///|
let key_str_base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="

///|
pub fn compress_to_base64(input : String) -> String {
  let res = _compress(input, 6, a => single_code_unit(key_str_base64, a))
  match res.length() % 4 {
    0 => res
    1 => res + "==="
    2 => res + "=="
    _ => res + "="
  }
}

///|
pub fn decompress_from_base64(input : String) -> String? {
  if input == "" {
    None
  } else {
    let length = input.length()
    _decompress(length, 32, idx => {
      if idx < length {
        get_base_value(key_str_base64, single_code_unit(input, idx))
      } else {
        0
      }
    })
  }
}