import*as SDK from"../sdk/sdk.js";export function sdkNodeToAXNode(e,d,o){let i=[];const n={id:d.id(),role:d.role()?.value,name:d.name()?.value,ignored:d.ignored(),parent:e,axTree:o,hasChildren:()=>Boolean(d.numChildren()),children:async()=>{if(d.numChildren()!==i.length){const e=await d.accessibilityModel().requestAXChildren(d.id());if(i=(e||[]).map((e=>sdkNodeToAXNode(n,e,o))),i.length!==d.numChildren())throw new Error("Unexpected: actual and expected number of child nodes is different")}return i},highlightNode:()=>d.highlightDOMNode(),clearHighlight:()=>SDK.OverlayModel.OverlayModel.hideDOMNodeHighlight()};for(const r of d.children())i.push(sdkNodeToAXNode(n,r,o));return n}