Prompt and non-prompt \(\hbox {J}/\psi \) production and nuclear modification at mid-rapidity in p–Pb collisions at \(\mathbf{\sqrt{{ s}_{\text {NN}}}= 5.02}\) TeV