You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

13 lines
9.9 KiB

!function(r,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Base32URL=t():r.Base32URL=t()}(window,(function(){return function(r){var t={};function e(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return r[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=r,e.c=t,e.d=function(r,t,n){e.o(r,t)||Object.defineProperty(r,t,{enumerable:!0,get:n})},e.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},e.t=function(r,t){if(1&t&&(r=e(r)),8&t)return r;if(4&t&&"object"==typeof r&&r&&r.__esModule)return r;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:r}),2&t&&"string"!=typeof r)for(var o in r)e.d(n,o,function(t){return r[t]}.bind(null,o));return n},e.n=function(r){var t=r&&r.__esModule?function(){return r.default}:function(){return r};return e.d(t,"a",t),t},e.o=function(r,t){return Object.prototype.hasOwnProperty.call(r,t)},e.p="",e(e.s=4)}([function(r,t,e){(function(t,n){var o;
/*
* [hi-base32]{@link https://github.com/emn178/hi-base32}
*
* @version 0.5.0
* @author Chen, Yi-Cyuan [[email protected]]
* @copyright Chen, Yi-Cyuan 2015-2018
* @license MIT
*/!function(){"use strict";var c="object"==typeof window?window:{};!c.HI_BASE32_NO_NODE_JS&&"object"==typeof t&&t.versions&&t.versions.node&&(c=n);var a=!c.HI_BASE32_NO_COMMON_JS&&"object"==typeof r&&r.exports,i=e(3),u="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".split(""),h={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25,2:26,3:27,4:28,5:29,6:30,7:31},f=[0,0,0,0,0,0,0,0],d=function(r,t){t.length>10&&(t="..."+t.substr(-10));var e=new Error("Decoded data is not valid UTF-8. Maybe try base32.decode.asBytes()? Partial data after reading "+r+" bytes: "+t+" <-");throw e.position=r,e},s=function(r){if(""===r)return[];if(!/^[A-Z2-7=]+$/.test(r))throw new Error("Invalid base32 characters");for(var t,e,n,o,c,a,i,u,f=[],d=0,s=(r=r.replace(/=/g,"")).length,l=0,A=s>>3<<3;l<A;)t=h[r.charAt(l++)],e=h[r.charAt(l++)],n=h[r.charAt(l++)],o=h[r.charAt(l++)],c=h[r.charAt(l++)],a=h[r.charAt(l++)],i=h[r.charAt(l++)],u=h[r.charAt(l++)],f[d++]=255&(t<<3|e>>>2),f[d++]=255&(e<<6|n<<1|o>>>4),f[d++]=255&(o<<4|c>>>1),f[d++]=255&(c<<7|a<<2|i>>>3),f[d++]=255&(i<<5|u);var p=s-A;return 2===p?(t=h[r.charAt(l++)],e=h[r.charAt(l++)],f[d++]=255&(t<<3|e>>>2)):4===p?(t=h[r.charAt(l++)],e=h[r.charAt(l++)],n=h[r.charAt(l++)],o=h[r.charAt(l++)],f[d++]=255&(t<<3|e>>>2),f[d++]=255&(e<<6|n<<1|o>>>4)):5===p?(t=h[r.charAt(l++)],e=h[r.charAt(l++)],n=h[r.charAt(l++)],o=h[r.charAt(l++)],c=h[r.charAt(l++)],f[d++]=255&(t<<3|e>>>2),f[d++]=255&(e<<6|n<<1|o>>>4),f[d++]=255&(o<<4|c>>>1)):7===p&&(t=h[r.charAt(l++)],e=h[r.charAt(l++)],n=h[r.charAt(l++)],o=h[r.charAt(l++)],c=h[r.charAt(l++)],a=h[r.charAt(l++)],i=h[r.charAt(l++)],f[d++]=255&(t<<3|e>>>2),f[d++]=255&(e<<6|n<<1|o>>>4),f[d++]=255&(o<<4|c>>>1),f[d++]=255&(c<<7|a<<2|i>>>3)),f},l=function(r,t){if(!t)return function(r){for(var t,e,n="",o=r.length,c=0,a=0;c<o;)if((t=r[c++])<=127)n+=String.fromCharCode(t);else{t>191&&t<=223?(e=31&t,a=1):t<=239?(e=15&t,a=2):t<=247?(e=7&t,a=3):d(c,n);for(var i=0;i<a;++i)((t=r[c++])<128||t>191)&&d(c,n),e<<=6,e+=63&t;e>=55296&&e<=57343&&d(c,n),e>1114111&&d(c,n),e<=65535?n+=String.fromCharCode(e):(e-=65536,n+=String.fromCharCode(55296+(e>>10)),n+=String.fromCharCode(56320+(1023&e)))}return n}(s(r));if(""===r)return"";if(!/^[A-Z2-7=]+$/.test(r))throw new Error("Invalid base32 characters");var e,n,o,c,a,i,u,f,l="",A=r.indexOf("=");-1===A&&(A=r.length);for(var p=0,C=A>>3<<3;p<C;)e=h[r.charAt(p++)],n=h[r.charAt(p++)],o=h[r.charAt(p++)],c=h[r.charAt(p++)],a=h[r.charAt(p++)],i=h[r.charAt(p++)],u=h[r.charAt(p++)],f=h[r.charAt(p++)],l+=String.fromCharCode(255&(e<<3|n>>>2))+String.fromCharCode(255&(n<<6|o<<1|c>>>4))+String.fromCharCode(255&(c<<4|a>>>1))+String.fromCharCode(255&(a<<7|i<<2|u>>>3))+String.fromCharCode(255&(u<<5|f));var g=A-C;return 2===g?(e=h[r.charAt(p++)],n=h[r.charAt(p++)],l+=String.fromCharCode(255&(e<<3|n>>>2))):4===g?(e=h[r.charAt(p++)],n=h[r.charAt(p++)],o=h[r.charAt(p++)],c=h[r.charAt(p++)],l+=String.fromCharCode(255&(e<<3|n>>>2))+String.fromCharCode(255&(n<<6|o<<1|c>>>4))):5===g?(e=h[r.charAt(p++)],n=h[r.charAt(p++)],o=h[r.charAt(p++)],c=h[r.charAt(p++)],a=h[r.charAt(p++)],l+=String.fromCharCode(255&(e<<3|n>>>2))+String.fromCharCode(255&(n<<6|o<<1|c>>>4))+String.fromCharCode(255&(c<<4|a>>>1))):7===g&&(e=h[r.charAt(p++)],n=h[r.charAt(p++)],o=h[r.charAt(p++)],c=h[r.charAt(p++)],a=h[r.charAt(p++)],i=h[r.charAt(p++)],u=h[r.charAt(p++)],l+=String.fromCharCode(255&(e<<3|n>>>2))+String.fromCharCode(255&(n<<6|o<<1|c>>>4))+String.fromCharCode(255&(c<<4|a>>>1))+String.fromCharCode(255&(a<<7|i<<2|u>>>3))),l},A={encode:function(r,t){var e="string"!=typeof r;return e&&r.constructor===ArrayBuffer&&(r=new Uint8Array(r)),e?function(r){for(var t,e,n,o,c,a="",i=r.length,h=0,f=5*parseInt(i/5);h<f;)t=r[h++],e=r[h++],n=r[h++],o=r[h++],c=r[h++],a+=u[t>>>3]+u[31&(t<<2|e>>>6)]+u[e>>>1&31]+u[31&(e<<4|n>>>4)]+u[31&(n<<1|o>>>7)]+u[o>>>2&31]+u[31&(o<<3|c>>>5)]+u[31&c];var d=i-f;return 1===d?(t=r[h],a+=u[t>>>3]+u[t<<2&31]+"======"):2===d?(t=r[h++],e=r[h],a+=u[t>>>3]+u[31&(t<<2|e>>>6)]+u[e>>>1&31]+u[e<<4&31]+"===="):3===d?(t=r[h++],e=r[h++],n=r[h],a+=u[t>>>3]+u[31&(t<<2|e>>>6)]+u[e>>>1&31]+u[31&(e<<4|n>>>4)]+u[n<<1&31]+"==="):4===d&&(t=r[h++],e=r[h++],n=r[h++],o=r[h],a+=u[t>>>3]+u[31&(t<<2|e>>>6)]+u[e>>>1&31]+u[31&(e<<4|n>>>4)]+u[31&(n<<1|o>>>7)]+u[o>>>2&31]+u[o<<3&31]+"="),a}(r):t?function(r){for(var t,e,n,o,c,a="",i=r.length,h=0,f=5*parseInt(i/5);h<f;)t=r.charCodeAt(h++),e=r.charCodeAt(h++),n=r.charCodeAt(h++),o=r.charCodeAt(h++),c=r.charCodeAt(h++),a+=u[t>>>3]+u[31&(t<<2|e>>>6)]+u[e>>>1&31]+u[31&(e<<4|n>>>4)]+u[31&(n<<1|o>>>7)]+u[o>>>2&31]+u[31&(o<<3|c>>>5)]+u[31&c];var d=i-f;return 1===d?(t=r.charCodeAt(h),a+=u[t>>>3]+u[t<<2&31]+"======"):2===d?(t=r.charCodeAt(h++),e=r.charCodeAt(h),a+=u[t>>>3]+u[31&(t<<2|e>>>6)]+u[e>>>1&31]+u[e<<4&31]+"===="):3===d?(t=r.charCodeAt(h++),e=r.charCodeAt(h++),n=r.charCodeAt(h),a+=u[t>>>3]+u[31&(t<<2|e>>>6)]+u[e>>>1&31]+u[31&(e<<4|n>>>4)]+u[n<<1&31]+"==="):4===d&&(t=r.charCodeAt(h++),e=r.charCodeAt(h++),n=r.charCodeAt(h++),o=r.charCodeAt(h),a+=u[t>>>3]+u[31&(t<<2|e>>>6)]+u[e>>>1&31]+u[31&(e<<4|n>>>4)]+u[31&(n<<1|o>>>7)]+u[o>>>2&31]+u[o<<3&31]+"="),a}(r):function(r){var t,e,n,o,c,a,i,h=!1,d="",s=0,l=0,A=r.length;if(""===r)return d;do{for(f[0]=f[5],f[1]=f[6],f[2]=f[7],i=l;s<A&&i<5;++s)(a=r.charCodeAt(s))<128?f[i++]=a:a<2048?(f[i++]=192|a>>6,f[i++]=128|63&a):a<55296||a>=57344?(f[i++]=224|a>>12,f[i++]=128|a>>6&63,f[i++]=128|63&a):(a=65536+((1023&a)<<10|1023&r.charCodeAt(++s)),f[i++]=240|a>>18,f[i++]=128|a>>12&63,f[i++]=128|a>>6&63,f[i++]=128|63&a);i-l,l=i-5,s===A&&++s,s>A&&i<6&&(h=!0),t=f[0],i>4?(e=f[1],n=f[2],o=f[3],c=f[4],d+=u[t>>>3]+u[31&(t<<2|e>>>6)]+u[e>>>1&31]+u[31&(e<<4|n>>>4)]+u[31&(n<<1|o>>>7)]+u[o>>>2&31]+u[31&(o<<3|c>>>5)]+u[31&c]):1===i?d+=u[t>>>3]+u[t<<2&31]+"======":2===i?(e=f[1],d+=u[t>>>3]+u[31&(t<<2|e>>>6)]+u[e>>>1&31]+u[e<<4&31]+"===="):3===i?(e=f[1],n=f[2],d+=u[t>>>3]+u[31&(t<<2|e>>>6)]+u[e>>>1&31]+u[31&(e<<4|n>>>4)]+u[n<<1&31]+"==="):(e=f[1],n=f[2],o=f[3],d+=u[t>>>3]+u[31&(t<<2|e>>>6)]+u[e>>>1&31]+u[31&(e<<4|n>>>4)]+u[31&(n<<1|o>>>7)]+u[o>>>2&31]+u[o<<3&31]+"=")}while(!h);return d}(r)},decode:l};l.asBytes=s,a?r.exports=A:(c.base32=A,i&&(void 0===(o=function(){return A}.call(A,e,A,r))||(r.exports=o)))}()}).call(this,e(1),e(2))},function(r,t){var e,n,o=r.exports={};function c(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function i(r){if(e===setTimeout)return setTimeout(r,0);if((e===c||!e)&&setTimeout)return e=setTimeout,setTimeout(r,0);try{return e(r,0)}catch(t){try{return e.call(null,r,0)}catch(t){return e.call(this,r,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:c}catch(r){e=c}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(r){n=a}}();var u,h=[],f=!1,d=-1;function s(){f&&u&&(f=!1,u.length?h=u.concat(h):d=-1,h.length&&l())}function l(){if(!f){var r=i(s);f=!0;for(var t=h.length;t;){for(u=h,h=[];++d<t;)u&&u[d].run();d=-1,t=h.length}u=null,f=!1,function(r){if(n===clearTimeout)return clearTimeout(r);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(r);try{n(r)}catch(t){try{return n.call(null,r)}catch(t){return n.call(this,r)}}}(r)}}function A(r,t){this.fun=r,this.array=t}function p(){}o.nextTick=function(r){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];h.push(new A(r,t)),1!==h.length||f||i(l)},A.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=p,o.addListener=p,o.once=p,o.off=p,o.removeListener=p,o.removeAllListeners=p,o.emit=p,o.prependListener=p,o.prependOnceListener=p,o.listeners=function(r){return[]},o.binding=function(r){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(r){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(r,t){var e;e=function(){return this}();try{e=e||new Function("return this")()}catch(r){"object"==typeof window&&(e=window)}r.exports=e},function(r,t){(function(t){r.exports=t}).call(this,{})},function(r,t,e){"use strict";e.r(t),e.d(t,"encode",(function(){return u})),e.d(t,"decode",(function(){return a})),e.d(t,"decodeAsString",(function(){return i}));var n=e(0),o=e.n(n);function c(r){switch(r.length%8){case 2:return r+"======";case 4:return r+"====";case 5:return r+"===";case 7:return r+"="}return r}function a(r,t){return o.a.decode.asBytes(c(r),t)}function i(r,t){return o.a.decode(c(r),t)}function u(r,t){return o.a.encode(r,t).replace(/=/g,"")}
/*!
* Copyright (c) 2021 PathCheck Foundation. All rights reserved.
*/}])}));
//# sourceMappingURL=base32url.min.js.map