grab 0.1.47-dev.e56fcc1 → 0.1.48-dev.303169b

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 (38) hide show
  1. package/dist/{copy-content-5FzVj_Qo.d.cts → copy-content-BPJ08fM-.d.cts} +36 -9
  2. package/dist/copy-content-BTtSCJ8G.js +10 -0
  3. package/dist/copy-content-BVS7GWGg.cjs +10 -0
  4. package/dist/{copy-content-BJATOqZF.d.ts → copy-content-tDo_MSv9.d.ts} +36 -9
  5. package/dist/core/index.cjs +1 -1
  6. package/dist/core/index.d.cts +2 -2
  7. package/dist/core/index.d.ts +2 -2
  8. package/dist/core/index.js +1 -1
  9. package/dist/core-ClWQzJeD.js +14 -0
  10. package/dist/core-DiKuJH95.cjs +14 -0
  11. package/dist/create-pointer-move-prompt-handoff-B5pjxeTR.js +9 -0
  12. package/dist/{action-shortcuts-Zws2aUUQ.cjs → create-pointer-move-prompt-handoff-B99Eq2Uo.cjs} +1 -1
  13. package/dist/freeze-updates-CmRqKCkV.js +51 -0
  14. package/dist/freeze-updates-_AW7J5Yx.cjs +51 -0
  15. package/dist/{index-jMjUhmbS.d.cts → index-CjtwpNJq.d.cts} +1 -1
  16. package/dist/{index-C_bngsx-.d.ts → index-Cx-YnOMQ.d.ts} +1 -1
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.d.cts +3 -3
  19. package/dist/index.d.ts +3 -3
  20. package/dist/index.global.js +18 -18
  21. package/dist/index.js +1 -1
  22. package/dist/primitives.cjs +2 -2
  23. package/dist/primitives.d.cts +1 -1
  24. package/dist/primitives.d.ts +1 -1
  25. package/dist/primitives.js +2 -2
  26. package/dist/renderer-BI2Oil1U.cjs +9 -0
  27. package/dist/renderer-BOPyTZnj.js +9 -0
  28. package/dist/styles.css +1 -1
  29. package/package.json +2 -2
  30. package/dist/action-shortcuts-BqUYwepS.js +0 -9
  31. package/dist/copy-content-BdNGJB1g.js +0 -10
  32. package/dist/copy-content-CE1c2qMK.cjs +0 -10
  33. package/dist/core-BMr2NQZo.cjs +0 -14
  34. package/dist/core-GnLSAWJ2.js +0 -14
  35. package/dist/freeze-updates-B9uIB2_2.js +0 -51
  36. package/dist/freeze-updates-BgilkYa3.cjs +0 -51
  37. package/dist/renderer-Bjgsgc2_.cjs +0 -9
  38. package/dist/renderer-bvmApDqj.js +0 -9
@@ -249,14 +249,15 @@ interface ContextMenuAction {
249
249
  enabled?: boolean | ((context: ActionContext) => boolean);
250
250
  onAction: (context: ContextMenuActionContext) => void | Promise<void>;
251
251
  }
252
- interface ArrowNavigationItem {
252
+ interface HierarchyItem {
253
253
  tagName: string;
254
254
  componentName?: string;
255
+ depth: number;
256
+ isLast: boolean;
255
257
  }
256
- interface ArrowNavigationState {
257
- items: ArrowNavigationItem[];
258
+ interface HierarchyState {
259
+ items: HierarchyItem[];
258
260
  activeIndex: number;
259
- isVisible: boolean;
260
261
  }
261
262
  interface PluginHooks {
262
263
  onActivate?: () => void;
@@ -300,6 +301,12 @@ interface Plugin {
300
301
  }
301
302
  interface Options {
302
303
  enabled?: boolean;
304
+ /**
305
+ * Confine React Grab to a single container element instead of the whole page.
306
+ * Hit-testing, the toolbar viewport, and scroll re-anchoring are scoped to it.
307
+ * Used by the demo build to scope the showcase to its card.
308
+ */
309
+ container?: HTMLElement;
303
310
  activationMode?: ActivationMode;
304
311
  keyHoldDuration?: number;
305
312
  allowActivationInsideInput?: boolean;
@@ -331,12 +338,31 @@ interface Options {
331
338
  interface SettableOptions extends Options {
332
339
  enabled?: never;
333
340
  telemetry?: never;
341
+ container?: never;
334
342
  }
335
343
  interface SourceInfo {
336
344
  filePath: string;
337
345
  lineNumber: number | null;
338
346
  componentName: string | null;
339
347
  }
348
+ interface SelectedElementPayload {
349
+ tagName: string;
350
+ id?: string;
351
+ className?: string;
352
+ textContent?: string;
353
+ componentName?: string;
354
+ filePath?: string;
355
+ lineNumber?: number;
356
+ columnNumber?: number;
357
+ }
358
+ interface ElementSelectedEventDetail {
359
+ elements: SelectedElementPayload[];
360
+ }
361
+ declare global {
362
+ interface WindowEventMap {
363
+ "react-grab:element-selected": CustomEvent<ElementSelectedEventDetail>;
364
+ }
365
+ }
340
366
  interface ToolbarState {
341
367
  edge: "top" | "bottom" | "left" | "right";
342
368
  ratio: number;
@@ -360,6 +386,7 @@ interface ReactGrabAPI {
360
386
  getToolbarState: () => ToolbarState | null;
361
387
  setToolbarState: (state: Partial<ToolbarState>) => void;
362
388
  onToolbarStateChange: (callback: (state: ToolbarState) => void) => () => void;
389
+ reset: () => void;
363
390
  dispose: () => void;
364
391
  copyElement: (elements: Element | Element[]) => Promise<boolean>;
365
392
  getSource: (element: Element) => Promise<SourceInfo | null>;
@@ -419,8 +446,8 @@ interface ReactGrabRendererProps {
419
446
  selectionComponentName?: string;
420
447
  selectionLabelVisible?: boolean;
421
448
  selectionLabelStatus?: SelectionLabelStatus;
422
- selectionArrowNavigationState?: ArrowNavigationState;
423
- onArrowNavigationSelect?: (index: number) => void;
449
+ hierarchyState?: HierarchyState;
450
+ hierarchyMenuPosition?: DropdownAnchor | null;
424
451
  labelInstances?: SelectionLabelInstance[];
425
452
  dragVisible?: boolean;
426
453
  dragBounds?: OverlayBounds;
@@ -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
+ import{A as e,C as t,D as n,Dt as r,E as i,Et as a,I as o,It as s,M as c,Mt as l,N as u,Nt as d,O as f,Pt as p,S as m,T as h,Tt as ee,b as g,j as te,k as ne,ut as re,w as ie,wt as _,x as v,y as ae}from"./freeze-updates-CmRqKCkV.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}:ie(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=re,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 l.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(),p),o=()=>i.abort();t?.aborted&&i.abort(),t?.addEventListener(`abort`,o);try{let t=await fetch(`${ae()}/__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 ne(e,e=>{if(!f(e))return!1;let r=h(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=d)=>{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=e=>e.getAttribute(`aria-hidden`)===`true`||e.hasAttribute(`hidden`)?!0:r.has(e.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(!_.has(t)||n&&e.children.length===0)return n;let r=[];return Xe(e,r,100),r.join(` `)},Qe=e=>W(e,15),$e=e=>{let t=[];for(let n of a){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}ee.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=>`<${o(e)} ...>`).join(`
10
+ `):`(${e.length} elements)`,rt=e=>{let t=o(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=o(e),n=tt(e),r=Ze(e,t),i=[],a=[],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?a.push(t):i.push(t)));let c=r.length>0&&_.has(t),l=``,u=nt(i);u&&!c&&(l+=`\n ${u}`),r&&(l+=`\n ${W(r,100)}`);let d=nt(a);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=t=>{if(!e())return t;let n=t;for(;n;){if(c(n))return n;n=n.parentElement}return t},ft=t=>{if(!e())return null;let n=c(K(t)),r=0;for(;n;){if(n.key)return n.key;if(u(n)&&(r+=1,r===2))break;n=n.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=c(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=t=>{if(!e())return Promise.resolve([]);let n=K(t),r=q.get(n);if(r)return r;let i=mt(n).then(e=>(e===null&&q.delete(n),e));return q.set(n,i),i},ht=async t=>{if(!e())return null;let n=await Y(t);if(!n)return null;for(let e of n){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||!u(e)?null:G(te(e.type)),vt=e=>U(async t=>{let n=c(K(e));if(!n)return null;try{let e=await m(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=(t,n,r=()=>!0)=>{if(!e())return[];let i=c(t);if(!i)return[];let a=[];return ne(i,e=>{if(a.length>=n)return!0;if(u(e)){let t=te(e.type);t&&ut(t)&&r(t)&&a.push(t)}return!1},!0),a},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:s,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};
@@ -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-_AW7J5Yx.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.ut,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.Mt.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.Pt),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.k(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.Nt)=>{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.Dt.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.wt.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.Et){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.Tt.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.I(t)} ...>`).join(`
10
+ `):`(${t.length} elements)`,Le=t=>{let n=e.I(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.I(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.wt.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.A())return t;let n=t;for(;n;){if(e.M(n))return n;n=n.parentElement}return t},Ue=t=>{if(!e.A())return null;let n=e.M(G(t)),r=0;for(;n;){if(n.key)return n.key;if(e.N(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.M(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.A())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.A())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.N(t)?null:W(e.j(t.type)),Je=t=>M(async n=>{let r=e.M(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.A())return[];let i=e.M(t);if(!i)return[];let a=[];return e.k(i,t=>{if(a.length>=n)return!0;if(e.N(t)){let n=e.j(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.It,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}});
@@ -249,14 +249,15 @@ interface ContextMenuAction {
249
249
  enabled?: boolean | ((context: ActionContext) => boolean);
250
250
  onAction: (context: ContextMenuActionContext) => void | Promise<void>;
251
251
  }
252
- interface ArrowNavigationItem {
252
+ interface HierarchyItem {
253
253
  tagName: string;
254
254
  componentName?: string;
255
+ depth: number;
256
+ isLast: boolean;
255
257
  }
256
- interface ArrowNavigationState {
257
- items: ArrowNavigationItem[];
258
+ interface HierarchyState {
259
+ items: HierarchyItem[];
258
260
  activeIndex: number;
259
- isVisible: boolean;
260
261
  }
261
262
  interface PluginHooks {
262
263
  onActivate?: () => void;
@@ -300,6 +301,12 @@ interface Plugin {
300
301
  }
301
302
  interface Options {
302
303
  enabled?: boolean;
304
+ /**
305
+ * Confine React Grab to a single container element instead of the whole page.
306
+ * Hit-testing, the toolbar viewport, and scroll re-anchoring are scoped to it.
307
+ * Used by the demo build to scope the showcase to its card.
308
+ */
309
+ container?: HTMLElement;
303
310
  activationMode?: ActivationMode;
304
311
  keyHoldDuration?: number;
305
312
  allowActivationInsideInput?: boolean;
@@ -331,12 +338,31 @@ interface Options {
331
338
  interface SettableOptions extends Options {
332
339
  enabled?: never;
333
340
  telemetry?: never;
341
+ container?: never;
334
342
  }
335
343
  interface SourceInfo {
336
344
  filePath: string;
337
345
  lineNumber: number | null;
338
346
  componentName: string | null;
339
347
  }
348
+ interface SelectedElementPayload {
349
+ tagName: string;
350
+ id?: string;
351
+ className?: string;
352
+ textContent?: string;
353
+ componentName?: string;
354
+ filePath?: string;
355
+ lineNumber?: number;
356
+ columnNumber?: number;
357
+ }
358
+ interface ElementSelectedEventDetail {
359
+ elements: SelectedElementPayload[];
360
+ }
361
+ declare global {
362
+ interface WindowEventMap {
363
+ "react-grab:element-selected": CustomEvent<ElementSelectedEventDetail>;
364
+ }
365
+ }
340
366
  interface ToolbarState {
341
367
  edge: "top" | "bottom" | "left" | "right";
342
368
  ratio: number;
@@ -360,6 +386,7 @@ interface ReactGrabAPI {
360
386
  getToolbarState: () => ToolbarState | null;
361
387
  setToolbarState: (state: Partial<ToolbarState>) => void;
362
388
  onToolbarStateChange: (callback: (state: ToolbarState) => void) => () => void;
389
+ reset: () => void;
363
390
  dispose: () => void;
364
391
  copyElement: (elements: Element | Element[]) => Promise<boolean>;
365
392
  getSource: (element: Element) => Promise<SourceInfo | null>;
@@ -419,8 +446,8 @@ interface ReactGrabRendererProps {
419
446
  selectionComponentName?: string;
420
447
  selectionLabelVisible?: boolean;
421
448
  selectionLabelStatus?: SelectionLabelStatus;
422
- selectionArrowNavigationState?: ArrowNavigationState;
423
- onArrowNavigationSelect?: (index: number) => void;
449
+ hierarchyState?: HierarchyState;
450
+ hierarchyMenuPosition?: DropdownAnchor | null;
424
451
  labelInstances?: SelectionLabelInstance[];
425
452
  dragVisible?: boolean;
426
453
  dragBounds?: OverlayBounds;
@@ -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 };
@@ -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-DiKuJH95.cjs`),t=require(`../freeze-updates-_AW7J5Yx.cjs`),n=require(`../copy-content-BVS7GWGg.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.A;
@@ -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-BPJ08fM-.cjs";
10
+ import { a as getStack, i as formatElementInfo, n as generateSnippet, r as DEFAULT_THEME, t as init } from "../index-CjtwpNJq.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-tDo_MSv9.js";
10
+ import { a as getStack, i as formatElementInfo, n as generateSnippet, r as DEFAULT_THEME, t as init } from "../index-Cx-YnOMQ.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-ClWQzJeD.js";import{A as r}from"../freeze-updates-CmRqKCkV.js";import{n as i,o as a,t as o}from"../copy-content-BTtSCJ8G.js";export{e as DEFAULT_THEME,o as copyContent,i as formatElementInfo,t as generateSnippet,a as getStack,n as init,r as isInstrumentationActive};