///|
let key_str_uri_safe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$"

///|
pub fn compress_to_encoded_uri_component(input : String) -> String {
  _compress(input, 6, a => single_code_unit(key_str_uri_safe, a))
}

///|
pub fn decompress_from_encoded_uri_component(input : String) -> String? {
  if input == "" {
    None
  } else {
    let normalized = input.replace_all(old=" ", new="+")
    let length = normalized.length()
    _decompress(length, 32, idx => {
      if idx < length {
        get_base_value(key_str_uri_safe, single_code_unit(normalized, idx))
      } else {
        0
      }
    })
  }
}