OSIL: Learning Offline Safe Imitation Policies with Safety Inferred from Non-preferred Trajectories