vendor: 4,762 bytes, lines 1-115
1// 2// THIS FILE IS AUTOMATICALLY GENERATED! DO NOT EDIT BY HAND! 3// 4; 5(function (global, factory) { 6 typeof exports === 'object' && typeof module !== 'undefined' 7 ? module.exports = factory() 8 : typeof define === 'function' && define.amd 9 ? define(factory) : 10 // cf. https://github.com/dankogai/js-base64/issues/119 11 (function () { 12 // existing version for noConflict() 13 var _Base64 = global.Base64; 14 var gBase64 = factory(); 15 gBase64.noConflict = function () { 16 global.Base64 = _Base64; 17 return gBase64; 18 }; 19 if (global.Meteor) { // Meteor.js 20 Base64 = gBase64; 21 } 22 global.Base64 = gBase64; 23 })(); 24}((typeof self !== 'undefined' ? self 25 : typeof window !== 'undefined' ? window 26 : typeof global !== 'undefined' ? global 27 : this), function () { 28 'use strict'; 29 /** 30 * base64.ts 31 * 32 * Licensed under the BSD 3-Clause License. 33 * http://opensource.org/licenses/BSD-3-Clause 34 * 35 * References: 36 * http://en.wikipedia.org/wiki/Base64 37 * 38 * @author Dan Kogai (https://github.com/dankogai) 39 */ 40 var version = '3.7.8'; 41 /** 42 * @deprecated use lowercase `version`. 43 */ 44 var VERSION = version; 45 var _hasBuffer = typeof Buffer === 'function'; 46 var _TD = typeof TextDecoder === 'function' ? new TextDecoder() : undefined; 47 var _TE = typeof TextEncoder === 'function' ? new TextEncoder() : undefined; 48 var b64ch = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; 49 var b64chs = Array.prototype.slice.call(b64ch); 50 var b64tab = (function (a) { 51 var tab = {}; 52 a.forEach(function (c, i) { return tab[c] = i; }); 53 return tab; 54 })(b64chs); 55 var b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/; 56 var _fromCC = String.fromCharCode.bind(String); 57 var _U8Afrom = typeof Uint8Array.from === 'function' 58 ? Uint8Array.from.bind(Uint8Array) 59 : function (it) { return new Uint8Array(Array.prototype.slice.call(it, 0)); }; 60 var _mkUriSafe = function (src) { return src 61 .replace(/=/g, '').replace(/[+\/]/g, function (m0) { return m0 == '+' ? '-' : '_'; }); }; 62 var _tidyB64 = function (s) { return s.replace(/[^A-Za-z0-9\+\/]/g, ''); }; 63 /** 64 * polyfill version of `btoa` 65 */ 66 var btoaPolyfill = function (bin) { 67 // console.log('polyfilled'); 68 var u32, c0, c1, c2, asc = ''; 69 var pad = bin.length % 3; 70 for (var i = 0; i < bin.length;) { 71 if ((c0 = bin.charCodeAt(i++)) > 255 || 72 (c1 = bin.charCodeAt(i++)) > 255 || 73 (c2 = bin.charCodeAt(i++)) > 255) 74 throw new TypeError('invalid character found'); 75 u32 = (c0 << 16) | (c1 << 8) | c2; 76 asc += b64chs[u32 >> 18 & 63] 77 + b64chs[u32 >> 12 & 63] 78 + b64chs[u32 >> 6 & 63] 79 + b64chs[u32 & 63]; 80 } 81 return pad ? asc.slice(0, pad - 3) + "===".substring(pad) : asc; 82 }; 83 /** 84 * does what `window.btoa` of web browsers do. 85 * @param {String} bin binary string 86 * @returns {string} Base64-encoded string 87 */ 88 var _btoa = typeof btoa === 'function' ? function (bin) { return btoa(bin); } 89 : _hasBuffer ? function (bin) { return Buffer.from(bin, 'binary').toString('base64'); } 90 : btoaPolyfill; 91 var _fromUint8Array = _hasBuffer 92 ? function (u8a) { return Buffer.from(u8a).toString('base64'); } 93 : function (u8a) { 94 // cf. https://stackoverflow.com/questions/12710001/how-to-convert-uint8-array-to-base64-encoded-string/12713326#12713326 95 var maxargs = 0x1000; 96 var strs = []; 97 for (var i = 0, l = u8a.length; i < l; i += maxargs) { 98 strs.push(_fromCC.apply(null, u8a.subarray(i, i + maxargs))); 99 } 100 return _btoa(strs.join('')); 101 }; 102 /** 103 * converts a Uint8Array to a Base64 string. 104 * @param {boolean} [urlsafe] URL-and-filename-safe a la RFC4648 §5 105 * @returns {string} Base64 string 106 */ 107 var fromUint8Array = function (u8a, urlsafe) { 108 if (urlsafe === void 0) { urlsafe = false; } 109 return urlsafe ? _mkUriSafe(_fromUint8Array(u8a)) : _fromUint8Array(u8a); 110 }; 111 // This trick is found broken https://github.com/dankogai/js-base64/issues/130 112 // const utob = (src: string) => unescape(encodeURIComponent(src)); 113 // reverting good old fationed regexp 114 var cb_utob = function (c) { 115 if (c.length < 2) {
vendor: 4,766 bytes, lines 116-230
116 var cc = c.charCodeAt(0); 117 return cc < 0x80 ? c 118 : cc < 0x800 ? (_fromCC(0xc0 | (cc >>> 6)) 119 + _fromCC(0x80 | (cc & 0x3f))) 120 : (_fromCC(0xe0 | ((cc >>> 12) & 0x0f)) 121 + _fromCC(0x80 | ((cc >>> 6) & 0x3f)) 122 + _fromCC(0x80 | (cc & 0x3f))); 123 } 124 else { 125 var cc = 0x10000 126 + (c.charCodeAt(0) - 0xD800) * 0x400 127 + (c.charCodeAt(1) - 0xDC00); 128 return (_fromCC(0xf0 | ((cc >>> 18) & 0x07)) 129 + _fromCC(0x80 | ((cc >>> 12) & 0x3f)) 130 + _fromCC(0x80 | ((cc >>> 6) & 0x3f)) 131 + _fromCC(0x80 | (cc & 0x3f))); 132 } 133 }; 134 var re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g; 135 /** 136 * @deprecated should have been internal use only. 137 * @param {string} src UTF-8 string 138 * @returns {string} UTF-16 string 139 */ 140 var utob = function (u) { return u.replace(re_utob, cb_utob); }; 141 // 142 var _encode = _hasBuffer 143 ? function (s) { return Buffer.from(s, 'utf8').toString('base64'); } 144 : _TE 145 ? function (s) { return _fromUint8Array(_TE.encode(s)); } 146 : function (s) { return _btoa(utob(s)); }; 147 /** 148 * converts a UTF-8-encoded string to a Base64 string. 149 * @param {boolean} [urlsafe] if `true` make the result URL-safe 150 * @returns {string} Base64 string 151 */ 152 var encode = function (src, urlsafe) { 153 if (urlsafe === void 0) { urlsafe = false; } 154 return urlsafe 155 ? _mkUriSafe(_encode(src)) 156 : _encode(src); 157 }; 158 /** 159 * converts a UTF-8-encoded string to URL-safe Base64 RFC4648 §5. 160 * @returns {string} Base64 string 161 */ 162 var encodeURI = function (src) { return encode(src, true); }; 163 // This trick is found broken https://github.com/dankogai/js-base64/issues/130 164 // const btou = (src: string) => decodeURIComponent(escape(src)); 165 // reverting good old fationed regexp 166 var re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g; 167 var cb_btou = function (cccc) { 168 switch (cccc.length) { 169 case 4: 170 var cp = ((0x07 & cccc.charCodeAt(0)) << 18) 171 | ((0x3f & cccc.charCodeAt(1)) << 12) 172 | ((0x3f & cccc.charCodeAt(2)) << 6) 173 | (0x3f & cccc.charCodeAt(3)), offset = cp - 0x10000; 174 return (_fromCC((offset >>> 10) + 0xD800) 175 + _fromCC((offset & 0x3FF) + 0xDC00)); 176 case 3: 177 return _fromCC(((0x0f & cccc.charCodeAt(0)) << 12) 178 | ((0x3f & cccc.charCodeAt(1)) << 6) 179 | (0x3f & cccc.charCodeAt(2))); 180 default: 181 return _fromCC(((0x1f & cccc.charCodeAt(0)) << 6) 182 | (0x3f & cccc.charCodeAt(1))); 183 } 184 }; 185 /** 186 * @deprecated should have been internal use only. 187 * @param {string} src UTF-16 string 188 * @returns {string} UTF-8 string 189 */ 190 var btou = function (b) { return b.replace(re_btou, cb_btou); }; 191 /** 192 * polyfill version of `atob` 193 */ 194 var atobPolyfill = function (asc) { 195 // console.log('polyfilled'); 196 asc = asc.replace(/\s+/g, ''); 197 if (!b64re.test(asc)) 198 throw new TypeError('malformed base64.'); 199 asc += '=='.slice(2 - (asc.length & 3)); 200 var u24, r1, r2; 201 var binArray = []; // use array to avoid minor gc in loop 202 for (var i = 0; i < asc.length;) { 203 u24 = b64tab[asc.charAt(i++)] << 18 204 | b64tab[asc.charAt(i++)] << 12 205 | (r1 = b64tab[asc.charAt(i++)]) << 6 206 | (r2 = b64tab[asc.charAt(i++)]); 207 if (r1 === 64) { 208 binArray.push(_fromCC(u24 >> 16 & 255)); 209 } 210 else if (r2 === 64) { 211 binArray.push(_fromCC(u24 >> 16 & 255, u24 >> 8 & 255)); 212 } 213 else { 214 binArray.push(_fromCC(u24 >> 16 & 255, u24 >> 8 & 255, u24 & 255)); 215 } 216 } 217 return binArray.join(''); 218 }; 219 /** 220 * does what `window.atob` of web browsers do. 221 * @param {String} asc Base64-encoded string 222 * @returns {string} binary string 223 */ 224 var _atob = typeof atob === 'function' ? function (asc) { return atob(_tidyB64(asc)); } 225 : _hasBuffer ? function (asc) { return Buffer.from(asc, 'base64').toString('binary'); } 226 : atobPolyfill; 227 // 228 var _toUint8Array = _hasBuffer 229 ? function (a) { return _U8Afrom(Buffer.from(a, 'base64')); } 230 : function (a) { return _U8Afrom(_atob(a).split('').map(function (c) { return c.charCo
vendor: 3,478 bytes, lines 230-321
230deAt(0); })); }; 231 /** 232 * converts a Base64 string to a Uint8Array. 233 */ 234 var toUint8Array = function (a) { return _toUint8Array(_unURI(a)); }; 235 // 236 var _decode = _hasBuffer 237 ? function (a) { return Buffer.from(a, 'base64').toString('utf8'); } 238 : _TD 239 ? function (a) { return _TD.decode(_toUint8Array(a)); } 240 : function (a) { return btou(_atob(a)); }; 241 var _unURI = function (a) { return _tidyB64(a.replace(/[-_]/g, function (m0) { return m0 == '-' ? '+' : '/'; })); }; 242 /** 243 * converts a Base64 string to a UTF-8 string. 244 * @param {String} src Base64 string. Both normal and URL-safe are supported 245 * @returns {string} UTF-8 string 246 */ 247 var decode = function (src) { return _decode(_unURI(src)); }; 248 /** 249 * check if a value is a valid Base64 string 250 * @param {String} src a value to check 251 */ 252 var isValid = function (src) { 253 if (typeof src !== 'string') 254 return false; 255 var s = src.replace(/\s+/g, '').replace(/={0,2}$/, ''); 256 return !/[^\s0-9a-zA-Z\+/]/.test(s) || !/[^\s0-9a-zA-Z\-_]/.test(s); 257 }; 258 // 259 var _noEnum = function (v) { 260 return { 261 value: v, enumerable: false, writable: true, configurable: true 262 }; 263 }; 264 /** 265 * extend String.prototype with relevant methods 266 */ 267 var extendString = function () { 268 var _add = function (name, body) { return Object.defineProperty(String.prototype, name, _noEnum(body)); }; 269 _add('fromBase64', function () { return decode(this); }); 270 _add('toBase64', function (urlsafe) { return encode(this, urlsafe); }); 271 _add('toBase64URI', function () { return encode(this, true); }); 272 _add('toBase64URL', function () { return encode(this, true); }); 273 _add('toUint8Array', function () { return toUint8Array(this); }); 274 }; 275 /** 276 * extend Uint8Array.prototype with relevant methods 277 */ 278 var extendUint8Array = function () { 279 var _add = function (name, body) { return Object.defineProperty(Uint8Array.prototype, name, _noEnum(body)); }; 280 _add('toBase64', function (urlsafe) { return fromUint8Array(this, urlsafe); }); 281 _add('toBase64URI', function () { return fromUint8Array(this, true); }); 282 _add('toBase64URL', function () { return fromUint8Array(this, true); }); 283 }; 284 /** 285 * extend Builtin prototypes with relevant methods 286 */ 287 var extendBuiltins = function () { 288 extendString(); 289 extendUint8Array(); 290 }; 291 var gBase64 = { 292 version: version, 293 VERSION: VERSION, 294 atob: _atob, 295 atobPolyfill: atobPolyfill, 296 btoa: _btoa, 297 btoaPolyfill: btoaPolyfill, 298 fromBase64: decode, 299 toBase64: encode, 300 encode: encode, 301 encodeURI: encodeURI, 302 encodeURL: encodeURI, 303 utob: utob, 304 btou: btou, 305 decode: decode, 306 isValid: isValid, 307 fromUint8Array: fromUint8Array, 308 toUint8Array: toUint8Array, 309 extendString: extendString, 310 extendUint8Array: extendUint8Array, 311 extendBuiltins: extendBuiltins 312 }; 313 // 314 // export Base64 to the namespace 315 // 316 // ES5 is yet to have Object.assign() that may make transpilers unhappy. 317 // gBase64.Base64 = Object.assign({}, gBase64); 318 gBase64.Base64 = {}; 319 Object.keys(gBase64).forEach(function (k) { return gBase64.Base64[k] = gBase64[k]; }); 320 return gBase64; 321}));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.