{"version":3,"file":"b64.mjs","names":[],"sources":["../src/b64.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nexport function fromBase64(base64String: string): Uint8Array<ArrayBuffer> {\n\treturn Uint8Array.from(atob(base64String), (char) => char.charCodeAt(0));\n}\n\nconst CHUNK_SIZE = 8192;\nexport function toBase64(bytes: Uint8Array): string {\n\t// Special-case the simple case for speed's sake.\n\tif (bytes.length < CHUNK_SIZE) {\n\t\treturn btoa(String.fromCharCode(...bytes));\n\t}\n\n\tlet output = '';\n\tfor (var i = 0; i < bytes.length; i += CHUNK_SIZE) {\n\t\tconst chunk = bytes.slice(i, i + CHUNK_SIZE);\n\t\toutput += String.fromCharCode(...chunk);\n\t}\n\n\treturn btoa(output);\n}\n"],"mappings":";AAGA,SAAgB,WAAW,cAA+C;AACzE,QAAO,WAAW,KAAK,KAAK,aAAa,GAAG,SAAS,KAAK,WAAW,EAAE,CAAC;;AAGzE,MAAM,aAAa;AACnB,SAAgB,SAAS,OAA2B;AAEnD,KAAI,MAAM,SAAS,WAClB,QAAO,KAAK,OAAO,aAAa,GAAG,MAAM,CAAC;CAG3C,IAAI,SAAS;AACb,MAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK,YAAY;EAClD,MAAM,QAAQ,MAAM,MAAM,GAAG,IAAI,WAAW;AAC5C,YAAU,OAAO,aAAa,GAAG,MAAM;;AAGxC,QAAO,KAAK,OAAO"}