PolyCurve/PolyLine Offset (general case) is one of the most challenging tasks. Just try the GH Offset Curve thingy on some “unsuitable” Curves. Or get a random Curve and try to offset it 100 times inwards/outwards.
Here’s a good classic abstract publication on that matter:
anoffsetalgorithm.pdf (723.4 KB)
I could provide some indicative hints (The full working solution is strictly internal) but using C# and there’s no way to auto translate the code into P.