#!/usr/bin/env python3
"""Add reliable browser clipboard handling to ttyd's pinned client page."""
from __future__ import annotations
import argparse
import socket
import subprocess
import time
import urllib.request
from pathlib import Path
MARKER = "atlas-ttyd-clipboard"
UPSTREAM_COPY = 'document.execCommand("copy")'
CLIPBOARD_ADAPTER = r"""
"""
def patch_html(content: str) -> str:
"""Insert the adapter once and disable ttyd's false-success copy call."""
if content.count(UPSTREAM_COPY) != 1 or content.count("