@therealtinhtute/baroiplayer 1.2.0 → 1.2.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 (97) hide show
  1. package/README.md +1 -2
  2. package/dist/context/media.js +1 -2
  3. package/dist/context/media.mjs +3 -15
  4. package/dist/context/store.js +1 -2
  5. package/dist/context/store.mjs +3 -5
  6. package/dist/context-Bzd5QCKM.cjs +7 -0
  7. package/dist/context-Bzd5QCKM.cjs.map +1 -0
  8. package/dist/context-DD_SH4tT.js +1053 -0
  9. package/dist/context-DD_SH4tT.js.map +1 -0
  10. package/dist/core-events-BRnLMB7s.cjs +2 -0
  11. package/dist/core-events-BRnLMB7s.cjs.map +1 -0
  12. package/dist/core-events-v_mKdj5p.js +417 -0
  13. package/dist/core-events-v_mKdj5p.js.map +1 -0
  14. package/dist/core-plugins-CMBv-yVh.cjs +2 -0
  15. package/dist/core-plugins-CMBv-yVh.cjs.map +1 -0
  16. package/dist/core-plugins-CqCxLkbd.js +754 -0
  17. package/dist/core-plugins-CqCxLkbd.js.map +1 -0
  18. package/dist/core.js +7 -29
  19. package/dist/core.js.map +1 -1
  20. package/dist/core.mjs +947 -1220
  21. package/dist/core.mjs.map +1 -1
  22. package/dist/enhanced-components-BwjBqSA1.js +2858 -0
  23. package/dist/enhanced-components-BwjBqSA1.js.map +1 -0
  24. package/dist/enhanced-components-C-ka-XLp.cjs +2 -0
  25. package/dist/enhanced-components-C-ka-XLp.cjs.map +1 -0
  26. package/dist/hooks-B-IIWPJr.js +1842 -0
  27. package/dist/hooks-B-IIWPJr.js.map +1 -0
  28. package/dist/hooks-DcHzmBwA.cjs +4 -0
  29. package/dist/hooks-DcHzmBwA.cjs.map +1 -0
  30. package/dist/index.js +27 -97
  31. package/dist/index.js.map +1 -1
  32. package/dist/index.mjs +5613 -6208
  33. package/dist/index.mjs.map +1 -1
  34. package/dist/minimal-components-BYsMQde5.js +1610 -0
  35. package/dist/minimal-components-BYsMQde5.js.map +1 -0
  36. package/dist/minimal-components-CsxQbDp7.cjs +2 -0
  37. package/dist/minimal-components-CsxQbDp7.cjs.map +1 -0
  38. package/dist/performance-monitor-DCSijLJg.js +312 -0
  39. package/dist/performance-monitor-DCSijLJg.js.map +1 -0
  40. package/dist/performance-monitor-wNFKmqMr.cjs +2 -0
  41. package/dist/performance-monitor-wNFKmqMr.cjs.map +1 -0
  42. package/dist/rolldown-runtime-BmowowmI.js +14 -0
  43. package/dist/rolldown-runtime-mLOUI7ql.cjs +1 -0
  44. package/dist/utils-D2gQ7c2R.js +64 -0
  45. package/dist/utils-D2gQ7c2R.js.map +1 -0
  46. package/dist/utils-DJaAwiZ9.cjs +2 -0
  47. package/dist/utils-DJaAwiZ9.cjs.map +1 -0
  48. package/dist/utils.js +1 -2
  49. package/dist/utils.mjs +3 -11
  50. package/package.json +28 -22
  51. package/src/components/AnimateLoading.tsx +14 -10
  52. package/src/components/examples/loading-states-demo.tsx +1 -2
  53. package/src/components/examples/react-19-demo.tsx +6 -10
  54. package/src/components/examples/volume-orientation-demo.tsx +1 -2
  55. package/src/components/ui/blur-poster.tsx +18 -15
  56. package/src/components/variants/minimal/components/VideoElement.tsx +3 -1
  57. package/src/core/performance/media-loading-optimizer.ts +2 -1
  58. package/src/hooks/useScreenshot.ts +60 -44
  59. package/src/types/assets.d.ts +29 -0
  60. package/dist/context/media.js.map +0 -1
  61. package/dist/context/media.mjs.map +0 -1
  62. package/dist/context/store.js.map +0 -1
  63. package/dist/context/store.mjs.map +0 -1
  64. package/dist/context-BYwDoSRX.js +0 -1172
  65. package/dist/context-BYwDoSRX.js.map +0 -1
  66. package/dist/context-eNS62_ac.cjs +0 -23
  67. package/dist/context-eNS62_ac.cjs.map +0 -1
  68. package/dist/core-events-B1iM2F46.cjs +0 -2
  69. package/dist/core-events-B1iM2F46.cjs.map +0 -1
  70. package/dist/core-events-DunPHKRE.js +0 -484
  71. package/dist/core-events-DunPHKRE.js.map +0 -1
  72. package/dist/core-plugins-By-4-kGs.cjs +0 -2
  73. package/dist/core-plugins-By-4-kGs.cjs.map +0 -1
  74. package/dist/core-plugins-DSBWcTuX.js +0 -821
  75. package/dist/core-plugins-DSBWcTuX.js.map +0 -1
  76. package/dist/enhanced-components-B_l3cist.js +0 -1142
  77. package/dist/enhanced-components-B_l3cist.js.map +0 -1
  78. package/dist/enhanced-components-BspFs9OO.cjs +0 -2
  79. package/dist/enhanced-components-BspFs9OO.cjs.map +0 -1
  80. package/dist/hooks-BXwI8QG6.cjs +0 -4
  81. package/dist/hooks-BXwI8QG6.cjs.map +0 -1
  82. package/dist/hooks-Bpi-jDiO.js +0 -1816
  83. package/dist/hooks-Bpi-jDiO.js.map +0 -1
  84. package/dist/minimal-components-C4z900Ro.js +0 -1926
  85. package/dist/minimal-components-C4z900Ro.js.map +0 -1
  86. package/dist/minimal-components-v4qBp6jv.cjs +0 -2
  87. package/dist/minimal-components-v4qBp6jv.cjs.map +0 -1
  88. package/dist/performance-monitor-C5k6FDXw.js +0 -301
  89. package/dist/performance-monitor-C5k6FDXw.js.map +0 -1
  90. package/dist/performance-monitor-lJmuUjQQ.cjs +0 -2
  91. package/dist/performance-monitor-lJmuUjQQ.cjs.map +0 -1
  92. package/dist/utils-CFOue_9K.cjs +0 -9
  93. package/dist/utils-CFOue_9K.cjs.map +0 -1
  94. package/dist/utils-Dzpl2ArK.js +0 -2844
  95. package/dist/utils-Dzpl2ArK.js.map +0 -1
  96. package/dist/utils.js.map +0 -1
  97. package/dist/utils.mjs.map +0 -1
@@ -0,0 +1,312 @@
1
+ import { i as e, r as t } from "./context-DD_SH4tT.js";
2
+ import { useCallback as n, useEffect as r, useRef as i, useState as a } from "react";
3
+ //#region src/core/performance/performance-monitor.tsx
4
+ var o = e(), s = {
5
+ lcp: {
6
+ good: 2500,
7
+ poor: 4e3
8
+ },
9
+ fid: {
10
+ good: 100,
11
+ poor: 300
12
+ },
13
+ cls: {
14
+ good: .1,
15
+ poor: .25
16
+ },
17
+ renderTime: {
18
+ good: 16,
19
+ poor: 100
20
+ },
21
+ memoryUsage: {
22
+ good: 50 * 1024 * 1024,
23
+ poor: 100 * 1024 * 1024
24
+ }
25
+ }, c = class {
26
+ constructor(e = s) {
27
+ t(this, "metrics", []), t(this, "listeners", /* @__PURE__ */ new Set()), t(this, "thresholds", void 0), t(this, "observer", void 0), t(this, "isMonitoring", !1), this.thresholds = e, this.initializeWebVitals(), this.initializePerformanceObserver();
28
+ }
29
+ async initializeWebVitals() {
30
+ if (!(typeof window > "u")) try {
31
+ let e = await import("web-vitals").catch(() => null);
32
+ if (!e) {
33
+ console.warn("web-vitals package not available, Core Web Vitals tracking disabled");
34
+ return;
35
+ }
36
+ let t = (e) => {
37
+ this.updateMetric(e.name.toLowerCase(), e.value);
38
+ }, n = e;
39
+ n.getCLS && n.getCLS(t), n.getFID && n.getFID(t), n.getFCP && n.getFCP(t), n.getLCP && n.getLCP(t), n.getTTFB && n.getTTFB(t), n.onINP && n.onINP(t);
40
+ } catch (e) {
41
+ console.warn("Web Vitals initialization failed:", e);
42
+ }
43
+ }
44
+ initializePerformanceObserver() {
45
+ if (!(typeof window > "u" || !("PerformanceObserver" in window))) try {
46
+ this.observer = new PerformanceObserver((e) => {
47
+ for (let t of e.getEntries()) this.handlePerformanceEntry(t);
48
+ }), this.observer.observe({ entryTypes: [
49
+ "measure",
50
+ "navigation",
51
+ "resource",
52
+ "paint"
53
+ ] });
54
+ } catch (e) {
55
+ console.warn("PerformanceObserver not supported:", e);
56
+ }
57
+ }
58
+ handlePerformanceEntry(e) {
59
+ switch (e.entryType) {
60
+ case "measure":
61
+ e.name.startsWith("baroiplayer-render") && this.updateMetric("componentRenderTime", e.duration);
62
+ break;
63
+ case "resource":
64
+ (e.name.includes(".js") || e.name.includes(".css")) && this.updateMetric("bundleLoadTime", e.duration);
65
+ break;
66
+ case "paint":
67
+ e.name === "first-contentful-paint" && this.updateMetric("fcp", e.startTime);
68
+ break;
69
+ }
70
+ }
71
+ updateMetric(e, t) {
72
+ let n = this.getCurrentMetrics(), r = {
73
+ ...n,
74
+ [e]: t,
75
+ timestamp: Date.now(),
76
+ performanceScore: this.calculatePerformanceScore({
77
+ ...n,
78
+ [e]: t
79
+ })
80
+ };
81
+ this.metrics.push(r), this.metrics.length > 100 && (this.metrics = this.metrics.slice(-100)), this.listeners.forEach((e) => e(r));
82
+ }
83
+ getCurrentMetrics() {
84
+ return this.metrics[this.metrics.length - 1] || {
85
+ componentRenderTime: 0,
86
+ bundleLoadTime: 0,
87
+ mediaLoadTime: 0,
88
+ memoryUsage: this.getMemoryUsage(),
89
+ performanceScore: 0,
90
+ timestamp: Date.now()
91
+ };
92
+ }
93
+ getMemoryUsage() {
94
+ return "memory" in performance && performance.memory.usedJSHeapSize || 0;
95
+ }
96
+ calculatePerformanceScore(e) {
97
+ let t = 100;
98
+ return e.lcp && e.lcp > this.thresholds.lcp.good && (t -= e.lcp > this.thresholds.lcp.poor ? 30 : 15), e.fid && e.fid > this.thresholds.fid.good && (t -= e.fid > this.thresholds.fid.poor ? 25 : 10), e.cls && e.cls > this.thresholds.cls.good && (t -= e.cls > this.thresholds.cls.poor ? 20 : 10), e.componentRenderTime > this.thresholds.renderTime.good && (t -= e.componentRenderTime > this.thresholds.renderTime.poor ? 20 : 10), e.memoryUsage > this.thresholds.memoryUsage.good && (t -= e.memoryUsage > this.thresholds.memoryUsage.poor ? 15 : 5), Math.max(0, t);
99
+ }
100
+ startMonitoring() {
101
+ this.isMonitoring = !0, this.startMemoryMonitoring();
102
+ }
103
+ stopMonitoring() {
104
+ this.isMonitoring = !1, this.observer && this.observer.disconnect();
105
+ }
106
+ startMemoryMonitoring() {
107
+ this.isMonitoring && (this.updateMetric("memoryUsage", this.getMemoryUsage()), setTimeout(() => this.startMemoryMonitoring(), 5e3));
108
+ }
109
+ measureComponentRender(e, t) {
110
+ let n = `baroiplayer-render-${e}-start`, r = `baroiplayer-render-${e}-end`, i = `baroiplayer-render-${e}`;
111
+ performance.mark(n);
112
+ let a = t();
113
+ performance.mark(r);
114
+ try {
115
+ performance.measure(i, n, r);
116
+ } catch (e) {
117
+ console.warn("Performance measurement failed:", e);
118
+ }
119
+ return a;
120
+ }
121
+ subscribe(e) {
122
+ return this.listeners.add(e), () => this.listeners.delete(e);
123
+ }
124
+ getLatestMetrics() {
125
+ return this.metrics[this.metrics.length - 1] || null;
126
+ }
127
+ getAllMetrics() {
128
+ return [...this.metrics];
129
+ }
130
+ getAverageMetrics(e = 10) {
131
+ let t = this.metrics.slice(-e);
132
+ if (t.length === 0) return {};
133
+ let n = {};
134
+ return [
135
+ "lcp",
136
+ "fid",
137
+ "cls",
138
+ "fcp",
139
+ "ttfb",
140
+ "inp",
141
+ "componentRenderTime",
142
+ "bundleLoadTime",
143
+ "mediaLoadTime",
144
+ "memoryUsage",
145
+ "performanceScore"
146
+ ].forEach((e) => {
147
+ let r = t.map((t) => t[e]).filter((e) => typeof e == "number" && !isNaN(e));
148
+ r.length > 0 && (n[e] = r.reduce((e, t) => e + t, 0) / r.length);
149
+ }), n;
150
+ }
151
+ getThresholds() {
152
+ return this.thresholds;
153
+ }
154
+ updateThresholds(e) {
155
+ this.thresholds = {
156
+ ...this.thresholds,
157
+ ...e
158
+ };
159
+ }
160
+ }, l = new c();
161
+ function u() {
162
+ let [e, t] = a(null), [i, o] = a(!0);
163
+ return r(() => {
164
+ if (o(typeof window < "u" && "performance" in window), !i) return;
165
+ l.startMonitoring();
166
+ let e = l.subscribe(t);
167
+ return () => {
168
+ e(), l.stopMonitoring();
169
+ };
170
+ }, [i]), {
171
+ metrics: e,
172
+ isSupported: i,
173
+ measureRender: n((e, t) => l.measureComponentRender(e, t), []),
174
+ averageMetrics: l.getAverageMetrics(),
175
+ allMetrics: l.getAllMetrics(),
176
+ thresholds: l.getThresholds()
177
+ };
178
+ }
179
+ function d(e, t) {
180
+ let n = t || e.displayName || e.name || "Component";
181
+ function s(t) {
182
+ let s = i(0), { measureRender: c } = u(), l = a(() => Math.random())[0];
183
+ return r(() => {
184
+ s.current += 1;
185
+ }), c(`${n}-${l}`, () => /* @__PURE__ */ (0, o.jsx)(e, { ...t }));
186
+ }
187
+ return s.displayName = `withPerformanceMonitoring(${n})`, s;
188
+ }
189
+ var f = class {
190
+ constructor() {
191
+ t(this, "baselineMetrics", null), t(this, "regressionThreshold", .2);
192
+ }
193
+ setBaseline(e) {
194
+ this.baselineMetrics = e;
195
+ }
196
+ detectRegression(e) {
197
+ if (!this.baselineMetrics) return [];
198
+ let t = [];
199
+ return [
200
+ "componentRenderTime",
201
+ "bundleLoadTime",
202
+ "mediaLoadTime",
203
+ "memoryUsage"
204
+ ].forEach((n) => {
205
+ let r = this.baselineMetrics[n], i = e[n];
206
+ if (r && i && r > 0) {
207
+ let e = (i - r) / r;
208
+ e > this.regressionThreshold && t.push({
209
+ metric: n,
210
+ baseline: r,
211
+ current: i,
212
+ degradation: e
213
+ });
214
+ }
215
+ }), t;
216
+ }
217
+ setRegressionThreshold(e) {
218
+ this.regressionThreshold = Math.max(0, Math.min(1, e));
219
+ }
220
+ };
221
+ function p({ className: e = "", showAdvanced: t = !1 }) {
222
+ let { metrics: n, averageMetrics: r, thresholds: i, isSupported: a } = u();
223
+ if (!a || !n) return /* @__PURE__ */ (0, o.jsx)("div", {
224
+ className: `performance-dashboard ${e}`,
225
+ children: /* @__PURE__ */ (0, o.jsx)("p", { children: "Performance monitoring not supported in this environment" })
226
+ });
227
+ let s = (e) => e >= 90 ? "text-green-600" : e >= 70 ? "text-yellow-600" : "text-red-600", c = (e) => `${(e / 1024 / 1024).toFixed(2)} MB`;
228
+ return /* @__PURE__ */ (0, o.jsxs)("div", {
229
+ className: `performance-dashboard rounded-lg bg-white p-4 shadow ${e}`,
230
+ children: [
231
+ /* @__PURE__ */ (0, o.jsx)("h3", {
232
+ className: "mb-4 font-semibold text-lg",
233
+ children: "Performance Dashboard"
234
+ }),
235
+ /* @__PURE__ */ (0, o.jsxs)("div", {
236
+ className: "mb-4",
237
+ children: [/* @__PURE__ */ (0, o.jsxs)("div", {
238
+ className: "flex items-center justify-between",
239
+ children: [/* @__PURE__ */ (0, o.jsx)("span", { children: "Performance Score" }), /* @__PURE__ */ (0, o.jsx)("span", {
240
+ className: `font-bold ${s(n.performanceScore)}`,
241
+ children: n.performanceScore.toFixed(0)
242
+ })]
243
+ }), /* @__PURE__ */ (0, o.jsx)("div", {
244
+ className: "mt-1 h-2 w-full rounded-full bg-gray-200",
245
+ children: /* @__PURE__ */ (0, o.jsx)("div", {
246
+ className: `h-2 rounded-full transition-all duration-300 ${n.performanceScore >= 90 ? "bg-green-500" : n.performanceScore >= 70 ? "bg-yellow-500" : "bg-red-500"}`,
247
+ style: { width: `${n.performanceScore}%` }
248
+ })
249
+ })]
250
+ }),
251
+ /* @__PURE__ */ (0, o.jsxs)("div", {
252
+ className: "mb-4 grid grid-cols-2 gap-4",
253
+ children: [/* @__PURE__ */ (0, o.jsxs)("div", { children: [/* @__PURE__ */ (0, o.jsx)("h4", {
254
+ className: "mb-2 font-medium",
255
+ children: "Core Web Vitals"
256
+ }), /* @__PURE__ */ (0, o.jsxs)("div", {
257
+ className: "space-y-1 text-sm",
258
+ children: [
259
+ n.lcp && /* @__PURE__ */ (0, o.jsxs)("div", { children: [
260
+ "LCP: ",
261
+ n.lcp.toFixed(0),
262
+ "ms"
263
+ ] }),
264
+ n.fid && /* @__PURE__ */ (0, o.jsxs)("div", { children: [
265
+ "FID: ",
266
+ n.fid.toFixed(0),
267
+ "ms"
268
+ ] }),
269
+ n.cls && /* @__PURE__ */ (0, o.jsxs)("div", { children: ["CLS: ", n.cls.toFixed(3)] })
270
+ ]
271
+ })] }), /* @__PURE__ */ (0, o.jsxs)("div", { children: [/* @__PURE__ */ (0, o.jsx)("h4", {
272
+ className: "mb-2 font-medium",
273
+ children: "Custom Metrics"
274
+ }), /* @__PURE__ */ (0, o.jsxs)("div", {
275
+ className: "space-y-1 text-sm",
276
+ children: [
277
+ /* @__PURE__ */ (0, o.jsxs)("div", { children: [
278
+ "Render: ",
279
+ n.componentRenderTime.toFixed(2),
280
+ "ms"
281
+ ] }),
282
+ /* @__PURE__ */ (0, o.jsxs)("div", { children: ["Memory: ", c(n.memoryUsage)] }),
283
+ n.bundleLoadTime > 0 && /* @__PURE__ */ (0, o.jsxs)("div", { children: [
284
+ "Bundle: ",
285
+ n.bundleLoadTime.toFixed(0),
286
+ "ms"
287
+ ] })
288
+ ]
289
+ })] })]
290
+ }),
291
+ t && /* @__PURE__ */ (0, o.jsxs)("div", { children: [/* @__PURE__ */ (0, o.jsx)("h4", {
292
+ className: "mb-2 font-medium",
293
+ children: "Advanced Metrics"
294
+ }), /* @__PURE__ */ (0, o.jsxs)("div", {
295
+ className: "space-y-1 text-sm",
296
+ children: [
297
+ /* @__PURE__ */ (0, o.jsxs)("div", { children: [
298
+ "Average Render Time: ",
299
+ (r.componentRenderTime || 0).toFixed(2),
300
+ "ms"
301
+ ] }),
302
+ /* @__PURE__ */ (0, o.jsxs)("div", { children: ["Average Memory: ", c(r.memoryUsage || 0)] }),
303
+ /* @__PURE__ */ (0, o.jsxs)("div", { children: ["Average Score: ", (r.performanceScore || 0).toFixed(0)] })
304
+ ]
305
+ })] })
306
+ ]
307
+ });
308
+ }
309
+ //#endregion
310
+ export { l as a, s as i, c as n, u as o, f as r, d as s, p as t };
311
+
312
+ //# sourceMappingURL=performance-monitor-DCSijLJg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"performance-monitor-DCSijLJg.js","names":[],"sources":["../src/core/performance/performance-monitor.tsx"],"sourcesContent":["import React, { useState, useEffect, useRef, useCallback, useReducer } from \"react\"\n// Import type safely with fallback\ntype ReportHandler = (metric: { name: string; value: number }) => void\n\n// Performance metrics types\nexport interface PerformanceMetrics {\n\t// Core Web Vitals\n\tlcp?: number // Largest Contentful Paint\n\tfid?: number // First Input Delay\n\tcls?: number // Cumulative Layout Shift\n\tfcp?: number // First Contentful Paint\n\tttfb?: number // Time to First Byte\n\tinp?: number // Interaction to Next Paint\n\n\t// Custom metrics\n\tcomponentRenderTime: number\n\tbundleLoadTime: number\n\tmediaLoadTime: number\n\tmemoryUsage: number\n\n\t// Performance scores\n\tperformanceScore: number\n\ttimestamp: number\n}\n\nexport interface PerformanceThresholds {\n\tlcp: { good: number; poor: number }\n\tfid: { good: number; poor: number }\n\tcls: { good: number; poor: number }\n\trenderTime: { good: number; poor: number }\n\tmemoryUsage: { good: number; poor: number }\n}\n\nexport const defaultThresholds: PerformanceThresholds = {\n\tlcp: { good: 2500, poor: 4000 },\n\tfid: { good: 100, poor: 300 },\n\tcls: { good: 0.1, poor: 0.25 },\n\trenderTime: { good: 16, poor: 100 }, // Target 60fps = 16.67ms per frame\n\tmemoryUsage: { good: 50 * 1024 * 1024, poor: 100 * 1024 * 1024 } // 50MB good, 100MB poor\n}\n\n// Performance monitoring class\nexport class PerformanceMonitor {\n\tprivate metrics: PerformanceMetrics[] = []\n\tprivate listeners: Set<(metrics: PerformanceMetrics) => void> = new Set()\n\tprivate thresholds: PerformanceThresholds\n\tprivate observer?: PerformanceObserver\n\tprivate isMonitoring = false\n\n\tconstructor(thresholds: PerformanceThresholds = defaultThresholds) {\n\t\tthis.thresholds = thresholds\n\t\tthis.initializeWebVitals()\n\t\tthis.initializePerformanceObserver()\n\t}\n\n\tprivate async initializeWebVitals() {\n\t\tif (typeof window === \"undefined\") return\n\n\t\ttry {\n\t\t\t// Try to import web-vitals dynamically and handle different versions\n\t\t\tconst webVitals = await import(\"web-vitals\").catch(() => null)\n\n\t\t\tif (!webVitals) {\n\t\t\t\tconsole.warn(\"web-vitals package not available, Core Web Vitals tracking disabled\")\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst reportHandler: ReportHandler = (metric) => {\n\t\t\t\tthis.updateMetric(metric.name.toLowerCase() as keyof PerformanceMetrics, metric.value)\n\t\t\t}\n\n\t\t\t// Handle different web-vitals versions safely\n\t\t\tconst vitalsAny = webVitals as any\n\t\t\tif (vitalsAny.getCLS) vitalsAny.getCLS(reportHandler)\n\t\t\tif (vitalsAny.getFID) vitalsAny.getFID(reportHandler)\n\t\t\tif (vitalsAny.getFCP) vitalsAny.getFCP(reportHandler)\n\t\t\tif (vitalsAny.getLCP) vitalsAny.getLCP(reportHandler)\n\t\t\tif (vitalsAny.getTTFB) vitalsAny.getTTFB(reportHandler)\n\t\t\tif (vitalsAny.onINP) vitalsAny.onINP(reportHandler)\n\t\t} catch (error) {\n\t\t\tconsole.warn(\"Web Vitals initialization failed:\", error)\n\t\t}\n\t}\n\n\tprivate initializePerformanceObserver() {\n\t\tif (typeof window === \"undefined\" || !(\"PerformanceObserver\" in window)) return\n\n\t\ttry {\n\t\t\tthis.observer = new PerformanceObserver((list) => {\n\t\t\t\tfor (const entry of list.getEntries()) {\n\t\t\t\t\tthis.handlePerformanceEntry(entry)\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tthis.observer.observe({ entryTypes: [\"measure\", \"navigation\", \"resource\", \"paint\"] })\n\t\t} catch (error) {\n\t\t\tconsole.warn(\"PerformanceObserver not supported:\", error)\n\t\t}\n\t}\n\n\tprivate handlePerformanceEntry(entry: PerformanceEntry) {\n\t\tswitch (entry.entryType) {\n\t\t\tcase \"measure\":\n\t\t\t\tif (entry.name.startsWith(\"baroiplayer-render\")) {\n\t\t\t\t\tthis.updateMetric(\"componentRenderTime\", entry.duration)\n\t\t\t\t}\n\t\t\t\tbreak\n\n\t\t\tcase \"resource\":\n\t\t\t\tif (entry.name.includes(\".js\") || entry.name.includes(\".css\")) {\n\t\t\t\t\tthis.updateMetric(\"bundleLoadTime\", entry.duration)\n\t\t\t\t}\n\t\t\t\tbreak\n\n\t\t\tcase \"paint\":\n\t\t\t\tif (entry.name === \"first-contentful-paint\") {\n\t\t\t\t\tthis.updateMetric(\"fcp\", entry.startTime)\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\tprivate updateMetric(key: keyof PerformanceMetrics, value: number) {\n\t\tconst currentMetrics = this.getCurrentMetrics()\n\t\tconst updatedMetrics = {\n\t\t\t...currentMetrics,\n\t\t\t[key]: value,\n\t\t\ttimestamp: Date.now(),\n\t\t\tperformanceScore: this.calculatePerformanceScore({ ...currentMetrics, [key]: value })\n\t\t}\n\n\t\tthis.metrics.push(updatedMetrics)\n\n\t\t// Keep only last 100 metrics\n\t\tif (this.metrics.length > 100) {\n\t\t\tthis.metrics = this.metrics.slice(-100)\n\t\t}\n\n\t\tthis.listeners.forEach((listener) => listener(updatedMetrics))\n\t}\n\n\tprivate getCurrentMetrics(): PerformanceMetrics {\n\t\tconst latest = this.metrics[this.metrics.length - 1]\n\t\treturn (\n\t\t\tlatest || {\n\t\t\t\tcomponentRenderTime: 0,\n\t\t\t\tbundleLoadTime: 0,\n\t\t\t\tmediaLoadTime: 0,\n\t\t\t\tmemoryUsage: this.getMemoryUsage(),\n\t\t\t\tperformanceScore: 0,\n\t\t\t\ttimestamp: Date.now()\n\t\t\t}\n\t\t)\n\t}\n\n\tprivate getMemoryUsage(): number {\n\t\tif (\"memory\" in performance) {\n\t\t\treturn (performance as any).memory.usedJSHeapSize || 0\n\t\t}\n\t\treturn 0\n\t}\n\n\tprivate calculatePerformanceScore(metrics: PerformanceMetrics): number {\n\t\tlet score = 100\n\n\t\t// Penalize based on thresholds\n\t\tif (metrics.lcp && metrics.lcp > this.thresholds.lcp.good) {\n\t\t\tscore -= metrics.lcp > this.thresholds.lcp.poor ? 30 : 15\n\t\t}\n\n\t\tif (metrics.fid && metrics.fid > this.thresholds.fid.good) {\n\t\t\tscore -= metrics.fid > this.thresholds.fid.poor ? 25 : 10\n\t\t}\n\n\t\tif (metrics.cls && metrics.cls > this.thresholds.cls.good) {\n\t\t\tscore -= metrics.cls > this.thresholds.cls.poor ? 20 : 10\n\t\t}\n\n\t\tif (metrics.componentRenderTime > this.thresholds.renderTime.good) {\n\t\t\tscore -= metrics.componentRenderTime > this.thresholds.renderTime.poor ? 20 : 10\n\t\t}\n\n\t\tif (metrics.memoryUsage > this.thresholds.memoryUsage.good) {\n\t\t\tscore -= metrics.memoryUsage > this.thresholds.memoryUsage.poor ? 15 : 5\n\t\t}\n\n\t\treturn Math.max(0, score)\n\t}\n\n\t// Public API\n\tpublic startMonitoring() {\n\t\tthis.isMonitoring = true\n\t\tthis.startMemoryMonitoring()\n\t}\n\n\tpublic stopMonitoring() {\n\t\tthis.isMonitoring = false\n\t\tif (this.observer) {\n\t\t\tthis.observer.disconnect()\n\t\t}\n\t}\n\n\tprivate startMemoryMonitoring() {\n\t\tif (!this.isMonitoring) return\n\n\t\tthis.updateMetric(\"memoryUsage\", this.getMemoryUsage())\n\t\tsetTimeout(() => this.startMemoryMonitoring(), 5000) // Check every 5 seconds\n\t}\n\n\tpublic measureComponentRender(componentName: string, renderFn: () => any): any {\n\t\tconst startMark = `baroiplayer-render-${componentName}-start`\n\t\tconst endMark = `baroiplayer-render-${componentName}-end`\n\t\tconst measureName = `baroiplayer-render-${componentName}`\n\n\t\tperformance.mark(startMark)\n\t\tconst result = renderFn()\n\t\tperformance.mark(endMark)\n\n\t\ttry {\n\t\t\tperformance.measure(measureName, startMark, endMark)\n\t\t} catch (error) {\n\t\t\tconsole.warn(\"Performance measurement failed:\", error)\n\t\t}\n\n\t\treturn result\n\t}\n\n\tpublic subscribe(listener: (metrics: PerformanceMetrics) => void): () => void {\n\t\tthis.listeners.add(listener)\n\t\treturn () => this.listeners.delete(listener)\n\t}\n\n\tpublic getLatestMetrics(): PerformanceMetrics | null {\n\t\treturn this.metrics[this.metrics.length - 1] || null\n\t}\n\n\tpublic getAllMetrics(): PerformanceMetrics[] {\n\t\treturn [...this.metrics]\n\t}\n\n\tpublic getAverageMetrics(count = 10): Partial<PerformanceMetrics> {\n\t\tconst recentMetrics = this.metrics.slice(-count)\n\t\tif (recentMetrics.length === 0) return {}\n\n\t\tconst averages: Partial<PerformanceMetrics> = {}\n\t\tconst keys: Array<keyof PerformanceMetrics> = [\n\t\t\t\"lcp\",\n\t\t\t\"fid\",\n\t\t\t\"cls\",\n\t\t\t\"fcp\",\n\t\t\t\"ttfb\",\n\t\t\t\"inp\",\n\t\t\t\"componentRenderTime\",\n\t\t\t\"bundleLoadTime\",\n\t\t\t\"mediaLoadTime\",\n\t\t\t\"memoryUsage\",\n\t\t\t\"performanceScore\"\n\t\t]\n\n\t\tkeys.forEach((key) => {\n\t\t\tconst values = recentMetrics\n\t\t\t\t.map((m) => m[key] as number)\n\t\t\t\t.filter((v) => typeof v === \"number\" && !isNaN(v))\n\n\t\t\tif (values.length > 0) {\n\t\t\t\t;(averages as any)[key] = values.reduce((sum, v) => sum + v, 0) / values.length\n\t\t\t}\n\t\t})\n\n\t\treturn averages\n\t}\n\n\tpublic getThresholds(): PerformanceThresholds {\n\t\treturn this.thresholds\n\t}\n\n\tpublic updateThresholds(newThresholds: Partial<PerformanceThresholds>) {\n\t\tthis.thresholds = { ...this.thresholds, ...newThresholds }\n\t}\n}\n\n// Global performance monitor instance\nexport const performanceMonitor = new PerformanceMonitor()\n\n// React hook for performance monitoring\nexport function usePerformanceMonitor() {\n\tconst [metrics, setMetrics] = useState<PerformanceMetrics | null>(null)\n\tconst [isSupported, setIsSupported] = useState(true)\n\n\tuseEffect(() => {\n\t\tsetIsSupported(typeof window !== \"undefined\" && \"performance\" in window)\n\n\t\tif (!isSupported) return\n\n\t\tperformanceMonitor.startMonitoring()\n\t\tconst unsubscribe = performanceMonitor.subscribe(setMetrics)\n\n\t\treturn () => {\n\t\t\tunsubscribe()\n\t\t\tperformanceMonitor.stopMonitoring()\n\t\t}\n\t}, [isSupported])\n\n\tconst measureRender = useCallback((componentName: string, renderFn: () => any): any => {\n\t\treturn performanceMonitor.measureComponentRender(componentName, renderFn)\n\t}, [])\n\n\treturn {\n\t\tmetrics,\n\t\tisSupported,\n\t\tmeasureRender,\n\t\taverageMetrics: performanceMonitor.getAverageMetrics(),\n\t\tallMetrics: performanceMonitor.getAllMetrics(),\n\t\tthresholds: performanceMonitor.getThresholds()\n\t}\n}\n\n// HOC for performance monitoring\nexport function withPerformanceMonitoring(\n\tWrappedComponent: React.ComponentType<any>,\n\tcomponentName?: string\n) {\n\tconst displayName =\n\t\tcomponentName || WrappedComponent.displayName || WrappedComponent.name || \"Component\"\n\n\tfunction PerformanceMonitoredComponent(props: any) {\n\t\tconst renderRef = useRef(0)\n\t\tconst { measureRender } = usePerformanceMonitor()\n\n\t\t// Use a simple counter that increments during render but doesn't access the ref value\n\t\tconst renderKey = useState(() => Math.random())[0]\n\n\t\t// Update ref in effect to track count without accessing during render\n\t\tuseEffect(() => {\n\t\t\trenderRef.current += 1\n\t\t})\n\n\t\treturn measureRender(`${displayName}-${renderKey}`, () => <WrappedComponent {...props} />)\n\t}\n\n\tPerformanceMonitoredComponent.displayName = `withPerformanceMonitoring(${displayName})`\n\treturn PerformanceMonitoredComponent\n}\n\n// Performance regression detector\nexport class PerformanceRegressionDetector {\n\tprivate baselineMetrics: PerformanceMetrics | null = null\n\tprivate regressionThreshold = 0.2 // 20% degradation threshold\n\n\tsetBaseline(metrics: PerformanceMetrics) {\n\t\tthis.baselineMetrics = metrics\n\t}\n\n\tdetectRegression(currentMetrics: PerformanceMetrics): Array<{\n\t\tmetric: keyof PerformanceMetrics\n\t\tbaseline: number\n\t\tcurrent: number\n\t\tdegradation: number\n\t}> {\n\t\tif (!this.baselineMetrics) return []\n\n\t\tconst regressions: Array<{\n\t\t\tmetric: keyof PerformanceMetrics\n\t\t\tbaseline: number\n\t\t\tcurrent: number\n\t\t\tdegradation: number\n\t\t}> = []\n\n\t\tconst metricsToCheck: Array<keyof PerformanceMetrics> = [\n\t\t\t\"componentRenderTime\",\n\t\t\t\"bundleLoadTime\",\n\t\t\t\"mediaLoadTime\",\n\t\t\t\"memoryUsage\"\n\t\t]\n\n\t\tmetricsToCheck.forEach((metric) => {\n\t\t\tconst baseline = this.baselineMetrics![metric] as number\n\t\t\tconst current = currentMetrics[metric] as number\n\n\t\t\tif (baseline && current && baseline > 0) {\n\t\t\t\tconst degradation = (current - baseline) / baseline\n\t\t\t\tif (degradation > this.regressionThreshold) {\n\t\t\t\t\tregressions.push({ metric, baseline, current, degradation })\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\n\t\treturn regressions\n\t}\n\n\tsetRegressionThreshold(threshold: number) {\n\t\tthis.regressionThreshold = Math.max(0, Math.min(1, threshold))\n\t}\n}\n\n// Development dashboard component\nexport interface PerformanceDashboardProps {\n\tclassName?: string\n\tshowAdvanced?: boolean\n}\n\nexport function PerformanceDashboard({\n\tclassName = \"\",\n\tshowAdvanced = false\n}: PerformanceDashboardProps) {\n\tconst { metrics, averageMetrics, thresholds, isSupported } = usePerformanceMonitor()\n\n\tif (!isSupported || !metrics) {\n\t\treturn (\n\t\t\t<div className={`performance-dashboard ${className}`}>\n\t\t\t\t<p>Performance monitoring not supported in this environment</p>\n\t\t\t</div>\n\t\t)\n\t}\n\n\tconst getScoreColor = (score: number) => {\n\t\tif (score >= 90) return \"text-green-600\"\n\t\tif (score >= 70) return \"text-yellow-600\"\n\t\treturn \"text-red-600\"\n\t}\n\n\tconst formatBytes = (bytes: number) => {\n\t\treturn `${(bytes / 1024 / 1024).toFixed(2)} MB`\n\t}\n\n\treturn (\n\t\t<div className={`performance-dashboard rounded-lg bg-white p-4 shadow ${className}`}>\n\t\t\t<h3 className=\"mb-4 font-semibold text-lg\">Performance Dashboard</h3>\n\n\t\t\t{/* Performance Score */}\n\t\t\t<div className=\"mb-4\">\n\t\t\t\t<div className=\"flex items-center justify-between\">\n\t\t\t\t\t<span>Performance Score</span>\n\t\t\t\t\t<span className={`font-bold ${getScoreColor(metrics.performanceScore)}`}>\n\t\t\t\t\t\t{metrics.performanceScore.toFixed(0)}\n\t\t\t\t\t</span>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"mt-1 h-2 w-full rounded-full bg-gray-200\">\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={`h-2 rounded-full transition-all duration-300 ${\n\t\t\t\t\t\t\tmetrics.performanceScore >= 90\n\t\t\t\t\t\t\t\t? \"bg-green-500\"\n\t\t\t\t\t\t\t\t: metrics.performanceScore >= 70\n\t\t\t\t\t\t\t\t\t? \"bg-yellow-500\"\n\t\t\t\t\t\t\t\t\t: \"bg-red-500\"\n\t\t\t\t\t\t}`}\n\t\t\t\t\t\tstyle={{ width: `${metrics.performanceScore}%` }}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t{/* Core Web Vitals */}\n\t\t\t<div className=\"mb-4 grid grid-cols-2 gap-4\">\n\t\t\t\t<div>\n\t\t\t\t\t<h4 className=\"mb-2 font-medium\">Core Web Vitals</h4>\n\t\t\t\t\t<div className=\"space-y-1 text-sm\">\n\t\t\t\t\t\t{metrics.lcp && <div>LCP: {metrics.lcp.toFixed(0)}ms</div>}\n\t\t\t\t\t\t{metrics.fid && <div>FID: {metrics.fid.toFixed(0)}ms</div>}\n\t\t\t\t\t\t{metrics.cls && <div>CLS: {metrics.cls.toFixed(3)}</div>}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\n\t\t\t\t<div>\n\t\t\t\t\t<h4 className=\"mb-2 font-medium\">Custom Metrics</h4>\n\t\t\t\t\t<div className=\"space-y-1 text-sm\">\n\t\t\t\t\t\t<div>Render: {metrics.componentRenderTime.toFixed(2)}ms</div>\n\t\t\t\t\t\t<div>Memory: {formatBytes(metrics.memoryUsage)}</div>\n\t\t\t\t\t\t{metrics.bundleLoadTime > 0 && <div>Bundle: {metrics.bundleLoadTime.toFixed(0)}ms</div>}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t{/* Advanced metrics */}\n\t\t\t{showAdvanced && (\n\t\t\t\t<div>\n\t\t\t\t\t<h4 className=\"mb-2 font-medium\">Advanced Metrics</h4>\n\t\t\t\t\t<div className=\"space-y-1 text-sm\">\n\t\t\t\t\t\t<div>Average Render Time: {(averageMetrics.componentRenderTime || 0).toFixed(2)}ms</div>\n\t\t\t\t\t\t<div>Average Memory: {formatBytes(averageMetrics.memoryUsage || 0)}</div>\n\t\t\t\t\t\t<div>Average Score: {(averageMetrics.performanceScore || 0).toFixed(0)}</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n\nexport default PerformanceMonitor\n"],"mappings":";;;aAiCa,IAA2C;CACvD,KAAK;EAAE,MAAM;EAAM,MAAM;CAAK;CAC9B,KAAK;EAAE,MAAM;EAAK,MAAM;CAAI;CAC5B,KAAK;EAAE,MAAM;EAAK,MAAM;CAAK;CAC7B,YAAY;EAAE,MAAM;EAAI,MAAM;CAAI;CAClC,aAAa;EAAE,MAAM,KAAK,OAAO;EAAM,MAAM,MAAM,OAAO;CAAK;AAChE,GAGa,IAAb,MAAgC;CAO/B,YAAY,IAAoC,GAAmB;EAGlE,QATD,WAAwC,CAAC,CAAA,WACzC,6BAAgE,IAAI,IAAI,CAAA,WACxE,cAAA,KAAA,CAAA,WACA,YAAA,KAAA,CAAA,WACA,gBAAuB,EAAA,GAGtB,KAAK,aAAa,GAClB,KAAK,oBAAoB,GACzB,KAAK,8BAA8B;CACpC;CAEA,MAAc,sBAAsB;EAC/B,aAAO,SAAW,MAEtB,IAAI;GAEH,IAAM,IAAY,MAAM,OAAO,aAAa,CAAC,YAAY,IAAI;GAE7D,IAAI,CAAC,GAAW;IACf,QAAQ,KAAK,qEAAqE;IAClF;GACD;GAEA,IAAM,KAAgC,MAAW;IAChD,KAAK,aAAa,EAAO,KAAK,YAAY,GAA+B,EAAO,KAAK;GACtF,GAGM,IAAY;GAMlB,AALI,EAAU,UAAQ,EAAU,OAAO,CAAa,GAChD,EAAU,UAAQ,EAAU,OAAO,CAAa,GAChD,EAAU,UAAQ,EAAU,OAAO,CAAa,GAChD,EAAU,UAAQ,EAAU,OAAO,CAAa,GAChD,EAAU,WAAS,EAAU,QAAQ,CAAa,GAClD,EAAU,SAAO,EAAU,MAAM,CAAa;EACnD,SAAS,GAAO;GACf,QAAQ,KAAK,qCAAqC,CAAK;EACxD;CACD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B,CAAA,GACrD,iBAAA,GAAA,EAAA,KAAA,CAAC,OAAD;IAAK,WAAU;cAAf;KACC,iBAAA,GAAA,EAAA,KAAA,CAAC,OAAD,EAAA,UAAA;MAAK;OAAuB,EAAe,uBAAuB,EAAA,CAAG,QAAQ,CAAC;MAAE;KAAO,EAAA,CAAA;KACvF,iBAAA,GAAA,EAAA,KAAA,CAAC,OAAD,EAAA,UAAA,CAAK,oBAAiB,EAAY,EAAe,eAAe,CAAC,CAAO,EAAA,CAAA;KACxE,iBAAA,GAAA,EAAA,KAAA,CAAC,OAAD,EAAA,UAAA,CAAK,oBAAiB,EAAe,oBAAoB,EAAA,CAAG,QAAQ,CAAC,CAAO,EAAA,CAAA;IACxE;KACD,EAAA,CAAA;EAEF;;AAEP"}
@@ -0,0 +1,2 @@
1
+ const e=require("./rolldown-runtime-mLOUI7ql.cjs"),t=require("./context-Bzd5QCKM.cjs");let n=require("react");n=e.r(n,1);var r=t.i(),i={lcp:{good:2500,poor:4e3},fid:{good:100,poor:300},cls:{good:.1,poor:.25},renderTime:{good:16,poor:100},memoryUsage:{good:50*1024*1024,poor:100*1024*1024}},a=class{constructor(e=i){t.r(this,`metrics`,[]),t.r(this,`listeners`,new Set),t.r(this,`thresholds`,void 0),t.r(this,`observer`,void 0),t.r(this,`isMonitoring`,!1),this.thresholds=e,this.initializeWebVitals(),this.initializePerformanceObserver()}async initializeWebVitals(){if(!(typeof window>`u`))try{let e=await import(`web-vitals`).catch(()=>null);if(!e){console.warn(`web-vitals package not available, Core Web Vitals tracking disabled`);return}let t=e=>{this.updateMetric(e.name.toLowerCase(),e.value)},n=e;n.getCLS&&n.getCLS(t),n.getFID&&n.getFID(t),n.getFCP&&n.getFCP(t),n.getLCP&&n.getLCP(t),n.getTTFB&&n.getTTFB(t),n.onINP&&n.onINP(t)}catch(e){console.warn(`Web Vitals initialization failed:`,e)}}initializePerformanceObserver(){if(!(typeof window>`u`||!(`PerformanceObserver`in window)))try{this.observer=new PerformanceObserver(e=>{for(let t of e.getEntries())this.handlePerformanceEntry(t)}),this.observer.observe({entryTypes:[`measure`,`navigation`,`resource`,`paint`]})}catch(e){console.warn(`PerformanceObserver not supported:`,e)}}handlePerformanceEntry(e){switch(e.entryType){case`measure`:e.name.startsWith(`baroiplayer-render`)&&this.updateMetric(`componentRenderTime`,e.duration);break;case`resource`:(e.name.includes(`.js`)||e.name.includes(`.css`))&&this.updateMetric(`bundleLoadTime`,e.duration);break;case`paint`:e.name===`first-contentful-paint`&&this.updateMetric(`fcp`,e.startTime);break}}updateMetric(e,t){let n=this.getCurrentMetrics(),r={...n,[e]:t,timestamp:Date.now(),performanceScore:this.calculatePerformanceScore({...n,[e]:t})};this.metrics.push(r),this.metrics.length>100&&(this.metrics=this.metrics.slice(-100)),this.listeners.forEach(e=>e(r))}getCurrentMetrics(){return this.metrics[this.metrics.length-1]||{componentRenderTime:0,bundleLoadTime:0,mediaLoadTime:0,memoryUsage:this.getMemoryUsage(),performanceScore:0,timestamp:Date.now()}}getMemoryUsage(){return`memory`in performance&&performance.memory.usedJSHeapSize||0}calculatePerformanceScore(e){let t=100;return e.lcp&&e.lcp>this.thresholds.lcp.good&&(t-=e.lcp>this.thresholds.lcp.poor?30:15),e.fid&&e.fid>this.thresholds.fid.good&&(t-=e.fid>this.thresholds.fid.poor?25:10),e.cls&&e.cls>this.thresholds.cls.good&&(t-=e.cls>this.thresholds.cls.poor?20:10),e.componentRenderTime>this.thresholds.renderTime.good&&(t-=e.componentRenderTime>this.thresholds.renderTime.poor?20:10),e.memoryUsage>this.thresholds.memoryUsage.good&&(t-=e.memoryUsage>this.thresholds.memoryUsage.poor?15:5),Math.max(0,t)}startMonitoring(){this.isMonitoring=!0,this.startMemoryMonitoring()}stopMonitoring(){this.isMonitoring=!1,this.observer&&this.observer.disconnect()}startMemoryMonitoring(){this.isMonitoring&&(this.updateMetric(`memoryUsage`,this.getMemoryUsage()),setTimeout(()=>this.startMemoryMonitoring(),5e3))}measureComponentRender(e,t){let n=`baroiplayer-render-${e}-start`,r=`baroiplayer-render-${e}-end`,i=`baroiplayer-render-${e}`;performance.mark(n);let a=t();performance.mark(r);try{performance.measure(i,n,r)}catch(e){console.warn(`Performance measurement failed:`,e)}return a}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}getLatestMetrics(){return this.metrics[this.metrics.length-1]||null}getAllMetrics(){return[...this.metrics]}getAverageMetrics(e=10){let t=this.metrics.slice(-e);if(t.length===0)return{};let n={};return[`lcp`,`fid`,`cls`,`fcp`,`ttfb`,`inp`,`componentRenderTime`,`bundleLoadTime`,`mediaLoadTime`,`memoryUsage`,`performanceScore`].forEach(e=>{let r=t.map(t=>t[e]).filter(e=>typeof e==`number`&&!isNaN(e));r.length>0&&(n[e]=r.reduce((e,t)=>e+t,0)/r.length)}),n}getThresholds(){return this.thresholds}updateThresholds(e){this.thresholds={...this.thresholds,...e}}},o=new a;function s(){let[e,t]=(0,n.useState)(null),[r,i]=(0,n.useState)(!0);return(0,n.useEffect)(()=>{if(i(typeof window<`u`&&`performance`in window),!r)return;o.startMonitoring();let e=o.subscribe(t);return()=>{e(),o.stopMonitoring()}},[r]),{metrics:e,isSupported:r,measureRender:(0,n.useCallback)((e,t)=>o.measureComponentRender(e,t),[]),averageMetrics:o.getAverageMetrics(),allMetrics:o.getAllMetrics(),thresholds:o.getThresholds()}}function c(e,t){let i=t||e.displayName||e.name||`Component`;function a(t){let a=(0,n.useRef)(0),{measureRender:o}=s(),c=(0,n.useState)(()=>Math.random())[0];return(0,n.useEffect)(()=>{a.current+=1}),o(`${i}-${c}`,()=>(0,r.jsx)(e,{...t}))}return a.displayName=`withPerformanceMonitoring(${i})`,a}var l=class{constructor(){t.r(this,`baselineMetrics`,null),t.r(this,`regressionThreshold`,.2)}setBaseline(e){this.baselineMetrics=e}detectRegression(e){if(!this.baselineMetrics)return[];let t=[];return[`componentRenderTime`,`bundleLoadTime`,`mediaLoadTime`,`memoryUsage`].forEach(n=>{let r=this.baselineMetrics[n],i=e[n];if(r&&i&&r>0){let e=(i-r)/r;e>this.regressionThreshold&&t.push({metric:n,baseline:r,current:i,degradation:e})}}),t}setRegressionThreshold(e){this.regressionThreshold=Math.max(0,Math.min(1,e))}};function u({className:e=``,showAdvanced:t=!1}){let{metrics:n,averageMetrics:i,thresholds:a,isSupported:o}=s();if(!o||!n)return(0,r.jsx)(`div`,{className:`performance-dashboard ${e}`,children:(0,r.jsx)(`p`,{children:`Performance monitoring not supported in this environment`})});let c=e=>e>=90?`text-green-600`:e>=70?`text-yellow-600`:`text-red-600`,l=e=>`${(e/1024/1024).toFixed(2)} MB`;return(0,r.jsxs)(`div`,{className:`performance-dashboard rounded-lg bg-white p-4 shadow ${e}`,children:[(0,r.jsx)(`h3`,{className:`mb-4 font-semibold text-lg`,children:`Performance Dashboard`}),(0,r.jsxs)(`div`,{className:`mb-4`,children:[(0,r.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,r.jsx)(`span`,{children:`Performance Score`}),(0,r.jsx)(`span`,{className:`font-bold ${c(n.performanceScore)}`,children:n.performanceScore.toFixed(0)})]}),(0,r.jsx)(`div`,{className:`mt-1 h-2 w-full rounded-full bg-gray-200`,children:(0,r.jsx)(`div`,{className:`h-2 rounded-full transition-all duration-300 ${n.performanceScore>=90?`bg-green-500`:n.performanceScore>=70?`bg-yellow-500`:`bg-red-500`}`,style:{width:`${n.performanceScore}%`}})})]}),(0,r.jsxs)(`div`,{className:`mb-4 grid grid-cols-2 gap-4`,children:[(0,r.jsxs)(`div`,{children:[(0,r.jsx)(`h4`,{className:`mb-2 font-medium`,children:`Core Web Vitals`}),(0,r.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[n.lcp&&(0,r.jsxs)(`div`,{children:[`LCP: `,n.lcp.toFixed(0),`ms`]}),n.fid&&(0,r.jsxs)(`div`,{children:[`FID: `,n.fid.toFixed(0),`ms`]}),n.cls&&(0,r.jsxs)(`div`,{children:[`CLS: `,n.cls.toFixed(3)]})]})]}),(0,r.jsxs)(`div`,{children:[(0,r.jsx)(`h4`,{className:`mb-2 font-medium`,children:`Custom Metrics`}),(0,r.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,r.jsxs)(`div`,{children:[`Render: `,n.componentRenderTime.toFixed(2),`ms`]}),(0,r.jsxs)(`div`,{children:[`Memory: `,l(n.memoryUsage)]}),n.bundleLoadTime>0&&(0,r.jsxs)(`div`,{children:[`Bundle: `,n.bundleLoadTime.toFixed(0),`ms`]})]})]})]}),t&&(0,r.jsxs)(`div`,{children:[(0,r.jsx)(`h4`,{className:`mb-2 font-medium`,children:`Advanced Metrics`}),(0,r.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,r.jsxs)(`div`,{children:[`Average Render Time: `,(i.componentRenderTime||0).toFixed(2),`ms`]}),(0,r.jsxs)(`div`,{children:[`Average Memory: `,l(i.memoryUsage||0)]}),(0,r.jsxs)(`div`,{children:[`Average Score: `,(i.performanceScore||0).toFixed(0)]})]})]})]})}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return u}});
2
+ //# sourceMappingURL=performance-monitor-wNFKmqMr.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"performance-monitor-wNFKmqMr.cjs","names":[],"sources":["../src/core/performance/performance-monitor.tsx"],"sourcesContent":["import React, { useState, useEffect, useRef, useCallback, useReducer } from \"react\"\n// Import type safely with fallback\ntype ReportHandler = (metric: { name: string; value: number }) => void\n\n// Performance metrics types\nexport interface PerformanceMetrics {\n\t// Core Web Vitals\n\tlcp?: number // Largest Contentful Paint\n\tfid?: number // First Input Delay\n\tcls?: number // Cumulative Layout Shift\n\tfcp?: number // First Contentful Paint\n\tttfb?: number // Time to First Byte\n\tinp?: number // Interaction to Next Paint\n\n\t// Custom metrics\n\tcomponentRenderTime: number\n\tbundleLoadTime: number\n\tmediaLoadTime: number\n\tmemoryUsage: number\n\n\t// Performance scores\n\tperformanceScore: number\n\ttimestamp: number\n}\n\nexport interface PerformanceThresholds {\n\tlcp: { good: number; poor: number }\n\tfid: { good: number; poor: number }\n\tcls: { good: number; poor: number }\n\trenderTime: { good: number; poor: number }\n\tmemoryUsage: { good: number; poor: number }\n}\n\nexport const defaultThresholds: PerformanceThresholds = {\n\tlcp: { good: 2500, poor: 4000 },\n\tfid: { good: 100, poor: 300 },\n\tcls: { good: 0.1, poor: 0.25 },\n\trenderTime: { good: 16, poor: 100 }, // Target 60fps = 16.67ms per frame\n\tmemoryUsage: { good: 50 * 1024 * 1024, poor: 100 * 1024 * 1024 } // 50MB good, 100MB poor\n}\n\n// Performance monitoring class\nexport class PerformanceMonitor {\n\tprivate metrics: PerformanceMetrics[] = []\n\tprivate listeners: Set<(metrics: PerformanceMetrics) => void> = new Set()\n\tprivate thresholds: PerformanceThresholds\n\tprivate observer?: PerformanceObserver\n\tprivate isMonitoring = false\n\n\tconstructor(thresholds: PerformanceThresholds = defaultThresholds) {\n\t\tthis.thresholds = thresholds\n\t\tthis.initializeWebVitals()\n\t\tthis.initializePerformanceObserver()\n\t}\n\n\tprivate async initializeWebVitals() {\n\t\tif (typeof window === \"undefined\") return\n\n\t\ttry {\n\t\t\t// Try to import web-vitals dynamically and handle different versions\n\t\t\tconst webVitals = await import(\"web-vitals\").catch(() => null)\n\n\t\t\tif (!webVitals) {\n\t\t\t\tconsole.warn(\"web-vitals package not available, Core Web Vitals tracking disabled\")\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst reportHandler: ReportHandler = (metric) => {\n\t\t\t\tthis.updateMetric(metric.name.toLowerCase() as keyof PerformanceMetrics, metric.value)\n\t\t\t}\n\n\t\t\t// Handle different web-vitals versions safely\n\t\t\tconst vitalsAny = webVitals as any\n\t\t\tif (vitalsAny.getCLS) vitalsAny.getCLS(reportHandler)\n\t\t\tif (vitalsAny.getFID) vitalsAny.getFID(reportHandler)\n\t\t\tif (vitalsAny.getFCP) vitalsAny.getFCP(reportHandler)\n\t\t\tif (vitalsAny.getLCP) vitalsAny.getLCP(reportHandler)\n\t\t\tif (vitalsAny.getTTFB) vitalsAny.getTTFB(reportHandler)\n\t\t\tif (vitalsAny.onINP) vitalsAny.onINP(reportHandler)\n\t\t} catch (error) {\n\t\t\tconsole.warn(\"Web Vitals initialization failed:\", error)\n\t\t}\n\t}\n\n\tprivate initializePerformanceObserver() {\n\t\tif (typeof window === \"undefined\" || !(\"PerformanceObserver\" in window)) return\n\n\t\ttry {\n\t\t\tthis.observer = new PerformanceObserver((list) => {\n\t\t\t\tfor (const entry of list.getEntries()) {\n\t\t\t\t\tthis.handlePerformanceEntry(entry)\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tthis.observer.observe({ entryTypes: [\"measure\", \"navigation\", \"resource\", \"paint\"] })\n\t\t} catch (error) {\n\t\t\tconsole.warn(\"PerformanceObserver not supported:\", error)\n\t\t}\n\t}\n\n\tprivate handlePerformanceEntry(entry: PerformanceEntry) {\n\t\tswitch (entry.entryType) {\n\t\t\tcase \"measure\":\n\t\t\t\tif (entry.name.startsWith(\"baroiplayer-render\")) {\n\t\t\t\t\tthis.updateMetric(\"componentRenderTime\", entry.duration)\n\t\t\t\t}\n\t\t\t\tbreak\n\n\t\t\tcase \"resource\":\n\t\t\t\tif (entry.name.includes(\".js\") || entry.name.includes(\".css\")) {\n\t\t\t\t\tthis.updateMetric(\"bundleLoadTime\", entry.duration)\n\t\t\t\t}\n\t\t\t\tbreak\n\n\t\t\tcase \"paint\":\n\t\t\t\tif (entry.name === \"first-contentful-paint\") {\n\t\t\t\t\tthis.updateMetric(\"fcp\", entry.startTime)\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\tprivate updateMetric(key: keyof PerformanceMetrics, value: number) {\n\t\tconst currentMetrics = this.getCurrentMetrics()\n\t\tconst updatedMetrics = {\n\t\t\t...currentMetrics,\n\t\t\t[key]: value,\n\t\t\ttimestamp: Date.now(),\n\t\t\tperformanceScore: this.calculatePerformanceScore({ ...currentMetrics, [key]: value })\n\t\t}\n\n\t\tthis.metrics.push(updatedMetrics)\n\n\t\t// Keep only last 100 metrics\n\t\tif (this.metrics.length > 100) {\n\t\t\tthis.metrics = this.metrics.slice(-100)\n\t\t}\n\n\t\tthis.listeners.forEach((listener) => listener(updatedMetrics))\n\t}\n\n\tprivate getCurrentMetrics(): PerformanceMetrics {\n\t\tconst latest = this.metrics[this.metrics.length - 1]\n\t\treturn (\n\t\t\tlatest || {\n\t\t\t\tcomponentRenderTime: 0,\n\t\t\t\tbundleLoadTime: 0,\n\t\t\t\tmediaLoadTime: 0,\n\t\t\t\tmemoryUsage: this.getMemoryUsage(),\n\t\t\t\tperformanceScore: 0,\n\t\t\t\ttimestamp: Date.now()\n\t\t\t}\n\t\t)\n\t}\n\n\tprivate getMemoryUsage(): number {\n\t\tif (\"memory\" in performance) {\n\t\t\treturn (performance as any).memory.usedJSHeapSize || 0\n\t\t}\n\t\treturn 0\n\t}\n\n\tprivate calculatePerformanceScore(metrics: PerformanceMetrics): number {\n\t\tlet score = 100\n\n\t\t// Penalize based on thresholds\n\t\tif (metrics.lcp && metrics.lcp > this.thresholds.lcp.good) {\n\t\t\tscore -= metrics.lcp > this.thresholds.lcp.poor ? 30 : 15\n\t\t}\n\n\t\tif (metrics.fid && metrics.fid > this.thresholds.fid.good) {\n\t\t\tscore -= metrics.fid > this.thresholds.fid.poor ? 25 : 10\n\t\t}\n\n\t\tif (metrics.cls && metrics.cls > this.thresholds.cls.good) {\n\t\t\tscore -= metrics.cls > this.thresholds.cls.poor ? 20 : 10\n\t\t}\n\n\t\tif (metrics.componentRenderTime > this.thresholds.renderTime.good) {\n\t\t\tscore -= metrics.componentRenderTime > this.thresholds.renderTime.poor ? 20 : 10\n\t\t}\n\n\t\tif (metrics.memoryUsage > this.thresholds.memoryUsage.good) {\n\t\t\tscore -= metrics.memoryUsage > this.thresholds.memoryUsage.poor ? 15 : 5\n\t\t}\n\n\t\treturn Math.max(0, score)\n\t}\n\n\t// Public API\n\tpublic startMonitoring() {\n\t\tthis.isMonitoring = true\n\t\tthis.startMemoryMonitoring()\n\t}\n\n\tpublic stopMonitoring() {\n\t\tthis.isMonitoring = false\n\t\tif (this.observer) {\n\t\t\tthis.observer.disconnect()\n\t\t}\n\t}\n\n\tprivate startMemoryMonitoring() {\n\t\tif (!this.isMonitoring) return\n\n\t\tthis.updateMetric(\"memoryUsage\", this.getMemoryUsage())\n\t\tsetTimeout(() => this.startMemoryMonitoring(), 5000) // Check every 5 seconds\n\t}\n\n\tpublic measureComponentRender(componentName: string, renderFn: () => any): any {\n\t\tconst startMark = `baroiplayer-render-${componentName}-start`\n\t\tconst endMark = `baroiplayer-render-${componentName}-end`\n\t\tconst measureName = `baroiplayer-render-${componentName}`\n\n\t\tperformance.mark(startMark)\n\t\tconst result = renderFn()\n\t\tperformance.mark(endMark)\n\n\t\ttry {\n\t\t\tperformance.measure(measureName, startMark, endMark)\n\t\t} catch (error) {\n\t\t\tconsole.warn(\"Performance measurement failed:\", error)\n\t\t}\n\n\t\treturn result\n\t}\n\n\tpublic subscribe(listener: (metrics: PerformanceMetrics) => void): () => void {\n\t\tthis.listeners.add(listener)\n\t\treturn () => this.listeners.delete(listener)\n\t}\n\n\tpublic getLatestMetrics(): PerformanceMetrics | null {\n\t\treturn this.metrics[this.metrics.length - 1] || null\n\t}\n\n\tpublic getAllMetrics(): PerformanceMetrics[] {\n\t\treturn [...this.metrics]\n\t}\n\n\tpublic getAverageMetrics(count = 10): Partial<PerformanceMetrics> {\n\t\tconst recentMetrics = this.metrics.slice(-count)\n\t\tif (recentMetrics.length === 0) return {}\n\n\t\tconst averages: Partial<PerformanceMetrics> = {}\n\t\tconst keys: Array<keyof PerformanceMetrics> = [\n\t\t\t\"lcp\",\n\t\t\t\"fid\",\n\t\t\t\"cls\",\n\t\t\t\"fcp\",\n\t\t\t\"ttfb\",\n\t\t\t\"inp\",\n\t\t\t\"componentRenderTime\",\n\t\t\t\"bundleLoadTime\",\n\t\t\t\"mediaLoadTime\",\n\t\t\t\"memoryUsage\",\n\t\t\t\"performanceScore\"\n\t\t]\n\n\t\tkeys.forEach((key) => {\n\t\t\tconst values = recentMetrics\n\t\t\t\t.map((m) => m[key] as number)\n\t\t\t\t.filter((v) => typeof v === \"number\" && !isNaN(v))\n\n\t\t\tif (values.length > 0) {\n\t\t\t\t;(averages as any)[key] = values.reduce((sum, v) => sum + v, 0) / values.length\n\t\t\t}\n\t\t})\n\n\t\treturn averages\n\t}\n\n\tpublic getThresholds(): PerformanceThresholds {\n\t\treturn this.thresholds\n\t}\n\n\tpublic updateThresholds(newThresholds: Partial<PerformanceThresholds>) {\n\t\tthis.thresholds = { ...this.thresholds, ...newThresholds }\n\t}\n}\n\n// Global performance monitor instance\nexport const performanceMonitor = new PerformanceMonitor()\n\n// React hook for performance monitoring\nexport function usePerformanceMonitor() {\n\tconst [metrics, setMetrics] = useState<PerformanceMetrics | null>(null)\n\tconst [isSupported, setIsSupported] = useState(true)\n\n\tuseEffect(() => {\n\t\tsetIsSupported(typeof window !== \"undefined\" && \"performance\" in window)\n\n\t\tif (!isSupported) return\n\n\t\tperformanceMonitor.startMonitoring()\n\t\tconst unsubscribe = performanceMonitor.subscribe(setMetrics)\n\n\t\treturn () => {\n\t\t\tunsubscribe()\n\t\t\tperformanceMonitor.stopMonitoring()\n\t\t}\n\t}, [isSupported])\n\n\tconst measureRender = useCallback((componentName: string, renderFn: () => any): any => {\n\t\treturn performanceMonitor.measureComponentRender(componentName, renderFn)\n\t}, [])\n\n\treturn {\n\t\tmetrics,\n\t\tisSupported,\n\t\tmeasureRender,\n\t\taverageMetrics: performanceMonitor.getAverageMetrics(),\n\t\tallMetrics: performanceMonitor.getAllMetrics(),\n\t\tthresholds: performanceMonitor.getThresholds()\n\t}\n}\n\n// HOC for performance monitoring\nexport function withPerformanceMonitoring(\n\tWrappedComponent: React.ComponentType<any>,\n\tcomponentName?: string\n) {\n\tconst displayName =\n\t\tcomponentName || WrappedComponent.displayName || WrappedComponent.name || \"Component\"\n\n\tfunction PerformanceMonitoredComponent(props: any) {\n\t\tconst renderRef = useRef(0)\n\t\tconst { measureRender } = usePerformanceMonitor()\n\n\t\t// Use a simple counter that increments during render but doesn't access the ref value\n\t\tconst renderKey = useState(() => Math.random())[0]\n\n\t\t// Update ref in effect to track count without accessing during render\n\t\tuseEffect(() => {\n\t\t\trenderRef.current += 1\n\t\t})\n\n\t\treturn measureRender(`${displayName}-${renderKey}`, () => <WrappedComponent {...props} />)\n\t}\n\n\tPerformanceMonitoredComponent.displayName = `withPerformanceMonitoring(${displayName})`\n\treturn PerformanceMonitoredComponent\n}\n\n// Performance regression detector\nexport class PerformanceRegressionDetector {\n\tprivate baselineMetrics: PerformanceMetrics | null = null\n\tprivate regressionThreshold = 0.2 // 20% degradation threshold\n\n\tsetBaseline(metrics: PerformanceMetrics) {\n\t\tthis.baselineMetrics = metrics\n\t}\n\n\tdetectRegression(currentMetrics: PerformanceMetrics): Array<{\n\t\tmetric: keyof PerformanceMetrics\n\t\tbaseline: number\n\t\tcurrent: number\n\t\tdegradation: number\n\t}> {\n\t\tif (!this.baselineMetrics) return []\n\n\t\tconst regressions: Array<{\n\t\t\tmetric: keyof PerformanceMetrics\n\t\t\tbaseline: number\n\t\t\tcurrent: number\n\t\t\tdegradation: number\n\t\t}> = []\n\n\t\tconst metricsToCheck: Array<keyof PerformanceMetrics> = [\n\t\t\t\"componentRenderTime\",\n\t\t\t\"bundleLoadTime\",\n\t\t\t\"mediaLoadTime\",\n\t\t\t\"memoryUsage\"\n\t\t]\n\n\t\tmetricsToCheck.forEach((metric) => {\n\t\t\tconst baseline = this.baselineMetrics![metric] as number\n\t\t\tconst current = currentMetrics[metric] as number\n\n\t\t\tif (baseline && current && baseline > 0) {\n\t\t\t\tconst degradation = (current - baseline) / baseline\n\t\t\t\tif (degradation > this.regressionThreshold) {\n\t\t\t\t\tregressions.push({ metric, baseline, current, degradation })\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\n\t\treturn regressions\n\t}\n\n\tsetRegressionThreshold(threshold: number) {\n\t\tthis.regressionThreshold = Math.max(0, Math.min(1, threshold))\n\t}\n}\n\n// Development dashboard component\nexport interface PerformanceDashboardProps {\n\tclassName?: string\n\tshowAdvanced?: boolean\n}\n\nexport function PerformanceDashboard({\n\tclassName = \"\",\n\tshowAdvanced = false\n}: PerformanceDashboardProps) {\n\tconst { metrics, averageMetrics, thresholds, isSupported } = usePerformanceMonitor()\n\n\tif (!isSupported || !metrics) {\n\t\treturn (\n\t\t\t<div className={`performance-dashboard ${className}`}>\n\t\t\t\t<p>Performance monitoring not supported in this environment</p>\n\t\t\t</div>\n\t\t)\n\t}\n\n\tconst getScoreColor = (score: number) => {\n\t\tif (score >= 90) return \"text-green-600\"\n\t\tif (score >= 70) return \"text-yellow-600\"\n\t\treturn \"text-red-600\"\n\t}\n\n\tconst formatBytes = (bytes: number) => {\n\t\treturn `${(bytes / 1024 / 1024).toFixed(2)} MB`\n\t}\n\n\treturn (\n\t\t<div className={`performance-dashboard rounded-lg bg-white p-4 shadow ${className}`}>\n\t\t\t<h3 className=\"mb-4 font-semibold text-lg\">Performance Dashboard</h3>\n\n\t\t\t{/* Performance Score */}\n\t\t\t<div className=\"mb-4\">\n\t\t\t\t<div className=\"flex items-center justify-between\">\n\t\t\t\t\t<span>Performance Score</span>\n\t\t\t\t\t<span className={`font-bold ${getScoreColor(metrics.performanceScore)}`}>\n\t\t\t\t\t\t{metrics.performanceScore.toFixed(0)}\n\t\t\t\t\t</span>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"mt-1 h-2 w-full rounded-full bg-gray-200\">\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={`h-2 rounded-full transition-all duration-300 ${\n\t\t\t\t\t\t\tmetrics.performanceScore >= 90\n\t\t\t\t\t\t\t\t? \"bg-green-500\"\n\t\t\t\t\t\t\t\t: metrics.performanceScore >= 70\n\t\t\t\t\t\t\t\t\t? \"bg-yellow-500\"\n\t\t\t\t\t\t\t\t\t: \"bg-red-500\"\n\t\t\t\t\t\t}`}\n\t\t\t\t\t\tstyle={{ width: `${metrics.performanceScore}%` }}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t{/* Core Web Vitals */}\n\t\t\t<div className=\"mb-4 grid grid-cols-2 gap-4\">\n\t\t\t\t<div>\n\t\t\t\t\t<h4 className=\"mb-2 font-medium\">Core Web Vitals</h4>\n\t\t\t\t\t<div className=\"space-y-1 text-sm\">\n\t\t\t\t\t\t{metrics.lcp && <div>LCP: {metrics.lcp.toFixed(0)}ms</div>}\n\t\t\t\t\t\t{metrics.fid && <div>FID: {metrics.fid.toFixed(0)}ms</div>}\n\t\t\t\t\t\t{metrics.cls && <div>CLS: {metrics.cls.toFixed(3)}</div>}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\n\t\t\t\t<div>\n\t\t\t\t\t<h4 className=\"mb-2 font-medium\">Custom Metrics</h4>\n\t\t\t\t\t<div className=\"space-y-1 text-sm\">\n\t\t\t\t\t\t<div>Render: {metrics.componentRenderTime.toFixed(2)}ms</div>\n\t\t\t\t\t\t<div>Memory: {formatBytes(metrics.memoryUsage)}</div>\n\t\t\t\t\t\t{metrics.bundleLoadTime > 0 && <div>Bundle: {metrics.bundleLoadTime.toFixed(0)}ms</div>}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t{/* Advanced metrics */}\n\t\t\t{showAdvanced && (\n\t\t\t\t<div>\n\t\t\t\t\t<h4 className=\"mb-2 font-medium\">Advanced Metrics</h4>\n\t\t\t\t\t<div className=\"space-y-1 text-sm\">\n\t\t\t\t\t\t<div>Average Render Time: {(averageMetrics.componentRenderTime || 0).toFixed(2)}ms</div>\n\t\t\t\t\t\t<div>Average Memory: {formatBytes(averageMetrics.memoryUsage || 0)}</div>\n\t\t\t\t\t\t<div>Average Score: {(averageMetrics.performanceScore || 0).toFixed(0)}</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n\nexport default PerformanceMonitor\n"],"mappings":"qIAiCa,EAA2C,CACvD,IAAK,CAAE,KAAM,KAAM,KAAM,GAAK,EAC9B,IAAK,CAAE,KAAM,IAAK,KAAM,GAAI,EAC5B,IAAK,CAAE,KAAM,GAAK,KAAM,GAAK,EAC7B,WAAY,CAAE,KAAM,GAAI,KAAM,GAAI,EAClC,YAAa,CAAE,KAAM,GAAK,KAAO,KAAM,KAAM,IAAM,KAAO,IAAK,CAChE,EAGa,EAAb,KAAgC,CAO/B,YAAY,EAAoC,EAAmB,UANnE,UAAwC,CAAC,CAAA,WACzC,YAAgE,IAAI,GAAI,WACxE,aAAA,IAAA,EAAA,WACA,WAAA,IAAA,EAAA,WACA,eAAuB,EAAA,EAGtB,KAAK,WAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,8BAA8B,CACpC,CAEA,MAAc,qBAAsB,CAC/B,YAAO,OAAW,KAEtB,GAAI,CAEH,IAAM,EAAY,MAAM,OAAO,aAAa,CAAC,UAAY,IAAI,EAE7D,GAAI,CAAC,EAAW,CACf,QAAQ,KAAK,qEAAqE,EAClF,MACD,CAEA,IAAM,EAAgC,GAAW,CAChD,KAAK,aAAa,EAAO,KAAK,YAAY,EAA+B,EAAO,KAAK,CACtF,EAGM,EAAY,EACd,EAAU,QAAQ,EAAU,OAAO,CAAa,EAChD,EAAU,QAAQ,EAAU,OAAO,CAAa,EAChD,EAAU,QAAQ,EAAU,OAAO,CAAa,EAChD,EAAU,QAAQ,EAAU,OAAO,CAAa,EAChD,EAAU,SAAS,EAAU,QAAQ,CAAa,EAClD,EAAU,OAAO,EAAU,MAAM,CAAa,C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f,EACC,EAAA,EAAA,KAAA,CAAC,MAAD,CAAA,SAAA,CAAK,yBAAuB,EAAe,qBAAuB,EAAA,CAAG,QAAQ,CAAC,EAAE,IAAO,CAAA,CAAA,GACvF,EAAA,EAAA,KAAA,CAAC,MAAD,CAAA,SAAA,CAAK,mBAAiB,EAAY,EAAe,aAAe,CAAC,CAAO,CAAA,CAAA,GACxE,EAAA,EAAA,KAAA,CAAC,MAAD,CAAA,SAAA,CAAK,mBAAiB,EAAe,kBAAoB,EAAA,CAAG,QAAQ,CAAC,CAAO,CAAA,CAAA,CACxE,GACD,CAAA,CAAA,CAEF,GAEP"}
@@ -0,0 +1,14 @@
1
+ //#region \0rolldown/runtime.js
2
+ var e = Object.defineProperty, t = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), n = (t, n) => {
3
+ let r = {};
4
+ for (var i in t) e(r, i, {
5
+ get: t[i],
6
+ enumerable: !0
7
+ });
8
+ return n || e(r, Symbol.toStringTag, { value: "Module" }), r;
9
+ }, r = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
10
+ if (typeof require < "u") return require.apply(this, arguments);
11
+ throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
12
+ });
13
+ //#endregion
14
+ export { n, r, t };
@@ -0,0 +1 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return o}});
@@ -0,0 +1,64 @@
1
+ import { _ as e, v as t } from "./enhanced-components-BwjBqSA1.js";
2
+ //#region ../ui/src/lib/utils.ts
3
+ function n(...n) {
4
+ return e(t(...n));
5
+ }
6
+ //#endregion
7
+ //#region ../../node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.mjs
8
+ var r = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), i = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), a = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), o = (e) => {
9
+ let t = a(e);
10
+ return t.charAt(0).toUpperCase() + t.slice(1);
11
+ }, s = (e) => {
12
+ for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
13
+ return !1;
14
+ };
15
+ //#endregion
16
+ //#region src/lib/async-utils.ts
17
+ function c(e, t, n = {
18
+ leading: !0,
19
+ trailing: !0
20
+ }) {
21
+ let r, i = 0, a = null, { leading: o = !0, trailing: s = !0 } = n;
22
+ return ((...n) => {
23
+ let c = Date.now(), l = t - (c - i), u = () => {
24
+ i = Date.now(), a = null, r = e(...n);
25
+ };
26
+ return i ? l <= 0 ? (a && (clearTimeout(a), a = null), r = e(...n), i = c) : s && !a && (a = setTimeout(() => u(), l)) : (o && (r = e(...n)), i = c), r;
27
+ });
28
+ }
29
+ function l(e, t, n = {}) {
30
+ let r = null, { immediate: i = !1 } = n;
31
+ return ((...n) => {
32
+ let a = () => (r = null, e(...n)), o = () => {
33
+ if (r = null, !i) return e(...n);
34
+ }, s = i && !r ? e(...n) : void 0;
35
+ return r && clearTimeout(r), r = setTimeout(i ? o : a, t), s;
36
+ });
37
+ }
38
+ function u(e, t) {
39
+ let n = e, r = 0, i = e;
40
+ return {
41
+ update: (e) => {
42
+ n = e;
43
+ let a = Date.now();
44
+ a - r >= t && (i = e, r = a);
45
+ },
46
+ getThrottledValue: () => i,
47
+ getLatestValue: () => n,
48
+ forceUpdate: () => {
49
+ i = n, r = Date.now();
50
+ }
51
+ };
52
+ }
53
+ function d(e) {
54
+ let t = [], n = !1, r = () => {
55
+ t.length > 0 && (e(t), t = []), n = !1;
56
+ };
57
+ return (...e) => {
58
+ t.push(e), n || (n = !0, setTimeout(() => r(), 0));
59
+ };
60
+ }
61
+ //#endregion
62
+ export { s as a, r as c, c as i, n as l, u as n, o, l as r, i as s, d as t };
63
+
64
+ //# sourceMappingURL=utils-D2gQ7c2R.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-D2gQ7c2R.js","names":[],"sources":["../../ui/src/lib/utils.ts","../../../node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.mjs","../../../node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.mjs","../../../node_modules/lucide-react/dist/esm/shared/src/utils/toCamelCase.mjs","../../../node_modules/lucide-react/dist/esm/shared/src/utils/toPascalCase.mjs","../../../node_modules/lucide-react/dist/esm/shared/src/utils/hasA11yProp.mjs","../src/lib/async-utils.ts"],"sourcesContent":["import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(...inputs));\n}\n","/**\n * @license lucide-react v1.24.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst mergeClasses = (...classes) => classes.filter((className, index, array) => {\n return Boolean(className) && className.trim() !== \"\" && array.indexOf(className) === index;\n}).join(\" \").trim();\n\nexport { mergeClasses };\n//# sourceMappingURL=mergeClasses.mjs.map\n","/**\n * @license lucide-react v1.24.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, \"$1-$2\").toLowerCase();\n\nexport { toKebabCase };\n//# sourceMappingURL=toKebabCase.mjs.map\n","/**\n * @license lucide-react v1.24.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst toCamelCase = (string) => string.replace(\n /^([A-Z])|[\\s-_]+(\\w)/g,\n (match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()\n);\n\nexport { toCamelCase };\n//# sourceMappingURL=toCamelCase.mjs.map\n","/**\n * @license lucide-react v1.24.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport { toCamelCase } from './toCamelCase.mjs';\n\nconst toPascalCase = (string) => {\n const camelCase = toCamelCase(string);\n return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);\n};\n\nexport { toPascalCase };\n//# sourceMappingURL=toPascalCase.mjs.map\n","/**\n * @license lucide-react v1.24.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst hasA11yProp = (props) => {\n for (const prop in props) {\n if (prop.startsWith(\"aria-\") || prop === \"role\" || prop === \"title\") {\n return true;\n }\n }\n return false;\n};\n\nexport { hasA11yProp };\n//# sourceMappingURL=hasA11yProp.mjs.map\n","/**\n * Async utilities for performance optimization\n * Provides throttle and debounce functions for controlling event frequency\n */\n\n/**\n * Throttle function that ensures a function is only called at most once\n * within a specified time period. Includes options for leading and trailing calls.\n *\n * @param func - The function to throttle\n * @param limit - The time limit in milliseconds\n * @param options - Options for leading/trailing edge calls\n * @returns The throttled function\n *\n * @example\n * // Throttle a click handler to at most once per 250ms\n * const throttledClick = throttle(handleClick, 250);\n *\n * // For timeupdate events with leading edge disabled\n * const throttledUpdate = throttle(handleUpdate, 250, { leading: false });\n */\nexport function throttle<T extends (...args: Parameters<T>) => ReturnType<T>>(\n\tfunc: T,\n\tlimit: number,\n\toptions: { leading?: boolean; trailing?: boolean } = {\n\t\tleading: true,\n\t\ttrailing: true\n\t}\n): T {\n\tlet lastResult: ReturnType<T> | undefined\n\tlet lastCallTime = 0\n\tlet timeoutId: ReturnType<typeof setTimeout> | null = null\n\tconst { leading = true, trailing = true } = options\n\n\treturn ((...args: Parameters<T>): ReturnType<T> => {\n\t\tconst now = Date.now()\n\t\tconst remaining = limit - (now - lastCallTime)\n\n\t\tconst call = () => {\n\t\t\tlastCallTime = Date.now()\n\t\t\ttimeoutId = null\n\t\t\tlastResult = func(...args)\n\t\t}\n\n\t\tif (!lastCallTime) {\n\t\t\t// First call - respect leading option\n\t\t\tif (leading) {\n\t\t\t\tlastResult = func(...args)\n\t\t\t}\n\t\t\tlastCallTime = now\n\t\t} else if (remaining <= 0) {\n\t\t\t// Time limit reached\n\t\t\tif (timeoutId) {\n\t\t\t\tclearTimeout(timeoutId)\n\t\t\t\ttimeoutId = null\n\t\t\t}\n\t\t\tlastResult = func(...args)\n\t\t\tlastCallTime = now\n\t\t} else if (trailing && !timeoutId) {\n\t\t\t// Schedule trailing call\n\t\t\ttimeoutId = setTimeout(() => call(), remaining)\n\t\t}\n\n\t\treturn lastResult as ReturnType<T>\n\t}) as T\n}\n\n/**\n * Debounce function that delays calling a function until after a specified\n * wait period has elapsed since the last time the debounced function was called.\n *\n * @param func - The function to debounce\n * @param wait - The wait period in milliseconds\n * @param options - Options for immediate invocation\n * @returns The debounced function\n *\n * @example\n * // Debounce a resize handler\n * const debouncedResize = debounce(handleResize, 150);\n *\n * // Debounce with immediate option for form validation\n * const immediateValidate = debounce(validateForm, 300, { immediate: true });\n */\nexport function debounce<T extends (...args: Parameters<T>) => ReturnType<T>>(\n\tfunc: T,\n\twait: number,\n\toptions: { immediate?: boolean } = {}\n): T {\n\tlet timeoutId: ReturnType<typeof setTimeout> | null = null\n\tconst { immediate = false } = options\n\n\treturn ((...args: Parameters<T>): ReturnType<T> => {\n\t\tconst call = () => {\n\t\t\ttimeoutId = null\n\t\t\treturn func(...args)\n\t\t}\n\n\t\tconst later = () => {\n\t\t\ttimeoutId = null\n\t\t\tif (!immediate) {\n\t\t\t\treturn func(...args)\n\t\t\t}\n\t\t}\n\n\t\tconst callNow = immediate && !timeoutId\n\t\tconst result = callNow ? func(...args) : undefined\n\n\t\tif (timeoutId) {\n\t\t\tclearTimeout(timeoutId)\n\t\t}\n\n\t\ttimeoutId = setTimeout(immediate ? later : call, wait)\n\n\t\treturn result as ReturnType<T>\n\t}) as T\n}\n\n/**\n * Creates a throttled callback that only updates the value at most once\n * per interval, but always returns the latest value when called.\n * Useful for UI updates that should be throttled but need to show final state.\n *\n * @param initialValue - The initial value\n * @param limit - The time limit in milliseconds\n * @returns An object with update function and getter functions\n *\n * @example\n * const { update, getThrottledValue, getLatestValue } = createThrottledValue(0, 250);\n */\nexport function createThrottledValue<T>(initialValue: T, limit: number) {\n\tlet latestValue = initialValue\n\tlet lastUpdateTime = 0\n\tlet throttledValue = initialValue\n\n\tconst update = (value: T) => {\n\t\tlatestValue = value\n\t\tconst now = Date.now()\n\t\tif (now - lastUpdateTime >= limit) {\n\t\t\tthrottledValue = value\n\t\t\tlastUpdateTime = now\n\t\t}\n\t}\n\n\tconst getThrottledValue = () => throttledValue\n\tconst getLatestValue = () => latestValue\n\tconst forceUpdate = () => {\n\t\tthrottledValue = latestValue\n\t\tlastUpdateTime = Date.now()\n\t}\n\n\treturn { update, getThrottledValue, getLatestValue, forceUpdate }\n}\n\n/**\n * Batch multiple rapid calls into a single call at the end of the event loop.\n * Useful for React state updates that should be batched.\n *\n * @param func - The function to call with batched arguments\n * @returns A function that batches arguments and calls the original function once\n *\n * @example\n * const batchUpdate = batch((updates) => {\n * updates.forEach(update => setState(prev => ({ ...prev, ...update })));\n * });\n *\n * // Multiple rapid calls will be batched\n * batchUpdate({ a: 1 });\n * batchUpdate({ a: 2 });\n * batchUpdate({ a: 3 });\n */\nexport function batch<T extends (...args: Parameters<T>) => void>(\n\tfunc: (args: Parameters<T>[]) => void\n): (...args: Parameters<T>) => void {\n\tlet batchedArgs: Parameters<T>[] = []\n\tlet scheduled = false\n\n\tconst flush = () => {\n\t\tif (batchedArgs.length > 0) {\n\t\t\tfunc(batchedArgs)\n\t\t\tbatchedArgs = []\n\t\t}\n\t\tscheduled = false\n\t}\n\n\treturn (...args: Parameters<T>) => {\n\t\tbatchedArgs.push(args)\n\t\tif (!scheduled) {\n\t\t\tscheduled = true\n\t\t\t// Use setImmediate/setTimeout pattern for cross-environment compatibility\n\t\t\t// In browsers this schedules as a macrotask, in tests with fake timers it will fire\n\t\t\tsetTimeout(() => flush(), 0)\n\t\t}\n\t}\n}\n"],"x_google_ignoreList":[1,2,3,4,5],"mappings":";;AAGA,SAAgB,EAAG,GAAG,GAAsB;CAC1C,OAAO,EAAQ,EAAK,GAAG,CAAM,CAAC;AAChC;;;ACEA,IAAM,KAAgB,GAAG,MAAY,EAAQ,QAAQ,GAAW,GAAO,MAC9D,EAAQ,KAAc,EAAU,KAAK,MAAM,MAAM,EAAM,QAAQ,CAAS,MAAM,CACtF,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,GCFZ,KAAe,MAAW,EAAO,QAAQ,sBAAsB,OAAO,CAAC,CAAC,YAAY,GCApF,KAAe,MAAW,EAAO,QACrC,0BACC,GAAO,GAAI,MAAO,IAAK,EAAG,YAAY,IAAI,EAAG,YAAY,CAC5D,GCDM,KAAgB,MAAW;CAC/B,IAAM,IAAY,EAAY,CAAM;CACpC,OAAO,EAAU,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,EAAU,MAAM,CAAC;AAC9D,GCLM,KAAe,MAAU;CAC7B,KAAK,IAAM,KAAQ,GACjB,IAAI,EAAK,WAAW,O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,mBAL1B;GAEzB,AADA,IAAiB,GACjB,IAAiB,KAAK,IAAI;EAC3B;CAEgE;AACjE;AAmBA,SAAgB,EACf,GACmC;CACnC,IAAI,IAA+B,CAAC,GAChC,IAAY,IAEV,UAAc;EAKnB,AAJI,EAAY,SAAS,MACxB,EAAK,CAAW,GAChB,IAAc,CAAC,IAEhB,IAAY;CACb;CAEA,QAAQ,GAAG,MAAwB;EAElC,AADA,EAAY,KAAK,CAAI,GAChB,MACJ,IAAY,IAGZ,iBAAiB,EAAM,GAAG,CAAC;CAE7B;AACD"}
@@ -0,0 +1,2 @@
1
+ const e=require("./enhanced-components-C-ka-XLp.cjs");function t(...t){return e._(e.v(...t))}var n=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),r=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),i=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),a=e=>{let t=i(e);return t.charAt(0).toUpperCase()+t.slice(1)},o=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1};function s(e,t,n={leading:!0,trailing:!0}){let r,i=0,a=null,{leading:o=!0,trailing:s=!0}=n;return((...n)=>{let c=Date.now(),l=t-(c-i),u=()=>{i=Date.now(),a=null,r=e(...n)};return i?l<=0?(a&&(clearTimeout(a),a=null),r=e(...n),i=c):s&&!a&&(a=setTimeout(()=>u(),l)):(o&&(r=e(...n)),i=c),r})}function c(e,t,n={}){let r=null,{immediate:i=!1}=n;return((...n)=>{let a=()=>(r=null,e(...n)),o=()=>{if(r=null,!i)return e(...n)},s=i&&!r?e(...n):void 0;return r&&clearTimeout(r),r=setTimeout(i?o:a,t),s})}function l(e,t){let n=e,r=0,i=e;return{update:e=>{n=e;let a=Date.now();a-r>=t&&(i=e,r=a)},getThrottledValue:()=>i,getLatestValue:()=>n,forceUpdate:()=>{i=n,r=Date.now()}}}function u(e){let t=[],n=!1,r=()=>{t.length>0&&(e(t),t=[]),n=!1};return(...e)=>{t.push(e),n||(n=!0,setTimeout(()=>r(),0))}}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return u}});
2
+ //# sourceMappingURL=utils-DJaAwiZ9.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-DJaAwiZ9.cjs","names":[],"sources":["../../ui/src/lib/utils.ts","../../../node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.mjs","../../../node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.mjs","../../../node_modules/lucide-react/dist/esm/shared/src/utils/toCamelCase.mjs","../../../node_modules/lucide-react/dist/esm/shared/src/utils/toPascalCase.mjs","../../../node_modules/lucide-react/dist/esm/shared/src/utils/hasA11yProp.mjs","../src/lib/async-utils.ts"],"sourcesContent":["import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(...inputs));\n}\n","/**\n * @license lucide-react v1.24.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst mergeClasses = (...classes) => classes.filter((className, index, array) => {\n return Boolean(className) && className.trim() !== \"\" && array.indexOf(className) === index;\n}).join(\" \").trim();\n\nexport { mergeClasses };\n//# sourceMappingURL=mergeClasses.mjs.map\n","/**\n * @license lucide-react v1.24.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, \"$1-$2\").toLowerCase();\n\nexport { toKebabCase };\n//# sourceMappingURL=toKebabCase.mjs.map\n","/**\n * @license lucide-react v1.24.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst toCamelCase = (string) => string.replace(\n /^([A-Z])|[\\s-_]+(\\w)/g,\n (match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()\n);\n\nexport { toCamelCase };\n//# sourceMappingURL=toCamelCase.mjs.map\n","/**\n * @license lucide-react v1.24.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport { toCamelCase } from './toCamelCase.mjs';\n\nconst toPascalCase = (string) => {\n const camelCase = toCamelCase(string);\n return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);\n};\n\nexport { toPascalCase };\n//# sourceMappingURL=toPascalCase.mjs.map\n","/**\n * @license lucide-react v1.24.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nconst hasA11yProp = (props) => {\n for (const prop in props) {\n if (prop.startsWith(\"aria-\") || prop === \"role\" || prop === \"title\") {\n return true;\n }\n }\n return false;\n};\n\nexport { hasA11yProp };\n//# sourceMappingURL=hasA11yProp.mjs.map\n","/**\n * Async utilities for performance optimization\n * Provides throttle and debounce functions for controlling event frequency\n */\n\n/**\n * Throttle function that ensures a function is only called at most once\n * within a specified time period. Includes options for leading and trailing calls.\n *\n * @param func - The function to throttle\n * @param limit - The time limit in milliseconds\n * @param options - Options for leading/trailing edge calls\n * @returns The throttled function\n *\n * @example\n * // Throttle a click handler to at most once per 250ms\n * const throttledClick = throttle(handleClick, 250);\n *\n * // For timeupdate events with leading edge disabled\n * const throttledUpdate = throttle(handleUpdate, 250, { leading: false });\n */\nexport function throttle<T extends (...args: Parameters<T>) => ReturnType<T>>(\n\tfunc: T,\n\tlimit: number,\n\toptions: { leading?: boolean; trailing?: boolean } = {\n\t\tleading: true,\n\t\ttrailing: true\n\t}\n): T {\n\tlet lastResult: ReturnType<T> | undefined\n\tlet lastCallTime = 0\n\tlet timeoutId: ReturnType<typeof setTimeout> | null = null\n\tconst { leading = true, trailing = true } = options\n\n\treturn ((...args: Parameters<T>): ReturnType<T> => {\n\t\tconst now = Date.now()\n\t\tconst remaining = limit - (now - lastCallTime)\n\n\t\tconst call = () => {\n\t\t\tlastCallTime = Date.now()\n\t\t\ttimeoutId = null\n\t\t\tlastResult = func(...args)\n\t\t}\n\n\t\tif (!lastCallTime) {\n\t\t\t// First call - respect leading option\n\t\t\tif (leading) {\n\t\t\t\tlastResult = func(...args)\n\t\t\t}\n\t\t\tlastCallTime = now\n\t\t} else if (remaining <= 0) {\n\t\t\t// Time limit reached\n\t\t\tif (timeoutId) {\n\t\t\t\tclearTimeout(timeoutId)\n\t\t\t\ttimeoutId = null\n\t\t\t}\n\t\t\tlastResult = func(...args)\n\t\t\tlastCallTime = now\n\t\t} else if (trailing && !timeoutId) {\n\t\t\t// Schedule trailing call\n\t\t\ttimeoutId = setTimeout(() => call(), remaining)\n\t\t}\n\n\t\treturn lastResult as ReturnType<T>\n\t}) as T\n}\n\n/**\n * Debounce function that delays calling a function until after a specified\n * wait period has elapsed since the last time the debounced function was called.\n *\n * @param func - The function to debounce\n * @param wait - The wait period in milliseconds\n * @param options - Options for immediate invocation\n * @returns The debounced function\n *\n * @example\n * // Debounce a resize handler\n * const debouncedResize = debounce(handleResize, 150);\n *\n * // Debounce with immediate option for form validation\n * const immediateValidate = debounce(validateForm, 300, { immediate: true });\n */\nexport function debounce<T extends (...args: Parameters<T>) => ReturnType<T>>(\n\tfunc: T,\n\twait: number,\n\toptions: { immediate?: boolean } = {}\n): T {\n\tlet timeoutId: ReturnType<typeof setTimeout> | null = null\n\tconst { immediate = false } = options\n\n\treturn ((...args: Parameters<T>): ReturnType<T> => {\n\t\tconst call = () => {\n\t\t\ttimeoutId = null\n\t\t\treturn func(...args)\n\t\t}\n\n\t\tconst later = () => {\n\t\t\ttimeoutId = null\n\t\t\tif (!immediate) {\n\t\t\t\treturn func(...args)\n\t\t\t}\n\t\t}\n\n\t\tconst callNow = immediate && !timeoutId\n\t\tconst result = callNow ? func(...args) : undefined\n\n\t\tif (timeoutId) {\n\t\t\tclearTimeout(timeoutId)\n\t\t}\n\n\t\ttimeoutId = setTimeout(immediate ? later : call, wait)\n\n\t\treturn result as ReturnType<T>\n\t}) as T\n}\n\n/**\n * Creates a throttled callback that only updates the value at most once\n * per interval, but always returns the latest value when called.\n * Useful for UI updates that should be throttled but need to show final state.\n *\n * @param initialValue - The initial value\n * @param limit - The time limit in milliseconds\n * @returns An object with update function and getter functions\n *\n * @example\n * const { update, getThrottledValue, getLatestValue } = createThrottledValue(0, 250);\n */\nexport function createThrottledValue<T>(initialValue: T, limit: number) {\n\tlet latestValue = initialValue\n\tlet lastUpdateTime = 0\n\tlet throttledValue = initialValue\n\n\tconst update = (value: T) => {\n\t\tlatestValue = value\n\t\tconst now = Date.now()\n\t\tif (now - lastUpdateTime >= limit) {\n\t\t\tthrottledValue = value\n\t\t\tlastUpdateTime = now\n\t\t}\n\t}\n\n\tconst getThrottledValue = () => throttledValue\n\tconst getLatestValue = () => latestValue\n\tconst forceUpdate = () => {\n\t\tthrottledValue = latestValue\n\t\tlastUpdateTime = Date.now()\n\t}\n\n\treturn { update, getThrottledValue, getLatestValue, forceUpdate }\n}\n\n/**\n * Batch multiple rapid calls into a single call at the end of the event loop.\n * Useful for React state updates that should be batched.\n *\n * @param func - The function to call with batched arguments\n * @returns A function that batches arguments and calls the original function once\n *\n * @example\n * const batchUpdate = batch((updates) => {\n * updates.forEach(update => setState(prev => ({ ...prev, ...update })));\n * });\n *\n * // Multiple rapid calls will be batched\n * batchUpdate({ a: 1 });\n * batchUpdate({ a: 2 });\n * batchUpdate({ a: 3 });\n */\nexport function batch<T extends (...args: Parameters<T>) => void>(\n\tfunc: (args: Parameters<T>[]) => void\n): (...args: Parameters<T>) => void {\n\tlet batchedArgs: Parameters<T>[] = []\n\tlet scheduled = false\n\n\tconst flush = () => {\n\t\tif (batchedArgs.length > 0) {\n\t\t\tfunc(batchedArgs)\n\t\t\tbatchedArgs = []\n\t\t}\n\t\tscheduled = false\n\t}\n\n\treturn (...args: Parameters<T>) => {\n\t\tbatchedArgs.push(args)\n\t\tif (!scheduled) {\n\t\t\tscheduled = true\n\t\t\t// Use setImmediate/setTimeout pattern for cross-environment compatibility\n\t\t\t// In browsers this schedules as a macrotask, in tests with fake timers it will fire\n\t\t\tsetTimeout(() => flush(), 0)\n\t\t}\n\t}\n}\n"],"x_google_ignoreList":[1,2,3,4,5],"mappings":"sDAGA,SAAgB,EAAG,GAAG,EAAsB,CAC1C,OAAO,EAAA,EAAQ,EAAA,EAAK,GAAG,CAAM,CAAC,CAChC,CCEA,IAAM,GAAgB,GAAG,IAAY,EAAQ,QAAQ,EAAW,EAAO,IAC9D,EAAQ,GAAc,EAAU,KAAK,IAAM,IAAM,EAAM,QAAQ,CAAS,IAAM,CACtF,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,ECFZ,EAAe,GAAW,EAAO,QAAQ,qBAAsB,OAAO,CAAC,CAAC,YAAY,ECApF,EAAe,GAAW,EAAO,QACrC,yBACC,EAAO,EAAI,IAAO,EAAK,EAAG,YAAY,EAAI,EAAG,YAAY,CAC5D,ECDM,EAAgB,GAAW,CAC/B,IAAM,EAAY,EAAY,CAAM,EACpC,OAAO,EAAU,OAAO,CAAC,CAAC,CAAC,YAAY,EAAI,EAAU,MAAM,CAAC,CAC9D,ECLM,EAAe,GAAU,CAC7B,IAAK,IAAM,KAAQ,EACjB,GAAI,EAAK,WAAW,OAAO,GAAK,IAAS,QAAU,IAAS,QAC1D,MAAO,GAGX,MAAO,EACT,ECOA,SAAgB,EACf,EACA,EACA,EAAqD,CACpD,QAAS,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C,EAAY,GAEV,MAAc,CACf,EAAY,OAAS,IACxB,EAAK,CAAW,EAChB,EAAc,CAAC,GAEhB,EAAY,EACb,EAEA,OAAQ,GAAG,IAAwB,CAClC,EAAY,KAAK,CAAI,EAChB,IACJ,EAAY,GAGZ,eAAiB,EAAM,EAAG,CAAC,EAE7B,CACD"}
package/dist/utils.js CHANGED
@@ -1,2 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./utils-CFOue_9K.cjs");exports.batch=e.batch;exports.cn=e.cn;exports.createThrottledValue=e.createThrottledValue;exports.debounce=e.debounce;exports.formatTime=e.formatTime;exports.parseTime=e.parseTime;exports.throttle=e.throttle;
2
- //# sourceMappingURL=utils.js.map
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./enhanced-components-C-ka-XLp.cjs"),t=require("./utils-DJaAwiZ9.cjs");exports.batch=t.t,exports.cn=e.g,exports.createThrottledValue=t.n,exports.debounce=t.r,exports.formatTime=e.p,exports.parseTime=e.m,exports.throttle=t.i;
package/dist/utils.mjs CHANGED
@@ -1,11 +1,3 @@
1
- import { j as t, c as s, i as r, g as o, f as c, p as m, e as f } from "./utils-Dzpl2ArK.js";
2
- export {
3
- t as batch,
4
- s as cn,
5
- r as createThrottledValue,
6
- o as debounce,
7
- c as formatTime,
8
- m as parseTime,
9
- f as throttle
10
- };
11
- //# sourceMappingURL=utils.mjs.map
1
+ import { g as e, m as t, p as n } from "./enhanced-components-BwjBqSA1.js";
2
+ import { i as r, n as i, r as a, t as o } from "./utils-D2gQ7c2R.js";
3
+ export { o as batch, e as cn, i as createThrottledValue, a as debounce, n as formatTime, t as parseTime, r as throttle };