/*! 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>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;sl?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>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=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;is&&(r=s-u),i=r;i>=0;i--){let r=!0;for(let n=0;no&&(n=o):n=o;const i=t.length;let a;for(n>i/2&&(n=i/2),a=0;a>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(;o239?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(;nn.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;tr&&(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>>=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;on)&&(r=n);let o="";for(let n=t;nr)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||te.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>>=0,t>>>=0,r||O(e,t,this.length);let n=this[e],o=1,i=0;for(;++i>>=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)<>>=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)<>>=0,t>>>=0,r||O(e,t,this.length);let n=this[e],o=1,i=0;for(;++i=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)<>>=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)<>>=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>>=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>>=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=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>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o=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||e3?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;a55295&&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=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<>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<>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<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=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=[];++c1)for(var r=1;r{!function(e){var t,r,n,o=String.fromCharCode;function i(e){for(var t,r,n=[],o=0,i=e.length;o=55296&&t<=56319&&o=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="";++n65535&&(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=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=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev=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);r1&&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>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>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;i1&&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;o1&&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;i65535){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=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>>=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=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;r1&&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;t0&&r.push(n[t]/e.length);var o,i=0;for(t=0;t1&&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=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(/]*>(\s|\S)*?<\/script[^>]*>/gi,e),e=t(/]*>(\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`
\n
\n
\n ${e.escapeHtml(t.name)}\n
\n
\n
`},o=function(t,r){if(r.startsWith("image")){var n="data:";return n+=r+";",""}return`
${e.escapeHtml(e.arrayBufferToStr(t.buffer))}
`},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=`
\n
\n
\n \n \n ${r.size.toLocaleString()} bytes\n \n save\n \n \n open_in_browser\n \n \n
\n
\n
\n
\n ${o(i,r.type)}\n
\n
\n
`,t.abrupt("return",u);case 7:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),a=`
\n ${r.length} file(s) found\n
`,s=0;case 5:if(!(s=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;re?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;i0||e===t?t:t-1}function q(e){for(var t,r,n=1,o=e.length,i=e[0]+"";nl^r?1:-1;for(s=(u=o.length)<(l=i.length)?u:l,a=0;ai[a]^r?1:-1;return u==l?0:u>l^r?1:-1}function ee(e,t,r,n){if(er||e!==j(e))throw Error(G+(n||"Argument")+("number"==typeof e?er?" 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 tb?h.c=h.e=null:e.e=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;us){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=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(;ss){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=10;o/=10,n++);return(r=n+r*H-1)>b?e.c=e.e=null:r=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=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=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>>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=9e15?crypto.randomBytes(7).copy(t,s):(u.push(i%1e14),s+=7);s=o/7}if(!w)for(;s=10;i/=10,s++);sr-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;ot[o]?1:-1;break}return i}function r(e,t,r,n){for(var o=0;r--;)e[r]-=o,o=e[r]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=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=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;t0)for(;t--;c[r++]=0);for(t=W-1;n>s;){if(c[--n]=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.e0&&d>0){for(i=d%s||s,c=p.substr(0,i);i0&&(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;r1&&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;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<>>=this.bitPos),o=8-this.bitPos,this.bitPos=0;oe){var i=o-e;"be"===t?n>>>=i:n&=(1<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=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.positionthis.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.position0&&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>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=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;i0&&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<>=1;for(var h=i<<16|u,p=l;p>>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;n2&&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;o0&&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;t255)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":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";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);r1&&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;s1&&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=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);r5&&void 0!==arguments[5]?arguments[5]:void 0;if(o(this,e),i.length25)throw new E("Crib is too long");for(var l=0;li&&(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;i1)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;o1&&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
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.

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.

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.

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.

More detailed descriptions of the Enigma, Typex and Bombe operations can be found here.",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+="\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+=`\n`}}catch(e){o.e(e)}finally{o.f()}return t+"
Rotor stops Partial plugboard Decryption preview
${i[0]} ${i[1]} ${i[2]}
"}}])}(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;tPt["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=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
To learn more, Virtual Colossus, an online, browser based simulation of a Colossus computer is available at virtualcolossus.co.uk.

A more detailed description of this operation can be found here.",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+="\n",t+="";var r,n=Nt(e.counters);try{for(n.s();!(r=n.n()).done;)t+=`\n`}catch(e){n.e(e)}finally{n.f()}return(t+="")+"
C1 C2 C3 C4 C5
${r.value}
"}}])}(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.

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.

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. AB CD EF 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 < then a list of stepping points.
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).

More detailed descriptions of the Enigma, Typex and Bombe operations can be found here.",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
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.

Each rotor has a different number of cams/lugs around their circumference which could be set active or inactive changing the key stream.

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.

The input can either be plaintext or ITA2 when sending and ITA2 when receiving.

To learn more, Virtual Lorenz, an online, browser based simulation of the Lorenz SZ40/42 is available at lorenz.virtualcolossus.co.uk.

A more detailed description of this operation can be found here.",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);r0&&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+="\n";var a,s=sr(i.result);try{for(s.s();!(a=s.n()).done;){var u=n(a.value,3);r+=`\n`}}catch(e){s.e(e)}finally{s.f()}r+="
Rotor stops Partial plugboard Decryption preview
${u[0]} ${u[1]} ${u[2]}
\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);rthis.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.

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.

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.

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
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.

To configure the reflector plugboard, enter a string of connected pairs of letters in the reflector box, e.g. AB CD EF 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 < then a list of stepping points.

More detailed descriptions of the Enigma, Typex and Bombe operations can be found here.",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}})()})();