[Flight mode evaluation diagram] Where is it implemented?

Hi everyone,

I am trying to better understand where in the code PX4 rejects/accepts flight modes.

I know about the flight mode evaluation diagram, but where is it implemented ?

More specifically, where in the code is it decided whether the drone is allowed to transition to position control mode ?

I tried digging through the PX4 repo but couldn’t find anything.

Wishing you all a great year!