| 
									
										
										
										
											2015-12-11 16:55:10 -08:00
										 |  |  | (function (w) { | 
					
						
							|  |  |  |   "use strict"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-27 22:26:00 -06:00
										 |  |  |   function findBest(atobNative) { | 
					
						
							| 
									
										
										
										
											2015-12-11 16:55:10 -08:00
										 |  |  |     // normal window
 | 
					
						
							| 
									
										
										
										
											2018-03-27 22:26:00 -06:00
										 |  |  |     if ('function' === typeof atobNative) { return atobNative; } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-11 16:55:10 -08:00
										 |  |  |     // browserify (web worker)
 | 
					
						
							| 
									
										
										
										
											2018-03-27 22:26:00 -06:00
										 |  |  |     if ('function' === typeof Buffer) { | 
					
						
							|  |  |  |       return function atobBrowserify(a) { | 
					
						
							|  |  |  |         //!! Deliberately using an API that's deprecated in node.js because
 | 
					
						
							|  |  |  |         //!! this file is for browsers and we expect them to cope with it.
 | 
					
						
							|  |  |  |         //!! Discussion: github.com/node-browser-compat/atob/pull/9
 | 
					
						
							|  |  |  |         return new Buffer(a, 'base64').toString('binary'); | 
					
						
							|  |  |  |       }; | 
					
						
							| 
									
										
										
										
											2015-12-11 16:55:10 -08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2018-03-27 22:26:00 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-11 16:55:10 -08:00
										 |  |  |     // ios web worker with base64js
 | 
					
						
							| 
									
										
										
										
											2018-03-27 22:26:00 -06:00
										 |  |  |     if ('object' === typeof w.base64js) { | 
					
						
							| 
									
										
										
										
											2015-12-11 16:55:10 -08:00
										 |  |  |       // bufferToBinaryString
 | 
					
						
							| 
									
										
										
										
											2018-03-27 22:26:00 -06:00
										 |  |  |       // https://git.coolaj86.com/coolaj86/unibabel.js/blob/master/index.js#L50
 | 
					
						
							|  |  |  |       return function atobWebWorker_iOS(a) { | 
					
						
							|  |  |  |         var buf = w.base64js.b64ToByteArray(a); | 
					
						
							|  |  |  |         return Array.prototype.map.call(buf, function (ch) { | 
					
						
							|  |  |  |           return String.fromCharCode(ch); | 
					
						
							|  |  |  |         }).join(''); | 
					
						
							|  |  |  |       }; | 
					
						
							| 
									
										
										
										
											2015-12-11 16:55:10 -08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2018-03-27 22:26:00 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		return function () { | 
					
						
							|  |  |  | 			// ios web worker without base64js
 | 
					
						
							|  |  |  | 			throw new Error("You're probably in an old browser or an iOS webworker." + | 
					
						
							|  |  |  | 				" It might help to include beatgammit's base64-js."); | 
					
						
							|  |  |  |     }; | 
					
						
							| 
									
										
										
										
											2015-12-11 16:55:10 -08:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-27 22:26:00 -06:00
										 |  |  |   var atobBest = findBest(w.atob); | 
					
						
							|  |  |  |   w.atob = atobBest; | 
					
						
							| 
									
										
										
										
											2015-12-28 09:54:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-27 22:26:00 -06:00
										 |  |  |   if ((typeof module === 'object') && module && module.exports) { | 
					
						
							|  |  |  |     module.exports = atobBest; | 
					
						
							| 
									
										
										
										
											2015-12-28 09:54:13 +00:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2015-12-11 16:55:10 -08:00
										 |  |  | }(window)); |