import pathlib,subprocess as sp,sys
root=pathlib.Path(__file__).parent
for run in sys.argv[1:]:
 d=root/run;p=d/'public';p.mkdir(exist_ok=True)
 # Mask only the local environment name in onboarding, preserving the app's visible state.
 for label in ['locked-40s','dismissed','interaction','second-locked','prompt-unlocked']:
  if label == 'prompt-unlocked' or (run.startswith('head') and label in ['dismissed','interaction']):
   sp.run(['convert',str(d/(label+'.png')),'-fill','#fcfcfc','-draw','rectangle 596,307 1100,332',str(p/(label+'.png'))],check=True)
  else:
   import shutil
   shutil.copyfile(d/(label+'.png'),p/(label+'.png'))
 sp.run(['ffmpeg','-y','-loglevel','error','-i',str(d/'locked-launch.mp4'),'-vf','delogo=x=596:y=307:w=504:h=25','-c:v','libx264','-preset','fast','-crf','23','-pix_fmt','yuv420p',str(p/'locked-launch.mp4')],check=True)
