106 lines
168 KiB
JavaScript
106 lines
168 KiB
JavaScript
|
/**
|
|||
|
* CyberChef - The Cyber Swiss Army Knife
|
|||
|
*
|
|||
|
* @copyright Crown Copyright 2016
|
|||
|
* @license Apache-2.0
|
|||
|
*
|
|||
|
* Copyright 2016 Crown Copyright
|
|||
|
*
|
|||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|||
|
* you may not use this file except in compliance with the License.
|
|||
|
* You may obtain a copy of the License at
|
|||
|
*
|
|||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
|
*
|
|||
|
* Unless required by applicable law or agreed to in writing, software
|
|||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
|
* See the License for the specific language governing permissions and
|
|||
|
* limitations under the License.
|
|||
|
*/!function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1512)}({0:function(e,t,r){"use strict";var n=r(15),i=r.n(n),o=r(10),u=r(7),s=r(19),a=r(18);function f(e,t,r,n,i,o,u){try{var s=e[o](u),a=s.value}catch(e){return void r(e)}s.done?t(a):Promise.resolve(a).then(n,i)}function l(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function u(e){f(o,n,i,u,s,"next",e)}function s(e){f(o,n,i,u,s,"throw",e)}u(void 0)})}}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}
|
|||
|
/**
|
|||
|
* @author n1474335 [n1474335@gmail.com]
|
|||
|
* @copyright Crown Copyright 2016
|
|||
|
* @license Apache-2.0
|
|||
|
*/
|
|||
|
var h=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,r,n;return t=e,r=null,n=[{key:"chr",value:function(e){if(e>65535){e-=65536;var t=String.fromCharCode(e>>>10&1023|55296);return e=56320|1023&e,t+String.fromCharCode(e)}return String.fromCharCode(e)}},{key:"ord",value:function(e){if(2===e.length){var t=e.charCodeAt(0),r=e.charCodeAt(1);if(t>=55296&&t<56320&&r>=56320&&r<57344)return 1024*(t-55296)+r-56320+65536}return e.charCodeAt(0)}},{key:"padBytesRight",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=new Array(t);return n.fill(r),Array.prototype.map.call(e,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(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==typeof window&&window.app&&!window.app.options.treatAsUtf8&&(t=e.byteArrayToChars(e.strToByteArray(t)));return t=t.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-\u
|
|||
|
/**
|
|||
|
* @author n1474335 [n1474335@gmail.com]
|
|||
|
* @copyright Crown Copyright 2016
|
|||
|
* @license Apache-2.0
|
|||
|
*/
|
|||
|
var s=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(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,t&&this._parseConfig(t)}var t,r,n;return t=e,n=[{key:"prepare",value:function(e,t){var r;switch(t){case"binaryString":case"binaryShortString":case"editableOption":case"editableOptionShort":return i.a.parseEscapedChars(e);case"byteArray":return"string"==typeof e?(e=e.replace(/\s+/g,""),Object(o.c)(e)):e;case"number":if(r=parseFloat(e),isNaN(r))throw"Invalid ingredient value. Not a number: "+i.a.truncate(e.toString(),10);return r;default:return e}}}],(r=[{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}},{key:"config",get:function(){return this._value}},{key:"value",set:function(t){this._value=e.prepare(t,this.type)},get:function(){return this._value}}])&&u(t.prototype,r),n&&u(t,n),e}();function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}
|
|||
|
/**
|
|||
|
* @author n1474335 [n1474335@gmail.com]
|
|||
|
* @copyright Crown Copyright 2016
|
|||
|
* @license Apache-2.0
|
|||
|
*/
|
|||
|
var f=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(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}var t,r,i;return t=e,(r=[{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:"addIngredient",value:function(e){this._ingList.push(e)}},{key:"inputType",set:function(e){this._inputType=n.a.typeEnum(e)},get:function(){return n.a.enumLookup(this._inputType)}},{key:"outputType",set:function(e){this._outputType=n.a.typeEnum(e),this._presentType<0&&(this._presentType=this._outputType)},get:function(){return n.a.enumLookup(this._outputType)}},{key:"presentType",set:function(e){this._presentType=n.a.typeEnum(e)},get:function(){return n.a.enumLookup(this._presentType)}},{key:"args",set:function(e){var t=this;e.forEach(function(e){var r=new s(e);t.addIngredient(r)})},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),t})}},{key:"config",get:function(){return{op:this.name,args:this._ingList.map(function(e){return e.config})}}},{key:"ingValues",set:function(e){var t=this;e.forEach(function(e,r){t._ingList[r].value=e})},get:function(){return this._ingList.map(function(e){return e.value})}},{key:"breakpoint",set:function(e){this._breakpoint=!!e},get:function(){return this._breakpoint}},{key:"disabled",set:function(e){this._disabled=!!e},get:function(){return this._disabled}},{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}}])&&a(t.prototype,r),i&&a(t,i),e}();t.a=f},10:function(e,t,r){"use strict";r.d(t,"c",function(){return i}),r.d(t,"b",function(){return o}),r.d(t,"a",function(){return u});var n=r(0);
|
|||
|
/**
|
|||
|
* Base64 functions.
|
|||
|
*
|
|||
|
* @author n1474335 [n1474335@gmail.com]
|
|||
|
* @copyright Crown Copyright 2016
|
|||
|
* @license Apache-2.0
|
|||
|
*/function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"A-Za-z0-9+/=";if(!e)return"";"string"==typeof e&&(e=n.a.strToByteArray(e)),t=n.a.expandAlphRange(t).join("");for(var r,i,o,u,s,a,f,l="",c=0;c<e.length;)u=(r=e[c++])>>2,s=(3&r)<<4|(i=e[c++])>>4,a=(15&i)<<2|(o=e[c++])>>6,f=63&o,isNaN(i)?a=f=64:isNaN(o)&&(f=64),l+=t.charAt(u)+t.charAt(s)+t.charAt(a)+t.charAt(f);return l}function o(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",i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(!e)return"string"===r?"":[];t=t||"A-Za-z0-9+/=",t=n.a.expandAlphRange(t).join("");var o,u,s,a,f,l,c=[],h=0;if(i){var p=new RegExp("[^"+t.replace(/[[\]\\\-^$]/g,"\\$&")+"]","g");e=e.replace(p,"")}for(;h<e.length;)o=t.indexOf(e.charAt(h++))<<2|(a=-1===(a=t.indexOf(e.charAt(h++)||"="))?64:a)>>4,u=(15&a)<<4|(f=-1===(f=t.indexOf(e.charAt(h++)||"="))?64:f)>>2,s=(3&f)<<6|(l=-1===(l=t.indexOf(e.charAt(h++)||"="))?64:l),c.push(o),64!==f&&c.push(u),64!==l&&c.push(s);return"string"===r?n.a.byteArrayToUtf8(c):c}var u=[{name:"Standard (RFC 4648): A-Za-z0-9+/=",value:"A-Za-z0-9+/="},{name:"URL safe (RFC 4648 §5): A-Za-z0-9-_",value:"A-Za-z0-9-_"},{name:"Filename safe: A-Za-z0-9+-=",value:"A-Za-z0-9+\\-="},{name:"itoa64: ./0-9A-Za-z=",value:"./0-9A-Za-z="},{name:"XML: A-Za-z0-9_.",value:"A-Za-z0-9_."},{name:"y64: A-Za-z0-9._-",value:"A-Za-z0-9._-"},{name:"z64: 0-9a-zA-Z+/=",value:"0-9a-zA-Z+/="},{name:"Radix-64 (RFC 4880): 0-9A-Za-z+/=",value:"0-9A-Za-z+/="},{name:"Uuencoding: [space]-_",value:" -_"},{name:"Xxencoding: +-0-9A-Za-z",value:"+\\-0-9A-Za-z"},{name:"BinHex: !-,-0-689@A-NP-VX-Z[`a-fh-mp-r",value:"!-,-0-689@A-NP-VX-Z[`a-fh-mp-r"},{name:"ROT13: N-ZA-Mn-za-m0-9+/=",value:"N-ZA-Mn-za-m0-9+/="},{name:"UNIX crypt: ./0-9A-Za-z",value:"./0-9A-Za-z"}]},1070:function(e,t){e.exports=n;var r=null;try{r=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function n(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function i(e){return!0===(e&&e.__isLong__)}n.prototype.__isLong__,Object.defineProperty(n.prototype,"__isLong__",{value:!0}),n.isLong=i;var o={},u={};function s(e,t){var r,n,i;return t?(i=0<=(e>>>=0)&&e<256)&&(n=u[e])?n:(r=f(e,(0|e)<0?-1:0,!0),i&&(u[e]=r),r):(i=-128<=(e|=0)&&e<128)&&(n=o[e])?n:(r=f(e,e<0?-1:0,!1),i&&(o[e]=r),r)}function a(e,t){if(isNaN(e))return t?_:b;if(t){if(e<0)return _;if(e>=g)return E}else{if(e<=-y)return N;if(e+1>=y)return B}return e<0?a(-e,t).neg():f(e%p|0,e/p|0,t)}function f(e,t,r){return new n(e,t,r)}n.fromInt=s,n.fromNumber=a,n.fromBits=f;var l=Math.pow;function c(e,t,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return b;if("number"==typeof t?(r=t,t=!1):t=!!t,(r=r||10)<2||36<r)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return c(e.substring(1),t,r).neg();for(var i=a(l(r,8)),o=b,u=0;u<e.length;u+=8){var s=Math.min(8,e.length-u),f=parseInt(e.substring(u,u+s),r);if(s<8){var h=a(l(r,s));o=o.mul(h).add(a(f))}else o=(o=o.mul(i)).add(a(f))}return o.unsigned=t,o}function h(e,t){return"number"==typeof
|
|||
|
/**
|
|||
|
* Custom error type for handling Dish type errors.
|
|||
|
* i.e. where the Dish cannot be successfully translated between types
|
|||
|
*
|
|||
|
* @author n1474335 [n1474335@gmail.com]
|
|||
|
* @copyright Crown Copyright 2018
|
|||
|
* @license Apache-2.0
|
|||
|
*/var a=function(e){function t(){var e,r,o,s;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var a=arguments.length,f=new Array(a),l=0;l<a;l++)f[l]=arguments[l];return o=this,(r=!(s=(e=i(t)).call.apply(e,[this].concat(f)))||"object"!==n(s)&&"function"!=typeof s?u(o):s).type="DishError",Error.captureStackTrace&&Error.captureStackTrace(u(u(r)),t),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(t,s(Error)),t}();t.a=a},14:function(e,t,r){var n,i;!function(o,u){"use strict";void 0===(i="function"==typeof(n=function(){var e=function(){},t="undefined",r=["trace","debug","info","warn","error"];function n(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 i(t,n){for(var i=0;i<r.length;i++){var o=r[i];this[o]=i<t?e:this.methodFactory(o,t,n)}this.log=this.debug}function o(r,o,u){return function(r){"debug"===r&&(r="log");return typeof console!==t&&(void 0!==console[r]?n(console,r):void 0!==console.log?n(console,"log"):e)}(r)||function(e,r,n){return function(){typeof console!==t&&(i.call(this,r,n),this[e].apply(this,arguments))}}.apply(this,arguments)}function u(e,n,u){var s,a=this,f="loglevel";function l(){var e;if(typeof window!==t){try{e=window.localStorage[f]}catch(e){}if(typeof e===t)try{var r=window.document.cookie,n=r.indexOf(encodeURIComponent(f)+"=");-1!==n&&(e=/^([^;]+)/.exec(r.slice(n))[1])}catch(e){}return void 0===a.levels[e]&&(e=void 0),e}}e&&(f+=":"+e),a.name=e,a.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},a.methodFactory=u||o,a.getLevel=function(){return s},a.setLevel=function(n,o){if("string"==typeof n&&void 0!==a.levels[n.toUpperCase()]&&(n=a.levels[n.toUpperCase()]),!("number"==typeof n&&n>=0&&n<=a.levels.SILENT))throw"log.setLevel() called with invalid level: "+n;if(s=n,!1!==o&&function(e){var n=(r[e]||"silent").toUpperCase();if(typeof window===t)return;try{return void(window.localStorage[f]=n)}catch(e){}try{window.document.cookie=encodeURIComponent(f)+"="+n+";"}catch(e){}}(n),i.call(a,n,e),typeof console===t&&n<a.levels.SILENT)return"No console available for logging"},a.setDefaultLevel=function(e){l()||a.setLevel(e,!1)},a.enableAll=function(e){a.setLevel(a.levels.TRACE,e)},a.disableAll=function(e){a.setLevel(a.levels.SILENT,e)};var c=l();null==c&&(c=null==n?"WARN":n),a.setLevel(c,!1)}var s=new u,a={};s.getLogger=function(e){if("string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=a[e];return t||(t=a[e]=new u(e,s.getLevel(),s.methodFactory)),t};var f=typeof window!==t?window.log:void 0;return s.noConflict=function(){return typeof window!==t&&window.log===s&&(window.log=f),s},s.getLoggers=function(){return a},s})?n.call(t,r,t,e):n)||(e.exports=i)}()},15:function(e,t,r){!function(e){var t,r,n,i=String.fromCharCode;function o(e){for(var t,r,n=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(r=e.charCodeAt(i++)))?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),i--):n.push(t);return n}function u(e){if(e>=55296&&e<=57343)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value")}function s(e,t){return i(e>>t&63|128)}function a(e){if(0==(4294967168&e))return i(e);var t="";return 0==(4294965248&e)?t=i(e>>6&31|192):0==(4294901760&e)?(u(e),t=i(e>>12&15|224),t+=s(e,6)):0==(4292870144&e)&&(t=i(e>>18&7|240),t+=s(e,12),t+=s(e,6)),t+=i(63&e|128)}function f(){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 l(){var e,i;if(n>r)throw Error("Invalid byte index");if(n==r)return!1;if(e=255&t[n],n++,0==(128&e))return e;if(192==(224&e)){if((i=(31&e)<<6|f())>=128)return i;throw Error("Invalid continuation byte")}if(224==(240&e)){if((i=(15&
|
|||
|
/**
|
|||
|
* @author n1474335 [n1474335@gmail.com]
|
|||
|
* @copyright Crown Copyright 2018
|
|||
|
* @license Apache-2.0
|
|||
|
*/var p=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=l(this,c(t).call(this))).name="BSON serialise",e.module="BSON",e.description="BSON is a computer data interchange format used mainly as a data storage and network transfer format in the MongoDB database. It is a binary form for representing simple data structures, associative arrays (called objects or documents in MongoDB), and various data types of specific interest to MongoDB. The name 'BSON' is based on the term JSON and stands for 'Binary JSON'.<br><br>Input data should be valid JSON.",e.infoURL="https://wikipedia.org/wiki/BSON",e.inputType="string",e.outputType="ArrayBuffer",e.args=[],e}var r,n,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&h(e,t)}(t,i["a"]),r=t,(n=[{key:"run",value:function(e,t){if(!e)return new ArrayBuffer;try{var r=JSON.parse(e);return u.a.serialize(r).buffer}catch(e){throw new s.a(e.toString())}}}])&&f(r.prototype,n),o&&f(r,o),t}(),g="undefined"==typeof self?{}:self.OpModules||{};g.BSON={"BSON deserialise":n.a,"BSON serialise":p};t.default=g},17:function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},18:function(e,t,r){"use strict";r.d(t,"b",function(){return i}),r.d(t,"a",function(){return o});var n=r(0);
|
|||
|
/**
|
|||
|
* Binary functions.
|
|||
|
*
|
|||
|
* @author n1474335 [n1474335@gmail.com]
|
|||
|
* @copyright Crown Copyright 2018
|
|||
|
* @license Apache-2.0
|
|||
|
*/function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Space",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8;if(!e)return"";t=n.a.charRep(t);for(var i="",o=0;o<e.length;o++)i+=e[o].toString(2).padStart(r,"0")+t;return t.length?i.slice(0,-t.length):i}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Space",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,i=n.a.regexRep(t);e=e.replace(i,"");for(var o=[],u=0;u<e.length;u+=r)o.push(parseInt(e.substr(u,r),2));return o}},19:function(e,t,r){"use strict";r.d(t,"a",function(){return i});var n=r(0);
|
|||
|
/**
|
|||
|
* Decimal functions.
|
|||
|
*
|
|||
|
* @author n1474335 [n1474335@gmail.com]
|
|||
|
* @copyright Crown Copyright 2018
|
|||
|
* @license Apache-2.0
|
|||
|
*/function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Auto";t=n.a.charRep(t);var r=[],i=e.split(t);""===i[i.length-1]&&(i=i.slice(0,i.length-1));for(var o=0;o<i.length;o++)r[o]=parseInt(i[o],10);return r}},3:function(e,t,r){"use strict";function n(e){return(n="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)}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function s(e){function t(){var t=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(t,Object.getPrototypeOf(this)),t}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}
|
|||
|
/**
|
|||
|
* Custom error type for handling operation input errors.
|
|||
|
* i.e. where the operation can handle the error and print a message to the screen.
|
|||
|
*
|
|||
|
* @author d98762625 [d98762625@gmail.com]
|
|||
|
* @copyright Crown Copyright 2018
|
|||
|
* @license Apache-2.0
|
|||
|
*/var a=function(e){function t(){var e,r,o,s;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var a=arguments.length,f=new Array(a),l=0;l<a;l++)f[l]=arguments[l];return o=this,(r=!(s=(e=i(t)).call.apply(e,[this].concat(f)))||"object"!==n(s)&&"function"!=typeof s?u(o):s).type="OperationError",Error.captureStackTrace&&Error.captureStackTrace(u(u(r)),t),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(t,s(Error)),t}();t.a=a},4:function(e,t,r){var n;!function(i){"use strict";var o,u=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,s=Math.ceil,a=Math.floor,f="[BigNumber Error] ",l=f+"Number primitive has more than 15 significant digits: ",c=1e14,h=14,p=9007199254740991,g=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],y=1e7,d=1e9;function b(e){var t=0|e;return e>0||e===t?t:t-1}function _(e){for(var t,r,n=1,i=e.length,o=e[0]+"";n<i;){for(t=e[n++]+"",r=h-t.length;r--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function v(e,t){var r,n,i=e.c,o=t.c,u=e.s,s=t.s,a=e.e,f=t.e;if(!u||!s)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-s:u;if(u!=s)return u;if(r=u<0,n=a==f,!i||!o)return n?0:!i^r?1:-1;if(!n)return a>f^r?1:-1;for(s=(a=i.length)<(f=o.length)?a:f,u=0;u<s;u++)if(i[u]!=o[u])return i[u]>o[u]^r?1:-1;return a==f?0:a>f^r?1:-1}function A(e,t,r,n){if(e<t||e>r||e!==(e<0?s(e):a(e)))throw Error(f+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function m(e){var t=e.c.length-1;return b(e.e/h)==t&&e.c[t]%2!=0}function B(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function E(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}(o=function e(t){var r,n,i,o,N,S,w,O,T,D=$.prototype={constructor:$,toString:null,valueOf:null},I=new $(1),F=20,R=4,x=-7,C=21,U=-1e7,M=1e7,k=!1,P=1,L=0,j={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},z="0123456789abcdefghijklmnopqrstuvwxyz";function $(e,t){var r,o,s,f,c,g,y,d,b=this;if(!(b instanceof $))return new $(e,t);if(null==t){if(e instanceof $)return b.s=e.s,b.e=e.e,void(b.c=(e=e.c)?e.slice():e);if((g="number"==typeof e)&&0*e==0){if(b.s=1/e<0?(e=-e,-1):1,e===~~e){for(f=0,c=e;c>=10;c/=10,f++);return b.e=f,void(b.c=[e])}d=String(e)}else{if(d=String(e),!u.test(d))return i(b,d,g);b.s=45==d.charCodeAt(0)?(d=d.slice(1),-1):1}(f=d.indexOf("."))>-1&&(d=d.replace(".","")),(c=d.search(/e/i))>0?(f<0&&(f=c),f+=+d.slice(c+1),d=d.substring(0,c)):f<0&&(f=d.length)}else{if(A(t,2,z.length,"Base"),d=String(e),10==t)return G(b=new $(e instanceof $?e:d),F+b.e+1,R);if(g="number"==typeof e){if(0*e!=0)return i(b,d,g,t);if(b.s=1/e<0?(d=d.slice(1),-1):1,$.DEBUG&&d.replace(/^0\.0*|\./,"").length>15)throw Error(l+e);g=!1}else b.s=45===d.charCodeAt(0)?(d=d.slice(1),-1):1;for(r=z.slice(0,t),f=c=0,y=d.length;c<y;c++)if(r.indexOf(o=d.charAt(c))<0){if("."==o){if(c>f){f=y;continue}}else if(!s&&(d==d.toUpperCase()&&(d=d.toLowerCase())||d==d.toLowerCase()&&(d=d.toUpperCase()))){s=!0,c=-1,f=0;continue}return i(b,String(e),g,t)}(f=(d=n(d,t,10,b.s)).indexOf("."))>-1?d=d.replace(".",""):f=d.length}for(c=0;48===d.charCodeAt(c);c++);for(y=d.length;48===d.charCodeAt(--y););if(d=d.slice(c,++y)){if(y-=c,g&&$.DEBUG&&y>15&&(e>p||e!==a(e)))throw Error(l+b.s*e);if((f=f-c-1)>M)b.c=b.e=null;else if(f<U)b.c=[b.e=0];else{if(b.e=f,b.c=[],c=(f+1)%h,f<0&&(c+=h),c<y){for(c&&b.c.push(+d.slice(0,c)),y-=h;c<y;)b.c.push(+d.slice(c,c+=h));d=d.slice(c),c=h-d.length}else c-=y;for(;c--;d+="0");b.c.push(+d)}}else b.c=[b.e=0]}function Y(e,t,r,n){var i,o,u,s,a;if(null==r?r=R:A(r,0,8),!e.c)return e.toString();if(i=e.c[0],u=e.e,null==t)a=_(e.c),a=1==n||2==n&&(u<=x||u>=C)?B(a,u):E(a,u,"0");els
|
|||
|
/*!
|
|||
|
* The buffer module from node.js, for the browser.
|
|||
|
*
|
|||
|
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|||
|
* @license MIT
|
|||
|
*/
|
|||
|
var n=r(58),i=r(59),o=r(60);function u(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(u()<t)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=a.prototype:(null===e&&(e=new a(t)),e.length=t),e}function a(e,t,r){if(!(a.TYPED_ARRAY_SUPPORT||this instanceof a))return new a(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return c(this,e)}return f(this,e,t,r)}function f(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);a.TYPED_ARRAY_SUPPORT?(e=t).__proto__=a.prototype:e=h(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!a.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|g(t,r),i=(e=s(e,n)).write(t,r);i!==n&&(e=e.slice(0,i));return e}(e,t,r):function(e,t){if(a.isBuffer(t)){var r=0|p(t.length);return 0===(e=s(e,r)).length?e:(t.copy(e,0,0,r),e)}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?s(e,0):h(e,t);if("Buffer"===t.type&&o(t.data))return h(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function c(e,t){if(l(t),e=s(e,t<0?0:0|p(t)),!a.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function h(e,t){var r=t.length<0?0:0|p(t.length);e=s(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function p(e){if(e>=u())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+u().toString(16)+" bytes");return 0|e}function g(e,t){if(a.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return j(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(e).length;default:if(n)return j(e).length;t=(""+t).toLowerCase(),n=!0}}function y(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function d(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=a.from(t,n)),a.isBuffer(t))return 0===t.length?-1:b(e,t,r,n,i);if("number"==typeof t)return t&=255,a.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):b(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(e,t,r,n,i){var o,u=1,s=e.length,a=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;u=2,s/=2,a/=2,r/=2}function f(e,t){return 1===u?e[t]:e.readUInt16BE(t*u)}if(i){var l=-1;for(o=r;o<s;o++)if(f(e,o)===f(t,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===a)return l*u}else-1!==l&&(o-=o-l),l=-1}else for(r+a>s&&(r=s-a),o=r;o>=0;o--){for(var c=!0,h=0;h<a;h++)if(f(e,o+h)!==f(t,h)){c=!1;break}if(c)return o}return-1}function _(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex s
|
|||
|
/**
|
|||
|
* Hexadecimal functions.
|
|||
|
*
|
|||
|
* @author n1474335 [n1474335@gmail.com]
|
|||
|
* @copyright Crown Copyright 2016
|
|||
|
* @license Apache-2.0
|
|||
|
*/function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;if(!e)return"";for(var n="",i=0;i<e.length;i++)n+=e[i].toString(16).padStart(r,"0")+t;return"0x"===t&&(n="0x"+n),"\\x"===t&&(n="\\x"+n),t.length?n.slice(0,-t.length):n}function o(e){if(!e)return"";for(var t=[],r=0;r<e.length;r++)t.push((e[r]>>>4).toString(16)),t.push((15&e[r]).toString(16));return t.join("")}function u(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("None"!==t){var i="Auto"===t?/[^a-f\d]/gi:n.a.regexRep(t);e=e.replace(i,"")}for(var o=[],u=0;u<e.length;u+=r)o.push(parseInt(e.substr(u,r),16));return o}var s=["Space","Comma","Semi-colon","Colon","Line feed","CRLF","0x","\\x","None"],a=["Auto"].concat(s)},775:function(e,t,r){"use strict";(function(e){var n=r(1),i=r(518),o=r.n(i),u=r(3);function s(e){return(s="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)}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function f(e,t){return!t||"object"!==s(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
|
|||
|
/**
|
|||
|
* @author n1474335 [n1474335@gmail.com]
|
|||
|
* @copyright Crown Copyright 2018
|
|||
|
* @license Apache-2.0
|
|||
|
*/var h=function(t){function r(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r),(e=f(this,l(r).call(this))).name="BSON deserialise",e.module="BSON",e.description="BSON is a computer data interchange format used mainly as a data storage and network transfer format in the MongoDB database. It is a binary form for representing simple data structures, associative arrays (called objects or documents in MongoDB), and various data types of specific interest to MongoDB. The name 'BSON' is based on the term JSON and stands for 'Binary JSON'.<br><br>Input data should be in a raw bytes format.",e.infoURL="https://wikipedia.org/wiki/BSON",e.inputType="ArrayBuffer",e.outputType="string",e.args=[],e}var i,s,h;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}(r,n["a"]),i=r,(s=[{key:"run",value:function(t,r){if(!t.byteLength)return"";try{var n=o.a.deserialize(new e(t));return JSON.stringify(n,null,2)}catch(e){throw new u.a(e.toString())}}}])&&a(i.prototype,s),h&&a(i,h),r}();t.a=h}).call(this,r(5).Buffer)},9:function(e,t,r){"use strict";var n=r(0),i=r(12),o=r(4),u=r.n(o),s=r(14),a=r.n(s);function f(e,t,r,n,i,o,u){try{var s=e[o](u),a=s.value}catch(e){return void r(e)}s.done?t(a):Promise.resolve(a).then(n,i)}function l(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function u(e){f(o,n,i,u,s,"next",e)}function s(e){f(o,n,i,u,s,"throw",e)}u(void 0)})}}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}
|
|||
|
/**
|
|||
|
* @author n1474335 [n1474335@gmail.com]
|
|||
|
* @author Matt C [matt@artemisbot.uk]
|
|||
|
* @copyright Crown Copyright 2016
|
|||
|
* @license Apache-2.0
|
|||
|
*/
|
|||
|
var h=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.value=[],this.type=e.BYTE_ARRAY,t&&t.hasOwnProperty("value")&&t.hasOwnProperty("type")&&this.set(t.value,t.type)}var t,r,o;return t=e,r=[{key:"set",value:function(t,r){if("string"==typeof r&&(r=e.typeEnum(r)),a.a.debug("Dish type: "+e.enumLookup(r)),this.value=t,this.type=r,!this.valid()){var o=n.a.truncate(JSON.stringify(this.value),13);throw new i.a("Data is not a valid ".concat(e.enumLookup(r),": ").concat(o))}}},{key:"get",value:function(){var t=l(regeneratorRuntime.mark(function t(r){var n,i=arguments;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n=i.length>1&&void 0!==i[1]&&i[1],"string"==typeof r&&(r=e.typeEnum(r)),this.type===r){t.next=5;break}return t.next=5,this._translate(r,n);case 5:return t.abrupt("return",this.value);case 6:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"_translate",value:function(){var t=l(regeneratorRuntime.mark(function t(r){var o,s,f=arguments;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:o=f.length>1&&void 0!==f[1]&&f[1],a.a.debug("Translating Dish from ".concat(e.enumLookup(this.type)," to ").concat(e.enumLookup(r))),s=o?n.a.byteArrayToChars:n.a.byteArrayToUtf8,t.prev=3,t.t0=this.type,t.next=t.t0===e.STRING?7:t.t0===e.NUMBER?9:t.t0===e.HTML?11:t.t0===e.ARRAY_BUFFER?13:t.t0===e.BIG_NUMBER?15:t.t0===e.JSON?17:t.t0===e.FILE?19:t.t0===e.LIST_FILE?24:30;break;case 7:return this.value=this.value?n.a.strToByteArray(this.value):[],t.abrupt("break",31);case 9:return this.value="number"==typeof this.value?n.a.strToByteArray(this.value.toString()):[],t.abrupt("break",31);case 11:return this.value=this.value?n.a.strToByteArray(n.a.unescapeHtml(n.a.stripHtmlTags(this.value,!0))):[],t.abrupt("break",31);case 13:return this.value=Array.prototype.slice.call(new Uint8Array(this.value)),t.abrupt("break",31);case 15:return this.value=u.a.isBigNumber(this.value)?n.a.strToByteArray(this.value.toFixed()):[],t.abrupt("break",31);case 17:return this.value=this.value?n.a.strToByteArray(JSON.stringify(this.value,null,4)):[],t.abrupt("break",31);case 19:return t.next=21,n.a.readFile(this.value);case 21:return this.value=t.sent,this.value=Array.prototype.slice.call(this.value),t.abrupt("break",31);case 24:return t.next=26,Promise.all(this.value.map(function(){var e=l(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.a.readFile(t));case 1:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()));case 26:return this.value=t.sent,this.value=this.value.map(function(e){return Array.prototype.slice.call(e)}),this.value=[].concat.apply([],this.value),t.abrupt("break",31);case 30:return t.abrupt("break",31);case 31:t.next=36;break;case 33:throw t.prev=33,t.t1=t.catch(3),new i.a("Error translating from ".concat(e.enumLookup(this.type)," to byteArray: ").concat(t.t1));case 36:this.type=e.BYTE_ARRAY,t.prev=37,t.t2=r,t.next=t.t2===e.STRING?41:t.t2===e.HTML?41:t.t2===e.NUMBER?44:t.t2===e.ARRAY_BUFFER?47:t.t2===e.BIG_NUMBER?50:t.t2===e.JSON?53:t.t2===e.FILE?56:t.t2===e.LIST_FILE?58:61;break;case 41:return this.value=this.value?s(this.value):"",this.type=e.STRING,t.abrupt("break",62);case 44:return this.value=this.value?parseFloat(s(this.value)):0,this.type=e.NUMBER,t.abrupt("break",62);case 47:return this.value=new Uint8Array(this.value).buffer,this.type=e.ARRAY_BUFFER,t.abrupt("break",62);case 50:try{this.value=new u.a(s(this.value))}catch(e){this.value=new u.a(NaN)}return this.type=e.BIG_NUMBER,t.abrupt("break",62);case 53:return this.value=JSON.parse(s(this.value)),this.type=e.JSON,t.abrupt("break",62);case 56:return this.value=new File(this.value,"unknown"),t.abrupt("break",62);case 58:return this.value=[new File(this.value,"unknown")],this.type=e.LIST_FILE,t.abrupt("break",
|