js-base64-legacy.2569446f.js 4.4 KB

1
  1. System.register([],(function(t){"use strict";return{execute:function(){var r,n="3.7.2",e="function"==typeof atob,o="function"==typeof btoa,u="function"==typeof Buffer,i="function"==typeof TextDecoder?new TextDecoder:void 0,c="function"==typeof TextEncoder?new TextEncoder:void 0,f=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),a=(r={},f.forEach((function(t,n){return r[t]=n})),r),s=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,d=String.fromCharCode.bind(String),h="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(t){return t};return new Uint8Array(Array.prototype.slice.call(t,0).map(r))},l=function(t){return t.replace(/=/g,"").replace(/[+\/]/g,(function(t){return"+"==t?"-":"_"}))},A=function(t){return t.replace(/[^A-Za-z0-9\+\/]/g,"")},y=function(t){for(var r,n,e,o,u="",i=t.length%3,c=0;c<t.length;){if((n=t.charCodeAt(c++))>255||(e=t.charCodeAt(c++))>255||(o=t.charCodeAt(c++))>255)throw new TypeError("invalid character found");u+=f[(r=n<<16|e<<8|o)>>18&63]+f[r>>12&63]+f[r>>6&63]+f[63&r]}return i?u.slice(0,i-3)+"===".substring(i):u},g=o?function(t){return btoa(t)}:u?function(t){return Buffer.from(t,"binary").toString("base64")}:y,p=u?function(t){return Buffer.from(t).toString("base64")}:function(t){for(var r=[],n=0,e=t.length;n<e;n+=4096)r.push(d.apply(null,t.subarray(n,n+4096)));return g(r.join(""))},b=function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return r?l(p(t)):p(t)},x=function(t){if(t.length<2)return(r=t.charCodeAt(0))<128?t:r<2048?d(192|r>>>6)+d(128|63&r):d(224|r>>>12&15)+d(128|r>>>6&63)+d(128|63&r);var r=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return d(240|r>>>18&7)+d(128|r>>>12&63)+d(128|r>>>6&63)+d(128|63&r)},B=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,v=function(t){return t.replace(B,x)},C=u?function(t){return Buffer.from(t,"utf8").toString("base64")}:c?function(t){return p(c.encode(t))}:function(t){return g(v(t))},m=function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return r?l(C(t)):C(t)},U=function(t){return m(t,!0)},F=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,S=function(t){switch(t.length){case 4:var r=((7&t.charCodeAt(0))<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|63&t.charCodeAt(3))-65536;return d(55296+(r>>>10))+d(56320+(1023&r));case 3:return d((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return d((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},w=function(t){return t.replace(F,S)},E=function(t){if(t=t.replace(/\s+/g,""),!s.test(t))throw new TypeError("malformed base64.");t+="==".slice(2-(3&t.length));for(var r,n,e,o="",u=0;u<t.length;)r=a[t.charAt(u++)]<<18|a[t.charAt(u++)]<<12|(n=a[t.charAt(u++)])<<6|(e=a[t.charAt(u++)]),o+=64===n?d(r>>16&255):64===e?d(r>>16&255,r>>8&255):d(r>>16&255,r>>8&255,255&r);return o},D=e?function(t){return atob(A(t))}:u?function(t){return Buffer.from(t,"base64").toString("binary")}:E,R=u?function(t){return h(Buffer.from(t,"base64"))}:function(t){return h(D(t),(function(t){return t.charCodeAt(0)}))},z=function(t){return R(Z(t))},T=u?function(t){return Buffer.from(t,"base64").toString("utf8")}:i?function(t){return i.decode(R(t))}:function(t){return w(D(t))},Z=function(t){return A(t.replace(/[-_]/g,(function(t){return"-"==t?"+":"/"})))},I=function(t){return T(Z(t))},P=function(t){return{value:t,enumerable:!1,writable:!0,configurable:!0}},j=function(){var t=function(t,r){return Object.defineProperty(String.prototype,t,P(r))};t("fromBase64",(function(){return I(this)})),t("toBase64",(function(t){return m(this,t)})),t("toBase64URI",(function(){return m(this,!0)})),t("toBase64URL",(function(){return m(this,!0)})),t("toUint8Array",(function(){return z(this)}))},L=function(){var t=function(t,r){return Object.defineProperty(Uint8Array.prototype,t,P(r))};t("toBase64",(function(t){return b(this,t)})),t("toBase64URI",(function(){return b(this,!0)})),t("toBase64URL",(function(){return b(this,!0)}))};t("g",{version:n,VERSION:"3.7.2",atob:D,atobPolyfill:E,btoa:g,btoaPolyfill:y,fromBase64:I,toBase64:m,encode:m,encodeURI:U,encodeURL:U,utob:v,btou:w,decode:I,isValid:function(t){if("string"!=typeof t)return!1;var r=t.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(r)||!/[^\s0-9a-zA-Z\-_]/.test(r)},fromUint8Array:b,toUint8Array:z,extendString:j,extendUint8Array:L,extendBuiltins:function(){j(),L()}})}}}));