user: Recreate this for TypeScript.  import requests import json import random import time import re from requests.cookies import RequestsCookieJar import base64   def generate_email(prefix, suffix, random_letters_count, locale):     characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"     random_string = "".join(random.choice(characters) for _ in range(random_letters_count))     email = f"{prefix}{random_string}{suffix}@xitroo.{locale}"     print(f"Generated email: {email}")     return email  def get_latest_inbox_raw(email):     for attempt in range(10):         try:             print(f"Attempt {attempt + 1} to get latest inbox for {email}")             response = requests.get(                 f"https://api.xitroo.com/v1/mails?locale=de&mailAddress={email}&mailsPerPage=25&minTimestamp=0.0&maxTimestamp={int(time.time()) + 500}"             )             id_site = response.json()             try:                 mail_response = requests.get(                     f"https://api.xitroo.com/v1/mail?locale=de&id={id_site['mails'][0]['_id']}"                 )                 return mail_response.json()             except Exception:                 time.sleep(5)         except Exception:             time.sleep(5)     return None  def get_body_text(email):     latest_inbox = get_latest_inbox_raw(email)      return base64.b64decode(latest_inbox['bodyText']).decode('utf-8')  def create_reka_account():     """     Creates a new account on the Reka platform and logs in to retrieve session cookies.      Returns:         bool: True if the account creation and login were successful, False otherwise.     """     email = generate_email("", "", 10, "de")     jar = RequestsCookieJar()     session = requests.Session()     session.cookies = jar      sign_up = session.get("https://chat.reka.ai/bff/auth/signup")     state = re.search(r'<input type="hidden" name="state" value="([^"]+)"', sign_up.text).group(1)     print(f"Sign up state: {state}")      session.post(         f"https://auth.reka.ai/u/signup?state={state}",         data={             "state": state,             "strengthPolicy": "low",             "complexityOptions.minLength": "12",             "email": email,             "password": "shivituganteng!23",             "action": "default",         },         allow_redirects=True,     )      body_text = get_body_text(email)     url = re.search(r"https?://\S+|www\.\S+", body_text).group(0)     ticket = re.search(r"ticket=([^&]+)", url).group(1)     print(f"Verification URL: {url}")     print(f"Ticket: {ticket}")      fucking = session.get(url)     state_generated = re.search(r'<input type="hidden" name="state" value="([^"]+)"', fucking.text).group(1)     print(f"State generated: {state_generated}")      session.post(         f"https://auth.reka.ai/u/email-verification?ticket={ticket}",         data={"state": state_generated}     )      login = session.get("https://chat.reka.ai/bff/auth/login")     state_login = re.search(r'<input type="hidden" name="state" value="([^"]+)"', login.text).group(1)     print(f"Login state: {state_login}")      session.get(f"https://auth.reka.ai/u/login?state={state_login}")     session.post(         f"https://auth.reka.ai/u/login?state={state_login}",         data={             "state": state_login,             "username": email,             "password": "shivituganteng!23",             "action": "default",         }     )      cookies = session.cookies.get_dict()     if "appSession" in cookies:         with open("database/reka_auths.json", "r+") as file:             auths = json.load(file)             auths["cookie"] = {"appSession": cookies["appSession"]}             auths["lastUpdated"] = time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime())             file.seek(0)             json.dump(auths, file, indent=4)             file.truncate()         print("Account created and logged in successfully")         return True     else:         print("Failed to create account or log in")         return False