grab 0.1.47-dev.e56fcc1 → 0.1.48-dev.2c6b683

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 (39) hide show
  1. package/README.md +1 -1
  2. package/dist/{copy-content-5FzVj_Qo.d.cts → copy-content-BPB8MmpL.d.cts} +38 -11
  3. package/dist/{copy-content-BJATOqZF.d.ts → copy-content-C7lFyXsY.d.ts} +38 -11
  4. package/dist/copy-content-CLCI_Lbe.cjs +10 -0
  5. package/dist/copy-content-DggKAmmU.js +10 -0
  6. package/dist/core/index.cjs +1 -1
  7. package/dist/core/index.d.cts +2 -2
  8. package/dist/core/index.d.ts +2 -2
  9. package/dist/core/index.js +1 -1
  10. package/dist/core-CBCQU3Hn.js +14 -0
  11. package/dist/core-U9umuR7Y.cjs +14 -0
  12. package/dist/create-pointer-move-prompt-handoff-CizEB9Y4.js +9 -0
  13. package/dist/{action-shortcuts-Zws2aUUQ.cjs → create-pointer-move-prompt-handoff-DByqEgBi.cjs} +1 -1
  14. package/dist/freeze-updates-BbpDYqOS.js +51 -0
  15. package/dist/freeze-updates-fV8HUsUG.cjs +51 -0
  16. package/dist/{index-jMjUhmbS.d.cts → index-DMyJsiaz.d.cts} +1 -1
  17. package/dist/{index-C_bngsx-.d.ts → index-VkohC_Hw.d.ts} +1 -1
  18. package/dist/index.cjs +1 -1
  19. package/dist/index.d.cts +3 -3
  20. package/dist/index.d.ts +3 -3
  21. package/dist/index.global.js +18 -18
  22. package/dist/index.js +1 -1
  23. package/dist/primitives.cjs +2 -2
  24. package/dist/primitives.d.cts +1 -1
  25. package/dist/primitives.d.ts +1 -1
  26. package/dist/primitives.js +2 -2
  27. package/dist/renderer-CKcrLUAY.cjs +9 -0
  28. package/dist/renderer-CN9zoF6u.js +9 -0
  29. package/dist/styles.css +1 -1
  30. package/package.json +2 -2
  31. package/dist/action-shortcuts-BqUYwepS.js +0 -9
  32. package/dist/copy-content-BdNGJB1g.js +0 -10
  33. package/dist/copy-content-CE1c2qMK.cjs +0 -10
  34. package/dist/core-BMr2NQZo.cjs +0 -14
  35. package/dist/core-GnLSAWJ2.js +0 -14
  36. package/dist/freeze-updates-B9uIB2_2.js +0 -51
  37. package/dist/freeze-updates-BgilkYa3.cjs +0 -51
  38. package/dist/renderer-Bjgsgc2_.cjs +0 -9
  39. package/dist/renderer-bvmApDqj.js +0 -9
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Copy any UI element for your agent.
7
7
 
8
- React Grab points agents to the actual source behind each selection. Agents are [**2× faster**](https://benchmark.react-grab.com/) and more accurate when using React Grab.
8
+ React Grab points agents to the actual source behind each selection. Agents are [**2× faster**](https://www.react-grab.com/benchmarks) and more accurate when using React Grab.
9
9
 
10
10
  [**Website →**](https://react-grab.com)
11
11
 
@@ -228,14 +228,12 @@ interface PreviewStyles {
228
228
  interface EditPanelState {
229
229
  element: Element;
230
230
  position: Position;
231
- selectionBounds: OverlayBounds;
232
231
  properties: EditableProperty[];
233
232
  preview: PreviewStyles;
234
233
  filePath?: string;
235
234
  lineNumber?: number;
236
235
  componentName?: string;
237
236
  tagName?: string;
238
- htmlPreview?: string;
239
237
  initialSearchQuery?: string;
240
238
  hasSessionEdits?: boolean;
241
239
  designTokens?: DesignTokenResolver;
@@ -249,14 +247,15 @@ interface ContextMenuAction {
249
247
  enabled?: boolean | ((context: ActionContext) => boolean);
250
248
  onAction: (context: ContextMenuActionContext) => void | Promise<void>;
251
249
  }
252
- interface ArrowNavigationItem {
250
+ interface HierarchyItem {
253
251
  tagName: string;
254
252
  componentName?: string;
253
+ depth: number;
254
+ isLast: boolean;
255
255
  }
256
- interface ArrowNavigationState {
257
- items: ArrowNavigationItem[];
256
+ interface HierarchyState {
257
+ items: HierarchyItem[];
258
258
  activeIndex: number;
259
- isVisible: boolean;
260
259
  }
261
260
  interface PluginHooks {
262
261
  onActivate?: () => void;
@@ -300,6 +299,12 @@ interface Plugin {
300
299
  }
301
300
  interface Options {
302
301
  enabled?: boolean;
302
+ /**
303
+ * Confine React Grab to a single container element instead of the whole page.
304
+ * Hit-testing, the toolbar viewport, and scroll re-anchoring are scoped to it.
305
+ * Used by the demo build to scope the showcase to its card.
306
+ */
307
+ container?: HTMLElement;
303
308
  activationMode?: ActivationMode;
304
309
  keyHoldDuration?: number;
305
310
  allowActivationInsideInput?: boolean;
@@ -331,12 +336,31 @@ interface Options {
331
336
  interface SettableOptions extends Options {
332
337
  enabled?: never;
333
338
  telemetry?: never;
339
+ container?: never;
334
340
  }
335
341
  interface SourceInfo {
336
342
  filePath: string;
337
343
  lineNumber: number | null;
338
344
  componentName: string | null;
339
345
  }
346
+ interface SelectedElementPayload {
347
+ tagName: string;
348
+ id?: string;
349
+ className?: string;
350
+ textContent?: string;
351
+ componentName?: string;
352
+ filePath?: string;
353
+ lineNumber?: number;
354
+ columnNumber?: number;
355
+ }
356
+ interface ElementSelectedEventDetail {
357
+ elements: SelectedElementPayload[];
358
+ }
359
+ declare global {
360
+ interface WindowEventMap {
361
+ "react-grab:element-selected": CustomEvent<ElementSelectedEventDetail>;
362
+ }
363
+ }
340
364
  interface ToolbarState {
341
365
  edge: "top" | "bottom" | "left" | "right";
342
366
  ratio: number;
@@ -360,6 +384,7 @@ interface ReactGrabAPI {
360
384
  getToolbarState: () => ToolbarState | null;
361
385
  setToolbarState: (state: Partial<ToolbarState>) => void;
362
386
  onToolbarStateChange: (callback: (state: ToolbarState) => void) => () => void;
387
+ reset: () => void;
363
388
  dispose: () => void;
364
389
  copyElement: (elements: Element | Element[]) => Promise<boolean>;
365
390
  getSource: (element: Element) => Promise<SourceInfo | null>;
@@ -419,8 +444,8 @@ interface ReactGrabRendererProps {
419
444
  selectionComponentName?: string;
420
445
  selectionLabelVisible?: boolean;
421
446
  selectionLabelStatus?: SelectionLabelStatus;
422
- selectionArrowNavigationState?: ArrowNavigationState;
423
- onArrowNavigationSelect?: (index: number) => void;
447
+ hierarchyState?: HierarchyState;
448
+ hierarchyMenuPosition?: DropdownAnchor | null;
424
449
  labelInstances?: SelectionLabelInstance[];
425
450
  dragVisible?: boolean;
426
451
  dragBounds?: OverlayBounds;
@@ -434,6 +459,8 @@ interface ReactGrabRendererProps {
434
459
  inputValue?: string;
435
460
  isPromptMode?: boolean;
436
461
  onShowContextMenuInstance?: (instanceId: string) => void;
462
+ onRetryInstance?: (instanceId: string) => void;
463
+ onAcknowledgeErrorInstance?: (instanceId: string) => void;
437
464
  onLabelInstanceHoverChange?: (instanceId: string, isHovered: boolean) => void;
438
465
  onInputChange?: (value: string) => void;
439
466
  onInputSubmit?: () => void;
@@ -521,7 +548,7 @@ interface ReactGrabEntry {
521
548
  frames?: ReactGrabStackFrame[];
522
549
  }
523
550
  //#endregion
524
- //#region ../../node_modules/.pnpm/bippy@0.5.42_react@19.2.6/node_modules/bippy/dist/core.d.ts
551
+ //#region ../../node_modules/.pnpm/bippy@0.5.43_react@19.2.6/node_modules/bippy/dist/core.d.ts
525
552
  type Flags = number;
526
553
  type Lanes = number;
527
554
  type TypeOfMode = number;
@@ -702,7 +729,7 @@ declare const isInstrumentationActive: () => boolean;
702
729
  * Returns the latest fiber (since it may be double-buffered).
703
730
  */
704
731
  //#endregion
705
- //#region ../../node_modules/.pnpm/bippy@0.5.42_react@19.2.6/node_modules/bippy/dist/source.d.ts
732
+ //#region ../../node_modules/.pnpm/bippy@0.5.43_react@19.2.6/node_modules/bippy/dist/source.d.ts
706
733
  //#region src/source/parse-stack.d.ts
707
734
  interface StackFrame {
708
735
  args?: unknown[];
@@ -724,4 +751,4 @@ interface CopyContentOptions {
724
751
  }
725
752
  declare const copyContent: (content: string, options?: CopyContentOptions) => boolean;
726
753
  //#endregion
727
- export { ToolbarState as A, ReactGrabAPI as C, SettableOptions as D, Rect as E, SourceInfo as O, PromptModeContext as S, ReactGrabState as T, OverlayBounds as _, ActionContext as a, PluginHooks as b, AgentContext as c, DeepPartial as d, DragRect as f, Options as g, GrabbedBox as h, isInstrumentationActive as i, Theme as k, ContextMenuAction as l, ElementLabelVariant as m, StackFrame as n, ActionContextHooks as o, ElementLabelContext as p, Fiber as r, ActivationMode as s, copyContent as t, ContextMenuActionContext as u, Plugin as v, ReactGrabRendererProps as w, Position as x, PluginConfig as y };
754
+ export { SourceInfo as A, PromptModeContext as C, Rect as D, ReactGrabState as E, ToolbarState as M, SelectedElementPayload as O, Position as S, ReactGrabRendererProps as T, Options as _, ActionContext as a, PluginConfig as b, AgentContext as c, DeepPartial as d, DragRect as f, GrabbedBox as g, ElementSelectedEventDetail as h, isInstrumentationActive as i, Theme as j, SettableOptions as k, ContextMenuAction as l, ElementLabelVariant as m, StackFrame as n, ActionContextHooks as o, ElementLabelContext as p, Fiber as r, ActivationMode as s, copyContent as t, ContextMenuActionContext as u, OverlayBounds as v, ReactGrabAPI as w, PluginHooks as x, Plugin as y };
@@ -228,14 +228,12 @@ interface PreviewStyles {
228
228
  interface EditPanelState {
229
229
  element: Element;
230
230
  position: Position;
231
- selectionBounds: OverlayBounds;
232
231
  properties: EditableProperty[];
233
232
  preview: PreviewStyles;
234
233
  filePath?: string;
235
234
  lineNumber?: number;
236
235
  componentName?: string;
237
236
  tagName?: string;
238
- htmlPreview?: string;
239
237
  initialSearchQuery?: string;
240
238
  hasSessionEdits?: boolean;
241
239
  designTokens?: DesignTokenResolver;
@@ -249,14 +247,15 @@ interface ContextMenuAction {
249
247
  enabled?: boolean | ((context: ActionContext) => boolean);
250
248
  onAction: (context: ContextMenuActionContext) => void | Promise<void>;
251
249
  }
252
- interface ArrowNavigationItem {
250
+ interface HierarchyItem {
253
251
  tagName: string;
254
252
  componentName?: string;
253
+ depth: number;
254
+ isLast: boolean;
255
255
  }
256
- interface ArrowNavigationState {
257
- items: ArrowNavigationItem[];
256
+ interface HierarchyState {
257
+ items: HierarchyItem[];
258
258
  activeIndex: number;
259
- isVisible: boolean;
260
259
  }
261
260
  interface PluginHooks {
262
261
  onActivate?: () => void;
@@ -300,6 +299,12 @@ interface Plugin {
300
299
  }
301
300
  interface Options {
302
301
  enabled?: boolean;
302
+ /**
303
+ * Confine React Grab to a single container element instead of the whole page.
304
+ * Hit-testing, the toolbar viewport, and scroll re-anchoring are scoped to it.
305
+ * Used by the demo build to scope the showcase to its card.
306
+ */
307
+ container?: HTMLElement;
303
308
  activationMode?: ActivationMode;
304
309
  keyHoldDuration?: number;
305
310
  allowActivationInsideInput?: boolean;
@@ -331,12 +336,31 @@ interface Options {
331
336
  interface SettableOptions extends Options {
332
337
  enabled?: never;
333
338
  telemetry?: never;
339
+ container?: never;
334
340
  }
335
341
  interface SourceInfo {
336
342
  filePath: string;
337
343
  lineNumber: number | null;
338
344
  componentName: string | null;
339
345
  }
346
+ interface SelectedElementPayload {
347
+ tagName: string;
348
+ id?: string;
349
+ className?: string;
350
+ textContent?: string;
351
+ componentName?: string;
352
+ filePath?: string;
353
+ lineNumber?: number;
354
+ columnNumber?: number;
355
+ }
356
+ interface ElementSelectedEventDetail {
357
+ elements: SelectedElementPayload[];
358
+ }
359
+ declare global {
360
+ interface WindowEventMap {
361
+ "react-grab:element-selected": CustomEvent<ElementSelectedEventDetail>;
362
+ }
363
+ }
340
364
  interface ToolbarState {
341
365
  edge: "top" | "bottom" | "left" | "right";
342
366
  ratio: number;
@@ -360,6 +384,7 @@ interface ReactGrabAPI {
360
384
  getToolbarState: () => ToolbarState | null;
361
385
  setToolbarState: (state: Partial<ToolbarState>) => void;
362
386
  onToolbarStateChange: (callback: (state: ToolbarState) => void) => () => void;
387
+ reset: () => void;
363
388
  dispose: () => void;
364
389
  copyElement: (elements: Element | Element[]) => Promise<boolean>;
365
390
  getSource: (element: Element) => Promise<SourceInfo | null>;
@@ -419,8 +444,8 @@ interface ReactGrabRendererProps {
419
444
  selectionComponentName?: string;
420
445
  selectionLabelVisible?: boolean;
421
446
  selectionLabelStatus?: SelectionLabelStatus;
422
- selectionArrowNavigationState?: ArrowNavigationState;
423
- onArrowNavigationSelect?: (index: number) => void;
447
+ hierarchyState?: HierarchyState;
448
+ hierarchyMenuPosition?: DropdownAnchor | null;
424
449
  labelInstances?: SelectionLabelInstance[];
425
450
  dragVisible?: boolean;
426
451
  dragBounds?: OverlayBounds;
@@ -434,6 +459,8 @@ interface ReactGrabRendererProps {
434
459
  inputValue?: string;
435
460
  isPromptMode?: boolean;
436
461
  onShowContextMenuInstance?: (instanceId: string) => void;
462
+ onRetryInstance?: (instanceId: string) => void;
463
+ onAcknowledgeErrorInstance?: (instanceId: string) => void;
437
464
  onLabelInstanceHoverChange?: (instanceId: string, isHovered: boolean) => void;
438
465
  onInputChange?: (value: string) => void;
439
466
  onInputSubmit?: () => void;
@@ -521,7 +548,7 @@ interface ReactGrabEntry {
521
548
  frames?: ReactGrabStackFrame[];
522
549
  }
523
550
  //#endregion
524
- //#region ../../node_modules/.pnpm/bippy@0.5.42_react@19.2.6/node_modules/bippy/dist/core.d.ts
551
+ //#region ../../node_modules/.pnpm/bippy@0.5.43_react@19.2.6/node_modules/bippy/dist/core.d.ts
525
552
  type Flags = number;
526
553
  type Lanes = number;
527
554
  type TypeOfMode = number;
@@ -702,7 +729,7 @@ declare const isInstrumentationActive: () => boolean;
702
729
  * Returns the latest fiber (since it may be double-buffered).
703
730
  */
704
731
  //#endregion
705
- //#region ../../node_modules/.pnpm/bippy@0.5.42_react@19.2.6/node_modules/bippy/dist/source.d.ts
732
+ //#region ../../node_modules/.pnpm/bippy@0.5.43_react@19.2.6/node_modules/bippy/dist/source.d.ts
706
733
  //#region src/source/parse-stack.d.ts
707
734
  interface StackFrame {
708
735
  args?: unknown[];
@@ -724,4 +751,4 @@ interface CopyContentOptions {
724
751
  }
725
752
  declare const copyContent: (content: string, options?: CopyContentOptions) => boolean;
726
753
  //#endregion
727
- export { ToolbarState as A, ReactGrabAPI as C, SettableOptions as D, Rect as E, SourceInfo as O, PromptModeContext as S, ReactGrabState as T, OverlayBounds as _, ActionContext as a, PluginHooks as b, AgentContext as c, DeepPartial as d, DragRect as f, Options as g, GrabbedBox as h, isInstrumentationActive as i, Theme as k, ContextMenuAction as l, ElementLabelVariant as m, StackFrame as n, ActionContextHooks as o, ElementLabelContext as p, Fiber as r, ActivationMode as s, copyContent as t, ContextMenuActionContext as u, Plugin as v, ReactGrabRendererProps as w, Position as x, PluginConfig as y };
754
+ export { SourceInfo as A, PromptModeContext as C, Rect as D, ReactGrabState as E, ToolbarState as M, SelectedElementPayload as O, Position as S, ReactGrabRendererProps as T, Options as _, ActionContext as a, PluginConfig as b, AgentContext as c, DeepPartial as d, DragRect as f, GrabbedBox as g, ElementSelectedEventDetail as h, isInstrumentationActive as i, Theme as j, SettableOptions as k, ContextMenuAction as l, ElementLabelVariant as m, StackFrame as n, ActionContextHooks as o, ElementLabelContext as p, Fiber as r, ActivationMode as s, copyContent as t, ContextMenuActionContext as u, OverlayBounds as v, ReactGrabAPI as w, PluginHooks as x, Plugin as y };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @license MIT
3
+ *
4
+ * Copyright (c) 2025 Aiden Bai
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+ const e=require(`./freeze-updates-fV8HUsUG.cjs`);var t=class extends Error{constructor(e){super(e),this.name=`ReactGrabError`}},n=class extends t{constructor(){super(`Can't generate CSS selector for non-element node type.`),this.name=`NonElementNodeError`}},r=class extends t{constructor(e){super(`Timeout: Can't find a unique selector after ${e}ms`),this.name=`SelectorTimeoutError`,this.timeoutMs=e}},i=class extends t{constructor(){super(`Selector was not found.`),this.name=`SelectorNotFoundError`}},a=class extends t{constructor(){super(`Failed to copy`),this.name=`CopyFailedError`}};const o=e=>e===void 0||!Number.isFinite(e)?3:Math.max(0,Math.floor(e)),s=e=>{try{return decodeURIComponent(e)}catch{return e}},c=/(?:^|[/\\])node_modules[/\\]/,l=/[/\\]\.vite[/\\]deps[^/\\]*[/\\]/,u=/\.[mc]?[jt]sx?$/i,d=/^chunk-[A-Za-z0-9_-]+$/,f=/[/\\]/,p=/^(.+?)@v?\d/,m=e=>e.split(f).filter(Boolean),h=e=>{let[t,n]=m(e);return!t||t.startsWith(`.`)?null:t.startsWith(`@`)?n?`${t}/${n}`:null:t},ee=e=>{let t=m(e)[0];if(!t)return null;let n=t.replace(u,``);if(d.test(n))return null;if(!n.startsWith(`@`))return n;let r=n.indexOf(`_`);return r===-1?null:`${n.slice(0,r)}/${n.slice(r+1)}`},g=(e,t,n)=>{let r=e.split(t);return r.length>1?n(r[r.length-1]):null},_=e=>e?.match(p)?.[1]??null,te=e=>{let t;try{t=new URL(e)}catch{return null}if(!t.hostname)return null;let n=m(t.pathname).map(s);for(let[e,t]of n.entries()){if(t.startsWith(`@`)){let r=_(n[e+1]);if(r)return`${t}/${r}`;continue}let r=_(t);if(r)return r}return null},ne=e=>g(e,l,ee)??g(e,c,h),re=t=>{if(!t)return null;let n=e.E(t);return n&&(ne(s(n))||te(t))||null},ie=/^@[A-Za-z0-9][A-Za-z0-9._-]*$/,ae=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,oe=new Set([`app`,`web`,`website`,`frontend`,`client`,`src`]),se=new Set([`app`,`src`,`components`,`pages`,`features`,`modules`,`hooks`,`lib`,`utils`,`ui`,`shared`,`common`,`core`,`styles`,`assets`]),ce=e=>{let t=e;for(;t.startsWith(`../`)||t.startsWith(`./`);)t=t.slice(t.startsWith(`../`)?3:2);return t},le=t=>{let n=ce(s(e.E(t)));if(n.startsWith(`/`))return null;let[r,i,...a]=m(n);return!r||!i||a.length===0||!ie.test(r)||se.has(r.slice(1))||!ae.test(i)||u.test(i)||oe.has(i)?null:`${r}/${i}`},ue=e=>e?re(e)??le(e):null,v=t=>{if(!t)return{origin:`unknown`,packageName:null};let n=ue(t);return n?{origin:`package`,packageName:n}:e.w(t)?{origin:`app`,packageName:null}:{origin:`unknown`,packageName:null}},de=new Set([`role`,`name`,`aria-label`,`rel`,`href`]),y=e=>{if(!/^[a-z-]{3,}$/i.test(e))return!1;let t=e.split(/-|[A-Z]/);for(let e of t)if(e.length<=2||/[^aeiou]{4,}/i.test(e))return!1;return!0},fe=(e,t)=>{let n=de.has(e)||e.startsWith(`data-`)&&y(e),r=y(t)&&t.length<100||t.startsWith(`#`)&&y(t.slice(1));return n&&r},b=e=>{let t=e[0].name;for(let n=1;n<e.length;n++)t=`${e[n].name} > ${t}`;return t},x=e=>{let t=0;for(let n of e)t+=n.penalty;return t},S=(e,t)=>x(e)-x(t),C=(e,t)=>{let n=e.parentNode;if(!n)return;let r=n.firstChild;if(!r)return;let i=0;for(;r&&(r instanceof Element&&(t===void 0||r.tagName.toLowerCase()===t)&&i++,r!==e);)r=r.nextSibling;return i},pe=(e,t)=>e===`html`?`html`:`${e}:nth-child(${t})`,me=(e,t)=>e===`html`?`html`:`${e}:nth-of-type(${t})`,he=(e,t)=>{let n=[],r=e.getAttribute(`id`),i=e.tagName.toLowerCase();r&&y(r)&&n.push({name:`#${CSS.escape(r)}`,penalty:0});for(let t of e.classList)y(t)&&n.push({name:`.${CSS.escape(t)}`,penalty:1});for(let r of e.attributes)t(r.name,r.value)&&n.push({name:`[${CSS.escape(r.name)}="${CSS.escape(r.value)}"]`,penalty:2});n.push({name:i,penalty:5});let a=C(e,i);a!==void 0&&n.push({name:me(i,a),penalty:10});let o=C(e);return o!==void 0&&n.push({name:pe(i,o),penalty:50}),n},w=(t,n=e.pt,r=[])=>{if(n<=0)return[];if(t.length===0)return[r];let i=[];for(let e of t[0]){let a=n-i.length;if(a<=0)break;i.push(...w(t.slice(1),a,[...r,e]))}return i},ge=(e,t)=>{let n=t.getRootNode?.();return n instanceof ShadowRoot?n:e instanceof Document?e:e.ownerDocument},T=(e,t)=>t.querySelectorAll(b(e)).length===1,_e=(e,t)=>{let n=e,r=[];for(;n&&n!==t;){let e=n.tagName.toLowerCase(),t=C(n,e);if(t===void 0)return;r.push({name:me(e,t),penalty:10}),n=n.parentElement}return T(r,t)?r:void 0},ve=(e,t,a,o)=>{if(e.nodeType!==Node.ELEMENT_NODE)throw new n;if(e.tagName.toLowerCase()===`html`)return`html`;let s=ge(t,e),c=Date.now(),l=[],u=e,d=0,f;for(;u&&u!==s&&!f;)if(l.push(he(u,o)),u=u.parentElement,d++,d>=3){let t=w(l);t.sort(S);for(let n of t){if(Date.now()-c>a){let t=_e(e,s);if(!t)throw new r(a);return b(t)}if(T(n,s)){f=n;break}}}if(!f&&d<3){let e=w(l);e.sort(S);for(let t of e){if(Date.now()-c>a)break;if(T(t,s)){f=t;break}}}if(!f)throw new i;return b(f)},E=e=>e.ownerDocument.body??e.ownerDocument.documentElement,D=new Set([`data-testid`,`data-test-id`,`data-test`,`data-cy`,`data-qa`,`aria-label`,`href`,`src`,`role`,`name`,`title`,`alt`]),O=e=>e.length>0&&e.length<=120,k=(e,t)=>{try{let n=e.ownerDocument.querySelectorAll(t);return n.length===1&&n[0]===e}catch{return!1}},ye=e=>{if(e instanceof HTMLElement&&e.id){let t=`#${CSS.escape(e.id)}`;if(k(e,t))return t}for(let t of D){let n=e.getAttribute(t);if(!n||!O(n))continue;let r=`[${t}=${JSON.stringify(n)}]`;if(k(e,r))return r;let i=`${e.tagName.toLowerCase()}${r}`;if(k(e,i))return i}return null},be=e=>{let t=[],n=E(e),r=e;for(;r;){if(r instanceof HTMLElement&&r.id){t.unshift(`#${CSS.escape(r.id)}`);break}let e=r.parentElement;if(!e){t.unshift(r.tagName.toLowerCase());break}let i=Array.from(e.children).indexOf(r)+1;if(t.unshift(`${r.tagName.toLowerCase()}:nth-child(${i})`),e===n){t.unshift(n.tagName.toLowerCase());break}r=e}return t.join(` > `)},xe=e=>{let t=ye(e);if(t)return t;try{let t=ve(e,E(e),200,(e,t)=>fe(e,t)||D.has(e)&&O(t));if(t)return t}catch{}return be(e)},Se=t=>{if(!t)return!1;let n=`/${e.x(t)}/`.toLowerCase();return e.Ft.some(e=>n.includes(e))},Ce=e=>e.map(e=>`\n in ${e}`).join(``),we=[`about://React/`,`rsc://React/`],Te=e=>we.some(t=>e.startsWith(t)),Ee=e=>{for(let t of we){if(!e.startsWith(t))continue;let n=e.indexOf(`/`,t.length);if(n===-1)continue;let r=n+1,i=e.lastIndexOf(`?`);return s(i>r?e.slice(r,i):e.slice(r))}return e},De=e=>{if(typeof e!=`object`||!e||!(`status`in e)||e.status!==`fulfilled`||!(`value`in e)||typeof e.value!=`object`||e.value===null||!(`originalStackFrame`in e.value))return null;let t=e.value.originalStackFrame;return typeof t!=`object`||!t||!(`file`in t)||typeof t.file!=`string`||!t.file||`ignored`in t&&t.ignored?null:{file:t.file,line1:`line1`in t&&typeof t.line1==`number`?t.line1:null,column1:`column1`in t&&typeof t.column1==`number`?t.column1:null}},Oe=async(t,n)=>{let r=[],i=[];for(let e=0;e<t.length;e++){let n=t[e];!n.isServer||!n.fileName||(r.push(e),i.push({file:Ee(n.fileName),methodName:n.functionName??`<unknown>`,line1:n.lineNumber??null,column1:n.columnNumber??null,arguments:[]}))}if(i.length===0)return t;let a=new AbortController,o=setTimeout(()=>a.abort(),e.Lt),s=()=>a.abort();n?.aborted&&a.abort(),n?.addEventListener(`abort`,s);try{let n=await fetch(`${e.y()}/__nextjs_original-stack-frames`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({frames:i,isServer:!0,isEdgeServer:!1,isAppDirectory:!0}),priority:`high`,signal:a.signal});if(!n.ok)return t;let o=await n.json();if(!Array.isArray(o))return t;let s=[...t];for(let e=0;e<r.length;e++){let n=De(o[e]);if(!n)continue;let i=r[e];s[i]={...t[i],fileName:n.file,lineNumber:n.line1??void 0,columnNumber:n.column1??void 0,isSymbolicated:!0}}return s}catch{return t}finally{clearTimeout(o),n?.removeEventListener(`abort`,s)}},ke=t=>{let n=new Map;return e.M(t,t=>{if(!e.O(t))return!1;let r=e.T(t._debugStack.stack);if(!r)return!1;for(let t of e.D(r))!t.functionName||!t.fileName||Te(t.fileName)&&(n.has(t.functionName)||n.set(t.functionName,{...t,isServer:!0}));return!1},!0),n},Ae=(e,t)=>{if(!t.some(e=>e.isServer&&!e.fileName&&e.functionName))return t;let n=ke(e);return n.size===0?t:t.map(e=>{if(!e.isServer||e.fileName||!e.functionName)return e;let t=n.get(e.functionName);return t?{...e,fileName:t.fileName,lineNumber:t.lineNumber,columnNumber:t.columnNumber}:e})};let A=0;const j=[],je=()=>A<3?(A+=1,Promise.resolve()):new Promise(e=>{j.push(e)}),Me=()=>{let e=j.shift();if(e){e();return}--A},M=async(t,n,r=e.It)=>{await je();let i=new AbortController,a,o=new Promise(e=>{a=setTimeout(()=>{i.abort(),e(n)},r)}),s=t(i.signal);s.catch(()=>{});try{return await Promise.race([s,o])}finally{clearTimeout(a),Me()}},N=(e,t)=>e.length>t?`${e.slice(0,t)}...`:e,Ne=e=>e.startsWith(`data-react-grab-`),P=e=>e.replace(/\s+/g,` `).trim(),Pe=e=>{let t=[];for(let n of e.childNodes){if(n.nodeType!==Node.TEXT_NODE)continue;let e=P(n.textContent??``);e&&t.push(e)}return t.join(` `)},F=t=>t.getAttribute(`aria-hidden`)===`true`||t.hasAttribute(`hidden`)?!0:e.At.has(t.tagName.toLowerCase()),I=(e,t,n)=>{if(e.nodeType===Node.TEXT_NODE){let r=P(e.textContent??``);return r?(t.push(r),n-r.length):n}if(!(e instanceof Element)||F(e))return n;for(let r of e.childNodes)if(n=I(r,t,n),n<=0)break;return n},L=(t,n)=>{if(F(t))return``;let r=Pe(t);if(!e.Dt.has(n)||r&&t.children.length===0)return r;let i=[];return I(t,i,100),i.join(` `)},R=e=>N(e,15),Fe=t=>{let n=[];for(let r of e.kt){let e=t.getAttribute(r);e&&n.push(`${r}="${e}"`)}return n.length>0?` ${n.join(` `)}`:``},Ie=e=>e===`class`||e===`className`||e===`style`,z=t=>{let n=[],r=[],i=``;for(let{name:a,value:o}of t.attributes)if(!Ne(a)){if(Ie(a)){a!==`style`&&o&&(i=` class="${R(o)}"`);continue}e.Ot.has(a)?n.push(o?` ${a}="${o}"`:` ${a}`):o&&r.push(` ${a}="${R(o)}"`)}return n.join(``)+r.join(``)+i},B=t=>t.length===0?``:t.length<=2?t.map(t=>`<${e.j(t)} ...>`).join(`
10
+ `):`(${t.length} elements)`,Le=t=>{let n=e.j(t);if(!(t instanceof HTMLElement))return`<${n}${Fe(t)} />`;let r=z(t),i=N(L(t,n),100);return i?`<${n}${r}>${i}</${n}>`:`<${n}${r} />`},V=t=>{let n=e.j(t),r=z(t),i=L(t,n),a=[],o=[],s=!1;for(let e of t.childNodes)e.nodeType!==Node.COMMENT_NODE&&(e.nodeType===Node.TEXT_NODE?e.textContent&&e.textContent.trim().length>0&&(s=!0):e instanceof Element&&(s?o.push(e):a.push(e)));let c=i.length>0&&e.Dt.has(n),l=``,u=B(a);u&&!c&&(l+=`\n ${u}`),i&&(l+=`\n ${N(i,100)}`);let d=B(o);return d&&!c&&(l+=`\n ${d}`),l.length>0?`<${n}${r}>${l}\n</${n}>`:`<${n}${r} />`},Re=new Set([`_`,`$`,`motion.`,`styled.`,`chakra.`,`ark.`,`Primitive.`,`Slot.`]),ze=new Set(`AppRouter.AppRouterAnnouncer.AppDevOverlay.AppDevOverlayErrorBoundary.ClientPageRoot.ClientSegmentRoot.DevRootHTTPAccessFallbackBoundary.ErrorBoundary.ErrorBoundaryHandler.GracefulDegradeBoundary.HTTPAccessErrorFallback.HTTPAccessFallbackBoundary.HTTPAccessFallbackErrorBoundary.HandleRedirect.Head.HistoryUpdater.HotReload.InnerLayoutRouter.InnerScrollAndFocusHandler.InnerScrollAndFocusHandlerOld.InnerScrollAndMaybeFocusHandler.InnerScrollHandlerNew.LoadableComponent.LoadingBoundary.LoadingBoundaryProvider.NotAllowedRootHTTPFallbackError.OfflineProvider.OuterLayoutRouter.RedirectBoundary.RedirectErrorBoundary.RenderFromTemplateContext.RenderValidationBoundaryAtThisLevel.ReplaySsrOnlyErrors.RootErrorBoundary.RootLevelDevOverlayElement.Router.ScrollAndFocusHandler.ScrollAndMaybeFocusHandler.SegmentBoundaryTrigger.SegmentBoundaryTriggerNode.SegmentStateProvider.SegmentTrieNode.SegmentViewNode.SegmentViewStateNode.ServerRoot.body.html`.split(`.`)),Be=new Set([`Suspense`,`Fragment`,`StrictMode`,`Profiler`,`SuspenseList`]),Ve=new Set([`MotionDOMComponent`]),H=e=>{if(ze.has(e)||Be.has(e)||Ve.has(e))return!0;for(let t of Re)if(e.startsWith(t))return!0;return!1},He=e=>!(!e||H(e)||e===`SlotClone`||e===`Slot`),U=e=>!(e.length<=1||H(e)||e[0]!==e[0].toUpperCase()||e.endsWith(`Provider`)||e.endsWith(`Context`)),W=e=>e&&U(e)?e:null,G=t=>{if(!e.N())return t;let n=t;for(;n;){if(e.I(n))return n;n=n.parentElement}return t},Ue=t=>{if(!e.N())return null;let n=e.I(G(t)),r=0;for(;n;){if(n.key)return n.key;if(e.R(n)&&(r+=1,r===2))break;n=n.return}return null},K=new WeakMap,q=new WeakMap,J=e=>t=>fetch(t,{signal:e,priority:`high`}),We=t=>M(async n=>{try{let r=e.I(t);if(!r)return null;let i=await e.C(r,!0,J(n));return e.b()?await Oe(Ae(r,i),n):i}catch{return null}},null),Y=t=>{if(!e.N())return Promise.resolve([]);let n=G(t),r=K.get(n);if(r)return r;let i=We(n).then(e=>(e===null&&K.delete(n),e));return K.set(n,i),i},Ge=async t=>{if(!e.N())return null;let n=await Y(t);if(!n)return null;for(let e of n){let t=W(e.functionName);if(t)return t}return null},Ke=e=>e.find(e=>!!W(e.functionName))??e[0]??null,qe=t=>!t||!e.R(t)?null:W(e.P(t.type)),Je=t=>M(async n=>{let r=e.I(G(t));if(!r)return null;try{let t=await e.S(r,!0,J(n));return t?.fileName?{filePath:e.x(t.fileName),lineNumber:t.lineNumber??null,columnNumber:t.columnNumber??null,componentName:W(t.functionName)??qe(r._debugOwner),origin:v(t.fileName).origin}:null}catch{return null}},null),X=e=>{let t=G(e),n=q.get(t);if(n)return n;let r=Je(t).then(e=>(e||q.delete(t),e));return q.set(t,r),r},Ye=[`app`,`package`],Xe=(t,n)=>{for(let r of Ye){if(t?.origin===r)return t;let i=Ke(n.filter(e=>v(e.fileName).origin===r));if(i?.fileName)return{filePath:e.x(i.fileName),lineNumber:i.lineNumber??null,columnNumber:i.columnNumber??null,componentName:W(i.functionName),origin:r}}return null},Ze=async e=>{let t=await X(e);return t?.origin===`app`?t:Xe(t,await Y(e)??[])},Qe=e=>Z(G(e),1)[0]??null,Z=(t,n,r=()=>!0)=>{if(!e.N())return[];let i=e.I(t);if(!i)return[];let a=[];return e.M(i,t=>{if(a.length>=n)return!0;if(e.R(t)){let n=e.P(t.type);n&&He(n)&&r(n)&&a.push(n)}return!1},!0),a},$e=[`/src/app/`,`/src/pages/`,`/app/`,`/pages/`],et=(t,n)=>{let r=e.x(t);if(!n||!r.startsWith(`/`))return r;for(let e of $e){let t=r.indexOf(e);if(t!==-1)return`/./${r.slice(t+1)}`}return r},tt=(e,t)=>{let n=et(e.filePath,t),r=t&&e.lineNumber?`${n}:${e.lineNumber}${e.columnNumber?`:${e.columnNumber}`:``}`:n;return e.componentName?`\n in ${e.componentName} (at ${r})`:`\n in ${r}`},Q={isAppSource:!1,consumesBudget:!1},nt=(e,t,n,r)=>{let i=t.packageName,a=t.origin===`app`?e.fileName:null;if(e.isServer&&!a&&(n||!e.functionName)){let e=i?`${i} at Server`:`at Server`;return{text:`\n in ${n??`<anonymous>`} (${e})`,...Q}}return!a&&n?{text:i?`\n in ${n} (${i})`:`\n in ${n}`,...Q}:i?{text:`\n in ${i}`,...Q}:a?{text:tt({componentName:n,filePath:a,lineNumber:e.lineNumber??null,columnNumber:e.columnNumber??null},r),isAppSource:!0,consumesBudget:!Se(a)}:null},rt=(t,n={},r=null)=>{let i=o(n.maxLines),a=Math.max(i,20),s=e.b(),c=[],l=new Set,u=null,d=!1,f=!1,p=!1,m=0,h=e=>{e&&l.add(e)};r&&(f=r.origin===`app`,Se(r.filePath)||(m+=1),h(r.componentName),c.push(tt(r,s)));for(let e of t){if(m>=i||c.length>=a)break;let t=v(e.fileName),n=W(e.functionName),o=t.packageName?`${t.packageName}:${n??``}:${e.isServer?`server`:`client`}`:null;if(o&&o===u)continue;if(!d&&n&&n===r?.componentName){d=!0;continue}let l=nt(e,t,n,s);l!==null&&l.text!==c[c.length-1]&&(l.isAppSource&&(f=!0),l.consumesBudget&&(m+=1,p=!0),h(n),c.push(l.text),u=o)}return{text:c.join(``),shouldAppendSelectorHint:!f,hasBudgetedStackFrame:p,renderedComponentNames:l}},it=async e=>{let t=await X(e);return t?.origin===`app`?t:null},at=(e,t,n)=>{let r=Z(G(e),n,e=>U(e)&&!t.renderedComponentNames.has(e));return r.length===0?t:{...t,text:`${t.text}${Ce(r)}`}},$=async(e,t={})=>{let n=await it(e),r=await Y(e),i=o(t.maxLines),a=rt(r??[],t,n);if(a.text)return a.hasBudgetedStackFrame?a:at(e,a,i);let s=Z(G(e),i);return{text:Ce(s),shouldAppendSelectorHint:!0,hasBudgetedStackFrame:!1,renderedComponentNames:new Set(s)}},ot=async(e,t={})=>(await $(e,t)).text,st=(e,t)=>{let n=Ue(e),r=n===null?``:`\n key: "${n}"`,i=t.shouldAppendSelectorHint?`\n selector: ${xe(e)}`:``;return`${t.text}${r}${i}`},ct=async(e,t={})=>{let n=await $(e,t);return`${Le(e)}${st(e,n).replace(/\n\s+/g,` `)}`},lt=async(e,t={})=>{let n=G(e);return`${V(n)}${st(n,await $(n,t))}`},ut=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`),dt=(t,n)=>{let r=n?.componentName??`div`,i={version:e.zt,content:t,entries:n?.entries??[{tagName:n?.tagName,componentName:r,content:t,commentText:n?.commentText}],timestamp:Date.now()},a=e=>{e.preventDefault(),e.clipboardData?.setData(`text/plain`,t),e.clipboardData?.setData(`text/html`,`<meta charset='utf-8'><pre><code>${ut(t)}</code></pre>`),e.clipboardData?.setData(`application/x-react-grab`,JSON.stringify(i))};document.addEventListener(`copy`,a);let o=document.createElement(`textarea`);o.value=t,o.style.position=`fixed`,o.style.left=`-9999px`,o.ariaHidden=`true`,document.body.appendChild(o),o.select();try{return typeof document.execCommand==`function`?document.execCommand(`copy`):!1}finally{document.removeEventListener(`copy`,a),o.remove()}};Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return ct}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return lt}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return Qe}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return ot}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return dt}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return xe}});
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @license MIT
3
+ *
4
+ * Copyright (c) 2025 Aiden Bai
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+ import{At as e,C as t,D as n,Dt as r,E as i,Ft as a,I as o,It as s,Lt as c,M as l,N as u,O as d,Ot as f,P as p,R as m,S as h,T as ee,b as g,j as _,kt as te,pt as ne,w as re,x as v,y as ie,zt as ae}from"./freeze-updates-BbpDYqOS.js";var y=class extends Error{constructor(e){super(e),this.name=`ReactGrabError`}},oe=class extends y{constructor(){super(`Can't generate CSS selector for non-element node type.`),this.name=`NonElementNodeError`}},se=class extends y{constructor(e){super(`Timeout: Can't find a unique selector after ${e}ms`),this.name=`SelectorTimeoutError`,this.timeoutMs=e}},ce=class extends y{constructor(){super(`Selector was not found.`),this.name=`SelectorNotFoundError`}},le=class extends y{constructor(){super(`Failed to copy`),this.name=`CopyFailedError`}};const ue=e=>e===void 0||!Number.isFinite(e)?3:Math.max(0,Math.floor(e)),b=e=>{try{return decodeURIComponent(e)}catch{return e}},de=/(?:^|[/\\])node_modules[/\\]/,fe=/[/\\]\.vite[/\\]deps[^/\\]*[/\\]/,pe=/\.[mc]?[jt]sx?$/i,me=/^chunk-[A-Za-z0-9_-]+$/,he=/[/\\]/,ge=/^(.+?)@v?\d/,x=e=>e.split(he).filter(Boolean),_e=e=>{let[t,n]=x(e);return!t||t.startsWith(`.`)?null:t.startsWith(`@`)?n?`${t}/${n}`:null:t},ve=e=>{let t=x(e)[0];if(!t)return null;let n=t.replace(pe,``);if(me.test(n))return null;if(!n.startsWith(`@`))return n;let r=n.indexOf(`_`);return r===-1?null:`${n.slice(0,r)}/${n.slice(r+1)}`},S=(e,t,n)=>{let r=e.split(t);return r.length>1?n(r[r.length-1]):null},C=e=>e?.match(ge)?.[1]??null,ye=e=>{let t;try{t=new URL(e)}catch{return null}if(!t.hostname)return null;let n=x(t.pathname).map(b);for(let[e,t]of n.entries()){if(t.startsWith(`@`)){let r=C(n[e+1]);if(r)return`${t}/${r}`;continue}let r=C(t);if(r)return r}return null},be=e=>S(e,fe,ve)??S(e,de,_e),xe=e=>{if(!e)return null;let t=i(e);return t&&(be(b(t))||ye(e))||null},Se=/^@[A-Za-z0-9][A-Za-z0-9._-]*$/,Ce=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,we=new Set([`app`,`web`,`website`,`frontend`,`client`,`src`]),Te=new Set([`app`,`src`,`components`,`pages`,`features`,`modules`,`hooks`,`lib`,`utils`,`ui`,`shared`,`common`,`core`,`styles`,`assets`]),Ee=e=>{let t=e;for(;t.startsWith(`../`)||t.startsWith(`./`);)t=t.slice(t.startsWith(`../`)?3:2);return t},De=e=>{let t=Ee(b(i(e)));if(t.startsWith(`/`))return null;let[n,r,...a]=x(t);return!n||!r||a.length===0||!Se.test(n)||Te.has(n.slice(1))||!Ce.test(r)||pe.test(r)||we.has(r)?null:`${n}/${r}`},Oe=e=>e?xe(e)??De(e):null,w=e=>{if(!e)return{origin:`unknown`,packageName:null};let t=Oe(e);return t?{origin:`package`,packageName:t}:re(e)?{origin:`app`,packageName:null}:{origin:`unknown`,packageName:null}},ke=new Set([`role`,`name`,`aria-label`,`rel`,`href`]),T=e=>{if(!/^[a-z-]{3,}$/i.test(e))return!1;let t=e.split(/-|[A-Z]/);for(let e of t)if(e.length<=2||/[^aeiou]{4,}/i.test(e))return!1;return!0},Ae=(e,t)=>{let n=ke.has(e)||e.startsWith(`data-`)&&T(e),r=T(t)&&t.length<100||t.startsWith(`#`)&&T(t.slice(1));return n&&r},E=e=>{let t=e[0].name;for(let n=1;n<e.length;n++)t=`${e[n].name} > ${t}`;return t},D=e=>{let t=0;for(let n of e)t+=n.penalty;return t},O=(e,t)=>D(e)-D(t),k=(e,t)=>{let n=e.parentNode;if(!n)return;let r=n.firstChild;if(!r)return;let i=0;for(;r&&(r instanceof Element&&(t===void 0||r.tagName.toLowerCase()===t)&&i++,r!==e);)r=r.nextSibling;return i},je=(e,t)=>e===`html`?`html`:`${e}:nth-child(${t})`,A=(e,t)=>e===`html`?`html`:`${e}:nth-of-type(${t})`,Me=(e,t)=>{let n=[],r=e.getAttribute(`id`),i=e.tagName.toLowerCase();r&&T(r)&&n.push({name:`#${CSS.escape(r)}`,penalty:0});for(let t of e.classList)T(t)&&n.push({name:`.${CSS.escape(t)}`,penalty:1});for(let r of e.attributes)t(r.name,r.value)&&n.push({name:`[${CSS.escape(r.name)}="${CSS.escape(r.value)}"]`,penalty:2});n.push({name:i,penalty:5});let a=k(e,i);a!==void 0&&n.push({name:A(i,a),penalty:10});let o=k(e);return o!==void 0&&n.push({name:je(i,o),penalty:50}),n},j=(e,t=ne,n=[])=>{if(t<=0)return[];if(e.length===0)return[n];let r=[];for(let i of e[0]){let a=t-r.length;if(a<=0)break;r.push(...j(e.slice(1),a,[...n,i]))}return r},Ne=(e,t)=>{let n=t.getRootNode?.();return n instanceof ShadowRoot?n:e instanceof Document?e:e.ownerDocument},M=(e,t)=>t.querySelectorAll(E(e)).length===1,Pe=(e,t)=>{let n=e,r=[];for(;n&&n!==t;){let e=n.tagName.toLowerCase(),t=k(n,e);if(t===void 0)return;r.push({name:A(e,t),penalty:10}),n=n.parentElement}return M(r,t)?r:void 0},Fe=(e,t,n,r)=>{if(e.nodeType!==Node.ELEMENT_NODE)throw new oe;if(e.tagName.toLowerCase()===`html`)return`html`;let i=Ne(t,e),a=Date.now(),o=[],s=e,c=0,l;for(;s&&s!==i&&!l;)if(o.push(Me(s,r)),s=s.parentElement,c++,c>=3){let t=j(o);t.sort(O);for(let r of t){if(Date.now()-a>n){let t=Pe(e,i);if(!t)throw new se(n);return E(t)}if(M(r,i)){l=r;break}}}if(!l&&c<3){let e=j(o);e.sort(O);for(let t of e){if(Date.now()-a>n)break;if(M(t,i)){l=t;break}}}if(!l)throw new ce;return E(l)},N=e=>e.ownerDocument.body??e.ownerDocument.documentElement,P=new Set([`data-testid`,`data-test-id`,`data-test`,`data-cy`,`data-qa`,`aria-label`,`href`,`src`,`role`,`name`,`title`,`alt`]),F=e=>e.length>0&&e.length<=120,I=(e,t)=>{try{let n=e.ownerDocument.querySelectorAll(t);return n.length===1&&n[0]===e}catch{return!1}},Ie=e=>{if(e instanceof HTMLElement&&e.id){let t=`#${CSS.escape(e.id)}`;if(I(e,t))return t}for(let t of P){let n=e.getAttribute(t);if(!n||!F(n))continue;let r=`[${t}=${JSON.stringify(n)}]`;if(I(e,r))return r;let i=`${e.tagName.toLowerCase()}${r}`;if(I(e,i))return i}return null},Le=e=>{let t=[],n=N(e),r=e;for(;r;){if(r instanceof HTMLElement&&r.id){t.unshift(`#${CSS.escape(r.id)}`);break}let e=r.parentElement;if(!e){t.unshift(r.tagName.toLowerCase());break}let i=Array.from(e.children).indexOf(r)+1;if(t.unshift(`${r.tagName.toLowerCase()}:nth-child(${i})`),e===n){t.unshift(n.tagName.toLowerCase());break}r=e}return t.join(` > `)},L=e=>{let t=Ie(e);if(t)return t;try{let t=Fe(e,N(e),200,(e,t)=>Ae(e,t)||P.has(e)&&F(t));if(t)return t}catch{}return Le(e)},R=e=>{if(!e)return!1;let t=`/${v(e)}/`.toLowerCase();return a.some(e=>t.includes(e))},z=e=>e.map(e=>`\n in ${e}`).join(``),B=[`about://React/`,`rsc://React/`],Re=e=>B.some(t=>e.startsWith(t)),ze=e=>{for(let t of B){if(!e.startsWith(t))continue;let n=e.indexOf(`/`,t.length);if(n===-1)continue;let r=n+1,i=e.lastIndexOf(`?`);return b(i>r?e.slice(r,i):e.slice(r))}return e},Be=e=>{if(typeof e!=`object`||!e||!(`status`in e)||e.status!==`fulfilled`||!(`value`in e)||typeof e.value!=`object`||e.value===null||!(`originalStackFrame`in e.value))return null;let t=e.value.originalStackFrame;return typeof t!=`object`||!t||!(`file`in t)||typeof t.file!=`string`||!t.file||`ignored`in t&&t.ignored?null:{file:t.file,line1:`line1`in t&&typeof t.line1==`number`?t.line1:null,column1:`column1`in t&&typeof t.column1==`number`?t.column1:null}},Ve=async(e,t)=>{let n=[],r=[];for(let t=0;t<e.length;t++){let i=e[t];!i.isServer||!i.fileName||(n.push(t),r.push({file:ze(i.fileName),methodName:i.functionName??`<unknown>`,line1:i.lineNumber??null,column1:i.columnNumber??null,arguments:[]}))}if(r.length===0)return e;let i=new AbortController,a=setTimeout(()=>i.abort(),c),o=()=>i.abort();t?.aborted&&i.abort(),t?.addEventListener(`abort`,o);try{let t=await fetch(`${ie()}/__nextjs_original-stack-frames`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({frames:r,isServer:!0,isEdgeServer:!1,isAppDirectory:!0}),priority:`high`,signal:i.signal});if(!t.ok)return e;let a=await t.json();if(!Array.isArray(a))return e;let o=[...e];for(let t=0;t<n.length;t++){let r=Be(a[t]);if(!r)continue;let i=n[t];o[i]={...e[i],fileName:r.file,lineNumber:r.line1??void 0,columnNumber:r.column1??void 0,isSymbolicated:!0}}return o}catch{return e}finally{clearTimeout(a),t?.removeEventListener(`abort`,o)}},He=e=>{let t=new Map;return l(e,e=>{if(!d(e))return!1;let r=ee(e._debugStack.stack);if(!r)return!1;for(let e of n(r))!e.functionName||!e.fileName||Re(e.fileName)&&(t.has(e.functionName)||t.set(e.functionName,{...e,isServer:!0}));return!1},!0),t},Ue=(e,t)=>{if(!t.some(e=>e.isServer&&!e.fileName&&e.functionName))return t;let n=He(e);return n.size===0?t:t.map(e=>{if(!e.isServer||e.fileName||!e.functionName)return e;let t=n.get(e.functionName);return t?{...e,fileName:t.fileName,lineNumber:t.lineNumber,columnNumber:t.columnNumber}:e})};let V=0;const H=[],We=()=>V<3?(V+=1,Promise.resolve()):new Promise(e=>{H.push(e)}),Ge=()=>{let e=H.shift();if(e){e();return}--V},U=async(e,t,n=s)=>{await We();let r=new AbortController,i,a=new Promise(e=>{i=setTimeout(()=>{r.abort(),e(t)},n)}),o=e(r.signal);o.catch(()=>{});try{return await Promise.race([o,a])}finally{clearTimeout(i),Ge()}},W=(e,t)=>e.length>t?`${e.slice(0,t)}...`:e,Ke=e=>e.startsWith(`data-react-grab-`),qe=e=>e.replace(/\s+/g,` `).trim(),Je=e=>{let t=[];for(let n of e.childNodes){if(n.nodeType!==Node.TEXT_NODE)continue;let e=qe(n.textContent??``);e&&t.push(e)}return t.join(` `)},Ye=t=>t.getAttribute(`aria-hidden`)===`true`||t.hasAttribute(`hidden`)?!0:e.has(t.tagName.toLowerCase()),Xe=(e,t,n)=>{if(e.nodeType===Node.TEXT_NODE){let r=qe(e.textContent??``);return r?(t.push(r),n-r.length):n}if(!(e instanceof Element)||Ye(e))return n;for(let r of e.childNodes)if(n=Xe(r,t,n),n<=0)break;return n},Ze=(e,t)=>{if(Ye(e))return``;let n=Je(e);if(!r.has(t)||n&&e.children.length===0)return n;let i=[];return Xe(e,i,100),i.join(` `)},Qe=e=>W(e,15),$e=e=>{let t=[];for(let n of te){let r=e.getAttribute(n);r&&t.push(`${n}="${r}"`)}return t.length>0?` ${t.join(` `)}`:``},et=e=>e===`class`||e===`className`||e===`style`,tt=e=>{let t=[],n=[],r=``;for(let{name:i,value:a}of e.attributes)if(!Ke(i)){if(et(i)){i!==`style`&&a&&(r=` class="${Qe(a)}"`);continue}f.has(i)?t.push(a?` ${i}="${a}"`:` ${i}`):a&&n.push(` ${i}="${Qe(a)}"`)}return t.join(``)+n.join(``)+r},nt=e=>e.length===0?``:e.length<=2?e.map(e=>`<${_(e)} ...>`).join(`
10
+ `):`(${e.length} elements)`,rt=e=>{let t=_(e);if(!(e instanceof HTMLElement))return`<${t}${$e(e)} />`;let n=tt(e),r=W(Ze(e,t),100);return r?`<${t}${n}>${r}</${t}>`:`<${t}${n} />`},it=e=>{let t=_(e),n=tt(e),i=Ze(e,t),a=[],o=[],s=!1;for(let t of e.childNodes)t.nodeType!==Node.COMMENT_NODE&&(t.nodeType===Node.TEXT_NODE?t.textContent&&t.textContent.trim().length>0&&(s=!0):t instanceof Element&&(s?o.push(t):a.push(t)));let c=i.length>0&&r.has(t),l=``,u=nt(a);u&&!c&&(l+=`\n ${u}`),i&&(l+=`\n ${W(i,100)}`);let d=nt(o);return d&&!c&&(l+=`\n ${d}`),l.length>0?`<${t}${n}>${l}\n</${t}>`:`<${t}${n} />`},at=new Set([`_`,`$`,`motion.`,`styled.`,`chakra.`,`ark.`,`Primitive.`,`Slot.`]),ot=new Set(`AppRouter.AppRouterAnnouncer.AppDevOverlay.AppDevOverlayErrorBoundary.ClientPageRoot.ClientSegmentRoot.DevRootHTTPAccessFallbackBoundary.ErrorBoundary.ErrorBoundaryHandler.GracefulDegradeBoundary.HTTPAccessErrorFallback.HTTPAccessFallbackBoundary.HTTPAccessFallbackErrorBoundary.HandleRedirect.Head.HistoryUpdater.HotReload.InnerLayoutRouter.InnerScrollAndFocusHandler.InnerScrollAndFocusHandlerOld.InnerScrollAndMaybeFocusHandler.InnerScrollHandlerNew.LoadableComponent.LoadingBoundary.LoadingBoundaryProvider.NotAllowedRootHTTPFallbackError.OfflineProvider.OuterLayoutRouter.RedirectBoundary.RedirectErrorBoundary.RenderFromTemplateContext.RenderValidationBoundaryAtThisLevel.ReplaySsrOnlyErrors.RootErrorBoundary.RootLevelDevOverlayElement.Router.ScrollAndFocusHandler.ScrollAndMaybeFocusHandler.SegmentBoundaryTrigger.SegmentBoundaryTriggerNode.SegmentStateProvider.SegmentTrieNode.SegmentViewNode.SegmentViewStateNode.ServerRoot.body.html`.split(`.`)),st=new Set([`Suspense`,`Fragment`,`StrictMode`,`Profiler`,`SuspenseList`]),ct=new Set([`MotionDOMComponent`]),lt=e=>{if(ot.has(e)||st.has(e)||ct.has(e))return!0;for(let t of at)if(e.startsWith(t))return!0;return!1},ut=e=>!(!e||lt(e)||e===`SlotClone`||e===`Slot`),dt=e=>!(e.length<=1||lt(e)||e[0]!==e[0].toUpperCase()||e.endsWith(`Provider`)||e.endsWith(`Context`)),G=e=>e&&dt(e)?e:null,K=e=>{if(!u())return e;let t=e;for(;t;){if(o(t))return t;t=t.parentElement}return e},ft=e=>{if(!u())return null;let t=o(K(e)),n=0;for(;t;){if(t.key)return t.key;if(m(t)&&(n+=1,n===2))break;t=t.return}return null},q=new WeakMap,J=new WeakMap,pt=e=>t=>fetch(t,{signal:e,priority:`high`}),mt=e=>U(async n=>{try{let r=o(e);if(!r)return null;let i=await t(r,!0,pt(n));return g()?await Ve(Ue(r,i),n):i}catch{return null}},null),Y=e=>{if(!u())return Promise.resolve([]);let t=K(e),n=q.get(t);if(n)return n;let r=mt(t).then(e=>(e===null&&q.delete(t),e));return q.set(t,r),r},ht=async e=>{if(!u())return null;let t=await Y(e);if(!t)return null;for(let e of t){let t=G(e.functionName);if(t)return t}return null},gt=e=>e.find(e=>!!G(e.functionName))??e[0]??null,_t=e=>!e||!m(e)?null:G(p(e.type)),vt=e=>U(async t=>{let n=o(K(e));if(!n)return null;try{let e=await h(n,!0,pt(t));return e?.fileName?{filePath:v(e.fileName),lineNumber:e.lineNumber??null,columnNumber:e.columnNumber??null,componentName:G(e.functionName)??_t(n._debugOwner),origin:w(e.fileName).origin}:null}catch{return null}},null),yt=e=>{let t=K(e),n=J.get(t);if(n)return n;let r=vt(t).then(e=>(e||J.delete(t),e));return J.set(t,r),r},bt=[`app`,`package`],xt=(e,t)=>{for(let n of bt){if(e?.origin===n)return e;let r=gt(t.filter(e=>w(e.fileName).origin===n));if(r?.fileName)return{filePath:v(r.fileName),lineNumber:r.lineNumber??null,columnNumber:r.columnNumber??null,componentName:G(r.functionName),origin:n}}return null},St=async e=>{let t=await yt(e);return t?.origin===`app`?t:xt(t,await Y(e)??[])},Ct=e=>X(K(e),1)[0]??null,X=(e,t,n=()=>!0)=>{if(!u())return[];let r=o(e);if(!r)return[];let i=[];return l(r,e=>{if(i.length>=t)return!0;if(m(e)){let t=p(e.type);t&&ut(t)&&n(t)&&i.push(t)}return!1},!0),i},wt=[`/src/app/`,`/src/pages/`,`/app/`,`/pages/`],Tt=(e,t)=>{let n=v(e);if(!t||!n.startsWith(`/`))return n;for(let e of wt){let t=n.indexOf(e);if(t!==-1)return`/./${n.slice(t+1)}`}return n},Et=(e,t)=>{let n=Tt(e.filePath,t),r=t&&e.lineNumber?`${n}:${e.lineNumber}${e.columnNumber?`:${e.columnNumber}`:``}`:n;return e.componentName?`\n in ${e.componentName} (at ${r})`:`\n in ${r}`},Z={isAppSource:!1,consumesBudget:!1},Dt=(e,t,n,r)=>{let i=t.packageName,a=t.origin===`app`?e.fileName:null;if(e.isServer&&!a&&(n||!e.functionName)){let e=i?`${i} at Server`:`at Server`;return{text:`\n in ${n??`<anonymous>`} (${e})`,...Z}}return!a&&n?{text:i?`\n in ${n} (${i})`:`\n in ${n}`,...Z}:i?{text:`\n in ${i}`,...Z}:a?{text:Et({componentName:n,filePath:a,lineNumber:e.lineNumber??null,columnNumber:e.columnNumber??null},r),isAppSource:!0,consumesBudget:!R(a)}:null},Ot=(e,t={},n=null)=>{let r=ue(t.maxLines),i=Math.max(r,20),a=g(),o=[],s=new Set,c=null,l=!1,u=!1,d=!1,f=0,p=e=>{e&&s.add(e)};n&&(u=n.origin===`app`,R(n.filePath)||(f+=1),p(n.componentName),o.push(Et(n,a)));for(let t of e){if(f>=r||o.length>=i)break;let e=w(t.fileName),s=G(t.functionName),m=e.packageName?`${e.packageName}:${s??``}:${t.isServer?`server`:`client`}`:null;if(m&&m===c)continue;if(!l&&s&&s===n?.componentName){l=!0;continue}let h=Dt(t,e,s,a);h!==null&&h.text!==o[o.length-1]&&(h.isAppSource&&(u=!0),h.consumesBudget&&(f+=1,d=!0),p(s),o.push(h.text),c=m)}return{text:o.join(``),shouldAppendSelectorHint:!u,hasBudgetedStackFrame:d,renderedComponentNames:s}},kt=async e=>{let t=await yt(e);return t?.origin===`app`?t:null},At=(e,t,n)=>{let r=X(K(e),n,e=>dt(e)&&!t.renderedComponentNames.has(e));return r.length===0?t:{...t,text:`${t.text}${z(r)}`}},Q=async(e,t={})=>{let n=await kt(e),r=await Y(e),i=ue(t.maxLines),a=Ot(r??[],t,n);if(a.text)return a.hasBudgetedStackFrame?a:At(e,a,i);let o=X(K(e),i);return{text:z(o),shouldAppendSelectorHint:!0,hasBudgetedStackFrame:!1,renderedComponentNames:new Set(o)}},jt=async(e,t={})=>(await Q(e,t)).text,$=(e,t)=>{let n=ft(e),r=n===null?``:`\n key: "${n}"`,i=t.shouldAppendSelectorHint?`\n selector: ${L(e)}`:``;return`${t.text}${r}${i}`},Mt=async(e,t={})=>{let n=await Q(e,t);return`${rt(e)}${$(e,n).replace(/\n\s+/g,` `)}`},Nt=async(e,t={})=>{let n=K(e);return`${it(n)}${$(n,await Q(n,t))}`},Pt=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`),Ft=(e,t)=>{let n=t?.componentName??`div`,r={version:ae,content:e,entries:t?.entries??[{tagName:t?.tagName,componentName:n,content:e,commentText:t?.commentText}],timestamp:Date.now()},i=t=>{t.preventDefault(),t.clipboardData?.setData(`text/plain`,e),t.clipboardData?.setData(`text/html`,`<meta charset='utf-8'><pre><code>${Pt(e)}</code></pre>`),t.clipboardData?.setData(`application/x-react-grab`,JSON.stringify(r))};document.addEventListener(`copy`,i);let a=document.createElement(`textarea`);a.value=e,a.style.position=`fixed`,a.style.left=`-9999px`,a.ariaHidden=`true`,document.body.appendChild(a),a.select();try{return typeof document.execCommand==`function`?document.execCommand(`copy`):!1}finally{document.removeEventListener(`copy`,i),a.remove()}};export{ht as a,St as c,le as d,Mt as i,it as l,Nt as n,Y as o,Ct as r,jt as s,Ft as t,L as u};
@@ -6,4 +6,4 @@
6
6
  * This source code is licensed under the MIT license found in the
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../core-BMr2NQZo.cjs`),t=require(`../freeze-updates-BgilkYa3.cjs`),n=require(`../copy-content-CE1c2qMK.cjs`);exports.DEFAULT_THEME=e.a,exports.copyContent=n.t,exports.formatElementInfo=n.n,exports.generateSnippet=e.n,exports.getStack=n.o,exports.init=e.t,exports.isInstrumentationActive=t.I;
9
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../core-U9umuR7Y.cjs`),t=require(`../freeze-updates-fV8HUsUG.cjs`),n=require(`../copy-content-CLCI_Lbe.cjs`);exports.DEFAULT_THEME=e.a,exports.copyContent=n.t,exports.formatElementInfo=n.n,exports.generateSnippet=e.n,exports.getStack=n.o,exports.init=e.t,exports.isInstrumentationActive=t.N;
@@ -6,6 +6,6 @@
6
6
  * This source code is licensed under the MIT license found in the
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
- import { C as ReactGrabAPI, D as SettableOptions, O as SourceInfo, _ as OverlayBounds, a as ActionContext, b as PluginHooks, c as AgentContext, g as Options, i as isInstrumentationActive, l as ContextMenuAction, t as copyContent, v as Plugin, w as ReactGrabRendererProps, y as PluginConfig } from "../copy-content-5FzVj_Qo.cjs";
10
- import { a as getStack, i as formatElementInfo, n as generateSnippet, r as DEFAULT_THEME, t as init } from "../index-jMjUhmbS.cjs";
9
+ import { A as SourceInfo, T as ReactGrabRendererProps, _ as Options, a as ActionContext, b as PluginConfig, c as AgentContext, i as isInstrumentationActive, k as SettableOptions, l as ContextMenuAction, t as copyContent, v as OverlayBounds, w as ReactGrabAPI, x as PluginHooks, y as Plugin } from "../copy-content-BPB8MmpL.cjs";
10
+ import { a as getStack, i as formatElementInfo, n as generateSnippet, r as DEFAULT_THEME, t as init } from "../index-DMyJsiaz.cjs";
11
11
  export { ActionContext, AgentContext, ContextMenuAction, DEFAULT_THEME, Options, OverlayBounds, Plugin, PluginConfig, PluginHooks, ReactGrabAPI, ReactGrabRendererProps, SettableOptions, SourceInfo, copyContent, formatElementInfo, generateSnippet, getStack, init, isInstrumentationActive };
@@ -6,6 +6,6 @@
6
6
  * This source code is licensed under the MIT license found in the
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
- import { C as ReactGrabAPI, D as SettableOptions, O as SourceInfo, _ as OverlayBounds, a as ActionContext, b as PluginHooks, c as AgentContext, g as Options, i as isInstrumentationActive, l as ContextMenuAction, t as copyContent, v as Plugin, w as ReactGrabRendererProps, y as PluginConfig } from "../copy-content-BJATOqZF.js";
10
- import { a as getStack, i as formatElementInfo, n as generateSnippet, r as DEFAULT_THEME, t as init } from "../index-C_bngsx-.js";
9
+ import { A as SourceInfo, T as ReactGrabRendererProps, _ as Options, a as ActionContext, b as PluginConfig, c as AgentContext, i as isInstrumentationActive, k as SettableOptions, l as ContextMenuAction, t as copyContent, v as OverlayBounds, w as ReactGrabAPI, x as PluginHooks, y as Plugin } from "../copy-content-C7lFyXsY.js";
10
+ import { a as getStack, i as formatElementInfo, n as generateSnippet, r as DEFAULT_THEME, t as init } from "../index-VkohC_Hw.js";
11
11
  export { ActionContext, AgentContext, ContextMenuAction, DEFAULT_THEME, Options, OverlayBounds, Plugin, PluginConfig, PluginHooks, ReactGrabAPI, ReactGrabRendererProps, SettableOptions, SourceInfo, copyContent, formatElementInfo, generateSnippet, getStack, init, isInstrumentationActive };
@@ -6,4 +6,4 @@
6
6
  * This source code is licensed under the MIT license found in the
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
- import{a as e,n as t,t as n}from"../core-GnLSAWJ2.js";import{I as r}from"../freeze-updates-B9uIB2_2.js";import{n as i,o as a,t as o}from"../copy-content-BdNGJB1g.js";export{e as DEFAULT_THEME,o as copyContent,i as formatElementInfo,t as generateSnippet,a as getStack,n as init,r as isInstrumentationActive};
9
+ import{a as e,n as t,t as n}from"../core-CBCQU3Hn.js";import{N as r}from"../freeze-updates-BbpDYqOS.js";import{n as i,o as a,t as o}from"../copy-content-DggKAmmU.js";export{e as DEFAULT_THEME,o as copyContent,i as formatElementInfo,t as generateSnippet,a as getStack,n as init,r as isInstrumentationActive};