Unique magic triplets Description

Your input is a list of integers \$[a_1, \dots, a_n]\$.

A magic triplet is a triplet \$(a_i, a_j, a_k)\$ of values from this list, such that


the indices \$\{i, j, k\}\$ are all distinct,
the values are in ascending order (\$a_i \leq a_j \leq a_k\$), and
the sum of two of the values equals the third.


Your task is to output all unique magic triplets, in any order.

Rules


Each number in the input list is guaranteed to be in the range \$-2^{32} \leq a &lt; 2^{32}\$.
The input list's length is guaranteed to be at most 1000.
The input list's length may be less than 3 (even 0). In this case, there are no magic triplets, and your program should produce an empty result.
The shortest answer in bytes wins.


Test cases

[1,2,3,2,4] -&gt; [[1,2,3], [1,3,4], [2,2,4]]
[0,0,0,0] -&gt; [[0,0,0]]
[1,0,-1] -&gt; [[-1,0,1]]
[1,2] -&gt; []
[1,2,4,8,99] -&gt; []
[33,90,7,24,60,32,80,43,15,40,36,90,65,12,91,33,88,1,96,33,40] -&gt; [[7,33,40], [32,33,65], [1,32,33], [1,90,91], [7,36,43], [24,36,60], [12,24,36], [36,60,96], [15,65,80], [40,40,80]]


Notes


In the second test case, [[0,0,0], [0,0,0]] is not a valid answer. No triplet may be listed twice in the output.
Remember that your program may order the triplets differently. For example, [[2,2,4], [1,2,3], [1,3,4]] is also a valid output for the first test case.
Nonetheless, [[4,2,2], …] is invalid: each triplet itself must be in ascending order.
Ruby, 46 51 58 bytes



-&gt;l{l.permutation(3).select{|a,b,c|a+b==c}.map(&amp;:sort)|[]}


Try it online!

Ok, not so straightforward, but now seems to work.