(defn
decode
[s]
(let
[l (.-length s)]
(loop
[i 0 result 0 shift 0]
(when
(>= i l)
(throw (js/Error. "Expected more digits in base 64 VLQ value.")))
(let
[digit (base64/decode (.charAt s i))]
(let
[i
(inc i)
continuation?
(pos? (bit-and digit vlq-continuation-bit))
digit
(bit-and digit vlq-base-mask)
result
(+ result (bit-shift-left digit shift))
shift
(+ shift vlq-base-shift)]
(if
continuation?
(recur i result shift)
(lazy-seq
(cons
(from-vlq-signed result)
(let
[s (.substring s i)]
(when-not (string/blank? s) (decode s)))))))))))