Metadata-Version: 2.5
Name: human-mouse-sdk
Version: 1.0.0
Summary: AI-driven human mouse behavior SDK: trajectories, click timing, drag and scroll wheel simulation
Author-email: wangchuang <327600068@qq.com>
License-Expression: LicenseRef-Proprietary
License-File: LICENSE
Keywords: automation,click-timing,human-like,human-mouse,mouse-simulation,pytorch,scroll-wheel,trajectory
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.9
Requires-Dist: numpy>=1.24
Requires-Dist: scipy>=1.10
Requires-Dist: torch>=2.0
Provides-Extra: live
Requires-Dist: pynput>=1.7; extra == 'live'
Description-Content-Type: text/markdown

# human-mouse-sdk

AI-driven **human mouse behavior SDK**. It turns a model trained on the
[Balabit Mouse Dynamics Challenge](https://github.com/balabit/Mouse-Dynamics-Challenge)
dataset into a small Python API that produces:

- Human-like **point-to-point trajectories** (Fitts-law velocity profile,
  overshoot, jitter, 125 Hz hardware polling timestamps)
- **Drag** trajectories and **click timing** (pre-click settle, hold duration,
  post-click pause, double-click gap, micro-slip)
- **Scroll wheel gestures** (a single finger flick with a U-shaped notch cadence,
  or multi-burst sequences with finger-reset pauses)
- **Idle pauses** (scanning / normal / reading & thinking styles)
- Optional **live desktop control** through `pynput`

The SDK ships **no model weights**. You pass the checkpoint path when creating
the generator (or set an environment variable), so the same package can load
whatever model build you deploy.

- Distribution: `human-mouse-sdk`
- Import name: `human_mouse_sdk`
- Python: 3.9+ · PyTorch 2.x · NumPy · SciPy
- Version: 1.0.0

---

## Contents

1. [Installation](#installation)
2. [Model checkpoints](#model-checkpoints)
3. [Quick start](#quick-start)
4. [`HumanMouseGenerator`](#humanmousegenerator)
   - [`generate_trajectory`](#generate_trajectory)
   - [`generate_click_plan`](#generate_click_plan)
   - [Scroll wheel APIs](#scroll-wheel-apis)
   - [`sample_idle_pause`](#sample_idle_pause)
   - [`load_scroll_checkpoint`](#load_scroll_checkpoint)
5. [`HumanMouseController`](#humanmousecontroller)
6. [Recipes](#recipes)
7. [Errors and troubleshooting](#errors-and-troubleshooting)
8. [License](#license)

---

## Installation

```bash
pip install human-mouse-sdk

# with real desktop control (adds pynput)
pip install "human-mouse-sdk[live]"
```

For GPU inference install the CUDA build of PyTorch first, then the SDK:

```bash
pip install torch --index-url https://download.pytorch.org/whl/cu124
pip install human-mouse-sdk
```

From a local checkout:

```bash
cd sdk
pip install -e .            # editable install
# or build artifacts
uv build                    # dist/human_mouse_sdk-<version>-*.whl
```

---

## Model checkpoints

### Main checkpoint

You need a `human_mouse_model.pt` file (produced by the repository's `train.py`
and updated by `train_scroll.py`, or provided by your team). Pass its path
explicitly:

```python
from human_mouse_sdk import HumanMouseGenerator

gen = HumanMouseGenerator(checkpoint_path="/models/human_mouse_model.pt")
```

or use an environment variable:

```bash
export HUMAN_MOUSE_CHECKPOINT=/models/human_mouse_model.pt
```

```python
gen = HumanMouseGenerator()          # reads HUMAN_MOUSE_CHECKPOINT
```

If neither is provided, construction raises `ValueError`. If the path does not
exist, it raises `FileNotFoundError`.

### Scroll-wheel checkpoint

The scroll model (`ScrollBurstMDN`) is stored under the `scroll_model_state`
key. It is resolved in this order:

1. `scroll_checkpoint_path=` argument
2. `HUMAN_MOUSE_SCROLL_CHECKPOINT` environment variable
3. `scroll_model_state` embedded in the main checkpoint
4. `scroll_model.pt` sitting next to the main checkpoint

```python
# explicit standalone scroll_model.pt (overrides an embedded state)
gen = HumanMouseGenerator(
    checkpoint_path="/models/human_mouse_model.pt",
    scroll_checkpoint_path="/models/scroll_model.pt",
)

# or via environment variable
# export HUMAN_MOUSE_SCROLL_CHECKPOINT=/models/scroll_model.pt

# or load / replace it later at runtime
gen.load_scroll_checkpoint("/models/scroll_model.pt")

print(gen.has_scroll_model)          # True when the MDN is loaded
print(gen.scroll_checkpoint_path)    # file it was loaded from
```

If no scroll checkpoint is found, the generator still works, but scroll calls
fall back to empirical notch-interval quantiles (`has_scroll_model == False`).

### Device selection

```python
gen = HumanMouseGenerator(checkpoint_path=CKPT, device="auto")   # default
gen = HumanMouseGenerator(checkpoint_path=CKPT, device="cpu")
gen = HumanMouseGenerator(checkpoint_path=CKPT, device="cuda")
gen = HumanMouseGenerator(checkpoint_path=CKPT, device="cuda:1")
```

`"auto"` picks CUDA when `torch.cuda.is_available()` else CPU. On CPU the SDK
caps PyTorch at 4 threads to keep latency predictable.

---

## Quick start

```python
from human_mouse_sdk import HumanMouseGenerator

gen = HumanMouseGenerator(checkpoint_path="human_mouse_model.pt")

# 1) trajectory
plan = gen.generate_trajectory(x0=120, y0=140, x1=900, y1=520)
print(plan.distance, plan.duration, plan.human_score_pct)
for x, y, t_cum, dt in plan.steps:
    print(x, y, round(t_cum * 1000, 1), round(dt * 1000, 1))

# 2) click timing
click = gen.generate_click_plan(action_type="left_click")
print(click.pre_click_delay, click.hold_duration, click.post_click_delay)

# 3) one scroll wheel flick
flick = gen.generate_scroll_gesture(direction="down", max_clicks=9)
print(flick.total_clicks, flick.duration, flick.burst_lengths)

# 4) longer multi-burst scroll
seq = gen.generate_scroll_detail(clicks=18, direction="up")
print(seq.burst_lengths, seq.inter_burst_pauses)

# 5) idle pause
print(gen.sample_idle_pause(style="reading"))
```

Every call samples fresh randomness. All time values are **seconds**, all
coordinates are **screen pixels**.

---

## `HumanMouseGenerator`

### Constructor

```python
HumanMouseGenerator(
    checkpoint_path: str | None = None,
    device: str = "auto",
    scroll_checkpoint_path: str | None = None,
)
```

| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| `checkpoint_path` | `str \| None` | `None` | Main model checkpoint. Falls back to `HUMAN_MOUSE_CHECKPOINT`; required. |
| `device` | `str` | `"auto"` | `"auto"`, `"cpu"`, `"cuda"`, `"cuda:N"`. |
| `scroll_checkpoint_path` | `str \| None` | `None` | Optional standalone scroll model. Falls back to `HUMAN_MOUSE_SCROLL_CHECKPOINT`, then embedded state, then a sibling `scroll_model.pt`. |

Useful attributes:

| Attribute | Description |
| --- | --- |
| `device` | Resolved `torch.device`. |
| `has_scroll_model` | `True` when `ScrollBurstMDN` weights were loaded. |
| `scroll_checkpoint_path` | Where the scroll weights came from (`None` before loading). |
| `seq_len` | Canonical trajectory length (usually 64). |
| `last_distance` / `last_duration` | Last generated trajectory's distance (px) and duration (s); used to condition click timing when `prev_*` is omitted. |
| `priors` | Empirical quantile tables loaded from the checkpoint. |

### `generate_trajectory`

```python
plan = gen.generate_trajectory(
    x0=100, y0=100,        # start (px)
    x1=900, y1=600,        # end (px)
    is_drag=False,         # sample a drag (button held) trajectory
    speed=1.0,             # >1 faster, <1 slower
    temperature=0.85,      # sampling randomness
    polling_hz=125,        # output sampling rate
)
```

| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| `x0`, `y0` | `int` | — | Start position in screen pixels. |
| `x1`, `y1` | `int` | — | Target position in screen pixels. |
| `is_drag` | `bool` | `False` | Use the drag-conditioned trajectory distribution. |
| `speed` | `float` | `1.0` | Duration multiplier: `speed=2.0` ≈ half duration, `0.5` ≈ double. |
| `temperature` | `float` | `0.85` | Latent/timing sampling spread. Lower = more conservative, higher = more varied. |
| `polling_hz` | `int` | `125` | Resampling rate of the integer step trace. |

Returns a `TrajectoryPlan`:

| Field | Type | Description |
| --- | --- | --- |
| `start`, `end` | `(int, int)` | Requested endpoints. |
| `distance` | `float` | Euclidean distance in px. |
| `duration` | `float` | Movement duration in seconds. |
| `is_drag` | `bool` | Whether it was sampled as a drag. |
| `human_score_pct` | `float` | Discriminator "humanness" score, 0–100. |
| `steps` | `list[(x, y, t_cum, dt)]` | Integer pixel trace at `polling_hz`; duplicate pixels are collapsed; the final point is always present. `t_cum` is absolute seconds from movement start, `dt` the interval since the previous step. |
| `xy_float` | `np.ndarray (N, 2)` | Full float trajectory before pixel rounding. |
| `t_float` | `np.ndarray (N,)` | Timestamps for `xy_float` (seconds). |
| `uv_canonical` | `np.ndarray (seq_len, 2)` | Canonical normalized curve in the model's rotated frame. |

Notes:

- Moves shorter than 2 px return a trivial 15 ms plan without model inference.
- `steps` is what you normally replay; `xy_float` / `t_float` are useful for
  plotting or sub-pixel interpolation.
- `speed` also changes the conditioning used for click timing
  (`last_duration`).

Replay a plan in real time:

```python
import time

plan = gen.generate_trajectory(200, 200, 1200, 700)
start = time.perf_counter()

for x, y, t_cum, _dt in plan.steps:
    wait = t_cum - (time.perf_counter() - start)
    if wait > 0:
        time.sleep(wait)
    backend.move_pointer(x, y)      # your mouse backend
```

### `generate_click_plan`

```python
click = gen.generate_click_plan(
    action_type="left_click",
    prev_distance=plan.distance,     # optional context
    prev_duration=plan.duration,     # optional context
    temperature=0.85,
)
```

| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| `action_type` | `str` | `"left_click"` | One of `"left"`, `"left_click"`, `"right"`, `"right_click"`, `"double"`, `"double_click"`, `"drag"`. Unknown values behave like a left click. |
| `prev_distance` | `float \| None` | `None` | Distance of the preceding movement (px); defaults to `last_distance`. |
| `prev_duration` | `float \| None` | `None` | Duration of the preceding movement (s); defaults to `last_duration`. |
| `temperature` | `float` | `0.85` | Sampling randomness. |

Returns a `ClickPlan`:

| Field | Type | Description |
| --- | --- | --- |
| `action_type` | `str` | The requested action. |
| `pre_click_delay` | `float` | Settle time after arriving, before pressing (s). |
| `hold_duration` | `float` | Button hold duration (s). |
| `post_click_delay` | `float` | Pause after release (s). |
| `double_click_gap` | `float` | Gap between the two clicks (s); `0.0` unless `double_click`. |
| `second_hold_duration` | `float` | Hold time of the second click (s); `0.0` unless `double_click`. |
| `slip_dx`, `slip_dy` | `int` | Optional 1 px micro-slip during the click; usually `(0, 0)` (~25% chance when sampled). |

Example:

```python
def do_click(x, y, double=False):
    move = gen.generate_trajectory(*current_pos(), x, y)
    replay(move)
    c = gen.generate_click_plan("double_click" if double else "left_click")
    time.sleep(c.pre_click_delay)
    press_and_release(c.hold_duration)
    if double:
        time.sleep(c.double_click_gap)
        press_and_release(c.second_hold_duration)
    time.sleep(c.post_click_delay)
```

### Scroll wheel APIs

All scroll methods accept `direction="down"` or `"up"` (case-insensitive; any
other value is treated as `"up"`), `speed` (duration multiplier) and
`temperature` (sampling spread).

#### `generate_scroll_gesture` — one finger flick

```python
flick = gen.generate_scroll_gesture(
    direction="down",
    max_clicks=9,        # sampled burst length is 3..max_clicks
    speed=1.0,
    temperature=0.85,
)
print(flick.total_clicks)     # e.g. 6
print(flick.burst_lengths)    # [6]
```

- A single burst of notches, no inter-burst reset pause.
- Burst length is sampled by `ScrollBurstMDN` and clamped to
  `[min(3, max_clicks), max_clicks]` (so `max_clicks=9` → 3–9).
- Use this for "one wheel event = one human flick" demos or per-event injection.

#### `generate_scroll_detail` — multi-burst sequence

```python
seq = gen.generate_scroll_detail(
    clicks=18,           # total notches
    direction="up",
    speed=1.0,
    temperature=0.85,
)
print(seq.burst_lengths)        # e.g. [12, 2, 4]
print(seq.inter_burst_pauses)   # e.g. [0.24, 0.67] seconds
```

- Splits `clicks` into several finger flicks with inter-burst reset pauses.
- `len(inter_burst_pauses) == len(burst_lengths) - 1`.
- Use this to scroll a long page in a human rhythm.

#### `generate_scroll_plan` — raw steps

```python
steps = gen.generate_scroll_plan(clicks=6, direction="down")
# [(dy, delay_after_notch_sec), ...]  e.g. [(-1, 0.021), (-1, 0.034), ...]
for dy, delay in steps:
    backend.scroll(dy)           # map dy to your wheel unit
    time.sleep(delay)
```

Returns the same `(dy, delay)` list used by `HumanMouseController.scroll()`.
`dy` is `-1` for down and `+1` for up (one notch per step).

#### `ScrollPlan` fields

| Field | Type | Description |
| --- | --- | --- |
| `direction` | `str` | `"down"` or `"up"`. |
| `total_clicks` | `int` | Number of wheel notches. |
| `duration` | `float` | Total gesture duration (s). |
| `burst_lengths` | `list[int]` | Notches per finger flick. |
| `inter_burst_pauses` | `list[float]` | Reset pause after each burst except the last (s). |
| `steps` | `list[(dy, delay)]` | `dy` is ±1; `delay` is the wait after that notch. For the last notch of a burst, `delay` is the reset pause. |
| `t_events` | `np.ndarray (N,)` | Timestamp of each notch (s). |
| `dt_steps` | `np.ndarray (N,)` | Delay after each notch (s), including reset pauses. |
| `y_notches` | `np.ndarray (N,)` | Cumulative notches with sign (`-1..-N` for down, `+1..+N` for up). |
| `burst_ids` | `np.ndarray (N,)` | Burst index of each notch. |
| `is_burst_end` | `np.ndarray (N,)` | `True` on the last notch before a reset pause. |

Cadence semantics: within a flick, intervals follow a U-shaped
accelerate–decelerate profile (longer at the edges, shorter mid-burst); between
flicks the finger repositions for a few hundred milliseconds.

#### Fallback without a scroll model

When `has_scroll_model == False`, the same APIs work using empirical quantile
tables from the main checkpoint (or from the standalone scroll checkpoint's
`scroll_interval_quantiles`). Load the MDN checkpoint for the trained cadence.

### `sample_idle_pause`

```python
pause = gen.sample_idle_pause("normal")   # seconds
```

| Style | Intended behavior | Approximate quantile range used |
| --- | --- | --- |
| `"quick"` | Fast visual scanning | 10–40% |
| `"normal"` | Typical interaction rhythm | 20–75% |
| `"thinking"` / `"reading"` | Longer cognitive pause | 65–95% |

Unknown styles fall back to `"normal"`. Values are sampled from the empirical
pause distribution and clipped to sane minimums by the underlying sampler.

### `load_scroll_checkpoint`

```python
gen.load_scroll_checkpoint("/models/scroll_model.pt")   # -> True
```

- Accepts a standalone `scroll_model.pt` or any checkpoint containing
  `scroll_model_state`.
- Updates `has_scroll_model` and `scroll_checkpoint_path`.
- Merges `scroll_interval_quantiles` into `priors` when present.
- Raises `FileNotFoundError` if the file is missing and `ValueError` if the
  file has no `scroll_model_state`.

---

## `HumanMouseController`

Optional high-level driver that executes generated plans on the real desktop
cursor (Windows/macOS/X11 via `pynput`). It is a thin wrapper around
`HumanMouseGenerator`.

### Constructor

```python
HumanMouseController(
    checkpoint_path=None,
    device="cpu",
    dry_run=False,
    polling_hz=125,
    scroll_checkpoint_path=None,
)
```

| Parameter | Default | Description |
| --- | --- | --- |
| `checkpoint_path` | `None` | Main checkpoint (or `HUMAN_MOUSE_CHECKPOINT`). |
| `device` | `"cpu"` | Inference device (controller defaults to CPU for timing stability). |
| `dry_run` | `False` | If `True`, no OS calls and no real waits; the virtual cursor is updated only. |
| `polling_hz` | `125` | Pointer update rate used by generated trajectories. |
| `scroll_checkpoint_path` | `None` | Optional standalone scroll model. |

If `pynput` is missing or no display is available, construction prints a warning
and switches to `dry_run=True` instead of failing.

### Methods

| Method | Returns | Description |
| --- | --- | --- |
| `position` (property) | `(int, int)` | Current pointer position (virtual position in dry-run). |
| `move_to(x, y, speed=1.0, temperature=0.85)` | `TrajectoryPlan` | Generates and replays a trajectory from the current position. |
| `click(x=None, y=None, button="left", speed=1.0, temperature=0.85)` | `(TrajectoryPlan \| None, ClickPlan)` | Optionally moves first, then settle → press → hold → release → pause. `button` is `"left"` or `"right"`. |
| `right_click(x=None, y=None, speed=1.0)` | `(TrajectoryPlan \| None, ClickPlan)` | Shorthand for `click(..., button="right")`. |
| `double_click(x=None, y=None, speed=1.0, temperature=0.85)` | `(TrajectoryPlan \| None, ClickPlan)` | Two clicks with learned hold times and inter-click gap. |
| `drag_to(target_x, target_y, start_x=None, start_y=None, button="left", speed=0.9, temperature=0.85)` | `(TrajectoryPlan, ClickPlan)` | Optionally moves to the start, presses, replays a drag trajectory, releases. |
| `scroll(clicks=5, direction="down")` | `list[(dy, delay)]` | Replays a multi-burst wheel sequence. |
| `idle_pause(style="normal")` | `float` | Samples and sleeps a human pause; returns its duration. |

Example:

```python
from human_mouse_sdk import HumanMouseController

bot = HumanMouseController(
    checkpoint_path="/models/human_mouse_model.pt",
    scroll_checkpoint_path="/models/scroll_model.pt",
    dry_run=False,
    polling_hz=125,
)

print(bot.position)

bot.move_to(800, 500)
bot.click()                       # click where we are
bot.double_click(450, 320)        # move + double click
bot.right_click(900, 300)
bot.drag_to(1100, 700, start_x=400, start_y=300)
bot.scroll(clicks=6, direction="down")
bot.idle_pause(style="thinking")
```

`dry_run` example (safe in CI/headless):

```python
bot = HumanMouseController(checkpoint_path="human_mouse_model.pt", dry_run=True)
plan = bot.move_to(300, 300)      # instant, no OS calls
print(plan.distance, bot.position)
```

> Use live control only on machines and applications you are authorised to
> automate. The SDK does not bypass anti-bot systems or OS security policies.

---

## Recipes

### 1. Replay with your own mouse backend

```python
import time

def replay(plan, move, click=None, sleep=time.sleep):
    t0 = time.perf_counter()
    for x, y, t_cum, _dt in plan.steps:
        wait = t_cum - (time.perf_counter() - t0)
        if wait > 0:
            sleep(wait)
        move(x, y)

def human_click(gen, move, press, release, x, y):
    plan = gen.generate_trajectory(*current_position(), x, y)
    replay(plan, move)
    c = gen.generate_click_plan("left_click")
    time.sleep(c.pre_click_delay)
    press()
    time.sleep(c.hold_duration)
    release()
    time.sleep(c.post_click_delay)
```

### 2. PyAutoGUI integration

```python
import time
import pyautogui
from human_mouse_sdk import HumanMouseGenerator

pyautogui.FAILSAFE = True
gen = HumanMouseGenerator(checkpoint_path="human_mouse_model.pt")

plan = gen.generate_trajectory(*pyautogui.position(), 900, 500)
t0 = time.perf_counter()
for x, y, t_cum, _dt in plan.steps:
    wait = t_cum - (time.perf_counter() - t0)
    if wait > 0:
        time.sleep(wait)
    pyautogui.moveTo(x, y, duration=0)

click = gen.generate_click_plan("left_click")
time.sleep(click.pre_click_delay)
pyautogui.mouseDown()
time.sleep(click.hold_duration)
pyautogui.mouseUp()
time.sleep(click.post_click_delay)
```

For scrolling, convert `dy` (±1) to your backend's wheel unit. PyAutoGUI uses
positive values for up, so `dy = -1` (down) maps directly:

```python
for dy, delay in gen.generate_scroll_gesture("down").steps:
    pyautogui.scroll(120 * dy)     # dy = -1 -> scroll down
    time.sleep(delay)
```

### 3. Multiple independent samples

```python
plans = [gen.generate_trajectory(100, 100, 800, 600) for _ in range(5)]
print([p.duration for p in plans])
print([p.human_score_pct for p in plans])
```

### 4. Reproducibility

Sampling uses both NumPy and PyTorch RNGs:

```python
import numpy as np
import torch

np.random.seed(42)
torch.manual_seed(42)

plan = gen.generate_trajectory(100, 100, 800, 600, temperature=0.0)
```

`temperature=0.0` gives the most deterministic trajectory, but small
floating-point / CUDA non-determinism can still cause tiny differences.

### 5. Choosing a device

```python
gen_cpu = HumanMouseGenerator(checkpoint_path=CKPT, device="cpu")
gen_gpu = HumanMouseGenerator(checkpoint_path=CKPT, device="cuda")
```

CPU is often preferable for interactive use: small batches on GPU may add
transfer latency without throughput benefit.

---

## Errors and troubleshooting

| Symptom | Cause | Fix |
| --- | --- | --- |
| `ValueError: A model checkpoint is required...` | No `checkpoint_path` and no `HUMAN_MOUSE_CHECKPOINT`. | Pass the path or export the env var. |
| `FileNotFoundError: Model checkpoint not found at ...` | Wrong path / relative path resolved elsewhere. | Use an absolute path or `~` (`expanduser` is applied). |
| `has_scroll_model` is `False` | No scroll state found. | Pass `scroll_checkpoint_path=` or set `HUMAN_MOUSE_SCROLL_CHECKPOINT`; scroll APIs still work with quantile fallback. |
| `ValueError: ... does not contain a 'scroll_model_state' entry` | Wrong file passed to `load_scroll_checkpoint`. | Use a `scroll_model.pt` from `train_scroll.py` or a main checkpoint that embeds the state. |
| `[Controller] Display/pynput unavailable (...)` | Headless session, missing `pynput`, or no display. | Use `dry_run=True`, or install `human-mouse-sdk[live]` and run in a graphical session. |
| macOS clicks/moves do nothing | Accessibility permission not granted. | Grant permission to the terminal/IDE in System Settings → Privacy & Security → Accessibility. |
| Very slow first call | PyTorch model warm-up / CUDA init. | Warm up with one throwaway generation. |
| Torch import errors | CPU/CUDA wheel mismatch. | Reinstall the matching PyTorch build. |

Additional notes:

- The generator is single-threaded and not designed for concurrent calls on the
  same instance; create one generator per worker.
- Trajectories are generated in absolute screen pixels; make sure coordinates
  fit your display, or scale them.
- The SDK never moves the mouse unless you use `HumanMouseController` (or your
  own backend with the returned plans).

---

## License

Proprietary — **All rights reserved**. See [LICENSE](LICENSE). No copying,
redistribution, or derivative use without prior written permission.
