@bravostudioai/react 0.1.18 → 0.1.22

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.
Files changed (69) hide show
  1. package/dist/cli/commands/generate.js +144 -129
  2. package/dist/cli/commands/generate.js.map +1 -1
  3. package/dist/components/DynamicComponent.js.map +1 -1
  4. package/dist/components/EncoreApp.js +41 -38
  5. package/dist/components/EncoreApp.js.map +1 -1
  6. package/dist/components/EncoreErrorBoundary.js.map +1 -1
  7. package/dist/components/EncoreLoadingFallback.js.map +1 -1
  8. package/dist/components.js +343 -336
  9. package/dist/components.js.map +1 -1
  10. package/dist/contexts/EncoreActionContext.js +3 -3
  11. package/dist/contexts/EncoreActionContext.js.map +1 -1
  12. package/dist/contexts/EncoreAppContext.js +2 -2
  13. package/dist/contexts/EncoreAppContext.js.map +1 -1
  14. package/dist/contexts/EncoreBindingContext.js +2 -2
  15. package/dist/contexts/EncoreBindingContext.js.map +1 -1
  16. package/dist/contexts/EncoreComponentIdContext.js +3 -5
  17. package/dist/contexts/EncoreComponentIdContext.js.map +1 -1
  18. package/dist/contexts/EncoreRepeatingContainerContext.js +2 -2
  19. package/dist/contexts/EncoreRepeatingContainerContext.js.map +1 -1
  20. package/dist/contexts/EncoreRouterContext.js +2 -2
  21. package/dist/contexts/EncoreRouterContext.js.map +1 -1
  22. package/dist/hooks/usePusherUpdates.js.map +1 -1
  23. package/dist/index.js +33 -30
  24. package/dist/index.js.map +1 -1
  25. package/dist/lib/fetcher.js +22 -17
  26. package/dist/lib/fetcher.js.map +1 -1
  27. package/dist/packages/encore-lib/package.json.js +8 -0
  28. package/dist/packages/encore-lib/package.json.js.map +1 -0
  29. package/dist/src/cli/commands/generate.d.ts.map +1 -1
  30. package/dist/src/components/DynamicComponent.d.ts.map +1 -1
  31. package/dist/src/components/EncoreApp.d.ts.map +1 -1
  32. package/dist/src/components/EncoreErrorBoundary.d.ts.map +1 -1
  33. package/dist/src/components/EncoreLoadingFallback.d.ts.map +1 -1
  34. package/dist/src/components.d.ts.map +1 -1
  35. package/dist/src/contexts/EncoreActionContext.d.ts +1 -2
  36. package/dist/src/contexts/EncoreActionContext.d.ts.map +1 -1
  37. package/dist/src/contexts/EncoreAppContext.d.ts +1 -2
  38. package/dist/src/contexts/EncoreAppContext.d.ts.map +1 -1
  39. package/dist/src/contexts/EncoreBindingContext.d.ts +1 -2
  40. package/dist/src/contexts/EncoreBindingContext.d.ts.map +1 -1
  41. package/dist/src/contexts/EncoreComponentIdContext.d.ts +1 -2
  42. package/dist/src/contexts/EncoreComponentIdContext.d.ts.map +1 -1
  43. package/dist/src/contexts/EncoreRepeatingContainerContext.d.ts +1 -2
  44. package/dist/src/contexts/EncoreRepeatingContainerContext.d.ts.map +1 -1
  45. package/dist/src/contexts/EncoreRouterContext.d.ts +1 -2
  46. package/dist/src/contexts/EncoreRouterContext.d.ts.map +1 -1
  47. package/dist/src/hooks/useAuthRedirect.d.ts.map +1 -1
  48. package/dist/src/hooks/usePusherUpdates.d.ts.map +1 -1
  49. package/dist/src/index.d.ts +1 -0
  50. package/dist/src/index.d.ts.map +1 -1
  51. package/dist/src/lib/fetcher.d.ts.map +1 -1
  52. package/dist/src/stores/useEncoreState.d.ts.map +1 -1
  53. package/dist/stores/useEncoreState.js.map +1 -1
  54. package/package.json +1 -1
  55. package/src/components/DynamicComponent.tsx +1 -0
  56. package/src/components/EncoreApp.tsx +3 -1
  57. package/src/components/EncoreErrorBoundary.tsx +36 -35
  58. package/src/components/EncoreLoadingFallback.tsx +19 -18
  59. package/src/components.tsx +5 -34
  60. package/src/contexts/EncoreActionContext.ts +4 -2
  61. package/src/contexts/EncoreAppContext.ts +4 -2
  62. package/src/contexts/EncoreBindingContext.ts +4 -2
  63. package/src/contexts/EncoreComponentIdContext.ts +4 -4
  64. package/src/contexts/EncoreRepeatingContainerContext.ts +4 -3
  65. package/src/contexts/EncoreRouterContext.ts +4 -2
  66. package/src/hooks/useAuthRedirect.ts +2 -0
  67. package/src/hooks/usePusherUpdates.ts +2 -0
  68. package/src/index.ts +6 -0
  69. package/src/stores/useEncoreState.ts +2 -0
@@ -1,12 +1,12 @@
1
1
  import { jsx as p, jsxs as it, Fragment as ut } from "react/jsx-runtime";
2
- import v, { useContext as N, useMemo as Ht, useState as Vt, useCallback as Nt } from "react";
2
+ import x, { useContext as N, useMemo as Ht, useState as Vt, useCallback as Nt } from "react";
3
3
  import tt from "./contexts/EncoreBindingContext.js";
4
4
  import k from "./stores/useEncoreState.js";
5
5
  import lt from "./contexts/EncoreComponentIdContext.js";
6
6
  import Ot from "axios";
7
- import ht from "./contexts/EncoreActionContext.js";
7
+ import ft from "./contexts/EncoreActionContext.js";
8
8
  import Mt from "./contexts/EncoreRepeatingContainerContext.js";
9
- const ct = v.createContext({}), V = v.createContext(
9
+ const ct = x.createContext({}), V = x.createContext(
10
10
  {}
11
11
  ), st = (t) => t.replace(/#(\w{2})(\w{6})/, "#$2$1"), Gt = (t) => t.slice(1, 3) === "00", jt = (t) => {
12
12
  if (!Array.isArray(t)) return null;
@@ -15,8 +15,8 @@ const ct = v.createContext({}), V = v.createContext(
15
15
  const e = r.split(":");
16
16
  return e.length >= 3 ? { type: e[1], groupName: e[2] } : null;
17
17
  }, rt = () => {
18
- const [t, r] = Vt({ width: 0, height: 0 }), e = v.useRef(null);
19
- return v.useEffect(() => {
18
+ const [t, r] = Vt({ width: 0, height: 0 }), e = x.useRef(null);
19
+ return x.useEffect(() => {
20
20
  if (!e.current) return;
21
21
  const o = e.current, i = () => {
22
22
  const { width: n, height: m } = o.getBoundingClientRect();
@@ -27,8 +27,8 @@ const ct = v.createContext({}), V = v.createContext(
27
27
  });
28
28
  const l = new ResizeObserver((n) => {
29
29
  for (const m of n) {
30
- const s = m.contentRect;
31
- r({ width: s.width, height: s.height });
30
+ const a = m.contentRect;
31
+ r({ width: a.width, height: a.height });
32
32
  }
33
33
  });
34
34
  return l.observe(o), () => l.disconnect();
@@ -38,56 +38,52 @@ const ct = v.createContext({}), V = v.createContext(
38
38
  width: window.innerWidth,
39
39
  height: window.innerHeight
40
40
  }, l = Nt(
41
- (a) => (o.dimensions?.width ?? 0) * 0.01 * a,
41
+ (s) => (o.dimensions?.width ?? 0) * 0.01 * s,
42
42
  [o.dimensions?.width]
43
43
  ), n = {};
44
44
  r = { debug: !1, ...r };
45
- const m = k((a) => a.fontsById || {});
46
- if (k((a) => a.fontsByIdFull || {}), !t || !t) return;
47
- const s = o.dimensions?.width ?? i.width, y = o.dimensions?.height ?? i.height;
48
- if (t.layout?.layoutSizingHorizontal || t.layout?.layoutSizingVertical || (t.width && s > 0 && (n.width = t.width * s * 0.01), t.aspectRatio && t.width ? s > 0 && (n.height = t.width * s * 0.01 / t.aspectRatio) : t.height && y > 0 && (n.height = t.height * y * 0.01)), !(o?.isFlex ?? !1) && t.positioning) {
49
- const a = t.layout?.layoutSizingHorizontal === "FIXED" || t.layout?.layoutSizingVertical === "FIXED", u = a && t.positioning.top < 0 ? 0 : t.positioning.top, R = a && t.positioning.left < 0 ? 0 : t.positioning.left;
45
+ const m = k((s) => s.fontsById || {});
46
+ if (k((s) => s.fontsByIdFull || {}), !t || !t) return;
47
+ const a = o.dimensions?.width ?? i.width, y = o.dimensions?.height ?? i.height;
48
+ if (t.layout?.layoutSizingHorizontal || t.layout?.layoutSizingVertical || (t.width && a > 0 && (n.width = t.width * a * 0.01), t.aspectRatio && t.width ? a > 0 && (n.height = t.width * a * 0.01 / t.aspectRatio) : t.height && y > 0 && (n.height = t.height * y * 0.01)), !(o?.isFlex ?? !1) && t.positioning) {
49
+ const s = t.layout?.layoutSizingHorizontal === "FIXED" || t.layout?.layoutSizingVertical === "FIXED", u = s && t.positioning.top < 0 ? 0 : t.positioning.top, R = s && t.positioning.left < 0 ? 0 : t.positioning.left;
50
50
  let w = !1;
51
- if (t.horizontalPosition === "center" && (w = !0), !w && a && t.layout?.layoutSizingHorizontal === "FIXED" && t.layout?.size?.x) {
52
- const B = t.layout.size.x, z = e.scaleFactor ?? 1, f = B * z, S = o?.dimensions?.width;
53
- S && typeof S == "number" && S > 0 && f / S >= 0.95 && R >= 15 && R <= 35 && (w = !0);
54
- }
55
- n.top = `${u}%`;
56
- const x = !!t.inset;
51
+ t.horizontalPosition === "center" && (w = !0), n.top = `${u}%`;
52
+ const S = !!t.inset;
57
53
  if (w) {
58
- if (x) {
59
- const B = String(t.inset).split(/\s+/);
60
- B.length === 3 ? n.inset = `${B[0]} 50% ${B[2]} auto` : B.length === 4 && (n.inset = `${B[0]} 50% ${B[2]} auto`), delete n.left, delete n.right;
54
+ if (S) {
55
+ const W = String(t.inset).split(/\s+/);
56
+ W.length === 3 ? n.inset = `${W[0]} 50% ${W[2]} auto` : W.length === 4 && (n.inset = `${W[0]} 50% ${W[2]} auto`), delete n.left, delete n.right;
61
57
  } else
62
58
  n.left = "50%", n.right = "auto";
63
59
  n.transform = "translateX(-50%)";
64
60
  } else
65
- x ? n.inset = t.inset : n.left = `${R}%`;
66
- a ? (n.right = "auto", n.bottom = "auto") : (t.positioning.bottom !== void 0 && (n.bottom = `${t.positioning.bottom}%`), t.positioning.right !== void 0 && (n.right = `${t.positioning.right}%`)), n.position = "absolute";
61
+ S ? n.inset = t.inset : n.left = `${R}%`;
62
+ s ? (n.right = "auto", n.bottom = "auto") : (t.positioning.bottom !== void 0 && (n.bottom = `${t.positioning.bottom}%`), t.positioning.right !== void 0 && (n.right = `${t.positioning.right}%`)), n.position = "absolute";
67
63
  }
68
64
  if (t.layout?.padding) {
69
- const a = e.scaleFactor ?? 1, u = t.layout.padding;
70
- u.top !== void 0 && (n.paddingTop = u.top * a), u.right !== void 0 && (n.paddingRight = u.right * a), u.bottom !== void 0 && (n.paddingBottom = u.bottom * a), u.left !== void 0 && (n.paddingLeft = u.left * a);
65
+ const s = e.scaleFactor ?? 1, u = t.layout.padding;
66
+ u.top !== void 0 && (n.paddingTop = u.top * s), u.right !== void 0 && (n.paddingRight = u.right * s), u.bottom !== void 0 && (n.paddingBottom = u.bottom * s), u.left !== void 0 && (n.paddingLeft = u.left * s);
71
67
  }
72
68
  if (t.layout?.mode) {
73
69
  n.display = "flex";
74
- const a = (B) => B ? {
70
+ const s = (W) => W ? {
75
71
  MIN: "flex-start",
76
72
  MAX: "flex-end",
77
73
  CENTER: "center",
78
74
  SPACE_BETWEEN: "space-between",
79
75
  SPACE_AROUND: "space-around",
80
76
  SPACE_EVENLY: "space-evenly"
81
- }[B] || B.toLowerCase().replace(/_/g, "-") : void 0;
82
- t.layout.mode == "HORIZONTAL" ? (n.flexDirection = "row", t.layout.flexWrap && (n.flexWrap = t.layout.flexWrap), n.justifyContent = a(
77
+ }[W] || W.toLowerCase().replace(/_/g, "-") : void 0;
78
+ t.layout.mode == "HORIZONTAL" ? (n.flexDirection = "row", t.layout.flexWrap && (n.flexWrap = t.layout.flexWrap), n.justifyContent = s(
83
79
  t.layout.primaryAxisAlignItems
84
- ), n.alignItems = t.layout.counterAxisAlignItems) : (n.flexDirection = "column", n.justifyContent = a(
80
+ ), n.alignItems = t.layout.counterAxisAlignItems) : (n.flexDirection = "column", n.justifyContent = s(
85
81
  t.layout.primaryAxisAlignItems
86
- ), n.alignItems = t.layout.counterAxisAlignItems), n.flexGrow = t.layout.grow, t.layout.wrap === "NO_WRAP" ? n.flexWrap = "nowrap" : t.layout.flexWrap ? n.flexWrap = t.layout.flexWrap : n.flexWrap = "wrap";
87
- const u = t.layout.itemSpacing, R = e.scaleFactor ?? 1, x = t.layout.primaryAxisAlignItems === "SPACE_BETWEEN" ? 0 : (u !== void 0 ? u : 0) * R;
88
- n.gap = x === 0 ? "0px" : `${x}px`, n.rowGap = x === 0 ? "0px" : `${x}px`, n.columnGap = x === 0 ? "0px" : `${x}px`, (n.flexWrap === "wrap" || n.flexWrap === "wrap-reverse") && (n.alignContent = "flex-start"), r.debug || t.layout?.mode === "HORIZONTAL" && u === 0 ? console.log("[useEncoreStyle] Setting gap properties:", {
82
+ ), n.alignItems = t.layout.counterAxisAlignItems), n.flexGrow = t.layout.grow, t.layout.wrap === "WRAP" || t.layout.flexWrap === "wrap" ? n.flexWrap = "wrap" : t.layout.flexWrap ? n.flexWrap = t.layout.flexWrap : n.flexWrap = "nowrap";
83
+ const u = t.layout.itemSpacing, R = e.scaleFactor ?? 1, S = t.layout.primaryAxisAlignItems === "SPACE_BETWEEN" ? 0 : (u !== void 0 ? u : 0) * R;
84
+ n.gap = S === 0 ? "0px" : `${S}px`, n.rowGap = S === 0 ? "0px" : `${S}px`, n.columnGap = S === 0 ? "0px" : `${S}px`, (n.flexWrap === "wrap" || n.flexWrap === "wrap-reverse") && (n.alignContent = "flex-start"), r.debug || t.layout?.mode === "HORIZONTAL" && u === 0 ? console.log("[useEncoreStyle] Setting gap properties:", {
89
85
  itemSpacing: u,
90
- spacing: x,
86
+ spacing: S,
91
87
  gap: n.gap,
92
88
  rowGap: n.rowGap,
93
89
  columnGap: n.columnGap,
@@ -101,12 +97,12 @@ const ct = v.createContext({}), V = v.createContext(
101
97
  );
102
98
  }
103
99
  if (t.layout?.layoutSizingHorizontal === "FILL" && (n.width = "100%"), t.layout?.layoutSizingHorizontal === "FIXED") {
104
- const a = e.scaleFactor ?? 1;
105
- n.width = t.layout.size.x * a;
100
+ const s = e.scaleFactor ?? 1;
101
+ n.width = t.layout.size.x * s;
106
102
  }
107
103
  if (t.layout?.layoutSizingHorizontal, t.layout?.layoutSizingVertical === "FIXED") {
108
- const a = e.scaleFactor ?? 1;
109
- n.height = t.layout.size.y * a;
104
+ const s = e.scaleFactor ?? 1;
105
+ n.height = t.layout.size.y * s;
110
106
  }
111
107
  if (t.layout?.layoutSizingVertical === "FILL")
112
108
  if (!(o?.isFlex ?? !1) && t.positioning && t.positioning?.top !== void 0) {
@@ -115,22 +111,22 @@ const ct = v.createContext({}), V = v.createContext(
115
111
  } else
116
112
  n.height = "100%";
117
113
  if (t.layout?.layoutSizingVertical, t.backgroundColor && !Gt(t.backgroundColor) && (n.backgroundColor = st(t.backgroundColor)), t.color && (n.color = st(t.color)), t.lineHeightPx && (n.lineHeight = (t.lineHeightPx * (e.scaleFactor ?? 1)).toString() + "px"), t.fontSize && (n.fontSize = t.fontSize * (e.scaleFactor ?? 1)), t.fontWeight && (n.fontWeight = `${t.fontWeight}`), t.opacity && (n.opacity = t.opacity * 0.01), t.fontId) {
118
- const a = m[t.fontId] || "sans-serif";
119
- n.fontFamily = `"${a}"`, console.log("[AG_DEBUG] [useEncoreStyle] Font Resolution:", {
114
+ const s = m[t.fontId] || "sans-serif";
115
+ n.fontFamily = `"${s}"`, console.log("[AG_DEBUG] [useEncoreStyle] Font Resolution:", {
120
116
  fontId: t.fontId,
121
- resolvedFamily: a,
117
+ resolvedFamily: s,
122
118
  fontWeight: t.fontWeight,
123
119
  finalStyle: n.fontFamily
124
120
  });
125
121
  }
126
122
  if (t.borderRadius && (n.borderRadius = l(t.borderRadius)), t.cornerRadii) {
127
- const a = t.cornerRadii.map(l);
128
- n.borderTopLeftRadius = a[0], n.borderTopRightRadius = a[1], n.borderBottomRightRadius = a[2], n.borderBottomLeftRadius = a[3], delete n.borderRadius;
123
+ const s = t.cornerRadii.map(l);
124
+ n.borderTopLeftRadius = s[0], n.borderTopRightRadius = s[1], n.borderBottomRightRadius = s[2], n.borderBottomLeftRadius = s[3], delete n.borderRadius;
129
125
  }
130
126
  return t.borderWidth && (t.borderWidth > 5 ? n.borderWidth = t.borderWidth * 0.5 : n.borderWidth = t.borderWidth * 1.5), t.borderColor && (n.borderColor = st(t.borderColor)), (t.borderWidth || t.borderColor) && (n.borderStyle = "solid"), t.rotation && (n.transform = `rotate(${t.rotation}deg)`), t.textCase === "upper" && (n.textTransform = "uppercase"), t.textCase === "lower" && (n.textTransform = "lowercase"), t.letterSpacing && (n.letterSpacing = t.letterSpacing), t.textAlign && (n.textAlign = t.textAlign), r.debug && (n.borderWidth = 1, n.borderColor = "#FF0000FF", n.borderStyle = "solid"), n;
131
127
  }, et = ({ id: t, nodeData: r }) => {
132
128
  const e = N(tt), o = e?.nodeData?.[t], { patch: i, list: l } = o ?? { list: null, patch: null }, m = Array.isArray(r?.tags) && (r.tags.includes("encore:data:array") || r.tags.includes("bravo:data:array")) && e?.arrayDataById && e.arrayDataById[t] && Array.isArray(e.arrayDataById[t]) ? e.arrayDataById[t] : null;
133
- let s = i ? {
129
+ let a = i ? {
134
130
  ...r,
135
131
  ...i || {},
136
132
  ...i && i.data ? { data: { ...r?.data || {}, ...i.data } } : {},
@@ -138,55 +134,55 @@ const ct = v.createContext({}), V = v.createContext(
138
134
  actions: i.actions && Array.isArray(i.actions) && i.actions.length > 0 ? i.actions : r.actions || i.actions || []
139
135
  } : r;
140
136
  const y = e?.textOverridesById && e.textOverridesById[t] !== void 0 ? e.textOverridesById[t] : void 0;
141
- y !== void 0 && Array.isArray(r?.tags) && r.tags.includes("PROP:TEXT_VAR") && (s = {
142
- ...s,
143
- data: { ...s?.data || {}, text: String(y) }
137
+ y !== void 0 && Array.isArray(r?.tags) && r.tags.includes("PROP:TEXT_VAR") && (a = {
138
+ ...a,
139
+ data: { ...a?.data || {}, text: String(y) }
144
140
  });
145
- const I = Array.isArray(r?.tags) && (r.tags.includes("encore:data") || r.tags.includes("bravo:data")), h = e?.rootData;
146
- h && h[t] && typeof h[t] == "object" && (s = {
147
- ...s,
141
+ const v = Array.isArray(r?.tags) && (r.tags.includes("encore:data") || r.tags.includes("bravo:data")), f = e?.rootData;
142
+ f && f[t] && typeof f[t] == "object" && (a = {
143
+ ...a,
148
144
  data: {
149
- ...s.data || {},
150
- ...h[t]
145
+ ...a.data || {},
146
+ ...f[t]
151
147
  }
152
148
  });
153
- const a = e?.nodeData && typeof e.nodeData == "object";
154
- if (I || a) {
149
+ const s = e?.nodeData && typeof e.nodeData == "object";
150
+ if (v || s) {
155
151
  const u = e?.nodeData;
156
152
  if (u && typeof u == "object") {
157
153
  if (u[t] !== void 0) {
158
154
  const w = u[t];
159
- w && typeof w == "object" && s.data && (s = {
160
- ...s,
155
+ w && typeof w == "object" && a.data && (a = {
156
+ ...a,
161
157
  data: {
162
- ...s.data,
158
+ ...a.data,
163
159
  ...w
164
160
  }
165
161
  });
166
- } else if (I && u.description && s.data && (s = {
167
- ...s,
162
+ } else if (v && u.description && a.data && (a = {
163
+ ...a,
168
164
  data: {
169
- ...s.data,
165
+ ...a.data,
170
166
  text: u.description
171
167
  }
172
- }), u.image && s.data) {
168
+ }), u.image && a.data) {
173
169
  const w = u.image.startsWith("//") ? `https:${u.image}` : u.image;
174
- s = {
175
- ...s,
170
+ a = {
171
+ ...a,
176
172
  data: {
177
- ...s.data,
173
+ ...a.data,
178
174
  imageUrl: w
179
175
  }
180
176
  };
181
177
  }
182
- s.encoreData = u;
178
+ a.encoreData = u;
183
179
  }
184
180
  }
185
181
  return {
186
182
  patch: i,
187
183
  list: l || m,
188
184
  // Use arrayData if list is not provided
189
- patchedNodeData: s,
185
+ patchedNodeData: a,
190
186
  arrayData: m
191
187
  // Also return separately for components that need it
192
188
  };
@@ -198,37 +194,37 @@ const ct = v.createContext({}), V = v.createContext(
198
194
  _parentInputGroupInfo: i,
199
195
  _parentName: l
200
196
  }) => {
201
- const n = k((f) => f.baseURL), m = k((f) => f.appId);
202
- k((f) => f.pageId);
203
- const { onAction: s } = v.useContext(ht), { statefulSetId: y } = v.useContext(
197
+ const n = k((h) => h.baseURL), m = k((h) => h.appId);
198
+ k((h) => h.pageId);
199
+ const { onAction: a } = x.useContext(ft), { statefulSetId: y } = x.useContext(
204
200
  lt
205
- ), I = o || y, { patchedNodeData: h } = et({ id: t, nodeData: r }), a = k(
206
- (f) => f.setStatefulSetVariant
201
+ ), v = o || y, { patchedNodeData: f } = et({ id: t, nodeData: r }), s = k(
202
+ (h) => h.setStatefulSetVariant
207
203
  ), u = k(
208
- (f) => f.setInputGroupValue
209
- ), R = k((f) => f.setAccessToken), { app: w } = k((f) => f.app);
204
+ (h) => h.setInputGroupValue
205
+ ), R = k((h) => h.setAccessToken), { app: w } = k((h) => h.app);
210
206
  w.data?.app?.startPageId, w.data?.app?.PageId;
211
- const x = L(
207
+ const S = L(
212
208
  {
213
209
  positioning: r.style?.positioning
214
210
  },
215
211
  { debug: !1 }
216
212
  );
217
- x.zIndex = 99999, x.backgroundColor = "transparent", x.position = "absolute", x.top = "0", x.left = "0", x.right = "0", x.bottom = "0", x.width = "100%", x.height = "100%", x.pointerEvents = "auto", x.isolation = "isolate";
218
- const B = async (f) => {
219
- let S = !1;
220
- const O = () => {
221
- S = !1;
213
+ S.zIndex = 99999, S.backgroundColor = "transparent", S.position = "absolute", S.top = "0", S.left = "0", S.right = "0", S.bottom = "0", S.width = "100%", S.height = "100%", S.pointerEvents = "auto", S.isolation = "isolate";
214
+ const W = async (h) => {
215
+ let A = !1;
216
+ const G = () => {
217
+ A = !1;
222
218
  };
223
- if (typeof s == "function")
219
+ if (typeof a == "function")
224
220
  try {
225
- await s({ bravo: { cancel: O, action: f, componentId: t } }), S = !0;
221
+ await a({ bravo: { cancel: G, action: h, componentId: t } }), A = !0;
226
222
  } catch {
227
223
  }
228
224
  else
229
- S = !0;
230
- if (S)
231
- switch (f.action) {
225
+ A = !0;
226
+ if (A)
227
+ switch (h.action) {
232
228
  case "login":
233
229
  // TODO firebase
234
230
  // TODO oauth
@@ -238,7 +234,7 @@ const ct = v.createContext({}), V = v.createContext(
238
234
  case "submit":
239
235
  break;
240
236
  case "email":
241
- window.location.href = `mailto:${f.params.email}`;
237
+ window.location.href = `mailto:${h.params.email}`;
242
238
  break;
243
239
  case "goback":
244
240
  break;
@@ -252,27 +248,27 @@ const ct = v.createContext({}), V = v.createContext(
252
248
  case "none":
253
249
  break;
254
250
  case "openurl":
255
- window.open(f.params.url, "_blank");
251
+ window.open(h.params.url, "_blank");
256
252
  break;
257
253
  case "phone":
258
- window.location.href = `tel:${f.params.phone}`;
254
+ window.location.href = `tel:${h.params.phone}`;
259
255
  break;
260
256
  case "remote":
261
- const M = btoa(JSON.stringify(f.params?.data || {})), j = `${n}/devices/apps/${m}/node/${t}/trigger/${f.event}?params=${M}`, K = await Ot.post(j);
262
- K.data?.action && await B(K.data);
257
+ const O = btoa(JSON.stringify(h.params?.data || {})), j = `${n}/devices/apps/${m}/node/${t}/trigger/${h.event}?params=${O}`, K = await Ot.post(j);
258
+ K.data?.action && await W(K.data);
263
259
  break;
264
260
  case "set-access-token":
265
- R(f.params);
261
+ R(h.params);
266
262
  break;
267
263
  case "set-state":
268
264
  if (i && l)
269
265
  if (console.log("🔵 Input group change:", {
270
266
  groupName: i.groupName,
271
267
  elementName: l,
272
- hasOnAction: typeof s == "function"
273
- }), u(i.groupName, l), typeof s == "function")
268
+ hasOnAction: typeof a == "function"
269
+ }), u(i.groupName, l), typeof a == "function")
274
270
  try {
275
- await s({
271
+ await a({
276
272
  bravo: {
277
273
  cancel: () => {
278
274
  },
@@ -294,23 +290,23 @@ const ct = v.createContext({}), V = v.createContext(
294
290
  else
295
291
  console.warn("⚠️ No onAction callback provided");
296
292
  else {
297
- let E = I || f.params?.stateSetId || h.data?.stateSetId;
293
+ let E = v || h.params?.stateSetId || f.data?.stateSetId;
298
294
  if (!E) {
299
295
  console.error("❌ No stateSetId found in action or nodeData!", {
300
- actionParams: f.params,
301
- nodeDataStateSetId: h.data?.stateSetId,
302
- parentStatefulSetId: I
296
+ actionParams: h.params,
297
+ nodeDataStateSetId: f.data?.stateSetId,
298
+ parentStatefulSetId: v
303
299
  });
304
300
  break;
305
301
  }
306
- a(E, f.params.state);
302
+ s(E, h.params.state);
307
303
  }
308
304
  break;
309
305
  case "showalert":
310
- alert(f.params.message);
306
+ alert(h.params.message);
311
307
  break;
312
308
  default:
313
- console.log(f), alert(f.action);
309
+ console.log(h), alert(h.action);
314
310
  }
315
311
  };
316
312
  if (r.href)
@@ -319,13 +315,13 @@ const ct = v.createContext({}), V = v.createContext(
319
315
  "button",
320
316
  {
321
317
  type: "button",
322
- onClick: () => B({
318
+ onClick: () => W({
323
319
  action: "goto",
324
320
  params: { href: r.href },
325
321
  event: "tap"
326
322
  }),
327
323
  style: {
328
- ...x,
324
+ ...S,
329
325
  cursor: "pointer",
330
326
  background: "transparent",
331
327
  border: "none",
@@ -336,17 +332,17 @@ const ct = v.createContext({}), V = v.createContext(
336
332
  ),
337
333
  e
338
334
  ] });
339
- let z = h.actions && h.actions.length > 0 ? h.actions : r.actions || [];
340
- if (I && z.length > 0 && (z = z.map((f) => f.action === "set-state" ? (f.params?.stateSetId, {
341
- ...f,
335
+ let $ = f.actions && f.actions.length > 0 ? f.actions : r.actions || [];
336
+ if (v && $.length > 0 && ($ = $.map((h) => h.action === "set-state" ? (h.params?.stateSetId, {
337
+ ...h,
342
338
  params: {
343
- ...f.params,
344
- stateSetId: I
339
+ ...h.params,
340
+ stateSetId: v
345
341
  // Always use parent's id
346
342
  }
347
- }) : f)), z.length === 0 && (h.data?.stateSetId || I))
343
+ }) : h)), $.length === 0 && (f.data?.stateSetId || v))
348
344
  if (i && l)
349
- z = [
345
+ $ = [
350
346
  {
351
347
  action: "set-state",
352
348
  params: {
@@ -357,13 +353,13 @@ const ct = v.createContext({}), V = v.createContext(
357
353
  }
358
354
  ];
359
355
  else {
360
- const f = I || h.data.stateSetId;
361
- f ? z = [
356
+ const h = v || f.data.stateSetId;
357
+ h ? $ = [
362
358
  {
363
359
  action: "set-state",
364
360
  params: {
365
- state: k.getState().statefulSetVariants[f] === "active" ? "default" : "active",
366
- stateSetId: f
361
+ state: k.getState().statefulSetVariants[h] === "active" ? "default" : "active",
362
+ stateSetId: h
367
363
  // Use parent's id or button's stateSetId
368
364
  },
369
365
  event: "tap"
@@ -373,25 +369,25 @@ const ct = v.createContext({}), V = v.createContext(
373
369
  { id: t, name: r.name }
374
370
  );
375
371
  }
376
- if (z && z.length > 0) {
377
- const f = z[0];
378
- return f.event !== "tap" ? e : /* @__PURE__ */ it(ut, { children: [
372
+ if ($ && $.length > 0) {
373
+ const h = $[0];
374
+ return h.event !== "tap" ? e : /* @__PURE__ */ it(ut, { children: [
379
375
  e,
380
376
  /* @__PURE__ */ p(
381
377
  "div",
382
378
  {
383
- onClick: (S) => {
384
- S.stopPropagation(), B(f);
379
+ onClick: (A) => {
380
+ A.stopPropagation(), W(h);
385
381
  },
386
- onMouseDown: (S) => S.stopPropagation(),
387
- onMouseUp: (S) => S.stopPropagation(),
388
- style: { ...x, cursor: "pointer", pointerEvents: "auto" }
382
+ onMouseDown: (A) => A.stopPropagation(),
383
+ onMouseUp: (A) => A.stopPropagation(),
384
+ style: { ...S, cursor: "pointer", pointerEvents: "auto" }
389
385
  }
390
386
  )
391
387
  ] });
392
388
  }
393
389
  return e;
394
- }, ft = ({ id: t, name: r, nodeData: e }) => {
390
+ }, ht = ({ id: t, name: r, nodeData: e }) => {
395
391
  const o = L(e.style, {
396
392
  debug: !1
397
393
  });
@@ -412,11 +408,11 @@ const ct = v.createContext({}), V = v.createContext(
412
408
  if (!o.backgroundColor && !o.borderColor)
413
409
  return null;
414
410
  if (o.borderColor && !o.backgroundColor && (o.backgroundColor = "transparent"), o.borderColor && o.borderWidth) {
415
- const I = Math.max(o.borderWidth || 0, 1);
416
- (!o.width || typeof o.width == "number" && o.width === 0) && (o.width = I), (!o.height || typeof o.height == "number" && o.height === 0) && (o.height = I), o.boxSizing = "border-box";
411
+ const v = Math.max(o.borderWidth || 0, 1);
412
+ (!o.width || typeof o.width == "number" && o.width === 0) && (o.width = v), (!o.height || typeof o.height == "number" && o.height === 0) && (o.height = v), o.boxSizing = "border-box";
417
413
  }
418
- const i = Array.isArray(e.tags) && e.tags.includes("bravo:layer"), l = N(V)?.isFlex ?? !1, n = e.style?.positioning, m = n && typeof n.top == "number" && typeof n.left == "number" && typeof n.right == "number" && typeof n.bottom == "number" && n.top === 0 && n.left === 0 && n.right === 0 && n.bottom === 0, s = i && (l || m), y = r && r.toLowerCase().startsWith("clip");
419
- return s && (o.position = "absolute", o.top = 0, o.left = 0, o.right = 0, o.bottom = 0, o.zIndex = -1, o.width && typeof o.width == "string" && o.width.includes("%") && delete o.width, o.height && typeof o.height == "string" && o.height.includes("%") && delete o.height), y && (o.backgroundColor = "transparent"), /* @__PURE__ */ p(Y, { id: t, nodeData: e, children: /* @__PURE__ */ p("div", { "data-name": r, "data-type": "ColorComponent", style: o }) });
414
+ const i = Array.isArray(e.tags) && e.tags.includes("bravo:layer"), l = N(V)?.isFlex ?? !1, n = e.style?.positioning, m = n && typeof n.top == "number" && typeof n.left == "number" && typeof n.right == "number" && typeof n.bottom == "number" && n.top === 0 && n.left === 0 && n.right === 0 && n.bottom === 0, a = i && (l || m), y = r && r.toLowerCase().startsWith("clip");
415
+ return a && (o.position = "absolute", o.top = 0, o.left = 0, o.right = 0, o.bottom = 0, o.zIndex = -1, o.width && typeof o.width == "string" && o.width.includes("%") && delete o.width, o.height && typeof o.height == "string" && o.height.includes("%") && delete o.height), y && (o.backgroundColor = "transparent"), /* @__PURE__ */ p(Y, { id: t, nodeData: e, children: /* @__PURE__ */ p("div", { "data-name": r, "data-type": "ColorComponent", style: o }) });
420
416
  }, mt = ({
421
417
  id: t,
422
418
  name: r,
@@ -428,8 +424,8 @@ const ct = v.createContext({}), V = v.createContext(
428
424
  if (!n?.color) return null;
429
425
  const m = st(n.color);
430
426
  if (typeof n.position == "number") {
431
- const s = n.position * 100;
432
- return `${m} ${s}%`;
427
+ const a = n.position * 100;
428
+ return `${m} ${a}%`;
433
429
  }
434
430
  return m;
435
431
  }).filter(Boolean).join(", ") : "";
@@ -445,22 +441,22 @@ const ct = v.createContext({}), V = v.createContext(
445
441
  debug: !1
446
442
  }), l = N(V), n = k((u) => u.assetsById), m = e.style?.scaleMode || "fill";
447
443
  m === "fill" ? i.objectFit = "cover" : m === "fit" && (i.objectFit = "contain"), i.objectPosition = "center";
448
- let s = e.data?.imageUrl;
449
- !s && e.encoreData?.image && (s = e.encoreData.image.startsWith("//") ? `https:${e.encoreData.image}` : e.encoreData.image), s || (s = n[e.assetId]?.url);
450
- const y = e.style?.positioning, I = e.style?.aspectRatio, h = l.dimensions?.width || 0, a = l.dimensions?.height || 0;
451
- if (y && I && h > 0) {
444
+ let a = e.data?.imageUrl;
445
+ !a && e.encoreData?.image && (a = e.encoreData.image.startsWith("//") ? `https:${e.encoreData.image}` : e.encoreData.image), a || (a = n[e.assetId]?.url);
446
+ const y = e.style?.positioning, v = e.style?.aspectRatio, f = l.dimensions?.width || 0, s = l.dimensions?.height || 0;
447
+ if (y && v && f > 0) {
452
448
  const u = typeof y.left == "number" && typeof y.right == "number", R = typeof y.top == "number" && typeof y.bottom == "number";
453
449
  if (u) {
454
450
  const w = 100 - y.left - y.right;
455
451
  if (w > 0) {
456
- const x = w * h / 100;
457
- i.width = x, i.height = x / I, i.left = `${Math.max(0, y.left)}%`, i.top = `${Math.max(0, y.top)}%`, delete i.right, delete i.bottom;
452
+ const S = w * f / 100;
453
+ i.width = S, i.height = S / v, i.left = `${Math.max(0, y.left)}%`, i.top = `${Math.max(0, y.top)}%`, delete i.right, delete i.bottom;
458
454
  }
459
- } else if (R && a > 0) {
455
+ } else if (R && s > 0) {
460
456
  const w = 100 - y.top - y.bottom;
461
457
  if (w > 0) {
462
- const x = w * a / 100;
463
- i.height = x, i.width = x * I, i.left = `${Math.max(0, y.left)}%`, i.top = `${Math.max(0, y.top)}%`, delete i.right, delete i.bottom;
458
+ const S = w * s / 100;
459
+ i.height = S, i.width = S * v, i.left = `${Math.max(0, y.left)}%`, i.top = `${Math.max(0, y.top)}%`, delete i.right, delete i.bottom;
464
460
  }
465
461
  }
466
462
  }
@@ -471,7 +467,7 @@ const ct = v.createContext({}), V = v.createContext(
471
467
  "data-name": r,
472
468
  "data-type": "ImageComponent",
473
469
  style: i,
474
- src: s || n[e.assetId]?.url,
470
+ src: a || n[e.assetId]?.url,
475
471
  alt: r
476
472
  }
477
473
  ) });
@@ -559,9 +555,9 @@ const ct = v.createContext({}), V = v.createContext(
559
555
  name: r,
560
556
  nodeData: e
561
557
  }) => {
562
- const o = k((h) => h.setFormInputValue), { onAction: i } = v.useContext(ht), { patchedNodeData: l } = et({ id: t, nodeData: e }), n = L(l.style, { debug: !1 });
558
+ const o = k((f) => f.setFormInputValue), { onAction: i } = x.useContext(ft), { patchedNodeData: l } = et({ id: t, nodeData: e }), n = L(l.style, { debug: !1 });
563
559
  n.width = "100%", n.flex = "1", n.minWidth = "0", n.boxSizing = "border-box", n.borderColor = n.borderColor ?? "transparent";
564
- const m = l.data?.value, s = l.data?.options, y = v.useMemo(() => !s || !Array.isArray(s) ? [] : s.map((h) => typeof h == "string" ? { value: h, label: h } : h), [s]);
560
+ const m = l.data?.value, a = l.data?.options, y = x.useMemo(() => !a || !Array.isArray(a) ? [] : a.map((f) => typeof f == "string" ? { value: f, label: f } : f), [a]);
565
561
  return /* @__PURE__ */ it(
566
562
  "select",
567
563
  {
@@ -570,9 +566,9 @@ const ct = v.createContext({}), V = v.createContext(
570
566
  "data-type": "SelectInputComponent",
571
567
  value: m ?? "",
572
568
  style: n,
573
- onChange: async (h) => {
574
- const a = h.target.value;
575
- if (o(t, a), console.log(`Select changed: ${a}`), typeof i == "function")
569
+ onChange: async (f) => {
570
+ const s = f.target.value;
571
+ if (o(t, s), console.log(`Select changed: ${s}`), typeof i == "function")
576
572
  try {
577
573
  await i({
578
574
  bravo: {
@@ -581,7 +577,7 @@ const ct = v.createContext({}), V = v.createContext(
581
577
  action: {
582
578
  action: "select-change",
583
579
  nodeId: t,
584
- params: { value: a }
580
+ params: { value: s }
585
581
  },
586
582
  componentId: t
587
583
  }
@@ -591,7 +587,7 @@ const ct = v.createContext({}), V = v.createContext(
591
587
  },
592
588
  children: [
593
589
  y.length === 0 && /* @__PURE__ */ p("option", { value: "", disabled: !0, children: "Select an option..." }),
594
- y.map((h) => /* @__PURE__ */ p("option", { value: h.value, children: h.label }, h.value))
590
+ y.map((f) => /* @__PURE__ */ p("option", { value: f.value, children: f.label }, f.value))
595
591
  ]
596
592
  }
597
593
  );
@@ -631,8 +627,19 @@ const ct = v.createContext({}), V = v.createContext(
631
627
  }, At = ({ id: t, name: r, nodeData: e }) => {
632
628
  const o = L(e.style, {
633
629
  debug: !1
634
- }), i = k((l) => l.assetsById);
635
- return /* @__PURE__ */ p(Y, { id: t, nodeData: e, children: /* @__PURE__ */ p(
630
+ }), i = k((n) => n.assetsById), l = e.style?.positioning;
631
+ if (l) {
632
+ const n = typeof l.left == "number" && typeof l.right == "number", m = typeof l.top == "number" && typeof l.bottom == "number";
633
+ if (n) {
634
+ const a = 100 - l.left - l.right;
635
+ o.width = `${a}%`, o.left = `${l.left}%`, delete o.right;
636
+ }
637
+ if (m) {
638
+ const a = 100 - l.top - l.bottom;
639
+ o.height = `${a}%`, o.top = `${l.top}%`, delete o.bottom;
640
+ }
641
+ }
642
+ return o.objectFit || (o.objectFit = "fill"), /* @__PURE__ */ p(Y, { id: t, nodeData: e, children: /* @__PURE__ */ p(
636
643
  "img",
637
644
  {
638
645
  "data-id": t,
@@ -662,10 +669,10 @@ const ct = v.createContext({}), V = v.createContext(
662
669
  center: "center",
663
670
  "from-bottom": "flex-end"
664
671
  }[l.verticalPosition]);
665
- const s = i && (i.includes(`
672
+ const a = i && (i.includes(`
666
673
  `) || i.includes("\r"));
667
674
  let y;
668
- return s && m.flexDirection === "column" ? y = i.split(/\r?\n/).filter((h) => h.length > 0).map((h, a) => /* @__PURE__ */ p("div", { style: { lineHeight: "inherit" }, children: h }, a)) : y = i, /* @__PURE__ */ p(Y, { id: t, nodeData: e, children: /* @__PURE__ */ p(
675
+ return a && m.flexDirection === "column" ? y = i.split(/\r?\n/).filter((f) => f.length > 0).map((f, s) => /* @__PURE__ */ p("div", { style: { lineHeight: "inherit" }, children: f }, s)) : y = i, /* @__PURE__ */ p(Y, { id: t, nodeData: e, children: /* @__PURE__ */ p(
669
676
  "div",
670
677
  {
671
678
  "data-id": t,
@@ -683,29 +690,29 @@ const ct = v.createContext({}), V = v.createContext(
683
690
  }) => {
684
691
  const i = N(tt), { patchedNodeData: l } = et({ id: t, nodeData: e });
685
692
  e = l;
686
- const n = jt(e.tags), m = n ? k((w) => w.inputGroups[n.groupName]) : null, s = k((w) => w.statefulSetVariants[t]), y = L(e.style, {
693
+ const n = jt(e.tags), m = n ? k((w) => w.inputGroups[n.groupName]) : null, a = k((w) => w.statefulSetVariants[t]), y = L(e.style, {
687
694
  debug: !1
688
695
  });
689
- let I;
690
- n && m !== null ? I = m === r ? "active" : "default" : I = s || e.data.initialState || "default";
691
- const h = v.Children.toArray(o).find((w) => v.isValidElement(w) ? w.props?.nodeData?.data?.state === I : !1), a = v.isValidElement(h) ? v.cloneElement(h, {
696
+ let v;
697
+ n && m !== null ? v = m === r ? "active" : "default" : v = a || e.data.initialState || "default";
698
+ const f = x.Children.toArray(o).find((w) => x.isValidElement(w) ? w.props?.nodeData?.data?.state === v : !1), s = x.isValidElement(f) ? x.cloneElement(f, {
692
699
  _parentStatefulSetId: t,
693
700
  _parentInputGroupInfo: n,
694
701
  _parentName: r
695
702
  // Pass the name so we can identify which element is active
696
- }) : h, u = /* @__PURE__ */ p(
703
+ }) : f, u = /* @__PURE__ */ p(
697
704
  "div",
698
705
  {
699
706
  "data-id": t,
700
707
  "data-name": r,
701
708
  "data-type": "StatefulSetComponent",
702
709
  style: y,
703
- children: a
710
+ children: s
704
711
  }
705
712
  );
706
713
  if (e.type === "component:input-stateful-set")
707
714
  return u;
708
- const R = v.useContext(lt);
715
+ const R = x.useContext(lt);
709
716
  return /* @__PURE__ */ p(
710
717
  tt.Provider,
711
718
  {
@@ -730,7 +737,7 @@ const ct = v.createContext({}), V = v.createContext(
730
737
  }) => {
731
738
  const m = L(e.style, {
732
739
  debug: !1
733
- }), s = {
740
+ }), a = {
734
741
  ...m,
735
742
  position: m.position || "relative"
736
743
  };
@@ -740,7 +747,7 @@ const ct = v.createContext({}), V = v.createContext(
740
747
  "data-id": t,
741
748
  "data-name": r,
742
749
  "data-type": "StatefulCompoundComponent",
743
- style: s,
750
+ style: a,
744
751
  children: /* @__PURE__ */ p(
745
752
  Y,
746
753
  {
@@ -788,40 +795,40 @@ const ct = v.createContext({}), V = v.createContext(
788
795
  `[DEBUG] ContainerComponent ${t} (Hero) FULL nodeData:`,
789
796
  JSON.stringify(e, null, 2)
790
797
  );
791
- const n = N(tt), { patchedNodeData: m, list: s, arrayData: y } = et({
798
+ const n = N(tt), { patchedNodeData: m, list: a, arrayData: y } = et({
792
799
  id: t,
793
800
  nodeData: e
794
801
  });
795
802
  e = m;
796
- const { dimensions: I, ref: h } = rt(), a = L(e.style, {
803
+ const { dimensions: v, ref: f } = rt(), s = L(e.style, {
797
804
  debug: !1
798
- }), u = !!e.style.layout?.mode, R = e.style.layout?.mode === "HORIZONTAL" ? "row" : "column", w = a.width !== void 0, x = a.height !== void 0, B = N(V), z = B?.isFlex ?? !1, f = B?.flexDirection, S = z && f === "row", O = !z && e.style.positioning, M = e.style.layout?.layoutSizingHorizontal === "FIXED" || e.style.layout?.layoutSizingVertical === "FIXED", j = e.style.layout?.layoutSizingHorizontal === "HUG" || e.style.layout?.layoutSizingVertical === "HUG";
799
- if (!w && !S && !(O && (M || j)) && (a.width = "100%"), !x) {
800
- const W = !z && e.style.positioning, Z = e.style.layout?.layoutSizingVertical === "FILL";
805
+ }), u = !!e.style.layout?.mode, R = e.style.layout?.mode === "HORIZONTAL" ? "row" : "column", w = s.width !== void 0, S = s.height !== void 0, W = N(V), $ = W?.isFlex ?? !1, h = W?.flexDirection, A = $ && h === "row", G = !$ && e.style.positioning, O = e.style.layout?.layoutSizingHorizontal === "FIXED" || e.style.layout?.layoutSizingVertical === "FIXED", j = e.style.layout?.layoutSizingHorizontal === "HUG" || e.style.layout?.layoutSizingVertical === "HUG";
806
+ if (!w && !A && !(G && (O || j)) && (s.width = "100%"), !S) {
807
+ const B = !$ && e.style.positioning, Z = e.style.layout?.layoutSizingVertical === "FILL";
801
808
  if (!(e.style.layout?.layoutSizingVertical === "HUG")) {
802
- if (!u) if (W && Z && e.style.positioning?.top !== void 0) {
803
- const D = 100 - e.style.positioning.top;
804
- a.height = `${D}%`;
809
+ if (!u) if (B && Z && e.style.positioning?.top !== void 0) {
810
+ const Q = 100 - e.style.positioning.top;
811
+ s.height = `${Q}%`;
805
812
  } else
806
- a.height = "100%";
813
+ s.height = "100%";
807
814
  }
808
815
  }
809
- const K = e.style.layout?.layoutSizingHorizontal || e.style.layout?.layoutSizingVertical, H = e.style.positioning && !u && (K || !0) ? { ...a, position: "absolute" } : a.position === "absolute" ? a : { ...a, position: a.position || "relative" }, U = (W) => typeof W == "number" ? W : typeof W == "string" && W.endsWith("px") && parseFloat(W) || 0, G = U(a.paddingLeft), g = U(a.paddingRight), q = U(a.paddingTop), X = U(a.paddingBottom), P = M && typeof a.width == "number" && typeof a.height == "number" ? {
810
- width: a.width - G - g,
811
- height: a.height - q - X
816
+ const K = e.style.layout?.layoutSizingHorizontal || e.style.layout?.layoutSizingVertical, H = e.style.positioning && !u && (K || !0) ? { ...s, position: "absolute" } : s.position === "absolute" ? s : { ...s, position: s.position || "relative" }, U = (B) => typeof B == "number" ? B : typeof B == "string" && B.endsWith("px") && parseFloat(B) || 0, M = U(s.paddingLeft), g = U(s.paddingRight), q = U(s.paddingTop), X = U(s.paddingBottom), P = O && typeof s.width == "number" && typeof s.height == "number" ? {
817
+ width: s.width - M - g,
818
+ height: s.height - q - X
812
819
  } : {
813
- width: I.width - G - g,
814
- height: I.height - q - X
820
+ width: v.width - M - g,
821
+ height: v.height - q - X
815
822
  };
816
- if (i != null && s) {
817
- const W = s[i];
818
- if (W !== void 0) {
819
- const Z = typeof W == "object" && W !== null ? {
820
- nodeData: W,
823
+ if (i != null && a) {
824
+ const B = a[i];
825
+ if (B !== void 0) {
826
+ const Z = typeof B == "object" && B !== null ? {
827
+ nodeData: B,
821
828
  arrayDataById: n?.arrayDataById,
822
829
  textOverridesById: n?.textOverridesById,
823
830
  rootData: n?.rootData
824
- } : { nodeData: W };
831
+ } : { nodeData: B };
825
832
  return /* @__PURE__ */ p(tt.Provider, { value: Z, children: /* @__PURE__ */ p(
826
833
  V.Provider,
827
834
  {
@@ -840,10 +847,10 @@ const ct = v.createContext({}), V = v.createContext(
840
847
  ) });
841
848
  }
842
849
  }
843
- if (s) {
844
- const W = y || s;
845
- return Ht(() => W.map((J, nt) => {
846
- const D = typeof J == "object" && J !== null ? {
850
+ if (a) {
851
+ const B = y || a;
852
+ return Ht(() => B.map((J, nt) => {
853
+ const Q = typeof J == "object" && J !== null ? {
847
854
  nodeData: J,
848
855
  arrayDataById: n?.arrayDataById,
849
856
  textOverridesById: n?.textOverridesById,
@@ -852,7 +859,7 @@ const ct = v.createContext({}), V = v.createContext(
852
859
  return /* @__PURE__ */ p(
853
860
  tt.Provider,
854
861
  {
855
- value: D,
862
+ value: Q,
856
863
  children: /* @__PURE__ */ p(
857
864
  V.Provider,
858
865
  {
@@ -872,16 +879,16 @@ const ct = v.createContext({}), V = v.createContext(
872
879
  },
873
880
  `${t}:${nt}`
874
881
  );
875
- }), [W, t]);
882
+ }), [B, t]);
876
883
  }
877
884
  let F = e.actions || [];
878
885
  !Array.isArray(F) && typeof F == "object" && F !== null && (F = Object.entries(F).map(
879
- ([W, Z]) => ({
880
- event: W,
886
+ ([B, Z]) => ({
887
+ event: B,
881
888
  ...typeof Z == "object" && Z !== null ? Z : {}
882
889
  })
883
890
  ));
884
- const $ = Array.isArray(F) && F.length > 0;
891
+ const z = Array.isArray(F) && F.length > 0;
885
892
  return /* @__PURE__ */ p(
886
893
  V.Provider,
887
894
  {
@@ -892,21 +899,21 @@ const ct = v.createContext({}), V = v.createContext(
892
899
  "data-id": t,
893
900
  "data-name": r,
894
901
  "data-type": "ContainerComponent",
895
- ref: h,
902
+ ref: f,
896
903
  style: H,
897
- children: $ ? /* @__PURE__ */ p(Y, { id: t, nodeData: e, children: o }) : o
904
+ children: z ? /* @__PURE__ */ p(Y, { id: t, nodeData: e, children: o }) : o
898
905
  }
899
906
  )
900
907
  }
901
908
  );
902
- }, Pt = pt, Wt = ({ id: t, name: r, nodeData: e, children: o }) => {
909
+ }, Pt = pt, Bt = ({ id: t, name: r, nodeData: e, children: o }) => {
903
910
  const { dimensions: i, ref: l } = rt(), n = L(e.style, {
904
911
  debug: !1
905
- }), m = !!e.style.layout?.mode, s = e.style.layout?.mode === "HORIZONTAL" ? "row" : "column", y = n.position ? n : { ...n, position: "relative" };
912
+ }), m = !!e.style.layout?.mode, a = e.style.layout?.mode === "HORIZONTAL" ? "row" : "column", y = n.position ? n : { ...n, position: "relative" };
906
913
  return /* @__PURE__ */ p(
907
914
  V.Provider,
908
915
  {
909
- value: { dimensions: i, isFlex: m, flexDirection: s },
916
+ value: { dimensions: i, isFlex: m, flexDirection: a },
910
917
  children: /* @__PURE__ */ p(
911
918
  "div",
912
919
  {
@@ -932,7 +939,7 @@ const ct = v.createContext({}), V = v.createContext(
932
939
  children: o
933
940
  }
934
941
  );
935
- }, Bt = ({ id: t, name: r, nodeData: e, children: o }) => /* @__PURE__ */ p(
942
+ }, Lt = ({ id: t, name: r, nodeData: e, children: o }) => /* @__PURE__ */ p(
936
943
  "div",
937
944
  {
938
945
  "data-id": t,
@@ -941,7 +948,7 @@ const ct = v.createContext({}), V = v.createContext(
941
948
  style: L(e.style),
942
949
  children: o
943
950
  }
944
- ), Lt = ({ id: t, name: r, nodeData: e, children: o }) => {
951
+ ), Wt = ({ id: t, name: r, nodeData: e, children: o }) => {
945
952
  const i = L(e.style, {
946
953
  debug: !1
947
954
  });
@@ -960,191 +967,191 @@ const ct = v.createContext({}), V = v.createContext(
960
967
  `[DEBUG] SliderComponent ${t} FULL nodeData:`,
961
968
  JSON.stringify(e, null, 2)
962
969
  );
963
- const { dimensions: i, ref: l } = rt(), n = v.useRef(null), m = v.useRef(null), s = v.useRef(!1), y = v.useRef(null), I = N(ct), h = N(Mt), { onAction: a } = N(ht), [u, R] = v.useState({
970
+ const { dimensions: i, ref: l } = rt(), n = x.useRef(null), m = x.useRef(null), a = x.useRef(!1), y = x.useRef(null), v = N(ct), f = N(Mt), { onAction: s } = N(ft), [u, R] = x.useState({
964
971
  currentIndex: void 0,
965
972
  onIndexChange: void 0
966
- }), [w, x] = v.useState(0), B = v.useRef(null), { patchedNodeData: z } = et({ id: t, nodeData: e });
967
- e = z;
968
- const f = e.data?.params || {}, S = f.infinite === !0, O = f.automatic === !0;
973
+ }), [w, S] = x.useState(0), W = x.useRef(null), { patchedNodeData: $ } = et({ id: t, nodeData: e });
974
+ e = $;
975
+ const h = e.data?.params || {}, A = h.infinite === !0, G = h.automatic === !0;
969
976
  let j = Array.isArray(e.tags) && e.tags.some((c) => c.includes("container:slider:vertical")) || e.name && e.name.includes("container:slider:vertical");
970
- if (!j && f.animation === "default") {
977
+ if (!j && h.animation === "default") {
971
978
  const c = e.style?.width, d = e.style?.height;
972
979
  typeof c == "number" && typeof d == "number" && d > c && (j = !0);
973
980
  }
974
- const K = j ? "vertical" : f.animation === "default" ? "horizontal" : f.animation || "horizontal", E = L(e.style, {
981
+ const K = j ? "vertical" : h.animation === "default" ? "horizontal" : h.animation || "horizontal", E = L(e.style, {
975
982
  debug: !1
976
983
  }), H = E.width !== void 0, U = E.height !== void 0;
977
984
  H || (E.width = "100%"), U || (E.height = "100%"), E.position || (E.position = "relative");
978
- const G = N(tt), g = v.useMemo(() => {
985
+ const M = N(tt), g = x.useMemo(() => {
979
986
  const c = [];
980
- return v.Children.forEach(o, (d) => {
987
+ return x.Children.forEach(o, (d) => {
981
988
  if (d == null) return;
982
- const A = d?.props || {}, C = A.nodeData || {};
983
- if (Array.isArray(C?.tags) && (C.tags.includes("encore:data:array") || C.tags.includes("bravo:data:array")) && A.id && G) {
984
- const T = G?.arrayDataById && G.arrayDataById[A.id] && Array.isArray(G.arrayDataById[A.id]) ? G.arrayDataById[A.id] : null;
985
- T && T.length > 0 ? T.forEach((Q, ot) => {
989
+ const I = d?.props || {}, C = I.nodeData || {};
990
+ if (Array.isArray(C?.tags) && (C.tags.includes("encore:data:array") || C.tags.includes("bravo:data:array")) && I.id && M) {
991
+ const T = M?.arrayDataById && M.arrayDataById[I.id] && Array.isArray(M.arrayDataById[I.id]) ? M.arrayDataById[I.id] : null;
992
+ T && T.length > 0 ? T.forEach((D, ot) => {
986
993
  c.push(
987
- v.cloneElement(d, {
988
- key: `${A.id}:${ot}`,
994
+ x.cloneElement(d, {
995
+ key: `${I.id}:${ot}`,
989
996
  // ContainerComponent will use this to know which item to render
990
997
  _arrayItemIndex: ot,
991
- _arrayItemData: Q
998
+ _arrayItemData: D
992
999
  })
993
1000
  );
994
1001
  }) : c.push(d);
995
1002
  } else
996
1003
  c.push(d);
997
1004
  }), c;
998
- }, [o, t, G]), q = v.useMemo(() => {
999
- if (!S || g.length === 0)
1005
+ }, [o, t, M]), q = x.useMemo(() => {
1006
+ if (!A || g.length === 0)
1000
1007
  return g;
1001
1008
  const c = g[0], d = g[g.length - 1];
1002
1009
  return [
1003
- v.cloneElement(d, {
1010
+ x.cloneElement(d, {
1004
1011
  key: `clone-last-${d.key || d.props.id}`
1005
1012
  }),
1006
1013
  ...g,
1007
- v.cloneElement(c, {
1014
+ x.cloneElement(c, {
1008
1015
  key: `clone-first-${c.key || c.props.id}`
1009
1016
  })
1010
1017
  ];
1011
- }, [g, S]), X = v.useMemo(() => {
1018
+ }, [g, A]), X = x.useMemo(() => {
1012
1019
  if (g.length === 0) return { width: 0, height: 0 };
1013
- const d = g[0]?.props?.nodeData?.style, A = I.scaleFactor || 1;
1020
+ const d = g[0]?.props?.nodeData?.style, I = v.scaleFactor || 1;
1014
1021
  let C = 0, b = 0;
1015
- return d?.layout?.layoutSizingHorizontal === "FIXED" && d?.layout?.size?.x ? C = d.layout.size.x * A : C = i.width || 0, d?.layout?.layoutSizingVertical === "FIXED" && d?.layout?.size?.y ? b = d.layout.size.y * A : b = i.height || 0, { width: C, height: b };
1016
- }, [g, i.width, i.height, I.scaleFactor]), P = X.width, F = X.height, $ = K === "vertical", _ = v.useCallback(() => {
1022
+ return d?.layout?.layoutSizingHorizontal === "FIXED" && d?.layout?.size?.x ? C = d.layout.size.x * I : C = i.width || 0, d?.layout?.layoutSizingVertical === "FIXED" && d?.layout?.size?.y ? b = d.layout.size.y * I : b = i.height || 0, { width: C, height: b };
1023
+ }, [g, i.width, i.height, v.scaleFactor]), P = X.width, F = X.height, z = K === "vertical", _ = x.useCallback(() => {
1017
1024
  if (!n.current || g.length === 0)
1018
1025
  return 0;
1019
1026
  const c = n.current;
1020
- if ($) {
1027
+ if (z) {
1021
1028
  if (F === 0) return 0;
1022
1029
  const d = c.scrollTop;
1023
- if (S) {
1030
+ if (A) {
1024
1031
  const C = d - F;
1025
1032
  let b = Math.round(C / F);
1026
1033
  return b < 0 && (b = 0), b >= g.length && (b = g.length - 1), b;
1027
1034
  } else {
1028
- const A = Math.round(d / F);
1029
- return A < 0 ? 0 : A >= g.length ? g.length - 1 : A;
1035
+ const I = Math.round(d / F);
1036
+ return I < 0 ? 0 : I >= g.length ? g.length - 1 : I;
1030
1037
  }
1031
1038
  } else {
1032
1039
  if (P === 0) return 0;
1033
1040
  const d = c.scrollLeft;
1034
- if (S) {
1041
+ if (A) {
1035
1042
  const C = d - P;
1036
1043
  let b = Math.round(C / P);
1037
1044
  return b < 0 && (b = 0), b >= g.length && (b = g.length - 1), b;
1038
1045
  } else {
1039
- const A = Math.round(d / P);
1040
- return A < 0 ? 0 : A >= g.length ? g.length - 1 : A;
1046
+ const I = Math.round(d / P);
1047
+ return I < 0 ? 0 : I >= g.length ? g.length - 1 : I;
1041
1048
  }
1042
1049
  }
1043
- }, [S, g.length, P, F, $]), W = v.useCallback(
1050
+ }, [A, g.length, P, F, z]), B = x.useCallback(
1044
1051
  (c, d = !0) => {
1045
1052
  if (!n.current || g.length === 0) return;
1046
- const A = n.current;
1047
- if ($) {
1053
+ const I = n.current;
1054
+ if (z) {
1048
1055
  let C;
1049
- S ? C = F + c * F : C = c * F, A.scrollTo({
1056
+ A ? C = F + c * F : C = c * F, I.scrollTo({
1050
1057
  top: C,
1051
1058
  behavior: d ? "smooth" : "auto"
1052
1059
  });
1053
1060
  } else {
1054
1061
  let C;
1055
- S ? C = P + c * P : C = c * P, A.scrollTo({
1062
+ A ? C = P + c * P : C = c * P, I.scrollTo({
1056
1063
  left: C,
1057
1064
  behavior: d ? "smooth" : "auto"
1058
1065
  });
1059
1066
  }
1060
1067
  },
1061
- [P, F, S, g.length, $]
1062
- ), Z = v.useCallback(() => {
1063
- if (!S || !n.current || g.length === 0) return;
1068
+ [P, F, A, g.length, z]
1069
+ ), Z = x.useCallback(() => {
1070
+ if (!A || !n.current || g.length === 0) return;
1064
1071
  const c = n.current, d = 1;
1065
- if ($) {
1072
+ if (z) {
1066
1073
  if (F === 0) return;
1067
- const A = c.scrollTop, C = F, b = C, T = b + g.length * C;
1068
- A >= T - d ? c.scrollTop = b : A <= d && (c.scrollTop = T - C);
1074
+ const I = c.scrollTop, C = F, b = C, T = b + g.length * C;
1075
+ I >= T - d ? c.scrollTop = b : I <= d && (c.scrollTop = T - C);
1069
1076
  } else {
1070
1077
  if (P === 0) return;
1071
- const A = c.scrollLeft, C = P, b = C, T = b + g.length * C;
1072
- A >= T - d ? c.scrollLeft = b : A <= d && (c.scrollLeft = T - C);
1078
+ const I = c.scrollLeft, C = P, b = C, T = b + g.length * C;
1079
+ I >= T - d ? c.scrollLeft = b : I <= d && (c.scrollLeft = T - C);
1073
1080
  }
1074
- }, [S, g.length, P, F, $]);
1075
- v.useEffect(() => {
1076
- if (!O || g.length <= 1 || P === 0) return;
1081
+ }, [A, g.length, P, F, z]);
1082
+ x.useEffect(() => {
1083
+ if (!G || g.length <= 1 || P === 0) return;
1077
1084
  const c = () => {
1078
- if (s.current || !n.current) return;
1085
+ if (a.current || !n.current) return;
1079
1086
  const d = n.current;
1080
- if ($) {
1087
+ if (z) {
1081
1088
  if (F === 0) return;
1082
- const A = d.scrollTop, C = F;
1089
+ const I = d.scrollTop, C = F;
1083
1090
  let b;
1084
- if (S) {
1085
- const ot = A - C;
1091
+ if (A) {
1092
+ const ot = I - C;
1086
1093
  b = Math.round(ot / C), b < 0 && (b = 0), b >= g.length && (b = g.length - 1);
1087
1094
  } else
1088
- b = Math.round(A / C);
1095
+ b = Math.round(I / C);
1089
1096
  let T = b + 1;
1090
- if (S) {
1097
+ if (A) {
1091
1098
  T >= g.length && (T = 0);
1092
- const Q = C;
1099
+ const D = C;
1093
1100
  d.scrollTo({
1094
- top: Q + T * C,
1101
+ top: D + T * C,
1095
1102
  behavior: "smooth"
1096
1103
  });
1097
1104
  } else
1098
- T >= g.length && (T = 0), W(T);
1105
+ T >= g.length && (T = 0), B(T);
1099
1106
  } else {
1100
1107
  if (P === 0) return;
1101
- const A = d.scrollLeft, C = P;
1108
+ const I = d.scrollLeft, C = P;
1102
1109
  let b;
1103
- if (S) {
1104
- const ot = A - C;
1110
+ if (A) {
1111
+ const ot = I - C;
1105
1112
  b = Math.round(ot / C), b < 0 && (b = 0), b >= g.length && (b = g.length - 1);
1106
1113
  } else
1107
- b = Math.round(A / C);
1114
+ b = Math.round(I / C);
1108
1115
  let T = b + 1;
1109
- if (S) {
1116
+ if (A) {
1110
1117
  T >= g.length && (T = 0);
1111
- const Q = C;
1118
+ const D = C;
1112
1119
  d.scrollTo({
1113
- left: Q + T * C,
1120
+ left: D + T * C,
1114
1121
  behavior: "smooth"
1115
1122
  });
1116
1123
  } else
1117
- T >= g.length && (T = 0), W(T);
1124
+ T >= g.length && (T = 0), B(T);
1118
1125
  }
1119
1126
  };
1120
1127
  return m.current = setInterval(c, 4e3), () => {
1121
1128
  m.current && (clearInterval(m.current), m.current = null);
1122
1129
  };
1123
1130
  }, [
1124
- O,
1131
+ G,
1125
1132
  g.length,
1126
- S,
1133
+ A,
1127
1134
  P,
1128
1135
  F,
1129
- $,
1130
- W
1136
+ z,
1137
+ B
1131
1138
  ]);
1132
- const J = v.useCallback(() => {
1133
- s.current = !0, y.current && clearTimeout(y.current), y.current = setTimeout(() => {
1134
- s.current = !1;
1139
+ const J = x.useCallback(() => {
1140
+ a.current = !0, y.current && clearTimeout(y.current), y.current = setTimeout(() => {
1141
+ a.current = !1;
1135
1142
  }, 3e3);
1136
- }, []), nt = v.useRef(u);
1137
- v.useEffect(() => {
1143
+ }, []), nt = x.useRef(u);
1144
+ x.useEffect(() => {
1138
1145
  nt.current = u;
1139
1146
  }, [u]);
1140
- const D = v.useCallback(
1147
+ const Q = x.useCallback(
1141
1148
  (c) => {
1142
- if (B.current === c) return;
1143
- B.current = c;
1149
+ if (W.current === c) return;
1150
+ W.current = c;
1144
1151
  const d = nt.current;
1145
- if (d.currentIndex === void 0 && x(c), d.onIndexChange && d.onIndexChange(c), typeof a == "function")
1152
+ if (d.currentIndex === void 0 && S(c), d.onIndexChange && d.onIndexChange(c), typeof s == "function")
1146
1153
  try {
1147
- a({
1154
+ s({
1148
1155
  bravo: {
1149
1156
  cancel: () => {
1150
1157
  },
@@ -1158,46 +1165,46 @@ const ct = v.createContext({}), V = v.createContext(
1158
1165
  } catch {
1159
1166
  }
1160
1167
  },
1161
- [a, t]
1168
+ [s, t]
1162
1169
  // Depend on onAction to ensure we call the latest version
1163
1170
  );
1164
- v.useEffect(() => {
1171
+ x.useEffect(() => {
1165
1172
  const c = n.current;
1166
1173
  if (!c) return;
1167
1174
  let d = null;
1168
- const A = () => {
1169
- J(), S ? (d !== null && cancelAnimationFrame(d), d = requestAnimationFrame(() => {
1175
+ const I = () => {
1176
+ J(), A ? (d !== null && cancelAnimationFrame(d), d = requestAnimationFrame(() => {
1170
1177
  Z();
1171
1178
  const T = _();
1172
- D(T);
1179
+ Q(T);
1173
1180
  })) : (d !== null && cancelAnimationFrame(d), d = requestAnimationFrame(() => {
1174
1181
  const T = _();
1175
- D(T);
1182
+ Q(T);
1176
1183
  }));
1177
1184
  }, C = () => J(), b = () => J();
1178
- return c.addEventListener("scroll", A, { passive: !0 }), c.addEventListener("touchstart", C, {
1185
+ return c.addEventListener("scroll", I, { passive: !0 }), c.addEventListener("touchstart", C, {
1179
1186
  passive: !0
1180
1187
  }), c.addEventListener("mousedown", b), () => {
1181
- c.removeEventListener("scroll", A), c.removeEventListener("touchstart", C), c.removeEventListener("mousedown", b), y.current && clearTimeout(y.current), d !== null && cancelAnimationFrame(d);
1188
+ c.removeEventListener("scroll", I), c.removeEventListener("touchstart", C), c.removeEventListener("mousedown", b), y.current && clearTimeout(y.current), d !== null && cancelAnimationFrame(d);
1182
1189
  };
1183
1190
  }, [
1184
- S,
1191
+ A,
1185
1192
  J,
1186
1193
  Z,
1187
1194
  _,
1188
- D
1189
- ]), v.useEffect(() => {
1190
- if (h) {
1191
- const c = h.getControlProps(t);
1195
+ Q
1196
+ ]), x.useEffect(() => {
1197
+ if (f) {
1198
+ const c = f.getControlProps(t);
1192
1199
  c && c !== u && R(c);
1193
1200
  }
1194
- }, [t, h, u]), v.useEffect(() => {
1201
+ }, [t, f, u]), x.useEffect(() => {
1195
1202
  if (u.currentIndex !== void 0 && n.current && g.length > 0 && P > 0) {
1196
1203
  const c = Math.max(
1197
1204
  0,
1198
1205
  Math.min(u.currentIndex, g.length - 1)
1199
1206
  ), d = _();
1200
- c !== d && W(c, !0);
1207
+ c !== d && B(c, !0);
1201
1208
  }
1202
1209
  }, [
1203
1210
  u.currentIndex,
@@ -1205,41 +1212,41 @@ const ct = v.createContext({}), V = v.createContext(
1205
1212
  g.length,
1206
1213
  P,
1207
1214
  F,
1208
- $,
1209
- W,
1215
+ z,
1216
+ B,
1210
1217
  _
1211
- ]), v.useEffect(() => {
1212
- if (S && n.current && g.length > 0 && g.length > 0 && ($ ? F > 0 : P > 0)) {
1213
- const c = $ ? F : P;
1218
+ ]), x.useEffect(() => {
1219
+ if (A && n.current && g.length > 0 && g.length > 0 && (z ? F > 0 : P > 0)) {
1220
+ const c = z ? F : P;
1214
1221
  setTimeout(() => {
1215
- n.current && ($ ? n.current.scrollTop = c : n.current.scrollLeft = c);
1222
+ n.current && (z ? n.current.scrollTop = c : n.current.scrollLeft = c);
1216
1223
  }, 0);
1217
1224
  }
1218
- }, [S, g.length, P, F, $]), v.useEffect(() => {
1219
- if (!h) return;
1220
- const { registerContainer: c, unregisterContainer: d } = h;
1225
+ }, [A, g.length, P, F, z]), x.useEffect(() => {
1226
+ if (!f) return;
1227
+ const { registerContainer: c, unregisterContainer: d } = f;
1221
1228
  return () => {
1222
1229
  };
1223
1230
  }, [
1224
1231
  t,
1225
- h?.registerContainer,
1226
- h?.unregisterContainer,
1232
+ f?.registerContainer,
1233
+ f?.unregisterContainer,
1227
1234
  // controlProps, // REMOVED to break infinite loop
1228
- W,
1235
+ B,
1229
1236
  _
1230
1237
  ]);
1231
- const kt = {
1238
+ const $t = {
1232
1239
  display: "flex",
1233
- flexDirection: $ ? "column" : "row",
1234
- overflowX: $ ? "hidden" : "auto",
1235
- overflowY: $ ? "auto" : "hidden",
1236
- scrollSnapType: $ ? "y mandatory" : "x mandatory",
1240
+ flexDirection: z ? "column" : "row",
1241
+ overflowX: z ? "hidden" : "auto",
1242
+ overflowY: z ? "auto" : "hidden",
1243
+ scrollSnapType: z ? "y mandatory" : "x mandatory",
1237
1244
  scrollBehavior: "smooth",
1238
1245
  width: "100%",
1239
1246
  height: "100%",
1240
1247
  WebkitOverflowScrolling: "touch"
1241
1248
  // Smooth scrolling on iOS
1242
- }, $t = {
1249
+ }, zt = {
1243
1250
  flexShrink: 0,
1244
1251
  scrollSnapAlign: "start",
1245
1252
  width: X.width > 0 ? X.width : void 0,
@@ -1254,7 +1261,7 @@ const ct = v.createContext({}), V = v.createContext(
1254
1261
  "data-type": "SliderComponent",
1255
1262
  ref: l,
1256
1263
  style: E,
1257
- children: /* @__PURE__ */ p("div", { ref: n, style: kt, children: q.map((c, d) => /* @__PURE__ */ p(
1264
+ children: /* @__PURE__ */ p("div", { ref: n, style: $t, children: q.map((c, d) => /* @__PURE__ */ p(
1258
1265
  V.Provider,
1259
1266
  {
1260
1267
  value: {
@@ -1264,32 +1271,32 @@ const ct = v.createContext({}), V = v.createContext(
1264
1271
  },
1265
1272
  isFlex: !1
1266
1273
  },
1267
- children: /* @__PURE__ */ p("div", { style: $t, children: c })
1274
+ children: /* @__PURE__ */ p("div", { style: zt, children: c })
1268
1275
  },
1269
1276
  c.key || `slide-${d}`
1270
1277
  )) })
1271
1278
  }
1272
1279
  );
1273
- }, zt = (t, r) => {
1280
+ }, kt = (t, r) => {
1274
1281
  const e = Array.isArray(t) ? t : [t];
1275
1282
  for (const o of e)
1276
1283
  if (!(!o || !o.props)) {
1277
1284
  if (o.props.id === r)
1278
1285
  return o;
1279
1286
  if (o.props.children) {
1280
- const i = zt(o.props.children, r);
1287
+ const i = kt(o.props.children, r);
1281
1288
  if (i) return i;
1282
1289
  }
1283
1290
  }
1284
1291
  return null;
1285
1292
  }, Rt = ({ id: t, name: r, nodeData: e, children: o }) => {
1286
- const { dimensions: i, ref: l } = rt(), { componentId: n } = N(lt), m = N(V), s = e.style.originalSize?.[0] || 1, y = e.style.originalSize?.[1] || 1, I = m?.dimensions?.width, h = m?.dimensions?.height, a = window.innerWidth, u = window.innerHeight, R = I && I > 0 && I < a * 0.8;
1287
- let w, x;
1288
- i.width > 0 && i.height > 0 ? (w = i.width, x = i.height) : R && I && h || I && h && I > 0 && h > 0 ? (w = I, x = h) : (w = a, x = u);
1289
- const z = { scaleFactor: Math.min(w / s, x / y) || 1 };
1293
+ const { dimensions: i, ref: l } = rt(), { componentId: n } = N(lt), m = N(V), a = e.style.originalSize?.[0] || 1, y = e.style.originalSize?.[1] || 1, v = m?.dimensions?.width, f = m?.dimensions?.height, s = window.innerWidth, u = window.innerHeight, R = v && v > 0 && v < s * 0.8;
1294
+ let w, S;
1295
+ i.width > 0 && i.height > 0 ? (w = i.width, S = i.height) : R && v && f || v && f && v > 0 && f > 0 ? (w = v, S = f) : (w = s, S = u);
1296
+ const $ = { scaleFactor: Math.min(w / a, S / y) || 1 };
1290
1297
  if (n) {
1291
- const E = zt(o, n);
1292
- return E ? /* @__PURE__ */ p(ct.Provider, { value: z, children: /* @__PURE__ */ p(
1298
+ const E = kt(o, n);
1299
+ return E ? /* @__PURE__ */ p(ct.Provider, { value: $, children: /* @__PURE__ */ p(
1293
1300
  V.Provider,
1294
1301
  {
1295
1302
  value: {
@@ -1302,18 +1309,18 @@ const ct = v.createContext({}), V = v.createContext(
1302
1309
  }
1303
1310
  ) }) : (console.warn(`Child with id "${n}" not found`), null);
1304
1311
  }
1305
- const f = Array.isArray(o) ? o : [o], { scrollableChildren: S, nonScrollableChildren: O } = f.reduce(
1312
+ const h = Array.isArray(o) ? o : [o], { scrollableChildren: A, nonScrollableChildren: G } = h.reduce(
1306
1313
  (E, H) => {
1307
- const G = H.props.nodeData.type === "container:top-bar" ? "nonScrollableChildren" : "scrollableChildren";
1308
- return E[G].push(H), E;
1314
+ const M = H.props.nodeData.type === "container:top-bar" ? "nonScrollableChildren" : "scrollableChildren";
1315
+ return E[M].push(H), E;
1309
1316
  },
1310
1317
  {
1311
1318
  scrollableChildren: [],
1312
1319
  nonScrollableChildren: []
1313
1320
  }
1314
1321
  );
1315
- let M = e.style?.layout?.mode;
1316
- if (!M && t === "01KASW494V02Y8P5JVWV5XK62X" && (console.log("🔧 PATCHING missing layout for page", t), M = "HORIZONTAL"), !M && o) {
1322
+ let O = e.style?.layout?.mode;
1323
+ if (!O && t === "01KASW494V02Y8P5JVWV5XK62X" && (console.log("🔧 PATCHING missing layout for page", t), O = "HORIZONTAL"), !O && o) {
1317
1324
  const E = Array.isArray(o) ? o : [o];
1318
1325
  let H = 0, U = 0;
1319
1326
  E.forEach((g) => {
@@ -1321,12 +1328,12 @@ const ct = v.createContext({}), V = v.createContext(
1321
1328
  q && (H += q, q < 99 && U++);
1322
1329
  }), U > 0 && H >= 99 && (console.log(
1323
1330
  `[PATCH] Detected HORIZONTAL WRAP layout for page ${t} (Partial width children: ${U}, Total width: ${H})`
1324
- ), M = "HORIZONTAL", e.style || (e.style = {}), e.style.layout || (e.style.layout = {}), e.style.layout.mode = "HORIZONTAL", e.style.layout.flexWrap = "wrap", e.style.layout.primaryAxisAlignItems = "flex-start", e.style.layout.counterAxisAlignItems = "flex-start");
1331
+ ), O = "HORIZONTAL", e.style || (e.style = {}), e.style.layout || (e.style.layout = {}), e.style.layout.mode = "HORIZONTAL", e.style.layout.flexWrap = "wrap", e.style.layout.primaryAxisAlignItems = "flex-start", e.style.layout.counterAxisAlignItems = "flex-start");
1325
1332
  }
1326
- const j = M === "HORIZONTAL" ? "row" : "column", K = O.some(
1333
+ const j = O === "HORIZONTAL" ? "row" : "column", K = G.some(
1327
1334
  (E) => E?.props?.nodeData?.type !== "container:background"
1328
1335
  );
1329
- return /* @__PURE__ */ p(ct.Provider, { value: z, children: /* @__PURE__ */ it(
1336
+ return /* @__PURE__ */ p(ct.Provider, { value: $, children: /* @__PURE__ */ it(
1330
1337
  "div",
1331
1338
  {
1332
1339
  style: {
@@ -1345,7 +1352,7 @@ const ct = v.createContext({}), V = v.createContext(
1345
1352
  },
1346
1353
  ref: l,
1347
1354
  children: [
1348
- O.filter(
1355
+ G.filter(
1349
1356
  (E) => E?.props?.nodeData?.type === "container:background"
1350
1357
  ).map((E, H) => /* @__PURE__ */ p(
1351
1358
  V.Provider,
@@ -1360,7 +1367,7 @@ const ct = v.createContext({}), V = v.createContext(
1360
1367
  },
1361
1368
  `bg-${H}`
1362
1369
  )),
1363
- K && O.filter(
1370
+ K && G.filter(
1364
1371
  (E) => E?.props?.nodeData?.type !== "container:background"
1365
1372
  ).map((E, H) => /* @__PURE__ */ p(
1366
1373
  V.Provider,
@@ -1397,14 +1404,14 @@ const ct = v.createContext({}), V = v.createContext(
1397
1404
  debug: !1
1398
1405
  })
1399
1406
  },
1400
- children: S
1407
+ children: A
1401
1408
  }
1402
1409
  ) })
1403
1410
  ]
1404
1411
  }
1405
1412
  ) });
1406
- }, Qt = {
1407
- WebViewComponent: ft,
1413
+ }, Dt = {
1414
+ WebViewComponent: ht,
1408
1415
  ColorComponent: gt,
1409
1416
  GradientComponent: mt,
1410
1417
  ImageComponent: yt,
@@ -1422,18 +1429,18 @@ const ct = v.createContext({}), V = v.createContext(
1422
1429
  BackgroundContainerComponent: Tt,
1423
1430
  ContainerComponent: pt,
1424
1431
  CompoundComponent: Pt,
1425
- TopBarContainerComponent: Wt,
1432
+ TopBarContainerComponent: Bt,
1426
1433
  DefaultLayerComponent: Ut,
1427
- TabsMenuComponent: Bt,
1428
- MenuSideComponent: Lt,
1434
+ TabsMenuComponent: Lt,
1435
+ MenuSideComponent: Wt,
1429
1436
  SliderComponent: at,
1430
1437
  PageComponent: Rt,
1431
1438
  // Type string mappings for dynamically loaded components
1432
- "menu:side": Lt,
1439
+ "menu:side": Wt,
1433
1440
  "page:default": Rt,
1434
1441
  "container:background": Tt,
1435
1442
  "container:default": pt,
1436
- "container:top-bar": Wt,
1443
+ "container:top-bar": Bt,
1437
1444
  "container:slider": at,
1438
1445
  "component:text": Et,
1439
1446
  "component:color": gt,
@@ -1445,7 +1452,7 @@ const ct = v.createContext({}), V = v.createContext(
1445
1452
  "component:stateful-set": dt,
1446
1453
  "component:stateful-compound": Ft,
1447
1454
  "component:slider": at,
1448
- "component:webview": ft,
1455
+ "component:webview": ht,
1449
1456
  "component:lottie": wt,
1450
1457
  "component:email-input": bt,
1451
1458
  "component:text-input": It,
@@ -1453,10 +1460,10 @@ const ct = v.createContext({}), V = v.createContext(
1453
1460
  "component:select-input": vt,
1454
1461
  "component:image-input": St,
1455
1462
  "component:hidden-input": Ct,
1456
- "component:tabs-menu": Bt,
1463
+ "component:tabs-menu": Lt,
1457
1464
  ContainerSliderComponent: at
1458
1465
  };
1459
1466
  export {
1460
- Qt as default
1467
+ Dt as default
1461
1468
  };
1462
1469
  //# sourceMappingURL=components.js.map