!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(r="undefined"!=typeof globalThis?globalThis:r||self).Blowfish=e()}(this,function(){"use strict";function i(r,e){for(var t=0;t>>0}function B(r,e){return s(r^e)}function h(r,e){return s(r+e|0)}function E(r,e,t,n){return s(r<<24|e<<16|t<<8|n)}function a(r){return[r>>>24&255,r>>>16&255,r>>>8&255,255&r]}function e(r){return"string"==typeof r}function t(r){return"object"==typeof r&&"byteLength"in r}function b(r){return e(r)||t(r)}function _(e,t){var n=!1;return Object.keys(e).forEach(function(r){e[r]===t&&(n=!0)}),n}function A(r){if(e(r))return function(r){for(var e=new Uint8Array(4*r.length),t=0,n=0;n!==r.length;n++){var i=r.charCodeAt(n);if(i<128)e[t++]=i;else{if(i<2048)e[t++]=i>>6|192;else{if(55295=r.length)return console.error("Incomplete surrogate pair"),e.subarray(0,t);var o=r.charCodeAt(n);if(o<56320||57343>18|240,e[t++]=i>>12&63|128}else e[t++]=i>>12|224;e[t++]=i>>6&63|128}e[t++]=63&i|128}}return e.subarray(0,t)}(r);if(t(r))return new Uint8Array(r);throw new Error("Unsupported type")}return function(){function r(r,e,t){if(void 0===e&&(e=d.ECB),void 0===t&&(t=v.PKCS5),!b(r))throw new Error("Key should be a string or an ArrayBuffer / Buffer");if(!_(d,e))throw new Error("Unsupported mode");if(!_(v,t))throw new Error("Unsupported padding");this.mode=e,this.padding=t,this.iv=null,this.p=p.slice(),this.s=[g.slice(),y.slice(),C.slice(),w.slice()],r=function(r){if(72<=r.length)return r;for(var e=[];e.length<72;)for(var t=0;t=r.length)return console.error("Incomplete 2-byte sequence"),t;n=(31&n)<<6|63&r[e++]}else if(223=r.length)return console.error("Incomplete 3-byte sequence"),t;n=(15&n)<<12|(63&r[e++])<<6|63&r[e++]}else{if(!(239=r.length)return console.error("Incomplete 4-byte sequence"),t;n=(7&n)<<18|(63&r[e++])<<12|(63&r[e++])<<6|63&r[e++]}if(n<=65535)t+=String.fromCharCode(n);else{if(!(n<=1114111))return console.error("Code point 0x"+n.toString(16)+" exceeds UTF-16 reach"),t;n-=65536,t+=String.fromCharCode(n>>10|55296),t+=String.fromCharCode(1023&n|56320)}}return t}(r);default:throw new Error("Unsupported return type")}},n._encryptBlock=function(r,e){for(var t=0;t<16;t++){r=B(r,this.p[t]);var n=[e=B(e,this._f(r)),r];r=n[0],e=n[1]}var i=[e,r];return e=B(e=i[1],this.p[16]),[r=B(r=i[0],this.p[17]),e]},n._decryptBlock=function(r,e){for(var t=17;1>>24&255],this.s[1][r>>>16&255]);return h(e=B(e,this.s[2][r>>>8&255]),this.s[3][255&r])},n._encodeECB=function(r){for(var e=new Uint8Array(r.length),t=0;t