@agg-market/ui 0.0.1

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 (192) hide show
  1. package/dist/badge.d.mts +26 -0
  2. package/dist/badge.d.ts +26 -0
  3. package/dist/badge.js +70 -0
  4. package/dist/badge.mjs +9 -0
  5. package/dist/button.d.mts +20 -0
  6. package/dist/button.d.ts +20 -0
  7. package/dist/button.js +197 -0
  8. package/dist/button.mjs +8 -0
  9. package/dist/card.d.mts +8 -0
  10. package/dist/card.d.ts +8 -0
  11. package/dist/card.js +84 -0
  12. package/dist/card.mjs +7 -0
  13. package/dist/chart.d.mts +40 -0
  14. package/dist/chart.d.ts +40 -0
  15. package/dist/chart.js +418 -0
  16. package/dist/chart.mjs +8 -0
  17. package/dist/chunk-2PGUPOXY.mjs +285 -0
  18. package/dist/chunk-3DV3D2LH.mjs +155 -0
  19. package/dist/chunk-44UEI6KD.mjs +280 -0
  20. package/dist/chunk-4ADCXJE6.mjs +297 -0
  21. package/dist/chunk-4GSXVVSA.mjs +64 -0
  22. package/dist/chunk-4NK2FNAG.mjs +581 -0
  23. package/dist/chunk-4XWCYUV3.mjs +355 -0
  24. package/dist/chunk-5MN6ZNFA.mjs +355 -0
  25. package/dist/chunk-6RRBINER.mjs +50 -0
  26. package/dist/chunk-765JPQDG.mjs +280 -0
  27. package/dist/chunk-7CD7GIZC.mjs +850 -0
  28. package/dist/chunk-7XRKA6XF.mjs +462 -0
  29. package/dist/chunk-AOFP74IB.mjs +850 -0
  30. package/dist/chunk-BNDFQPHF.mjs +9 -0
  31. package/dist/chunk-C4OI72SM.mjs +14 -0
  32. package/dist/chunk-CB2MLGCJ.mjs +279 -0
  33. package/dist/chunk-CKTAVEW2.mjs +212 -0
  34. package/dist/chunk-DA6KZWSK.mjs +807 -0
  35. package/dist/chunk-DBD5GHHD.mjs +147 -0
  36. package/dist/chunk-DQ6XFBYJ.mjs +37 -0
  37. package/dist/chunk-FACIYUNK.mjs +217 -0
  38. package/dist/chunk-FUJQIYOF.mjs +37 -0
  39. package/dist/chunk-FZTAHWOS.mjs +82 -0
  40. package/dist/chunk-GC3QIIH7.mjs +112 -0
  41. package/dist/chunk-GPBLZGJ2.mjs +136 -0
  42. package/dist/chunk-H4LELROL.mjs +262 -0
  43. package/dist/chunk-H7P6DIX4.mjs +262 -0
  44. package/dist/chunk-H7YEBGYY.mjs +42 -0
  45. package/dist/chunk-HJOBAMDU.mjs +142 -0
  46. package/dist/chunk-IJG5I642.mjs +462 -0
  47. package/dist/chunk-IY2AA3OL.mjs +50 -0
  48. package/dist/chunk-J6L5BLKX.mjs +136 -0
  49. package/dist/chunk-J7OETCZ7.mjs +147 -0
  50. package/dist/chunk-JLLMIPIX.mjs +42 -0
  51. package/dist/chunk-KBRLFTJT.mjs +741 -0
  52. package/dist/chunk-KDBYDMYV.mjs +64 -0
  53. package/dist/chunk-L6E6Q4C4.mjs +217 -0
  54. package/dist/chunk-LY6474C4.mjs +297 -0
  55. package/dist/chunk-M23S2DVV.mjs +581 -0
  56. package/dist/chunk-MG243DSX.mjs +44 -0
  57. package/dist/chunk-MRHSN2B7.mjs +279 -0
  58. package/dist/chunk-MXWRCVRJ.mjs +285 -0
  59. package/dist/chunk-NFYS557L.mjs +481 -0
  60. package/dist/chunk-NNSY462N.mjs +212 -0
  61. package/dist/chunk-OUOIDPGX.mjs +25 -0
  62. package/dist/chunk-P5PFQX75.mjs +31 -0
  63. package/dist/chunk-P674XRDY.mjs +481 -0
  64. package/dist/chunk-PAQ542ER.mjs +170 -0
  65. package/dist/chunk-QE46DVJG.mjs +323 -0
  66. package/dist/chunk-QXFDXXDB.mjs +792 -0
  67. package/dist/chunk-R3DRVI4J.mjs +741 -0
  68. package/dist/chunk-TTOR7JCT.mjs +155 -0
  69. package/dist/chunk-V5WIYMKS.mjs +25 -0
  70. package/dist/chunk-VAZE267Q.mjs +82 -0
  71. package/dist/chunk-VLIJ7PQK.mjs +792 -0
  72. package/dist/chunk-VYNVBJK6.mjs +44 -0
  73. package/dist/chunk-WIWJ6DIE.mjs +323 -0
  74. package/dist/chunk-XDAEEJYR.mjs +142 -0
  75. package/dist/chunk-YUIZZ6XE.mjs +31 -0
  76. package/dist/connect-button.d.mts +40 -0
  77. package/dist/connect-button.d.ts +40 -0
  78. package/dist/connect-button.js +1815 -0
  79. package/dist/connect-button.mjs +14 -0
  80. package/dist/event-list-item-details.d.mts +11 -0
  81. package/dist/event-list-item-details.d.ts +11 -0
  82. package/dist/event-list-item-details.js +2140 -0
  83. package/dist/event-list-item-details.mjs +19 -0
  84. package/dist/event-list-item-details.types-CMbXOrT-.d.ts +53 -0
  85. package/dist/event-list-item-details.types-CxWr4Qn1.d.ts +53 -0
  86. package/dist/event-list-item-details.types-DRi99PZq.d.mts +53 -0
  87. package/dist/event-list-item-details.types-DekJKeMD.d.mts +53 -0
  88. package/dist/event-list-item.d.mts +10 -0
  89. package/dist/event-list-item.d.ts +10 -0
  90. package/dist/event-list-item.js +2097 -0
  91. package/dist/event-list-item.mjs +17 -0
  92. package/dist/event-list-item.types-B1490EQm.d.mts +46 -0
  93. package/dist/event-list-item.types-B1490EQm.d.ts +46 -0
  94. package/dist/event-list-item.types-Y6IeJ4e4.d.mts +46 -0
  95. package/dist/event-list-item.types-Y6IeJ4e4.d.ts +46 -0
  96. package/dist/event-list.d.mts +9 -0
  97. package/dist/event-list.d.ts +9 -0
  98. package/dist/event-list.js +3151 -0
  99. package/dist/event-list.mjs +20 -0
  100. package/dist/event-list.types-Bpp6Vn-t.d.mts +13 -0
  101. package/dist/event-list.types-Bpp6Vn-t.d.ts +13 -0
  102. package/dist/event-list.types-CkAAUqwW.d.mts +13 -0
  103. package/dist/event-list.types-CkAAUqwW.d.ts +13 -0
  104. package/dist/event-market-page.d.mts +52 -0
  105. package/dist/event-market-page.d.ts +52 -0
  106. package/dist/event-market-page.js +5369 -0
  107. package/dist/event-market-page.mjs +29 -0
  108. package/dist/hello-world.d.mts +8 -0
  109. package/dist/hello-world.d.ts +8 -0
  110. package/dist/hello-world.js +80 -0
  111. package/dist/hello-world.mjs +8 -0
  112. package/dist/home-page.d.mts +51 -0
  113. package/dist/home-page.d.ts +51 -0
  114. package/dist/home-page.js +3415 -0
  115. package/dist/home-page.mjs +21 -0
  116. package/dist/icon.d.mts +123 -0
  117. package/dist/icon.d.ts +123 -0
  118. package/dist/icon.js +922 -0
  119. package/dist/icon.mjs +57 -0
  120. package/dist/index.d.mts +70 -0
  121. package/dist/index.d.ts +70 -0
  122. package/dist/index.js +8184 -0
  123. package/dist/index.mjs +307 -0
  124. package/dist/loading-icon.d.mts +14 -0
  125. package/dist/loading-icon.d.ts +14 -0
  126. package/dist/loading-icon.js +115 -0
  127. package/dist/loading-icon.mjs +8 -0
  128. package/dist/market-details.d.mts +73 -0
  129. package/dist/market-details.d.ts +73 -0
  130. package/dist/market-details.js +3923 -0
  131. package/dist/market-details.mjs +22 -0
  132. package/dist/modal.d.mts +66 -0
  133. package/dist/modal.d.ts +66 -0
  134. package/dist/modal.js +317 -0
  135. package/dist/modal.mjs +9 -0
  136. package/dist/number-value.d.mts +14 -0
  137. package/dist/number-value.d.ts +14 -0
  138. package/dist/number-value.js +67 -0
  139. package/dist/number-value.mjs +7 -0
  140. package/dist/onboarding-modal.d.mts +88 -0
  141. package/dist/onboarding-modal.d.ts +88 -0
  142. package/dist/onboarding-modal.js +2242 -0
  143. package/dist/onboarding-modal.mjs +24 -0
  144. package/dist/place-order.d.mts +20 -0
  145. package/dist/place-order.d.ts +20 -0
  146. package/dist/place-order.js +2916 -0
  147. package/dist/place-order.mjs +18 -0
  148. package/dist/registry-CVn79H3I.d.mts +106 -0
  149. package/dist/registry-CVn79H3I.d.ts +106 -0
  150. package/dist/search.d.mts +69 -0
  151. package/dist/search.d.ts +69 -0
  152. package/dist/search.js +1465 -0
  153. package/dist/search.mjs +12 -0
  154. package/dist/select.d.mts +19 -0
  155. package/dist/select.d.ts +19 -0
  156. package/dist/select.js +920 -0
  157. package/dist/select.mjs +11 -0
  158. package/dist/settlement.d.mts +16 -0
  159. package/dist/settlement.d.ts +16 -0
  160. package/dist/settlement.js +1769 -0
  161. package/dist/settlement.mjs +15 -0
  162. package/dist/skeleton.d.mts +22 -0
  163. package/dist/skeleton.d.ts +22 -0
  164. package/dist/skeleton.js +523 -0
  165. package/dist/skeleton.mjs +10 -0
  166. package/dist/styles.css +2 -0
  167. package/dist/switch-button.d.mts +21 -0
  168. package/dist/switch-button.d.ts +21 -0
  169. package/dist/switch-button.js +184 -0
  170. package/dist/switch-button.mjs +7 -0
  171. package/dist/tabs.d.mts +27 -0
  172. package/dist/tabs.d.ts +27 -0
  173. package/dist/tabs.js +1708 -0
  174. package/dist/tabs.mjs +12 -0
  175. package/dist/tailwind.css +2 -0
  176. package/dist/types-8VUuQVZq.d.mts +387 -0
  177. package/dist/types-8VUuQVZq.d.ts +387 -0
  178. package/dist/types-CayJ8tWA.d.mts +3 -0
  179. package/dist/types-CayJ8tWA.d.ts +3 -0
  180. package/dist/typography.d.mts +16 -0
  181. package/dist/typography.d.ts +16 -0
  182. package/dist/typography.js +62 -0
  183. package/dist/typography.mjs +7 -0
  184. package/dist/venue-logo.d.mts +12 -0
  185. package/dist/venue-logo.d.ts +12 -0
  186. package/dist/venue-logo.js +350 -0
  187. package/dist/venue-logo.mjs +10 -0
  188. package/dist/venue-logo.types-4hmCg3D3.d.ts +17 -0
  189. package/dist/venue-logo.types-B1iPJgiD.d.mts +17 -0
  190. package/dist/venue-logo.types-Bg8eXtGp.d.ts +17 -0
  191. package/dist/venue-logo.types-QNDwiQ77.d.mts +17 -0
  192. package/package.json +195 -0
@@ -0,0 +1,2140 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
+ var __getProtoOf = Object.getPrototypeOf;
10
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
+ var __spreadValues = (a, b) => {
14
+ for (var prop in b || (b = {}))
15
+ if (__hasOwnProp.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ if (__getOwnPropSymbols)
18
+ for (var prop of __getOwnPropSymbols(b)) {
19
+ if (__propIsEnum.call(b, prop))
20
+ __defNormalProp(a, prop, b[prop]);
21
+ }
22
+ return a;
23
+ };
24
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
+ var __objRest = (source, exclude) => {
26
+ var target = {};
27
+ for (var prop in source)
28
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
29
+ target[prop] = source[prop];
30
+ if (source != null && __getOwnPropSymbols)
31
+ for (var prop of __getOwnPropSymbols(source)) {
32
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
33
+ target[prop] = source[prop];
34
+ }
35
+ return target;
36
+ };
37
+ var __export = (target, all) => {
38
+ for (var name in all)
39
+ __defProp(target, name, { get: all[name], enumerable: true });
40
+ };
41
+ var __copyProps = (to, from, except, desc) => {
42
+ if (from && typeof from === "object" || typeof from === "function") {
43
+ for (let key of __getOwnPropNames(from))
44
+ if (!__hasOwnProp.call(to, key) && key !== except)
45
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
46
+ }
47
+ return to;
48
+ };
49
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
50
+ // If the importer is in node compatibility mode or this is not an ESM
51
+ // file that has been converted to a CommonJS file using a Babel-
52
+ // compatible transform (i.e. "__esModule" has not been set), then set
53
+ // "default" to the CommonJS "module.exports" for node compatibility.
54
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
55
+ mod
56
+ ));
57
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
58
+
59
+ // src/events/item-details/index.tsx
60
+ var item_details_exports = {};
61
+ __export(item_details_exports, {
62
+ EventListItemDetails: () => EventListItemDetails
63
+ });
64
+ module.exports = __toCommonJS(item_details_exports);
65
+ var import_react3 = require("react");
66
+ var import_hooks12 = require("@agg-market/hooks");
67
+
68
+ // src/shared/utils.ts
69
+ var cn = (...values) => values.filter(Boolean).join(" ");
70
+ var getMotionClassName = (enabled, ...values) => {
71
+ if (!enabled)
72
+ return void 0;
73
+ return cn(...values);
74
+ };
75
+ var toDate = (value) => {
76
+ if (!value)
77
+ return null;
78
+ if (value instanceof Date)
79
+ return value;
80
+ const parsed = new Date(value);
81
+ if (Number.isNaN(parsed.getTime()))
82
+ return null;
83
+ return parsed;
84
+ };
85
+
86
+ // src/primitives/badge/badge.constants.ts
87
+ var badgeSizeClasses = {
88
+ xxs: cn("h-4 px-1.5 gap-0.5", "text-agg-xs leading-agg-3"),
89
+ xs: cn("h-5 px-2 gap-1", "text-agg-xs leading-agg-4"),
90
+ s: cn("h-6 px-2.5 gap-1", "text-agg-sm leading-agg-5"),
91
+ m: cn("h-7 px-3 gap-1.5", "text-agg-sm leading-agg-5"),
92
+ l: cn("h-8 px-3.5 gap-1.5", "text-agg-base leading-agg-6"),
93
+ xl: cn("h-9 px-4 gap-2", "text-agg-lg leading-agg-7"),
94
+ xxl: cn("h-10 px-5 gap-2", "text-agg-xl leading-agg-7")
95
+ };
96
+ var baseBadgeClasses = cn(
97
+ "inline-flex items-center justify-center rounded-agg-full font-agg-sans",
98
+ "bg-agg-secondary-hover text-agg-foreground whitespace-nowrap font-agg-normal"
99
+ );
100
+
101
+ // src/primitives/badge/index.tsx
102
+ var import_jsx_runtime = require("react/jsx-runtime");
103
+ function Badge({ text, prefix, suffix, size = "m", classNames }) {
104
+ const resolvedText = `${text}`;
105
+ const resolvedAriaLabel = resolvedText.length > 0 ? resolvedText : void 0;
106
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
107
+ "span",
108
+ {
109
+ "aria-label": resolvedAriaLabel,
110
+ className: cn(baseBadgeClasses, badgeSizeClasses[size], classNames == null ? void 0 : classNames.root),
111
+ children: [
112
+ prefix ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: classNames == null ? void 0 : classNames.prefix, children: prefix }) : null,
113
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: cn("truncate", classNames == null ? void 0 : classNames.text), children: text }),
114
+ suffix ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: classNames == null ? void 0 : classNames.suffix, children: suffix }) : null
115
+ ]
116
+ }
117
+ );
118
+ }
119
+ Badge.displayName = "Badge";
120
+
121
+ // src/primitives/button/index.tsx
122
+ var import_hooks = require("@agg-market/hooks");
123
+
124
+ // src/primitives/icon/icon.constants.ts
125
+ var iconSizeClasses = {
126
+ xxs: "h-2 w-2",
127
+ xs: "h-3 w-3",
128
+ s: "h-4 w-4",
129
+ m: "h-6 w-6",
130
+ l: "h-8 w-8",
131
+ xl: "h-10 w-10",
132
+ xxl: "h-12 w-12"
133
+ };
134
+
135
+ // src/primitives/button/button.constants.ts
136
+ var sizeClasses = {
137
+ xxs: cn("h-6 px-2.5 gap-1", "text-agg-xs leading-agg-4"),
138
+ xs: cn("h-7 px-3 gap-1", "text-agg-xs leading-agg-4"),
139
+ s: cn("h-8 px-4 gap-1.5", "text-agg-sm leading-agg-5"),
140
+ m: cn("h-9 px-5 gap-1.5", "text-agg-sm leading-agg-5"),
141
+ l: cn("h-10 px-6 gap-2", "text-agg-base leading-agg-6"),
142
+ xl: cn("h-11 px-7 gap-2", "text-agg-base leading-agg-6"),
143
+ xxl: cn("h-12 px-8 gap-2", "text-agg-base leading-agg-6")
144
+ };
145
+ var iconSizeClasses2 = {
146
+ xxs: iconSizeClasses.xs,
147
+ xs: iconSizeClasses.xs,
148
+ s: iconSizeClasses.s,
149
+ m: iconSizeClasses.s,
150
+ l: iconSizeClasses.s,
151
+ xl: iconSizeClasses.s,
152
+ xxl: iconSizeClasses.s
153
+ };
154
+ var iconSlotClasses = {
155
+ xxs: "[&_svg]:h-3 [&_svg]:w-3",
156
+ xs: "[&_svg]:h-3 [&_svg]:w-3",
157
+ s: "[&_svg]:h-4 [&_svg]:w-4",
158
+ m: "[&_svg]:h-4 [&_svg]:w-4",
159
+ l: "[&_svg]:h-4 [&_svg]:w-4",
160
+ xl: "[&_svg]:h-4 [&_svg]:w-4",
161
+ xxl: "[&_svg]:h-4 [&_svg]:w-4"
162
+ };
163
+ var variantClasses = {
164
+ primary: cn(
165
+ "bg-agg-primary text-agg-on-primary",
166
+ "hover:bg-agg-primary-hover",
167
+ "disabled:bg-agg-separator disabled:text-agg-on-primary",
168
+ "focus-visible:ring-agg-primary-hover"
169
+ ),
170
+ secondary: cn(
171
+ "border border-agg-separator bg-agg-secondary text-agg-foreground",
172
+ "hover:bg-agg-secondary-hover",
173
+ "disabled:bg-agg-secondary disabled:text-agg-muted-foreground disabled:border-agg-separator",
174
+ "focus-visible:ring-agg-separator"
175
+ ),
176
+ tertiary: cn(
177
+ "bg-transparent text-agg-foreground",
178
+ "hover:bg-agg-secondary-hover",
179
+ "disabled:bg-transparent disabled:text-agg-muted-foreground",
180
+ "focus-visible:ring-agg-separator"
181
+ )
182
+ };
183
+ var baseButtonClasses = cn(
184
+ "cursor-pointer disabled:cursor-not-allowed",
185
+ "inline-flex items-center justify-center rounded-agg-full font-agg-sans font-agg-bold text-center",
186
+ "whitespace-nowrap",
187
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-agg-secondary"
188
+ );
189
+
190
+ // src/primitives/button/index.tsx
191
+ var import_jsx_runtime2 = require("react/jsx-runtime");
192
+ var Button = (_a) => {
193
+ var _b = _a, {
194
+ children,
195
+ variant = "primary",
196
+ size = "m",
197
+ isLoading = false,
198
+ disabled,
199
+ prefix,
200
+ suffix,
201
+ type = "button",
202
+ className,
203
+ "aria-label": ariaLabel
204
+ } = _b, other = __objRest(_b, [
205
+ "children",
206
+ "variant",
207
+ "size",
208
+ "isLoading",
209
+ "disabled",
210
+ "prefix",
211
+ "suffix",
212
+ "type",
213
+ "className",
214
+ "aria-label"
215
+ ]);
216
+ const { enableAnimations } = (0, import_hooks.useSdkUiConfig)();
217
+ const isDisabled = disabled || isLoading;
218
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
219
+ "button",
220
+ __spreadProps(__spreadValues({
221
+ type,
222
+ className: cn(
223
+ baseButtonClasses,
224
+ getMotionClassName(enableAnimations, "transition-colors"),
225
+ sizeClasses[size],
226
+ iconSlotClasses[size],
227
+ variantClasses[variant],
228
+ className
229
+ ),
230
+ disabled: isDisabled,
231
+ "aria-busy": isLoading,
232
+ "aria-label": ariaLabel
233
+ }, other), {
234
+ children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
235
+ "span",
236
+ {
237
+ className: cn(
238
+ "inline-block rounded-agg-full border-2 border-current border-r-transparent",
239
+ getMotionClassName(enableAnimations, "animate-spin"),
240
+ iconSizeClasses2[size]
241
+ ),
242
+ "aria-hidden": "true"
243
+ }
244
+ ) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
245
+ prefix != null ? prefix : null,
246
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children }),
247
+ suffix != null ? suffix : null
248
+ ] })
249
+ })
250
+ );
251
+ };
252
+ Button.displayName = "Button";
253
+
254
+ // src/primitives/chart/index.tsx
255
+ var import_dayjs = __toESM(require("dayjs"));
256
+ var import_hooks3 = require("@agg-market/hooks");
257
+ var import_react2 = require("react");
258
+ var import_liveline = require("liveline");
259
+
260
+ // src/primitives/switch-button/index.tsx
261
+ var import_react = require("react");
262
+ var import_hooks2 = require("@agg-market/hooks");
263
+ var import_jsx_runtime3 = require("react/jsx-runtime");
264
+ var resolveActiveIndex = (options, value) => {
265
+ const activeIndex = options.findIndex((option) => option.value === value);
266
+ if (activeIndex >= 0)
267
+ return activeIndex;
268
+ return 0;
269
+ };
270
+ var resolveNextEnabledIndex = (options, currentIndex, direction) => {
271
+ if (options.length <= 1)
272
+ return currentIndex;
273
+ const step = direction === "next" ? 1 : -1;
274
+ for (let offset = 1; offset <= options.length; offset += 1) {
275
+ const candidateIndex = (currentIndex + step * offset + options.length) % options.length;
276
+ const candidate = options[candidateIndex];
277
+ if (candidate && !candidate.disabled) {
278
+ return candidateIndex;
279
+ }
280
+ }
281
+ return currentIndex;
282
+ };
283
+ var SwitchButton = ({
284
+ options,
285
+ value,
286
+ onValueChange,
287
+ ariaLabel,
288
+ className
289
+ }) => {
290
+ const { enableAnimations } = (0, import_hooks2.useSdkUiConfig)();
291
+ const activeIndex = (0, import_react.useMemo)(() => {
292
+ return resolveActiveIndex(options, value);
293
+ }, [options, value]);
294
+ const [isAnimating, setIsAnimating] = (0, import_react.useState)(false);
295
+ const [lastAnimatedIndex, setLastAnimatedIndex] = (0, import_react.useState)(activeIndex);
296
+ (0, import_react.useEffect)(() => {
297
+ if (lastAnimatedIndex === activeIndex) {
298
+ return;
299
+ }
300
+ setLastAnimatedIndex(activeIndex);
301
+ if (!enableAnimations) {
302
+ setIsAnimating(false);
303
+ return;
304
+ }
305
+ setIsAnimating(true);
306
+ const timeoutId = window.setTimeout(() => {
307
+ setIsAnimating(false);
308
+ }, 350);
309
+ return () => {
310
+ window.clearTimeout(timeoutId);
311
+ };
312
+ }, [activeIndex, enableAnimations, lastAnimatedIndex]);
313
+ if (options.length === 0) {
314
+ return null;
315
+ }
316
+ const handleKeyDown = (event, optionIndex) => {
317
+ if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") {
318
+ return;
319
+ }
320
+ event.preventDefault();
321
+ const nextOptionIndex = resolveNextEnabledIndex(
322
+ options,
323
+ optionIndex,
324
+ event.key === "ArrowRight" ? "next" : "previous"
325
+ );
326
+ const nextOption = options[nextOptionIndex];
327
+ if (!nextOption || nextOption.disabled) {
328
+ return;
329
+ }
330
+ onValueChange(nextOption.value);
331
+ };
332
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
333
+ "div",
334
+ {
335
+ className: cn(
336
+ "inline-flex min-w-0 rounded-agg-full bg-agg-secondary-hover font-agg-sans",
337
+ className
338
+ ),
339
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
340
+ "div",
341
+ {
342
+ className: "relative grid min-w-0 flex-1 items-center",
343
+ style: {
344
+ gridTemplateColumns: `repeat(${options.length}, minmax(0, 1fr))`
345
+ },
346
+ role: "tablist",
347
+ "aria-label": ariaLabel,
348
+ children: [
349
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
350
+ "span",
351
+ {
352
+ className: cn(
353
+ "pointer-events-none absolute inset-y-0 left-0 rounded-agg-full border-2 border-agg-primary bg-agg-secondary",
354
+ getMotionClassName(
355
+ enableAnimations,
356
+ "transition-transform duration-[450ms] ease-[cubic-bezier(0.77,0,0.175,1)]"
357
+ )
358
+ ),
359
+ style: {
360
+ width: `${100 / options.length}%`,
361
+ transform: `translateX(${activeIndex * 100}%) scaleX(${isAnimating ? 1.08 : 1})`
362
+ },
363
+ "aria-hidden": "true"
364
+ }
365
+ ),
366
+ options.map((option, optionIndex) => {
367
+ var _a;
368
+ const isActive = optionIndex === activeIndex;
369
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
370
+ "button",
371
+ {
372
+ type: "button",
373
+ role: "tab",
374
+ "aria-selected": isActive,
375
+ "aria-label": (_a = option.ariaLabel) != null ? _a : void 0,
376
+ tabIndex: isActive ? 0 : -1,
377
+ disabled: option.disabled,
378
+ className: cn(
379
+ "relative z-10 min-w-0 rounded-agg-full px-5 py-1.5 font-agg-sans text-agg-base leading-agg-6 text-agg-foreground",
380
+ getMotionClassName(enableAnimations, "transition-colors duration-300"),
381
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-2 focus-visible:ring-offset-agg-secondary-hover",
382
+ "disabled:cursor-not-allowed disabled:text-agg-muted-foreground",
383
+ isActive ? "font-agg-bold" : "font-agg-normal"
384
+ ),
385
+ onClick: () => {
386
+ if (option.disabled || isActive) {
387
+ return;
388
+ }
389
+ onValueChange(option.value);
390
+ },
391
+ onKeyDown: (event) => {
392
+ handleKeyDown(event, optionIndex);
393
+ },
394
+ children: option.label
395
+ },
396
+ option.value
397
+ );
398
+ })
399
+ ]
400
+ }
401
+ )
402
+ }
403
+ );
404
+ };
405
+ SwitchButton.displayName = "SwitchButton";
406
+
407
+ // src/primitives/chart/index.tsx
408
+ var import_jsx_runtime4 = require("react/jsx-runtime");
409
+ var normalizeSeries = (series) => {
410
+ return series.map((seriesItem) => {
411
+ const pointsByTime = /* @__PURE__ */ new Map();
412
+ seriesItem.points.forEach((point) => {
413
+ if (!Number.isFinite(point.time) || !Number.isFinite(point.value)) {
414
+ return;
415
+ }
416
+ pointsByTime.set(Math.floor(point.time), point.value);
417
+ });
418
+ const sortedPoints = [...pointsByTime.entries()].sort((left, right) => left[0] - right[0]).map(([time, value]) => ({
419
+ time,
420
+ value
421
+ }));
422
+ return __spreadProps(__spreadValues({}, seriesItem), {
423
+ points: sortedPoints
424
+ });
425
+ }).filter((seriesItem) => seriesItem.points.length > 0);
426
+ };
427
+ var defaultValueFormatter = (value) => {
428
+ return `${Math.round(value)}%`;
429
+ };
430
+ var defaultTimeFormatter = (timestamp) => {
431
+ return import_dayjs.default.unix(timestamp).format("MMM D");
432
+ };
433
+ var toLivelinePoints = (points) => {
434
+ return points.map((point) => ({
435
+ time: point.time,
436
+ value: point.value
437
+ }));
438
+ };
439
+ var resolveWindowSeconds = (normalizedSeries) => {
440
+ const timestamps = normalizedSeries.flatMap(
441
+ (seriesItem) => seriesItem.points.map((point) => point.time)
442
+ );
443
+ if (timestamps.length <= 1)
444
+ return 30;
445
+ const minTimestamp = Math.min(...timestamps);
446
+ const maxTimestamp = Math.max(...timestamps);
447
+ const span = maxTimestamp - minTimestamp;
448
+ if (!Number.isFinite(span) || span <= 0)
449
+ return 30;
450
+ return Math.max(1, Math.floor(span));
451
+ };
452
+ var resolveLatestValue = (points) => {
453
+ const latestPoint = points[points.length - 1];
454
+ if (!latestPoint)
455
+ return 0;
456
+ return latestPoint.value;
457
+ };
458
+ var resolveActiveSeriesId = (series, activeSeriesId) => {
459
+ var _a, _b;
460
+ if (activeSeriesId) {
461
+ const matchingSeries = series.find((seriesItem) => seriesItem.id === activeSeriesId);
462
+ if (matchingSeries) {
463
+ return matchingSeries.id;
464
+ }
465
+ }
466
+ return (_b = (_a = series[0]) == null ? void 0 : _a.id) != null ? _b : "";
467
+ };
468
+ var formatDefaultSeriesLabel = (seriesItem) => {
469
+ return seriesItem.id.charAt(0).toUpperCase() + seriesItem.id.slice(1);
470
+ };
471
+ var renderDefaultSeriesControls = ({
472
+ series,
473
+ activeSeriesId,
474
+ handleSeriesChange,
475
+ defaultSeriesSwitchClassName,
476
+ seriesSwitchAriaLabel,
477
+ formatSeriesOptionAriaLabel
478
+ }) => {
479
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
480
+ SwitchButton,
481
+ {
482
+ ariaLabel: seriesSwitchAriaLabel,
483
+ className: defaultSeriesSwitchClassName,
484
+ options: series.map((seriesItem) => ({
485
+ value: seriesItem.id,
486
+ label: formatDefaultSeriesLabel(seriesItem),
487
+ ariaLabel: formatSeriesOptionAriaLabel(formatDefaultSeriesLabel(seriesItem))
488
+ })),
489
+ value: activeSeriesId,
490
+ onValueChange: handleSeriesChange
491
+ }
492
+ );
493
+ };
494
+ var resolveSelectedSeries = (series, activeSeriesId) => {
495
+ const availableSeriesIds = new Set(series.map((seriesItem) => seriesItem.id));
496
+ if (!availableSeriesIds.has(activeSeriesId)) {
497
+ return series[0];
498
+ }
499
+ return series.find((seriesItem) => seriesItem.id === activeSeriesId);
500
+ };
501
+ var LineChart = ({
502
+ series,
503
+ height = 280,
504
+ width,
505
+ classNames,
506
+ isLoading = false,
507
+ showSeriesControls = true,
508
+ renderSeriesControls
509
+ }) => {
510
+ var _a, _b;
511
+ const labels = (0, import_hooks3.useLabels)();
512
+ const { theme } = (0, import_hooks3.useSdkUiConfig)();
513
+ const normalizedSeries = (0, import_react2.useMemo)(() => {
514
+ return normalizeSeries(series);
515
+ }, [series]);
516
+ const [activeSeriesId, setActiveSeriesId] = (0, import_react2.useState)(
517
+ () => resolveActiveSeriesId(normalizedSeries, null)
518
+ );
519
+ (0, import_react2.useEffect)(() => {
520
+ setActiveSeriesId(
521
+ (currentActiveSeriesId) => resolveActiveSeriesId(normalizedSeries, currentActiveSeriesId)
522
+ );
523
+ }, [normalizedSeries]);
524
+ const livelineTheme = theme;
525
+ const handleSeriesChange = (seriesId) => {
526
+ setActiveSeriesId(seriesId);
527
+ };
528
+ const primarySeries = (0, import_react2.useMemo)(() => {
529
+ return resolveSelectedSeries(normalizedSeries, activeSeriesId);
530
+ }, [activeSeriesId, normalizedSeries]);
531
+ const primaryData = (0, import_react2.useMemo)(() => {
532
+ if (!primarySeries) {
533
+ return [];
534
+ }
535
+ return toLivelinePoints(primarySeries.points);
536
+ }, [primarySeries]);
537
+ const primaryValue = (0, import_react2.useMemo)(() => {
538
+ if (!primarySeries) {
539
+ return 0;
540
+ }
541
+ return resolveLatestValue(primarySeries.points);
542
+ }, [primarySeries]);
543
+ const livelineSeries = (0, import_react2.useMemo)(() => {
544
+ return normalizedSeries.map((seriesItem) => ({
545
+ id: seriesItem.id,
546
+ color: seriesItem.color,
547
+ data: toLivelinePoints(seriesItem.points),
548
+ value: resolveLatestValue(seriesItem.points)
549
+ }));
550
+ }, [normalizedSeries]);
551
+ const windowSeconds = (0, import_react2.useMemo)(() => {
552
+ return resolveWindowSeconds(normalizedSeries);
553
+ }, [normalizedSeries]);
554
+ const seriesControls = showSeriesControls && normalizedSeries.length > 0 ? (_a = renderSeriesControls == null ? void 0 : renderSeriesControls({
555
+ series: normalizedSeries,
556
+ activeSeriesId,
557
+ handleSeriesChange
558
+ })) != null ? _a : normalizedSeries.length > 1 ? renderDefaultSeriesControls({
559
+ series: normalizedSeries,
560
+ activeSeriesId,
561
+ handleSeriesChange,
562
+ defaultSeriesSwitchClassName: classNames == null ? void 0 : classNames.defaultSeriesSwitch,
563
+ seriesSwitchAriaLabel: labels.common.lineChartSeriesSwitchAria,
564
+ formatSeriesOptionAriaLabel: labels.common.lineChartSeriesOptionAria
565
+ }) : null : null;
566
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: cn("w-full", classNames == null ? void 0 : classNames.root), style: { width }, children: [
567
+ !isLoading && seriesControls ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cn("mb-3", classNames == null ? void 0 : classNames.controls), children: seriesControls }) : null,
568
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
569
+ "div",
570
+ {
571
+ className: cn(
572
+ "overflow-hidden [&>div:not(.agg-livechart):first-of-type]:hidden!",
573
+ classNames == null ? void 0 : classNames.chartViewport
574
+ ),
575
+ style: { height },
576
+ role: "img",
577
+ "aria-label": labels.common.lineChartAria,
578
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
579
+ import_liveline.Liveline,
580
+ {
581
+ className: cn("h-full w-full agg-livechart", classNames == null ? void 0 : classNames.liveline),
582
+ data: primaryData,
583
+ value: primaryValue,
584
+ series: livelineSeries,
585
+ color: (_b = primarySeries == null ? void 0 : primarySeries.color) != null ? _b : "var(--agg-color-primary)",
586
+ theme: livelineTheme,
587
+ grid: true,
588
+ momentum: false,
589
+ pulse: false,
590
+ window: windowSeconds,
591
+ formatValue: defaultValueFormatter,
592
+ formatTime: defaultTimeFormatter,
593
+ padding: {
594
+ top: 12,
595
+ right: 80,
596
+ bottom: 28,
597
+ left: 12
598
+ },
599
+ loading: isLoading
600
+ }
601
+ )
602
+ }
603
+ )
604
+ ] });
605
+ };
606
+ LineChart.displayName = "LineChart";
607
+
608
+ // src/primitives/card/index.tsx
609
+ var import_hooks4 = require("@agg-market/hooks");
610
+ var import_jsx_runtime5 = require("react/jsx-runtime");
611
+ var Card = (_a) => {
612
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
613
+ const { enableAnimations } = (0, import_hooks4.useSdkUiConfig)();
614
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
615
+ "div",
616
+ __spreadValues({
617
+ className: cn(
618
+ "flex w-full flex-col font-agg-sans",
619
+ "rounded-agg-xl border border-agg-separator",
620
+ "bg-agg-secondary text-agg-foreground shadow-agg-card",
621
+ getMotionClassName(enableAnimations, "transition-shadow hover:shadow-agg-card-hover"),
622
+ className
623
+ )
624
+ }, props)
625
+ );
626
+ };
627
+ Card.displayName = "Card";
628
+
629
+ // src/primitives/skeleton/views/event-list-skeleton-view.tsx
630
+ var import_hooks7 = require("@agg-market/hooks");
631
+
632
+ // src/primitives/skeleton/skeleton-block.tsx
633
+ var import_hooks5 = require("@agg-market/hooks");
634
+ var import_jsx_runtime6 = require("react/jsx-runtime");
635
+ var SkeletonBlock = ({ className }) => {
636
+ const { enableAnimations } = (0, import_hooks5.useSdkUiConfig)();
637
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
638
+ "div",
639
+ {
640
+ "aria-hidden": true,
641
+ className: cn(
642
+ "bg-agg-separator",
643
+ getMotionClassName(enableAnimations, "animate-pulse"),
644
+ className
645
+ )
646
+ }
647
+ );
648
+ };
649
+ SkeletonBlock.displayName = "SkeletonBlock";
650
+
651
+ // src/primitives/skeleton/views/event-list-item-skeleton-view.tsx
652
+ var import_hooks6 = require("@agg-market/hooks");
653
+
654
+ // src/events/item/event-list-item.constants.ts
655
+ var baseCardClassName = "gap-3 overflow-hidden p-5 w-full";
656
+
657
+ // src/primitives/skeleton/views/event-list-item-skeleton-view.tsx
658
+ var import_jsx_runtime7 = require("react/jsx-runtime");
659
+ var EventListItemSkeletonView = ({
660
+ className,
661
+ ariaLabel,
662
+ isStandalone = false
663
+ }) => {
664
+ const labels = (0, import_hooks6.useLabels)();
665
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
666
+ Card,
667
+ {
668
+ className: cn(baseCardClassName, className),
669
+ role: isStandalone ? "status" : void 0,
670
+ "aria-label": isStandalone ? ariaLabel != null ? ariaLabel : labels.eventItem.loading : void 0,
671
+ "aria-busy": isStandalone || void 0,
672
+ "aria-hidden": isStandalone ? void 0 : true,
673
+ children: [
674
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex w-full items-start gap-3", children: [
675
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SkeletonBlock, { className: "h-10 w-10 rounded-agg-lg" }),
676
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-1 flex-col gap-2", children: [
677
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SkeletonBlock, { className: "h-5 w-[82%] rounded-agg-sm" }),
678
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SkeletonBlock, { className: "h-5 w-[68%] rounded-agg-sm" })
679
+ ] })
680
+ ] }),
681
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex flex-col gap-3", children: [0, 1].map((index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
682
+ "div",
683
+ {
684
+ className: "grid w-full grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-3",
685
+ children: [
686
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SkeletonBlock, { className: "h-4 rounded-agg-sm" }),
687
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SkeletonBlock, { className: "h-4 w-10 rounded-agg-sm" }),
688
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SkeletonBlock, { className: "h-9 w-[101px] rounded-agg-full" })
689
+ ]
690
+ },
691
+ index
692
+ )) }),
693
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center justify-between gap-2 text-agg-muted-foreground", children: [
694
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-2", children: [
695
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SkeletonBlock, { className: "h-4 w-36 rounded-agg-sm" }),
696
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-1", children: [
697
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SkeletonBlock, { className: "size-3 rounded-agg-full" }),
698
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SkeletonBlock, { className: "size-3 rounded-agg-full" }),
699
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SkeletonBlock, { className: "size-3 rounded-agg-full" })
700
+ ] })
701
+ ] }),
702
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SkeletonBlock, { className: "h-4 w-20 rounded-agg-sm" })
703
+ ] })
704
+ ]
705
+ }
706
+ );
707
+ };
708
+ EventListItemSkeletonView.displayName = "EventListItemSkeletonView";
709
+
710
+ // src/primitives/skeleton/views/event-list-skeleton-view.tsx
711
+ var import_jsx_runtime8 = require("react/jsx-runtime");
712
+ var EventListSkeletonView = ({ className, ariaLabel }) => {
713
+ const labels = (0, import_hooks7.useLabels)();
714
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
715
+ "section",
716
+ {
717
+ className: cn("flex w-full flex-col gap-5", className),
718
+ role: "status",
719
+ "aria-label": ariaLabel != null ? ariaLabel : labels.eventList.loading("events"),
720
+ "aria-busy": true,
721
+ children: [
722
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("header", { className: "flex w-full flex-col items-start justify-between gap-2 md:flex-row md:flex-nowrap md:items-center md:gap-4", children: [
723
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SkeletonBlock, { className: "h-7 w-40 rounded-agg-sm" }),
724
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex max-w-full gap-2", children: [
725
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SkeletonBlock, { className: "h-10 w-20 rounded-agg-full" }),
726
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SkeletonBlock, { className: "h-10 w-20 rounded-agg-full" }),
727
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SkeletonBlock, { className: "h-10 w-24 rounded-agg-full" })
728
+ ] })
729
+ ] }),
730
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "grid grid-cols-1 gap-5 md:grid-cols-3", children: Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
731
+ EventListItemSkeletonView,
732
+ {
733
+ isStandalone: false,
734
+ className: "w-full min-w-0 max-w-none"
735
+ },
736
+ index
737
+ )) })
738
+ ]
739
+ }
740
+ );
741
+ };
742
+ EventListSkeletonView.displayName = "EventListSkeletonView";
743
+
744
+ // src/primitives/skeleton/views/event-list-item-details-skeleton-view.tsx
745
+ var import_hooks8 = require("@agg-market/hooks");
746
+
747
+ // src/events/item-details/event-list-item-details.constants.ts
748
+ var detailsBaseCardClassName = "w-full overflow-hidden gap-6 p-5 md:gap-8 md:p-10";
749
+ var eventListItemDetailsTimeRanges = [
750
+ "1H",
751
+ "6H",
752
+ "1D",
753
+ "1W",
754
+ "1M",
755
+ "ALL"
756
+ ];
757
+ var lineColorByVenue = {
758
+ polymarket: "#2e5cff",
759
+ kalshi: "#00d295",
760
+ probable: "#f05923",
761
+ opinion: "#020205"
762
+ };
763
+ var fallbackLineColors = ["#2e5cff", "#00d295", "#f05923", "#020205"];
764
+
765
+ // src/primitives/skeleton/views/event-list-item-details-skeleton-view.tsx
766
+ var import_jsx_runtime9 = require("react/jsx-runtime");
767
+ var EventListItemDetailsSkeletonView = ({
768
+ className,
769
+ ariaLabel
770
+ }) => {
771
+ const labels = (0, import_hooks8.useLabels)();
772
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
773
+ Card,
774
+ {
775
+ className: cn(detailsBaseCardClassName, className),
776
+ role: "status",
777
+ "aria-label": ariaLabel != null ? ariaLabel : labels.eventItemDetails.loading,
778
+ "aria-busy": true,
779
+ children: [
780
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex w-full items-start gap-3 md:gap-4", children: [
781
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SkeletonBlock, { className: "size-10 rounded-agg-lg md:size-[60px]" }),
782
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-1 flex-col gap-2", children: [
783
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SkeletonBlock, { className: "h-5 w-[82%] rounded-agg-sm md:h-7 md:w-[55%]" }),
784
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex gap-2 overflow-hidden", children: [
785
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SkeletonBlock, { className: "h-8 w-28 rounded-agg-full" }),
786
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SkeletonBlock, { className: "h-8 w-28 rounded-agg-full" }),
787
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SkeletonBlock, { className: "h-8 w-28 rounded-agg-full" })
788
+ ] })
789
+ ] })
790
+ ] }),
791
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col gap-4", children: [
792
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SkeletonBlock, { className: "h-10 w-full rounded-agg-full md:w-[220px]" }),
793
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex gap-2 overflow-hidden", children: [
794
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SkeletonBlock, { className: "h-9 w-20 rounded-agg-full" }),
795
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SkeletonBlock, { className: "h-9 w-20 rounded-agg-full" }),
796
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SkeletonBlock, { className: "h-9 w-20 rounded-agg-full" }),
797
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SkeletonBlock, { className: "h-9 w-20 rounded-agg-full" })
798
+ ] })
799
+ ] }),
800
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "h-[300px] w-full rounded-agg-xl", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SkeletonBlock, { className: "h-full w-full rounded-agg-xl" }) }),
801
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center justify-between", children: [
802
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SkeletonBlock, { className: "h-5 w-24 rounded-agg-sm" }),
803
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SkeletonBlock, { className: "h-5 w-40 rounded-agg-sm" })
804
+ ] })
805
+ ]
806
+ }
807
+ );
808
+ };
809
+ EventListItemDetailsSkeletonView.displayName = "EventListItemDetailsSkeletonView";
810
+
811
+ // src/primitives/skeleton/views/market-details-skeleton-view.tsx
812
+ var import_hooks9 = require("@agg-market/hooks");
813
+
814
+ // src/events/market-details/market-details.constants.ts
815
+ var marketDetailsBaseCardClassName = "w-full overflow-hidden rounded-agg-lg border border-agg-separator bg-agg-secondary text-agg-foreground shadow-none hover:shadow-none";
816
+
817
+ // src/primitives/skeleton/views/market-details-skeleton-view.tsx
818
+ var import_jsx_runtime10 = require("react/jsx-runtime");
819
+ var MarketDetailsSkeletonView = ({
820
+ className,
821
+ ariaLabel,
822
+ isDetailed
823
+ }) => {
824
+ const labels = (0, import_hooks9.useLabels)();
825
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
826
+ Card,
827
+ {
828
+ className: cn(marketDetailsBaseCardClassName, className),
829
+ role: "status",
830
+ "aria-label": ariaLabel != null ? ariaLabel : labels.marketDetails.loading,
831
+ "aria-busy": true,
832
+ children: [
833
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col gap-3 p-4 md:px-5 md:py-4", children: [
834
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
835
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex min-w-0 items-center gap-3 md:gap-4", children: [
836
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SkeletonBlock, { className: "size-12 rounded-agg-lg md:size-[60px]" }),
837
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex min-w-0 flex-col gap-2", children: [
838
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SkeletonBlock, { className: "h-6 w-40 rounded-agg-sm" }),
839
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SkeletonBlock, { className: "h-4 w-28 rounded-agg-sm" })
840
+ ] })
841
+ ] }),
842
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SkeletonBlock, { className: "h-8 w-16 rounded-agg-sm" })
843
+ ] }),
844
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex gap-2", children: [
845
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SkeletonBlock, { className: "h-10 flex-1 rounded-agg-full" }),
846
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SkeletonBlock, { className: "h-10 flex-1 rounded-agg-full" })
847
+ ] })
848
+ ] }),
849
+ isDetailed ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
850
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "h-px w-full bg-agg-separator" }),
851
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex h-14 items-end", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SkeletonBlock, { className: "h-full w-full rounded-none" }) }),
852
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "h-px w-full bg-agg-separator" }),
853
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col gap-4 p-5", children: [
854
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col gap-3", children: [
855
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SkeletonBlock, { className: "h-4 w-12 rounded-agg-sm" }),
856
+ [0, 1, 2, 3].map((index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
857
+ "div",
858
+ {
859
+ className: "grid grid-cols-[52px_1fr_1fr_52px] items-center gap-2",
860
+ children: [
861
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SkeletonBlock, { className: "h-4 rounded-agg-sm" }),
862
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SkeletonBlock, { className: "h-4 rounded-agg-sm" }),
863
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SkeletonBlock, { className: "h-4 rounded-agg-sm" }),
864
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SkeletonBlock, { className: "h-2 rounded-agg-full" })
865
+ ]
866
+ },
867
+ `ask-${index}`
868
+ ))
869
+ ] }),
870
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col gap-3", children: [
871
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SkeletonBlock, { className: "h-4 w-12 rounded-agg-sm" }),
872
+ [0, 1, 2, 3].map((index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
873
+ "div",
874
+ {
875
+ className: "grid grid-cols-[52px_1fr_1fr_52px] items-center gap-2",
876
+ children: [
877
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SkeletonBlock, { className: "h-4 rounded-agg-sm" }),
878
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SkeletonBlock, { className: "h-4 rounded-agg-sm" }),
879
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SkeletonBlock, { className: "h-4 rounded-agg-sm" }),
880
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SkeletonBlock, { className: "h-2 rounded-agg-full" })
881
+ ]
882
+ },
883
+ `bid-${index}`
884
+ ))
885
+ ] })
886
+ ] })
887
+ ] }) : null
888
+ ]
889
+ }
890
+ );
891
+ };
892
+ MarketDetailsSkeletonView.displayName = "MarketDetailsSkeletonView";
893
+
894
+ // src/primitives/skeleton/views/place-order-skeleton-view.tsx
895
+ var import_jsx_runtime11 = require("react/jsx-runtime");
896
+ var placeOrderCardClassName = "overflow-hidden rounded-agg-xl border border-agg-border bg-agg-secondary shadow-none hover:shadow-none";
897
+ var ContentBody = () => {
898
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col gap-6 p-5", children: [
899
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col gap-2", children: [
900
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-start justify-between gap-5", children: [
901
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-3", children: [
902
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonBlock, { className: "h-12 w-12 shrink-0 rounded-agg-lg" }),
903
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [
904
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonBlock, { className: "h-5 w-[92%] rounded-agg-sm" }),
905
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonBlock, { className: "h-5 w-[80%] rounded-agg-sm" })
906
+ ] })
907
+ ] }),
908
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonBlock, { className: "h-6 w-6 rounded-agg-sm" })
909
+ ] }),
910
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonBlock, { className: "h-5 w-28 rounded-agg-sm" })
911
+ ] }),
912
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex h-11 items-end border-b border-agg-separator", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-8", children: [
913
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col gap-2", children: [
914
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonBlock, { className: "h-5 w-10 rounded-agg-sm" }),
915
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonBlock, { className: "h-[3px] w-12 rounded-t-agg-sm" })
916
+ ] }),
917
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonBlock, { className: "h-5 w-10 rounded-agg-sm" })
918
+ ] }) }),
919
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col gap-4", children: [
920
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex gap-2", children: [
921
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonBlock, { className: "h-11 flex-1 rounded-agg-full" }),
922
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonBlock, { className: "h-11 flex-1 rounded-agg-full" })
923
+ ] }),
924
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
925
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col gap-2", children: [
926
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonBlock, { className: "h-6 w-20 rounded-agg-sm" }),
927
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonBlock, { className: "h-4 w-28 rounded-agg-sm" })
928
+ ] }),
929
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonBlock, { className: "h-9 w-28 rounded-agg-sm" })
930
+ ] })
931
+ ] }),
932
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col gap-2", children: [
933
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "rounded-agg-lg border border-agg-trade-highlight-border bg-agg-trade-highlight-surface p-3", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col gap-3", children: [
934
+ [0, 1].map((index) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col gap-3", children: [
935
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
936
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-2", children: [
937
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonBlock, { className: "size-4 rounded-agg-full" }),
938
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonBlock, { className: "h-5 w-24 rounded-agg-sm" })
939
+ ] }),
940
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonBlock, { className: "h-5 w-10 rounded-agg-sm" })
941
+ ] }),
942
+ index === 0 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "h-px w-full bg-agg-trade-highlight-border" }) : null
943
+ ] }, `place-order-route-${index}`)),
944
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonBlock, { className: "mx-auto h-5 w-40 rounded-agg-sm" })
945
+ ] }) }),
946
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonBlock, { className: "h-4 w-36 rounded-agg-sm" })
947
+ ] }),
948
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
949
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col gap-2", children: [
950
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonBlock, { className: "h-6 w-20 rounded-agg-sm" }),
951
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonBlock, { className: "h-4 w-24 rounded-agg-sm" })
952
+ ] }),
953
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonBlock, { className: "h-9 w-36 rounded-agg-sm" })
954
+ ] }),
955
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonBlock, { className: "h-4 w-[88%] self-center rounded-agg-sm" })
956
+ ] });
957
+ };
958
+ var PlaceOrderSkeletonView = ({
959
+ className,
960
+ ariaLabel
961
+ }) => {
962
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
963
+ "div",
964
+ {
965
+ className: cn("w-full", className),
966
+ role: "status",
967
+ "aria-label": ariaLabel != null ? ariaLabel : "Loading place order",
968
+ "aria-busy": true,
969
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex w-full items-end justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
970
+ Card,
971
+ {
972
+ className: cn(
973
+ placeOrderCardClassName,
974
+ "w-full max-w-[400px] rounded-t-agg-xl rounded-b-none border-b-0"
975
+ ),
976
+ children: [
977
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ContentBody, {}),
978
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "border-t border-agg-separator bg-agg-secondary p-4", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SkeletonBlock, { className: "h-12 w-full rounded-agg-full" }) })
979
+ ]
980
+ }
981
+ ) })
982
+ }
983
+ );
984
+ };
985
+ PlaceOrderSkeletonView.displayName = "PlaceOrderSkeletonView";
986
+
987
+ // src/primitives/skeleton/views/settlement-skeleton-view.tsx
988
+ var import_hooks10 = require("@agg-market/hooks");
989
+ var import_jsx_runtime12 = require("react/jsx-runtime");
990
+ var SettlementSkeletonView = ({
991
+ className,
992
+ ariaLabel
993
+ }) => {
994
+ const labels = (0, import_hooks10.useLabels)();
995
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
996
+ Card,
997
+ {
998
+ className: cn(
999
+ "gap-5 rounded-agg-xl border border-agg-separator bg-agg-secondary p-5 shadow-none hover:shadow-none",
1000
+ className
1001
+ ),
1002
+ role: "status",
1003
+ "aria-label": ariaLabel != null ? ariaLabel : labels.trading.settlementLoading,
1004
+ "aria-busy": true,
1005
+ children: [
1006
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-col gap-1 md:flex-row md:items-center md:justify-between md:gap-4", children: [
1007
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SkeletonBlock, { className: "h-4 w-20 rounded-agg-sm" }),
1008
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SkeletonBlock, { className: "h-5 w-full max-w-80 rounded-agg-sm" })
1009
+ ] }),
1010
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-col gap-2", children: [
1011
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SkeletonBlock, { className: "h-5 w-52 rounded-agg-sm" }),
1012
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-col gap-2", children: [
1013
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SkeletonBlock, { className: "h-4 w-[88%] rounded-agg-sm" }),
1014
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SkeletonBlock, { className: "h-4 w-[84%] rounded-agg-sm" }),
1015
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SkeletonBlock, { className: "h-4 w-[80%] rounded-agg-sm" }),
1016
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SkeletonBlock, { className: "h-4 w-[74%] rounded-agg-sm" })
1017
+ ] })
1018
+ ] }),
1019
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "h-px w-full bg-agg-separator" }),
1020
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-col gap-3", children: [
1021
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-col gap-2", children: [
1022
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
1023
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SkeletonBlock, { className: "size-4 rounded-agg-full" }),
1024
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SkeletonBlock, { className: "h-5 w-24 rounded-agg-sm" }),
1025
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SkeletonBlock, { className: "h-4 w-4 rounded-agg-sm" })
1026
+ ] }),
1027
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-col gap-2 pl-6", children: [
1028
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SkeletonBlock, { className: "h-4 w-full rounded-agg-sm" }),
1029
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SkeletonBlock, { className: "h-4 w-[92%] rounded-agg-sm" }),
1030
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SkeletonBlock, { className: "h-4 w-[34%] rounded-agg-sm" })
1031
+ ] })
1032
+ ] }),
1033
+ [0, 1, 2].map((index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
1034
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SkeletonBlock, { className: "size-4 rounded-agg-full" }),
1035
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SkeletonBlock, { className: "h-5 w-20 rounded-agg-sm" }),
1036
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SkeletonBlock, { className: "h-4 w-4 rounded-agg-sm" })
1037
+ ] }, `settlement-venue-${index}`))
1038
+ ] })
1039
+ ]
1040
+ }
1041
+ );
1042
+ };
1043
+ SettlementSkeletonView.displayName = "SettlementSkeletonView";
1044
+
1045
+ // src/primitives/skeleton/skeleton.types.ts
1046
+ var skeletonViews = {
1047
+ eventListItem: "event-list-item",
1048
+ eventListItemDetails: "event-list-item-details",
1049
+ marketDetailsMinified: "market-details-minified",
1050
+ marketDetailsDetailed: "market-details-detailed",
1051
+ eventList: "event-list",
1052
+ settlement: "settlement",
1053
+ placeOrder: "place-order"
1054
+ };
1055
+
1056
+ // src/primitives/skeleton/index.tsx
1057
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1058
+ var Skeleton = ({ view, className, ariaLabel }) => {
1059
+ if (view === skeletonViews.eventListItem) {
1060
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(EventListItemSkeletonView, { className, ariaLabel, isStandalone: true });
1061
+ }
1062
+ if (view === skeletonViews.eventListItemDetails) {
1063
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(EventListItemDetailsSkeletonView, { className, ariaLabel });
1064
+ }
1065
+ if (view === skeletonViews.marketDetailsMinified) {
1066
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MarketDetailsSkeletonView, { className, ariaLabel, isDetailed: false });
1067
+ }
1068
+ if (view === skeletonViews.marketDetailsDetailed) {
1069
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MarketDetailsSkeletonView, { className, ariaLabel, isDetailed: true });
1070
+ }
1071
+ if (view === skeletonViews.settlement) {
1072
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SettlementSkeletonView, { className, ariaLabel });
1073
+ }
1074
+ if (view === skeletonViews.placeOrder) {
1075
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PlaceOrderSkeletonView, { className, ariaLabel });
1076
+ }
1077
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(EventListSkeletonView, { className, ariaLabel });
1078
+ };
1079
+ Skeleton.displayName = "Skeleton";
1080
+
1081
+ // src/primitives/typography/typography.constants.ts
1082
+ var variantClasses2 = {
1083
+ title: cn("font-agg-sans text-agg-lg leading-agg-7", "font-agg-bold", "text-agg-foreground"),
1084
+ body: cn("font-agg-sans text-agg-base leading-agg-6", "font-agg-normal", "text-agg-foreground"),
1085
+ meta: cn(
1086
+ "font-agg-sans text-agg-sm leading-agg-5",
1087
+ "font-agg-normal",
1088
+ "text-agg-muted-foreground"
1089
+ ),
1090
+ label: cn(
1091
+ "font-agg-sans text-agg-sm leading-agg-5",
1092
+ "font-agg-bold uppercase",
1093
+ "text-agg-foreground"
1094
+ ),
1095
+ value: cn("font-agg-sans text-agg-xl leading-agg-7", "font-agg-normal", "text-agg-foreground"),
1096
+ caption: cn("font-agg-sans text-agg-xs leading-agg-4", "font-agg-normal", "text-agg-foreground")
1097
+ };
1098
+
1099
+ // src/primitives/typography/index.tsx
1100
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1101
+ var Typography = ({
1102
+ as: Component = "p",
1103
+ variant = "body",
1104
+ className,
1105
+ children
1106
+ }) => {
1107
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Component, { className: cn(variantClasses2[variant], "truncate", className), children });
1108
+ };
1109
+ Typography.displayName = "Typography";
1110
+
1111
+ // src/primitives/venue-logo/index.tsx
1112
+ var import_hooks11 = require("@agg-market/hooks");
1113
+
1114
+ // src/primitives/icon/types.ts
1115
+ var getIconA11yProps = (title) => ({
1116
+ role: title ? "img" : "presentation",
1117
+ "aria-hidden": title ? void 0 : true
1118
+ });
1119
+
1120
+ // src/primitives/venue-logo/logo-props.ts
1121
+ var DEFAULT_MONOCHROME_COLOR = "#000000";
1122
+ var resolveLogoPrimaryColor = ({
1123
+ brandColor,
1124
+ isColor = true,
1125
+ color
1126
+ }) => {
1127
+ if (typeof color === "string" && color.trim())
1128
+ return color;
1129
+ if (!isColor)
1130
+ return DEFAULT_MONOCHROME_COLOR;
1131
+ return brandColor;
1132
+ };
1133
+
1134
+ // src/primitives/venue-logo/svg/logo-kalshi.tsx
1135
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1136
+ var KALSHI_GREEN = "#18C590";
1137
+ var LogoKalshiIcon = (_a) => {
1138
+ var _b = _a, {
1139
+ title,
1140
+ className,
1141
+ isColor = true,
1142
+ color
1143
+ } = _b, props = __objRest(_b, [
1144
+ "title",
1145
+ "className",
1146
+ "isColor",
1147
+ "color"
1148
+ ]);
1149
+ const primaryColor = resolveLogoPrimaryColor({
1150
+ brandColor: KALSHI_GREEN,
1151
+ isColor,
1152
+ color
1153
+ });
1154
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
1155
+ "svg",
1156
+ __spreadProps(__spreadValues(__spreadValues({
1157
+ viewBox: "0 0 100 100",
1158
+ className,
1159
+ fill: "none"
1160
+ }, getIconA11yProps(title)), props), {
1161
+ children: [
1162
+ title ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("title", { children: title }) : null,
1163
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M20 10H36V90H20V10Z", fill: primaryColor }),
1164
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M44 50L74 10H92L62 50L92 90H74L44 50Z", fill: primaryColor })
1165
+ ]
1166
+ })
1167
+ );
1168
+ };
1169
+ LogoKalshiIcon.displayName = "LogoKalshiIcon";
1170
+
1171
+ // src/primitives/venue-logo/svg/logo-opinion.tsx
1172
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1173
+ var OPINION_BLACK = "#000000";
1174
+ var OPINION_WHITE = "#FFFFFF";
1175
+ var LogoOpinionIcon = (_a) => {
1176
+ var _b = _a, {
1177
+ title,
1178
+ className,
1179
+ isColor = true,
1180
+ color
1181
+ } = _b, props = __objRest(_b, [
1182
+ "title",
1183
+ "className",
1184
+ "isColor",
1185
+ "color"
1186
+ ]);
1187
+ const primaryColor = resolveLogoPrimaryColor({
1188
+ brandColor: OPINION_BLACK,
1189
+ isColor,
1190
+ color
1191
+ });
1192
+ const accentColor = (color == null ? void 0 : color.trim()) ? primaryColor : OPINION_WHITE;
1193
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
1194
+ "svg",
1195
+ __spreadProps(__spreadValues(__spreadValues({
1196
+ viewBox: "0 0 100 100",
1197
+ className,
1198
+ fill: "none"
1199
+ }, getIconA11yProps(title)), props), {
1200
+ children: [
1201
+ title ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("title", { children: title }) : null,
1202
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("circle", { cx: "50", cy: "50", r: "40", fill: primaryColor }),
1203
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1204
+ "rect",
1205
+ {
1206
+ x: "21",
1207
+ y: "18",
1208
+ width: "8",
1209
+ height: "64",
1210
+ rx: "4",
1211
+ transform: "rotate(-7 21 18)",
1212
+ fill: accentColor
1213
+ }
1214
+ ),
1215
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1216
+ "rect",
1217
+ {
1218
+ x: "37",
1219
+ y: "12",
1220
+ width: "8",
1221
+ height: "76",
1222
+ rx: "4",
1223
+ transform: "rotate(-4 37 12)",
1224
+ fill: accentColor
1225
+ }
1226
+ ),
1227
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1228
+ "rect",
1229
+ {
1230
+ x: "53",
1231
+ y: "12",
1232
+ width: "8",
1233
+ height: "76",
1234
+ rx: "4",
1235
+ transform: "rotate(-4 53 12)",
1236
+ fill: accentColor
1237
+ }
1238
+ ),
1239
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1240
+ "rect",
1241
+ {
1242
+ x: "69",
1243
+ y: "18",
1244
+ width: "8",
1245
+ height: "64",
1246
+ rx: "4",
1247
+ transform: "rotate(-7 69 18)",
1248
+ fill: accentColor
1249
+ }
1250
+ ),
1251
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: "12", y: "44", width: "76", height: "12", fill: primaryColor })
1252
+ ]
1253
+ })
1254
+ );
1255
+ };
1256
+ LogoOpinionIcon.displayName = "LogoOpinionIcon";
1257
+
1258
+ // src/primitives/venue-logo/svg/logo-polymarket.tsx
1259
+ var import_jsx_runtime17 = require("react/jsx-runtime");
1260
+ var POLYMARKET_BLUE = "#3861FB";
1261
+ var LogoPolymarketIcon = (_a) => {
1262
+ var _b = _a, {
1263
+ title,
1264
+ className,
1265
+ isColor = true,
1266
+ color
1267
+ } = _b, props = __objRest(_b, [
1268
+ "title",
1269
+ "className",
1270
+ "isColor",
1271
+ "color"
1272
+ ]);
1273
+ const primaryColor = resolveLogoPrimaryColor({
1274
+ brandColor: POLYMARKET_BLUE,
1275
+ isColor,
1276
+ color
1277
+ });
1278
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
1279
+ "svg",
1280
+ __spreadProps(__spreadValues(__spreadValues({
1281
+ viewBox: "0 0 100 100",
1282
+ className,
1283
+ fill: "none"
1284
+ }, getIconA11yProps(title)), props), {
1285
+ children: [
1286
+ title ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("title", { children: title }) : null,
1287
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1288
+ "path",
1289
+ {
1290
+ d: "M18 10L78 2V98L18 88V10Z",
1291
+ stroke: primaryColor,
1292
+ strokeWidth: "8",
1293
+ strokeLinejoin: "round"
1294
+ }
1295
+ ),
1296
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M18 32L78 44", stroke: primaryColor, strokeWidth: "8", strokeLinecap: "round" }),
1297
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M18 58L78 70", stroke: primaryColor, strokeWidth: "8", strokeLinecap: "round" })
1298
+ ]
1299
+ })
1300
+ );
1301
+ };
1302
+ LogoPolymarketIcon.displayName = "LogoPolymarketIcon";
1303
+
1304
+ // src/primitives/venue-logo/svg/logo-probable.tsx
1305
+ var import_jsx_runtime18 = require("react/jsx-runtime");
1306
+ var PROBABLE_ORANGE = "#F85B22";
1307
+ var LogoProbableIcon = (_a) => {
1308
+ var _b = _a, {
1309
+ title,
1310
+ className,
1311
+ isColor = true,
1312
+ color
1313
+ } = _b, props = __objRest(_b, [
1314
+ "title",
1315
+ "className",
1316
+ "isColor",
1317
+ "color"
1318
+ ]);
1319
+ const primaryColor = resolveLogoPrimaryColor({
1320
+ brandColor: PROBABLE_ORANGE,
1321
+ isColor,
1322
+ color
1323
+ });
1324
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1325
+ "svg",
1326
+ __spreadProps(__spreadValues(__spreadValues({
1327
+ viewBox: "0 0 100 100",
1328
+ className,
1329
+ fill: "none"
1330
+ }, getIconA11yProps(title)), props), {
1331
+ children: [
1332
+ title ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("title", { children: title }) : null,
1333
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("rect", { x: "20", y: "16", width: "60", height: "12", fill: primaryColor }),
1334
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("rect", { x: "18", y: "36", width: "64", height: "46", rx: "23", fill: primaryColor }),
1335
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1336
+ "rect",
1337
+ {
1338
+ x: "32",
1339
+ y: "50",
1340
+ width: "40",
1341
+ height: "18",
1342
+ rx: "9",
1343
+ fill: isColor && !color ? "white" : primaryColor
1344
+ }
1345
+ ),
1346
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("circle", { cx: "61", cy: "59", r: "7", fill: primaryColor })
1347
+ ]
1348
+ })
1349
+ );
1350
+ };
1351
+ LogoProbableIcon.displayName = "LogoProbableIcon";
1352
+
1353
+ // src/primitives/venue-logo/venue-logo.constants.ts
1354
+ var venueLogoRegistry = {
1355
+ kalshi: LogoKalshiIcon,
1356
+ polymarket: LogoPolymarketIcon,
1357
+ opinion: LogoOpinionIcon,
1358
+ probable: LogoProbableIcon
1359
+ };
1360
+ var venueLogoNames = Object.keys(venueLogoRegistry);
1361
+ var sizeClasses2 = {
1362
+ xxs: "h-2 w-2",
1363
+ xs: "h-3 w-3",
1364
+ s: "h-4 w-4",
1365
+ m: "h-6 w-6",
1366
+ l: "h-8 w-8",
1367
+ xl: "h-10 w-10",
1368
+ xxl: "h-12 w-12"
1369
+ };
1370
+
1371
+ // src/primitives/venue-logo/index.tsx
1372
+ var import_jsx_runtime19 = require("react/jsx-runtime");
1373
+ var VenueLogo = ({
1374
+ venue,
1375
+ isColor = true,
1376
+ isMonochromatic = false,
1377
+ color,
1378
+ size = "m",
1379
+ className,
1380
+ ariaLabel,
1381
+ title
1382
+ }) => {
1383
+ const labels = (0, import_hooks11.useLabels)();
1384
+ const Component = venueLogoRegistry[venue];
1385
+ const sizeClass = sizeClasses2[size];
1386
+ const resolvedIsColor = isMonochromatic ? false : isColor;
1387
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1388
+ Component,
1389
+ {
1390
+ className: cn("shrink-0", sizeClass, className),
1391
+ isColor: resolvedIsColor,
1392
+ color,
1393
+ "aria-label": ariaLabel != null ? ariaLabel : labels.venues[venue],
1394
+ title
1395
+ }
1396
+ );
1397
+ };
1398
+ VenueLogo.displayName = "VenueLogo";
1399
+
1400
+ // src/events/item/event-list-item.utils.ts
1401
+ var resolveEventListItemEvent = (fetchedEvent) => {
1402
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
1403
+ if (!fetchedEvent)
1404
+ return void 0;
1405
+ const fallbackVenueEvent = fetchedEvent.venueEvents[0];
1406
+ if (!fallbackVenueEvent)
1407
+ return void 0;
1408
+ const mergedVenueMarkets = fetchedEvent.markets.flatMap((venueEvent) => venueEvent.venueMarkets);
1409
+ const venueMarkets = mergedVenueMarkets.length > 0 ? mergedVenueMarkets : [];
1410
+ if ((venueMarkets == null ? void 0 : venueMarkets.length) === 0)
1411
+ return void 0;
1412
+ return __spreadProps(__spreadValues({}, fetchedEvent), {
1413
+ id: fetchedEvent.id,
1414
+ title: fetchedEvent.title || fallbackVenueEvent.title,
1415
+ description: (_b = (_a = fetchedEvent.description) != null ? _a : fallbackVenueEvent.description) != null ? _b : null,
1416
+ volume: (_d = (_c = fetchedEvent.volume) != null ? _c : fallbackVenueEvent.volume) != null ? _d : null,
1417
+ startDate: (_f = (_e = fetchedEvent.startDate) != null ? _e : fallbackVenueEvent.startDate) != null ? _f : null,
1418
+ endDate: (_h = (_g = fetchedEvent.endDate) != null ? _g : fallbackVenueEvent.endDate) != null ? _h : null,
1419
+ creationDate: (_j = (_i = fetchedEvent.creationDate) != null ? _i : fallbackVenueEvent.creationDate) != null ? _j : null
1420
+ });
1421
+ };
1422
+ var normalizeProbability = (value) => {
1423
+ if (typeof value !== "number" || !Number.isFinite(value))
1424
+ return void 0;
1425
+ if (value < 0)
1426
+ return 0;
1427
+ if (value > 1)
1428
+ return 1;
1429
+ return value;
1430
+ };
1431
+ var hasDateLabel = (outcome) => {
1432
+ return !!toDate(outcome.label);
1433
+ };
1434
+ var sortOutcomes = (outcomes) => {
1435
+ if (outcomes.length <= 1)
1436
+ return outcomes;
1437
+ const now = Date.now();
1438
+ if (outcomes.some(hasDateLabel)) {
1439
+ return [...outcomes].sort((a, b) => {
1440
+ var _a, _b, _c, _d;
1441
+ const aDate = (_b = (_a = toDate(a.label)) == null ? void 0 : _a.getTime()) != null ? _b : 0;
1442
+ const bDate = (_d = (_c = toDate(b.label)) == null ? void 0 : _c.getTime()) != null ? _d : 0;
1443
+ return Math.abs(aDate - now) - Math.abs(bDate - now);
1444
+ });
1445
+ }
1446
+ return [...outcomes].sort((a, b) => {
1447
+ var _a, _b;
1448
+ const aPrice = (_a = normalizeProbability(a.price)) != null ? _a : 0;
1449
+ const bPrice = (_b = normalizeProbability(b.price)) != null ? _b : 0;
1450
+ return bPrice - aPrice;
1451
+ });
1452
+ };
1453
+ var resolveOutcomeTitle = (outcome) => {
1454
+ if (outcome.title && outcome.title.trim())
1455
+ return outcome.title;
1456
+ return outcome.label;
1457
+ };
1458
+ var selectPrimaryVenueMarket = (venueMarkets) => {
1459
+ if (venueMarkets.length === 0)
1460
+ return void 0;
1461
+ if (venueMarkets.length === 1)
1462
+ return venueMarkets[0];
1463
+ return [...venueMarkets].sort((a, b) => {
1464
+ const aVolume = typeof a.volume === "number" ? a.volume : -1;
1465
+ const bVolume = typeof b.volume === "number" ? b.volume : -1;
1466
+ return bVolume - aVolume;
1467
+ })[0];
1468
+ };
1469
+ var resolveTileTitle = (event, primaryVenueMarket, titleOverride) => {
1470
+ if (typeof titleOverride === "string" && titleOverride.trim()) {
1471
+ return titleOverride;
1472
+ }
1473
+ if (typeof (primaryVenueMarket == null ? void 0 : primaryVenueMarket.question) === "string" && primaryVenueMarket.question.trim()) {
1474
+ return primaryVenueMarket.question;
1475
+ }
1476
+ return event.title;
1477
+ };
1478
+ var resolveTileImage = (event, primaryVenueMarket, imageOverride) => {
1479
+ var _a, _b, _c, _d, _e, _f;
1480
+ if (typeof imageOverride === "string" && imageOverride.trim()) {
1481
+ return imageOverride;
1482
+ }
1483
+ if (typeof (primaryVenueMarket == null ? void 0 : primaryVenueMarket.image) === "string" && primaryVenueMarket.image.trim()) {
1484
+ return primaryVenueMarket.image;
1485
+ }
1486
+ if (typeof ((_b = (_a = event.venueEvents) == null ? void 0 : _a[0]) == null ? void 0 : _b.image) === "string" && ((_d = (_c = event.venueEvents) == null ? void 0 : _c[0]) == null ? void 0 : _d.image.trim())) {
1487
+ return (_f = (_e = event.venueEvents) == null ? void 0 : _e[0]) == null ? void 0 : _f.image;
1488
+ }
1489
+ return void 0;
1490
+ };
1491
+
1492
+ // src/events/item-details/event-list-item-details.utils.ts
1493
+ var import_dayjs2 = __toESM(require("dayjs"));
1494
+ var normalizeLabel = (value) => {
1495
+ return value.trim().toLowerCase();
1496
+ };
1497
+ var isDateLikeLabel = (value) => {
1498
+ if (!value.trim())
1499
+ return false;
1500
+ return (0, import_dayjs2.default)(value).isValid();
1501
+ };
1502
+ var formatDateLabel = (value) => {
1503
+ if (!isDateLikeLabel(value))
1504
+ return value;
1505
+ return (0, import_dayjs2.default)(value).format("MMM D, YYYY");
1506
+ };
1507
+ var getDefaultSelectedTimeRange = (value) => {
1508
+ if (!value)
1509
+ return "1M";
1510
+ return value;
1511
+ };
1512
+ var getTimeWindowByRange = (range) => {
1513
+ const endTs = (0, import_dayjs2.default)().unix();
1514
+ if (range === "1H") {
1515
+ return {
1516
+ startTs: import_dayjs2.default.unix(endTs).subtract(1, "hour").unix(),
1517
+ endTs,
1518
+ intervalMinutes: 5
1519
+ };
1520
+ }
1521
+ if (range === "6H") {
1522
+ return {
1523
+ startTs: import_dayjs2.default.unix(endTs).subtract(6, "hour").unix(),
1524
+ endTs,
1525
+ intervalMinutes: 15
1526
+ };
1527
+ }
1528
+ if (range === "1D") {
1529
+ return {
1530
+ startTs: import_dayjs2.default.unix(endTs).subtract(1, "day").unix(),
1531
+ endTs,
1532
+ intervalMinutes: 30
1533
+ };
1534
+ }
1535
+ if (range === "1W") {
1536
+ return {
1537
+ startTs: import_dayjs2.default.unix(endTs).subtract(7, "day").unix(),
1538
+ endTs,
1539
+ intervalMinutes: 60
1540
+ };
1541
+ }
1542
+ if (range === "1M") {
1543
+ return {
1544
+ startTs: import_dayjs2.default.unix(endTs).subtract(1, "month").unix(),
1545
+ endTs,
1546
+ intervalMinutes: 240
1547
+ };
1548
+ }
1549
+ return {
1550
+ startTs: import_dayjs2.default.unix(endTs).subtract(6, "month").unix(),
1551
+ endTs,
1552
+ intervalMinutes: 720
1553
+ };
1554
+ };
1555
+ var resolveOutcomeLabels = (venueMarkets) => {
1556
+ var _a;
1557
+ const primaryMarket = selectPrimaryVenueMarket(venueMarkets);
1558
+ const initialLabels = ((_a = primaryMarket == null ? void 0 : primaryMarket.venueMarketOutcomes) != null ? _a : []).map(
1559
+ (outcome) => resolveOutcomeTitle(outcome)
1560
+ );
1561
+ const labels = new Set(initialLabels);
1562
+ venueMarkets.forEach((market) => {
1563
+ sortOutcomes(market.venueMarketOutcomes).forEach((outcome) => {
1564
+ labels.add(resolveOutcomeTitle(outcome));
1565
+ });
1566
+ });
1567
+ return [...labels];
1568
+ };
1569
+ var resolveDefaultOutcomeLabel = (outcomeLabels) => {
1570
+ return outcomeLabels[0];
1571
+ };
1572
+ var matchOutcomeByLabel = (outcome, selectedOutcomeLabel) => {
1573
+ const normalizedSelectedLabel = normalizeLabel(selectedOutcomeLabel);
1574
+ const resolvedTitle = resolveOutcomeTitle(outcome);
1575
+ return normalizeLabel(resolvedTitle) === normalizedSelectedLabel || normalizeLabel(outcome.label) === normalizedSelectedLabel;
1576
+ };
1577
+ var resolveOutcomesByVenue = (venueMarkets, selectedOutcomeLabel) => {
1578
+ return venueMarkets.map((market) => {
1579
+ const matchedOutcome = sortOutcomes(market.venueMarketOutcomes).find((outcome) => {
1580
+ return matchOutcomeByLabel(outcome, selectedOutcomeLabel);
1581
+ });
1582
+ if (!matchedOutcome)
1583
+ return null;
1584
+ return {
1585
+ venue: market.venue,
1586
+ market,
1587
+ outcome: matchedOutcome
1588
+ };
1589
+ }).filter((item) => item != null);
1590
+ };
1591
+ var buildPriceHistoryGroups = (selectedOutcomes) => {
1592
+ const venueMarketOutcomeIdsByVenue = /* @__PURE__ */ new Map();
1593
+ selectedOutcomes.forEach(({ venue, outcome }) => {
1594
+ var _a;
1595
+ if (!venueMarketOutcomeIdsByVenue.has(venue)) {
1596
+ venueMarketOutcomeIdsByVenue.set(venue, []);
1597
+ }
1598
+ (_a = venueMarketOutcomeIdsByVenue.get(venue)) == null ? void 0 : _a.push(outcome.id);
1599
+ });
1600
+ return [...venueMarketOutcomeIdsByVenue.entries()].map(([venue, venueMarketOutcomeIds]) => ({
1601
+ venue,
1602
+ venueMarketOutcomeIds
1603
+ })).filter((group) => group.venueMarketOutcomeIds.length > 0);
1604
+ };
1605
+ var resolveSeriesColor = (venue, index) => {
1606
+ var _a;
1607
+ const colorFromVenue = lineColorByVenue[venue];
1608
+ if (colorFromVenue)
1609
+ return colorFromVenue;
1610
+ return (_a = fallbackLineColors[index % fallbackLineColors.length]) != null ? _a : "#2e5cff";
1611
+ };
1612
+
1613
+ // src/events/item-details/index.tsx
1614
+ var import_jsx_runtime20 = require("react/jsx-runtime");
1615
+ var EventListItemDetailsLoadingState = ({
1616
+ classNames,
1617
+ ariaLabel
1618
+ }) => {
1619
+ const labels = (0, import_hooks12.useLabels)();
1620
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1621
+ Skeleton,
1622
+ {
1623
+ view: "event-list-item-details",
1624
+ className: classNames == null ? void 0 : classNames.root,
1625
+ ariaLabel: ariaLabel != null ? ariaLabel : labels.eventItemDetails.loading
1626
+ }
1627
+ );
1628
+ };
1629
+ var EventListItemDetailsUnavailableState = ({
1630
+ classNames,
1631
+ ariaLabel
1632
+ }) => {
1633
+ const labels = (0, import_hooks12.useLabels)();
1634
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1635
+ Card,
1636
+ {
1637
+ className: cn(detailsBaseCardClassName, classNames == null ? void 0 : classNames.root),
1638
+ role: "status",
1639
+ "aria-label": ariaLabel != null ? ariaLabel : labels.eventItemDetails.unavailableAria,
1640
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: cn("flex flex-col gap-1", classNames == null ? void 0 : classNames.header), children: [
1641
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Typography, { variant: "title", className: cn("truncate", classNames == null ? void 0 : classNames.title), children: labels.eventItemDetails.unavailableTitle }),
1642
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Typography, { variant: "body", className: "text-agg-muted-foreground", children: labels.eventItemDetails.unavailableDescription })
1643
+ ] })
1644
+ }
1645
+ );
1646
+ };
1647
+ var EventListItemDetailsGraphSection = ({
1648
+ venueMarkets,
1649
+ outcomeLabels,
1650
+ selectedOutcomeLabel,
1651
+ onSelectedOutcomeLabelChange,
1652
+ probabilityByLabel,
1653
+ switchLabels,
1654
+ isDateOutcomeMarket,
1655
+ classNames,
1656
+ showVenueLogo,
1657
+ venueInfo,
1658
+ formatPercent,
1659
+ selectedTimeRange
1660
+ }) => {
1661
+ const labels = (0, import_hooks12.useLabels)();
1662
+ const isLocalOutcomeSelection = !isDateOutcomeMarket && outcomeLabels.length === 2;
1663
+ const [internalSelectedOutcomeLabel, setInternalSelectedOutcomeLabel] = (0, import_react3.useState)(selectedOutcomeLabel);
1664
+ const [selectedBinaryOutcome, setSelectedBinaryOutcome] = (0, import_react3.useState)("Yes");
1665
+ (0, import_react3.useEffect)(() => {
1666
+ setInternalSelectedOutcomeLabel(selectedOutcomeLabel);
1667
+ }, [selectedOutcomeLabel]);
1668
+ const resolvedSelectedOutcomeLabel = isLocalOutcomeSelection ? internalSelectedOutcomeLabel : selectedOutcomeLabel;
1669
+ const selectedOutcomesByVenue = (0, import_react3.useMemo)(() => {
1670
+ return resolveOutcomesByVenue(venueMarkets, resolvedSelectedOutcomeLabel);
1671
+ }, [resolvedSelectedOutcomeLabel, venueMarkets]);
1672
+ const segmentedDisplayItems = (0, import_react3.useMemo)(() => {
1673
+ var _a;
1674
+ if (isDateOutcomeMarket) {
1675
+ const selectedOutcomeAverageProbability = (_a = probabilityByLabel.get(resolvedSelectedOutcomeLabel)) != null ? _a : 0;
1676
+ const noProbability = Math.max(0, 1 - selectedOutcomeAverageProbability);
1677
+ return [
1678
+ {
1679
+ label: labels.eventItemDetails.yes,
1680
+ display: `${labels.eventItemDetails.yes} ${formatPercent(selectedOutcomeAverageProbability)}`,
1681
+ isActive: selectedBinaryOutcome === "Yes",
1682
+ onSelect: () => setSelectedBinaryOutcome("Yes")
1683
+ },
1684
+ {
1685
+ label: labels.eventItemDetails.no,
1686
+ display: `${labels.eventItemDetails.no} ${formatPercent(noProbability)}`,
1687
+ isActive: selectedBinaryOutcome === "No",
1688
+ onSelect: () => setSelectedBinaryOutcome("No")
1689
+ }
1690
+ ];
1691
+ }
1692
+ return switchLabels.map((label) => {
1693
+ const probability = probabilityByLabel.get(label);
1694
+ const probabilitySuffix = probability == null ? "" : ` ${formatPercent(probability)}`;
1695
+ return {
1696
+ label,
1697
+ display: `${label}${probabilitySuffix}`,
1698
+ isActive: resolvedSelectedOutcomeLabel === label,
1699
+ onSelect: () => {
1700
+ if (isLocalOutcomeSelection) {
1701
+ setInternalSelectedOutcomeLabel(label);
1702
+ return;
1703
+ }
1704
+ onSelectedOutcomeLabelChange(label);
1705
+ }
1706
+ };
1707
+ });
1708
+ }, [
1709
+ formatPercent,
1710
+ isDateOutcomeMarket,
1711
+ isLocalOutcomeSelection,
1712
+ onSelectedOutcomeLabelChange,
1713
+ probabilityByLabel,
1714
+ resolvedSelectedOutcomeLabel,
1715
+ selectedBinaryOutcome,
1716
+ switchLabels
1717
+ ]);
1718
+ const priceHistoryGroups = (0, import_react3.useMemo)(() => {
1719
+ return buildPriceHistoryGroups(selectedOutcomesByVenue);
1720
+ }, [selectedOutcomesByVenue]);
1721
+ const timeWindow = (0, import_react3.useMemo)(() => {
1722
+ return getTimeWindowByRange(selectedTimeRange);
1723
+ }, [selectedTimeRange]);
1724
+ const { data: priceHistoryData, isLoading: isPriceHistoryLoading } = (0, import_hooks12.usePriceHistory)(__spreadProps(__spreadValues({
1725
+ groups: priceHistoryGroups
1726
+ }, timeWindow), {
1727
+ enabled: priceHistoryGroups.length > 0
1728
+ }));
1729
+ const chartSeries = (0, import_react3.useMemo)(() => {
1730
+ if (!(priceHistoryData == null ? void 0 : priceHistoryData.length))
1731
+ return [];
1732
+ return priceHistoryData.map((history, index) => {
1733
+ var _a, _b;
1734
+ const matchingOutcomeByVenue = (_a = selectedOutcomesByVenue.find((item) => {
1735
+ return item.outcome.id === history.marketId || item.outcome.externalIdentifier === history.marketId || item.market.externalIdentifier === history.marketId;
1736
+ })) != null ? _a : selectedOutcomesByVenue.find((item) => item.venue === history.venue);
1737
+ const color = resolveSeriesColor((_b = matchingOutcomeByVenue == null ? void 0 : matchingOutcomeByVenue.venue) != null ? _b : history.venue, index);
1738
+ return {
1739
+ id: `${history.venue}-${history.marketId}-${index}`,
1740
+ color,
1741
+ points: history.points.map((point) => ({
1742
+ time: point.timestamp,
1743
+ value: point.price * 100
1744
+ }))
1745
+ };
1746
+ }).filter((seriesItem) => seriesItem.points.length > 0);
1747
+ }, [priceHistoryData, selectedOutcomesByVenue]);
1748
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1749
+ LineChart,
1750
+ {
1751
+ classNames: { root: classNames == null ? void 0 : classNames.chart },
1752
+ series: chartSeries,
1753
+ height: 300,
1754
+ isLoading: isPriceHistoryLoading,
1755
+ showSeriesControls: selectedOutcomesByVenue.length > 0 || segmentedDisplayItems.length > 0,
1756
+ renderSeriesControls: () => {
1757
+ var _a, _b, _c, _d;
1758
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
1759
+ "div",
1760
+ {
1761
+ className: cn("flex flex-row items-center justify-between gap-4", classNames == null ? void 0 : classNames.summary),
1762
+ children: [
1763
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1764
+ "div",
1765
+ {
1766
+ className: cn(
1767
+ "flex min-w-0 gap-2 overflow-x-auto pb-1 md:flex-wrap md:overflow-visible md:pb-0",
1768
+ classNames == null ? void 0 : classNames.outcomeBadges
1769
+ ),
1770
+ children: selectedOutcomesByVenue.map((outcomeByVenue) => {
1771
+ var _a2;
1772
+ const probability = normalizeProbability(outcomeByVenue.outcome.price);
1773
+ const text = probability == null ? "-" : formatPercent(probability);
1774
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1775
+ Badge,
1776
+ {
1777
+ text,
1778
+ size: "l",
1779
+ prefix: showVenueLogo ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1780
+ VenueLogo,
1781
+ {
1782
+ venue: outcomeByVenue.venue,
1783
+ size: "s",
1784
+ title: (_a2 = venueInfo == null ? void 0 : venueInfo[outcomeByVenue.venue]) == null ? void 0 : _a2.label
1785
+ }
1786
+ ) : void 0,
1787
+ classNames: {
1788
+ root: "h-9 shrink-0 bg-agg-secondary-hover px-4 text-agg-base leading-agg-6"
1789
+ }
1790
+ },
1791
+ `${outcomeByVenue.market.id}-${outcomeByVenue.outcome.id}`
1792
+ );
1793
+ })
1794
+ }
1795
+ ),
1796
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1797
+ SwitchButton,
1798
+ {
1799
+ ariaLabel: labels.eventItemDetails.outcomeSelectorAria,
1800
+ className: cn("w-full md:w-fit", classNames == null ? void 0 : classNames.segmentedControl),
1801
+ value: (_d = (_c = (_a = segmentedDisplayItems.find((item) => item.isActive)) == null ? void 0 : _a.label) != null ? _c : (_b = segmentedDisplayItems[0]) == null ? void 0 : _b.label) != null ? _d : "",
1802
+ onValueChange: (nextValue) => {
1803
+ var _a2;
1804
+ (_a2 = segmentedDisplayItems.find((item) => item.label === nextValue)) == null ? void 0 : _a2.onSelect();
1805
+ },
1806
+ options: segmentedDisplayItems.map((segmentedItem) => ({
1807
+ value: segmentedItem.label,
1808
+ label: segmentedItem.display,
1809
+ ariaLabel: segmentedItem.display
1810
+ }))
1811
+ }
1812
+ )
1813
+ ]
1814
+ }
1815
+ );
1816
+ }
1817
+ }
1818
+ );
1819
+ };
1820
+ var EventListItemDetailsContent = ({
1821
+ event,
1822
+ title,
1823
+ image,
1824
+ showVenueLogo = true,
1825
+ classNames,
1826
+ venueInfo,
1827
+ detailsStats,
1828
+ ariaLabel,
1829
+ defaultTimeRange
1830
+ }) => {
1831
+ const config = (0, import_hooks12.useSdkUiConfig)();
1832
+ const labels = (0, import_hooks12.useLabels)();
1833
+ const venueMarkets = (0, import_react3.useMemo)(() => {
1834
+ var _a, _b, _c;
1835
+ return (_c = (_b = (_a = event.markets) == null ? void 0 : _a[0]) == null ? void 0 : _b.venueMarkets) != null ? _c : [];
1836
+ }, [event.markets]);
1837
+ const primaryVenueMarket = (0, import_react3.useMemo)(() => {
1838
+ return selectPrimaryVenueMarket(venueMarkets);
1839
+ }, [venueMarkets]);
1840
+ const outcomeLabels = (0, import_react3.useMemo)(() => {
1841
+ return resolveOutcomeLabels(venueMarkets);
1842
+ }, [venueMarkets]);
1843
+ const [selectedOutcomeLabel, setSelectedOutcomeLabel] = (0, import_react3.useState)(() => {
1844
+ return resolveDefaultOutcomeLabel(outcomeLabels);
1845
+ });
1846
+ const [selectedTimeRange, setSelectedTimeRange] = (0, import_react3.useState)(() => {
1847
+ return getDefaultSelectedTimeRange(defaultTimeRange);
1848
+ });
1849
+ (0, import_react3.useEffect)(() => {
1850
+ setSelectedTimeRange(getDefaultSelectedTimeRange(defaultTimeRange));
1851
+ }, [defaultTimeRange]);
1852
+ const resolvedTitle = resolveTileTitle(event, primaryVenueMarket, title);
1853
+ const resolvedImage = resolveTileImage(event, primaryVenueMarket, image);
1854
+ const isDateOutcomeMarket = outcomeLabels.length > 2 && outcomeLabels.every(isDateLikeLabel);
1855
+ const outcomeSelectorLabels = outcomeLabels;
1856
+ const probabilityByLabel = (0, import_react3.useMemo)(() => {
1857
+ return new Map(
1858
+ outcomeLabels.map((label) => {
1859
+ const outcomesByVenue = resolveOutcomesByVenue(venueMarkets, label);
1860
+ const probabilities = outcomesByVenue.map((item) => normalizeProbability(item.outcome.price)).filter((value) => value != null);
1861
+ if (probabilities.length === 0) {
1862
+ return [label, void 0];
1863
+ }
1864
+ const averageProbability = probabilities.reduce((sum, value) => sum + value, 0) / probabilities.length;
1865
+ return [label, averageProbability];
1866
+ })
1867
+ );
1868
+ }, [outcomeLabels, venueMarkets]);
1869
+ const mainOutcomeLabel = (0, import_react3.useMemo)(() => {
1870
+ if (outcomeLabels.length === 0)
1871
+ return void 0;
1872
+ return [...outcomeLabels].sort((left, right) => {
1873
+ var _a, _b;
1874
+ const leftProbability = (_a = probabilityByLabel.get(left)) != null ? _a : -1;
1875
+ const rightProbability = (_b = probabilityByLabel.get(right)) != null ? _b : -1;
1876
+ return rightProbability - leftProbability;
1877
+ })[0];
1878
+ }, [outcomeLabels, probabilityByLabel]);
1879
+ (0, import_react3.useEffect)(() => {
1880
+ if (!outcomeLabels.length) {
1881
+ setSelectedOutcomeLabel(void 0);
1882
+ return;
1883
+ }
1884
+ if (selectedOutcomeLabel && outcomeLabels.includes(selectedOutcomeLabel)) {
1885
+ return;
1886
+ }
1887
+ const fallbackOutcomeLabel = isDateOutcomeMarket ? resolveDefaultOutcomeLabel(outcomeLabels) : mainOutcomeLabel != null ? mainOutcomeLabel : resolveDefaultOutcomeLabel(outcomeLabels);
1888
+ setSelectedOutcomeLabel(fallbackOutcomeLabel);
1889
+ }, [isDateOutcomeMarket, mainOutcomeLabel, outcomeLabels, selectedOutcomeLabel]);
1890
+ const switchLabels = (0, import_react3.useMemo)(() => {
1891
+ var _a, _b;
1892
+ if (isDateOutcomeMarket) {
1893
+ return [labels.eventItemDetails.yes, labels.eventItemDetails.no];
1894
+ }
1895
+ const sortedOutcomeLabels = [...outcomeLabels].sort((left, right) => {
1896
+ var _a2, _b2;
1897
+ const leftProbability = (_a2 = probabilityByLabel.get(left)) != null ? _a2 : -1;
1898
+ const rightProbability = (_b2 = probabilityByLabel.get(right)) != null ? _b2 : -1;
1899
+ return rightProbability - leftProbability;
1900
+ });
1901
+ const firstLabel = (_a = sortedOutcomeLabels[0]) != null ? _a : labels.eventItemDetails.yes;
1902
+ const secondLabel = (_b = sortedOutcomeLabels.find((label) => label !== firstLabel)) != null ? _b : firstLabel;
1903
+ return [firstLabel, secondLabel];
1904
+ }, [
1905
+ isDateOutcomeMarket,
1906
+ labels.eventItemDetails.no,
1907
+ labels.eventItemDetails.yes,
1908
+ outcomeLabels,
1909
+ probabilityByLabel
1910
+ ]);
1911
+ const volumeLabel = (0, import_react3.useMemo)(() => {
1912
+ var _a;
1913
+ const resolvedVolume = typeof event.volume === "number" ? event.volume : (_a = primaryVenueMarket == null ? void 0 : primaryVenueMarket.volume) != null ? _a : void 0;
1914
+ if (typeof resolvedVolume !== "number")
1915
+ return "";
1916
+ return `${config.formatCompactCurrency(resolvedVolume)} ${labels.eventItemDetails.volumeSuffix}`;
1917
+ }, [config, event.volume, labels.eventItemDetails.volumeSuffix, primaryVenueMarket == null ? void 0 : primaryVenueMarket.volume]);
1918
+ if (!primaryVenueMarket || !selectedOutcomeLabel) {
1919
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(EventListItemDetailsUnavailableState, { classNames, ariaLabel });
1920
+ }
1921
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
1922
+ Card,
1923
+ {
1924
+ className: cn(detailsBaseCardClassName, classNames == null ? void 0 : classNames.root),
1925
+ "aria-label": ariaLabel != null ? ariaLabel : resolvedTitle,
1926
+ children: [
1927
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: cn("flex items-start gap-3 md:gap-4", classNames == null ? void 0 : classNames.header), children: [
1928
+ resolvedImage ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1929
+ "img",
1930
+ {
1931
+ src: resolvedImage,
1932
+ alt: "",
1933
+ className: "size-10 rounded-agg-lg object-cover md:size-[60px]"
1934
+ }
1935
+ ) : null,
1936
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-3", children: [
1937
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1938
+ Typography,
1939
+ {
1940
+ variant: "value",
1941
+ className: cn(
1942
+ "min-w-0 text-agg-base font-agg-bold leading-agg-6 whitespace-normal [display:-webkit-box] [-webkit-box-orient:vertical] [-webkit-line-clamp:2] md:text-agg-2xl md:leading-agg-8 md:[display:block] md:truncate md:whitespace-nowrap",
1943
+ classNames == null ? void 0 : classNames.title
1944
+ ),
1945
+ children: resolvedTitle
1946
+ }
1947
+ ),
1948
+ outcomeSelectorLabels.length > 2 ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1949
+ "div",
1950
+ {
1951
+ className: cn(
1952
+ "flex items-center gap-2 overflow-x-auto pb-1 md:flex-wrap md:overflow-visible md:pb-0",
1953
+ classNames == null ? void 0 : classNames.headerPills
1954
+ ),
1955
+ children: outcomeSelectorLabels.map((outcomeSelectorLabel) => {
1956
+ const isActive = outcomeSelectorLabel === selectedOutcomeLabel;
1957
+ const displayLabel = isDateLikeLabel(outcomeSelectorLabel) ? formatDateLabel(outcomeSelectorLabel) : outcomeSelectorLabel;
1958
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1959
+ Button,
1960
+ {
1961
+ size: "s",
1962
+ variant: "secondary",
1963
+ "aria-pressed": isActive,
1964
+ className: cn(
1965
+ "h-auto shrink-0 rounded-agg-full px-4 py-1.5 text-agg-sm leading-agg-5",
1966
+ "border-2",
1967
+ isActive ? "border-agg-primary bg-agg-secondary text-agg-foreground font-agg-bold" : "border-transparent bg-agg-secondary-hover text-agg-foreground font-agg-normal"
1968
+ ),
1969
+ onClick: () => setSelectedOutcomeLabel(outcomeSelectorLabel),
1970
+ children: displayLabel
1971
+ },
1972
+ outcomeSelectorLabel
1973
+ );
1974
+ })
1975
+ }
1976
+ ) : null
1977
+ ] })
1978
+ ] }),
1979
+ detailsStats && detailsStats.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn("flex flex-wrap items-start gap-4 md:gap-6", classNames == null ? void 0 : classNames.headerStats), children: detailsStats.map((statItem) => {
1980
+ const deltaClassName = statItem.deltaTone === "positive" ? "text-agg-success" : statItem.deltaTone === "negative" ? "text-agg-error" : "text-agg-muted-foreground";
1981
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-1", children: [
1982
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1983
+ Typography,
1984
+ {
1985
+ variant: "label",
1986
+ className: "text-agg-xs leading-agg-4 tracking-agg-normal text-agg-muted-foreground",
1987
+ children: statItem.label
1988
+ }
1989
+ ),
1990
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-baseline gap-1", children: [
1991
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1992
+ Typography,
1993
+ {
1994
+ variant: "body",
1995
+ className: "text-agg-lg leading-agg-7 text-agg-foreground",
1996
+ children: statItem.value
1997
+ }
1998
+ ),
1999
+ statItem.delta ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2000
+ Typography,
2001
+ {
2002
+ variant: "meta",
2003
+ className: cn("text-agg-sm leading-agg-5", deltaClassName),
2004
+ children: statItem.delta
2005
+ }
2006
+ ) : null
2007
+ ] })
2008
+ ] }, `${statItem.label}-${statItem.value}`);
2009
+ }) }) : null,
2010
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2011
+ EventListItemDetailsGraphSection,
2012
+ {
2013
+ venueMarkets,
2014
+ outcomeLabels,
2015
+ selectedOutcomeLabel,
2016
+ onSelectedOutcomeLabelChange: setSelectedOutcomeLabel,
2017
+ probabilityByLabel,
2018
+ switchLabels,
2019
+ isDateOutcomeMarket,
2020
+ classNames,
2021
+ showVenueLogo,
2022
+ venueInfo,
2023
+ formatPercent: config.formatPercent,
2024
+ selectedTimeRange
2025
+ }
2026
+ ),
2027
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: cn("flex flex-wrap items-center justify-between gap-4", classNames == null ? void 0 : classNames.footer), children: [
2028
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Typography, { variant: "meta", className: "text-agg-muted-foreground text-agg-sm leading-agg-5", children: volumeLabel || "-" }),
2029
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn("flex items-center gap-2 md:gap-3", classNames == null ? void 0 : classNames.timeRange), children: eventListItemDetailsTimeRanges.map((timeRange) => {
2030
+ const isActive = timeRange === selectedTimeRange;
2031
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2032
+ Button,
2033
+ {
2034
+ size: "xs",
2035
+ variant: "tertiary",
2036
+ className: cn(
2037
+ "h-auto min-w-0 rounded-none px-0 py-0 text-agg-xs leading-agg-4 md:text-agg-sm md:leading-agg-5",
2038
+ "border-0 bg-transparent shadow-none",
2039
+ isActive ? "font-agg-bold text-agg-foreground" : "font-agg-normal text-agg-muted-foreground"
2040
+ ),
2041
+ "aria-pressed": isActive,
2042
+ onClick: () => setSelectedTimeRange(timeRange),
2043
+ children: timeRange === "ALL" ? labels.eventItemDetails.allTimeRange : timeRange
2044
+ },
2045
+ timeRange
2046
+ );
2047
+ }) })
2048
+ ] })
2049
+ ]
2050
+ }
2051
+ );
2052
+ };
2053
+ var EventListItemDetailsByEventId = (_a) => {
2054
+ var _b = _a, {
2055
+ eventId
2056
+ } = _b, rest = __objRest(_b, [
2057
+ "eventId"
2058
+ ]);
2059
+ const {
2060
+ event: fetchedEvent,
2061
+ isError,
2062
+ isLoading
2063
+ } = (0, import_hooks12.useEvent)(eventId, {
2064
+ enabled: !!eventId
2065
+ });
2066
+ const resolvedEvent = (0, import_react3.useMemo)(() => {
2067
+ return resolveEventListItemEvent(fetchedEvent);
2068
+ }, [fetchedEvent]);
2069
+ if (!eventId) {
2070
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2071
+ EventListItemDetailsUnavailableState,
2072
+ {
2073
+ classNames: rest.classNames,
2074
+ ariaLabel: rest.ariaLabel
2075
+ }
2076
+ );
2077
+ }
2078
+ if (isLoading) {
2079
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(EventListItemDetailsLoadingState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
2080
+ }
2081
+ if (!resolvedEvent && !isError) {
2082
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(EventListItemDetailsLoadingState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
2083
+ }
2084
+ if (!resolvedEvent) {
2085
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2086
+ EventListItemDetailsUnavailableState,
2087
+ {
2088
+ classNames: rest.classNames,
2089
+ ariaLabel: rest.ariaLabel
2090
+ }
2091
+ );
2092
+ }
2093
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(EventListItemDetailsContent, __spreadValues({ event: resolvedEvent }, rest));
2094
+ };
2095
+ var EventListItemDetails = (props) => {
2096
+ if (props.isLoading) {
2097
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(EventListItemDetailsLoadingState, { classNames: props.classNames, ariaLabel: props.ariaLabel });
2098
+ }
2099
+ if ("event" in props && props.event) {
2100
+ const _a = props, { event } = _a, rest = __objRest(_a, ["event"]);
2101
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(EventListItemDetailsContent, __spreadValues({ event }, rest));
2102
+ }
2103
+ if ("eventId" in props && typeof props.eventId === "string") {
2104
+ const {
2105
+ title: titleOverride,
2106
+ image: imageOverride,
2107
+ showVenueLogo: showVenueLogoOverride,
2108
+ classNames,
2109
+ venueInfo,
2110
+ detailsStats,
2111
+ ariaLabel: ariaLabelOverride,
2112
+ defaultTimeRange: defaultTimeRangeOverride
2113
+ } = props;
2114
+ const byEventIdProps = {
2115
+ eventId: props.eventId,
2116
+ isLoading: false,
2117
+ title: titleOverride,
2118
+ image: imageOverride,
2119
+ showVenueLogo: showVenueLogoOverride,
2120
+ classNames,
2121
+ venueInfo,
2122
+ detailsStats,
2123
+ ariaLabel: ariaLabelOverride,
2124
+ defaultTimeRange: defaultTimeRangeOverride
2125
+ };
2126
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(EventListItemDetailsByEventId, __spreadValues({}, byEventIdProps));
2127
+ }
2128
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2129
+ EventListItemDetailsUnavailableState,
2130
+ {
2131
+ classNames: props.classNames,
2132
+ ariaLabel: props.ariaLabel
2133
+ }
2134
+ );
2135
+ };
2136
+ EventListItemDetails.displayName = "EventListItemDetails";
2137
+ // Annotate the CommonJS export names for ESM import in node:
2138
+ 0 && (module.exports = {
2139
+ EventListItemDetails
2140
+ });