mirror of
https://github.com/gchq/CyberChef
synced 2024-12-26 04:23:10 +00:00
2 lines
No EOL
225 KiB
JavaScript
Executable file
2 lines
No EOL
225 KiB
JavaScript
Executable file
/*! For license information please see Bletchley.js.LICENSE.txt */
|
||
(()=>{var e={67526:(e,t)=>{"use strict";t.byteLength=function(e){var t=s(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,i=s(e),a=i[0],u=i[1],l=new o(function(e,t,r){return 3*(t+r)/4-r}(0,a,u)),c=0,f=u>0?a-4:a;for(r=0;r<f;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],l[c++]=t>>16&255,l[c++]=t>>8&255,l[c++]=255&t;return 2===u&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,l[c++]=255&t),1===u&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,l[c++]=t>>8&255,l[c++]=255&t),l},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],a=16383,s=0,l=n-o;s<l;s+=a)i.push(u(e,s,s+a>l?l:s+a));return 1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),i.join("")};for(var r=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)r[a]=i[a],n[i.charCodeAt(a)]=a;function s(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function u(e,t,n){for(var o,i,a=[],s=t;s<n;s+=3)o=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),a.push(r[(i=o)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},48287:(e,t,r)=>{"use strict";const n=r(67526),o=r(251),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=u,t.INSPECT_MAX_BYTES=50;const a=2147483647;function s(e){if(e>a)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,u.prototype),t}function u(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return f(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!u.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|m(e,t);let n=s(r);const o=n.write(e,t);return o!==r&&(n=n.slice(0,o)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Y(e,Uint8Array)){const t=new Uint8Array(e);return p(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Y(e,ArrayBuffer)||e&&Y(e.buffer,ArrayBuffer))return p(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(Y(e,SharedArrayBuffer)||e&&Y(e.buffer,SharedArrayBuffer)))return p(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return u.from(n,t,r);const o=function(e){if(u.isBuffer(e)){const t=0|d(e.length),r=s(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||J(e.length)?s(0):h(e):"Buffer"===e.type&&Array.isArray(e.data)?h(e.data):void 0}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return u.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function f(e){return c(e),s(e<0?0:0|d(e))}function h(e){const t=e.length<0?0:0|d(e.length),r=s(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function p(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,u.prototype),n}function d(e){if(e>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function m(e,t){if(u.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Y(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Q(e).length;default:if(o)return n?-1:H(e).length;t=(""+t).toLowerCase(),o=!0}}function v(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return T(this,t,r);case"utf8":case"utf-8":return S(this,t,r);case"ascii":return I(this,t,r);case"latin1":case"binary":return C(this,t,r);case"base64":return F(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function y(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function g(e,t,r,n,o){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),J(r=+r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof t&&(t=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:b(e,t,r,n,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):b(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function b(e,t,r,n,o){let i,a=1,s=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,r/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){let n=-1;for(i=r;i<s;i++)if(l(e,i)===l(t,-1===n?0:i-n)){if(-1===n&&(n=i),i-n+1===u)return n*a}else-1!==n&&(i-=i-n),n=-1}else for(r+u>s&&(r=s-u),i=r;i>=0;i--){let r=!0;for(let n=0;n<u;n++)if(l(e,i+n)!==l(t,n)){r=!1;break}if(r)return i}return-1}function w(e,t,r,n){r=Number(r)||0;const o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;const i=t.length;let a;for(n>i/2&&(n=i/2),a=0;a<n;++a){const n=parseInt(t.substr(2*a,2),16);if(J(n))return a;e[r+a]=n}return a}function x(e,t,r,n){return V(H(t,e.length-r),e,r,n)}function A(e,t,r,n){return V(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function B(e,t,r,n){return V(Q(t),e,r,n)}function E(e,t,r,n){return V(function(e,t){let r,n,o;const i=[];for(let a=0;a<e.length&&!((t-=2)<0);++a)r=e.charCodeAt(a),n=r>>8,o=r%256,i.push(o),i.push(n);return i}(t,e.length-r),e,r,n)}function F(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function S(e,t,r){r=Math.min(e.length,r);const n=[];let o=t;for(;o<r;){const t=e[o];let i=null,a=t>239?4:t>223?3:t>191?2:1;if(o+a<=r){let r,n,s,u;switch(a){case 1:t<128&&(i=t);break;case 2:r=e[o+1],128==(192&r)&&(u=(31&t)<<6|63&r,u>127&&(i=u));break;case 3:r=e[o+1],n=e[o+2],128==(192&r)&&128==(192&n)&&(u=(15&t)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(i=u));break;case 4:r=e[o+1],n=e[o+2],s=e[o+3],128==(192&r)&&128==(192&n)&&128==(192&s)&&(u=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&s,u>65535&&u<1114112&&(i=u))}}null===i?(i=65533,a=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|1023&i),n.push(i),o+=a}return function(e){const t=e.length;if(t<=k)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=k));return r}(n)}u.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(e,t,r){return function(e,t,r){return c(e),e<=0?s(e):void 0!==t?"string"==typeof r?s(e).fill(t,r):s(e).fill(t):s(e)}(e,t,r)},u.allocUnsafe=function(e){return f(e)},u.allocUnsafeSlow=function(e){return f(e)},u.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==u.prototype},u.compare=function(e,t){if(Y(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),Y(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let o=0,i=Math.min(r,n);o<i;++o)if(e[o]!==t[o]){r=e[o],n=t[o];break}return r<n?-1:n<r?1:0},u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const n=u.allocUnsafe(t);let o=0;for(r=0;r<e.length;++r){let t=e[r];if(Y(t,Uint8Array))o+t.length>n.length?(u.isBuffer(t)||(t=u.from(t)),t.copy(n,o)):Uint8Array.prototype.set.call(n,t,o);else{if(!u.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,o)}o+=t.length}return n},u.byteLength=m,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)y(this,t,t+1);return this},u.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},u.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},u.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?S(this,0,e):v.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},i&&(u.prototype[i]=u.prototype.inspect),u.prototype.compare=function(e,t,r,n,o){if(Y(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),t<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=r)return 0;if(n>=o)return-1;if(t>=r)return 1;if(this===e)return 0;let i=(o>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0);const s=Math.min(i,a),l=this.slice(n,o),c=e.slice(t,r);for(let e=0;e<s;++e)if(l[e]!==c[e]){i=l[e],a=c[e];break}return i<a?-1:a<i?1:0},u.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},u.prototype.indexOf=function(e,t,r){return g(this,e,t,r,!0)},u.prototype.lastIndexOf=function(e,t,r){return g(this,e,t,r,!1)},u.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const o=this.length-t;if((void 0===r||r>o)&&(r=o),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let i=!1;for(;;)switch(n){case"hex":return w(this,e,t,r);case"utf8":case"utf-8":return x(this,e,t,r);case"ascii":case"latin1":case"binary":return A(this,e,t,r);case"base64":return B(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const k=4096;function I(e,t,r){let n="";r=Math.min(e.length,r);for(let o=t;o<r;++o)n+=String.fromCharCode(127&e[o]);return n}function C(e,t,r){let n="";r=Math.min(e.length,r);for(let o=t;o<r;++o)n+=String.fromCharCode(e[o]);return n}function T(e,t,r){const n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let o="";for(let n=t;n<r;++n)o+=z[e[n]];return o}function R(e,t,r){const n=e.slice(t,r);let o="";for(let e=0;e<n.length-1;e+=2)o+=String.fromCharCode(n[e]+256*n[e+1]);return o}function O(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function L(e,t,r,n,o,i){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function M(e,t,r,n,o){j(t,n,o,e,r,7);let i=Number(t&BigInt(4294967295));e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,r}function P(e,t,r,n,o){j(t,n,o,e,r,7);let i=Number(t&BigInt(4294967295));e[r+7]=i,i>>=8,e[r+6]=i,i>>=8,e[r+5]=i,i>>=8,e[r+4]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=a,a>>=8,e[r+2]=a,a>>=8,e[r+1]=a,a>>=8,e[r]=a,r+8}function U(e,t,r,n,o,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(e,t,r,n,i){return t=+t,r>>>=0,i||U(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function N(e,t,r,n,i){return t=+t,r>>>=0,i||U(e,0,r,8),o.write(e,t,r,n,52,8),r+8}u.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const n=this.subarray(e,t);return Object.setPrototypeOf(n,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||O(e,t,this.length);let n=this[e],o=1,i=0;for(;++i<t&&(o*=256);)n+=this[e+i]*o;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||O(e,t,this.length);let n=this[e+--t],o=1;for(;t>0&&(o*=256);)n+=this[e+--t]*o;return n},u.prototype.readUint8=u.prototype.readUInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),this[e]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readBigUInt64LE=q((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||Z(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,o=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))})),u.prototype.readBigUInt64BE=q((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||Z(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],o=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(o)})),u.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||O(e,t,this.length);let n=this[e],o=1,i=0;for(;++i<t&&(o*=256);)n+=this[e+i]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||O(e,t,this.length);let n=t,o=1,i=this[e+--n];for(;n>0&&(o*=256);)i+=this[e+--n]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i},u.prototype.readInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){e>>>=0,t||O(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){e>>>=0,t||O(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readBigInt64LE=q((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||Z(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),u.prototype.readBigInt64BE=q((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||Z(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),u.prototype.readFloatLE=function(e,t){return e>>>=0,t||O(e,4,this.length),o.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return e>>>=0,t||O(e,4,this.length),o.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return e>>>=0,t||O(e,8,this.length),o.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return e>>>=0,t||O(e,8,this.length),o.read(this,e,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||L(this,e,t,r,Math.pow(2,8*r)-1,0);let o=1,i=0;for(this[t]=255&e;++i<r&&(o*=256);)this[t+i]=e/o&255;return t+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||L(this,e,t,r,Math.pow(2,8*r)-1,0);let o=r-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,1,255,0),this[t]=255&e,t+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeBigUInt64LE=q((function(e,t=0){return M(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=q((function(e,t=0){return P(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);L(this,e,t,r,n-1,-n)}let o=0,i=1,a=0;for(this[t]=255&e;++o<r&&(i*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/i|0)-a&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);L(this,e,t,r,n-1,-n)}let o=r-1,i=1,a=0;for(this[t+o]=255&e;--o>=0&&(i*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/i|0)-a&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeBigInt64LE=q((function(e,t=0){return M(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=q((function(e,t=0){return P(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return N(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return N(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,n){if(!u.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);const o=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),o},u.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){const t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{const i=u.isBuffer(e)?e:u.from(e,n),a=i.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<r-t;++o)this[o+t]=i[o%a]}return this};const _={};function $(e,t,r){_[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function X(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function j(e,t,r,n,o,i){if(e>r||e<t){const n="bigint"==typeof t?"n":"";let o;throw o=i>3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(i+1)}${n}`:`>= -(2${n} ** ${8*(i+1)-1}${n}) and < 2 ** ${8*(i+1)-1}${n}`:`>= ${t}${n} and <= ${r}${n}`,new _.ERR_OUT_OF_RANGE("value",o,e)}!function(e,t,r){G(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||Z(t,e.length-(r+1))}(n,o,i)}function G(e,t){if("number"!=typeof e)throw new _.ERR_INVALID_ARG_TYPE(t,"number",e)}function Z(e,t,r){if(Math.floor(e)!==e)throw G(e,r),new _.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new _.ERR_BUFFER_OUT_OF_BOUNDS;throw new _.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}$("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),$("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),$("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" is out of range.`,o=r;return Number.isInteger(r)&&Math.abs(r)>2**32?o=X(String(r)):"bigint"==typeof r&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=X(o)),o+="n"),n+=` It must be ${t}. Received ${o}`,n}),RangeError);const W=/[^+/0-9A-Za-z-_]/g;function H(e,t){let r;t=t||1/0;const n=e.length;let o=null;const i=[];for(let a=0;a<n;++a){if(r=e.charCodeAt(a),r>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function Q(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(W,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function V(e,t,r,n){let o;for(o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function Y(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function J(e){return e!=e}const z=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let o=0;o<16;++o)t[n+o]=e[r]+e[o]}return t}();function q(e){return"undefined"==typeof BigInt?K:e}function K(){throw new Error("BigInt not supported")}},251:(e,t)=>{t.read=function(e,t,r,n,o){var i,a,s=8*o-n-1,u=(1<<s)-1,l=u>>1,c=-7,f=r?o-1:0,h=r?-1:1,p=e[t+f];for(f+=h,i=p&(1<<-c)-1,p>>=-c,c+=s;c>0;i=256*i+e[t+f],f+=h,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=n;c>0;a=256*a+e[t+f],f+=h,c-=8);if(0===i)i=1-l;else{if(i===u)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,n),i-=l}return(p?-1:1)*a*Math.pow(2,i-n)},t.write=function(e,t,r,n,o,i){var a,s,u,l=8*i-o-1,c=(1<<l)-1,f=c>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,d=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(a++,u/=2),a+f>=c?(s=0,a=c):a+f>=1?(s=(t*u-1)*Math.pow(2,o),a+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,o),a=0));o>=8;e[r+p]=255&s,p+=d,s/=256,o-=8);for(a=a<<o|s,l+=o;l>0;e[r+p]=255&a,p+=d,a/=256,l-=8);e[r+p-d]|=128*m}},73065:function(e,t,r){var n,o;!function(i,a){"use strict";n=function(){var e=function(){},t="undefined",r=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),n=["trace","debug","info","warn","error"],o={},i=null;function a(e,t){var r=e[t];if("function"==typeof r.bind)return r.bind(e);try{return Function.prototype.bind.call(r,e)}catch(t){return function(){return Function.prototype.apply.apply(r,[e,arguments])}}}function s(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function u(){for(var r=this.getLevel(),o=0;o<n.length;o++){var i=n[o];this[i]=o<r?e:this.methodFactory(i,r,this.name)}if(this.log=this.debug,typeof console===t&&r<this.levels.SILENT)return"No console available for logging"}function l(e){return function(){typeof console!==t&&(u.call(this),this[e].apply(this,arguments))}}function c(n,o,i){return function(n){return"debug"===n&&(n="log"),typeof console!==t&&("trace"===n&&r?s:void 0!==console[n]?a(console,n):void 0!==console.log?a(console,"log"):e)}(n)||l.apply(this,arguments)}function f(e,r){var a,s,l,f=this,h="loglevel";function p(){var e;if(typeof window!==t&&h){try{e=window.localStorage[h]}catch(e){}if(typeof e===t)try{var r=window.document.cookie,n=encodeURIComponent(h),o=r.indexOf(n+"=");-1!==o&&(e=/^([^;]+)/.exec(r.slice(o+n.length+1))[1])}catch(e){}return void 0===f.levels[e]&&(e=void 0),e}}function d(e){var t=e;if("string"==typeof t&&void 0!==f.levels[t.toUpperCase()]&&(t=f.levels[t.toUpperCase()]),"number"==typeof t&&t>=0&&t<=f.levels.SILENT)return t;throw new TypeError("log.setLevel() called with invalid level: "+e)}"string"==typeof e?h+=":"+e:"symbol"==typeof e&&(h=void 0),f.name=e,f.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},f.methodFactory=r||c,f.getLevel=function(){return null!=l?l:null!=s?s:a},f.setLevel=function(e,r){return l=d(e),!1!==r&&function(e){var r=(n[e]||"silent").toUpperCase();if(typeof window!==t&&h){try{return void(window.localStorage[h]=r)}catch(e){}try{window.document.cookie=encodeURIComponent(h)+"="+r+";"}catch(e){}}}(l),u.call(f)},f.setDefaultLevel=function(e){s=d(e),p()||f.setLevel(e,!1)},f.resetLevel=function(){l=null,function(){if(typeof window!==t&&h){try{window.localStorage.removeItem(h)}catch(e){}try{window.document.cookie=encodeURIComponent(h)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(e){}}}(),u.call(f)},f.enableAll=function(e){f.setLevel(f.levels.TRACE,e)},f.disableAll=function(e){f.setLevel(f.levels.SILENT,e)},f.rebuild=function(){if(i!==f&&(a=d(i.getLevel())),u.call(f),i===f)for(var e in o)o[e].rebuild()},a=d(i?i.getLevel():"WARN");var m=p();null!=m&&(l=d(m)),u.call(f)}(i=new f).getLogger=function(e){if("symbol"!=typeof e&&"string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=o[e];return t||(t=o[e]=new f(e,i.methodFactory)),t};var h=typeof window!==t?window.log:void 0;return i.noConflict=function(){return typeof window!==t&&window.log===i&&(window.log=h),i},i.getLoggers=function(){return o},i.default=i,i},void 0===(o=n.call(t,r,t,e))||(e.exports=o)}()},65606:e=>{var t,r,n=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function a(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var s,u=[],l=!1,c=-1;function f(){l&&s&&(l=!1,s.length?u=s.concat(u):c=-1,u.length&&h())}function h(){if(!l){var e=a(f);l=!0;for(var t=u.length;t;){for(s=u,u=[];++c<t;)s&&s[c].run();c=-1,t=u.length}s=null,l=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===i||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{return r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function d(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];u.push(new p(e,t)),1!==u.length||l||a(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=d,n.addListener=d,n.once=d,n.off=d,n.removeListener=d,n.removeAllListeners=d,n.emit=d,n.prependListener=d,n.prependOnceListener=d,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},90031:(e,t)=>{!function(e){var t,r,n,o=String.fromCharCode;function i(e){for(var t,r,n=[],o=0,i=e.length;o<i;)(t=e.charCodeAt(o++))>=55296&&t<=56319&&o<i?56320==(64512&(r=e.charCodeAt(o++)))?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),o--):n.push(t);return n}function a(e){if(e>=55296&&e<=57343)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value")}function s(e,t){return o(e>>t&63|128)}function u(e){if(!(4294967168&e))return o(e);var t="";return 4294965248&e?4294901760&e?4292870144&e||(t=o(e>>18&7|240),t+=s(e,12),t+=s(e,6)):(a(e),t=o(e>>12&15|224),t+=s(e,6)):t=o(e>>6&31|192),t+o(63&e|128)}function l(){if(n>=r)throw Error("Invalid byte index");var e=255&t[n];if(n++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function c(){var e,o;if(n>r)throw Error("Invalid byte index");if(n==r)return!1;if(e=255&t[n],n++,!(128&e))return e;if(192==(224&e)){if((o=(31&e)<<6|l())>=128)return o;throw Error("Invalid continuation byte")}if(224==(240&e)){if((o=(15&e)<<12|l()<<6|l())>=2048)return a(o),o;throw Error("Invalid continuation byte")}if(240==(248&e)&&(o=(7&e)<<18|l()<<12|l()<<6|l())>=65536&&o<=1114111)return o;throw Error("Invalid UTF-8 detected")}e.version="3.0.0",e.encode=function(e){for(var t=i(e),r=t.length,n=-1,o="";++n<r;)o+=u(t[n]);return o},e.decode=function(e){t=i(e),r=t.length,n=0;for(var a,s=[];!1!==(a=c());)s.push(a);return function(e){for(var t,r=e.length,n=-1,i="";++n<r;)(t=e[n])>65535&&(i+=o((t-=65536)>>>10&1023|55296),t=56320|1023&t),i+=o(t);return i}(s)}}(t)},4633:(e,t,r)=>{var n=r(73738).default;function o(){"use strict";e.exports=o=function(){return r},e.exports.__esModule=!0,e.exports.default=e.exports;var t,r={},i=Object.prototype,a=i.hasOwnProperty,s=Object.defineProperty||function(e,t,r){e[t]=r.value},u="function"==typeof Symbol?Symbol:{},l=u.iterator||"@@iterator",c=u.asyncIterator||"@@asyncIterator",f=u.toStringTag||"@@toStringTag";function h(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{h({},"")}catch(t){h=function(e,t,r){return e[t]=r}}function p(e,t,r,n){var o=t&&t.prototype instanceof w?t:w,i=Object.create(o.prototype),a=new L(n||[]);return s(i,"_invoke",{value:C(e,r,a)}),i}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}r.wrap=p;var m="suspendedStart",v="suspendedYield",y="executing",g="completed",b={};function w(){}function x(){}function A(){}var B={};h(B,l,(function(){return this}));var E=Object.getPrototypeOf,F=E&&E(E(M([])));F&&F!==i&&a.call(F,l)&&(B=F);var S=A.prototype=w.prototype=Object.create(B);function k(e){["next","throw","return"].forEach((function(t){h(e,t,(function(e){return this._invoke(t,e)}))}))}function I(e,t){function r(o,i,s,u){var l=d(e[o],e,i);if("throw"!==l.type){var c=l.arg,f=c.value;return f&&"object"==n(f)&&a.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,s,u)}),(function(e){r("throw",e,s,u)})):t.resolve(f).then((function(e){c.value=e,s(c)}),(function(e){return r("throw",e,s,u)}))}u(l.arg)}var o;s(this,"_invoke",{value:function(e,n){function i(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(i,i):i()}})}function C(e,r,n){var o=m;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var u=T(s,n);if(u){if(u===b)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===m)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var l=d(e,r,n);if("normal"===l.type){if(o=n.done?g:v,l.arg===b)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=g,n.method="throw",n.arg=l.arg)}}}function T(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,T(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),b;var i=d(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,b;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,b):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,b)}function R(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(R,this),this.reset(!0)}function M(e){if(e||""===e){var r=e[l];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(a.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(n(e)+" is not iterable")}return x.prototype=A,s(S,"constructor",{value:A,configurable:!0}),s(A,"constructor",{value:x,configurable:!0}),x.displayName=h(A,f,"GeneratorFunction"),r.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===x||"GeneratorFunction"===(t.displayName||t.name))},r.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,A):(e.__proto__=A,h(e,f,"GeneratorFunction")),e.prototype=Object.create(S),e},r.awrap=function(e){return{__await:e}},k(I.prototype),h(I.prototype,c,(function(){return this})),r.AsyncIterator=I,r.async=function(e,t,n,o,i){void 0===i&&(i=Promise);var a=new I(p(e,t,n,o),i);return r.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},k(S),h(S,f,"Generator"),h(S,l,(function(){return this})),h(S,"toString",(function(){return"[object Generator]"})),r.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},r.values=M,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(O),!e)for(var r in this)"t"===r.charAt(0)&&a.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return s.type="throw",s.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=a.call(i,"catchLoc"),l=a.call(i,"finallyLoc");if(u&&l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,b):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),b},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),O(r),b}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;O(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:M(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),b}},r}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},73738:e=>{function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},54756:(e,t,r)=>{var n=r(4633)();e.exports=n;try{regeneratorRuntime=n}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function t(t,r){if(t){if("string"==typeof t)return e(t,r);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(t,r):void 0}}function n(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(e,r)||t(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function a(e){var t=function(e,t){if("object"!=i(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==i(t)?t:t+""}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function u(e,t,r){return t&&s(e.prototype,t),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(e,t){if(t&&("object"==i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}function h(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t)}function p(e,t,r,n,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,o)}function d(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(e){p(i,n,o,a,s,"next",e)}function s(e){p(i,n,o,a,s,"throw",e)}a(void 0)}))}}var m=r(54756),v=r.n(m);function y(r){return function(t){if(Array.isArray(t))return e(t)}(r)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(r)||t(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var g=r(73065),b=r.n(g),w=r(90031),x=r.n(w);function A(e,t,r){return t=c(t),l(e,B()?Reflect.construct(t,r||[],c(e).constructor):t.apply(e,r))}function B(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(B=function(){return!!e})()}const E=function(e){function t(){var e;o(this,t);for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(e=A(this,t,[].concat(n))).type="OperationError",Error.captureStackTrace&&Error.captureStackTrace(e,t),e}return h(t,e),u(t)}(function(e){function t(){var t=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(t,Object.getPrototypeOf(this)),t}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}(Error));function F(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"A-Za-z0-9+/=";if(!e)return"";if("string"==typeof e&&(e=U.strToArrayBuffer(e)),e instanceof ArrayBuffer&&(e=new Uint8Array(e)),64!==(t=U.expandAlphRange(t).join("")).length&&65!==t.length)throw new E(`Invalid Base64 alphabet length (${t.length}): ${t}`);for(var r,n,o,i,a,s,u,l="",c=0;c<e.length;)i=(r=e[c++])>>2,a=(3&r)<<4|(n=e[c++])>>4,s=(15&n)<<2|(o=e[c++])>>6,u=63&o,isNaN(n)?s=u=64:isNaN(o)&&(u=64),l+=t.charAt(i)+t.charAt(a)+t.charAt(s)+t.charAt(u);return l}function S(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"A-Za-z0-9+/=",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"string",n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(!e)return"string"===r?"":[];if(t=t||"A-Za-z0-9+/=",64!==(t=U.expandAlphRange(t).join("")).length&&65!==t.length)throw new E(`Error: Base64 alphabet should be 64 characters long, or 65 with a padding character. Found ${t.length}: ${t}`);if(n){var i=new RegExp("[^"+t.replace(/[[\]\\\-^$]/g,"\\$&")+"]","g");e=e.replace(i,"")}if(o){if(e.length%4==1)throw new E(`Error: Invalid Base64 input length (${e.length}). Cannot be 4n+1, even without padding chars.`);if(65===t.length){var a=t.charAt(64),s=e.indexOf(a);if(s>=0){if(s<e.length-2||e.charAt(e.length-1)!==a)throw new E(`Error: Base64 padding character (${a}) not used in the correct place.`);if(e.length%4!=0)throw new E("Error: Base64 not padded to a multiple of 4.")}}}for(var u,l,c,f,h,p,d,m=[],v=0;v<e.length;){if(f=t.indexOf(e.charAt(v++)||null),h=t.indexOf(e.charAt(v++)||null),p=t.indexOf(e.charAt(v++)||null),d=t.indexOf(e.charAt(v++)||null),o&&(f<0||h<0||p<0||d<0))throw new E("Error: Base64 input contains non-alphabet char(s)");l=(15&h)<<4|p>>2,c=(3&p)<<6|d,(u=f<<2|h>>4)>=0&&u<256&&m.push(u),l>=0&&l<256&&64!==p&&m.push(l),c>=0&&c<256&&64!==d&&m.push(c)}return"string"===r?U.byteArrayToUtf8(m):m}function k(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Auto",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;if(r<1||Math.round(r)!==r)throw new E("Byte length must be a positive integer");if("None"!==t){var n="Auto"===t?/[^a-f\d]|0x/gi:U.regexRep(t);e=e.split(n)}else e=[e];for(var o=[],i=0;i<e.length;i++)for(var a=0;a<e[i].length;a+=r)o.push(parseInt(e[i].substr(a,r),16));return o}function I(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Auto";t=U.charRep(t);var r=[],n=e.split(t);""===n[n.length-1]&&(n=n.slice(0,n.length-1));for(var o=0;o<n.length;o++)r[o]=parseInt(n[o],10);return r}function C(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Space",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8;if(r<1||Math.round(r)!==r)throw new E("Byte length must be a positive integer");var n=U.regexRep(t);e=e.replace(n,"");for(var o=[],i=0;i<e.length;i+=r)o.push(parseInt(e.substr(i,r),2));return o}["Auto"].concat(["Space","Percent","Comma","Semi-colon","Colon","Line feed","CRLF","0x","0x with comma","\\x","None"]);var T=r(48287).Buffer,R=r(65606),O=function(){function e(){o(this,e)}return u(e,null,[{key:"chr",value:function(e){if(e>65535){e-=65536;var t=String.fromCharCode(e>>>10&1023|55296);return e=56320|1023&e,t+String.fromCharCode(e)}return String.fromCharCode(e)}},{key:"ord",value:function(e){if(2===e.length){var t=e.charCodeAt(0),r=e.charCodeAt(1);if(t>=55296&&t<56320&&r>=56320&&r<57344)return 1024*(t-55296)+r-56320+65536}return e.charCodeAt(0)}},{key:"padBytesRight",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=new Array(t);return n.fill(r),y(e).forEach((function(e,t){n[t]=e})),n}},{key:"truncate",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"...";return e.length>t&&(e=e.slice(0,t-r.length)+r),e}},{key:"hex",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return(t="string"==typeof t?e.ord(t):t).toString(16).padStart(r,"0")}},{key:"bin",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return(t="string"==typeof t?e.ord(t):t).toString(2).padStart(r,"0")}},{key:"printable",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return arguments.length>2&&void 0!==arguments[2]&&arguments[2]?e.replace(/[^\x20-\x7f]/g,"."):(e=e.replace(/[\0-\x08\x0B-\x0C\x0E-\x1F\x7F-\x9F\xAD\u0378\u0379\u037F-\u0383\u038B\u038D\u03A2\u0528-\u0530\u0557\u0558\u0560\u0588\u058B-\u058E\u0590\u05C8-\u05CF\u05EB-\u05EF\u05F5-\u0605\u061C\u061D\u06DD\u070E\u070F\u074B\u074C\u07B2-\u07BF\u07FB-\u07FF\u082E\u082F\u083F\u085C\u085D\u085F-\u089F\u08A1\u08AD-\u08E3\u08FF\u0978\u0980\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09FC-\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF2-\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B55\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B78-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BFB-\u0C00\u0C04\u0C0D\u0C11\u0C29\u0C34\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5A-\u0C5F\u0C64\u0C65\u0C70-\u0C77\u0C80\u0C81\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0D01\u0D04\u0D0D\u0D11\u0D3B\u0D3C\u0D45\u0D49\u0D4F-\u0D56\u0D58-\u0D5F\u0D64\u0D65\u0D76-\u0D78\u0D80\u0D81\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DF1\u0DF5-\u0E00\u0E3B-\u0E3E\u0E5C-\u0E80\u0E83\u0E85\u0E86\u0E89\u0E8B\u0E8C\u0E8E-\u0E93\u0E98\u0EA0\u0EA4\u0EA6\u0EA8\u0EA9\u0EAC\u0EBA\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F48\u0F6D-\u0F70\u0F98\u0FBD\u0FCD\u0FDB-\u0FFF\u10C6\u10C8-\u10CC\u10CE\u10CF\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u137D-\u137F\u139A-\u139F\u13F5-\u13FF\u169D-\u169F\u16F1-\u16FF\u170D\u1715-\u171F\u1737-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17DE\u17DF\u17EA-\u17EF\u17FA-\u17FF\u180F\u181A-\u181F\u1878-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191D-\u191F\u192C-\u192F\u193C-\u193F\u1941-\u1943\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DB-\u19DD\u1A1C\u1A1D\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1A9F\u1AAE-\u1AFF\u1B4C-\u1B4F\u1B7D-\u1B7F\u1BF4-\u1BFB\u1C38-\u1C3A\u1C4A-\u1C4C\u1C80-\u1CBF\u1CC8-\u1CCF\u1CF7-\u1CFF\u1DE7-\u1DFB\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FC5\u1FD4\u1FD5\u1FDC\u1FF0\u1FF1\u1FF5\u1FFF\u200B-\u200F\u202A-\u202E\u2060-\u206F\u2072\u2073\u208F\u209D-\u209F\u20BB-\u20CF\u20F1-\u20FF\u218A-\u218F\u23F4-\u23FF\u2427-\u243F\u244B-\u245F\u2700\u2B4D-\u2B4F\u2B5A-\u2BFF\u2C2F\u2C5F\u2CF4-\u2CF8\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D71-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E3C-\u2E7F\u2E9A\u2EF4-\u2EFF\u2FD6-\u2FEF\u2FFC-\u2FFF\u3040\u3097\u3098\u3100-\u3104\u312E-\u3130\u318F\u31BB-\u31BF\u31E4-\u31EF\u321F\u32FF\u4DB6-\u4DBF\u9FCD-\u9FFF\uA48D-\uA48F\uA4C7-\uA4CF\uA62C-\uA63F\uA698-\uA69E\uA6F8-\uA6FF\uA78F\uA794-\uA79F\uA7AB-\uA7F7\uA82C-\uA82F\uA83A-\uA83F\uA878-\uA87F\uA8C5-\uA8CD\uA8DA-\uA8DF\uA8FC-\uA8FF\uA954-\uA95E\uA97D-\uA97F\uA9CE\uA9DA-\uA9DD\uA9E0-\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A\uAA5B\uAA7C-\uAA7F\uAAC3-\uAADA\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F-\uABBF\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBC2-\uFBD2\uFD40-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFE\uFDFF\uFE1A-\uFE1F\uFE27-\uFE2F\uFE53\uFE67\uFE6C-\uFE6F\uFE75\uFEFD-\uFF00\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFDF\uFFE7\uFFEF-\uFFFB\uFFFE\uFFFF]/g,"."),t||(e=e.replace(/[\x09-\x10\u2028\u2029]/g,".")),e)}},{key:"escapeWhitespace",value:function(e){return e.replace(/[\x09-\x10]/g,(function(e){return String.fromCharCode(57344+e.charCodeAt(0))}))}},{key:"parseEscapedChars",value:function(e){return e.replace(/\\([abfnrtv'"]|[0-3][0-7]{2}|[0-7]{1,2}|x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]{1,6}\}|\\)/g,(function(e,t){switch(t[0]){case"\\":return"\\";case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":return String.fromCharCode(parseInt(t,8));case"a":return String.fromCharCode(7);case"b":return"\b";case"t":return"\t";case"n":return"\n";case"v":return"\v";case"f":return"\f";case"r":return"\r";case'"':return'"';case"'":return"'";case"x":return String.fromCharCode(parseInt(t.substr(1),16));case"u":return"{"===t[1]?String.fromCodePoint(parseInt(t.slice(2,-1),16)):String.fromCharCode(parseInt(t.substr(1),16))}}))}},{key:"escapeRegex",value:function(e){return e.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}},{key:"expandAlphRange",value:function(t){for(var r=[],n=0;n<t.length;n++)if(n<t.length-2&&"-"===t[n+1]&&"\\"!==t[n]){for(var o=e.ord(t[n]),i=e.ord(t[n+2]),a=o;a<=i;a++)r.push(e.chr(a));n+=2}else n<t.length-2&&"\\"===t[n]&&"-"===t[n+1]?(r.push("-"),n++):r.push(t[n]);return r}},{key:"convertToByteArray",value:function(t,r){switch(r.toLowerCase()){case"binary":return C(t);case"hex":return k(t);case"decimal":return I(t);case"base64":return S(t,null,"byteArray");case"utf8":return e.strToUtf8ByteArray(t);default:return e.strToByteArray(t)}}},{key:"convertToByteString",value:function(t,r){switch(r.toLowerCase()){case"binary":return e.byteArrayToChars(C(t));case"hex":return e.byteArrayToChars(k(t));case"decimal":return e.byteArrayToChars(I(t));case"base64":return e.byteArrayToChars(S(t,null,"byteArray"));case"utf8":return x().encode(t);default:return t}}},{key:"byteArrayToInt",value:function(e,t){var r=0;if("big"===t)for(var n=0;n<e.length;n++)r=256*r+e[n];else for(var o=e.length-1;o>=0;o--)r=256*r+e[o];return r}},{key:"intToByteArray",value:function(e,t,r){var n=new Array(t);if("little"===r)for(var o=0;o<t;o++)n[o]=255&e,e>>>=8;else for(var i=t-1;i>=0;i--)n[i]=255&e,e>>>=8;return n}},{key:"strToArrayBuffer",value:function(t){if(b().debug(`Converting string[${null==t?void 0:t.length}] to array buffer`),!t)return new ArrayBuffer;for(var r,n=new Uint8Array(t.length),o=t.length;o--;)if(r=t.charCodeAt(o),n[o]=r,r>255)return e.strToUtf8ArrayBuffer(t);return n.buffer}},{key:"strToUtf8ArrayBuffer",value:function(e){if(b().debug(`Converting string[${null==e?void 0:e.length}] to UTF8 array buffer`),!e)return new ArrayBuffer;var t=new TextEncoder("utf-8").encode(e);return e.length!==t.length&&(P()&&self&&"function"==typeof self.setOption?self.setOption("attemptHighlight",!1):M()&&(window.app.options.attemptHighlight=!1)),t.buffer}},{key:"strToByteArray",value:function(t){if(b().debug(`Converting string[${null==t?void 0:t.length}] to byte array`),!t)return[];for(var r,n=new Array(t.length),o=t.length;o--;)if(r=t.charCodeAt(o),n[o]=r,r>255)return e.strToUtf8ByteArray(t);return n}},{key:"strToUtf8ByteArray",value:function(t){if(b().debug(`Converting string[${null==t?void 0:t.length}] to UTF8 byte array`),!t)return[];var r=x().encode(t);return t.length!==r.length&&(P()?self.setOption("attemptHighlight",!1):M()&&(window.app.options.attemptHighlight=!1)),e.strToByteArray(r)}},{key:"strToCharcode",value:function(t){if(b().debug(`Converting string[${null==t?void 0:t.length}] to charcode`),!t)return[];for(var r=[],n=0;n<t.length;n++){var o=t.charCodeAt(n);if(n<t.length-1&&o>=55296&&o<56320){var i=t[n+1].charCodeAt(0);i>=56320&&i<57344&&(o=e.ord(t[n]+t[++n]))}r.push(o)}return r}},{key:"byteArrayToUtf8",value:function(t){var r;if(b().debug(`Converting byte array[${null===(r=t)||void 0===r?void 0:r.length}] to UTF8`),!t||!t.length)return"";t instanceof Uint8Array||(t=new Uint8Array(t));try{var n=new TextDecoder("utf-8",{fatal:!0}).decode(t);return n.length!==t.length&&(P()?self.setOption("attemptHighlight",!1):M()&&(window.app.options.attemptHighlight=!1)),n}catch(r){return e.byteArrayToChars(t)}}},{key:"byteArrayToChars",value:function(e){if(b().debug(`Converting byte array[${null==e?void 0:e.length}] to chars`),!e||!e.length)return"";for(var t="",r=0;r<e.length;r+=2e4)t+=String.fromCharCode.apply(String,y(e.slice(r,r+2e4)));return t}},{key:"arrayBufferToStr",value:function(t){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(b().debug(`Converting array buffer[${null==t?void 0:t.byteLength}] to str`),!t||!t.byteLength)return"";var n=new Uint8Array(t);return r?e.byteArrayToUtf8(n):e.byteArrayToChars(n)}},{key:"calculateShannonEntropy",value:function(e){e instanceof ArrayBuffer&&(e=new Uint8Array(e));var t,r=[],n=new Array(256).fill(0);for(t=0;t<e.length;t++)n[e[t]]++;for(t=0;t<n.length;t++)n[t]>0&&r.push(n[t]/e.length);var o,i=0;for(t=0;t<r.length;t++)i+=(o=r[t])*Math.log(o)/Math.log(2);return-i}},{key:"parseCSV",value:function(e){var t,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[","],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:["\n","\r"],i=!1,a=!1,s="",u=[],l=[];e.length&&"\ufeff"===e[0]&&(e=e.substr(1));for(var c=0;c<e.length;c++)t=e[c],r=e[c+1]||"",i?(s+=t,i=!1):'"'!==t||a?'"'===t&&a?'"'===r?i=!0:a=!1:!a&&n.indexOf(t)>=0?(u.push(s),s=""):!a&&o.indexOf(t)>=0?(u.push(s),s="",l.push(u),u=[],o.indexOf(r)>=0&&r!==t&&c++):s+=t:a=!0;return u.length&&(u.push(s),l.push(u)),l}},{key:"stripHtmlTags",value:function(e){function t(e,r){var n=r.replace(e,"");return n.length===r.length?n:t(e,n)}return arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(e=t(/<script[^>]*>(\s|\S)*?<\/script[^>]*>/gi,e),e=t(/<style[^>]*>(\s|\S)*?<\/style[^>]*>/gi,e)),t(/<[^>]+>/g,e)}},{key:"escapeHtml",value:function(e){var t={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","\0":""};return e?e.replace(/[&<>"'`\u0000]/g,(function(e){return t[e]})):e}},{key:"unescapeHtml",value:function(e){var t={"&":"&","<":"<",">":">",""":'"',"'":"'","/":"/","`":"`","":"\0"};return e.replace(/(&#?x?[a-z0-9]{2,4};|\ue000)/gi,(function(e){return t[e]||e}))}},{key:"toTitleCase",value:function(e){return e.replace(/\w\S*/g,(function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()}))}},{key:"encodeURIFragment",value:function(e){var t={"%2D":"-","%2E":".","%5F":"_","%7E":"~","%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2C":",","%3B":";","%3A":":","%40":"@","%2F":"/","%3F":"?"};return(e=encodeURIComponent(e)).replace(/%[0-9A-F]{2}/g,(function(e){return t[e]||e}))}},{key:"generatePrettyRecipe",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r="",n="",o="",i="",a="";return e.forEach((function(e){n=e.op.replace(/ /g,"_"),o=JSON.stringify(e.args).slice(1,-1).replace(/'/g,"\\'").replace(/"((?:[^"\\]|\\.)*)"/g,"'$1'").replace(/\\"/g,'"'),i=e.disabled?"/disabled":"",a=e.breakpoint?"/breakpoint":"",r+=`${n}(${o}${i}${a})`,t&&(r+="\n")})),r}},{key:"parseRecipeConfig",value:function(e){if(0===(e=e.trim()).length)return[];if("["===e[0])return JSON.parse(e);var t,r;e=e.replace(/\n/g,"");for(var n=/([^(]+)\(((?:'[^'\\]*(?:\\.[^'\\]*)*'|[^)/'])*)(\/[^)]+)?\)/g,o=[];t=n.exec(e);){r="["+(r=t[2].replace(/"/g,'\\"').replace(/(^|,|{|:)'/g,'$1"').replace(/([^\\]|(?:\\\\)+)'(,|:|}|$)/g,'$1"$2').replace(/\\'/g,"'"))+"]";var i={op:t[1].replace(/_/g," "),args:JSON.parse(r)};t[3]&&t[3].indexOf("disabled")>0&&(i.disabled=!0),t[3]&&t[3].indexOf("breakpoint")>0&&(i.breakpoint=!0),o.push(i)}return o}},{key:"displayFilesAsHTML",value:(t=d(v().mark((function t(r){var n,o,i,a,s;return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=function(t){return`<div class='card' style='white-space: normal;'>\n <div class='card-header'>\n <h6 class="mb-0">\n ${e.escapeHtml(t.name)}\n </h6>\n </div>\n </div>`},o=function(t,r){if(r.startsWith("image")){var n="data:";return n+=r+";","<img style='max-width: 100%;' src='"+(n+="base64,"+F(t))+"'>"}return`<pre>${e.escapeHtml(e.arrayBufferToStr(t.buffer))}</pre>`},i=function(){var t=d(v().mark((function t(r,n){var i,a,s,u;return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.readFile(r);case 2:return i=t.sent,a=new Blob([i],{type:r.type||"octet/stream"}),s=URL.createObjectURL(a),u=`<div class='card' style='white-space: normal;'>\n <div class='card-header' id='heading${n}'>\n <h6 class='mb-0'>\n <a class='collapsed'\n data-toggle='collapse'\n href='#collapse${n}'\n aria-expanded='false'\n aria-controls='collapse${n}'\n title="Show/hide contents of '${e.escapeHtml(r.name)}'">\n ${e.escapeHtml(r.name)}</a>\n <span class='float-right' style="margin-top: -3px">\n ${r.size.toLocaleString()} bytes\n <a title="Download ${e.escapeHtml(r.name)}"\n href="${s}"\n download="${e.escapeHtml(r.name)}"\n data-toggle="tooltip">\n <i class="material-icons" style="vertical-align: bottom">save</i>\n </a>\n <a title="Move to input"\n href="#"\n blob-url="${s}"\n file-name="${e.escapeHtml(r.name)}"\n class="extract-file"\n data-toggle="tooltip">\n <i class="material-icons" style="vertical-align: bottom">open_in_browser</i>\n </a>\n </span>\n </h6>\n </div>\n <div id='collapse${n}' class='collapse' aria-labelledby='heading${n}' data-parent="#files">\n <div class='card-body'>\n ${o(i,r.type)}\n </div>\n </div>\n </div>`,t.abrupt("return",u);case 7:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),a=`<div style='padding: 5px; white-space: normal;'>\n ${r.length} file(s) found\n </div><div id="files" style="padding: 20px">`,s=0;case 5:if(!(s<r.length)){t.next=17;break}if(!r[s].name.endsWith("/")){t.next=10;break}a+=n(r[s]),t.next=14;break;case 10:return t.t0=a,t.next=13,i(r[s],s);case 13:a=t.t0+=t.sent;case 14:s++,t.next=5;break;case 17:return t.abrupt("return",a+="</div>");case 18:case"end":return t.stop()}}),t)}))),function(e){return t.apply(this,arguments)})},{key:"parseURIParams",value:function(e){if(""===e)return{};"?"!==e[0]&&"#"!==e[0]||(e=e.substr(1));for(var t=e.split("&"),r={},n=0;n<t.length;n++){var o=t[n].split("=");2!==o.length?r[t[n]]=!0:r[o[0]]=decodeURIComponent(o[1].replace(/\+/g," "))}return r}},{key:"readFile",value:function(e){return L()?T.from(e).buffer:new Promise((function(t,r){var n=new FileReader,o=new Uint8Array(e.size),i=0,a=10485760,s=function(){if(i>=e.size)t(o);else{var r=e.slice(i,i+a);n.readAsArrayBuffer(r)}};n.onload=function(e){o.set(new Uint8Array(n.result),i),i+=a,s()},n.onerror=function(e){r(n.error.message)},s()}))}},{key:"readFileSync",value:function(e){if(!L())throw new TypeError("Browser environment cannot support readFileSync");return Uint8Array.from(e.data).buffer}},{key:"mod",value:function(e,t){return(e%t+t)%t}},{key:"gcd",value:function(t,r){return r?e.gcd(r,t%r):t}},{key:"modInv",value:function(e,t){e%=t;for(var r=1;r<t;r++)if(e*r%26==1)return r}},{key:"charRep",value:function(e){return{Space:" ",Percent:"%",Comma:",","Semi-colon":";",Colon:":",Tab:"\t","Line feed":"\n",CRLF:"\r\n","Forward slash":"/",Backslash:"\\","0x":"0x","\\x":"\\x","Nothing (separate chars)":"",None:""}[e]}},{key:"regexRep",value:function(e){return{Space:/\s+/g,Percent:/%/g,Comma:/,/g,"Semi-colon":/;/g,Colon:/:/g,"Line feed":/\n/g,CRLF:/\r\n/g,"Forward slash":/\//g,Backslash:/\\/g,"0x with comma":/,?0x/g,"0x":/0x/g,"\\x":/\\x/g,None:/\s+/g}[e]}},{key:"chunked",value:v().mark((function e(t,r){var n,o,i,a;return v().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t[Symbol.iterator]();case 1:o=[],i=0;case 4:if(!(i<r)){e.next=12;break}if(!(a=n.next()).done){e.next=8;break}return e.abrupt("break",12);case 8:o.push(a.value);case 9:i++,e.next=4;break;case 12:if(!o.length){e.next=17;break}return e.next=15,o;case 15:e.next=18;break;case 17:return e.abrupt("return");case 18:e.next=1;break;case 20:case"end":return e.stop()}}),e)}))}]);var t}();function L(){return void 0!==R&&null!=R.versions&&null!=R.versions.node}function M(){return"object"==typeof window}function P(){return"function"==typeof importScripts}const U=O;function D(e,t,r){return t=c(t),l(e,N()?Reflect.construct(t,r||[],c(e).constructor):t.apply(e,r))}function N(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(N=function(){return!!e})()}Array.prototype.unique=function(){for(var e={},t=[],r=0,n=this.length;r<n;r++)Object.prototype.hasOwnProperty.call(e,this[r])||(t.push(this[r]),e[this[r]]=1);return t},Array.prototype.max=function(){return Math.max.apply(null,this)},Array.prototype.min=function(){return Math.min.apply(null,this)},Array.prototype.sum=function(){return this.reduce((function(e,t){return e+t}),0)},Array.prototype.equals=function(e){if(!e)return!1;var t=this.length;if(t!==e.length)return!1;for(;t--;)if(this[t]!==e[t])return!1;return!0},String.prototype.count=function(e){return this.split(e).length-1},String.prototype.padStart||(String.prototype.padStart=function(e,t){return e|=0,t=String(void 0!==t?t:" "),this.length>e?String(this):((e-=this.length)>t.length&&(t+=t.repeat(e/t.length)),t.slice(0,e)+String(this))}),String.prototype.padEnd||(String.prototype.padEnd=function(e,t){return e|=0,t=String(void 0!==t?t:" "),this.length>e?String(this):((e-=this.length)>t.length&&(t+=t.repeat(e/t.length)),String(this)+t.slice(0,e))});const _=function(e){function t(){var e;o(this,t);for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(e=D(this,t,[].concat(n))).type="DishError",Error.captureStackTrace&&Error.captureStackTrace(e,t),e}return h(t,e),u(t)}(function(e){function t(){var t=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(t,Object.getPrototypeOf(this)),t}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}(Error));var $=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,X=Math.ceil,j=Math.floor,G="[BigNumber Error] ",Z=G+"Number primitive has more than 15 significant digits: ",W=1e14,H=14,Q=9007199254740991,V=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],Y=1e7,J=1e9;function z(e){var t=0|e;return e>0||e===t?t:t-1}function q(e){for(var t,r,n=1,o=e.length,i=e[0]+"";n<o;){for(t=e[n++]+"",r=H-t.length;r--;t="0"+t);i+=t}for(o=i.length;48===i.charCodeAt(--o););return i.slice(0,o+1||1)}function K(e,t){var r,n,o=e.c,i=t.c,a=e.s,s=t.s,u=e.e,l=t.e;if(!a||!s)return null;if(r=o&&!o[0],n=i&&!i[0],r||n)return r?n?0:-s:a;if(a!=s)return a;if(r=a<0,n=u==l,!o||!i)return n?0:!o^r?1:-1;if(!n)return u>l^r?1:-1;for(s=(u=o.length)<(l=i.length)?u:l,a=0;a<s;a++)if(o[a]!=i[a])return o[a]>i[a]^r?1:-1;return u==l?0:u>l^r?1:-1}function ee(e,t,r,n){if(e<t||e>r||e!==j(e))throw Error(G+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function te(e){var t=e.c.length-1;return z(e.e/H)==t&&e.c[t]%2!=0}function re(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function ne(e,t,r){var n,o;if(t<0){for(o=r+".";++t;o+=r);e=o+e}else if(++t>(n=e.length)){for(o=r,t-=n;--t;o+=r);e+=o}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}var oe=function e(t){var r,n,o,i,a,s,u,l,c,f,h=S.prototype={constructor:S,toString:null,valueOf:null},p=new S(1),d=20,m=4,v=-7,y=21,g=-1e7,b=1e7,w=!1,x=1,A=0,B={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},E="0123456789abcdefghijklmnopqrstuvwxyz",F=!0;function S(e,t){var r,i,a,s,u,l,c,f,h=this;if(!(h instanceof S))return new S(e,t);if(null==t){if(e&&!0===e._isBigNumber)return h.s=e.s,void(!e.c||e.e>b?h.c=h.e=null:e.e<g?h.c=[h.e=0]:(h.e=e.e,h.c=e.c.slice()));if((l="number"==typeof e)&&0*e==0){if(h.s=1/e<0?(e=-e,-1):1,e===~~e){for(s=0,u=e;u>=10;u/=10,s++);return void(s>b?h.c=h.e=null:(h.e=s,h.c=[e]))}f=String(e)}else{if(!$.test(f=String(e)))return o(h,f,l);h.s=45==f.charCodeAt(0)?(f=f.slice(1),-1):1}(s=f.indexOf("."))>-1&&(f=f.replace(".","")),(u=f.search(/e/i))>0?(s<0&&(s=u),s+=+f.slice(u+1),f=f.substring(0,u)):s<0&&(s=f.length)}else{if(ee(t,2,E.length,"Base"),10==t&&F)return T(h=new S(e),d+h.e+1,m);if(f=String(e),l="number"==typeof e){if(0*e!=0)return o(h,f,l,t);if(h.s=1/e<0?(f=f.slice(1),-1):1,S.DEBUG&&f.replace(/^0\.0*|\./,"").length>15)throw Error(Z+e)}else h.s=45===f.charCodeAt(0)?(f=f.slice(1),-1):1;for(r=E.slice(0,t),s=u=0,c=f.length;u<c;u++)if(r.indexOf(i=f.charAt(u))<0){if("."==i){if(u>s){s=c;continue}}else if(!a&&(f==f.toUpperCase()&&(f=f.toLowerCase())||f==f.toLowerCase()&&(f=f.toUpperCase()))){a=!0,u=-1,s=0;continue}return o(h,String(e),l,t)}l=!1,(s=(f=n(f,t,10,h.s)).indexOf("."))>-1?f=f.replace(".",""):s=f.length}for(u=0;48===f.charCodeAt(u);u++);for(c=f.length;48===f.charCodeAt(--c););if(f=f.slice(u,++c)){if(c-=u,l&&S.DEBUG&&c>15&&(e>Q||e!==j(e)))throw Error(Z+h.s*e);if((s=s-u-1)>b)h.c=h.e=null;else if(s<g)h.c=[h.e=0];else{if(h.e=s,h.c=[],u=(s+1)%H,s<0&&(u+=H),u<c){for(u&&h.c.push(+f.slice(0,u)),c-=H;u<c;)h.c.push(+f.slice(u,u+=H));u=H-(f=f.slice(u)).length}else u-=c;for(;u--;f+="0");h.c.push(+f)}}else h.c=[h.e=0]}function k(e,t,r,n){var o,i,a,s,u;if(null==r?r=m:ee(r,0,8),!e.c)return e.toString();if(o=e.c[0],a=e.e,null==t)u=q(e.c),u=1==n||2==n&&(a<=v||a>=y)?re(u,a):ne(u,a,"0");else if(i=(e=T(new S(e),t,r)).e,s=(u=q(e.c)).length,1==n||2==n&&(t<=i||i<=v)){for(;s<t;u+="0",s++);u=re(u,i)}else if(t-=a,u=ne(u,i,"0"),i+1>s){if(--t>0)for(u+=".";t--;u+="0");}else if((t+=i-s)>0)for(i+1==s&&(u+=".");t--;u+="0");return e.s<0&&o?"-"+u:u}function I(e,t){for(var r,n,o=1,i=new S(e[0]);o<e.length;o++)(!(n=new S(e[o])).s||(r=K(i,n))===t||0===r&&i.s===t)&&(i=n);return i}function C(e,t,r){for(var n=1,o=t.length;!t[--o];t.pop());for(o=t[0];o>=10;o/=10,n++);return(r=n+r*H-1)>b?e.c=e.e=null:r<g?e.c=[e.e=0]:(e.e=r,e.c=t),e}function T(e,t,r,n){var o,i,a,s,u,l,c,f=e.c,h=V;if(f){e:{for(o=1,s=f[0];s>=10;s/=10,o++);if((i=t-o)<0)i+=H,a=t,u=f[l=0],c=j(u/h[o-a-1]%10);else if((l=X((i+1)/H))>=f.length){if(!n)break e;for(;f.length<=l;f.push(0));u=c=0,o=1,a=(i%=H)-H+1}else{for(u=s=f[l],o=1;s>=10;s/=10,o++);c=(a=(i%=H)-H+o)<0?0:j(u/h[o-a-1]%10)}if(n=n||t<0||null!=f[l+1]||(a<0?u:u%h[o-a-1]),n=r<4?(c||n)&&(0==r||r==(e.s<0?3:2)):c>5||5==c&&(4==r||n||6==r&&(i>0?a>0?u/h[o-a]:0:f[l-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,n?(t-=e.e+1,f[0]=h[(H-t%H)%H],e.e=-t||0):f[0]=e.e=0,e;if(0==i?(f.length=l,s=1,l--):(f.length=l+1,s=h[H-i],f[l]=a>0?j(u/h[o-a]%h[a])*s:0),n)for(;;){if(0==l){for(i=1,a=f[0];a>=10;a/=10,i++);for(a=f[0]+=s,s=1;a>=10;a/=10,s++);i!=s&&(e.e++,f[0]==W&&(f[0]=1));break}if(f[l]+=s,f[l]!=W)break;f[l--]=0,s=1}for(i=f.length;0===f[--i];f.pop());}e.e>b?e.c=e.e=null:e.e<g&&(e.c=[e.e=0])}return e}function R(e){var t,r=e.e;return null===r?e.toString():(t=q(e.c),t=r<=v||r>=y?re(t,r):ne(t,r,"0"),e.s<0?"-"+t:t)}return S.clone=e,S.ROUND_UP=0,S.ROUND_DOWN=1,S.ROUND_CEIL=2,S.ROUND_FLOOR=3,S.ROUND_HALF_UP=4,S.ROUND_HALF_DOWN=5,S.ROUND_HALF_EVEN=6,S.ROUND_HALF_CEIL=7,S.ROUND_HALF_FLOOR=8,S.EUCLID=9,S.config=S.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(G+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(ee(r=e[t],0,J,t),d=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(ee(r=e[t],0,8,t),m=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(ee(r[0],-J,0,t),ee(r[1],0,J,t),v=r[0],y=r[1]):(ee(r,-J,J,t),v=-(y=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)ee(r[0],-J,-1,t),ee(r[1],1,J,t),g=r[0],b=r[1];else{if(ee(r,-J,J,t),!r)throw Error(G+t+" cannot be zero: "+r);g=-(b=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(G+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw w=!r,Error(G+"crypto unavailable");w=r}else w=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(ee(r=e[t],0,9,t),x=r),e.hasOwnProperty(t="POW_PRECISION")&&(ee(r=e[t],0,J,t),A=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(G+t+" not an object: "+r);B=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(G+t+" invalid: "+r);F="0123456789"==r.slice(0,10),E=r}}return{DECIMAL_PLACES:d,ROUNDING_MODE:m,EXPONENTIAL_AT:[v,y],RANGE:[g,b],CRYPTO:w,MODULO_MODE:x,POW_PRECISION:A,FORMAT:B,ALPHABET:E}},S.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!S.DEBUG)return!0;var t,r,n=e.c,o=e.e,i=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===i||-1===i)&&o>=-J&&o<=J&&o===j(o)){if(0===n[0]){if(0===o&&1===n.length)return!0;break e}if((t=(o+1)%H)<1&&(t+=H),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||r>=W||r!==j(r))break e;if(0!==r)return!0}}}else if(null===n&&null===o&&(null===i||1===i||-1===i))return!0;throw Error(G+"Invalid BigNumber: "+e)},S.maximum=S.max=function(){return I(arguments,-1)},S.minimum=S.min=function(){return I(arguments,1)},S.random=(i=9007199254740992,a=Math.random()*i&2097151?function(){return j(Math.random()*i)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,o,i,s=0,u=[],l=new S(p);if(null==e?e=d:ee(e,0,J),o=X(e/H),w)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(o*=2));s<o;)(i=131072*t[s]+(t[s+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[s]=r[0],t[s+1]=r[1]):(u.push(i%1e14),s+=2);s=o/2}else{if(!crypto.randomBytes)throw w=!1,Error(G+"crypto unavailable");for(t=crypto.randomBytes(o*=7);s<o;)(i=281474976710656*(31&t[s])+1099511627776*t[s+1]+4294967296*t[s+2]+16777216*t[s+3]+(t[s+4]<<16)+(t[s+5]<<8)+t[s+6])>=9e15?crypto.randomBytes(7).copy(t,s):(u.push(i%1e14),s+=7);s=o/7}if(!w)for(;s<o;)(i=a())<9e15&&(u[s++]=i%1e14);for(o=u[--s],e%=H,o&&e&&(i=V[H-e],u[s]=j(o/i)*i);0===u[s];u.pop(),s--);if(s<0)u=[n=0];else{for(n=-1;0===u[0];u.splice(0,1),n-=H);for(s=1,i=u[0];i>=10;i/=10,s++);s<H&&(n-=H-s)}return l.e=n,l.c=u,l}),S.sum=function(){for(var e=1,t=arguments,r=new S(t[0]);e<t.length;)r=r.plus(t[e++]);return r},n=function(){var e="0123456789";function t(e,t,r,n){for(var o,i,a=[0],s=0,u=e.length;s<u;){for(i=a.length;i--;a[i]*=t);for(a[0]+=n.indexOf(e.charAt(s++)),o=0;o<a.length;o++)a[o]>r-1&&(null==a[o+1]&&(a[o+1]=0),a[o+1]+=a[o]/r|0,a[o]%=r)}return a.reverse()}return function(n,o,i,a,s){var u,l,c,f,h,p,v,y,g=n.indexOf("."),b=d,w=m;for(g>=0&&(f=A,A=0,n=n.replace(".",""),p=(y=new S(o)).pow(n.length-g),A=f,y.c=t(ne(q(p.c),p.e,"0"),10,i,e),y.e=y.c.length),c=f=(v=t(n,o,i,s?(u=E,e):(u=e,E))).length;0==v[--f];v.pop());if(!v[0])return u.charAt(0);if(g<0?--c:(p.c=v,p.e=c,p.s=a,v=(p=r(p,y,b,w,i)).c,h=p.r,c=p.e),g=v[l=c+b+1],f=i/2,h=h||l<0||null!=v[l+1],h=w<4?(null!=g||h)&&(0==w||w==(p.s<0?3:2)):g>f||g==f&&(4==w||h||6==w&&1&v[l-1]||w==(p.s<0?8:7)),l<1||!v[0])n=h?ne(u.charAt(1),-b,u.charAt(0)):u.charAt(0);else{if(v.length=l,h)for(--i;++v[--l]>i;)v[l]=0,l||(++c,v=[1].concat(v));for(f=v.length;!v[--f];);for(g=0,n="";g<=f;n+=u.charAt(v[g++]));n=ne(n,c,u.charAt(0))}return n}}(),r=function(){function e(e,t,r){var n,o,i,a,s=0,u=e.length,l=t%Y,c=t/Y|0;for(e=e.slice();u--;)s=((o=l*(i=e[u]%Y)+(n=c*i+(a=e[u]/Y|0)*l)%Y*Y+s)/r|0)+(n/Y|0)+c*a,e[u]=o%r;return s&&(e=[s].concat(e)),e}function t(e,t,r,n){var o,i;if(r!=n)i=r>n?1:-1;else for(o=i=0;o<r;o++)if(e[o]!=t[o]){i=e[o]>t[o]?1:-1;break}return i}function r(e,t,r,n){for(var o=0;r--;)e[r]-=o,o=e[r]<t[r]?1:0,e[r]=o*n+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,o,i,a,s){var u,l,c,f,h,p,d,m,v,y,g,b,w,x,A,B,E,F=n.s==o.s?1:-1,k=n.c,I=o.c;if(!(k&&k[0]&&I&&I[0]))return new S(n.s&&o.s&&(k?!I||k[0]!=I[0]:I)?k&&0==k[0]||!I?0*F:F/0:NaN);for(v=(m=new S(F)).c=[],F=i+(l=n.e-o.e)+1,s||(s=W,l=z(n.e/H)-z(o.e/H),F=F/H|0),c=0;I[c]==(k[c]||0);c++);if(I[c]>(k[c]||0)&&l--,F<0)v.push(1),f=!0;else{for(x=k.length,B=I.length,c=0,F+=2,(h=j(s/(I[0]+1)))>1&&(I=e(I,h,s),k=e(k,h,s),B=I.length,x=k.length),w=B,g=(y=k.slice(0,B)).length;g<B;y[g++]=0);E=I.slice(),E=[0].concat(E),A=I[0],I[1]>=s/2&&A++;do{if(h=0,(u=t(I,y,B,g))<0){if(b=y[0],B!=g&&(b=b*s+(y[1]||0)),(h=j(b/A))>1)for(h>=s&&(h=s-1),d=(p=e(I,h,s)).length,g=y.length;1==t(p,y,d,g);)h--,r(p,B<d?E:I,d,s),d=p.length,u=1;else 0==h&&(u=h=1),d=(p=I.slice()).length;if(d<g&&(p=[0].concat(p)),r(y,p,g,s),g=y.length,-1==u)for(;t(I,y,B,g)<1;)h++,r(y,B<g?E:I,g,s),g=y.length}else 0===u&&(h++,y=[0]);v[c++]=h,y[0]?y[g++]=k[w]||0:(y=[k[w]],g=1)}while((w++<x||null!=y[0])&&F--);f=null!=y[0],v[0]||v.splice(0,1)}if(s==W){for(c=1,F=v[0];F>=10;F/=10,c++);T(m,i+(m.e=c+l*H-1)+1,a,f)}else m.e=l,m.r=+f;return m}}(),s=/^(-?)0([xbo])(?=\w[\w.]*$)/i,u=/^([^.]+)\.$/,l=/^\.([^.]+)$/,c=/^-?(Infinity|NaN)$/,f=/^\s*\+(?=[\w.])|^\s+|\s+$/g,o=function(e,t,r,n){var o,i=r?t:t.replace(f,"");if(c.test(i))e.s=isNaN(i)?null:i<0?-1:1;else{if(!r&&(i=i.replace(s,(function(e,t,r){return o="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=o?e:t})),n&&(o=n,i=i.replace(u,"$1").replace(l,"0.$1")),t!=i))return new S(i,o);if(S.DEBUG)throw Error(G+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},h.absoluteValue=h.abs=function(){var e=new S(this);return e.s<0&&(e.s=1),e},h.comparedTo=function(e,t){return K(this,new S(e,t))},h.decimalPlaces=h.dp=function(e,t){var r,n,o,i=this;if(null!=e)return ee(e,0,J),null==t?t=m:ee(t,0,8),T(new S(i),e+i.e+1,t);if(!(r=i.c))return null;if(n=((o=r.length-1)-z(this.e/H))*H,o=r[o])for(;o%10==0;o/=10,n--);return n<0&&(n=0),n},h.dividedBy=h.div=function(e,t){return r(this,new S(e,t),d,m)},h.dividedToIntegerBy=h.idiv=function(e,t){return r(this,new S(e,t),0,1)},h.exponentiatedBy=h.pow=function(e,t){var r,n,o,i,a,s,u,l,c=this;if((e=new S(e)).c&&!e.isInteger())throw Error(G+"Exponent not an integer: "+R(e));if(null!=t&&(t=new S(t)),a=e.e>14,!c.c||!c.c[0]||1==c.c[0]&&!c.e&&1==c.c.length||!e.c||!e.c[0])return l=new S(Math.pow(+R(c),a?e.s*(2-te(e)):+R(e))),t?l.mod(t):l;if(s=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new S(NaN);(n=!s&&c.isInteger()&&t.isInteger())&&(c=c.mod(t))}else{if(e.e>9&&(c.e>0||c.e<-1||(0==c.e?c.c[0]>1||a&&c.c[1]>=24e7:c.c[0]<8e13||a&&c.c[0]<=9999975e7)))return i=c.s<0&&te(e)?-0:0,c.e>-1&&(i=1/i),new S(s?1/i:i);A&&(i=X(A/H+2))}for(a?(r=new S(.5),s&&(e.s=1),u=te(e)):u=(o=Math.abs(+R(e)))%2,l=new S(p);;){if(u){if(!(l=l.times(c)).c)break;i?l.c.length>i&&(l.c.length=i):n&&(l=l.mod(t))}if(o){if(0===(o=j(o/2)))break;u=o%2}else if(T(e=e.times(r),e.e+1,1),e.e>14)u=te(e);else{if(0==(o=+R(e)))break;u=o%2}c=c.times(c),i?c.c&&c.c.length>i&&(c.c.length=i):n&&(c=c.mod(t))}return n?l:(s&&(l=p.div(l)),t?l.mod(t):i?T(l,A,m,void 0):l)},h.integerValue=function(e){var t=new S(this);return null==e?e=m:ee(e,0,8),T(t,t.e+1,e)},h.isEqualTo=h.eq=function(e,t){return 0===K(this,new S(e,t))},h.isFinite=function(){return!!this.c},h.isGreaterThan=h.gt=function(e,t){return K(this,new S(e,t))>0},h.isGreaterThanOrEqualTo=h.gte=function(e,t){return 1===(t=K(this,new S(e,t)))||0===t},h.isInteger=function(){return!!this.c&&z(this.e/H)>this.c.length-2},h.isLessThan=h.lt=function(e,t){return K(this,new S(e,t))<0},h.isLessThanOrEqualTo=h.lte=function(e,t){return-1===(t=K(this,new S(e,t)))||0===t},h.isNaN=function(){return!this.s},h.isNegative=function(){return this.s<0},h.isPositive=function(){return this.s>0},h.isZero=function(){return!!this.c&&0==this.c[0]},h.minus=function(e,t){var r,n,o,i,a=this,s=a.s;if(t=(e=new S(e,t)).s,!s||!t)return new S(NaN);if(s!=t)return e.s=-t,a.plus(e);var u=a.e/H,l=e.e/H,c=a.c,f=e.c;if(!u||!l){if(!c||!f)return c?(e.s=-t,e):new S(f?a:NaN);if(!c[0]||!f[0])return f[0]?(e.s=-t,e):new S(c[0]?a:3==m?-0:0)}if(u=z(u),l=z(l),c=c.slice(),s=u-l){for((i=s<0)?(s=-s,o=c):(l=u,o=f),o.reverse(),t=s;t--;o.push(0));o.reverse()}else for(n=(i=(s=c.length)<(t=f.length))?s:t,s=t=0;t<n;t++)if(c[t]!=f[t]){i=c[t]<f[t];break}if(i&&(o=c,c=f,f=o,e.s=-e.s),(t=(n=f.length)-(r=c.length))>0)for(;t--;c[r++]=0);for(t=W-1;n>s;){if(c[--n]<f[n]){for(r=n;r&&!c[--r];c[r]=t);--c[r],c[n]+=W}c[n]-=f[n]}for(;0==c[0];c.splice(0,1),--l);return c[0]?C(e,c,l):(e.s=3==m?-1:1,e.c=[e.e=0],e)},h.modulo=h.mod=function(e,t){var n,o,i=this;return e=new S(e,t),!i.c||!e.s||e.c&&!e.c[0]?new S(NaN):!e.c||i.c&&!i.c[0]?new S(i):(9==x?(o=e.s,e.s=1,n=r(i,e,0,3),e.s=o,n.s*=o):n=r(i,e,0,x),(e=i.minus(n.times(e))).c[0]||1!=x||(e.s=i.s),e)},h.multipliedBy=h.times=function(e,t){var r,n,o,i,a,s,u,l,c,f,h,p,d,m,v,y=this,g=y.c,b=(e=new S(e,t)).c;if(!(g&&b&&g[0]&&b[0]))return!y.s||!e.s||g&&!g[0]&&!b||b&&!b[0]&&!g?e.c=e.e=e.s=null:(e.s*=y.s,g&&b?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=z(y.e/H)+z(e.e/H),e.s*=y.s,(u=g.length)<(f=b.length)&&(d=g,g=b,b=d,o=u,u=f,f=o),o=u+f,d=[];o--;d.push(0));for(m=W,v=Y,o=f;--o>=0;){for(r=0,h=b[o]%v,p=b[o]/v|0,i=o+(a=u);i>o;)r=((l=h*(l=g[--a]%v)+(s=p*l+(c=g[a]/v|0)*h)%v*v+d[i]+r)/m|0)+(s/v|0)+p*c,d[i--]=l%m;d[i]=r}return r?++n:d.splice(0,1),C(e,d,n)},h.negated=function(){var e=new S(this);return e.s=-e.s||null,e},h.plus=function(e,t){var r,n=this,o=n.s;if(t=(e=new S(e,t)).s,!o||!t)return new S(NaN);if(o!=t)return e.s=-t,n.minus(e);var i=n.e/H,a=e.e/H,s=n.c,u=e.c;if(!i||!a){if(!s||!u)return new S(o/0);if(!s[0]||!u[0])return u[0]?e:new S(s[0]?n:0*o)}if(i=z(i),a=z(a),s=s.slice(),o=i-a){for(o>0?(a=i,r=u):(o=-o,r=s),r.reverse();o--;r.push(0));r.reverse()}for((o=s.length)-(t=u.length)<0&&(r=u,u=s,s=r,t=o),o=0;t;)o=(s[--t]=s[t]+u[t]+o)/W|0,s[t]=W===s[t]?0:s[t]%W;return o&&(s=[o].concat(s),++a),C(e,s,a)},h.precision=h.sd=function(e,t){var r,n,o,i=this;if(null!=e&&e!==!!e)return ee(e,1,J),null==t?t=m:ee(t,0,8),T(new S(i),e,t);if(!(r=i.c))return null;if(n=(o=r.length-1)*H+1,o=r[o]){for(;o%10==0;o/=10,n--);for(o=r[0];o>=10;o/=10,n++);}return e&&i.e+1>n&&(n=i.e+1),n},h.shiftedBy=function(e){return ee(e,-9007199254740991,Q),this.times("1e"+e)},h.squareRoot=h.sqrt=function(){var e,t,n,o,i,a=this,s=a.c,u=a.s,l=a.e,c=d+4,f=new S("0.5");if(1!==u||!s||!s[0])return new S(!u||u<0&&(!s||s[0])?NaN:s?a:1/0);if(0==(u=Math.sqrt(+R(a)))||u==1/0?(((t=q(s)).length+l)%2==0&&(t+="0"),u=Math.sqrt(+t),l=z((l+1)/2)-(l<0||l%2),n=new S(t=u==1/0?"5e"+l:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+l)):n=new S(u+""),n.c[0])for((u=(l=n.e)+c)<3&&(u=0);;)if(i=n,n=f.times(i.plus(r(a,i,c,1))),q(i.c).slice(0,u)===(t=q(n.c)).slice(0,u)){if(n.e<l&&--u,"9999"!=(t=t.slice(u-3,u+1))&&(o||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(T(n,n.e+d+2,1),e=!n.times(n).eq(a));break}if(!o&&(T(i,i.e+d+2,0),i.times(i).eq(a))){n=i;break}c+=4,u+=4,o=1}return T(n,n.e+d+1,m,e)},h.toExponential=function(e,t){return null!=e&&(ee(e,0,J),e++),k(this,e,t,1)},h.toFixed=function(e,t){return null!=e&&(ee(e,0,J),e=e+this.e+1),k(this,e,t)},h.toFormat=function(e,t,r){var n,o=this;if(null==r)null!=e&&t&&"object"==typeof t?(r=t,t=null):e&&"object"==typeof e?(r=e,e=t=null):r=B;else if("object"!=typeof r)throw Error(G+"Argument not an object: "+r);if(n=o.toFixed(e,t),o.c){var i,a=n.split("."),s=+r.groupSize,u=+r.secondaryGroupSize,l=r.groupSeparator||"",c=a[0],f=a[1],h=o.s<0,p=h?c.slice(1):c,d=p.length;if(u&&(i=s,s=u,u=i,d-=i),s>0&&d>0){for(i=d%s||s,c=p.substr(0,i);i<d;i+=s)c+=l+p.substr(i,s);u>0&&(c+=l+p.slice(i)),h&&(c="-"+c)}n=f?c+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?f.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):f):c}return(r.prefix||"")+n+(r.suffix||"")},h.toFraction=function(e){var t,n,o,i,a,s,u,l,c,f,h,d,v=this,y=v.c;if(null!=e&&(!(u=new S(e)).isInteger()&&(u.c||1!==u.s)||u.lt(p)))throw Error(G+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+R(u));if(!y)return new S(v);for(t=new S(p),c=n=new S(p),o=l=new S(p),d=q(y),a=t.e=d.length-v.e-1,t.c[0]=V[(s=a%H)<0?H+s:s],e=!e||u.comparedTo(t)>0?a>0?t:c:u,s=b,b=1/0,u=new S(d),l.c[0]=0;f=r(u,t,0,1),1!=(i=n.plus(f.times(o))).comparedTo(e);)n=o,o=i,c=l.plus(f.times(i=c)),l=i,t=u.minus(f.times(i=t)),u=i;return i=r(e.minus(n),o,0,1),l=l.plus(i.times(c)),n=n.plus(i.times(o)),l.s=c.s=v.s,h=r(c,o,a*=2,m).minus(v).abs().comparedTo(r(l,n,a,m).minus(v).abs())<1?[c,o]:[l,n],b=s,h},h.toNumber=function(){return+R(this)},h.toPrecision=function(e,t){return null!=e&&ee(e,1,J),k(this,e,t,2)},h.toString=function(e){var t,r=this,o=r.s,i=r.e;return null===i?o?(t="Infinity",o<0&&(t="-"+t)):t="NaN":(null==e?t=i<=v||i>=y?re(q(r.c),i):ne(q(r.c),i,"0"):10===e&&F?t=ne(q((r=T(new S(r),d+i+1,m)).c),r.e,"0"):(ee(e,2,E.length,"Base"),t=n(ne(q(r.c),i,"0"),10,e,o,!0)),o<0&&r.c[0]&&(t="-"+t)),t},h.valueOf=h.toJSON=function(){return R(this)},h._isBigNumber=!0,h[Symbol.toStringTag]="BigNumber",h[Symbol.for("nodejs.util.inspect.custom")]=h.valueOf,null!=t&&S.set(t),S}();const ie=oe;var ae=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;o(this,e),this.bytes=t,this.length=this.bytes.length,this.position=r,this.bitPos=n}return u(e,[{key:"clone",value:function(){return new e(this.bytes,this.position,this.bitPos)}},{key:"getBytes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(!(this.position>this.length)){var t=null!==e?this.position+e:this.length,r=this.bytes.slice(this.position,t);return this.position=t,this.bitPos=0,r}}},{key:"readString",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;if(!(this.position>this.length)){-1===e&&(e=this.length-this.position);for(var t="",r=this.position;r<this.position+e;r++){var n=this.bytes[r];if(0===n)break;t+=String.fromCharCode(n)}return this.position+=e,this.bitPos=0,t}}},{key:"readInt",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"be";if(!(this.position>this.length)){var r=0;if("be"===t)for(var n=this.position;n<this.position+e;n++)r<<=8,r|=this.bytes[n];else for(var o=this.position+e-1;o>=this.position;o--)r<<=8,r|=this.bytes[o];return this.position+=e,this.bitPos=0,r}}},{key:"readBits",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"be";if(!(this.position>this.length)){var r,n=0,o=0;for(n=this.bytes[this.position++]&(r=this.bitPos,"be"===t?(1<<8-r)-1:256-(1<<r)),"be"!==t&&(n>>>=this.bitPos),o=8-this.bitPos,this.bitPos=0;o<e;)"be"===t?n=n<<o|this.bytes[this.position++]:n|=this.bytes[this.position++]<<o,o+=8;if(o>e){var i=o-e;"be"===t?n>>>=i:n&=(1<<e)-1,o-=i,this.position--,this.bitPos=8-i}return n}}},{key:"continueUntil",value:function(e){if(!(this.position>this.length))if(this.bitPos=0,"number"!=typeof e){var t=e.length,r=e[t-1];this.position=t;for(var n,o=function(e,t){var r=new Array;return e.forEach((function(e,n){r[e]=t-n})),r}(e,t);this.position<this.length;){for(;this.position<this.length&&this.bytes[this.position++]!==r;);n=!0;for(var i=t-1;i>=0;i--)if(this.bytes[this.position-t+i]!==e[i]){n=!1,this.position+=o[e[i]];break}if(n){this.position-=t;break}}}else for(;++this.position<this.length&&this.bytes[this.position]!==e;);}},{key:"consumeWhile",value:function(e){for(;this.position<this.length&&this.bytes[this.position]===e;)this.position++;this.bitPos=0}},{key:"consumeIf",value:function(e){this.bytes[this.position]===e&&(this.position++,this.bitPos=0)}},{key:"moveForwardsBy",value:function(e){var t=this.position+e;if(t<0||t>this.length)throw new Error("Cannot move to position "+t+" in stream. Out of bounds.");this.position=t,this.bitPos=0}},{key:"moveBackwardsBy",value:function(e){var t=this.position-e;if(t<0||t>this.length)throw new Error("Cannot move to position "+t+" in stream. Out of bounds.");this.position=t,this.bitPos=0}},{key:"moveBackwardsByBits",value:function(e){if(e<=this.bitPos)this.bitPos-=e;else for(this.bitPos>0&&(e-=this.bitPos,this.bitPos=0);e>0;)this.moveBackwardsBy(1),this.bitPos=8,this.moveBackwardsByBits(e),e-=8}},{key:"moveTo",value:function(e){if(e<0||e>this.length)throw new Error("Cannot move to position "+e+" in stream. Out of bounds.");this.position=e,this.bitPos=0}},{key:"hasMore",value:function(){return this.position<this.length}},{key:"carve",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.position;return this.bitPos>0&&t++,this.bytes.slice(e,t)}}])}();function se(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return ue(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ue(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function ue(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var le={Images:[{name:"Joint Photographic Experts Group image",extension:"jpg,jpeg,jpe,thm,mpo",mime:"image/jpeg",description:"",signature:{0:255,1:216,2:255,3:[192,196,219,221,224,225,226,227,228,229,231,232,234,235,236,237,238,254]},extractor:function(e,t){for(var r=new ae(e.slice(t));r.hasMore();){var n=r.getBytes(2);if(255!==n[0])throw new Error(`Invalid marker while parsing JPEG at pos ${r.position}: ${n}`);var o=0;switch(n[1]){case 216:case 1:break;case 217:return r.carve();case 192:case 193:case 194:case 195:case 196:case 197:case 198:case 199:case 200:case 201:case 202:case 203:case 204:case 205:case 206:case 207:case 219:case 222:case 224:case 225:case 226:case 227:case 228:case 229:case 230:case 231:case 232:case 233:case 234:case 235:case 236:case 237:case 238:case 239:case 254:o=r.readInt(2,"be"),r.position+=o-2;break;case 223:r.position++;break;case 220:case 221:r.position+=2;break;case 218:o=r.readInt(2,"be"),r.position+=o-2,r.continueUntil(255);break;default:r.continueUntil(255)}}throw new Error("Unable to parse JPEG successfully")}},{name:"Graphics Interchange Format image",extension:"gif",mime:"image/gif",description:"",signature:{0:71,1:73,2:70,3:56,4:[55,57],5:97},extractor:function(e,t){var r=new ae(e.slice(t));for(r.continueUntil([33,255]),r.continueUntil([33,249]),r.moveForwardsBy(2);r.hasMore();){for(r.moveForwardsBy(r.readInt(1)+1),r.moveForwardsBy(11);!Array.from(r.getBytes(2)).equals([33,249])&&(r.moveBackwardsBy(2),r.moveForwardsBy(r.readInt(1)),r.readInt(1));)r.moveBackwardsBy(1);if(59===r.readInt(1))break;r.moveForwardsBy(1)}return r.carve()}},{name:"Portable Network Graphics image",extension:"png",mime:"image/png",description:"",signature:{0:137,1:80,2:78,3:71,4:13,5:10,6:26,7:10},extractor:function(e,t){var r=new ae(e.slice(t));r.moveForwardsBy(8);for(var n=0,o="";"IEND"!==o;)n=r.readInt(4,"be"),o=r.readString(4),r.moveForwardsBy(n+4);return r.carve()}},{name:"WEBP Image",extension:"webp",mime:"image/webp",description:"",signature:{8:87,9:69,10:66,11:80},extractor:function(e,t){var r=new ae(e.slice(t));r.moveForwardsBy(4);var n=r.readInt(4,"le");return r.moveForwardsBy(n),r.carve()}},{name:"High Efficiency Image File Format",extension:"heic,heif",mime:"image/heif",description:"",signature:{0:0,1:0,2:0,3:[36,24],4:102,5:116,6:121,7:112,8:104,9:101,10:105,11:99},extractor:null},{name:"Camera Image File Format",extension:"crw",mime:"image/x-canon-crw",description:"",signature:{6:72,7:69,8:65,9:80,10:67,11:67,12:68,13:82},extractor:null},{name:"Canon CR2 raw image",extension:"cr2",mime:"image/x-canon-cr2",description:"",signature:[{0:73,1:73,2:42,3:0,8:67,9:82},{0:77,1:77,2:0,3:42,8:67,9:82}],extractor:null},{name:"Tagged Image File Format image",extension:"tif",mime:"image/tiff",description:"",signature:[{0:73,1:73,2:42,3:0},{0:77,1:77,2:0,3:42}],extractor:null},{name:"Bitmap image",extension:"bmp",mime:"image/bmp",description:"",signature:{0:66,1:77,7:0,9:0,14:[12,40,56,64,108,124],15:0,16:0,17:0},extractor:function(e,t){var r=new ae(e.slice(t));r.moveForwardsBy(2);var n=r.readInt(4,"le");return r.moveForwardsBy(n-6),r.carve()}},{name:"JPEG Extended Range image",extension:"jxr",mime:"image/vnd.ms-photo",description:"",signature:{0:73,1:73,2:188},extractor:null},{name:"Photoshop image",extension:"psd",mime:"image/vnd.adobe.photoshop",description:"",signature:{0:56,1:66,2:80,3:83,4:0,5:1,6:0,7:0,8:0,9:0,10:0,11:0},extractor:null},{name:"Photoshop Large Document",extension:"psb",mime:"application/x-photoshop",description:"",signature:{0:56,1:66,2:80,3:83,4:0,5:2,6:0,7:0,8:0,9:0,10:0,11:0,12:0},extractor:null},{name:"Paint Shop Pro image",extension:"psp",mime:"image/psp",description:"",signature:[{0:80,1:97,2:105,3:110,4:116,5:32,6:83,7:104,8:111,9:112,10:32,11:80,12:114,13:111,14:32,15:73,16:109},{0:126,1:66,2:75,3:0}],extractor:null},{name:"The GIMP image",extension:"xcf",mime:"image/x-xcf",description:"",signature:{0:103,1:105,2:109,3:112,4:32,5:120,6:99,7:102,8:32,9:[102,118],10:[105,48],11:[108,48],12:[101,49,50,51]},extractor:null},{name:"Icon image",extension:"ico",mime:"image/x-icon",description:"",signature:{0:0,1:0,2:1,3:0,4:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21],5:0,6:[16,32,48,64,128],7:[16,32,48,64,128],9:0,10:[0,1]},extractor:function(e,t){var r=new ae(e.slice(t));r.moveTo(4);var n=r.readInt(2,"le");r.moveForwardsBy(8+16*(n-1));var o=r.readInt(4,"le"),i=r.readInt(4,"le");return r.moveTo(i+o),r.carve()}},{name:"Radiance High Dynamic Range image",extension:"hdr",mime:"image/vnd.radiance",description:"",signature:{0:35,1:63,2:82,3:65,4:68,5:73,6:65,7:78,8:67,9:69,10:10},extractor:null},{name:"Sony ARW image",extension:"arw",mime:"image/x-raw",description:"",signature:{0:5,1:0,2:0,3:0,4:65,5:87,6:49,7:46},extractor:null},{name:"Fujifilm Raw Image",extension:"raf",mime:"image/x-raw",description:"",signature:{0:70,1:85,2:74,3:73,4:70,5:73,6:76,7:77,8:67,9:67,10:68,11:45,12:82,13:65,14:87},extractor:null},{name:"Minolta RAW image",extension:"mrw",mime:"image/x-raw",description:"",signature:{0:0,1:77,2:82,3:77},extractor:null},{name:"Adobe Bridge Thumbnail Cache",extension:"bct",mime:"application/octet-stream",description:"",signature:{0:108,1:110,2:98,3:116,4:2,5:0,6:0,7:0},extractor:null},{name:"Microsoft Document Imaging",extension:"mdi",mime:"image/vnd.ms-modi",description:"",signature:{0:69,1:80,2:42,3:0},extractor:null},{name:"Joint Photographic Experts Group image (under Base64)",extension:"B64",mime:"application/octet-stream",description:"",signature:{0:47,1:57,2:106,3:47,4:52},extractor:null},{name:"Portable Network Graphics image (under Base64)",extension:"B64",mime:"application/octet-stream",description:"",signature:{0:105,1:86,2:66,3:79,4:82,5:119,6:48},extractor:null},{name:"AutoCAD Drawing",extension:"dwg,123d",mime:"application/acad",description:"",signature:{0:65,1:67,2:49,3:48,4:[48,49],5:[48,49,50,51,52,53],6:0},extractor:null},{name:"AutoCAD Drawing",extension:"dwg,dwt",mime:"application/acad",description:"",signature:[{0:65,1:67,2:49,3:48,4:49,5:56,6:0},{0:65,1:67,2:49,3:48,4:50,5:52,6:0},{0:65,1:67,2:49,3:48,4:50,5:55,6:0}],extractor:null},{name:"Targa Image",extension:"tga",mime:"image/x-targa",description:"",signature:[{0:84,1:82,2:85,3:69,4:86,5:73,6:83,7:73,8:79,9:78,10:45,11:88,12:70,13:73,14:76,15:69,16:46}],extractor:function(e,t){var r=new ae(e);r.moveTo(t-8);var n=r.readInt(4,"le"),o=r.readInt(4,"le");function i(e,t){for(var n=0;n<e;n++){r.moveBackwardsBy(1);var o=r.readInt(t,"le")-1;if(r.moveBackwardsBy(t),o===n)break}}return r.moveBackwardsBy(8),n||o?n?(i(65535,2),r.moveBackwardsBy(n)):o&&(i(4294967295,4),r.moveBackwardsBy(6),r.moveBackwardsBy(o)):(function(){r.moveBackwardsBy(5);for(var e=0;e<1048576&&r.readInt(2,"le")*r.readInt(2,"le")*r.readInt(1)/8!=e-1;e++)r.moveBackwardsBy(6)}(),r.moveBackwardsBy(17)),r.carve(r.position,t+18)}}],Video:[{name:"Matroska Multimedia Container",extension:"mkv",mime:"video/x-matroska",description:"",signature:{31:109,32:97,33:116,34:114,35:111,36:115,37:107,38:97},extractor:null},{name:"WEBM video",extension:"webm",mime:"video/webm",description:"",signature:{0:26,1:69,2:223,3:163},extractor:null},{name:"Flash MP4 video",extension:"f4v",mime:"video/mp4",description:"",signature:{4:102,5:116,6:121,7:112,8:[102,70],9:52,10:[118,86],11:32},extractor:null},{name:"MPEG-4 video",extension:"mp4",mime:"video/mp4",description:"",signature:[{0:0,1:0,2:0,3:[24,32],4:102,5:116,6:121,7:112},{0:51,1:103,2:112,3:53},{0:0,1:0,2:0,3:28,4:102,5:116,6:121,7:112,8:109,9:112,10:52,11:50,16:109,17:112,18:52,19:49,20:109,21:112,22:52,23:50,24:105,25:115,26:111,27:109}],extractor:null},{name:"M4V video",extension:"m4v",mime:"video/x-m4v",description:"",signature:{0:0,1:0,2:0,3:28,4:102,5:116,6:121,7:112,8:77,9:52,10:86},extractor:null},{name:"Quicktime video",extension:"mov",mime:"video/quicktime",description:"",signature:{0:0,1:0,2:0,3:20,4:102,5:116,6:121,7:112},extractor:null},{name:"Audio Video Interleave",extension:"avi",mime:"video/x-msvideo",description:"",signature:{0:82,1:73,2:70,3:70,8:65,9:86,10:73},extractor:null},{name:"Windows Media Video",extension:"wmv",mime:"video/x-ms-wmv",description:"",signature:{0:48,1:38,2:178,3:117,4:142,5:102,6:207,7:17,8:166,9:217},extractor:null},{name:"MPEG video",extension:"mpg",mime:"video/mpeg",description:"",signature:{0:0,1:0,2:1,3:186},extractor:null},{name:"Flash Video",extension:"flv",mime:"video/x-flv",description:"",signature:{0:70,1:76,2:86,3:1},extractor:function(e,t){var r=new ae(e.slice(t));r.moveForwardsBy(5);var n=r.readInt(4,"be");r.moveForwardsBy(n-9);for(var o=-11;r.hasMore();){var i=r.readInt(4,"be"),a=r.readInt(1);if([8,9,18].indexOf(a)<0){r.moveBackwardsBy(1);break}if(i!==o+11){r.moveBackwardsBy(o+11+5);break}o=r.readInt(3,"be"),r.moveForwardsBy(7+o)}return r.carve()}},{name:"OGG Video",extension:"ogv,ogm,opus,ogx",mime:"video/ogg",description:"",signature:[{0:79,1:103,2:103,3:83,4:0,5:2,28:1,29:118,30:105,31:100,32:101,33:111},{0:79,1:103,2:103,3:83,4:0,5:2,28:128,29:116,30:104,31:101,32:111,33:114,34:97},{0:79,1:103,2:103,3:83,4:0,5:2,28:102,29:105,30:115,31:104,32:101,33:97,34:100}],extractor:null}],Audio:[{name:"Waveform Audio",extension:"wav",mime:"audio/x-wav",description:"",signature:{0:82,1:73,2:70,3:70,8:87,9:65,10:86,11:69},extractor:function(e,t){var r=new ae(e.slice(t));return r.moveTo(4),r.moveTo(r.readInt(4,"le")+8),r.carve()}},{name:"OGG audio",extension:"ogg",mime:"audio/ogg",description:"",signature:{0:79,1:103,2:103,3:83},extractor:null},{name:"Musical Instrument Digital Interface audio",extension:"midi",mime:"audio/midi",description:"",signature:{0:77,1:84,2:104,3:100},extractor:null},{name:"MPEG-3 audio",extension:"mp3",mime:"audio/mpeg",description:"",signature:[{0:73,1:68,2:51},{0:255,1:251}],extractor:function(e,t){var r=new ae(e.slice(t)),n=["free",32e3,4e4,48e3,56e3,64e3,8e4,96e3,112e3,128e3,16e4,192e3,224e3,256e3,32e4,"bad"],o=[44100,48e3,32e3,"reserved"];if(r.getBytes(3).toString()===[73,68,51].toString()){r.moveTo(6);var i=r.readInt(1)<<21|r.readInt(1)<<14|r.readInt(1)<<7|r.readInt(1);r.moveForwardsBy(i)}else r.moveTo(0);for(;r.hasMore();){if(r.getBytes(3)===[84,65,71].toString()){r.moveForwardsBy(125);break}if(r.getBytes(2).toString()!==[255,251].toString()){r.moveBackwardsBy(2);break}var a=r.readInt(1),s=n[a>>4],u=o[(15&a)>>2],l=(2&a)>>1;if("free"===s||"bad"===s||"reserved"===u){r.moveBackwardsBy(1);break}var c=Math.floor(144*s/u+l);if(r.position+c>r.length){r.moveTo(r.length);break}r.moveForwardsBy(c-3)}return r.carve()}},{name:"MPEG-4 Part 14 audio",extension:"m4a",mime:"audio/m4a",description:"",signature:[{4:102,5:116,6:121,7:112,8:77,9:52,10:65},{0:77,1:52,2:65,3:32}],extractor:null},{name:"Free Lossless Audio Codec",extension:"flac",mime:"audio/x-flac",description:"",signature:{0:102,1:76,2:97,3:67},extractor:null},{name:"Adaptive Multi-Rate audio codec",extension:"amr",mime:"audio/amr",description:"",signature:{0:35,1:33,2:65,3:77,4:82,5:10},extractor:null},{name:"Audacity",extension:"au",mime:"audio/x-au",description:"",signature:{0:100,1:110,2:115,3:46,24:65,25:117,26:100,27:97,28:99,29:105,30:116,31:121,32:66,33:108,34:111,35:99,36:107,37:70,38:105,39:108,40:101},extractor:null},{name:"Audacity Block",extension:"auf",mime:"application/octet-stream",description:"",signature:{0:65,1:117,2:100,3:97,4:99,5:105,6:116,7:121,8:66,9:108,10:111,11:99,12:107,13:70,14:105,15:108,16:101},extractor:null},{name:"Audio Interchange File",extension:"aif",mime:"audio/x-aiff",description:"",signature:{0:70,1:79,2:82,3:77,8:65,9:73,10:70,11:70},extractor:null},{name:"Audio Interchange File (compressed)",extension:"aifc",mime:"audio/x-aifc",description:"",signature:{0:70,1:79,2:82,3:77,8:65,9:73,10:70,11:67},extractor:null}],Documents:[{name:"Portable Document Format",extension:"pdf",mime:"application/pdf",description:"",signature:{0:37,1:80,2:68,3:70},extractor:function(e,t){var r=new ae(e.slice(t));return r.continueUntil([37,37,69,79,70]),r.moveForwardsBy(5),r.consumeIf(13),r.consumeIf(10),r.carve()}},{name:"Portable Document Format (under Base64)",extension:"B64",mime:"application/octet-stream",description:"",signature:{0:65,1:74,2:86,3:66,4:69,5:82,6:105},extractor:null},{name:"Adobe PostScript",extension:"ps,eps,ai,pfa",mime:"application/postscript",description:"",signature:{0:37,1:33,2:80,3:83,4:45,5:65,6:100,7:111,8:98,9:101},extractor:null},{name:"PostScript",extension:"ps",mime:"application/postscript",description:"",signature:{0:37,1:33},extractor:null},{name:"Encapsulated PostScript",extension:"eps,ai",mime:"application/eps",description:"",signature:{0:197,1:208,2:211,3:198},extractor:null},{name:"Rich Text Format",extension:"rtf",mime:"application/rtf",description:"",signature:{0:123,1:92,2:114,3:116},extractor:function(e,t){var r=new ae(e.slice(t)),n=0;if(123!==r.readInt(1))throw new Error("Not a valid RTF file");for(n++;n>0&&r.hasMore();)switch(r.readInt(1)){case 123:n++;break;case 125:n--;break;case 92:r.consumeIf(92),r.position++}return r.carve()}},{name:"Microsoft Office document/OLE2",extension:"ole2,doc,xls,dot,ppt,xla,ppa,pps,pot,msi,sdw,db,vsd,msg",mime:"application/msword,application/vnd.ms-excel,application/vnd.ms-powerpoint",description:"Microsoft Office documents",signature:{0:208,1:207,2:17,3:224,4:161,5:177,6:26,7:225},extractor:null},{name:"Microsoft Office document/OLE2 (under Base64)",extension:"B64",mime:"application/octet-stream",description:"",signature:{0:48,1:77,2:56,3:82,4:52,5:75,6:71,7:120},extractor:null},{name:"Microsoft Office 2007+ document",extension:"docx,xlsx,pptx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.presentationml.presentation",description:"",signature:{38:95,39:84,40:121,41:112,42:101,43:115,44:93,45:46,46:120,47:109,48:108},extractor:ce},{name:"Microsoft Access database",extension:"mdb,mda,mde,mdt,fdb,psa",mime:"application/msaccess",description:"",signature:{0:0,1:1,2:0,3:0,4:83,5:116,6:97,7:110,8:100,9:97,10:114,11:100,12:32,13:74,14:101,15:116},extractor:null},{name:"Microsoft Access 2007+ database",extension:"accdb,accde,accda,accdu",mime:"application/msaccess",description:"",signature:{0:0,1:1,2:0,3:0,4:83,5:116,6:97,7:110,8:100,9:97,10:114,11:100,12:32,13:65,14:67,15:69,16:32},extractor:null},{name:"Microsoft OneNote document",extension:"one",mime:"application/onenote",description:"",signature:{0:228,1:82,2:92,3:123,4:140,5:216,6:167,7:77,8:174,9:177,10:83,11:120,12:208,13:41,14:150,15:211},extractor:null},{name:"Outlook Express database",extension:"dbx",mime:"application/octet-stream",description:"",signature:{0:207,1:173,2:18,3:254,4:[48,197,198,199],11:17},extractor:null},{name:"Personal Storage Table (Outlook)",extension:"pst,ost,fdb,pab",mime:"application/octet-stream",description:"",signature:{0:33,1:66,2:68,3:78},extractor:null},{name:"Microsoft Exchange Database",extension:"edb",mime:"application/octet-stream",description:"",signature:{4:239,5:205,6:171,7:137,8:[32,35],9:6,10:0,11:0,12:[0,1],13:0,14:0,15:0},extractor:null},{name:"WordPerfect document",extension:"wpd,wp,wp5,wp6,wpp,bk!,wcm",mime:"application/wordperfect",description:"",signature:{0:255,1:87,2:80,3:67,7:[0,1,2],8:1,9:10},extractor:null},{name:"EPUB e-book",extension:"epub",mime:"application/epub+zip",description:"",signature:{0:80,1:75,2:3,3:4,30:109,31:105,32:109,33:101,34:116,35:121,36:112,37:101,38:97,39:112,40:112,41:108,42:105,43:99,44:97,45:116,46:105,47:111,48:110,49:47,50:101,51:112,52:117,53:98,54:43,55:122,56:105,57:112},extractor:ce}],Applications:[{name:"Windows Portable Executable",extension:"exe,dll,drv,vxd,sys,ocx,vbx,com,fon,scr",mime:"application/vnd.microsoft.portable-executable",description:"",signature:{0:77,1:90,3:[0,1,2],5:[0,1,2]},extractor:function(e,t){var r=new ae(e.slice(t));r.moveTo(60);var n=r.readInt(4,"le");r.moveTo(n),r.moveForwardsBy(6);var o=r.readInt(2,"le");r.moveForwardsBy(16);var i=523===r.readInt(2,"le")?112:96;r.moveForwardsBy(i-2),r.moveForwardsBy(32);var a=r.readInt(4,"le"),s=r.readInt(4,"le");if(a>0)return r.moveTo(a+s),r.carve();r.moveForwardsBy(88),r.moveForwardsBy(40*(o-1)),r.moveForwardsBy(16);var u=r.readInt(4,"le"),l=r.readInt(4,"le");return r.moveTo(l+u),r.carve()}},{name:"Executable and Linkable Format",extension:"elf,bin,axf,o,prx,so",mime:"application/x-executable",description:"Executable and Linkable Format file. No standard file extension.",signature:{0:127,1:69,2:76,3:70},extractor:function(e,t){var r=new ae(e.slice(t));r.moveForwardsBy(4);var n=1===r.readInt(1),o=1===r.readInt(1)?"le":"be";r.moveForwardsBy(n?26:34);var i=n?r.readInt(4,o):r.readInt(8,o);r.moveForwardsBy(10);var a=r.readInt(2,o),s=r.readInt(2,o);return r.moveTo(i),r.moveForwardsBy(a*s),r.carve()}},{name:"MacOS Mach-O object",extension:"dylib",mime:"application/octet-stream",description:"",signature:[{0:202,1:254,2:186,3:190,4:0,5:0,6:0,7:[1,2,3]},{0:206,1:250,2:237,3:254,4:7,5:0,6:0,7:0,8:[1,2,3]}],extractor:fe},{name:"MacOS Mach-O 64-bit object",extension:"dylib",mime:"application/octet-stream",description:"",signature:{0:207,1:250,2:237,3:254},extractor:fe},{name:"Adobe Flash",extension:"swf",mime:"application/x-shockwave-flash",description:"",signature:{0:[67,70],1:87,2:83},extractor:null},{name:"Java Class",extension:"class",mime:"application/java-vm",description:"",signature:{0:202,1:254,2:186,3:190},extractor:null},{name:"Dalvik Executable",extension:"dex",mime:"application/octet-stream",description:"Dalvik Executable as used by Android",signature:{0:100,1:101,2:120,3:10,4:48,5:51,6:53,7:0},extractor:null},{name:"Google Chrome Extension",extension:"crx",mime:"application/crx",description:"Google Chrome extension or packaged app",signature:{0:67,1:114,2:50,3:52},extractor:null}],Archives:[{name:"PKZIP archive",extension:"zip",mime:"application/zip",description:"",signature:{0:80,1:75,2:[3,5,7],3:[4,6,8]},extractor:ce},{name:"PKZIP archive (under Base64)",extension:"B64",mime:"application/octet-stream",description:"",signature:{0:85,1:69,2:115,3:68,4:66,5:66},extractor:null},{name:"TAR archive",extension:"tar",mime:"application/x-tar",description:"",signature:{257:117,258:115,259:116,260:97,261:114},extractor:function(e,t){for(var r=new ae(e.slice(t)),n=function(){if(r.moveForwardsBy(257),r.getBytes(5).join("")!==[117,115,116,97,114].join(""))return r.moveBackwardsBy(262),1;r.moveBackwardsBy(138);var e=0;r.getBytes(11).forEach((function(t,r){e+=(t-48).toString()})),e=512*Math.ceil(parseInt(e,8)/512),r.moveForwardsBy(e+377)};r.hasMore()&&!n(););return r.consumeWhile(0),r.carve()}},{name:"Roshal Archive",extension:"rar",mime:"application/x-rar-compressed",description:"",signature:{0:82,1:97,2:114,3:33,4:26,5:7,6:[0,1]},extractor:null},{name:"Gzip",extension:"gz",mime:"application/gzip",description:"",signature:{0:31,1:139,2:8},extractor:function(e,t){var r=new ae(e.slice(t));r.moveForwardsBy(3);var n=r.readInt(1);if(r.moveForwardsBy(4),r.readInt(1),r.moveForwardsBy(1),4&n){var o=r.readInt(2,"le");r.moveForwardsby(o)}return 8&n&&(r.continueUntil(0),r.moveForwardsBy(1)),16&n&&(r.continueUntil(0),r.moveForwardsBy(1)),2&n&&r.moveForwardsBy(2),ye(r),r.moveForwardsBy(8),r.carve()}},{name:"Bzip2",extension:"bz2",mime:"application/x-bzip2",description:"",signature:{0:66,1:90,2:104},extractor:function(e,t){for(var r=new ae(e.slice(t)),n=[[119,36,83,133,9],[238,72,167,10,18],[220,145,78,20,36],[185,34,156,40,72],[114,69,56,80,144],[187,146,41,194,132],[93,201,20,225,66],[46,228,138,112,161],[23,114,69,56,80]],o=0;o<n.length&&(r.continueUntil(n[o]),r.getBytes(5).join("")!==n[o].join(""));o++)r.moveTo(0);return r.moveForwardsBy(4),r.carve()}},{name:"7zip",extension:"7z",mime:"application/x-7z-compressed",description:"",signature:{0:55,1:122,2:188,3:175,4:39,5:28},extractor:null},{name:"Zlib Deflate",extension:"zlib",mime:"application/x-deflate",description:"",signature:{0:120,1:[1,156,218,94]},extractor:function(e,t){var r=new ae(e.slice(t));return r.moveForwardsBy(1),32&r.readInt(1)&&r.moveForwardsBy(4),ye(r),r.moveForwardsBy(4),r.carve()}},{name:"xz compression",extension:"xz",mime:"application/x-xz",description:"",signature:{0:253,1:55,2:122,3:88,4:90,5:0},extractor:function(e,t){var r=new ae(e.slice(t));return r.continueUntil([0,0,0,0,4,89,90]),r.moveForwardsBy(7),r.carve()}},{name:"Tarball",extension:"tar.z",mime:"application/x-gtar",description:"",signature:{0:31,1:[157,160]},extractor:null},{name:"ISO disk image",extension:"iso",mime:"application/octet-stream",description:"ISO 9660 CD/DVD image file",signature:[{32769:67,32770:68,32771:48,32772:48,32773:49},{34817:67,34818:68,34819:48,34820:48,34821:49},{36865:67,36866:68,36867:48,36868:48,36869:49}],extractor:null},{name:"Virtual Machine Disk",extension:"vmdk",mime:"application/vmdk,application/x-virtualbox-vmdk",description:"",signature:{0:75,1:68,2:77,3:86,5:0,6:0,7:0},extractor:null},{name:"Virtual Hard Drive",extension:"vhd",mime:"application/x-vhd",description:"",signature:{0:99,1:111,2:110,3:101,4:99,5:116,6:105,7:120},extractor:null},{name:"Macintosh disk image",extension:"dmf,dmg",mime:"application/octet-stream",description:"",signature:{0:120,1:1,2:115,3:13,4:98,5:98,6:96,7:96},extractor:null},{name:"ARJ Archive",extension:"arj",mime:"application/x-arj-compressed",description:"",signature:{0:96,1:234,8:[0,16,20],9:0,10:2},extractor:null},{name:"WinAce Archive",extension:"ace",mime:"application/x-ace-compressed",description:"",signature:{7:42,8:42,9:65,10:67,11:69,12:42,13:42},extractor:null},{name:"Macintosh BinHex Encoded File",extension:"hqx",mime:"application/mac-binhex",description:"",signature:{11:109,12:117,13:115,14:116,15:32,16:98,17:101,18:32,19:99,20:111,21:110,22:118,23:101,24:114,25:116,26:101,27:100,28:32,29:119,30:105,31:116,32:104,33:32,34:66,35:105,36:110,37:72,38:101,39:120},extractor:null},{name:"ALZip Archive",extension:"alz",mime:"application/octet-stream",description:"",signature:{0:65,1:76,2:90,3:1,4:10,5:0,6:0,7:0},extractor:null},{name:"KGB Compressed Archive",extension:"kgb",mime:"application/x-kgb-compressed",description:"",signature:{0:75,1:71,2:66,3:95,4:97,5:114,6:99,7:104,8:32,9:45},extractor:null},{name:"Microsoft Cabinet",extension:"cab",mime:"vnd.ms-cab-compressed",description:"",signature:{0:77,1:83,2:67,3:70,4:0,5:0,6:0,7:0},extractor:null},{name:"Jar Archive",extension:"jar",mime:"application/java-archive",description:"",signature:{0:95,1:39,2:168,3:137},extractor:null},{name:"Jar Archive",extension:"jar",mime:"application/java-archive",description:"",signature:{0:80,1:75,2:3,3:4,4:20,5:0,6:8,7:0,8:8,9:0},extractor:ce},{name:"lzop compressed",extension:"lzop,lzo",mime:"application/x-lzop",description:"",signature:{0:137,1:76,2:90,3:79,4:0,5:13,6:10,7:26},extractor:function(e,t){var r=new ae(e.slice(t)),n=0,o=0;r.moveForwardsBy(9);var i=r.readInt(2,"be");r.moveForwardsBy(6);var a=r.readInt(4,"be");2048&i&&r.moveForwardsBy(4),2&a&&n++,512&a&&n++,1&a&&o++,256&a&&o++,r.moveForwardsBy(8),i>=2368&&r.moveForwardsBy(4);var s=r.readInt(1,"be");if(r.moveForwardsBy(s),64&a){var u=r.readInt(4,"be");r.moveForwardsBy(u)}for(r.moveForwardsBy(4);r.hasMore();){var l=r.readInt(4,"be");if(0===l)break;var c=r.readInt(4,"be"),f=l===c?o:o+n;r.moveForwardsBy(c+4*f)}return r.carve()}},{name:"Linux deb package",extension:"deb",mime:"application/vnd.debian.binary-package",description:"",signature:{0:33,1:60,2:97,3:114,4:99,5:104,6:62},extractor:function(e,t){var r=new ae(e.slice(t));for(r.moveForwardsBy(8);r.hasMore();){r.moveForwardsBy(48);var n,o="",i=se(r.getBytes(10));try{for(i.s();!(n=i.n()).done;){var a=n.value;o+=String.fromCharCode(a)}}catch(e){i.e(e)}finally{i.f()}o=parseInt(o.trim(),10),r.moveForwardsBy(2),r.moveForwardsBy(o)}return r.carve()}},{name:"Apple Disk Image",extension:"dmg",mime:"application/x-apple-diskimage",description:"",signature:{0:120,1:1,2:115,3:13,4:98,5:98,6:96},extractor:null}],Miscellaneous:[{name:"UTF-8 text",extension:"txt",mime:"text/plain",description:"UTF-8 encoded Unicode byte order mark, commonly but not exclusively seen in text files.",signature:{0:239,1:187,2:191},extractor:null},{name:"UTF-32 LE text",extension:"utf32le",mime:"charset/utf32le",description:"Little-endian UTF-32 encoded Unicode byte order mark.",signature:{0:255,1:254,2:0,3:0},extractor:null},{name:"UTF-16 LE text",extension:"utf16le",mime:"charset/utf16le",description:"Little-endian UTF-16 encoded Unicode byte order mark.",signature:{0:255,1:254},extractor:null},{name:"Web Open Font Format",extension:"woff",mime:"application/font-woff",description:"",signature:{0:119,1:79,2:70,3:70,4:0,5:1,6:0,7:0},extractor:null},{name:"Web Open Font Format 2",extension:"woff2",mime:"application/font-woff",description:"",signature:{0:119,1:79,2:70,3:50,4:0,5:1,6:0,7:0},extractor:null},{name:"Embedded OpenType font",extension:"eot",mime:"application/octet-stream",description:"",signature:[{8:2,9:0,10:1,34:76,35:80},{8:1,9:0,10:0,34:76,35:80},{8:2,9:0,10:2,34:76,35:80}],extractor:null},{name:"TrueType Font",extension:"ttf",mime:"application/font-sfnt",description:"",signature:{0:0,1:1,2:0,3:0,4:0},extractor:null},{name:"OpenType Font",extension:"otf",mime:"application/font-sfnt",description:"",signature:{0:79,1:84,2:84,3:79,4:0},extractor:null},{name:"SQLite",extension:"sqlite",mime:"application/x-sqlite3",description:"",signature:{0:83,1:81,2:76,3:105},extractor:function(e,t){var r=new ae(e.slice(t));r.moveTo(16);var n=r.readInt(2);r.moveTo(28);var o=r.readInt(4);return r.moveTo(n*o),r.carve()}},{name:"BitTorrent link",extension:"torrent",mime:"application/x-bittorrent",description:"",signature:[{0:100,1:56,2:58,3:97,4:110,5:110,6:111,7:117,8:110,9:99,10:101,11:35,12:35,13:58},{0:100,1:52,2:58,3:105,4:110,5:102,6:111,7:100,8:[52,53,54],9:58}],extractor:null},{name:"Cryptocurrency wallet",extension:"wallet",mime:"application/octet-stream",description:"",signature:{0:0,1:0,2:0,3:0,4:1,5:0,6:0,7:0,8:0,9:0,10:0,11:0,12:98,13:49,14:5,15:0},extractor:null},{name:"Registry fragment",extension:"hbin",mime:"application/octet-stream",description:"",signature:{0:104,1:98,2:105,3:110,4:0},extractor:null},{name:"Registry script",extension:"rgs",mime:"application/octet-stream",description:"",signature:{0:72,1:75,2:67,3:82,4:13,5:10,6:92,7:123},extractor:null},{name:"WinNT Registry Hive",extension:"registry",mime:"application/octet-stream",description:"",signature:{0:114,1:101,2:103,3:102},extractor:null},{name:"Windows Event Log",extension:"evt",mime:"application/octet-stream",description:"",signature:{0:48,1:0,2:0,3:0,4:76,5:102,6:76,7:101},extractor:function(e,t){var r=new ae(e.slice(t));r.moveTo(20);var n=r.readInt(4,"le");r.moveTo(n);var o=r.readInt(4,"le");return r.moveForwardsBy(o-4),r.carve()}},{name:"Windows Event Log",extension:"evtx",mime:"application/octet-stream",description:"",signature:{0:69,1:108,2:102,3:70,4:105,5:108,6:101},extractor:function(e,t){var r=new ae(e.slice(t));r.moveTo(40);var n=r.readInt(4,"le")-44;for(r.moveForwardsBy(n);r.hasMore()&&r.getBytes(7).join("")===[69,108,102,67,104,110,107].join("");)r.moveForwardsBy(65529);return r.consumeWhile(0),r.carve()}},{name:"Windows Pagedump",extension:"dmp",mime:"application/octet-stream",description:"",signature:{0:80,1:65,2:71,3:69,4:68,5:85,6:[77,54],7:[80,52]},extractor:function(e,t){var r=new ae(e.slice(t));return r.moveTo(112),r.moveTo(4096*(r.readInt(4,"le")+1)),r.carve()}},{name:"Windows Prefetch",extension:"pf",mime:"application/x-pf",description:"",signature:{0:[17,23,26],1:0,2:0,3:0,4:83,5:67,6:67,7:65},extractor:function(e,t){var r=new ae(e.slice(t));return r.moveTo(12),r.moveTo(r.readInt(4,"be")),r.carve()}},{name:"Windows Prefetch (Win 10)",extension:"pf",mime:"application/x-pf",description:"",signature:{0:77,1:65,2:77,3:4,7:0},extractor:function(e,t){var r=new ae(e.slice(t));return r.moveTo(r.readInt(4,"be")),r.carve()}},{name:"PList (XML)",extension:"plist",mime:"application/xml",description:"",signature:{39:60,40:33,41:68,42:79,43:67,44:84,45:89,46:80,47:69,48:32,49:112,50:108,51:105,52:115,53:116},extractor:function(e,t){var r=new ae(e.slice(t)),n=0;for(r.continueUntil([60,112,108,105,115,116]),r.moveForwardsBy(6),n++;n>0&&r.hasMore();)60===r.readInt(1)&&(r.getBytes(5).join("")===[112,108,105,115,116].join("")?n++:r.moveBackwardsBy(5),r.getBytes(7).join("")===[47,112,108,105,115,116,62].join("")?n--:r.moveBackwardsBy(7));return r.consumeIf(10),r.carve()}},{name:"PList (binary)",extension:"bplist,plist,ipmeta,abcdp,mdbackup,mdinfo,strings,nib,ichat,qtz,webbookmark,webhistory",mime:"application/x-plist",description:"",signature:{0:98,1:112,2:108,3:105,4:115,5:116,6:48,7:48},extractor:null},{name:"MacOS X Keychain",extension:"keychain",mime:"application/octet-stream",description:"",signature:{0:107,1:121,2:99,3:104,4:0,5:1},extractor:function(e,t){var r=new ae(e.slice(t));return r.moveTo(20),r.moveForwardsBy(r.readInt(4)),r.carve()}},{name:"TCP Packet",extension:"tcp",mime:"application/tcp",description:"",signature:{12:8,13:0,14:69,15:0,21:0,22:function(e){return e>=1&&e<=128},23:6},extractor:null},{name:"UDP Packet",extension:"udp",mime:"application/udp",description:"",signature:{12:8,13:0,14:69,15:0,16:[0,1,2,3,4,5],22:function(e){return e>=1&&e<=128},23:17},extractor:null},{name:"Compiled HTML",extension:"chm,chw,chi",mime:"application/vnd.ms-htmlhelp",description:"",signature:{0:73,1:84,2:83,3:70,4:3,5:0,6:0,7:0},extractor:null},{name:"Windows Password",extension:"pwl",mime:"application/octet-stream",description:"",signature:{0:227,1:130,2:133,3:150},extractor:null},{name:"Bitlocker recovery key",extension:"bitlocker",mime:"application/octet-stream",description:"",signature:{0:255,1:254,2:66,3:0,4:105,5:0,6:116,7:0,8:76,9:0,10:111,11:0,12:99,13:0,14:107,15:0,16:101,17:0,18:114,19:0,20:32,21:0},extractor:null},{name:"Certificate",extension:"cer,cat,p7b,p7c,p7m,p7s,swz,rsa,crl,crt,der",mime:"application/pkix-cert",description:"",signature:{0:48,1:130,4:[6,10,48]},extractor:null},{name:"Certificate",extension:"cat,swz,p7m",mime:"application/vnd.ms-pki.seccat",description:"",signature:{0:48,1:131,2:function(e){return 0!==e},5:6,6:9},extractor:null},{name:"PGP pubring",extension:"pkr,gpg",mime:"application/pgp-keys",description:"",signature:{0:153,1:1,2:[13,162],3:4},extractor:null},{name:"PGP secring",extension:"skr",mime:"application/pgp-keys",description:"",signature:[{0:149,1:1,2:207,3:4},{0:149,1:3,2:198,3:4},{0:149,1:5,2:134,3:4}],extractor:null},{name:"PGP Safe",extension:"pgd",mime:"application/pgp-keys",description:"",signature:{0:80,1:71,2:80,3:100,4:77,5:65,6:73,7:78,8:96,9:1,10:0},extractor:null},{name:"Task Scheduler",extension:"job",mime:"application/octet-stream",description:"",signature:{0:[0,1,2,3],1:[5,6],2:1,3:0,20:70,21:0},extractor:null},{name:"Windows Shortcut",extension:"lnk",mime:"application/x-ms-shortcut",description:"",signature:{0:76,1:0,2:0,3:0,4:1,5:20,6:2,7:0,8:0,9:0,10:0,11:0,12:192,13:0,14:0,15:0,16:0,17:0,18:0,19:70},extractor:function(e,t){var r=new ae(e.slice(t));return r.moveTo(52),r.moveTo(r.readInt(4,"le")),r.carve()}},{name:"Bash",extension:"bash",mime:"application/bash",description:"",signature:{0:35,1:33,2:47,3:98,4:105,5:110,6:47,7:98,8:97,9:115,10:104},extractor:null},{name:"Shell",extension:"sh",mime:"application/sh",description:"",signature:{0:35,1:33,2:47,3:98,4:105,5:110,6:47,7:115,8:104},extractor:null},{name:"Python",extension:"py,pyc,pyd,pyo,pyw,pyz",mime:"application/python",description:"",signature:{0:35,1:33,2:47,3:117,4:115,5:114,6:47,7:98,8:105,9:110,10:47,11:112,12:121,13:116,14:104,15:111,16:110,17:[50,51,10,13]},extractor:null},{name:"Ruby",extension:"rb",mime:"application/ruby",description:"",signature:{0:35,1:33,2:47,3:117,4:115,5:114,6:47,7:98,8:105,9:110,10:47,11:114,12:117,13:98,14:121},extractor:null},{name:"perl",extension:"pl,pm,t,pod",mime:"application/perl",description:"",signature:{0:35,1:33,2:47,3:117,4:115,5:114,6:47,7:98,8:105,9:110,10:47,11:112,12:101,13:114,14:108},extractor:null},{name:"php",extension:"php,phtml,php3,php4,php5,php7,phps,php-s,pht,phar",mime:"application/php",description:"",signature:{0:60,1:63,2:112,3:104,4:112},extractor:null},{name:"Smile",extension:"sml",mime:"\tapplication/x-jackson-smile",description:"",signature:{0:58,1:41,2:10},extractor:null},{name:"Lua Bytecode",extension:"luac",mime:"application/x-lua",description:"",signature:{0:27,1:76,2:117,3:97},extractor:null},{name:"WebAssembly binary",extension:"wasm",mime:"application/octet-stream",description:"",signature:{0:0,1:97,2:115,3:109},extractor:null}]};function ce(e,t){var r=new ae(e.slice(t));r.continueUntil([80,75,5,6]),r.moveForwardsBy(20);var n=r.readInt(2,"le");return r.moveForwardsBy(n),r.carve()}function fe(e,t){var r="207250237254",n=new ae(e.slice(t)),o=n.getBytes(4).join("");return n.moveTo(function(e,t,r){var n=28;t&&(n+=4),e.moveTo(16);var o=e.readInt(4,r);return function(e,t,r,n){for(var o=0,i=0;i<n;i++){e.moveTo(t);var a=e.readInt(4,r);25===a?(e.moveTo(t+48),o+=e.readInt(8,r),e.moveTo(t+4),t+=e.readInt(4,r)):1===a&&(e.moveTo(t+36),o+=e.readInt(4,r),e.moveTo(t+4),t+=e.readInt(4,r))}return o}(e,n,r,o)}(n,function(e){return e===r||"254237250207"===e}(o),function(e){return"206250237254"===e||e===r}(o)?"le":"be")),n.carve()}for(var he=new Array(288),pe=0;pe<he.length;pe++)he[pe]=pe<=143?8:pe<=255?9:pe<=279?7:8;var de=xe(he),me=xe(new Array(30).fill(5)),ve=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function ye(e){for(var t=0;!t;){t=e.readBits(1,"le");var r=e.readBits(2,"le");if(0===r){e.moveForwardsBy(1);var n=e.readInt(2,"le");e.moveForwardsBy(2+n)}else if(1===r)we(e,de,me);else{if(2!==r)throw new Error(`Invalid block type while parsing DEFLATE stream at pos ${e.position}`);for(var o=e.readBits(5,"le")+257,i=e.readBits(5,"le")+1,a=e.readBits(4,"le")+4,s=new Uint8Array(ve.length),u=0;u<a;u++)s[ve[u]]=e.readBits(3,"le");for(var l=xe(s),c=new Uint8Array(o+i),f=void 0,h=void 0,p=void 0,d=0;d<o+i;)switch(f=Ae(e,l)){case 16:for(h=3+e.readBits(2,"le");h--;)c[d++]=p;break;case 17:for(h=3+e.readBits(3,"le");h--;)c[d++]=0;p=0;break;case 18:for(h=11+e.readBits(7,"le");h--;)c[d++]=0;p=0;break;default:c[d++]=f,p=f}we(e,xe(c.subarray(0,o)),xe(c.subarray(o)))}}e.bitPos>0&&e.moveForwardsBy(1)}var ge=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],be=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];function we(e,t,r){for(var n,o=0;(n=Ae(e,t))&&256!==n;){if(++o>1e4)throw new Error("Caught in probable infinite loop while parsing Huffman Block");n<256||(e.readBits(ge[n-257],"le"),n=Ae(e,r),e.readBits(be[n],"le"))}}function xe(e){for(var t=Math.max.apply(Math,e),r=Math.min.apply(Math,e),n=1<<t,o=new Uint32Array(n),i=1,a=0,s=2;i<=t;){for(var u=0;u<e.length;u++)if(e[u]===i){var l=void 0,c=void 0,f=void 0;for(l=0,c=a,f=0;f<i;f++)l=l<<1|1&c,c>>=1;for(var h=i<<16|u,p=l;p<n;p+=s)o[p]=h;a++}i++,a<<=1,s<<=1}return[o,t,r]}function Ae(e,t){var r=n(t,2),o=r[0],i=r[1],a=o[e.readBits(i,"le")&(1<<i)-1],s=a>>>16;if(s>i)throw new Error(`Invalid Huffman Code length while parsing DEFLATE block at pos ${e.position}: ${s}`);return e.moveBackwardsByBits(i-s),65535&a}function Be(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(e.length){for(var n=0;n<e.length;n++)if(Ee(e[n],t,r))return!0;return!1}return Ee(e,t,r)}function Ee(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;for(var n in e){var o=parseInt(n,10)+r;switch(typeof e[n]){case"number":if(t[o]!==e[n])return!1;break;case"object":if(e[n].indexOf(t[o])<0)return!1;break;case"function":if(!e[n](t[o]))return!1;break;default:throw new Error(`Unrecognised signature type at offset ${n}`)}}return!0}const Fe=function(){return u((function e(){o(this,e)}),null,[{key:"checkForValue",value:function(e){if(void 0===e)throw new Error("only use translation methods with .bind")}},{key:"toArrayBuffer",value:function(){throw new Error("toArrayBuffer has not been implemented")}},{key:"fromArrayBuffer",value:function(){throw new Error("fromArrayBuffer has not been implemented")}}])}();function Se(e,t,r){return t=c(t),l(e,ke()?Reflect.construct(t,r||[],c(e).constructor):t.apply(e,r))}function ke(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ke=function(){return!!e})()}const Ie=function(e){function t(){return o(this,t),Se(this,t,arguments)}return h(t,e),u(t,null,[{key:"toArrayBuffer",value:function(){t.checkForValue(this.value),this.value=new Uint8Array(this.value).buffer}},{key:"fromArrayBuffer",value:function(){t.checkForValue(this.value),this.value=Array.prototype.slice.call(new Uint8Array(this.value))}}])}(Fe);function Ce(e,t,r){return t=c(t),l(e,Te()?Reflect.construct(t,r||[],c(e).constructor):t.apply(e,r))}function Te(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Te=function(){return!!e})()}const Re=function(e){function t(){return o(this,t),Ce(this,t,arguments)}return h(t,e),u(t,null,[{key:"toArrayBuffer",value:function(){t.checkForValue(this.value),this.value=ie.isBigNumber(this.value)?U.strToArrayBuffer(this.value.toFixed()):new ArrayBuffer}},{key:"fromArrayBuffer",value:function(){t.checkForValue(this.value);try{this.value=new ie(U.arrayBufferToStr(this.value))}catch(e){this.value=new ie(NaN)}}}])}(Fe);function Oe(e,t,r){return t=c(t),l(e,Le()?Reflect.construct(t,r||[],c(e).constructor):t.apply(e,r))}function Le(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Le=function(){return!!e})()}const Me=function(e){function t(){return o(this,t),Oe(this,t,arguments)}return h(t,e),u(t,null,[{key:"toArrayBuffer",value:function(){var e=this;if(t.checkForValue(this.value),!L())return new Promise((function(t,r){U.readFile(e.value).then((function(t){return e.value=t.buffer})).then(t).catch(r)}));this.value=U.readFileSync(this.value)}},{key:"fromArrayBuffer",value:function(){t.checkForValue(this.value),this.value=new File(this.value,"unknown")}}])}(Fe);function Pe(e,t,r){return t=c(t),l(e,Ue()?Reflect.construct(t,r||[],c(e).constructor):t.apply(e,r))}function Ue(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ue=function(){return!!e})()}const De=function(e){function t(){return o(this,t),Pe(this,t,arguments)}return h(t,e),u(t,null,[{key:"toArrayBuffer",value:function(){t.checkForValue(this.value),this.value=this.value?U.strToArrayBuffer(this.value):new ArrayBuffer}},{key:"fromArrayBuffer",value:function(){t.checkForValue(this.value),this.value=this.value?U.arrayBufferToStr(this.value):""}}])}(Fe);function Ne(e,t,r){return t=c(t),l(e,_e()?Reflect.construct(t,r||[],c(e).constructor):t.apply(e,r))}function _e(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(_e=function(){return!!e})()}const $e=function(e){function t(){return o(this,t),Ne(this,t,arguments)}return h(t,e),u(t,null,[{key:"toArrayBuffer",value:function(){t.checkForValue(this.value),this.value=this.value?U.strToArrayBuffer(U.unescapeHtml(U.stripHtmlTags(this.value,!0))):new ArrayBuffer}}])}(De);function Xe(e,t,r){return t=c(t),l(e,je()?Reflect.construct(t,r||[],c(e).constructor):t.apply(e,r))}function je(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(je=function(){return!!e})()}const Ge=function(e){function t(){return o(this,t),Xe(this,t,arguments)}return h(t,e),u(t,null,[{key:"toArrayBuffer",value:function(){t.checkForValue(this.value),this.value=void 0!==this.value?U.strToArrayBuffer(JSON.stringify(this.value,null,4)):new ArrayBuffer}},{key:"fromArrayBuffer",value:function(){t.checkForValue(this.value),this.value=JSON.parse(U.arrayBufferToStr(this.value))}}])}(Fe);function Ze(e,t,r){return t=c(t),l(e,We()?Reflect.construct(t,r||[],c(e).constructor):t.apply(e,r))}function We(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(We=function(){return!!e})()}var He=function(e){function t(){return o(this,t),Ze(this,t,arguments)}return h(t,e),u(t,null,[{key:"toArrayBuffer",value:(n=d(v().mark((function e(){return v().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.checkForValue(this.value),!L()){e.next=5;break}this.value=this.value.map((function(e){return Uint8Array.from(e.data)})),e.next=8;break;case 5:return e.next=7,t.concatenateTypedArraysWithTypedElements.apply(t,y(this.value));case 7:this.value=e.sent;case 8:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"fromArrayBuffer",value:function(){t.checkForValue(this.value),this.value=[new File(this.value,"unknown")]}},{key:"concatenateTypedArraysWithTypedElements",value:(r=d(v().mark((function e(){var t,r,n,o,i,a,s,u,l,c,f,h,p,d=arguments;return v().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=0,r=d.length,n=new Array(r),o=0;o<r;o++)n[o]=d[o];for(i=0,a=n;i<a.length;i++)s=a[i],t+=s.size;u=new Uint8Array(t),l=0,c=0,f=n;case 6:if(!(c<f.length)){e.next=16;break}return h=f[c],e.next=10,U.readFile(h);case 10:p=e.sent,u.set(p,l),l+=p.length;case 13:c++,e.next=6;break;case 16:return e.abrupt("return",u);case 17:case"end":return e.stop()}}),e)}))),function(){return r.apply(this,arguments)})},{key:"concatenateTypedArrays",value:function(){for(var e=0,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];for(var o=0,i=r;o<i.length;o++)e+=i[o].length;for(var a=new Uint8Array(e),s=0,u=0,l=r;u<l.length;u++){var c=l[u];a.set(c,s),s+=c.length}return a}}]);var r,n}(Fe);const Qe=He;function Ve(e,t,r){return t=c(t),l(e,Ye()?Reflect.construct(t,r||[],c(e).constructor):t.apply(e,r))}function Ye(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ye=function(){return!!e})()}const Je=function(e){function t(){return o(this,t),Ve(this,t,arguments)}return h(t,e),u(t,null,[{key:"toArrayBuffer",value:function(){t.checkForValue(this.value),this.value="number"==typeof this.value?U.strToArrayBuffer(this.value.toString()):new ArrayBuffer}},{key:"fromArrayBuffer",value:function(){t.checkForValue(this.value),this.value=this.value?parseFloat(U.arrayBufferToStr(this.value)):0}}])}(Fe);var ze=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(o(this,e),this.value=new ArrayBuffer(0),this.type=e.ARRAY_BUFFER,t&&Object.prototype.hasOwnProperty.call(t,"value")&&Object.prototype.hasOwnProperty.call(t,"type"))this.set(t.value,t.type);else if(t&&null!==r)this.set(t,r);else if(t){var n=e.typeEnum(t.constructor.name);this.set(t,n)}}return u(e,[{key:"get",value:function(t){var r=this;return"string"==typeof t&&(t=e.typeEnum(t)),this.type!==t?L()?(this._translate(t),this.value):new Promise((function(e,n){r._translate(t).then((function(){e(r.value)})).catch(n)})):this.value}},{key:"set",value:function(t,r){if("string"==typeof r&&(r=e.typeEnum(r)),b().debug("Dish type: "+e.enumLookup(r)),this.value=t,this.type=r,!this.valid()){var n=U.truncate(JSON.stringify(this.value),25);throw new _(`Data is not a valid ${e.enumLookup(r)}: ${n}`)}}},{key:"presentAs",value:function(e){return this.clone().get(e)}},{key:"detectDishType",value:function(){var e=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object.keys(le);if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),!(e&&e.length>1))return[];var r=[],n={};for(var o in le)t.includes(o)&&(n[o]=le[o]);for(var i in n)n[i].forEach((function(t){Be(t.signature,e)&&r.push(t)}));return r}(new Uint8Array(this.value.slice(0,2048)));return e.length&&e[0].mime&&"text/plain"===e[0].mime?e[0].mime:null}},{key:"getTitle",value:(t=d(v().mark((function t(r){var n,o;return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n="",t.t0=this.type,t.next=t.t0===e.FILE?4:t.t0===e.LIST_FILE?6:t.t0===e.JSON?8:t.t0===e.NUMBER||t.t0===e.BIG_NUMBER?10:t.t0===e.ARRAY_BUFFER||t.t0===e.BYTE_ARRAY?12:15;break;case 4:return n=this.value.name,t.abrupt("break",26);case 6:return n=`${this.value.length} file(s)`,t.abrupt("break",26);case 8:return n="application/json",t.abrupt("break",26);case 10:return n=this.value.toString(),t.abrupt("break",26);case 12:if(null===(n=this.detectDishType())){t.next=15;break}return t.abrupt("break",26);case 15:return t.prev=15,(o=this.clone()).value=o.value.slice(0,256),t.next=20,o.get(e.STRING);case 20:n=t.sent,t.next=26;break;case 23:t.prev=23,t.t1=t.catch(15),b().error(`${e.enumLookup(this.type)} cannot be sliced. ${t.t1}`);case 26:return t.abrupt("return",n.slice(0,r));case 27:case"end":return t.stop()}}),t,this,[[15,23]])}))),function(e){return t.apply(this,arguments)})},{key:"valid",value:function(){switch(this.type){case e.BYTE_ARRAY:if(!(this.value instanceof Uint8Array||this.value instanceof Array))return!1;for(var t=0;t<this.value.length;t++)if("number"!=typeof this.value[t]||this.value[t]<0||this.value[t]>255)return!1;return!0;case e.STRING:case e.HTML:return"string"==typeof this.value;case e.NUMBER:return"number"==typeof this.value;case e.ARRAY_BUFFER:return this.value instanceof ArrayBuffer;case e.BIG_NUMBER:if(ie.isBigNumber(this.value))return!0;if(Object.keys(this.value).sort().equals(["c","e","s"])){var r=new ie;return r.c=this.value.c,r.e=this.value.e,r.s=this.value.s,this.value=r,!0}return!1;case e.JSON:return!0;case e.FILE:return this.value instanceof File;case e.LIST_FILE:return this.value instanceof Array&&this.value.reduce((function(e,t){return e&&t instanceof File}),!0);default:return!1}}},{key:"size",get:function(){switch(this.type){case e.BYTE_ARRAY:case e.STRING:case e.HTML:return this.value.length;case e.NUMBER:case e.BIG_NUMBER:return this.value.toString().length;case e.ARRAY_BUFFER:return this.value.byteLength;case e.JSON:return JSON.stringify(this.value).length;case e.FILE:return this.value.size;case e.LIST_FILE:return this.value.reduce((function(e,t){return e+t.size}),0);default:return-1}}},{key:"clone",value:function(){var t=new e;switch(this.type){case e.STRING:case e.HTML:case e.NUMBER:case e.BIG_NUMBER:t.set(this.value,this.type);break;case e.BYTE_ARRAY:case e.JSON:t.set(JSON.parse(JSON.stringify(this.value)),this.type);break;case e.ARRAY_BUFFER:t.set(this.value.slice(0),this.type);break;case e.FILE:t.set(new File([this.value],this.value.name,{type:this.value.type,lastModified:this.value.lastModified}),this.type);break;case e.LIST_FILE:t.set(this.value.map((function(e){return new File([e],e.name,{type:e.type,lastModified:e.lastModified})})),this.type);break;default:throw new _("Cannot clone Dish, unknown type")}return t}},{key:"_translate",value:function(t){var r=this;if(b().debug(`Translating Dish from ${e.enumLookup(this.type)} to ${e.enumLookup(t)}`),!L())return new Promise((function(n,o){r._toArrayBuffer().then((function(){return r.type=e.ARRAY_BUFFER})).then((function(){r._fromArrayBuffer(t),n()})).catch(o)}));this._toArrayBuffer(),this.type=e.ARRAY_BUFFER,this._fromArrayBuffer(t)}},{key:"_toArrayBuffer",value:function(){var t=this,r={browser:{[e.STRING]:function(){return Promise.resolve(De.toArrayBuffer.bind(t)())},[e.NUMBER]:function(){return Promise.resolve(Je.toArrayBuffer.bind(t)())},[e.HTML]:function(){return Promise.resolve($e.toArrayBuffer.bind(t)())},[e.ARRAY_BUFFER]:function(){return Promise.resolve()},[e.BIG_NUMBER]:function(){return Promise.resolve(Re.toArrayBuffer.bind(t)())},[e.JSON]:function(){return Promise.resolve(Ge.toArrayBuffer.bind(t)())},[e.FILE]:function(){return Me.toArrayBuffer.bind(t)()},[e.LIST_FILE]:function(){return Promise.resolve(Qe.toArrayBuffer.bind(t)())},[e.BYTE_ARRAY]:function(){return Promise.resolve(Ie.toArrayBuffer.bind(t)())}},node:{[e.STRING]:function(){return De.toArrayBuffer.bind(t)()},[e.NUMBER]:function(){return Je.toArrayBuffer.bind(t)()},[e.HTML]:function(){return $e.toArrayBuffer.bind(t)()},[e.ARRAY_BUFFER]:function(){},[e.BIG_NUMBER]:function(){return Re.toArrayBuffer.bind(t)()},[e.JSON]:function(){return Ge.toArrayBuffer.bind(t)()},[e.FILE]:function(){return Me.toArrayBuffer.bind(t)()},[e.LIST_FILE]:function(){return Qe.toArrayBuffer.bind(t)()},[e.BYTE_ARRAY]:function(){return Ie.toArrayBuffer.bind(t)()}}};try{return r[L()?"node":"browser"][this.type]()}catch(t){throw new _(`Error translating from ${e.enumLookup(this.type)} to ArrayBuffer: ${t}`)}}},{key:"_fromArrayBuffer",value:function(t){var r=this,n={[e.STRING]:function(){return De.fromArrayBuffer.bind(r)()},[e.NUMBER]:function(){return Je.fromArrayBuffer.bind(r)()},[e.HTML]:function(){return $e.fromArrayBuffer.bind(r)()},[e.ARRAY_BUFFER]:function(){},[e.BIG_NUMBER]:function(){return Re.fromArrayBuffer.bind(r)()},[e.JSON]:function(){return Ge.fromArrayBuffer.bind(r)()},[e.FILE]:function(){return Me.fromArrayBuffer.bind(r)()},[e.LIST_FILE]:function(){return Qe.fromArrayBuffer.bind(r)()},[e.BYTE_ARRAY]:function(){return Ie.fromArrayBuffer.bind(r)()}};try{n[t](),this.type=t}catch(r){throw new _(`Error translating from ArrayBuffer to ${e.enumLookup(t)}: ${r}`)}}}],[{key:"typeEnum",value:function(t){switch(t.toLowerCase()){case"bytearray":case"byte array":return e.BYTE_ARRAY;case"string":return e.STRING;case"number":return e.NUMBER;case"html":return e.HTML;case"arraybuffer":case"array buffer":return e.ARRAY_BUFFER;case"bignumber":case"big number":return e.BIG_NUMBER;case"json":case"object":return e.JSON;case"file":return e.FILE;case"list<file>":return e.LIST_FILE;default:throw new _("Invalid data type string. No matching enum.")}}},{key:"enumLookup",value:function(t){switch(t){case e.BYTE_ARRAY:return"byteArray";case e.STRING:return"string";case e.NUMBER:return"number";case e.HTML:return"html";case e.ARRAY_BUFFER:return"ArrayBuffer";case e.BIG_NUMBER:return"BigNumber";case e.JSON:return"JSON";case e.FILE:return"File";case e.LIST_FILE:return"List<File>";default:throw new _("Invalid data type enum. No matching type.")}}}]);var t}();ze.BYTE_ARRAY=0,ze.STRING=1,ze.NUMBER=2,ze.HTML=3,ze.ARRAY_BUFFER=4,ze.BIG_NUMBER=5,ze.JSON=6,ze.FILE=7,ze.LIST_FILE=8;const qe=ze,Ke=function(){function e(t){o(this,e),this.name="",this.type="",this._value=null,this.disabled=!1,this.hint="",this.rows=0,this.toggleValues=[],this.target=null,this.defaultIndex=0,this.maxLength=null,this.min=null,this.max=null,this.step=1,t&&this._parseConfig(t)}return u(e,[{key:"_parseConfig",value:function(e){this.name=e.name,this.type=e.type,this.defaultValue=e.value,this.disabled=!!e.disabled,this.hint=e.hint||!1,this.rows=e.rows||!1,this.toggleValues=e.toggleValues,this.target=void 0!==e.target?e.target:null,this.defaultIndex=void 0!==e.defaultIndex?e.defaultIndex:0,this.maxLength=e.maxLength||null,this.min=e.min,this.max=e.max,this.step=e.step}},{key:"config",get:function(){return this._value}},{key:"value",get:function(){return this._value},set:function(t){this._value=e.prepare(t,this.type)}}],[{key:"prepare",value:function(e,t){var r;switch(t){case"binaryString":case"binaryShortString":case"editableOption":case"editableOptionShort":return U.parseEscapedChars(e);case"byteArray":return"string"==typeof e?k(e=e.replace(/\s+/g,"")):e;case"number":if(null===e)return e;if(r=parseFloat(e),isNaN(r))throw"Invalid ingredient value. Not a number: "+U.truncate(e.toString(),10);return r;default:return e}}}])}();var et=function(){return u((function e(){o(this,e),this._inputType=-1,this._outputType=-1,this._presentType=-1,this._breakpoint=!1,this._disabled=!1,this._flowControl=!1,this._manualBake=!1,this._ingList=[],this.name="",this.module="",this.description="",this.infoURL=null}),[{key:"run",value:function(e,t){return e}},{key:"highlight",value:function(e,t){return!1}},{key:"highlightReverse",value:function(e,t){return!1}},{key:"present",value:function(e,t){return e}},{key:"inputType",get:function(){return qe.enumLookup(this._inputType)},set:function(e){this._inputType=qe.typeEnum(e)}},{key:"outputType",get:function(){return qe.enumLookup(this._outputType)},set:function(e){this._outputType=qe.typeEnum(e),this._presentType<0&&(this._presentType=this._outputType)}},{key:"presentType",get:function(){return qe.enumLookup(this._presentType)},set:function(e){this._presentType=qe.typeEnum(e)}},{key:"args",get:function(){return this._ingList.map((function(e){var t={name:e.name,type:e.type,value:e.defaultValue};return e.toggleValues&&(t.toggleValues=e.toggleValues),e.hint&&(t.hint=e.hint),e.rows&&(t.rows=e.rows),e.disabled&&(t.disabled=e.disabled),e.target&&(t.target=e.target),e.defaultIndex&&(t.defaultIndex=e.defaultIndex),e.maxLength&&(t.maxLength=e.maxLength),"number"==typeof e.min&&(t.min=e.min),"number"==typeof e.max&&(t.max=e.max),e.step&&(t.step=e.step),t}))},set:function(e){var t=this;e.forEach((function(e){var r=new Ke(e);t.addIngredient(r)}))}},{key:"config",get:function(){return{op:this.name,args:this._ingList.map((function(e){return e.config}))}}},{key:"addIngredient",value:function(e){this._ingList.push(e)}},{key:"ingValues",get:function(){return this._ingList.map((function(e){return e.value}))},set:function(e){var t=this;e.forEach((function(e,r){t._ingList[r].value=e}))}},{key:"breakpoint",get:function(){return this._breakpoint},set:function(e){this._breakpoint=!!e}},{key:"disabled",get:function(){return this._disabled},set:function(e){this._disabled=!!e}},{key:"flowControl",get:function(){return this._flowControl},set:function(e){this._flowControl=!!e}},{key:"manualBake",get:function(){return this._manualBake},set:function(e){this._manualBake=!!e}}])}();const tt=et;function rt(e,t,r){return t=c(t),l(e,nt()?Reflect.construct(t,r||[],c(e).constructor):t.apply(e,r))}function nt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(nt=function(){return!!e})()}function ot(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return it(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?it(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function it(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var at=[{name:"I",value:"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R"},{name:"II",value:"AJDKSIRUXBLHWTMCQGZNPYFVOE<F"},{name:"III",value:"BDFHJLCPRTXVZNYEIWGAKMUSQO<W"},{name:"IV",value:"ESOVPZJAYQUIRHXLNFTGKDCMWB<K"},{name:"V",value:"VZBRGITYUPSDNHLXAWMJQOFECK<A"},{name:"VI",value:"JPGVOUMFYQBENHZRDKASXLICTW<AN"},{name:"VII",value:"NZJHGRCXMYSWBOUFAIVLPEKQDT<AN"},{name:"VIII",value:"FKQHTLXOCBJSPDZRAMEWNIUYGV<AN"}],st=[{name:"Beta",value:"LEYJVCNIXWPBQMDRTAKZGFUHOS"},{name:"Gamma",value:"FSOKANUERHMBTIYCWLQPZXVGJD"}],ut=[{name:"B",value:"AY BR CU DH EQ FS GL IP JX KN MO TZ VW"},{name:"C",value:"AF BV CP DJ EI GO HY KR LZ MX NW TQ SU"},{name:"B Thin",value:"AE BN CK DQ FU GY HW IJ LO MP RX SZ TV"},{name:"C Thin",value:"AR BD CO EJ FN GT HK IV LM PW QZ SX UY"}],lt="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");function ct(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=U.ord(e);if(r>=65&&r<=90)return r-65;if(t)return r>=97&&r<=122?r-97:-1;throw new E("a2i called on non-uppercase ASCII character")}function ft(e){if(e>=0&&e<26)return U.chr(e+65);throw new E("i2a called on value outside 0..25")}var ht=function(){return u((function e(t,r,n,i){if(o(this,e),!/^[A-Z]{26}$/.test(t))throw new E("Rotor wiring must be 26 unique uppercase letters");if(!/^[A-Z]{0,26}$/.test(r))throw new E("Rotor steps must be 0-26 unique uppercase letters");if(!/^[A-Z]$/.test(n))throw new E("Rotor ring setting must be exactly one uppercase letter");if(!/^[A-Z]$/.test(i))throw new E("Rotor initial position must be exactly one uppercase letter");this.map=new Array(26),this.revMap=new Array(26);for(var a={},s=0;s<lt.length;s++){var u=ct(lt[s]),l=ct(t[s]);this.map[u]=l,this.revMap[l]=u,a[l]=!0}if(Object.keys(a).length!==lt.length)throw new E("Rotor wiring must have each letter exactly once");var c=ct(n);this.steps=new Set;var f,h=ot(r);try{for(h.s();!(f=h.n()).done;){var p=f.value;this.steps.add(U.mod(ct(p)-c,26))}}catch(e){h.e(e)}finally{h.f()}if(this.steps.size!==r.length)throw new E("Rotor steps must be unique");this.pos=U.mod(ct(i)-c,26)}),[{key:"step",value:function(){return this.pos=U.mod(this.pos+1,26),this.pos}},{key:"transform",value:function(e){return U.mod(this.map[U.mod(e+this.pos,26)]-this.pos,26)}},{key:"revTransform",value:function(e){return U.mod(this.revMap[U.mod(e+this.pos,26)]-this.pos,26)}}])}(),pt=function(){return u((function e(t){var r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"PairMapBase";o(this,e),this.pairs=t,this.map={},""!==t&&t.split(/\s+/).forEach((function(e){if(!/^[A-Z]{2}$/.test(e))throw new E(n+" must be a whitespace-separated list of uppercase letter pairs");var t=ct(e[0]),o=ct(e[1]);if(t!==o){if(Object.prototype.hasOwnProperty.call(r.map,t))throw new E(`${n} connects ${e[0]} more than once`);if(Object.prototype.hasOwnProperty.call(r.map,o))throw new E(`${n} connects ${e[1]} more than once`);r.map[t]=o,r.map[o]=t}}))}),[{key:"transform",value:function(e){return Object.prototype.hasOwnProperty.call(this.map,e)?this.map[e]:e}},{key:"revTransform",value:function(e){return this.transform(e)}}])}(),dt=function(e){function t(e){var r;if(o(this,t),r=rt(this,t,[e,"Reflector"]),26!==Object.keys(r.map).length)throw new E("Reflector must have exactly 13 pairs covering every letter");for(var n=new Array(26),i=0,a=Object.keys(r.map);i<a.length;i++){var s=a[i];n[s]=r.map[s]}return r.map=n,r}return h(t,e),u(t,[{key:"transform",value:function(e){return this.map[e]}}])}(pt),mt=function(e){function t(e){return o(this,t),rt(this,t,[e,"Plugboard"])}return h(t,e),u(t)}(pt),vt=function(){return u((function e(t,r,n){o(this,e),this.rotors=t,this.rotorsRev=[].concat(t).reverse(),this.reflector=r,this.plugboard=n}),[{key:"step",value:function(){var e=this.rotors[0],t=this.rotors[1];e.step(),(e.steps.has(e.pos)||t.steps.has(U.mod(t.pos+1,26)))&&(t.step(),t.steps.has(t.pos)&&this.rotors[2].step())}},{key:"crypt",value:function(e){var t,r="",n=ot(e);try{for(n.s();!(t=n.n()).done;){var o=t.value,i=ct(o,!0);if(-1!==i){this.step(),i=this.plugboard.transform(i);var a,s=ot(this.rotors);try{for(s.s();!(a=s.n()).done;)i=a.value.transform(i)}catch(e){s.e(e)}finally{s.f()}i=this.reflector.transform(i);var u,l=ot(this.rotorsRev);try{for(l.s();!(u=l.n()).done;)i=u.value.revTransform(i)}catch(e){l.e(e)}finally{l.f()}r+=ft(i=this.plugboard.revTransform(i))}else r+=o}}catch(e){n.e(e)}finally{n.f()}return r}}])}(),yt=function(e){function t(e,r,n){var i;if(o(this,t),i=rt(this,t,[e,r,n]),3!==e.length&&4!==e.length)throw new E("Enigma must have 3 or 4 rotors");return i}return h(t,e),u(t)}(vt);function gt(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return bt(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?bt(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function bt(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function wt(e,t,r){return t=c(t),l(e,xt()?Reflect.construct(t,r||[],c(e).constructor):t.apply(e,r))}function xt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(xt=function(){return!!e})()}var At=function(e){function t(){return o(this,t),wt(this,t,arguments)}return h(t,e),u(t,[{key:"copy",value:function(){return{map:this.map,revMap:this.revMap,pos:this.pos,step:this.step,transform:this.transform,revTransform:this.revTransform}}}])}(ht),Bt=u((function e(t){o(this,e),this.letter=t,this.edges=new Set,this.visited=!1})),Et=function(){return u((function e(t,r,n){o(this,e),this.pos=t,this.node1=r,this.node2=n,r.edges.add(this),n.edges.add(this),this.visited=!1}),[{key:"getOther",value:function(e){return this.node1===e?this.node2:this.node1}}])}(),Ft=function(){return u((function e(t,r){o(this,e),this.lowerCache=new Array(26),this.higherCache=new Array(26);for(var n=0;n<26;n++)this.higherCache[n]=new Array(26);this.changeRotors(t,r)}),[{key:"changeRotors",value:function(e,t){this.reflector=t,this.rotors=e,this.rotorsRev=[].concat(e).reverse(),this.cacheGen()}},{key:"step",value:function(e){for(var t=0;t<e-1;t++)this.rotors[t].step();this.cacheGen()}},{key:"cacheGen",value:function(){for(var e=0;e<26;e++){this.lowerCache[e]=void 0;for(var t=0;t<26;t++)this.higherCache[e][t]=void 0}for(var r=0;r<26;r++)if(void 0===this.lowerCache[r]){var n,o=r,i=gt(this.rotors);try{for(i.s();!(n=i.n()).done;)o=n.value.transform(o)}catch(e){i.e(e)}finally{i.f()}o=this.reflector.transform(o);var a,s=gt(this.rotorsRev);try{for(s.s();!(a=s.n()).done;)o=a.value.revTransform(o)}catch(e){s.e(e)}finally{s.f()}this.lowerCache[r]=o,this.lowerCache[o]=r}}},{key:"transform",value:function(e){return this.lowerCache[e]}}])}(),St=function(){return u((function e(t,r,n,i,a){o(this,e),this.baseScrambler=t,this.initialPos=n,this.changeRotor(r),this.end1=i,this.end2=a,this.cache=this.baseScrambler.higherCache[n]}),[{key:"changeRotor",value:function(e){this.rotor=e,this.rotor.pos+=this.initialPos}},{key:"step",value:function(){this.rotor.step(),this.cache=this.baseScrambler.higherCache[this.rotor.pos]}},{key:"transform",value:function(e){var t=e,r=this.cache[e];return void 0!==r?r:(t=this.rotor.transform(t),t=this.baseScrambler.transform(t),t=this.rotor.revTransform(t),this.cache[e]=t,this.cache[t]=e,t)}},{key:"getOtherEnd",value:function(e){return this.end1===e?this.end2:this.end1}},{key:"getPos",value:function(){var e="",t=U.mod(this.rotor.pos-1,26);e+=ft(t);for(var r=0;r<this.baseScrambler.rotors.length;r++)e+=ft(t=this.baseScrambler.rotors[r].pos);return e.split("").reverse().join("")}}])}(),kt=function(){return u((function e(t,r,i,a,s){var u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:void 0;if(o(this,e),i.length<a.length)throw new E("Crib overruns supplied ciphertext");if(a.length<2)throw new E("Crib is too short");if(a.length>25)throw new E("Crib is too long");for(var l=0;l<a.length;l++)if(i[l]===a[l])throw new E(`Invalid crib: character ${i[l]} at pos ${l} in both ciphertext and crib`);this.ciphertext=i,this.crib=a,this.initRotors(t),this.check=s,this.updateFn=u;var c=n(this.makeMenu(),2),f=c[0],h=c[1];this.wires=new Array(676),this.scramblers=new Array;for(var p=0;p<26;p++)this.scramblers.push(new Array);this.sharedScrambler=new Ft(this.baseRotors.slice(1),r),this.allScramblers=new Array,this.indicator=void 0;var d,m=gt(h);try{for(m.s();!(d=m.n()).done;){var v=d.value,y=this.baseRotors[0].copy(),g=ct(v.node1.letter),b=ct(v.node2.letter),w=new St(this.sharedScrambler,y,v.pos,g,b);0===v.pos&&(this.indicator=w),this.scramblers[g].push(w),this.scramblers[b].push(w),this.allScramblers.push(w)}}catch(e){m.e(e)}finally{m.f()}void 0===this.indicator&&(this.indicator=new St(this.sharedScrambler,this.baseRotors[0].copy(),0,void 0,void 0),this.allScramblers.push(this.indicator)),this.testRegister=ct(f.letter);var x,A=gt(f.edges);try{for(A.s();!(x=A.n()).done;){var B=x.value;this.testInput=[this.testRegister,ct(B.getOther(f).letter)];break}}catch(e){A.e(e)}finally{A.f()}}),[{key:"initRotors",value:function(e){this.baseRotors=[];var t,r=gt(e);try{for(r.s();!(t=r.n()).done;){var n=t.value,o=new At(n,"","A","A");this.baseRotors.push(o)}}catch(e){r.e(e)}finally{r.f()}}},{key:"changeRotors",value:function(e,t){this.initRotors(e),this.sharedScrambler.changeRotors(this.baseRotors.slice(1),t);var r,n=gt(this.allScramblers);try{for(n.s();!(r=n.n()).done;)r.value.changeRotor(this.baseRotors[0].copy())}catch(e){n.e(e)}finally{n.f()}}},{key:"update",value:function(){void 0!==this.updateFn&&this.updateFn.apply(this,arguments)}},{key:"dfs",value:function(e){var t=0,r=1,o=e,i=o.edges.size,a=new Set;e.visited=!0;var s,u=gt(e.edges);try{for(u.s();!(s=u.n()).done;){var l=s.value;if(!l.visited){l.visited=!0,a.add(l);var c=l.getOther(e);if(c.visited)t+=1;else{var f=n(this.dfs(c),5),h=f[0],p=f[1],d=f[2],m=f[3],v=f[4];t+=h,r+=p,a=new Set([].concat(y(a),y(v))),m>i&&(o=d,i=m)}}}}catch(e){u.e(e)}finally{u.f()}return[t,r,o,i,a]}},{key:"makeMenu",value:function(){var e,t=new Map,r=gt(this.ciphertext+this.crib);try{for(r.s();!(e=r.n()).done;){var n=e.value;if(!t.has(n)){var o=new Bt(n);t.set(n,o)}}}catch(e){r.e(e)}finally{r.f()}for(var i=0;i<this.crib.length;i++){var a=this.crib[i],s=this.ciphertext[i];new Et(i,t.get(a),t.get(s))}var u,l=[],c=gt(t.keys());try{for(c.s();!(u=c.n()).done;){var f=u.value;if(!t.get(f).visited){var h=this.dfs(t.get(f));l.push(h)}}}catch(e){c.e(e)}finally{c.f()}return l.sort((function(e,t){var r=t[0]-e[0];return 0===r&&(r=t[1]-e[1]),r})),this.nLoops=l[0][0],[l[0][2],l[0][4]]}},{key:"energise",value:function(e,t){var r=26*e+t;if(!this.wires[r]){this.wires[r]=!0;var n=26*t+e;if(this.wires[n]=!0,e!==this.testRegister&&t!==this.testRegister||(this.energiseCount++,26!==this.energiseCount)){for(var o=0;o<this.scramblers[e].length;o++){var i=this.scramblers[e][o],a=i.transform(t),s=i.getOtherEnd(e),u=26*s+a;if(!this.wires[u]&&(this.energise(s,a),26===this.energiseCount))return}if(e!==t)for(var l=0;l<this.scramblers[t].length;l++){var c=this.scramblers[t][l],f=c.transform(e),h=c.getOtherEnd(t),p=26*h+f;if(!this.wires[p]&&(this.energise(h,f),26===this.energiseCount))return}}}}},{key:"tryDecrypt",value:function(e){for(var t=this.indicator.rotor,r=t.pos,n=[],o=new mt(e),i=0;i<Math.min(26,this.ciphertext.length);i++){var a=this.indicator.transform(o.transform(ct(this.ciphertext[i])));n.push(ft(o.transform(a))),this.indicator.step(1)}return t.pos=r,n.join("")}},{key:"formatPair",value:function(e,t){return e<t?`${ft(e)}${ft(t)}`:`${ft(t)}${ft(e)}`}},{key:"checkingMachine",value:function(e){if(e!==this.testInput[1]){for(var t=0;t<this.wires.length;t++)this.wires[t]=!1;this.energiseCount=0,this.energise(this.testRegister,e)}var r=new Set;r.add(this.formatPair(this.testRegister,e));for(var n=0;n<26;n++){for(var o=0,i=void 0,a=0;a<26;a++)this.wires[26*n+a]&&(o++,i=a);if(o>1)return"";0!==o&&r.add(this.formatPair(n,i))}return y(r).join(" ")}},{key:"checkStop",value:function(){var e=this.energiseCount;if(26!==e){var t,r;if(25===e){for(var n=0;n<26;n++)if(!this.wires[26*this.testRegister+n]){t=n;break}}else{if(1!==e){if(!this.check)return[this.indicator.getPos(),"??",this.tryDecrypt("")];for(var o=void 0,i=0;i<26;i++){var a=this.checkingMachine(i);if(""!==a){if(void 0!==o)return[this.indicator.getPos(),"??",this.tryDecrypt("")];o=a}}if(void 0===o)return;return[this.indicator.getPos(),o,this.tryDecrypt(o)]}t=this.testInput[1]}if(this.check){if(""===(r=this.checkingMachine(t)))return}else r=`${ft(this.testRegister)}${ft(t)}`;var s=this.tryDecrypt(r);return[this.indicator.getPos(),r,s]}}},{key:"run",value:function(){for(var e=0,t=[],r=Math.pow(26,this.baseRotors.length),n=1;n<=r;n++){for(var o=0;o<this.wires.length;o++)this.wires[o]=!1;this.energiseCount=0,this.energise.apply(this,y(this.testInput));var i=this.checkStop();void 0!==i&&(e++,t.push(i));for(var a=1,s=1;s<this.baseRotors.length&&n%Math.pow(26,s)==0;s++)a++;a>1&&this.sharedScrambler.step(a);var u,l=gt(this.allScramblers);try{for(l.s();!(u=l.n()).done;)u.value.step()}catch(e){l.e(e)}finally{l.f()}a>3&&this.update(this.nLoops,e,n/r)}return t}}])}();function It(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Ct(e,t,r){return t=c(t),l(e,Tt()?Reflect.construct(t,r||[],c(e).constructor):t.apply(e,r))}function Tt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Tt=function(){return!!e})()}var Rt=function(e){function t(){var e;return o(this,t),(e=Ct(this,t)).name="Bombe",e.module="Bletchley",e.description="Emulation of the Bombe machine used at Bletchley Park to attack Enigma, based on work by Polish and British cryptanalysts.<br><br>To run this you need to have a 'crib', which is some known plaintext for a chunk of the target ciphertext, and know the rotors used. (See the 'Bombe (multiple runs)' operation if you don't know the rotors.) The machine will suggest possible configurations of the Enigma. Each suggestion has the rotor start positions (left to right) and known plugboard pairs.<br><br>Choosing a crib: First, note that Enigma cannot encrypt a letter to itself, which allows you to rule out some positions for possible cribs. Secondly, the Bombe does not simulate the Enigma's middle rotor stepping. The longer your crib, the more likely a step happened within it, which will prevent the attack working. However, other than that, longer cribs are generally better. The attack produces a 'menu' which maps ciphertext letters to plaintext, and the goal is to produce 'loops': for example, with ciphertext ABC and crib CAB, we have the mappings A<->C, B<->A, and C<->B, which produces a loop A-B-C-A. The more loops, the better the crib. The operation will output this: if your menu has too few loops or is too short, a large number of incorrect outputs will usually be produced. Try a different crib. If the menu seems good but the right answer isn't produced, your crib may be wrong, or you may have overlapped the middle rotor stepping - try a different crib.<br><br>Output is not sufficient to fully decrypt the data. You will have to recover the rest of the plugboard settings by inspection. And the ring position is not taken into account: this affects when the middle rotor steps. If your output is correct for a bit, and then goes wrong, adjust the ring and start position on the right-hand rotor together until the output improves. If necessary, repeat for the middle rotor.<br><br>By default this operation runs the checking machine, a manual process to verify the quality of Bombe stops, on each stop, discarding stops which fail. If you want to see how many times the hardware actually stops for a given input, disable the checking machine.<br><br>More detailed descriptions of the Enigma, Typex and Bombe operations <a href='https://github.com/gchq/CyberChef/wiki/Enigma,-the-Bombe,-and-Typex'>can be found here</a>.",e.infoURL="https://wikipedia.org/wiki/Bombe",e.inputType="string",e.outputType="JSON",e.presentType="html",e.args=[{name:"Model",type:"argSelector",value:[{name:"3-rotor",off:[1]},{name:"4-rotor",on:[1]}]},{name:"Left-most (4th) rotor",type:"editableOption",value:st,defaultIndex:0},{name:"Left-hand rotor",type:"editableOption",value:at,defaultIndex:0},{name:"Middle rotor",type:"editableOption",value:at,defaultIndex:1},{name:"Right-hand rotor",type:"editableOption",value:at,defaultIndex:2},{name:"Reflector",type:"editableOption",value:ut},{name:"Crib",type:"string",value:""},{name:"Crib offset",type:"number",value:0},{name:"Use checking machine",type:"boolean",value:!0}],e}return h(t,e),u(t,[{key:"updateStatus",value:function(e,t,r){var n=`Bombe run with ${e} loop${1===e?"":"s"} in menu (2+ desirable): ${t} stops, ${Math.floor(100*r)}% done`;self.sendStatusMessage(n)}},{key:"run",value:function(e,t){for(var r=t[0],n=t[5],o=t[6],i=t[7],a=t[8],s=[],u=0;u<4;u++)if(0!==u||"3-rotor"!==r){var l=t[u+1];l.includes("<")&&(l=l.split("<",2)[0]),s.push(l)}if(s.reverse(),0===o.length)throw new E("Crib cannot be empty");if(i<0)throw new E("Offset cannot be negative");e=e.replace(/[^A-Za-z]/g,"").toUpperCase(),o=o.replace(/[^A-Za-z]/g,"").toUpperCase();var c,f=e.slice(i),h=new dt(n);c=P()?this.updateStatus:void 0;var p=new kt(s,h,f,o,a,c),d=p.run();return{nLoops:p.nLoops,result:d}}},{key:"present",value:function(e){var t=`Bombe run on menu with ${e.nLoops} loop${1===e.nLoops?"":"s"} (2+ desirable). Note: Rotor positions are listed left to right and start at the beginning of the crib, and ignore stepping and the ring setting. Some plugboard settings are determined. A decryption preview starting at the beginning of the crib and ignoring stepping is also provided.\n\n`;t+="<table class='table table-hover table-sm table-bordered table-nonfluid'><tr><th>Rotor stops</th> <th>Partial plugboard</th> <th>Decryption preview</th></tr>\n";var r,o=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return It(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?It(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}(e.result);try{for(o.s();!(r=o.n()).done;){var i=n(r.value,3);t+=`<tr><td>${i[0]}</td> <td>${i[1]}</td> <td>${i[2]}</td></tr>\n`}}catch(e){o.e(e)}finally{o.f()}return t+"</table>"}}])}(tt);const Ot=Rt;var Lt=[{name:"Up (.)",value:"."},{name:"Centre",value:""},{name:"Down (x)",value:"x"}],Mt={A:"11000",B:"10011",C:"01110",D:"10010",E:"10000",F:"10110",G:"01011",H:"00101",I:"01100",J:"11010",K:"11110",L:"01001",M:"00111",N:"00110",O:"00011",P:"01101",Q:"11101",R:"01010",S:"10100",T:"00001",U:"11100",V:"01111",W:"11001",X:"10111",Y:"10101",Z:"10001",3:"00010",4:"01000",9:"00100","/":"00000"," ":"00100",".":"00100",8:"11111",5:"11011","-":"11111","+":"11011"},Pt={S1:43,S2:47,S3:51,S4:53,S5:59,M37:37,M61:61,X1:41,X2:31,X3:29,X4:26,X5:23},Ut={"No Pattern":{X:{1:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],2:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],3:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],4:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],5:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},S:{1:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],2:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],3:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],4:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],5:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},M:{1:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],2:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},"KH Pattern":{X:{1:[0,1,0,0,0,1,1,1,0,1,0,1,1,1,1,0,1,0,0,0,1,0,1,0,0,1,1,1,0,0,0,0,1,1,0,1,1,1,1,0,0],2:[1,0,0,1,1,1,0,0,0,1,0,1,1,1,1,0,0,1,1,0,0,1,0,0,1,1,0,1,1,0,0],3:[0,0,1,1,0,0,1,0,1,1,1,0,0,0,1,1,0,0,0,1,1,0,0,1,1,0,1,1,0],4:[1,1,0,0,1,0,0,1,1,1,1,0,0,1,1,0,1,1,1,0,0,0,0,1,0,0],5:[1,1,0,0,1,1,0,0,0,0,1,1,1,1,0,1,0,0,1,0,1,0,0]},S:{1:[0,1,0,0,0,1,1,0,1,0,1,0,0,1,1,1,0,1,0,1,0,1,1,1,1,0,1,0,1,0,1,0,1,0,1,0,0,1,0,1,1,0,1],2:[0,1,1,0,1,0,1,1,1,0,0,1,0,1,0,1,0,0,1,0,1,1,0,1,0,1,1,1,0,1,0,0,0,0,1,0,1,1,0,1,0,1,0,1,0,0,1],3:[0,1,0,1,0,1,0,0,1,1,1,0,0,0,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,1,1,0,1,0,1,0,0,1,0,1,0,1,1,0,0,1,0,1,0,1],4:[0,1,1,0,0,0,1,1,1,1,1,0,1,0,1,0,1,1,0,0,0,1,0,1,1,0,1,0,1,0,0,1,0,1,0,1,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0],5:[1,1,0,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,0,1,1,1,1,0,1,0,1,0,0,0,1,1,0,1,0,0,1,0]},M:{1:[0,1,1,1,1,0,1,1,1,1,0,1,1,1,0,1,1,1,1,0,1,1,0,0,0,0,1,1,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,0,1,1,1,1,0,0,0],2:[1,0,1,0,1,0,1,0,1,0,1,0,0,0,1,0,1,0,1,0,0,0,1,0,1,0,1,0,0,0,1,0,1,0,0,0,0]}},"ZMUG Pattern":{X:{1:[0,1,1,0,1,1,0,0,0,1,1,0,1,1,0,0,1,0,0,0,0,1,1,1,0,0,1,1,1,0,0,0,0,1,1,1,0,0,1,1,0],2:[1,1,0,1,1,0,0,0,0,1,1,1,0,1,1,1,1,0,1,0,0,0,1,1,0,0,1,1,0,0,0],3:[0,0,1,0,0,1,1,0,0,0,1,1,0,0,0,1,1,1,0,0,0,1,1,0,1,1,1,1,0],4:[1,0,1,0,1,0,0,1,1,0,0,0,1,1,0,0,1,0,1,1,1,0,0,1,0,1],5:[0,1,0,0,1,1,1,1,0,0,0,1,0,1,1,1,0,0,0,0,1,0,1]},S:{1:[1,1,0,1,0,0,1,1,0,0,0,1,1,1,0,0,1,1,0,0,0,1,1,0,0,0,1,1,1,1,0,0,1,1,1,0,0,1,1,1,0,0,0],2:[0,0,0,1,0,0,0,1,1,1,0,0,1,1,0,0,1,1,1,0,0,0,1,1,1,1,0,0,0,1,1,0,0,1,1,1,0,0,1,1,1,0,0,1,0,1,1],3:[0,1,0,0,1,1,0,0,1,1,1,0,0,1,1,1,0,0,1,0,0,0,1,1,1,1,0,0,0,1,0,0,0,1,1,1,0,0,0,1,1,0,0,0,1,1,0,0,1,1,1],4:[0,0,1,1,1,0,0,1,1,0,0,1,1,1,0,0,1,1,1,1,0,0,0,1,0,0,0,1,1,0,0,1,1,1,0,0,1,0,0,1,1,0,0,0,1,1,0,0,1,1,1,0,1],5:[1,0,0,1,1,1,0,0,0,1,0,0,0,1,1,1,1,0,0,1,1,1,0,0,1,0,0,1,1,1,1,0,0,0,1,1,0,0,1,1,1,0,0,1,1,0,0,1,1,1,0,0,1,0,0,0,1,1,0]},M:{1:[1,0,1,1,0,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,1,0,1,0,1,0,1],2:[0,1,0,1,0,1,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1]}},"BREAM Pattern":{X:{1:[0,1,1,1,1,0,1,0,1,1,0,1,0,1,1,0,0,1,0,0,1,1,0,1,0,0,0,0,1,1,0,0,0,0,1,1,1,1,0,0,0],2:[0,1,1,1,0,0,0,0,1,0,0,0,1,1,0,1,0,1,0,0,0,1,1,0,1,1,1,0,0,1,1],3:[1,1,0,0,1,1,0,1,1,0,0,1,1,1,0,0,0,0,1,0,0,1,1,0,1,1,1,0,0],4:[1,1,1,1,0,0,1,0,0,1,1,0,0,1,0,0,1,1,0,1,0,0,1,1,0,0],5:[0,1,1,1,0,1,1,1,0,0,0,1,0,0,1,1,0,1,0,0,0,1,0]},S:{1:[0,0,0,1,1,1,0,0,1,1,1,0,1,1,0,0,1,0,1,0,1,1,0,1,1,0,1,0,0,1,0,0,1,0,1,0,1,0,1,0,1,0,0],2:[1,1,0,1,0,0,1,1,1,0,0,0,0,0,1,1,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,0],3:[1,0,0,1,0,0,1,1,0,1,1,1,0,0,0,1,1,1,0,0,0,0,1,1,1,1,0,1,0,1,0,1,1,0,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1],4:[0,1,0,0,0,0,1,0,0,1,0,1,1,1,1,1,0,1,1,0,0,1,1,0,0,1,1,0,0,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,0,1,0,1],5:[1,0,1,0,1,0,0,1,1,0,0,1,1,0,1,1,0,0,1,0,0,0,1,0,0,0,0,1,0,1,1,0,1,1,1,1,0,1,1,1,0,0,1,0,1,0,0,0,1,1,0,1,0,1,0,1,0,1,0]},M:{1:[1,0,0,0,0,1,1,0,0,0,1,1,0,0,1,1,0,1,1,1,1,0,0,0,0,1,1,0,0,0,1,1,0,1,1,0,1,0,1,1,1,1,0,0,0,1,1,0,0,1,1,0,0,1,1,0,1,0,1,1,1],2:[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,1,1,0,1]}}},Dt=function(){return u((function e(t,r,n,i,a,s,u,l){for(var c in o(this,e),this.ITAlookup=Mt,this.ReverseITAlookup={},this.ITAlookup){var f=this.ITAlookup[c];this.ReverseITAlookup[f]=c}this.initThyratrons(r),this.ciphertext=t,this.qbusin=n,this.qbusswitches=i,this.control=a,this.starts=s,this.settotal=u,this.limitations=l,this.allCounters=[0,0,0,0,0],this.Zbits=[0,0,0,0,0],this.ZbitsOneBack=[0,0,0,0,0],this.Qbits=[0,0,0,0,0],this.Xbits=[0,0,0,0,0],this.Xptr=[0,0,0,0,0],this.XbitsOneBack=[0,0,0,0,0],this.Sbits=[0,0,0,0,0],this.Sptr=[0,0,0,0,0],this.SbitsOneBack=[0,0,0,0,0],this.Mptr=[0,0],this.rotorPtrs={},this.totalmotor=0,this.P5Zbit=[0,0]}),[{key:"run",value:function(){var e={printout:""};this.rotorPtrs={X1:this.starts.X1,X2:this.starts.X2,X3:this.starts.X3,X4:this.starts.X4,X5:this.starts.X5,M61:this.starts.M61,M37:this.starts.M37,S1:this.starts.S1,S2:this.starts.S2,S3:this.starts.S3,S4:this.starts.S4,S5:this.starts.S5};var t=1,r=this.control.fast,n=this.control.slow;e.printout+=r+" "+n+"\n";do{this.allCounters=[0,0,0,0,0],this.ZbitsOneBack=[0,0,0,0,0],this.XbitsOneBack=[0,0,0,0,0],this.runTape();var o="00",i="00";""!==r&&(o=this.rotorPtrs[r].toString().padStart(2,"0")),""!==n&&(i=this.rotorPtrs[n].toString().padStart(2,"0"));for(var a="",s=0;s<5;s++)this.allCounters[s]>this.settotal&&(a+=String.fromCharCode(s+97)+this.allCounters[s]+" ");""!==a&&(e.printout+=o+" "+i+" : ",e.printout+=a,e.printout+="\n"),""!==r&&(this.rotorPtrs[r]++,this.rotorPtrs[r]>Pt[r]&&(this.rotorPtrs[r]=1)),""!==n&&this.rotorPtrs[r]===this.starts[r]&&(this.rotorPtrs[n]++,this.rotorPtrs[n]>Pt[n]&&(this.rotorPtrs[n]=1)),t++}while(JSON.stringify(this.rotorPtrs)!==JSON.stringify(this.starts));return e.counters=this.allCounters,e.runcount=t,e}},{key:"runTape",value:function(){var e="";this.Xptr=[this.rotorPtrs.X1,this.rotorPtrs.X2,this.rotorPtrs.X3,this.rotorPtrs.X4,this.rotorPtrs.X5],this.Mptr=[this.rotorPtrs.M37,this.rotorPtrs.M61],this.Sptr=[this.rotorPtrs.S1,this.rotorPtrs.S2,this.rotorPtrs.S3,this.rotorPtrs.S4,this.rotorPtrs.S5];for(var t=0;t<this.ciphertext.length;t++){e=this.ciphertext.charAt(t),this.getQbusInputs(e);var r=this.runQbusProcessingConditional();this.runQbusProcessingAddition(r),this.P5Zbit[1]=this.P5Zbit[0],this.P5Zbit[0]=this.ITAlookup[e].split("")[4],this.stepThyratrons()}}},{key:"stepThyratrons",value:function(){var e=this.Xptr[1]-1;0===e&&(e=Pt.X2);var t=this.Sptr[0]-1;0===t&&(t=Pt.S1);var r=this.Xptr[4]-1;0===r&&(r=Pt.X5),0==(r-=1)&&(r=Pt.X5);var n=this.Sptr[4]-1;0===n&&(n=Pt.S5),0==(n-=1)&&(n=Pt.S5);var o=this.limitations.X2,i=this.limitations.S1,a=this.limitations.P5,s=1;if(o&&(s=this.rings.X[2][e-1]),i&&(s^=this.rings.S[1][t-1]),a){var u=this.P5Zbit[1];u^=this.rings.X[5][r-1],s^=u^=this.rings.S[5][n-1]}var l=this.rings.M[2][this.Mptr[0]-1];this.totalmotor=l,(o||i)&&(this.totalmotor=0===l&&1===s?0:1);for(var c=0;c<5;c++)this.Xptr[c]++,this.Xptr[c]>Pt["X"+(c+1)]&&(this.Xptr[c]=1);if(this.totalmotor)for(var f=0;f<5;f++)this.Sptr[f]++,this.Sptr[f]>Pt["S"+(f+1)]&&(this.Sptr[f]=1);1===this.rings.M[1][this.Mptr[1]-1]&&this.Mptr[0]++,this.Mptr[0]>Pt.M37&&(this.Mptr[0]=1),this.Mptr[1]++,this.Mptr[1]>Pt.M61&&(this.Mptr[1]=1)}},{key:"getQbusInputs",value:function(e){if(this.Zbits=this.ITAlookup[e].split(""),"Z"===this.qbusin.Z)this.Qbits=this.Zbits;else if("ΔZ"===this.qbusin.Z)for(var t=0;t<5;t++)this.Qbits[t]=this.Zbits[t]^this.ZbitsOneBack[t];this.ZbitsOneBack=this.Zbits.slice();for(var r=0;r<5;r++)this.Xbits[r]=this.rings.X[r+1][this.Xptr[r]-1];if(""!==this.qbusin.Chi)if("Χ"===this.qbusin.Chi)for(var n=0;n<5;n++)this.Qbits[n]=this.Qbits[n]^this.Xbits[n];else if("ΔΧ"===this.qbusin.Chi)for(var o=0;o<5;o++)this.Qbits[o]=this.Qbits[o]^this.Xbits[o],this.Qbits[o]=this.Qbits[o]^this.XbitsOneBack[o];this.XbitsOneBack=this.Xbits.slice();for(var i=0;i<5;i++)this.Sbits[i]=this.rings.S[i+1][this.Sptr[i]-1];if(""!==this.qbusin.Psi)if("Ψ"===this.qbusin.Psi)for(var a=0;a<5;a++)this.Qbits[a]=this.Qbits[a]^this.Sbits[a];else if("ΔΨ"===this.qbusin.Psi)for(var s=0;s<5;s++)this.Qbits[s]=this.Qbits[s]^this.Sbits[s],this.Qbits[s]=this.Qbits[s]^this.SbitsOneBack[s];this.SbitsOneBack=this.Sbits.slice()}},{key:"runQbusProcessingConditional",value:function(){for(var e=[-1,-1,-1,-1,-1],t=this.qbusswitches.condition.length,r=0;r<t;r++){var n=this.qbusswitches.condition[r];if(""!==n.Counter){for(var o=!0,i=n.Counter-1,a=this.readBusSwitches(n.Qswitches),s=0;s<5;s++)a[s]>=0&&a[s]!==parseInt(this.Qbits[s],10)&&(o=!1);n.Negate&&(o=!o),-1===e[i]?e[i]=o:o||(e[i]=!1)}}for(var u=0;u<5;u++)this.qbusswitches.condNegateAll&&-1!==e[u]&&(e[u]=!e[u]);return e}},{key:"runQbusProcessingAddition",value:function(e){var t=this.qbusswitches.addition[0],r=t.Qswitches.slice();if(t.C1){for(var n=0,o=0;o<5;o++)r[o]&&(n^=this.Qbits[o]);n===(""===t.Equals?-1:"."===t.Equals?0:1)?-1===e[0]&&(e[0]=!0):e[0]=!1}for(var i=0;i<5;i++)this.qbusswitches.addNegateAll&&-1!==e[i]&&(e[i]=!e[i]),(""===this.qbusswitches.totalMotor||"x"===this.qbusswitches.totalMotor&&0===this.totalmotor||"."===this.qbusswitches.totalMotor&&1===this.totalmotor)&&!0===e[i]&&this.allCounters[i]++}},{key:"initThyratrons",value:function(e){this.rings={X:{1:Ut[e].X[1].slice().reverse(),2:Ut[e].X[2].slice().reverse(),3:Ut[e].X[3].slice().reverse(),4:Ut[e].X[4].slice().reverse(),5:Ut[e].X[5].slice().reverse()},M:{1:Ut[e].M[1].slice().reverse(),2:Ut[e].M[2].slice().reverse()},S:{1:Ut[e].S[1].slice().reverse(),2:Ut[e].S[2].slice().reverse(),3:Ut[e].S[3].slice().reverse(),4:Ut[e].S[4].slice().reverse(),5:Ut[e].S[5].slice().reverse()}}}},{key:"readBusSwitches",value:function(e){for(var t=[-1,-1,-1,-1,-1],r=0;r<5;r++)"."===e[r]&&(t[r]=0),"x"===e[r]&&(t[r]=1);return t}}])}();function Nt(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return _t(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_t(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function _t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function $t(e,t,r){return t=c(t),l(e,Xt()?Reflect.construct(t,r||[],c(e).constructor):t.apply(e,r))}function Xt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Xt=function(){return!!e})()}const jt=function(e){function t(){var e;return o(this,t),(e=$t(this,t)).name="Colossus",e.module="Bletchley",e.description="Colossus is the name of the world's first electronic computer. Ten Colossi were designed by Tommy Flowers and built at the Post Office Research Labs at Dollis Hill in 1943 during World War 2. They assisted with the breaking of the German Lorenz cipher attachment, a machine created to encipher communications between Hitler and his generals on the front lines.<br><br>To learn more, Virtual Colossus, an online, browser based simulation of a Colossus computer is available at <a href='https://virtualcolossus.co.uk' target='_blank'>virtualcolossus.co.uk</a>.<br><br>A more detailed description of this operation can be found <a href='https://github.com/gchq/CyberChef/wiki/Colossus' target='_blank'>here</a>.",e.infoURL="https://wikipedia.org/wiki/Colossus_computer",e.inputType="string",e.outputType="JSON",e.presentType="html",e.args=[{name:"Input",type:"label"},{name:"Pattern",type:"option",value:["KH Pattern","ZMUG Pattern","BREAM Pattern"]},{name:"QBusZ",type:"option",value:["","Z","ΔZ"]},{name:"QBusΧ",type:"option",value:["","Χ","ΔΧ"]},{name:"QBusΨ",type:"option",value:["","Ψ","ΔΨ"]},{name:"Limitation",type:"option",value:["None","Χ2","Χ2 + P5","X2 + Ψ1","X2 + Ψ1 + P5"]},{name:"K Rack Option",type:"argSelector",value:[{name:"Select Program",on:[7],off:[8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40]},{name:"Top Section - Conditional",on:[8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],off:[7,31,32,33,34,35,36,37,38,39,40]},{name:"Bottom Section - Addition",on:[31,32,33,34,35,36,37,38,39,40],off:[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]},{name:"Advanced",on:[8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40],off:[7]}]},{name:"Program to run",type:"option",value:["","Letter Count","1+2=. (1+2 Break In, Find X1,X2)","4=5=/1=2 (Given X1,X2 find X4,X5)","/,5,U (Count chars to find X3)"]},{name:"K Rack: Conditional",type:"label"},{name:"R1-Q1",type:"editableOptionShort",value:Lt,defaultIndex:1},{name:"R1-Q2",type:"editableOptionShort",value:Lt,defaultIndex:1},{name:"R1-Q3",type:"editableOptionShort",value:Lt,defaultIndex:1},{name:"R1-Q4",type:"editableOptionShort",value:Lt,defaultIndex:1},{name:"R1-Q5",type:"editableOptionShort",value:Lt,defaultIndex:1},{name:"R1-Negate",type:"boolean",value:!1},{name:"R1-Counter",type:"option",value:["","1","2","3","4","5"]},{name:"R2-Q1",type:"editableOptionShort",value:Lt,defaultIndex:1},{name:"R2-Q2",type:"editableOptionShort",value:Lt,defaultIndex:1},{name:"R2-Q3",type:"editableOptionShort",value:Lt,defaultIndex:1},{name:"R2-Q4",type:"editableOptionShort",value:Lt,defaultIndex:1},{name:"R2-Q5",type:"editableOptionShort",value:Lt,defaultIndex:1},{name:"R2-Negate",type:"boolean",value:!1},{name:"R2-Counter",type:"option",value:["","1","2","3","4","5"]},{name:"R3-Q1",type:"editableOptionShort",value:Lt,defaultIndex:1},{name:"R3-Q2",type:"editableOptionShort",value:Lt,defaultIndex:1},{name:"R3-Q3",type:"editableOptionShort",value:Lt,defaultIndex:1},{name:"R3-Q4",type:"editableOptionShort",value:Lt,defaultIndex:1},{name:"R3-Q5",type:"editableOptionShort",value:Lt,defaultIndex:1},{name:"R3-Negate",type:"boolean",value:!1},{name:"R3-Counter",type:"option",value:["","1","2","3","4","5"]},{name:"Negate All",type:"boolean",value:!1},{name:"K Rack: Addition",type:"label"},{name:"Add-Q1",type:"boolean",value:!1},{name:"Add-Q2",type:"boolean",value:!1},{name:"Add-Q3",type:"boolean",value:!1},{name:"Add-Q4",type:"boolean",value:!1},{name:"Add-Q5",type:"boolean",value:!1},{name:"Add-Equals",type:"editableOptionShort",value:Lt,defaultIndex:1},{name:"Add-Counter1",type:"boolean",value:!1},{name:"Add Negate All",type:"boolean",value:!1},{name:"Total Motor",type:"editableOptionShort",value:Lt,defaultIndex:1},{name:"Master Control Panel",type:"label"},{name:"Set Total",type:"number",value:0},{name:"Fast Step",type:"option",value:["","X1","X2","X3","X4","X5","M37","M61","S1","S2","S3","S4","S5"]},{name:"Slow Step",type:"option",value:["","X1","X2","X3","X4","X5","M37","M61","S1","S2","S3","S4","S5"]},{name:"Start Χ1",type:"number",value:1},{name:"Start Χ2",type:"number",value:1},{name:"Start Χ3",type:"number",value:1},{name:"Start Χ4",type:"number",value:1},{name:"Start Χ5",type:"number",value:1},{name:"Start M61",type:"number",value:1},{name:"Start M37",type:"number",value:1},{name:"Start Ψ1",type:"number",value:1},{name:"Start Ψ2",type:"number",value:1},{name:"Start Ψ3",type:"number",value:1},{name:"Start Ψ4",type:"number",value:1},{name:"Start Ψ5",type:"number",value:1}],e}return h(t,e),u(t,[{key:"run",value:function(e,t){var r,n=Nt(e=e.toUpperCase());try{for(n.s();!(r=n.n()).done;){var o=r.value;if(-1==="ABCDEFGHIJKLMNOPQRSTUVWXYZ34589+-./".indexOf(o)){var i=o;throw"\n"===i&&(i="Carriage Return")," "===i&&(i="Space"),new E("Invalid ITA2 character : "+i)}}}catch(e){n.e(e)}finally{n.f()}var a=t[1],s={Z:t[2],Chi:t[3],Psi:t[4]},u=t[5],l=[!1,!1,!1];u.includes("Χ2")&&(l[0]=!0),u.includes("Ψ1")&&(l[1]=!0),u.includes("P5")&&(l[2]=!0);var c={X2:l[0],S1:l[1],P5:l[2]},f=t[6],h=t[7];"Select Program"===f&&""!==h&&(t=this.selectProgram(h,t));for(var p=new RegExp("^$|^[.x]$"),d=0;d<3;d++)for(var m=0;m<5;m++)if(!p.test(t[7*d+(m+9)]))throw new E("Switch R"+(d+1)+"-Q"+(m+1)+" can only be set to blank, . or x");if(!p.test(t[37]))throw new E("Switch Add-Equals can only be set to blank, . or x");if(!p.test(t[40]))throw new E("Switch Total Motor can only be set to blank, . or x");var v={condition:[{Qswitches:[t[9],t[10],t[11],t[12],t[13]],Negate:t[14],Counter:t[15]},{Qswitches:[t[16],t[17],t[18],t[19],t[20]],Negate:t[21],Counter:t[22]},{Qswitches:[t[23],t[24],t[25],t[26],t[27]],Negate:t[28],Counter:t[29]}],condNegateAll:t[30],addition:[{Qswitches:[t[32],t[33],t[34],t[35],t[36]],Equals:t[37],C1:t[38]}],addNegateAll:t[39],totalMotor:t[40]},y=parseInt(t[42],10);if(y<0||y>9999)throw new E("Set Total must be between 0000 and 9999");var g={fast:t[43],slow:t[44]};if(t[52]<1||t[52]>43)throw new E("Ψ1 start must be between 1 and 43");if(t[53]<1||t[53]>47)throw new E("Ψ2 start must be between 1 and 47");if(t[54]<1||t[54]>51)throw new E("Ψ3 start must be between 1 and 51");if(t[55]<1||t[55]>53)throw new E("Ψ4 start must be between 1 and 53");if(t[56]<1||t[57]>59)throw new E("Ψ5 start must be between 1 and 59");if(t[51]<1||t[51]>37)throw new E("Μ37 start must be between 1 and 37");if(t[50]<1||t[50]>61)throw new E("Μ61 start must be between 1 and 61");if(t[45]<1||t[45]>41)throw new E("Χ1 start must be between 1 and 41");if(t[46]<1||t[46]>31)throw new E("Χ2 start must be between 1 and 31");if(t[47]<1||t[47]>29)throw new E("Χ3 start must be between 1 and 29");if(t[48]<1||t[48]>26)throw new E("Χ4 start must be between 1 and 26");if(t[49]<1||t[49]>23)throw new E("Χ5 start must be between 1 and 23");var b={X1:t[45],X2:t[46],X3:t[47],X4:t[48],X5:t[49],M61:t[50],M37:t[51],S1:t[52],S2:t[53],S3:t[54],S4:t[55],S5:t[56]};return new Dt(e,a,s,v,g,b,y,c).run()}},{key:"selectProgram",value:function(e,t){return"Letter Count"===e&&(t[9]="",t[10]="",t[11]="",t[12]="",t[13]="",t[14]=!1,t[15]="1",t[22]="",t[29]="",t[30]=!1,t[38]=!1),"1+2=. (1+2 Break In, Find X1,X2)"===e&&(t[15]="",t[22]="",t[29]="",t[32]=!0,t[33]=!0,t[34]=!1,t[35]=!1,t[36]=!1,t[37]=".",t[38]=!0),"4=5=/1=2 (Given X1,X2 find X4,X5)"===e&&(t[9]=".",t[10]=".",t[11]="",t[12]=".",t[13]=".",t[14]=!0,t[15]="1",t[16]="x",t[17]="x",t[18]="",t[19]="x",t[20]="x",t[21]=!0,t[22]="1",t[29]="",t[30]=!0,t[38]=!1),"/,5,U (Count chars to find X3)"===e&&(t[9]=".",t[10]=".",t[11]=".",t[12]=".",t[13]=".",t[14]=!1,t[15]="1",t[16]="x",t[17]="x",t[18]=".",t[19]="x",t[20]="x",t[21]=!1,t[22]="2",t[23]="x",t[24]="x",t[25]="x",t[26]=".",t[27]=".",t[28]=!1,t[29]="3",t[30]=!1,t[38]=!1),t}},{key:"present",value:function(e){var t="Colossus Printer\n\n";t+=e.printout+"\n\n",t+="Colossus Counters\n\n",t+="<table class='table table-hover table-sm table-bordered table-nonfluid'><tr><th>C1</th> <th>C2</th> <th>C3</th> <th>C4</th> <th>C5</th></tr>\n",t+="<tr>";var r,n=Nt(e.counters);try{for(n.s();!(r=n.n()).done;)t+=`<td>${r.value}</td>\n`}catch(e){n.e(e)}finally{n.f()}return(t+="</tr>")+"</table>"}}])}(tt);function Gt(e,t,r){return t=c(t),l(e,Zt()?Reflect.construct(t,r||[],c(e).constructor):t.apply(e,r))}function Zt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Zt=function(){return!!e})()}var Wt=function(e){function t(){var e;return o(this,t),(e=Gt(this,t)).name="Enigma",e.module="Bletchley",e.description="Encipher/decipher with the WW2 Enigma machine.<br><br>Enigma was used by the German military, among others, around the WW2 era as a portable cipher machine to protect sensitive military, diplomatic and commercial communications.<br><br>The standard set of German military rotors and reflectors are provided. To configure the plugboard, enter a string of connected pairs of letters, e.g. <code>AB CD EF</code> connects A to B, C to D, and E to F. This is also used to create your own reflectors. To create your own rotor, enter the letters that the rotor maps A to Z to, in order, optionally followed by <code><</code> then a list of stepping points.<br>This is deliberately fairly permissive with rotor placements etc compared to a real Enigma (on which, for example, a four-rotor Enigma uses only the thin reflectors and the beta or gamma rotor in the 4th slot).<br><br>More detailed descriptions of the Enigma, Typex and Bombe operations <a href='https://github.com/gchq/CyberChef/wiki/Enigma,-the-Bombe,-and-Typex'>can be found here</a>.",e.infoURL="https://wikipedia.org/wiki/Enigma_machine",e.inputType="string",e.outputType="string",e.args=[{name:"Model",type:"argSelector",value:[{name:"3-rotor",off:[1,2,3]},{name:"4-rotor",on:[1,2,3]}]},{name:"Left-most (4th) rotor",type:"editableOption",value:st,defaultIndex:0},{name:"Left-most rotor ring setting",type:"option",value:lt},{name:"Left-most rotor initial value",type:"option",value:lt},{name:"Left-hand rotor",type:"editableOption",value:at,defaultIndex:0},{name:"Left-hand rotor ring setting",type:"option",value:lt},{name:"Left-hand rotor initial value",type:"option",value:lt},{name:"Middle rotor",type:"editableOption",value:at,defaultIndex:1},{name:"Middle rotor ring setting",type:"option",value:lt},{name:"Middle rotor initial value",type:"option",value:lt},{name:"Right-hand rotor",type:"editableOption",value:at,defaultIndex:2},{name:"Right-hand rotor ring setting",type:"option",value:lt},{name:"Right-hand rotor initial value",type:"option",value:lt},{name:"Reflector",type:"editableOption",value:ut},{name:"Plugboard",type:"string",value:""},{name:"Strict output",hint:"Remove non-alphabet letters and group output",type:"boolean",value:!0}],e}return h(t,e),u(t,[{key:"parseRotorStr",value:function(e,t){if(""===e)throw new E(`Rotor ${t} must be provided.`);return e.includes("<")?e.split("<",2):[e,""]}},{key:"run",value:function(e,t){for(var r=t[0],o=t[13],i=t[14],a=t[15],s=[],u=0;u<4;u++)if(0!==u||"3-rotor"!==r){var l=n(this.parseRotorStr(t[3*u+1],1),2),c=l[0],f=l[1];s.push(new ht(c,f,t[3*u+2],t[3*u+3]))}s.reverse();var h=new dt(o),p=new mt(i);a&&(e=e.replace(/[^A-Za-z]/g,""));var d=new yt(s,h,p).crypt(e);return a&&(d=d.replace(/([A-Z]{5})(?!$)/g,"$1 ")),d}},{key:"highlight",value:function(e,t){if(!1===t[13])return e}},{key:"highlightReverse",value:function(e,t){if(!1===t[13])return e}}])}(tt);const Ht=Wt;function Qt(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return Vt(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Vt(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function Vt(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Yt(e,t,r){return t=c(t),l(e,Jt()?Reflect.construct(t,r||[],c(e).constructor):t.apply(e,r))}function Jt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Jt=function(){return!!e})()}var zt=function(e){function t(){var e;return o(this,t),(e=Yt(this,t)).name="Lorenz",e.module="Bletchley",e.description="The Lorenz SZ40/42 cipher attachment was a WW2 German rotor cipher machine with twelve rotors which attached in-line between remote teleprinters.<br><br>It used the Vernam cipher with two groups of five rotors (named the psi(ψ) wheels and chi(χ) wheels at Bletchley Park) to create two pseudorandom streams of five bits, encoded in ITA2, which were XOR added to the plaintext. Two other rotors, dubbed the mu(μ) or motor wheels, could hold up the stepping of the psi wheels meaning they stepped intermittently.<br><br>Each rotor has a different number of cams/lugs around their circumference which could be set active or inactive changing the key stream.<br><br>Three models of the Lorenz are emulated, SZ40, SZ42a and SZ42b and three example wheel patterns (the lug settings) are included (KH, ZMUG & BREAM) with the option to set a custom set using the letter 'x' for active or '.' for an inactive lug.<br><br>The input can either be plaintext or ITA2 when sending and ITA2 when receiving.<br><br>To learn more, Virtual Lorenz, an online, browser based simulation of the Lorenz SZ40/42 is available at <a href='https://lorenz.virtualcolossus.co.uk' target='_blank'>lorenz.virtualcolossus.co.uk</a>.<br><br>A more detailed description of this operation can be found <a href='https://github.com/gchq/CyberChef/wiki/Lorenz-SZ' target='_blank'>here</a>.",e.infoURL="https://wikipedia.org/wiki/Lorenz_cipher",e.inputType="string",e.outputType="string",e.args=[{name:"Model",type:"option",value:["SZ40","SZ42a","SZ42b"]},{name:"Wheel Pattern",type:"argSelector",value:[{name:"KH Pattern",off:[19,20,21,22,23,24,25,26,27,28,29,30]},{name:"ZMUG Pattern",off:[19,20,21,22,23,24,25,26,27,28,29,30]},{name:"BREAM Pattern",off:[19,20,21,22,23,24,25,26,27,28,29,30]},{name:"No Pattern",off:[19,20,21,22,23,24,25,26,27,28,29,30]},{name:"Custom",on:[19,20,21,22,23,24,25,26,27,28,29,30]}]},{name:"KT-Schalter",type:"boolean",value:!1},{name:"Mode",type:"argSelector",value:[{name:"Send",on:[4],off:[5]},{name:"Receive",off:[4],on:[5]}]},{name:"Input Type",type:"option",value:["Plaintext","ITA2"]},{name:"Output Type",type:"option",value:["Plaintext","ITA2"]},{name:"ITA2 Format",type:"option",value:["5/8/9","+/-/."]},{name:"Ψ1 start (1-43)",type:"number",value:1},{name:"Ψ2 start (1-47)",type:"number",value:1},{name:"Ψ3 start (1-51)",type:"number",value:1},{name:"Ψ4 start (1-53)",type:"number",value:1},{name:"Ψ5 start (1-59)",type:"number",value:1},{name:"Μ37 start (1-37)",type:"number",value:1},{name:"Μ61 start (1-61)",type:"number",value:1},{name:"Χ1 start (1-41)",type:"number",value:1},{name:"Χ2 start (1-31)",type:"number",value:1},{name:"Χ3 start (1-29)",type:"number",value:1},{name:"Χ4 start (1-26)",type:"number",value:1},{name:"Χ5 start (1-23)",type:"number",value:1},{name:"Ψ1 lugs (43)",type:"string",value:".x...xx.x.x..xxx.x.x.xxxx.x.x.x.x.x..x.xx.x"},{name:"Ψ2 lugs (47)",type:"string",value:".xx.x.xxx..x.x.x..x.xx.x.xxx.x....x.xx.x.x.x..x"},{name:"Ψ3 lugs (51)",type:"string",value:".x.x.x..xxx....x.x.xx.x.x.x..xxx.x.x..x.x.xx..x.x.x"},{name:"Ψ4 lugs (53)",type:"string",value:".xx...xxxxx.x.x.xx...x.xx.x.x..x.x.xx.x..x.x.x.x.x.x."},{name:"Ψ5 lugs (59)",type:"string",value:"xx...xx.x..x.xx.x...x.x.x.x.x.x.x.x.xx..xxxx.x.x...xx.x..x."},{name:"Μ37 lugs (37)",type:"string",value:"x.x.x.x.x.x...x.x.x...x.x.x...x.x...."},{name:"Μ61 lugs (61)",type:"string",value:".xxxx.xxxx.xxx.xxxx.xx....xxx.xxxx.xxxx.xxxx.xxxx.xxx.xxxx..."},{name:"Χ1 lugs (41)",type:"string",value:".x...xxx.x.xxxx.x...x.x..xxx....xx.xxxx.."},{name:"Χ2 lugs (31)",type:"string",value:"x..xxx...x.xxxx..xx..x..xx.xx.."},{name:"Χ3 lugs (29)",type:"string",value:"..xx..x.xxx...xx...xx..xx.xx."},{name:"Χ4 lugs (26)",type:"string",value:"xx..x..xxxx..xx.xxx....x.."},{name:"Χ5 lugs (23)",type:"string",value:"xx..xx....xxxx.x..x.x.."}],e}return h(t,e),u(t,[{key:"run",value:function(e,t){var r=t[0],n=t[1],o=t[2],i=t[3],a=t[4],s=t[5],u=t[6],l=t[19],c=t[20],f=t[21],h=t[22],p=t[23],d=t[24],m=t[25],v=t[26],y=t[27],g=t[28],b=t[29],w=t[30],x=t[7],A=t[8],B=t[9],F=t[10],S=t[11],k=t[12],I=t[13],C=t[14],T=t[15],R=t[16],O=t[17],L=t[18];if(this.reverseTable(),x<1||x>43)throw new E("Ψ1 start must be between 1 and 43");if(A<1||A>47)throw new E("Ψ2 start must be between 1 and 47");if(B<1||B>51)throw new E("Ψ3 start must be between 1 and 51");if(F<1||F>53)throw new E("Ψ4 start must be between 1 and 53");if(S<1||S>59)throw new E("Ψ5 start must be between 1 and 59");if(k<1||k>37)throw new E("Μ37 start must be between 1 and 37");if(I<1||I>61)throw new E("Μ61 start must be between 1 and 61");if(C<1||C>41)throw new E("Χ1 start must be between 1 and 41");if(T<1||T>31)throw new E("Χ2 start must be between 1 and 31");if(R<1||R>29)throw new E("Χ3 start must be between 1 and 29");if(O<1||O>26)throw new E("Χ4 start must be between 1 and 26");if(L<1||L>23)throw new E("Χ5 start must be between 1 and 23");var M="";if("Custom"===n){var P=new RegExp("^[.xX]*$");if(43!==l.length||!P.test(l))throw new E("Ψ1 custom lugs must be 43 long and can only include . or x ");if(47!==c.length||!P.test(c))throw new E("Ψ2 custom lugs must be 47 long and can only include . or x");if(51!==f.length||!P.test(f))throw new E("Ψ3 custom lugs must be 51 long and can only include . or x");if(53!==h.length||!P.test(h))throw new E("Ψ4 custom lugs must be 53 long and can only include . or x");if(59!==p.length||!P.test(p))throw new E("Ψ5 custom lugs must be 59 long and can only include . or x");if(37!==d.length||!P.test(d))throw new E("M37 custom lugs must be 37 long and can only include . or x");if(61!==m.length||!P.test(m))throw new E("M61 custom lugs must be 61 long and can only include . or x");if(41!==v.length||!P.test(v))throw new E("Χ1 custom lugs must be 41 long and can only include . or x");if(31!==y.length||!P.test(y))throw new E("Χ2 custom lugs must be 31 long and can only include . or x");if(29!==g.length||!P.test(g))throw new E("Χ3 custom lugs must be 29 long and can only include . or x");if(26!==b.length||!P.test(b))throw new E("Χ4 custom lugs must be 26 long and can only include . or x");if(23!==w.length||!P.test(w))throw new E("Χ5 custom lugs must be 23 long and can only include . or x");(M=nr["No Pattern"]).S[1]=this.readLugs(l),M.S[2]=this.readLugs(c),M.S[3]=this.readLugs(f),M.S[4]=this.readLugs(h),M.S[5]=this.readLugs(p),M.M[1]=this.readLugs(m),M.M[2]=this.readLugs(d),M.X[1]=this.readLugs(v),M.X[2]=this.readLugs(y),M.X[3]=this.readLugs(g),M.X[4]=this.readLugs(b),M.X[5]=this.readLugs(w)}else M=nr[n];var U=M.X,D=M.S,N=M.M,_=this.convertToITA2(e,a,i),$=[],X=[],j=N[1][I-1],G=N[2][k-1],Z=[0,0,0],W=this,H=Array.prototype.map.call(_,(function(e){var t=e.toUpperCase(),n=T+1;32===n&&(n=1);var a=x+1;if(44===a&&(a=1),X=[U[1][C-1],U[2][T-1],U[3][R-1],U[4][O-1],U[5][L-1]],$=[D[1][x-1],D[2][A-1],D[3][B-1],D[4][F-1],D[5][S-1]],void 0===qt[t])return"";for(var s=[],l=0;l<=4;l++)s[l]=qt[t][l]^$[l]^X[l];var c=s.join("");--C<1&&(C=41),--T<1&&(T=31),--R<1&&(R=29),--O<1&&(O=26),--L<1&&(L=23),--I<1&&(I=61),1===j&&--k<1&&(k=37);var f,h=G,p=0;if(Z[2]=Z[1],Z[1]=Z[0],Z[0]="Send"===i?parseInt(qt[t][4],10):parseInt(s[4],10),"SZ42a"===r)p=parseInt(U[2][n-1],10),o&&(p=p===Z[2]?0:1),f=0===h&&1===p?0:1;else if("SZ42b"===r)p=1,parseInt(U[2][n-1],10)===parseInt(D[1][a-1],10)&&(p=0),o&&(p=p===Z[2]?0:1),f=0===h&&1===p?0:1;else{if("SZ40"!==r)throw new E("Lorenz model type not recognised");f=h}1===f&&(--x<1&&(x=43),--A<1&&(A=47),--B<1&&(B=51),--F<1&&(F=53),--S<1&&(S=59)),j=N[1][I-1],G=N[2][k-1];var d=W.REVERSE_ITA2_TABLE[c];return"5/8/9"===u&&("+"===d&&(d="5"),"-"===d&&(d="8"),"."===d&&(d="9")),d})),Q=H.join("");return this.convertFromITA2(Q,s,i)}},{key:"reverseTable",value:function(){for(var e in this.REVERSE_ITA2_TABLE={},this.REVERSE_FIGSHIFT_TABLE={},qt){var t=qt[e];this.REVERSE_ITA2_TABLE[t]=e}for(var r in rr){var n=rr[r];this.REVERSE_FIGSHIFT_TABLE[n]=r}}},{key:"readLugs",value:function(e){return Array.prototype.map.call(e,(function(e){return"."===e?0:1}))}},{key:"convertToITA2",value:function(e,t,r){var n,o="",i=!1,a=Qt(e);try{for(a.s();!(n=a.n()).done;){var s=n.value.toUpperCase();if("ITA2"===t||"Receive"===r){if(-1===er.indexOf(s)){var u=s;throw"\n"===u&&(u="Carriage Return")," "===u&&(u="Space"),new E("Invalid ITA2 character : "+u)}o+=s}else{if(-1===Kt.indexOf(s))throw new E("Invalid Plaintext character : "+s);i||-1===tr.indexOf(s)?i?"\n"===s?o+="34":"\r"===s?o+="4":-1===tr.indexOf(s)?(i=!1,o+="88"+s):o+=rr[s]:o+="\n"===s?"34":"\r"===s?"4":s:(i=!0,o+="55"+rr[s])}}}catch(e){a.e(e)}finally{a.f()}return o}},{key:"convertFromITA2",value:function(e,t,r){var n,o="",i=!1,a=Qt(e);try{for(a.s();!(n=a.n()).done;){var s=n.value;"Receive"===r&&"Plaintext"===t?"5"===s||"+"===s?i=!0:"8"===s||"-"===s?i=!1:o+="9"===s?" ":"3"===s?"\n":"4"===s?"":"/"===s?"/":i?this.REVERSE_FIGSHIFT_TABLE[s]:s:o+=s}}catch(e){a.e(e)}finally{a.f()}return o}}])}(tt),qt={A:"11000",B:"10011",C:"01110",D:"10010",E:"10000",F:"10110",G:"01011",H:"00101",I:"01100",J:"11010",K:"11110",L:"01001",M:"00111",N:"00110",O:"00011",P:"01101",Q:"11101",R:"01010",S:"10100",T:"00001",U:"11100",V:"01111",W:"11001",X:"10111",Y:"10101",Z:"10001",3:"00010",4:"01000",9:"00100","/":"00000"," ":"00100",".":"00100",8:"11111",5:"11011","-":"11111","+":"11011"},Kt="ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890+-'()/:=?,. \n\r",er="ABCDEFGHIJKLMNOPQRSTUVWXYZ34589+-./",tr="1234567890+-'()/:=?,.",rr={1:"Q",2:"W",3:"E",4:"R",5:"T",6:"Y",7:"U",8:"I",9:"O",0:"P"," ":"9","-":"A","?":"B",":":"C","#":"D","%":"F","@":"G","£":"H","":"J","(":"K",")":"L",".":"M",",":"N","'":"S","=":"V","/":"X","+":"Z","\n":"3","\r":"4"},nr={"No Pattern":{X:{1:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],2:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],3:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],4:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],5:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},S:{1:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],2:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],3:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],4:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],5:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},M:{1:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],2:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},"KH Pattern":{X:{1:[0,1,0,0,0,1,1,1,0,1,0,1,1,1,1,0,1,0,0,0,1,0,1,0,0,1,1,1,0,0,0,0,1,1,0,1,1,1,1,0,0],2:[1,0,0,1,1,1,0,0,0,1,0,1,1,1,1,0,0,1,1,0,0,1,0,0,1,1,0,1,1,0,0],3:[0,0,1,1,0,0,1,0,1,1,1,0,0,0,1,1,0,0,0,1,1,0,0,1,1,0,1,1,0],4:[1,1,0,0,1,0,0,1,1,1,1,0,0,1,1,0,1,1,1,0,0,0,0,1,0,0],5:[1,1,0,0,1,1,0,0,0,0,1,1,1,1,0,1,0,0,1,0,1,0,0]},S:{1:[0,1,0,0,0,1,1,0,1,0,1,0,0,1,1,1,0,1,0,1,0,1,1,1,1,0,1,0,1,0,1,0,1,0,1,0,0,1,0,1,1,0,1],2:[0,1,1,0,1,0,1,1,1,0,0,1,0,1,0,1,0,0,1,0,1,1,0,1,0,1,1,1,0,1,0,0,0,0,1,0,1,1,0,1,0,1,0,1,0,0,1],3:[0,1,0,1,0,1,0,0,1,1,1,0,0,0,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,1,1,0,1,0,1,0,0,1,0,1,0,1,1,0,0,1,0,1,0,1],4:[0,1,1,0,0,0,1,1,1,1,1,0,1,0,1,0,1,1,0,0,0,1,0,1,1,0,1,0,1,0,0,1,0,1,0,1,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0],5:[1,1,0,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,0,1,1,1,1,0,1,0,1,0,0,0,1,1,0,1,0,0,1,0]},M:{1:[0,1,1,1,1,0,1,1,1,1,0,1,1,1,0,1,1,1,1,0,1,1,0,0,0,0,1,1,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,0,1,1,1,1,0,0,0],2:[1,0,1,0,1,0,1,0,1,0,1,0,0,0,1,0,1,0,1,0,0,0,1,0,1,0,1,0,0,0,1,0,1,0,0,0,0]}},"ZMUG Pattern":{X:{1:[0,1,1,0,1,1,0,0,0,1,1,0,1,1,0,0,1,0,0,0,0,1,1,1,0,0,1,1,1,0,0,0,0,1,1,1,0,0,1,1,0],2:[1,1,0,1,1,0,0,0,0,1,1,1,0,1,1,1,1,0,1,0,0,0,1,1,0,0,1,1,0,0,0],3:[0,0,1,0,0,1,1,0,0,0,1,1,0,0,0,1,1,1,0,0,0,1,1,0,1,1,1,1,0],4:[1,0,1,0,1,0,0,1,1,0,0,0,1,1,0,0,1,0,1,1,1,0,0,1,0,1],5:[0,1,0,0,1,1,1,1,0,0,0,1,0,1,1,1,0,0,0,0,1,0,1]},S:{1:[1,1,0,1,0,0,1,1,0,0,0,1,1,1,0,0,1,1,0,0,0,1,1,0,0,0,1,1,1,1,0,0,1,1,1,0,0,1,1,1,0,0,0],2:[0,0,0,1,0,0,0,1,1,1,0,0,1,1,0,0,1,1,1,0,0,0,1,1,1,1,0,0,0,1,1,0,0,1,1,1,0,0,1,1,1,0,0,1,0,1,1],3:[0,1,0,0,1,1,0,0,1,1,1,0,0,1,1,1,0,0,1,0,0,0,1,1,1,1,0,0,0,1,0,0,0,1,1,1,0,0,0,1,1,0,0,0,1,1,0,0,1,1,1],4:[0,0,1,1,1,0,0,1,1,0,0,1,1,1,0,0,1,1,1,1,0,0,0,1,0,0,0,1,1,0,0,1,1,1,0,0,1,0,0,1,1,0,0,0,1,1,0,0,1,1,1,0,1],5:[1,0,0,1,1,1,0,0,0,1,0,0,0,1,1,1,1,0,0,1,1,1,0,0,1,0,0,1,1,1,1,0,0,0,1,1,0,0,1,1,1,0,0,1,1,0,0,1,1,1,0,0,1,0,0,0,1,1,0]},M:{1:[1,0,1,1,0,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,1,0,1,0,1,0,1],2:[0,1,0,1,0,1,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1]}},"BREAM Pattern":{X:{1:[0,1,1,1,1,0,1,0,1,1,0,1,0,1,1,0,0,1,0,0,1,1,0,1,0,0,0,0,1,1,0,0,0,0,1,1,1,1,0,0,0],2:[0,1,1,1,0,0,0,0,1,0,0,0,1,1,0,1,0,1,0,0,0,1,1,0,1,1,1,0,0,1,1],3:[1,1,0,0,1,1,0,1,1,0,0,1,1,1,0,0,0,0,1,0,0,1,1,0,1,1,1,0,0],4:[1,1,1,1,0,0,1,0,0,1,1,0,0,1,0,0,1,1,0,1,0,0,1,1,0,0],5:[0,1,1,1,0,1,1,1,0,0,0,1,0,0,1,1,0,1,0,0,0,1,0]},S:{1:[0,0,0,1,1,1,0,0,1,1,1,0,1,1,0,0,1,0,1,0,1,1,0,1,1,0,1,0,0,1,0,0,1,0,1,0,1,0,1,0,1,0,0],2:[1,1,0,1,0,0,1,1,1,0,0,0,0,0,1,1,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,0],3:[1,0,0,1,0,0,1,1,0,1,1,1,0,0,0,1,1,1,0,0,0,0,1,1,1,1,0,1,0,1,0,1,1,0,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1],4:[0,1,0,0,0,0,1,0,0,1,0,1,1,1,1,1,0,1,1,0,0,1,1,0,0,1,1,0,0,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,0,1,0,1],5:[1,0,1,0,1,0,0,1,1,0,0,1,1,0,1,1,0,0,1,0,0,0,1,0,0,0,0,1,0,1,1,0,1,1,1,1,0,1,1,1,0,0,1,0,1,0,0,0,1,1,0,1,0,1,0,1,0,1,0]},M:{1:[1,0,0,0,0,1,1,0,0,0,1,1,0,0,1,1,0,1,1,1,1,0,0,0,0,1,1,0,0,0,1,1,0,1,1,0,1,0,1,1,1,1,0,0,0,1,1,0,0,1,1,0,0,1,1,0,1,0,1,1,1],2:[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,1,1,0,1]}}};const or=zt;function ir(e,t,r){return t=c(t),l(e,ar()?Reflect.construct(t,r||[],c(e).constructor):t.apply(e,r))}function ar(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ar=function(){return!!e})()}function sr(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return ur(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ur(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function ur(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function lr(e,t,r){var n,o=[],i=sr(e.slice(t,r));try{for(i.s();!(n=i.n()).done;){var a=n.value;o.push(a.value)}}catch(e){i.e(e)}finally{i.f()}return o.join("\n")}var cr=function(e){function t(){var e;return o(this,t),(e=ir(this,t)).name="Multiple Bombe",e.module="Bletchley",e.description="Emulation of the Bombe machine used to attack Enigma. This version carries out multiple Bombe runs to handle unknown rotor configurations.<br><br>You should test your menu on the single Bombe operation before running it here. See the description of the Bombe operation for instructions on choosing a crib.<br><br>More detailed descriptions of the Enigma, Typex and Bombe operations <a href='https://github.com/gchq/CyberChef/wiki/Enigma,-the-Bombe,-and-Typex'>can be found here</a>.",e.infoURL="https://wikipedia.org/wiki/Bombe",e.inputType="string",e.outputType="JSON",e.presentType="html",e.args=[{name:"Standard Enigmas",type:"populateMultiOption",value:[{name:"German Service Enigma (First - 3 rotor)",value:[lr(at,0,5),"",lr(ut,0,1)]},{name:"German Service Enigma (Second - 3 rotor)",value:[lr(at,0,8),"",lr(ut,0,2)]},{name:"German Service Enigma (Third - 4 rotor)",value:[lr(at,0,8),lr(st,1,2),lr(ut,2,3)]},{name:"German Service Enigma (Fourth - 4 rotor)",value:[lr(at,0,8),lr(st,1,3),lr(ut,2,4)]},{name:"User defined",value:["","",""]}],target:[1,2,3]},{name:"Main rotors",type:"text",value:""},{name:"4th rotor",type:"text",value:""},{name:"Reflectors",type:"text",value:""},{name:"Crib",type:"string",value:""},{name:"Crib offset",type:"number",value:0},{name:"Use checking machine",type:"boolean",value:!0}],e}return h(t,e),u(t,[{key:"updateStatus",value:function(e,t,r,n){var o=(Date.now()-n)/r*(1-r)/1e3,i=Math.floor(o/3600),a=`0${Math.floor(o%3600/60)}`.slice(-2),s=`0${Math.floor(o%60)}`.slice(-2),u=`Bombe run with ${e} loop${1===e?"":"s"} in menu (2+ desirable): ${t} stops, ${Math.floor(100*r)}% done, ${i}:${a}:${s} remaining`;self.sendStatusMessage(u)}},{key:"validateRotor",value:function(e){if(e.includes("<")&&(e=e.split("<",2)[0]),!/^[A-Z]{26}$/.test(e))throw new E("Rotor wiring must be 26 unique uppercase letters");if(26!==new Set(e).size)throw new E("Rotor wiring must be 26 unique uppercase letters");return e}},{key:"run",value:function(e,t){var r,n=t[1],o=t[2],i=t[3],a=t[4],s=t[5],u=t[6],l=[],c=[],f=[],h=sr(n.split("\n"));try{for(h.s();!(r=h.n()).done;){var p=r.value;p=this.validateRotor(p),l.push(p)}}catch(e){h.e(e)}finally{h.f()}if(l.length<3)throw new E("A minimum of three rotors must be supplied");if(""!==o){var d,m=sr(o.split("\n"));try{for(m.s();!(d=m.n()).done;){var v=d.value;v=this.validateRotor(v),c.push(v)}}catch(e){m.e(e)}finally{m.f()}}0===c.length&&c.push("");var y,g=sr(i.split("\n"));try{for(g.s();!(y=g.n()).done;){var b=y.value,w=new dt(b);f.push(w)}}catch(e){g.e(e)}finally{g.f()}if(0===f.length)throw new E("A minimum of one reflector must be supplied");if(0===a.length)throw new E("Crib cannot be empty");if(s<0)throw new E("Offset cannot be negative");e=e.replace(/[^A-Za-z]/g,"").toUpperCase(),a=a.replace(/[^A-Za-z]/g,"").toUpperCase();var x,A=e.slice(s);x=P()?this.updateStatus:void 0;for(var B=void 0,F={bombeRuns:[]},S=6*function(e,t){for(var r=1,n=1;n<=3;n++)r*=(e+1-n)/n;return r}(l.length)*c.length*f.length,k=0,I=0,C=Date.now(),T=0,R=l;T<R.length;T++){var O,L=R[T],M=sr(l);try{for(M.s();!(O=M.n()).done;){var U=O.value;if(U!==L){var D,N=sr(l);try{for(N.s();!(D=N.n()).done;){var _=D.value;if(_!==U&&_!==L){var $,X=sr(c);try{for(X.s();!($=X.n()).done;){var j,G=$.value,Z=sr(f);try{for(Z.s();!(j=Z.n()).done;){var W=j.value;k++;var H=[L,U,_];""!==G&&H.push(G),void 0===B?(B=new kt(H,W,A,a,u),F.nLoops=B.nLoops):B.changeRotors(H,W);var Q=B.run();I+=Q.length,void 0!==x&&x(B.nLoops,I,k/S,C),Q.length>0&&F.bombeRuns.push({rotors:H,reflector:W.pairs,result:Q})}}catch(e){Z.e(e)}finally{Z.f()}}}catch(e){X.e(e)}finally{X.f()}}}}catch(e){N.e(e)}finally{N.f()}}}}catch(e){M.e(e)}finally{M.f()}}return F}},{key:"present",value:function(e){var t,r=`Bombe run on menu with ${e.nLoops} loop${1===e.nLoops?"":"s"} (2+ desirable). Note: Rotors and rotor positions are listed left to right, ignore stepping and the ring setting, and positions start at the beginning of the crib. Some plugboard settings are determined. A decryption preview starting at the beginning of the crib and ignoring stepping is also provided.\n`,o=sr(e.bombeRuns);try{for(o.s();!(t=o.n()).done;){var i=t.value;r+=`\nRotors: ${i.rotors.slice().reverse().join(", ")}\nReflector: ${i.reflector}\n`,r+="<table class='table table-hover table-sm table-bordered table-nonfluid'><tr><th>Rotor stops</th> <th>Partial plugboard</th> <th>Decryption preview</th></tr>\n";var a,s=sr(i.result);try{for(s.s();!(a=s.n()).done;){var u=n(a.value,3);r+=`<tr><td>${u[0]}</td> <td>${u[1]}</td> <td>${u[2]}</td></tr>\n`}}catch(e){s.e(e)}finally{s.f()}r+="</table>\n"}}catch(e){o.e(e)}finally{o.f()}return r}}])}(tt);const fr=cr;function hr(e,t,r){return t=c(t),l(e,pr()?Reflect.construct(t,r||[],c(e).constructor):t.apply(e,r))}function pr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(pr=function(){return!!e})()}function dr(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return mr(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?mr(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function mr(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var vr=[{name:"Example 1",value:"SRGWANHPJZFXVIDQCEUKBYOLMT"},{name:"Example 2",value:"THQEFSAZVKJYULBODCPXNIMWRG"},{name:"Example 3",value:"XDTUYLEVFNQZBPOGIRCSMHWKAJ"},{name:"Example 4",value:"LOHDMCWUPSTNGVXYFJREQIKBZA"},{name:"Example 5",value:"ERXWNZQIJYLVOFUMSGHTCKPBDA"},{name:"Example 6",value:"FQECYHJIOUMDZVPSLKRTGWXBAN"},{name:"Example 7",value:"TBYIUMKZDJSOPEWXVANHLCFQGR"},{name:"Example 8",value:"QZUPDTFNYIAOMLEBWJXCGHKRSV"},{name:"Example 9",value:"CZWNHEMPOVXLKRSIDGJFYBTQAU"},{name:"Example 10",value:"ENPXJVKYQBFZTICAGMOHWRLDUS"}],yr=[{name:"Example 1",value:"6201348957"},{name:"Example 2",value:"6147253089"},{name:"Example 3",value:"8239647510"},{name:"Example 4",value:"7194835260"},{name:"Example 5",value:"4873205916"}],gr="0123456789".split("");function br(e){var t=e.charCodeAt();return 97<=t&&t<=122?String.fromCharCode(t-32):e}var wr=function(){return u((function e(t,r,n){o(this,e),this.cipherBank=new xr(t),this.controlBank=new Ar(r),this.indexBank=new Br(n)}),[{key:"step",value:function(){var e=this.controlBank.goThroughControl(),t=this.indexBank.goThroughIndex(e);this.cipherBank.step(t)}},{key:"encryptLetter",value:function(e){" "===(e=br(e))?e="Z":"Z"===e&&(e="X");var t=this.cipherBank.encrypt(e);return this.step(),t}},{key:"decryptLetter",value:function(e){e=br(e);var t=this.cipherBank.decrypt(e);return"Z"===t&&(t=" "),this.step(),t}},{key:"encrypt",value:function(e){var t,r="",n=dr(e);try{for(n.s();!(t=n.n()).done;){var o=t.value;r=r.concat(this.encryptLetter(o))}}catch(e){n.e(e)}finally{n.f()}return r}},{key:"decrypt",value:function(e){var t,r="",n=dr(e);try{for(n.s();!(t=n.n()).done;){var o=t.value;r=r.concat(this.decryptLetter(o))}}catch(e){n.e(e)}finally{n.f()}return r}}])}(),xr=function(){return u((function e(t){o(this,e),this.rotors=t}),[{key:"encrypt",value:function(e){var t,r=dr(this.rotors);try{for(r.s();!(t=r.n()).done;)e=t.value.crypt(e,"leftToRight")}catch(e){r.e(e)}finally{r.f()}return e}},{key:"decrypt",value:function(e){var t,r=dr(y(this.rotors).reverse());try{for(r.s();!(t=r.n()).done;)e=t.value.crypt(e,"rightToLeft")}catch(e){r.e(e)}finally{r.f()}return e}},{key:"step",value:function(e){var t={0:[0,9],1:[7,8],2:[5,6],3:[3,4],4:[1,2]},r=[];for(var n in t){var o,i=t[n],a=dr(e);try{for(a.s();!(o=a.n()).done;){var s=o.value;if(i.includes(s)){r.push(this.rotors[n]);break}}}catch(e){a.e(e)}finally{a.f()}}for(var u=0,l=r;u<l.length;u++)l[u].step()}}])}(),Ar=function(){return u((function e(t){o(this,e),this.rotors=y(t).reverse()}),[{key:"crypt",value:function(e){var t,r=dr(this.rotors);try{for(r.s();!(t=r.n()).done;)e=t.value.crypt(e,"rightToLeft")}catch(e){r.e(e)}finally{r.f()}return e}},{key:"getOutputs",value:function(){var e=[this.crypt("F"),this.crypt("G"),this.crypt("H"),this.crypt("I")],t={1:"B",2:"C",3:"DE",4:"FGH",5:"IJK",6:"LMNO",7:"PQRST",8:"UVWXYZ",9:"A"},r=[];for(var n in t){var o,i=t[n],a=dr(e);try{for(a.s();!(o=a.n()).done;){var s=o.value;if(i.includes(s)){r.push(n);break}}}catch(e){a.e(e)}finally{a.f()}}return r}},{key:"step",value:function(){var e=this.rotors[1],t=this.rotors[2],r=this.rotors[3];14===t.state&&(14===e.state&&r.step(),e.step()),t.step()}},{key:"goThroughControl",value:function(){var e=this.getOutputs();return this.step(),e}}])}(),Br=function(){return u((function e(t){o(this,e),this.rotors=t}),[{key:"crypt",value:function(e){var t,r=dr(this.rotors);try{for(r.s();!(t=r.n()).done;)e=t.value.crypt(e)}catch(e){r.e(e)}finally{r.f()}return e}},{key:"goThroughIndex",value:function(e){var t,r=[],n=dr(e);try{for(n.s();!(t=n.n()).done;){var o=t.value;r.push(this.crypt(o))}}catch(e){n.e(e)}finally{n.f()}return r}}])}(),Er=function(){return u((function e(t,r,n){o(this,e),this.state=r,this.numMapping=this.getNumMapping(t,n),this.posMapping=this.getPosMapping(n)}),[{key:"getNumMapping",value:function(e,t){if(!1===t)return e;for(var r=e.length,n=new Array(r),o=0;o<r;o++)n[e[o]]=o;return n}},{key:"getPosMapping",value:function(e){var t=this.numMapping.length,r=[];if(!1===e)for(var n=this.state;n<this.state+t;n++){var o=n%t;o<0&&(o+=t),r.push(o)}else for(var i=this.state;i>this.state-t;i--){var a=i%t;a<0&&(a+=t),r.push(a)}return r}},{key:"cryptNum",value:function(e,t){var r,n=this.posMapping[e];return"leftToRight"===t?r=this.numMapping[n]:"rightToLeft"===t&&(r=this.numMapping.indexOf(n)),this.posMapping.indexOf(r)}},{key:"step",value:function(){var e=this.posMapping.pop();this.posMapping.splice(0,0,e),this.state=this.posMapping[0]}}])}(),Fr=function(e){function t(e,r){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return o(this,t),hr(this,t,[e=e.split("").map(t.letterToNum),t.letterToNum(r),n])}return h(t,e),u(t,[{key:"crypt",value:function(e,r){e=t.letterToNum(e);var n=this.cryptNum(e,r);return t.numToLetter(n)}}],[{key:"letterToNum",value:function(e){return e.charCodeAt()-65}},{key:"numToLetter",value:function(e){return String.fromCharCode(e+65)}}])}(Er),Sr=function(e){function t(e,r){return o(this,t),hr(this,t,[e=e.split("").map(Number),Number(r),!1])}return h(t,e),u(t,[{key:"crypt",value:function(e){return this.cryptNum(e,"leftToRight")}}])}(Er);function kr(e,t,r){return t=c(t),l(e,Ir()?Reflect.construct(t,r||[],c(e).constructor):t.apply(e,r))}function Ir(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ir=function(){return!!e})()}var Cr=function(e){function t(){var e;return o(this,t),(e=kr(this,t)).name="SIGABA",e.module="Bletchley",e.description="Encipher/decipher with the WW2 SIGABA machine. <br><br>SIGABA, otherwise known as ECM Mark II, was used by the United States for message encryption during WW2 up to the 1950s. It was developed in the 1930s by the US Army and Navy, and has up to this day never been broken. Consisting of 15 rotors: 5 cipher rotors and 10 rotors (5 control rotors and 5 index rotors) controlling the stepping of the cipher rotors, the rotor stepping for SIGABA is much more complex than other rotor machines of its time, such as Enigma. All example rotor wirings are random example sets.<br><br>To configure rotor wirings, for the cipher and control rotors enter a string of letters which map from A to Z, and for the index rotors enter a sequence of numbers which map from 0 to 9. Note that encryption is not the same as decryption, so first choose the desired mode. <br><br> Note: Whilst this has been tested against other software emulators, it has not been tested against hardware.",e.infoURL="https://wikipedia.org/wiki/SIGABA",e.inputType="string",e.outputType="string",e.args=[{name:"1st (left-hand) cipher rotor",type:"editableOption",value:vr,defaultIndex:0},{name:"1st cipher rotor reversed",type:"boolean",value:!1},{name:"1st cipher rotor initial value",type:"option",value:lt},{name:"2nd cipher rotor",type:"editableOption",value:vr,defaultIndex:0},{name:"2nd cipher rotor reversed",type:"boolean",value:!1},{name:"2nd cipher rotor initial value",type:"option",value:lt},{name:"3rd (middle) cipher rotor",type:"editableOption",value:vr,defaultIndex:0},{name:"3rd cipher rotor reversed",type:"boolean",value:!1},{name:"3rd cipher rotor initial value",type:"option",value:lt},{name:"4th cipher rotor",type:"editableOption",value:vr,defaultIndex:0},{name:"4th cipher rotor reversed",type:"boolean",value:!1},{name:"4th cipher rotor initial value",type:"option",value:lt},{name:"5th (right-hand) cipher rotor",type:"editableOption",value:vr,defaultIndex:0},{name:"5th cipher rotor reversed",type:"boolean",value:!1},{name:"5th cipher rotor initial value",type:"option",value:lt},{name:"1st (left-hand) control rotor",type:"editableOption",value:vr,defaultIndex:0},{name:"1st control rotor reversed",type:"boolean",value:!1},{name:"1st control rotor initial value",type:"option",value:lt},{name:"2nd control rotor",type:"editableOption",value:vr,defaultIndex:0},{name:"2nd control rotor reversed",type:"boolean",value:!1},{name:"2nd control rotor initial value",type:"option",value:lt},{name:"3rd (middle) control rotor",type:"editableOption",value:vr,defaultIndex:0},{name:"3rd control rotor reversed",type:"boolean",value:!1},{name:"3rd control rotor initial value",type:"option",value:lt},{name:"4th control rotor",type:"editableOption",value:vr,defaultIndex:0},{name:"4th control rotor reversed",type:"boolean",value:!1},{name:"4th control rotor initial value",type:"option",value:lt},{name:"5th (right-hand) control rotor",type:"editableOption",value:vr,defaultIndex:0},{name:"5th control rotor reversed",type:"boolean",value:!1},{name:"5th control rotor initial value",type:"option",value:lt},{name:"1st (left-hand) index rotor",type:"editableOption",value:yr,defaultIndex:0},{name:"1st index rotor initial value",type:"option",value:gr},{name:"2nd index rotor",type:"editableOption",value:yr,defaultIndex:0},{name:"2nd index rotor initial value",type:"option",value:gr},{name:"3rd (middle) index rotor",type:"editableOption",value:yr,defaultIndex:0},{name:"3rd index rotor initial value",type:"option",value:gr},{name:"4th index rotor",type:"editableOption",value:yr,defaultIndex:0},{name:"4th index rotor initial value",type:"option",value:gr},{name:"5th (right-hand) index rotor",type:"editableOption",value:yr,defaultIndex:0},{name:"5th index rotor initial value",type:"option",value:gr},{name:"SIGABA mode",type:"option",value:["Encrypt","Decrypt"]}],e}return h(t,e),u(t,[{key:"run",value:function(e,t){for(var r=t[40],n=[],o=[],i=[],a=0;a<5;a++){var s=t[3*a];n.push(new Fr(s,t[3*a+2],t[3*a+1]))}for(var u=5;u<10;u++){var l=t[3*u];o.push(new Fr(l,t[3*u+2],t[3*u+1]))}for(var c=15;c<20;c++){var f=t[2*c];i.push(new Sr(f,t[2*c+1]))}var h,p=new wr(n,o,i);return"Encrypt"===r?h=p.encrypt(e):"Decrypt"===r&&(h=p.decrypt(e)),h}}])}(tt);const Tr=Cr;function Rr(){return Rr="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=c(e)););return e}(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},Rr.apply(null,arguments)}function Or(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return Lr(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Lr(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function Lr(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Mr(e,t,r){return t=c(t),l(e,Pr()?Reflect.construct(t,r||[],c(e).constructor):t.apply(e,r))}function Pr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Pr=function(){return!!e})()}for(var Ur=[{name:"Example 1",value:"MCYLPQUVRXGSAOWNBJEZDTFKHI<BFHNQUW"},{name:"Example 2",value:"KHWENRCBISXJQGOFMAPVYZDLTU<BFHNQUW"},{name:"Example 3",value:"BYPDZMGIKQCUSATREHOJNLFWXV<BFHNQUW"},{name:"Example 4",value:"ZANJCGDLVHIXOBRPMSWQUKFYET<BFHNQUW"},{name:"Example 5",value:"QXBGUTOVFCZPJIHSWERYNDAMLK<BFHNQUW"},{name:"Example 6",value:"BDCNWUEIQVFTSXALOGZJYMHKPR<BFHNQUW"},{name:"Example 7",value:"WJUKEIABMSGFTQZVCNPHORDXYL<BFHNQUW"},{name:"Example 8",value:"TNVCZXDIPFWQKHSJMAOYLEURGB<BFHNQUW"}],Dr=[{name:"Example",value:"AN BC FG IE KD LU MH OR TS VZ WQ XJ YP"}],Nr={Q:"1",W:"2",E:"3",R:"4",T:"5",Y:"6",U:"7",I:"8",O:"9",P:"0",A:"-",S:"/",D:"Z",F:"%",G:"X",H:"£",K:"(",L:")",C:"V",B:"'",N:",",M:"."},_r={},$r=0,Xr=Object.keys(Nr);$r<Xr.length;$r++){var jr=Xr[$r];_r[Nr[jr]]=jr}var Gr=function(e){function t(e,r,n,i){var a;if(o(this,t),a=Mr(this,t,[e,r,n]),5!==e.length)throw new E("Typex must have 5 rotors");return a.keyboard=i,a}return h(t,e),u(t,[{key:"step",value:function(){var e=this.rotors[2],t=this.rotors[3];e.step(),(e.steps.has(e.pos)||t.steps.has(U.mod(t.pos+1,26)))&&(t.step(),t.steps.has(t.pos)&&this.rotors[4].step())}},{key:"crypt",value:function(e){var r=e;if("Encrypt"===this.keyboard){r="";var n,o=!1,i=Or(e);try{for(i.s();!(n=i.n()).done;){var a=n.value;" "===a?r+="X":o?Object.prototype.hasOwnProperty.call(_r,a)?r+=_r[a]:(o=!1,r+="V"+a):Object.prototype.hasOwnProperty.call(_r,a)?(o=!0,r+="Z"+_r[a]):r+=a}}catch(e){i.e(e)}finally{i.f()}}var s=Rr(c(t.prototype),"crypt",this).call(this,r),u=s;if("Decrypt"===this.keyboard){u="";var l,f=!1,h=Or(s);try{for(h.s();!(l=h.n()).done;){var p=l.value;"X"===p?u+=" ":"V"===p?f=!1:"Z"===p?f=!0:u+=f?Nr[p]:p}}catch(e){h.e(e)}finally{h.f()}}return u}}])}(vt),Zr=function(e){function t(e,r,n,i,a){o(this,t);var s=e;if(n){for(var u=new Array(26),l=0;l<26;l++){var c=U.mod(26-ct(e[l]),26),f=ft(U.mod(26-ct(lt[l]),26));u[c]=f}s=u.join("")}return Mr(this,t,[s,r,i,a])}return h(t,e),u(t)}(ht),Wr=function(e){function t(e){var r;if(o(this,t),!/^[A-Z]{26}$/.test(e))throw new E("Plugboard wiring must be 26 unique uppercase letters");e=e.replace(/./g,(function(e){return"AZYXWVUTSRQPONMLKJIHGFEDCB"[ct(e)]}));try{r=Mr(this,t,[e,"","A","A"])}catch(e){throw new E(e.message.replace("Rotor","Plugboard"))}return r}return h(t,e),u(t,[{key:"transform",value:function(e){return U.mod(this.map[U.mod(e+this.pos,26)]-this.pos,26)}},{key:"revTransform",value:function(e){return U.mod(this.revMap[U.mod(e+this.pos,26)]-this.pos,26)}}])}(ht);function Hr(e,t,r){return t=c(t),l(e,Qr()?Reflect.construct(t,r||[],c(e).constructor):t.apply(e,r))}function Qr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Qr=function(){return!!e})()}var Vr=function(e){function t(){var e;return o(this,t),(e=Hr(this,t)).name="Typex",e.module="Bletchley",e.description="Encipher/decipher with the WW2 Typex machine.<br><br>Typex was originally built by the British Royal Air Force prior to WW2, and is based on the Enigma machine with some improvements made, including using five rotors with more stepping points and interchangeable wiring cores. It was used across the British and Commonwealth militaries. A number of later variants were produced; here we simulate a WW2 era Mark 22 Typex with plugboards for the reflector and input. Typex rotors were changed regularly and none are public: a random example set are provided.<br><br>To configure the reflector plugboard, enter a string of connected pairs of letters in the reflector box, e.g. <code>AB CD EF</code> connects A to B, C to D, and E to F (you'll need to connect every letter). There is also an input plugboard: unlike Enigma's plugboard, it's not restricted to pairs, so it's entered like a rotor (without stepping). To create your own rotor, enter the letters that the rotor maps A to Z to, in order, optionally followed by <code><</code> then a list of stepping points.<br><br>More detailed descriptions of the Enigma, Typex and Bombe operations <a href='https://github.com/gchq/CyberChef/wiki/Enigma,-the-Bombe,-and-Typex'>can be found here</a>.",e.infoURL="https://wikipedia.org/wiki/Typex",e.inputType="string",e.outputType="string",e.args=[{name:"1st (left-hand) rotor",type:"editableOption",value:Ur,defaultIndex:0},{name:"1st rotor reversed",type:"boolean",value:!1},{name:"1st rotor ring setting",type:"option",value:lt},{name:"1st rotor initial value",type:"option",value:lt},{name:"2nd rotor",type:"editableOption",value:Ur,defaultIndex:1},{name:"2nd rotor reversed",type:"boolean",value:!1},{name:"2nd rotor ring setting",type:"option",value:lt},{name:"2nd rotor initial value",type:"option",value:lt},{name:"3rd (middle) rotor",type:"editableOption",value:Ur,defaultIndex:2},{name:"3rd rotor reversed",type:"boolean",value:!1},{name:"3rd rotor ring setting",type:"option",value:lt},{name:"3rd rotor initial value",type:"option",value:lt},{name:"4th (static) rotor",type:"editableOption",value:Ur,defaultIndex:3},{name:"4th rotor reversed",type:"boolean",value:!1},{name:"4th rotor ring setting",type:"option",value:lt},{name:"4th rotor initial value",type:"option",value:lt},{name:"5th (right-hand, static) rotor",type:"editableOption",value:Ur,defaultIndex:4},{name:"5th rotor reversed",type:"boolean",value:!1},{name:"5th rotor ring setting",type:"option",value:lt},{name:"5th rotor initial value",type:"option",value:lt},{name:"Reflector",type:"editableOption",value:Dr},{name:"Plugboard",type:"string",value:""},{name:"Typex keyboard emulation",type:"option",value:["None","Encrypt","Decrypt"]},{name:"Strict output",hint:"Remove non-alphabet letters and group output",type:"boolean",value:!0}],e}return h(t,e),u(t,[{key:"parseRotorStr",value:function(e,t){if(""===e)throw new E(`Rotor ${t} must be provided.`);return e.includes("<")?e.split("<",2):[e,""]}},{key:"run",value:function(e,t){for(var r=t[20],o=t[21],i=t[22],a=t[23],s=[],u=0;u<5;u++){var l=n(this.parseRotorStr(t[4*u]),2),c=l[0],f=l[1];s.push(new Zr(c,f,t[4*u+1],t[4*u+2],t[4*u+3]))}s.reverse();var h=new dt(r),p=o;""===p&&(p="ABCDEFGHIJKLMNOPQRSTUVWXYZ");var d=new Wr(p);a&&(e="Encrypt"===i?e.replace(/[^A-Za-z0-9 /%£()',.-]/g,""):e.replace(/[^A-Za-z]/g,""));var m=new Gr(s,h,d,i).crypt(e);return a&&"Decrypt"!==i&&(m=m.replace(/([A-Z]{5})(?!$)/g,"$1 ")),m}},{key:"highlight",value:function(e,t){if(!1===t[18])return e}},{key:"highlightReverse",value:function(e,t){if(!1===t[18])return e}}])}(tt);const Yr=Vr;("undefined"==typeof self?{}:self.OpModules||{}).Bletchley={Bombe:Ot,Colossus:jt,Enigma:Ht,Lorenz:or,"Multiple Bombe":fr,SIGABA:Tr,Typex:Yr}})()})(); |