FWIW, ChatGPT wasn't even close with a solution for ... but it took a completely different path than I was taking, and I think it may have led me to an easier way to implement this than I would have otherwise found.