@zonetrix/viewer 2.13.1 → 2.13.3

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,20 +1,20 @@
1
- import { jsx as a, jsxs as k } from "react/jsx-runtime";
2
- import { useState as Y, useCallback as N, useEffect as B, useRef as U, useMemo as z, memo as K } from "react";
3
- import { Stage as oe, Layer as vt, Group as re, Text as Rt, Circle as Dt, Rect as Nt, Path as se, RegularPolygon as ae } from "react-konva";
4
- import { clearFirebaseInstance as be, getFirebaseDatabase as me, initializeFirebaseForViewer as ve, isFirebaseInitialized as Se, useFirebaseConfig as we, useFirebaseSeatStates as Ce, useRealtimeSeatMap as Me } from "@zonetrix/shared";
5
- function ce(n) {
6
- const [u, e] = Y(null), [r, S] = Y(!1), [y, f] = Y(null), x = N(async () => {
1
+ import { jsx as c, jsxs as k } from "react/jsx-runtime";
2
+ import { useState as A, useCallback as N, useEffect as B, useRef as K, useMemo as z, memo as J } from "react";
3
+ import { Stage as oe, Layer as St, Group as re, Text as Dt, Circle as Nt, Rect as Tt, Path as se, RegularPolygon as ce } from "react-konva";
4
+ import { clearFirebaseInstance as me, getFirebaseDatabase as be, initializeFirebaseForViewer as ve, isFirebaseInitialized as Se, useFirebaseConfig as we, useFirebaseSeatStates as Ce, useRealtimeSeatMap as Me } from "@zonetrix/shared";
5
+ function ae(n) {
6
+ const [u, e] = A(null), [r, S] = A(!1), [y, f] = A(null), x = N(async () => {
7
7
  if (n) {
8
8
  S(!0), f(null);
9
9
  try {
10
10
  const g = await fetch(n);
11
11
  if (!g.ok)
12
12
  throw new Error(`Failed to fetch config: ${g.statusText}`);
13
- const c = await g.json();
14
- e(c);
13
+ const a = await g.json();
14
+ e(a);
15
15
  } catch (g) {
16
- const c = g instanceof Error ? g : new Error("Unknown error occurred");
17
- f(c), console.error("Failed to fetch seat map config:", c);
16
+ const a = g instanceof Error ? g : new Error("Unknown error occurred");
17
+ f(a), console.error("Failed to fetch seat map config:", a);
18
18
  } finally {
19
19
  S(!1);
20
20
  }
@@ -30,7 +30,7 @@ function ce(n) {
30
30
  };
31
31
  }
32
32
  function le(n) {
33
- const [u, e] = Y({ width: 0, height: 0 });
33
+ const [u, e] = A({ width: 0, height: 0 });
34
34
  return B(() => {
35
35
  const r = n.current;
36
36
  if (!r) return;
@@ -39,67 +39,69 @@ function le(n) {
39
39
  const f = new ResizeObserver((x) => {
40
40
  const g = x[0];
41
41
  if (!g) return;
42
- const { width: c, height: p } = g.contentRect;
43
- c > 0 && p > 0 && e((b) => b.width === c && b.height === p ? b : { width: c, height: p });
42
+ const { width: a, height: p } = g.contentRect;
43
+ a > 0 && p > 0 && e((m) => m.width === a && m.height === p ? m : { width: a, height: p });
44
44
  });
45
45
  return f.observe(r), () => {
46
46
  f.disconnect();
47
47
  };
48
48
  }, [n]), u;
49
49
  }
50
- function Ft(n, u) {
50
+ function kt(n, u) {
51
51
  return Math.sqrt(Math.pow(u.x - n.x, 2) + Math.pow(u.y - n.y, 2));
52
52
  }
53
- function kt(n, u) {
53
+ function Rt(n, u) {
54
54
  return {
55
55
  x: (n.x + u.x) / 2,
56
56
  y: (n.y + u.y) / 2
57
57
  };
58
58
  }
59
59
  function he(n, u) {
60
- const e = U(null), r = U(null), S = U(1), {
60
+ const e = K(null), r = K(null), S = K(1), {
61
61
  enabled: y,
62
62
  minScale: f,
63
63
  maxScale: x,
64
64
  currentScale: g,
65
- currentPosition: c,
65
+ currentPosition: a,
66
66
  onScaleChange: p
67
67
  } = u;
68
68
  B(() => {
69
- const b = n.current;
70
- if (!b || !y) return;
71
- const d = b.container(), I = (m) => {
72
- if (m.touches.length === 2) {
73
- m.preventDefault();
74
- const L = { x: m.touches[0].clientX, y: m.touches[0].clientY }, W = { x: m.touches[1].clientX, y: m.touches[1].clientY };
75
- e.current = Ft(L, W), r.current = kt(L, W), S.current = g;
69
+ const m = n.current;
70
+ if (!m || !y) return;
71
+ const h = m.container(), I = h.style.touchAction;
72
+ h.style.touchAction = "none";
73
+ const b = (v) => {
74
+ if (v.touches.length === 2) {
75
+ v.preventDefault();
76
+ const T = { x: v.touches[0].clientX, y: v.touches[0].clientY }, P = { x: v.touches[1].clientX, y: v.touches[1].clientY };
77
+ e.current = kt(T, P), r.current = Rt(T, P), S.current = g;
76
78
  }
77
- }, v = (m) => {
78
- if (m.touches.length !== 2) return;
79
- m.preventDefault();
80
- const L = { x: m.touches[0].clientX, y: m.touches[0].clientY }, W = { x: m.touches[1].clientX, y: m.touches[1].clientY }, O = Ft(L, W), M = kt(L, W);
79
+ }, w = (v) => {
80
+ if (v.touches.length !== 2) return;
81
+ v.preventDefault();
82
+ const T = { x: v.touches[0].clientX, y: v.touches[0].clientY }, P = { x: v.touches[1].clientX, y: v.touches[1].clientY }, F = kt(T, P), W = Rt(T, P);
81
83
  if (e.current !== null && r.current !== null) {
82
- const P = O / e.current, A = Math.min(
83
- Math.max(g * P, f),
84
+ const Q = F / e.current, O = Math.min(
85
+ Math.max(g * Q, f),
84
86
  x
85
- ), J = d.getBoundingClientRect(), j = M.x - J.left, ot = M.y - J.top, rt = g, st = {
86
- x: (j - c.x) / rt,
87
- y: (ot - c.y) / rt
88
- }, at = M.x - r.current.x, $ = M.y - r.current.y, V = {
89
- x: j - st.x * A + at,
90
- y: ot - st.y * A + $
87
+ ), j = h.getBoundingClientRect(), ct = W.x - j.left, at = W.y - j.top, lt = g, tt = {
88
+ x: (ct - a.x) / lt,
89
+ y: (at - a.y) / lt
90
+ }, Y = W.x - r.current.x, V = W.y - r.current.y, ht = {
91
+ x: ct - tt.x * O + Y,
92
+ y: at - tt.y * O + V
91
93
  };
92
- p(A, V), e.current = O, r.current = M;
94
+ p(O, ht), e.current = F, r.current = W;
93
95
  }
94
- }, w = (m) => {
95
- m.touches.length < 2 && (e.current = null, r.current = null);
96
+ }, E = (v) => {
97
+ v.touches.length < 2 && (e.current = null, r.current = null);
96
98
  };
97
- return d.addEventListener("touchstart", I, {
99
+ return h.addEventListener("touchstart", b, {
98
100
  passive: !1
99
- }), d.addEventListener("touchmove", v, {
101
+ }), h.addEventListener("touchmove", w, {
100
102
  passive: !1
101
- }), d.addEventListener("touchend", w), () => {
102
- d.removeEventListener("touchstart", I), d.removeEventListener("touchmove", v), d.removeEventListener("touchend", w);
103
+ }), h.addEventListener("touchend", E), () => {
104
+ h.style.touchAction = I, h.removeEventListener("touchstart", b), h.removeEventListener("touchmove", w), h.removeEventListener("touchend", E);
103
105
  };
104
106
  }, [
105
107
  n,
@@ -107,7 +109,7 @@ function he(n, u) {
107
109
  f,
108
110
  x,
109
111
  g,
110
- c,
112
+ a,
111
113
  p
112
114
  ]);
113
115
  }
@@ -121,7 +123,7 @@ const de = {
121
123
  seatHidden: "#4a4a4a",
122
124
  gridLines: "#404040",
123
125
  currency: "KD"
124
- }, Wt = K(
126
+ }, Wt = J(
125
127
  ({ seat: n, state: u, colors: e, onClick: r, onMouseEnter: S, onMouseLeave: y }) => {
126
128
  const f = (n.size || 24) / 2, g = {
127
129
  available: e.seatAvailable,
@@ -130,35 +132,36 @@ const de = {
130
132
  unavailable: e.seatUnavailable,
131
133
  hidden: e.seatHidden
132
134
  // Hidden seats are filtered out, but included for type safety
133
- }[u], c = u === "available" || u === "selected", p = N(() => {
134
- c && r(n);
135
- }, [n, r, c]), b = N(
136
- (v) => {
137
- S(n, v);
138
- const w = v.target.getStage();
139
- w && c && (w.container().style.cursor = "pointer");
135
+ }[u], a = u === "available" || u === "selected", p = N(() => {
136
+ a && r(n);
137
+ }, [n, r, a]), m = N(
138
+ (b) => {
139
+ S(n, b);
140
+ const w = b.target.getStage();
141
+ w && a && (w.container().style.cursor = "pointer");
140
142
  },
141
- [n, S, c]
142
- ), d = N(
143
- (v) => {
143
+ [n, S, a]
144
+ ), h = N(
145
+ (b) => {
144
146
  y();
145
- const w = v.target.getStage();
147
+ const w = b.target.getStage();
146
148
  w && (w.container().style.cursor = "grab");
147
149
  },
148
150
  [y]
149
151
  ), I = {
150
152
  x: n.position.x,
151
153
  y: n.position.y,
154
+ rotation: n.rotation || 0,
152
155
  fill: g,
153
156
  stroke: "#ffffff",
154
157
  strokeWidth: 1,
155
158
  onClick: p,
156
159
  onTap: p,
157
- onMouseEnter: b,
158
- onMouseLeave: d
160
+ onMouseEnter: m,
161
+ onMouseLeave: h
159
162
  };
160
- return n.shape === "circle" ? /* @__PURE__ */ a(Dt, { ...I, radius: f }) : /* @__PURE__ */ a(
161
- Nt,
163
+ return n.shape === "circle" ? /* @__PURE__ */ c(Nt, { ...I, radius: f }) : /* @__PURE__ */ c(
164
+ Tt,
162
165
  {
163
166
  ...I,
164
167
  width: f * 2,
@@ -171,59 +174,59 @@ const de = {
171
174
  }
172
175
  );
173
176
  Wt.displayName = "ViewerSeat";
174
- const Tt = K(({ stage: n, stageColor: u }) => {
177
+ const Xt = J(({ stage: n, stageColor: u }) => {
175
178
  const e = n.config, r = e.shape || "rectangle", S = e.showLabel !== !1, y = e.color || u, f = e.width / e.height, x = f < 0.5, g = f > 2;
176
- let c;
177
- x ? c = e.width * 0.25 : g ? c = e.height * 0.35 : c = Math.min(e.width, e.height) * 0.25;
178
- const p = e.label?.length || 6, I = e.width * 0.85 / p * 1.5, v = Math.max(
179
+ let a;
180
+ x ? a = e.width * 0.25 : g ? a = e.height * 0.35 : a = Math.min(e.width, e.height) * 0.25;
181
+ const p = e.label?.length || 6, I = e.width * 0.85 / p * 1.5, b = Math.max(
179
182
  10,
180
- Math.min(24, Math.min(c, I))
181
- ), w = 4, m = Math.max(20, e.width - w * 2), L = (e.width - m) / 2, W = {
183
+ Math.min(24, Math.min(a, I))
184
+ ), w = 4, E = Math.max(20, e.width - w * 2), v = (e.width - E) / 2, T = {
182
185
  fill: y + "80",
183
186
  stroke: "#ffffff",
184
187
  strokeWidth: 2,
185
188
  perfectDrawEnabled: !1,
186
189
  hitStrokeWidth: 0
187
- }, O = () => {
190
+ }, P = () => {
188
191
  switch (r) {
189
192
  case "circle": {
190
- const M = Math.min(e.width, e.height) / 2;
191
- return /* @__PURE__ */ a(
192
- Dt,
193
+ const F = Math.min(e.width, e.height) / 2;
194
+ return /* @__PURE__ */ c(
195
+ Nt,
193
196
  {
194
197
  x: e.width / 2,
195
198
  y: e.height / 2,
196
- radius: M,
197
- ...W
199
+ radius: F,
200
+ ...T
198
201
  }
199
202
  );
200
203
  }
201
204
  case "triangle": {
202
- const M = Math.min(e.width, e.height) / 2;
203
- return /* @__PURE__ */ a(
204
- ae,
205
+ const F = Math.min(e.width, e.height) / 2;
206
+ return /* @__PURE__ */ c(
207
+ ce,
205
208
  {
206
209
  x: e.width / 2,
207
210
  y: e.height / 2,
208
211
  sides: 3,
209
- radius: M,
212
+ radius: F,
210
213
  rotation: -90,
211
- ...W
214
+ ...T
212
215
  }
213
216
  );
214
217
  }
215
218
  case "arrow": {
216
- const M = e.width / 24, P = e.height / 24, A = `M${9 * M},${18 * P} v${-8 * P} H${5 * M} l${7 * M},${-7 * P} l${7 * M},${7 * P} h${-4 * M} v${8 * P} Z`;
217
- return /* @__PURE__ */ a(se, { data: A, ...W });
219
+ const F = e.width / 24, W = e.height / 24, Q = `M${9 * F},${18 * W} v${-8 * W} H${5 * F} l${7 * F},${-7 * W} l${7 * F},${7 * W} h${-4 * F} v${8 * W} Z`;
220
+ return /* @__PURE__ */ c(se, { data: Q, ...T });
218
221
  }
219
222
  default:
220
- return /* @__PURE__ */ a(
221
- Nt,
223
+ return /* @__PURE__ */ c(
224
+ Tt,
222
225
  {
223
226
  width: e.width,
224
227
  height: e.height,
225
228
  cornerRadius: 10,
226
- ...W
229
+ ...T
227
230
  }
228
231
  );
229
232
  }
@@ -235,16 +238,16 @@ const Tt = K(({ stage: n, stageColor: u }) => {
235
238
  y: n.position.y,
236
239
  rotation: e.rotation || 0,
237
240
  children: [
238
- O(),
239
- S && /* @__PURE__ */ a(
240
- Rt,
241
+ P(),
242
+ S && /* @__PURE__ */ c(
243
+ Dt,
241
244
  {
242
245
  text: e.label,
243
- x: L,
246
+ x: v,
244
247
  y: w,
245
- width: m,
248
+ width: E,
246
249
  height: e.height - w * 2,
247
- fontSize: v,
250
+ fontSize: b,
248
251
  fontStyle: "bold",
249
252
  fill: "#ffffff",
250
253
  align: "center",
@@ -257,9 +260,9 @@ const Tt = K(({ stage: n, stageColor: u }) => {
257
260
  }
258
261
  );
259
262
  });
260
- Tt.displayName = "ViewerStage";
261
- const Lt = K(({ text: n }) => /* @__PURE__ */ a(
262
- Rt,
263
+ Xt.displayName = "ViewerStage";
264
+ const Yt = J(({ text: n }) => /* @__PURE__ */ c(
265
+ Dt,
263
266
  {
264
267
  x: n.position.x,
265
268
  y: n.position.y,
@@ -267,11 +270,13 @@ const Lt = K(({ text: n }) => /* @__PURE__ */ a(
267
270
  fontSize: n.config.fontSize,
268
271
  fill: n.config.color,
269
272
  rotation: n.config.rotation || 0,
273
+ scaleX: n.config.scaleX || 1,
274
+ scaleY: n.config.scaleY || 1,
270
275
  listening: !1
271
276
  }
272
277
  ));
273
- Lt.displayName = "ViewerText";
274
- const $t = K(
278
+ Yt.displayName = "ViewerText";
279
+ const Lt = J(
275
280
  ({
276
281
  floors: n,
277
282
  currentFloorId: u,
@@ -282,9 +287,9 @@ const $t = K(
282
287
  className: f
283
288
  }) => {
284
289
  const x = z(
285
- () => [...n].sort((d, I) => d.order - I.order),
290
+ () => [...n].sort((h, I) => h.order - I.order),
286
291
  [n]
287
- ), c = {
292
+ ), a = {
288
293
  position: "absolute",
289
294
  display: "flex",
290
295
  alignItems: "center",
@@ -312,36 +317,36 @@ const $t = K(
312
317
  transition: "all 0.2s ease",
313
318
  minHeight: "44px",
314
319
  touchAction: "manipulation"
315
- }, b = {
320
+ }, m = {
316
321
  ...p,
317
322
  backgroundColor: "#3A7DE5",
318
323
  borderColor: "#3A7DE5"
319
324
  };
320
- return /* @__PURE__ */ k("div", { className: f, style: c, children: [
321
- r && /* @__PURE__ */ a(
325
+ return /* @__PURE__ */ k("div", { className: f, style: a, children: [
326
+ r && /* @__PURE__ */ c(
322
327
  "button",
323
328
  {
324
329
  type: "button",
325
330
  onClick: () => e(null),
326
- style: u === null ? b : p,
331
+ style: u === null ? m : p,
327
332
  children: S
328
333
  }
329
334
  ),
330
- x.map((d) => /* @__PURE__ */ a(
335
+ x.map((h) => /* @__PURE__ */ c(
331
336
  "button",
332
337
  {
333
338
  type: "button",
334
- onClick: () => e(d.id),
335
- style: u === d.id ? b : p,
336
- children: d.name
339
+ onClick: () => e(h.id),
340
+ style: u === h.id ? m : p,
341
+ children: h.name
337
342
  },
338
- d.id
343
+ h.id
339
344
  ))
340
345
  ] });
341
346
  }
342
347
  );
343
- $t.displayName = "FloorSelectorBar";
344
- const Et = K(
348
+ Lt.displayName = "FloorSelectorBar";
349
+ const $t = J(
345
350
  ({ scale: n, minScale: u, maxScale: e, fitScale: r, onZoomIn: S, onZoomOut: y, onFitToScreen: f, position: x, className: g }) => {
346
351
  const p = {
347
352
  position: "absolute",
@@ -359,7 +364,7 @@ const Et = K(
359
364
  "bottom-left": { bottom: 0, left: 0 },
360
365
  "bottom-right": { bottom: 0, right: 0 }
361
366
  }[x]
362
- }, b = {
367
+ }, m = {
363
368
  width: "44px",
364
369
  height: "44px",
365
370
  minWidth: "44px",
@@ -376,43 +381,43 @@ const Et = K(
376
381
  justifyContent: "center",
377
382
  transition: "all 0.2s ease",
378
383
  touchAction: "manipulation"
379
- }, d = {
380
- ...b,
384
+ }, h = {
385
+ ...m,
381
386
  opacity: 0.4,
382
387
  cursor: "not-allowed"
383
- }, I = n < e, v = n > u, w = Math.abs(n - r) < 0.01;
388
+ }, I = n < e, b = n > u, w = Math.abs(n - r) < 0.01;
384
389
  return /* @__PURE__ */ k("div", { className: g, style: p, children: [
385
- /* @__PURE__ */ a(
390
+ /* @__PURE__ */ c(
386
391
  "button",
387
392
  {
388
393
  type: "button",
389
394
  onClick: S,
390
395
  disabled: !I,
391
- style: I ? b : d,
396
+ style: I ? m : h,
392
397
  title: "Zoom In",
393
398
  "aria-label": "Zoom In",
394
399
  children: "+"
395
400
  }
396
401
  ),
397
- /* @__PURE__ */ a(
402
+ /* @__PURE__ */ c(
398
403
  "button",
399
404
  {
400
405
  type: "button",
401
406
  onClick: f,
402
407
  disabled: w,
403
- style: w ? d : b,
408
+ style: w ? h : m,
404
409
  title: "Fit to Screen",
405
410
  "aria-label": "Fit to Screen",
406
411
  children: "⤢"
407
412
  }
408
413
  ),
409
- /* @__PURE__ */ a(
414
+ /* @__PURE__ */ c(
410
415
  "button",
411
416
  {
412
417
  type: "button",
413
418
  onClick: y,
414
- disabled: !v,
415
- style: v ? b : d,
419
+ disabled: !b,
420
+ style: b ? m : h,
416
421
  title: "Zoom Out",
417
422
  "aria-label": "Zoom Out",
418
423
  children: "−"
@@ -421,8 +426,8 @@ const Et = K(
421
426
  ] });
422
427
  }
423
428
  );
424
- Et.displayName = "ZoomControls";
425
- const Xt = K(
429
+ $t.displayName = "ZoomControls";
430
+ const At = J(
426
431
  ({ visible: n, x: u, y: e, seat: r, currency: S, state: y }) => {
427
432
  if (!n || !r) return null;
428
433
  const f = r.seatNumber || (r.rowLabel && r.columnLabel ? `${r.rowLabel}-${r.columnLabel}` : "N/A"), x = {
@@ -440,45 +445,45 @@ const Xt = K(
440
445
  fontSize: "13px",
441
446
  boxShadow: "0 4px 12px rgba(0, 0, 0, 0.3)",
442
447
  minWidth: "140px"
443
- }, c = {
448
+ }, a = {
444
449
  color: "#9ca3af",
445
450
  marginRight: "4px"
446
451
  }, p = {
447
452
  fontWeight: 600
448
- }, b = {
453
+ }, m = {
449
454
  color: "#4ade80",
450
455
  fontWeight: 600
451
- }, d = {
456
+ }, h = {
452
457
  fontSize: "11px",
453
458
  color: "#6b7280",
454
459
  textTransform: "capitalize",
455
460
  marginTop: "4px"
456
461
  };
457
- return /* @__PURE__ */ a("div", { style: x, children: /* @__PURE__ */ k("div", { style: g, children: [
462
+ return /* @__PURE__ */ c("div", { style: x, children: /* @__PURE__ */ k("div", { style: g, children: [
458
463
  r.sectionName && /* @__PURE__ */ k("div", { style: { marginBottom: "4px" }, children: [
459
- /* @__PURE__ */ a("span", { style: c, children: "Section:" }),
460
- /* @__PURE__ */ a("span", { style: { ...p, color: "#3b82f6" }, children: r.sectionName })
464
+ /* @__PURE__ */ c("span", { style: a, children: "Section:" }),
465
+ /* @__PURE__ */ c("span", { style: { ...p, color: "#3b82f6" }, children: r.sectionName })
461
466
  ] }),
462
467
  /* @__PURE__ */ k("div", { style: { marginBottom: "4px" }, children: [
463
- /* @__PURE__ */ a("span", { style: c, children: "Seat:" }),
464
- /* @__PURE__ */ a("span", { style: p, children: f })
468
+ /* @__PURE__ */ c("span", { style: a, children: "Seat:" }),
469
+ /* @__PURE__ */ c("span", { style: p, children: f })
465
470
  ] }),
466
471
  r.price !== void 0 && r.price > 0 && y === "available" && /* @__PURE__ */ k("div", { style: { marginBottom: "4px" }, children: [
467
- /* @__PURE__ */ a("span", { style: c, children: "Price:" }),
468
- /* @__PURE__ */ k("span", { style: b, children: [
472
+ /* @__PURE__ */ c("span", { style: a, children: "Price:" }),
473
+ /* @__PURE__ */ k("span", { style: m, children: [
469
474
  S,
470
475
  " ",
471
476
  r.price.toFixed(2)
472
477
  ] })
473
478
  ] }),
474
- /* @__PURE__ */ k("div", { style: d, children: [
479
+ /* @__PURE__ */ k("div", { style: h, children: [
475
480
  "Status: ",
476
481
  y
477
482
  ] })
478
483
  ] }) });
479
484
  }
480
485
  );
481
- Xt.displayName = "SeatTooltip";
486
+ At.displayName = "SeatTooltip";
482
487
  const pe = ({
483
488
  config: n,
484
489
  configUrl: u,
@@ -490,84 +495,84 @@ const pe = ({
490
495
  unavailableSeats: f = [],
491
496
  selectedSeats: x,
492
497
  myReservedSeats: g = [],
493
- onSeatSelect: c,
498
+ onSeatSelect: a,
494
499
  onSeatDeselect: p,
495
- onSelectionChange: b,
496
- colorOverrides: d,
500
+ onSelectionChange: m,
501
+ colorOverrides: h,
497
502
  showTooltip: I = !0,
498
- zoomEnabled: v = !0,
503
+ zoomEnabled: b = !0,
499
504
  className: w = "",
500
- onConfigLoad: m,
501
- onError: L,
505
+ onConfigLoad: E,
506
+ onError: v,
502
507
  // Floor selector props
503
- showFloorSelector: W,
504
- floorSelectorPosition: O = "top-left",
505
- floorSelectorClassName: M,
506
- showAllFloorsOption: P = !0,
507
- allFloorsLabel: A = "All",
508
- fitToView: J = !0,
508
+ showFloorSelector: T,
509
+ floorSelectorPosition: P = "top-left",
510
+ floorSelectorClassName: F,
511
+ showAllFloorsOption: W = !0,
512
+ allFloorsLabel: Q = "All",
513
+ fitToView: O = !0,
509
514
  fitPadding: j = 40,
510
515
  // Zoom controls
511
- showZoomControls: ot = !0,
512
- zoomControlsPosition: rt = "bottom-right",
513
- zoomControlsClassName: st,
514
- minZoom: at,
515
- maxZoom: $ = 3,
516
+ showZoomControls: ct = !0,
517
+ zoomControlsPosition: at = "bottom-right",
518
+ zoomControlsClassName: lt,
519
+ minZoom: tt,
520
+ maxZoom: Y = 3,
516
521
  zoomStep: V = 0.25,
517
522
  // Touch gestures
518
- touchEnabled: Yt = !0
523
+ touchEnabled: ht = !0
519
524
  }) => {
520
- const St = y !== void 0 ? y : S, gt = U(null), wt = U(null), C = le(wt), [Z, Ct] = Y(
525
+ const wt = y !== void 0 ? y : S, yt = K(null), Ct = K(null), C = le(Ct), [Z, Mt] = A(
521
526
  /* @__PURE__ */ new Set()
522
- ), [R, Q] = Y(1), [T, _] = Y({ x: 0, y: 0 }), [Pt, zt] = Y(null), [Mt, Bt] = Y(1), ct = U({ width: 0, height: 0 }), [tt, It] = Y({ visible: !1, x: 0, y: 0, seat: null, state: "available" }), { config: At, loading: Ht, error: et } = ce(u), s = n || At, pt = e !== void 0, D = pt ? e || null : Pt, lt = x !== void 0, Ot = N(
527
+ ), [R, et] = A(1), [X, _] = A({ x: 0, y: 0 }), [Et, Pt] = A(null), [It, zt] = A(1), dt = K({ width: 0, height: 0 }), [nt, Ft] = A({ visible: !1, x: 0, y: 0, seat: null, state: "available" }), { config: Bt, loading: Ht, error: it } = ae(u), s = n || Bt, xt = e !== void 0, D = xt ? e || null : Et, ut = x !== void 0, Ot = N(
523
528
  (t) => {
524
- pt || zt(t), r?.(t);
529
+ xt || Pt(t), r?.(t);
525
530
  },
526
- [pt, r]
527
- ), yt = s?.floors || [], jt = W !== void 0 ? W : yt.length > 1, ht = z(
528
- () => s ? { ...s.colors, ...d } : { ...de, ...d },
529
- [s, d]
531
+ [xt, r]
532
+ ), mt = s?.floors || [], jt = T !== void 0 ? T : mt.length > 1, ft = z(
533
+ () => s ? { ...s.colors, ...h } : { ...de, ...h },
534
+ [s, h]
530
535
  ), q = z(() => {
531
536
  if (!s) return [];
532
537
  let t = s.seats.filter((i) => i.state !== "hidden");
533
538
  return D && (t = t.filter(
534
539
  (i) => i.floorId === D || !i.floorId && D === "floor_default"
535
540
  )), t;
536
- }, [s, D]), dt = z(() => s?.stages ? D ? s.stages.filter(
541
+ }, [s, D]), gt = z(() => s?.stages ? D ? s.stages.filter(
537
542
  (t) => t.floorId === D || !t.floorId && D === "floor_default"
538
- ) : s.stages : [], [s, D]), ut = z(() => s?.texts ? D ? s.texts.filter(
543
+ ) : s.stages : [], [s, D]), pt = z(() => s?.texts ? D ? s.texts.filter(
539
544
  (t) => t.floorId === D || !t.floorId && D === "floor_default"
540
- ) : s.texts : [], [s, D]), E = z(() => {
541
- if (!s || q.length === 0 && dt.length === 0 && ut.length === 0)
545
+ ) : s.texts : [], [s, D]), L = z(() => {
546
+ if (!s || q.length === 0 && gt.length === 0 && pt.length === 0)
542
547
  return null;
543
- let t = 1 / 0, i = 1 / 0, l = -1 / 0, h = -1 / 0;
548
+ let t = 1 / 0, i = 1 / 0, l = -1 / 0, d = -1 / 0;
544
549
  return q.forEach((o) => {
545
- const F = (o.size || 24) / 2;
546
- t = Math.min(t, o.position.x - F), i = Math.min(i, o.position.y - F), l = Math.max(l, o.position.x + F), h = Math.max(h, o.position.y + F);
547
- }), dt.forEach((o) => {
548
- t = Math.min(t, o.position.x), i = Math.min(i, o.position.y), l = Math.max(l, o.position.x + (o.config?.width || 200)), h = Math.max(h, o.position.y + (o.config?.height || 100));
549
- }), ut.forEach((o) => {
550
- const F = o.config.text.length * o.config.fontSize * 0.6, X = o.config.fontSize;
551
- t = Math.min(t, o.position.x), i = Math.min(i, o.position.y), l = Math.max(l, o.position.x + F), h = Math.max(h, o.position.y + X);
552
- }), { minX: t, minY: i, maxX: l, maxY: h, width: l - t, height: h - i };
553
- }, [s, q, dt, ut]), xt = N(() => {
554
- if (!s || !E || C.width === 0 || C.height === 0) return;
555
- const t = C.width, i = C.height, l = t - j * 2, h = i - j * 2, o = l / E.width, F = h / E.height, X = Math.min(o, F, $), ft = E.minX + E.width / 2, mt = E.minY + E.height / 2, te = t / 2, ee = i / 2, ne = te - ft * X, ie = ee - mt * X;
556
- Q(X), _({ x: ne, y: ie }), Bt(X);
557
- }, [s, E, C, j, $]);
550
+ const M = (o.size || 24) / 2;
551
+ t = Math.min(t, o.position.x - M), i = Math.min(i, o.position.y - M), l = Math.max(l, o.position.x + M), d = Math.max(d, o.position.y + M);
552
+ }), gt.forEach((o) => {
553
+ t = Math.min(t, o.position.x), i = Math.min(i, o.position.y), l = Math.max(l, o.position.x + (o.config?.width || 200)), d = Math.max(d, o.position.y + (o.config?.height || 100));
554
+ }), pt.forEach((o) => {
555
+ const M = o.config.scaleX || 1, $ = o.config.scaleY || 1, U = o.config.text.length * o.config.fontSize * 0.6 * M, st = o.config.fontSize * $;
556
+ t = Math.min(t, o.position.x), i = Math.min(i, o.position.y), l = Math.max(l, o.position.x + U), d = Math.max(d, o.position.y + st);
557
+ }), { minX: t, minY: i, maxX: l, maxY: d, width: l - t, height: d - i };
558
+ }, [s, q, gt, pt]), bt = N(() => {
559
+ if (!s || !L || C.width === 0 || C.height === 0) return;
560
+ const t = C.width, i = C.height, l = t - j * 2, d = i - j * 2, o = l / L.width, M = d / L.height, $ = Math.min(o, M, Y), U = L.minX + L.width / 2, st = L.minY + L.height / 2, te = t / 2, ee = i / 2, ne = te - U * $, ie = ee - st * $;
561
+ et($), _({ x: ne, y: ie }), zt($);
562
+ }, [s, L, C, j, Y]);
558
563
  B(() => {
559
- if (!J || !s || !E || C.width === 0 || C.height === 0) return;
564
+ if (!O || !s || !L || C.width === 0 || C.height === 0) return;
560
565
  const t = Math.abs(
561
- C.width - ct.current.width
566
+ C.width - dt.current.width
562
567
  ), i = Math.abs(
563
- C.height - ct.current.height
568
+ C.height - dt.current.height
564
569
  );
565
- !(ct.current.width === 0) && t < 10 && i < 10 || (ct.current = C, xt());
566
- }, [J, s, E, C, D, xt]);
570
+ !(dt.current.width === 0) && t < 10 && i < 10 || (dt.current = C, bt());
571
+ }, [O, s, L, C, D, bt]);
567
572
  const H = z(() => {
568
- const t = new Set(St), i = new Set(f), l = new Set(g);
573
+ const t = new Set(wt), i = new Set(f), l = new Set(g);
569
574
  return { reserved: t, unavailable: i, myReserved: l };
570
- }, [St, f, g]), bt = z(() => x ? new Set(x) : null, [x]), nt = N(
575
+ }, [wt, f, g]), vt = z(() => x ? new Set(x) : null, [x]), ot = N(
571
576
  (t) => {
572
577
  const i = t.id, l = t.seatNumber || "";
573
578
  return H.unavailable.has(i) || H.unavailable.has(l) ? "unavailable" : H.reserved.has(i) || H.reserved.has(l) ? "reserved" : H.myReserved.has(i) || H.myReserved.has(l) || Z.has(i) ? "selected" : t.state;
@@ -575,76 +580,76 @@ const pe = ({
575
580
  [H, Z]
576
581
  );
577
582
  B(() => {
578
- s && m && m(s);
579
- }, [s, m]), B(() => {
580
- et && L && L(et);
581
- }, [et, L]), B(() => {
582
- lt && bt && Ct(bt);
583
- }, [lt, bt]);
583
+ s && E && E(s);
584
+ }, [s, E]), B(() => {
585
+ it && v && v(it);
586
+ }, [it, v]), B(() => {
587
+ ut && vt && Mt(vt);
588
+ }, [ut, vt]);
584
589
  const Vt = N(
585
590
  (t) => {
586
- const i = nt(t);
591
+ const i = ot(t);
587
592
  if (i !== "available" && i !== "selected")
588
593
  return;
589
594
  const l = Z.has(t.id);
590
- lt || Ct((h) => {
591
- const o = new Set(h);
595
+ ut || Mt((d) => {
596
+ const o = new Set(d);
592
597
  return l ? o.delete(t.id) : o.add(t.id), o;
593
- }), l ? p?.(t) : (c?.(t), c || console.log("Seat selected:", t));
598
+ }), l ? p?.(t) : (a?.(t), a || console.log("Seat selected:", t));
594
599
  },
595
600
  [
596
- nt,
601
+ ot,
597
602
  Z,
598
- lt,
599
- c,
603
+ ut,
604
+ a,
600
605
  p
601
606
  ]
602
- ), it = z(() => s ? q.filter((t) => Z.has(t.id)) : [], [s, q, Z]);
607
+ ), rt = z(() => s ? q.filter((t) => Z.has(t.id)) : [], [s, q, Z]);
603
608
  B(() => {
604
- b?.(it);
605
- }, [it, b]);
606
- const G = at !== void 0 ? at : Mt * 0.5, Zt = N(() => {
607
- if (!v) return;
608
- const t = Math.min(R + V, $);
609
+ m?.(rt);
610
+ }, [rt, m]);
611
+ const G = tt !== void 0 ? tt : It * 0.5, Zt = N(() => {
612
+ if (!b) return;
613
+ const t = Math.min(R + V, Y);
609
614
  if (t !== R) {
610
- const i = C.width || s?.canvas.width || 800, l = C.height || s?.canvas.height || 600, h = i / 2, o = l / 2, F = {
611
- x: (h - T.x) / R,
612
- y: (o - T.y) / R
615
+ const i = C.width || s?.canvas.width || 800, l = C.height || s?.canvas.height || 600, d = i / 2, o = l / 2, M = {
616
+ x: (d - X.x) / R,
617
+ y: (o - X.y) / R
613
618
  };
614
- Q(t), _({
615
- x: h - F.x * t,
616
- y: o - F.y * t
619
+ et(t), _({
620
+ x: d - M.x * t,
621
+ y: o - M.y * t
617
622
  });
618
623
  }
619
624
  }, [
620
- v,
625
+ b,
621
626
  R,
622
627
  V,
623
- $,
628
+ Y,
624
629
  C,
625
630
  s,
626
- T
631
+ X
627
632
  ]), _t = N(() => {
628
- if (!v) return;
633
+ if (!b) return;
629
634
  const t = Math.max(R - V, G);
630
635
  if (t !== R) {
631
- const i = C.width || s?.canvas.width || 800, l = C.height || s?.canvas.height || 600, h = i / 2, o = l / 2, F = {
632
- x: (h - T.x) / R,
633
- y: (o - T.y) / R
636
+ const i = C.width || s?.canvas.width || 800, l = C.height || s?.canvas.height || 600, d = i / 2, o = l / 2, M = {
637
+ x: (d - X.x) / R,
638
+ y: (o - X.y) / R
634
639
  };
635
- Q(t), _({
636
- x: h - F.x * t,
637
- y: o - F.y * t
640
+ et(t), _({
641
+ x: d - M.x * t,
642
+ y: o - M.y * t
638
643
  });
639
644
  }
640
645
  }, [
641
- v,
646
+ b,
642
647
  R,
643
648
  V,
644
649
  G,
645
650
  C,
646
651
  s,
647
- T
652
+ X
648
653
  ]), qt = N((t) => {
649
654
  _({
650
655
  x: t.target.x(),
@@ -652,31 +657,31 @@ const pe = ({
652
657
  });
653
658
  }, []), Gt = N(
654
659
  (t) => {
655
- if (!v) return;
660
+ if (!b) return;
656
661
  t.evt.preventDefault();
657
- const i = gt.current;
662
+ const i = yt.current;
658
663
  if (!i) return;
659
- const l = i.scaleX(), h = i.getPointerPosition();
660
- if (!h) return;
661
- const o = 1.1, F = t.evt.deltaY > 0 ? l / o : l * o, X = Math.min(Math.max(F, G), $), ft = {
662
- x: (h.x - T.x) / l,
663
- y: (h.y - T.y) / l
664
- }, mt = {
665
- x: h.x - ft.x * X,
666
- y: h.y - ft.y * X
664
+ const l = i.scaleX(), d = i.getPointerPosition();
665
+ if (!d) return;
666
+ const o = 1.1, M = t.evt.deltaY > 0 ? l / o : l * o, $ = Math.min(Math.max(M, G), Y), U = {
667
+ x: (d.x - X.x) / l,
668
+ y: (d.y - X.y) / l
669
+ }, st = {
670
+ x: d.x - U.x * $,
671
+ y: d.y - U.y * $
667
672
  };
668
- Q(X), _(mt);
673
+ et($), _(st);
669
674
  },
670
- [v, T, G, $]
675
+ [b, X, G, Y]
671
676
  );
672
- he(gt, {
673
- enabled: Yt && v,
677
+ he(yt, {
678
+ enabled: ht && b,
674
679
  minScale: G,
675
- maxScale: $,
680
+ maxScale: Y,
676
681
  currentScale: R,
677
- currentPosition: T,
682
+ currentPosition: X,
678
683
  onScaleChange: (t, i) => {
679
- Q(t), _(i);
684
+ et(t), _(i);
680
685
  }
681
686
  });
682
687
  const Ut = N(
@@ -684,60 +689,60 @@ const pe = ({
684
689
  if (!I) return;
685
690
  const l = i.target.getStage();
686
691
  if (!l) return;
687
- const h = l.getPointerPosition();
688
- if (!h) return;
692
+ const d = l.getPointerPosition();
693
+ if (!d) return;
689
694
  const o = l.container().getBoundingClientRect();
690
- It({
695
+ Ft({
691
696
  visible: !0,
692
- x: o.left + h.x,
693
- y: o.top + h.y,
697
+ x: o.left + d.x,
698
+ y: o.top + d.y,
694
699
  seat: t,
695
- state: nt(t)
700
+ state: ot(t)
696
701
  });
697
702
  },
698
- [I, nt]
703
+ [I, ot]
699
704
  ), Kt = N(() => {
700
- It((t) => ({ ...t, visible: !1 }));
705
+ Ft((t) => ({ ...t, visible: !1 }));
701
706
  }, []);
702
707
  if (Ht)
703
- return /* @__PURE__ */ a("div", { className: `flex items-center justify-center h-full ${w}`, children: /* @__PURE__ */ a("p", { children: "Loading seat map..." }) });
704
- if (et)
705
- return /* @__PURE__ */ a("div", { className: `flex items-center justify-center h-full ${w}`, children: /* @__PURE__ */ k("p", { className: "text-red-500", children: [
708
+ return /* @__PURE__ */ c("div", { className: `flex items-center justify-center h-full ${w}`, children: /* @__PURE__ */ c("p", { children: "Loading seat map..." }) });
709
+ if (it)
710
+ return /* @__PURE__ */ c("div", { className: `flex items-center justify-center h-full ${w}`, children: /* @__PURE__ */ k("p", { className: "text-red-500", children: [
706
711
  "Error loading seat map: ",
707
- et.message
712
+ it.message
708
713
  ] }) });
709
714
  if (!s)
710
- return /* @__PURE__ */ a("div", { className: `flex items-center justify-center h-full ${w}`, children: /* @__PURE__ */ a("p", { children: "No configuration provided" }) });
715
+ return /* @__PURE__ */ c("div", { className: `flex items-center justify-center h-full ${w}`, children: /* @__PURE__ */ c("p", { children: "No configuration provided" }) });
711
716
  const Jt = C.width || s.canvas.width, Qt = C.height || s.canvas.height;
712
717
  return /* @__PURE__ */ k(
713
718
  "div",
714
719
  {
715
- ref: wt,
720
+ ref: Ct,
716
721
  className: `relative ${w}`,
717
- style: { width: "100%", height: "100%" },
722
+ style: { width: "100%", height: "100%", touchAction: ht && b ? "none" : "auto" },
718
723
  children: [
719
- jt && yt.length > 0 && /* @__PURE__ */ a(
720
- $t,
724
+ jt && mt.length > 0 && /* @__PURE__ */ c(
725
+ Lt,
721
726
  {
722
- floors: yt,
727
+ floors: mt,
723
728
  currentFloorId: D,
724
729
  onFloorChange: Ot,
725
- showAllOption: P,
726
- allLabel: A,
727
- position: O,
728
- className: M
730
+ showAllOption: W,
731
+ allLabel: Q,
732
+ position: P,
733
+ className: F
729
734
  }
730
735
  ),
731
736
  /* @__PURE__ */ k(
732
737
  oe,
733
738
  {
734
- ref: gt,
739
+ ref: yt,
735
740
  width: Jt,
736
741
  height: Qt,
737
742
  scaleX: R,
738
743
  scaleY: R,
739
- x: T.x,
740
- y: T.y,
744
+ x: X.x,
745
+ y: X.y,
741
746
  draggable: !0,
742
747
  onDragEnd: qt,
743
748
  onWheel: Gt,
@@ -746,21 +751,21 @@ const pe = ({
746
751
  cursor: "grab"
747
752
  },
748
753
  children: [
749
- /* @__PURE__ */ a(vt, { listening: !1, children: dt.map((t) => /* @__PURE__ */ a(
750
- Tt,
754
+ /* @__PURE__ */ c(St, { listening: !1, children: gt.map((t) => /* @__PURE__ */ c(
755
+ Xt,
751
756
  {
752
757
  stage: t,
753
- stageColor: ht.stageColor
758
+ stageColor: ft.stageColor
754
759
  },
755
760
  t.id
756
761
  )) }),
757
- /* @__PURE__ */ a(vt, { listening: !1, children: ut.map((t) => /* @__PURE__ */ a(Lt, { text: t }, t.id)) }),
758
- /* @__PURE__ */ a(vt, { children: q.map((t) => /* @__PURE__ */ a(
762
+ /* @__PURE__ */ c(St, { listening: !1, children: pt.map((t) => /* @__PURE__ */ c(Yt, { text: t }, t.id)) }),
763
+ /* @__PURE__ */ c(St, { children: q.map((t) => /* @__PURE__ */ c(
759
764
  Wt,
760
765
  {
761
766
  seat: t,
762
- state: nt(t),
763
- colors: ht,
767
+ state: ot(t),
768
+ colors: ft,
764
769
  onClick: Vt,
765
770
  onMouseEnter: Ut,
766
771
  onMouseLeave: Kt
@@ -770,40 +775,40 @@ const pe = ({
770
775
  ]
771
776
  }
772
777
  ),
773
- I && /* @__PURE__ */ a(
774
- Xt,
778
+ I && /* @__PURE__ */ c(
779
+ At,
775
780
  {
776
- visible: tt.visible,
777
- x: tt.x,
778
- y: tt.y,
779
- seat: tt.seat,
780
- currency: ht.currency,
781
- state: tt.state
781
+ visible: nt.visible,
782
+ x: nt.x,
783
+ y: nt.y,
784
+ seat: nt.seat,
785
+ currency: ft.currency,
786
+ state: nt.state
782
787
  }
783
788
  ),
784
- ot && v && /* @__PURE__ */ a(
785
- Et,
789
+ ct && b && /* @__PURE__ */ c(
790
+ $t,
786
791
  {
787
792
  scale: R,
788
793
  minScale: G,
789
- maxScale: $,
790
- fitScale: Mt,
794
+ maxScale: Y,
795
+ fitScale: It,
791
796
  onZoomIn: Zt,
792
797
  onZoomOut: _t,
793
- onFitToScreen: xt,
794
- position: rt,
795
- className: st
798
+ onFitToScreen: bt,
799
+ position: at,
800
+ className: lt
796
801
  }
797
802
  ),
798
- it.length > 0 && /* @__PURE__ */ k("div", { className: "absolute top-4 right-4 bg-white dark:bg-gray-800 p-4 rounded shadow-lg", children: [
803
+ rt.length > 0 && /* @__PURE__ */ k("div", { className: "absolute top-4 right-4 bg-white dark:bg-gray-800 p-4 rounded shadow-lg", children: [
799
804
  /* @__PURE__ */ k("h3", { className: "font-semibold mb-2", children: [
800
805
  "Selected Seats (",
801
- it.length,
806
+ rt.length,
802
807
  ")"
803
808
  ] }),
804
- /* @__PURE__ */ a("div", { className: "max-h-48 overflow-y-auto space-y-1", children: it.map((t) => /* @__PURE__ */ k("div", { className: "text-sm", children: [
809
+ /* @__PURE__ */ c("div", { className: "max-h-48 overflow-y-auto space-y-1", children: rt.map((t) => /* @__PURE__ */ k("div", { className: "text-sm", children: [
805
810
  t.seatNumber,
806
- t.price && ` - ${ht.currency} ${t.price.toFixed(2)}`
811
+ t.price && ` - ${ft.currency} ${t.price.toFixed(2)}`
807
812
  ] }, t.id)) })
808
813
  ] })
809
814
  ]
@@ -813,11 +818,11 @@ const pe = ({
813
818
  export {
814
819
  de as DEFAULT_COLORS,
815
820
  pe as SeatMapViewer,
816
- be as clearFirebaseInstance,
817
- me as getFirebaseDatabase,
821
+ me as clearFirebaseInstance,
822
+ be as getFirebaseDatabase,
818
823
  ve as initializeFirebaseForViewer,
819
824
  Se as isFirebaseInitialized,
820
- ce as useConfigFetcher,
825
+ ae as useConfigFetcher,
821
826
  le as useContainerSize,
822
827
  we as useFirebaseConfig,
823
828
  Ce as useFirebaseSeatStates,