| 3024 | return u.replace(re_utob, cb_utob); |
| 3025 | }; |
| 3026 | var cb_encode = function (ccc) { |
| 3027 | var padlen = [0, 2, 1][ccc.length % 3], |
| 3028 | ord = ccc.charCodeAt(0) << 16 |
| 3029 | | ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
| 3030 | | ((ccc.length > 2 ? ccc.charCodeAt(2) : 0)), |
| 3031 | chars = [ |
| 3032 | b64chars.charAt(ord >>> 18), |
| 3033 | b64chars.charAt((ord >>> 12) & 63), |
| 3034 | padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63), |
| 3035 | padlen >= 1 ? '=' : b64chars.charAt(ord & 63) |
| 3036 | ]; |
| 3037 | return chars.join(''); |
| 3038 | }; |
| 3039 | var btoa = function (b) { |
| 3040 | return b.replace(/[\s\S]{1,3}/g, cb_encode); |
| 3041 | }; |