A nested copy pasted out of its copy, where the main the copy refers to
had swapped that head, advanced its refs by level through the replaced
slot of the old component and passed on the swap, which left an invalid
file (`:ref-shape-not-found`, `:misplaced-swap-group`). Users reach it
by copying such a copy and pasting it on the page (F590).
When the references a pasted head skips include a swapped head, each of
its shapes now refers to its counterpart in the main of the component it
shows, the first of its content references there, and keeps the
overrides of those it skips, without the swap.
Found by the generated programs once they paste nested copies (a
variant program with a swap in a main).
Test (swap-group-test, fails before the fix):
`paste-out-of-a-copy-follows-a-swap-in-its-main`.
Benchmark (bench-components, alone):
| :world | :baseline | :now | :mean | :ratio |
|------------------------------------+-----------+---------+---------+--------|
| deepest-edit-through-three-levels | 35.215 | 21.672 | 24.681 | 0.62 |
| edit-through-a-chain-of-dependents | 68.931 | 43.664 | 46.149 | 0.63 |
| library-update-into-copies | 83.083 | 51.625 | 55.322 | 0.62 |
| main-edit-among-many-shapes | 4.837 | 2.582 | 3.817 | 0.53 |
| main-edit-into-10-copies | 1.79 | 1.063 | 1.179 | 0.59 |
| main-edit-into-100-copies | 15.415 | 10.715 | 11.354 | 0.7 |
| main-edit-into-1000-copies | 153.086 | 104.404 | 110.116 | 0.68 |
| variant-switch-into-copies | 32.052 | 21.823 | 24.319 | 0.68 |
AI-assisted-by: claude-opus-5-5