/**
* uiautomator's view of an Android screen, turned into pi-gui elements.
*
* Android is the target where a structural read is BOTH cheaper and more precise than
* pixels: the dump names every element and gives exact bounds, where a screenshot of a
* phone costs far more tokens and still leaves a model estimating where to tap.
*
* A regex rather than an XML parser, deliberately (ported from mirasim's simulator):
* the dump is a flat sequence of self-describing `` elements with no
* namespaces and no entities beyond the standard five.
*/
import type { Element } from "../types.ts";
/** One element of the dump, with bounds in device pixels. */
export interface AndroidUiNode {
cls: string;
text?: string;
desc?: string;
id?: string;
pkg?: string;
bounds?: {
x: number;
y: number;
w: number;
h: number;
};
clickable?: boolean;
focused?: boolean;
checked?: boolean;
}
/**
* An Android class name to the role vocabulary the browser driver already taught the
* model (textbox/checkbox/button/...): `android.widget.ImageButton` and a `