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