How to pack these curves into rectangle

I tried to adapt one of your definitions earlier today but couldn’t do it.

Here’s your solution from above with an automated slider:

curves into rectangle.gh (41.5 KB)