@nice2dev/events 1.0.30 → 1.1.6

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.mjs CHANGED
@@ -1,52 +1,124 @@
1
- import { jsxs as i, jsx as e, Fragment as nn } from "react/jsx-runtime";
2
- import { NtdHeart as tn, NtdTrash as an, NtdPlay as ln, NtdImage as rn, NtdSparkle as fe, NtdCamera as Ne, NtdMicrophone as _e, NtdHelp as be, NtdMusic as q, NtdGamepad as ke, NtdThumbsUp as cn, NtdClipboardCheck as sn, NtdMedal as ue, NtdTrophy as on } from "@nice2dev/icons";
3
- import { NiceUpload as dn, NiceTextInput as T, NiceCardGroup as mn, NiceAvatarGroup as he, NiceAvatar as Z, NiceBadge as W, NiceButton as B, NiceSelect as ve, NiceAmountBreakdown as pn, NiceToggle as ge, NiceTabs as un, NiceTextArea as hn } from "@nice2dev/ui";
4
- import ne, { forwardRef as E, useState as f, useMemo as I, useCallback as O } from "react";
5
- import { NiceIcon as L } from "@nice2dev/ui-core";
6
- const vn = ({ item: z }) => {
7
- const [N, C] = f(!1), t = z.thumbnailUrl ?? z.url;
8
- return z.type === "video" ? /* @__PURE__ */ e("div", { className: "nice-event-media__video-thumb", children: /* @__PURE__ */ e(ln, { size: 26 }) }) : N || !t ? /* @__PURE__ */ e("div", { className: "nice-event-media__broken", title: "Image unavailable", children: /* @__PURE__ */ e(rn, { size: 24 }) }) : /* @__PURE__ */ e(
1
+ import { jsxs as a, jsx as e, Fragment as Ke } from "react/jsx-runtime";
2
+ import { NtdMove as bn, NtdHeart as dt, NtdTrash as Te, NtdPlay as wn, NtdImage as xn, NtdPlus as kn, NtdCheck as He, NtdHelp as Qe, NtdClose as ut, NtdSearch as mt, NtdQrCode as ht, NtdMail as In, NtdWheelchair as Cn, NtdSend as pt, NtdGiftCard as gt, NtdStar as ft, NtdLink as vt, NtdReceipt as yt, NtdCoins as _t, NtdArrowRight as Nt, NtdSparkle as Sn, NtdCamera as zn, NtdMicrophone as $n, NtdMusic as Re, NtdGamepad as An, NtdThumbsUp as bt, NtdClipboardCheck as wt, NtdMedal as dn, NtdTrophy as xt } from "@nice2dev/icons";
3
+ import { NiceUpload as qe, NiceTextInput as J, NiceCardGroup as Pn, NiceEmpty as kt, NiceButton as F, NiceSegmentedControl as Tn, NiceAvatarGroup as un, NiceAvatar as Be, NiceBadge as te, NiceSelect as Pe, NiceAmountBreakdown as It, NiceToggle as We, NiceTabs as Ct, NiceTextArea as Ze, NiceNumericInput as Je, NiceCollapse as St, NiceHtmlEditor as zt, NiceProgress as $t } from "@nice2dev/ui";
4
+ import Ue, { useState as E, useRef as ve, useCallback as G, forwardRef as ee, useMemo as X, useEffect as Oe } from "react";
5
+ import { NiceIcon as ie } from "@nice2dev/ui-core";
6
+ function At(s) {
7
+ return s.map((t, r) => ({ item: t, index: r, key: t.order ?? r })).sort((t, r) => t.key - r.key || t.index - r.index).map((t) => t.item);
8
+ }
9
+ function mn(s, t, r) {
10
+ if (t === r)
11
+ return [...s];
12
+ if (t < 0 || t >= s.length)
13
+ return [...s];
14
+ if (r < 0 || r >= s.length)
15
+ return [...s];
16
+ const n = [...s], [c] = n.splice(t, 1);
17
+ return n.splice(r, 0, c), n;
18
+ }
19
+ function Mn(s) {
20
+ const { items: t, onReorder: r, disabled: n = !1 } = s, [c, o] = E(null), [d, m] = E(null), [h, i] = E(!1), u = ve(null), p = G((w) => t.findIndex((k) => k.id === w), [t]), b = G(
21
+ (w, k) => {
22
+ const _ = p(w), $ = p(k);
23
+ _ < 0 || $ < 0 || _ === $ || r == null || r(mn([...t], _, $).map((l) => l.id));
24
+ },
25
+ [t, p, r]
26
+ ), f = G(() => {
27
+ o(null), m(null), i(!1), u.current = null;
28
+ }, []), g = G(
29
+ (w, k) => ({
30
+ role: "button",
31
+ // Explicitly off: this is a pointer-driven control, and leaving the
32
+ // native HTML5 drag enabled would fight it on desktop.
33
+ draggable: !1,
34
+ tabIndex: n ? -1 : 0,
35
+ "aria-grabbed": c === w,
36
+ onPointerDown: (_) => {
37
+ var y, v;
38
+ if (n || _.button !== 0 && _.pointerType === "mouse")
39
+ return;
40
+ (v = (y = _.currentTarget).setPointerCapture) == null || v.call(y, _.pointerId), o(w), i(!0), u.current = t.map((A) => A.id);
41
+ const $ = () => {
42
+ window.removeEventListener("pointerup", $), window.removeEventListener("pointercancel", l), i(!1), o(null), m(null);
43
+ }, l = () => {
44
+ window.removeEventListener("pointerup", $), window.removeEventListener("pointercancel", l), u.current && (r == null || r(u.current)), f();
45
+ };
46
+ window.addEventListener("pointerup", $), window.addEventListener("pointercancel", l);
47
+ },
48
+ onPointerEnter: () => {
49
+ n || !c || c === w || (m(w), b(c, w));
50
+ },
51
+ onKeyDown: (_) => {
52
+ if (n)
53
+ return;
54
+ if (_.key === " " || _.key === "Enter") {
55
+ _.preventDefault(), c === w ? f() : (o(w), u.current = t.map((A) => A.id));
56
+ return;
57
+ }
58
+ if (_.key === "Escape" && c === w) {
59
+ _.preventDefault(), u.current && (r == null || r(u.current)), f();
60
+ return;
61
+ }
62
+ if (c !== w)
63
+ return;
64
+ const l = _.key === "ArrowLeft" || _.key === "ArrowUp" ? -1 : _.key === "ArrowRight" || _.key === "ArrowDown" ? 1 : 0;
65
+ if (l === 0)
66
+ return;
67
+ _.preventDefault();
68
+ const y = p(w), v = y + l;
69
+ v < 0 || v >= t.length || r == null || r(mn([...t], y, v).map((A) => A.id));
70
+ },
71
+ ...k ? { "aria-label": k } : {}
72
+ }),
73
+ [c, b, n, f, p, t, r]
74
+ );
75
+ return { activeId: c, overId: d, getHandleProps: g, dragging: h };
76
+ }
77
+ const Pt = ({ item: s }) => {
78
+ const [t, r] = E(!1), n = s.thumbnailUrl ?? s.url;
79
+ return s.type === "video" ? /* @__PURE__ */ e("div", { className: "nice-event-media__video-thumb", children: /* @__PURE__ */ e(wn, { size: 26 }) }) : t || !n ? /* @__PURE__ */ e("div", { className: "nice-event-media__broken", title: "Image unavailable", children: /* @__PURE__ */ e(xn, { size: 24 }) }) : /* @__PURE__ */ e(
9
80
  "img",
10
81
  {
11
- src: t,
12
- alt: z.caption ?? "",
82
+ src: n,
83
+ alt: s.caption ?? "",
13
84
  className: "nice-event-media__thumb",
14
85
  loading: "lazy",
15
- onError: () => C(!0)
86
+ onError: () => r(!0)
16
87
  }
17
88
  );
18
- }, wn = E(
19
- function(N, C) {
89
+ }, Si = ee(
90
+ function(t, r) {
20
91
  const {
21
- items: t,
22
- onUpload: p,
23
- onDelete: u,
24
- onLike: m,
25
- onItemClick: h,
26
- layout: v = "grid",
27
- uploadEnabled: _ = !0,
28
- typeFilter: g = "all",
29
- className: S,
30
- style: b
31
- } = N, [l, o] = f(""), k = I(() => g === "all" ? t : t.filter((d) => d.type === g), [t, g]), y = (d) => {
32
- const n = d[0];
33
- !n || !p || (p(n, l.trim() || void 0), o(""));
34
- }, x = v === "list";
35
- return /* @__PURE__ */ i(
92
+ items: n,
93
+ onUpload: c,
94
+ onDelete: o,
95
+ onLike: d,
96
+ onItemClick: m,
97
+ layout: h = "grid",
98
+ uploadEnabled: i = !0,
99
+ typeFilter: u = "all",
100
+ onReorder: p,
101
+ className: b,
102
+ style: f
103
+ } = t, [g, w] = E(""), k = X(() => At(n), [n]), _ = X(() => u === "all" ? k : k.filter((A) => A.type === u), [k, u]), $ = !!p && u === "all", l = Mn({ items: k, onReorder: p, disabled: !$ }), y = (A) => {
104
+ const I = A[0];
105
+ !I || !c || (c(I, g.trim() || void 0), w(""));
106
+ }, v = h === "list";
107
+ return /* @__PURE__ */ a(
36
108
  "div",
37
109
  {
38
- ref: C,
39
- className: `nice-event-media nice-event-media--${v} ${S ?? ""}`,
40
- style: b,
110
+ ref: r,
111
+ className: `nice-event-media nice-event-media--${h} ${b ?? ""}`,
112
+ style: f,
41
113
  children: [
42
- /* @__PURE__ */ e("div", { className: "nice-event-media__header", children: /* @__PURE__ */ i("h3", { children: [
114
+ /* @__PURE__ */ e("div", { className: "nice-event-media__header", children: /* @__PURE__ */ a("h3", { children: [
43
115
  "Media (",
44
- k.length,
116
+ _.length,
45
117
  ")"
46
118
  ] }) }),
47
- _ && p && /* @__PURE__ */ i("div", { className: "nice-event-media__upload", children: [
119
+ i && c && /* @__PURE__ */ a("div", { className: "nice-event-media__upload", children: [
48
120
  /* @__PURE__ */ e(
49
- dn,
121
+ qe,
50
122
  {
51
123
  accept: "image/*,video/*",
52
124
  multiple: !1,
@@ -54,800 +126,3319 @@ const vn = ({ item: z }) => {
54
126
  onFilesSelected: y
55
127
  }
56
128
  ),
57
- /* @__PURE__ */ e(T, { value: l, onChange: o, placeholder: "Add a caption…" })
129
+ /* @__PURE__ */ e(J, { value: g, onChange: w, placeholder: "Add a caption…" })
58
130
  ] }),
59
- k.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-event-media__empty", children: "No media yet." }) : /* @__PURE__ */ e(
60
- mn,
131
+ _.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-event-media__empty", children: "No media yet." }) : /* @__PURE__ */ e(
132
+ Pn,
61
133
  {
62
- columns: x ? 1 : void 0,
134
+ columns: v ? 1 : void 0,
63
135
  minColumnWidth: 200,
64
136
  gap: 12,
65
137
  align: "stretch",
66
- children: k.map((d) => /* @__PURE__ */ i(
67
- "div",
68
- {
69
- className: `nice-event-media__card${x ? " nice-event-media__card--row" : ""}`,
70
- onClick: () => h == null ? void 0 : h(d),
71
- role: h ? "button" : void 0,
72
- tabIndex: h ? 0 : void 0,
73
- children: [
74
- /* @__PURE__ */ e(vn, { item: d }),
75
- /* @__PURE__ */ i("div", { className: "nice-event-media__body", children: [
76
- d.caption && /* @__PURE__ */ e("span", { className: "nice-event-media__caption", children: d.caption }),
77
- d.uploadedByName && /* @__PURE__ */ e("span", { className: "nice-event-media__uploader", children: d.uploadedByName }),
78
- /* @__PURE__ */ i("div", { className: "nice-event-media__actions", children: [
79
- m && /* @__PURE__ */ i(
80
- "button",
138
+ children: _.map((A, I) => {
139
+ const D = $ ? l.getHandleProps(A.id, `Move ${A.caption ?? `item ${I + 1}`}`) : null;
140
+ return /* @__PURE__ */ a(
141
+ "div",
142
+ {
143
+ className: `nice-event-media__card${v ? " nice-event-media__card--row" : ""}${l.activeId === A.id ? " nice-event-media__card--dragging" : ""}`,
144
+ onClick: () => m == null ? void 0 : m(A),
145
+ onPointerEnter: D == null ? void 0 : D.onPointerEnter,
146
+ role: m ? "button" : void 0,
147
+ tabIndex: m ? 0 : void 0,
148
+ children: [
149
+ D && /* @__PURE__ */ e(
150
+ "span",
151
+ {
152
+ className: "nice-event-media__grip",
153
+ role: D.role,
154
+ tabIndex: D.tabIndex,
155
+ "aria-grabbed": D["aria-grabbed"],
156
+ "aria-label": D["aria-label"],
157
+ draggable: D.draggable,
158
+ onPointerDown: D.onPointerDown,
159
+ onKeyDown: D.onKeyDown,
160
+ onClick: (N) => N.stopPropagation(),
161
+ children: /* @__PURE__ */ e(bn, { size: 14 })
162
+ }
163
+ ),
164
+ /* @__PURE__ */ e(Pt, { item: A }),
165
+ /* @__PURE__ */ a("div", { className: "nice-event-media__body", children: [
166
+ A.caption && /* @__PURE__ */ e("span", { className: "nice-event-media__caption", children: A.caption }),
167
+ A.uploadedByName && /* @__PURE__ */ e("span", { className: "nice-event-media__uploader", children: A.uploadedByName }),
168
+ /* @__PURE__ */ a("div", { className: "nice-event-media__actions", children: [
169
+ d && /* @__PURE__ */ a(
170
+ "button",
171
+ {
172
+ type: "button",
173
+ className: "nice-event-media__action",
174
+ onClick: (N) => {
175
+ N.stopPropagation(), d(A.id);
176
+ },
177
+ "aria-label": "Like",
178
+ children: [
179
+ /* @__PURE__ */ e(dt, { size: 15 }),
180
+ " ",
181
+ A.likes ?? 0
182
+ ]
183
+ }
184
+ ),
185
+ o && /* @__PURE__ */ e(
186
+ "button",
187
+ {
188
+ type: "button",
189
+ className: "nice-event-media__action nice-event-media__action--danger",
190
+ onClick: (N) => {
191
+ N.stopPropagation(), o(A.id);
192
+ },
193
+ "aria-label": "Delete",
194
+ children: /* @__PURE__ */ e(Te, { size: 15 })
195
+ }
196
+ )
197
+ ] })
198
+ ] })
199
+ ]
200
+ },
201
+ A.id
202
+ );
203
+ })
204
+ }
205
+ )
206
+ ]
207
+ }
208
+ );
209
+ }
210
+ ), ye = ({
211
+ title: s,
212
+ description: t,
213
+ icon: r,
214
+ action: n,
215
+ className: c
216
+ }) => /* @__PURE__ */ e(
217
+ kt,
218
+ {
219
+ size: "sm",
220
+ title: s,
221
+ description: t,
222
+ icon: r,
223
+ action: n,
224
+ className: c
225
+ }
226
+ ), zi = ee(
227
+ function(t, r) {
228
+ const {
229
+ items: n,
230
+ layout: c = "grid",
231
+ onReorder: o,
232
+ onItemAdd: d,
233
+ onItemRemove: m,
234
+ onCaptionChange: h,
235
+ onItemClick: i,
236
+ previewMode: u = !1,
237
+ transition: p = "fade",
238
+ defaultDurationMs: b = 3e3,
239
+ autoPlay: f = !0,
240
+ disabled: g = !1,
241
+ readOnly: w = !1,
242
+ size: k = "md",
243
+ className: _,
244
+ style: $
245
+ } = t, [l, y] = E(0), [v, A] = E(null), [I, D] = E(""), N = g || w, L = !!o && !N, V = Mn({ items: n, onReorder: o, disabled: !L }), B = n.length > 0 ? Math.min(l, n.length - 1) : 0, C = n[B], O = (C == null ? void 0 : C.durationMs) ?? b;
246
+ Oe(() => {
247
+ if (!u || !f || n.length < 2)
248
+ return;
249
+ const M = window.setTimeout(
250
+ () => y((j) => (j + 1) % n.length),
251
+ Math.max(250, O)
252
+ );
253
+ return () => window.clearTimeout(M);
254
+ }, [u, f, n.length, B, O]);
255
+ const z = X(
256
+ () => n.reduce((M, j) => M + (j.durationMs ?? b), 0),
257
+ [n, b]
258
+ ), P = (M) => {
259
+ h == null || h(M, I), A(null), D("");
260
+ };
261
+ return n.length === 0 ? /* @__PURE__ */ e("div", { ref: r, className: `nice-media-collage ${_ ?? ""}`, style: $, children: /* @__PURE__ */ e(
262
+ ye,
263
+ {
264
+ icon: /* @__PURE__ */ e(xn, { size: 28 }),
265
+ title: "Nothing in the collage yet",
266
+ description: "Add photos or video to start arranging them.",
267
+ action: d && !N ? /* @__PURE__ */ e(qe, { accept: "image/*,video/*", multiple: !0, onFilesSelected: d }) : void 0
268
+ }
269
+ ) }) : u ? /* @__PURE__ */ a(
270
+ "div",
271
+ {
272
+ ref: r,
273
+ className: `nice-media-collage nice-media-collage--preview nice-media-collage--${p} ${_ ?? ""}`,
274
+ style: $,
275
+ children: [
276
+ /* @__PURE__ */ a("div", { className: "nice-media-collage__stage", "aria-live": "polite", children: [
277
+ (C == null ? void 0 : C.type) === "video" ? /* @__PURE__ */ e(
278
+ "video",
279
+ {
280
+ className: "nice-media-collage__slide",
281
+ src: C.mediaUrl,
282
+ controls: !0
283
+ },
284
+ C.id
285
+ ) : /* @__PURE__ */ e(
286
+ "img",
287
+ {
288
+ className: "nice-media-collage__slide",
289
+ src: C == null ? void 0 : C.mediaUrl,
290
+ alt: (C == null ? void 0 : C.caption) ?? ""
291
+ },
292
+ C == null ? void 0 : C.id
293
+ ),
294
+ (C == null ? void 0 : C.caption) && /* @__PURE__ */ e("p", { className: "nice-media-collage__slide-caption", children: C.caption })
295
+ ] }),
296
+ /* @__PURE__ */ a("div", { className: "nice-media-collage__playbar", children: [
297
+ /* @__PURE__ */ e(
298
+ F,
299
+ {
300
+ size: "sm",
301
+ variant: "ghost",
302
+ onClick: () => y((M) => (M - 1 + n.length) % n.length),
303
+ children: "Previous"
304
+ }
305
+ ),
306
+ /* @__PURE__ */ a("span", { className: "nice-media-collage__counter", children: [
307
+ B + 1,
308
+ " / ",
309
+ n.length
310
+ ] }),
311
+ /* @__PURE__ */ e(
312
+ F,
313
+ {
314
+ size: "sm",
315
+ variant: "ghost",
316
+ onClick: () => y((M) => (M + 1) % n.length),
317
+ children: "Next"
318
+ }
319
+ )
320
+ ] })
321
+ ]
322
+ }
323
+ ) : /* @__PURE__ */ a(
324
+ "div",
325
+ {
326
+ ref: r,
327
+ className: `nice-media-collage nice-media-collage--${c} nice-media-collage--${k} ${_ ?? ""}`,
328
+ style: $,
329
+ children: [
330
+ /* @__PURE__ */ a("div", { className: "nice-media-collage__toolbar", children: [
331
+ /* @__PURE__ */ e(
332
+ Tn,
333
+ {
334
+ size: "sm",
335
+ value: c,
336
+ readOnly: !0,
337
+ options: [
338
+ { value: "sequence", label: "Sequence" },
339
+ { value: "grid", label: "Grid" },
340
+ { value: "mosaic", label: "Mosaic" }
341
+ ]
342
+ }
343
+ ),
344
+ /* @__PURE__ */ a("span", { className: "nice-media-collage__duration", children: [
345
+ n.length,
346
+ " item",
347
+ n.length === 1 ? "" : "s",
348
+ " · ",
349
+ Math.round(z / 1e3),
350
+ "s"
351
+ ] }),
352
+ d && !N && /* @__PURE__ */ e(
353
+ qe,
354
+ {
355
+ accept: "image/*,video/*",
356
+ multiple: !0,
357
+ imagePreview: !1,
358
+ onFilesSelected: d
359
+ }
360
+ )
361
+ ] }),
362
+ /* @__PURE__ */ e(
363
+ "ol",
364
+ {
365
+ className: "nice-media-collage__tiles",
366
+ "aria-label": "Collage order",
367
+ "aria-busy": V.dragging,
368
+ children: n.map((M, j) => {
369
+ const W = L ? V.getHandleProps(M.id, `Move ${M.caption ?? `item ${j + 1}`}`) : null;
370
+ return /* @__PURE__ */ a(
371
+ "li",
372
+ {
373
+ className: `nice-media-collage__tile${V.activeId === M.id ? " nice-media-collage__tile--active" : ""}${V.overId === M.id ? " nice-media-collage__tile--over" : ""}`,
374
+ onPointerEnter: W == null ? void 0 : W.onPointerEnter,
375
+ children: [
376
+ /* @__PURE__ */ e("span", { className: "nice-media-collage__index", "aria-hidden": "true", children: j + 1 }),
377
+ /* @__PURE__ */ e(
378
+ "button",
379
+ {
380
+ type: "button",
381
+ className: "nice-media-collage__thumb-button",
382
+ onClick: () => i == null ? void 0 : i(M),
383
+ disabled: !i,
384
+ children: M.type === "video" ? /* @__PURE__ */ e("span", { className: "nice-media-collage__video-thumb", children: /* @__PURE__ */ e(wn, { size: 22 }) }) : /* @__PURE__ */ e(
385
+ "img",
386
+ {
387
+ className: "nice-media-collage__thumb",
388
+ src: M.mediaUrl,
389
+ alt: M.caption ?? "",
390
+ loading: "lazy"
391
+ }
392
+ )
393
+ }
394
+ ),
395
+ v === M.id ? /* @__PURE__ */ e(
396
+ J,
397
+ {
398
+ value: I,
399
+ onChange: D,
400
+ placeholder: "Caption",
401
+ autoFocus: !0,
402
+ size: "sm",
403
+ onBlur: () => P(M.id),
404
+ onKeyDown: (S) => {
405
+ S.key === "Enter" && P(M.id), S.key === "Escape" && A(null);
406
+ }
407
+ }
408
+ ) : /* @__PURE__ */ e(
409
+ "button",
410
+ {
411
+ type: "button",
412
+ className: "nice-media-collage__caption",
413
+ disabled: !h || N,
414
+ onClick: () => {
415
+ A(M.id), D(M.caption ?? "");
416
+ },
417
+ children: M.caption || /* @__PURE__ */ e("em", { children: "Add a caption" })
418
+ }
419
+ ),
420
+ /* @__PURE__ */ a("div", { className: "nice-media-collage__tile-actions", children: [
421
+ W && /* @__PURE__ */ e(
422
+ "span",
81
423
  {
82
- type: "button",
83
- className: "nice-event-media__action",
84
- onClick: (n) => {
85
- n.stopPropagation(), m(d.id);
86
- },
87
- "aria-label": "Like",
88
- children: [
89
- /* @__PURE__ */ e(tn, { size: 15 }),
90
- " ",
91
- d.likes ?? 0
92
- ]
424
+ className: "nice-media-collage__grip",
425
+ role: W.role,
426
+ tabIndex: W.tabIndex,
427
+ "aria-grabbed": W["aria-grabbed"],
428
+ "aria-label": W["aria-label"],
429
+ draggable: W.draggable,
430
+ onPointerDown: W.onPointerDown,
431
+ onKeyDown: W.onKeyDown,
432
+ children: /* @__PURE__ */ e(bn, { size: 14 })
93
433
  }
94
434
  ),
95
- u && /* @__PURE__ */ e(
96
- "button",
435
+ m && !w && /* @__PURE__ */ e(
436
+ F,
97
437
  {
98
- type: "button",
99
- className: "nice-event-media__action nice-event-media__action--danger",
100
- onClick: (n) => {
101
- n.stopPropagation(), u(d.id);
102
- },
103
- "aria-label": "Delete",
104
- children: /* @__PURE__ */ e(an, { size: 15 })
438
+ size: "sm",
439
+ variant: "ghost",
440
+ ariaLabel: `Remove ${M.caption ?? `item ${j + 1}`}`,
441
+ disabled: g,
442
+ onClick: () => m(M.id),
443
+ children: /* @__PURE__ */ e(Te, { size: 14 })
105
444
  }
106
445
  )
107
446
  ] })
108
- ] })
109
- ]
447
+ ]
448
+ },
449
+ M.id
450
+ );
451
+ })
452
+ }
453
+ ),
454
+ d && !N && n.length > 0 && /* @__PURE__ */ a("p", { className: "nice-media-collage__hint", children: [
455
+ /* @__PURE__ */ e(kn, { size: 12 }),
456
+ " Drag a tile, or focus one and press Space then the arrow keys."
457
+ ] })
458
+ ]
459
+ }
460
+ );
461
+ }
462
+ );
463
+ function Ee(s) {
464
+ const t = s.toLowerCase();
465
+ return ["active", "live", "published", "completed", "confirmed"].includes(t) ? "success" : ["cancelled", "canceled", "rejected", "failed"].includes(t) ? "error" : ["scheduled", "pending", "planning"].includes(t) ? "info" : ["draft", "archived"].includes(t) ? "secondary" : "warning";
466
+ }
467
+ const Tt = {
468
+ micro: [],
469
+ compact: ["details", "location", "budget"],
470
+ normal: ["details", "location", "schedule", "participants", "tasks", "surveys", "budget"],
471
+ full: [
472
+ "details",
473
+ "location",
474
+ "schedule",
475
+ "participants",
476
+ "tasks",
477
+ "surveys",
478
+ "vendors",
479
+ "budget",
480
+ "documents",
481
+ "settings"
482
+ ]
483
+ }, $i = ee(
484
+ function(t, r) {
485
+ var an, sn, rn, ln, cn, on;
486
+ const {
487
+ event: n,
488
+ participants: c = [],
489
+ surveys: o = [],
490
+ billing: d = [],
491
+ scheduleItems: m = [],
492
+ tasks: h = [],
493
+ vendors: i = [],
494
+ documents: u = [],
495
+ displayMode: p = "normal",
496
+ tabs: b,
497
+ activeTab: f,
498
+ onTabChange: g,
499
+ tabsIconOnly: w = !0,
500
+ tabsCentered: k = "auto",
501
+ countLocation: _ = "bottom",
502
+ showDetails: $ = !0,
503
+ showLocation: l = !0,
504
+ showSchedule: y = !0,
505
+ showParticipants: v = !0,
506
+ showTasks: A = !0,
507
+ showSurveys: I = !0,
508
+ showVendors: D = !0,
509
+ showBudget: N = !0,
510
+ showDocuments: L = !0,
511
+ showSettings: V = !0,
512
+ editable: B = !1,
513
+ onSave: C,
514
+ onPublish: O,
515
+ onShare: z,
516
+ onExport: P,
517
+ onUpdateEvent: M,
518
+ onUpdateLocation: j,
519
+ onAddSurvey: W,
520
+ onSurveyRespond: S,
521
+ onAddBilling: Y,
522
+ className: q,
523
+ style: Q
524
+ } = t, [R, ne] = E(n.title), [H, _e] = E(n.description ?? ""), [le, me] = E(n.startDate ?? ""), [Ne, Me] = E(n.endDate ?? ""), [be, he] = E(((an = n.location) == null ? void 0 : an.name) ?? ""), [we, Ve] = E(((sn = n.location) == null ? void 0 : sn.address) ?? ""), [pe, oe] = E(((rn = n.location) == null ? void 0 : rn.virtualUrl) ?? ""), [re, Ie] = E(((ln = n.location) == null ? void 0 : ln.isVirtual) ?? !1), [ge, Ce] = E(""), [fe, Fe] = E("single"), [Se, ze] = E(""), [de, $e] = E(""), [xe, T] = E(""), [U, K] = E("PLN"), Z = {
525
+ details: $,
526
+ location: l,
527
+ schedule: y,
528
+ participants: v,
529
+ tasks: A,
530
+ surveys: I,
531
+ vendors: D,
532
+ budget: N,
533
+ documents: L,
534
+ settings: V
535
+ }, ue = (b ?? Tt[p]).filter((x) => Z[x] !== !1), [De, On] = E(ue[0] ?? "details"), Rn = f ?? De, Un = G(
536
+ (x) => {
537
+ const ce = x;
538
+ f === void 0 && On(ce), g == null || g(ce);
539
+ },
540
+ [f, g]
541
+ ), Yn = G(() => {
542
+ M == null || M({
543
+ title: R,
544
+ description: H || void 0,
545
+ startDate: le || void 0,
546
+ endDate: Ne || void 0
547
+ });
548
+ }, [R, H, le, Ne, M]), Xn = G(() => {
549
+ j == null || j({
550
+ name: be,
551
+ address: we || void 0,
552
+ virtualUrl: pe || void 0,
553
+ isVirtual: re
554
+ });
555
+ }, [be, we, pe, re, j]), Vn = G(() => {
556
+ if (!ge.trim() || !W)
557
+ return;
558
+ const x = Se.split(",").map((ce) => ce.trim()).filter(Boolean);
559
+ W(ge.trim(), fe, x.length > 0 ? x : void 0), Ce(""), ze("");
560
+ }, [ge, fe, Se, W]), Fn = G(() => {
561
+ !de.trim() || !Y || (Y({
562
+ label: de.trim(),
563
+ amount: parseFloat(xe) || 0,
564
+ currency: U
565
+ }), $e(""), T(""));
566
+ }, [de, xe, U, Y]), Wn = X(
567
+ () => d.map((x) => ({
568
+ label: x.label,
569
+ amount: x.amount
570
+ })),
571
+ [d]
572
+ ), qn = X(() => d.reduce((x, ce) => x + ce.amount, 0), [d]), jn = ((cn = d[0]) == null ? void 0 : cn.currency) ?? "PLN", Gn = /* @__PURE__ */ a("div", { className: "nice-event-planning__form", children: [
573
+ /* @__PURE__ */ e(
574
+ J,
575
+ {
576
+ label: "Title",
577
+ value: R,
578
+ onChange: ne,
579
+ readOnly: !B
580
+ }
581
+ ),
582
+ /* @__PURE__ */ e(
583
+ Ze,
584
+ {
585
+ label: "Description",
586
+ value: H,
587
+ onChange: _e,
588
+ readOnly: !B,
589
+ rows: 3
590
+ }
591
+ ),
592
+ /* @__PURE__ */ a("div", { className: "nice-event-planning__row", children: [
593
+ /* @__PURE__ */ a("label", { className: "nice-field", children: [
594
+ /* @__PURE__ */ e("span", { className: "nice-field__label", children: "Start" }),
595
+ /* @__PURE__ */ e(
596
+ "input",
597
+ {
598
+ className: "nice-input",
599
+ type: "datetime-local",
600
+ value: le,
601
+ onChange: (x) => me(x.target.value),
602
+ readOnly: !B
603
+ }
604
+ )
605
+ ] }),
606
+ /* @__PURE__ */ a("label", { className: "nice-field", children: [
607
+ /* @__PURE__ */ e("span", { className: "nice-field__label", children: "End" }),
608
+ /* @__PURE__ */ e(
609
+ "input",
610
+ {
611
+ className: "nice-input",
612
+ type: "datetime-local",
613
+ value: Ne,
614
+ onChange: (x) => Me(x.target.value),
615
+ readOnly: !B
616
+ }
617
+ )
618
+ ] })
619
+ ] }),
620
+ B && /* @__PURE__ */ e(
621
+ F,
622
+ {
623
+ variant: "primary",
624
+ leftIcon: /* @__PURE__ */ e(ie, { name: "check", size: "sm" }),
625
+ onClick: Yn,
626
+ children: "Save details"
627
+ }
628
+ )
629
+ ] }), Kn = /* @__PURE__ */ a("div", { className: "nice-event-planning__form", children: [
630
+ /* @__PURE__ */ e(
631
+ We,
632
+ {
633
+ label: "Virtual event",
634
+ checked: re,
635
+ onChange: Ie,
636
+ disabled: !B
637
+ }
638
+ ),
639
+ /* @__PURE__ */ e(
640
+ J,
641
+ {
642
+ label: "Venue name",
643
+ value: be,
644
+ onChange: he,
645
+ readOnly: !B
646
+ }
647
+ ),
648
+ re ? /* @__PURE__ */ e(
649
+ J,
650
+ {
651
+ label: "Virtual URL",
652
+ value: pe,
653
+ onChange: oe,
654
+ readOnly: !B
655
+ }
656
+ ) : /* @__PURE__ */ e(
657
+ J,
658
+ {
659
+ label: "Address",
660
+ value: we,
661
+ onChange: Ve,
662
+ readOnly: !B
663
+ }
664
+ ),
665
+ B && /* @__PURE__ */ e(
666
+ F,
667
+ {
668
+ variant: "primary",
669
+ leftIcon: /* @__PURE__ */ e(ie, { name: "check", size: "sm" }),
670
+ onClick: Xn,
671
+ children: "Save location"
672
+ }
673
+ )
674
+ ] }), Hn = /* @__PURE__ */ e("div", { className: "nice-event-planning__participants", children: c.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-event-planning__empty", children: "No participants yet." }) : /* @__PURE__ */ a(Ke, { children: [
675
+ /* @__PURE__ */ e(un, { max: 8, children: c.map((x) => /* @__PURE__ */ e(Be, { name: x.name, src: x.avatarUrl }, x.id)) }),
676
+ /* @__PURE__ */ e("ul", { className: "nice-event-planning__participant-list", children: c.map((x) => /* @__PURE__ */ a("li", { className: "nice-event-planning__participant", children: [
677
+ /* @__PURE__ */ e(Be, { name: x.name, src: x.avatarUrl, size: "sm" }),
678
+ /* @__PURE__ */ e("span", { className: "nice-event-planning__participant-name", children: x.name }),
679
+ /* @__PURE__ */ e(te, { size: "xs", subtle: !0, variant: Ee(x.status), children: x.status })
680
+ ] }, x.id)) })
681
+ ] }) }), Qn = /* @__PURE__ */ a("div", { className: "nice-event-planning__form", children: [
682
+ o.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-event-planning__empty", children: "No surveys yet." }) : o.map((x) => /* @__PURE__ */ a("div", { className: "nice-event-planning__survey", children: [
683
+ /* @__PURE__ */ e("strong", { children: x.question }),
684
+ " ",
685
+ /* @__PURE__ */ e(te, { size: "xs", outline: !0, variant: "info", children: x.type }),
686
+ x.options && /* @__PURE__ */ e("div", { className: "nice-event-planning__survey-options", children: x.options.map((ce, ot) => /* @__PURE__ */ e(
687
+ F,
688
+ {
689
+ size: "sm",
690
+ variant: "outline",
691
+ onClick: () => S == null ? void 0 : S(x.id, ce),
692
+ children: ce
693
+ },
694
+ ot
695
+ )) }),
696
+ x.responses && /* @__PURE__ */ a("span", { className: "nice-event-planning__muted", children: [
697
+ x.responses.length,
698
+ " responses"
699
+ ] })
700
+ ] }, x.id)),
701
+ B && W && /* @__PURE__ */ a("div", { className: "nice-event-planning__form", children: [
702
+ /* @__PURE__ */ e(
703
+ J,
704
+ {
705
+ label: "New survey question",
706
+ value: ge,
707
+ onChange: Ce,
708
+ placeholder: "Question"
709
+ }
710
+ ),
711
+ /* @__PURE__ */ e(
712
+ Pe,
713
+ {
714
+ label: "Type",
715
+ value: fe,
716
+ onChange: (x) => Fe(x),
717
+ options: [
718
+ { value: "single", label: "Single choice" },
719
+ { value: "multiple", label: "Multiple choice" },
720
+ { value: "text", label: "Free text" },
721
+ { value: "rating", label: "Rating" }
722
+ ]
723
+ }
724
+ ),
725
+ /* @__PURE__ */ e(
726
+ J,
727
+ {
728
+ label: "Options (comma-separated)",
729
+ value: Se,
730
+ onChange: ze,
731
+ placeholder: "Yes, No, Maybe"
732
+ }
733
+ ),
734
+ /* @__PURE__ */ e(
735
+ F,
736
+ {
737
+ variant: "primary",
738
+ leftIcon: /* @__PURE__ */ e(ie, { name: "plus", size: "sm" }),
739
+ onClick: Vn,
740
+ disabled: !ge.trim(),
741
+ children: "Add survey"
742
+ }
743
+ )
744
+ ] })
745
+ ] }), Zn = /* @__PURE__ */ a("div", { className: "nice-event-planning__form", children: [
746
+ d.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-event-planning__empty", children: "No billing items yet." }) : /* @__PURE__ */ e(
747
+ It,
748
+ {
749
+ lines: [...Wn, { label: "Total", amount: qn, isSummary: !0 }],
750
+ currency: jn
751
+ }
752
+ ),
753
+ B && Y && /* @__PURE__ */ a("div", { className: "nice-event-planning__row", children: [
754
+ /* @__PURE__ */ e(
755
+ J,
756
+ {
757
+ label: "Item",
758
+ value: de,
759
+ onChange: $e,
760
+ placeholder: "Catering"
761
+ }
762
+ ),
763
+ /* @__PURE__ */ e(
764
+ J,
765
+ {
766
+ label: "Amount",
767
+ value: xe,
768
+ onChange: T,
769
+ placeholder: "0.00"
770
+ }
771
+ ),
772
+ /* @__PURE__ */ e(
773
+ Pe,
774
+ {
775
+ label: "Currency",
776
+ value: U,
777
+ onChange: (x) => K(x),
778
+ options: ["PLN", "EUR", "USD", "GBP"]
779
+ }
780
+ ),
781
+ /* @__PURE__ */ e(
782
+ F,
783
+ {
784
+ variant: "primary",
785
+ leftIcon: /* @__PURE__ */ e(ie, { name: "plus", size: "sm" }),
786
+ onClick: Fn,
787
+ disabled: !de.trim(),
788
+ children: "Add"
789
+ }
790
+ )
791
+ ] })
792
+ ] }), Jn = /* @__PURE__ */ a("div", { className: "nice-event-planning__form", children: [
793
+ /* @__PURE__ */ e(We, { label: "Public event", checked: n.isPublic ?? !1, disabled: !B }),
794
+ /* @__PURE__ */ e(
795
+ J,
796
+ {
797
+ label: "Max participants",
798
+ value: n.maxParticipants != null ? String(n.maxParticipants) : "",
799
+ onChange: () => {
800
+ },
801
+ readOnly: !B
802
+ }
803
+ ),
804
+ /* @__PURE__ */ a("div", { className: "nice-event-planning__muted", children: [
805
+ "Host: ",
806
+ n.hostName,
807
+ " · Created ",
808
+ new Date(n.createdAt).toLocaleDateString()
809
+ ] })
810
+ ] }), et = /* @__PURE__ */ e("div", { className: "nice-event-planning__list", children: m.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-event-planning__empty", children: "No agenda items yet." }) : /* @__PURE__ */ e("ul", { className: "nice-event-planning__schedule", children: m.map((x) => /* @__PURE__ */ a("li", { className: "nice-event-planning__schedule-item", children: [
811
+ /* @__PURE__ */ a("span", { className: "nice-event-planning__schedule-time", children: [
812
+ /* @__PURE__ */ e(ie, { name: "clock", size: "sm" }),
813
+ x.startTime ?? "",
814
+ x.endTime ? `–${x.endTime}` : ""
815
+ ] }),
816
+ /* @__PURE__ */ e("span", { className: "nice-event-planning__schedule-title", children: x.title }),
817
+ x.location && /* @__PURE__ */ e("span", { className: "nice-event-planning__muted", children: x.location })
818
+ ] }, x.id)) }) }), nt = /* @__PURE__ */ e("div", { className: "nice-event-planning__list", children: h.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-event-planning__empty", children: "No tasks yet." }) : /* @__PURE__ */ e("ul", { className: "nice-event-planning__tasks", children: h.map((x) => /* @__PURE__ */ a("li", { className: "nice-event-planning__task", children: [
819
+ /* @__PURE__ */ e(We, { label: x.title, checked: x.done ?? !1, disabled: !B }),
820
+ x.assigneeName && /* @__PURE__ */ e(te, { size: "xs", subtle: !0, variant: "info", children: x.assigneeName }),
821
+ x.dueDate && /* @__PURE__ */ e("span", { className: "nice-event-planning__muted", children: x.dueDate })
822
+ ] }, x.id)) }) }), tt = /* @__PURE__ */ e("div", { className: "nice-event-planning__list", children: i.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-event-planning__empty", children: "No vendors yet." }) : /* @__PURE__ */ e("ul", { className: "nice-event-planning__vendors", children: i.map((x) => /* @__PURE__ */ a("li", { className: "nice-event-planning__vendor", children: [
823
+ /* @__PURE__ */ e(ie, { name: "briefcase", size: "sm" }),
824
+ /* @__PURE__ */ e("span", { className: "nice-event-planning__vendor-name", children: x.name }),
825
+ x.category && /* @__PURE__ */ e("span", { className: "nice-event-planning__muted", children: x.category }),
826
+ x.status && /* @__PURE__ */ e(te, { size: "xs", subtle: !0, variant: Ee(x.status), children: x.status }),
827
+ x.cost != null && /* @__PURE__ */ a("span", { className: "nice-event-planning__vendor-cost", children: [
828
+ x.cost,
829
+ " ",
830
+ x.currency ?? ""
831
+ ] })
832
+ ] }, x.id)) }) }), it = /* @__PURE__ */ e("div", { className: "nice-event-planning__list", children: u.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-event-planning__empty", children: "No documents yet." }) : /* @__PURE__ */ e("ul", { className: "nice-event-planning__documents", children: u.map((x) => /* @__PURE__ */ a("li", { className: "nice-event-planning__document", children: [
833
+ /* @__PURE__ */ e(ie, { name: "file", size: "sm" }),
834
+ /* @__PURE__ */ e("span", { className: "nice-event-planning__document-name", children: x.name }),
835
+ x.fileType && /* @__PURE__ */ e(te, { size: "xs", outline: !0, variant: "secondary", children: x.fileType }),
836
+ x.sizeKb != null && /* @__PURE__ */ a("span", { className: "nice-event-planning__muted", children: [
837
+ x.sizeKb,
838
+ " KB"
839
+ ] })
840
+ ] }, x.id)) }) }), at = {
841
+ details: Gn,
842
+ location: Kn,
843
+ schedule: et,
844
+ participants: Hn,
845
+ tasks: nt,
846
+ surveys: Qn,
847
+ vendors: tt,
848
+ budget: Zn,
849
+ documents: it,
850
+ settings: Jn
851
+ }, st = {
852
+ details: "file",
853
+ location: "home",
854
+ schedule: "clock",
855
+ participants: "users",
856
+ tasks: "list",
857
+ surveys: "clipboard",
858
+ vendors: "briefcase",
859
+ budget: "dollar",
860
+ documents: "folder",
861
+ settings: "settings"
862
+ }, rt = {
863
+ schedule: m.length || void 0,
864
+ participants: c.length || void 0,
865
+ tasks: h.length || void 0,
866
+ surveys: o.length || void 0,
867
+ vendors: i.length || void 0,
868
+ budget: d.length || void 0,
869
+ documents: u.length || void 0
870
+ }, lt = ue.map((x) => ({
871
+ id: x,
872
+ label: x.charAt(0).toUpperCase() + x.slice(1),
873
+ icon: /* @__PURE__ */ e(ie, { name: st[x], size: "sm" }),
874
+ badge: rt[x],
875
+ content: at[x]
876
+ })), ct = /* @__PURE__ */ a("div", { className: "nice-event-planning__toolbar", children: [
877
+ /* @__PURE__ */ a("div", { className: "nice-event-planning__toolbar-title", children: [
878
+ /* @__PURE__ */ e(ie, { name: "calendar", size: "md" }),
879
+ /* @__PURE__ */ e("span", { className: "nice-event-planning__title", children: n.title }),
880
+ /* @__PURE__ */ e(te, { size: "sm", variant: Ee(n.status), children: n.status })
881
+ ] }),
882
+ /* @__PURE__ */ e("span", { className: "nice-event-planning__toolbar-spacer" }),
883
+ /* @__PURE__ */ a("div", { className: "nice-event-planning__toolbar-actions", children: [
884
+ C && /* @__PURE__ */ e(
885
+ F,
886
+ {
887
+ size: "sm",
888
+ variant: "primary",
889
+ leftIcon: /* @__PURE__ */ e(ie, { name: "check", size: "sm" }),
890
+ onClick: () => C({ title: R, description: H }),
891
+ children: "Save"
892
+ }
893
+ ),
894
+ O && /* @__PURE__ */ e(
895
+ F,
896
+ {
897
+ size: "sm",
898
+ variant: "success",
899
+ leftIcon: /* @__PURE__ */ e(ie, { name: "upload", size: "sm" }),
900
+ onClick: O,
901
+ children: "Publish"
902
+ }
903
+ ),
904
+ z && /* @__PURE__ */ e(
905
+ F,
906
+ {
907
+ size: "sm",
908
+ variant: "ghost",
909
+ leftIcon: /* @__PURE__ */ e(ie, { name: "link", size: "sm" }),
910
+ onClick: z,
911
+ children: "Share"
912
+ }
913
+ ),
914
+ P && /* @__PURE__ */ e(
915
+ F,
916
+ {
917
+ size: "sm",
918
+ variant: "ghost",
919
+ leftIcon: /* @__PURE__ */ e(ie, { name: "download", size: "sm" }),
920
+ onClick: P,
921
+ children: "Export"
922
+ }
923
+ )
924
+ ] })
925
+ ] });
926
+ return p === "micro" ? /* @__PURE__ */ e(
927
+ "div",
928
+ {
929
+ ref: r,
930
+ className: `nice-event-planning nice-event-planning--micro ${q ?? ""}`,
931
+ style: Q,
932
+ children: /* @__PURE__ */ a("div", { className: "nice-event-planning__micro", children: [
933
+ /* @__PURE__ */ e(ie, { name: "calendar", size: "md" }),
934
+ /* @__PURE__ */ a("div", { className: "nice-event-planning__micro-body", children: [
935
+ /* @__PURE__ */ e("span", { className: "nice-event-planning__title", children: n.title }),
936
+ /* @__PURE__ */ a("span", { className: "nice-event-planning__muted", children: [
937
+ n.startDate ? new Date(n.startDate).toLocaleString() : "No date",
938
+ (on = n.location) != null && on.name ? ` · ${n.location.name}` : ""
939
+ ] })
940
+ ] }),
941
+ /* @__PURE__ */ e(te, { size: "sm", variant: Ee(n.status), children: n.status }),
942
+ c.length > 0 && /* @__PURE__ */ e(un, { max: 4, size: "sm", children: c.map((x) => /* @__PURE__ */ e(Be, { name: x.name, src: x.avatarUrl, size: "sm" }, x.id)) })
943
+ ] })
944
+ }
945
+ ) : /* @__PURE__ */ a(
946
+ "div",
947
+ {
948
+ ref: r,
949
+ className: `nice-event-planning nice-event-planning--${p} ${q ?? ""}`,
950
+ style: Q,
951
+ children: [
952
+ ct,
953
+ /* @__PURE__ */ e(
954
+ Ct,
955
+ {
956
+ tabs: lt,
957
+ activeTab: Rn,
958
+ onChange: Un,
959
+ iconOnly: w,
960
+ centered: k,
961
+ countLocation: _
962
+ }
963
+ )
964
+ ]
965
+ }
966
+ );
967
+ }
968
+ );
969
+ function Mt(s) {
970
+ switch (s) {
971
+ case "confirmed":
972
+ return "success";
973
+ case "checked-in":
974
+ return "info";
975
+ case "declined":
976
+ return "error";
977
+ case "no-show":
978
+ return "warning";
979
+ default:
980
+ return "secondary";
981
+ }
982
+ }
983
+ const je = ({
984
+ participant: s,
985
+ showRole: t = !0,
986
+ showStatus: r = !0,
987
+ meta: n,
988
+ children: c,
989
+ size: o = "md",
990
+ className: d
991
+ }) => /* @__PURE__ */ a("li", { className: `nice-participant-row nice-participant-row--${o} ${d ?? ""}`, children: [
992
+ /* @__PURE__ */ e(Be, { name: s.name, src: s.avatarUrl, size: o }),
993
+ /* @__PURE__ */ e("span", { className: "nice-participant-row__name", children: s.name }),
994
+ t && s.role && /* @__PURE__ */ e(te, { size: "xs", outline: !0, variant: "info", children: s.role }),
995
+ r && s.status && /* @__PURE__ */ e(te, { size: "xs", subtle: !0, variant: Mt(s.status), children: s.status }),
996
+ n && /* @__PURE__ */ e("span", { className: "nice-participant-row__meta", children: n }),
997
+ c && /* @__PURE__ */ e("span", { className: "nice-participant-row__trailing", children: c })
998
+ ] }), Dt = /^[^\s@,;]+@[^\s@,;]+\.[^\s@,;]{2,}$/, hn = /^.*<\s*([^<>\s]+)\s*>$/;
999
+ function Dn(s) {
1000
+ var o, d;
1001
+ const t = [], r = [], n = /* @__PURE__ */ new Set();
1002
+ let c = 0;
1003
+ if (!s)
1004
+ return { valid: t, invalid: r, duplicates: c };
1005
+ for (const m of s.split(/[,;\r\n\t]+/)) {
1006
+ const h = m.trim();
1007
+ if (!h)
1008
+ continue;
1009
+ const i = ((d = (o = hn.exec(h)) == null ? void 0 : o[1]) == null ? void 0 : d.trim()) ?? h, u = hn.test(h) ? [i] : i.split(/\s+/);
1010
+ for (const p of u) {
1011
+ if (!p)
1012
+ continue;
1013
+ if (!Dt.test(p)) {
1014
+ r.push(p);
1015
+ continue;
1016
+ }
1017
+ const b = p.toLowerCase();
1018
+ if (n.has(b)) {
1019
+ c += 1;
1020
+ continue;
1021
+ }
1022
+ n.add(b), t.push(p);
1023
+ }
1024
+ }
1025
+ return { valid: t, invalid: r, duplicates: c };
1026
+ }
1027
+ function Et(s, t) {
1028
+ const r = new Set(s.map((c) => c.toLowerCase())), n = [...s];
1029
+ for (const c of t) {
1030
+ const o = c.toLowerCase();
1031
+ r.has(o) || (r.add(o), n.push(c));
1032
+ }
1033
+ return n;
1034
+ }
1035
+ function En(s = {}) {
1036
+ const { currentUserId: t, currentUserName: r, requireIdentity: n = !0 } = s, [c, o] = E(""), d = !t, m = r ?? c, h = !n || m.trim().length > 0;
1037
+ return {
1038
+ isAnonymous: d,
1039
+ name: m,
1040
+ setName: o,
1041
+ canAct: h,
1042
+ actor: { userId: t, userName: m.trim() }
1043
+ };
1044
+ }
1045
+ const Lt = [
1046
+ { answer: "yes", label: "Yes", variant: "success", Icon: He },
1047
+ { answer: "maybe", label: "Maybe", variant: "warning", Icon: Qe },
1048
+ { answer: "no", label: "No", variant: "error", Icon: ut }
1049
+ ], pn = ee(
1050
+ function(t, r) {
1051
+ const {
1052
+ value: n,
1053
+ onRespond: c,
1054
+ allowPlusOnes: o = !1,
1055
+ maxPlusOnes: d = 5,
1056
+ plusOnes: m = 0,
1057
+ allowNote: h = !1,
1058
+ currentUserId: i,
1059
+ currentUserName: u,
1060
+ compact: p = !1,
1061
+ disabled: b = !1,
1062
+ readOnly: f = !1,
1063
+ size: g = "md",
1064
+ className: w,
1065
+ style: k
1066
+ } = t, _ = En({ currentUserId: i, currentUserName: u }), [$, l] = E(m), [y, v] = E(""), A = !p && _.isAnonymous && !_.canAct, I = b || f, D = (N) => {
1067
+ I || !c || c({
1068
+ answer: N,
1069
+ plusOnes: o && N !== "no" ? $ : void 0,
1070
+ note: h && y.trim() ? y.trim() : void 0,
1071
+ userId: _.actor.userId,
1072
+ userName: _.actor.userName || void 0
1073
+ });
1074
+ };
1075
+ return /* @__PURE__ */ a(
1076
+ "div",
1077
+ {
1078
+ ref: r,
1079
+ className: `nice-rsvp-control nice-rsvp-control--${g}${p ? " nice-rsvp-control--compact" : ""} ${w ?? ""}`,
1080
+ style: k,
1081
+ children: [
1082
+ !p && _.isAnonymous && /* @__PURE__ */ e(
1083
+ J,
1084
+ {
1085
+ label: "Your name",
1086
+ value: _.name,
1087
+ onChange: _.setName,
1088
+ placeholder: "Who is replying?",
1089
+ required: !0,
1090
+ disabled: I,
1091
+ size: g
1092
+ }
1093
+ ),
1094
+ /* @__PURE__ */ e("div", { className: "nice-rsvp-control__answers", role: "group", "aria-label": "Your reply", children: Lt.map(({ answer: N, label: L, variant: V, Icon: B }) => /* @__PURE__ */ e(
1095
+ F,
1096
+ {
1097
+ size: g,
1098
+ variant: n === N ? V : "outline",
1099
+ leftIcon: /* @__PURE__ */ e(B, { size: 16 }),
1100
+ disabled: I || A,
1101
+ "aria-pressed": n === N,
1102
+ onClick: () => D(N),
1103
+ children: L
1104
+ },
1105
+ N
1106
+ )) }),
1107
+ !p && o && n !== "no" && /* @__PURE__ */ a("label", { className: "nice-rsvp-control__field", children: [
1108
+ /* @__PURE__ */ e("span", { className: "nice-rsvp-control__field-label", children: "Additional guests" }),
1109
+ /* @__PURE__ */ e(
1110
+ Je,
1111
+ {
1112
+ value: $,
1113
+ onChange: (N) => l(Math.max(0, Math.min(d, N ?? 0))),
1114
+ min: 0,
1115
+ max: d,
1116
+ step: 1,
1117
+ size: "xs",
1118
+ disabled: I
1119
+ }
1120
+ )
1121
+ ] }),
1122
+ !p && h && /* @__PURE__ */ e(
1123
+ J,
1124
+ {
1125
+ label: "Note",
1126
+ value: y,
1127
+ onChange: v,
1128
+ placeholder: "Anything we should know?",
1129
+ disabled: I,
1130
+ size: g
1131
+ }
1132
+ ),
1133
+ A && /* @__PURE__ */ e("p", { className: "nice-rsvp-control__hint", children: "Enter your name to reply." })
1134
+ ]
1135
+ }
1136
+ );
1137
+ }
1138
+ ), Bt = {
1139
+ yes: "confirmed",
1140
+ maybe: "invited",
1141
+ no: "declined"
1142
+ }, gn = {
1143
+ confirmed: "yes",
1144
+ "checked-in": "yes",
1145
+ declined: "no"
1146
+ }, Le = [
1147
+ "confirmed",
1148
+ "checked-in",
1149
+ "invited",
1150
+ "declined",
1151
+ "no-show"
1152
+ ], Ai = ee(
1153
+ function(t, r) {
1154
+ const {
1155
+ participants: n,
1156
+ mode: c = "organizer",
1157
+ currentUserId: o,
1158
+ currentUserName: d,
1159
+ onRsvpChange: m,
1160
+ onCheckIn: h,
1161
+ onScan: i,
1162
+ checkInSlot: u,
1163
+ onInvite: p,
1164
+ extraFields: b,
1165
+ groupBy: f = "none",
1166
+ showSummary: g = !0,
1167
+ showSearch: w = !0,
1168
+ allowPlusOnes: k = !1,
1169
+ disabled: _ = !1,
1170
+ readOnly: $ = !1,
1171
+ size: l = "md",
1172
+ className: y,
1173
+ style: v
1174
+ } = t, [A, I] = E(""), [D, N] = E("all"), [L, V] = E(""), B = _ || $, C = c === "guest", O = X(() => {
1175
+ const S = { total: n.length };
1176
+ for (const Y of Le)
1177
+ S[Y] = 0;
1178
+ for (const Y of n)
1179
+ S[Y.status] = (S[Y.status] ?? 0) + 1;
1180
+ return S;
1181
+ }, [n]), z = X(() => {
1182
+ if (C)
1183
+ return n.filter((Y) => Y.userId === o || Y.id === o);
1184
+ const S = A.trim().toLowerCase();
1185
+ return n.filter((Y) => D !== "all" && Y.status !== D ? !1 : !S || Y.name.toLowerCase().includes(S));
1186
+ }, [n, C, o, A, D]), P = X(() => {
1187
+ if (f === "none" || C)
1188
+ return [{ key: "all", label: "", items: z }];
1189
+ const S = /* @__PURE__ */ new Map();
1190
+ for (const q of z) {
1191
+ const Q = f === "status" ? q.status : q.role, R = S.get(Q);
1192
+ R ? R.push(q) : S.set(Q, [q]);
1193
+ }
1194
+ return [...S.keys()].sort((q, Q) => f !== "status" ? q.localeCompare(Q) : Le.indexOf(q) - Le.indexOf(Q)).map((q) => ({ key: q, label: q, items: S.get(q) ?? [] }));
1195
+ }, [z, f, C]), M = X(() => Dn(L), [L]), j = (S) => (Y) => {
1196
+ m == null || m(S, Bt[Y.answer], Y);
1197
+ }, W = () => {
1198
+ !p || M.valid.length === 0 || (p(M.valid), V(""));
1199
+ };
1200
+ if (C) {
1201
+ const S = z[0];
1202
+ return S ? /* @__PURE__ */ a(
1203
+ "div",
1204
+ {
1205
+ ref: r,
1206
+ className: `nice-participant-list nice-participant-list--guest ${y ?? ""}`,
1207
+ style: v,
1208
+ children: [
1209
+ /* @__PURE__ */ e("ul", { className: "nice-participant-list__rows", children: /* @__PURE__ */ e(je, { participant: S, size: l }) }),
1210
+ /* @__PURE__ */ e(
1211
+ pn,
1212
+ {
1213
+ value: gn[S.status],
1214
+ onRespond: j(S.id),
1215
+ allowPlusOnes: k,
1216
+ currentUserId: o ?? S.userId,
1217
+ currentUserName: d ?? S.name,
1218
+ disabled: _,
1219
+ readOnly: $,
1220
+ size: l
1221
+ }
1222
+ )
1223
+ ]
1224
+ }
1225
+ ) : /* @__PURE__ */ e("div", { ref: r, className: `nice-participant-list ${y ?? ""}`, style: v, children: /* @__PURE__ */ e(
1226
+ ye,
1227
+ {
1228
+ title: "You are not on this guest list",
1229
+ description: "Ask the host for an invitation link."
1230
+ }
1231
+ ) });
1232
+ }
1233
+ return /* @__PURE__ */ a("div", { ref: r, className: `nice-participant-list ${y ?? ""}`, style: v, children: [
1234
+ g && /* @__PURE__ */ a("div", { className: "nice-participant-list__summary", children: [
1235
+ /* @__PURE__ */ a("span", { className: "nice-participant-list__stat", children: [
1236
+ /* @__PURE__ */ e("strong", { children: O.confirmed }),
1237
+ " confirmed"
1238
+ ] }),
1239
+ /* @__PURE__ */ a("span", { className: "nice-participant-list__stat", children: [
1240
+ /* @__PURE__ */ e("strong", { children: O.invited }),
1241
+ " awaiting reply"
1242
+ ] }),
1243
+ /* @__PURE__ */ a("span", { className: "nice-participant-list__stat", children: [
1244
+ /* @__PURE__ */ e("strong", { children: O.declined }),
1245
+ " declined"
1246
+ ] }),
1247
+ /* @__PURE__ */ a("span", { className: "nice-participant-list__stat", children: [
1248
+ /* @__PURE__ */ e("strong", { children: O["checked-in"] }),
1249
+ " checked in"
1250
+ ] }),
1251
+ /* @__PURE__ */ a("span", { className: "nice-participant-list__stat nice-participant-list__stat--total", children: [
1252
+ /* @__PURE__ */ e("strong", { children: O.total }),
1253
+ " total"
1254
+ ] })
1255
+ ] }),
1256
+ (w || u || i) && /* @__PURE__ */ a("div", { className: "nice-participant-list__toolbar", children: [
1257
+ w && /* @__PURE__ */ a(Ke, { children: [
1258
+ /* @__PURE__ */ e(
1259
+ J,
1260
+ {
1261
+ value: A,
1262
+ onChange: I,
1263
+ placeholder: "Search guests…",
1264
+ prefix: /* @__PURE__ */ e(mt, { size: 15 }),
1265
+ size: l
1266
+ }
1267
+ ),
1268
+ /* @__PURE__ */ e(
1269
+ Pe,
1270
+ {
1271
+ value: D,
1272
+ onChange: (S) => N(S),
1273
+ size: l,
1274
+ options: [
1275
+ { value: "all", label: "All statuses" },
1276
+ ...Le.map((S) => ({ value: S, label: S }))
1277
+ ]
1278
+ }
1279
+ )
1280
+ ] }),
1281
+ u,
1282
+ i && !u && /* @__PURE__ */ a("span", { className: "nice-participant-list__scan-hint", children: [
1283
+ /* @__PURE__ */ e(ht, { size: 15 }),
1284
+ " Scanner ready"
1285
+ ] })
1286
+ ] }),
1287
+ z.length === 0 ? /* @__PURE__ */ e(
1288
+ ye,
1289
+ {
1290
+ title: "No guests yet",
1291
+ description: n.length > 0 ? "No one matches the current filter." : "Invite people to see them here."
1292
+ }
1293
+ ) : P.map((S) => /* @__PURE__ */ a("section", { className: "nice-participant-list__group", children: [
1294
+ S.label && /* @__PURE__ */ a("h4", { className: "nice-participant-list__group-title", children: [
1295
+ S.label,
1296
+ " ",
1297
+ /* @__PURE__ */ a("span", { children: [
1298
+ "(",
1299
+ S.items.length,
1300
+ ")"
1301
+ ] })
1302
+ ] }),
1303
+ /* @__PURE__ */ e("ul", { className: "nice-participant-list__rows", children: S.items.map((Y) => /* @__PURE__ */ a(
1304
+ je,
1305
+ {
1306
+ participant: Y,
1307
+ size: l,
1308
+ meta: b == null ? void 0 : b.map((q) => /* @__PURE__ */ e("span", { className: "nice-participant-list__extra", children: q.render ? q.render(Y) : String(
1309
+ Y[q.key] ?? ""
1310
+ ) }, q.key)),
1311
+ children: [
1312
+ m && /* @__PURE__ */ e(
1313
+ pn,
1314
+ {
1315
+ compact: !0,
1316
+ value: gn[Y.status],
1317
+ onRespond: j(Y.id),
1318
+ currentUserId: Y.userId,
1319
+ currentUserName: Y.name,
1320
+ disabled: B,
1321
+ size: "sm"
1322
+ }
1323
+ ),
1324
+ h && Y.status !== "checked-in" && /* @__PURE__ */ e(
1325
+ F,
1326
+ {
1327
+ size: "sm",
1328
+ variant: "outline",
1329
+ leftIcon: /* @__PURE__ */ e(He, { size: 14 }),
1330
+ disabled: B,
1331
+ onClick: () => h(Y.id),
1332
+ children: "Check in"
1333
+ }
1334
+ )
1335
+ ]
1336
+ },
1337
+ Y.id
1338
+ )) })
1339
+ ] }, S.key)),
1340
+ p && !$ && /* @__PURE__ */ a("div", { className: "nice-participant-list__invite", children: [
1341
+ /* @__PURE__ */ e(
1342
+ Ze,
1343
+ {
1344
+ label: "Invite by email",
1345
+ value: L,
1346
+ onChange: V,
1347
+ placeholder: "Paste addresses — commas, semicolons or new lines",
1348
+ rows: 3,
1349
+ disabled: _,
1350
+ size: l
1351
+ }
1352
+ ),
1353
+ /* @__PURE__ */ a(
1354
+ F,
1355
+ {
1356
+ variant: "primary",
1357
+ size: l,
1358
+ leftIcon: /* @__PURE__ */ e(In, { size: 15 }),
1359
+ disabled: _ || M.valid.length === 0,
1360
+ onClick: W,
1361
+ children: [
1362
+ "Invite ",
1363
+ M.valid.length > 0 ? `(${M.valid.length})` : ""
1364
+ ]
1365
+ }
1366
+ ),
1367
+ (M.invalid.length > 0 || M.duplicates > 0) && /* @__PURE__ */ a("p", { className: "nice-participant-list__invite-hint", children: [
1368
+ M.duplicates > 0 && `${M.duplicates} duplicate(s) removed. `,
1369
+ M.invalid.length > 0 && `${M.invalid.length} entry(ies) not recognised.`
1370
+ ] })
1371
+ ] })
1372
+ ] });
1373
+ }
1374
+ ), Ot = {
1375
+ // No minor unit at all.
1376
+ BIF: 0,
1377
+ CLP: 0,
1378
+ DJF: 0,
1379
+ GNF: 0,
1380
+ ISK: 0,
1381
+ JPY: 0,
1382
+ KMF: 0,
1383
+ KRW: 0,
1384
+ PYG: 0,
1385
+ RWF: 0,
1386
+ UGX: 0,
1387
+ UYI: 0,
1388
+ VND: 0,
1389
+ VUV: 0,
1390
+ XAF: 0,
1391
+ XOF: 0,
1392
+ XPF: 0,
1393
+ // Thousandths.
1394
+ BHD: 3,
1395
+ IQD: 3,
1396
+ JOD: 3,
1397
+ KWD: 3,
1398
+ LYD: 3,
1399
+ OMR: 3,
1400
+ TND: 3
1401
+ };
1402
+ function en(s) {
1403
+ return Ot[s == null ? void 0 : s.toUpperCase()] ?? 2;
1404
+ }
1405
+ function nn(s, t) {
1406
+ return Number.isFinite(s) ? Math.round(s * 10 ** en(t)) : 0;
1407
+ }
1408
+ function Ye(s, t) {
1409
+ const r = en(t);
1410
+ return r === 0 ? s : s / 10 ** r;
1411
+ }
1412
+ function Rt(s, t, r) {
1413
+ const n = en(t), c = Ye(s, t);
1414
+ try {
1415
+ return new Intl.NumberFormat(r, {
1416
+ style: "currency",
1417
+ currency: t.toUpperCase(),
1418
+ minimumFractionDigits: n,
1419
+ maximumFractionDigits: n
1420
+ }).format(c);
1421
+ } catch {
1422
+ return `${c.toFixed(n)} ${t}`;
1423
+ }
1424
+ }
1425
+ function se(s, t, r) {
1426
+ return Rt(nn(s, t), t, r);
1427
+ }
1428
+ const Ge = { minX: 0, minY: 0, maxX: 0, maxY: 0 };
1429
+ function Ut(s, t = 0) {
1430
+ if (s.length === 0)
1431
+ return { ...Ge };
1432
+ let r = 1 / 0, n = 1 / 0, c = -1 / 0, o = -1 / 0;
1433
+ for (const d of s)
1434
+ d.x < r && (r = d.x), d.y < n && (n = d.y), d.x > c && (c = d.x), d.y > o && (o = d.y);
1435
+ return { minX: r - t, minY: n - t, maxX: c + t, maxY: o + t };
1436
+ }
1437
+ function fn(s, t) {
1438
+ return {
1439
+ minX: Math.min(s.minX, t.minX),
1440
+ minY: Math.min(s.minY, t.minY),
1441
+ maxX: Math.max(s.maxX, t.maxX),
1442
+ maxY: Math.max(s.maxY, t.maxY)
1443
+ };
1444
+ }
1445
+ function vn(s, t) {
1446
+ return s.minX <= t.maxX && s.maxX >= t.minX && s.minY <= t.maxY && s.maxY >= t.minY;
1447
+ }
1448
+ function Yt(s, t, r = 0) {
1449
+ const n = s.zoom || 1, c = -s.pan.x / n - r, o = -s.pan.y / n - r;
1450
+ return {
1451
+ minX: c,
1452
+ minY: o,
1453
+ maxX: c + t.width / n + r * 2,
1454
+ maxY: o + t.height / n + r * 2
1455
+ };
1456
+ }
1457
+ function Xt(s, t = 12) {
1458
+ const r = [], n = [], c = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
1459
+ let d = null, m = 0;
1460
+ for (const h of s.sections ?? []) {
1461
+ let i = null, u = 0;
1462
+ (h.rows ?? []).forEach((b, f) => {
1463
+ const g = Vt(b.seats ?? []);
1464
+ if (g.length === 0)
1465
+ return;
1466
+ const w = Ut(g, t);
1467
+ n.push({ sectionId: h.id, rowIndex: f, label: b.label, seats: g, bounds: w }), g.forEach((k, _) => {
1468
+ c.set(k.id, k), o.set(k.id, { sectionId: h.id, rowIndex: f, seatIndex: _ });
1469
+ }), u += g.length, i = i ? fn(i, w) : w;
1470
+ });
1471
+ const p = i ?? { ...Ge };
1472
+ r.push({ section: h, bounds: p, seatCount: u }), m += u, u > 0 && (d = d ? fn(d, p) : p);
1473
+ }
1474
+ return {
1475
+ sections: r,
1476
+ rows: n,
1477
+ bounds: d ?? { ...Ge },
1478
+ totalSeats: m,
1479
+ seatById: c,
1480
+ locationById: o
1481
+ };
1482
+ }
1483
+ function Vt(s) {
1484
+ return [...s].sort((t, r) => t.number - r.number || t.x - r.x);
1485
+ }
1486
+ function Ft(s, t) {
1487
+ return s > t * 4 ? "section" : s > t ? "row" : "seat";
1488
+ }
1489
+ function Wt(s, t, r = 2500, n) {
1490
+ const c = s.sections.filter((u) => vn(u.bounds, t)), o = new Set(c.map((u) => u.section.id)), d = s.rows.filter(
1491
+ (u) => o.has(u.sectionId) && vn(u.bounds, t)
1492
+ );
1493
+ let m = 0;
1494
+ for (const u of d)
1495
+ for (const p of u.seats)
1496
+ p.x >= t.minX && p.x <= t.maxX && p.y >= t.minY && p.y <= t.maxY && (m += 1);
1497
+ const h = n ?? Ft(m, r);
1498
+ let i = [];
1499
+ if (h === "seat") {
1500
+ i = [];
1501
+ for (const u of d)
1502
+ for (const p of u.seats)
1503
+ p.x >= t.minX && p.x <= t.maxX && p.y >= t.minY && p.y <= t.maxY && i.push(p);
1504
+ }
1505
+ return { tier: h, sections: c, rows: h === "section" ? [] : d, seats: i, visibleSeatCount: m };
1506
+ }
1507
+ function tn(s) {
1508
+ if (s.accessType)
1509
+ return s.accessType;
1510
+ if (s.status === "wheelchair" || s.status === "companion")
1511
+ return s.status;
1512
+ }
1513
+ function ke(s, t) {
1514
+ const r = (t == null ? void 0 : t[s.id]) ?? s.status;
1515
+ return r === "wheelchair" || r === "companion" ? "available" : r;
1516
+ }
1517
+ function yn(s, t, r) {
1518
+ var c;
1519
+ const n = (c = t.priceCategories) == null ? void 0 : c.find((o) => o.id === s.priceCategoryId);
1520
+ return {
1521
+ amount: (n == null ? void 0 : n.price) ?? r.basePrice,
1522
+ currency: r.currency
1523
+ };
1524
+ }
1525
+ function qt(s, t = {}, r) {
1526
+ return !(ke(s, r) !== "available" || t.allowedCategories && !t.allowedCategories.includes(s.priceCategoryId));
1527
+ }
1528
+ function Ln(s, t = {}, r) {
1529
+ const n = [];
1530
+ let c = null;
1531
+ return s.forEach((o, d) => {
1532
+ qt(o, t, r) ? c ? c.seats.push(o) : c = { start: d, seats: [o] } : c && (n.push(c), c = null);
1533
+ }), c && n.push(c), n;
1534
+ }
1535
+ function jt(s, t, r = {}, n) {
1536
+ const c = r.maxSeats ?? 8;
1537
+ if (s.length > c)
1538
+ return { ok: !1, reason: "max-seats" };
1539
+ for (const d of s) {
1540
+ const m = t.seatById.get(d);
1541
+ if (m) {
1542
+ if (ke(m, n) !== "available")
1543
+ return { ok: !1, reason: "unavailable", seatId: d };
1544
+ if (r.allowedCategories && !r.allowedCategories.includes(m.priceCategoryId))
1545
+ return { ok: !1, reason: "category-not-allowed", seatId: d };
1546
+ }
1547
+ }
1548
+ if (!r.adjacentOnly || s.length === 0)
1549
+ return { ok: !0 };
1550
+ const o = /* @__PURE__ */ new Map();
1551
+ for (const d of s) {
1552
+ const m = t.locationById.get(d);
1553
+ if (!m)
1554
+ continue;
1555
+ const h = `${m.sectionId}::${m.rowIndex}`, i = o.get(h);
1556
+ i ? i.push(d) : o.set(h, [d]);
1557
+ }
1558
+ for (const [d, m] of o) {
1559
+ const [h, i] = d.split("::"), u = Number(i), p = t.rows.find((l) => l.sectionId === h && l.rowIndex === u);
1560
+ if (!p)
1561
+ continue;
1562
+ const b = Ln(p.seats, r, n), f = new Set(m);
1563
+ let g = null;
1564
+ for (const l of b)
1565
+ if (l.seats.some((y) => f.has(y.id))) {
1566
+ if (g)
1567
+ return { ok: !1, reason: "not-adjacent", seatId: m[0] };
1568
+ g = l;
1569
+ }
1570
+ if (!g)
1571
+ continue;
1572
+ const w = g.seats.map((l, y) => f.has(l.id) ? y : -1).filter((l) => l >= 0);
1573
+ if (w.length === 0)
1574
+ continue;
1575
+ const k = w[0], _ = w[w.length - 1];
1576
+ if (_ - k + 1 !== w.length)
1577
+ return { ok: !1, reason: "not-adjacent", seatId: m[0] };
1578
+ const $ = g.seats.length;
1579
+ if ($ > 1 && (k === 1 || $ - 1 - _ === 1))
1580
+ return { ok: !1, reason: "orphan-seat", seatId: m[0] };
1581
+ }
1582
+ return { ok: !0 };
1583
+ }
1584
+ function Gt(s, t, r, n = {}, c) {
1585
+ if (s.includes(t))
1586
+ return { selected: s.filter((m) => m !== t) };
1587
+ const o = [...s, t], d = jt(o, r, n, c);
1588
+ return d.ok ? { selected: o } : { rejected: d.reason ?? "not-adjacent" };
1589
+ }
1590
+ function Kt(s, t, r = {}, n = {}, c) {
1591
+ if (t <= 0)
1592
+ return [];
1593
+ const o = n.categoryId ? { ...r, allowedCategories: [n.categoryId] } : r;
1594
+ let d = null;
1595
+ for (const m of s.rows)
1596
+ if (!(n.sectionId && m.sectionId !== n.sectionId))
1597
+ for (const h of Ln(m.seats, o, c)) {
1598
+ const i = h.seats.length;
1599
+ if (!(i < t))
1600
+ for (let u = 0; u + t <= i; u += 1) {
1601
+ const p = u + t - 1;
1602
+ if (i > t && (u === 1 || i - 1 - p === 1))
1603
+ continue;
1604
+ const b = h.seats.slice(u, p + 1), f = b.reduce((g, w) => g + (w.viewScore ?? 50), 0) / t;
1605
+ (!d || f > d.score) && (d = { ids: b.map((g) => g.id), score: f });
1606
+ }
1607
+ }
1608
+ return (d == null ? void 0 : d.ids) ?? [];
1609
+ }
1610
+ function Ht(s, t, r) {
1611
+ var u, p, b, f;
1612
+ const n = s.locationById.get(t);
1613
+ if (!n)
1614
+ return null;
1615
+ const c = s.rows.findIndex(
1616
+ (g) => g.sectionId === n.sectionId && g.rowIndex === n.rowIndex
1617
+ );
1618
+ if (c < 0)
1619
+ return null;
1620
+ const o = s.rows[c];
1621
+ if (r === "left")
1622
+ return ((u = o.seats[n.seatIndex - 1]) == null ? void 0 : u.id) ?? null;
1623
+ if (r === "right")
1624
+ return ((p = o.seats[n.seatIndex + 1]) == null ? void 0 : p.id) ?? null;
1625
+ if (r === "row-start")
1626
+ return ((b = o.seats[0]) == null ? void 0 : b.id) ?? null;
1627
+ if (r === "row-end")
1628
+ return ((f = o.seats[o.seats.length - 1]) == null ? void 0 : f.id) ?? null;
1629
+ const d = s.rows[r === "up" ? c - 1 : c + 1];
1630
+ if (!d)
1631
+ return null;
1632
+ const m = o.seats[n.seatIndex].x;
1633
+ let h = null, i = 1 / 0;
1634
+ for (const g of d.seats) {
1635
+ const w = Math.abs(g.x - m);
1636
+ w < i && (i = w, h = g);
1637
+ }
1638
+ return (h == null ? void 0 : h.id) ?? null;
1639
+ }
1640
+ function Qt(s, t, r) {
1641
+ var h, i, u;
1642
+ const n = s.sections.filter((p) => p.seatCount > 0);
1643
+ if (n.length === 0)
1644
+ return null;
1645
+ const c = t ? (h = s.locationById.get(t)) == null ? void 0 : h.sectionId : void 0, o = n.findIndex((p) => p.section.id === c), d = o < 0 ? 0 : r === "next" ? o + 1 : o - 1, m = n[d];
1646
+ return m ? ((u = (i = s.rows.find((p) => p.sectionId === m.section.id)) == null ? void 0 : i.seats[0]) == null ? void 0 : u.id) ?? null : null;
1647
+ }
1648
+ const Ae = 8;
1649
+ function Zt(s, t) {
1650
+ return s.seats.length === 0 ? 0 : s.seats.filter((n) => ke(n, t) === "available").length / s.seats.length;
1651
+ }
1652
+ const Jt = ({
1653
+ cull: s,
1654
+ selectedIds: t,
1655
+ cursorId: r,
1656
+ statusOverrides: n,
1657
+ sectionColorById: c,
1658
+ interactive: o,
1659
+ onSeatClick: d,
1660
+ onSectionClick: m,
1661
+ describeSeat: h
1662
+ }) => s.tier === "section" ? /* @__PURE__ */ e("g", { className: "nice-seating-chart__sections", children: s.sections.map(({ section: i, bounds: u, seatCount: p }) => /* @__PURE__ */ a("g", { className: "nice-seating-chart__section", children: [
1663
+ /* @__PURE__ */ e(
1664
+ "rect",
1665
+ {
1666
+ x: u.minX,
1667
+ y: u.minY,
1668
+ width: u.maxX - u.minX,
1669
+ height: u.maxY - u.minY,
1670
+ rx: 12,
1671
+ className: "nice-seating-chart__section-shape",
1672
+ style: { fill: c.get(i.id) },
1673
+ role: m ? "button" : "img",
1674
+ "aria-label": `${i.name}, ${p} seats`,
1675
+ tabIndex: m ? 0 : void 0,
1676
+ onClick: m ? () => m(i.id) : void 0
1677
+ }
1678
+ ),
1679
+ /* @__PURE__ */ e(
1680
+ "text",
1681
+ {
1682
+ x: (u.minX + u.maxX) / 2,
1683
+ y: (u.minY + u.maxY) / 2,
1684
+ className: "nice-seating-chart__section-label",
1685
+ textAnchor: "middle",
1686
+ dominantBaseline: "middle",
1687
+ "aria-hidden": "true",
1688
+ children: i.name
1689
+ }
1690
+ )
1691
+ ] }, i.id)) }) : s.tier === "row" ? /* @__PURE__ */ e("g", { className: "nice-seating-chart__rows", children: s.rows.map((i) => {
1692
+ const u = Zt(i, n);
1693
+ return /* @__PURE__ */ a("g", { children: [
1694
+ /* @__PURE__ */ e(
1695
+ "rect",
1696
+ {
1697
+ x: i.bounds.minX,
1698
+ y: i.bounds.minY,
1699
+ width: i.bounds.maxX - i.bounds.minX,
1700
+ height: i.bounds.maxY - i.bounds.minY,
1701
+ rx: 8,
1702
+ className: "nice-seating-chart__row-shape",
1703
+ style: {
1704
+ fill: c.get(i.sectionId),
1705
+ fillOpacity: 0.25 + u * 0.65
1706
+ },
1707
+ role: "img",
1708
+ "aria-label": `Row ${i.label}, ${i.seats.length} seats, ${Math.round(
1709
+ u * i.seats.length
1710
+ )} available`
1711
+ }
1712
+ ),
1713
+ /* @__PURE__ */ e(
1714
+ "text",
1715
+ {
1716
+ x: i.bounds.minX - 6,
1717
+ y: (i.bounds.minY + i.bounds.maxY) / 2,
1718
+ className: "nice-seating-chart__row-label",
1719
+ textAnchor: "end",
1720
+ dominantBaseline: "middle",
1721
+ "aria-hidden": "true",
1722
+ children: i.label
1723
+ }
1724
+ )
1725
+ ] }, `${i.sectionId}-${i.rowIndex}`);
1726
+ }) }) : /* @__PURE__ */ e("g", { className: "nice-seating-chart__seats", children: s.seats.map((i) => {
1727
+ const u = ke(i, n), p = tn(i), b = t.has(i.id), f = r === i.id, g = { row: i.row, number: i.number }, w = [
1728
+ "nice-seating-chart__seat",
1729
+ `nice-seating-chart__seat--${u}`,
1730
+ b ? "nice-seating-chart__seat--selected" : "",
1731
+ p ? `nice-seating-chart__seat--${p}` : "",
1732
+ f ? "nice-seating-chart__seat--cursor" : ""
1733
+ ].filter(Boolean).join(" ");
1734
+ return /* @__PURE__ */ a(
1735
+ "g",
1736
+ {
1737
+ className: w,
1738
+ "data-seat-id": i.id,
1739
+ role: "gridcell",
1740
+ "aria-selected": b,
1741
+ "aria-disabled": u !== "available",
1742
+ "aria-label": h(i),
1743
+ tabIndex: f ? 0 : -1,
1744
+ onClick: o && d ? () => d(i) : void 0,
1745
+ children: [
1746
+ p ? /* @__PURE__ */ e(
1747
+ "rect",
1748
+ {
1749
+ x: i.x - Ae,
1750
+ y: i.y - Ae,
1751
+ width: Ae * 2,
1752
+ height: Ae * 2,
1753
+ rx: 3,
1754
+ className: "nice-seating-chart__seat-shape",
1755
+ fill: p === "companion" ? "url(#nice-seat-companion-hatch)" : void 0
1756
+ }
1757
+ ) : /* @__PURE__ */ e(
1758
+ "circle",
1759
+ {
1760
+ cx: i.x,
1761
+ cy: i.y,
1762
+ r: Ae,
1763
+ className: "nice-seating-chart__seat-shape"
1764
+ }
1765
+ ),
1766
+ p === "wheelchair" && /* @__PURE__ */ e(
1767
+ Cn,
1768
+ {
1769
+ size: 10,
1770
+ x: i.x - 5,
1771
+ y: i.y - 5,
1772
+ className: "nice-seating-chart__seat-glyph"
1773
+ }
1774
+ ),
1775
+ /* @__PURE__ */ e("title", { children: h(i) }),
1776
+ /* @__PURE__ */ e(
1777
+ "text",
1778
+ {
1779
+ x: i.x,
1780
+ y: i.y,
1781
+ className: "nice-seating-chart__seat-number",
1782
+ textAnchor: "middle",
1783
+ dominantBaseline: "middle",
1784
+ "aria-hidden": "true",
1785
+ children: g.number
1786
+ }
1787
+ )
1788
+ ]
1789
+ },
1790
+ i.id
1791
+ );
1792
+ }) }), ei = ({
1793
+ index: s,
1794
+ selectedIds: t,
1795
+ statusOverrides: r,
1796
+ maxSeats: n,
1797
+ onSeatToggle: c,
1798
+ onBestAvailable: o,
1799
+ describeSeat: d,
1800
+ disabled: m = !1,
1801
+ defaultOpen: h = !1
1802
+ }) => {
1803
+ var $;
1804
+ const i = X(
1805
+ () => s.sections.filter((l) => l.seatCount > 0),
1806
+ [s.sections]
1807
+ ), [u, p] = E((($ = i[0]) == null ? void 0 : $.section.id) ?? ""), [b, f] = E(0), [g, w] = E(2), k = X(
1808
+ () => s.rows.filter((l) => l.sectionId === u),
1809
+ [s.rows, u]
1810
+ ), _ = k.find((l) => l.rowIndex === b) ?? k[0];
1811
+ return /* @__PURE__ */ a(
1812
+ St,
1813
+ {
1814
+ trigger: "Choose seats without the map",
1815
+ defaultExpanded: h,
1816
+ className: "nice-seating-chart__list-panel",
1817
+ children: [
1818
+ o && /* @__PURE__ */ a("div", { className: "nice-seating-chart__best", children: [
1819
+ /* @__PURE__ */ a("label", { className: "nice-seating-chart__field", children: [
1820
+ /* @__PURE__ */ e("span", { children: "How many seats?" }),
1821
+ /* @__PURE__ */ e(
1822
+ Je,
1823
+ {
1824
+ value: g,
1825
+ onChange: (l) => w(Math.max(1, Math.min(n, l ?? 1))),
1826
+ min: 1,
1827
+ max: n,
1828
+ size: "xs",
1829
+ disabled: m
1830
+ }
1831
+ )
1832
+ ] }),
1833
+ /* @__PURE__ */ e(
1834
+ F,
1835
+ {
1836
+ size: "sm",
1837
+ variant: "primary",
1838
+ disabled: m,
1839
+ onClick: () => o(g, { sectionId: u || void 0 }),
1840
+ children: "Best available"
1841
+ }
1842
+ )
1843
+ ] }),
1844
+ /* @__PURE__ */ a("div", { className: "nice-seating-chart__pickers", children: [
1845
+ /* @__PURE__ */ a("label", { className: "nice-seating-chart__field", children: [
1846
+ /* @__PURE__ */ e("span", { children: "Section" }),
1847
+ /* @__PURE__ */ e(
1848
+ Pe,
1849
+ {
1850
+ size: "sm",
1851
+ value: u,
1852
+ disabled: m,
1853
+ onChange: (l) => {
1854
+ p(l), f(0);
1855
+ },
1856
+ options: i.map((l) => ({
1857
+ value: l.section.id,
1858
+ label: `${l.section.name} (${l.seatCount})`
1859
+ }))
1860
+ }
1861
+ )
1862
+ ] }),
1863
+ /* @__PURE__ */ a("label", { className: "nice-seating-chart__field", children: [
1864
+ /* @__PURE__ */ e("span", { children: "Row" }),
1865
+ /* @__PURE__ */ e(
1866
+ Pe,
1867
+ {
1868
+ size: "sm",
1869
+ value: String((_ == null ? void 0 : _.rowIndex) ?? 0),
1870
+ disabled: m || k.length === 0,
1871
+ onChange: (l) => f(Number(l)),
1872
+ options: k.map((l) => ({
1873
+ value: String(l.rowIndex),
1874
+ label: `${l.label} (${l.seats.length})`
1875
+ }))
1876
+ }
1877
+ )
1878
+ ] })
1879
+ ] }),
1880
+ _ && /* @__PURE__ */ e("ul", { className: "nice-seating-chart__seat-list", children: _.seats.map((l) => {
1881
+ const y = ke(l, r), v = tn(l), A = t.has(l.id);
1882
+ return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ a(
1883
+ F,
1884
+ {
1885
+ size: "sm",
1886
+ variant: A ? "primary" : "outline",
1887
+ disabled: m || y !== "available",
1888
+ ariaLabel: d(l),
1889
+ "aria-pressed": A,
1890
+ onClick: () => c(l),
1891
+ children: [
1892
+ l.number,
1893
+ v && /* @__PURE__ */ e(Cn, { size: 11 })
1894
+ ]
1895
+ }
1896
+ ) }, l.id);
1897
+ }) })
1898
+ ]
1899
+ }
1900
+ );
1901
+ }, ni = { zoom: 1, pan: { x: 0, y: 0 } };
1902
+ function ti(s = {}) {
1903
+ const {
1904
+ minZoom: t = 0.1,
1905
+ maxZoom: r = 10,
1906
+ initial: n = ni,
1907
+ viewport: c,
1908
+ onViewportChange: o,
1909
+ disabled: d = !1
1910
+ } = s, [m, h] = E(n), i = c ?? m, [u, p] = E(!1), b = ve(/* @__PURE__ */ new Map()), f = ve(null), g = ve(null), w = G(
1911
+ (N) => {
1912
+ c === void 0 && h(N), o == null || o(N);
1913
+ },
1914
+ [c, o]
1915
+ ), k = G(
1916
+ (N) => Math.min(r, Math.max(t, N)),
1917
+ [t, r]
1918
+ ), _ = G(
1919
+ (N, L) => {
1920
+ const V = k(i.zoom * N);
1921
+ if (V === i.zoom)
1922
+ return;
1923
+ const B = V / i.zoom;
1924
+ w({
1925
+ zoom: V,
1926
+ pan: {
1927
+ x: L.x - (L.x - i.pan.x) * B,
1928
+ y: L.y - (L.y - i.pan.y) * B
1929
+ }
1930
+ });
1931
+ },
1932
+ [w, k, i]
1933
+ ), $ = G(
1934
+ (N, L, V) => {
1935
+ const B = L ?? (V ? { x: V.width / 2, y: V.height / 2 } : { x: 0, y: 0 });
1936
+ _(N, B);
1937
+ },
1938
+ [_]
1939
+ ), l = G(
1940
+ (N, L, V = 24) => {
1941
+ const B = Math.max(1, N.maxX - N.minX), C = Math.max(1, N.maxY - N.minY), O = k(
1942
+ Math.min((L.width - V * 2) / B, (L.height - V * 2) / C)
1943
+ );
1944
+ w({
1945
+ zoom: O,
1946
+ pan: {
1947
+ x: (L.width - B * O) / 2 - N.minX * O,
1948
+ y: (L.height - C * O) / 2 - N.minY * O
1949
+ }
1950
+ });
1951
+ },
1952
+ [w, k]
1953
+ ), y = G(() => w(n), [w, n]), v = G(
1954
+ (N) => ({
1955
+ x: (N.x - i.pan.x) / i.zoom,
1956
+ y: (N.y - i.pan.y) / i.zoom
1957
+ }),
1958
+ [i]
1959
+ ), A = G(
1960
+ (N) => ({
1961
+ x: N.x * i.zoom + i.pan.x,
1962
+ y: N.y * i.zoom + i.pan.y
1963
+ }),
1964
+ [i]
1965
+ ), I = (N) => {
1966
+ const L = N.currentTarget.getBoundingClientRect();
1967
+ return { x: N.clientX - L.left, y: N.clientY - L.top };
1968
+ };
1969
+ return {
1970
+ viewport: i,
1971
+ setViewport: w,
1972
+ containerProps: d ? {} : {
1973
+ onWheel: (N) => {
1974
+ N.preventDefault();
1975
+ const L = Math.exp(-N.deltaY * 2e-3);
1976
+ _(Math.min(2, Math.max(0.5, L)), I(N));
1977
+ },
1978
+ onPointerDown: (N) => {
1979
+ var V, B;
1980
+ const L = I(N);
1981
+ if (b.current.set(N.pointerId, L), (B = (V = N.currentTarget).setPointerCapture) == null || B.call(V, N.pointerId), b.current.size === 2) {
1982
+ const [C, O] = [...b.current.values()];
1983
+ f.current = {
1984
+ distance: Math.hypot(C.x - O.x, C.y - O.y) || 1,
1985
+ zoom: i.zoom
1986
+ };
1987
+ } else
1988
+ g.current = L, p(!0);
1989
+ },
1990
+ onPointerMove: (N) => {
1991
+ if (!b.current.has(N.pointerId))
1992
+ return;
1993
+ const L = I(N);
1994
+ if (b.current.set(N.pointerId, L), b.current.size === 2 && f.current) {
1995
+ const [C, O] = [...b.current.values()], z = Math.hypot(C.x - O.x, C.y - O.y) || 1, P = k(f.current.zoom * (z / f.current.distance)), M = { x: (C.x + O.x) / 2, y: (C.y + O.y) / 2 };
1996
+ P !== i.zoom && _(P / i.zoom, M);
1997
+ return;
1998
+ }
1999
+ if (!g.current)
2000
+ return;
2001
+ const V = L.x - g.current.x, B = L.y - g.current.y;
2002
+ g.current = L, w({ zoom: i.zoom, pan: { x: i.pan.x + V, y: i.pan.y + B } });
2003
+ },
2004
+ onPointerUp: (N) => {
2005
+ b.current.delete(N.pointerId), b.current.size < 2 && (f.current = null), b.current.size === 0 && (g.current = null, p(!1));
2006
+ },
2007
+ onPointerCancel: (N) => {
2008
+ b.current.delete(N.pointerId), f.current = null, g.current = null, p(!1);
2009
+ }
2010
+ },
2011
+ zoomBy: $,
2012
+ fitTo: l,
2013
+ reset: y,
2014
+ screenToWorld: v,
2015
+ worldToScreen: A,
2016
+ panning: u
2017
+ };
2018
+ }
2019
+ const ii = {
2020
+ "orphan-seat": "That would leave a single empty seat. Pick a different seat.",
2021
+ "not-adjacent": "Seats must be next to each other.",
2022
+ "max-seats": "You have selected as many seats as this order allows.",
2023
+ "category-not-allowed": "That seat is not part of the selected ticket type.",
2024
+ unavailable: "That seat is not available."
2025
+ }, ai = ee(
2026
+ function(t, r) {
2027
+ var de, $e, xe;
2028
+ const {
2029
+ chart: n,
2030
+ mode: c = "select",
2031
+ selection: o = {},
2032
+ selectedSeatIds: d,
2033
+ defaultSelectedSeatIds: m = [],
2034
+ onSelectionChange: h,
2035
+ onSelectionRejected: i,
2036
+ seatStatusOverrides: u,
2037
+ onSeatClick: p,
2038
+ onBestAvailable: b,
2039
+ lod: f = "auto",
2040
+ onLodChange: g,
2041
+ maxRenderedSeats: w = 2500,
2042
+ containerSize: k,
2043
+ showLegend: _ = !0,
2044
+ showList: $ = !1,
2045
+ zoomable: l = !0,
2046
+ locale: y,
2047
+ disabled: v = !1,
2048
+ readOnly: A = !1,
2049
+ className: I,
2050
+ style: D
2051
+ } = t, N = ve(null), [L, V] = E({ width: 800, height: 500 }), [B, C] = E(!1), [O, z] = E(m), [P, M] = E(null), [j, W] = E(""), S = d ?? O, Y = X(() => new Set(S), [S]), q = c === "select" && !v && !A && o.interactive !== !1, Q = o.maxSeats ?? 8, R = X(() => Xt(n), [n]), ne = k ?? L, H = !!k || B;
2052
+ Oe(() => {
2053
+ if (k || !N.current || typeof ResizeObserver > "u")
2054
+ return;
2055
+ const T = N.current, U = new ResizeObserver(([K]) => {
2056
+ const { width: Z, height: ae } = K.contentRect;
2057
+ Z > 0 && ae > 0 && (V({ width: Z, height: ae }), C(!0));
2058
+ });
2059
+ return U.observe(T), () => U.disconnect();
2060
+ }, [k]);
2061
+ const _e = ti({ disabled: !l || v }), { fitTo: le, viewport: me } = _e, Ne = ve(!1);
2062
+ Oe(() => {
2063
+ Ne.current || !H || R.totalSeats === 0 || ne.width <= 0 || (Ne.current = !0, le(R.bounds, ne));
2064
+ }, [le, R, ne, H]);
2065
+ const Me = X(() => Yt(me, ne, 40), [me, ne]), be = f !== "auto" ? f : P ? "seat" : void 0, he = X(
2066
+ () => Wt(R, Me, w, be),
2067
+ [R, Me, w, be]
2068
+ ), we = ve(null);
2069
+ Oe(() => {
2070
+ we.current !== he.tier && (we.current = he.tier, g == null || g(he.tier));
2071
+ }, [he.tier, g]);
2072
+ const Ve = X(
2073
+ () => {
2074
+ var T;
2075
+ return new Map(((T = n.sections) == null ? void 0 : T.map((U) => [U.id, U.color])) ?? []);
2076
+ },
2077
+ [n.sections]
2078
+ ), pe = X(
2079
+ () => {
2080
+ var T;
2081
+ return new Map(((T = n.sections) == null ? void 0 : T.map((U) => [U.id, U])) ?? []);
2082
+ },
2083
+ [n.sections]
2084
+ ), oe = G(
2085
+ (T) => {
2086
+ const U = pe.get(T.sectorId), K = ke(T, u), Z = tn(T), ae = [
2087
+ U ? U.name : "",
2088
+ `row ${T.row}`,
2089
+ `seat ${T.number}`
2090
+ ].filter(Boolean);
2091
+ if (U && o.showPrices !== !1) {
2092
+ const ue = yn(T, n, U);
2093
+ ae.push(se(ue.amount, ue.currency, y));
2094
+ }
2095
+ return ae.push(K), Z === "wheelchair" && ae.push("wheelchair accessible"), Z === "companion" && ae.push("companion seat"), ae.join(", ");
2096
+ },
2097
+ [n, pe, u, o.showPrices, y]
2098
+ ), re = G(
2099
+ (T) => {
2100
+ d === void 0 && z(T), h == null || h(T);
2101
+ },
2102
+ [d, h]
2103
+ ), Ie = G(
2104
+ (T) => {
2105
+ if (p == null || p(T), !q)
2106
+ return;
2107
+ const U = Gt(S, T.id, R, o, u);
2108
+ if ("rejected" in U) {
2109
+ i == null || i({ reason: U.rejected, seatId: T.id }), W(ii[U.rejected]);
2110
+ return;
2111
+ }
2112
+ re(U.selected), W(`${oe(T)}. ${U.selected.length} of ${Q} selected.`);
2113
+ },
2114
+ [
2115
+ re,
2116
+ oe,
2117
+ R,
2118
+ q,
2119
+ Q,
2120
+ p,
2121
+ i,
2122
+ u,
2123
+ S,
2124
+ o
2125
+ ]
2126
+ ), ge = G(
2127
+ (T, U) => {
2128
+ if (b) {
2129
+ b(T, U);
2130
+ return;
2131
+ }
2132
+ const K = Kt(R, T, o, U, u);
2133
+ if (K.length === 0) {
2134
+ W(`No block of ${T} seats together is available.`);
2135
+ return;
2136
+ }
2137
+ re(K), M(K[0]), W(`Selected ${K.length} seats together.`);
2138
+ },
2139
+ [re, R, b, u, o]
2140
+ ), Ce = G(
2141
+ (T) => {
2142
+ const U = R.locationById.get(T);
2143
+ if (!U)
2144
+ return;
2145
+ const K = R.rows.find(
2146
+ (Z) => Z.sectionId === U.sectionId && Z.rowIndex === U.rowIndex
2147
+ );
2148
+ K && le(K.bounds, ne, 80);
2149
+ },
2150
+ [le, R, ne]
2151
+ ), fe = G(
2152
+ (T) => {
2153
+ if (!T)
2154
+ return;
2155
+ M(T), Ce(T);
2156
+ const U = R.seatById.get(T);
2157
+ U && W(oe(U));
2158
+ },
2159
+ [oe, R.seatById, Ce]
2160
+ ), Fe = (T) => {
2161
+ var ae, ue;
2162
+ const U = P ?? ((ue = (ae = R.rows[0]) == null ? void 0 : ae.seats[0]) == null ? void 0 : ue.id) ?? null;
2163
+ if (!U)
2164
+ return;
2165
+ const Z = {
2166
+ ArrowLeft: "left",
2167
+ ArrowRight: "right",
2168
+ ArrowUp: "up",
2169
+ ArrowDown: "down",
2170
+ Home: "row-start",
2171
+ End: "row-end"
2172
+ }[T.key];
2173
+ if (Z) {
2174
+ T.preventDefault(), fe(P ? Ht(R, U, Z) : U);
2175
+ return;
2176
+ }
2177
+ if (T.key === "PageDown" || T.key === "PageUp") {
2178
+ T.preventDefault(), fe(Qt(R, P, T.key === "PageDown" ? "next" : "prev"));
2179
+ return;
2180
+ }
2181
+ if (T.key === "Enter" || T.key === " ") {
2182
+ T.preventDefault();
2183
+ const De = R.seatById.get(U);
2184
+ De && Ie(De);
2185
+ return;
2186
+ }
2187
+ T.key === "Escape" && S.length > 0 && (T.preventDefault(), re([]), W("Selection cleared."));
2188
+ };
2189
+ if (R.totalSeats === 0)
2190
+ return /* @__PURE__ */ e("div", { ref: r, className: `nice-seating-chart ${I ?? ""}`, style: D, children: /* @__PURE__ */ e(
2191
+ ye,
2192
+ {
2193
+ title: "This chart has no seats",
2194
+ description: "Add sections and rows to the seating chart to see it here."
2195
+ }
2196
+ ) });
2197
+ const Se = S.reduce((T, U) => {
2198
+ const K = R.seatById.get(U), Z = K ? pe.get(K.sectorId) : void 0;
2199
+ return !K || !Z ? T : T + yn(K, n, Z).amount;
2200
+ }, 0), ze = (($e = (de = n.sections) == null ? void 0 : de[0]) == null ? void 0 : $e.currency) ?? "PLN";
2201
+ return /* @__PURE__ */ a(
2202
+ "div",
2203
+ {
2204
+ ref: r,
2205
+ className: `nice-seating-chart nice-seating-chart--${c} ${I ?? ""}`,
2206
+ style: D,
2207
+ children: [
2208
+ /* @__PURE__ */ a(
2209
+ "div",
2210
+ {
2211
+ ref: N,
2212
+ className: "nice-seating-chart__canvas-host",
2213
+ role: "grid",
2214
+ "aria-label": `${n.name} seating chart`,
2215
+ "aria-rowcount": R.rows.length,
2216
+ "aria-colcount": R.totalSeats,
2217
+ tabIndex: P ? -1 : 0,
2218
+ onKeyDown: Fe,
2219
+ ..._e.containerProps,
2220
+ children: [
2221
+ /* @__PURE__ */ a(
2222
+ "svg",
2223
+ {
2224
+ className: "nice-seating-chart__canvas",
2225
+ width: "100%",
2226
+ height: "100%",
2227
+ role: "presentation",
2228
+ children: [
2229
+ /* @__PURE__ */ e("defs", { children: /* @__PURE__ */ e(
2230
+ "pattern",
2231
+ {
2232
+ id: "nice-seat-companion-hatch",
2233
+ width: 4,
2234
+ height: 4,
2235
+ patternUnits: "userSpaceOnUse",
2236
+ patternTransform: "rotate(45)",
2237
+ children: /* @__PURE__ */ e("line", { x1: 0, y1: 0, x2: 0, y2: 4, className: "nice-seating-chart__hatch" })
2238
+ }
2239
+ ) }),
2240
+ /* @__PURE__ */ e("g", { transform: `translate(${me.pan.x} ${me.pan.y}) scale(${me.zoom})`, children: /* @__PURE__ */ e(
2241
+ Jt,
2242
+ {
2243
+ cull: he,
2244
+ selectedIds: Y,
2245
+ cursorId: P,
2246
+ statusOverrides: u,
2247
+ sectionColorById: Ve,
2248
+ interactive: q,
2249
+ onSeatClick: Ie,
2250
+ onSectionClick: o.sectionSelect ? (T) => {
2251
+ var K;
2252
+ const U = (K = R.rows.find((Z) => Z.sectionId === T)) == null ? void 0 : K.seats[0];
2253
+ U && fe(U.id);
2254
+ } : void 0,
2255
+ describeSeat: oe
2256
+ }
2257
+ ) })
2258
+ ]
2259
+ }
2260
+ ),
2261
+ l && /* @__PURE__ */ a("div", { className: "nice-seating-chart__zoom", children: [
2262
+ /* @__PURE__ */ e(
2263
+ F,
2264
+ {
2265
+ size: "sm",
2266
+ variant: "ghost",
2267
+ ariaLabel: "Zoom in",
2268
+ onClick: () => _e.zoomBy(1.25, void 0, ne),
2269
+ children: "+"
2270
+ }
2271
+ ),
2272
+ /* @__PURE__ */ e(
2273
+ F,
2274
+ {
2275
+ size: "sm",
2276
+ variant: "ghost",
2277
+ ariaLabel: "Zoom out",
2278
+ onClick: () => _e.zoomBy(0.8, void 0, ne),
2279
+ children: "−"
2280
+ }
2281
+ ),
2282
+ /* @__PURE__ */ e(
2283
+ F,
2284
+ {
2285
+ size: "sm",
2286
+ variant: "ghost",
2287
+ ariaLabel: "Fit to view",
2288
+ onClick: () => le(R.bounds, ne),
2289
+ children: "Fit"
2290
+ }
2291
+ )
2292
+ ] })
2293
+ ]
2294
+ }
2295
+ ),
2296
+ /* @__PURE__ */ e("p", { className: "nice-seating-chart__status", role: "status", "aria-live": "polite", children: j }),
2297
+ _ && /* @__PURE__ */ a("ul", { className: "nice-seating-chart__legend", children: [
2298
+ (xe = n.priceCategories) == null ? void 0 : xe.map((T) => /* @__PURE__ */ a("li", { className: "nice-seating-chart__legend-item", children: [
2299
+ /* @__PURE__ */ e(
2300
+ "span",
2301
+ {
2302
+ className: "nice-seating-chart__legend-swatch",
2303
+ style: { background: T.color },
2304
+ "aria-hidden": "true"
2305
+ }
2306
+ ),
2307
+ T.name,
2308
+ " · ",
2309
+ se(T.price, ze, y)
2310
+ ] }, T.id)),
2311
+ /* @__PURE__ */ a("li", { className: "nice-seating-chart__legend-item nice-seating-chart__legend-item--sold", children: [
2312
+ /* @__PURE__ */ e("span", { className: "nice-seating-chart__legend-swatch", "aria-hidden": "true" }),
2313
+ " Sold"
2314
+ ] })
2315
+ ] }),
2316
+ c === "select" && S.length > 0 && /* @__PURE__ */ a("p", { className: "nice-seating-chart__total", children: [
2317
+ S.length,
2318
+ " seat",
2319
+ S.length === 1 ? "" : "s",
2320
+ " ·",
2321
+ " ",
2322
+ se(Se, ze, y)
2323
+ ] }),
2324
+ $ && /* @__PURE__ */ e(
2325
+ ei,
2326
+ {
2327
+ index: R,
2328
+ selectedIds: Y,
2329
+ statusOverrides: u,
2330
+ maxSeats: Q,
2331
+ onSeatToggle: Ie,
2332
+ onBestAvailable: ge,
2333
+ describeSeat: oe,
2334
+ disabled: !q,
2335
+ defaultOpen: c === "select" && $
2336
+ }
2337
+ )
2338
+ ]
2339
+ }
2340
+ );
2341
+ }
2342
+ ), Pi = ee(
2343
+ function({ showList: t = !0, className: r, ...n }, c) {
2344
+ return /* @__PURE__ */ e(
2345
+ ai,
2346
+ {
2347
+ ref: c,
2348
+ mode: "select",
2349
+ showList: t,
2350
+ className: `nice-seat-picker ${r ?? ""}`,
2351
+ ...n
2352
+ }
2353
+ );
2354
+ }
2355
+ ), Bn = /\{\{\s*([\w.-]+)\s*\}\}/g, si = {
2356
+ "&": "&amp;",
2357
+ "<": "&lt;",
2358
+ ">": "&gt;",
2359
+ '"': "&quot;",
2360
+ "'": "&#39;"
2361
+ };
2362
+ function ri(s) {
2363
+ return s.replace(/[&<>"']/g, (t) => si[t] ?? t);
2364
+ }
2365
+ function li(s) {
2366
+ const t = [], r = /* @__PURE__ */ new Set();
2367
+ for (const n of s.matchAll(Bn)) {
2368
+ const c = n[1];
2369
+ r.has(c) || (r.add(c), t.push(c));
2370
+ }
2371
+ return t;
2372
+ }
2373
+ function ci(s, t = {}, r = {}) {
2374
+ const { escape: n = !0, missing: c = "keep" } = r;
2375
+ return s.replace(Bn, (o, d) => {
2376
+ const m = t[d];
2377
+ return m == null ? c === "blank" ? "" : o : n ? ri(String(m)) : String(m);
2378
+ });
2379
+ }
2380
+ function _n(s) {
2381
+ return `{{${s}}}`;
2382
+ }
2383
+ function oi(s, t = {}) {
2384
+ return li(s).filter((r) => t[r] === void 0 || t[r] === null);
2385
+ }
2386
+ const di = [
2387
+ "bold",
2388
+ "italic",
2389
+ "underline",
2390
+ "h1",
2391
+ "h2",
2392
+ "ul",
2393
+ "ol",
2394
+ "link",
2395
+ "image",
2396
+ "alignLeft",
2397
+ "alignCenter",
2398
+ "undo",
2399
+ "redo"
2400
+ ], Ti = ee(
2401
+ function(t, r) {
2402
+ const {
2403
+ template: n,
2404
+ onTemplateChange: c,
2405
+ tokens: o = [],
2406
+ previewData: d = {},
2407
+ recipients: m = [],
2408
+ onRecipientsChange: h,
2409
+ onSend: i,
2410
+ sending: u = !1,
2411
+ toolbar: p = di,
2412
+ disabled: b = !1,
2413
+ readOnly: f = !1,
2414
+ size: g = "md",
2415
+ className: w,
2416
+ style: k
2417
+ } = t, [_, $] = E(""), l = b || f || u, y = X(() => Dn(_), [_]), v = X(() => {
2418
+ const C = {};
2419
+ for (const O of o)
2420
+ O.sample !== void 0 && (C[O.key] = O.sample);
2421
+ return { ...C, ...d };
2422
+ }, [o, d]), A = X(
2423
+ () => ci(n.body ?? "", v),
2424
+ [n.body, v]
2425
+ ), I = X(
2426
+ () => oi(n.body ?? "", v),
2427
+ [n.body, v]
2428
+ ), D = m.map((C) => C.email), N = (C) => c == null ? void 0 : c({ ...n, ...C }), L = (C) => {
2429
+ N({ body: `${n.body ?? ""}${_n(C)}` });
2430
+ }, V = () => {
2431
+ !h || y.valid.length === 0 || (h(Et(D, y.valid)), $(""));
2432
+ }, B = (C) => {
2433
+ h == null || h(D.filter((O) => O !== C));
2434
+ };
2435
+ return /* @__PURE__ */ a(
2436
+ "div",
2437
+ {
2438
+ ref: r,
2439
+ className: `nice-invitation-designer nice-invitation-designer--${g} ${w ?? ""}`,
2440
+ style: k,
2441
+ children: [
2442
+ /* @__PURE__ */ a("section", { className: "nice-invitation-designer__editor", children: [
2443
+ /* @__PURE__ */ e(
2444
+ J,
2445
+ {
2446
+ label: "Template name",
2447
+ value: n.name,
2448
+ onChange: (C) => N({ name: C }),
2449
+ placeholder: "Birthday invitation",
2450
+ disabled: l,
2451
+ size: g
2452
+ }
2453
+ ),
2454
+ o.length > 0 && !f && /* @__PURE__ */ a("div", { className: "nice-invitation-designer__tokens", children: [
2455
+ /* @__PURE__ */ e("span", { className: "nice-invitation-designer__tokens-label", children: "Insert:" }),
2456
+ o.map((C) => /* @__PURE__ */ e(
2457
+ F,
2458
+ {
2459
+ size: "sm",
2460
+ variant: "outline",
2461
+ disabled: l,
2462
+ onClick: () => L(C.key),
2463
+ children: C.label
2464
+ },
2465
+ C.key
2466
+ ))
2467
+ ] }),
2468
+ /* @__PURE__ */ e(
2469
+ zt,
2470
+ {
2471
+ value: n.body ?? "",
2472
+ onChange: (C) => N({ body: C }),
2473
+ toolbar: p,
2474
+ height: 280,
2475
+ readOnly: f || u,
2476
+ disabled: b
2477
+ }
2478
+ )
2479
+ ] }),
2480
+ /* @__PURE__ */ a("section", { className: "nice-invitation-designer__preview", "aria-label": "Invitation preview", children: [
2481
+ /* @__PURE__ */ a("header", { className: "nice-invitation-designer__preview-header", children: [
2482
+ /* @__PURE__ */ e("h4", { children: "Preview" }),
2483
+ I.length > 0 && /* @__PURE__ */ a(te, { size: "xs", subtle: !0, variant: "warning", children: [
2484
+ I.length,
2485
+ " unresolved"
2486
+ ] })
2487
+ ] }),
2488
+ n.coverImageUrl && /* @__PURE__ */ e("img", { className: "nice-invitation-designer__cover", src: n.coverImageUrl, alt: "" }),
2489
+ /* @__PURE__ */ e(
2490
+ "div",
2491
+ {
2492
+ className: "nice-invitation-designer__preview-body",
2493
+ dangerouslySetInnerHTML: { __html: A }
2494
+ }
2495
+ ),
2496
+ I.length > 0 && /* @__PURE__ */ a("p", { className: "nice-invitation-designer__unresolved", children: [
2497
+ "No preview value for: ",
2498
+ I.map((C) => _n(C)).join(", ")
2499
+ ] })
2500
+ ] }),
2501
+ /* @__PURE__ */ a("section", { className: "nice-invitation-designer__recipients", children: [
2502
+ /* @__PURE__ */ e("header", { className: "nice-invitation-designer__recipients-header", children: /* @__PURE__ */ a("h4", { children: [
2503
+ "Recipients ",
2504
+ /* @__PURE__ */ a("span", { children: [
2505
+ "(",
2506
+ m.length,
2507
+ ")"
2508
+ ] })
2509
+ ] }) }),
2510
+ h && !f && /* @__PURE__ */ a(Ke, { children: [
2511
+ /* @__PURE__ */ e(
2512
+ Ze,
2513
+ {
2514
+ label: "Add addresses",
2515
+ value: _,
2516
+ onChange: $,
2517
+ placeholder: "Paste a list — commas, semicolons or new lines",
2518
+ rows: 3,
2519
+ disabled: l,
2520
+ size: g
2521
+ }
2522
+ ),
2523
+ /* @__PURE__ */ a("div", { className: "nice-invitation-designer__paste-actions", children: [
2524
+ /* @__PURE__ */ a(
2525
+ F,
2526
+ {
2527
+ size: g,
2528
+ variant: "outline",
2529
+ leftIcon: /* @__PURE__ */ e(In, { size: 15 }),
2530
+ disabled: l || y.valid.length === 0,
2531
+ onClick: V,
2532
+ children: [
2533
+ "Add ",
2534
+ y.valid.length > 0 ? `(${y.valid.length})` : ""
2535
+ ]
2536
+ }
2537
+ ),
2538
+ (y.invalid.length > 0 || y.duplicates > 0) && /* @__PURE__ */ a("span", { className: "nice-invitation-designer__paste-hint", children: [
2539
+ y.duplicates > 0 && `${y.duplicates} duplicate(s). `,
2540
+ y.invalid.length > 0 && `${y.invalid.length} not recognised: ${y.invalid.slice(0, 3).join(", ")}`
2541
+ ] })
2542
+ ] })
2543
+ ] }),
2544
+ m.length > 0 && /* @__PURE__ */ e("ul", { className: "nice-invitation-designer__recipient-list", children: m.map((C) => /* @__PURE__ */ a("li", { className: "nice-invitation-designer__recipient", children: [
2545
+ /* @__PURE__ */ e("span", { children: C.name ? `${C.name} <${C.email}>` : C.email }),
2546
+ C.status && C.status !== "pending" && /* @__PURE__ */ e(
2547
+ te,
2548
+ {
2549
+ size: "xs",
2550
+ subtle: !0,
2551
+ variant: C.status === "sent" ? "success" : "error",
2552
+ children: C.status
2553
+ }
2554
+ ),
2555
+ h && !f && /* @__PURE__ */ e(
2556
+ F,
2557
+ {
2558
+ size: "sm",
2559
+ variant: "ghost",
2560
+ ariaLabel: `Remove ${C.email}`,
2561
+ disabled: l,
2562
+ onClick: () => B(C.email),
2563
+ children: /* @__PURE__ */ e(Te, { size: 13 })
2564
+ }
2565
+ )
2566
+ ] }, C.email)) }),
2567
+ i && !f && /* @__PURE__ */ e(
2568
+ F,
2569
+ {
2570
+ variant: "primary",
2571
+ size: g,
2572
+ leftIcon: /* @__PURE__ */ e(pt, { size: 15 }),
2573
+ loading: u,
2574
+ ariaLabel: "Send invitations",
2575
+ disabled: b || u || m.length === 0,
2576
+ onClick: () => i({ templateId: n.id, emails: D }),
2577
+ children: u ? "Sending…" : `Send to ${m.length}`
2578
+ }
2579
+ )
2580
+ ] })
2581
+ ]
2582
+ }
2583
+ );
2584
+ }
2585
+ ), ui = ({
2586
+ value: s,
2587
+ max: t,
2588
+ currency: r,
2589
+ locale: n,
2590
+ label: c,
2591
+ className: o
2592
+ }) => {
2593
+ const d = t > 0 ? t : 1, m = s >= t && t > 0, h = (i, u) => r ? `${se(i, r, n)} / ${se(u, r, n)}` : `${i} / ${u}`;
2594
+ return /* @__PURE__ */ e(
2595
+ $t,
2596
+ {
2597
+ className: o,
2598
+ value: Math.min(s, d),
2599
+ max: d,
2600
+ variant: m ? "success" : "primary",
2601
+ size: "sm",
2602
+ showValue: !0,
2603
+ formatValue: () => h(s, t),
2604
+ "aria-label": c
2605
+ }
2606
+ );
2607
+ };
2608
+ function mi(s, t) {
2609
+ if (t === "wishlist")
2610
+ return { value: s.isPurchased ? 1 : 0, max: 1, complete: !!s.isPurchased };
2611
+ const r = s.quantityNeeded ?? 1, n = s.quantityContributed ?? 0;
2612
+ return { value: n, max: r, complete: r > 0 && n >= r };
2613
+ }
2614
+ const Mi = ee(
2615
+ function(t, r) {
2616
+ const {
2617
+ items: n,
2618
+ kind: c = "registry",
2619
+ mode: o = "owner",
2620
+ currency: d = "PLN",
2621
+ locale: m,
2622
+ hideContributors: h = !1,
2623
+ currentUserId: i,
2624
+ currentUserName: u,
2625
+ onContribute: p,
2626
+ onClaim: b,
2627
+ onUnclaim: f,
2628
+ onItemAdd: g,
2629
+ onItemDelete: w,
2630
+ onItemClick: k,
2631
+ layout: _ = "grid",
2632
+ disabled: $ = !1,
2633
+ readOnly: l = !1,
2634
+ size: y = "md",
2635
+ className: v,
2636
+ style: A
2637
+ } = t, I = En({ currentUserId: i, currentUserName: u }), [D, N] = E(null), [L, V] = E(0), [B, C] = E(""), O = o === "owner", z = $ || l, P = c === "wishlist", M = X(() => P ? [...n].sort(
2638
+ (S, Y) => Number(S.isPurchased ?? !1) - Number(Y.isPurchased ?? !1) || (Y.priority ?? 0) - (S.priority ?? 0)
2639
+ ) : n, [n, P]), j = () => {
2640
+ N(null), V(0);
2641
+ }, W = (S) => {
2642
+ !p || !I.canAct || (p(S.id, {
2643
+ amount: L > 0 ? L : void 0,
2644
+ quantity: L > 0 ? void 0 : 1,
2645
+ userName: I.actor.userName,
2646
+ userId: I.actor.userId
2647
+ }), j());
2648
+ };
2649
+ return n.length === 0 ? /* @__PURE__ */ e("div", { ref: r, className: `nice-gift-registry ${v ?? ""}`, style: A, children: /* @__PURE__ */ e(
2650
+ ye,
2651
+ {
2652
+ icon: /* @__PURE__ */ e(gt, { size: 28 }),
2653
+ title: P ? "Nothing on the wishlist yet" : "No gifts on the registry yet",
2654
+ description: O ? "Add what you would like and share the link." : "The host has not added anything yet."
2655
+ }
2656
+ ) }) : /* @__PURE__ */ a(
2657
+ "div",
2658
+ {
2659
+ ref: r,
2660
+ className: `nice-gift-registry nice-gift-registry--${c} nice-gift-registry--${_} nice-gift-registry--${y} ${v ?? ""}`,
2661
+ style: A,
2662
+ children: [
2663
+ !O && I.isAnonymous && (p || b) && /* @__PURE__ */ e(
2664
+ J,
2665
+ {
2666
+ label: "Your name",
2667
+ value: I.name,
2668
+ onChange: I.setName,
2669
+ placeholder: "So the host knows who to thank",
2670
+ required: !0,
2671
+ disabled: z,
2672
+ size: y
2673
+ }
2674
+ ),
2675
+ /* @__PURE__ */ e(Pn, { columns: _ === "list" ? 1 : void 0, minColumnWidth: 240, gap: 12, children: M.map((S) => {
2676
+ const { value: Y, max: q, complete: Q } = mi(S, c), R = S.price, ne = S.contributions ?? [];
2677
+ return /* @__PURE__ */ a(
2678
+ "div",
2679
+ {
2680
+ className: `nice-gift-registry__item${Q ? " nice-gift-registry__item--complete" : ""}`,
2681
+ children: [
2682
+ S.imageUrl && /* @__PURE__ */ e(
2683
+ "img",
2684
+ {
2685
+ src: S.imageUrl,
2686
+ alt: "",
2687
+ className: "nice-gift-registry__image",
2688
+ loading: "lazy"
2689
+ }
2690
+ ),
2691
+ /* @__PURE__ */ a("div", { className: "nice-gift-registry__body", children: [
2692
+ /* @__PURE__ */ e(
2693
+ "button",
2694
+ {
2695
+ type: "button",
2696
+ className: "nice-gift-registry__title",
2697
+ onClick: () => k == null ? void 0 : k(S),
2698
+ disabled: !k,
2699
+ children: S.title
2700
+ }
2701
+ ),
2702
+ S.description && /* @__PURE__ */ e("p", { className: "nice-gift-registry__description", children: S.description }),
2703
+ /* @__PURE__ */ a("div", { className: "nice-gift-registry__facts", children: [
2704
+ R && /* @__PURE__ */ e("span", { className: "nice-gift-registry__price", children: se(R.amount, R.currency || d, m) }),
2705
+ P && (S.priority ?? 0) > 0 && /* @__PURE__ */ a(te, { size: "xs", subtle: !0, variant: "warning", children: [
2706
+ /* @__PURE__ */ e(ft, { size: 11 }),
2707
+ " ",
2708
+ S.priority
2709
+ ] }),
2710
+ Q && /* @__PURE__ */ e(te, { size: "xs", subtle: !0, variant: "success", children: P ? "bought" : "fully covered" }),
2711
+ S.url && /* @__PURE__ */ a(
2712
+ "a",
2713
+ {
2714
+ className: "nice-gift-registry__link",
2715
+ href: S.url,
2716
+ target: "_blank",
2717
+ rel: "noopener noreferrer",
2718
+ children: [
2719
+ /* @__PURE__ */ e(vt, { size: 13 }),
2720
+ " Shop"
2721
+ ]
2722
+ }
2723
+ )
2724
+ ] }),
2725
+ !P && /* @__PURE__ */ e(
2726
+ ui,
2727
+ {
2728
+ value: Y,
2729
+ max: q,
2730
+ label: `${S.title}: ${Y} of ${q} covered`
2731
+ }
2732
+ ),
2733
+ !h && ne.length > 0 && /* @__PURE__ */ e("ul", { className: "nice-gift-registry__contributors", children: ne.map((H) => /* @__PURE__ */ a("li", { className: "nice-gift-registry__contributor", children: [
2734
+ /* @__PURE__ */ e("strong", { children: H.contributorName }),
2735
+ H.amount !== void 0 && ` — ${se(H.amount, (R == null ? void 0 : R.currency) || d, m)}`,
2736
+ H.amount === void 0 && H.quantity ? ` — ${H.quantity}×` : "",
2737
+ H.message && /* @__PURE__ */ a("em", { children: [
2738
+ " “",
2739
+ H.message,
2740
+ "”"
2741
+ ] })
2742
+ ] }, H.id)) }),
2743
+ /* @__PURE__ */ a("div", { className: "nice-gift-registry__actions", children: [
2744
+ !O && !Q && b && /* @__PURE__ */ e(
2745
+ F,
2746
+ {
2747
+ size: "sm",
2748
+ variant: "primary",
2749
+ disabled: z || !I.canAct,
2750
+ leftIcon: /* @__PURE__ */ e(He, { size: 14 }),
2751
+ onClick: () => b(S.id, { ...I.actor, quantity: 1 }),
2752
+ children: "I'll take this"
2753
+ }
2754
+ ),
2755
+ !O && Q && f && /* @__PURE__ */ e(
2756
+ F,
2757
+ {
2758
+ size: "sm",
2759
+ variant: "ghost",
2760
+ disabled: z,
2761
+ onClick: () => f(S.id),
2762
+ children: "Release"
2763
+ }
2764
+ ),
2765
+ !O && !Q && !P && p && /* @__PURE__ */ e(
2766
+ F,
2767
+ {
2768
+ size: "sm",
2769
+ variant: "outline",
2770
+ disabled: z || !I.canAct,
2771
+ onClick: () => N(D === S.id ? null : S.id),
2772
+ children: "Chip in"
2773
+ }
2774
+ ),
2775
+ O && w && !l && /* @__PURE__ */ e(
2776
+ F,
2777
+ {
2778
+ size: "sm",
2779
+ variant: "ghost",
2780
+ ariaLabel: `Delete ${S.title}`,
2781
+ disabled: $,
2782
+ onClick: () => w(S.id),
2783
+ children: /* @__PURE__ */ e(Te, { size: 14 })
2784
+ }
2785
+ )
2786
+ ] }),
2787
+ D === S.id && /* @__PURE__ */ a("div", { className: "nice-gift-registry__pledge", children: [
2788
+ /* @__PURE__ */ a("label", { className: "nice-gift-registry__pledge-field", children: [
2789
+ /* @__PURE__ */ a("span", { children: [
2790
+ "Amount (",
2791
+ (R == null ? void 0 : R.currency) || d,
2792
+ ")"
2793
+ ] }),
2794
+ /* @__PURE__ */ e(
2795
+ Je,
2796
+ {
2797
+ value: L,
2798
+ onChange: (H) => V(Math.max(0, H ?? 0)),
2799
+ min: 0,
2800
+ size: "xs",
2801
+ disabled: z
2802
+ }
2803
+ )
2804
+ ] }),
2805
+ /* @__PURE__ */ e(
2806
+ F,
2807
+ {
2808
+ size: "sm",
2809
+ variant: "primary",
2810
+ disabled: z || !I.canAct,
2811
+ onClick: () => W(S),
2812
+ children: "Confirm"
2813
+ }
2814
+ ),
2815
+ /* @__PURE__ */ e(F, { size: "sm", variant: "ghost", onClick: j, children: "Cancel" })
2816
+ ] })
2817
+ ] })
2818
+ ]
2819
+ },
2820
+ S.id
2821
+ );
2822
+ }) }),
2823
+ O && g && !l && /* @__PURE__ */ a("div", { className: "nice-gift-registry__add", children: [
2824
+ /* @__PURE__ */ e(
2825
+ J,
2826
+ {
2827
+ label: P ? "Add a wish" : "Add a gift",
2828
+ value: B,
2829
+ onChange: C,
2830
+ placeholder: "What would you like?",
2831
+ disabled: $,
2832
+ size: y
2833
+ }
2834
+ ),
2835
+ /* @__PURE__ */ e(
2836
+ F,
2837
+ {
2838
+ variant: "primary",
2839
+ size: y,
2840
+ leftIcon: /* @__PURE__ */ e(kn, { size: 15 }),
2841
+ disabled: $ || !B.trim(),
2842
+ onClick: () => {
2843
+ g({ title: B.trim(), quantityNeeded: 1 }), C("");
110
2844
  },
111
- d.id
112
- ))
113
- }
114
- )
2845
+ children: "Add"
2846
+ }
2847
+ )
2848
+ ] })
115
2849
  ]
116
2850
  }
117
2851
  );
118
2852
  }
119
2853
  );
120
- function ee(z) {
121
- const N = z.toLowerCase();
122
- return ["active", "live", "published", "completed", "confirmed"].includes(N) ? "success" : ["cancelled", "canceled", "rejected", "failed"].includes(N) ? "error" : ["scheduled", "pending", "planning"].includes(N) ? "info" : ["draft", "archived"].includes(N) ? "secondary" : "warning";
2854
+ function hi(s) {
2855
+ const t = /* @__PURE__ */ new Map();
2856
+ for (const r of s) {
2857
+ const n = (r.currency || "").toUpperCase(), c = t.get(n);
2858
+ c ? c.push(r) : t.set(n, [r]);
2859
+ }
2860
+ return t;
123
2861
  }
124
- const gn = {
125
- micro: [],
126
- compact: ["details", "location", "budget"],
127
- normal: ["details", "location", "participants", "surveys", "budget"],
128
- full: ["details", "location", "participants", "surveys", "budget", "settings"]
129
- }, zn = E(
130
- function(N, C) {
131
- var ce, se, oe, de, me, pe;
132
- const {
133
- event: t,
134
- participants: p = [],
135
- surveys: u = [],
136
- billing: m = [],
137
- displayMode: h = "normal",
138
- tabs: v,
139
- activeTab: _,
140
- onTabChange: g,
141
- tabsIconOnly: S = !0,
142
- tabsCentered: b = "auto",
143
- editable: l = !1,
144
- onSave: o,
145
- onPublish: k,
146
- onShare: y,
147
- onExport: x,
148
- onUpdateEvent: d,
149
- onUpdateLocation: n,
150
- onAddSurvey: c,
151
- onSurveyRespond: a,
152
- onAddBilling: w,
153
- className: s,
154
- style: A
155
- } = N, [P, V] = f(t.title), [M, Ce] = f(t.description ?? ""), [F, Se] = f(t.startDate ?? ""), [Q, xe] = f(t.endDate ?? ""), [j, we] = f(((ce = t.location) == null ? void 0 : ce.name) ?? ""), [G, ze] = f(((se = t.location) == null ? void 0 : se.address) ?? ""), [H, Ae] = f(((oe = t.location) == null ? void 0 : oe.virtualUrl) ?? ""), [U, Ie] = f(((de = t.location) == null ? void 0 : de.isVirtual) ?? !1), [$, ie] = f(""), [Y, Le] = f("single"), [K, te] = f(""), [D, ae] = f(""), [J, le] = f(""), [X, Te] = f("PLN"), re = v ?? gn[h], [Pe, Re] = f(re[0] ?? "details"), Be = _ ?? Pe, Ee = O(
156
- (r) => {
157
- const R = r;
158
- _ === void 0 && Re(R), g == null || g(R);
159
- },
160
- [_, g]
161
- ), Oe = O(() => {
162
- d == null || d({
163
- title: P,
164
- description: M || void 0,
165
- startDate: F || void 0,
166
- endDate: Q || void 0
167
- });
168
- }, [P, M, F, Q, d]), $e = O(() => {
169
- n == null || n({
170
- name: j,
171
- address: G || void 0,
172
- virtualUrl: H || void 0,
173
- isVirtual: U
174
- });
175
- }, [j, G, H, U, n]), De = O(() => {
176
- if (!$.trim() || !c)
177
- return;
178
- const r = K.split(",").map((R) => R.trim()).filter(Boolean);
179
- c($.trim(), Y, r.length > 0 ? r : void 0), ie(""), te("");
180
- }, [$, Y, K, c]), Ve = O(() => {
181
- !D.trim() || !w || (w({
182
- label: D.trim(),
183
- amount: parseFloat(J) || 0,
184
- currency: X
185
- }), ae(""), le(""));
186
- }, [D, J, X, w]), Me = I(
187
- () => m.map((r) => ({
188
- label: r.label,
189
- amount: r.amount
190
- })),
191
- [m]
192
- ), Ue = I(() => m.reduce((r, R) => r + R.amount, 0), [m]), We = ((me = m[0]) == null ? void 0 : me.currency) ?? "PLN", qe = /* @__PURE__ */ i("div", { className: "nice-event-planning__form", children: [
193
- /* @__PURE__ */ e(
194
- T,
195
- {
196
- label: "Title",
197
- value: P,
198
- onChange: V,
199
- readOnly: !l
200
- }
201
- ),
202
- /* @__PURE__ */ e(
203
- hn,
204
- {
205
- label: "Description",
206
- value: M,
207
- onChange: Ce,
208
- readOnly: !l,
209
- rows: 3
210
- }
211
- ),
212
- /* @__PURE__ */ i("div", { className: "nice-event-planning__row", children: [
213
- /* @__PURE__ */ i("label", { className: "nice-field", children: [
214
- /* @__PURE__ */ e("span", { className: "nice-field__label", children: "Start" }),
215
- /* @__PURE__ */ e(
216
- "input",
217
- {
218
- className: "nice-input",
219
- type: "datetime-local",
220
- value: F,
221
- onChange: (r) => Se(r.target.value),
222
- readOnly: !l
223
- }
224
- )
225
- ] }),
226
- /* @__PURE__ */ i("label", { className: "nice-field", children: [
227
- /* @__PURE__ */ e("span", { className: "nice-field__label", children: "End" }),
228
- /* @__PURE__ */ e(
229
- "input",
230
- {
231
- className: "nice-input",
232
- type: "datetime-local",
233
- value: Q,
234
- onChange: (r) => xe(r.target.value),
235
- readOnly: !l
236
- }
237
- )
238
- ] })
239
- ] }),
240
- l && /* @__PURE__ */ e(
241
- B,
242
- {
243
- variant: "primary",
244
- leftIcon: /* @__PURE__ */ e(L, { name: "check", size: "sm" }),
245
- onClick: Oe,
246
- children: "Save details"
247
- }
248
- )
249
- ] }), Fe = /* @__PURE__ */ i("div", { className: "nice-event-planning__form", children: [
250
- /* @__PURE__ */ e(
251
- ge,
252
- {
253
- label: "Virtual event",
254
- checked: U,
255
- onChange: Ie,
256
- disabled: !l
257
- }
258
- ),
259
- /* @__PURE__ */ e(
260
- T,
261
- {
262
- label: "Venue name",
263
- value: j,
264
- onChange: we,
265
- readOnly: !l
266
- }
267
- ),
268
- U ? /* @__PURE__ */ e(
269
- T,
270
- {
271
- label: "Virtual URL",
272
- value: H,
273
- onChange: Ae,
274
- readOnly: !l
275
- }
276
- ) : /* @__PURE__ */ e(
277
- T,
278
- {
279
- label: "Address",
280
- value: G,
281
- onChange: ze,
282
- readOnly: !l
283
- }
284
- ),
285
- l && /* @__PURE__ */ e(
286
- B,
287
- {
288
- variant: "primary",
289
- leftIcon: /* @__PURE__ */ e(L, { name: "check", size: "sm" }),
290
- onClick: $e,
291
- children: "Save location"
292
- }
293
- )
294
- ] }), Qe = /* @__PURE__ */ e("div", { className: "nice-event-planning__participants", children: p.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-event-planning__empty", children: "No participants yet." }) : /* @__PURE__ */ i(nn, { children: [
295
- /* @__PURE__ */ e(he, { max: 8, children: p.map((r) => /* @__PURE__ */ e(Z, { name: r.name, src: r.avatarUrl }, r.id)) }),
296
- /* @__PURE__ */ e("ul", { className: "nice-event-planning__participant-list", children: p.map((r) => /* @__PURE__ */ i("li", { className: "nice-event-planning__participant", children: [
297
- /* @__PURE__ */ e(Z, { name: r.name, src: r.avatarUrl, size: "sm" }),
298
- /* @__PURE__ */ e("span", { className: "nice-event-planning__participant-name", children: r.name }),
299
- /* @__PURE__ */ e(W, { size: "xs", subtle: !0, variant: ee(r.status), children: r.status })
300
- ] }, r.id)) })
301
- ] }) }), je = /* @__PURE__ */ i("div", { className: "nice-event-planning__form", children: [
302
- u.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-event-planning__empty", children: "No surveys yet." }) : u.map((r) => /* @__PURE__ */ i("div", { className: "nice-event-planning__survey", children: [
303
- /* @__PURE__ */ e("strong", { children: r.question }),
304
- " ",
305
- /* @__PURE__ */ e(W, { size: "xs", outline: !0, variant: "info", children: r.type }),
306
- r.options && /* @__PURE__ */ e("div", { className: "nice-event-planning__survey-options", children: r.options.map((R, en) => /* @__PURE__ */ e(
307
- B,
308
- {
309
- size: "sm",
310
- variant: "outline",
311
- onClick: () => a == null ? void 0 : a(r.id, R),
312
- children: R
313
- },
314
- en
315
- )) }),
316
- r.responses && /* @__PURE__ */ i("span", { className: "nice-event-planning__muted", children: [
317
- r.responses.length,
318
- " responses"
319
- ] })
320
- ] }, r.id)),
321
- l && c && /* @__PURE__ */ i("div", { className: "nice-event-planning__form", children: [
322
- /* @__PURE__ */ e(
323
- T,
324
- {
325
- label: "New survey question",
326
- value: $,
327
- onChange: ie,
328
- placeholder: "Question"
329
- }
330
- ),
331
- /* @__PURE__ */ e(
332
- ve,
333
- {
334
- label: "Type",
335
- value: Y,
336
- onChange: (r) => Le(r),
337
- options: [
338
- { value: "single", label: "Single choice" },
339
- { value: "multiple", label: "Multiple choice" },
340
- { value: "text", label: "Free text" },
341
- { value: "rating", label: "Rating" }
342
- ]
343
- }
344
- ),
345
- /* @__PURE__ */ e(
346
- T,
347
- {
348
- label: "Options (comma-separated)",
349
- value: K,
350
- onChange: te,
351
- placeholder: "Yes, No, Maybe"
352
- }
353
- ),
354
- /* @__PURE__ */ e(
355
- B,
356
- {
357
- variant: "primary",
358
- leftIcon: /* @__PURE__ */ e(L, { name: "plus", size: "sm" }),
359
- onClick: De,
360
- disabled: !$.trim(),
361
- children: "Add survey"
362
- }
363
- )
364
- ] })
365
- ] }), Ge = /* @__PURE__ */ i("div", { className: "nice-event-planning__form", children: [
366
- m.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-event-planning__empty", children: "No billing items yet." }) : /* @__PURE__ */ e(
367
- pn,
368
- {
369
- lines: [...Me, { label: "Total", amount: Ue, isSummary: !0 }],
370
- currency: We
371
- }
372
- ),
373
- l && w && /* @__PURE__ */ i("div", { className: "nice-event-planning__row", children: [
374
- /* @__PURE__ */ e(
375
- T,
376
- {
377
- label: "Item",
378
- value: D,
379
- onChange: ae,
380
- placeholder: "Catering"
381
- }
382
- ),
383
- /* @__PURE__ */ e(
384
- T,
385
- {
386
- label: "Amount",
387
- value: J,
388
- onChange: le,
389
- placeholder: "0.00"
390
- }
391
- ),
392
- /* @__PURE__ */ e(
393
- ve,
394
- {
395
- label: "Currency",
396
- value: X,
397
- onChange: (r) => Te(r),
398
- options: ["PLN", "EUR", "USD", "GBP"]
399
- }
400
- ),
401
- /* @__PURE__ */ e(
402
- B,
403
- {
404
- variant: "primary",
405
- leftIcon: /* @__PURE__ */ e(L, { name: "plus", size: "sm" }),
406
- onClick: Ve,
407
- disabled: !D.trim(),
408
- children: "Add"
409
- }
410
- )
411
- ] })
412
- ] }), He = /* @__PURE__ */ i("div", { className: "nice-event-planning__form", children: [
413
- /* @__PURE__ */ e(ge, { label: "Public event", checked: t.isPublic ?? !1, disabled: !l }),
414
- /* @__PURE__ */ e(
415
- T,
416
- {
417
- label: "Max participants",
418
- value: t.maxParticipants != null ? String(t.maxParticipants) : "",
419
- onChange: () => {
420
- },
421
- readOnly: !l
2862
+ function pi(s, t, r) {
2863
+ var h;
2864
+ const n = new Set(t.map((i) => i.id)), c = t.map((i) => i.id), o = new Map(c.map((i) => [i, 0])), d = [];
2865
+ let m = 0;
2866
+ if (c.length === 0)
2867
+ return {
2868
+ balances: o,
2869
+ issues: s.map((i) => ({ itemId: i.id, reason: "no-participants" })),
2870
+ totalMinor: 0
2871
+ };
2872
+ for (const i of s) {
2873
+ const u = i.paidById;
2874
+ if (!u) {
2875
+ d.push({ itemId: i.id, reason: "no-payer" });
2876
+ continue;
2877
+ }
2878
+ if (!n.has(u)) {
2879
+ d.push({ itemId: i.id, reason: "unknown-payer" });
2880
+ continue;
2881
+ }
2882
+ let p = (h = i.splitAmong) != null && h.length ? i.splitAmong.filter((_) => n.has(_)) : c;
2883
+ p.length === 0 && (p = c);
2884
+ const b = nn(i.amount, r);
2885
+ m += b;
2886
+ const f = p.length, g = Math.floor(b / f), w = b - g * f, k = new Map(p.map((_) => [_, g]));
2887
+ if (w !== 0)
2888
+ if (k.has(u))
2889
+ k.set(u, (k.get(u) ?? 0) + w);
2890
+ else {
2891
+ const _ = [...p].sort(Xe), $ = w > 0 ? 1 : -1;
2892
+ for (let l = 0; l < Math.abs(w); l += 1) {
2893
+ const y = _[l % _.length];
2894
+ k.set(y, (k.get(y) ?? 0) + $);
422
2895
  }
423
- ),
424
- /* @__PURE__ */ i("div", { className: "nice-event-planning__muted", children: [
425
- "Host: ",
426
- t.hostName,
427
- " · Created ",
428
- new Date(t.createdAt).toLocaleDateString()
429
- ] })
430
- ] }), Ye = {
431
- details: qe,
432
- location: Fe,
433
- participants: Qe,
434
- surveys: je,
435
- budget: Ge,
436
- settings: He
437
- }, Ke = {
438
- details: "file",
439
- location: "home",
440
- participants: "users",
441
- surveys: "clipboard",
442
- budget: "file",
443
- settings: "settings"
444
- }, Je = {
445
- participants: p.length || void 0,
446
- surveys: u.length || void 0,
447
- budget: m.length || void 0
448
- }, Xe = re.map((r) => ({
449
- id: r,
450
- label: r.charAt(0).toUpperCase() + r.slice(1),
451
- icon: /* @__PURE__ */ e(L, { name: Ke[r], size: "sm" }),
452
- badge: Je[r],
453
- content: Ye[r]
454
- })), Ze = /* @__PURE__ */ i("div", { className: "nice-event-planning__toolbar", children: [
455
- /* @__PURE__ */ i("div", { className: "nice-event-planning__toolbar-title", children: [
456
- /* @__PURE__ */ e(L, { name: "calendar", size: "md" }),
457
- /* @__PURE__ */ e("span", { className: "nice-event-planning__title", children: t.title }),
458
- /* @__PURE__ */ e(W, { size: "sm", variant: ee(t.status), children: t.status })
459
- ] }),
460
- /* @__PURE__ */ e("span", { className: "nice-event-planning__toolbar-spacer" }),
461
- /* @__PURE__ */ i("div", { className: "nice-event-planning__toolbar-actions", children: [
462
- o && /* @__PURE__ */ e(
463
- B,
464
- {
465
- size: "sm",
466
- variant: "primary",
467
- leftIcon: /* @__PURE__ */ e(L, { name: "check", size: "sm" }),
468
- onClick: () => o({ title: P, description: M }),
469
- children: "Save"
470
- }
471
- ),
472
- k && /* @__PURE__ */ e(
473
- B,
474
- {
475
- size: "sm",
476
- variant: "success",
477
- leftIcon: /* @__PURE__ */ e(L, { name: "upload", size: "sm" }),
478
- onClick: k,
479
- children: "Publish"
480
- }
481
- ),
482
- y && /* @__PURE__ */ e(
483
- B,
484
- {
485
- size: "sm",
486
- variant: "ghost",
487
- leftIcon: /* @__PURE__ */ e(L, { name: "link", size: "sm" }),
488
- onClick: y,
489
- children: "Share"
490
- }
491
- ),
492
- x && /* @__PURE__ */ e(
493
- B,
494
- {
495
- size: "sm",
496
- variant: "ghost",
497
- leftIcon: /* @__PURE__ */ e(L, { name: "download", size: "sm" }),
498
- onClick: x,
499
- children: "Export"
500
- }
501
- )
502
- ] })
503
- ] });
504
- return h === "micro" ? /* @__PURE__ */ e(
505
- "div",
2896
+ }
2897
+ o.set(u, (o.get(u) ?? 0) + b);
2898
+ for (const [_, $] of k)
2899
+ o.set(_, (o.get(_) ?? 0) - $);
2900
+ }
2901
+ return { balances: o, issues: d, totalMinor: m };
2902
+ }
2903
+ function gi(s, t, r) {
2904
+ for (const n of t) {
2905
+ if ((n.currency || "").toUpperCase() !== r || !s.has(n.fromId) || !s.has(n.toId))
2906
+ continue;
2907
+ const c = nn(n.amount, r);
2908
+ s.set(n.fromId, (s.get(n.fromId) ?? 0) + c), s.set(n.toId, (s.get(n.toId) ?? 0) - c);
2909
+ }
2910
+ }
2911
+ function fi(s, t, r) {
2912
+ const n = new Map(t.map((i) => [i.id, i.name])), c = [...s.entries()].filter(([, i]) => i > 0).map(([i, u]) => ({ id: i, v: u })).sort((i, u) => u.v - i.v || Xe(i.id, u.id)), o = [...s.entries()].filter(([, i]) => i < 0).map(([i, u]) => ({ id: i, v: u })).sort((i, u) => i.v - u.v || Xe(i.id, u.id)), d = [];
2913
+ let m = 0, h = 0;
2914
+ for (; m < o.length && h < c.length; ) {
2915
+ const i = Math.min(-o[m].v, c[h].v);
2916
+ i > 0 && d.push({
2917
+ fromId: o[m].id,
2918
+ fromName: n.get(o[m].id) ?? o[m].id,
2919
+ toId: c[h].id,
2920
+ toName: n.get(c[h].id) ?? c[h].id,
2921
+ amount: Ye(i, r),
2922
+ currency: r
2923
+ }), o[m].v += i, c[h].v -= i, o[m].v === 0 && (m += 1), c[h].v === 0 && (h += 1);
2924
+ }
2925
+ return d;
2926
+ }
2927
+ function vi(s, t, r = []) {
2928
+ const n = [], c = [], o = [...hi(s).entries()].sort(([d], [m]) => Xe(d, m));
2929
+ for (const [d, m] of o) {
2930
+ const h = pi(m, t, d);
2931
+ c.push(...h.issues), gi(h.balances, r, d), n.push({
2932
+ currency: d,
2933
+ total: Ye(h.totalMinor, d),
2934
+ balances: t.map((i) => ({
2935
+ participantId: i.id,
2936
+ participantName: i.name,
2937
+ amount: Ye(h.balances.get(i.id) ?? 0, d),
2938
+ currency: d
2939
+ })),
2940
+ transfers: fi(h.balances, t, d)
2941
+ });
2942
+ }
2943
+ return { groups: n, issues: c };
2944
+ }
2945
+ function Xe(s, t) {
2946
+ return s < t ? -1 : s > t ? 1 : 0;
2947
+ }
2948
+ const Di = ee(
2949
+ function(t, r) {
2950
+ const {
2951
+ items: n,
2952
+ participants: c,
2953
+ settlements: o = [],
2954
+ view: d,
2955
+ defaultView: m = "expenses",
2956
+ onViewChange: h,
2957
+ onSettle: i,
2958
+ onItemDelete: u,
2959
+ onItemClick: p,
2960
+ onValidationChange: b,
2961
+ sortBy: f = "date",
2962
+ locale: g,
2963
+ disabled: w = !1,
2964
+ readOnly: k = !1,
2965
+ size: _ = "md",
2966
+ className: $,
2967
+ style: l
2968
+ } = t, [y, v] = E(m), A = d ?? y, I = w || k, D = X(
2969
+ () => c.map((z) => ({ id: z.id, name: z.name })),
2970
+ [c]
2971
+ ), N = X(() => vi(n, D, o), [n, D, o]), L = X(() => f === "none" ? n : n.map((z, P) => ({ item: z, index: P })).sort((z, P) => {
2972
+ if (f === "amount")
2973
+ return P.item.amount - z.item.amount || z.index - P.index;
2974
+ const M = z.item.incurredAt, j = P.item.incurredAt;
2975
+ return M && j ? M.localeCompare(j) || z.index - P.index : M ? -1 : j ? 1 : z.index - P.index;
2976
+ }).map((z) => z.item), [n, f]), V = N.issues.map((z) => `${z.itemId}:${z.reason}`).join("|");
2977
+ Ue.useEffect(() => {
2978
+ b == null || b(N.issues);
2979
+ }, [V]);
2980
+ const B = X(
2981
+ () => new Map(c.map((z) => [z.id, z.avatarUrl])),
2982
+ [c]
2983
+ ), C = X(
2984
+ () => new Map(N.issues.map((z) => [z.itemId, z.reason])),
2985
+ [N.issues]
2986
+ ), O = (z) => {
2987
+ d === void 0 && v(z), h == null || h(z);
2988
+ };
2989
+ return n.length === 0 ? /* @__PURE__ */ e("div", { ref: r, className: `nice-expense-split ${$ ?? ""}`, style: l, children: /* @__PURE__ */ e(
2990
+ ye,
506
2991
  {
507
- ref: C,
508
- className: `nice-event-planning nice-event-planning--micro ${s ?? ""}`,
509
- style: A,
510
- children: /* @__PURE__ */ i("div", { className: "nice-event-planning__micro", children: [
511
- /* @__PURE__ */ e(L, { name: "calendar", size: "md" }),
512
- /* @__PURE__ */ i("div", { className: "nice-event-planning__micro-body", children: [
513
- /* @__PURE__ */ e("span", { className: "nice-event-planning__title", children: t.title }),
514
- /* @__PURE__ */ i("span", { className: "nice-event-planning__muted", children: [
515
- t.startDate ? new Date(t.startDate).toLocaleString() : "No date",
516
- (pe = t.location) != null && pe.name ? ` · ${t.location.name}` : ""
517
- ] })
518
- ] }),
519
- /* @__PURE__ */ e(W, { size: "sm", variant: ee(t.status), children: t.status }),
520
- p.length > 0 && /* @__PURE__ */ e(he, { max: 4, size: "sm", children: p.map((r) => /* @__PURE__ */ e(Z, { name: r.name, src: r.avatarUrl, size: "sm" }, r.id)) })
521
- ] })
2992
+ icon: /* @__PURE__ */ e(yt, { size: 28 }),
2993
+ title: "No expenses yet",
2994
+ description: "Add what people paid for and this will work out who owes whom."
522
2995
  }
523
- ) : /* @__PURE__ */ i(
2996
+ ) }) : /* @__PURE__ */ a(
524
2997
  "div",
525
2998
  {
526
- ref: C,
527
- className: `nice-event-planning nice-event-planning--${h} ${s ?? ""}`,
528
- style: A,
2999
+ ref: r,
3000
+ className: `nice-expense-split nice-expense-split--${_} ${$ ?? ""}`,
3001
+ style: l,
529
3002
  children: [
530
- Ze,
531
3003
  /* @__PURE__ */ e(
532
- un,
3004
+ Tn,
533
3005
  {
534
- tabs: Xe,
535
- activeTab: Be,
536
- onChange: Ee,
537
- iconOnly: S,
538
- centered: b
3006
+ size: _,
3007
+ value: A,
3008
+ onChange: (z) => O(z),
3009
+ options: [
3010
+ { value: "expenses", label: "Expenses" },
3011
+ { value: "balances", label: "Balances" },
3012
+ { value: "settlement", label: "Settle up" }
3013
+ ]
539
3014
  }
540
- )
3015
+ ),
3016
+ A === "expenses" && /* @__PURE__ */ e("ul", { className: "nice-expense-split__items", children: L.map((z) => {
3017
+ const P = C.get(z.id);
3018
+ return /* @__PURE__ */ a(
3019
+ "li",
3020
+ {
3021
+ className: `nice-expense-split__item${P ? " nice-expense-split__item--excluded" : ""}`,
3022
+ children: [
3023
+ /* @__PURE__ */ a(
3024
+ "button",
3025
+ {
3026
+ type: "button",
3027
+ className: "nice-expense-split__item-main",
3028
+ onClick: () => p == null ? void 0 : p(z),
3029
+ disabled: !p,
3030
+ children: [
3031
+ /* @__PURE__ */ e("span", { className: "nice-expense-split__item-label", children: z.label }),
3032
+ /* @__PURE__ */ a("span", { className: "nice-expense-split__item-payer", children: [
3033
+ z.paidByName ?? z.paidById ?? "nobody",
3034
+ " paid"
3035
+ ] })
3036
+ ]
3037
+ }
3038
+ ),
3039
+ /* @__PURE__ */ e("span", { className: "nice-expense-split__item-amount", children: se(z.amount, z.currency, g) }),
3040
+ z.isPaid && /* @__PURE__ */ e(te, { size: "xs", subtle: !0, variant: "success", children: "paid" }),
3041
+ P && /* @__PURE__ */ e(te, { size: "xs", subtle: !0, variant: "warning", children: P === "no-payer" ? "no payer" : "unknown payer" }),
3042
+ u && !k && /* @__PURE__ */ e(
3043
+ F,
3044
+ {
3045
+ size: "sm",
3046
+ variant: "ghost",
3047
+ ariaLabel: `Delete ${z.label}`,
3048
+ disabled: w,
3049
+ onClick: () => u(z.id),
3050
+ children: /* @__PURE__ */ e(Te, { size: 14 })
3051
+ }
3052
+ )
3053
+ ]
3054
+ },
3055
+ z.id
3056
+ );
3057
+ }) }),
3058
+ A === "balances" && N.groups.map((z) => /* @__PURE__ */ a("section", { className: "nice-expense-split__group", children: [
3059
+ /* @__PURE__ */ a("h4", { className: "nice-expense-split__group-title", children: [
3060
+ z.currency,
3061
+ /* @__PURE__ */ a("span", { className: "nice-expense-split__group-total", children: [
3062
+ se(z.total, z.currency, g),
3063
+ " total"
3064
+ ] })
3065
+ ] }),
3066
+ /* @__PURE__ */ e("ul", { className: "nice-participant-list__rows", children: z.balances.map((P) => /* @__PURE__ */ e(
3067
+ je,
3068
+ {
3069
+ participant: {
3070
+ id: P.participantId,
3071
+ name: P.participantName,
3072
+ avatarUrl: B.get(P.participantId)
3073
+ },
3074
+ showRole: !1,
3075
+ showStatus: !1,
3076
+ size: _,
3077
+ children: /* @__PURE__ */ a(
3078
+ "span",
3079
+ {
3080
+ className: `nice-expense-split__balance nice-expense-split__balance--${P.amount > 0 ? "owed" : P.amount < 0 ? "owes" : "settled"}`,
3081
+ children: [
3082
+ P.amount === 0 ? "settled up" : se(Math.abs(P.amount), P.currency, g),
3083
+ P.amount > 0 && /* @__PURE__ */ e("em", { children: " is owed" }),
3084
+ P.amount < 0 && /* @__PURE__ */ e("em", { children: " owes" })
3085
+ ]
3086
+ }
3087
+ )
3088
+ },
3089
+ P.participantId
3090
+ )) })
3091
+ ] }, z.currency)),
3092
+ A === "settlement" && (N.groups.every((z) => z.transfers.length === 0) ? /* @__PURE__ */ e(
3093
+ ye,
3094
+ {
3095
+ icon: /* @__PURE__ */ e(_t, { size: 28 }),
3096
+ title: "All settled up",
3097
+ description: "Nobody owes anybody anything."
3098
+ }
3099
+ ) : N.groups.filter((z) => z.transfers.length > 0).map((z) => /* @__PURE__ */ a("section", { className: "nice-expense-split__group", children: [
3100
+ /* @__PURE__ */ a("h4", { className: "nice-expense-split__group-title", children: [
3101
+ z.currency,
3102
+ /* @__PURE__ */ a("span", { className: "nice-expense-split__group-total", children: [
3103
+ z.transfers.length,
3104
+ " transfer",
3105
+ z.transfers.length === 1 ? "" : "s"
3106
+ ] })
3107
+ ] }),
3108
+ /* @__PURE__ */ e("ul", { className: "nice-expense-split__transfers", children: z.transfers.map((P) => /* @__PURE__ */ a(
3109
+ "li",
3110
+ {
3111
+ className: "nice-expense-split__transfer",
3112
+ children: [
3113
+ /* @__PURE__ */ e("span", { className: "nice-expense-split__transfer-from", children: P.fromName }),
3114
+ /* @__PURE__ */ e(Nt, { size: 15 }),
3115
+ /* @__PURE__ */ e("span", { className: "nice-expense-split__transfer-to", children: P.toName }),
3116
+ /* @__PURE__ */ e("span", { className: "nice-expense-split__transfer-amount", children: se(P.amount, P.currency, g) }),
3117
+ i && !k && /* @__PURE__ */ e(
3118
+ F,
3119
+ {
3120
+ size: "sm",
3121
+ variant: "outline",
3122
+ disabled: I,
3123
+ onClick: () => i(P),
3124
+ children: "Mark paid"
3125
+ }
3126
+ )
3127
+ ]
3128
+ },
3129
+ `${P.fromId}-${P.toId}-${P.amount}`
3130
+ )) })
3131
+ ] }, z.currency)))
541
3132
  ]
542
3133
  }
543
3134
  );
544
3135
  }
545
- ), yn = {
3136
+ ), yi = {
546
3137
  upcoming: "⏳",
547
3138
  active: "▶️",
548
3139
  voting: "🗳️",
549
3140
  scored: "📊",
550
3141
  completed: "✅",
551
3142
  skipped: "⏭️"
552
- }, fn = {
3143
+ }, _i = {
553
3144
  upcoming: "#9ca3af",
554
3145
  active: "#22c55e",
555
3146
  voting: "#eab308",
556
3147
  scored: "#3b82f6",
557
3148
  completed: "#6b7280",
558
3149
  skipped: "#d1d5db"
559
- }, An = E(
560
- function(N, C) {
3150
+ }, Ei = ee(
3151
+ function(t, r) {
561
3152
  const {
562
- rounds: t,
563
- activeRoundId: p,
564
- onSelect: u,
565
- onStart: m,
566
- onEnd: h,
567
- onCreate: v,
568
- editable: _ = !1,
569
- className: g,
570
- style: S
571
- } = N, b = [...t].sort((l, o) => l.order - o.order);
572
- return /* @__PURE__ */ i("div", { ref: C, className: `nice-round-list ${g ?? ""}`, style: S, children: [
573
- /* @__PURE__ */ i("div", { className: "nice-round-list__header", children: [
574
- /* @__PURE__ */ i("h3", { children: [
3153
+ rounds: n,
3154
+ activeRoundId: c,
3155
+ onSelect: o,
3156
+ onStart: d,
3157
+ onEnd: m,
3158
+ onCreate: h,
3159
+ editable: i = !1,
3160
+ className: u,
3161
+ style: p
3162
+ } = t, b = [...n].sort((f, g) => f.order - g.order);
3163
+ return /* @__PURE__ */ a("div", { ref: r, className: `nice-round-list ${u ?? ""}`, style: p, children: [
3164
+ /* @__PURE__ */ a("div", { className: "nice-round-list__header", children: [
3165
+ /* @__PURE__ */ a("h3", { children: [
575
3166
  "Rounds (",
576
- t.length,
3167
+ n.length,
577
3168
  ")"
578
3169
  ] }),
579
- _ && v && /* @__PURE__ */ e("button", { onClick: v, children: "+ Add Round" })
3170
+ i && h && /* @__PURE__ */ e("button", { onClick: h, children: "+ Add Round" })
580
3171
  ] }),
581
- b.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-round-list__empty", children: "No rounds yet." }) : /* @__PURE__ */ e("div", { className: "nice-round-list__items", children: b.map((l) => {
582
- const o = l.id === p;
583
- return /* @__PURE__ */ i(
3172
+ b.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-round-list__empty", children: "No rounds yet." }) : /* @__PURE__ */ e("div", { className: "nice-round-list__items", children: b.map((f) => {
3173
+ const g = f.id === c;
3174
+ return /* @__PURE__ */ a(
584
3175
  "div",
585
3176
  {
586
- className: `nice-round-list__item ${o ? "nice-round-list__item--active" : ""}`,
587
- onClick: () => u == null ? void 0 : u(l),
588
- role: u ? "button" : void 0,
589
- tabIndex: u ? 0 : void 0,
3177
+ className: `nice-round-list__item ${g ? "nice-round-list__item--active" : ""}`,
3178
+ onClick: () => o == null ? void 0 : o(f),
3179
+ role: o ? "button" : void 0,
3180
+ tabIndex: o ? 0 : void 0,
590
3181
  children: [
591
- /* @__PURE__ */ i("span", { className: "nice-round-list__order", children: [
3182
+ /* @__PURE__ */ a("span", { className: "nice-round-list__order", children: [
592
3183
  "#",
593
- l.order
3184
+ f.order
594
3185
  ] }),
595
- /* @__PURE__ */ e("span", { className: "nice-round-list__icon", children: yn[l.status] }),
596
- /* @__PURE__ */ i("div", { className: "nice-round-list__info", children: [
597
- /* @__PURE__ */ e("strong", { className: "nice-round-list__name", children: l.name }),
598
- l.description && /* @__PURE__ */ e("small", { children: l.description }),
599
- l.type && /* @__PURE__ */ e("span", { className: "nice-round-list__type", children: l.type })
3186
+ /* @__PURE__ */ e("span", { className: "nice-round-list__icon", children: yi[f.status] }),
3187
+ /* @__PURE__ */ a("div", { className: "nice-round-list__info", children: [
3188
+ /* @__PURE__ */ e("strong", { className: "nice-round-list__name", children: f.name }),
3189
+ f.description && /* @__PURE__ */ e("small", { children: f.description }),
3190
+ f.type && /* @__PURE__ */ e("span", { className: "nice-round-list__type", children: f.type })
600
3191
  ] }),
601
3192
  /* @__PURE__ */ e(
602
3193
  "span",
603
3194
  {
604
3195
  className: "nice-round-list__status",
605
- style: { color: fn[l.status] },
606
- children: l.status
3196
+ style: { color: _i[f.status] },
3197
+ children: f.status
607
3198
  }
608
3199
  ),
609
- l.durationMinutes && /* @__PURE__ */ i("span", { className: "nice-round-list__duration", children: [
610
- l.durationMinutes,
3200
+ f.durationMinutes && /* @__PURE__ */ a("span", { className: "nice-round-list__duration", children: [
3201
+ f.durationMinutes,
611
3202
  "m"
612
3203
  ] }),
613
- l.winnerIds && l.winnerIds.length > 0 && /* @__PURE__ */ i("span", { className: "nice-round-list__winners", children: [
3204
+ f.winnerIds && f.winnerIds.length > 0 && /* @__PURE__ */ a("span", { className: "nice-round-list__winners", children: [
614
3205
  "🏆 ",
615
- l.winnerIds.length
3206
+ f.winnerIds.length
616
3207
  ] }),
617
- _ && /* @__PURE__ */ i("div", { className: "nice-round-list__actions", onClick: (k) => k.stopPropagation(), children: [
618
- l.status === "upcoming" && m && /* @__PURE__ */ e("button", { onClick: () => m(l.id), children: "Start" }),
619
- (l.status === "active" || l.status === "voting") && h && /* @__PURE__ */ e("button", { onClick: () => h(l.id), children: "End" })
3208
+ i && /* @__PURE__ */ a("div", { className: "nice-round-list__actions", onClick: (w) => w.stopPropagation(), children: [
3209
+ f.status === "upcoming" && d && /* @__PURE__ */ e("button", { onClick: () => d(f.id), children: "Start" }),
3210
+ (f.status === "active" || f.status === "voting") && m && /* @__PURE__ */ e("button", { onClick: () => m(f.id), children: "End" })
620
3211
  ] })
621
3212
  ]
622
3213
  },
623
- l.id
3214
+ f.id
624
3215
  );
625
3216
  }) })
626
3217
  ] });
627
3218
  }
628
- ), In = E(
629
- function(N, C) {
3219
+ ), Li = ee(
3220
+ function(t, r) {
630
3221
  const {
631
- round: t,
632
- timerRunning: p = !1,
633
- remainingSeconds: u,
634
- onSubmitScore: m,
635
- onStart: h,
636
- onEnd: v,
637
- onSkip: _,
638
- editable: g = !1,
639
- footerActions: S,
3222
+ round: n,
3223
+ timerRunning: c = !1,
3224
+ remainingSeconds: o,
3225
+ onSubmitScore: d,
3226
+ onStart: m,
3227
+ onEnd: h,
3228
+ onSkip: i,
3229
+ editable: u = !1,
3230
+ footerActions: p,
640
3231
  className: b,
641
- style: l
642
- } = N, [o, k] = f({}), y = O(
643
- (n) => {
644
- const c = parseFloat(o[n] ?? "");
645
- isNaN(c) || !m || (m(n, c), k((a) => ({ ...a, [n]: "" })));
3232
+ style: f
3233
+ } = t, [g, w] = E({}), k = G(
3234
+ (l) => {
3235
+ const y = parseFloat(g[l] ?? "");
3236
+ isNaN(y) || !d || (d(l, y), w((v) => ({ ...v, [l]: "" })));
646
3237
  },
647
- [o, m]
648
- ), x = (n) => {
649
- const c = Math.floor(n / 60), a = n % 60;
650
- return `${c}:${a.toString().padStart(2, "0")}`;
651
- }, d = t.scores ? [...t.scores].sort((n, c) => c.score - n.score) : [];
652
- return /* @__PURE__ */ i(
3238
+ [g, d]
3239
+ ), _ = (l) => {
3240
+ const y = Math.floor(l / 60), v = l % 60;
3241
+ return `${y}:${v.toString().padStart(2, "0")}`;
3242
+ }, $ = n.scores ? [...n.scores].sort((l, y) => y.score - l.score) : [];
3243
+ return /* @__PURE__ */ a(
653
3244
  "div",
654
3245
  {
655
- ref: C,
656
- className: `nice-round-card nice-round-card--${t.status} ${b ?? ""}`,
657
- style: l,
3246
+ ref: r,
3247
+ className: `nice-round-card nice-round-card--${n.status} ${b ?? ""}`,
3248
+ style: f,
658
3249
  children: [
659
- /* @__PURE__ */ i("div", { className: "nice-round-card__header", children: [
660
- /* @__PURE__ */ i("span", { className: "nice-round-card__order", children: [
3250
+ /* @__PURE__ */ a("div", { className: "nice-round-card__header", children: [
3251
+ /* @__PURE__ */ a("span", { className: "nice-round-card__order", children: [
661
3252
  "Round #",
662
- t.order
3253
+ n.order
663
3254
  ] }),
664
- /* @__PURE__ */ e("h3", { className: "nice-round-card__name", children: t.name }),
665
- /* @__PURE__ */ e("span", { className: "nice-round-card__status", children: t.status })
3255
+ /* @__PURE__ */ e("h3", { className: "nice-round-card__name", children: n.name }),
3256
+ /* @__PURE__ */ e("span", { className: "nice-round-card__status", children: n.status })
666
3257
  ] }),
667
- t.description && /* @__PURE__ */ e("p", { className: "nice-round-card__description", children: t.description }),
668
- (p || u != null) && /* @__PURE__ */ i(
3258
+ n.description && /* @__PURE__ */ e("p", { className: "nice-round-card__description", children: n.description }),
3259
+ (c || o != null) && /* @__PURE__ */ a(
669
3260
  "div",
670
3261
  {
671
- className: `nice-round-card__timer ${p ? "nice-round-card__timer--running" : ""}`,
3262
+ className: `nice-round-card__timer ${c ? "nice-round-card__timer--running" : ""}`,
672
3263
  children: [
673
3264
  "⏱️ ",
674
- u != null ? x(u) : "—"
3265
+ o != null ? _(o) : "—"
675
3266
  ]
676
3267
  }
677
3268
  ),
678
- d.length > 0 && /* @__PURE__ */ i("div", { className: "nice-round-card__scoreboard", children: [
3269
+ $.length > 0 && /* @__PURE__ */ a("div", { className: "nice-round-card__scoreboard", children: [
679
3270
  /* @__PURE__ */ e("h4", { children: "Scoreboard" }),
680
- /* @__PURE__ */ i("table", { className: "nice-round-card__scores-table", children: [
681
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ i("tr", { children: [
3271
+ /* @__PURE__ */ a("table", { className: "nice-round-card__scores-table", children: [
3272
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ a("tr", { children: [
682
3273
  /* @__PURE__ */ e("th", { children: "Rank" }),
683
3274
  /* @__PURE__ */ e("th", { children: "Participant" }),
684
3275
  /* @__PURE__ */ e("th", { children: "Score" })
685
3276
  ] }) }),
686
- /* @__PURE__ */ e("tbody", { children: d.map((n, c) => /* @__PURE__ */ i(
3277
+ /* @__PURE__ */ e("tbody", { children: $.map((l, y) => /* @__PURE__ */ a(
687
3278
  "tr",
688
3279
  {
689
- className: c < 3 ? `nice-round-card__top-${c + 1}` : "",
3280
+ className: y < 3 ? `nice-round-card__top-${y + 1}` : "",
690
3281
  children: [
691
- /* @__PURE__ */ i("td", { children: [
692
- n.rank ?? c + 1,
693
- c === 0 ? " 🥇" : c === 1 ? " 🥈" : c === 2 ? " 🥉" : ""
3282
+ /* @__PURE__ */ a("td", { children: [
3283
+ l.rank ?? y + 1,
3284
+ y === 0 ? " 🥇" : y === 1 ? " 🥈" : y === 2 ? " 🥉" : ""
694
3285
  ] }),
695
- /* @__PURE__ */ e("td", { children: n.participantName }),
696
- /* @__PURE__ */ e("td", { children: n.score })
3286
+ /* @__PURE__ */ e("td", { children: l.participantName }),
3287
+ /* @__PURE__ */ e("td", { children: l.score })
697
3288
  ]
698
3289
  },
699
- n.participantId
3290
+ l.participantId
700
3291
  )) })
701
3292
  ] })
702
3293
  ] }),
703
- m && (t.status === "active" || t.status === "voting") && d.length > 0 && /* @__PURE__ */ i("div", { className: "nice-round-card__score-input", children: [
3294
+ d && (n.status === "active" || n.status === "voting") && $.length > 0 && /* @__PURE__ */ a("div", { className: "nice-round-card__score-input", children: [
704
3295
  /* @__PURE__ */ e("h4", { children: "Submit Scores" }),
705
- d.map((n) => /* @__PURE__ */ i("div", { className: "nice-round-card__score-row", children: [
706
- /* @__PURE__ */ e("span", { children: n.participantName }),
3296
+ $.map((l) => /* @__PURE__ */ a("div", { className: "nice-round-card__score-row", children: [
3297
+ /* @__PURE__ */ e("span", { children: l.participantName }),
707
3298
  /* @__PURE__ */ e(
708
3299
  "input",
709
3300
  {
710
3301
  type: "number",
711
- value: o[n.participantId] ?? "",
712
- onChange: (c) => k((a) => ({ ...a, [n.participantId]: c.target.value })),
3302
+ value: g[l.participantId] ?? "",
3303
+ onChange: (y) => w((v) => ({ ...v, [l.participantId]: y.target.value })),
713
3304
  min: 0,
714
3305
  step: 1,
715
3306
  placeholder: "Score"
716
3307
  }
717
3308
  ),
718
- /* @__PURE__ */ e("button", { onClick: () => y(n.participantId), children: "Submit" })
719
- ] }, n.participantId))
3309
+ /* @__PURE__ */ e("button", { onClick: () => k(l.participantId), children: "Submit" })
3310
+ ] }, l.participantId))
720
3311
  ] }),
721
- /* @__PURE__ */ i("div", { className: "nice-round-card__footer", children: [
722
- g && /* @__PURE__ */ i("div", { className: "nice-round-card__actions", children: [
723
- t.status === "upcoming" && h && /* @__PURE__ */ e("button", { onClick: h, children: "▶ Start Round" }),
724
- (t.status === "active" || t.status === "voting") && v && /* @__PURE__ */ e("button", { onClick: v, children: "⏹ End Round" }),
725
- t.status === "upcoming" && _ && /* @__PURE__ */ e("button", { onClick: _, children: "⏭ Skip" })
3312
+ /* @__PURE__ */ a("div", { className: "nice-round-card__footer", children: [
3313
+ u && /* @__PURE__ */ a("div", { className: "nice-round-card__actions", children: [
3314
+ n.status === "upcoming" && m && /* @__PURE__ */ e("button", { onClick: m, children: "▶ Start Round" }),
3315
+ (n.status === "active" || n.status === "voting") && h && /* @__PURE__ */ e("button", { onClick: h, children: "⏹ End Round" }),
3316
+ n.status === "upcoming" && i && /* @__PURE__ */ e("button", { onClick: i, children: "⏭ Skip" })
726
3317
  ] }),
727
- S
3318
+ p
728
3319
  ] }),
729
- t.winnerIds && t.winnerIds.length > 0 && /* @__PURE__ */ i("div", { className: "nice-round-card__winners", children: [
3320
+ n.winnerIds && n.winnerIds.length > 0 && /* @__PURE__ */ a("div", { className: "nice-round-card__winners", children: [
730
3321
  "🏆 Winners: ",
731
- t.winnerIds.length
3322
+ n.winnerIds.length
732
3323
  ] })
733
3324
  ]
734
3325
  }
735
3326
  );
736
3327
  }
737
- ), Ln = E(
738
- function(N, C) {
3328
+ ), Bi = ee(
3329
+ function(t, r) {
739
3330
  const {
740
- songs: t,
741
- onAdd: p,
742
- onRemove: u,
743
- onVote: m,
744
- onSearch: h,
745
- showQueue: v = !0,
746
- readOnly: _ = !1,
747
- className: g,
748
- style: S
749
- } = N, [b, l] = f(""), o = I(() => {
3331
+ songs: n,
3332
+ onAdd: c,
3333
+ onRemove: o,
3334
+ onVote: d,
3335
+ onSearch: m,
3336
+ showQueue: h = !0,
3337
+ readOnly: i = !1,
3338
+ className: u,
3339
+ style: p
3340
+ } = t, [b, f] = E(""), g = X(() => {
750
3341
  if (!b.trim())
751
- return t;
752
- const n = b.toLowerCase();
753
- return t.filter(
754
- (c) => c.title.toLowerCase().includes(n) || c.artist.toLowerCase().includes(n)
3342
+ return n;
3343
+ const l = b.toLowerCase();
3344
+ return n.filter(
3345
+ (y) => y.title.toLowerCase().includes(l) || y.artist.toLowerCase().includes(l)
755
3346
  );
756
- }, [t, b]), k = I(() => t.filter((n) => n.isQueued), [t]), y = t.find((n) => n.isPlaying), x = (n) => {
757
- l(n), h == null || h(n);
758
- }, d = (n) => {
759
- if (!n)
3347
+ }, [n, b]), w = X(() => n.filter((l) => l.isQueued), [n]), k = n.find((l) => l.isPlaying), _ = (l) => {
3348
+ f(l), m == null || m(l);
3349
+ }, $ = (l) => {
3350
+ if (!l)
760
3351
  return "";
761
- const c = Math.floor(n / 60), a = n % 60;
762
- return `${c}:${a.toString().padStart(2, "0")}`;
3352
+ const y = Math.floor(l / 60), v = l % 60;
3353
+ return `${y}:${v.toString().padStart(2, "0")}`;
763
3354
  };
764
- return /* @__PURE__ */ i("div", { ref: C, className: `nice-song-picker ${g ?? ""}`, style: S, children: [
765
- y && /* @__PURE__ */ i("div", { className: "nice-song-picker__now-playing", children: [
3355
+ return /* @__PURE__ */ a("div", { ref: r, className: `nice-song-picker ${u ?? ""}`, style: p, children: [
3356
+ k && /* @__PURE__ */ a("div", { className: "nice-song-picker__now-playing", children: [
766
3357
  /* @__PURE__ */ e("span", { className: "nice-song-picker__np-label", children: "🎵 Now Playing" }),
767
- y.albumArt && /* @__PURE__ */ e("img", { src: y.albumArt, alt: "", className: "nice-song-picker__album-art" }),
768
- /* @__PURE__ */ e("strong", { children: y.title }),
769
- /* @__PURE__ */ e("span", { children: y.artist })
3358
+ k.albumArt && /* @__PURE__ */ e("img", { src: k.albumArt, alt: "", className: "nice-song-picker__album-art" }),
3359
+ /* @__PURE__ */ e("strong", { children: k.title }),
3360
+ /* @__PURE__ */ e("span", { children: k.artist })
770
3361
  ] }),
771
3362
  /* @__PURE__ */ e(
772
3363
  "input",
773
3364
  {
774
3365
  type: "text",
775
3366
  value: b,
776
- onChange: (n) => x(n.target.value),
3367
+ onChange: (l) => _(l.target.value),
777
3368
  placeholder: "Search songs…",
778
3369
  className: "nice-song-picker__search"
779
3370
  }
780
3371
  ),
781
- /* @__PURE__ */ e("div", { className: "nice-song-picker__list", children: o.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-song-picker__empty", children: "No songs found." }) : o.map((n) => /* @__PURE__ */ i(
3372
+ /* @__PURE__ */ e("div", { className: "nice-song-picker__list", children: g.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-song-picker__empty", children: "No songs found." }) : g.map((l) => /* @__PURE__ */ a(
782
3373
  "div",
783
3374
  {
784
- className: `nice-song-picker__item ${n.isPlaying ? "nice-song-picker__item--playing" : ""}`,
3375
+ className: `nice-song-picker__item ${l.isPlaying ? "nice-song-picker__item--playing" : ""}`,
785
3376
  children: [
786
- n.albumArt && /* @__PURE__ */ e("img", { src: n.albumArt, alt: "", className: "nice-song-picker__thumb" }),
787
- /* @__PURE__ */ i("div", { className: "nice-song-picker__info", children: [
788
- /* @__PURE__ */ e("strong", { children: n.title }),
789
- /* @__PURE__ */ e("span", { children: n.artist }),
790
- n.duration && /* @__PURE__ */ e("span", { className: "nice-song-picker__duration", children: d(n.duration) }),
791
- n.addedByName && /* @__PURE__ */ i("small", { children: [
3377
+ l.albumArt && /* @__PURE__ */ e("img", { src: l.albumArt, alt: "", className: "nice-song-picker__thumb" }),
3378
+ /* @__PURE__ */ a("div", { className: "nice-song-picker__info", children: [
3379
+ /* @__PURE__ */ e("strong", { children: l.title }),
3380
+ /* @__PURE__ */ e("span", { children: l.artist }),
3381
+ l.duration && /* @__PURE__ */ e("span", { className: "nice-song-picker__duration", children: $(l.duration) }),
3382
+ l.addedByName && /* @__PURE__ */ a("small", { children: [
792
3383
  "Added by ",
793
- n.addedByName
3384
+ l.addedByName
794
3385
  ] })
795
3386
  ] }),
796
- !_ && /* @__PURE__ */ i("div", { className: "nice-song-picker__actions", children: [
797
- m && /* @__PURE__ */ i("button", { onClick: () => m(n.id), children: [
3387
+ !i && /* @__PURE__ */ a("div", { className: "nice-song-picker__actions", children: [
3388
+ d && /* @__PURE__ */ a("button", { onClick: () => d(l.id), children: [
798
3389
  "👍 ",
799
- n.votes ?? 0
3390
+ l.votes ?? 0
800
3391
  ] }),
801
- p && !n.isQueued && /* @__PURE__ */ e("button", { onClick: () => p(n.id), children: "+ Queue" }),
802
- u && n.isQueued && /* @__PURE__ */ e("button", { onClick: () => u(n.id), children: "Remove" })
3392
+ c && !l.isQueued && /* @__PURE__ */ e("button", { onClick: () => c(l.id), children: "+ Queue" }),
3393
+ o && l.isQueued && /* @__PURE__ */ e("button", { onClick: () => o(l.id), children: "Remove" })
803
3394
  ] })
804
3395
  ]
805
3396
  },
806
- n.id
3397
+ l.id
807
3398
  )) }),
808
- v && k.length > 0 && /* @__PURE__ */ i("div", { className: "nice-song-picker__queue", children: [
809
- /* @__PURE__ */ i("h4", { children: [
3399
+ h && w.length > 0 && /* @__PURE__ */ a("div", { className: "nice-song-picker__queue", children: [
3400
+ /* @__PURE__ */ a("h4", { children: [
810
3401
  "Queue (",
811
- k.length,
3402
+ w.length,
812
3403
  ")"
813
3404
  ] }),
814
- k.map((n, c) => /* @__PURE__ */ i("div", { className: "nice-song-picker__queue-item", children: [
815
- /* @__PURE__ */ i("span", { className: "nice-song-picker__queue-pos", children: [
816
- c + 1,
3405
+ w.map((l, y) => /* @__PURE__ */ a("div", { className: "nice-song-picker__queue-item", children: [
3406
+ /* @__PURE__ */ a("span", { className: "nice-song-picker__queue-pos", children: [
3407
+ y + 1,
817
3408
  "."
818
3409
  ] }),
819
- /* @__PURE__ */ i("span", { children: [
820
- n.title,
3410
+ /* @__PURE__ */ a("span", { children: [
3411
+ l.title,
821
3412
  " — ",
822
- n.artist
3413
+ l.artist
823
3414
  ] })
824
- ] }, n.id))
3415
+ ] }, l.id))
825
3416
  ] })
826
3417
  ] });
827
3418
  }
828
- ), Tn = E(
829
- function(N, C) {
3419
+ ), Oi = ee(
3420
+ function(t, r) {
830
3421
  const {
831
- songs: t,
832
- queue: p = [],
833
- onEnqueue: u,
834
- onDequeue: m,
835
- onNext: h,
836
- nowPlayingId: v,
837
- readOnly: _ = !1,
838
- className: g,
839
- style: S
840
- } = N, [b, l] = f(""), [o, k] = f(""), y = t.find((a) => a.id === v), x = I(() => {
841
- let a = t;
3422
+ songs: n,
3423
+ queue: c = [],
3424
+ onEnqueue: o,
3425
+ onDequeue: d,
3426
+ onNext: m,
3427
+ nowPlayingId: h,
3428
+ readOnly: i = !1,
3429
+ className: u,
3430
+ style: p
3431
+ } = t, [b, f] = E(""), [g, w] = E(""), k = n.find((v) => v.id === h), _ = X(() => {
3432
+ let v = n;
842
3433
  if (b.trim()) {
843
- const w = b.toLowerCase();
844
- a = a.filter(
845
- (s) => s.title.toLowerCase().includes(w) || s.artist.toLowerCase().includes(w)
3434
+ const A = b.toLowerCase();
3435
+ v = v.filter(
3436
+ (I) => I.title.toLowerCase().includes(A) || I.artist.toLowerCase().includes(A)
846
3437
  );
847
3438
  }
848
- return o && (a = a.filter((w) => w.difficulty === o)), a;
849
- }, [t, b, o]), d = I(() => new Set(p.map((a) => a.id)), [p]), n = ["easy", "medium", "hard", "expert"], c = (a) => {
850
- switch (a) {
3439
+ return g && (v = v.filter((A) => A.difficulty === g)), v;
3440
+ }, [n, b, g]), $ = X(() => new Set(c.map((v) => v.id)), [c]), l = ["easy", "medium", "hard", "expert"], y = (v) => {
3441
+ switch (v) {
851
3442
  case "easy":
852
3443
  return "#4caf50";
853
3444
  case "medium":
@@ -860,8 +3451,8 @@ const gn = {
860
3451
  return "#999";
861
3452
  }
862
3453
  };
863
- return /* @__PURE__ */ i("div", { ref: C, className: `nice-karaoke-picker ${g ?? ""}`, style: S, children: [
864
- y && /* @__PURE__ */ i(
3454
+ return /* @__PURE__ */ a("div", { ref: r, className: `nice-karaoke-picker ${u ?? ""}`, style: p, children: [
3455
+ k && /* @__PURE__ */ a(
865
3456
  "div",
866
3457
  {
867
3458
  className: "nice-karaoke-picker__now-singing",
@@ -873,21 +3464,21 @@ const gn = {
873
3464
  },
874
3465
  children: [
875
3466
  /* @__PURE__ */ e("span", { style: { fontWeight: 600 }, children: "🎤 Now Singing" }),
876
- /* @__PURE__ */ i("div", { children: [
877
- /* @__PURE__ */ e("strong", { children: y.title }),
3467
+ /* @__PURE__ */ a("div", { children: [
3468
+ /* @__PURE__ */ e("strong", { children: k.title }),
878
3469
  " — ",
879
- y.artist,
880
- y.performerName && /* @__PURE__ */ i("span", { children: [
3470
+ k.artist,
3471
+ k.performerName && /* @__PURE__ */ a("span", { children: [
881
3472
  " (by ",
882
- y.performerName,
3473
+ k.performerName,
883
3474
  ")"
884
3475
  ] })
885
3476
  ] }),
886
- !_ && h && /* @__PURE__ */ e("button", { onClick: h, style: { marginTop: 8 }, children: "Skip / Next ⏭" })
3477
+ !i && m && /* @__PURE__ */ e("button", { onClick: m, style: { marginTop: 8 }, children: "Skip / Next ⏭" })
887
3478
  ]
888
3479
  }
889
3480
  ),
890
- /* @__PURE__ */ i(
3481
+ /* @__PURE__ */ a(
891
3482
  "div",
892
3483
  {
893
3484
  className: "nice-karaoke-picker__filters",
@@ -898,19 +3489,19 @@ const gn = {
898
3489
  {
899
3490
  type: "text",
900
3491
  value: b,
901
- onChange: (a) => l(a.target.value),
3492
+ onChange: (v) => f(v.target.value),
902
3493
  placeholder: "Search songs or artists…",
903
3494
  style: { flex: 1 }
904
3495
  }
905
3496
  ),
906
- /* @__PURE__ */ i("select", { value: o, onChange: (a) => k(a.target.value), children: [
3497
+ /* @__PURE__ */ a("select", { value: g, onChange: (v) => w(v.target.value), children: [
907
3498
  /* @__PURE__ */ e("option", { value: "", children: "All Difficulties" }),
908
- n.map((a) => /* @__PURE__ */ e("option", { value: a, children: a }, a))
3499
+ l.map((v) => /* @__PURE__ */ e("option", { value: v, children: v }, v))
909
3500
  ] })
910
3501
  ]
911
3502
  }
912
3503
  ),
913
- /* @__PURE__ */ e("div", { className: "nice-karaoke-picker__catalog", children: x.length === 0 ? /* @__PURE__ */ e("p", { children: "No songs match your search." }) : x.map((a) => /* @__PURE__ */ i(
3504
+ /* @__PURE__ */ e("div", { className: "nice-karaoke-picker__catalog", children: _.length === 0 ? /* @__PURE__ */ e("p", { children: "No songs match your search." }) : _.map((v) => /* @__PURE__ */ a(
914
3505
  "div",
915
3506
  {
916
3507
  className: "nice-karaoke-picker__song",
@@ -922,81 +3513,81 @@ const gn = {
922
3513
  borderBottom: "1px solid #eee"
923
3514
  },
924
3515
  children: [
925
- /* @__PURE__ */ i("div", { children: [
926
- /* @__PURE__ */ e("strong", { children: a.title }),
3516
+ /* @__PURE__ */ a("div", { children: [
3517
+ /* @__PURE__ */ e("strong", { children: v.title }),
927
3518
  " — ",
928
- a.artist,
929
- a.difficulty && /* @__PURE__ */ i(
3519
+ v.artist,
3520
+ v.difficulty && /* @__PURE__ */ a(
930
3521
  "span",
931
3522
  {
932
3523
  style: {
933
3524
  marginLeft: 8,
934
3525
  fontSize: 12,
935
- color: c(a.difficulty),
3526
+ color: y(v.difficulty),
936
3527
  fontWeight: 600
937
3528
  },
938
3529
  children: [
939
3530
  "[",
940
- a.difficulty,
3531
+ v.difficulty,
941
3532
  "]"
942
3533
  ]
943
3534
  }
944
3535
  ),
945
- a.hasLyrics && /* @__PURE__ */ e("span", { style: { marginLeft: 6, fontSize: 12 }, title: "Lyrics available", children: "📝" }),
946
- a.language && /* @__PURE__ */ i("span", { style: { marginLeft: 6, fontSize: 12, color: "#666" }, children: [
3536
+ v.hasLyrics && /* @__PURE__ */ e("span", { style: { marginLeft: 6, fontSize: 12 }, title: "Lyrics available", children: "📝" }),
3537
+ v.language && /* @__PURE__ */ a("span", { style: { marginLeft: 6, fontSize: 12, color: "#666" }, children: [
947
3538
  "(",
948
- a.language,
3539
+ v.language,
949
3540
  ")"
950
3541
  ] })
951
3542
  ] }),
952
- !_ && /* @__PURE__ */ e("div", { children: d.has(a.id) ? /* @__PURE__ */ e("button", { onClick: () => m == null ? void 0 : m(a.id), style: { color: "#f44336" }, children: "Remove" }) : /* @__PURE__ */ e("button", { onClick: () => u == null ? void 0 : u(a.id), children: "🎤 Sing" }) })
3543
+ !i && /* @__PURE__ */ e("div", { children: $.has(v.id) ? /* @__PURE__ */ e("button", { onClick: () => d == null ? void 0 : d(v.id), style: { color: "#f44336" }, children: "Remove" }) : /* @__PURE__ */ e("button", { onClick: () => o == null ? void 0 : o(v.id), children: "🎤 Sing" }) })
953
3544
  ]
954
3545
  },
955
- a.id
3546
+ v.id
956
3547
  )) }),
957
- p.length > 0 && /* @__PURE__ */ i("div", { className: "nice-karaoke-picker__queue", style: { marginTop: 16 }, children: [
958
- /* @__PURE__ */ i("h4", { children: [
3548
+ c.length > 0 && /* @__PURE__ */ a("div", { className: "nice-karaoke-picker__queue", style: { marginTop: 16 }, children: [
3549
+ /* @__PURE__ */ a("h4", { children: [
959
3550
  "🎶 Queue (",
960
- p.length,
3551
+ c.length,
961
3552
  ")"
962
3553
  ] }),
963
- p.map((a, w) => /* @__PURE__ */ i(
3554
+ c.map((v, A) => /* @__PURE__ */ a(
964
3555
  "div",
965
3556
  {
966
3557
  style: { display: "flex", justifyContent: "space-between", padding: "4px 0" },
967
3558
  children: [
968
- /* @__PURE__ */ i("span", { children: [
969
- /* @__PURE__ */ i("strong", { children: [
970
- w + 1,
3559
+ /* @__PURE__ */ a("span", { children: [
3560
+ /* @__PURE__ */ a("strong", { children: [
3561
+ A + 1,
971
3562
  "."
972
3563
  ] }),
973
3564
  " ",
974
- a.title,
3565
+ v.title,
975
3566
  " — ",
976
- a.artist,
977
- a.performerName && /* @__PURE__ */ i("em", { children: [
3567
+ v.artist,
3568
+ v.performerName && /* @__PURE__ */ a("em", { children: [
978
3569
  " (",
979
- a.performerName,
3570
+ v.performerName,
980
3571
  ")"
981
3572
  ] })
982
3573
  ] }),
983
- !_ && m && /* @__PURE__ */ e("button", { onClick: () => m(a.id), style: { fontSize: 12 }, children: "✕" })
3574
+ !i && d && /* @__PURE__ */ e("button", { onClick: () => d(v.id), style: { fontSize: 12 }, children: "✕" })
984
3575
  ]
985
3576
  },
986
- a.id
3577
+ v.id
987
3578
  ))
988
3579
  ] })
989
3580
  ] });
990
3581
  }
991
- ), ye = {
992
- game: ke,
993
- music: q,
994
- dance: q,
995
- quiz: be,
996
- karaoke: _e,
997
- photo: Ne,
998
- custom: fe
999
- }, Nn = {
3582
+ ), Nn = {
3583
+ game: An,
3584
+ music: Re,
3585
+ dance: Re,
3586
+ quiz: Qe,
3587
+ karaoke: $n,
3588
+ photo: zn,
3589
+ custom: Sn
3590
+ }, Ni = {
1000
3591
  game: "Games",
1001
3592
  music: "Music",
1002
3593
  dance: "Dance",
@@ -1004,46 +3595,46 @@ const gn = {
1004
3595
  karaoke: "Karaoke",
1005
3596
  photo: "Photo",
1006
3597
  custom: "Custom"
1007
- }, Pn = E(
1008
- function(N, C) {
3598
+ }, Ri = ee(
3599
+ function(t, r) {
1009
3600
  const {
1010
- attractions: t,
1011
- onSelect: p,
1012
- onDeselect: u,
1013
- onVote: m,
1014
- selectedIds: h = [],
1015
- maxSelections: v,
1016
- showVotes: _ = !0,
1017
- readOnly: g = !1,
1018
- layout: S = "grid",
3601
+ attractions: n,
3602
+ onSelect: c,
3603
+ onDeselect: o,
3604
+ onVote: d,
3605
+ selectedIds: m = [],
3606
+ maxSelections: h,
3607
+ showVotes: i = !0,
3608
+ readOnly: u = !1,
3609
+ layout: p = "grid",
1019
3610
  className: b,
1020
- style: l
1021
- } = N, [o, k] = f(""), [y, x] = f(""), d = I(() => new Set(h), [h]), n = I(() => {
1022
- const s = new Set(t.map((A) => A.category));
1023
- return Array.from(s);
1024
- }, [t]), c = I(() => {
1025
- let s = t;
1026
- if (o && (s = s.filter((A) => A.category === o)), y.trim()) {
1027
- const A = y.toLowerCase();
1028
- s = s.filter(
1029
- (P) => {
1030
- var V;
1031
- return P.name.toLowerCase().includes(A) || ((V = P.description) == null ? void 0 : V.toLowerCase().includes(A));
3611
+ style: f
3612
+ } = t, [g, w] = E(""), [k, _] = E(""), $ = X(() => new Set(m), [m]), l = X(() => {
3613
+ const I = new Set(n.map((D) => D.category));
3614
+ return Array.from(I);
3615
+ }, [n]), y = X(() => {
3616
+ let I = n;
3617
+ if (g && (I = I.filter((D) => D.category === g)), k.trim()) {
3618
+ const D = k.toLowerCase();
3619
+ I = I.filter(
3620
+ (N) => {
3621
+ var L;
3622
+ return N.name.toLowerCase().includes(D) || ((L = N.description) == null ? void 0 : L.toLowerCase().includes(D));
1032
3623
  }
1033
3624
  );
1034
3625
  }
1035
- return s;
1036
- }, [t, o, y]), a = !v || d.size < v, w = (s) => {
1037
- g || (d.has(s) ? u == null || u(s) : a && (p == null || p(s)));
3626
+ return I;
3627
+ }, [n, g, k]), v = !h || $.size < h, A = (I) => {
3628
+ u || ($.has(I) ? o == null || o(I) : v && (c == null || c(I)));
1038
3629
  };
1039
- return /* @__PURE__ */ i(
3630
+ return /* @__PURE__ */ a(
1040
3631
  "div",
1041
3632
  {
1042
- ref: C,
3633
+ ref: r,
1043
3634
  className: `nice-attraction-picker ${b ?? ""}`,
1044
- style: { color: "var(--text-primary)", ...l },
3635
+ style: { color: "var(--text-primary)", ...f },
1045
3636
  children: [
1046
- /* @__PURE__ */ i(
3637
+ /* @__PURE__ */ a(
1047
3638
  "div",
1048
3639
  {
1049
3640
  style: {
@@ -1054,22 +3645,22 @@ const gn = {
1054
3645
  },
1055
3646
  children: [
1056
3647
  /* @__PURE__ */ e("h3", { style: { margin: 0 }, children: "Attractions" }),
1057
- v && /* @__PURE__ */ i("span", { style: { color: "var(--text-secondary, #64748b)", fontSize: 14 }, children: [
1058
- d.size,
3648
+ h && /* @__PURE__ */ a("span", { style: { color: "var(--text-secondary, #64748b)", fontSize: 14 }, children: [
3649
+ $.size,
1059
3650
  "/",
1060
- v,
3651
+ h,
1061
3652
  " selected"
1062
3653
  ] })
1063
3654
  ]
1064
3655
  }
1065
3656
  ),
1066
- /* @__PURE__ */ i("div", { style: { display: "flex", gap: 8, marginBottom: 12, flexWrap: "wrap" }, children: [
3657
+ /* @__PURE__ */ a("div", { style: { display: "flex", gap: 8, marginBottom: 12, flexWrap: "wrap" }, children: [
1067
3658
  /* @__PURE__ */ e(
1068
3659
  "input",
1069
3660
  {
1070
3661
  type: "text",
1071
- value: y,
1072
- onChange: (s) => x(s.target.value),
3662
+ value: k,
3663
+ onChange: (I) => _(I.target.value),
1073
3664
  placeholder: "Search attractions…",
1074
3665
  style: { flex: 1, minWidth: 150 }
1075
3666
  }
@@ -1077,60 +3668,60 @@ const gn = {
1077
3668
  /* @__PURE__ */ e(
1078
3669
  "button",
1079
3670
  {
1080
- onClick: () => k(""),
1081
- style: { fontWeight: o ? 400 : 700 },
3671
+ onClick: () => w(""),
3672
+ style: { fontWeight: g ? 400 : 700 },
1082
3673
  children: "All"
1083
3674
  }
1084
3675
  ),
1085
- n.map((s) => /* @__PURE__ */ i(
3676
+ l.map((I) => /* @__PURE__ */ a(
1086
3677
  "button",
1087
3678
  {
1088
- onClick: () => k(s === o ? "" : s),
3679
+ onClick: () => w(I === g ? "" : I),
1089
3680
  style: {
1090
- fontWeight: s === o ? 700 : 400,
3681
+ fontWeight: I === g ? 700 : 400,
1091
3682
  display: "inline-flex",
1092
3683
  alignItems: "center",
1093
3684
  gap: 4
1094
3685
  },
1095
3686
  children: [
1096
- ne.createElement(ye[s], { size: 14 }),
3687
+ Ue.createElement(Nn[I], { size: 14 }),
1097
3688
  " ",
1098
- Nn[s]
3689
+ Ni[I]
1099
3690
  ]
1100
3691
  },
1101
- s
3692
+ I
1102
3693
  ))
1103
3694
  ] }),
1104
3695
  /* @__PURE__ */ e(
1105
3696
  "div",
1106
3697
  {
1107
3698
  style: {
1108
- display: S === "grid" ? "grid" : "flex",
1109
- gridTemplateColumns: S === "grid" ? "repeat(auto-fill, minmax(200px, 1fr))" : void 0,
3699
+ display: p === "grid" ? "grid" : "flex",
3700
+ gridTemplateColumns: p === "grid" ? "repeat(auto-fill, minmax(200px, 1fr))" : void 0,
1110
3701
  gap: 12,
1111
- flexDirection: S === "list" ? "column" : void 0
3702
+ flexDirection: p === "list" ? "column" : void 0
1112
3703
  },
1113
- children: c.length === 0 ? /* @__PURE__ */ e("p", { children: "No attractions found." }) : c.map((s) => {
1114
- const A = d.has(s.id);
1115
- return /* @__PURE__ */ i(
3704
+ children: y.length === 0 ? /* @__PURE__ */ e("p", { children: "No attractions found." }) : y.map((I) => {
3705
+ const D = $.has(I.id);
3706
+ return /* @__PURE__ */ a(
1116
3707
  "div",
1117
3708
  {
1118
3709
  className: "nice-attraction-picker__card",
1119
3710
  style: {
1120
- border: A ? "2px solid var(--color-primary, #6366f1)" : "1px solid var(--border-color, #cbd5e1)",
3711
+ border: D ? "2px solid var(--color-primary, #6366f1)" : "1px solid var(--border-color, #cbd5e1)",
1121
3712
  borderRadius: 8,
1122
3713
  padding: 12,
1123
- cursor: g ? "default" : "pointer",
1124
- background: A ? "color-mix(in srgb, var(--color-primary) 12%, transparent)" : "var(--bg-elevated, var(--bg-primary))",
3714
+ cursor: u ? "default" : "pointer",
3715
+ background: D ? "color-mix(in srgb, var(--color-primary) 12%, transparent)" : "var(--bg-elevated, var(--bg-primary))",
1125
3716
  transition: "all 0.2s"
1126
3717
  },
1127
- onClick: () => w(s.id),
3718
+ onClick: () => A(I.id),
1128
3719
  children: [
1129
- s.imageUrl && /* @__PURE__ */ e(
3720
+ I.imageUrl && /* @__PURE__ */ e(
1130
3721
  "img",
1131
3722
  {
1132
- src: s.imageUrl,
1133
- alt: s.name,
3723
+ src: I.imageUrl,
3724
+ alt: I.name,
1134
3725
  style: {
1135
3726
  width: "100%",
1136
3727
  borderRadius: 6,
@@ -1140,11 +3731,11 @@ const gn = {
1140
3731
  }
1141
3732
  }
1142
3733
  ),
1143
- /* @__PURE__ */ i("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
1144
- /* @__PURE__ */ e("span", { style: { display: "inline-flex" }, children: ne.createElement(ye[s.category], { size: 16 }) }),
1145
- /* @__PURE__ */ e("strong", { children: s.name })
3734
+ /* @__PURE__ */ a("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
3735
+ /* @__PURE__ */ e("span", { style: { display: "inline-flex" }, children: Ue.createElement(Nn[I.category], { size: 16 }) }),
3736
+ /* @__PURE__ */ e("strong", { children: I.name })
1146
3737
  ] }),
1147
- s.description && /* @__PURE__ */ e(
3738
+ I.description && /* @__PURE__ */ e(
1148
3739
  "p",
1149
3740
  {
1150
3741
  style: {
@@ -1152,10 +3743,10 @@ const gn = {
1152
3743
  color: "var(--text-secondary, #64748b)",
1153
3744
  margin: "6px 0"
1154
3745
  },
1155
- children: s.description
3746
+ children: I.description
1156
3747
  }
1157
3748
  ),
1158
- /* @__PURE__ */ i(
3749
+ /* @__PURE__ */ a(
1159
3750
  "div",
1160
3751
  {
1161
3752
  style: {
@@ -1165,7 +3756,7 @@ const gn = {
1165
3756
  marginTop: 8
1166
3757
  },
1167
3758
  children: [
1168
- _ && /* @__PURE__ */ i(
3759
+ i && /* @__PURE__ */ a(
1169
3760
  "span",
1170
3761
  {
1171
3762
  style: {
@@ -1175,17 +3766,17 @@ const gn = {
1175
3766
  gap: 4
1176
3767
  },
1177
3768
  children: [
1178
- /* @__PURE__ */ e(cn, { size: 14 }),
3769
+ /* @__PURE__ */ e(bt, { size: 14 }),
1179
3770
  " ",
1180
- s.votes ?? 0
3771
+ I.votes ?? 0
1181
3772
  ]
1182
3773
  }
1183
3774
  ),
1184
- !g && m && /* @__PURE__ */ e(
3775
+ !u && d && /* @__PURE__ */ e(
1185
3776
  "button",
1186
3777
  {
1187
- onClick: (P) => {
1188
- P.stopPropagation(), m(s.id);
3778
+ onClick: (N) => {
3779
+ N.stopPropagation(), d(I.id);
1189
3780
  },
1190
3781
  style: { fontSize: 12 },
1191
3782
  children: "Vote"
@@ -1196,7 +3787,7 @@ const gn = {
1196
3787
  )
1197
3788
  ]
1198
3789
  },
1199
- s.id
3790
+ I.id
1200
3791
  );
1201
3792
  })
1202
3793
  }
@@ -1205,66 +3796,66 @@ const gn = {
1205
3796
  }
1206
3797
  );
1207
3798
  }
1208
- ), _n = {
1209
- game: ke,
1210
- music: q,
1211
- dance: q,
1212
- quiz: be,
1213
- karaoke: _e,
1214
- photo: Ne,
1215
- custom: fe
1216
- }, Rn = E(
1217
- function(N, C) {
3799
+ ), bi = {
3800
+ game: An,
3801
+ music: Re,
3802
+ dance: Re,
3803
+ quiz: Qe,
3804
+ karaoke: $n,
3805
+ photo: zn,
3806
+ custom: Sn
3807
+ }, Ui = ee(
3808
+ function(t, r) {
1218
3809
  const {
1219
- attractions: t,
1220
- onVote: p,
1221
- onUnvote: u,
1222
- votedIds: m = [],
1223
- maxVotes: h,
1224
- closed: v = !1,
1225
- sortBy: _ = "votes",
1226
- showResults: g = !0,
1227
- className: S,
3810
+ attractions: n,
3811
+ onVote: c,
3812
+ onUnvote: o,
3813
+ votedIds: d = [],
3814
+ maxVotes: m,
3815
+ closed: h = !1,
3816
+ sortBy: i = "votes",
3817
+ showResults: u = !0,
3818
+ className: p,
1228
3819
  style: b
1229
- } = N, l = I(() => new Set(m), [m]), o = h ? h - l.size : void 0, k = I(() => {
1230
- const n = [...t];
1231
- switch (_) {
3820
+ } = t, f = X(() => new Set(d), [d]), g = m ? m - f.size : void 0, w = X(() => {
3821
+ const l = [...n];
3822
+ switch (i) {
1232
3823
  case "votes":
1233
- n.sort((c, a) => (a.votes ?? 0) - (c.votes ?? 0));
3824
+ l.sort((y, v) => (v.votes ?? 0) - (y.votes ?? 0));
1234
3825
  break;
1235
3826
  case "name":
1236
- n.sort((c, a) => c.name.localeCompare(a.name));
3827
+ l.sort((y, v) => y.name.localeCompare(v.name));
1237
3828
  break;
1238
3829
  case "category":
1239
- n.sort((c, a) => c.category.localeCompare(a.category));
3830
+ l.sort((y, v) => y.category.localeCompare(v.category));
1240
3831
  break;
1241
3832
  }
1242
- return n;
1243
- }, [t, _]), y = I(
1244
- () => Math.max(...t.map((n) => n.votes ?? 0), 1),
1245
- [t]
1246
- ), x = (n) => {
1247
- v || (l.has(n) ? u == null || u(n) : (!o || o > 0) && (p == null || p(n)));
1248
- }, d = (n) => {
1249
- switch (n) {
3833
+ return l;
3834
+ }, [n, i]), k = X(
3835
+ () => Math.max(...n.map((l) => l.votes ?? 0), 1),
3836
+ [n]
3837
+ ), _ = (l) => {
3838
+ h || (f.has(l) ? o == null || o(l) : (!g || g > 0) && (c == null || c(l)));
3839
+ }, $ = (l) => {
3840
+ switch (l) {
1250
3841
  case 0:
1251
- return /* @__PURE__ */ e(on, { size: 18, primaryColor: "#f59e0b", title: "1st place" });
3842
+ return /* @__PURE__ */ e(xt, { size: 18, primaryColor: "#f59e0b", title: "1st place" });
1252
3843
  case 1:
1253
- return /* @__PURE__ */ e(ue, { size: 18, primaryColor: "#94a3b8", title: "2nd place" });
3844
+ return /* @__PURE__ */ e(dn, { size: 18, primaryColor: "#94a3b8", title: "2nd place" });
1254
3845
  case 2:
1255
- return /* @__PURE__ */ e(ue, { size: 18, primaryColor: "#b45309", title: "3rd place" });
3846
+ return /* @__PURE__ */ e(dn, { size: 18, primaryColor: "#b45309", title: "3rd place" });
1256
3847
  default:
1257
- return `${n + 1}.`;
3848
+ return `${l + 1}.`;
1258
3849
  }
1259
3850
  };
1260
- return /* @__PURE__ */ i(
3851
+ return /* @__PURE__ */ a(
1261
3852
  "div",
1262
3853
  {
1263
- ref: C,
1264
- className: `nice-attraction-voting ${S ?? ""}`,
3854
+ ref: r,
3855
+ className: `nice-attraction-voting ${p ?? ""}`,
1265
3856
  style: { color: "var(--text-primary)", ...b },
1266
3857
  children: [
1267
- /* @__PURE__ */ i(
3858
+ /* @__PURE__ */ a(
1268
3859
  "div",
1269
3860
  {
1270
3861
  style: {
@@ -1274,21 +3865,21 @@ const gn = {
1274
3865
  marginBottom: 16
1275
3866
  },
1276
3867
  children: [
1277
- /* @__PURE__ */ i("h3", { style: { margin: 0, display: "inline-flex", alignItems: "center", gap: 8 }, children: [
1278
- /* @__PURE__ */ e(sn, { size: 20 }),
1279
- v ? "Voting Results" : "Vote for Attractions"
3868
+ /* @__PURE__ */ a("h3", { style: { margin: 0, display: "inline-flex", alignItems: "center", gap: 8 }, children: [
3869
+ /* @__PURE__ */ e(wt, { size: 20 }),
3870
+ h ? "Voting Results" : "Vote for Attractions"
1280
3871
  ] }),
1281
- !v && o !== void 0 && /* @__PURE__ */ i(
3872
+ !h && g !== void 0 && /* @__PURE__ */ a(
1282
3873
  "span",
1283
3874
  {
1284
3875
  style: {
1285
3876
  fontSize: 14,
1286
- color: o > 0 ? "var(--color-primary, #6366f1)" : "var(--color-error, #ef4444)"
3877
+ color: g > 0 ? "var(--color-primary, #6366f1)" : "var(--color-error, #ef4444)"
1287
3878
  },
1288
3879
  children: [
1289
- o,
3880
+ g,
1290
3881
  " vote",
1291
- o !== 1 ? "s" : "",
3882
+ g !== 1 ? "s" : "",
1292
3883
  " remaining"
1293
3884
  ]
1294
3885
  }
@@ -1296,10 +3887,10 @@ const gn = {
1296
3887
  ]
1297
3888
  }
1298
3889
  ),
1299
- v && /* @__PURE__ */ e("p", { style: { color: "var(--text-secondary, #64748b)", marginBottom: 12 }, children: "Voting is closed. Final results:" }),
1300
- /* @__PURE__ */ e("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: k.map((n, c) => {
1301
- const a = l.has(n.id), w = n.votes ?? 0, s = g ? `${Math.round(w / y * 100)}%` : "0%";
1302
- return /* @__PURE__ */ i(
3890
+ h && /* @__PURE__ */ e("p", { style: { color: "var(--text-secondary, #64748b)", marginBottom: 12 }, children: "Voting is closed. Final results:" }),
3891
+ /* @__PURE__ */ e("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: w.map((l, y) => {
3892
+ const v = f.has(l.id), A = l.votes ?? 0, I = u ? `${Math.round(A / k * 100)}%` : "0%";
3893
+ return /* @__PURE__ */ a(
1303
3894
  "div",
1304
3895
  {
1305
3896
  style: {
@@ -1308,18 +3899,18 @@ const gn = {
1308
3899
  gap: 12,
1309
3900
  padding: "10px 14px",
1310
3901
  borderRadius: 8,
1311
- border: a ? "2px solid var(--color-primary, #6366f1)" : "1px solid var(--border-color, #cbd5e1)",
1312
- background: a ? "color-mix(in srgb, var(--color-primary) 12%, transparent)" : "var(--bg-elevated, var(--bg-primary))",
1313
- cursor: v ? "default" : "pointer",
3902
+ border: v ? "2px solid var(--color-primary, #6366f1)" : "1px solid var(--border-color, #cbd5e1)",
3903
+ background: v ? "color-mix(in srgb, var(--color-primary) 12%, transparent)" : "var(--bg-elevated, var(--bg-primary))",
3904
+ cursor: h ? "default" : "pointer",
1314
3905
  transition: "all 0.2s"
1315
3906
  },
1316
- onClick: () => x(n.id),
3907
+ onClick: () => _(l.id),
1317
3908
  children: [
1318
- g && /* @__PURE__ */ e("span", { style: { fontSize: 18, minWidth: 32, textAlign: "center" }, children: d(c) }),
1319
- /* @__PURE__ */ e("span", { style: { display: "inline-flex", fontSize: 20 }, children: ne.createElement(_n[n.category], { size: 20 }) }),
1320
- /* @__PURE__ */ i("div", { style: { flex: 1, minWidth: 0 }, children: [
1321
- /* @__PURE__ */ e("div", { style: { fontWeight: 600 }, children: n.name }),
1322
- n.description && /* @__PURE__ */ e(
3909
+ u && /* @__PURE__ */ e("span", { style: { fontSize: 18, minWidth: 32, textAlign: "center" }, children: $(y) }),
3910
+ /* @__PURE__ */ e("span", { style: { display: "inline-flex", fontSize: 20 }, children: Ue.createElement(bi[l.category], { size: 20 }) }),
3911
+ /* @__PURE__ */ a("div", { style: { flex: 1, minWidth: 0 }, children: [
3912
+ /* @__PURE__ */ e("div", { style: { fontWeight: 600 }, children: l.name }),
3913
+ l.description && /* @__PURE__ */ e(
1323
3914
  "div",
1324
3915
  {
1325
3916
  style: {
@@ -1329,10 +3920,10 @@ const gn = {
1329
3920
  textOverflow: "ellipsis",
1330
3921
  whiteSpace: "nowrap"
1331
3922
  },
1332
- children: n.description
3923
+ children: l.description
1333
3924
  }
1334
3925
  ),
1335
- g && /* @__PURE__ */ e(
3926
+ u && /* @__PURE__ */ e(
1336
3927
  "div",
1337
3928
  {
1338
3929
  style: {
@@ -1347,7 +3938,7 @@ const gn = {
1347
3938
  {
1348
3939
  style: {
1349
3940
  height: "100%",
1350
- width: s,
3941
+ width: I,
1351
3942
  background: "var(--color-primary, #6366f1)",
1352
3943
  borderRadius: 3,
1353
3944
  transition: "width 0.3s"
@@ -1357,31 +3948,31 @@ const gn = {
1357
3948
  }
1358
3949
  )
1359
3950
  ] }),
1360
- g && /* @__PURE__ */ e("span", { style: { fontWeight: 600, fontSize: 16, minWidth: 40, textAlign: "right" }, children: w }),
1361
- !v && /* @__PURE__ */ e(
3951
+ u && /* @__PURE__ */ e("span", { style: { fontWeight: 600, fontSize: 16, minWidth: 40, textAlign: "right" }, children: A }),
3952
+ !h && /* @__PURE__ */ e(
1362
3953
  "button",
1363
3954
  {
1364
- onClick: (A) => {
1365
- A.stopPropagation(), x(n.id);
3955
+ onClick: (D) => {
3956
+ D.stopPropagation(), _(l.id);
1366
3957
  },
1367
3958
  style: {
1368
3959
  padding: "4px 12px",
1369
3960
  borderRadius: 4,
1370
3961
  border: "none",
1371
- background: a ? "var(--color-error, #ef4444)" : "var(--color-primary, #6366f1)",
3962
+ background: v ? "var(--color-error, #ef4444)" : "var(--color-primary, #6366f1)",
1372
3963
  color: "#fff",
1373
3964
  cursor: "pointer",
1374
3965
  fontSize: 13
1375
3966
  },
1376
- children: a ? "Unvote" : "Vote"
3967
+ children: v ? "Unvote" : "Vote"
1377
3968
  }
1378
3969
  )
1379
3970
  ]
1380
3971
  },
1381
- n.id
3972
+ l.id
1382
3973
  );
1383
3974
  }) }),
1384
- g && /* @__PURE__ */ i(
3975
+ u && /* @__PURE__ */ a(
1385
3976
  "div",
1386
3977
  {
1387
3978
  style: {
@@ -1392,7 +3983,7 @@ const gn = {
1392
3983
  },
1393
3984
  children: [
1394
3985
  "Total votes: ",
1395
- t.reduce((n, c) => n + (c.votes ?? 0), 0)
3986
+ n.reduce((l, y) => l + (y.votes ?? 0), 0)
1396
3987
  ]
1397
3988
  }
1398
3989
  )
@@ -1402,12 +3993,20 @@ const gn = {
1402
3993
  }
1403
3994
  );
1404
3995
  export {
1405
- Pn as NiceAttractionPicker,
1406
- Rn as NiceAttractionVoting,
1407
- wn as NiceEventMedia,
1408
- zn as NiceEventPlanning,
1409
- Tn as NiceKaraokePicker,
1410
- In as NiceRoundCard,
1411
- An as NiceRoundList,
1412
- Ln as NiceSongPicker
3996
+ Ri as NiceAttractionPicker,
3997
+ Ui as NiceAttractionVoting,
3998
+ Si as NiceEventMedia,
3999
+ $i as NiceEventPlanning,
4000
+ Di as NiceExpenseSplit,
4001
+ Mi as NiceGiftRegistry,
4002
+ Ti as NiceInvitationDesigner,
4003
+ Oi as NiceKaraokePicker,
4004
+ zi as NiceMediaCollage,
4005
+ Ai as NiceParticipantList,
4006
+ Li as NiceRoundCard,
4007
+ Ei as NiceRoundList,
4008
+ pn as NiceRsvpControl,
4009
+ Pi as NiceSeatPicker,
4010
+ ai as NiceSeatingChart,
4011
+ Bi as NiceSongPicker
1413
4012
  };