react-doctor 0.9.12 → 0.9.13-dev.1239043

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 (52) hide show
  1. package/README.md +34 -1
  2. package/bin/react-doctor.js +1 -9
  3. package/dist/active-run-trace-dlIZeEvb.js +18 -0
  4. package/dist/active-scan-abort-registry-DwG6tSPy.js +28 -0
  5. package/dist/{build-section-divider-BsQvH-7I.js → build-section-divider-C09RcJrc.js} +10 -25
  6. package/dist/{ci-B4x4RjKD.js → ci-CUgNjCr-.js} +13 -12
  7. package/dist/cli.js +121 -41
  8. package/dist/{design-A48PNCf_.js → design-CX2j8ubS.js} +4 -4
  9. package/dist/{devtools-DPRVRu3S.js → devtools-CC2PAZ85.js} +4 -4
  10. package/dist/{exit-gracefully-Bk531kS-.js → exit-gracefully-cGJM2g3O.js} +15 -9
  11. package/dist/get-east-asian-width-Bv2TD3Xj.js +444 -0
  12. package/dist/{report-error-Pb2uO8EG.js → handle-error-BCI-Nv3P.js} +18 -68
  13. package/dist/index.d.ts +53 -42
  14. package/dist/index.js +55146 -54688
  15. package/dist/{inspect-CwH84aSA.js → inspect-Dq5krKWG.js} +47 -34
  16. package/dist/{install-sFN_w425.js → install-C0aiZKgf.js} +9 -8
  17. package/dist/{install-doctor-script-DLayXS7q.js → install-doctor-script-CaTIms0r.js} +7 -449
  18. package/dist/{install-github-workflow-Goz-KFqb.js → install-github-workflow-DjPgXVqg.js} +10 -6
  19. package/dist/{install-react-doctor-Bq7dfEBI.js → install-react-doctor-C-PVDWXv.js} +47 -45
  20. package/dist/{run-scan-app-DXBMW54J.js → jsx-runtime-D_A4d39v.js} +281 -2759
  21. package/dist/path-format-DnHpmJwG.js +9 -0
  22. package/dist/{print-branded-header-D_J8Qdsj.js → print-branded-header-Dz0SwyHQ.js} +4 -4
  23. package/dist/project-analysis-worker.d.ts +1 -0
  24. package/dist/project-analysis-worker.js +51905 -0
  25. package/dist/prompt-runtime-scan-url-BXdY2Opw.js +240 -0
  26. package/dist/{read-object-file-Hk79zI91.js → read-object-file-CmMGK1uu.js} +4 -4
  27. package/dist/{record-metric-CsQXJewH.js → record-metric-B6T_Ej33.js} +3285 -6018
  28. package/dist/report-error-DwL3b99q.js +64 -0
  29. package/dist/{report-workflow-result-6n_wSqzA.js → report-workflow-result-5PueDIAr.js} +5 -5
  30. package/dist/{resolve-scope-DP6rYlNO.js → resolve-scope-CTlLl7e6.js} +8 -10
  31. package/dist/{rules-BnIZ4Fq_.js → rules-DEbHKRag.js} +6 -6
  32. package/dist/run-scan-app-D3huvmXJ.js +2517 -0
  33. package/dist/runtime-scan/browser-probe.iife.js +855 -0
  34. package/dist/runtime-scan-CHFAEYg3.js +770 -0
  35. package/dist/sanitize-runtime-url-Bbq40iIp.js +76 -0
  36. package/dist/scan-C7sCm7wi.js +47 -0
  37. package/dist/semver-DFtnEmN-.js +3219 -0
  38. package/dist/{should-fail-scan-gate-DzZuTxim.js → should-fail-scan-gate-CfG_ppAV.js} +188 -187
  39. package/dist/{should-skip-prompts-D1GWG2qN.js → should-skip-prompts-BuNtAVEs.js} +4 -4
  40. package/dist/should-use-tui-B-lCjXVG.js +25 -0
  41. package/dist/skills/improve-threejs/SKILL.md +102 -0
  42. package/dist/skills/performance/SKILL.md +113 -0
  43. package/dist/skills/react-doctor/SKILL.md +6 -0
  44. package/dist/{unref-stdin-0a_0uwC6.js → telemetry-runtime-BF83aBFL.js} +57 -33
  45. package/dist/unref-stdin-SK3WfwxS.js +12 -0
  46. package/dist/{version-Bo5QDp7F.js → version-C27gr4Qj.js} +4 -4
  47. package/dist/{why-BFYbtnm8.js → why-CYRkZ2VY.js} +4 -4
  48. package/dist/with-run-span-CdsXSJgE.js +110 -0
  49. package/package.json +9 -10
  50. package/dist/chunk-q7NCDQ7-.js +0 -28
  51. package/dist/lsp.js +0 -81145
  52. package/dist/scan-CnnXz78m.js +0 -53
@@ -0,0 +1,855 @@
1
+ (function() {
2
+ //#region ../../node_modules/.pnpm/bippy@0.6.1_react@19.2.5/node_modules/bippy/dist/rdt-hook.js
3
+ /**
4
+ * @license bippy
5
+ *
6
+ * Copyright (c) Aiden Bai
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */
11
+ const e = (e) => Object.assign(e, { [Symbol.dispose]: e }), n = `bippy-0.6.1`, r = Object.defineProperty, i = Object.prototype.hasOwnProperty, a = () => {}, o = (e) => {
12
+ try {
13
+ Function.prototype.toString.call(e).indexOf(`^_^`) > -1 && setTimeout(() => {
14
+ throw Error(`React is running in production mode, but dead code elimination has not been applied. Read how to correctly configure React for production: https://reactjs.org/link/perf-use-production-build`);
15
+ });
16
+ } catch {}
17
+ }, s = (e = globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__) => !!(e && `getFiberRoots` in e);
18
+ let c = !1, l;
19
+ const u = (e = globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__) => c ? !0 : (e && typeof e.inject == `function` && (l = e.inject.toString()), !!l?.includes(`(injected)`)), d = /* @__PURE__ */ new Set(), f$1 = /* @__PURE__ */ new Set(), p$1 = /* @__PURE__ */ new Set(), m$1 = /* @__PURE__ */ new WeakSet();
20
+ let h$1 = null;
21
+ const g$1 = (e) => {
22
+ if (e.inject === h$1) return;
23
+ let t = e.inject, n = (n) => {
24
+ let r = t.call(e, n);
25
+ if (!m$1.has(n)) {
26
+ m$1.add(n);
27
+ for (let e of p$1) e(n);
28
+ }
29
+ return r;
30
+ };
31
+ e.inject = n, h$1 = n;
32
+ }, _$1 = (t) => (g$1(x$1()), p$1.add(t), e(() => {
33
+ p$1.delete(t);
34
+ })), v$1 = (e) => {
35
+ e && d.add(e);
36
+ let t = /* @__PURE__ */ new Map(), i = 0, s = {
37
+ _instrumentationIsActive: !1,
38
+ _instrumentationSource: n,
39
+ checkDCE: o,
40
+ hasUnsupportedRendererAttached: !1,
41
+ inject(e) {
42
+ let n = ++i;
43
+ return t.set(n, e), f$1.add(e), s._instrumentationIsActive || (s._instrumentationIsActive = !0, d.forEach((e) => e())), n;
44
+ },
45
+ on: a,
46
+ onCommitFiberRoot: a,
47
+ onCommitFiberUnmount: a,
48
+ onPostCommitFiberRoot: a,
49
+ renderers: t,
50
+ supportsFiber: !0,
51
+ supportsFlight: !0
52
+ };
53
+ try {
54
+ r(globalThis, `__REACT_DEVTOOLS_GLOBAL_HOOK__`, {
55
+ configurable: !0,
56
+ enumerable: !0,
57
+ get() {
58
+ return s;
59
+ },
60
+ set(t) {
61
+ if (t && typeof t == `object`) {
62
+ let n = s.renderers;
63
+ s = t, n.size > 0 && (n.forEach((e, n) => {
64
+ f$1.add(e), t.renderers.set(n, e);
65
+ }), y$1(e));
66
+ }
67
+ }
68
+ });
69
+ let t = window.hasOwnProperty, n = !1;
70
+ r(window, `hasOwnProperty`, {
71
+ configurable: !0,
72
+ value: function(...e) {
73
+ try {
74
+ if (!n && e[0] === `__REACT_DEVTOOLS_GLOBAL_HOOK__`) return globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__ = void 0, n = !0, -0;
75
+ } catch {}
76
+ return t.apply(this, e);
77
+ },
78
+ writable: !0
79
+ });
80
+ } catch {
81
+ y$1(e);
82
+ }
83
+ return s;
84
+ }, y$1 = (e) => {
85
+ e && d.add(e);
86
+ try {
87
+ let t = globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;
88
+ if (!t) return;
89
+ if (!t._instrumentationSource) {
90
+ t.checkDCE = o, t.supportsFiber = !0, t.supportsFlight = !0, t.hasUnsupportedRendererAttached = !1, t._instrumentationSource = n, t._instrumentationIsActive = !1;
91
+ let e = s(t);
92
+ if (e || (t.on = a), t.renderers.size) {
93
+ t._instrumentationIsActive = !0, d.forEach((e) => e());
94
+ return;
95
+ }
96
+ let r = t.inject, i = u(t);
97
+ i && !e && (c = !0, t.inject({ scheduleRefresh() {} }) && (t._instrumentationIsActive = !0)), t.inject = (e) => {
98
+ let n = r(e);
99
+ return f$1.add(e), i && t.renderers.set(n, e), t._instrumentationIsActive = !0, d.forEach((e) => e()), n;
100
+ };
101
+ }
102
+ (t.renderers.size || t._instrumentationIsActive || u()) && e?.();
103
+ } catch {}
104
+ }, b$1 = () => i.call(globalThis, `__REACT_DEVTOOLS_GLOBAL_HOOK__`), x$1 = (e) => b$1() ? (y$1(e), globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__) : v$1(e), S$1 = () => !!(typeof window < `u` && (window.document?.createElement || window.navigator?.product === `ReactNative`)), C$1 = () => {
105
+ try {
106
+ S$1() && x$1();
107
+ } catch {}
108
+ };
109
+ //#endregion
110
+ //#region ../../node_modules/.pnpm/bippy@0.6.1_react@19.2.5/node_modules/bippy/dist/install-hook-only.js
111
+ /**
112
+ * @license bippy
113
+ *
114
+ * Copyright (c) Aiden Bai
115
+ *
116
+ * This source code is licensed under the MIT license found in the
117
+ * LICENSE file in the root directory of this source tree.
118
+ */
119
+ C$1();
120
+ //#endregion
121
+ //#region ../../node_modules/.pnpm/bippy@0.6.1_react@19.2.5/node_modules/bippy/dist/core.js
122
+ /**
123
+ * @license bippy
124
+ *
125
+ * Copyright (c) Aiden Bai
126
+ *
127
+ * This source code is licensed under the MIT license found in the
128
+ * LICENSE file in the root directory of this source tree.
129
+ */
130
+ const p = 60111, m = `Symbol(react.concurrent_mode)`, h = `Symbol(react.async_mode)`, _ = (e) => {
131
+ switch (e.tag) {
132
+ case 5:
133
+ case 26:
134
+ case 27: return !0;
135
+ default: return typeof e.type == `string`;
136
+ }
137
+ }, Oe = (e) => {
138
+ switch (e.tag) {
139
+ case 1:
140
+ case 11:
141
+ case 0:
142
+ case 14:
143
+ case 15: return !0;
144
+ default: return !1;
145
+ }
146
+ }, y = (e) => {
147
+ let t = e.memoizedProps, n = e.alternate?.memoizedProps || {}, r = e.flags ?? e.effectTag ?? 0;
148
+ switch (e.tag) {
149
+ case 1:
150
+ case 9:
151
+ case 11:
152
+ case 0:
153
+ case 14:
154
+ case 15: return (r & 1) == 1;
155
+ default: return e.alternate ? n !== t || e.alternate.memoizedState !== e.memoizedState || e.alternate.ref !== e.ref : !0;
156
+ }
157
+ }, C = (e) => {
158
+ switch (e.tag) {
159
+ case 18: return !0;
160
+ case 7:
161
+ case 6:
162
+ case 23:
163
+ case 22: return !0;
164
+ case 3: return !1;
165
+ default: {
166
+ let t = typeof e.type == `object` && e.type !== null ? e.type.$$typeof : e.type;
167
+ if (typeof t == `symbol`) return t.description === `react.concurrent_mode` || t.description === `react.async_mode`;
168
+ switch (t) {
169
+ case p:
170
+ case m:
171
+ case h: return !0;
172
+ default: return !1;
173
+ }
174
+ }
175
+ }
176
+ };
177
+ const T = (e, t, n = !1) => {
178
+ if (!e) return null;
179
+ if (t(e) === !0) return e;
180
+ let r = n ? e.return : e.child;
181
+ for (; r;) {
182
+ let e = T(r, t, n);
183
+ if (e) return e;
184
+ r = n ? null : r.sibling;
185
+ }
186
+ return null;
187
+ }, E = async (e, t, n = !1) => {
188
+ if (!e) return null;
189
+ if (await t(e) === !0) return e;
190
+ let r = n ? e.return : e.child;
191
+ for (; r;) {
192
+ let e = await E(r, t, n);
193
+ if (e) return e;
194
+ r = n ? null : r.sibling;
195
+ }
196
+ return null;
197
+ }, Pe = (e) => {
198
+ let t = e?.actualDuration ?? 0, n = t, r = e?.child ?? null;
199
+ for (; t > 0 && r != null;) n -= r.actualDuration ?? 0, r = r.sibling;
200
+ return {
201
+ selfTime: n,
202
+ totalTime: t
203
+ };
204
+ }, D = (e) => {
205
+ let t = e;
206
+ return typeof t == `function` ? t : typeof t == `object` && t ? D(t.type || t.render) : null;
207
+ }, Ie = (e) => {
208
+ let t = e;
209
+ if (typeof t == `string`) return t;
210
+ if (typeof t != `function` && !(typeof t == `object` && t)) return null;
211
+ let n = t.displayName || t.name || null;
212
+ if (n) return n;
213
+ let r = D(t);
214
+ return r && (r.displayName || r.name) || null;
215
+ }, Le = (e) => {
216
+ try {
217
+ if (typeof e.version == `string` && e.bundleType > 0) return `development`;
218
+ } catch {}
219
+ return `production`;
220
+ }, O = /* @__PURE__ */ new Set();
221
+ let k = 0;
222
+ const A = /* @__PURE__ */ new WeakMap(), j = (e, t = k++) => {
223
+ A.set(e, t);
224
+ }, M = (e) => {
225
+ let t = A.get(e);
226
+ return t === void 0 && e.alternate && (t = A.get(e.alternate)), t === void 0 && (t = k++, j(e, t)), t;
227
+ }, N = (e, t, n) => {
228
+ let r = t;
229
+ for (; r != null;) {
230
+ if (A.has(r) || M(r), !C(r) && y(r) && e(r, `mount`), r.tag === 13) if (r.memoizedState !== null) {
231
+ let t = r.child, n = t ? t.sibling : null;
232
+ if (n) {
233
+ let t = n.child;
234
+ t !== null && N(e, t, !1);
235
+ }
236
+ } else {
237
+ let t = null;
238
+ r.child !== null && (t = r.child.child), t !== null && N(e, t, !1);
239
+ }
240
+ else r.child != null && N(e, r.child, !0);
241
+ r = n ? r.sibling : null;
242
+ }
243
+ }, P = (e, t, n, r) => {
244
+ if (A.has(t) || M(t), !n) return;
245
+ A.has(n) || M(n);
246
+ let i = t.tag === 13, a = !C(t);
247
+ a && y(t) && e(t, `update`);
248
+ let o = i && n.memoizedState !== null, s = i && t.memoizedState !== null;
249
+ if (o && s) {
250
+ let r = t.child?.sibling ?? null, i = n.child?.sibling ?? null;
251
+ r !== null && i !== null && P(e, r, i, t);
252
+ } else if (o && !s) {
253
+ let n = t.child;
254
+ n !== null && N(e, n, !0);
255
+ } else if (!o && s) {
256
+ I(e, n);
257
+ let r = t.child?.sibling ?? null;
258
+ r !== null && N(e, r, !0);
259
+ } else if (t.child !== n.child) {
260
+ let n = t.child;
261
+ for (; n;) {
262
+ if (n.alternate) {
263
+ let i = n.alternate;
264
+ P(e, n, i, a ? t : r);
265
+ } else N(e, n, !1);
266
+ n = n.sibling;
267
+ }
268
+ }
269
+ }, F = (e, t) => {
270
+ (t.tag === 3 || !C(t)) && e(t, `unmount`);
271
+ }, I = (e, t) => {
272
+ let n = t.tag === 13 && t.memoizedState !== null, r = t.child;
273
+ for (n && (r = (t.child?.sibling ?? null)?.child ?? null); r !== null;) r.return !== null && (F(e, r), I(e, r)), r = r.sibling;
274
+ };
275
+ let Be = 0;
276
+ const L = /* @__PURE__ */ new WeakMap(), Ve = (e, t) => {
277
+ let n = `current` in e ? e.current : e, r = L.get(e);
278
+ r || (r = {
279
+ id: Be++,
280
+ prevFiber: null
281
+ }, L.set(e, r));
282
+ let { prevFiber: i } = r;
283
+ if (!n) F(t, n);
284
+ else if (i !== null) {
285
+ let e = i && i.memoizedState != null && i.memoizedState.element != null && i.memoizedState.isDehydrated !== !0, r = n.memoizedState != null && n.memoizedState.element != null && n.memoizedState.isDehydrated !== !0;
286
+ !e && r ? N(t, n, !1) : e && r ? P(t, n, n.alternate, null) : e && !r && F(t, n);
287
+ } else N(t, n, !0);
288
+ r.prevFiber = n;
289
+ };
290
+ const U = (e) => Object.prototype.toString.call(e) === `[object Object]` && (Object.getPrototypeOf(e) === Object.prototype || Object.getPrototypeOf(e) === null), W = (e, t = []) => {
291
+ if (!U(e)) return [{
292
+ path: t,
293
+ value: e
294
+ }];
295
+ let n = [];
296
+ for (let r in e) {
297
+ let i = e[r], a = t.concat(r);
298
+ U(i) ? n.push(...W(i, a)) : n.push({
299
+ path: a,
300
+ value: i
301
+ });
302
+ }
303
+ return n;
304
+ }, K = /* @__PURE__ */ new Set(), q = /* @__PURE__ */ new Set(), J = /* @__PURE__ */ new Set(), Y = /* @__PURE__ */ new Set(), X = /* @__PURE__ */ new WeakMap(), Z = /* @__PURE__ */ new WeakMap(), Q = (e) => {
305
+ let t = X.get(e) ?? {};
306
+ if (X.set(e, t), !t.onCommitFiberRoot || e.onCommitFiberRoot !== t.onCommitFiberRoot) {
307
+ let n = e.onCommitFiberRoot, r = (t, i, a) => {
308
+ if (n?.(t, i, a), X.get(e)?.onCommitFiberRoot === r) {
309
+ O.add(i), Z.set(i, t);
310
+ for (let e of K) e(t, i, a);
311
+ }
312
+ };
313
+ t.onCommitFiberRoot = r, e.onCommitFiberRoot = r;
314
+ }
315
+ if (!t.onCommitFiberUnmount || e.onCommitFiberUnmount !== t.onCommitFiberUnmount) {
316
+ let n = e.onCommitFiberUnmount, r = (t, i) => {
317
+ if (n?.(t, i), X.get(e)?.onCommitFiberUnmount === r) for (let e of q) e(t, i);
318
+ };
319
+ t.onCommitFiberUnmount = r, e.onCommitFiberUnmount = r;
320
+ }
321
+ if (!t.onPostCommitFiberRoot || e.onPostCommitFiberRoot !== t.onPostCommitFiberRoot) {
322
+ let n = e.onPostCommitFiberRoot, r = (t, i) => {
323
+ if (n?.(t, i), X.get(e)?.onPostCommitFiberRoot === r) for (let e of J) e(t, i);
324
+ };
325
+ t.onPostCommitFiberRoot = r, e.onPostCommitFiberRoot = r;
326
+ }
327
+ if (!t.onScheduleFiberRoot || e.onScheduleFiberRoot !== t.onScheduleFiberRoot) {
328
+ let n = e.onScheduleFiberRoot, r = (t, i, a) => {
329
+ if (n?.(t, i, a), X.get(e)?.onScheduleFiberRoot === r) for (let e of Y) e(t, i, a);
330
+ };
331
+ t.onScheduleFiberRoot = r, e.onScheduleFiberRoot = r;
332
+ }
333
+ }, Je = (e$1) => {
334
+ let t = x$1(e$1.onActive);
335
+ t._instrumentationSource = e$1.name ?? n, Q(t);
336
+ let { onActive: n$1, onCommitFiberRoot: r, onCommitFiberUnmount: a, onPostCommitFiberRoot: c, onScheduleFiberRoot: l } = e$1;
337
+ return r && K.add(r), a && q.add(a), c && J.add(c), l && Y.add(l), e(() => {
338
+ n$1 && d.delete(n$1), r && K.delete(r), a && q.delete(a), c && J.delete(c), l && Y.delete(l);
339
+ });
340
+ };
341
+ //#endregion
342
+ //#region ../../node_modules/.pnpm/bippy@0.6.1_react@19.2.5/node_modules/bippy/dist/index.js
343
+ /**
344
+ * @license bippy
345
+ *
346
+ * Copyright (c) Aiden Bai
347
+ *
348
+ * This source code is licensed under the MIT license found in the
349
+ * LICENSE file in the root directory of this source tree.
350
+ */
351
+ //#endregion
352
+ //#region src/cli/runtime-scan/constants.ts
353
+ const RUNTIME_SCAN_MAX_COMPONENT_EVENTS = 2e3;
354
+ const RUNTIME_SCAN_SNAPSHOT_CATEGORY_BUDGET_BYTES = Math.floor((5 * 1024 * 1024 - 64 * 1024) / 3);
355
+ const RUNTIME_SCAN_MAX_STRING_LENGTH = 4096;
356
+ [
357
+ ...Array.from({ length: 11 }, (_unusedValue, portOffset) => 3e3 + portOffset),
358
+ ...Array.from({ length: 11 }, (_unusedValue, portOffset) => 4e3 + portOffset),
359
+ ...Array.from({ length: 11 }, (_unusedValue, portOffset) => 5e3 + portOffset),
360
+ ...Array.from({ length: 11 }, (_unusedValue, portOffset) => 5173 + portOffset),
361
+ ...Array.from({ length: 11 }, (_unusedValue, portOffset) => 8e3 + portOffset),
362
+ ...Array.from({ length: 11 }, (_unusedValue, portOffset) => 8080 + portOffset)
363
+ ];
364
+ const RUNTIME_SCAN_PROBE_SNAPSHOT_ATTRIBUTE_NAME_PLACEHOLDER = "data-react-doctor-runtime-scan-snapshot";
365
+ const RUNTIME_SCAN_PROBE_SNAPSHOT_TOKEN_PLACEHOLDER = "__REACT_DOCTOR_RUNTIME_SCAN_TOKEN__";
366
+ const RUNTIME_SCAN_OVERLAY_COLOR_RGB = "115,97,230";
367
+ const RUNTIME_SCAN_OVERLAY_FONT = "Menlo,Consolas,Monaco,Liberation Mono,Lucida Console,monospace";
368
+ const RUNTIME_SCAN_OVERLAY_FILL_ALPHA = .1;
369
+ const RUNTIME_SCAN_OVERLAY_Z_INDEX = 2147483646;
370
+ //#endregion
371
+ //#region src/cli/runtime-scan/browser-overlay.ts
372
+ const pendingOutlines = /* @__PURE__ */ new Map();
373
+ const activeOutlines = /* @__PURE__ */ new Map();
374
+ let canvas = null;
375
+ let context = null;
376
+ let flushAnimationFrameId = null;
377
+ let drawAnimationFrameId = null;
378
+ let previousScrollX = window.scrollX;
379
+ let previousScrollY = window.scrollY;
380
+ const getNearestHostElements = (fiber) => {
381
+ const elements = [];
382
+ const fibersToVisit = [];
383
+ if (_(fiber)) fibersToVisit.push(fiber);
384
+ else if (fiber.child !== null) fibersToVisit.push(fiber.child);
385
+ while (fibersToVisit.length > 0 && elements.length < 20) {
386
+ const currentFiber = fibersToVisit.pop();
387
+ if (currentFiber === void 0) break;
388
+ if (_(currentFiber)) {
389
+ if (currentFiber.stateNode instanceof Element) elements.push(currentFiber.stateNode);
390
+ } else if (currentFiber.child !== null) fibersToVisit.push(currentFiber.child);
391
+ if (currentFiber.sibling !== null) fibersToVisit.push(currentFiber.sibling);
392
+ }
393
+ return elements;
394
+ };
395
+ const mergeRects = (rects) => {
396
+ const firstRect = rects[0];
397
+ if (rects.length === 1) return firstRect;
398
+ let minimumX = firstRect.x;
399
+ let minimumY = firstRect.y;
400
+ let maximumX = firstRect.right;
401
+ let maximumY = firstRect.bottom;
402
+ for (const rect of rects.slice(1)) {
403
+ minimumX = Math.min(minimumX, rect.x);
404
+ minimumY = Math.min(minimumY, rect.y);
405
+ maximumX = Math.max(maximumX, rect.right);
406
+ maximumY = Math.max(maximumY, rect.bottom);
407
+ }
408
+ return new DOMRect(minimumX, minimumY, maximumX - minimumX, maximumY - minimumY);
409
+ };
410
+ const resizeCanvas = () => {
411
+ if (canvas === null || context === null) return;
412
+ const devicePixelRatio = Math.min(window.devicePixelRatio || 1, 2);
413
+ canvas.style.width = `${window.innerWidth}px`;
414
+ canvas.style.height = `${window.innerHeight}px`;
415
+ canvas.width = window.innerWidth * devicePixelRatio;
416
+ canvas.height = window.innerHeight * devicePixelRatio;
417
+ context.setTransform(devicePixelRatio, 0, 0, devicePixelRatio, 0, 0);
418
+ };
419
+ const ensureCanvas = () => {
420
+ if (canvas !== null && context !== null) return true;
421
+ const documentElement = document.documentElement;
422
+ if (documentElement === null) return false;
423
+ const host = document.createElement("div");
424
+ host.dataset.reactDoctorRuntimeScanOverlay = "";
425
+ const shadowRoot = host.attachShadow({ mode: "open" });
426
+ const nextCanvas = document.createElement("canvas");
427
+ nextCanvas.setAttribute("aria-hidden", "true");
428
+ nextCanvas.style.position = "fixed";
429
+ nextCanvas.style.inset = "0";
430
+ nextCanvas.style.pointerEvents = "none";
431
+ nextCanvas.style.zIndex = String(RUNTIME_SCAN_OVERLAY_Z_INDEX);
432
+ shadowRoot.appendChild(nextCanvas);
433
+ documentElement.appendChild(host);
434
+ const nextContext = nextCanvas.getContext("2d");
435
+ if (nextContext === null) {
436
+ host.remove();
437
+ return false;
438
+ }
439
+ canvas = nextCanvas;
440
+ context = nextContext;
441
+ resizeCanvas();
442
+ return true;
443
+ };
444
+ const buildGroupLabel = (outlines) => {
445
+ const renderCountByName = /* @__PURE__ */ new Map();
446
+ for (const outline of outlines) renderCountByName.set(outline.name, (renderCountByName.get(outline.name) ?? 0) + outline.count);
447
+ const label = [...renderCountByName.entries()].sort((left, right) => right[1] - left[1]).map(([name, count]) => `${name} ×${count}`).join(", ");
448
+ return label.length > 40 ? `${label.slice(0, 40)}…` : label;
449
+ };
450
+ const groupOutlines = () => {
451
+ const outlinesByRect = /* @__PURE__ */ new Map();
452
+ for (const outline of activeOutlines.values()) {
453
+ const key = `${Math.round(outline.x)},${Math.round(outline.y)},${Math.round(outline.width)},${Math.round(outline.height)}`;
454
+ const existing = outlinesByRect.get(key);
455
+ if (existing === void 0) outlinesByRect.set(key, [outline]);
456
+ else existing.push(outline);
457
+ }
458
+ return [...outlinesByRect.values()].map((outlines) => {
459
+ const firstOutline = outlines[0];
460
+ return {
461
+ outlines,
462
+ x: firstOutline.x,
463
+ y: firstOutline.y,
464
+ width: firstOutline.width,
465
+ height: firstOutline.height,
466
+ alpha: Math.max(...outlines.map((outline) => 1 - outline.elapsedFrameCount / 45))
467
+ };
468
+ });
469
+ };
470
+ const drawActiveOutlines = () => {
471
+ drawAnimationFrameId = null;
472
+ if (canvas === null || context === null) return;
473
+ context.clearRect(0, 0, window.innerWidth, window.innerHeight);
474
+ context.font = `11px ${RUNTIME_SCAN_OVERLAY_FONT}`;
475
+ for (const group of groupOutlines()) {
476
+ const x = Math.round(group.x) + 1 / 2;
477
+ const y = Math.round(group.y) + 1 / 2;
478
+ const width = Math.round(group.width);
479
+ const height = Math.round(group.height);
480
+ context.strokeStyle = `rgba(${RUNTIME_SCAN_OVERLAY_COLOR_RGB},${group.alpha})`;
481
+ context.lineWidth = 1;
482
+ context.strokeRect(x, y, width, height);
483
+ context.fillStyle = `rgba(${RUNTIME_SCAN_OVERLAY_COLOR_RGB},${group.alpha * RUNTIME_SCAN_OVERLAY_FILL_ALPHA})`;
484
+ context.fillRect(x, y, width, height);
485
+ const label = buildGroupLabel(group.outlines);
486
+ const labelWidth = context.measureText(label).width + 4;
487
+ const labelHeight = 15;
488
+ const labelY = Math.max(0, y - labelHeight - 4);
489
+ context.fillStyle = `rgba(${RUNTIME_SCAN_OVERLAY_COLOR_RGB},${group.alpha})`;
490
+ context.fillRect(x, labelY, labelWidth, labelHeight);
491
+ context.fillStyle = `rgba(255,255,255,${group.alpha})`;
492
+ context.fillText(label, x + 2, labelY + labelHeight - 2);
493
+ }
494
+ for (const outline of activeOutlines.values()) {
495
+ outline.elapsedFrameCount += 1;
496
+ if (outline.elapsedFrameCount > 45) activeOutlines.delete(outline.id);
497
+ }
498
+ if (activeOutlines.size > 0) drawAnimationFrameId = requestAnimationFrame(drawActiveOutlines);
499
+ };
500
+ const flushPendingOutlines = () => {
501
+ flushAnimationFrameId = null;
502
+ if (!ensureCanvas()) return;
503
+ const rectByElement = /* @__PURE__ */ new Map();
504
+ for (const pendingOutline of pendingOutlines.values()) for (const element of pendingOutline.elements) {
505
+ if (!element.isConnected || rectByElement.has(element)) continue;
506
+ rectByElement.set(element, element.getBoundingClientRect());
507
+ }
508
+ for (const pendingOutline of pendingOutlines.values()) {
509
+ const rects = pendingOutline.elements.map((element) => rectByElement.get(element)).filter((rect) => rect !== void 0).filter((rect) => rect.width > 0 && rect.height > 0);
510
+ if (rects.length === 0) continue;
511
+ const rect = mergeRects(rects);
512
+ const existing = activeOutlines.get(pendingOutline.id);
513
+ if (existing === void 0) {
514
+ if (activeOutlines.size >= 200) continue;
515
+ activeOutlines.set(pendingOutline.id, {
516
+ id: pendingOutline.id,
517
+ name: pendingOutline.name,
518
+ count: pendingOutline.count,
519
+ x: rect.x,
520
+ y: rect.y,
521
+ width: rect.width,
522
+ height: rect.height,
523
+ elapsedFrameCount: 0
524
+ });
525
+ } else {
526
+ existing.count += pendingOutline.count;
527
+ existing.x = rect.x;
528
+ existing.y = rect.y;
529
+ existing.width = rect.width;
530
+ existing.height = rect.height;
531
+ existing.elapsedFrameCount = 0;
532
+ }
533
+ }
534
+ pendingOutlines.clear();
535
+ if (drawAnimationFrameId === null && activeOutlines.size > 0) drawAnimationFrameId = requestAnimationFrame(drawActiveOutlines);
536
+ };
537
+ const recordRuntimeScanOverlayRender = (fiber) => {
538
+ if (!Oe(fiber)) return;
539
+ const id = M(fiber);
540
+ const existing = pendingOutlines.get(id);
541
+ if (existing !== void 0) {
542
+ existing.count += 1;
543
+ return;
544
+ }
545
+ if (pendingOutlines.size >= 200) return;
546
+ const displayName = Ie(fiber.type);
547
+ if (displayName === null) return;
548
+ const name = displayName.slice(0, 40);
549
+ const elements = getNearestHostElements(fiber);
550
+ if (elements.length === 0) return;
551
+ pendingOutlines.set(id, {
552
+ id,
553
+ name,
554
+ elements,
555
+ count: 1
556
+ });
557
+ if (flushAnimationFrameId === null) flushAnimationFrameId = requestAnimationFrame(flushPendingOutlines);
558
+ };
559
+ window.addEventListener("resize", resizeCanvas);
560
+ window.addEventListener("scroll", () => {
561
+ const deltaX = window.scrollX - previousScrollX;
562
+ const deltaY = window.scrollY - previousScrollY;
563
+ previousScrollX = window.scrollX;
564
+ previousScrollY = window.scrollY;
565
+ for (const outline of activeOutlines.values()) {
566
+ outline.x -= deltaX;
567
+ outline.y -= deltaY;
568
+ }
569
+ if (drawAnimationFrameId === null && activeOutlines.size > 0) drawAnimationFrameId = requestAnimationFrame(drawActiveOutlines);
570
+ }, { passive: true });
571
+ //#endregion
572
+ //#region src/cli/runtime-scan/browser-probe.ts
573
+ const performanceObservers = [];
574
+ const snapshotTextEncoder = new TextEncoder();
575
+ const setSnapshotAttribute = Element.prototype.setAttribute;
576
+ const removeSnapshotAttribute = Element.prototype.removeAttribute;
577
+ const queueSnapshotAttributeRemoval = window.queueMicrotask.bind(window);
578
+ const longAnimationFrames = {
579
+ entries: [],
580
+ nextIndex: 0,
581
+ dropped: 0
582
+ };
583
+ const componentEvents = {
584
+ entries: [],
585
+ nextIndex: 0,
586
+ dropped: 0
587
+ };
588
+ const interactions = {
589
+ entries: [],
590
+ nextIndex: 0,
591
+ dropped: 0
592
+ };
593
+ let cumulativeLayoutShift = 0;
594
+ let largestContentfulPaintMs = null;
595
+ let droppedScriptTimings = 0;
596
+ let reactDetected = false;
597
+ let reactVersion = null;
598
+ let reactBuildType = null;
599
+ let nativeReactTracks = false;
600
+ let bippyComponentTracks = false;
601
+ let didCaptureCurrentPageState = false;
602
+ const limitString = (value) => value.slice(0, RUNTIME_SCAN_MAX_STRING_LENGTH);
603
+ const sanitizeUrl = (rawUrl) => {
604
+ try {
605
+ const parsedUrl = new URL(rawUrl, window.location.href);
606
+ parsedUrl.username = "";
607
+ parsedUrl.password = "";
608
+ parsedUrl.search = "";
609
+ parsedUrl.hash = "";
610
+ return limitString(parsedUrl.href);
611
+ } catch {
612
+ return "";
613
+ }
614
+ };
615
+ const pushBoundedEntry = (boundedEntries, limit, entry) => {
616
+ if (boundedEntries.entries.length < limit) boundedEntries.entries.push(entry);
617
+ else {
618
+ boundedEntries.entries[boundedEntries.nextIndex] = entry;
619
+ boundedEntries.nextIndex = (boundedEntries.nextIndex + 1) % limit;
620
+ boundedEntries.dropped += 1;
621
+ }
622
+ };
623
+ const readBoundedEntries = (boundedEntries) => {
624
+ if (boundedEntries.nextIndex === 0) return [...boundedEntries.entries];
625
+ return [...boundedEntries.entries.slice(boundedEntries.nextIndex), ...boundedEntries.entries.slice(0, boundedEntries.nextIndex)];
626
+ };
627
+ const takeLatestEntriesWithinByteBudget = (entries) => {
628
+ let minimumEntryCount = 0;
629
+ let maximumEntryCount = entries.length;
630
+ while (minimumEntryCount < maximumEntryCount) {
631
+ const candidateEntryCount = Math.ceil((minimumEntryCount + maximumEntryCount) / 2);
632
+ const candidateEntries = entries.slice(entries.length - candidateEntryCount);
633
+ if (snapshotTextEncoder.encode(JSON.stringify(candidateEntries)).byteLength <= RUNTIME_SCAN_SNAPSHOT_CATEGORY_BUDGET_BYTES) minimumEntryCount = candidateEntryCount;
634
+ else maximumEntryCount = candidateEntryCount - 1;
635
+ }
636
+ return {
637
+ entries: entries.slice(entries.length - minimumEntryCount),
638
+ dropped: entries.length - minimumEntryCount
639
+ };
640
+ };
641
+ const pushLongAnimationFrame = (entry) => {
642
+ pushBoundedEntry(longAnimationFrames, 100, entry);
643
+ };
644
+ const pushComponentEvent = (entry) => {
645
+ pushBoundedEntry(componentEvents, RUNTIME_SCAN_MAX_COMPONENT_EVENTS, entry);
646
+ };
647
+ const pushInteraction = (entry) => {
648
+ pushBoundedEntry(interactions, 500, entry);
649
+ };
650
+ const captureSnapshot = (snapshot) => {
651
+ const documentElement = document.documentElement;
652
+ if (documentElement === null) return;
653
+ try {
654
+ setSnapshotAttribute.call(documentElement, RUNTIME_SCAN_PROBE_SNAPSHOT_ATTRIBUTE_NAME_PLACEHOLDER, JSON.stringify({
655
+ token: RUNTIME_SCAN_PROBE_SNAPSHOT_TOKEN_PLACEHOLDER,
656
+ snapshot
657
+ }));
658
+ queueSnapshotAttributeRemoval(() => {
659
+ try {
660
+ removeSnapshotAttribute.call(documentElement, RUNTIME_SCAN_PROBE_SNAPSHOT_ATTRIBUTE_NAME_PLACEHOLDER);
661
+ } catch {}
662
+ });
663
+ } catch {
664
+ return;
665
+ }
666
+ };
667
+ const observe = (entryType, listener, durationThresholdMs) => {
668
+ try {
669
+ const options = {
670
+ type: entryType,
671
+ buffered: true,
672
+ durationThreshold: durationThresholdMs
673
+ };
674
+ const observer = new PerformanceObserver((entryList) => {
675
+ for (const entry of entryList.getEntries()) listener(entry);
676
+ });
677
+ observer.observe(options);
678
+ performanceObservers.push({
679
+ observer,
680
+ listener
681
+ });
682
+ return true;
683
+ } catch {
684
+ return false;
685
+ }
686
+ };
687
+ const mapScriptTiming = (scriptTiming) => ({
688
+ invoker: limitString(scriptTiming.invoker ?? ""),
689
+ invokerType: limitString(scriptTiming.invokerType ?? ""),
690
+ sourceUrl: sanitizeUrl(scriptTiming.sourceURL ?? ""),
691
+ sourceFunctionName: limitString(scriptTiming.sourceFunctionName ?? ""),
692
+ sourceCharPosition: scriptTiming.sourceCharPosition ?? 0,
693
+ executionStart: scriptTiming.executionStart ?? 0,
694
+ durationMs: scriptTiming.duration ?? 0,
695
+ forcedStyleAndLayoutDurationMs: scriptTiming.forcedStyleAndLayoutDuration ?? 0,
696
+ pauseDurationMs: scriptTiming.pauseDuration ?? 0
697
+ });
698
+ const loafSupported = observe("long-animation-frame", (performanceEntry) => {
699
+ const loafEntry = performanceEntry;
700
+ const scriptTimings = loafEntry.scripts ?? [];
701
+ droppedScriptTimings += Math.max(0, scriptTimings.length - 100);
702
+ pushLongAnimationFrame({
703
+ startTime: loafEntry.startTime,
704
+ durationMs: loafEntry.duration,
705
+ blockingDurationMs: loafEntry.blockingDuration ?? 0,
706
+ renderStart: loafEntry.renderStart ?? 0,
707
+ styleAndLayoutStart: loafEntry.styleAndLayoutStart ?? 0,
708
+ firstUiEventTimestamp: loafEntry.firstUIEventTimestamp ?? 0,
709
+ scripts: scriptTimings.slice(0, 100).map(mapScriptTiming)
710
+ });
711
+ });
712
+ observe("event", (performanceEntry) => {
713
+ const interactionEntry = performanceEntry;
714
+ const interactionId = interactionEntry.interactionId ?? 0;
715
+ if (interactionId === 0) return;
716
+ pushInteraction({
717
+ name: limitString(interactionEntry.name),
718
+ startTime: interactionEntry.startTime,
719
+ durationMs: interactionEntry.duration,
720
+ processingStart: interactionEntry.processingStart ?? interactionEntry.startTime,
721
+ processingEnd: interactionEntry.processingEnd ?? interactionEntry.startTime,
722
+ interactionId,
723
+ targetTag: interactionEntry.target === null || interactionEntry.target === void 0 ? null : limitString(interactionEntry.target.tagName)
724
+ });
725
+ }, 16);
726
+ observe("layout-shift", (performanceEntry) => {
727
+ const layoutShiftEntry = performanceEntry;
728
+ if (layoutShiftEntry.hadRecentInput === true) return;
729
+ cumulativeLayoutShift += layoutShiftEntry.value ?? 0;
730
+ });
731
+ observe("largest-contentful-paint", (performanceEntry) => {
732
+ largestContentfulPaintMs = Math.max(largestContentfulPaintMs ?? 0, performanceEntry.startTime);
733
+ });
734
+ observe("measure", (performanceEntry) => {
735
+ const measure = performanceEntry;
736
+ const devtools = measure.detail?.devtools;
737
+ if (!devtools?.track?.includes("Components")) return;
738
+ if (devtools.reactDoctorSource === "bippy") return;
739
+ nativeReactTracks = true;
740
+ pushComponentEvent({
741
+ name: limitString(measure.name.replace(/^\u200B/, "")),
742
+ startTime: measure.startTime,
743
+ durationMs: measure.duration,
744
+ depth: 0,
745
+ source: "native"
746
+ });
747
+ });
748
+ const versionHasNativeTracks = (version) => {
749
+ const [majorText, minorText] = version.split(".");
750
+ const majorVersion = Number.parseInt(majorText ?? "", 10);
751
+ return majorVersion > 19 || majorVersion === 19 && Number.parseInt(minorText ?? "", 10) >= 2;
752
+ };
753
+ const attachRenderer = (renderer) => {
754
+ reactDetected = true;
755
+ reactVersion = typeof renderer.version === "string" ? limitString(renderer.version) : null;
756
+ reactBuildType = Le(renderer);
757
+ };
758
+ const recordFallbackComponent = (fiber, depth) => {
759
+ const { selfTime } = Pe(fiber);
760
+ if (selfTime < .05) return;
761
+ const name = limitString(Ie(fiber.type) ?? "Anonymous");
762
+ const startTime = fiber.actualStartTime ?? performance.now() - selfTime;
763
+ pushComponentEvent({
764
+ name,
765
+ startTime,
766
+ durationMs: selfTime,
767
+ depth,
768
+ source: "bippy"
769
+ });
770
+ bippyComponentTracks = true;
771
+ try {
772
+ performance.measure(`\u200B${name}`, {
773
+ start: startTime,
774
+ duration: selfTime,
775
+ detail: { devtools: {
776
+ track: "Components ⚛",
777
+ tooltipText: "React component render captured by React Doctor",
778
+ reactDoctorSource: "bippy"
779
+ } }
780
+ });
781
+ performance.clearMeasures(`\u200B${name}`);
782
+ } catch {}
783
+ };
784
+ for (const renderer of x$1().renderers.values()) attachRenderer(renderer);
785
+ _$1(attachRenderer);
786
+ Je({
787
+ name: "react-doctor-runtime-scan",
788
+ onCommitFiberRoot: (_rendererId, root) => {
789
+ const shouldRecordFallbackTracks = reactVersion === null || !versionHasNativeTracks(reactVersion);
790
+ let componentCount = 0;
791
+ Ve(root, (fiber) => {
792
+ if (!Oe(fiber)) return;
793
+ if (componentCount >= 250) return;
794
+ recordRuntimeScanOverlayRender(fiber);
795
+ if (!shouldRecordFallbackTracks) {
796
+ componentCount += 1;
797
+ return;
798
+ }
799
+ let depth = 0;
800
+ let parentFiber = fiber.return;
801
+ while (parentFiber !== null) {
802
+ depth += 1;
803
+ parentFiber = parentFiber.return;
804
+ }
805
+ recordFallbackComponent(fiber, depth);
806
+ componentCount += 1;
807
+ });
808
+ }
809
+ });
810
+ const snapshot = () => {
811
+ for (const { observer, listener } of performanceObservers) for (const entry of observer.takeRecords()) listener(entry);
812
+ const budgetedLongAnimationFrames = takeLatestEntriesWithinByteBudget(readBoundedEntries(longAnimationFrames));
813
+ const budgetedComponentEvents = takeLatestEntriesWithinByteBudget(readBoundedEntries(componentEvents));
814
+ const budgetedInteractions = takeLatestEntriesWithinByteBudget(readBoundedEntries(interactions));
815
+ return {
816
+ timeOrigin: performance.timeOrigin,
817
+ finalUrl: sanitizeUrl(window.location.href),
818
+ support: {
819
+ reactDetected,
820
+ reactVersion,
821
+ reactBuildType,
822
+ nativeReactTracks,
823
+ bippyComponentTracks,
824
+ loaf: loafSupported
825
+ },
826
+ longAnimationFrames: budgetedLongAnimationFrames.entries,
827
+ componentEvents: budgetedComponentEvents.entries,
828
+ interactions: budgetedInteractions.entries,
829
+ cumulativeLayoutShift,
830
+ largestContentfulPaintMs,
831
+ droppedLongAnimationFrames: longAnimationFrames.dropped + budgetedLongAnimationFrames.dropped,
832
+ droppedScriptTimings,
833
+ droppedComponentEvents: componentEvents.dropped + budgetedComponentEvents.dropped,
834
+ droppedInteractions: interactions.dropped + budgetedInteractions.dropped
835
+ };
836
+ };
837
+ window.__REACT_DOCTOR_RUNTIME_SCAN__ = { snapshot };
838
+ const captureNavigationSnapshot = () => {
839
+ if (window !== window.top || didCaptureCurrentPageState) return;
840
+ didCaptureCurrentPageState = true;
841
+ captureSnapshot(snapshot());
842
+ };
843
+ document.addEventListener("visibilitychange", () => {
844
+ if (document.visibilityState === "hidden") captureNavigationSnapshot();
845
+ else didCaptureCurrentPageState = false;
846
+ });
847
+ window.addEventListener("pageshow", () => {
848
+ didCaptureCurrentPageState = false;
849
+ });
850
+ window.addEventListener("beforeunload", captureNavigationSnapshot);
851
+ window.addEventListener("pagehide", captureNavigationSnapshot);
852
+ //#endregion
853
+ })();
854
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="da4c683a-e42d-5ded-848e-8f3c5e6f8a4c")}catch(e){}}();
855
+ //# debugId=da4c683a-e42d-5ded-848e-8f3c5e6f8a4c