From 51b627ab2966cc9f81b827d8bfc05302fc77fcb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Tue, 29 Nov 2016 19:28:07 +0100 Subject: [PATCH 01/24] Added operation: "XPath expression" --- .gitignore | 1 + Gruntfile.js | 1 + src/js/config/Categories.js | 1 + src/js/config/OperationConfig.js | 18 + src/js/lib/jquery.xpath.js | 6380 ++++++++++++++++++++++++++++++ src/js/operations/Extract.js | 65 +- 6 files changed, 6464 insertions(+), 2 deletions(-) create mode 100644 src/js/lib/jquery.xpath.js diff --git a/.gitignore b/.gitignore index 482be5c7..77d1e64a 100755 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ build/dev docs/* !docs/*.conf.json !docs/*.ico +.idea/* \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index c968f125..bd3e327b 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -123,6 +123,7 @@ module.exports = function(grunt) { "src/js/lib/vkbeautify.js", "src/js/lib/Sortable.js", "src/js/lib/bootstrap-colorpicker.js", + 'src/js/lib/jquery.xpath.js', // Custom libraries "src/js/lib/canvas_components.js", diff --git a/src/js/config/Categories.js b/src/js/config/Categories.js index 02c2b1f5..5120e5c9 100755 --- a/src/js/config/Categories.js +++ b/src/js/config/Categories.js @@ -186,6 +186,7 @@ var Categories = [ "Extract file paths", "Extract dates", "Regular expression", + "XPath expression", ] }, { diff --git a/src/js/config/OperationConfig.js b/src/js/config/OperationConfig.js index f011a0b2..dec017e0 100755 --- a/src/js/config/OperationConfig.js +++ b/src/js/config/OperationConfig.js @@ -1893,6 +1893,24 @@ var OperationConfig = { }, ] }, + "XPath expression": { + description: "Extract information from an xml document with an XPath query", + run: Extract.run_xpath, + input_type: "string", + output_type: "string", + args: [ + { + name: "XPath", + type: "string", + value: Extract.XPATH_INITIAL + }, + { + name: "Result delimiter", + type: "binary_short_string", + value: Extract.XPATH_DELIMITER + } + ] + }, "From UNIX Timestamp": { description: "Converts a UNIX timestamp to a datetime string.

e.g. 978346800 becomes Mon 1 January 2001 11:00:00 UTC", run: DateTime.run_from_unix_timestamp, diff --git a/src/js/lib/jquery.xpath.js b/src/js/lib/jquery.xpath.js new file mode 100644 index 00000000..33f42221 --- /dev/null +++ b/src/js/lib/jquery.xpath.js @@ -0,0 +1,6380 @@ +/* + * jQuery XPath plugin v0.3.1 + * https://github.com/ilinsky/jquery-xpath + * Copyright 2015, Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * Includes xpath.js - XPath 2.0 implementation in JavaScript + * https://github.com/ilinsky/xpath.js + * Copyright 2015, Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + */ +(function () { + + +var cString = window.String, + cBoolean = window.Boolean, + cNumber = window.Number, + cObject = window.Object, + cArray = window.Array, + cRegExp = window.RegExp, + cDate = window.Date, + cFunction = window.Function, + cMath = window.Math, + cError = window.Error, + cSyntaxError= window.SyntaxError, + cTypeError = window.TypeError, + fIsNaN = window.isNaN, + fIsFinite = window.isFinite, + nNaN = window.NaN, + nInfinity = window.Infinity, + fWindow_btoa = window.btoa, + fWindow_atob = window.atob, + fWindow_parseInt= window.parseInt, + fString_trim =(function() { + return cString.prototype.trim ? function(sValue) {return cString(sValue).trim();} : function(sValue) { + return cString(sValue).replace(/^\s+|\s+$/g, ''); + }; + })(), + fArray_indexOf =(function() { + return cArray.prototype.indexOf ? function(aValue, vItem) {return aValue.indexOf(vItem);} : function(aValue, vItem) { + for (var nIndex = 0, nLength = aValue.length; nIndex < nLength; nIndex++) + if (aValue[nIndex] === vItem) + return nIndex; + return -1; + }; + })(); + +var sNS_XSD = "http://www.w3.org/2001/XMLSchema", + sNS_XPF = "http://www.w3.org/2005/xpath-functions", + sNS_XNS = "http://www.w3.org/2000/xmlns/", + sNS_XML = "http://www.w3.org/XML/1998/namespace"; + + +function cException(sCode + , sMessage + ) { + + this.code = sCode; + this.message = + sMessage || + oException_messages[sCode]; +}; + +cException.prototype = new cError; + + +var oException_messages = {}; +oException_messages["XPDY0002"] = "Evaluation of an expression relies on some part of the dynamic context that has not been assigned a value."; +oException_messages["XPST0003"] = "Expression is not a valid instance of the grammar"; +oException_messages["XPTY0004"] = "Type is not appropriate for the context in which the expression occurs"; +oException_messages["XPST0008"] = "Expression refers to an element name, attribute name, schema type name, namespace prefix, or variable name that is not defined in the static context"; +oException_messages["XPST0010"] = "Axis not supported"; +oException_messages["XPST0017"] = "Expanded QName and number of arguments in a function call do not match the name and arity of a function signature"; +oException_messages["XPTY0018"] = "The result of the last step in a path expression contains both nodes and atomic values"; +oException_messages["XPTY0019"] = "The result of a step (other than the last step) in a path expression contains an atomic value."; +oException_messages["XPTY0020"] = "In an axis step, the context item is not a node."; +oException_messages["XPST0051"] = "It is a static error if a QName that is used as an AtomicType in a SequenceType is not defined in the in-scope schema types as an atomic type."; +oException_messages["XPST0081"] = "A QName used in an expression contains a namespace prefix that cannot be expanded into a namespace URI by using the statically known namespaces."; +oException_messages["FORG0001"] = "Invalid value for cast/constructor."; +oException_messages["FORG0003"] = "fn:zero-or-one called with a sequence containing more than one item."; +oException_messages["FORG0004"] = "fn:one-or-more called with a sequence containing no items."; +oException_messages["FORG0005"] = "fn:exactly-one called with a sequence containing zero or more than one item."; +oException_messages["FORG0006"] = "Invalid argument type."; +oException_messages["FODC0001"] = "No context document."; +oException_messages["FORX0001"] = "Invalid regular expression flags."; +oException_messages["FOCA0002"] = "Invalid lexical value."; +oException_messages["FOCH0002"] = "Unsupported collation."; + +oException_messages["FONS0004"] = "No namespace found for prefix."; + + +function cLexer(sValue) { + var aMatch = sValue.match(/\$?(?:(?![0-9-])(?:[\w-]+|\*):)?(?![0-9-])(?:[\w-]+|\*)|\(:|:\)|\/\/|\.\.|::|\d+(?:\.\d*)?(?:[eE][+-]?\d+)?|\.\d+(?:[eE][+-]?\d+)?|"[^"]*(?:""[^"]*)*"|'[^']*(?:''[^']*)*'|<<|>>|[!<>]=|(?![0-9-])[\w-]+:\*|\s+|./g); + if (aMatch) { + var nStack = 0; + for (var nIndex = 0, nLength = aMatch.length; nIndex < nLength; nIndex++) + if (aMatch[nIndex] == '(:') + nStack++; + else + if (aMatch[nIndex] == ':)' && nStack) + nStack--; + else + if (!nStack && !/^\s/.test(aMatch[nIndex])) + this[this.length++] = aMatch[nIndex]; + if (nStack) + throw new cException("XPST0003" + , "Unclosed comment" + ); + } +}; + +cLexer.prototype.index = 0; +cLexer.prototype.length = 0; + +cLexer.prototype.reset = function() { + this.index = 0; +}; + +cLexer.prototype.peek = function(nOffset) { + return this[this.index +(nOffset || 0)] || ''; +}; + +cLexer.prototype.next = function(nOffset) { + return(this.index+= nOffset || 1) < this.length; +}; + +cLexer.prototype.back = function(nOffset) { + return(this.index-= nOffset || 1) > 0; +}; + +cLexer.prototype.eof = function() { + return this.index >= this.length; +}; + + +function cDOMAdapter() { + +}; + +cDOMAdapter.prototype.isNode = function(oNode) { + return oNode &&!!oNode.nodeType; +}; + +cDOMAdapter.prototype.getProperty = function(oNode, sName) { + return oNode[sName]; +}; + +cDOMAdapter.prototype.isSameNode = function(oNode, oNode2) { + return oNode == oNode2; +}; + +cDOMAdapter.prototype.compareDocumentPosition = function(oNode, oNode2) { + return oNode.compareDocumentPosition(oNode2); +}; + +cDOMAdapter.prototype.lookupNamespaceURI = function(oNode, sPrefix) { + return oNode.lookupNamespaceURI(sPrefix); +}; + +cDOMAdapter.prototype.getElementById = function(oNode, sId) { + return oNode.getElementById(sId); +}; + +cDOMAdapter.prototype.getElementsByTagNameNS = function(oNode, sNameSpaceURI, sLocalName) { + return oNode.getElementsByTagNameNS(sNameSpaceURI, sLocalName); +}; + + +function cDynamicContext(oStaticContext, vItem, oScope, oDOMAdapter) { + this.staticContext = oStaticContext; + this.item = vItem; + this.scope = oScope || {}; + this.stack = {}; + this.DOMAdapter = oDOMAdapter || new cDOMAdapter; + var oDate = new cDate, + nOffset = oDate.getTimezoneOffset(); + this.dateTime = new cXSDateTime(oDate.getFullYear(), oDate.getMonth() + 1, oDate.getDate(), oDate.getHours(), oDate.getMinutes(), oDate.getSeconds() + oDate.getMilliseconds() / 1000, -nOffset); + this.timezone = new cXSDayTimeDuration(0, cMath.abs(~~(nOffset / 60)), cMath.abs(nOffset % 60), 0, nOffset > 0); +}; + +cDynamicContext.prototype.item = null; +cDynamicContext.prototype.position = 0; +cDynamicContext.prototype.size = 0; +cDynamicContext.prototype.scope = null; +cDynamicContext.prototype.stack = null; cDynamicContext.prototype.dateTime = null; +cDynamicContext.prototype.timezone = null; +cDynamicContext.prototype.staticContext = null; + +cDynamicContext.prototype.pushVariable = function(sName, vValue) { + if (!this.stack.hasOwnProperty(sName)) + this.stack[sName] = []; + this.stack[sName].push(this.scope[sName]); + this.scope[sName] = vValue; +}; + +cDynamicContext.prototype.popVariable = function(sName) { + if (this.stack.hasOwnProperty(sName)) { + this.scope[sName] = this.stack[sName].pop(); + if (!this.stack[sName].length) { + delete this.stack[sName]; + if (typeof this.scope[sName] == "undefined") + delete this.scope[sName]; + } + } +}; + + +function cStaticContext() { + this.dataTypes = {}; + this.documents = {}; + this.functions = {}; + this.collations = {}; + this.collections= {}; +}; + +cStaticContext.prototype.baseURI = null; +cStaticContext.prototype.dataTypes = null; +cStaticContext.prototype.documents = null; +cStaticContext.prototype.functions = null; +cStaticContext.prototype.defaultFunctionNamespace = null; +cStaticContext.prototype.collations = null; +cStaticContext.prototype.defaultCollationName = sNS_XPF + "/collation/codepoint"; +cStaticContext.prototype.collections = null; +cStaticContext.prototype.namespaceResolver = null; +cStaticContext.prototype.defaultElementNamespace = null; + +var rStaticContext_uri = /^(?:\{([^\}]+)\})?(.+)$/; +cStaticContext.prototype.setDataType = function(sUri, fFunction) { + var aMatch = sUri.match(rStaticContext_uri); + if (aMatch) + if (aMatch[1] != sNS_XSD) + this.dataTypes[sUri] = fFunction; +}; + +cStaticContext.prototype.getDataType = function(sUri) { + var aMatch = sUri.match(rStaticContext_uri); + if (aMatch) + return aMatch[1] == sNS_XSD ? hStaticContext_dataTypes[cRegExp.$2] : this.dataTypes[sUri]; +}; + +cStaticContext.prototype.setDocument = function(sUri, fFunction) { + this.documents[sUri] = fFunction; +}; + +cStaticContext.prototype.setFunction = function(sUri, fFunction) { + var aMatch = sUri.match(rStaticContext_uri); + if (aMatch) + if (aMatch[1] != sNS_XPF) + this.functions[sUri] = fFunction; +}; + +cStaticContext.prototype.getFunction = function(sUri) { + var aMatch = sUri.match(rStaticContext_uri); + if (aMatch) + return aMatch[1] == sNS_XPF ? hStaticContext_functions[cRegExp.$2] : this.functions[sUri]; +}; + +cStaticContext.prototype.setCollation = function(sUri, fFunction) { + this.collations[sUri] = fFunction; +}; + +cStaticContext.prototype.getCollation = function(sUri) { + return this.collations[sUri]; +}; + + +cStaticContext.prototype.setCollection = function(sUri, fFunction) { + this.collections[sUri] = fFunction; +}; + +cStaticContext.prototype.getURIForPrefix = function(sPrefix) { + var oResolver = this.namespaceResolver, + fResolver = oResolver && oResolver.lookupNamespaceURI ? oResolver.lookupNamespaceURI : oResolver, + sNameSpaceURI; + if (fResolver instanceof cFunction && (sNameSpaceURI = fResolver.call(oResolver, sPrefix))) + return sNameSpaceURI; + if (sPrefix == 'fn') + return sNS_XPF; + if (sPrefix == 'xs') + return sNS_XSD; + if (sPrefix == "xml") + return sNS_XML; + if (sPrefix == "xmlns") + return sNS_XNS; + throw new cException("XPST0081" + , "Prefix '" + sPrefix + "' has not been declared" + ); +}; + +cStaticContext.js2xs = function(vItem) { + if (typeof vItem == "boolean") + vItem = new cXSBoolean(vItem); + else + if (typeof vItem == "number") + vItem =(fIsNaN(vItem) ||!fIsFinite(vItem)) ? new cXSDouble(vItem) : fNumericLiteral_parseValue(cString(vItem)); + else + vItem = new cXSString(cString(vItem)); + return vItem; +}; + +cStaticContext.xs2js = function(vItem) { + if (vItem instanceof cXSBoolean) + vItem = vItem.valueOf(); + else + if (fXSAnyAtomicType_isNumeric(vItem)) + vItem = vItem.valueOf(); + else + vItem = vItem.toString(); + return vItem; +}; + +var hStaticContext_functions = {}, + hStaticContext_signatures = {}, + hStaticContext_dataTypes = {}, + hStaticContext_operators = {}; + +function fStaticContext_defineSystemFunction(sName, aParameters, fFunction) { + hStaticContext_functions[sName] = fFunction; + hStaticContext_signatures[sName] = aParameters; +}; + +function fStaticContext_defineSystemDataType(sName, fFunction) { + hStaticContext_dataTypes[sName] = fFunction; +}; + + +function cExpression(sExpression, oStaticContext) { + var oLexer = new cLexer(sExpression), + oExpr = fExpr_parse(oLexer, oStaticContext); + if (!oLexer.eof()) + throw new cException("XPST0003" + , "Unexpected token beyond end of query" + ); + if (!oExpr) + throw new cException("XPST0003" + , "Expected expression" + ); + this.internalExpression = oExpr; +}; + +cExpression.prototype.internalExpression = null; + +cExpression.prototype.evaluate = function(oContext) { + return this.internalExpression.evaluate(oContext); +}; + + +function cStringCollator() { + +}; + +cStringCollator.prototype.equals = function(sValue1, sValue2) { + throw "Not implemented"; +}; + +cStringCollator.prototype.compare = function(sValue1, sValue2) { + throw "Not implemented"; +}; + + +function cXSConstants(){}; + +cXSConstants.ANYSIMPLETYPE_DT = 1; +cXSConstants.STRING_DT = 2; +cXSConstants.BOOLEAN_DT = 3; +cXSConstants.DECIMAL_DT = 4; +cXSConstants.FLOAT_DT = 5; +cXSConstants.DOUBLE_DT = 6; +cXSConstants.DURATION_DT = 7; +cXSConstants.DATETIME_DT = 8; +cXSConstants.TIME_DT = 9; +cXSConstants.DATE_DT = 10; +cXSConstants.GYEARMONTH_DT = 11; +cXSConstants.GYEAR_DT = 12; +cXSConstants.GMONTHDAY_DT = 13; +cXSConstants.GDAY_DT = 14; +cXSConstants.GMONTH_DT = 15; +cXSConstants.HEXBINARY_DT = 16; +cXSConstants.BASE64BINARY_DT = 17; +cXSConstants.ANYURI_DT = 18; +cXSConstants.QNAME_DT = 19; +cXSConstants.NOTATION_DT = 20; +cXSConstants.NORMALIZEDSTRING_DT = 21; +cXSConstants.TOKEN_DT = 22; +cXSConstants.LANGUAGE_DT = 23; +cXSConstants.NMTOKEN_DT = 24; +cXSConstants.NAME_DT = 25; +cXSConstants.NCNAME_DT = 26; +cXSConstants.ID_DT = 27; +cXSConstants.IDREF_DT = 28; +cXSConstants.ENTITY_DT = 29; +cXSConstants.INTEGER_DT = 30; +cXSConstants.NONPOSITIVEINTEGER_DT = 31; +cXSConstants.NEGATIVEINTEGER_DT = 32; +cXSConstants.LONG_DT = 33; +cXSConstants.INT_DT = 34; +cXSConstants.SHORT_DT = 35; +cXSConstants.BYTE_DT = 36; +cXSConstants.NONNEGATIVEINTEGER_DT = 37; +cXSConstants.UNSIGNEDLONG_DT = 38; +cXSConstants.UNSIGNEDINT_DT = 39; +cXSConstants.UNSIGNEDSHORT_DT = 40; +cXSConstants.UNSIGNEDBYTE_DT = 41; +cXSConstants.POSITIVEINTEGER_DT = 42; +cXSConstants.LISTOFUNION_DT = 43; +cXSConstants.LIST_DT = 44; +cXSConstants.UNAVAILABLE_DT = 45; + +cXSConstants.DATETIMESTAMP_DT = 46; +cXSConstants.DAYMONTHDURATION_DT = 47; +cXSConstants.DAYTIMEDURATION_DT = 48; +cXSConstants.PRECISIONDECIMAL_DT = 49; +cXSConstants.ANYATOMICTYPE_DT = 50; +cXSConstants.ANYTYPE_DT = 51; + +cXSConstants.XT_YEARMONTHDURATION_DT=-1; +cXSConstants.XT_UNTYPEDATOMIC_DT =-2; + + +function cExpr() { + this.items = []; +}; + +cExpr.prototype.items = null; + +function fExpr_parse (oLexer, oStaticContext) { + var oItem; + if (oLexer.eof() ||!(oItem = fExprSingle_parse(oLexer, oStaticContext))) + return; + + var oExpr = new cExpr; + oExpr.items.push(oItem); + while (oLexer.peek() == ',') { + oLexer.next(); + if (oLexer.eof() ||!(oItem = fExprSingle_parse(oLexer, oStaticContext))) + throw new cException("XPST0003" + , "Expected expression" + ); + oExpr.items.push(oItem); + } + return oExpr; +}; + +cExpr.prototype.evaluate = function(oContext) { + var oSequence = []; + for (var nIndex = 0, nLength = this.items.length; nIndex < nLength; nIndex++) + oSequence = hStaticContext_operators["concatenate"].call(oContext, oSequence, this.items[nIndex].evaluate(oContext)); + return oSequence; +}; + + +function cExprSingle() { + +}; + +function fExprSingle_parse (oLexer, oStaticContext) { + if (!oLexer.eof()) + return fIfExpr_parse(oLexer, oStaticContext) + || fForExpr_parse(oLexer, oStaticContext) + || fQuantifiedExpr_parse(oLexer, oStaticContext) + || fOrExpr_parse(oLexer, oStaticContext); +}; + + +function cForExpr() { + this.bindings = []; + this.returnExpr = null; +}; + +cForExpr.prototype.bindings = null; +cForExpr.prototype.returnExpr = null; + +function fForExpr_parse (oLexer, oStaticContext) { + if (oLexer.peek() == "for" && oLexer.peek(1).substr(0, 1) == '$') { + oLexer.next(); + + var oForExpr = new cForExpr, + oExpr; + do { + oForExpr.bindings.push(fSimpleForBinding_parse(oLexer, oStaticContext)); + } + while (oLexer.peek() == ',' && oLexer.next()); + + if (oLexer.peek() != "return") + throw new cException("XPST0003" + , "Expected 'return' token in for expression" + ); + + oLexer.next(); + if (oLexer.eof() ||!(oExpr = fExprSingle_parse(oLexer, oStaticContext))) + throw new cException("XPST0003" + , "Expected return statement operand in for expression" + ); + + oForExpr.returnExpr = oExpr; + return oForExpr; + } +}; + +cForExpr.prototype.evaluate = function (oContext) { + var oSequence = []; + (function(oSelf, nBinding) { + var oBinding = oSelf.bindings[nBinding++], + oSequence1 = oBinding.inExpr.evaluate(oContext), + sUri = (oBinding.namespaceURI ? '{' + oBinding.namespaceURI + '}' : '') + oBinding.localName; + for (var nIndex = 0, nLength = oSequence1.length; nIndex < nLength; nIndex++) { + oContext.pushVariable(sUri, oSequence1[nIndex]); + if (nBinding < oSelf.bindings.length) + arguments.callee(oSelf, nBinding); + else + oSequence = oSequence.concat(oSelf.returnExpr.evaluate(oContext)); + oContext.popVariable(sUri); + } + })(this, 0); + + return oSequence; +}; + +function cSimpleForBinding(sPrefix, sLocalName, sNameSpaceURI, oInExpr) { + this.prefix = sPrefix; + this.localName = sLocalName; + this.namespaceURI = sNameSpaceURI; + this.inExpr = oInExpr; +}; + +cSimpleForBinding.prototype.prefix = null; +cSimpleForBinding.prototype.localName = null; +cSimpleForBinding.prototype.namespaceURI = null; +cSimpleForBinding.prototype.inExpr = null; + +function fSimpleForBinding_parse (oLexer, oStaticContext) { + var aMatch = oLexer.peek().substr(1).match(rNameTest); + if (!aMatch) + throw new cException("XPST0003" + , "Expected binding in for expression" + ); + + if (aMatch[1] == '*' || aMatch[2] == '*') + throw new cException("XPST0003" + , "Illegal use of wildcard in for expression binding variable name" + ); + + oLexer.next(); + if (oLexer.peek() != "in") + throw new cException("XPST0003" + , "Expected 'in' token in for expression binding" + ); + + oLexer.next(); + var oExpr; + if (oLexer.eof() ||!(oExpr = fExprSingle_parse(oLexer, oStaticContext))) + throw new cException("XPST0003" + , "Expected in statement operand in for expression binding" + ); + + return new cSimpleForBinding(aMatch[1] || null, aMatch[2], aMatch[1] ? oStaticContext.getURIForPrefix(aMatch[1]) : null, oExpr); +}; + + +function cIfExpr(oCondExpr, oThenExpr, oElseExpr) { + this.condExpr = oCondExpr; + this.thenExpr = oThenExpr; + this.elseExpr = oElseExpr; +}; + +cIfExpr.prototype.condExpr = null; +cIfExpr.prototype.thenExpr = null; +cIfExpr.prototype.elseExpr = null; + +function fIfExpr_parse (oLexer, oStaticContext) { + var oCondExpr, + oThenExpr, + oElseExpr; + if (oLexer.peek() == "if" && oLexer.peek(1) == '(') { + oLexer.next(2); + if (oLexer.eof() ||!(oCondExpr = fExpr_parse(oLexer, oStaticContext))) + throw new cException("XPST0003" + , "Expected if statement operand in conditional expression" + ); + if (oLexer.peek() != ')') + throw new cException("XPST0003" + , "Expected ')' token in for expression" + ); + + oLexer.next(); + if (oLexer.peek() != "then") + throw new cException("XPST0003" + , "Expected 'then' token in conditional if expression" + ); + + oLexer.next(); + if (oLexer.eof() ||!(oThenExpr = fExprSingle_parse(oLexer, oStaticContext))) + throw new cException("XPST0003" + , "Expected then statement operand in condional expression" + ); + + if (oLexer.peek() != "else") + throw new cException("XPST0003" + , "Expected 'else' token in conditional if expression" + ); + + oLexer.next(); + if (oLexer.eof() ||!(oElseExpr = fExprSingle_parse(oLexer, oStaticContext))) + throw new cException("XPST0003" + , "Expected else statement operand in condional expression" + ); + return new cIfExpr(oCondExpr, oThenExpr, oElseExpr); + } +}; + +cIfExpr.prototype.evaluate = function (oContext) { + return this[fFunction_sequence_toEBV(this.condExpr.evaluate(oContext), oContext) ? "thenExpr" : "elseExpr"].evaluate(oContext); +}; + + +function cQuantifiedExpr(sQuantifier) { + this.quantifier = sQuantifier; + this.bindings = []; + this.satisfiesExpr = null; +}; + +cQuantifiedExpr.prototype.bindings = null; +cQuantifiedExpr.prototype.quantifier = null; +cQuantifiedExpr.prototype.satisfiesExpr = null; + +function fQuantifiedExpr_parse (oLexer, oStaticContext) { + var sQuantifier = oLexer.peek(); + if ((sQuantifier == "some" || sQuantifier == "every") && oLexer.peek(1).substr(0, 1) == '$') { + oLexer.next(); + + var oQuantifiedExpr = new cQuantifiedExpr(sQuantifier), + oExpr; + do { + oQuantifiedExpr.bindings.push(fSimpleQuantifiedBinding_parse(oLexer, oStaticContext)); + } + while (oLexer.peek() == ',' && oLexer.next()); + + if (oLexer.peek() != "satisfies") + throw new cException("XPST0003" + , "Expected 'satisfies' token in quantified expression" + ); + + oLexer.next(); + if (oLexer.eof() ||!(oExpr = fExprSingle_parse(oLexer, oStaticContext))) + throw new cException("XPST0003" + , "Expected satisfies statement operand in quantified expression" + ); + + oQuantifiedExpr.satisfiesExpr = oExpr; + return oQuantifiedExpr; + } +}; + +cQuantifiedExpr.prototype.evaluate = function (oContext) { + var bEvery = this.quantifier == "every", + bResult = bEvery ? true : false; + (function(oSelf, nBinding) { + var oBinding = oSelf.bindings[nBinding++], + oSequence1 = oBinding.inExpr.evaluate(oContext), + sUri = (oBinding.namespaceURI ? '{' + oBinding.namespaceURI + '}' : '') + oBinding.localName; + for (var nIndex = 0, nLength = oSequence1.length; (nIndex < nLength) && (bEvery ? bResult :!bResult); nIndex++) { + oContext.pushVariable(sUri, oSequence1[nIndex]); + if (nBinding < oSelf.bindings.length) + arguments.callee(oSelf, nBinding); + else + bResult = fFunction_sequence_toEBV(oSelf.satisfiesExpr.evaluate(oContext), oContext); + oContext.popVariable(sUri); + } + })(this, 0); + + return [new cXSBoolean(bResult)]; +}; + + + +function cSimpleQuantifiedBinding(sPrefix, sLocalName, sNameSpaceURI, oInExpr) { + this.prefix = sPrefix; + this.localName = sLocalName; + this.namespaceURI = sNameSpaceURI; + this.inExpr = oInExpr; +}; + +cSimpleQuantifiedBinding.prototype.prefix = null; +cSimpleQuantifiedBinding.prototype.localName = null; +cSimpleQuantifiedBinding.prototype.namespaceURI = null; +cSimpleQuantifiedBinding.prototype.inExpr = null; + +function fSimpleQuantifiedBinding_parse (oLexer, oStaticContext) { + var aMatch = oLexer.peek().substr(1).match(rNameTest); + if (!aMatch) + throw new cException("XPST0003" + , "Expected binding in quantified expression" + ); + + if (aMatch[1] == '*' || aMatch[2] == '*') + throw new cException("XPST0003" + , "Illegal use of wildcard in quantified expression binding variable name" + ); + + oLexer.next(); + if (oLexer.peek() != "in") + throw new cException("XPST0003" + , "Expected 'in' token in quantified expression binding" + ); + + oLexer.next(); + var oExpr; + if (oLexer.eof() ||!(oExpr = fExprSingle_parse(oLexer, oStaticContext))) + throw new cException("XPST0003" + , "Expected in statement operand in quantified expression binding" + ); + + return new cSimpleQuantifiedBinding(aMatch[1] || null, aMatch[2], aMatch[1] ? oStaticContext.getURIForPrefix(aMatch[1]) : null, oExpr); +}; + + +function cComparisonExpr(oLeft, oRight, sOperator) { + this.left = oLeft; + this.right = oRight; + this.operator = sOperator; +}; + +cComparisonExpr.prototype.left = null; +cComparisonExpr.prototype.right = null; +cComparisonExpr.prototype.operator = null; + +function fComparisonExpr_parse (oLexer, oStaticContext) { + var oExpr, + oRight; + if (oLexer.eof() ||!(oExpr = fRangeExpr_parse(oLexer, oStaticContext))) + return; + if (!(oLexer.peek() in hComparisonExpr_operators)) + return oExpr; + + var sOperator = oLexer.peek(); + oLexer.next(); + if (oLexer.eof() ||!(oRight = fRangeExpr_parse(oLexer, oStaticContext))) + throw new cException("XPST0003" + , "Expected second operand in comparison expression" + ); + return new cComparisonExpr(oExpr, oRight, sOperator); +}; + +cComparisonExpr.prototype.evaluate = function (oContext) { + var oResult = hComparisonExpr_operators[this.operator](this, oContext); + return oResult == null ? [] : [oResult]; +}; + +function fComparisonExpr_GeneralComp(oExpr, oContext) { + var oLeft = fFunction_sequence_atomize(oExpr.left.evaluate(oContext), oContext); + if (!oLeft.length) + return new cXSBoolean(false); + + var oRight = fFunction_sequence_atomize(oExpr.right.evaluate(oContext), oContext); + if (!oRight.length) + return new cXSBoolean(false); + + var bResult = false; + for (var nLeftIndex = 0, nLeftLength = oLeft.length, bLeft, vLeft; (nLeftIndex < nLeftLength) &&!bResult; nLeftIndex++) { + for (var nRightIndex = 0, nRightLength = oRight.length, bRight, vRight; (nRightIndex < nRightLength) &&!bResult; nRightIndex++) { + + vLeft = oLeft[nLeftIndex]; + vRight = oRight[nRightIndex]; + + bLeft = vLeft instanceof cXSUntypedAtomic; + bRight = vRight instanceof cXSUntypedAtomic; + + if (bLeft && bRight) { + vLeft = cXSString.cast(vLeft); + vRight = cXSString.cast(vRight); + } + else { + if (bLeft) { + if (vRight instanceof cXSDayTimeDuration) + vLeft = cXSDayTimeDuration.cast(vLeft); + else + if (vRight instanceof cXSYearMonthDuration) + vLeft = cXSYearMonthDuration.cast(vLeft); + else + if (vRight.primitiveKind) + vLeft = hStaticContext_dataTypes[vRight.primitiveKind].cast(vLeft); + } + else + if (bRight) { + if (vLeft instanceof cXSDayTimeDuration) + vRight = cXSDayTimeDuration.cast(vRight); + else + if (vLeft instanceof cXSYearMonthDuration) + vRight = cXSYearMonthDuration.cast(vRight); + else + if (vLeft.primitiveKind) + vRight = hStaticContext_dataTypes[vLeft.primitiveKind].cast(vRight); + } + + if (vLeft instanceof cXSAnyURI) + vLeft = cXSString.cast(vLeft); + if (vRight instanceof cXSAnyURI) + vRight = cXSString.cast(vRight); + } + + bResult = hComparisonExpr_ValueComp_operators[hComparisonExpr_GeneralComp_map[oExpr.operator]](vLeft, vRight, oContext).valueOf(); + } + } + return new cXSBoolean(bResult); +}; + +var hComparisonExpr_GeneralComp_map = { + '=': 'eq', + '!=': 'ne', + '>': 'gt', + '<': 'lt', + '>=': 'ge', + '<=': 'le' +}; + +function fComparisonExpr_ValueComp(oExpr, oContext) { + var oLeft = fFunction_sequence_atomize(oExpr.left.evaluate(oContext), oContext); + if (!oLeft.length) + return null; + fFunctionCall_assertSequenceCardinality(oContext, oLeft, '?' + , "first operand of '" + oExpr.operator + "'" + ); + + var oRight = fFunction_sequence_atomize(oExpr.right.evaluate(oContext), oContext); + if (!oRight.length) + return null; + fFunctionCall_assertSequenceCardinality(oContext, oRight, '?' + , "second operand of '" + oExpr.operator + "'" + ); + + var vLeft = oLeft[0], + vRight = oRight[0]; + + if (vLeft instanceof cXSUntypedAtomic) + vLeft = cXSString.cast(vLeft); + if (vRight instanceof cXSUntypedAtomic) + vRight = cXSString.cast(vRight); + + if (vLeft instanceof cXSAnyURI) + vLeft = cXSString.cast(vLeft); + if (vRight instanceof cXSAnyURI) + vRight = cXSString.cast(vRight); + + return hComparisonExpr_ValueComp_operators[oExpr.operator](vLeft, vRight, oContext); +}; + +var hComparisonExpr_ValueComp_operators = {}; +hComparisonExpr_ValueComp_operators['eq'] = function(oLeft, oRight, oContext) { + var sOperator = ''; + + if (fXSAnyAtomicType_isNumeric(oLeft)) { + if (fXSAnyAtomicType_isNumeric(oRight)) + sOperator = "numeric-equal"; + } + else + if (oLeft instanceof cXSBoolean) { + if (oRight instanceof cXSBoolean) + sOperator = "boolean-equal"; + } + else + if (oLeft instanceof cXSString) { + if (oRight instanceof cXSString) + return hStaticContext_operators["numeric-equal"].call(oContext, hStaticContext_functions["compare"].call(oContext, oLeft, oRight), new cXSInteger(0)); + } + else + if (oLeft instanceof cXSDate) { + if (oRight instanceof cXSDate) + sOperator = "date-equal"; + } + else + if (oLeft instanceof cXSTime) { + if (oRight instanceof cXSTime) + sOperator = "time-equal"; + } + else + if (oLeft instanceof cXSDateTime) { + if (oRight instanceof cXSDateTime) + sOperator = "dateTime-equal"; + } + else + if (oLeft instanceof cXSDuration) { + if (oRight instanceof cXSDuration) + sOperator = "duration-equal"; + } + else + if (oLeft instanceof cXSGYearMonth) { + if (oRight instanceof cXSGYearMonth) + sOperator = "gYearMonth-equal"; + } + else + if (oLeft instanceof cXSGYear) { + if (oRight instanceof cXSGYear) + sOperator = "gYear-equal"; + } + else + if (oLeft instanceof cXSGMonthDay) { + if (oRight instanceof cXSGMonthDay) + sOperator = "gMonthDay-equal"; + } + else + if (oLeft instanceof cXSGMonth) { + if (oRight instanceof cXSGMonth) + sOperator = "gMonth-equal"; + } + else + if (oLeft instanceof cXSGDay) { + if (oRight instanceof cXSGDay) + sOperator = "gDay-equal"; + } + else + if (oLeft instanceof cXSQName) { + if (oRight instanceof cXSQName) + sOperator = "QName-equal"; + } + else + if (oLeft instanceof cXSHexBinary) { + if (oRight instanceof cXSHexBinary) + sOperator = "hexBinary-equal"; + } + else + if (oLeft instanceof cXSBase64Binary) { + if (oRight instanceof cXSBase64Binary) + sOperator = "base64Binary-equal"; + } + + if (sOperator) + return hStaticContext_operators[sOperator].call(oContext, oLeft, oRight); + + throw new cException("XPTY0004" + , "Cannot compare values of given types" + ); }; +hComparisonExpr_ValueComp_operators['ne'] = function(oLeft, oRight, oContext) { + return new cXSBoolean(!hComparisonExpr_ValueComp_operators['eq'](oLeft, oRight, oContext).valueOf()); +}; +hComparisonExpr_ValueComp_operators['gt'] = function(oLeft, oRight, oContext) { + var sOperator = ''; + + if (fXSAnyAtomicType_isNumeric(oLeft)) { + if (fXSAnyAtomicType_isNumeric(oRight)) + sOperator = "numeric-greater-than"; + } + else + if (oLeft instanceof cXSBoolean) { + if (oRight instanceof cXSBoolean) + sOperator = "boolean-greater-than"; + } + else + if (oLeft instanceof cXSString) { + if (oRight instanceof cXSString) + return hStaticContext_operators["numeric-greater-than"].call(oContext, hStaticContext_functions["compare"].call(oContext, oLeft, oRight), new cXSInteger(0)); + } + else + if (oLeft instanceof cXSDate) { + if (oRight instanceof cXSDate) + sOperator = "date-greater-than"; + } + else + if (oLeft instanceof cXSTime) { + if (oRight instanceof cXSTime) + sOperator = "time-greater-than"; + } + else + if (oLeft instanceof cXSDateTime) { + if (oRight instanceof cXSDateTime) + sOperator = "dateTime-greater-than"; + } + else + if (oLeft instanceof cXSYearMonthDuration) { + if (oRight instanceof cXSYearMonthDuration) + sOperator = "yearMonthDuration-greater-than"; + } + else + if (oLeft instanceof cXSDayTimeDuration) { + if (oRight instanceof cXSDayTimeDuration) + sOperator = "dayTimeDuration-greater-than"; + } + + if (sOperator) + return hStaticContext_operators[sOperator].call(oContext, oLeft, oRight); + + throw new cException("XPTY0004" + , "Cannot compare values of given types" + ); }; +hComparisonExpr_ValueComp_operators['lt'] = function(oLeft, oRight, oContext) { + var sOperator = ''; + + if (fXSAnyAtomicType_isNumeric(oLeft)) { + if (fXSAnyAtomicType_isNumeric(oRight)) + sOperator = "numeric-less-than"; + } + else + if (oLeft instanceof cXSBoolean) { + if (oRight instanceof cXSBoolean) + sOperator = "boolean-less-than"; + } + else + if (oLeft instanceof cXSString) { + if (oRight instanceof cXSString) + return hStaticContext_operators["numeric-less-than"].call(oContext, hStaticContext_functions["compare"].call(oContext, oLeft, oRight), new cXSInteger(0)); + } + else + if (oLeft instanceof cXSDate) { + if (oRight instanceof cXSDate) + sOperator = "date-less-than"; + } + else + if (oLeft instanceof cXSTime) { + if (oRight instanceof cXSTime) + sOperator = "time-less-than"; + } + else + if (oLeft instanceof cXSDateTime) { + if (oRight instanceof cXSDateTime) + sOperator = "dateTime-less-than"; + } + else + if (oLeft instanceof cXSYearMonthDuration) { + if (oRight instanceof cXSYearMonthDuration) + sOperator = "yearMonthDuration-less-than"; + } + else + if (oLeft instanceof cXSDayTimeDuration) { + if (oRight instanceof cXSDayTimeDuration) + sOperator = "dayTimeDuration-less-than"; + } + + if (sOperator) + return hStaticContext_operators[sOperator].call(oContext, oLeft, oRight); + + throw new cException("XPTY0004" + , "Cannot compare values of given types" + ); }; +hComparisonExpr_ValueComp_operators['ge'] = function(oLeft, oRight, oContext) { + var sOperator = ''; + + if (fXSAnyAtomicType_isNumeric(oLeft)) { + if (fXSAnyAtomicType_isNumeric(oRight)) + sOperator = "numeric-less-than"; + } + else + if (oLeft instanceof cXSBoolean) { + if (oRight instanceof cXSBoolean) + sOperator = "boolean-less-than"; + } + else + if (oLeft instanceof cXSString) { + if (oRight instanceof cXSString) + return hStaticContext_operators["numeric-greater-than"].call(oContext, hStaticContext_functions["compare"].call(oContext, oLeft, oRight), new cXSInteger(-1)); + } + else + if (oLeft instanceof cXSDate) { + if (oRight instanceof cXSDate) + sOperator = "date-less-than"; + } + else + if (oLeft instanceof cXSTime) { + if (oRight instanceof cXSTime) + sOperator = "time-less-than"; + } + else + if (oLeft instanceof cXSDateTime) { + if (oRight instanceof cXSDateTime) + sOperator = "dateTime-less-than"; + } + else + if (oLeft instanceof cXSYearMonthDuration) { + if (oRight instanceof cXSYearMonthDuration) + sOperator = "yearMonthDuration-less-than"; + } + else + if (oLeft instanceof cXSDayTimeDuration) { + if (oRight instanceof cXSDayTimeDuration) + sOperator = "dayTimeDuration-less-than"; + } + + if (sOperator) + return new cXSBoolean(!hStaticContext_operators[sOperator].call(oContext, oLeft, oRight).valueOf()); + + throw new cException("XPTY0004" + , "Cannot compare values of given types" + ); }; +hComparisonExpr_ValueComp_operators['le'] = function(oLeft, oRight, oContext) { + var sOperator = ''; + + if (fXSAnyAtomicType_isNumeric(oLeft)) { + if (fXSAnyAtomicType_isNumeric(oRight)) + sOperator = "numeric-greater-than"; + } + else + if (oLeft instanceof cXSBoolean) { + if (oRight instanceof cXSBoolean) + sOperator = "boolean-greater-than"; + } + else + if (oLeft instanceof cXSString) { + if (oRight instanceof cXSString) + return hStaticContext_operators["numeric-less-than"].call(oContext, hStaticContext_functions["compare"].call(oContext, oLeft, oRight), new cXSInteger(1)); + } + else + if (oLeft instanceof cXSDate) { + if (oRight instanceof cXSDate) + sOperator = "date-greater-than"; + } + else + if (oLeft instanceof cXSTime) { + if (oRight instanceof cXSTime) + sOperator = "time-greater-than"; + } + else + if (oLeft instanceof cXSDateTime) { + if (oRight instanceof cXSDateTime) + sOperator = "dateTime-greater-than"; + } + else + if (oLeft instanceof cXSYearMonthDuration) { + if (oRight instanceof cXSYearMonthDuration) + sOperator = "yearMonthDuration-greater-than"; + } + else + if (oLeft instanceof cXSDayTimeDuration) { + if (oRight instanceof cXSDayTimeDuration) + sOperator = "dayTimeDuration-greater-than"; + } + + if (sOperator) + return new cXSBoolean(!hStaticContext_operators[sOperator].call(oContext, oLeft, oRight).valueOf()); + + throw new cException("XPTY0004" + , "Cannot compare values of given types" + ); }; + +function fComparisonExpr_NodeComp(oExpr, oContext) { + var oLeft = oExpr.left.evaluate(oContext); + if (!oLeft.length) + return null; + fFunctionCall_assertSequenceCardinality(oContext, oLeft, '?' + , "first operand of '" + oExpr.operator + "'" + ); + fFunctionCall_assertSequenceItemType(oContext, oLeft, cXTNode + , "first operand of '" + oExpr.operator + "'" + ); + + var oRight = oExpr.right.evaluate(oContext); + if (!oRight.length) + return null; + fFunctionCall_assertSequenceCardinality(oContext, oRight, '?' + , "second operand of '" + oExpr.operator + "'" + ); + fFunctionCall_assertSequenceItemType(oContext, oRight, cXTNode + , "second operand of '" + oExpr.operator + "'" + ); + + return hComparisonExpr_NodeComp_operators[oExpr.operator](oLeft[0], oRight[0], oContext); +}; + +var hComparisonExpr_NodeComp_operators = {}; +hComparisonExpr_NodeComp_operators['is'] = function(oLeft, oRight, oContext) { + return hStaticContext_operators["is-same-node"].call(oContext, oLeft, oRight); +}; +hComparisonExpr_NodeComp_operators['>>'] = function(oLeft, oRight, oContext) { + return hStaticContext_operators["node-after"].call(oContext, oLeft, oRight); +}; +hComparisonExpr_NodeComp_operators['<<'] = function(oLeft, oRight, oContext) { + return hStaticContext_operators["node-before"].call(oContext, oLeft, oRight); +}; + +var hComparisonExpr_operators = { + '=': fComparisonExpr_GeneralComp, + '!=': fComparisonExpr_GeneralComp, + '<': fComparisonExpr_GeneralComp, + '<=': fComparisonExpr_GeneralComp, + '>': fComparisonExpr_GeneralComp, + '>=': fComparisonExpr_GeneralComp, + 'eq': fComparisonExpr_ValueComp, + 'ne': fComparisonExpr_ValueComp, + 'lt': fComparisonExpr_ValueComp, + 'le': fComparisonExpr_ValueComp, + 'gt': fComparisonExpr_ValueComp, + 'ge': fComparisonExpr_ValueComp, + 'is': fComparisonExpr_NodeComp, + '>>': fComparisonExpr_NodeComp, + '<<': fComparisonExpr_NodeComp +}; + + +function cAdditiveExpr(oExpr) { + this.left = oExpr; + this.items = []; +}; + +cAdditiveExpr.prototype.left = null; +cAdditiveExpr.prototype.items = null; + +var hAdditiveExpr_operators = {}; +hAdditiveExpr_operators['+'] = function(oLeft, oRight, oContext) { + var sOperator = '', + bReverse = false; + + if (fXSAnyAtomicType_isNumeric(oLeft)) { + if (fXSAnyAtomicType_isNumeric(oRight)) + sOperator = "numeric-add"; + } + else + if (oLeft instanceof cXSDate) { + if (oRight instanceof cXSYearMonthDuration) + sOperator = "add-yearMonthDuration-to-date"; + else + if (oRight instanceof cXSDayTimeDuration) + sOperator = "add-dayTimeDuration-to-date"; + } + else + if (oLeft instanceof cXSYearMonthDuration) { + if (oRight instanceof cXSDate) { + sOperator = "add-yearMonthDuration-to-date"; + bReverse = true; + } + else + if (oRight instanceof cXSDateTime) { + sOperator = "add-yearMonthDuration-to-dateTime"; + bReverse = true; + } + else + if (oRight instanceof cXSYearMonthDuration) + sOperator = "add-yearMonthDurations"; + } + else + if (oLeft instanceof cXSDayTimeDuration) { + if (oRight instanceof cXSDate) { + sOperator = "add-dayTimeDuration-to-date"; + bReverse = true; + } + else + if (oRight instanceof cXSTime) { + sOperator = "add-dayTimeDuration-to-time"; + bReverse = true; + } + else + if (oRight instanceof cXSDateTime) { + sOperator = "add-dayTimeDuration-to-dateTime"; + bReverse = true; + } + else + if (oRight instanceof cXSDayTimeDuration) + sOperator = "add-dayTimeDurations"; + } + else + if (oLeft instanceof cXSTime) { + if (oRight instanceof cXSDayTimeDuration) + sOperator = "add-dayTimeDuration-to-time"; + } + else + if (oLeft instanceof cXSDateTime) { + if (oRight instanceof cXSYearMonthDuration) + sOperator = "add-yearMonthDuration-to-dateTime"; + else + if (oRight instanceof cXSDayTimeDuration) + sOperator = "add-dayTimeDuration-to-dateTime"; + } + + if (sOperator) + return hStaticContext_operators[sOperator].call(oContext, bReverse ? oRight : oLeft, bReverse ? oLeft : oRight); + + throw new cException("XPTY0004" + , "Arithmetic operator is not defined for provided arguments" + ); }; +hAdditiveExpr_operators['-'] = function (oLeft, oRight, oContext) { + var sOperator = ''; + + if (fXSAnyAtomicType_isNumeric(oLeft)) { + if (fXSAnyAtomicType_isNumeric(oRight)) + sOperator = "numeric-subtract"; + } + else + if (oLeft instanceof cXSDate) { + if (oRight instanceof cXSDate) + sOperator = "subtract-dates"; + else + if (oRight instanceof cXSYearMonthDuration) + sOperator = "subtract-yearMonthDuration-from-date"; + else + if (oRight instanceof cXSDayTimeDuration) + sOperator = "subtract-dayTimeDuration-from-date"; + } + else + if (oLeft instanceof cXSTime) { + if (oRight instanceof cXSTime) + sOperator = "subtract-times"; + else + if (oRight instanceof cXSDayTimeDuration) + sOperator = "subtract-dayTimeDuration-from-time"; + } + else + if (oLeft instanceof cXSDateTime) { + if (oRight instanceof cXSDateTime) + sOperator = "subtract-dateTimes"; + else + if (oRight instanceof cXSYearMonthDuration) + sOperator = "subtract-yearMonthDuration-from-dateTime"; + else + if (oRight instanceof cXSDayTimeDuration) + sOperator = "subtract-dayTimeDuration-from-dateTime"; + } + else + if (oLeft instanceof cXSYearMonthDuration) { + if (oRight instanceof cXSYearMonthDuration) + sOperator = "subtract-yearMonthDurations"; + } + else + if (oLeft instanceof cXSDayTimeDuration) { + if (oRight instanceof cXSDayTimeDuration) + sOperator = "subtract-dayTimeDurations"; + } + + if (sOperator) + return hStaticContext_operators[sOperator].call(oContext, oLeft, oRight); + + throw new cException("XPTY0004" + , "Arithmetic operator is not defined for provided arguments" + ); }; + +function fAdditiveExpr_parse (oLexer, oStaticContext) { + var oExpr; + if (oLexer.eof() ||!(oExpr = fMultiplicativeExpr_parse(oLexer, oStaticContext))) + return; + if (!(oLexer.peek() in hAdditiveExpr_operators)) + return oExpr; + + var oAdditiveExpr = new cAdditiveExpr(oExpr), + sOperator; + while ((sOperator = oLexer.peek()) in hAdditiveExpr_operators) { + oLexer.next(); + if (oLexer.eof() ||!(oExpr = fMultiplicativeExpr_parse(oLexer, oStaticContext))) + throw new cException("XPST0003" + , "Expected second operand in additive expression" + ); + oAdditiveExpr.items.push([sOperator, oExpr]); + } + return oAdditiveExpr; +}; + +cAdditiveExpr.prototype.evaluate = function (oContext) { + var oLeft = fFunction_sequence_atomize(this.left.evaluate(oContext), oContext); + + if (!oLeft.length) + return []; + fFunctionCall_assertSequenceCardinality(oContext, oLeft, '?' + , "first operand of '" + this.items[0][0] + "'" + ); + + var vLeft = oLeft[0]; + if (vLeft instanceof cXSUntypedAtomic) + vLeft = cXSDouble.cast(vLeft); + for (var nIndex = 0, nLength = this.items.length, oRight, vRight; nIndex < nLength; nIndex++) { + oRight = fFunction_sequence_atomize(this.items[nIndex][1].evaluate(oContext), oContext); + + if (!oRight.length) + return []; + fFunctionCall_assertSequenceCardinality(oContext, oRight, '?' + , "first operand of '" + this.items[nIndex][0] + "'" + ); + + vRight = oRight[0]; + if (vRight instanceof cXSUntypedAtomic) + vRight = cXSDouble.cast(vRight); + vLeft = hAdditiveExpr_operators[this.items[nIndex][0]](vLeft, vRight, oContext); + } + return [vLeft]; +}; + + +function cMultiplicativeExpr(oExpr) { + this.left = oExpr; + this.items = []; +}; + +cMultiplicativeExpr.prototype.left = null; +cMultiplicativeExpr.prototype.items = null; + +var hMultiplicativeExpr_operators = {}; +hMultiplicativeExpr_operators['*'] = function (oLeft, oRight, oContext) { + var sOperator = '', + bReverse = false; + + if (fXSAnyAtomicType_isNumeric(oLeft)) { + if (fXSAnyAtomicType_isNumeric(oRight)) + sOperator = "numeric-multiply"; + else + if (oRight instanceof cXSYearMonthDuration) { + sOperator = "multiply-yearMonthDuration"; + bReverse = true; + } + else + if (oRight instanceof cXSDayTimeDuration) { + sOperator = "multiply-dayTimeDuration"; + bReverse = true; + } + } + else { + if (oLeft instanceof cXSYearMonthDuration) { + if (fXSAnyAtomicType_isNumeric(oRight)) + sOperator = "multiply-yearMonthDuration"; + } + else + if (oLeft instanceof cXSDayTimeDuration) { + if (fXSAnyAtomicType_isNumeric(oRight)) + sOperator = "multiply-dayTimeDuration"; + } + } + + if (sOperator) + return hStaticContext_operators[sOperator].call(oContext, bReverse ? oRight : oLeft, bReverse ? oLeft : oRight); + + throw new cException("XPTY0004" + , "Arithmetic operator is not defined for provided arguments" + ); }; +hMultiplicativeExpr_operators['div'] = function (oLeft, oRight, oContext) { + var sOperator = ''; + + if (fXSAnyAtomicType_isNumeric(oLeft)) { + if (fXSAnyAtomicType_isNumeric(oRight)) + sOperator = "numeric-divide"; + } + else + if (oLeft instanceof cXSYearMonthDuration) { + if (fXSAnyAtomicType_isNumeric(oRight)) + sOperator = "divide-yearMonthDuration"; + else + if (oRight instanceof cXSYearMonthDuration) + sOperator = "divide-yearMonthDuration-by-yearMonthDuration"; + } + else + if (oLeft instanceof cXSDayTimeDuration) { + if (fXSAnyAtomicType_isNumeric(oRight)) + sOperator = "divide-dayTimeDuration"; + else + if (oRight instanceof cXSDayTimeDuration) + sOperator = "divide-dayTimeDuration-by-dayTimeDuration"; + } + if (sOperator) + return hStaticContext_operators[sOperator].call(oContext, oLeft, oRight); + + throw new cException("XPTY0004" + , "Arithmetic operator is not defined for provided arguments" + ); }; +hMultiplicativeExpr_operators['idiv'] = function (oLeft, oRight, oContext) { + if (fXSAnyAtomicType_isNumeric(oLeft) && fXSAnyAtomicType_isNumeric(oRight)) + return hStaticContext_operators["numeric-integer-divide"].call(oContext, oLeft, oRight); + throw new cException("XPTY0004" + , "Arithmetic operator is not defined for provided arguments" + ); }; +hMultiplicativeExpr_operators['mod'] = function (oLeft, oRight, oContext) { + if (fXSAnyAtomicType_isNumeric(oLeft) && fXSAnyAtomicType_isNumeric(oRight)) + return hStaticContext_operators["numeric-mod"].call(oContext, oLeft, oRight); + throw new cException("XPTY0004" + , "Arithmetic operator is not defined for provided arguments" + ); }; + +function fMultiplicativeExpr_parse (oLexer, oStaticContext) { + var oExpr; + if (oLexer.eof() ||!(oExpr = fUnionExpr_parse(oLexer, oStaticContext))) + return; + if (!(oLexer.peek() in hMultiplicativeExpr_operators)) + return oExpr; + + var oMultiplicativeExpr = new cMultiplicativeExpr(oExpr), + sOperator; + while ((sOperator = oLexer.peek()) in hMultiplicativeExpr_operators) { + oLexer.next(); + if (oLexer.eof() ||!(oExpr = fUnionExpr_parse(oLexer, oStaticContext))) + throw new cException("XPST0003" + , "Expected second operand in multiplicative expression" + ); + oMultiplicativeExpr.items.push([sOperator, oExpr]); + } + return oMultiplicativeExpr; +}; + +cMultiplicativeExpr.prototype.evaluate = function (oContext) { + var oLeft = fFunction_sequence_atomize(this.left.evaluate(oContext), oContext); + + if (!oLeft.length) + return []; + fFunctionCall_assertSequenceCardinality(oContext, oLeft, '?' + , "first operand of '" + this.items[0][0] + "'" + ); + + var vLeft = oLeft[0]; + if (vLeft instanceof cXSUntypedAtomic) + vLeft = cXSDouble.cast(vLeft); + for (var nIndex = 0, nLength = this.items.length, oRight, vRight; nIndex < nLength; nIndex++) { + oRight = fFunction_sequence_atomize(this.items[nIndex][1].evaluate(oContext), oContext); + + if (!oRight.length) + return []; + fFunctionCall_assertSequenceCardinality(oContext, oRight, '?' + , "second operand of '" + this.items[nIndex][0] + "'" + ); + + vRight = oRight[0]; + if (vRight instanceof cXSUntypedAtomic) + vRight = cXSDouble.cast(vRight); + vLeft = hMultiplicativeExpr_operators[this.items[nIndex][0]](vLeft, vRight, oContext); + } + return [vLeft]; +}; + + +function cUnaryExpr(sOperator, oExpr) { + this.operator = sOperator; + this.expression = oExpr; +}; + +cUnaryExpr.prototype.operator = null; +cUnaryExpr.prototype.expression = null; + +var hUnaryExpr_operators = {}; +hUnaryExpr_operators['-'] = function(oRight, oContext) { + if (fXSAnyAtomicType_isNumeric(oRight)) + return hStaticContext_operators["numeric-unary-minus"].call(oContext, oRight); + throw new cException("XPTY0004" + , "Arithmetic operator is not defined for provided arguments" + ); }; +hUnaryExpr_operators['+'] = function(oRight, oContext) { + if (fXSAnyAtomicType_isNumeric(oRight)) + return hStaticContext_operators["numeric-unary-plus"].call(oContext, oRight); + throw new cException("XPTY0004" + , "Arithmetic operator is not defined for provided arguments" + ); }; + +function fUnaryExpr_parse (oLexer, oStaticContext) { + if (oLexer.eof()) + return; + if (!(oLexer.peek() in hUnaryExpr_operators)) + return fValueExpr_parse(oLexer, oStaticContext); + + var sOperator = '+', + oExpr; + while (oLexer.peek() in hUnaryExpr_operators) { + if (oLexer.peek() == '-') + sOperator = sOperator == '-' ? '+' : '-'; + oLexer.next(); + } + if (oLexer.eof() ||!(oExpr = fValueExpr_parse(oLexer, oStaticContext))) + throw new cException("XPST0003" + , "Expected operand in unary expression" + ); + return new cUnaryExpr(sOperator, oExpr); +}; + +cUnaryExpr.prototype.evaluate = function (oContext) { + var oRight = fFunction_sequence_atomize(this.expression.evaluate(oContext), oContext); + + if (!oRight.length) + return []; + fFunctionCall_assertSequenceCardinality(oContext, oRight, '?' + , "second operand of '" + this.operator + "'" + ); + + var vRight = oRight[0]; + if (vRight instanceof cXSUntypedAtomic) + vRight = cXSDouble.cast(vRight); + return [hUnaryExpr_operators[this.operator](vRight, oContext)]; +}; + + +function cValueExpr() { + +}; + +function fValueExpr_parse (oLexer, oStaticContext) { + return fPathExpr_parse(oLexer, oStaticContext); +}; + + +function cOrExpr(oExpr) { + this.left = oExpr; + this.items = []; +}; + +cOrExpr.prototype.left = null; +cOrExpr.prototype.items = null; + +function fOrExpr_parse (oLexer, oStaticContext) { + var oExpr; + if (oLexer.eof() ||!(oExpr = fAndExpr_parse(oLexer, oStaticContext))) + return; + if (oLexer.peek() != "or") + return oExpr; + + var oOrExpr = new cOrExpr(oExpr); + while (oLexer.peek() == "or") { + oLexer.next(); + if (oLexer.eof() ||!(oExpr = fAndExpr_parse(oLexer, oStaticContext))) + throw new cException("XPST0003" + , "Expected second operand in logical expression" + ); + oOrExpr.items.push(oExpr); + } + return oOrExpr; +}; + +cOrExpr.prototype.evaluate = function (oContext) { + var bValue = fFunction_sequence_toEBV(this.left.evaluate(oContext), oContext); + for (var nIndex = 0, nLength = this.items.length; (nIndex < nLength) && !bValue; nIndex++) + bValue = fFunction_sequence_toEBV(this.items[nIndex].evaluate(oContext), oContext); + return [new cXSBoolean(bValue)]; +}; + + +function cAndExpr(oExpr) { + this.left = oExpr; + this.items = []; +}; + +cAndExpr.prototype.left = null; +cAndExpr.prototype.items = null; + +function fAndExpr_parse (oLexer, oStaticContext) { + var oExpr; + if (oLexer.eof() ||!(oExpr = fComparisonExpr_parse(oLexer, oStaticContext))) + return; + if (oLexer.peek() != "and") + return oExpr; + + var oAndExpr = new cAndExpr(oExpr); + while (oLexer.peek() == "and") { + oLexer.next(); + if (oLexer.eof() ||!(oExpr = fComparisonExpr_parse(oLexer, oStaticContext))) + throw new cException("XPST0003" + , "Expected second operand in logical expression" + ); + oAndExpr.items.push(oExpr); + } + return oAndExpr; +}; + +cAndExpr.prototype.evaluate = function (oContext) { + var bValue = fFunction_sequence_toEBV(this.left.evaluate(oContext), oContext); + for (var nIndex = 0, nLength = this.items.length; (nIndex < nLength) && bValue; nIndex++) + bValue = fFunction_sequence_toEBV(this.items[nIndex].evaluate(oContext), oContext); + return [new cXSBoolean(bValue)]; +}; + + +function cStepExpr() { + +}; + +cStepExpr.prototype.predicates = null; + +function fStepExpr_parse (oLexer, oStaticContext) { + if (!oLexer.eof()) + return fFilterExpr_parse(oLexer, oStaticContext) + || fAxisStep_parse(oLexer, oStaticContext); +}; + +function fStepExpr_parsePredicates (oLexer, oStaticContext, oStep) { + var oExpr; + while (oLexer.peek() == '[') { + oLexer.next(); + + if (oLexer.eof() ||!(oExpr = fExpr_parse(oLexer, oStaticContext))) + throw new cException("XPST0003" + , "Expected expression in predicate" + ); + + oStep.predicates.push(oExpr); + + if (oLexer.peek() != ']') + throw new cException("XPST0003" + , "Expected ']' token in predicate" + ); + + oLexer.next(); + } +}; + +cStepExpr.prototype.applyPredicates = function(oSequence, oContext) { + var vContextItem = oContext.item, + nContextPosition= oContext.position, + nContextSize = oContext.size; + for (var nPredicateIndex = 0, oSequence1, nPredicateLength = this.predicates.length; nPredicateIndex < nPredicateLength; nPredicateIndex++) { + oSequence1 = oSequence; + oSequence = []; + for (var nIndex = 0, oSequence2, nLength = oSequence1.length; nIndex < nLength; nIndex++) { + oContext.item = oSequence1[nIndex]; + oContext.position = nIndex + 1; + oContext.size = nLength; + oSequence2 = this.predicates[nPredicateIndex].evaluate(oContext); + if (oSequence2.length == 1 && fXSAnyAtomicType_isNumeric(oSequence2[0])) { + if (oSequence2[0].valueOf() == nIndex + 1) + oSequence.push(oSequence1[nIndex]); + } + else + if (fFunction_sequence_toEBV(oSequence2, oContext)) + oSequence.push(oSequence1[nIndex]); + } + } + oContext.item = vContextItem; + oContext.position = nContextPosition; + oContext.size = nContextSize; + return oSequence; +}; + + +function cAxisStep(sAxis, oTest) { + this.axis = sAxis; + this.test = oTest; + this.predicates = []; +}; + +cAxisStep.prototype = new cStepExpr; + +cAxisStep.prototype.axis = null; +cAxisStep.prototype.test = null; + +var hAxisStep_axises = {}; +hAxisStep_axises["attribute"] = {}; +hAxisStep_axises["child"] = {}; +hAxisStep_axises["descendant"] = {}; +hAxisStep_axises["descendant-or-self"] = {}; +hAxisStep_axises["following"] = {}; +hAxisStep_axises["following-sibling"] = {}; +hAxisStep_axises["self"] = {}; +hAxisStep_axises["ancestor"] = {}; +hAxisStep_axises["ancestor-or-self"] = {}; +hAxisStep_axises["parent"] = {}; +hAxisStep_axises["preceding"] = {}; +hAxisStep_axises["preceding-sibling"] = {}; + +function fAxisStep_parse (oLexer, oStaticContext) { + var sAxis = oLexer.peek(), + oExpr, + oStep; + if (oLexer.peek(1) == '::') { + if (!(sAxis in hAxisStep_axises)) + throw new cException("XPST0003" + , "Unknown axis name: " + sAxis + ); + + oLexer.next(2); + if (oLexer.eof() ||!(oExpr = fNodeTest_parse(oLexer, oStaticContext))) + throw new cException("XPST0003" + , "Expected node test expression in axis step" + ); + oStep = new cAxisStep(sAxis, oExpr); + } + else + if (sAxis == '..') { + oLexer.next(); + oStep = new cAxisStep("parent", new cKindTest("node")); + } + else + if (sAxis == '@') { + oLexer.next(); + if (oLexer.eof() ||!(oExpr = fNodeTest_parse(oLexer, oStaticContext))) + throw new cException("XPST0003" + , "Expected node test expression in axis step" + ); + oStep = new cAxisStep("attribute", oExpr); + } + else { + if (oLexer.eof() ||!(oExpr = fNodeTest_parse(oLexer, oStaticContext))) + return; + oStep = new cAxisStep(oExpr instanceof cKindTest && oExpr.name == "attribute" ? "attribute" : "child", oExpr); + } + fStepExpr_parsePredicates(oLexer, oStaticContext, oStep); + + return oStep; +}; + +cAxisStep.prototype.evaluate = function (oContext) { + var oItem = oContext.item; + + if (!oContext.DOMAdapter.isNode(oItem)) + throw new cException("XPTY0020"); + + var oSequence = [], + fGetProperty= oContext.DOMAdapter.getProperty, + nType = fGetProperty(oItem, "nodeType"); + + switch (this.axis) { + case "attribute": + if (nType == 1) + for (var aAttributes = fGetProperty(oItem, "attributes"), nIndex = 0, nLength = aAttributes.length; nIndex < nLength; nIndex++) + oSequence.push(aAttributes[nIndex]); + break; + + case "child": + for (var oNode = fGetProperty(oItem, "firstChild"); oNode; oNode = fGetProperty(oNode, "nextSibling")) + oSequence.push(oNode); + break; + + case "descendant-or-self": + oSequence.push(oItem); + case "descendant": + fAxisStep_getChildrenForward(fGetProperty(oItem, "firstChild"), oSequence, fGetProperty); + break; + + case "following": + for (var oParent = oItem, oSibling; oParent; oParent = fGetProperty(oParent, "parentNode")) + if (oSibling = fGetProperty(oParent, "nextSibling")) + fAxisStep_getChildrenForward(oSibling, oSequence, fGetProperty); + break; + + case "following-sibling": + for (var oNode = oItem; oNode = fGetProperty(oNode, "nextSibling");) + oSequence.push(oNode); + break; + + case "self": + oSequence.push(oItem); + break; + + case "ancestor-or-self": + oSequence.push(oItem); + case "ancestor": + for (var oNode = nType == 2 ? fGetProperty(oItem, "ownerElement") : oItem; oNode = fGetProperty(oNode, "parentNode");) + oSequence.push(oNode); + break; + + case "parent": + var oParent = nType == 2 ? fGetProperty(oItem, "ownerElement") : fGetProperty(oItem, "parentNode"); + if (oParent) + oSequence.push(oParent); + break; + + case "preceding": + for (var oParent = oItem, oSibling; oParent; oParent = fGetProperty(oParent, "parentNode")) + if (oSibling = fGetProperty(oParent, "previousSibling")) + fAxisStep_getChildrenBackward(oSibling, oSequence, fGetProperty); + break; + + case "preceding-sibling": + for (var oNode = oItem; oNode = fGetProperty(oNode, "previousSibling");) + oSequence.push(oNode); + break; + } + + if (oSequence.length && !(this.test instanceof cKindTest && this.test.name == "node")) { + var oSequence1 = oSequence; + oSequence = []; + for (var nIndex = 0, nLength = oSequence1.length; nIndex < nLength; nIndex++) { + if (this.test.test(oSequence1[nIndex], oContext)) + oSequence.push(oSequence1[nIndex]); + } + } + + if (oSequence.length && this.predicates.length) + oSequence = this.applyPredicates(oSequence, oContext); + + switch (this.axis) { + case "ancestor": + case "ancestor-or-self": + case "parent": + case "preceding": + case "preceding-sibling": + oSequence.reverse(); + } + + return oSequence; +}; + +function fAxisStep_getChildrenForward(oNode, oSequence, fGetProperty) { + for (var oChild; oNode; oNode = fGetProperty(oNode, "nextSibling")) { + oSequence.push(oNode); + if (oChild = fGetProperty(oNode, "firstChild")) + fAxisStep_getChildrenForward(oChild, oSequence, fGetProperty); + } +}; + +function fAxisStep_getChildrenBackward(oNode, oSequence, fGetProperty) { + for (var oChild; oNode; oNode = fGetProperty(oNode, "previousSibling")) { + if (oChild = fGetProperty(oNode, "lastChild")) + fAxisStep_getChildrenBackward(oChild, oSequence, fGetProperty); + oSequence.push(oNode); + } +}; + + +function cPathExpr() { + this.items = []; +}; + +cPathExpr.prototype.items = null; + +function fPathExpr_parse (oLexer, oStaticContext) { + if (oLexer.eof()) + return; + var sSingleSlash = '/', + sDoubleSlash = '/' + '/'; + + var oPathExpr = new cPathExpr(), + sSlash = oLexer.peek(), + oExpr; + if (sSlash == sDoubleSlash || sSlash == sSingleSlash) { + oLexer.next(); + oPathExpr.items.push(new cFunctionCall(null, "root", sNS_XPF)); + if (sSlash == sDoubleSlash) + oPathExpr.items.push(new cAxisStep("descendant-or-self", new cKindTest("node"))); + } + + if (oLexer.eof() ||!(oExpr = fStepExpr_parse(oLexer, oStaticContext))) { + if (sSlash == sSingleSlash) + return oPathExpr.items[0]; if (sSlash == sDoubleSlash) + throw new cException("XPST0003" + , "Expected path step expression" + ); + return; + } + oPathExpr.items.push(oExpr); + + while ((sSlash = oLexer.peek()) == sSingleSlash || sSlash == sDoubleSlash) { + if (sSlash == sDoubleSlash) + oPathExpr.items.push(new cAxisStep("descendant-or-self", new cKindTest("node"))); + oLexer.next(); + if (oLexer.eof() ||!(oExpr = fStepExpr_parse(oLexer, oStaticContext))) + throw new cException("XPST0003" + , "Expected path step expression" + ); + oPathExpr.items.push(oExpr); + } + + if (oPathExpr.items.length == 1) + return oPathExpr.items[0]; + + return oPathExpr; +}; + +cPathExpr.prototype.evaluate = function (oContext) { + var vContextItem = oContext.item; + var oSequence = [vContextItem]; + for (var nItemIndex = 0, nItemLength = this.items.length, oSequence1; nItemIndex < nItemLength; nItemIndex++) { + oSequence1 = []; + for (var nIndex = 0, nLength = oSequence.length; nIndex < nLength; nIndex++) { + oContext.item = oSequence[nIndex]; + for (var nRightIndex = 0, oSequence2 = this.items[nItemIndex].evaluate(oContext), nRightLength = oSequence2.length; nRightIndex < nRightLength; nRightIndex++) + if ((nItemIndex < nItemLength - 1) && !oContext.DOMAdapter.isNode(oSequence2[nRightIndex])) + throw new cException("XPTY0019"); + else + if (fArray_indexOf(oSequence1, oSequence2[nRightIndex]) ==-1) + oSequence1.push(oSequence2[nRightIndex]); + } + oSequence = oSequence1; + }; + oContext.item = vContextItem; + return fFunction_sequence_order(oSequence, oContext); +}; + + +function cNodeTest() { + +}; + +function fNodeTest_parse (oLexer, oStaticContext) { + if (!oLexer.eof()) + return fKindTest_parse(oLexer, oStaticContext) + || fNameTest_parse(oLexer, oStaticContext); +}; + + +function cKindTest(sName) { + this.name = sName; + this.args = []; +}; + +cKindTest.prototype = new cNodeTest; + +cKindTest.prototype.name = null; +cKindTest.prototype.args = null; + +var hKindTest_names = {}; +hKindTest_names["document-node"] = {}; +hKindTest_names["element"] = {}; +hKindTest_names["attribute"] = {}; +hKindTest_names["processing-instruction"] = {}; +hKindTest_names["comment"] = {}; +hKindTest_names["text"] = {}; +hKindTest_names["node"] = {}; +hKindTest_names["schema-element"] = {}; +hKindTest_names["schema-attribute"] = {}; + +function fKindTest_parse (oLexer, oStaticContext) { + var sName = oLexer.peek(); + if (oLexer.peek(1) == '(') { + if (!(sName in hKindTest_names)) + throw new cException("XPST0003" + , "Unknown '" + sName + "' kind test" + ); + + oLexer.next(2); + var oTest = new cKindTest(sName); + if (oLexer.peek() != ')') { + if (sName == "document-node") { + } + else + if (sName == "element") { + } + else + if (sName == "attribute") { + } + else + if (sName == "processing-instruction") { + } + else + if (sName == "schema-attribute") { + } + else + if (sName == "schema-element") { + } + } + else { + if (sName == "schema-attribute") + throw new cException("XPST0003" + , "Expected attribute declaration in 'schema-attribute' kind test" + ); + else + if (sName == "schema-element") + throw new cException("XPST0003" + , "Expected element declaration in 'schema-element' kind test" + ); + } + + if (oLexer.peek() != ')') + throw new cException("XPST0003" + , "Expected ')' token in kind test" + ); + oLexer.next(); + + return oTest; + } +}; + +cKindTest.prototype.test = function (oNode, oContext) { + var fGetProperty = oContext.DOMAdapter.getProperty, + nType = oContext.DOMAdapter.isNode(oNode) ? fGetProperty(oNode, "nodeType") : 0; + switch (this.name) { + case "node": return !!nType; + case "attribute": if (nType != 2) return false; break; + case "document-node": return nType == 9; + case "element": return nType == 1; + case "processing-instruction": if (nType != 7) return false; break; + case "comment": return nType == 8; + case "text": return nType == 3 || nType == 4; + + case "schema-attribute": + throw "KindTest '" + "schema-attribute" + "' not implemented"; + + case "schema-element": + throw "KindTest '" + "schema-element" + "' not implemented"; + } + + if (nType == 2) + return fGetProperty(oNode, "prefix") != "xmlns" && fGetProperty(oNode, "localName") != "xmlns"; + if (nType == 7) + return fGetProperty(oNode, "target") != "xml"; + + return true; +}; + + +function cNameTest(sPrefix, sLocalName, sNameSpaceURI) { + this.prefix = sPrefix; + this.localName = sLocalName; + this.namespaceURI = sNameSpaceURI; +}; + +cNameTest.prototype = new cNodeTest; + +cNameTest.prototype.prefix = null; +cNameTest.prototype.localName = null; +cNameTest.prototype.namespaceURI = null; + +var rNameTest = /^(?:(?![0-9-])([\w-]+|\*)\:)?(?![0-9-])([\w-]+|\*)$/; +function fNameTest_parse (oLexer, oStaticContext) { + var aMatch = oLexer.peek().match(rNameTest); + if (aMatch) { + if (aMatch[1] == '*' && aMatch[2] == '*') + throw new cException("XPST0003" + , "Illegal use of *:* wildcard in name test" + ); + oLexer.next(); + return new cNameTest(aMatch[1] || null, aMatch[2], aMatch[1] ? aMatch[1] == '*' ? '*' : oStaticContext.getURIForPrefix(aMatch[1]) || null : oStaticContext.defaultElementNamespace); + } +}; + +cNameTest.prototype.test = function (oNode, oContext) { + var fGetProperty = oContext.DOMAdapter.getProperty, + nType = fGetProperty(oNode, "nodeType"); + if (nType == 1 || nType == 2) { + if (this.localName == '*') + return (nType == 1 || (fGetProperty(oNode, "prefix") != "xmlns" && fGetProperty(oNode, "localName") != "xmlns")) && (!this.prefix || fGetProperty(oNode, "namespaceURI") == this.namespaceURI); + if (this.localName == fGetProperty(oNode, "localName")) + return this.namespaceURI == '*' || (nType == 2 && !this.prefix && !fGetProperty(oNode, "prefix")) || fGetProperty(oNode, "namespaceURI") == this.namespaceURI; + } + return false; +}; + + +function cPrimaryExpr() { + +}; + +function fPrimaryExpr_parse (oLexer, oStaticContext) { + if (!oLexer.eof()) + return fContextItemExpr_parse(oLexer, oStaticContext) + || fParenthesizedExpr_parse(oLexer, oStaticContext) + || fFunctionCall_parse(oLexer, oStaticContext) + || fVarRef_parse(oLexer, oStaticContext) + || fLiteral_parse(oLexer, oStaticContext); +}; + + +function cParenthesizedExpr(oExpr) { + this.expression = oExpr; +}; + +function fParenthesizedExpr_parse (oLexer, oStaticContext) { + if (oLexer.peek() == '(') { + oLexer.next(); + var oExpr = null; + if (oLexer.peek() != ')') + oExpr = fExpr_parse(oLexer, oStaticContext); + + if (oLexer.peek() != ')') + throw new cException("XPST0003" + , "Expected ')' token in parenthesized expression" + ); + + oLexer.next(); + + return new cParenthesizedExpr(oExpr); + } +}; + +cParenthesizedExpr.prototype.evaluate = function (oContext) { + return this.expression ? this.expression.evaluate(oContext) : []; +}; + + +function cContextItemExpr() { + +}; + +function fContextItemExpr_parse (oLexer, oStaticContext) { + if (oLexer.peek() == '.') { + oLexer.next(); + return new cContextItemExpr; + } +}; + +cContextItemExpr.prototype.evaluate = function (oContext) { + if (oContext.item == null) + throw new cException("XPDY0002" + , "Dynamic context does not have context item initialized" + ); + return [oContext.item]; +}; + + +function cLiteral() { + +}; + +cLiteral.prototype.value = null; + +function fLiteral_parse (oLexer, oStaticContext) { + if (!oLexer.eof()) + return fNumericLiteral_parse(oLexer, oStaticContext) + || fStringLiteral_parse(oLexer, oStaticContext); +}; + +cLiteral.prototype.evaluate = function (oContext) { + return [this.value]; +}; + + +function cNumericLiteral(oValue) { + this.value = oValue; +}; + +cNumericLiteral.prototype = new cLiteral; + +var rNumericLiteral = /^[+\-]?(?:(?:(\d+)(?:\.(\d*))?)|(?:\.(\d+)))(?:[eE]([+-])?(\d+))?$/; +function fNumericLiteral_parse (oLexer, oStaticContext) { + var sValue = oLexer.peek(), + vValue = fNumericLiteral_parseValue(sValue); + if (vValue) { + oLexer.next(); + return new cNumericLiteral(vValue); + } +}; + +function fNumericLiteral_parseValue(sValue) { + var aMatch = sValue.match(rNumericLiteral); + if (aMatch) { + var cType = cXSInteger; + if (aMatch[5]) + cType = cXSDouble; + else + if (aMatch[2] || aMatch[3]) + cType = cXSDecimal; + return new cType(+sValue); + } +}; + + +function cStringLiteral(oValue) { + this.value = oValue; +}; + +cStringLiteral.prototype = new cLiteral; + +var rStringLiteral = /^'([^']*(?:''[^']*)*)'|"([^"]*(?:""[^"]*)*)"$/; +function fStringLiteral_parse (oLexer, oStaticContext) { + var aMatch = oLexer.peek().match(rStringLiteral); + if (aMatch) { + oLexer.next(); + return new cStringLiteral(new cXSString(aMatch[1] ? aMatch[1].replace("''", "'") : aMatch[2] ? aMatch[2].replace('""', '"') : '')); + } +}; + + +function cFilterExpr(oPrimary) { + this.expression = oPrimary; + this.predicates = []; +}; + +cFilterExpr.prototype = new cStepExpr; + +cFilterExpr.prototype.expression = null; + +function fFilterExpr_parse (oLexer, oStaticContext) { + var oExpr; + if (oLexer.eof() ||!(oExpr = fPrimaryExpr_parse(oLexer, oStaticContext))) + return; + + var oFilterExpr = new cFilterExpr(oExpr); + fStepExpr_parsePredicates(oLexer, oStaticContext, oFilterExpr); + + if (oFilterExpr.predicates.length == 0) + return oFilterExpr.expression; + + return oFilterExpr; +}; + +cFilterExpr.prototype.evaluate = function (oContext) { + var oSequence = this.expression.evaluate(oContext); + if (this.predicates.length && oSequence.length) + oSequence = this.applyPredicates(oSequence, oContext); + return oSequence; +}; + + +function cVarRef(sPrefix, sLocalName, sNameSpaceURI) { + this.prefix = sPrefix; + this.localName = sLocalName; + this.namespaceURI = sNameSpaceURI; +}; + +cVarRef.prototype.prefix = null; +cVarRef.prototype.localName = null; +cVarRef.prototype.namespaceURI = null; + +function fVarRef_parse (oLexer, oStaticContext) { + if (oLexer.peek().substr(0, 1) == '$') { + var aMatch = oLexer.peek().substr(1).match(rNameTest); + if (aMatch) { + if (aMatch[1] == '*' || aMatch[2] == '*') + throw new cException("XPST0003" + , "Illegal use of wildcard in var expression variable name" + ); + + var oVarRef = new cVarRef(aMatch[1] || null, aMatch[2], aMatch[1] ? oStaticContext.getURIForPrefix(aMatch[1]) : null); + oLexer.next(); + return oVarRef; + } + } +}; + +cVarRef.prototype.evaluate = function (oContext) { + var sUri = (this.namespaceURI ? '{' + this.namespaceURI + '}' : '') + this.localName; + if (oContext.scope.hasOwnProperty(sUri)) + return [oContext.scope[sUri]]; + throw new cException("XPST0008" + , "Variable $" + (this.prefix ? this.prefix + ':' : '') + this.localName + " has not been declared" + ); +}; + + +function cFunctionCall(sPrefix, sLocalName, sNameSpaceURI) { + this.prefix = sPrefix; + this.localName = sLocalName; + this.namespaceURI = sNameSpaceURI; + this.args = []; +}; + +cFunctionCall.prototype.prefix = null; +cFunctionCall.prototype.localName = null; +cFunctionCall.prototype.namespaceURI = null; +cFunctionCall.prototype.args = null; + +function fFunctionCall_parse (oLexer, oStaticContext) { + var aMatch = oLexer.peek().match(rNameTest); + if (aMatch && oLexer.peek(1) == '(') { + if (!aMatch[1] && (aMatch[2] in hKindTest_names)) + return fAxisStep_parse(oLexer, oStaticContext); + if (aMatch[1] == '*' || aMatch[2] == '*') + throw new cException("XPST0003" + , "Illegal use of wildcard in function name" + ); + var oFunctionCallExpr = new cFunctionCall(aMatch[1] || null, aMatch[2], aMatch[1] ? oStaticContext.getURIForPrefix(aMatch[1]) || null : oStaticContext.defaultFunctionNamespace), + oExpr; + oLexer.next(2); + if (oLexer.peek() != ')') { + do { + if (oLexer.eof() ||!(oExpr = fExprSingle_parse(oLexer, oStaticContext))) + throw new cException("XPST0003" + , "Expected function call argument" + ); + oFunctionCallExpr.args.push(oExpr); + } + while (oLexer.peek() == ',' && oLexer.next()); + if (oLexer.peek() != ')') + throw new cException("XPST0003" + , "Expected ')' token in function call" + ); + } + oLexer.next(); + return oFunctionCallExpr; + } +}; + +cFunctionCall.prototype.evaluate = function (oContext) { + var aArguments = [], + aParameters, + fFunction; + + for (var nIndex = 0, nLength = this.args.length; nIndex < nLength; nIndex++) + aArguments.push(this.args[nIndex].evaluate(oContext)); + + var sUri = (this.namespaceURI ? '{' + this.namespaceURI + '}' : '') + this.localName; + if (this.namespaceURI == sNS_XPF) { + if (fFunction = hStaticContext_functions[this.localName]) { + if (aParameters = hStaticContext_signatures[this.localName]) + fFunctionCall_prepare(this.localName, aParameters, fFunction, aArguments, oContext); + var vResult = fFunction.apply(oContext, aArguments); + return vResult == null ? [] : vResult instanceof cArray ? vResult : [vResult]; + } + throw new cException("XPST0017" + , "Unknown system function: " + sUri + '()' + ); + } + else + if (this.namespaceURI == sNS_XSD) { + if ((fFunction = hStaticContext_dataTypes[this.localName]) && this.localName != "NOTATION" && this.localName != "anyAtomicType") { + fFunctionCall_prepare(this.localName, [[cXSAnyAtomicType]], fFunction, aArguments, oContext); + return [fFunction.cast(aArguments[0])]; + } + throw new cException("XPST0017" + , "Unknown type constructor function: " + sUri + '()' + ); + } + else + if (fFunction = oContext.staticContext.getFunction(sUri)) { + var vResult = fFunction.apply(oContext, aArguments); + return vResult == null ? [] : vResult instanceof cArray ? vResult : [vResult]; + } + throw new cException("XPST0017" + , "Unknown user function: " + sUri + '()' + ); +}; + +var aFunctionCall_numbers = ["first", "second", "third", "fourth", "fifth"]; +function fFunctionCall_prepare(sName, aParameters, fFunction, aArguments, oContext) { + var oArgument, + nArgumentsLength = aArguments.length, + oParameter, + nParametersLength = aParameters.length, + nParametersRequired = 0; + + while ((nParametersRequired < aParameters.length) && !aParameters[nParametersRequired][2]) + nParametersRequired++; + + if (nArgumentsLength > nParametersLength) + throw new cException("XPST0017" + , "Function " + sName + "() must have " + (nParametersLength ? " no more than " : '') + nParametersLength + " argument" + (nParametersLength > 1 || !nParametersLength ? 's' : '') + ); + else + if (nArgumentsLength < nParametersRequired) + throw new cException("XPST0017" + , "Function " + sName + "() must have " + (nParametersRequired == nParametersLength ? "exactly" : "at least") + ' ' + nParametersRequired + " argument" + (nParametersLength > 1 ? 's' : '') + ); + + for (var nIndex = 0; nIndex < nArgumentsLength; nIndex++) { + oParameter = aParameters[nIndex]; + oArgument = aArguments[nIndex]; + fFunctionCall_assertSequenceCardinality(oContext, oArgument, oParameter[1] + , aFunctionCall_numbers[nIndex] + " argument of " + sName + '()' + ); + fFunctionCall_assertSequenceItemType(oContext, oArgument, oParameter[0] + , aFunctionCall_numbers[nIndex] + " argument of " + sName + '()' + ); + if (oParameter[1] != '+' && oParameter[1] != '*') + aArguments[nIndex] = oArgument.length ? oArgument[0] : null; + } +}; + +function fFunctionCall_assertSequenceItemType(oContext, oSequence, cItemType + , sSource + ) { + for (var nIndex = 0, nLength = oSequence.length, nNodeType, vItem; nIndex < nLength; nIndex++) { + vItem = oSequence[nIndex]; + if (cItemType == cXTNode || cItemType.prototype instanceof cXTNode) { + if (!oContext.DOMAdapter.isNode(vItem)) + throw new cException("XPTY0004" + , "Required item type of " + sSource + " is " + cItemType + ); + + if (cItemType != cXTNode) { + nNodeType = oContext.DOMAdapter.getProperty(vItem, "nodeType"); + if ([null, cXTElement, cXTAttribute, cXTText, cXTText, null, null, cXTProcessingInstruction, cXTComment, cXTDocument, null, null, null][nNodeType] != cItemType) + throw new cException("XPTY0004" + , "Required item type of " + sSource + " is " + cItemType + ); + } + } + else + if (cItemType == cXSAnyAtomicType || cItemType.prototype instanceof cXSAnyAtomicType) { + vItem = fFunction_sequence_atomize([vItem], oContext)[0]; + if (cItemType != cXSAnyAtomicType) { + if (vItem instanceof cXSUntypedAtomic) + vItem = cItemType.cast(vItem); + else + if (cItemType == cXSString) { + if (vItem instanceof cXSAnyURI) + vItem = cXSString.cast(vItem); + } + else + if (cItemType == cXSDouble) { + if (fXSAnyAtomicType_isNumeric(vItem)) + vItem = cItemType.cast(vItem); + } + } + if (!(vItem instanceof cItemType)) + throw new cException("XPTY0004" + , "Required item type of " + sSource + " is " + cItemType + ); + oSequence[nIndex] = vItem; + } + } +}; + +function fFunctionCall_assertSequenceCardinality(oContext, oSequence, sCardinality + , sSource + ) { + var nLength = oSequence.length; + if (sCardinality == '?') { if (nLength > 1) + throw new cException("XPTY0004" + , "Required cardinality of " + sSource + " is one or zero" + ); + } + else + if (sCardinality == '+') { if (nLength < 1) + throw new cException("XPTY0004" + , "Required cardinality of " + sSource + " is one or more" + ); + } + else + if (sCardinality != '*') { if (nLength != 1) + throw new cException("XPTY0004" + , "Required cardinality of " + sSource + " is exactly one" + ); + } +}; + + +function cIntersectExceptExpr(oExpr) { + this.left = oExpr; + this.items = []; +}; + +cIntersectExceptExpr.prototype.left = null; +cIntersectExceptExpr.prototype.items = null; + +function fIntersectExceptExpr_parse (oLexer, oStaticContext) { + var oExpr, + sOperator; + if (oLexer.eof() ||!(oExpr = fInstanceofExpr_parse(oLexer, oStaticContext))) + return; + if (!((sOperator = oLexer.peek()) == "intersect" || sOperator == "except")) + return oExpr; + + var oIntersectExceptExpr = new cIntersectExceptExpr(oExpr); + while ((sOperator = oLexer.peek()) == "intersect" || sOperator == "except") { + oLexer.next(); + if (oLexer.eof() ||!(oExpr = fInstanceofExpr_parse(oLexer, oStaticContext))) + throw new cException("XPST0003" + , "Expected second operand in " + sOperator + " expression" + ); + oIntersectExceptExpr.items.push([sOperator, oExpr]); + } + return oIntersectExceptExpr; +}; + +cIntersectExceptExpr.prototype.evaluate = function (oContext) { + var oSequence = this.left.evaluate(oContext); + for (var nIndex = 0, nLength = this.items.length, oItem; nIndex < nLength; nIndex++) + oSequence = hStaticContext_operators[(oItem = this.items[nIndex])[0]].call(oContext, oSequence, oItem[1].evaluate(oContext)); + return oSequence; +}; + + +function cRangeExpr(oLeft, oRight) { + this.left = oLeft; + this.right = oRight; +}; + +cRangeExpr.prototype.left = null; +cRangeExpr.prototype.right = null; + +function fRangeExpr_parse (oLexer, oStaticContext) { + var oExpr, + oRight; + if (oLexer.eof() ||!(oExpr = fAdditiveExpr_parse(oLexer, oStaticContext))) + return; + if (oLexer.peek() != "to") + return oExpr; + + oLexer.next(); + if (oLexer.eof() ||!(oRight = fAdditiveExpr_parse(oLexer, oStaticContext))) + throw new cException("XPST0003" + , "Expected second operand in range expression" + ); + return new cRangeExpr(oExpr, oRight); +}; + +cRangeExpr.prototype.evaluate = function (oContext) { + var oLeft = this.left.evaluate(oContext); + if (!oLeft.length) + return []; + var sSource = "first operand of 'to'"; + + fFunctionCall_assertSequenceCardinality(oContext, oLeft, '?' + , sSource + ); + fFunctionCall_assertSequenceItemType(oContext, oLeft, cXSInteger + , sSource + ); + + var oRight = this.right.evaluate(oContext); + if (!oRight.length) + return []; + + sSource = "second operand of 'to'"; + + fFunctionCall_assertSequenceCardinality(oContext, oRight, '?' + , sSource + ); + fFunctionCall_assertSequenceItemType(oContext, oRight, cXSInteger + , sSource + ); + + return hStaticContext_operators["to"].call(oContext, oLeft[0], oRight[0]); +}; + + +function cUnionExpr(oExpr) { + this.left = oExpr; + this.items = []; +}; + +cUnionExpr.prototype.left = null; +cUnionExpr.prototype.items = null; + +function fUnionExpr_parse (oLexer, oStaticContext) { + var oExpr, + sOperator; + if (oLexer.eof() ||!(oExpr = fIntersectExceptExpr_parse(oLexer, oStaticContext))) + return; + if (!((sOperator = oLexer.peek()) == '|' || sOperator == "union")) + return oExpr; + + var oUnionExpr = new cUnionExpr(oExpr); + while ((sOperator = oLexer.peek()) == '|' || sOperator == "union") { + oLexer.next(); + if (oLexer.eof() ||!(oExpr = fIntersectExceptExpr_parse(oLexer, oStaticContext))) + throw new cException("XPST0003" + , "Expected second operand in union expression" + ); + oUnionExpr.items.push(oExpr); + } + return oUnionExpr; +}; + +cUnionExpr.prototype.evaluate = function (oContext) { + var oSequence = this.left.evaluate(oContext); + for (var nIndex = 0, nLength = this.items.length; nIndex < nLength; nIndex++) + oSequence = hStaticContext_operators["union"].call(oContext, oSequence, this.items[nIndex].evaluate(oContext)); + return oSequence; +}; + + +function cInstanceofExpr(oExpr, oType) { + this.expression = oExpr; + this.type = oType; +}; + +cInstanceofExpr.prototype.expression = null; +cInstanceofExpr.prototype.type = null; + +function fInstanceofExpr_parse (oLexer, oStaticContext) { + var oExpr, + oType; + if (oLexer.eof() ||!(oExpr = fTreatExpr_parse(oLexer, oStaticContext))) + return; + + if (!(oLexer.peek() == "instance" && oLexer.peek(1) == "of")) + return oExpr; + + oLexer.next(2); + if (oLexer.eof() ||!(oType = fSequenceType_parse(oLexer, oStaticContext))) + throw new cException("XPST0003" + , "Expected second operand in instance of expression" + ); + + return new cInstanceofExpr(oExpr, oType); +}; + +cInstanceofExpr.prototype.evaluate = function(oContext) { + var oSequence1 = this.expression.evaluate(oContext), + oItemType = this.type.itemType, + sOccurence = this.type.occurence; + if (!oItemType) + return [new cXSBoolean(!oSequence1.length)]; + if (!oSequence1.length) + return [new cXSBoolean(sOccurence == '?' || sOccurence == '*')]; + if (oSequence1.length != 1) + if (!(sOccurence == '+' || sOccurence == '*')) + return [new cXSBoolean(false)]; + + if (!oItemType.test) return [new cXSBoolean(true)]; + + var bValue = true; + for (var nIndex = 0, nLength = oSequence1.length; (nIndex < nLength) && bValue; nIndex++) + bValue = oItemType.test.test(oSequence1[nIndex], oContext); + return [new cXSBoolean(bValue)]; +}; + + +function cTreatExpr(oExpr, oType) { + this.expression = oExpr; + this.type = oType; +}; + +cTreatExpr.prototype.expression = null; +cTreatExpr.prototype.type = null; + +function fTreatExpr_parse (oLexer, oStaticContext) { + var oExpr, + oType; + if (oLexer.eof() ||!(oExpr = fCastableExpr_parse(oLexer, oStaticContext))) + return; + + if (!(oLexer.peek() == "treat" && oLexer.peek(1) == "as")) + return oExpr; + + oLexer.next(2); + if (oLexer.eof() ||!(oType = fSequenceType_parse(oLexer, oStaticContext))) + throw new cException("XPST0003" + , "Expected second operand in treat expression" + ); + + return new cTreatExpr(oExpr, oType); +}; + +cTreatExpr.prototype.evaluate = function(oContext) { + var oSequence1 = this.expression.evaluate(oContext), + oItemType = this.type.itemType, + sOccurence = this.type.occurence; + if (!oItemType) { + if (oSequence1.length) + throw new cException("XPDY0050" + , "The only value allowed for the value in 'treat as' expression is an empty sequence" + ); + return oSequence1; + } + + if (!(sOccurence == '?' || sOccurence == '*')) + if (!oSequence1.length) + throw new cException("XPDY0050" + , "An empty sequence is not allowed as the value in 'treat as' expression" + ); + + if (!(sOccurence == '+' || sOccurence == '*')) + if (oSequence1.length != 1) + throw new cException("XPDY0050" + , "A sequence of more than one item is not allowed as the value in 'treat as' expression" + ); + + if (!oItemType.test) return oSequence1; + + for (var nIndex = 0, nLength = oSequence1.length; nIndex < nLength; nIndex++) + if (!oItemType.test.test(oSequence1[nIndex], oContext)) + throw new cException("XPDY0050" + , "Required item type of value in 'treat as' expression is " + (oItemType.test.prefix ? oItemType.test.prefix + ':' : '') + oItemType.test.localName + ); + + return oSequence1; +}; + + +function cCastableExpr(oExpr, oType) { + this.expression = oExpr; + this.type = oType; +}; + +cCastableExpr.prototype.expression = null; +cCastableExpr.prototype.type = null; + +function fCastableExpr_parse (oLexer, oStaticContext) { + var oExpr, + oType; + if (oLexer.eof() ||!(oExpr = fCastExpr_parse(oLexer, oStaticContext))) + return; + + if (!(oLexer.peek() == "castable" && oLexer.peek(1) == "as")) + return oExpr; + + oLexer.next(2); + if (oLexer.eof() ||!(oType = fSingleType_parse(oLexer, oStaticContext))) + throw new cException("XPST0003" + , "Expected second operand in castable expression" + ); + + return new cCastableExpr(oExpr, oType); +}; + +cCastableExpr.prototype.evaluate = function(oContext) { + var oSequence1 = this.expression.evaluate(oContext), + oItemType = this.type.itemType, + sOccurence = this.type.occurence; + + if (oSequence1.length > 1) + return [new cXSBoolean(false)]; + else + if (!oSequence1.length) + return [new cXSBoolean(sOccurence == '?')]; + + try { + oItemType.cast(fFunction_sequence_atomize(oSequence1, oContext)[0]); + } + catch (e) { + if (e.code == "XPST0051") + throw e; + if (e.code == "XPST0017") + throw new cException("XPST0080" + , "No value is castable to " + (oItemType.prefix ? oItemType.prefix + ':' : '') + oItemType.localName + ); + return [new cXSBoolean(false)]; + } + + return [new cXSBoolean(true)]; +}; + + +function cCastExpr(oExpr, oType) { + this.expression = oExpr; + this.type = oType; +}; + +cCastExpr.prototype.expression = null; +cCastExpr.prototype.type = null; + +function fCastExpr_parse (oLexer, oStaticContext) { + var oExpr, + oType; + if (oLexer.eof() ||!(oExpr = fUnaryExpr_parse(oLexer, oStaticContext))) + return; + + if (!(oLexer.peek() == "cast" && oLexer.peek(1) == "as")) + return oExpr; + + oLexer.next(2); + if (oLexer.eof() ||!(oType = fSingleType_parse(oLexer, oStaticContext))) + throw new cException("XPST0003" + , "Expected second operand in cast expression" + ); + + return new cCastExpr(oExpr, oType); +}; + +cCastExpr.prototype.evaluate = function(oContext) { + var oSequence1 = this.expression.evaluate(oContext); + fFunctionCall_assertSequenceCardinality(oContext, oSequence1, this.type.occurence + , "'cast as' expression operand" + ); + if (!oSequence1.length) + return []; + return [this.type.itemType.cast(fFunction_sequence_atomize(oSequence1, oContext)[0], oContext)]; +}; + + +function cAtomicType(sPrefix, sLocalName, sNameSpaceURI) { + this.prefix = sPrefix; + this.localName = sLocalName; + this.namespaceURI = sNameSpaceURI; +}; + +cAtomicType.prototype.prefix = null; +cAtomicType.prototype.localName = null; +cAtomicType.prototype.namespaceURI = null; + +function fAtomicType_parse (oLexer, oStaticContext) { + var aMatch = oLexer.peek().match(rNameTest); + if (aMatch) { + if (aMatch[1] == '*' || aMatch[2] == '*') + throw new cException("XPST0003" + , "Illegal use of wildcard in type name" + ); + oLexer.next(); + return new cAtomicType(aMatch[1] || null, aMatch[2], aMatch[1] ? oStaticContext.getURIForPrefix(aMatch[1]) : null); + } +}; + +cAtomicType.prototype.test = function(vItem, oContext) { + var sUri = (this.namespaceURI ? '{' + this.namespaceURI + '}' : '') + this.localName, + cType = this.namespaceURI == sNS_XSD ? hStaticContext_dataTypes[this.localName] : oContext.staticContext.getDataType(sUri); + if (cType) + return vItem instanceof cType; + throw new cException("XPST0051" + , "Unknown simple type " + (this.prefix ? this.prefix + ':' : '') + this.localName + ); +}; + +cAtomicType.prototype.cast = function(vItem, oContext) { + var sUri = (this.namespaceURI ? '{' + this.namespaceURI + '}' : '') + this.localName, + cType = this.namespaceURI == sNS_XSD ? hStaticContext_dataTypes[this.localName] : oContext.staticContext.getDataType(sUri); + if (cType) + return cType.cast(vItem); + throw new cException("XPST0051" + , "Unknown atomic type " + (this.prefix ? this.prefix + ':' : '') + this.localName + ); +}; + + +function cItemType(oTest) { + this.test = oTest; +}; + +cItemType.prototype.test = null; + +function fItemType_parse (oLexer, oStaticContext) { + if (oLexer.eof()) + return; + + var oExpr; + if (oLexer.peek() == "item" && oLexer.peek(1) == '(') { + oLexer.next(2); + if (oLexer.peek() != ')') + throw new cException("XPST0003" + , "Expected ')' token in item type expression" + ); + oLexer.next(); + return new cItemType; + } + if (oExpr = fKindTest_parse(oLexer, oStaticContext)) + return new cItemType(oExpr); + if (oExpr = fAtomicType_parse(oLexer, oStaticContext)) + return new cItemType(oExpr); +}; + + +function cSequenceType(oItemType, sOccurence) { + this.itemType = oItemType || null; + this.occurence = sOccurence|| null; +}; + +cSequenceType.prototype.itemType = null; +cSequenceType.prototype.occurence = null; + +function fSequenceType_parse (oLexer, oStaticContext) { + if (oLexer.eof()) + return; + + if (oLexer.peek() == "empty-sequence" && oLexer.peek(1) == '(') { + oLexer.next(2); + if (oLexer.peek() != ')') + throw new cException("XPST0003" + , "Expected ')' token in sequence type" + ); + oLexer.next(); + return new cSequenceType; } + + var oExpr, + sOccurence; + if (!oLexer.eof() && (oExpr = fItemType_parse(oLexer, oStaticContext))) { + sOccurence = oLexer.peek(); + if (sOccurence == '?' || sOccurence == '*' || sOccurence == '+') + oLexer.next(); + else + sOccurence = null; + + return new cSequenceType(oExpr, sOccurence); + } +}; + + +function cSingleType(oItemType, sOccurence) { + this.itemType = oItemType || null; + this.occurence = sOccurence|| null; +}; + +cSingleType.prototype.itemType = null; +cSingleType.prototype.occurence = null; + +function fSingleType_parse (oLexer, oStaticContext) { + var oExpr, + sOccurence; + if (!oLexer.eof() && (oExpr = fAtomicType_parse(oLexer, oStaticContext))) { + sOccurence = oLexer.peek(); + if (sOccurence == '?') + oLexer.next(); + else + sOccurence = null; + + return new cSingleType(oExpr, sOccurence); + } +}; + + +function cXSAnyType() { + +}; + +cXSAnyType.prototype.builtInKind = cXSConstants.ANYTYPE_DT; + + +function cXSAnySimpleType() { + +}; + +cXSAnySimpleType.prototype = new cXSAnyType; + +cXSAnySimpleType.prototype.builtInKind = cXSConstants.ANYSIMPLETYPE_DT; +cXSAnySimpleType.prototype.primitiveKind= null; + +cXSAnySimpleType.PRIMITIVE_ANYURI = "anyURI"; cXSAnySimpleType.PRIMITIVE_BASE64BINARY = "base64Binary"; cXSAnySimpleType.PRIMITIVE_BOOLEAN = "boolean"; cXSAnySimpleType.PRIMITIVE_DATE = "date"; cXSAnySimpleType.PRIMITIVE_DATETIME = "dateTime"; cXSAnySimpleType.PRIMITIVE_DECIMAL = "decimal"; cXSAnySimpleType.PRIMITIVE_DOUBLE = "double"; cXSAnySimpleType.PRIMITIVE_DURATION = "duration"; cXSAnySimpleType.PRIMITIVE_FLOAT = "float"; cXSAnySimpleType.PRIMITIVE_GDAY = "gDay"; cXSAnySimpleType.PRIMITIVE_GMONTH = "gMonth"; cXSAnySimpleType.PRIMITIVE_GMONTHDAY = "gMonthDay"; cXSAnySimpleType.PRIMITIVE_GYEAR = "gYear"; cXSAnySimpleType.PRIMITIVE_GYEARMONTH = "gYearMonth"; cXSAnySimpleType.PRIMITIVE_HEXBINARY = "hexBinary"; cXSAnySimpleType.PRIMITIVE_NOTATION = "NOTATION"; cXSAnySimpleType.PRIMITIVE_QNAME = "QName"; cXSAnySimpleType.PRIMITIVE_STRING = "string"; cXSAnySimpleType.PRIMITIVE_TIME = "time"; + +function cXSAnyAtomicType() { + +}; + +cXSAnyAtomicType.prototype = new cXSAnySimpleType; +cXSAnyAtomicType.prototype.builtInKind = cXSConstants.ANYATOMICTYPE_DT; + +cXSAnyAtomicType.cast = function(vValue) { + throw new cException("XPST0017" + , "Abstract type used in constructor function xs:anyAtomicType" + ); }; + +function fXSAnyAtomicType_isNumeric(vItem) { + return vItem instanceof cXSFloat || vItem instanceof cXSDouble || vItem instanceof cXSDecimal; +}; + +fStaticContext_defineSystemDataType("anyAtomicType", cXSAnyAtomicType); + + +function cXSAnyURI(sScheme, sAuthority, sPath, sQuery, sFragment) { + this.scheme = sScheme; + this.authority = sAuthority; + this.path = sPath; + this.query = sQuery; + this.fragment = sFragment; +}; + +cXSAnyURI.prototype = new cXSAnyAtomicType; +cXSAnyURI.prototype.builtInKind = cXSConstants.ANYURI_DT; +cXSAnyURI.prototype.primitiveKind = cXSAnySimpleType.PRIMITIVE_ANYURI; + +cXSAnyURI.prototype.scheme = null; +cXSAnyURI.prototype.authority = null; +cXSAnyURI.prototype.path = null; +cXSAnyURI.prototype.query = null; +cXSAnyURI.prototype.fragment = null; + +cXSAnyURI.prototype.toString = function() { + return (this.scheme ? this.scheme + ':' : '') + + (this.authority ? '/' + '/' + this.authority : '') + + (this.path ? this.path : '') + + (this.query ? '?' + this.query : '') + + (this.fragment ? '#' + this.fragment : ''); +}; + +var rXSAnyURI = /^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/; cXSAnyURI.cast = function(vValue) { + if (vValue instanceof cXSAnyURI) + return vValue; + if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) { + var aMatch; + if (aMatch = fString_trim(vValue).match(rXSAnyURI)) + return new cXSAnyURI(aMatch[2], aMatch[4], aMatch[5], aMatch[7], aMatch[9]); + throw new cException("FORG0001"); + } + throw new cException("XPTY0004" + , "Casting value '" + vValue + "' to xs:anyURI can never succeed" + ); +}; + +fStaticContext_defineSystemDataType("anyURI", cXSAnyURI); + + +function cXSBase64Binary(sValue) { + this.value = sValue; +}; + +cXSBase64Binary.prototype = new cXSAnyAtomicType; +cXSBase64Binary.prototype.builtInKind = cXSConstants.BASE64BINARY_DT; +cXSBase64Binary.prototype.primitiveKind = cXSAnySimpleType.PRIMITIVE_BASE64BINARY; + +cXSBase64Binary.prototype.value = null; + +cXSBase64Binary.prototype.valueOf = function() { + return this.value; +}; + +cXSBase64Binary.prototype.toString = function() { + return this.value; +}; + +var rXSBase64Binary = /^((([A-Za-z0-9+\/]\s*){4})*(([A-Za-z0-9+\/]\s*){3}[A-Za-z0-9+\/]|([A-Za-z0-9+\/]\s*){2}[AEIMQUYcgkosw048]\s*=|[A-Za-z0-9+\/]\s*[AQgw]\s*=\s*=))?$/; +cXSBase64Binary.cast = function(vValue) { + if (vValue instanceof cXSBase64Binary) + return vValue; + if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) { + var aMatch = fString_trim(vValue).match(rXSBase64Binary); + if (aMatch) + return new cXSBase64Binary(aMatch[0]); + throw new cException("FORG0001"); + } + if (vValue instanceof cXSHexBinary) { + var aMatch = vValue.valueOf().match(/.{2}/g), + aValue = []; + for (var nIndex = 0, nLength = aMatch.length; nIndex < nLength; nIndex++) + aValue.push(cString.fromCharCode(fWindow_parseInt(aMatch[nIndex], 16))); + return new cXSBase64Binary(fWindow_btoa(aValue.join(''))); + } + throw new cException("XPTY0004" + , "Casting value '" + vValue + "' to xs:hexBinary can never succeed" + ); +}; + +fStaticContext_defineSystemDataType("base64Binary", cXSBase64Binary); + + +function cXSBoolean(bValue) { + this.value = bValue; +}; + +cXSBoolean.prototype = new cXSAnyAtomicType; +cXSBoolean.prototype.builtInKind = cXSConstants.BOOLEAN_DT; +cXSBoolean.prototype.primitiveKind = cXSAnySimpleType.PRIMITIVE_BOOLEAN; + +cXSBoolean.prototype.value = null; + +cXSBoolean.prototype.valueOf = function() { + return this.value; +}; + +cXSBoolean.prototype.toString = function() { + return cString(this.value); +}; + +var rXSBoolean = /^(0|1|true|false)$/; +cXSBoolean.cast = function(vValue) { + if (vValue instanceof cXSBoolean) + return vValue; + if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) { + var aMatch; + if (aMatch = fString_trim(vValue).match(rXSBoolean)) + return new cXSBoolean(aMatch[1] == '1' || aMatch[1] == "true"); + throw new cException("FORG0001"); + } + if (fXSAnyAtomicType_isNumeric(vValue)) + return new cXSBoolean(vValue != 0); + throw new cException("XPTY0004" + , "Casting value '" + vValue + "' to xs:boolean can never succeed" + ); +}; + +fStaticContext_defineSystemDataType("boolean", cXSBoolean); + + +function cXSDate(nYear, nMonth, nDay, nTimezone, bNegative) { + this.year = nYear; + this.month = nMonth; + this.day = nDay; + this.timezone = nTimezone; + this.negative = bNegative; +}; + +cXSDate.prototype = new cXSAnyAtomicType; +cXSDate.prototype.builtInKind = cXSConstants.DATE_DT; +cXSDate.prototype.primitiveKind = cXSAnySimpleType.PRIMITIVE_DATE; + +cXSDate.prototype.year = null; +cXSDate.prototype.month = null; +cXSDate.prototype.day = null; +cXSDate.prototype.timezone = null; +cXSDate.prototype.negative = null; + +cXSDate.prototype.toString = function() { + return fXSDateTime_getDateComponent(this) + + fXSDateTime_getTZComponent(this); +}; + +var rXSDate = /^(-?)([1-9]\d\d\d+|0\d\d\d)-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])(Z|([+\-])(0\d|1[0-4]):([0-5]\d))?$/; +cXSDate.cast = function(vValue) { + if (vValue instanceof cXSDate) + return vValue; + if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) { + var aMatch = fString_trim(vValue).match(rXSDate); + if (aMatch) { + var nYear = +aMatch[2], + nMonth = +aMatch[3], + nDay = +aMatch[4]; + if (nDay - 1 < fXSDate_getDaysForYearMonth(nYear, nMonth)) + return new cXSDate( nYear, + nMonth, + nDay, + aMatch[5] ? aMatch[5] == 'Z' ? 0 : (aMatch[6] == '-' ? -1 : 1) * (aMatch[7] * 60 + aMatch[8] * 1) : null, + aMatch[1] == '-' + ); + throw new cException("FORG0001" + , "Invalid date '" + vValue + "' (Non-existent date)" + ); + } + throw new cException("FORG0001"); + } + if (vValue instanceof cXSDateTime) + return new cXSDate(vValue.year, vValue.month, vValue.day, vValue.timezone, vValue.negative); + throw new cException("XPTY0004" + , "Casting value '" + vValue + "' to xs:date can never succeed" + ); +}; + +var aXSDate_days = [31,28,31,30,31,30,31,31,30,31,30,31]; +function fXSDate_getDaysForYearMonth(nYear, nMonth) { + return nMonth == 2 && (nYear % 400 == 0 || nYear % 100 != 0 && nYear % 4 == 0) ? 29 : aXSDate_days[nMonth - 1]; +}; + +function fXSDate_normalize(oValue, bDay) { + if (!bDay) { + var nDay = fXSDate_getDaysForYearMonth(oValue.year, oValue.month); + if (oValue.day > nDay) { + while (oValue.day > nDay) { + oValue.month += 1; + if (oValue.month > 12) { + oValue.year += 1; + if (oValue.year == 0) + oValue.year = 1; + oValue.month = 1; + } + oValue.day -= nDay; + nDay = fXSDate_getDaysForYearMonth(oValue.year, oValue.month); + } + } + else + if (oValue.day < 1) { + while (oValue.day < 1) { + oValue.month -= 1; + if (oValue.month < 1) { + oValue.year -= 1; + if (oValue.year == 0) + oValue.year =-1; + oValue.month = 12; + } + nDay = fXSDate_getDaysForYearMonth(oValue.year, oValue.month); + oValue.day += nDay; + } + } + } + if (oValue.month > 12) { + oValue.year += ~~(oValue.month / 12); + if (oValue.year == 0) + oValue.year = 1; + oValue.month = oValue.month % 12; + } + else + if (oValue.month < 1) { + oValue.year += ~~(oValue.month / 12) - 1; + if (oValue.year == 0) + oValue.year =-1; + oValue.month = oValue.month % 12 + 12; + } + + return oValue; +}; + +fStaticContext_defineSystemDataType("date", cXSDate); + + +function cXSDateTime(nYear, nMonth, nDay, nHours, nMinutes, nSeconds, nTimezone, bNegative) { + this.year = nYear; + this.month = nMonth; + this.day = nDay; + this.hours = nHours; + this.minutes = nMinutes; + this.seconds = nSeconds; + this.timezone = nTimezone; + this.negative = bNegative; +}; + +cXSDateTime.prototype = new cXSAnyAtomicType; +cXSDateTime.prototype.builtInKind = cXSConstants.DATETIME_DT; +cXSDateTime.prototype.primitiveKind = cXSAnySimpleType.PRIMITIVE_DATETIME; + +cXSDateTime.prototype.year = null; +cXSDateTime.prototype.month = null; +cXSDateTime.prototype.day = null; +cXSDateTime.prototype.hours = null; +cXSDateTime.prototype.minutes = null; +cXSDateTime.prototype.seconds = null; +cXSDateTime.prototype.timezone = null; +cXSDateTime.prototype.negative = null; + +cXSDateTime.prototype.toString = function() { + return fXSDateTime_getDateComponent(this) + + 'T' + + fXSDateTime_getTimeComponent(this) + + fXSDateTime_getTZComponent(this); +}; + +var rXSDateTime = /^(-?)([1-9]\d\d\d+|0\d\d\d)-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])T(([01]\d|2[0-3]):([0-5]\d):([0-5]\d)(?:\.(\d+))?|(24:00:00)(?:\.(0+))?)(Z|([+\-])(0\d|1[0-4]):([0-5]\d))?$/; +cXSDateTime.cast = function(vValue) { + if (vValue instanceof cXSDateTime) + return vValue; + if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) { + var aMatch = fString_trim(vValue).match(rXSDateTime); + if (aMatch) { + var nYear = +aMatch[2], + nMonth = +aMatch[3], + nDay = +aMatch[4], + bValue = !!aMatch[10]; + if (nDay - 1 < fXSDate_getDaysForYearMonth(nYear, nMonth)) + return fXSDateTime_normalize(new cXSDateTime( nYear, + nMonth, + nDay, + bValue ? 24 : +aMatch[6], + bValue ? 0 : +aMatch[7], + cNumber((bValue ? 0 : aMatch[8]) + '.' + (bValue ? 0 : aMatch[9] || 0)), + aMatch[12] ? aMatch[12] == 'Z' ? 0 : (aMatch[13] == '-' ? -1 : 1) * (aMatch[14] * 60 + aMatch[15] * 1) : null, + aMatch[1] == '-' + )); + throw new cException("FORG0001" + , "Invalid date '" + vValue + "' (Non-existent date)" + ); + } + throw new cException("FORG0001"); + } + if (vValue instanceof cXSDate) + return new cXSDateTime(vValue.year, vValue.month, vValue.day, 0, 0, 0, vValue.timezone, vValue.negative); + throw new cException("XPTY0004" + , "Casting value '" + vValue + "' to xs:dateTime can never succeed" + ); +}; + +function fXSDateTime_pad(vValue, nLength) { + var sValue = cString(vValue); + if (arguments.length < 2) + nLength = 2; + return (sValue.length < nLength + 1 ? new cArray(nLength + 1 - sValue.length).join('0') : '') + sValue; +}; + +function fXSDateTime_getTZComponent(oDateTime) { + var nTimezone = oDateTime.timezone; + return nTimezone == null + ? '' + : nTimezone + ? (nTimezone > 0 ? '+' : '-') + + fXSDateTime_pad(cMath.abs(~~(nTimezone / 60))) + + ':' + + fXSDateTime_pad(cMath.abs(nTimezone % 60)) + : 'Z'; +}; + +function fXSDateTime_getDateComponent(oDateTime) { + return (oDateTime.negative ? '-' : '') + + fXSDateTime_pad(oDateTime.year, 4) + + '-' + fXSDateTime_pad(oDateTime.month) + + '-' + fXSDateTime_pad(oDateTime.day); +}; + +function fXSDateTime_getTimeComponent(oDateTime) { + var aValue = cString(oDateTime.seconds).split('.'); + return fXSDateTime_pad(oDateTime.hours) + + ':' + fXSDateTime_pad(oDateTime.minutes) + + ':' + fXSDateTime_pad(aValue[0]) + + (aValue.length > 1 ? '.' + aValue[1] : ''); +}; + +function fXSDateTime_normalize(oValue) { + return fXSDate_normalize(fXSTime_normalize(oValue)); +}; + +fStaticContext_defineSystemDataType("dateTime", cXSDateTime); + + +function cXSDecimal(nValue) { + this.value = nValue; +}; + +cXSDecimal.prototype = new cXSAnyAtomicType; +cXSDecimal.prototype.builtInKind = cXSConstants.DECIMAL_DT; +cXSDecimal.prototype.primitiveKind = cXSAnySimpleType.PRIMITIVE_DECIMAL; + +cXSDecimal.prototype.value = null; + +cXSDecimal.prototype.valueOf = function() { + return this.value; +}; + +cXSDecimal.prototype.toString = function() { + return cString(this.value); +}; + +var rXSDecimal = /^[+\-]?((\d+(\.\d*)?)|(\.\d+))$/; +cXSDecimal.cast = function(vValue) { + if (vValue instanceof cXSDecimal) + return vValue; + if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) { + var aMatch = fString_trim(vValue).match(rXSDecimal); + if (aMatch) + return new cXSDecimal(+vValue); + throw new cException("FORG0001"); + } + if (vValue instanceof cXSBoolean) + return new cXSDecimal(vValue * 1); + if (fXSAnyAtomicType_isNumeric(vValue)) { + if (fIsNaN(vValue) || !fIsFinite(vValue)) + throw new cException("FOCA0002" + , "Cannot convert '" + vValue + "' to xs:decimal" + ); + return new cXSDecimal(+vValue); + } + throw new cException("XPTY0004" + , "Casting value '" + vValue + "' to xs:decimal can never succeed" + ); +}; + +fStaticContext_defineSystemDataType("decimal", cXSDecimal); + + +function cXSDouble(nValue) { + this.value = nValue; +}; + +cXSDouble.prototype = new cXSAnyAtomicType; +cXSDouble.prototype.builtInKind = cXSConstants.DOUBLE_DT; +cXSDouble.prototype.primitiveKind = cXSAnySimpleType.PRIMITIVE_DOUBLE; + +cXSDouble.prototype.value = null; + +cXSDouble.prototype.valueOf = function() { + return this.value; +}; + +cXSDouble.prototype.toString = function() { + return cString(this.value); +}; + +var rXSDouble = /^([+\-]?((\d+(\.\d*)?)|(\.\d+))([eE][+\-]?\d+)?|(-?INF)|NaN)$/; +cXSDouble.cast = function(vValue) { + if (vValue instanceof cXSDouble) + return vValue; + if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) { + var aMatch = fString_trim(vValue).match(rXSDouble); + if (aMatch) + return new cXSDouble(aMatch[7] ? +aMatch[7].replace("INF", "Infinity") : +vValue); + throw new cException("FORG0001"); + } + if (vValue instanceof cXSBoolean) + return new cXSDouble(vValue * 1); + if (fXSAnyAtomicType_isNumeric(vValue)) + return new cXSDouble(vValue.value); + throw new cException("XPTY0004" + , "Casting value '" + vValue + "' to xs:double can never succeed" + ); +}; + +fStaticContext_defineSystemDataType("double", cXSDouble); + + +function cXSDuration(nYear, nMonth, nDay, nHours, nMinutes, nSeconds, bNegative) { + this.year = nYear; + this.month = nMonth; + this.day = nDay; + this.hours = nHours; + this.minutes = nMinutes; + this.seconds = nSeconds; + this.negative = bNegative; +}; + +cXSDuration.prototype = new cXSAnyAtomicType; +cXSDuration.prototype.builtInKind = cXSConstants.DURATION_DT; +cXSDuration.prototype.primitiveKind = cXSAnySimpleType.PRIMITIVE_DURATION; + +cXSDuration.prototype.year = null; +cXSDuration.prototype.month = null; +cXSDuration.prototype.day = null; +cXSDuration.prototype.hours = null; +cXSDuration.prototype.minutes = null; +cXSDuration.prototype.seconds = null; +cXSDuration.prototype.negative = null; + +cXSDuration.prototype.toString = function() { + return (this.negative ? '-' : '') + 'P' + + ((fXSDuration_getYearMonthComponent(this) + fXSDuration_getDayTimeComponent(this)) || 'T0S'); +}; + +var rXSDuration = /^(-)?P(?:([0-9]+)Y)?(?:([0-9]+)M)?(?:([0-9]+)D)?(?:T(?:([0-9]+)H)?(?:([0-9]+)M)?(?:((?:(?:[0-9]+(?:.[0-9]*)?)|(?:.[0-9]+)))S)?)?$/; +cXSDuration.cast = function(vValue) { + if (vValue instanceof cXSYearMonthDuration) + return new cXSDuration(vValue.year, vValue.month, 0, 0, 0, 0, vValue.negative); + if (vValue instanceof cXSDayTimeDuration) + return new cXSDuration(0, 0, vValue.day, vValue.hours, vValue.minutes, vValue.seconds, vValue.negative); + if (vValue instanceof cXSDuration) + return vValue; + if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) { + var aMatch = fString_trim(vValue).match(rXSDuration); + if (aMatch) + return fXSDuration_normalize(new cXSDuration(+aMatch[2] || 0, +aMatch[3] || 0, +aMatch[4] || 0, +aMatch[5] || 0, +aMatch[6] || 0, +aMatch[7] || 0, aMatch[1] == '-')); + throw new cException("FORG0001"); + } + throw new cException("XPTY0004" + , "Casting value '" + vValue + "' to xs:duration can never succeed" + ); +}; + +function fXSDuration_getYearMonthComponent(oDuration) { + return (oDuration.year ? oDuration.year + 'Y' : '') + + (oDuration.month ? oDuration.month + 'M' : ''); +}; + +function fXSDuration_getDayTimeComponent(oDuration) { + return (oDuration.day ? oDuration.day + 'D' : '') + + (oDuration.hours || oDuration.minutes || oDuration.seconds + ? 'T' + + (oDuration.hours ? oDuration.hours + 'H' : '') + + (oDuration.minutes ? oDuration.minutes + 'M' : '') + + (oDuration.seconds ? oDuration.seconds + 'S' : '') + : ''); +}; + +function fXSDuration_normalize(oDuration) { + return fXSYearMonthDuration_normalize(fXSDayTimeDuration_normalize(oDuration)); +}; + +fStaticContext_defineSystemDataType("duration", cXSDuration); + + +function cXSFloat(nValue) { + this.value = nValue; +}; + +cXSFloat.prototype = new cXSAnyAtomicType; +cXSFloat.prototype.builtInKind = cXSConstants.FLOAT_DT; +cXSFloat.prototype.primitiveKind = cXSAnySimpleType.PRIMITIVE_FLOAT; + +cXSFloat.prototype.value = null; + +cXSFloat.prototype.valueOf = function() { + return this.value; +}; + +cXSFloat.prototype.toString = function() { + return cString(this.value); +}; + +var rXSFloat = /^([+\-]?((\d+(\.\d*)?)|(\.\d+))([eE][+\-]?\d+)?|(-?INF)|NaN)$/; +cXSFloat.cast = function(vValue) { + if (vValue instanceof cXSFloat) + return vValue; + if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) { + var aMatch = fString_trim(vValue).match(rXSFloat); + if (aMatch) + return new cXSFloat(aMatch[7] ? +aMatch[7].replace("INF", "Infinity") : +vValue); + throw new cException("FORG0001"); + } + if (vValue instanceof cXSBoolean) + return new cXSFloat(vValue * 1); + if (fXSAnyAtomicType_isNumeric(vValue)) + return new cXSFloat(vValue.value); + throw new cException("XPTY0004" + , "Casting value '" + vValue + "' to xs:float can never succeed" + ); +}; + +fStaticContext_defineSystemDataType("float", cXSFloat); + + +function cXSGDay(nDay, nTimezone) { + this.day = nDay; + this.timezone = nTimezone; +}; + +cXSGDay.prototype = new cXSAnyAtomicType; +cXSGDay.prototype.builtInKind = cXSConstants.GDAY_DT; +cXSGDay.prototype.primitiveKind = cXSAnySimpleType.PRIMITIVE_GDAY; + +cXSGDay.prototype.day = null; +cXSGDay.prototype.timezone = null; + +cXSGDay.prototype.toString = function() { + return '-' + + '-' + + '-' + fXSDateTime_pad(this.day) + + fXSDateTime_getTZComponent(this); +}; + +var rXSGDay = /^---(0[1-9]|[12]\d|3[01])(Z|([+\-])(0\d|1[0-4]):([0-5]\d))?$/; +cXSGDay.cast = function(vValue) { + if (vValue instanceof cXSGDay) + return vValue; + if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) { + var aMatch = fString_trim(vValue).match(rXSGDay); + if (aMatch) { + var nDay = +aMatch[1]; + return new cXSGDay( nDay, + aMatch[2] ? aMatch[2] == 'Z' ? 0 : (aMatch[3] == '-' ? -1 : 1) * (aMatch[4] * 60 + aMatch[5] * 1) : null + ); + } + throw new cException("FORG0001"); + } + if (vValue instanceof cXSDate || vValue instanceof cXSDateTime) + return new cXSGDay(vValue.day, vValue.timezone); + throw new cException("XPTY0004" + , "Casting value '" + vValue + "' to xs:gDay can never succeed" + ); +}; + +fStaticContext_defineSystemDataType("gDay", cXSGDay); + + +function cXSGMonth(nMonth, nTimezone) { + this.month = nMonth; + this.timezone = nTimezone; +}; + +cXSGMonth.prototype = new cXSAnyAtomicType; +cXSGMonth.prototype.builtInKind = cXSConstants.GMONTH_DT; +cXSGMonth.prototype.primitiveKind = cXSAnySimpleType.PRIMITIVE_GMONTH; + +cXSGMonth.prototype.month = null; +cXSGMonth.prototype.timezone = null; + +cXSGMonth.prototype.toString = function() { + return '-' + + '-' + fXSDateTime_pad(this.month) + + fXSDateTime_getTZComponent(this); +}; + +var rXSGMonth = /^--(0[1-9]|1[0-2])(Z|([+\-])(0\d|1[0-4]):([0-5]\d))?$/; +cXSGMonth.cast = function(vValue) { + if (vValue instanceof cXSGMonth) + return vValue; + if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) { + var aMatch = fString_trim(vValue).match(rXSGMonth); + if (aMatch) { + var nMonth = +aMatch[1]; + return new cXSGMonth( nMonth, + aMatch[2] ? aMatch[2] == 'Z' ? 0 : (aMatch[3] == '-' ? -1 : 1) * (aMatch[4] * 60 + aMatch[5] * 1) : null + ); + } + throw new cException("FORG0001"); + } + if (vValue instanceof cXSDate || vValue instanceof cXSDateTime) + return new cXSGMonth(vValue.month, vValue.timezone); + throw new cException("XPTY0004" + , "Casting value '" + vValue + "' to xs:gMonth can never succeed" + ); +}; + +fStaticContext_defineSystemDataType("gMonth", cXSGMonth); + + +function cXSGMonthDay(nMonth, nDay, nTimezone) { + this.month = nMonth; + this.day = nDay; + this.timezone = nTimezone; +}; + +cXSGMonthDay.prototype = new cXSAnyAtomicType; +cXSGMonthDay.prototype.builtInKind = cXSConstants.GMONTHDAY_DT; +cXSGMonthDay.prototype.primitiveKind = cXSAnySimpleType.PRIMITIVE_GMONTHDAY; + +cXSGMonthDay.prototype.month = null; +cXSGMonthDay.prototype.day = null; +cXSGMonthDay.prototype.timezone = null; + +cXSGMonthDay.prototype.toString = function() { + return '-' + + '-' + fXSDateTime_pad(this.month) + + '-' + fXSDateTime_pad(this.day) + + fXSDateTime_getTZComponent(this); +}; + +var rXSGMonthDay = /^--(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])(Z|([+\-])(0\d|1[0-4]):([0-5]\d))?$/; +cXSGMonthDay.cast = function(vValue) { + if (vValue instanceof cXSGMonthDay) + return vValue; + if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) { + var aMatch = fString_trim(vValue).match(rXSGMonthDay); + if (aMatch) { + var nMonth = +aMatch[1], + nDay = +aMatch[2]; + if (nDay - 1 < fXSDate_getDaysForYearMonth(1976, nMonth)) + return new cXSGMonthDay( nMonth, + nDay, + aMatch[3] ? aMatch[3] == 'Z' ? 0 : (aMatch[4] == '-' ? -1 : 1) * (aMatch[5] * 60 + aMatch[6] * 1) : null + ); + throw new cException("FORG0001" + , "Invalid date '" + vValue + "' (Non-existent date)" + ); + } + throw new cException("FORG0001"); + } + if (vValue instanceof cXSDate || vValue instanceof cXSDateTime) + return new cXSGMonthDay(vValue.month, vValue.day, vValue.timezone); + throw new cException("XPTY0004" + , "Casting value '" + vValue + "' to xs:gMonthDay can never succeed" + ); +}; + +fStaticContext_defineSystemDataType("gMonthDay", cXSGMonthDay); + + +function cXSGYear(nYear, nTimezone) { + this.year = nYear; + this.timezone = nTimezone; +}; + +cXSGYear.prototype = new cXSAnyAtomicType; +cXSGYear.prototype.builtInKind = cXSConstants.GYEAR_DT; +cXSGYear.prototype.primitiveKind = cXSAnySimpleType.PRIMITIVE_GYEAR; + +cXSGYear.prototype.year = null; +cXSGYear.prototype.timezone = null; + +cXSGYear.prototype.toString = function() { + return fXSDateTime_pad(this.year) + + fXSDateTime_getTZComponent(this); +}; + +var rXSGYear = /^-?([1-9]\d\d\d+|0\d\d\d)(Z|([+\-])(0\d|1[0-4]):([0-5]\d))?$/; +cXSGYear.cast = function(vValue) { + if (vValue instanceof cXSGYear) + return vValue; + if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) { + var aMatch = fString_trim(vValue).match(rXSGYear); + if (aMatch) { + var nYear = +aMatch[1]; + return new cXSGYear( nYear, + aMatch[2] ? aMatch[2] == 'Z' ? 0 : (aMatch[3] == '-' ? -1 : 1) * (aMatch[4] * 60 + aMatch[5] * 1) : null + ); + } + throw new cException("FORG0001"); + } + if (vValue instanceof cXSDate || vValue instanceof cXSDateTime) + return new cXSGYear(vValue.year, vValue.timezone); + throw new cException("XPTY0004" + , "Casting value '" + vValue + "' to xs:gYear can never succeed" + ); +}; + +fStaticContext_defineSystemDataType("gYear", cXSGYear); + + +function cXSGYearMonth(nYear, nMonth, nTimezone) { + this.year = nYear; + this.month = nMonth; + this.timezone = nTimezone; +}; + +cXSGYearMonth.prototype = new cXSAnyAtomicType; +cXSGYearMonth.prototype.builtInKind = cXSConstants.GYEARMONTH_DT; +cXSGYearMonth.prototype.primitiveKind = cXSAnySimpleType.PRIMITIVE_GYEARMONTH; + +cXSGYearMonth.prototype.year = null; +cXSGYearMonth.prototype.month = null; +cXSGYearMonth.prototype.timezone= null; + +cXSGYearMonth.prototype.toString = function() { + return fXSDateTime_pad(this.year) + + '-' + fXSDateTime_pad(this.month) + + fXSDateTime_getTZComponent(this); +}; + +var rXSGYearMonth = /^-?([1-9]\d\d\d+|0\d\d\d)-(0[1-9]|1[0-2])(Z|([+\-])(0\d|1[0-4]):([0-5]\d))?$/; +cXSGYearMonth.cast = function(vValue) { + if (vValue instanceof cXSGYearMonth) + return vValue; + if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) { + var aMatch = fString_trim(vValue).match(rXSGYearMonth); + if (aMatch) { + var nYear = +aMatch[1], + nMonth = +aMatch[2]; + return new cXSGYearMonth( nYear, + nMonth, + aMatch[3] ? aMatch[3] == 'Z' ? 0 : (aMatch[4] == '-' ? -1 : 1) * (aMatch[5] * 60 + aMatch[6] * 1) : null + ); + } + throw new cException("FORG0001"); + } + if (vValue instanceof cXSDate || vValue instanceof cXSDateTime) + return new cXSGYearMonth(vValue.year, vValue.month, vValue.timezone); + throw new cException("XPTY0004" + , "Casting value '" + vValue + "' to xs:gYearMonth can never succeed" + ); +}; + +fStaticContext_defineSystemDataType("gYearMonth", cXSGYearMonth); + + +function cXSHexBinary(sValue) { + this.value = sValue; +}; + +cXSHexBinary.prototype = new cXSAnyAtomicType; +cXSHexBinary.prototype.builtInKind = cXSConstants.HEXBINARY_DT; +cXSHexBinary.prototype.primitiveKind = cXSAnySimpleType.PRIMITIVE_HEXBINARY; + +cXSHexBinary.prototype.value = null; + +cXSHexBinary.prototype.valueOf = function() { + return this.value; +}; + +cXSHexBinary.prototype.toString = function() { + return this.value; +}; + +var rXSHexBinary = /^([0-9a-fA-F]{2})*$/; +cXSHexBinary.cast = function(vValue) { + if (vValue instanceof cXSHexBinary) + return vValue; + if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) { + var aMatch = fString_trim(vValue).match(rXSHexBinary); + if (aMatch) + return new cXSHexBinary(aMatch[0].toUpperCase()); + throw new cException("FORG0001"); + } + if (vValue instanceof cXSBase64Binary) { + var sValue = fWindow_atob(vValue.valueOf()), + aValue = []; + for (var nIndex = 0, nLength = sValue.length, sLetter; nIndex < nLength; nIndex++) { + sLetter = sValue.charCodeAt(nIndex).toString(16); + aValue.push(new cArray(3 - sLetter.length).join('0') + sLetter); + } + return new cXSHexBinary(aValue.join('')); + } + throw new cException("XPTY0004" + , "Casting value '" + vValue + "' to xs:hexBinary can never succeed" + ); +}; + +fStaticContext_defineSystemDataType("hexBinary", cXSHexBinary); + + +function cXSNOTATION() { + +}; + +cXSNOTATION.prototype = new cXSAnyAtomicType; +cXSNOTATION.prototype.builtInKind = cXSConstants.NOTATION_DT; +cXSNOTATION.prototype.primitiveKind = cXSAnySimpleType.PRIMITIVE_NOTATION; + +cXSNOTATION.cast = function(vValue) { + throw new cException("XPST0017" + , "Abstract type used in constructor function xs:NOTATION" + ); }; + +fStaticContext_defineSystemDataType("NOTATION", cXSNOTATION); + + + +function cXSQName(sPrefix, sLocalName, sNameSpaceURI) { + this.prefix = sPrefix; + this.localName = sLocalName; + this.namespaceURI = sNameSpaceURI; +}; + +cXSQName.prototype = new cXSAnyAtomicType; +cXSQName.prototype.builtInKind = cXSConstants.QNAME_DT; +cXSQName.prototype.primitiveKind = cXSAnySimpleType.PRIMITIVE_QNAME; + +cXSQName.prototype.prefix = null; +cXSQName.prototype.localName = null; +cXSQName.prototype.namespaceURI = null; + +cXSQName.prototype.toString = function() { + return (this.prefix ? this.prefix + ':' : '') + this.localName; +}; + +var rXSQName = /^(?:(?![0-9-])([\w-]+)\:)?(?![0-9-])([\w-]+)$/; +cXSQName.cast = function(vValue) { + if (vValue instanceof cXSQName) + return vValue; + if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) { + var aMatch = fString_trim(vValue).match(rXSQName); + if (aMatch) + return new cXSQName(aMatch[1] || null, aMatch[2], null); + throw new cException("FORG0001"); + } + throw new cException("XPTY0004" + , "Casting value '" + vValue + "' to xs:QName can never succeed" + ); +}; + +fStaticContext_defineSystemDataType("QName", cXSQName); + + +function cXSString(sValue) { + this.value = sValue; +}; + +cXSString.prototype = new cXSAnyAtomicType; + +cXSString.prototype.value = null; +cXSString.prototype.builtInKind = cXSConstants.STRING_DT; +cXSString.prototype.primitiveKind = cXSAnySimpleType.PRIMITIVE_STRING; + +cXSString.prototype.valueOf = function() { + return this.value; +}; + +cXSString.prototype.toString = function() { + return this.value; +}; + +cXSString.cast = function(vValue) { + return new cXSString(cString(vValue)); + throw new cException("XPTY0004" + , "Casting value '" + vValue + "' to xs:string can never succeed" + ); +}; + +fStaticContext_defineSystemDataType("string", cXSString); + + +function cXSTime(nHours, nMinutes, nSeconds, nTimezone) { + this.hours = nHours; + this.minutes = nMinutes; + this.seconds = nSeconds; + this.timezone = nTimezone; +}; + +cXSTime.prototype = new cXSAnyAtomicType; +cXSTime.prototype.builtInKind = cXSConstants.TIME_DT; +cXSTime.prototype.primitiveKind = cXSAnySimpleType.PRIMITIVE_TIME; + +cXSTime.prototype.hours = null; +cXSTime.prototype.minutes = null; +cXSTime.prototype.seconds = null; +cXSTime.prototype.timezone = null; + +cXSTime.prototype.toString = function() { + return fXSDateTime_getTimeComponent(this) + + fXSDateTime_getTZComponent(this); +}; + +var rXSTime = /^(([01]\d|2[0-3]):([0-5]\d):([0-5]\d)(?:\.(\d+))?|(24:00:00)(?:\.(0+))?)(Z|([+\-])(0\d|1[0-4]):([0-5]\d))?$/; +cXSTime.cast = function(vValue) { + if (vValue instanceof cXSTime) + return vValue; + if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) { + var aMatch = fString_trim(vValue).match(rXSTime); + if (aMatch) { + var bValue = !!aMatch[6]; + return new cXSTime(bValue ? 0 : +aMatch[2], + bValue ? 0 : +aMatch[3], + cNumber((bValue ? 0 : aMatch[4]) + '.' + (bValue ? 0 : aMatch[5] || 0)), + aMatch[8] ? aMatch[8] == 'Z' ? 0 : (aMatch[9] == '-' ? -1 : 1) * (aMatch[10] * 60 + aMatch[11] * 1) : null + ); + } + throw new cException("FORG0001"); + } + if (vValue instanceof cXSDateTime) + return new cXSTime(vValue.hours, vValue.minutes, vValue.seconds, vValue.timezone); + throw new cException("XPTY0004" + , "Casting value '" + vValue + "' to xs:time can never succeed" + ); +}; + +function fXSTime_normalize(oValue) { + if (oValue.seconds >= 60 || oValue.seconds < 0) { + oValue.minutes += ~~(oValue.seconds / 60) - (oValue.seconds < 0 && oValue.seconds % 60 ? 1 : 0); + oValue.seconds = oValue.seconds % 60 + (oValue.seconds < 0 && oValue.seconds % 60 ? 60 : 0); + } + if (oValue.minutes >= 60 || oValue.minutes < 0) { + oValue.hours += ~~(oValue.minutes / 60) - (oValue.minutes < 0 && oValue.minutes % 60 ? 1 : 0); + oValue.minutes = oValue.minutes % 60 + (oValue.minutes < 0 && oValue.minutes % 60 ? 60 : 0); + } + if (oValue.hours >= 24 || oValue.hours < 0) { + if (oValue instanceof cXSDateTime) + oValue.day += ~~(oValue.hours / 24) - (oValue.hours < 0 && oValue.hours % 24 ? 1 : 0); + oValue.hours = oValue.hours % 24 + (oValue.hours < 0 && oValue.hours % 24 ? 24 : 0); + } + return oValue; +}; + +fStaticContext_defineSystemDataType("time", cXSTime); + + +function cXSUntypedAtomic(sValue) { + this.value = sValue; +}; + +cXSUntypedAtomic.prototype = new cXSAnyAtomicType; +cXSUntypedAtomic.prototype.builtInKind = cXSConstants.XT_UNTYPEDATOMIC_DT; + +cXSUntypedAtomic.prototype.toString = function() { + return cString(this.value); +}; + +cXSUntypedAtomic.cast = function(vValue) { + if (vValue instanceof cXSUntypedAtomic) + return vValue; + + return new cXSUntypedAtomic(cString(vValue)); + throw new cException("XPTY0004" + , "Casting value '" + vValue + "' to xs:untypedAtomic can never succeed" + ); +}; + +fStaticContext_defineSystemDataType("untypedAtomic", cXSUntypedAtomic); + + +function cXSYearMonthDuration(nYear, nMonth, bNegative) { + cXSDuration.call(this, nYear, nMonth, 0, 0, 0, 0, bNegative); +}; + +cXSYearMonthDuration.prototype = new cXSDuration; +cXSYearMonthDuration.prototype.builtInKind = cXSConstants.XT_YEARMONTHDURATION_DT; + +cXSYearMonthDuration.prototype.toString = function() { + return (this.negative ? '-' : '') + 'P' + + (fXSDuration_getYearMonthComponent(this) || '0M'); +}; + +var rXSYearMonthDuration = /^(-)?P(?:([0-9]+)Y)?(?:([0-9]+)M)?$/; +cXSYearMonthDuration.cast = function(vValue) { + if (vValue instanceof cXSYearMonthDuration) + return vValue; + if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) { + var aMatch = fString_trim(vValue).match(rXSYearMonthDuration); + if (aMatch) + return fXSYearMonthDuration_normalize(new cXSYearMonthDuration(+aMatch[2] || 0, +aMatch[3] || 0, aMatch[1] == '-')); + throw new cException("FORG0001"); + } + if (vValue instanceof cXSDayTimeDuration) + return new cXSYearMonthDuration(0, 0); + if (vValue instanceof cXSDuration) + return new cXSYearMonthDuration(vValue.year, vValue.month, vValue.negative); + throw new cException("XPTY0004" + , "Casting value '" + vValue + "' to xs:yearMonthDuration can never succeed" + ); +}; + +function fXSYearMonthDuration_normalize(oDuration) { + if (oDuration.month >= 12) { + oDuration.year += ~~(oDuration.month / 12); + oDuration.month %= 12; + } + return oDuration; +}; + +fStaticContext_defineSystemDataType("yearMonthDuration", cXSYearMonthDuration); + + +function cXSDayTimeDuration(nDay, nHours, nMinutes, nSeconds, bNegative) { + cXSDuration.call(this, 0, 0, nDay, nHours, nMinutes, nSeconds, bNegative); +}; + +cXSDayTimeDuration.prototype = new cXSDuration; +cXSDayTimeDuration.prototype.builtInKind = cXSConstants.DAYTIMEDURATION_DT; + +cXSDayTimeDuration.prototype.toString = function() { + return (this.negative ? '-' : '') + 'P' + + (fXSDuration_getDayTimeComponent(this) || 'T0S'); +}; + +var rXSDayTimeDuration = /^(-)?P(?:([0-9]+)D)?(?:T(?:([0-9]+)H)?(?:([0-9]+)M)?(?:((?:(?:[0-9]+(?:.[0-9]*)?)|(?:.[0-9]+)))S)?)?$/; +cXSDayTimeDuration.cast = function(vValue) { + if (vValue instanceof cXSDayTimeDuration) + return vValue; + if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) { + var aMatch = fString_trim(vValue).match(rXSDayTimeDuration); + if (aMatch) + return fXSDayTimeDuration_normalize(new cXSDayTimeDuration(+aMatch[2] || 0, +aMatch[3] || 0, +aMatch[4] || 0, +aMatch[5] || 0, aMatch[1] == '-')); + throw new cException("FORG0001"); + } + if (vValue instanceof cXSYearMonthDuration) + return new cXSDayTimeDuration(0, 0, 0, 0); + if (vValue instanceof cXSDuration) + return new cXSDayTimeDuration(vValue.day, vValue.hours, vValue.minutes, vValue.seconds, vValue.negative); + throw new cException("XPTY0004" + , "Casting value '" + vValue + "' to xs:dayTimeDuration can never succeed" + ); +}; + +function fXSDayTimeDuration_normalize(oDuration) { + if (oDuration.seconds >= 60) { + oDuration.minutes += ~~(oDuration.seconds / 60); + oDuration.seconds %= 60; + } + if (oDuration.minutes >= 60) { + oDuration.hours += ~~(oDuration.minutes / 60); + oDuration.minutes %= 60; + } + if (oDuration.hours >= 24) { + oDuration.day += ~~(oDuration.hours / 24); + oDuration.hours %= 24; + } + return oDuration; +}; + +fStaticContext_defineSystemDataType("dayTimeDuration", cXSDayTimeDuration); + + +function cXSInteger(nValue) { + this.value = nValue; +}; + +cXSInteger.prototype = new cXSDecimal; +cXSInteger.prototype.builtInKind = cXSConstants.INTEGER_DT; + +var rXSInteger = /^[-+]?[0-9]+$/; +cXSInteger.cast = function(vValue) { + if (vValue instanceof cXSInteger) + return vValue; + if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) { + var aMatch = fString_trim(vValue).match(rXSInteger); + if (aMatch) + return new cXSInteger(~~vValue); + throw new cException("FORG0001"); + } + if (vValue instanceof cXSBoolean) + return new cXSInteger(vValue * 1); + if (fXSAnyAtomicType_isNumeric(vValue)) { + if (fIsNaN(vValue) || !fIsFinite(vValue)) + throw new cException("FOCA0002" + , "Cannot convert '" + vValue + "' to xs:integer" + ); + return new cXSInteger(~~vValue); + } + throw new cException("XPTY0004" + , "Casting value '" + vValue + "' to xs:integer can never succeed" + ); +}; + +fStaticContext_defineSystemDataType("integer", cXSInteger); + + +function cXSNonPositiveInteger(nValue) { + this.value = nValue; +}; + +cXSNonPositiveInteger.prototype = new cXSInteger; +cXSNonPositiveInteger.prototype.builtInKind = cXSConstants.NONPOSITIVEINTEGER_DT; + +cXSNonPositiveInteger.cast = function(vValue) { + return new cXSNonPositiveInteger(cNumber(vValue)); +}; + +fStaticContext_defineSystemDataType("nonPositiveInteger", cXSNonPositiveInteger); + + +function cXSNegativeInteger(nValue) { + this.value = nValue; +}; + +cXSNegativeInteger.prototype = new cXSNonPositiveInteger; +cXSNegativeInteger.prototype.builtInKind = cXSConstants.NEGATIVEINTEGER_DT; + +cXSNegativeInteger.cast = function(vValue) { + return new cXSNegativeInteger(cNumber(vValue)); +}; + +fStaticContext_defineSystemDataType("negativeInteger", cXSNegativeInteger); + + +function cXSLong(nValue) { + this.value = nValue; +}; + +cXSLong.prototype = new cXSInteger; +cXSLong.prototype.builtInKind = cXSConstants.LONG_DT; + +cXSLong.cast = function(vValue) { + return new cXSLong(cNumber(vValue)); +}; + +fStaticContext_defineSystemDataType("long", cXSLong); + + +function cXSInt(nValue) { + this.value = nValue; +}; + +cXSInt.prototype = new cXSLong; +cXSInt.prototype.builtInKind = cXSConstants.INT_DT; + +cXSInt.cast = function(vValue) { + return new cXSInt(cNumber(vValue)); +}; + +fStaticContext_defineSystemDataType("int", cXSInt); + + +function cXSShort(nValue) { + this.value = nValue; +}; + +cXSShort.prototype = new cXSInt; +cXSShort.prototype.builtInKind = cXSConstants.SHORT_DT; + +cXSShort.cast = function(vValue) { + return new cXSShort(cNumber(vValue)); +}; + +fStaticContext_defineSystemDataType("short", cXSShort); + + +function cXSByte(nValue) { + this.value = nValue; +}; + +cXSByte.prototype = new cXSShort; +cXSByte.prototype.builtInKind = cXSConstants.BYTE_DT; + +cXSByte.cast = function(vValue) { + return new cXSByte(cNumber(vValue)); +}; + +fStaticContext_defineSystemDataType("byte", cXSByte); + + +function cXSNonNegativeInteger(nValue) { + this.value = nValue; +}; + +cXSNonNegativeInteger.prototype = new cXSInteger; +cXSNonNegativeInteger.prototype.builtInKind = cXSConstants.NONNEGATIVEINTEGER_DT; + +cXSNonNegativeInteger.cast = function(vValue) { + return new cXSNonNegativeInteger(cNumber(vValue)); +}; + +fStaticContext_defineSystemDataType("nonNegativeInteger", cXSNonNegativeInteger); + + +function cXSPositiveInteger(nValue) { + this.value = nValue; +}; + +cXSPositiveInteger.prototype = new cXSNonNegativeInteger; +cXSPositiveInteger.prototype.builtInKind = cXSConstants.POSITIVEINTEGER_DT; + +cXSPositiveInteger.cast = function(vValue) { + return new cXSPositiveInteger(cNumber(vValue)); +}; + +fStaticContext_defineSystemDataType("positiveInteger", cXSPositiveInteger); + + +function cXSUnsignedLong(nValue) { + this.value = nValue; +}; + +cXSUnsignedLong.prototype = new cXSNonNegativeInteger; +cXSUnsignedLong.prototype.builtInKind = cXSConstants.UNSIGNEDLONG_DT; + +cXSUnsignedLong.cast = function(vValue) { + return new cXSUnsignedLong(cNumber(vValue)); +}; + +fStaticContext_defineSystemDataType("unsignedLong", cXSUnsignedLong); + + +function cXSUnsignedInt(nValue) { + this.value = nValue; +}; + +cXSUnsignedInt.prototype = new cXSNonNegativeInteger; +cXSUnsignedInt.prototype.builtInKind = cXSConstants.UNSIGNEDINT_DT; + +cXSUnsignedInt.cast = function(vValue) { + return new cXSUnsignedInt(cNumber(vValue)); +}; + +fStaticContext_defineSystemDataType("unsignedInt", cXSUnsignedInt); + + +function cXSUnsignedShort(nValue) { + this.value = nValue; +}; + +cXSUnsignedShort.prototype = new cXSUnsignedInt; +cXSUnsignedShort.prototype.builtInKind = cXSConstants.UNSIGNEDSHORT_DT; + +cXSUnsignedShort.cast = function(vValue) { + return new cXSUnsignedShort(cNumber(vValue)); +}; + +fStaticContext_defineSystemDataType("unsignedShort", cXSUnsignedShort); + + +function cXSUnsignedByte(nValue) { + this.value = nValue; +}; + +cXSUnsignedByte.prototype = new cXSUnsignedShort; +cXSUnsignedByte.prototype.builtInKind = cXSConstants.UNSIGNEDBYTE_DT; + +cXSUnsignedByte.cast = function(vValue) { + return new cXSUnsignedByte(cNumber(vValue)); +}; + +fStaticContext_defineSystemDataType("unsignedByte", cXSUnsignedByte); + + +function cXSNormalizedString(sValue) { + this.value = sValue; +}; + +cXSNormalizedString.prototype = new cXSString; +cXSNormalizedString.prototype.builtInKind = cXSConstants.NORMALIZEDSTRING_DT; + +cXSNormalizedString.cast = function(vValue) { + return new cXSNormalizedString(cString(vValue)); +}; + +fStaticContext_defineSystemDataType("normalizedString", cXSNormalizedString); + + +function cXSToken(sValue) { + this.value = sValue; +}; + +cXSToken.prototype = new cXSNormalizedString; +cXSToken.prototype.builtInKind = cXSConstants.TOKEN_DT; + +cXSToken.cast = function(vValue) { + return new cXSToken(cString(vValue)); +}; + +fStaticContext_defineSystemDataType("token", cXSToken); + + +function cXSName(sValue) { + this.value = sValue; +}; + +cXSName.prototype = new cXSToken; +cXSName.prototype.builtInKind = cXSConstants.NAME_DT; + +cXSName.cast = function(vValue) { + return new cXSName(cString(vValue)); +}; + +fStaticContext_defineSystemDataType("Name", cXSName); + + +function cXSNCName(sValue) { + this.value = sValue; +}; + +cXSNCName.prototype = new cXSName; +cXSNCName.prototype.builtInKind = cXSConstants.NCNAME_DT; + +cXSNCName.cast = function(vValue) { + return new cXSNCName(cString(vValue)); +}; + +fStaticContext_defineSystemDataType("NCName", cXSNCName); + + +function cXSENTITY(sValue) { + this.value = sValue; +}; + +cXSENTITY.prototype = new cXSNCName; +cXSENTITY.prototype.builtInKind = cXSConstants.ENTITY_DT; + +cXSENTITY.cast = function(vValue) { + return new cXSENTITY(cString(vValue)); +}; + +fStaticContext_defineSystemDataType("ENTITY", cXSENTITY); + + +function cXSID(sValue) { + this.value = sValue; +}; + +cXSID.prototype = new cXSNCName; +cXSID.prototype.builtInKind = cXSConstants.ID_DT; + +cXSID.cast = function(vValue) { + return new cXSID(cString(vValue)); +}; + +fStaticContext_defineSystemDataType("ID", cXSID); + + +function cXSLanguage(sValue) { + this.value = sValue; +}; + +cXSLanguage.prototype = new cXSToken; +cXSLanguage.prototype.builtInKind = cXSConstants.LANGUAGE_DT; + +cXSLanguage.cast = function(vValue) { + return new cXSLanguage(cString(vValue)); +}; + +fStaticContext_defineSystemDataType("language", cXSLanguage); + + +function cXSNMTOKEN(sValue) { + this.value = sValue; +}; + +cXSNMTOKEN.prototype = new cXSToken; +cXSNMTOKEN.prototype.builtInKind = cXSConstants.NMTOKEN_DT; + +cXSNMTOKEN.cast = function(vValue) { + return new cXSNMTOKEN(cString(vValue)); +}; + +fStaticContext_defineSystemDataType("NMTOKEN", cXSNMTOKEN); + + +function cXTItem() { + +}; + + +function cXTNode() { + +}; + +cXTNode.prototype = new cXTItem; + + + +function cXTAttribute() { + +}; + +cXTAttribute.prototype = new cXTNode; + + +function cXTComment() { + +}; + +cXTComment.prototype = new cXTNode; + + +function cXTDocument() { + +}; + +cXTDocument.prototype = new cXTNode; + + +function cXTElement() { + +}; + +cXTElement.prototype = new cXTNode; + + +function cXTProcessingInstruction() { + +}; + +cXTProcessingInstruction.prototype = new cXTNode; + + +function cXTText() { + +}; + +cXTText.prototype = new cXTNode; + + + +hStaticContext_operators["hexBinary-equal"] = function(oLeft, oRight) { + return new cXSBoolean(oLeft.valueOf() == oRight.valueOf()); +}; + +hStaticContext_operators["base64Binary-equal"] = function(oLeft, oRight) { + return new cXSBoolean(oLeft.valueOf() == oRight.valueOf()); +}; + + + + +hStaticContext_operators["boolean-equal"] = function(oLeft, oRight) { + return new cXSBoolean(oLeft.valueOf() == oRight.valueOf()); +}; + +hStaticContext_operators["boolean-less-than"] = function(oLeft, oRight) { + return new cXSBoolean(oLeft.valueOf() < oRight.valueOf()); +}; + +hStaticContext_operators["boolean-greater-than"] = function(oLeft, oRight) { + return new cXSBoolean(oLeft.valueOf() > oRight.valueOf()); +}; + + + + +hStaticContext_operators["yearMonthDuration-less-than"] = function(oLeft, oRight) { + return new cXSBoolean(fOperator_yearMonthDuration_toMonths(oLeft) < fOperator_yearMonthDuration_toMonths(oRight)); +}; + +hStaticContext_operators["yearMonthDuration-greater-than"] = function(oLeft, oRight) { + return new cXSBoolean(fOperator_yearMonthDuration_toMonths(oLeft) > fOperator_yearMonthDuration_toMonths(oRight)); +}; + +hStaticContext_operators["dayTimeDuration-less-than"] = function(oLeft, oRight) { + return new cXSBoolean(fOperator_dayTimeDuration_toSeconds(oLeft) < fOperator_dayTimeDuration_toSeconds(oRight)); +}; + +hStaticContext_operators["dayTimeDuration-greater-than"] = function(oLeft, oRight) { + return new cXSBoolean(fOperator_dayTimeDuration_toSeconds(oLeft) > fOperator_dayTimeDuration_toSeconds(oRight)); +}; + +hStaticContext_operators["duration-equal"] = function(oLeft, oRight) { + return new cXSBoolean(oLeft.negative == oRight.negative + && fOperator_yearMonthDuration_toMonths(oLeft) == fOperator_yearMonthDuration_toMonths(oRight) + && fOperator_dayTimeDuration_toSeconds(oLeft) == fOperator_dayTimeDuration_toSeconds(oRight)); +}; + +hStaticContext_operators["dateTime-equal"] = function(oLeft, oRight) { + return fOperator_compareDateTimes(oLeft, oRight, 'eq'); +}; + +hStaticContext_operators["dateTime-less-than"] = function(oLeft, oRight) { + return fOperator_compareDateTimes(oLeft, oRight, 'lt'); +}; + +hStaticContext_operators["dateTime-greater-than"] = function(oLeft, oRight) { + return fOperator_compareDateTimes(oLeft, oRight, 'gt'); +}; + +hStaticContext_operators["date-equal"] = function(oLeft, oRight) { + return fOperator_compareDates(oLeft, oRight, 'eq'); +}; + +hStaticContext_operators["date-less-than"] = function(oLeft, oRight) { + return fOperator_compareDates(oLeft, oRight, 'lt'); +}; + +hStaticContext_operators["date-greater-than"] = function(oLeft, oRight) { + return fOperator_compareDates(oLeft, oRight, 'gt'); +}; + +hStaticContext_operators["time-equal"] = function(oLeft, oRight) { + return fOperator_compareTimes(oLeft, oRight, 'eq'); +}; + +hStaticContext_operators["time-less-than"] = function(oLeft, oRight) { + return fOperator_compareTimes(oLeft, oRight, 'lt'); +}; + +hStaticContext_operators["time-greater-than"] = function(oLeft, oRight) { + return fOperator_compareTimes(oLeft, oRight, 'gt'); +}; + +hStaticContext_operators["gYearMonth-equal"] = function(oLeft, oRight) { + return fOperator_compareDateTimes( + new cXSDateTime(oLeft.year, oLeft.month, fXSDate_getDaysForYearMonth(oLeft.year, oLeft.month), 0, 0, 0, oLeft.timezone == null ? this.timezone : oLeft.timezone), + new cXSDateTime(oRight.year, oRight.month, fXSDate_getDaysForYearMonth(oRight.year, oRight.month), 0, 0, 0, oRight.timezone == null ? this.timezone : oRight.timezone), + 'eq' + ); +}; + +hStaticContext_operators["gYear-equal"] = function(oLeft, oRight) { + return fOperator_compareDateTimes( + new cXSDateTime(oLeft.year, 1, 1, 0, 0, 0, oLeft.timezone == null ? this.timezone : oLeft.timezone), + new cXSDateTime(oRight.year, 1, 1, 0, 0, 0, oRight.timezone == null ? this.timezone : oRight.timezone), + 'eq' + ); +}; + +hStaticContext_operators["gMonthDay-equal"] = function(oLeft, oRight) { + return fOperator_compareDateTimes( + new cXSDateTime(1972, oLeft.month, oLeft.day, 0, 0, 0, oLeft.timezone == null ? this.timezone : oLeft.timezone), + new cXSDateTime(1972, oRight.month, oRight.day, 0, 0, 0, oRight.timezone == null ? this.timezone : oRight.timezone), + 'eq' + ); +}; + +hStaticContext_operators["gMonth-equal"] = function(oLeft, oRight) { + return fOperator_compareDateTimes( + new cXSDateTime(1972, oLeft.month, fXSDate_getDaysForYearMonth(1972, oRight.month), 0, 0, 0, oLeft.timezone == null ? this.timezone : oLeft.timezone), + new cXSDateTime(1972, oRight.month, fXSDate_getDaysForYearMonth(1972, oRight.month), 0, 0, 0, oRight.timezone == null ? this.timezone : oRight.timezone), + 'eq' + ); +}; + +hStaticContext_operators["gDay-equal"] = function(oLeft, oRight) { + return fOperator_compareDateTimes( + new cXSDateTime(1972, 12, oLeft.day, 0, 0, 0, oLeft.timezone == null ? this.timezone : oLeft.timezone), + new cXSDateTime(1972, 12, oRight.day, 0, 0, 0, oRight.timezone == null ? this.timezone : oRight.timezone), + 'eq' + ); +}; + +hStaticContext_operators["add-yearMonthDurations"] = function(oLeft, oRight) { + return fOperator_yearMonthDuration_fromMonths(fOperator_yearMonthDuration_toMonths(oLeft) + fOperator_yearMonthDuration_toMonths(oRight)); +}; + +hStaticContext_operators["subtract-yearMonthDurations"] = function(oLeft, oRight) { + return fOperator_yearMonthDuration_fromMonths(fOperator_yearMonthDuration_toMonths(oLeft) - fOperator_yearMonthDuration_toMonths(oRight)); +}; + +hStaticContext_operators["multiply-yearMonthDuration"] = function(oLeft, oRight) { + return fOperator_yearMonthDuration_fromMonths(fOperator_yearMonthDuration_toMonths(oLeft) * oRight); +}; + +hStaticContext_operators["divide-yearMonthDuration"] = function(oLeft, oRight) { + return fOperator_yearMonthDuration_fromMonths(fOperator_yearMonthDuration_toMonths(oLeft) / oRight); +}; + +hStaticContext_operators["divide-yearMonthDuration-by-yearMonthDuration"] = function(oLeft, oRight) { + return new cXSDecimal(fOperator_yearMonthDuration_toMonths(oLeft) / fOperator_yearMonthDuration_toMonths(oRight)); +}; + +hStaticContext_operators["add-dayTimeDurations"] = function(oLeft, oRight) { + return fOperator_dayTimeDuration_fromSeconds(fOperator_dayTimeDuration_toSeconds(oLeft) + fOperator_dayTimeDuration_toSeconds(oRight)); +}; + +hStaticContext_operators["subtract-dayTimeDurations"] = function(oLeft, oRight) { + return fOperator_dayTimeDuration_fromSeconds(fOperator_dayTimeDuration_toSeconds(oLeft) - fOperator_dayTimeDuration_toSeconds(oRight)); +}; + +hStaticContext_operators["multiply-dayTimeDuration"] = function(oLeft, oRight) { + return fOperator_dayTimeDuration_fromSeconds(fOperator_dayTimeDuration_toSeconds(oLeft) * oRight); +}; + +hStaticContext_operators["divide-dayTimeDuration"] = function(oLeft, oRight) { + return fOperator_dayTimeDuration_fromSeconds(fOperator_dayTimeDuration_toSeconds(oLeft) / oRight); +}; + +hStaticContext_operators["divide-dayTimeDuration-by-dayTimeDuration"] = function(oLeft, oRight) { + return new cXSDecimal(fOperator_dayTimeDuration_toSeconds(oLeft) / fOperator_dayTimeDuration_toSeconds(oRight)); +}; + +hStaticContext_operators["subtract-dateTimes"] = function(oLeft, oRight) { + return fOperator_dayTimeDuration_fromSeconds(fOperator_dateTime_toSeconds(oLeft) - fOperator_dateTime_toSeconds(oRight)); +}; + +hStaticContext_operators["subtract-dates"] = function(oLeft, oRight) { + return fOperator_dayTimeDuration_fromSeconds(fOperator_dateTime_toSeconds(oLeft) - fOperator_dateTime_toSeconds(oRight)); +}; + +hStaticContext_operators["subtract-times"] = function(oLeft, oRight) { + return fOperator_dayTimeDuration_fromSeconds(fOperator_time_toSeconds(oLeft) - fOperator_time_toSeconds(oRight)); +}; + +hStaticContext_operators["add-yearMonthDuration-to-dateTime"] = function(oLeft, oRight) { + return fOperator_addYearMonthDuration2DateTime(oLeft, oRight, '+'); +}; + +hStaticContext_operators["add-dayTimeDuration-to-dateTime"] = function(oLeft, oRight) { + return fOperator_addDayTimeDuration2DateTime(oLeft, oRight, '+'); +}; + +hStaticContext_operators["subtract-yearMonthDuration-from-dateTime"] = function(oLeft, oRight) { + return fOperator_addYearMonthDuration2DateTime(oLeft, oRight, '-'); +}; + +hStaticContext_operators["subtract-dayTimeDuration-from-dateTime"] = function(oLeft, oRight) { + return fOperator_addDayTimeDuration2DateTime(oLeft, oRight, '-'); +}; + +hStaticContext_operators["add-yearMonthDuration-to-date"] = function(oLeft, oRight) { + return fOperator_addYearMonthDuration2DateTime(oLeft, oRight, '+'); +}; + +hStaticContext_operators["add-dayTimeDuration-to-date"] = function(oLeft, oRight) { + return fOperator_addDayTimeDuration2DateTime(oLeft, oRight, '+'); +}; + +hStaticContext_operators["subtract-yearMonthDuration-from-date"] = function(oLeft, oRight) { + return fOperator_addYearMonthDuration2DateTime(oLeft, oRight, '-'); +}; + +hStaticContext_operators["subtract-dayTimeDuration-from-date"] = function(oLeft, oRight) { + return fOperator_addDayTimeDuration2DateTime(oLeft, oRight, '-'); +}; + +hStaticContext_operators["add-dayTimeDuration-to-time"] = function(oLeft, oRight) { + var oValue = new cXSTime(oLeft.hours, oLeft.minutes, oLeft.seconds, oLeft.timezone); + oValue.hours += oRight.hours; + oValue.minutes += oRight.minutes; + oValue.seconds += oRight.seconds; + return fXSTime_normalize(oValue); +}; + +hStaticContext_operators["subtract-dayTimeDuration-from-time"] = function(oLeft, oRight) { + var oValue = new cXSTime(oLeft.hours, oLeft.minutes, oLeft.seconds, oLeft.timezone); + oValue.hours -= oRight.hours; + oValue.minutes -= oRight.minutes; + oValue.seconds -= oRight.seconds; + return fXSTime_normalize(oValue); +}; + +function fOperator_compareTimes(oLeft, oRight, sComparator) { + var nLeft = fOperator_time_toSeconds(oLeft), + nRight = fOperator_time_toSeconds(oRight); + return new cXSBoolean(sComparator == 'lt' ? nLeft < nRight : sComparator == 'gt' ? nLeft > nRight : nLeft == nRight); +}; + +function fOperator_compareDates(oLeft, oRight, sComparator) { + return fOperator_compareDateTimes(cXSDateTime.cast(oLeft), cXSDateTime.cast(oRight), sComparator); +}; + +function fOperator_compareDateTimes(oLeft, oRight, sComparator) { + var oTimezone = new cXSDayTimeDuration(0, 0, 0, 0), + sLeft = fFunction_dateTime_adjustTimezone(oLeft, oTimezone).toString(), + sRight = fFunction_dateTime_adjustTimezone(oRight, oTimezone).toString(); + return new cXSBoolean(sComparator == 'lt' ? sLeft < sRight : sComparator == 'gt' ? sLeft > sRight : sLeft == sRight); +}; + +function fOperator_addYearMonthDuration2DateTime(oLeft, oRight, sOperator) { + var oValue; + if (oLeft instanceof cXSDate) + oValue = new cXSDate(oLeft.year, oLeft.month, oLeft.day, oLeft.timezone, oLeft.negative); + else + if (oLeft instanceof cXSDateTime) + oValue = new cXSDateTime(oLeft.year, oLeft.month, oLeft.day, oLeft.hours, oLeft.minutes, oLeft.seconds, oLeft.timezone, oLeft.negative); + oValue.year = oValue.year + oRight.year * (sOperator == '-' ?-1 : 1); + oValue.month = oValue.month + oRight.month * (sOperator == '-' ?-1 : 1); + fXSDate_normalize(oValue, true); + var nDay = fXSDate_getDaysForYearMonth(oValue.year, oValue.month); + if (oValue.day > nDay) + oValue.day = nDay; + return oValue; +}; + +function fOperator_addDayTimeDuration2DateTime(oLeft, oRight, sOperator) { + var oValue; + if (oLeft instanceof cXSDate) { + var nValue = (oRight.hours * 60 + oRight.minutes) * 60 + oRight.seconds; + oValue = new cXSDate(oLeft.year, oLeft.month, oLeft.day, oLeft.timezone, oLeft.negative); + oValue.day = oValue.day + oRight.day * (sOperator == '-' ?-1 : 1) - 1 * (nValue && sOperator == '-'); + fXSDate_normalize(oValue); + } + else + if (oLeft instanceof cXSDateTime) { + oValue = new cXSDateTime(oLeft.year, oLeft.month, oLeft.day, oLeft.hours, oLeft.minutes, oLeft.seconds, oLeft.timezone, oLeft.negative); + oValue.seconds = oValue.seconds + oRight.seconds * (sOperator == '-' ?-1 : 1); + oValue.minutes = oValue.minutes + oRight.minutes * (sOperator == '-' ?-1 : 1); + oValue.hours = oValue.hours + oRight.hours * (sOperator == '-' ?-1 : 1); + oValue.day = oValue.day + oRight.day * (sOperator == '-' ?-1 : 1); + fXSDateTime_normalize(oValue); + } + return oValue; +}; + +function fOperator_dayTimeDuration_toSeconds(oDuration) { + return (((oDuration.day * 24 + oDuration.hours) * 60 + oDuration.minutes) * 60 + oDuration.seconds) * (oDuration.negative ? -1 : 1); +}; + +function fOperator_dayTimeDuration_fromSeconds(nValue) { + var bNegative =(nValue = cMath.round(nValue)) < 0, + nDays = ~~((nValue = cMath.abs(nValue)) / 86400), + nHours = ~~((nValue -= nDays * 3600 * 24) / 3600), + nMinutes= ~~((nValue -= nHours * 3600) / 60), + nSeconds = nValue -= nMinutes * 60; + return new cXSDayTimeDuration(nDays, nHours, nMinutes, nSeconds, bNegative); +}; + +function fOperator_yearMonthDuration_toMonths(oDuration) { + return (oDuration.year * 12 + oDuration.month) * (oDuration.negative ? -1 : 1); +}; + +function fOperator_yearMonthDuration_fromMonths(nValue) { + var nNegative =(nValue = cMath.round(nValue)) < 0, + nYears = ~~((nValue = cMath.abs(nValue)) / 12), + nMonths = nValue -= nYears * 12; + return new cXSYearMonthDuration(nYears, nMonths, nNegative); +}; + +function fOperator_time_toSeconds(oTime) { + return oTime.seconds + (oTime.minutes - (oTime.timezone != null ? oTime.timezone % 60 : 0) + (oTime.hours - (oTime.timezone != null ? ~~(oTime.timezone / 60) : 0)) * 60) * 60; +}; + +function fOperator_dateTime_toSeconds(oValue) { + var oDate = new cDate((oValue.negative ? -1 : 1) * oValue.year, oValue.month, oValue.day, 0, 0, 0, 0); + if (oValue instanceof cXSDateTime) { + oDate.setHours(oValue.hours); + oDate.setMinutes(oValue.minutes); + oDate.setSeconds(oValue.seconds); + } + if (oValue.timezone != null) + oDate.setMinutes(oDate.getMinutes() - oValue.timezone); + return oDate.getTime() / 1000; +}; + + + + +hStaticContext_operators["is-same-node"] = function(oLeft, oRight) { + return new cXSBoolean(this.DOMAdapter.isSameNode(oLeft, oRight)); +}; + +hStaticContext_operators["node-before"] = function(oLeft, oRight) { + return new cXSBoolean(!!(this.DOMAdapter.compareDocumentPosition(oLeft, oRight) & 4)); +}; + +hStaticContext_operators["node-after"] = function(oLeft, oRight) { + return new cXSBoolean(!!(this.DOMAdapter.compareDocumentPosition(oLeft, oRight) & 2)); +}; + + + + + + + +function fFunctionCall_numeric_getPower(oLeft, oRight) { + if (fIsNaN(oLeft) || (cMath.abs(oLeft) == nInfinity) || fIsNaN(oRight) || (cMath.abs(oRight) == nInfinity)) + return 0; + var aLeft = cString(oLeft).match(rNumericLiteral), + aRight = cString(oRight).match(rNumericLiteral), + nPower = cMath.max(1, (aLeft[2] || aLeft[3] || '').length + (aLeft[5] || 0) * (aLeft[4] == '+' ?-1 : 1), (aRight[2] || aRight[3] || '').length + (aRight[5] || 0) * (aRight[4] == '+' ?-1 : 1)); + return nPower + (nPower % 2 ? 0 : 1); +}; + +hStaticContext_operators["numeric-add"] = function(oLeft, oRight) { + var nLeft = oLeft.valueOf(), + nRight = oRight.valueOf(), + nPower = cMath.pow(10, fFunctionCall_numeric_getPower(nLeft, nRight)); + return fOperator_numeric_getResultOfType(oLeft, oRight, ((nLeft * nPower) + (nRight * nPower))/nPower); +}; + +hStaticContext_operators["numeric-subtract"] = function(oLeft, oRight) { + var nLeft = oLeft.valueOf(), + nRight = oRight.valueOf(), + nPower = cMath.pow(10, fFunctionCall_numeric_getPower(nLeft, nRight)); + return fOperator_numeric_getResultOfType(oLeft, oRight, ((nLeft * nPower) - (nRight * nPower))/nPower); +}; + +hStaticContext_operators["numeric-multiply"] = function(oLeft, oRight) { + var nLeft = oLeft.valueOf(), + nRight = oRight.valueOf(), + nPower = cMath.pow(10, fFunctionCall_numeric_getPower(nLeft, nRight)); + return fOperator_numeric_getResultOfType(oLeft, oRight, ((nLeft * nPower) * (nRight * nPower))/(nPower * nPower)); +}; + +hStaticContext_operators["numeric-divide"] = function(oLeft, oRight) { + var nLeft = oLeft.valueOf(), + nRight = oRight.valueOf(), + nPower = cMath.pow(10, fFunctionCall_numeric_getPower(nLeft, nRight)); + return fOperator_numeric_getResultOfType(oLeft, oRight, (oLeft * nPower) / (oRight * nPower)); +}; + +hStaticContext_operators["numeric-integer-divide"] = function(oLeft, oRight) { + return new cXSInteger(~~(oLeft / oRight)); +}; + +hStaticContext_operators["numeric-mod"] = function(oLeft, oRight) { + var nLeft = oLeft.valueOf(), + nRight = oRight.valueOf(), + nPower = cMath.pow(10, fFunctionCall_numeric_getPower(nLeft, nRight)); + return fOperator_numeric_getResultOfType(oLeft, oRight, ((nLeft * nPower) % (nRight * nPower)) / nPower); +}; + +hStaticContext_operators["numeric-unary-plus"] = function(oRight) { + return oRight; +}; + +hStaticContext_operators["numeric-unary-minus"] = function(oRight) { + oRight.value *=-1; + return oRight; +}; + + +hStaticContext_operators["numeric-equal"] = function(oLeft, oRight) { + return new cXSBoolean(oLeft.valueOf() == oRight.valueOf()); +}; + +hStaticContext_operators["numeric-less-than"] = function(oLeft, oRight) { + return new cXSBoolean(oLeft.valueOf() < oRight.valueOf()); +}; + +hStaticContext_operators["numeric-greater-than"] = function(oLeft, oRight) { + return new cXSBoolean(oLeft.valueOf() > oRight.valueOf()); +}; + +function fOperator_numeric_getResultOfType(oLeft, oRight, nResult) { + return new (oLeft instanceof cXSInteger && oRight instanceof cXSInteger && nResult == cMath.round(nResult) ? cXSInteger : cXSDecimal)(nResult); +}; + + + + +hStaticContext_operators["QName-equal"] = function(oLeft, oRight) { + return new cXSBoolean(oLeft.localName == oRight.localName && oLeft.namespaceURI == oRight.namespaceURI); +}; + + + + +hStaticContext_operators["concatenate"] = function(oSequence1, oSequence2) { + return oSequence1.concat(oSequence2); +}; + +hStaticContext_operators["union"] = function(oSequence1, oSequence2) { + var oSequence = []; + for (var nIndex = 0, nLength = oSequence1.length, oItem; nIndex < nLength; nIndex++) { + if (!this.DOMAdapter.isNode(oItem = oSequence1[nIndex])) + throw new cException("XPTY0004" + , "Required item type of first operand of 'union' is node()" + ); if (fArray_indexOf(oSequence, oItem) ==-1) + oSequence.push(oItem); + } + for (var nIndex = 0, nLength = oSequence2.length, oItem; nIndex < nLength; nIndex++) { + if (!this.DOMAdapter.isNode(oItem = oSequence2[nIndex])) + throw new cException("XPTY0004" + , "Required item type of second operand of 'union' is node()" + ); if (fArray_indexOf(oSequence, oItem) ==-1) + oSequence.push(oItem); + } + return fFunction_sequence_order(oSequence, this); +}; + +hStaticContext_operators["intersect"] = function(oSequence1, oSequence2) { + var oSequence = []; + for (var nIndex = 0, nLength = oSequence1.length, oItem, bFound; nIndex < nLength; nIndex++) { + if (!this.DOMAdapter.isNode(oItem = oSequence1[nIndex])) + throw new cException("XPTY0004" + , "Required item type of second operand of 'intersect' is node()" + ); bFound = false; + for (var nRightIndex = 0, nRightLength = oSequence2.length;(nRightIndex < nRightLength) && !bFound; nRightIndex++) { + if (!this.DOMAdapter.isNode(oSequence2[nRightIndex])) + throw new cException("XPTY0004" + , "Required item type of first operand of 'intersect' is node()" + ); + bFound = this.DOMAdapter.isSameNode(oSequence2[nRightIndex], oItem); + } + if (bFound && fArray_indexOf(oSequence, oItem) ==-1) + oSequence.push(oItem); + } + return fFunction_sequence_order(oSequence, this); +}; + +hStaticContext_operators["except"] = function(oSequence1, oSequence2) { + var oSequence = []; + for (var nIndex = 0, nLength = oSequence1.length, oItem, bFound; nIndex < nLength; nIndex++) { + if (!this.DOMAdapter.isNode(oItem = oSequence1[nIndex])) + throw new cException("XPTY0004" + , "Required item type of second operand of 'except' is node()" + ); bFound = false; + for (var nRightIndex = 0, nRightLength = oSequence2.length;(nRightIndex < nRightLength) && !bFound; nRightIndex++) { + if (!this.DOMAdapter.isNode(oSequence2[nRightIndex])) + throw new cException("XPTY0004" + , "Required item type of first operand of 'except' is node()" + ); + bFound = this.DOMAdapter.isSameNode(oSequence2[nRightIndex], oItem); + } + if (!bFound && fArray_indexOf(oSequence, oItem) ==-1) + oSequence.push(oItem); + } + return fFunction_sequence_order(oSequence, this); +}; + +hStaticContext_operators["to"] = function(oLeft, oRight) { + var oSequence = []; + for (var nIndex = oLeft.valueOf(), nLength = oRight.valueOf(); nIndex <= nLength; nIndex++) + oSequence.push(new cXSInteger(nIndex)); + return oSequence; +}; + + + + +fStaticContext_defineSystemFunction("node-name", [[cXTNode, '?']], function(oNode) { + if (oNode != null) { + var fGetProperty = this.DOMAdapter.getProperty; + switch (fGetProperty(oNode, "nodeType")) { + case 1: case 2: return new cXSQName(fGetProperty(oNode, "prefix"), fGetProperty(oNode, "localName"), fGetProperty(oNode, "namespaceURI")); + case 5: throw "Not implemented"; + case 6: throw "Not implemented"; + case 7: return new cXSQName(null, fGetProperty(oNode, "target"), null); + case 10: return new cXSQName(null, fGetProperty(oNode, "name"), null); + } + } + return null; +}); + +fStaticContext_defineSystemFunction("nilled", [[cXTNode, '?']], function(oNode) { + if (oNode != null) { + if (this.DOMAdapter.getProperty(oNode, "nodeType") == 1) + return new cXSBoolean(false); } + return null; +}); + +fStaticContext_defineSystemFunction("string", [[cXTItem, '?', true]], function(oItem) { + if (!arguments.length) { + if (!this.item) + throw new cException("XPDY0002"); + oItem = this.item; + } + return oItem == null ? new cXSString('') : cXSString.cast(fFunction_sequence_atomize([oItem], this)[0]); +}); + +fStaticContext_defineSystemFunction("data", [[cXTItem, '*']], function(oSequence1) { + return fFunction_sequence_atomize(oSequence1, this); +}); + +fStaticContext_defineSystemFunction("base-uri", [[cXTNode, '?', true]], function(oNode) { + if (!arguments.length) { + if (!this.DOMAdapter.isNode(this.item)) + throw new cException("XPTY0004" + , "base-uri() function called when the context item is not a node" + ); + oNode = this.item; + } + return cXSAnyURI.cast(new cXSString(this.DOMAdapter.getProperty(oNode, "baseURI") || '')); +}); + +fStaticContext_defineSystemFunction("document-uri", [[cXTNode, '?']], function(oNode) { + if (oNode != null) { + var fGetProperty = this.DOMAdapter.getProperty; + if (fGetProperty(oNode, "nodeType") == 9) + return cXSAnyURI.cast(new cXSString(fGetProperty(oNode, "documentURI") || '')); + } + return null; +}); + + + + +fStaticContext_defineSystemFunction("resolve-uri", [[cXSString, '?'], [cXSString, '', true]], function(sUri, sBaseUri) { + var sBaseUri; + if (arguments.length < 2) { + if (!this.DOMAdapter.isNode(this.item)) + throw new cException("XPTY0004" + , "resolve-uri() function called when the context item is not a node" + ); + sBaseUri = new cXSString(this.DOMAdapter.getProperty(this.item, "baseURI") || ''); + } + + if (sUri == null) + return null; + + if (sUri.valueOf() == '' || sUri.valueOf().charAt(0) == '#') + return cXSAnyURI.cast(sBaseUri); + + var oUri = cXSAnyURI.cast(sUri); + if (oUri.scheme) + return oUri; + + var oBaseUri = cXSAnyURI.cast(sBaseUri); + oUri.scheme = oBaseUri.scheme; + + if (!oUri.authority) { + oUri.authority = oBaseUri.authority; + + if (oUri.path.charAt(0) != '/') { + var aUriSegments = oUri.path.split('/'), + aBaseUriSegments = oBaseUri.path.split('/'); + aBaseUriSegments.pop(); + + var nBaseUriStart = aBaseUriSegments[0] == '' ? 1 : 0; + for (var nIndex = 0, nLength = aUriSegments.length; nIndex < nLength; nIndex++) { + if (aUriSegments[nIndex] == '..') { + if (aBaseUriSegments.length > nBaseUriStart) + aBaseUriSegments.pop(); + else { + aBaseUriSegments.push(aUriSegments[nIndex]); + nBaseUriStart++; + } + } + else + if (aUriSegments[nIndex] != '.') + aBaseUriSegments.push(aUriSegments[nIndex]); + } + if (aUriSegments[--nIndex] == '..' || aUriSegments[nIndex] == '.') + aBaseUriSegments.push(''); + oUri.path = aBaseUriSegments.join('/'); + } + } + + return oUri; +}); + + + + +fStaticContext_defineSystemFunction("true", [], function() { + return new cXSBoolean(true); +}); + +fStaticContext_defineSystemFunction("false", [], function() { + return new cXSBoolean(false); +}); + +fStaticContext_defineSystemFunction("not", [[cXTItem, '*']], function(oSequence1) { + return new cXSBoolean(!fFunction_sequence_toEBV(oSequence1, this)); +}); + + + +fStaticContext_defineSystemFunction("position", [], function() { + return new cXSInteger(this.position); +}); + +fStaticContext_defineSystemFunction("last", [], function() { + return new cXSInteger(this.size); +}); + +fStaticContext_defineSystemFunction("current-dateTime", [], function() { + return this.dateTime; +}); + +fStaticContext_defineSystemFunction("current-date", [], function() { + return cXSDate.cast(this.dateTime); +}); + +fStaticContext_defineSystemFunction("current-time", [], function() { + return cXSTime.cast(this.dateTime); +}); + +fStaticContext_defineSystemFunction("implicit-timezone", [], function() { + return this.timezone; +}); + +fStaticContext_defineSystemFunction("default-collation", [], function() { + return new cXSString(this.staticContext.defaultCollationName); +}); + +fStaticContext_defineSystemFunction("static-base-uri", [], function() { + return cXSAnyURI.cast(new cXSString(this.staticContext.baseURI || '')); +}); + + + + +fStaticContext_defineSystemFunction("years-from-duration", [[cXSDuration, '?']], function(oDuration) { + return fFunction_duration_getComponent(oDuration, "year"); +}); + +fStaticContext_defineSystemFunction("months-from-duration", [[cXSDuration, '?']], function(oDuration) { + return fFunction_duration_getComponent(oDuration, "month"); +}); + +fStaticContext_defineSystemFunction("days-from-duration", [[cXSDuration, '?']], function(oDuration) { + return fFunction_duration_getComponent(oDuration, "day"); +}); + +fStaticContext_defineSystemFunction("hours-from-duration", [[cXSDuration, '?']], function(oDuration) { + return fFunction_duration_getComponent(oDuration, "hours"); +}); + +fStaticContext_defineSystemFunction("minutes-from-duration", [[cXSDuration, '?']], function(oDuration) { + return fFunction_duration_getComponent(oDuration, "minutes"); +}); + +fStaticContext_defineSystemFunction("seconds-from-duration", [[cXSDuration, '?']], function(oDuration) { + return fFunction_duration_getComponent(oDuration, "seconds"); +}); + +fStaticContext_defineSystemFunction("year-from-dateTime", [[cXSDateTime, '?']], function(oDateTime) { + return fFunction_dateTime_getComponent(oDateTime, "year"); +}); + +fStaticContext_defineSystemFunction("month-from-dateTime", [[cXSDateTime, '?']], function(oDateTime) { + return fFunction_dateTime_getComponent(oDateTime, "month"); +}); + +fStaticContext_defineSystemFunction("day-from-dateTime", [[cXSDateTime, '?']], function(oDateTime) { + return fFunction_dateTime_getComponent(oDateTime, "day"); +}); + +fStaticContext_defineSystemFunction("hours-from-dateTime", [[cXSDateTime, '?']], function(oDateTime) { + return fFunction_dateTime_getComponent(oDateTime, "hours"); +}); + +fStaticContext_defineSystemFunction("minutes-from-dateTime", [[cXSDateTime, '?']], function(oDateTime) { + return fFunction_dateTime_getComponent(oDateTime, "minutes"); +}); + +fStaticContext_defineSystemFunction("seconds-from-dateTime", [[cXSDateTime, '?']], function(oDateTime) { + return fFunction_dateTime_getComponent(oDateTime, "seconds"); +}); + +fStaticContext_defineSystemFunction("timezone-from-dateTime", [[cXSDateTime, '?']], function(oDateTime) { + return fFunction_dateTime_getComponent(oDateTime, "timezone"); +}); + +fStaticContext_defineSystemFunction("year-from-date", [[cXSDate, '?']], function(oDate) { + return fFunction_dateTime_getComponent(oDate, "year"); +}); + +fStaticContext_defineSystemFunction("month-from-date", [[cXSDate, '?']], function(oDate) { + return fFunction_dateTime_getComponent(oDate, "month"); +}); + +fStaticContext_defineSystemFunction("day-from-date", [[cXSDate, '?']], function(oDate) { + return fFunction_dateTime_getComponent(oDate, "day"); +}); + +fStaticContext_defineSystemFunction("timezone-from-date", [[cXSDate, '?']], function(oDate) { + return fFunction_dateTime_getComponent(oDate, "timezone"); +}); + +fStaticContext_defineSystemFunction("hours-from-time", [[cXSTime, '?']], function(oTime) { + return fFunction_dateTime_getComponent(oTime, "hours"); +}); + +fStaticContext_defineSystemFunction("minutes-from-time", [[cXSTime, '?']], function(oTime) { + return fFunction_dateTime_getComponent(oTime, "minutes"); +}); + +fStaticContext_defineSystemFunction("seconds-from-time", [[cXSTime, '?']], function(oTime) { + return fFunction_dateTime_getComponent(oTime, "seconds"); +}); + +fStaticContext_defineSystemFunction("timezone-from-time", [[cXSTime, '?']], function(oTime) { + return fFunction_dateTime_getComponent(oTime, "timezone"); +}); + + +fStaticContext_defineSystemFunction("adjust-dateTime-to-timezone", [[cXSDateTime, '?'], [cXSDayTimeDuration, '?', true]], function(oDateTime, oDayTimeDuration) { + return fFunction_dateTime_adjustTimezone(oDateTime, arguments.length > 1 && oDayTimeDuration != null ? arguments.length > 1 ? oDayTimeDuration : this.timezone : null); +}); + +fStaticContext_defineSystemFunction("adjust-date-to-timezone", [[cXSDate, '?'], [cXSDayTimeDuration, '?', true]], function(oDate, oDayTimeDuration) { + return fFunction_dateTime_adjustTimezone(oDate, arguments.length > 1 && oDayTimeDuration != null ? arguments.length > 1 ? oDayTimeDuration : this.timezone : null); +}); + +fStaticContext_defineSystemFunction("adjust-time-to-timezone", [[cXSTime, '?'], [cXSDayTimeDuration, '?', true]], function(oTime, oDayTimeDuration) { + return fFunction_dateTime_adjustTimezone(oTime, arguments.length > 1 && oDayTimeDuration != null ? arguments.length > 1 ? oDayTimeDuration : this.timezone : null); +}); + +function fFunction_duration_getComponent(oDuration, sName) { + if (oDuration == null) + return null; + + var nValue = oDuration[sName] * (oDuration.negative ?-1 : 1); + return sName == "seconds" ? new cXSDecimal(nValue) : new cXSInteger(nValue); +}; + +function fFunction_dateTime_getComponent(oDateTime, sName) { + if (oDateTime == null) + return null; + + if (sName == "timezone") { + var nTimezone = oDateTime.timezone; + if (nTimezone == null) + return null; + return new cXSDayTimeDuration(0, cMath.abs(~~(nTimezone / 60)), cMath.abs(nTimezone % 60), 0, nTimezone < 0); + } + else { + var nValue = oDateTime[sName]; + if (!(oDateTime instanceof cXSDate)) { + if (sName == "hours") + if (nValue == 24) + nValue = 0; + } + if (!(oDateTime instanceof cXSTime)) + nValue *= oDateTime.negative ?-1 : 1; + return sName == "seconds" ? new cXSDecimal(nValue) : new cXSInteger(nValue); + } +}; + +function fFunction_dateTime_adjustTimezone(oDateTime, oTimezone) { + if (oDateTime == null) + return null; + + var oValue; + if (oDateTime instanceof cXSDate) + oValue = new cXSDate(oDateTime.year, oDateTime.month, oDateTime.day, oDateTime.timezone, oDateTime.negative); + else + if (oDateTime instanceof cXSTime) + oValue = new cXSTime(oDateTime.hours, oDateTime.minutes, oDateTime.seconds, oDateTime.timezone, oDateTime.negative); + else + oValue = new cXSDateTime(oDateTime.year, oDateTime.month, oDateTime.day, oDateTime.hours, oDateTime.minutes, oDateTime.seconds, oDateTime.timezone, oDateTime.negative); + + if (oTimezone == null) + oValue.timezone = null; + else { + var nTimezone = fOperator_dayTimeDuration_toSeconds(oTimezone) / 60; + if (oDateTime.timezone != null) { + var nDiff = nTimezone - oDateTime.timezone; + if (oDateTime instanceof cXSDate) { + if (nDiff < 0) + oValue.day--; + } + else { + oValue.minutes += nDiff % 60; + oValue.hours += ~~(nDiff / 60); + } + fXSDateTime_normalize(oValue); + } + oValue.timezone = nTimezone; + } + return oValue; +}; + + + + +fStaticContext_defineSystemFunction("name", [[cXTNode, '?', true]], function(oNode) { + if (!arguments.length) { + if (!this.DOMAdapter.isNode(this.item)) + throw new cException("XPTY0004" + , "name() function called when the context item is not a node" + ); + oNode = this.item; + } + else + if (oNode == null) + return new cXSString(''); + var vValue = hStaticContext_functions["node-name"].call(this, oNode); + return new cXSString(vValue == null ? '' : vValue.toString()); +}); + +fStaticContext_defineSystemFunction("local-name", [[cXTNode, '?', true]], function(oNode) { + if (!arguments.length) { + if (!this.DOMAdapter.isNode(this.item)) + throw new cException("XPTY0004" + , "local-name() function called when the context item is not a node" + ); + oNode = this.item; + } + else + if (oNode == null) + return new cXSString(''); + return new cXSString(this.DOMAdapter.getProperty(oNode, "localName") || ''); +}); + +fStaticContext_defineSystemFunction("namespace-uri", [[cXTNode, '?', true]], function(oNode) { + if (!arguments.length) { + if (!this.DOMAdapter.isNode(this.item)) + throw new cException("XPTY0004" + , "namespace-uri() function called when the context item is not a node" + ); + oNode = this.item; + } + else + if (oNode == null) + return cXSAnyURI.cast(new cXSString('')); + return cXSAnyURI.cast(new cXSString(this.DOMAdapter.getProperty(oNode, "namespaceURI") || '')); +}); + +fStaticContext_defineSystemFunction("number", [[cXSAnyAtomicType, '?', true]], function(oItem) { + if (!arguments.length) { + if (!this.item) + throw new cException("XPDY0002"); + oItem = fFunction_sequence_atomize([this.item], this)[0]; + } + + var vValue = new cXSDouble(nNaN); + if (oItem != null) { + try { + vValue = cXSDouble.cast(oItem); + } + catch (e) { + + } + } + return vValue; +}); + +fStaticContext_defineSystemFunction("lang", [[cXSString, '?'], [cXTNode, '', true]], function(sLang, oNode) { + if (arguments.length < 2) { + if (!this.DOMAdapter.isNode(this.item)) + throw new cException("XPTY0004" + , "lang() function called when the context item is not a node" + ); + oNode = this.item; + } + + var fGetProperty = this.DOMAdapter.getProperty; + if (fGetProperty(oNode, "nodeType") == 2) + oNode = fGetProperty(oNode, "ownerElement"); + + for (var aAttributes; oNode; oNode = fGetProperty(oNode, "parentNode")) + if (aAttributes = fGetProperty(oNode, "attributes")) + for (var nIndex = 0, nLength = aAttributes.length; nIndex < nLength; nIndex++) + if (fGetProperty(aAttributes[nIndex], "nodeName") == "xml:lang") + return new cXSBoolean(fGetProperty(aAttributes[nIndex], "value").replace(/-.+/, '').toLowerCase() == sLang.valueOf().replace(/-.+/, '').toLowerCase()); + return new cXSBoolean(false); +}); + +fStaticContext_defineSystemFunction("root", [[cXTNode, '?', true]], function(oNode) { + if (!arguments.length) { + if (!this.DOMAdapter.isNode(this.item)) + throw new cException("XPTY0004" + , "root() function called when the context item is not a node" + ); + oNode = this.item; + } + else + if (oNode == null) + return null; + + var fGetProperty = this.DOMAdapter.getProperty; + + if (fGetProperty(oNode, "nodeType") == 2) + oNode = fGetProperty(oNode, "ownerElement"); + + for (var oParent = oNode; oParent; oParent = fGetProperty(oNode, "parentNode")) + oNode = oParent; + + return oNode; +}); + + + + +fStaticContext_defineSystemFunction("abs", [[cXSDouble, '?']], function(oValue) { + return new cXSDecimal(cMath.abs(oValue)); +}); + +fStaticContext_defineSystemFunction("ceiling", [[cXSDouble, '?']], function(oValue) { + return new cXSDecimal(cMath.ceil(oValue)); +}); + +fStaticContext_defineSystemFunction("floor", [[cXSDouble, '?']], function(oValue) { + return new cXSDecimal(cMath.floor(oValue)); +}); + +fStaticContext_defineSystemFunction("round", [[cXSDouble, '?']], function(oValue) { + return new cXSDecimal(cMath.round(oValue)); +}); + +fStaticContext_defineSystemFunction("round-half-to-even", [[cXSDouble, '?'], [cXSInteger, '', true]], function(oValue, oPrecision) { + var nPrecision = arguments.length > 1 ? oPrecision.valueOf() : 0; + + if (nPrecision < 0) { + var oPower = new cXSInteger(cMath.pow(10,-nPrecision)), + nRounded= cMath.round(hStaticContext_operators["numeric-divide"].call(this, oValue, oPower)), + oRounded= new cXSInteger(nRounded); + nDecimal= cMath.abs(hStaticContext_operators["numeric-subtract"].call(this, oRounded, hStaticContext_operators["numeric-divide"].call(this, oValue, oPower))); + return hStaticContext_operators["numeric-multiply"].call(this, hStaticContext_operators["numeric-add"].call(this, oRounded, new cXSDecimal(nDecimal == 0.5 && nRounded % 2 ?-1 : 0)), oPower); + } + else { + var oPower = new cXSInteger(cMath.pow(10, nPrecision)), + nRounded= cMath.round(hStaticContext_operators["numeric-multiply"].call(this, oValue, oPower)), + oRounded= new cXSInteger(nRounded); + nDecimal= cMath.abs(hStaticContext_operators["numeric-subtract"].call(this, oRounded, hStaticContext_operators["numeric-multiply"].call(this, oValue, oPower))); + return hStaticContext_operators["numeric-divide"].call(this, hStaticContext_operators["numeric-add"].call(this, oRounded, new cXSDecimal(nDecimal == 0.5 && nRounded % 2 ?-1 : 0)), oPower); + } +}); + + + + +fStaticContext_defineSystemFunction("resolve-QName", [[cXSString, '?'], [cXTElement]], function(oQName, oElement) { + if (oQName == null) + return null; + + var sQName = oQName.valueOf(), + aMatch = sQName.match(rXSQName); + if (!aMatch) + throw new cException("FOCA0002" + , "Invalid QName '" + sQName + "'" + ); + + var sPrefix = aMatch[1] || null, + sLocalName = aMatch[2], + sNameSpaceURI = this.DOMAdapter.lookupNamespaceURI(oElement, sPrefix); + if (sPrefix != null &&!sNameSpaceURI) + throw new cException("FONS0004" + , "Namespace prefix '" + sPrefix + "' has not been declared" + ); + + return new cXSQName(sPrefix, sLocalName, sNameSpaceURI || null); +}); + +fStaticContext_defineSystemFunction("QName", [[cXSString, '?'], [cXSString]], function(oUri, oQName) { + var sQName = oQName.valueOf(), + aMatch = sQName.match(rXSQName); + + if (!aMatch) + throw new cException("FOCA0002" + , "Invalid QName '" + sQName + "'" + ); + + return new cXSQName(aMatch[1] || null, aMatch[2] || null, oUri == null ? '' : oUri.valueOf()); +}); + +fStaticContext_defineSystemFunction("prefix-from-QName", [[cXSQName, '?']], function(oQName) { + if (oQName != null) { + if (oQName.prefix) + return new cXSNCName(oQName.prefix); + } + return null; +}); + +fStaticContext_defineSystemFunction("local-name-from-QName", [[cXSQName, '?']], function(oQName) { + if (oQName == null) + return null; + + return new cXSNCName(oQName.localName); +}); + +fStaticContext_defineSystemFunction("namespace-uri-from-QName", [[cXSQName, '?']], function(oQName) { + if (oQName == null) + return null; + + return cXSAnyURI.cast(new cXSString(oQName.namespaceURI || '')); +}); + +fStaticContext_defineSystemFunction("namespace-uri-for-prefix", [[cXSString, '?'], [cXTElement]], function(oPrefix, oElement) { + var sPrefix = oPrefix == null ? '' : oPrefix.valueOf(), + sNameSpaceURI = this.DOMAdapter.lookupNamespaceURI(oElement, sPrefix || null); + + return sNameSpaceURI == null ? null : cXSAnyURI.cast(new cXSString(sNameSpaceURI)); +}); + +fStaticContext_defineSystemFunction("in-scope-prefixes", [[cXTElement]], function(oElement) { + throw "Function '" + "in-scope-prefixes" + "' not implemented"; +}); + + + + +fStaticContext_defineSystemFunction("boolean", [[cXTItem, '*']], function(oSequence1) { + return new cXSBoolean(fFunction_sequence_toEBV(oSequence1, this)); +}); + +fStaticContext_defineSystemFunction("index-of", [[cXSAnyAtomicType, '*'], [cXSAnyAtomicType], [cXSString, '', true]], function(oSequence1, oSearch, oCollation) { + if (!oSequence1.length || oSearch == null) + return []; + + + var vLeft = oSearch; + if (vLeft instanceof cXSUntypedAtomic) + vLeft = cXSString.cast(vLeft); + + var oSequence = []; + for (var nIndex = 0, nLength = oSequence1.length, vRight; nIndex < nLength; nIndex++) { + vRight = oSequence1[nIndex]; + if (vRight instanceof cXSUntypedAtomic) + vRight = cXSString.cast(vRight); + if (vRight.valueOf() === vLeft.valueOf()) + oSequence.push(new cXSInteger(nIndex + 1)); + } + + return oSequence; +}); + +fStaticContext_defineSystemFunction("empty", [[cXTItem, '*']], function(oSequence1) { + return new cXSBoolean(!oSequence1.length); +}); + +fStaticContext_defineSystemFunction("exists", [[cXTItem, '*']], function(oSequence1) { + return new cXSBoolean(!!oSequence1.length); +}); + +fStaticContext_defineSystemFunction("distinct-values", [[cXSAnyAtomicType, '*'], [cXSString, '', true]], function(oSequence1, oCollation) { + if (!oSequence1.length) + return null; + + var oSequence = []; + for (var nIndex = 0, nLength = oSequence1.length, vLeft; nIndex < nLength; nIndex++) { + vLeft = oSequence1[nIndex]; + if (vLeft instanceof cXSUntypedAtomic) + vLeft = cXSString.cast(vLeft); + for (var nRightIndex = 0, nRightLength = oSequence.length, vRight, bFound = false; (nRightIndex < nRightLength) &&!bFound; nRightIndex++) { + vRight = oSequence[nRightIndex]; + if (vRight instanceof cXSUntypedAtomic) + vRight = cXSString.cast(vRight); + if (vRight.valueOf() === vLeft.valueOf()) + bFound = true; + } + if (!bFound) + oSequence.push(oSequence1[nIndex]); + } + + return oSequence; +}); + +fStaticContext_defineSystemFunction("insert-before", [[cXTItem, '*'], [cXSInteger], [cXTItem, '*']], function(oSequence1, oPosition, oSequence3) { + if (!oSequence1.length) + return oSequence3; + if (!oSequence3.length) + return oSequence1; + + var nLength = oSequence1.length, + nPosition = oPosition.valueOf(); + if (nPosition < 1) + nPosition = 1; + else + if (nPosition > nLength) + nPosition = nLength + 1; + + var oSequence = []; + for (var nIndex = 0; nIndex < nLength; nIndex++) { + if (nPosition == nIndex + 1) + oSequence = oSequence.concat(oSequence3); + oSequence.push(oSequence1[nIndex]); + } + if (nPosition == nIndex + 1) + oSequence = oSequence.concat(oSequence3); + + return oSequence; +}); + +fStaticContext_defineSystemFunction("remove", [[cXTItem, '*'], [cXSInteger]], function(oSequence1, oPosition) { + if (!oSequence1.length) + return []; + + var nLength = oSequence1.length, + nPosition = oPosition.valueOf(); + + if (nPosition < 1 || nPosition > nLength) + return oSequence1; + + var oSequence = []; + for (var nIndex = 0; nIndex < nLength; nIndex++) + if (nPosition != nIndex + 1) + oSequence.push(oSequence1[nIndex]); + + return oSequence; +}); + +fStaticContext_defineSystemFunction("reverse", [[cXTItem, '*']], function(oSequence1) { + oSequence1.reverse(); + + return oSequence1; +}); + +fStaticContext_defineSystemFunction("subsequence", [[cXTItem, '*'], [cXSDouble, ''], [cXSDouble, '', true]], function(oSequence1, oStart, oLength) { + var nPosition = cMath.round(oStart), + nLength = arguments.length > 2 ? cMath.round(oLength) : oSequence1.length - nPosition + 1; + + return oSequence1.slice(nPosition - 1, nPosition - 1 + nLength); +}); + +fStaticContext_defineSystemFunction("unordered", [[cXTItem, '*']], function(oSequence1) { + return oSequence1; +}); + + +fStaticContext_defineSystemFunction("zero-or-one", [[cXTItem, '*']], function(oSequence1) { + if (oSequence1.length > 1) + throw new cException("FORG0003"); + + return oSequence1; +}); + +fStaticContext_defineSystemFunction("one-or-more", [[cXTItem, '*']], function(oSequence1) { + if (!oSequence1.length) + throw new cException("FORG0004"); + + return oSequence1; +}); + +fStaticContext_defineSystemFunction("exactly-one", [[cXTItem, '*']], function(oSequence1) { + if (oSequence1.length != 1) + throw new cException("FORG0005"); + + return oSequence1; +}); + + +fStaticContext_defineSystemFunction("deep-equal", [[cXTItem, '*'], [cXTItem, '*'], [cXSString, '', true]], function(oSequence1, oSequence2, oCollation) { + throw "Function '" + "deep-equal" + "' not implemented"; +}); + + +fStaticContext_defineSystemFunction("count", [[cXTItem, '*']], function(oSequence1) { + return new cXSInteger(oSequence1.length); +}); + +fStaticContext_defineSystemFunction("avg", [[cXSAnyAtomicType, '*']], function(oSequence1) { + if (!oSequence1.length) + return null; + + try { + var vValue = oSequence1[0]; + if (vValue instanceof cXSUntypedAtomic) + vValue = cXSDouble.cast(vValue); + for (var nIndex = 1, nLength = oSequence1.length, vRight; nIndex < nLength; nIndex++) { + vRight = oSequence1[nIndex]; + if (vRight instanceof cXSUntypedAtomic) + vRight = cXSDouble.cast(vRight); + vValue = hAdditiveExpr_operators['+'](vValue, vRight, this); + } + return hMultiplicativeExpr_operators['div'](vValue, new cXSInteger(nLength), this); + } + catch (e) { + throw e.code != "XPTY0004" ? e : new cException("FORG0006" + , "Input to avg() contains a mix of types" + ); + } +}); + +fStaticContext_defineSystemFunction("max", [[cXSAnyAtomicType, '*'], [cXSString, '', true]], function(oSequence1, oCollation) { + if (!oSequence1.length) + return null; + + + try { + var vValue = oSequence1[0]; + for (var nIndex = 1, nLength = oSequence1.length; nIndex < nLength; nIndex++) + if (hComparisonExpr_ValueComp_operators['ge'](oSequence1[nIndex], vValue, this).valueOf()) + vValue = oSequence1[nIndex]; + return vValue; + } + catch (e) { + throw e.code != "XPTY0004" ? e : new cException("FORG0006" + , "Input to max() contains a mix of not comparable values" + ); + } +}); + +fStaticContext_defineSystemFunction("min", [[cXSAnyAtomicType, '*'], [cXSString, '', true]], function(oSequence1, oCollation) { + if (!oSequence1.length) + return null; + + + try { + var vValue = oSequence1[0]; + for (var nIndex = 1, nLength = oSequence1.length; nIndex < nLength; nIndex++) + if (hComparisonExpr_ValueComp_operators['le'](oSequence1[nIndex], vValue, this).valueOf()) + vValue = oSequence1[nIndex]; + return vValue; + } + catch (e) { + throw e.code != "XPTY0004" ? e : new cException("FORG0006" + , "Input to min() contains a mix of not comparable values" + ); + } +}); + +fStaticContext_defineSystemFunction("sum", [[cXSAnyAtomicType, '*'], [cXSAnyAtomicType, '?', true]], function(oSequence1, oZero) { + if (!oSequence1.length) { + if (arguments.length > 1) + return oZero; + else + return new cXSDouble(0); + + return null; + } + + + try { + var vValue = oSequence1[0]; + if (vValue instanceof cXSUntypedAtomic) + vValue = cXSDouble.cast(vValue); + for (var nIndex = 1, nLength = oSequence1.length, vRight; nIndex < nLength; nIndex++) { + vRight = oSequence1[nIndex]; + if (vRight instanceof cXSUntypedAtomic) + vRight = cXSDouble.cast(vRight); + vValue = hAdditiveExpr_operators['+'](vValue, vRight, this); + } + return vValue; + } + catch (e) { + throw e.code != "XPTY0004" ? e : new cException("FORG0006" + , "Input to sum() contains a mix of types" + ); + } +}); + + +fStaticContext_defineSystemFunction("id", [[cXSString, '*'], [cXTNode, '', true]], function(oSequence1, oNode) { + if (arguments.length < 2) { + if (!this.DOMAdapter.isNode(this.item)) + throw new cException("XPTY0004" + , "id() function called when the context item is not a node" + ); + oNode = this.item; + } + + var oDocument = hStaticContext_functions["root"].call(this, oNode); + if (this.DOMAdapter.getProperty(oDocument, "nodeType") != 9) + throw new cException("FODC0001"); + + var oSequence = []; + for (var nIndex = 0; nIndex < oSequence1.length; nIndex++) + for (var nRightIndex = 0, aValue = fString_trim(oSequence1[nIndex]).split(/\s+/), nRightLength = aValue.length; nRightIndex < nRightLength; nRightIndex++) + if ((oNode = this.DOMAdapter.getElementById(oDocument, aValue[nRightIndex])) && fArray_indexOf(oSequence, oNode) ==-1) + oSequence.push(oNode); + return fFunction_sequence_order(oSequence, this); +}); + +fStaticContext_defineSystemFunction("idref", [[cXSString, '*'], [cXTNode, '', true]], function(oSequence1, oNode) { + throw "Function '" + "idref" + "' not implemented"; +}); + +fStaticContext_defineSystemFunction("doc", [[cXSString, '?', true]], function(oUri) { + throw "Function '" + "doc" + "' not implemented"; +}); + +fStaticContext_defineSystemFunction("doc-available", [[cXSString, '?', true]], function(oUri) { + throw "Function '" + "doc-available" + "' not implemented"; +}); + +fStaticContext_defineSystemFunction("collection", [[cXSString, '?', true]], function(oUri) { + throw "Function '" + "collection" + "' not implemented"; +}); + +fStaticContext_defineSystemFunction("element-with-id", [[cXSString, '*'], [cXTNode, '', true]], function(oSequence1, oNode) { + throw "Function '" + "element-with-id" + "' not implemented"; +}); + +function fFunction_sequence_toEBV(oSequence1, oContext) { + if (!oSequence1.length) + return false; + + var oItem = oSequence1[0]; + if (oContext.DOMAdapter.isNode(oItem)) + return true; + + if (oSequence1.length == 1) { + if (oItem instanceof cXSBoolean) + return oItem.value.valueOf(); + if (oItem instanceof cXSString) + return !!oItem.valueOf().length; + if (fXSAnyAtomicType_isNumeric(oItem)) + return !(fIsNaN(oItem.valueOf()) || oItem.valueOf() == 0); + + throw new cException("FORG0006" + , "Effective boolean value is defined only for sequences containing booleans, strings, numbers, URIs, or nodes" + ); + } + + throw new cException("FORG0006" + , "Effective boolean value is not defined for a sequence of two or more items" + ); +}; + +function fFunction_sequence_atomize(oSequence1, oContext) { + var oSequence = []; + for (var nIndex = 0, nLength = oSequence1.length, oItem, vItem; nIndex < nLength; nIndex++) { + oItem = oSequence1[nIndex]; + vItem = null; + if (oItem == null) + vItem = null; + else + if (oContext.DOMAdapter.isNode(oItem)) { + var fGetProperty = oContext.DOMAdapter.getProperty; + switch (fGetProperty(oItem, "nodeType")) { + case 1: vItem = new cXSUntypedAtomic(fGetProperty(oItem, "textContent")); + break; + case 2: vItem = new cXSUntypedAtomic(fGetProperty(oItem, "value")); + break; + case 3: case 4: case 8: vItem = new cXSUntypedAtomic(fGetProperty(oItem, "data")); + break; + case 7: vItem = new cXSUntypedAtomic(fGetProperty(oItem, "data")); + break; + case 9: var oNode = fGetProperty(oItem, "documentElement"); + vItem = new cXSUntypedAtomic(oNode ? fGetProperty(oNode, "textContent") : ''); + break; + } + } + else + if (oItem instanceof cXSAnyAtomicType) + vItem = oItem; + + if (vItem != null) + oSequence.push(vItem); + } + + return oSequence; +}; + +function fFunction_sequence_order(oSequence1, oContext) { + return oSequence1.sort(function(oNode, oNode2) { + var nPosition = oContext.DOMAdapter.compareDocumentPosition(oNode, oNode2); + return nPosition & 2 ? 1 : nPosition & 4 ?-1 : 0; + }); +}; + + + + +fStaticContext_defineSystemFunction("codepoints-to-string", [[cXSInteger, '*']], function(oSequence1) { + var aValue = []; + for (var nIndex = 0, nLength = oSequence1.length; nIndex < nLength; nIndex++) + aValue.push(cString.fromCharCode(oSequence1[nIndex])); + + return new cXSString(aValue.join('')); +}); + +fStaticContext_defineSystemFunction("string-to-codepoints", [[cXSString, '?']], function(oValue) { + if (oValue == null) + return null; + + var sValue = oValue.valueOf(); + if (sValue == '') + return []; + + var oSequence = []; + for (var nIndex = 0, nLength = sValue.length; nIndex < nLength; nIndex++) + oSequence.push(new cXSInteger(sValue.charCodeAt(nIndex))); + + return oSequence; +}); + +fStaticContext_defineSystemFunction("compare", [[cXSString, '?'], [cXSString, '?'], [cXSString, '', true]], function(oValue1, oValue2, oCollation) { + if (oValue1 == null || oValue2 == null) + return null; + + var sCollation = this.staticContext.defaultCollationName, + vCollation; + if (arguments.length > 2) + sCollation = oCollation.valueOf(); + + vCollation = sCollation == sNS_XPF + "/collation/codepoint" ? oCodepointStringCollator : this.staticContext.getCollation(sCollation); + if (!vCollation) + throw new cException("FOCH0002" + , "Unknown collation " + '{' + sCollation + '}' + ); + + return new cXSInteger(vCollation.compare(oValue1.valueOf(), oValue2.valueOf())); +}); + +fStaticContext_defineSystemFunction("codepoint-equal", [[cXSString, '?'], [cXSString, '?']], function(oValue1, oValue2) { + if (oValue1 == null || oValue2 == null) + return null; + + + return new cXSBoolean(oValue1.valueOf() == oValue2.valueOf()); +}); + + +fStaticContext_defineSystemFunction("concat", null, function() { + if (arguments.length < 2) + throw new cException("XPST0017" + , "Function concat() must have at least 2 arguments" + ); + + var aValue = []; + for (var nIndex = 0, nLength = arguments.length, oSequence; nIndex < nLength; nIndex++) { + oSequence = arguments[nIndex]; + fFunctionCall_assertSequenceCardinality(this, oSequence, '?' + , "each argument of concat()" + ); + if (oSequence.length) + aValue[aValue.length] = cXSString.cast(fFunction_sequence_atomize(oSequence, this)[0]).valueOf(); + } + + return new cXSString(aValue.join('')); +}); + +fStaticContext_defineSystemFunction("string-join", [[cXSString, '*'], [cXSString]], function(oSequence1, oValue) { + return new cXSString(oSequence1.join(oValue)); +}); + +fStaticContext_defineSystemFunction("substring", [[cXSString, '?'], [cXSDouble], [cXSDouble, '', true]], function(oValue, oStart, oLength) { + var sValue = oValue == null ? '' : oValue.valueOf(), + nStart = cMath.round(oStart) - 1, + nEnd = arguments.length > 2 ? nStart + cMath.round(oLength) : sValue.length; + + return new cXSString(nEnd > nStart ? sValue.substring(nStart, nEnd) : ''); +}); + +fStaticContext_defineSystemFunction("string-length", [[cXSString, '?', true]], function(oValue) { + if (!arguments.length) { + if (!this.item) + throw new cException("XPDY0002"); + oValue = cXSString.cast(fFunction_sequence_atomize([this.item], this)[0]); + } + return new cXSInteger(oValue == null ? 0 : oValue.valueOf().length); +}); + +fStaticContext_defineSystemFunction("normalize-space", [[cXSString, '?', true]], function(oValue) { + if (!arguments.length) { + if (!this.item) + throw new cException("XPDY0002"); + oValue = cXSString.cast(fFunction_sequence_atomize([this.item], this)[0]); + } + return new cXSString(oValue == null ? '' : fString_trim(oValue).replace(/\s\s+/g, ' ')); +}); + +fStaticContext_defineSystemFunction("normalize-unicode", [[cXSString, '?'], [cXSString, '', true]], function(oValue, oNormalization) { + throw "Function '" + "normalize-unicode" + "' not implemented"; +}); + +fStaticContext_defineSystemFunction("upper-case", [[cXSString, '?']], function(oValue) { + return new cXSString(oValue == null ? '' : oValue.valueOf().toUpperCase()); +}); + +fStaticContext_defineSystemFunction("lower-case", [[cXSString, '?']], function(oValue) { + return new cXSString(oValue == null ? '' : oValue.valueOf().toLowerCase()); +}); + +fStaticContext_defineSystemFunction("translate", [[cXSString, '?'], [cXSString], [cXSString]], function(oValue, oMap, oTranslate) { + if (oValue == null) + return new cXSString(''); + + var aValue = oValue.valueOf().split(''), + aMap = oMap.valueOf().split(''), + aTranslate = oTranslate.valueOf().split(''), + nTranslateLength = aTranslate.length, + aReturn = []; + for (var nIndex = 0, nLength = aValue.length, nPosition; nIndex < nLength; nIndex++) + if ((nPosition = aMap.indexOf(aValue[nIndex])) ==-1) + aReturn[aReturn.length] = aValue[nIndex]; + else + if (nPosition < nTranslateLength) + aReturn[aReturn.length] = aTranslate[nPosition]; + + return new cXSString(aReturn.join('')); +}); + +fStaticContext_defineSystemFunction("encode-for-uri", [[cXSString, '?']], function(oValue) { + return new cXSString(oValue == null ? '' : window.encodeURIComponent(oValue)); +}); + +fStaticContext_defineSystemFunction("iri-to-uri", [[cXSString, '?']], function(oValue) { + return new cXSString(oValue == null ? '' : window.encodeURI(window.decodeURI(oValue))); +}); + +fStaticContext_defineSystemFunction("escape-html-uri", [[cXSString, '?']], function(oValue) { + if (oValue == null || oValue.valueOf() == '') + return new cXSString(''); + var aValue = oValue.valueOf().split(''); + for (var nIndex = 0, nLength = aValue.length, nCode; nIndex < nLength; nIndex++) + if ((nCode = aValue[nIndex].charCodeAt(0)) < 32 || nCode > 126) + aValue[nIndex] = window.encodeURIComponent(aValue[nIndex]); + return new cXSString(aValue.join('')); +}); + + +fStaticContext_defineSystemFunction("contains", [[cXSString, '?'], [cXSString, '?'], [cXSString, '', true]], function(oValue, oSearch, oCollation) { + return new cXSBoolean((oValue == null ? '' : oValue.valueOf()).indexOf(oSearch == null ? '' : oSearch.valueOf()) >= 0); +}); + +fStaticContext_defineSystemFunction("starts-with", [[cXSString, '?'], [cXSString, '?'], [cXSString, '', true]], function(oValue, oSearch, oCollation) { + return new cXSBoolean((oValue == null ? '' : oValue.valueOf()).indexOf(oSearch == null ? '' : oSearch.valueOf()) == 0); +}); + +fStaticContext_defineSystemFunction("ends-with", [[cXSString, '?'], [cXSString, '?'], [cXSString, '', true]], function(oValue, oSearch, oCollation) { + var sValue = oValue == null ? '' : oValue.valueOf(), + sSearch = oSearch == null ? '' : oSearch.valueOf(); + + return new cXSBoolean(sValue.indexOf(sSearch) == sValue.length - sSearch.length); +}); + +fStaticContext_defineSystemFunction("substring-before", [[cXSString, '?'], [cXSString, '?'], [cXSString, '', true]], function(oValue, oSearch, oCollation) { + var sValue = oValue == null ? '' : oValue.valueOf(), + sSearch = oSearch == null ? '' : oSearch.valueOf(), + nPosition; + + return new cXSString((nPosition = sValue.indexOf(sSearch)) >= 0 ? sValue.substring(0, nPosition) : ''); +}); + +fStaticContext_defineSystemFunction("substring-after", [[cXSString, '?'], [cXSString, '?'], [cXSString, '', true]], function(oValue, oSearch, oCollation) { + var sValue = oValue == null ? '' : oValue.valueOf(), + sSearch = oSearch == null ? '' : oSearch.valueOf(), + nPosition; + + return new cXSString((nPosition = sValue.indexOf(sSearch)) >= 0 ? sValue.substring(nPosition + sSearch.length) : ''); +}); + + +function fFunction_string_createRegExp(sValue, sFlags) { + var d1 = '\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF', + d2 = '\u0370-\u037D\u037F-\u1FFF\u200C-\u200D', + d3 = '\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD', + c = 'A-Z_a-z\\-.0-9\u00B7' + d1 + '\u0300-\u036F' + d2 + '\u203F-\u2040' + d3, + i = 'A-Z_a-z' + d1 + d2 + d3; + + sValue = sValue + .replace(/\[\\i-\[:\]\]/g, '[' + i + ']') + .replace(/\[\\c-\[:\]\]/g, '[' + c + ']') + .replace(/\\i/g, '[:' + i + ']') + .replace(/\\I/g, '[^:' + i + ']') + .replace(/\\c/g, '[:' + c + ']') + .replace(/\\C/g, '[^:' + c + ']'); + + if (sFlags && !sFlags.match(/^[smix]+$/)) + throw new cException("FORX0001"); + var bFlagS = sFlags.indexOf('s') >= 0, + bFlagX = sFlags.indexOf('x') >= 0; + if (bFlagS || bFlagX) { + sFlags = sFlags.replace(/[sx]/g, ''); + var aValue = [], + rValue = /\s/; + for (var nIndex = 0, nLength = sValue.length, bValue = false, sCharCurr, sCharPrev = ''; nIndex < nLength; nIndex++) { + sCharCurr = sValue.charAt(nIndex); + if (sCharPrev != '\\') { + if (sCharCurr == '[') + bValue = true; + else + if (sCharCurr == ']') + bValue = false; + } + if (bValue || !(bFlagX && rValue.test(sCharCurr))) { + if (!bValue && (bFlagS && sCharCurr == '.' && sCharPrev != '\\')) + aValue[aValue.length] = '(?:.|\\s)'; + else + aValue[aValue.length] = sCharCurr; + } + sCharPrev = sCharCurr; + } + sValue = aValue.join(''); + } + + return new cRegExp(sValue, sFlags + 'g'); +}; + +fStaticContext_defineSystemFunction("matches", [[cXSString, '?'], [cXSString], [cXSString, '', true]], function(oValue, oPattern, oFlags) { + var sValue = oValue == null ? '' : oValue.valueOf(), + rRegExp = fFunction_string_createRegExp(oPattern.valueOf(), arguments.length > 2 ? oFlags.valueOf() : ''); + + return new cXSBoolean(rRegExp.test(sValue)); +}); + +fStaticContext_defineSystemFunction("replace", [[cXSString, '?'], [cXSString], [cXSString], [cXSString, '', true]], function(oValue, oPattern, oReplacement, oFlags) { + var sValue = oValue == null ? '' : oValue.valueOf(), + rRegExp = fFunction_string_createRegExp(oPattern.valueOf(), arguments.length > 3 ? oFlags.valueOf() : ''); + + return new cXSBoolean(sValue.replace(rRegExp, oReplacement.valueOf())); +}); + +fStaticContext_defineSystemFunction("tokenize", [[cXSString, '?'], [cXSString], [cXSString, '', true]], function(oValue, oPattern, oFlags) { + var sValue = oValue == null ? '' : oValue.valueOf(), + rRegExp = fFunction_string_createRegExp(oPattern.valueOf(), arguments.length > 2 ? oFlags.valueOf() : ''); + + var oSequence = []; + for (var nIndex = 0, aValue = sValue.split(rRegExp), nLength = aValue.length; nIndex < nLength; nIndex++) + oSequence.push(new cXSString(aValue[nIndex])); + + return oSequence; +}); + + + + +fStaticContext_defineSystemFunction("trace", [[cXTItem, '*'], [cXSString]], function(oSequence1, oLabel) { + var oConsole = window.console; + if (oConsole && oConsole.log) + oConsole.log(oLabel.valueOf(), oSequence1); + return oSequence1; +}); + + +var oCodepointStringCollator = new cStringCollator; + +oCodepointStringCollator.equals = function(sValue1, sValue2) { + return sValue1 == sValue2; +}; + +oCodepointStringCollator.compare = function(sValue1, sValue2) { + return sValue1 == sValue2 ? 0 : sValue1 > sValue2 ? 1 :-1; +}; + + +var cAttr = function() { + +}; + +cAttr.prototype.nodeType = 2; +cAttr.prototype.nodeName = +cAttr.prototype.nodeValue = +cAttr.prototype.ownerDocument = +cAttr.prototype.localName = +cAttr.prototype.namespaceURI = +cAttr.prototype.prefix = +cAttr.prototype.attributes = +cAttr.prototype.childNodes = +cAttr.prototype.firstChild = +cAttr.prototype.lastChild = +cAttr.prototype.previousSibling = +cAttr.prototype.nextSibling = +cAttr.prototype.parentNode = + +cAttr.prototype.name = +cAttr.prototype.specified = +cAttr.prototype.value = +cAttr.prototype.ownerElement = null; + + +function cLXDOMAdapter() { + +}; + +cLXDOMAdapter.prototype = new cDOMAdapter; + +var oLXDOMAdapter_staticContext = new cStaticContext; + +cLXDOMAdapter.prototype.getProperty = function(oNode, sName) { + if (sName in oNode) + return oNode[sName]; + + if (sName == "baseURI") { + var sBaseURI = '', + fResolveUri = oLXDOMAdapter_staticContext.getFunction('{' + "http://www.w3.org/2005/xpath-functions" + '}' + "resolve-uri"), + cXSString = oLXDOMAdapter_staticContext.getDataType('{' + "http://www.w3.org/2001/XMLSchema" + '}' + "string"); + + for (var oParent = oNode, sUri; oParent; oParent = oParent.parentNode) + if (oParent.nodeType == 1 && (sUri = oParent.getAttribute("xml:base"))) + sBaseURI = fResolveUri(new cXSString(sUri), new cXSString(sBaseURI)).toString(); + return sBaseURI; + } + else + if (sName == "textContent") { + var aText = []; + (function(oNode) { + for (var nIndex = 0, oChild; oChild = oNode.childNodes[nIndex]; nIndex++) + if (oChild.nodeType == 3 || oChild.nodeType == 4 ) + aText.push(oChild.data); + else + if (oChild.nodeType == 1 && oChild.firstChild) + arguments.callee(oChild); + })(oNode); + return aText.join(''); + } +}; + +cLXDOMAdapter.prototype.compareDocumentPosition = function(oNode, oChild) { + if ("compareDocumentPosition" in oNode) + return oNode.compareDocumentPosition(oChild); + + if (oChild == oNode) + return 0; + + var oAttr1 = null, + oAttr2 = null, + aAttributes, + oAttr, oElement, nIndex, nLength; + if (oNode.nodeType == 2 ) { + oAttr1 = oNode; + oNode = this.getProperty(oAttr1, "ownerElement"); + } + if (oChild.nodeType == 2 ) { + oAttr2 = oChild; + oChild = this.getProperty(oAttr2, "ownerElement"); + } + + if (oAttr1 && oAttr2 && oNode && oNode == oChild) { + for (nIndex = 0, aAttributes = this.getProperty(oNode, "attributes"), nLength = aAttributes.length; nIndex < nLength; nIndex++) { + oAttr = aAttributes[nIndex]; + if (oAttr == oAttr1) + return 32 | 4 ; + if (oAttr == oAttr2) + return 32 | 2 ; + } + } + + var aChain1 = [], nLength1, oNode1, + aChain2 = [], nLength2, oNode2; + if (oAttr1) + aChain1.push(oAttr1); + for (oElement = oNode; oElement; oElement = oElement.parentNode) + aChain1.push(oElement); + if (oAttr2) + aChain2.push(oAttr2); + for (oElement = oChild; oElement; oElement = oElement.parentNode) + aChain2.push(oElement); + if (((oNode.ownerDocument || oNode) != (oChild.ownerDocument || oChild)) || (aChain1[aChain1.length - 1] != aChain2[aChain2.length - 1])) + return 32 | 1 ; + for (nIndex = cMath.min(nLength1 = aChain1.length, nLength2 = aChain2.length); nIndex; --nIndex) + if ((oNode1 = aChain1[--nLength1]) != (oNode2 = aChain2[--nLength2])) { + if (oNode1.nodeType == 2 ) + return 4 ; + if (oNode2.nodeType == 2 ) + return 2 ; + if (!oNode2.nextSibling) + return 4 ; + if (!oNode1.nextSibling) + return 2 ; + for (oElement = oNode2.previousSibling; oElement; oElement = oElement.previousSibling) + if (oElement == oNode1) + return 4 ; + return 2 ; + } + return nLength1 < nLength2 ? 4 | 16 : 2 | 8 ; +}; + +cLXDOMAdapter.prototype.lookupNamespaceURI = function(oNode, sPrefix) { + if ("lookupNamespaceURI" in oNode) + return oNode.lookupNamespaceURI(sPrefix); + + for (; oNode && oNode.nodeType != 9 ; oNode = oNode.parentNode) + if (sPrefix == this.getProperty(oChild, "prefix")) + return this.getProperty(oNode, "namespaceURI"); + else + if (oNode.nodeType == 1) for (var oAttributes = this.getProperty(oNode, "attributes"), nIndex = 0, nLength = oAttributes.length, sName = "xmlns" + ':' + sPrefix; nIndex < nLength; nIndex++) + if (this.getProperty(oAttributes[nIndex], "nodeName") == sName) + return this.getProperty(oAttributes[nIndex], "value"); + return null; +}; + +cLXDOMAdapter.prototype.getElementsByTagNameNS = function(oNode, sNameSpaceURI, sLocalName) { + if ("getElementsByTagNameNS" in oNode) + return oNode.getElementsByTagNameNS(sNameSpaceURI, sLocalName); + + var aElements = [], + bNameSpaceURI = '*' == sNameSpaceURI, + bLocalName = '*' == sLocalName; + (function(oNode) { + for (var nIndex = 0, oChild; oChild = oNode.childNodes[nIndex]; nIndex++) + if (oChild.nodeType == 1) { if ((bLocalName || sLocalName == this.getProperty(oChild, "localName")) && (bNameSpaceURI || sNameSpaceURI == this.getProperty(oChild, "namespaceURI"))) + aElements[aElements.length] = oChild; + if (oChild.firstChild) + arguments.callee(oChild); + } + })(oNode); + return aElements; +}; + + +var oL2DOMAdapter = new cLXDOMAdapter; + + + +var oL2HTMLDOMAdapter = new cLXDOMAdapter; + +oL2HTMLDOMAdapter.getProperty = function(oNode, sName) { + if (sName == "localName") { + if (oNode.nodeType == 1) + return oNode.localName.toLowerCase(); + } + if (sName == "namespaceURI") + return oNode.nodeType == 1 ? "http://www.w3.org/1999/xhtml" : null; + return cLXDOMAdapter.prototype.getProperty.call(this, oNode, sName); +}; + + +var oMSHTMLDOMAdapter = new cLXDOMAdapter; + +oMSHTMLDOMAdapter.getProperty = function(oNode, sName) { + if (sName == "localName") { + if (oNode.nodeType == 1) + return oNode.nodeName.toLowerCase(); + } + if (sName == "prefix") + return null; + if (sName == "namespaceURI") + return oNode.nodeType == 1 ? "http://www.w3.org/1999/xhtml" : null; + if (sName == "textContent") + return oNode.innerText; + if (sName == "attributes" && oNode.nodeType == 1) { + var aAttributes = []; + for (var nIndex = 0, oAttributes = oNode.attributes, nLength = oAttributes.length, oNode2, oAttribute; nIndex < nLength; nIndex++) { + oNode2 = oAttributes[nIndex]; + if (oNode2.specified) { + oAttribute = new cAttr; + oAttribute.ownerElement = oNode; + oAttribute.ownerDocument= oNode.ownerDocument; + oAttribute.specified = true; + oAttribute.value = + oAttribute.nodeValue = oNode2.nodeValue; + oAttribute.name = + oAttribute.nodeName = + oAttribute.localName = oNode2.nodeName.toLowerCase(); + aAttributes[aAttributes.length] = oAttribute; + } + } + return aAttributes; + } + return cLXDOMAdapter.prototype.getProperty.call(this, oNode, sName); +}; + + +var oMSXMLDOMAdapter = new cLXDOMAdapter; + +oMSXMLDOMAdapter.getProperty = function(oNode, sName) { + if (sName == "localName") { + if (oNode.nodeType == 7) + return null; + if (oNode.nodeType == 1) + return oNode.baseName; + } + if (sName == "prefix" || sName == "namespaceURI") + return oNode[sName] || null; + if (sName == "textContent") + return oNode.text; + if (sName == "attributes" && oNode.nodeType == 1) { + var aAttributes = []; + for (var nIndex = 0, oAttributes = oNode.attributes, nLength = oAttributes.length, oNode2, oAttribute; nIndex < nLength; nIndex++) { + oNode2 = oAttributes[nIndex]; + if (oNode2.specified) { + oAttribute = new cAttr; + oAttribute.nodeType = 2; + oAttribute.ownerElement = oNode; + oAttribute.ownerDocument= oNode.ownerDocument; + oAttribute.specified = true; + oAttribute.value = + oAttribute.nodeValue = oNode2.nodeValue; + oAttribute.name = + oAttribute.nodeName = oNode2.nodeName; + oAttribute.localName = oNode2.baseName; + oAttribute.prefix = oNode2.prefix || null; + oAttribute.namespaceURI = oNode2.namespaceURI || null; + aAttributes[aAttributes.length] = oAttribute; + } + } + return aAttributes; + } + return cLXDOMAdapter.prototype.getProperty.call(this, oNode, sName); +}; + +oMSXMLDOMAdapter.getElementById = function(oDocument, sId) { + return oDocument.nodeFromID(sId); +}; + + + + +var cQuery = window.jQuery, + oDocument = window.document, + bOldMS = !!oDocument.namespaces && !oDocument.createElementNS, + bOldW3 = !bOldMS && oDocument.documentElement.namespaceURI != "http://www.w3.org/1999/xhtml"; + +var oHTMLStaticContext = new cStaticContext, + oXMLStaticContext = new cStaticContext; + +oHTMLStaticContext.baseURI = oDocument.location.href; +oHTMLStaticContext.defaultFunctionNamespace = "http://www.w3.org/2005/xpath-functions"; +oHTMLStaticContext.defaultElementNamespace = "http://www.w3.org/1999/xhtml"; + +oXMLStaticContext.defaultFunctionNamespace = oHTMLStaticContext.defaultFunctionNamespace; + +function fXPath_evaluate(oQuery, sExpression, fNSResolver) { + if (typeof sExpression == "undefined" || sExpression === null) + sExpression = ''; + + var oNode = oQuery[0]; + if (typeof oNode == "undefined") + oNode = null; + + var oStaticContext = oNode && (oNode.nodeType == 9 ? oNode : oNode.ownerDocument).createElement("div").tagName == "DIV" ? oHTMLStaticContext : oXMLStaticContext; + + oStaticContext.namespaceResolver = fNSResolver; + + var oExpression = new cExpression(cString(sExpression), oStaticContext); + + oStaticContext.namespaceResolver = null; + + var aSequence, + oSequence = new cQuery, + oAdapter = oL2DOMAdapter; + + if (bOldMS) + oAdapter = oStaticContext == oHTMLStaticContext ? oMSHTMLDOMAdapter : oMSXMLDOMAdapter; + else + if (bOldW3 && oStaticContext == oHTMLStaticContext) + oAdapter = oL2HTMLDOMAdapter; + + aSequence = oExpression.evaluate(new cDynamicContext(oStaticContext, oNode, null, oAdapter)); + for (var nIndex = 0, nLength = aSequence.length, oItem; nIndex < nLength; nIndex++) + oSequence.push(oAdapter.isNode(oItem = aSequence[nIndex]) ? oItem : cStaticContext.xs2js(oItem)); + + return oSequence; +}; + +var oObject = {}; +oObject.xpath = function(oQuery, sExpression, fNSResolver) { + return fXPath_evaluate(oQuery instanceof cQuery ? oQuery : new cQuery(oQuery), sExpression, fNSResolver); +}; +cQuery.extend(cQuery, oObject); + +oObject = {}; +oObject.xpath = function(sExpression, fNSResolver) { + return fXPath_evaluate(this, sExpression, fNSResolver); +}; +cQuery.extend(cQuery.prototype, oObject); + +})(); diff --git a/src/js/operations/Extract.js b/src/js/operations/Extract.js index fdab5591..01ebfd3a 100755 --- a/src/js/operations/Extract.js +++ b/src/js/operations/Extract.js @@ -10,7 +10,7 @@ var Extract = { /** - * Runs search operations across the input data using refular expressions. + * Runs search operations across the input data using regular expressions. * * @private * @param {string} input @@ -293,5 +293,66 @@ var Extract = { output += Extract.run_dates(input, []); return output; }, - + + /** + * @constant + * @default + */ + XPATH_INITIAL: "", + + /** + * @constant + * @default + */ + XPATH_DELIMITER: "\\n", + + /** + * Extract information (from an xml document) with an XPath query + * + * @param {string} input + * @param {Object[]} args + * @returns {string} + */ + run_xpath:function(input, args) { + var query = args[0]; + var delimiter = args[1]; + + try { + var xml = $.parseXML(input); + } catch (err) { + return "Invalid input XML."; + } + + try { + var result = $.xpath(xml, query); + } catch (err) { + return "Invalid XPath. Details:\n" + err.message; + } + + var serializer = new XMLSerializer(); + var output = ""; + for (var i = 0; i < result.length; i++) { + if (i > 0) output += delimiter; + + switch (result[i].nodeType) { + case Node.ELEMENT_NODE: + output += serializer.serializeToString(result[i]); + break; + case Node.ATTRIBUTE_NODE: + output += result[i].value; + break; + case Node.TEXT_NODE: + output += result[i].wholeText; + break; + case Node.COMMENT_NODE: + output += result[i].data; + break; + default: + throw new Error("Unknown Node Type: " + result[i].nodeType); + } + } + + return output; + } + }; From befb89ba761e71d0bc1bc87c8f98819b983404ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Schw=C3=B6rer=20Mike?= Date: Wed, 30 Nov 2016 09:56:02 +0100 Subject: [PATCH 02/24] reverted .gitignore and no for-loop in run_xpath --- .gitignore | 1 - src/js/operations/Extract.js | 31 ++++++++++--------------------- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index 77d1e64a..482be5c7 100755 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,3 @@ build/dev docs/* !docs/*.conf.json !docs/*.ico -.idea/* \ No newline at end of file diff --git a/src/js/operations/Extract.js b/src/js/operations/Extract.js index 01ebfd3a..41644762 100755 --- a/src/js/operations/Extract.js +++ b/src/js/operations/Extract.js @@ -330,29 +330,18 @@ var Extract = { } var serializer = new XMLSerializer(); - var output = ""; - for (var i = 0; i < result.length; i++) { - if (i > 0) output += delimiter; - - switch (result[i].nodeType) { - case Node.ELEMENT_NODE: - output += serializer.serializeToString(result[i]); - break; - case Node.ATTRIBUTE_NODE: - output += result[i].value; - break; - case Node.TEXT_NODE: - output += result[i].wholeText; - break; - case Node.COMMENT_NODE: - output += result[i].data; - break; - default: - throw new Error("Unknown Node Type: " + result[i].nodeType); + var nodeToString = function(node) { + const { nodeType, value, wholeText, data } = node; + switch (nodeType) { + case Node.ELEMENT_NODE: return serializer.serializeToString(node); + case Node.ATTRIBUTE_NODE: return value; + case Node.COMMENT_NODE: return data; + default: throw new Error(`Unknown Node Type: ${nodeType}`); } } - return output; + return Object.values(result).slice(0, -1) // all values except last (length) + .map(nodeToString) + .join(delimiter); } - }; From d5f84abb3baa8a2018dfaa826fdd169d52d4ba99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Schw=C3=B6rer=20Mike?= Date: Wed, 30 Nov 2016 12:23:19 +0100 Subject: [PATCH 03/24] declare function as const and added Node.DOCUMENT_NODE --- src/js/operations/Extract.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/js/operations/Extract.js b/src/js/operations/Extract.js index 41644762..6ee0b071 100755 --- a/src/js/operations/Extract.js +++ b/src/js/operations/Extract.js @@ -330,12 +330,13 @@ var Extract = { } var serializer = new XMLSerializer(); - var nodeToString = function(node) { + const nodeToString = function(node) { const { nodeType, value, wholeText, data } = node; switch (nodeType) { case Node.ELEMENT_NODE: return serializer.serializeToString(node); case Node.ATTRIBUTE_NODE: return value; case Node.COMMENT_NODE: return data; + case Node.DOCUMENT_NODE: return serializer.serializeToString(node); default: throw new Error(`Unknown Node Type: ${nodeType}`); } } From 2db6f8f63c3165d57b1cd8c91984a5f2a3cf0c9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Schw=C3=B6rer=20Mike?= Date: Fri, 2 Dec 2016 12:49:49 +0100 Subject: [PATCH 04/24] added css_query operation --- src/js/config/Categories.js | 1 + src/js/config/OperationConfig.js | 18 ++++++++++ src/js/operations/Extract.js | 62 +++++++++++++++++++++++++++++--- 3 files changed, 77 insertions(+), 4 deletions(-) diff --git a/src/js/config/Categories.js b/src/js/config/Categories.js index 5120e5c9..09912a95 100755 --- a/src/js/config/Categories.js +++ b/src/js/config/Categories.js @@ -187,6 +187,7 @@ var Categories = [ "Extract dates", "Regular expression", "XPath expression", + "CSS selector", ] }, { diff --git a/src/js/config/OperationConfig.js b/src/js/config/OperationConfig.js index dec017e0..98539c3a 100755 --- a/src/js/config/OperationConfig.js +++ b/src/js/config/OperationConfig.js @@ -1911,6 +1911,24 @@ var OperationConfig = { } ] }, + "CSS selector": { + description: "Extract information from an HTML document with an CSS selector", + run: Extract.run_css_query, + input_type: "string", + output_type: "string", + args: [ + { + name: "CSS selector", + type: "string", + value: Extract.SELECTOR_INITIAL + }, + { + name: "Delimiter", + type: "binary_short_string", + value: Extract.CSS_QUERY_DELIMITER + }, + ] + }, "From UNIX Timestamp": { description: "Converts a UNIX timestamp to a datetime string.

e.g. 978346800 becomes Mon 1 January 2001 11:00:00 UTC", run: DateTime.run_from_unix_timestamp, diff --git a/src/js/operations/Extract.js b/src/js/operations/Extract.js index 6ee0b071..5582baee 100755 --- a/src/js/operations/Extract.js +++ b/src/js/operations/Extract.js @@ -314,8 +314,8 @@ var Extract = { * @returns {string} */ run_xpath:function(input, args) { - var query = args[0]; - var delimiter = args[1]; + const query = args[0]; + const delimiter = args[1]; try { var xml = $.parseXML(input); @@ -329,7 +329,7 @@ var Extract = { return "Invalid XPath. Details:\n" + err.message; } - var serializer = new XMLSerializer(); + const serializer = new XMLSerializer(); const nodeToString = function(node) { const { nodeType, value, wholeText, data } = node; switch (nodeType) { @@ -344,5 +344,59 @@ var Extract = { return Object.values(result).slice(0, -1) // all values except last (length) .map(nodeToString) .join(delimiter); - } + }, + + + /** + * @constant + * @default + */ + SELECTOR_INITIAL: "", + /** + * @constant + * @default + */ + CSS_QUERY_DELIMITER: "\\n", + + /** + * Extract information (from an hmtl document) with an css selector + * + * @param {string} input + * @param {Object[]} args + * @returns {string} + */ + run_css_query: function(input, args) { + const query = args[0]; + const delimiter = args[1]; + + try { + var html = $.parseHTML(input); + } catch (err) { + return "Invalid input HTML."; + } + + try { + var result = $(html).find(query); + } catch (err) { + return "Invalid CSS Selector. Details:\n" + err.message; + } + + const nodeToString = function(node) { + const { nodeType, value, wholeText, data } = node; + switch (nodeType) { + case Node.ELEMENT_NODE: return node.outerHTML; + case Node.ATTRIBUTE_NODE: return value; + case Node.COMMENT_NODE: return data; + case Node.TEXT_NODE: return wholeText; + case Node.DOCUMENT_NODE: return node.outerHTML; + default: throw new Error(`Unknown Node Type: ${nodeType}`); + } + } + + return Array.apply(null, Array(result.length)) + .map(function (_, i) {return result[i];}) + .map(nodeToString) + .join(delimiter); + }, + }; From 662805d11e781bfc4f442b82e079d96968401192 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Mon, 5 Dec 2016 19:47:41 +0100 Subject: [PATCH 05/24] fixed a few jshint warnings and uglify:prod problems --- src/js/.jshintrc | 1 + src/js/operations/Extract.js | 38 +++++++++++++++++++----------------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/js/.jshintrc b/src/js/.jshintrc index 7dc0b5ac..d6ad3ca3 100755 --- a/src/js/.jshintrc +++ b/src/js/.jshintrc @@ -1,4 +1,5 @@ { + "esversion": 6, "strict": "implied", "multistr": true, "browser": true, diff --git a/src/js/operations/Extract.js b/src/js/operations/Extract.js index 5582baee..2dc346be 100755 --- a/src/js/operations/Extract.js +++ b/src/js/operations/Extract.js @@ -317,29 +317,30 @@ var Extract = { const query = args[0]; const delimiter = args[1]; + var xml; try { - var xml = $.parseXML(input); + xml = $.parseXML(input); } catch (err) { return "Invalid input XML."; } + var result; try { - var result = $.xpath(xml, query); + result = $.xpath(xml, query); } catch (err) { return "Invalid XPath. Details:\n" + err.message; } const serializer = new XMLSerializer(); const nodeToString = function(node) { - const { nodeType, value, wholeText, data } = node; - switch (nodeType) { + switch (node.nodeType) { case Node.ELEMENT_NODE: return serializer.serializeToString(node); - case Node.ATTRIBUTE_NODE: return value; - case Node.COMMENT_NODE: return data; + case Node.ATTRIBUTE_NODE: return node.value; + case Node.COMMENT_NODE: return node.data; case Node.DOCUMENT_NODE: return serializer.serializeToString(node); - default: throw new Error(`Unknown Node Type: ${nodeType}`); + default: throw new Error("Unknown Node Type: " + node.nodeType); } - } + }; return Object.values(result).slice(0, -1) // all values except last (length) .map(nodeToString) @@ -369,29 +370,30 @@ var Extract = { const query = args[0]; const delimiter = args[1]; + var html; try { - var html = $.parseHTML(input); + html = $.parseHTML(input); } catch (err) { return "Invalid input HTML."; } - + + var result; try { - var result = $(html).find(query); + result = $(html).find(query); } catch (err) { return "Invalid CSS Selector. Details:\n" + err.message; } const nodeToString = function(node) { - const { nodeType, value, wholeText, data } = node; - switch (nodeType) { + switch (node.nodeType) { case Node.ELEMENT_NODE: return node.outerHTML; - case Node.ATTRIBUTE_NODE: return value; - case Node.COMMENT_NODE: return data; - case Node.TEXT_NODE: return wholeText; + case Node.ATTRIBUTE_NODE: return node.value; + case Node.COMMENT_NODE: return node.ata; + case Node.TEXT_NODE: return node.wholeText; case Node.DOCUMENT_NODE: return node.outerHTML; - default: throw new Error(`Unknown Node Type: ${nodeType}`); + default: throw new Error("Unknown Node Type: " + node.nodeType); } - } + }; return Array.apply(null, Array(result.length)) .map(function (_, i) {return result[i];}) From dea16f63f555e34919c256e80db7d4d1701c4ffd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Fri, 16 Dec 2016 22:32:19 +0100 Subject: [PATCH 06/24] Small stuff to make eslint happy --- Gruntfile.js | 2 +- src/js/operations/Extract.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 05373d1b..8238e7a5 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -130,7 +130,7 @@ module.exports = function(grunt) { "src/js/lib/vkbeautify.js", "src/js/lib/Sortable.js", "src/js/lib/bootstrap-colorpicker.js", - 'src/js/lib/jquery.xpath.js', + "src/js/lib/jquery.xpath.js", // Custom libraries "src/js/lib/canvas_components.js", diff --git a/src/js/operations/Extract.js b/src/js/operations/Extract.js index 1ded1dc8..f84719e6 100755 --- a/src/js/operations/Extract.js +++ b/src/js/operations/Extract.js @@ -396,7 +396,7 @@ var Extract = { }; return Array.apply(null, Array(result.length)) - .map(function (_, i) {return result[i];}) + .map((_, i) => result[i]) .map(nodeToString) .join(delimiter); }, From 8db1b2fc79b6b3f770eb6f55686cfa125498a9f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Sat, 17 Dec 2016 00:33:47 +0100 Subject: [PATCH 07/24] switched from jquery.cpath.js to xpath.js --- Gruntfile.js | 2 +- src/js/lib/{jquery.xpath.js => xpath.js} | 3528 +++++++++++++++++----- src/js/operations/Extract.js | 16 +- 3 files changed, 2820 insertions(+), 726 deletions(-) rename src/js/lib/{jquery.xpath.js => xpath.js} (69%) diff --git a/Gruntfile.js b/Gruntfile.js index 8238e7a5..96f22d76 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -130,7 +130,7 @@ module.exports = function(grunt) { "src/js/lib/vkbeautify.js", "src/js/lib/Sortable.js", "src/js/lib/bootstrap-colorpicker.js", - "src/js/lib/jquery.xpath.js", + "src/js/lib/xpath.js", // Custom libraries "src/js/lib/canvas_components.js", diff --git a/src/js/lib/jquery.xpath.js b/src/js/lib/xpath.js similarity index 69% rename from src/js/lib/jquery.xpath.js rename to src/js/lib/xpath.js index 33f42221..4a1e3d7d 100644 --- a/src/js/lib/jquery.xpath.js +++ b/src/js/lib/xpath.js @@ -1,18 +1,13 @@ -/* - * jQuery XPath plugin v0.3.1 - * https://github.com/ilinsky/jquery-xpath - * Copyright 2015, Sergey Ilinsky +(function(){/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky * Dual licensed under the MIT and GPL licenses. * - * Includes xpath.js - XPath 2.0 implementation in JavaScript - * https://github.com/ilinsky/xpath.js - * Copyright 2015, Sergey Ilinsky - * Dual licensed under the MIT and GPL licenses. * */ -(function () { - +// Javascript objects var cString = window.String, cBoolean = window.Boolean, cNumber = window.Number, @@ -22,14 +17,17 @@ var cString = window.String, cDate = window.Date, cFunction = window.Function, cMath = window.Math, +// Error Objects cError = window.Error, cSyntaxError= window.SyntaxError, cTypeError = window.TypeError, +// misc fIsNaN = window.isNaN, fIsFinite = window.isFinite, nNaN = window.NaN, nInfinity = window.Infinity, - fWindow_btoa = window.btoa, + // Functions + fWindow_btoa = window.btoa, fWindow_atob = window.atob, fWindow_parseInt= window.parseInt, fString_trim =(function() { @@ -51,19 +49,28 @@ var sNS_XSD = "http://www.w3.org/2001/XMLSchema", sNS_XNS = "http://www.w3.org/2000/xmlns/", sNS_XML = "http://www.w3.org/XML/1998/namespace"; +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cException(sCode - , sMessage + ) { this.code = sCode; this.message = - sMessage || + oException_messages[sCode]; }; cException.prototype = new cError; +// "http://www.w3.org/2005/xqt-errors" var oException_messages = {}; oException_messages["XPDY0002"] = "Evaluation of an expression relies on some part of the dynamic context that has not been assigned a value."; @@ -77,21 +84,34 @@ oException_messages["XPTY0019"] = "The result of a step (other than the last ste oException_messages["XPTY0020"] = "In an axis step, the context item is not a node."; oException_messages["XPST0051"] = "It is a static error if a QName that is used as an AtomicType in a SequenceType is not defined in the in-scope schema types as an atomic type."; oException_messages["XPST0081"] = "A QName used in an expression contains a namespace prefix that cannot be expanded into a namespace URI by using the statically known namespaces."; +// oException_messages["FORG0001"] = "Invalid value for cast/constructor."; oException_messages["FORG0003"] = "fn:zero-or-one called with a sequence containing more than one item."; oException_messages["FORG0004"] = "fn:one-or-more called with a sequence containing no items."; oException_messages["FORG0005"] = "fn:exactly-one called with a sequence containing zero or more than one item."; oException_messages["FORG0006"] = "Invalid argument type."; +// oException_messages["FODC0001"] = "No context document."; +// oException_messages["FORX0001"] = "Invalid regular expression flags."; +// oException_messages["FOCA0002"] = "Invalid lexical value."; +// oException_messages["FOCH0002"] = "Unsupported collation."; oException_messages["FONS0004"] = "No namespace found for prefix."; +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cLexer(sValue) { - var aMatch = sValue.match(/\$?(?:(?![0-9-])(?:[\w-]+|\*):)?(?![0-9-])(?:[\w-]+|\*)|\(:|:\)|\/\/|\.\.|::|\d+(?:\.\d*)?(?:[eE][+-]?\d+)?|\.\d+(?:[eE][+-]?\d+)?|"[^"]*(?:""[^"]*)*"|'[^']*(?:''[^']*)*'|<<|>>|[!<>]=|(?![0-9-])[\w-]+:\*|\s+|./g); + var aMatch = sValue.match(/\$?(?:(?![0-9-])(?:\w[\w.-]*|\*):)?(?![0-9-])(?:\w[\w.-]*|\*)|\(:|:\)|\/\/|\.\.|::|\d+(?:\.\d*)?(?:[eE][+-]?\d+)?|\.\d+(?:[eE][+-]?\d+)?|"[^"]*(?:""[^"]*)*"|'[^']*(?:''[^']*)*'|<<|>>|[!<>]=|(?![0-9-])[\w-]+:\*|\s+|./g); if (aMatch) { var nStack = 0; for (var nIndex = 0, nLength = aMatch.length; nIndex < nLength; nIndex++) @@ -105,7 +125,7 @@ function cLexer(sValue) { this[this.length++] = aMatch[nIndex]; if (nStack) throw new cException("XPST0003" - , "Unclosed comment" + ); } }; @@ -133,11 +153,20 @@ cLexer.prototype.eof = function() { return this.index >= this.length; }; +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cDOMAdapter() { }; +// Custom members cDOMAdapter.prototype.isNode = function(oNode) { return oNode &&!!oNode.nodeType; }; @@ -146,6 +175,7 @@ cDOMAdapter.prototype.getProperty = function(oNode, sName) { return oNode[sName]; }; +// Standard members cDOMAdapter.prototype.isSameNode = function(oNode, oNode2) { return oNode == oNode2; }; @@ -158,22 +188,37 @@ cDOMAdapter.prototype.lookupNamespaceURI = function(oNode, sPrefix) { return oNode.lookupNamespaceURI(sPrefix); }; +// Document object members cDOMAdapter.prototype.getElementById = function(oNode, sId) { return oNode.getElementById(sId); }; +// Element/Document object members cDOMAdapter.prototype.getElementsByTagNameNS = function(oNode, sNameSpaceURI, sLocalName) { return oNode.getElementsByTagNameNS(sNameSpaceURI, sLocalName); }; +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cDynamicContext(oStaticContext, vItem, oScope, oDOMAdapter) { - this.staticContext = oStaticContext; - this.item = vItem; - this.scope = oScope || {}; + // + this.staticContext = oStaticContext; + // + this.item = vItem; + // + this.scope = oScope || {}; this.stack = {}; - this.DOMAdapter = oDOMAdapter || new cDOMAdapter; - var oDate = new cDate, + // + this.DOMAdapter = oDOMAdapter || new cDOMAdapter; + // + var oDate = new cDate, nOffset = oDate.getTimezoneOffset(); this.dateTime = new cXSDateTime(oDate.getFullYear(), oDate.getMonth() + 1, oDate.getDate(), oDate.getHours(), oDate.getMinutes(), oDate.getSeconds() + oDate.getMilliseconds() / 1000, -nOffset); this.timezone = new cXSDayTimeDuration(0, cMath.abs(~~(nOffset / 60)), cMath.abs(nOffset % 60), 0, nOffset > 0); @@ -182,11 +227,16 @@ function cDynamicContext(oStaticContext, vItem, oScope, oDOMAdapter) { cDynamicContext.prototype.item = null; cDynamicContext.prototype.position = 0; cDynamicContext.prototype.size = 0; +// cDynamicContext.prototype.scope = null; -cDynamicContext.prototype.stack = null; cDynamicContext.prototype.dateTime = null; +cDynamicContext.prototype.stack = null; // Variables stack +// +cDynamicContext.prototype.dateTime = null; cDynamicContext.prototype.timezone = null; +// cDynamicContext.prototype.staticContext = null; +// Stack management cDynamicContext.prototype.pushVariable = function(sName, vValue) { if (!this.stack.hasOwnProperty(sName)) this.stack[sName] = []; @@ -204,7 +254,14 @@ cDynamicContext.prototype.popVariable = function(sName) { } } }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cStaticContext() { this.dataTypes = {}; @@ -215,17 +272,24 @@ function cStaticContext() { }; cStaticContext.prototype.baseURI = null; +// cStaticContext.prototype.dataTypes = null; cStaticContext.prototype.documents = null; +// cStaticContext.prototype.functions = null; cStaticContext.prototype.defaultFunctionNamespace = null; +// cStaticContext.prototype.collations = null; cStaticContext.prototype.defaultCollationName = sNS_XPF + "/collation/codepoint"; +// cStaticContext.prototype.collections = null; +// cStaticContext.prototype.namespaceResolver = null; cStaticContext.prototype.defaultElementNamespace = null; +// var rStaticContext_uri = /^(?:\{([^\}]+)\})?(.+)$/; +// cStaticContext.prototype.setDataType = function(sUri, fFunction) { var aMatch = sUri.match(rStaticContext_uri); if (aMatch) @@ -236,13 +300,17 @@ cStaticContext.prototype.setDataType = function(sUri, fFunction) { cStaticContext.prototype.getDataType = function(sUri) { var aMatch = sUri.match(rStaticContext_uri); if (aMatch) - return aMatch[1] == sNS_XSD ? hStaticContext_dataTypes[cRegExp.$2] : this.dataTypes[sUri]; + return aMatch[1] == sNS_XSD ? hStaticContext_dataTypes[aMatch[2]] : this.dataTypes[sUri]; }; cStaticContext.prototype.setDocument = function(sUri, fFunction) { this.documents[sUri] = fFunction; }; +cStaticContext.prototype.getDocument = function(sUri) { + return this.documents[sUri]; +}; + cStaticContext.prototype.setFunction = function(sUri, fFunction) { var aMatch = sUri.match(rStaticContext_uri); if (aMatch) @@ -253,7 +321,7 @@ cStaticContext.prototype.setFunction = function(sUri, fFunction) { cStaticContext.prototype.getFunction = function(sUri) { var aMatch = sUri.match(rStaticContext_uri); if (aMatch) - return aMatch[1] == sNS_XPF ? hStaticContext_functions[cRegExp.$2] : this.functions[sUri]; + return aMatch[1] == sNS_XPF ? hStaticContext_functions[aMatch[2]] : this.functions[sUri]; }; cStaticContext.prototype.setCollation = function(sUri, fFunction) { @@ -264,11 +332,14 @@ cStaticContext.prototype.getCollation = function(sUri) { return this.collations[sUri]; }; - cStaticContext.prototype.setCollection = function(sUri, fFunction) { this.collections[sUri] = fFunction; }; +cStaticContext.prototype.getCollection = function(sUri) { + return this.collections[sUri]; +}; + cStaticContext.prototype.getURIForPrefix = function(sPrefix) { var oResolver = this.namespaceResolver, fResolver = oResolver && oResolver.lookupNamespaceURI ? oResolver.lookupNamespaceURI : oResolver, @@ -283,22 +354,28 @@ cStaticContext.prototype.getURIForPrefix = function(sPrefix) { return sNS_XML; if (sPrefix == "xmlns") return sNS_XNS; - throw new cException("XPST0081" - , "Prefix '" + sPrefix + "' has not been declared" + // + throw new cException("XPST0081" + ); }; +// Static members +//Converts non-null JavaScript object to XML Schema object cStaticContext.js2xs = function(vItem) { - if (typeof vItem == "boolean") + // Convert types from JavaScript to XPath 2.0 + if (typeof vItem == "boolean") vItem = new cXSBoolean(vItem); else if (typeof vItem == "number") vItem =(fIsNaN(vItem) ||!fIsFinite(vItem)) ? new cXSDouble(vItem) : fNumericLiteral_parseValue(cString(vItem)); else vItem = new cXSString(cString(vItem)); - return vItem; + // + return vItem; }; +// Converts non-null XML Schema object to JavaScript object cStaticContext.xs2js = function(vItem) { if (vItem instanceof cXSBoolean) vItem = vItem.valueOf(); @@ -307,44 +384,68 @@ cStaticContext.xs2js = function(vItem) { vItem = vItem.valueOf(); else vItem = vItem.toString(); - return vItem; + // + return vItem; }; +// System functions with signatures, operators and types var hStaticContext_functions = {}, hStaticContext_signatures = {}, hStaticContext_dataTypes = {}, hStaticContext_operators = {}; function fStaticContext_defineSystemFunction(sName, aParameters, fFunction) { - hStaticContext_functions[sName] = fFunction; - hStaticContext_signatures[sName] = aParameters; + // Register function + hStaticContext_functions[sName] = fFunction; + // Register signature + hStaticContext_signatures[sName] = aParameters; }; function fStaticContext_defineSystemDataType(sName, fFunction) { - hStaticContext_dataTypes[sName] = fFunction; + // Register dataType + hStaticContext_dataTypes[sName] = fFunction; }; +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cExpression(sExpression, oStaticContext) { var oLexer = new cLexer(sExpression), oExpr = fExpr_parse(oLexer, oStaticContext); - if (!oLexer.eof()) + // + if (!oLexer.eof()) throw new cException("XPST0003" - , "Unexpected token beyond end of query" + ); - if (!oExpr) + // + if (!oExpr) throw new cException("XPST0003" - , "Expected expression" + ); this.internalExpression = oExpr; }; cExpression.prototype.internalExpression = null; +// Public methods cExpression.prototype.evaluate = function(oContext) { return this.internalExpression.evaluate(oContext); }; +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cStringCollator() { @@ -357,10 +458,18 @@ cStringCollator.prototype.equals = function(sValue1, sValue2) { cStringCollator.prototype.compare = function(sValue1, sValue2) { throw "Not implemented"; }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSConstants(){}; +// XML Schema 1.0 Datatypes cXSConstants.ANYSIMPLETYPE_DT = 1; cXSConstants.STRING_DT = 2; cXSConstants.BOOLEAN_DT = 3; @@ -407,6 +516,7 @@ cXSConstants.LISTOFUNION_DT = 43; cXSConstants.LIST_DT = 44; cXSConstants.UNAVAILABLE_DT = 45; +// XML Schema 1.1 Datatypes cXSConstants.DATETIMESTAMP_DT = 46; cXSConstants.DAYMONTHDURATION_DT = 47; cXSConstants.DAYTIMEDURATION_DT = 48; @@ -414,9 +524,18 @@ cXSConstants.PRECISIONDECIMAL_DT = 49; cXSConstants.ANYATOMICTYPE_DT = 50; cXSConstants.ANYTYPE_DT = 51; +// cXSConstants.XT_YEARMONTHDURATION_DT=-1; cXSConstants.XT_UNTYPEDATOMIC_DT =-2; +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cExpr() { this.items = []; @@ -424,36 +543,47 @@ function cExpr() { cExpr.prototype.items = null; +// Static members function fExpr_parse (oLexer, oStaticContext) { var oItem; if (oLexer.eof() ||!(oItem = fExprSingle_parse(oLexer, oStaticContext))) return; - var oExpr = new cExpr; + // Create expression + var oExpr = new cExpr; oExpr.items.push(oItem); while (oLexer.peek() == ',') { oLexer.next(); if (oLexer.eof() ||!(oItem = fExprSingle_parse(oLexer, oStaticContext))) throw new cException("XPST0003" - , "Expected expression" + ); oExpr.items.push(oItem); } return oExpr; }; +// Public members cExpr.prototype.evaluate = function(oContext) { var oSequence = []; for (var nIndex = 0, nLength = this.items.length; nIndex < nLength; nIndex++) oSequence = hStaticContext_operators["concatenate"].call(oContext, oSequence, this.items[nIndex].evaluate(oContext)); return oSequence; }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cExprSingle() { }; +// Static members function fExprSingle_parse (oLexer, oStaticContext) { if (!oLexer.eof()) return fIfExpr_parse(oLexer, oStaticContext) @@ -461,7 +591,14 @@ function fExprSingle_parse (oLexer, oStaticContext) { || fQuantifiedExpr_parse(oLexer, oStaticContext) || fOrExpr_parse(oLexer, oStaticContext); }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cForExpr() { this.bindings = []; @@ -471,6 +608,7 @@ function cForExpr() { cForExpr.prototype.bindings = null; cForExpr.prototype.returnExpr = null; +// Static members function fForExpr_parse (oLexer, oStaticContext) { if (oLexer.peek() == "for" && oLexer.peek(1).substr(0, 1) == '$') { oLexer.next(); @@ -484,13 +622,13 @@ function fForExpr_parse (oLexer, oStaticContext) { if (oLexer.peek() != "return") throw new cException("XPST0003" - , "Expected 'return' token in for expression" + ); oLexer.next(); if (oLexer.eof() ||!(oExpr = fExprSingle_parse(oLexer, oStaticContext))) throw new cException("XPST0003" - , "Expected return statement operand in for expression" + ); oForExpr.returnExpr = oExpr; @@ -498,6 +636,9 @@ function fForExpr_parse (oLexer, oStaticContext) { } }; +// Public members +// for $x in X, $y in Y, $z in Z return $x + $y + $z +// for $x in X return for $y in Y return for $z in Z return $x + $y + $z cForExpr.prototype.evaluate = function (oContext) { var oSequence = []; (function(oSelf, nBinding) { @@ -517,6 +658,7 @@ cForExpr.prototype.evaluate = function (oContext) { return oSequence; }; +// function cSimpleForBinding(sPrefix, sLocalName, sNameSpaceURI, oInExpr) { this.prefix = sPrefix; this.localName = sLocalName; @@ -533,30 +675,37 @@ function fSimpleForBinding_parse (oLexer, oStaticContext) { var aMatch = oLexer.peek().substr(1).match(rNameTest); if (!aMatch) throw new cException("XPST0003" - , "Expected binding in for expression" + ); if (aMatch[1] == '*' || aMatch[2] == '*') throw new cException("XPST0003" - , "Illegal use of wildcard in for expression binding variable name" + ); oLexer.next(); if (oLexer.peek() != "in") throw new cException("XPST0003" - , "Expected 'in' token in for expression binding" + ); oLexer.next(); var oExpr; if (oLexer.eof() ||!(oExpr = fExprSingle_parse(oLexer, oStaticContext))) throw new cException("XPST0003" - , "Expected in statement operand in for expression binding" + ); return new cSimpleForBinding(aMatch[1] || null, aMatch[2], aMatch[1] ? oStaticContext.getURIForPrefix(aMatch[1]) : null, oExpr); }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cIfExpr(oCondExpr, oThenExpr, oElseExpr) { this.condExpr = oCondExpr; @@ -568,51 +717,63 @@ cIfExpr.prototype.condExpr = null; cIfExpr.prototype.thenExpr = null; cIfExpr.prototype.elseExpr = null; +// Static members function fIfExpr_parse (oLexer, oStaticContext) { var oCondExpr, oThenExpr, oElseExpr; if (oLexer.peek() == "if" && oLexer.peek(1) == '(') { oLexer.next(2); - if (oLexer.eof() ||!(oCondExpr = fExpr_parse(oLexer, oStaticContext))) + // + if (oLexer.eof() ||!(oCondExpr = fExpr_parse(oLexer, oStaticContext))) throw new cException("XPST0003" - , "Expected if statement operand in conditional expression" + ); - if (oLexer.peek() != ')') + // + if (oLexer.peek() != ')') throw new cException("XPST0003" - , "Expected ')' token in for expression" + ); oLexer.next(); if (oLexer.peek() != "then") throw new cException("XPST0003" - , "Expected 'then' token in conditional if expression" + ); oLexer.next(); if (oLexer.eof() ||!(oThenExpr = fExprSingle_parse(oLexer, oStaticContext))) throw new cException("XPST0003" - , "Expected then statement operand in condional expression" + ); if (oLexer.peek() != "else") throw new cException("XPST0003" - , "Expected 'else' token in conditional if expression" + ); oLexer.next(); if (oLexer.eof() ||!(oElseExpr = fExprSingle_parse(oLexer, oStaticContext))) throw new cException("XPST0003" - , "Expected else statement operand in condional expression" + ); - return new cIfExpr(oCondExpr, oThenExpr, oElseExpr); + // + return new cIfExpr(oCondExpr, oThenExpr, oElseExpr); } }; +// Public members cIfExpr.prototype.evaluate = function (oContext) { return this[fFunction_sequence_toEBV(this.condExpr.evaluate(oContext), oContext) ? "thenExpr" : "elseExpr"].evaluate(oContext); }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cQuantifiedExpr(sQuantifier) { this.quantifier = sQuantifier; @@ -624,6 +785,7 @@ cQuantifiedExpr.prototype.bindings = null; cQuantifiedExpr.prototype.quantifier = null; cQuantifiedExpr.prototype.satisfiesExpr = null; +// Static members function fQuantifiedExpr_parse (oLexer, oStaticContext) { var sQuantifier = oLexer.peek(); if ((sQuantifier == "some" || sQuantifier == "every") && oLexer.peek(1).substr(0, 1) == '$') { @@ -638,13 +800,13 @@ function fQuantifiedExpr_parse (oLexer, oStaticContext) { if (oLexer.peek() != "satisfies") throw new cException("XPST0003" - , "Expected 'satisfies' token in quantified expression" + ); oLexer.next(); if (oLexer.eof() ||!(oExpr = fExprSingle_parse(oLexer, oStaticContext))) throw new cException("XPST0003" - , "Expected satisfies statement operand in quantified expression" + ); oQuantifiedExpr.satisfiesExpr = oExpr; @@ -652,8 +814,10 @@ function fQuantifiedExpr_parse (oLexer, oStaticContext) { } }; +// Public members cQuantifiedExpr.prototype.evaluate = function (oContext) { - var bEvery = this.quantifier == "every", + // TODO: re-factor + var bEvery = this.quantifier == "every", bResult = bEvery ? true : false; (function(oSelf, nBinding) { var oBinding = oSelf.bindings[nBinding++], @@ -674,6 +838,7 @@ cQuantifiedExpr.prototype.evaluate = function (oContext) { +// function cSimpleQuantifiedBinding(sPrefix, sLocalName, sNameSpaceURI, oInExpr) { this.prefix = sPrefix; this.localName = sLocalName; @@ -690,30 +855,37 @@ function fSimpleQuantifiedBinding_parse (oLexer, oStaticContext) { var aMatch = oLexer.peek().substr(1).match(rNameTest); if (!aMatch) throw new cException("XPST0003" - , "Expected binding in quantified expression" + ); if (aMatch[1] == '*' || aMatch[2] == '*') throw new cException("XPST0003" - , "Illegal use of wildcard in quantified expression binding variable name" + ); oLexer.next(); if (oLexer.peek() != "in") throw new cException("XPST0003" - , "Expected 'in' token in quantified expression binding" + ); oLexer.next(); var oExpr; if (oLexer.eof() ||!(oExpr = fExprSingle_parse(oLexer, oStaticContext))) throw new cException("XPST0003" - , "Expected in statement operand in quantified expression binding" + ); return new cSimpleQuantifiedBinding(aMatch[1] || null, aMatch[2], aMatch[1] ? oStaticContext.getURIForPrefix(aMatch[1]) : null, oExpr); }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cComparisonExpr(oLeft, oRight, sOperator) { this.left = oLeft; @@ -725,6 +897,7 @@ cComparisonExpr.prototype.left = null; cComparisonExpr.prototype.right = null; cComparisonExpr.prototype.operator = null; +// Static members function fComparisonExpr_parse (oLexer, oStaticContext) { var oExpr, oRight; @@ -733,20 +906,23 @@ function fComparisonExpr_parse (oLexer, oStaticContext) { if (!(oLexer.peek() in hComparisonExpr_operators)) return oExpr; - var sOperator = oLexer.peek(); + // Comparison expression + var sOperator = oLexer.peek(); oLexer.next(); if (oLexer.eof() ||!(oRight = fRangeExpr_parse(oLexer, oStaticContext))) throw new cException("XPST0003" - , "Expected second operand in comparison expression" + ); return new cComparisonExpr(oExpr, oRight, sOperator); }; +// Public members cComparisonExpr.prototype.evaluate = function (oContext) { var oResult = hComparisonExpr_operators[this.operator](this, oContext); return oResult == null ? [] : [oResult]; }; +// General comparison function fComparisonExpr_GeneralComp(oExpr, oContext) { var oLeft = fFunction_sequence_atomize(oExpr.left.evaluate(oContext), oContext); if (!oLeft.length) @@ -767,33 +943,40 @@ function fComparisonExpr_GeneralComp(oExpr, oContext) { bRight = vRight instanceof cXSUntypedAtomic; if (bLeft && bRight) { - vLeft = cXSString.cast(vLeft); + // cast xs:untypedAtomic to xs:string + vLeft = cXSString.cast(vLeft); vRight = cXSString.cast(vRight); } else { - if (bLeft) { - if (vRight instanceof cXSDayTimeDuration) + // + if (bLeft) { + // Special: durations + if (vRight instanceof cXSDayTimeDuration) vLeft = cXSDayTimeDuration.cast(vLeft); else if (vRight instanceof cXSYearMonthDuration) vLeft = cXSYearMonthDuration.cast(vLeft); else - if (vRight.primitiveKind) + // + if (vRight.primitiveKind) vLeft = hStaticContext_dataTypes[vRight.primitiveKind].cast(vLeft); } else if (bRight) { - if (vLeft instanceof cXSDayTimeDuration) + // Special: durations + if (vLeft instanceof cXSDayTimeDuration) vRight = cXSDayTimeDuration.cast(vRight); else if (vLeft instanceof cXSYearMonthDuration) vRight = cXSYearMonthDuration.cast(vRight); else - if (vLeft.primitiveKind) + // + if (vLeft.primitiveKind) vRight = hStaticContext_dataTypes[vLeft.primitiveKind].cast(vRight); } - if (vLeft instanceof cXSAnyURI) + // cast xs:anyURI to xs:string + if (vLeft instanceof cXSAnyURI) vLeft = cXSString.cast(vLeft); if (vRight instanceof cXSAnyURI) vRight = cXSString.cast(vRight); @@ -814,37 +997,44 @@ var hComparisonExpr_GeneralComp_map = { '<=': 'le' }; +// Value comparison function fComparisonExpr_ValueComp(oExpr, oContext) { var oLeft = fFunction_sequence_atomize(oExpr.left.evaluate(oContext), oContext); if (!oLeft.length) return null; - fFunctionCall_assertSequenceCardinality(oContext, oLeft, '?' - , "first operand of '" + oExpr.operator + "'" + // Assert cardinality + fFunctionCall_assertSequenceCardinality(oContext, oLeft, '?' + ); var oRight = fFunction_sequence_atomize(oExpr.right.evaluate(oContext), oContext); if (!oRight.length) return null; - fFunctionCall_assertSequenceCardinality(oContext, oRight, '?' - , "second operand of '" + oExpr.operator + "'" + // Assert cardinality + fFunctionCall_assertSequenceCardinality(oContext, oRight, '?' + ); var vLeft = oLeft[0], vRight = oRight[0]; - if (vLeft instanceof cXSUntypedAtomic) + // cast xs:untypedAtomic to xs:string + if (vLeft instanceof cXSUntypedAtomic) vLeft = cXSString.cast(vLeft); if (vRight instanceof cXSUntypedAtomic) vRight = cXSString.cast(vRight); - if (vLeft instanceof cXSAnyURI) + // cast xs:anyURI to xs:string + if (vLeft instanceof cXSAnyURI) vLeft = cXSString.cast(vLeft); if (vRight instanceof cXSAnyURI) vRight = cXSString.cast(vRight); - return hComparisonExpr_ValueComp_operators[oExpr.operator](vLeft, vRight, oContext); + // + return hComparisonExpr_ValueComp_operators[oExpr.operator](vLeft, vRight, oContext); }; +// var hComparisonExpr_ValueComp_operators = {}; hComparisonExpr_ValueComp_operators['eq'] = function(oLeft, oRight, oContext) { var sOperator = ''; @@ -908,7 +1098,8 @@ hComparisonExpr_ValueComp_operators['eq'] = function(oLeft, oRight, oContext) { if (oRight instanceof cXSGDay) sOperator = "gDay-equal"; } - else + // skipped: xs:anyURI (covered by xs:string) + else if (oLeft instanceof cXSQName) { if (oRight instanceof cXSQName) sOperator = "QName-equal"; @@ -924,12 +1115,15 @@ hComparisonExpr_ValueComp_operators['eq'] = function(oLeft, oRight, oContext) { sOperator = "base64Binary-equal"; } - if (sOperator) + // Call operator function + if (sOperator) return hStaticContext_operators[sOperator].call(oContext, oLeft, oRight); - throw new cException("XPTY0004" - , "Cannot compare values of given types" - ); }; + // skipped: xs:NOTATION + throw new cException("XPTY0004" + + ); // Cannot compare {type1} to {type2} +}; hComparisonExpr_ValueComp_operators['ne'] = function(oLeft, oRight, oContext) { return new cXSBoolean(!hComparisonExpr_ValueComp_operators['eq'](oLeft, oRight, oContext).valueOf()); }; @@ -976,12 +1170,15 @@ hComparisonExpr_ValueComp_operators['gt'] = function(oLeft, oRight, oContext) { sOperator = "dayTimeDuration-greater-than"; } - if (sOperator) + // Call operator function + if (sOperator) return hStaticContext_operators[sOperator].call(oContext, oLeft, oRight); - throw new cException("XPTY0004" - , "Cannot compare values of given types" - ); }; + // skipped: xs:anyURI (covered by xs:string) + throw new cException("XPTY0004" + + ); // Cannot compare {type1} to {type2} +}; hComparisonExpr_ValueComp_operators['lt'] = function(oLeft, oRight, oContext) { var sOperator = ''; @@ -1025,12 +1222,15 @@ hComparisonExpr_ValueComp_operators['lt'] = function(oLeft, oRight, oContext) { sOperator = "dayTimeDuration-less-than"; } - if (sOperator) + // Call operator function + if (sOperator) return hStaticContext_operators[sOperator].call(oContext, oLeft, oRight); - throw new cException("XPTY0004" - , "Cannot compare values of given types" - ); }; + // skipped: xs:anyURI (covered by xs:string) + throw new cException("XPTY0004" + + ); // Cannot compare {type1} to {type2} +}; hComparisonExpr_ValueComp_operators['ge'] = function(oLeft, oRight, oContext) { var sOperator = ''; @@ -1074,12 +1274,15 @@ hComparisonExpr_ValueComp_operators['ge'] = function(oLeft, oRight, oContext) { sOperator = "dayTimeDuration-less-than"; } - if (sOperator) + // Call operator function + if (sOperator) return new cXSBoolean(!hStaticContext_operators[sOperator].call(oContext, oLeft, oRight).valueOf()); - throw new cException("XPTY0004" - , "Cannot compare values of given types" - ); }; + // skipped: xs:anyURI (covered by xs:string) + throw new cException("XPTY0004" + + ); // Cannot compare {type1} to {type2} +}; hComparisonExpr_ValueComp_operators['le'] = function(oLeft, oRight, oContext) { var sOperator = ''; @@ -1123,32 +1326,40 @@ hComparisonExpr_ValueComp_operators['le'] = function(oLeft, oRight, oContext) { sOperator = "dayTimeDuration-greater-than"; } - if (sOperator) + // Call operator function + if (sOperator) return new cXSBoolean(!hStaticContext_operators[sOperator].call(oContext, oLeft, oRight).valueOf()); - throw new cException("XPTY0004" - , "Cannot compare values of given types" - ); }; + // skipped: xs:anyURI (covered by xs:string) + throw new cException("XPTY0004" + ); // Cannot compare {type1} to {type2} +}; + +// Node comparison function fComparisonExpr_NodeComp(oExpr, oContext) { var oLeft = oExpr.left.evaluate(oContext); if (!oLeft.length) return null; - fFunctionCall_assertSequenceCardinality(oContext, oLeft, '?' - , "first operand of '" + oExpr.operator + "'" + // Assert cardinality + fFunctionCall_assertSequenceCardinality(oContext, oLeft, '?' + ); - fFunctionCall_assertSequenceItemType(oContext, oLeft, cXTNode - , "first operand of '" + oExpr.operator + "'" + // Assert item type + fFunctionCall_assertSequenceItemType(oContext, oLeft, cXTNode + ); var oRight = oExpr.right.evaluate(oContext); if (!oRight.length) return null; - fFunctionCall_assertSequenceCardinality(oContext, oRight, '?' - , "second operand of '" + oExpr.operator + "'" + // Assert cardinality + fFunctionCall_assertSequenceCardinality(oContext, oRight, '?' + ); - fFunctionCall_assertSequenceItemType(oContext, oRight, cXTNode - , "second operand of '" + oExpr.operator + "'" + // Assert item type + fFunctionCall_assertSequenceItemType(oContext, oRight, cXTNode + ); return hComparisonExpr_NodeComp_operators[oExpr.operator](oLeft[0], oRight[0], oContext); @@ -1165,24 +1376,35 @@ hComparisonExpr_NodeComp_operators['<<'] = function(oLeft, oRight, oContext) { return hStaticContext_operators["node-before"].call(oContext, oLeft, oRight); }; +// Operators var hComparisonExpr_operators = { - '=': fComparisonExpr_GeneralComp, + // GeneralComp + '=': fComparisonExpr_GeneralComp, '!=': fComparisonExpr_GeneralComp, '<': fComparisonExpr_GeneralComp, '<=': fComparisonExpr_GeneralComp, '>': fComparisonExpr_GeneralComp, '>=': fComparisonExpr_GeneralComp, - 'eq': fComparisonExpr_ValueComp, + // ValueComp + 'eq': fComparisonExpr_ValueComp, 'ne': fComparisonExpr_ValueComp, 'lt': fComparisonExpr_ValueComp, 'le': fComparisonExpr_ValueComp, 'gt': fComparisonExpr_ValueComp, 'ge': fComparisonExpr_ValueComp, - 'is': fComparisonExpr_NodeComp, + // NodeComp + 'is': fComparisonExpr_NodeComp, '>>': fComparisonExpr_NodeComp, '<<': fComparisonExpr_NodeComp }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cAdditiveExpr(oExpr) { this.left = oExpr; @@ -1192,6 +1414,7 @@ function cAdditiveExpr(oExpr) { cAdditiveExpr.prototype.left = null; cAdditiveExpr.prototype.items = null; +// var hAdditiveExpr_operators = {}; hAdditiveExpr_operators['+'] = function(oLeft, oRight, oContext) { var sOperator = '', @@ -1258,12 +1481,15 @@ hAdditiveExpr_operators['+'] = function(oLeft, oRight, oContext) { sOperator = "add-dayTimeDuration-to-dateTime"; } - if (sOperator) + // Call operator function + if (sOperator) return hStaticContext_operators[sOperator].call(oContext, bReverse ? oRight : oLeft, bReverse ? oLeft : oRight); - throw new cException("XPTY0004" - , "Arithmetic operator is not defined for provided arguments" - ); }; + // + throw new cException("XPTY0004" + + ); // Arithmetic operator is not defined for arguments of types ({type1}, {type2}) +}; hAdditiveExpr_operators['-'] = function (oLeft, oRight, oContext) { var sOperator = ''; @@ -1312,13 +1538,17 @@ hAdditiveExpr_operators['-'] = function (oLeft, oRight, oContext) { sOperator = "subtract-dayTimeDurations"; } - if (sOperator) + // Call operator function + if (sOperator) return hStaticContext_operators[sOperator].call(oContext, oLeft, oRight); - throw new cException("XPTY0004" - , "Arithmetic operator is not defined for provided arguments" - ); }; + // + throw new cException("XPTY0004" + ); // Arithmetic operator is not defined for arguments of types ({type1}, {type2}) +}; + +// Static members function fAdditiveExpr_parse (oLexer, oStaticContext) { var oExpr; if (oLexer.eof() ||!(oExpr = fMultiplicativeExpr_parse(oLexer, oStaticContext))) @@ -1326,48 +1556,61 @@ function fAdditiveExpr_parse (oLexer, oStaticContext) { if (!(oLexer.peek() in hAdditiveExpr_operators)) return oExpr; - var oAdditiveExpr = new cAdditiveExpr(oExpr), + // Additive expression + var oAdditiveExpr = new cAdditiveExpr(oExpr), sOperator; while ((sOperator = oLexer.peek()) in hAdditiveExpr_operators) { oLexer.next(); if (oLexer.eof() ||!(oExpr = fMultiplicativeExpr_parse(oLexer, oStaticContext))) throw new cException("XPST0003" - , "Expected second operand in additive expression" + ); oAdditiveExpr.items.push([sOperator, oExpr]); } return oAdditiveExpr; }; +// Public members cAdditiveExpr.prototype.evaluate = function (oContext) { var oLeft = fFunction_sequence_atomize(this.left.evaluate(oContext), oContext); if (!oLeft.length) return []; - fFunctionCall_assertSequenceCardinality(oContext, oLeft, '?' - , "first operand of '" + this.items[0][0] + "'" + // Assert cardinality + fFunctionCall_assertSequenceCardinality(oContext, oLeft, '?' + ); var vLeft = oLeft[0]; if (vLeft instanceof cXSUntypedAtomic) - vLeft = cXSDouble.cast(vLeft); + vLeft = cXSDouble.cast(vLeft); // cast to xs:double + for (var nIndex = 0, nLength = this.items.length, oRight, vRight; nIndex < nLength; nIndex++) { oRight = fFunction_sequence_atomize(this.items[nIndex][1].evaluate(oContext), oContext); if (!oRight.length) return []; - fFunctionCall_assertSequenceCardinality(oContext, oRight, '?' - , "first operand of '" + this.items[nIndex][0] + "'" + // Assert cardinality + fFunctionCall_assertSequenceCardinality(oContext, oRight, '?' + ); vRight = oRight[0]; if (vRight instanceof cXSUntypedAtomic) - vRight = cXSDouble.cast(vRight); + vRight = cXSDouble.cast(vRight); // cast to xs:double + vLeft = hAdditiveExpr_operators[this.items[nIndex][0]](vLeft, vRight, oContext); } return [vLeft]; }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cMultiplicativeExpr(oExpr) { this.left = oExpr; @@ -1377,6 +1620,7 @@ function cMultiplicativeExpr(oExpr) { cMultiplicativeExpr.prototype.left = null; cMultiplicativeExpr.prototype.items = null; +// var hMultiplicativeExpr_operators = {}; hMultiplicativeExpr_operators['*'] = function (oLeft, oRight, oContext) { var sOperator = '', @@ -1408,12 +1652,15 @@ hMultiplicativeExpr_operators['*'] = function (oLeft, oRight, oContext) { } } - if (sOperator) + // Call operator function + if (sOperator) return hStaticContext_operators[sOperator].call(oContext, bReverse ? oRight : oLeft, bReverse ? oLeft : oRight); - throw new cException("XPTY0004" - , "Arithmetic operator is not defined for provided arguments" - ); }; + // + throw new cException("XPTY0004" + + ); // Arithmetic operator is not defined for arguments of types ({type1}, {type2}) +}; hMultiplicativeExpr_operators['div'] = function (oLeft, oRight, oContext) { var sOperator = ''; @@ -1437,25 +1684,33 @@ hMultiplicativeExpr_operators['div'] = function (oLeft, oRight, oContext) { if (oRight instanceof cXSDayTimeDuration) sOperator = "divide-dayTimeDuration-by-dayTimeDuration"; } - if (sOperator) + // Call operator function + if (sOperator) return hStaticContext_operators[sOperator].call(oContext, oLeft, oRight); - throw new cException("XPTY0004" - , "Arithmetic operator is not defined for provided arguments" - ); }; + // + throw new cException("XPTY0004" + + ); // Arithmetic operator is not defined for arguments of types ({type1}, {type2}) +}; hMultiplicativeExpr_operators['idiv'] = function (oLeft, oRight, oContext) { if (fXSAnyAtomicType_isNumeric(oLeft) && fXSAnyAtomicType_isNumeric(oRight)) return hStaticContext_operators["numeric-integer-divide"].call(oContext, oLeft, oRight); - throw new cException("XPTY0004" - , "Arithmetic operator is not defined for provided arguments" - ); }; + // + throw new cException("XPTY0004" + + ); // Arithmetic operator is not defined for arguments of types ({type1}, {type2}) +}; hMultiplicativeExpr_operators['mod'] = function (oLeft, oRight, oContext) { if (fXSAnyAtomicType_isNumeric(oLeft) && fXSAnyAtomicType_isNumeric(oRight)) return hStaticContext_operators["numeric-mod"].call(oContext, oLeft, oRight); - throw new cException("XPTY0004" - , "Arithmetic operator is not defined for provided arguments" - ); }; + // + throw new cException("XPTY0004" + ); // Arithmetic operator is not defined for arguments of types ({type1}, {type2}) +}; + +// Static members function fMultiplicativeExpr_parse (oLexer, oStaticContext) { var oExpr; if (oLexer.eof() ||!(oExpr = fUnionExpr_parse(oLexer, oStaticContext))) @@ -1463,48 +1718,62 @@ function fMultiplicativeExpr_parse (oLexer, oStaticContext) { if (!(oLexer.peek() in hMultiplicativeExpr_operators)) return oExpr; - var oMultiplicativeExpr = new cMultiplicativeExpr(oExpr), + // Additive expression + var oMultiplicativeExpr = new cMultiplicativeExpr(oExpr), sOperator; while ((sOperator = oLexer.peek()) in hMultiplicativeExpr_operators) { oLexer.next(); if (oLexer.eof() ||!(oExpr = fUnionExpr_parse(oLexer, oStaticContext))) throw new cException("XPST0003" - , "Expected second operand in multiplicative expression" + ); oMultiplicativeExpr.items.push([sOperator, oExpr]); } return oMultiplicativeExpr; }; +// Public members cMultiplicativeExpr.prototype.evaluate = function (oContext) { var oLeft = fFunction_sequence_atomize(this.left.evaluate(oContext), oContext); - if (!oLeft.length) + // + if (!oLeft.length) return []; - fFunctionCall_assertSequenceCardinality(oContext, oLeft, '?' - , "first operand of '" + this.items[0][0] + "'" + // Assert cardinality + fFunctionCall_assertSequenceCardinality(oContext, oLeft, '?' + ); var vLeft = oLeft[0]; if (vLeft instanceof cXSUntypedAtomic) - vLeft = cXSDouble.cast(vLeft); + vLeft = cXSDouble.cast(vLeft); // cast to xs:double + for (var nIndex = 0, nLength = this.items.length, oRight, vRight; nIndex < nLength; nIndex++) { oRight = fFunction_sequence_atomize(this.items[nIndex][1].evaluate(oContext), oContext); if (!oRight.length) return []; - fFunctionCall_assertSequenceCardinality(oContext, oRight, '?' - , "second operand of '" + this.items[nIndex][0] + "'" + // Assert cardinality + fFunctionCall_assertSequenceCardinality(oContext, oRight, '?' + ); vRight = oRight[0]; if (vRight instanceof cXSUntypedAtomic) - vRight = cXSDouble.cast(vRight); + vRight = cXSDouble.cast(vRight); // cast to xs:double + vLeft = hMultiplicativeExpr_operators[this.items[nIndex][0]](vLeft, vRight, oContext); } return [vLeft]; }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cUnaryExpr(sOperator, oExpr) { this.operator = sOperator; @@ -1514,27 +1783,35 @@ function cUnaryExpr(sOperator, oExpr) { cUnaryExpr.prototype.operator = null; cUnaryExpr.prototype.expression = null; +// var hUnaryExpr_operators = {}; hUnaryExpr_operators['-'] = function(oRight, oContext) { if (fXSAnyAtomicType_isNumeric(oRight)) return hStaticContext_operators["numeric-unary-minus"].call(oContext, oRight); - throw new cException("XPTY0004" - , "Arithmetic operator is not defined for provided arguments" - ); }; + // + throw new cException("XPTY0004" + + ); // Arithmetic operator is not defined for arguments of types ({type1}, {type2}) +}; hUnaryExpr_operators['+'] = function(oRight, oContext) { if (fXSAnyAtomicType_isNumeric(oRight)) return hStaticContext_operators["numeric-unary-plus"].call(oContext, oRight); - throw new cException("XPTY0004" - , "Arithmetic operator is not defined for provided arguments" - ); }; + // + throw new cException("XPTY0004" + ); // Arithmetic operator is not defined for arguments of types ({type1}, {type2}) +}; + +// Static members +// UnaryExpr := ("-" | "+")* ValueExpr function fUnaryExpr_parse (oLexer, oStaticContext) { if (oLexer.eof()) return; if (!(oLexer.peek() in hUnaryExpr_operators)) return fValueExpr_parse(oLexer, oStaticContext); - var sOperator = '+', + // Unary expression + var sOperator = '+', oExpr; while (oLexer.peek() in hUnaryExpr_operators) { if (oLexer.peek() == '-') @@ -1543,7 +1820,7 @@ function fUnaryExpr_parse (oLexer, oStaticContext) { } if (oLexer.eof() ||!(oExpr = fValueExpr_parse(oLexer, oStaticContext))) throw new cException("XPST0003" - , "Expected operand in unary expression" + ); return new cUnaryExpr(sOperator, oExpr); }; @@ -1551,27 +1828,46 @@ function fUnaryExpr_parse (oLexer, oStaticContext) { cUnaryExpr.prototype.evaluate = function (oContext) { var oRight = fFunction_sequence_atomize(this.expression.evaluate(oContext), oContext); - if (!oRight.length) + // + if (!oRight.length) return []; - fFunctionCall_assertSequenceCardinality(oContext, oRight, '?' - , "second operand of '" + this.operator + "'" + // Assert cardinality + fFunctionCall_assertSequenceCardinality(oContext, oRight, '?' + ); var vRight = oRight[0]; if (vRight instanceof cXSUntypedAtomic) - vRight = cXSDouble.cast(vRight); + vRight = cXSDouble.cast(vRight); // cast to xs:double + return [hUnaryExpr_operators[this.operator](vRight, oContext)]; }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cValueExpr() { }; +// Static members function fValueExpr_parse (oLexer, oStaticContext) { return fPathExpr_parse(oLexer, oStaticContext); }; +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cOrExpr(oExpr) { this.left = oExpr; @@ -1581,6 +1877,7 @@ function cOrExpr(oExpr) { cOrExpr.prototype.left = null; cOrExpr.prototype.items = null; +// Static members function fOrExpr_parse (oLexer, oStaticContext) { var oExpr; if (oLexer.eof() ||!(oExpr = fAndExpr_parse(oLexer, oStaticContext))) @@ -1588,25 +1885,34 @@ function fOrExpr_parse (oLexer, oStaticContext) { if (oLexer.peek() != "or") return oExpr; - var oOrExpr = new cOrExpr(oExpr); + // Or expression + var oOrExpr = new cOrExpr(oExpr); while (oLexer.peek() == "or") { oLexer.next(); if (oLexer.eof() ||!(oExpr = fAndExpr_parse(oLexer, oStaticContext))) throw new cException("XPST0003" - , "Expected second operand in logical expression" + ); oOrExpr.items.push(oExpr); } return oOrExpr; }; +// Public members cOrExpr.prototype.evaluate = function (oContext) { var bValue = fFunction_sequence_toEBV(this.left.evaluate(oContext), oContext); for (var nIndex = 0, nLength = this.items.length; (nIndex < nLength) && !bValue; nIndex++) bValue = fFunction_sequence_toEBV(this.items[nIndex].evaluate(oContext), oContext); return [new cXSBoolean(bValue)]; }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cAndExpr(oExpr) { this.left = oExpr; @@ -1616,6 +1922,7 @@ function cAndExpr(oExpr) { cAndExpr.prototype.left = null; cAndExpr.prototype.items = null; +// Static members function fAndExpr_parse (oLexer, oStaticContext) { var oExpr; if (oLexer.eof() ||!(oExpr = fComparisonExpr_parse(oLexer, oStaticContext))) @@ -1623,25 +1930,34 @@ function fAndExpr_parse (oLexer, oStaticContext) { if (oLexer.peek() != "and") return oExpr; - var oAndExpr = new cAndExpr(oExpr); + // And expression + var oAndExpr = new cAndExpr(oExpr); while (oLexer.peek() == "and") { oLexer.next(); if (oLexer.eof() ||!(oExpr = fComparisonExpr_parse(oLexer, oStaticContext))) throw new cException("XPST0003" - , "Expected second operand in logical expression" + ); oAndExpr.items.push(oExpr); } return oAndExpr; }; +// Public members cAndExpr.prototype.evaluate = function (oContext) { var bValue = fFunction_sequence_toEBV(this.left.evaluate(oContext), oContext); for (var nIndex = 0, nLength = this.items.length; (nIndex < nLength) && bValue; nIndex++) bValue = fFunction_sequence_toEBV(this.items[nIndex].evaluate(oContext), oContext); return [new cXSBoolean(bValue)]; }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cStepExpr() { @@ -1649,6 +1965,7 @@ function cStepExpr() { cStepExpr.prototype.predicates = null; +// Static members function fStepExpr_parse (oLexer, oStaticContext) { if (!oLexer.eof()) return fFilterExpr_parse(oLexer, oStaticContext) @@ -1657,38 +1974,44 @@ function fStepExpr_parse (oLexer, oStaticContext) { function fStepExpr_parsePredicates (oLexer, oStaticContext, oStep) { var oExpr; - while (oLexer.peek() == '[') { + // Parse predicates + while (oLexer.peek() == '[') { oLexer.next(); if (oLexer.eof() ||!(oExpr = fExpr_parse(oLexer, oStaticContext))) throw new cException("XPST0003" - , "Expected expression in predicate" + ); oStep.predicates.push(oExpr); if (oLexer.peek() != ']') throw new cException("XPST0003" - , "Expected ']' token in predicate" + ); oLexer.next(); } }; +// Public members cStepExpr.prototype.applyPredicates = function(oSequence, oContext) { var vContextItem = oContext.item, nContextPosition= oContext.position, nContextSize = oContext.size; - for (var nPredicateIndex = 0, oSequence1, nPredicateLength = this.predicates.length; nPredicateIndex < nPredicateLength; nPredicateIndex++) { + // + for (var nPredicateIndex = 0, oSequence1, nPredicateLength = this.predicates.length; nPredicateIndex < nPredicateLength; nPredicateIndex++) { oSequence1 = oSequence; oSequence = []; for (var nIndex = 0, oSequence2, nLength = oSequence1.length; nIndex < nLength; nIndex++) { - oContext.item = oSequence1[nIndex]; + // Set new context + oContext.item = oSequence1[nIndex]; oContext.position = nIndex + 1; oContext.size = nLength; - oSequence2 = this.predicates[nPredicateIndex].evaluate(oContext); - if (oSequence2.length == 1 && fXSAnyAtomicType_isNumeric(oSequence2[0])) { + // + oSequence2 = this.predicates[nPredicateIndex].evaluate(oContext); + // + if (oSequence2.length == 1 && fXSAnyAtomicType_isNumeric(oSequence2[0])) { if (oSequence2[0].valueOf() == nIndex + 1) oSequence.push(oSequence1[nIndex]); } @@ -1697,12 +2020,21 @@ cStepExpr.prototype.applyPredicates = function(oSequence, oContext) { oSequence.push(oSequence1[nIndex]); } } - oContext.item = vContextItem; + // Restore context + oContext.item = vContextItem; oContext.position = nContextPosition; oContext.size = nContextSize; - return oSequence; + // + return oSequence; }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cAxisStep(sAxis, oTest) { this.axis = sAxis; @@ -1715,7 +2047,9 @@ cAxisStep.prototype = new cStepExpr; cAxisStep.prototype.axis = null; cAxisStep.prototype.test = null; +// var hAxisStep_axises = {}; +// Forward axis hAxisStep_axises["attribute"] = {}; hAxisStep_axises["child"] = {}; hAxisStep_axises["descendant"] = {}; @@ -1723,12 +2057,15 @@ hAxisStep_axises["descendant-or-self"] = {}; hAxisStep_axises["following"] = {}; hAxisStep_axises["following-sibling"] = {}; hAxisStep_axises["self"] = {}; +// hAxisStep_axises["namespace"] = {}; // deprecated in 2.0 +// Reverse axis hAxisStep_axises["ancestor"] = {}; hAxisStep_axises["ancestor-or-self"] = {}; hAxisStep_axises["parent"] = {}; hAxisStep_axises["preceding"] = {}; hAxisStep_axises["preceding-sibling"] = {}; +// Static members function fAxisStep_parse (oLexer, oStaticContext) { var sAxis = oLexer.peek(), oExpr, @@ -1736,15 +2073,16 @@ function fAxisStep_parse (oLexer, oStaticContext) { if (oLexer.peek(1) == '::') { if (!(sAxis in hAxisStep_axises)) throw new cException("XPST0003" - , "Unknown axis name: " + sAxis + ); oLexer.next(2); if (oLexer.eof() ||!(oExpr = fNodeTest_parse(oLexer, oStaticContext))) throw new cException("XPST0003" - , "Expected node test expression in axis step" + ); - oStep = new cAxisStep(sAxis, oExpr); + // + oStep = new cAxisStep(sAxis, oExpr); } else if (sAxis == '..') { @@ -1756,20 +2094,23 @@ function fAxisStep_parse (oLexer, oStaticContext) { oLexer.next(); if (oLexer.eof() ||!(oExpr = fNodeTest_parse(oLexer, oStaticContext))) throw new cException("XPST0003" - , "Expected node test expression in axis step" + ); - oStep = new cAxisStep("attribute", oExpr); + // + oStep = new cAxisStep("attribute", oExpr); } else { if (oLexer.eof() ||!(oExpr = fNodeTest_parse(oLexer, oStaticContext))) return; oStep = new cAxisStep(oExpr instanceof cKindTest && oExpr.name == "attribute" ? "attribute" : "child", oExpr); } - fStepExpr_parsePredicates(oLexer, oStaticContext, oStep); + // + fStepExpr_parsePredicates(oLexer, oStaticContext, oStep); return oStep; }; +// Public members cAxisStep.prototype.evaluate = function (oContext) { var oItem = oContext.item; @@ -1781,7 +2122,8 @@ cAxisStep.prototype.evaluate = function (oContext) { nType = fGetProperty(oItem, "nodeType"); switch (this.axis) { - case "attribute": + // Forward axis + case "attribute": if (nType == 1) for (var aAttributes = fGetProperty(oItem, "attributes"), nIndex = 0, nLength = aAttributes.length; nIndex < nLength; nIndex++) oSequence.push(aAttributes[nIndex]); @@ -1794,12 +2136,14 @@ cAxisStep.prototype.evaluate = function (oContext) { case "descendant-or-self": oSequence.push(oItem); - case "descendant": + // No break left intentionally + case "descendant": fAxisStep_getChildrenForward(fGetProperty(oItem, "firstChild"), oSequence, fGetProperty); break; case "following": - for (var oParent = oItem, oSibling; oParent; oParent = fGetProperty(oParent, "parentNode")) + // TODO: Attribute node context + for (var oParent = oItem, oSibling; oParent; oParent = fGetProperty(oParent, "parentNode")) if (oSibling = fGetProperty(oParent, "nextSibling")) fAxisStep_getChildrenForward(oSibling, oSequence, fGetProperty); break; @@ -1813,9 +2157,11 @@ cAxisStep.prototype.evaluate = function (oContext) { oSequence.push(oItem); break; - case "ancestor-or-self": + // Reverse axis + case "ancestor-or-self": oSequence.push(oItem); - case "ancestor": + // No break left intentionally + case "ancestor": for (var oNode = nType == 2 ? fGetProperty(oItem, "ownerElement") : oItem; oNode = fGetProperty(oNode, "parentNode");) oSequence.push(oNode); break; @@ -1827,7 +2173,8 @@ cAxisStep.prototype.evaluate = function (oContext) { break; case "preceding": - for (var oParent = oItem, oSibling; oParent; oParent = fGetProperty(oParent, "parentNode")) + // TODO: Attribute node context + for (var oParent = oItem, oSibling; oParent; oParent = fGetProperty(oParent, "parentNode")) if (oSibling = fGetProperty(oParent, "previousSibling")) fAxisStep_getChildrenBackward(oSibling, oSequence, fGetProperty); break; @@ -1838,7 +2185,8 @@ cAxisStep.prototype.evaluate = function (oContext) { break; } - if (oSequence.length && !(this.test instanceof cKindTest && this.test.name == "node")) { + // Apply test + if (oSequence.length && !(this.test instanceof cKindTest && this.test.name == "node")) { var oSequence1 = oSequence; oSequence = []; for (var nIndex = 0, nLength = oSequence1.length; nIndex < nLength; nIndex++) { @@ -1847,10 +2195,12 @@ cAxisStep.prototype.evaluate = function (oContext) { } } - if (oSequence.length && this.predicates.length) + // Apply predicates + if (oSequence.length && this.predicates.length) oSequence = this.applyPredicates(oSequence, oContext); - switch (this.axis) { + // Reverse results if reverse axis + switch (this.axis) { case "ancestor": case "ancestor-or-self": case "parent": @@ -1862,6 +2212,7 @@ cAxisStep.prototype.evaluate = function (oContext) { return oSequence; }; +// function fAxisStep_getChildrenForward(oNode, oSequence, fGetProperty) { for (var oChild; oNode; oNode = fGetProperty(oNode, "nextSibling")) { oSequence.push(oNode); @@ -1877,7 +2228,14 @@ function fAxisStep_getChildrenBackward(oNode, oSequence, fGetProperty) { oSequence.push(oNode); } }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cPathExpr() { this.items = []; @@ -1885,6 +2243,7 @@ function cPathExpr() { cPathExpr.prototype.items = null; +// Static members function fPathExpr_parse (oLexer, oStaticContext) { if (oLexer.eof()) return; @@ -1894,48 +2253,60 @@ function fPathExpr_parse (oLexer, oStaticContext) { var oPathExpr = new cPathExpr(), sSlash = oLexer.peek(), oExpr; - if (sSlash == sDoubleSlash || sSlash == sSingleSlash) { + // Parse first step + if (sSlash == sDoubleSlash || sSlash == sSingleSlash) { oLexer.next(); oPathExpr.items.push(new cFunctionCall(null, "root", sNS_XPF)); - if (sSlash == sDoubleSlash) + // + if (sSlash == sDoubleSlash) oPathExpr.items.push(new cAxisStep("descendant-or-self", new cKindTest("node"))); } - if (oLexer.eof() ||!(oExpr = fStepExpr_parse(oLexer, oStaticContext))) { + // + if (oLexer.eof() ||!(oExpr = fStepExpr_parse(oLexer, oStaticContext))) { if (sSlash == sSingleSlash) - return oPathExpr.items[0]; if (sSlash == sDoubleSlash) + return oPathExpr.items[0]; // '/' expression + if (sSlash == sDoubleSlash) throw new cException("XPST0003" - , "Expected path step expression" + ); return; } oPathExpr.items.push(oExpr); - while ((sSlash = oLexer.peek()) == sSingleSlash || sSlash == sDoubleSlash) { + // Parse other steps + while ((sSlash = oLexer.peek()) == sSingleSlash || sSlash == sDoubleSlash) { if (sSlash == sDoubleSlash) oPathExpr.items.push(new cAxisStep("descendant-or-self", new cKindTest("node"))); - oLexer.next(); + // + oLexer.next(); if (oLexer.eof() ||!(oExpr = fStepExpr_parse(oLexer, oStaticContext))) throw new cException("XPST0003" - , "Expected path step expression" + ); - oPathExpr.items.push(oExpr); + // + oPathExpr.items.push(oExpr); } if (oPathExpr.items.length == 1) return oPathExpr.items[0]; - return oPathExpr; + // + return oPathExpr; }; +// Public members cPathExpr.prototype.evaluate = function (oContext) { var vContextItem = oContext.item; - var oSequence = [vContextItem]; + // + var oSequence = [vContextItem]; for (var nItemIndex = 0, nItemLength = this.items.length, oSequence1; nItemIndex < nItemLength; nItemIndex++) { oSequence1 = []; for (var nIndex = 0, nLength = oSequence.length; nIndex < nLength; nIndex++) { - oContext.item = oSequence[nIndex]; - for (var nRightIndex = 0, oSequence2 = this.items[nItemIndex].evaluate(oContext), nRightLength = oSequence2.length; nRightIndex < nRightLength; nRightIndex++) + // Set new context item + oContext.item = oSequence[nIndex]; + // + for (var nRightIndex = 0, oSequence2 = this.items[nItemIndex].evaluate(oContext), nRightLength = oSequence2.length; nRightIndex < nRightLength; nRightIndex++) if ((nItemIndex < nItemLength - 1) && !oContext.DOMAdapter.isNode(oSequence2[nRightIndex])) throw new cException("XPTY0019"); else @@ -1944,21 +2315,38 @@ cPathExpr.prototype.evaluate = function (oContext) { } oSequence = oSequence1; }; - oContext.item = vContextItem; - return fFunction_sequence_order(oSequence, oContext); + // Restore context item + oContext.item = vContextItem; + // + return fFunction_sequence_order(oSequence, oContext); }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cNodeTest() { }; +// Static members function fNodeTest_parse (oLexer, oStaticContext) { if (!oLexer.eof()) return fKindTest_parse(oLexer, oStaticContext) || fNameTest_parse(oLexer, oStaticContext); }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cKindTest(sName) { this.name = sName; @@ -1971,6 +2359,7 @@ cKindTest.prototype.name = null; cKindTest.prototype.args = null; var hKindTest_names = {}; +// hKindTest_names["document-node"] = {}; hKindTest_names["element"] = {}; hKindTest_names["attribute"] = {}; @@ -1978,53 +2367,70 @@ hKindTest_names["processing-instruction"] = {}; hKindTest_names["comment"] = {}; hKindTest_names["text"] = {}; hKindTest_names["node"] = {}; +// hKindTest_names["schema-element"] = {}; hKindTest_names["schema-attribute"] = {}; +// Static members function fKindTest_parse (oLexer, oStaticContext) { - var sName = oLexer.peek(); + var sName = oLexer.peek(), + oValue; if (oLexer.peek(1) == '(') { - if (!(sName in hKindTest_names)) + // + if (!(sName in hKindTest_names)) throw new cException("XPST0003" - , "Unknown '" + sName + "' kind test" + ); - oLexer.next(2); - var oTest = new cKindTest(sName); + // + oLexer.next(2); + // + var oTest = new cKindTest(sName); if (oLexer.peek() != ')') { if (sName == "document-node") { - } + // TODO: parse test further + } else if (sName == "element") { - } + // TODO: parse test further + } else if (sName == "attribute") { - } + // TODO: parse test further + } else if (sName == "processing-instruction") { - } + oValue = fStringLiteral_parse(oLexer, oStaticContext); + if (!oValue) { + oValue = new cStringLiteral(new cXSString(oLexer.peek())); + oLexer.next(); + } + oTest.args.push(oValue); + } else if (sName == "schema-attribute") { - } + // TODO: parse test further + } else if (sName == "schema-element") { - } + // TODO: parse test further + } } else { if (sName == "schema-attribute") throw new cException("XPST0003" - , "Expected attribute declaration in 'schema-attribute' kind test" + ); else if (sName == "schema-element") throw new cException("XPST0003" - , "Expected element declaration in 'schema-element' kind test" + ); } if (oLexer.peek() != ')') throw new cException("XPST0003" - , "Expected ')' token in kind test" + ); oLexer.next(); @@ -2032,11 +2438,14 @@ function fKindTest_parse (oLexer, oStaticContext) { } }; +// Public members cKindTest.prototype.test = function (oNode, oContext) { var fGetProperty = oContext.DOMAdapter.getProperty, - nType = oContext.DOMAdapter.isNode(oNode) ? fGetProperty(oNode, "nodeType") : 0; + nType = oContext.DOMAdapter.isNode(oNode) ? fGetProperty(oNode, "nodeType") : 0, + sTarget; switch (this.name) { - case "node": return !!nType; + // Node type test + case "node": return !!nType; case "attribute": if (nType != 2) return false; break; case "document-node": return nType == 9; case "element": return nType == 1; @@ -2044,21 +2453,33 @@ cKindTest.prototype.test = function (oNode, oContext) { case "comment": return nType == 8; case "text": return nType == 3 || nType == 4; - case "schema-attribute": + // Schema tests + case "schema-attribute": throw "KindTest '" + "schema-attribute" + "' not implemented"; case "schema-element": throw "KindTest '" + "schema-element" + "' not implemented"; } - if (nType == 2) + // Additional tests + if (nType == 2) return fGetProperty(oNode, "prefix") != "xmlns" && fGetProperty(oNode, "localName") != "xmlns"; - if (nType == 7) - return fGetProperty(oNode, "target") != "xml"; + if (nType == 7) { + sTarget = fGetProperty(oNode, "target"); + return this.args.length ? sTarget == this.args[0].value : sTarget != "xml"; + } return true; }; +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cNameTest(sPrefix, sLocalName, sNameSpaceURI) { this.prefix = sPrefix; @@ -2072,19 +2493,21 @@ cNameTest.prototype.prefix = null; cNameTest.prototype.localName = null; cNameTest.prototype.namespaceURI = null; -var rNameTest = /^(?:(?![0-9-])([\w-]+|\*)\:)?(?![0-9-])([\w-]+|\*)$/; +// Static members +var rNameTest = /^(?:(?![0-9-])(\w[\w.-]*|\*)\:)?(?![0-9-])(\w[\w.-]*|\*)$/; function fNameTest_parse (oLexer, oStaticContext) { var aMatch = oLexer.peek().match(rNameTest); if (aMatch) { if (aMatch[1] == '*' && aMatch[2] == '*') throw new cException("XPST0003" - , "Illegal use of *:* wildcard in name test" + ); oLexer.next(); return new cNameTest(aMatch[1] || null, aMatch[2], aMatch[1] ? aMatch[1] == '*' ? '*' : oStaticContext.getURIForPrefix(aMatch[1]) || null : oStaticContext.defaultElementNamespace); } }; +// Public members cNameTest.prototype.test = function (oNode, oContext) { var fGetProperty = oContext.DOMAdapter.getProperty, nType = fGetProperty(oNode, "nodeType"); @@ -2094,14 +2517,24 @@ cNameTest.prototype.test = function (oNode, oContext) { if (this.localName == fGetProperty(oNode, "localName")) return this.namespaceURI == '*' || (nType == 2 && !this.prefix && !fGetProperty(oNode, "prefix")) || fGetProperty(oNode, "namespaceURI") == this.namespaceURI; } - return false; + // + return false; }; +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cPrimaryExpr() { }; +// Static members function fPrimaryExpr_parse (oLexer, oStaticContext) { if (!oLexer.eof()) return fContextItemExpr_parse(oLexer, oStaticContext) @@ -2110,39 +2543,59 @@ function fPrimaryExpr_parse (oLexer, oStaticContext) { || fVarRef_parse(oLexer, oStaticContext) || fLiteral_parse(oLexer, oStaticContext); }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cParenthesizedExpr(oExpr) { this.expression = oExpr; }; +// Static members function fParenthesizedExpr_parse (oLexer, oStaticContext) { if (oLexer.peek() == '(') { oLexer.next(); - var oExpr = null; + // Check if not empty (allowed) + var oExpr = null; if (oLexer.peek() != ')') oExpr = fExpr_parse(oLexer, oStaticContext); - if (oLexer.peek() != ')') + // + if (oLexer.peek() != ')') throw new cException("XPST0003" - , "Expected ')' token in parenthesized expression" + ); oLexer.next(); - return new cParenthesizedExpr(oExpr); + // + return new cParenthesizedExpr(oExpr); } }; +// Public members cParenthesizedExpr.prototype.evaluate = function (oContext) { return this.expression ? this.expression.evaluate(oContext) : []; }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cContextItemExpr() { }; +// Static members function fContextItemExpr_parse (oLexer, oStaticContext) { if (oLexer.peek() == '.') { oLexer.next(); @@ -2150,14 +2603,23 @@ function fContextItemExpr_parse (oLexer, oStaticContext) { } }; +// Public members cContextItemExpr.prototype.evaluate = function (oContext) { if (oContext.item == null) throw new cException("XPDY0002" - , "Dynamic context does not have context item initialized" - ); - return [oContext.item]; -}; + ); + // + return [oContext.item]; +}; +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cLiteral() { @@ -2165,16 +2627,25 @@ function cLiteral() { cLiteral.prototype.value = null; +// Static members function fLiteral_parse (oLexer, oStaticContext) { if (!oLexer.eof()) return fNumericLiteral_parse(oLexer, oStaticContext) || fStringLiteral_parse(oLexer, oStaticContext); }; +// Public members cLiteral.prototype.evaluate = function (oContext) { return [this.value]; }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cNumericLiteral(oValue) { this.value = oValue; @@ -2182,6 +2653,7 @@ function cNumericLiteral(oValue) { cNumericLiteral.prototype = new cLiteral; +// Integer | Decimal | Double var rNumericLiteral = /^[+\-]?(?:(?:(\d+)(?:\.(\d*))?)|(?:\.(\d+)))(?:[eE]([+-])?(\d+))?$/; function fNumericLiteral_parse (oLexer, oStaticContext) { var sValue = oLexer.peek(), @@ -2204,7 +2676,14 @@ function fNumericLiteral_parseValue(sValue) { return new cType(+sValue); } }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cStringLiteral(oValue) { this.value = oValue; @@ -2220,7 +2699,14 @@ function fStringLiteral_parse (oLexer, oStaticContext) { return new cStringLiteral(new cXSString(aMatch[1] ? aMatch[1].replace("''", "'") : aMatch[2] ? aMatch[2].replace('""', '"') : '')); } }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cFilterExpr(oPrimary) { this.expression = oPrimary; @@ -2231,27 +2717,38 @@ cFilterExpr.prototype = new cStepExpr; cFilterExpr.prototype.expression = null; +// Static members function fFilterExpr_parse (oLexer, oStaticContext) { var oExpr; if (oLexer.eof() ||!(oExpr = fPrimaryExpr_parse(oLexer, oStaticContext))) return; var oFilterExpr = new cFilterExpr(oExpr); - fStepExpr_parsePredicates(oLexer, oStaticContext, oFilterExpr); + // Parse predicates + fStepExpr_parsePredicates(oLexer, oStaticContext, oFilterExpr); - if (oFilterExpr.predicates.length == 0) + // If no predicates found + if (oFilterExpr.predicates.length == 0) return oFilterExpr.expression; return oFilterExpr; }; +// Public members cFilterExpr.prototype.evaluate = function (oContext) { var oSequence = this.expression.evaluate(oContext); if (this.predicates.length && oSequence.length) oSequence = this.applyPredicates(oSequence, oContext); return oSequence; }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cVarRef(sPrefix, sLocalName, sNameSpaceURI) { this.prefix = sPrefix; @@ -2263,14 +2760,15 @@ cVarRef.prototype.prefix = null; cVarRef.prototype.localName = null; cVarRef.prototype.namespaceURI = null; +// Static members function fVarRef_parse (oLexer, oStaticContext) { if (oLexer.peek().substr(0, 1) == '$') { var aMatch = oLexer.peek().substr(1).match(rNameTest); if (aMatch) { if (aMatch[1] == '*' || aMatch[2] == '*') throw new cException("XPST0003" - , "Illegal use of wildcard in var expression variable name" - ); + + ); var oVarRef = new cVarRef(aMatch[1] || null, aMatch[2], aMatch[1] ? oStaticContext.getURIForPrefix(aMatch[1]) : null); oLexer.next(); @@ -2279,15 +2777,24 @@ function fVarRef_parse (oLexer, oStaticContext) { } }; +// Public members cVarRef.prototype.evaluate = function (oContext) { var sUri = (this.namespaceURI ? '{' + this.namespaceURI + '}' : '') + this.localName; if (oContext.scope.hasOwnProperty(sUri)) return [oContext.scope[sUri]]; - throw new cException("XPST0008" - , "Variable $" + (this.prefix ? this.prefix + ':' : '') + this.localName + " has not been declared" + // + throw new cException("XPST0008" + ); }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cFunctionCall(sPrefix, sLocalName, sNameSpaceURI) { this.prefix = sPrefix; @@ -2301,30 +2808,36 @@ cFunctionCall.prototype.localName = null; cFunctionCall.prototype.namespaceURI = null; cFunctionCall.prototype.args = null; +// Static members function fFunctionCall_parse (oLexer, oStaticContext) { var aMatch = oLexer.peek().match(rNameTest); if (aMatch && oLexer.peek(1) == '(') { - if (!aMatch[1] && (aMatch[2] in hKindTest_names)) + // Reserved "functions" + if (!aMatch[1] && (aMatch[2] in hKindTest_names)) return fAxisStep_parse(oLexer, oStaticContext); - if (aMatch[1] == '*' || aMatch[2] == '*') + // Other functions + if (aMatch[1] == '*' || aMatch[2] == '*') throw new cException("XPST0003" - , "Illegal use of wildcard in function name" + ); var oFunctionCallExpr = new cFunctionCall(aMatch[1] || null, aMatch[2], aMatch[1] ? oStaticContext.getURIForPrefix(aMatch[1]) || null : oStaticContext.defaultFunctionNamespace), oExpr; oLexer.next(2); - if (oLexer.peek() != ')') { + // + if (oLexer.peek() != ')') { do { if (oLexer.eof() ||!(oExpr = fExprSingle_parse(oLexer, oStaticContext))) throw new cException("XPST0003" - , "Expected function call argument" + ); - oFunctionCallExpr.args.push(oExpr); + // + oFunctionCallExpr.args.push(oExpr); } while (oLexer.peek() == ',' && oLexer.next()); - if (oLexer.peek() != ')') + // + if (oLexer.peek() != ')') throw new cException("XPST0003" - , "Expected ')' token in function call" + ); } oLexer.next(); @@ -2332,43 +2845,54 @@ function fFunctionCall_parse (oLexer, oStaticContext) { } }; +// Public members cFunctionCall.prototype.evaluate = function (oContext) { var aArguments = [], aParameters, fFunction; - for (var nIndex = 0, nLength = this.args.length; nIndex < nLength; nIndex++) + // Evaluate arguments + for (var nIndex = 0, nLength = this.args.length; nIndex < nLength; nIndex++) aArguments.push(this.args[nIndex].evaluate(oContext)); var sUri = (this.namespaceURI ? '{' + this.namespaceURI + '}' : '') + this.localName; - if (this.namespaceURI == sNS_XPF) { + // Call function + if (this.namespaceURI == sNS_XPF) { if (fFunction = hStaticContext_functions[this.localName]) { - if (aParameters = hStaticContext_signatures[this.localName]) + // Validate/Cast arguments + if (aParameters = hStaticContext_signatures[this.localName]) fFunctionCall_prepare(this.localName, aParameters, fFunction, aArguments, oContext); - var vResult = fFunction.apply(oContext, aArguments); - return vResult == null ? [] : vResult instanceof cArray ? vResult : [vResult]; + // + var vResult = fFunction.apply(oContext, aArguments); + // + return vResult == null ? [] : vResult instanceof cArray ? vResult : [vResult]; } throw new cException("XPST0017" - , "Unknown system function: " + sUri + '()' + ); } else if (this.namespaceURI == sNS_XSD) { if ((fFunction = hStaticContext_dataTypes[this.localName]) && this.localName != "NOTATION" && this.localName != "anyAtomicType") { - fFunctionCall_prepare(this.localName, [[cXSAnyAtomicType]], fFunction, aArguments, oContext); - return [fFunction.cast(aArguments[0])]; + // + fFunctionCall_prepare(this.localName, [[cXSAnyAtomicType, '?']], fFunction, aArguments, oContext); + // + return aArguments[0] === null ? [] : [fFunction.cast(aArguments[0])]; } throw new cException("XPST0017" - , "Unknown type constructor function: " + sUri + '()' + ); } else if (fFunction = oContext.staticContext.getFunction(sUri)) { - var vResult = fFunction.apply(oContext, aArguments); - return vResult == null ? [] : vResult instanceof cArray ? vResult : [vResult]; + // + var vResult = fFunction.apply(oContext, aArguments); + // + return vResult == null ? [] : vResult instanceof cArray ? vResult : [vResult]; } - throw new cException("XPST0017" - , "Unknown user function: " + sUri + '()' + // + throw new cException("XPST0017" + ); }; @@ -2380,27 +2904,31 @@ function fFunctionCall_prepare(sName, aParameters, fFunction, aArguments, oConte nParametersLength = aParameters.length, nParametersRequired = 0; - while ((nParametersRequired < aParameters.length) && !aParameters[nParametersRequired][2]) + // Determine amount of parameters required + while ((nParametersRequired < aParameters.length) && !aParameters[nParametersRequired][2]) nParametersRequired++; - if (nArgumentsLength > nParametersLength) + // Validate arguments length + if (nArgumentsLength > nParametersLength) throw new cException("XPST0017" - , "Function " + sName + "() must have " + (nParametersLength ? " no more than " : '') + nParametersLength + " argument" + (nParametersLength > 1 || !nParametersLength ? 's' : '') + ); else if (nArgumentsLength < nParametersRequired) throw new cException("XPST0017" - , "Function " + sName + "() must have " + (nParametersRequired == nParametersLength ? "exactly" : "at least") + ' ' + nParametersRequired + " argument" + (nParametersLength > 1 ? 's' : '') + ); for (var nIndex = 0; nIndex < nArgumentsLength; nIndex++) { oParameter = aParameters[nIndex]; oArgument = aArguments[nIndex]; - fFunctionCall_assertSequenceCardinality(oContext, oArgument, oParameter[1] - , aFunctionCall_numbers[nIndex] + " argument of " + sName + '()' + // Check sequence cardinality + fFunctionCall_assertSequenceCardinality(oContext, oArgument, oParameter[1] + ); - fFunctionCall_assertSequenceItemType(oContext, oArgument, oParameter[0] - , aFunctionCall_numbers[nIndex] + " argument of " + sName + '()' + // Check sequence items data types consistency + fFunctionCall_assertSequenceItemType(oContext, oArgument, oParameter[0] + ); if (oParameter[1] != '+' && oParameter[1] != '*') aArguments[nIndex] = oArgument.length ? oArgument[0] : null; @@ -2408,73 +2936,96 @@ function fFunctionCall_prepare(sName, aParameters, fFunction, aArguments, oConte }; function fFunctionCall_assertSequenceItemType(oContext, oSequence, cItemType - , sSource + ) { - for (var nIndex = 0, nLength = oSequence.length, nNodeType, vItem; nIndex < nLength; nIndex++) { + // + for (var nIndex = 0, nLength = oSequence.length, nNodeType, vItem; nIndex < nLength; nIndex++) { vItem = oSequence[nIndex]; - if (cItemType == cXTNode || cItemType.prototype instanceof cXTNode) { - if (!oContext.DOMAdapter.isNode(vItem)) + // Node types + if (cItemType == cXTNode || cItemType.prototype instanceof cXTNode) { + // Check if is node + if (!oContext.DOMAdapter.isNode(vItem)) throw new cException("XPTY0004" - , "Required item type of " + sSource + " is " + cItemType + ); - if (cItemType != cXTNode) { + // Check node type + if (cItemType != cXTNode) { nNodeType = oContext.DOMAdapter.getProperty(vItem, "nodeType"); if ([null, cXTElement, cXTAttribute, cXTText, cXTText, null, null, cXTProcessingInstruction, cXTComment, cXTDocument, null, null, null][nNodeType] != cItemType) throw new cException("XPTY0004" - , "Required item type of " + sSource + " is " + cItemType + ); } } else - if (cItemType == cXSAnyAtomicType || cItemType.prototype instanceof cXSAnyAtomicType) { - vItem = fFunction_sequence_atomize([vItem], oContext)[0]; - if (cItemType != cXSAnyAtomicType) { - if (vItem instanceof cXSUntypedAtomic) + // Atomic types + if (cItemType == cXSAnyAtomicType || cItemType.prototype instanceof cXSAnyAtomicType) { + // Atomize item + vItem = fFunction_sequence_atomize([vItem], oContext)[0]; + // Convert type if necessary + if (cItemType != cXSAnyAtomicType) { + // Cast item to expected type if it's type is xs:untypedAtomic + if (vItem instanceof cXSUntypedAtomic) vItem = cItemType.cast(vItem); - else - if (cItemType == cXSString) { + // Cast item to xs:string if it's type is xs:anyURI + else + if (cItemType == cXSString/* || cItemType.prototype instanceof cXSString*/) { if (vItem instanceof cXSAnyURI) vItem = cXSString.cast(vItem); } else - if (cItemType == cXSDouble) { + if (cItemType == cXSDouble/* || cItemType.prototype instanceof cXSDouble*/) { if (fXSAnyAtomicType_isNumeric(vItem)) vItem = cItemType.cast(vItem); } } - if (!(vItem instanceof cItemType)) + // Check type + if (!(vItem instanceof cItemType)) throw new cException("XPTY0004" - , "Required item type of " + sSource + " is " + cItemType + ); - oSequence[nIndex] = vItem; + // Write value back to sequence + oSequence[nIndex] = vItem; } } }; function fFunctionCall_assertSequenceCardinality(oContext, oSequence, sCardinality - , sSource + ) { var nLength = oSequence.length; - if (sCardinality == '?') { if (nLength > 1) + // Check cardinality + if (sCardinality == '?') { // =0 or 1 + if (nLength > 1) throw new cException("XPTY0004" - , "Required cardinality of " + sSource + " is one or zero" + ); } else - if (sCardinality == '+') { if (nLength < 1) + if (sCardinality == '+') { // =1+ + if (nLength < 1) throw new cException("XPTY0004" - , "Required cardinality of " + sSource + " is one or more" + ); } else - if (sCardinality != '*') { if (nLength != 1) + if (sCardinality != '*') { // =1 ('*' =0+) + if (nLength != 1) throw new cException("XPTY0004" - , "Required cardinality of " + sSource + " is exactly one" + ); } }; +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cIntersectExceptExpr(oExpr) { this.left = oExpr; @@ -2484,6 +3035,7 @@ function cIntersectExceptExpr(oExpr) { cIntersectExceptExpr.prototype.left = null; cIntersectExceptExpr.prototype.items = null; +// Static members function fIntersectExceptExpr_parse (oLexer, oStaticContext) { var oExpr, sOperator; @@ -2492,25 +3044,34 @@ function fIntersectExceptExpr_parse (oLexer, oStaticContext) { if (!((sOperator = oLexer.peek()) == "intersect" || sOperator == "except")) return oExpr; - var oIntersectExceptExpr = new cIntersectExceptExpr(oExpr); + // IntersectExcept expression + var oIntersectExceptExpr = new cIntersectExceptExpr(oExpr); while ((sOperator = oLexer.peek()) == "intersect" || sOperator == "except") { oLexer.next(); if (oLexer.eof() ||!(oExpr = fInstanceofExpr_parse(oLexer, oStaticContext))) throw new cException("XPST0003" - , "Expected second operand in " + sOperator + " expression" + ); oIntersectExceptExpr.items.push([sOperator, oExpr]); } return oIntersectExceptExpr; }; +// Public members cIntersectExceptExpr.prototype.evaluate = function (oContext) { var oSequence = this.left.evaluate(oContext); for (var nIndex = 0, nLength = this.items.length, oItem; nIndex < nLength; nIndex++) oSequence = hStaticContext_operators[(oItem = this.items[nIndex])[0]].call(oContext, oSequence, oItem[1].evaluate(oContext)); return oSequence; }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cRangeExpr(oLeft, oRight) { this.left = oLeft; @@ -2520,6 +3081,7 @@ function cRangeExpr(oLeft, oRight) { cRangeExpr.prototype.left = null; cRangeExpr.prototype.right = null; +// Static members function fRangeExpr_parse (oLexer, oStaticContext) { var oExpr, oRight; @@ -2528,43 +3090,54 @@ function fRangeExpr_parse (oLexer, oStaticContext) { if (oLexer.peek() != "to") return oExpr; - oLexer.next(); + // Range expression + oLexer.next(); if (oLexer.eof() ||!(oRight = fAdditiveExpr_parse(oLexer, oStaticContext))) throw new cException("XPST0003" - , "Expected second operand in range expression" + ); return new cRangeExpr(oExpr, oRight); }; +// Public members cRangeExpr.prototype.evaluate = function (oContext) { - var oLeft = this.left.evaluate(oContext); + // + var oLeft = this.left.evaluate(oContext); if (!oLeft.length) return []; - var sSource = "first operand of 'to'"; + // + fFunctionCall_assertSequenceCardinality(oContext, oLeft, '?' - , sSource + ); fFunctionCall_assertSequenceItemType(oContext, oLeft, cXSInteger - , sSource + ); var oRight = this.right.evaluate(oContext); if (!oRight.length) return []; - sSource = "second operand of 'to'"; + fFunctionCall_assertSequenceCardinality(oContext, oRight, '?' - , sSource + ); fFunctionCall_assertSequenceItemType(oContext, oRight, cXSInteger - , sSource + ); return hStaticContext_operators["to"].call(oContext, oLeft[0], oRight[0]); }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cUnionExpr(oExpr) { this.left = oExpr; @@ -2574,6 +3147,7 @@ function cUnionExpr(oExpr) { cUnionExpr.prototype.left = null; cUnionExpr.prototype.items = null; +// Static members function fUnionExpr_parse (oLexer, oStaticContext) { var oExpr, sOperator; @@ -2582,25 +3156,34 @@ function fUnionExpr_parse (oLexer, oStaticContext) { if (!((sOperator = oLexer.peek()) == '|' || sOperator == "union")) return oExpr; - var oUnionExpr = new cUnionExpr(oExpr); + // Union expression + var oUnionExpr = new cUnionExpr(oExpr); while ((sOperator = oLexer.peek()) == '|' || sOperator == "union") { oLexer.next(); if (oLexer.eof() ||!(oExpr = fIntersectExceptExpr_parse(oLexer, oStaticContext))) throw new cException("XPST0003" - , "Expected second operand in union expression" + ); oUnionExpr.items.push(oExpr); } return oUnionExpr; }; +// Public members cUnionExpr.prototype.evaluate = function (oContext) { var oSequence = this.left.evaluate(oContext); for (var nIndex = 0, nLength = this.items.length; nIndex < nLength; nIndex++) oSequence = hStaticContext_operators["union"].call(oContext, oSequence, this.items[nIndex].evaluate(oContext)); return oSequence; }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cInstanceofExpr(oExpr, oType) { this.expression = oExpr; @@ -2622,7 +3205,7 @@ function fInstanceofExpr_parse (oLexer, oStaticContext) { oLexer.next(2); if (oLexer.eof() ||!(oType = fSequenceType_parse(oLexer, oStaticContext))) throw new cException("XPST0003" - , "Expected second operand in instance of expression" + ); return new cInstanceofExpr(oExpr, oType); @@ -2632,22 +3215,34 @@ cInstanceofExpr.prototype.evaluate = function(oContext) { var oSequence1 = this.expression.evaluate(oContext), oItemType = this.type.itemType, sOccurence = this.type.occurence; - if (!oItemType) + // Validate empty-sequence() + if (!oItemType) return [new cXSBoolean(!oSequence1.length)]; - if (!oSequence1.length) + // Validate cardinality + if (!oSequence1.length) return [new cXSBoolean(sOccurence == '?' || sOccurence == '*')]; if (oSequence1.length != 1) if (!(sOccurence == '+' || sOccurence == '*')) return [new cXSBoolean(false)]; - if (!oItemType.test) return [new cXSBoolean(true)]; + // Validate type + if (!oItemType.test) // item() + return [new cXSBoolean(true)]; var bValue = true; for (var nIndex = 0, nLength = oSequence1.length; (nIndex < nLength) && bValue; nIndex++) bValue = oItemType.test.test(oSequence1[nIndex], oContext); - return [new cXSBoolean(bValue)]; + // + return [new cXSBoolean(bValue)]; }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cTreatExpr(oExpr, oType) { this.expression = oExpr; @@ -2669,7 +3264,7 @@ function fTreatExpr_parse (oLexer, oStaticContext) { oLexer.next(2); if (oLexer.eof() ||!(oType = fSequenceType_parse(oLexer, oStaticContext))) throw new cException("XPST0003" - , "Expected second operand in treat expression" + ); return new cTreatExpr(oExpr, oType); @@ -2679,37 +3274,49 @@ cTreatExpr.prototype.evaluate = function(oContext) { var oSequence1 = this.expression.evaluate(oContext), oItemType = this.type.itemType, sOccurence = this.type.occurence; - if (!oItemType) { + // Validate empty-sequence() + if (!oItemType) { if (oSequence1.length) throw new cException("XPDY0050" - , "The only value allowed for the value in 'treat as' expression is an empty sequence" + ); return oSequence1; } - if (!(sOccurence == '?' || sOccurence == '*')) + // Validate cardinality + if (!(sOccurence == '?' || sOccurence == '*')) if (!oSequence1.length) throw new cException("XPDY0050" - , "An empty sequence is not allowed as the value in 'treat as' expression" + ); if (!(sOccurence == '+' || sOccurence == '*')) if (oSequence1.length != 1) throw new cException("XPDY0050" - , "A sequence of more than one item is not allowed as the value in 'treat as' expression" + ); - if (!oItemType.test) return oSequence1; + // Validate type + if (!oItemType.test) // item() + return oSequence1; for (var nIndex = 0, nLength = oSequence1.length; nIndex < nLength; nIndex++) if (!oItemType.test.test(oSequence1[nIndex], oContext)) throw new cException("XPDY0050" - , "Required item type of value in 'treat as' expression is " + (oItemType.test.prefix ? oItemType.test.prefix + ':' : '') + oItemType.test.localName - ); - return oSequence1; + ); + + // + return oSequence1; }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cCastableExpr(oExpr, oType) { this.expression = oExpr; @@ -2731,7 +3338,7 @@ function fCastableExpr_parse (oLexer, oStaticContext) { oLexer.next(2); if (oLexer.eof() ||!(oType = fSingleType_parse(oLexer, oStaticContext))) throw new cException("XPST0003" - , "Expected second operand in castable expression" + ); return new cCastableExpr(oExpr, oType); @@ -2748,7 +3355,8 @@ cCastableExpr.prototype.evaluate = function(oContext) { if (!oSequence1.length) return [new cXSBoolean(sOccurence == '?')]; - try { + // Try casting + try { oItemType.cast(fFunction_sequence_atomize(oSequence1, oContext)[0]); } catch (e) { @@ -2756,14 +3364,22 @@ cCastableExpr.prototype.evaluate = function(oContext) { throw e; if (e.code == "XPST0017") throw new cException("XPST0080" - , "No value is castable to " + (oItemType.prefix ? oItemType.prefix + ':' : '') + oItemType.localName + ); - return [new cXSBoolean(false)]; + // + return [new cXSBoolean(false)]; } return [new cXSBoolean(true)]; }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cCastExpr(oExpr, oType) { this.expression = oExpr; @@ -2785,7 +3401,7 @@ function fCastExpr_parse (oLexer, oStaticContext) { oLexer.next(2); if (oLexer.eof() ||!(oType = fSingleType_parse(oLexer, oStaticContext))) throw new cException("XPST0003" - , "Expected second operand in cast expression" + ); return new cCastExpr(oExpr, oType); @@ -2793,14 +3409,24 @@ function fCastExpr_parse (oLexer, oStaticContext) { cCastExpr.prototype.evaluate = function(oContext) { var oSequence1 = this.expression.evaluate(oContext); - fFunctionCall_assertSequenceCardinality(oContext, oSequence1, this.type.occurence - , "'cast as' expression operand" - ); - if (!oSequence1.length) - return []; - return [this.type.itemType.cast(fFunction_sequence_atomize(oSequence1, oContext)[0], oContext)]; -}; + // Validate cardinality + fFunctionCall_assertSequenceCardinality(oContext, oSequence1, this.type.occurence + ); + // + if (!oSequence1.length) + return []; + // + return [this.type.itemType.cast(fFunction_sequence_atomize(oSequence1, oContext)[0], oContext)]; +}; +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cAtomicType(sPrefix, sLocalName, sNameSpaceURI) { this.prefix = sPrefix; @@ -2817,7 +3443,7 @@ function fAtomicType_parse (oLexer, oStaticContext) { if (aMatch) { if (aMatch[1] == '*' || aMatch[2] == '*') throw new cException("XPST0003" - , "Illegal use of wildcard in type name" + ); oLexer.next(); return new cAtomicType(aMatch[1] || null, aMatch[2], aMatch[1] ? oStaticContext.getURIForPrefix(aMatch[1]) : null); @@ -2825,25 +3451,36 @@ function fAtomicType_parse (oLexer, oStaticContext) { }; cAtomicType.prototype.test = function(vItem, oContext) { - var sUri = (this.namespaceURI ? '{' + this.namespaceURI + '}' : '') + this.localName, + // Test + var sUri = (this.namespaceURI ? '{' + this.namespaceURI + '}' : '') + this.localName, cType = this.namespaceURI == sNS_XSD ? hStaticContext_dataTypes[this.localName] : oContext.staticContext.getDataType(sUri); if (cType) return vItem instanceof cType; - throw new cException("XPST0051" - , "Unknown simple type " + (this.prefix ? this.prefix + ':' : '') + this.localName + // + throw new cException("XPST0051" + ); }; cAtomicType.prototype.cast = function(vItem, oContext) { - var sUri = (this.namespaceURI ? '{' + this.namespaceURI + '}' : '') + this.localName, + // Cast + var sUri = (this.namespaceURI ? '{' + this.namespaceURI + '}' : '') + this.localName, cType = this.namespaceURI == sNS_XSD ? hStaticContext_dataTypes[this.localName] : oContext.staticContext.getDataType(sUri); if (cType) return cType.cast(vItem); - throw new cException("XPST0051" - , "Unknown atomic type " + (this.prefix ? this.prefix + ':' : '') + this.localName + // + throw new cException("XPST0051" + ); }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cItemType(oTest) { this.test = oTest; @@ -2860,17 +3497,25 @@ function fItemType_parse (oLexer, oStaticContext) { oLexer.next(2); if (oLexer.peek() != ')') throw new cException("XPST0003" - , "Expected ')' token in item type expression" + ); oLexer.next(); return new cItemType; } - if (oExpr = fKindTest_parse(oLexer, oStaticContext)) + // Note! Following step should have been before previous as per spec + if (oExpr = fKindTest_parse(oLexer, oStaticContext)) return new cItemType(oExpr); if (oExpr = fAtomicType_parse(oLexer, oStaticContext)) return new cItemType(oExpr); }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cSequenceType(oItemType, sOccurence) { this.itemType = oItemType || null; @@ -2888,10 +3533,11 @@ function fSequenceType_parse (oLexer, oStaticContext) { oLexer.next(2); if (oLexer.peek() != ')') throw new cException("XPST0003" - , "Expected ')' token in sequence type" + ); oLexer.next(); - return new cSequenceType; } + return new cSequenceType; // empty sequence + } var oExpr, sOccurence; @@ -2905,7 +3551,14 @@ function fSequenceType_parse (oLexer, oStaticContext) { return new cSequenceType(oExpr, sOccurence); } }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cSingleType(oItemType, sOccurence) { this.itemType = oItemType || null; @@ -2928,14 +3581,28 @@ function fSingleType_parse (oLexer, oStaticContext) { return new cSingleType(oExpr, sOccurence); } }; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSAnyType() { }; cXSAnyType.prototype.builtInKind = cXSConstants.ANYTYPE_DT; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSAnySimpleType() { @@ -2946,7 +3613,34 @@ cXSAnySimpleType.prototype = new cXSAnyType; cXSAnySimpleType.prototype.builtInKind = cXSConstants.ANYSIMPLETYPE_DT; cXSAnySimpleType.prototype.primitiveKind= null; -cXSAnySimpleType.PRIMITIVE_ANYURI = "anyURI"; cXSAnySimpleType.PRIMITIVE_BASE64BINARY = "base64Binary"; cXSAnySimpleType.PRIMITIVE_BOOLEAN = "boolean"; cXSAnySimpleType.PRIMITIVE_DATE = "date"; cXSAnySimpleType.PRIMITIVE_DATETIME = "dateTime"; cXSAnySimpleType.PRIMITIVE_DECIMAL = "decimal"; cXSAnySimpleType.PRIMITIVE_DOUBLE = "double"; cXSAnySimpleType.PRIMITIVE_DURATION = "duration"; cXSAnySimpleType.PRIMITIVE_FLOAT = "float"; cXSAnySimpleType.PRIMITIVE_GDAY = "gDay"; cXSAnySimpleType.PRIMITIVE_GMONTH = "gMonth"; cXSAnySimpleType.PRIMITIVE_GMONTHDAY = "gMonthDay"; cXSAnySimpleType.PRIMITIVE_GYEAR = "gYear"; cXSAnySimpleType.PRIMITIVE_GYEARMONTH = "gYearMonth"; cXSAnySimpleType.PRIMITIVE_HEXBINARY = "hexBinary"; cXSAnySimpleType.PRIMITIVE_NOTATION = "NOTATION"; cXSAnySimpleType.PRIMITIVE_QNAME = "QName"; cXSAnySimpleType.PRIMITIVE_STRING = "string"; cXSAnySimpleType.PRIMITIVE_TIME = "time"; +cXSAnySimpleType.PRIMITIVE_ANYURI = "anyURI"; //18; +cXSAnySimpleType.PRIMITIVE_BASE64BINARY = "base64Binary"; // 17; +cXSAnySimpleType.PRIMITIVE_BOOLEAN = "boolean"; // 3; +cXSAnySimpleType.PRIMITIVE_DATE = "date"; // 10; +cXSAnySimpleType.PRIMITIVE_DATETIME = "dateTime"; // 8; +cXSAnySimpleType.PRIMITIVE_DECIMAL = "decimal"; // 4; +cXSAnySimpleType.PRIMITIVE_DOUBLE = "double"; // 6; +cXSAnySimpleType.PRIMITIVE_DURATION = "duration"; // 7; +cXSAnySimpleType.PRIMITIVE_FLOAT = "float"; // 5; +cXSAnySimpleType.PRIMITIVE_GDAY = "gDay"; // 14; +cXSAnySimpleType.PRIMITIVE_GMONTH = "gMonth"; // 15; +cXSAnySimpleType.PRIMITIVE_GMONTHDAY = "gMonthDay"; // 13; +cXSAnySimpleType.PRIMITIVE_GYEAR = "gYear"; // 12; +cXSAnySimpleType.PRIMITIVE_GYEARMONTH = "gYearMonth"; // 11; +cXSAnySimpleType.PRIMITIVE_HEXBINARY = "hexBinary"; // 16; +cXSAnySimpleType.PRIMITIVE_NOTATION = "NOTATION"; // 20; +cXSAnySimpleType.PRIMITIVE_QNAME = "QName"; // 19; +cXSAnySimpleType.PRIMITIVE_STRING = "string"; // 2; +cXSAnySimpleType.PRIMITIVE_TIME = "time"; // 9; + +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSAnyAtomicType() { @@ -2957,15 +3651,25 @@ cXSAnyAtomicType.prototype.builtInKind = cXSConstants.ANYATOMICTYPE_DT; cXSAnyAtomicType.cast = function(vValue) { throw new cException("XPST0017" - , "Abstract type used in constructor function xs:anyAtomicType" - ); }; + + ); // {http://www.w3.org/2001/XMLSchema}anyAtomicType +}; function fXSAnyAtomicType_isNumeric(vItem) { return vItem instanceof cXSFloat || vItem instanceof cXSDouble || vItem instanceof cXSDecimal; }; +// fStaticContext_defineSystemDataType("anyAtomicType", cXSAnyAtomicType); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSAnyURI(sScheme, sAuthority, sPath, sQuery, sFragment) { this.scheme = sScheme; @@ -2993,7 +3697,8 @@ cXSAnyURI.prototype.toString = function() { + (this.fragment ? '#' + this.fragment : ''); }; -var rXSAnyURI = /^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/; cXSAnyURI.cast = function(vValue) { +var rXSAnyURI = /^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/; // http://tools.ietf.org/html/rfc3986 +cXSAnyURI.cast = function(vValue) { if (vValue instanceof cXSAnyURI) return vValue; if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) { @@ -3002,13 +3707,23 @@ var rXSAnyURI = /^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/; return new cXSAnyURI(aMatch[2], aMatch[4], aMatch[5], aMatch[7], aMatch[9]); throw new cException("FORG0001"); } - throw new cException("XPTY0004" - , "Casting value '" + vValue + "' to xs:anyURI can never succeed" + // + throw new cException("XPTY0004" + ); }; +// fStaticContext_defineSystemDataType("anyURI", cXSAnyURI); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSBase64Binary(sValue) { this.value = sValue; @@ -3045,13 +3760,23 @@ cXSBase64Binary.cast = function(vValue) { aValue.push(cString.fromCharCode(fWindow_parseInt(aMatch[nIndex], 16))); return new cXSBase64Binary(fWindow_btoa(aValue.join(''))); } - throw new cException("XPTY0004" - , "Casting value '" + vValue + "' to xs:hexBinary can never succeed" + // + throw new cException("XPTY0004" + ); }; +// fStaticContext_defineSystemDataType("base64Binary", cXSBase64Binary); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSBoolean(bValue) { this.value = bValue; @@ -3083,13 +3808,23 @@ cXSBoolean.cast = function(vValue) { } if (fXSAnyAtomicType_isNumeric(vValue)) return new cXSBoolean(vValue != 0); - throw new cException("XPTY0004" - , "Casting value '" + vValue + "' to xs:boolean can never succeed" + // + throw new cException("XPTY0004" + ); }; +// fStaticContext_defineSystemDataType("boolean", cXSBoolean); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSDate(nYear, nMonth, nDay, nTimezone, bNegative) { this.year = nYear; @@ -3131,26 +3866,30 @@ cXSDate.cast = function(vValue) { aMatch[5] ? aMatch[5] == 'Z' ? 0 : (aMatch[6] == '-' ? -1 : 1) * (aMatch[7] * 60 + aMatch[8] * 1) : null, aMatch[1] == '-' ); - throw new cException("FORG0001" - , "Invalid date '" + vValue + "' (Non-existent date)" + // + throw new cException("FORG0001" + ); } throw new cException("FORG0001"); } if (vValue instanceof cXSDateTime) return new cXSDate(vValue.year, vValue.month, vValue.day, vValue.timezone, vValue.negative); - throw new cException("XPTY0004" - , "Casting value '" + vValue + "' to xs:date can never succeed" + // + throw new cException("XPTY0004" + ); }; +// Utilities var aXSDate_days = [31,28,31,30,31,30,31,31,30,31,30,31]; function fXSDate_getDaysForYearMonth(nYear, nMonth) { return nMonth == 2 && (nYear % 400 == 0 || nYear % 100 != 0 && nYear % 4 == 0) ? 29 : aXSDate_days[nMonth - 1]; }; function fXSDate_normalize(oValue, bDay) { - if (!bDay) { + // Adjust day for month/year + if (!bDay) { var nDay = fXSDate_getDaysForYearMonth(oValue.year, oValue.month); if (oValue.day > nDay) { while (oValue.day > nDay) { @@ -3180,7 +3919,9 @@ function fXSDate_normalize(oValue, bDay) { } } } - if (oValue.month > 12) { +//? else + // Adjust month + if (oValue.month > 12) { oValue.year += ~~(oValue.month / 12); if (oValue.year == 0) oValue.year = 1; @@ -3197,8 +3938,17 @@ function fXSDate_normalize(oValue, bDay) { return oValue; }; +// fStaticContext_defineSystemDataType("date", cXSDate); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSDateTime(nYear, nMonth, nDay, nHours, nMinutes, nSeconds, nTimezone, bNegative) { this.year = nYear; @@ -3252,19 +4002,22 @@ cXSDateTime.cast = function(vValue) { aMatch[12] ? aMatch[12] == 'Z' ? 0 : (aMatch[13] == '-' ? -1 : 1) * (aMatch[14] * 60 + aMatch[15] * 1) : null, aMatch[1] == '-' )); - throw new cException("FORG0001" - , "Invalid date '" + vValue + "' (Non-existent date)" + // + throw new cException("FORG0001" + ); } throw new cException("FORG0001"); } if (vValue instanceof cXSDate) return new cXSDateTime(vValue.year, vValue.month, vValue.day, 0, 0, 0, vValue.timezone, vValue.negative); - throw new cException("XPTY0004" - , "Casting value '" + vValue + "' to xs:dateTime can never succeed" + // + throw new cException("XPTY0004" + ); }; +// Utilities function fXSDateTime_pad(vValue, nLength) { var sValue = cString(vValue); if (arguments.length < 2) @@ -3303,8 +4056,17 @@ function fXSDateTime_normalize(oValue) { return fXSDate_normalize(fXSTime_normalize(oValue)); }; +// fStaticContext_defineSystemDataType("dateTime", cXSDateTime); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSDecimal(nValue) { this.value = nValue; @@ -3337,19 +4099,29 @@ cXSDecimal.cast = function(vValue) { if (vValue instanceof cXSBoolean) return new cXSDecimal(vValue * 1); if (fXSAnyAtomicType_isNumeric(vValue)) { - if (fIsNaN(vValue) || !fIsFinite(vValue)) - throw new cException("FOCA0002" - , "Cannot convert '" + vValue + "' to xs:decimal" - ); - return new cXSDecimal(+vValue); + if (!fIsNaN(vValue) && fIsFinite(vValue)) + return new cXSDecimal(+vValue); + throw new cException("FOCA0002" + + ); } - throw new cException("XPTY0004" - , "Casting value '" + vValue + "' to xs:decimal can never succeed" + // + throw new cException("XPTY0004" + ); }; +// fStaticContext_defineSystemDataType("decimal", cXSDecimal); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSDouble(nValue) { this.value = nValue; @@ -3383,13 +4155,23 @@ cXSDouble.cast = function(vValue) { return new cXSDouble(vValue * 1); if (fXSAnyAtomicType_isNumeric(vValue)) return new cXSDouble(vValue.value); - throw new cException("XPTY0004" - , "Casting value '" + vValue + "' to xs:double can never succeed" + // + throw new cException("XPTY0004" + ); }; +// fStaticContext_defineSystemDataType("double", cXSDouble); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSDuration(nYear, nMonth, nDay, nHours, nMinutes, nSeconds, bNegative) { this.year = nYear; @@ -3420,23 +4202,25 @@ cXSDuration.prototype.toString = function() { var rXSDuration = /^(-)?P(?:([0-9]+)Y)?(?:([0-9]+)M)?(?:([0-9]+)D)?(?:T(?:([0-9]+)H)?(?:([0-9]+)M)?(?:((?:(?:[0-9]+(?:.[0-9]*)?)|(?:.[0-9]+)))S)?)?$/; cXSDuration.cast = function(vValue) { + if (vValue instanceof cXSDuration) + return vValue; if (vValue instanceof cXSYearMonthDuration) return new cXSDuration(vValue.year, vValue.month, 0, 0, 0, 0, vValue.negative); if (vValue instanceof cXSDayTimeDuration) return new cXSDuration(0, 0, vValue.day, vValue.hours, vValue.minutes, vValue.seconds, vValue.negative); - if (vValue instanceof cXSDuration) - return vValue; if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) { var aMatch = fString_trim(vValue).match(rXSDuration); if (aMatch) return fXSDuration_normalize(new cXSDuration(+aMatch[2] || 0, +aMatch[3] || 0, +aMatch[4] || 0, +aMatch[5] || 0, +aMatch[6] || 0, +aMatch[7] || 0, aMatch[1] == '-')); throw new cException("FORG0001"); } - throw new cException("XPTY0004" - , "Casting value '" + vValue + "' to xs:duration can never succeed" + // + throw new cException("XPTY0004" + ); }; +// Utilities function fXSDuration_getYearMonthComponent(oDuration) { return (oDuration.year ? oDuration.year + 'Y' : '') + (oDuration.month ? oDuration.month + 'M' : ''); @@ -3456,8 +4240,17 @@ function fXSDuration_normalize(oDuration) { return fXSYearMonthDuration_normalize(fXSDayTimeDuration_normalize(oDuration)); }; +// fStaticContext_defineSystemDataType("duration", cXSDuration); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSFloat(nValue) { this.value = nValue; @@ -3491,13 +4284,23 @@ cXSFloat.cast = function(vValue) { return new cXSFloat(vValue * 1); if (fXSAnyAtomicType_isNumeric(vValue)) return new cXSFloat(vValue.value); - throw new cException("XPTY0004" - , "Casting value '" + vValue + "' to xs:float can never succeed" + // + throw new cException("XPTY0004" + ); }; +// fStaticContext_defineSystemDataType("float", cXSFloat); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSGDay(nDay, nTimezone) { this.day = nDay; @@ -3534,13 +4337,22 @@ cXSGDay.cast = function(vValue) { } if (vValue instanceof cXSDate || vValue instanceof cXSDateTime) return new cXSGDay(vValue.day, vValue.timezone); - throw new cException("XPTY0004" - , "Casting value '" + vValue + "' to xs:gDay can never succeed" + // + throw new cException("XPTY0004" + ); }; +// fStaticContext_defineSystemDataType("gDay", cXSGDay); - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSGMonth(nMonth, nTimezone) { this.month = nMonth; @@ -3576,13 +4388,22 @@ cXSGMonth.cast = function(vValue) { } if (vValue instanceof cXSDate || vValue instanceof cXSDateTime) return new cXSGMonth(vValue.month, vValue.timezone); - throw new cException("XPTY0004" - , "Casting value '" + vValue + "' to xs:gMonth can never succeed" + // + throw new cException("XPTY0004" + ); }; +// fStaticContext_defineSystemDataType("gMonth", cXSGMonth); - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSGMonthDay(nMonth, nDay, nTimezone) { this.month = nMonth; @@ -3619,21 +4440,31 @@ cXSGMonthDay.cast = function(vValue) { nDay, aMatch[3] ? aMatch[3] == 'Z' ? 0 : (aMatch[4] == '-' ? -1 : 1) * (aMatch[5] * 60 + aMatch[6] * 1) : null ); - throw new cException("FORG0001" - , "Invalid date '" + vValue + "' (Non-existent date)" + // + throw new cException("FORG0001" + ); } throw new cException("FORG0001"); } if (vValue instanceof cXSDate || vValue instanceof cXSDateTime) return new cXSGMonthDay(vValue.month, vValue.day, vValue.timezone); - throw new cException("XPTY0004" - , "Casting value '" + vValue + "' to xs:gMonthDay can never succeed" + // + throw new cException("XPTY0004" + ); }; +// fStaticContext_defineSystemDataType("gMonthDay", cXSGMonthDay); - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSGYear(nYear, nTimezone) { this.year = nYear; @@ -3668,13 +4499,22 @@ cXSGYear.cast = function(vValue) { } if (vValue instanceof cXSDate || vValue instanceof cXSDateTime) return new cXSGYear(vValue.year, vValue.timezone); - throw new cException("XPTY0004" - , "Casting value '" + vValue + "' to xs:gYear can never succeed" + // + throw new cException("XPTY0004" + ); }; +// fStaticContext_defineSystemDataType("gYear", cXSGYear); - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSGYearMonth(nYear, nMonth, nTimezone) { this.year = nYear; @@ -3714,13 +4554,22 @@ cXSGYearMonth.cast = function(vValue) { } if (vValue instanceof cXSDate || vValue instanceof cXSDateTime) return new cXSGYearMonth(vValue.year, vValue.month, vValue.timezone); - throw new cException("XPTY0004" - , "Casting value '" + vValue + "' to xs:gYearMonth can never succeed" + // + throw new cException("XPTY0004" + ); }; +// fStaticContext_defineSystemDataType("gYearMonth", cXSGYearMonth); - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSHexBinary(sValue) { this.value = sValue; @@ -3759,13 +4608,23 @@ cXSHexBinary.cast = function(vValue) { } return new cXSHexBinary(aValue.join('')); } - throw new cException("XPTY0004" - , "Casting value '" + vValue + "' to xs:hexBinary can never succeed" + // + throw new cException("XPTY0004" + ); }; +// fStaticContext_defineSystemDataType("hexBinary", cXSHexBinary); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSNOTATION() { @@ -3777,12 +4636,22 @@ cXSNOTATION.prototype.primitiveKind = cXSAnySimpleType.PRIMITIVE_NOTATION; cXSNOTATION.cast = function(vValue) { throw new cException("XPST0017" - , "Abstract type used in constructor function xs:NOTATION" - ); }; + ); // {http://www.w3.org/2001/XMLSchema}NOTATION +}; + +// fStaticContext_defineSystemDataType("NOTATION", cXSNOTATION); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSQName(sPrefix, sLocalName, sNameSpaceURI) { this.prefix = sPrefix; @@ -3802,7 +4671,7 @@ cXSQName.prototype.toString = function() { return (this.prefix ? this.prefix + ':' : '') + this.localName; }; -var rXSQName = /^(?:(?![0-9-])([\w-]+)\:)?(?![0-9-])([\w-]+)$/; +var rXSQName = /^(?:(?![0-9-])(\w[\w.-]*)\:)?(?![0-9-])(\w[\w.-]*)$/; cXSQName.cast = function(vValue) { if (vValue instanceof cXSQName) return vValue; @@ -3812,13 +4681,23 @@ cXSQName.cast = function(vValue) { return new cXSQName(aMatch[1] || null, aMatch[2], null); throw new cException("FORG0001"); } - throw new cException("XPTY0004" - , "Casting value '" + vValue + "' to xs:QName can never succeed" + // + throw new cException("XPTY0004" + ); }; +// fStaticContext_defineSystemDataType("QName", cXSQName); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSString(sValue) { this.value = sValue; @@ -3840,13 +4719,23 @@ cXSString.prototype.toString = function() { cXSString.cast = function(vValue) { return new cXSString(cString(vValue)); - throw new cException("XPTY0004" - , "Casting value '" + vValue + "' to xs:string can never succeed" + // + throw new cException("XPTY0004" + ); }; +// fStaticContext_defineSystemDataType("string", cXSString); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSTime(nHours, nMinutes, nSeconds, nTimezone) { this.hours = nHours; @@ -3887,30 +4776,45 @@ cXSTime.cast = function(vValue) { } if (vValue instanceof cXSDateTime) return new cXSTime(vValue.hours, vValue.minutes, vValue.seconds, vValue.timezone); - throw new cException("XPTY0004" - , "Casting value '" + vValue + "' to xs:time can never succeed" + // + throw new cException("XPTY0004" + ); }; +// function fXSTime_normalize(oValue) { - if (oValue.seconds >= 60 || oValue.seconds < 0) { + // + if (oValue.seconds >= 60 || oValue.seconds < 0) { oValue.minutes += ~~(oValue.seconds / 60) - (oValue.seconds < 0 && oValue.seconds % 60 ? 1 : 0); oValue.seconds = oValue.seconds % 60 + (oValue.seconds < 0 && oValue.seconds % 60 ? 60 : 0); } - if (oValue.minutes >= 60 || oValue.minutes < 0) { + // + if (oValue.minutes >= 60 || oValue.minutes < 0) { oValue.hours += ~~(oValue.minutes / 60) - (oValue.minutes < 0 && oValue.minutes % 60 ? 1 : 0); oValue.minutes = oValue.minutes % 60 + (oValue.minutes < 0 && oValue.minutes % 60 ? 60 : 0); } - if (oValue.hours >= 24 || oValue.hours < 0) { + // + if (oValue.hours >= 24 || oValue.hours < 0) { if (oValue instanceof cXSDateTime) oValue.day += ~~(oValue.hours / 24) - (oValue.hours < 0 && oValue.hours % 24 ? 1 : 0); oValue.hours = oValue.hours % 24 + (oValue.hours < 0 && oValue.hours % 24 ? 24 : 0); } - return oValue; + // + return oValue; }; +// fStaticContext_defineSystemDataType("time", cXSTime); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSUntypedAtomic(sValue) { this.value = sValue; @@ -3928,13 +4832,23 @@ cXSUntypedAtomic.cast = function(vValue) { return vValue; return new cXSUntypedAtomic(cString(vValue)); - throw new cException("XPTY0004" - , "Casting value '" + vValue + "' to xs:untypedAtomic can never succeed" + // + throw new cException("XPTY0004" + ); }; +// fStaticContext_defineSystemDataType("untypedAtomic", cXSUntypedAtomic); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSYearMonthDuration(nYear, nMonth, bNegative) { cXSDuration.call(this, nYear, nMonth, 0, 0, 0, 0, bNegative); @@ -3962,11 +4876,13 @@ cXSYearMonthDuration.cast = function(vValue) { return new cXSYearMonthDuration(0, 0); if (vValue instanceof cXSDuration) return new cXSYearMonthDuration(vValue.year, vValue.month, vValue.negative); - throw new cException("XPTY0004" - , "Casting value '" + vValue + "' to xs:yearMonthDuration can never succeed" + // + throw new cException("XPTY0004" + ); }; +// function fXSYearMonthDuration_normalize(oDuration) { if (oDuration.month >= 12) { oDuration.year += ~~(oDuration.month / 12); @@ -3975,8 +4891,17 @@ function fXSYearMonthDuration_normalize(oDuration) { return oDuration; }; +// fStaticContext_defineSystemDataType("yearMonthDuration", cXSYearMonthDuration); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSDayTimeDuration(nDay, nHours, nMinutes, nSeconds, bNegative) { cXSDuration.call(this, 0, 0, nDay, nHours, nMinutes, nSeconds, bNegative); @@ -4004,11 +4929,13 @@ cXSDayTimeDuration.cast = function(vValue) { return new cXSDayTimeDuration(0, 0, 0, 0); if (vValue instanceof cXSDuration) return new cXSDayTimeDuration(vValue.day, vValue.hours, vValue.minutes, vValue.seconds, vValue.negative); - throw new cException("XPTY0004" - , "Casting value '" + vValue + "' to xs:dayTimeDuration can never succeed" + // + throw new cException("XPTY0004" + ); }; +// Utilities function fXSDayTimeDuration_normalize(oDuration) { if (oDuration.seconds >= 60) { oDuration.minutes += ~~(oDuration.seconds / 60); @@ -4025,8 +4952,17 @@ function fXSDayTimeDuration_normalize(oDuration) { return oDuration; }; +// fStaticContext_defineSystemDataType("dayTimeDuration", cXSDayTimeDuration); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSInteger(nValue) { this.value = nValue; @@ -4038,29 +4974,39 @@ cXSInteger.prototype.builtInKind = cXSConstants.INTEGER_DT; var rXSInteger = /^[-+]?[0-9]+$/; cXSInteger.cast = function(vValue) { if (vValue instanceof cXSInteger) - return vValue; + return new cXSInteger(vValue.value); if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) { var aMatch = fString_trim(vValue).match(rXSInteger); if (aMatch) - return new cXSInteger(~~vValue); + return new cXSInteger(+vValue); throw new cException("FORG0001"); } if (vValue instanceof cXSBoolean) return new cXSInteger(vValue * 1); if (fXSAnyAtomicType_isNumeric(vValue)) { - if (fIsNaN(vValue) || !fIsFinite(vValue)) - throw new cException("FOCA0002" - , "Cannot convert '" + vValue + "' to xs:integer" - ); - return new cXSInteger(~~vValue); + if (!fIsNaN(vValue) && fIsFinite(vValue)) + return new cXSInteger(+vValue); + throw new cException("FOCA0002" + + ); } - throw new cException("XPTY0004" - , "Casting value '" + vValue + "' to xs:integer can never succeed" + // + throw new cException("XPTY0004" + ); }; +// fStaticContext_defineSystemDataType("integer", cXSInteger); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSNonPositiveInteger(nValue) { this.value = nValue; @@ -4070,11 +5016,31 @@ cXSNonPositiveInteger.prototype = new cXSInteger; cXSNonPositiveInteger.prototype.builtInKind = cXSConstants.NONPOSITIVEINTEGER_DT; cXSNonPositiveInteger.cast = function(vValue) { - return new cXSNonPositiveInteger(cNumber(vValue)); + var oValue; + try { + oValue = cXSInteger.cast(vValue); + } + catch (oError) { + throw oError; + } + // facet validation + if (oValue.value <= 0) + return new cXSNonPositiveInteger(oValue.value); + // + throw new cException("FORG0001"); }; +// fStaticContext_defineSystemDataType("nonPositiveInteger", cXSNonPositiveInteger); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSNegativeInteger(nValue) { this.value = nValue; @@ -4084,11 +5050,31 @@ cXSNegativeInteger.prototype = new cXSNonPositiveInteger; cXSNegativeInteger.prototype.builtInKind = cXSConstants.NEGATIVEINTEGER_DT; cXSNegativeInteger.cast = function(vValue) { - return new cXSNegativeInteger(cNumber(vValue)); + var oValue; + try { + oValue = cXSInteger.cast(vValue); + } + catch (oError) { + throw oError; + } + // facet validation + if (oValue.value <= -1) + return new cXSNegativeInteger(oValue.value); + // + throw new cException("FORG0001"); }; +// fStaticContext_defineSystemDataType("negativeInteger", cXSNegativeInteger); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSLong(nValue) { this.value = nValue; @@ -4098,11 +5084,31 @@ cXSLong.prototype = new cXSInteger; cXSLong.prototype.builtInKind = cXSConstants.LONG_DT; cXSLong.cast = function(vValue) { - return new cXSLong(cNumber(vValue)); + var oValue; + try { + oValue = cXSInteger.cast(vValue); + } + catch (oError) { + throw oError; + } + // facet validation + if (oValue.value <= 9223372036854775807 && oValue.value >= -9223372036854775808) + return new cXSLong(oValue.value); + // + throw new cException("FORG0001"); }; +// fStaticContext_defineSystemDataType("long", cXSLong); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSInt(nValue) { this.value = nValue; @@ -4112,11 +5118,31 @@ cXSInt.prototype = new cXSLong; cXSInt.prototype.builtInKind = cXSConstants.INT_DT; cXSInt.cast = function(vValue) { - return new cXSInt(cNumber(vValue)); + var oValue; + try { + oValue = cXSInteger.cast(vValue); + } + catch (oError) { + throw oError; + } + // facet validation + if (oValue.value <= 2147483647 && oValue.value >= -2147483648) + return new cXSInt(oValue.value); + // + throw new cException("FORG0001"); }; +// fStaticContext_defineSystemDataType("int", cXSInt); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSShort(nValue) { this.value = nValue; @@ -4126,11 +5152,31 @@ cXSShort.prototype = new cXSInt; cXSShort.prototype.builtInKind = cXSConstants.SHORT_DT; cXSShort.cast = function(vValue) { - return new cXSShort(cNumber(vValue)); + var oValue; + try { + oValue = cXSInteger.cast(vValue); + } + catch (oError) { + throw oError; + } + // facet validation + if (oValue.value <= 32767 && oValue.value >= -32768) + return new cXSShort(oValue.value); + // + throw new cException("FORG0001"); }; +// fStaticContext_defineSystemDataType("short", cXSShort); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSByte(nValue) { this.value = nValue; @@ -4140,11 +5186,31 @@ cXSByte.prototype = new cXSShort; cXSByte.prototype.builtInKind = cXSConstants.BYTE_DT; cXSByte.cast = function(vValue) { - return new cXSByte(cNumber(vValue)); + var oValue; + try { + oValue = cXSInteger.cast(vValue); + } + catch (oError) { + throw oError; + } + // facet validation + if (oValue.value <= 127 && oValue.value >= -128) + return new cXSByte(oValue.value); + // + throw new cException("FORG0001"); }; +// fStaticContext_defineSystemDataType("byte", cXSByte); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSNonNegativeInteger(nValue) { this.value = nValue; @@ -4154,11 +5220,31 @@ cXSNonNegativeInteger.prototype = new cXSInteger; cXSNonNegativeInteger.prototype.builtInKind = cXSConstants.NONNEGATIVEINTEGER_DT; cXSNonNegativeInteger.cast = function(vValue) { - return new cXSNonNegativeInteger(cNumber(vValue)); + var oValue; + try { + oValue = cXSInteger.cast(vValue); + } + catch (oError) { + throw oError; + } + // facet validation + if (oValue.value >= 0) + return new cXSNonNegativeInteger(oValue.value); + // + throw new cException("FORG0001"); }; +// fStaticContext_defineSystemDataType("nonNegativeInteger", cXSNonNegativeInteger); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSPositiveInteger(nValue) { this.value = nValue; @@ -4168,11 +5254,31 @@ cXSPositiveInteger.prototype = new cXSNonNegativeInteger; cXSPositiveInteger.prototype.builtInKind = cXSConstants.POSITIVEINTEGER_DT; cXSPositiveInteger.cast = function(vValue) { - return new cXSPositiveInteger(cNumber(vValue)); + var oValue; + try { + oValue = cXSInteger.cast(vValue); + } + catch (oError) { + throw oError; + } + // facet validation + if (oValue.value >= 1) + return new cXSPositiveInteger(oValue.value); + // + throw new cException("FORG0001"); }; +// fStaticContext_defineSystemDataType("positiveInteger", cXSPositiveInteger); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSUnsignedLong(nValue) { this.value = nValue; @@ -4182,11 +5288,31 @@ cXSUnsignedLong.prototype = new cXSNonNegativeInteger; cXSUnsignedLong.prototype.builtInKind = cXSConstants.UNSIGNEDLONG_DT; cXSUnsignedLong.cast = function(vValue) { - return new cXSUnsignedLong(cNumber(vValue)); + var oValue; + try { + oValue = cXSInteger.cast(vValue); + } + catch (oError) { + throw oError; + } + // facet validation + if (oValue.value >= 1 && oValue.value <= 18446744073709551615) + return new cXSUnsignedLong(oValue.value); + // + throw new cException("FORG0001"); }; +// fStaticContext_defineSystemDataType("unsignedLong", cXSUnsignedLong); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSUnsignedInt(nValue) { this.value = nValue; @@ -4196,11 +5322,31 @@ cXSUnsignedInt.prototype = new cXSNonNegativeInteger; cXSUnsignedInt.prototype.builtInKind = cXSConstants.UNSIGNEDINT_DT; cXSUnsignedInt.cast = function(vValue) { - return new cXSUnsignedInt(cNumber(vValue)); + var oValue; + try { + oValue = cXSInteger.cast(vValue); + } + catch (oError) { + throw oError; + } + // facet validation + if (oValue.value >= 1 && oValue.value <= 4294967295) + return new cXSUnsignedInt(oValue.value); + // + throw new cException("FORG0001"); }; +// fStaticContext_defineSystemDataType("unsignedInt", cXSUnsignedInt); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSUnsignedShort(nValue) { this.value = nValue; @@ -4210,11 +5356,31 @@ cXSUnsignedShort.prototype = new cXSUnsignedInt; cXSUnsignedShort.prototype.builtInKind = cXSConstants.UNSIGNEDSHORT_DT; cXSUnsignedShort.cast = function(vValue) { - return new cXSUnsignedShort(cNumber(vValue)); + var oValue; + try { + oValue = cXSInteger.cast(vValue); + } + catch (oError) { + throw oError; + } + // facet validation + if (oValue.value >= 1 && oValue.value <= 65535) + return new cXSUnsignedShort(oValue.value); + // + throw new cException("FORG0001"); }; +// fStaticContext_defineSystemDataType("unsignedShort", cXSUnsignedShort); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSUnsignedByte(nValue) { this.value = nValue; @@ -4224,11 +5390,31 @@ cXSUnsignedByte.prototype = new cXSUnsignedShort; cXSUnsignedByte.prototype.builtInKind = cXSConstants.UNSIGNEDBYTE_DT; cXSUnsignedByte.cast = function(vValue) { - return new cXSUnsignedByte(cNumber(vValue)); + var oValue; + try { + oValue = cXSInteger.cast(vValue); + } + catch (oError) { + throw oError; + } + // facet validation + if (oValue.value >= 1 && oValue.value <= 255) + return new cXSUnsignedByte(oValue.value); + // + throw new cException("FORG0001"); }; +// fStaticContext_defineSystemDataType("unsignedByte", cXSUnsignedByte); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSNormalizedString(sValue) { this.value = sValue; @@ -4241,8 +5427,17 @@ cXSNormalizedString.cast = function(vValue) { return new cXSNormalizedString(cString(vValue)); }; +// fStaticContext_defineSystemDataType("normalizedString", cXSNormalizedString); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSToken(sValue) { this.value = sValue; @@ -4255,8 +5450,17 @@ cXSToken.cast = function(vValue) { return new cXSToken(cString(vValue)); }; +// fStaticContext_defineSystemDataType("token", cXSToken); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSName(sValue) { this.value = sValue; @@ -4269,8 +5473,17 @@ cXSName.cast = function(vValue) { return new cXSName(cString(vValue)); }; +// fStaticContext_defineSystemDataType("Name", cXSName); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSNCName(sValue) { this.value = sValue; @@ -4283,8 +5496,17 @@ cXSNCName.cast = function(vValue) { return new cXSNCName(cString(vValue)); }; +// fStaticContext_defineSystemDataType("NCName", cXSNCName); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSENTITY(sValue) { this.value = sValue; @@ -4297,8 +5519,17 @@ cXSENTITY.cast = function(vValue) { return new cXSENTITY(cString(vValue)); }; +// fStaticContext_defineSystemDataType("ENTITY", cXSENTITY); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSID(sValue) { this.value = sValue; @@ -4311,8 +5542,40 @@ cXSID.cast = function(vValue) { return new cXSID(cString(vValue)); }; +// fStaticContext_defineSystemDataType("ID", cXSID); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ + +function cXSIDREF(sValue) { + this.value = sValue; +}; + +cXSIDREF.prototype = new cXSNCName; +cXSIDREF.prototype.builtInKind = cXSConstants.IDREF_DT; + +cXSIDREF.cast = function(vValue) { + return new cXSIDREF(cString(vValue)); +}; + +// +fStaticContext_defineSystemDataType("IDREF", cXSIDREF); + +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSLanguage(sValue) { this.value = sValue; @@ -4325,8 +5588,17 @@ cXSLanguage.cast = function(vValue) { return new cXSLanguage(cString(vValue)); }; +// fStaticContext_defineSystemDataType("language", cXSLanguage); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXSNMTOKEN(sValue) { this.value = sValue; @@ -4339,13 +5611,30 @@ cXSNMTOKEN.cast = function(vValue) { return new cXSNMTOKEN(cString(vValue)); }; +// fStaticContext_defineSystemDataType("NMTOKEN", cXSNMTOKEN); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXTItem() { }; +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXTNode() { @@ -4354,50 +5643,104 @@ function cXTNode() { cXTNode.prototype = new cXTItem; +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXTAttribute() { }; cXTAttribute.prototype = new cXTNode; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXTComment() { }; cXTComment.prototype = new cXTNode; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXTDocument() { }; cXTDocument.prototype = new cXTNode; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXTElement() { }; cXTElement.prototype = new cXTNode; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXTProcessingInstruction() { }; cXTProcessingInstruction.prototype = new cXTNode; - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ function cXTText() { }; cXTText.prototype = new cXTNode; +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ - - +/* + 12.1 Comparisons of base64Binary and hexBinary Values + op:hexBinary-equal + op:base64Binary-equal +*/ hStaticContext_operators["hexBinary-equal"] = function(oLeft, oRight) { return new cXSBoolean(oLeft.valueOf() == oRight.valueOf()); }; @@ -4405,83 +5748,172 @@ hStaticContext_operators["hexBinary-equal"] = function(oLeft, oRight) { hStaticContext_operators["base64Binary-equal"] = function(oLeft, oRight) { return new cXSBoolean(oLeft.valueOf() == oRight.valueOf()); }; +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ +/* + 9.2 Operators on Boolean Values + op:boolean-equal + op:boolean-less-than + op:boolean-greater-than +*/ - - +// 9.2 Operators on Boolean Values +// op:boolean-equal($value1 as xs:boolean, $value2 as xs:boolean) as xs:boolean hStaticContext_operators["boolean-equal"] = function(oLeft, oRight) { return new cXSBoolean(oLeft.valueOf() == oRight.valueOf()); }; +// op:boolean-less-than($arg1 as xs:boolean, $arg2 as xs:boolean) as xs:boolean hStaticContext_operators["boolean-less-than"] = function(oLeft, oRight) { return new cXSBoolean(oLeft.valueOf() < oRight.valueOf()); }; +// op:boolean-greater-than($arg1 as xs:boolean, $arg2 as xs:boolean) as xs:boolean hStaticContext_operators["boolean-greater-than"] = function(oLeft, oRight) { return new cXSBoolean(oLeft.valueOf() > oRight.valueOf()); }; +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ + +/* + 10.4 Comparison Operators on Duration, Date and Time Values + op:yearMonthDuration-less-than + op:yearMonthDuration-greater-than + op:dayTimeDuration-less-than + op:dayTimeDuration-greater-than + op:duration-equal + op:dateTime-equal + op:dateTime-less-than + op:dateTime-greater-than + op:date-equal + op:date-less-than + op:date-greater-than + op:time-equal + op:time-less-than + op:time-greater-than + op:gYearMonth-equal + op:gYear-equal + op:gMonthDay-equal + op:gMonth-equal + op:gDay-equal + + 10.6 Arithmetic Operators on Durations + op:add-yearMonthDurations + op:subtract-yearMonthDurations + op:multiply-yearMonthDuration + op:divide-yearMonthDuration + op:divide-yearMonthDuration-by-yearMonthDuration + op:add-dayTimeDurations + op:subtract-dayTimeDurations + op:multiply-dayTimeDuration + op:divide-dayTimeDuration + op:divide-dayTimeDuration-by-dayTimeDuration + 10.8 Arithmetic Operators on Durations, Dates and Times + op:subtract-dateTimes + op:subtract-dates + op:subtract-times + op:add-yearMonthDuration-to-dateTime + op:add-dayTimeDuration-to-dateTime + op:subtract-yearMonthDuration-from-dateTime + op:subtract-dayTimeDuration-from-dateTime + op:add-yearMonthDuration-to-date + op:add-dayTimeDuration-to-date + op:subtract-yearMonthDuration-from-date + op:subtract-dayTimeDuration-from-date + op:add-dayTimeDuration-to-time + op:subtract-dayTimeDuration-from-time +*/ +// 10.4 Comparison Operators on Duration, Date and Time Values +// op:yearMonthDuration-less-than($arg1 as xs:yearMonthDuration, $arg2 as xs:yearMonthDuration) as xs:boolean hStaticContext_operators["yearMonthDuration-less-than"] = function(oLeft, oRight) { return new cXSBoolean(fOperator_yearMonthDuration_toMonths(oLeft) < fOperator_yearMonthDuration_toMonths(oRight)); }; +// op:yearMonthDuration-greater-than($arg1 as xs:yearMonthDuration, $arg2 as xs:yearMonthDuration) as xs:boolean hStaticContext_operators["yearMonthDuration-greater-than"] = function(oLeft, oRight) { return new cXSBoolean(fOperator_yearMonthDuration_toMonths(oLeft) > fOperator_yearMonthDuration_toMonths(oRight)); }; +// op:dayTimeDuration-less-than($arg1 as dayTimeDuration, $arg2 as dayTimeDuration) as xs:boolean hStaticContext_operators["dayTimeDuration-less-than"] = function(oLeft, oRight) { return new cXSBoolean(fOperator_dayTimeDuration_toSeconds(oLeft) < fOperator_dayTimeDuration_toSeconds(oRight)); }; +// op:dayTimeDuration-greater-than($arg1 as dayTimeDuration, $arg2 as dayTimeDuration) as xs:boolean hStaticContext_operators["dayTimeDuration-greater-than"] = function(oLeft, oRight) { return new cXSBoolean(fOperator_dayTimeDuration_toSeconds(oLeft) > fOperator_dayTimeDuration_toSeconds(oRight)); }; +// op:duration-equal($arg1 as xs:duration, $arg2 as xs:duration) as xs:boolean hStaticContext_operators["duration-equal"] = function(oLeft, oRight) { return new cXSBoolean(oLeft.negative == oRight.negative && fOperator_yearMonthDuration_toMonths(oLeft) == fOperator_yearMonthDuration_toMonths(oRight) && fOperator_dayTimeDuration_toSeconds(oLeft) == fOperator_dayTimeDuration_toSeconds(oRight)); }; +// op:dateTime-equal($arg1 as xs:dateTime, $arg2 as xs:dateTime) as xs:boolean hStaticContext_operators["dateTime-equal"] = function(oLeft, oRight) { return fOperator_compareDateTimes(oLeft, oRight, 'eq'); }; +// op:dateTime-less-than($arg1 as xs:dateTime, $arg2 as xs:dateTime) as xs:boolean hStaticContext_operators["dateTime-less-than"] = function(oLeft, oRight) { return fOperator_compareDateTimes(oLeft, oRight, 'lt'); }; +//op:dateTime-greater-than($arg1 as xs:dateTime, $arg2 as xs:dateTime) as xs:boolean hStaticContext_operators["dateTime-greater-than"] = function(oLeft, oRight) { return fOperator_compareDateTimes(oLeft, oRight, 'gt'); }; +// op:date-equal($arg1 as xs:date, $arg2 as xs:date) as xs:boolean hStaticContext_operators["date-equal"] = function(oLeft, oRight) { return fOperator_compareDates(oLeft, oRight, 'eq'); }; +// op:date-less-than($arg1 as xs:date, $arg2 as xs:date) as xs:boolean hStaticContext_operators["date-less-than"] = function(oLeft, oRight) { return fOperator_compareDates(oLeft, oRight, 'lt'); }; +// op:date-greater-than($arg1 as xs:date, $arg2 as xs:date) as xs:boolean hStaticContext_operators["date-greater-than"] = function(oLeft, oRight) { return fOperator_compareDates(oLeft, oRight, 'gt'); }; +// op:time-equal($arg1 as xs:time, $arg2 as xs:time) as xs:boolean hStaticContext_operators["time-equal"] = function(oLeft, oRight) { return fOperator_compareTimes(oLeft, oRight, 'eq'); }; +// op:time-less-than($arg1 as xs:time, $arg2 as xs:time) as xs:boolean hStaticContext_operators["time-less-than"] = function(oLeft, oRight) { return fOperator_compareTimes(oLeft, oRight, 'lt'); }; +// op:time-greater-than($arg1 as xs:time, $arg2 as xs:time) as xs:boolean hStaticContext_operators["time-greater-than"] = function(oLeft, oRight) { return fOperator_compareTimes(oLeft, oRight, 'gt'); }; +// op:gYearMonth-equal($arg1 as xs:gYearMonth, $arg2 as xs:gYearMonth) as xs:boolean hStaticContext_operators["gYearMonth-equal"] = function(oLeft, oRight) { return fOperator_compareDateTimes( new cXSDateTime(oLeft.year, oLeft.month, fXSDate_getDaysForYearMonth(oLeft.year, oLeft.month), 0, 0, 0, oLeft.timezone == null ? this.timezone : oLeft.timezone), @@ -4490,6 +5922,7 @@ hStaticContext_operators["gYearMonth-equal"] = function(oLeft, oRight) { ); }; +// op:gYear-equal($arg1 as xs:gYear, $arg2 as xs:gYear) as xs:boolean hStaticContext_operators["gYear-equal"] = function(oLeft, oRight) { return fOperator_compareDateTimes( new cXSDateTime(oLeft.year, 1, 1, 0, 0, 0, oLeft.timezone == null ? this.timezone : oLeft.timezone), @@ -4498,6 +5931,7 @@ hStaticContext_operators["gYear-equal"] = function(oLeft, oRight) { ); }; +// op:gMonthDay-equal($arg1 as xs:gMonthDay, $arg2 as xs:gMonthDay) as xs:boolean hStaticContext_operators["gMonthDay-equal"] = function(oLeft, oRight) { return fOperator_compareDateTimes( new cXSDateTime(1972, oLeft.month, oLeft.day, 0, 0, 0, oLeft.timezone == null ? this.timezone : oLeft.timezone), @@ -4506,6 +5940,7 @@ hStaticContext_operators["gMonthDay-equal"] = function(oLeft, oRight) { ); }; +// op:gMonth-equal($arg1 as xs:gMonth, $arg2 as xs:gMonth) as xs:boolean hStaticContext_operators["gMonth-equal"] = function(oLeft, oRight) { return fOperator_compareDateTimes( new cXSDateTime(1972, oLeft.month, fXSDate_getDaysForYearMonth(1972, oRight.month), 0, 0, 0, oLeft.timezone == null ? this.timezone : oLeft.timezone), @@ -4514,6 +5949,7 @@ hStaticContext_operators["gMonth-equal"] = function(oLeft, oRight) { ); }; +// op:gDay-equal($arg1 as xs:gDay, $arg2 as xs:gDay) as xs:boolean hStaticContext_operators["gDay-equal"] = function(oLeft, oRight) { return fOperator_compareDateTimes( new cXSDateTime(1972, 12, oLeft.day, 0, 0, 0, oLeft.timezone == null ? this.timezone : oLeft.timezone), @@ -4522,104 +5958,131 @@ hStaticContext_operators["gDay-equal"] = function(oLeft, oRight) { ); }; +// 10.6 Arithmetic Operators on Durations +// op:add-yearMonthDurations($arg1 as xs:yearMonthDuration, $arg2 as xs:yearMonthDuration) as xs:yearMonthDuration hStaticContext_operators["add-yearMonthDurations"] = function(oLeft, oRight) { return fOperator_yearMonthDuration_fromMonths(fOperator_yearMonthDuration_toMonths(oLeft) + fOperator_yearMonthDuration_toMonths(oRight)); }; +// op:subtract-yearMonthDurations($arg1 as xs:yearMonthDuration, $arg2 as xs:yearMonthDuration) as xs:yearMonthDuration hStaticContext_operators["subtract-yearMonthDurations"] = function(oLeft, oRight) { return fOperator_yearMonthDuration_fromMonths(fOperator_yearMonthDuration_toMonths(oLeft) - fOperator_yearMonthDuration_toMonths(oRight)); }; +// op:multiply-yearMonthDuration($arg1 as xs:yearMonthDuration, $arg2 as xs:double) as xs:yearMonthDuration hStaticContext_operators["multiply-yearMonthDuration"] = function(oLeft, oRight) { return fOperator_yearMonthDuration_fromMonths(fOperator_yearMonthDuration_toMonths(oLeft) * oRight); }; +// op:divide-yearMonthDuration($arg1 as xs:yearMonthDuration, $arg2 as xs:double) as xs:yearMonthDuration hStaticContext_operators["divide-yearMonthDuration"] = function(oLeft, oRight) { return fOperator_yearMonthDuration_fromMonths(fOperator_yearMonthDuration_toMonths(oLeft) / oRight); }; +// op:divide-yearMonthDuration-by-yearMonthDuration($arg1 as xs:yearMonthDuration, $arg2 as xs:yearMonthDuration) as xs:decimal hStaticContext_operators["divide-yearMonthDuration-by-yearMonthDuration"] = function(oLeft, oRight) { return new cXSDecimal(fOperator_yearMonthDuration_toMonths(oLeft) / fOperator_yearMonthDuration_toMonths(oRight)); }; +// op:add-dayTimeDurations($arg1 as xs:dayTimeDuration, $arg2 as xs:dayTimeDuration) as xs:dayTimeDuration hStaticContext_operators["add-dayTimeDurations"] = function(oLeft, oRight) { return fOperator_dayTimeDuration_fromSeconds(fOperator_dayTimeDuration_toSeconds(oLeft) + fOperator_dayTimeDuration_toSeconds(oRight)); }; +// op:subtract-dayTimeDurations($arg1 as xs:dayTimeDuration, $arg2 as xs:dayTimeDuration) as xs:dayTimeDuration hStaticContext_operators["subtract-dayTimeDurations"] = function(oLeft, oRight) { return fOperator_dayTimeDuration_fromSeconds(fOperator_dayTimeDuration_toSeconds(oLeft) - fOperator_dayTimeDuration_toSeconds(oRight)); }; +// op:multiply-dayTimeDurations($arg1 as xs:dayTimeDuration, $arg2 as xs:double) as xs:dayTimeDuration hStaticContext_operators["multiply-dayTimeDuration"] = function(oLeft, oRight) { return fOperator_dayTimeDuration_fromSeconds(fOperator_dayTimeDuration_toSeconds(oLeft) * oRight); }; +// op:divide-dayTimeDurations($arg1 as xs:dayTimeDuration, $arg2 as xs:double) as xs:dayTimeDuration hStaticContext_operators["divide-dayTimeDuration"] = function(oLeft, oRight) { return fOperator_dayTimeDuration_fromSeconds(fOperator_dayTimeDuration_toSeconds(oLeft) / oRight); }; +// op:divide-dayTimeDuration-by-dayTimeDuration($arg1 as xs:dayTimeDuration, $arg2 as xs:dayTimeDuration) as xs:decimal hStaticContext_operators["divide-dayTimeDuration-by-dayTimeDuration"] = function(oLeft, oRight) { return new cXSDecimal(fOperator_dayTimeDuration_toSeconds(oLeft) / fOperator_dayTimeDuration_toSeconds(oRight)); }; +// 10.8 Arithmetic Operators on Durations, Dates and Times +// op:subtract-dateTimes($arg1 as xs:dateTime, $arg2 as xs:dateTime) as xs:dayTimeDuration hStaticContext_operators["subtract-dateTimes"] = function(oLeft, oRight) { return fOperator_dayTimeDuration_fromSeconds(fOperator_dateTime_toSeconds(oLeft) - fOperator_dateTime_toSeconds(oRight)); }; +// op:subtract-dates($arg1 as xs:date, $arg2 as xs:date) as xs:dayTimeDuration hStaticContext_operators["subtract-dates"] = function(oLeft, oRight) { return fOperator_dayTimeDuration_fromSeconds(fOperator_dateTime_toSeconds(oLeft) - fOperator_dateTime_toSeconds(oRight)); }; +// op:subtract-times($arg1 as xs:time, $arg2 as xs:time) as xs:dayTimeDuration hStaticContext_operators["subtract-times"] = function(oLeft, oRight) { return fOperator_dayTimeDuration_fromSeconds(fOperator_time_toSeconds(oLeft) - fOperator_time_toSeconds(oRight)); }; +// op:add-yearMonthDuration-to-dateTime($arg1 as xs:dateTime, $arg2 as xs:yearMonthDuration) as xs:dateTime hStaticContext_operators["add-yearMonthDuration-to-dateTime"] = function(oLeft, oRight) { return fOperator_addYearMonthDuration2DateTime(oLeft, oRight, '+'); }; +// op:add-dayTimeDuration-to-dateTime($arg1 as xs:dateTime, $arg2 as xs:dayTimeDuration) as xs:dateTime hStaticContext_operators["add-dayTimeDuration-to-dateTime"] = function(oLeft, oRight) { return fOperator_addDayTimeDuration2DateTime(oLeft, oRight, '+'); }; +// op:subtract-yearMonthDuration-from-dateTime($arg1 as xs:dateTime, $arg2 as xs:yearMonthDuration) as xs:dateTime hStaticContext_operators["subtract-yearMonthDuration-from-dateTime"] = function(oLeft, oRight) { return fOperator_addYearMonthDuration2DateTime(oLeft, oRight, '-'); }; +// op:subtract-dayTimeDuration-from-dateTime($arg1 as xs:dateTime, $arg2 as xs:dayTimeDuration) as xs:dateTime hStaticContext_operators["subtract-dayTimeDuration-from-dateTime"] = function(oLeft, oRight) { return fOperator_addDayTimeDuration2DateTime(oLeft, oRight, '-'); }; +// op:add-yearMonthDuration-to-date($arg1 as xs:date, $arg2 as xs:yearMonthDuration) as xs:date hStaticContext_operators["add-yearMonthDuration-to-date"] = function(oLeft, oRight) { return fOperator_addYearMonthDuration2DateTime(oLeft, oRight, '+'); }; +// op:add-dayTimeDuration-to-date($arg1 as xs:date, $arg2 as xs:dayTimeDuration) as xs:date hStaticContext_operators["add-dayTimeDuration-to-date"] = function(oLeft, oRight) { return fOperator_addDayTimeDuration2DateTime(oLeft, oRight, '+'); }; +// op:subtract-yearMonthDuration-from-date($arg1 as xs:date, $arg2 as xs:yearMonthDuration) as xs:date hStaticContext_operators["subtract-yearMonthDuration-from-date"] = function(oLeft, oRight) { return fOperator_addYearMonthDuration2DateTime(oLeft, oRight, '-'); }; +// op:subtract-dayTimeDuration-from-date($arg1 as xs:date, $arg2 as xs:dayTimeDuration) as xs:date hStaticContext_operators["subtract-dayTimeDuration-from-date"] = function(oLeft, oRight) { return fOperator_addDayTimeDuration2DateTime(oLeft, oRight, '-'); }; +// op:add-dayTimeDuration-to-time($arg1 as xs:time, $arg2 as xs:dayTimeDuration) as xs:time hStaticContext_operators["add-dayTimeDuration-to-time"] = function(oLeft, oRight) { var oValue = new cXSTime(oLeft.hours, oLeft.minutes, oLeft.seconds, oLeft.timezone); oValue.hours += oRight.hours; oValue.minutes += oRight.minutes; oValue.seconds += oRight.seconds; - return fXSTime_normalize(oValue); + // + return fXSTime_normalize(oValue); }; +// op:subtract-dayTimeDuration-from-time($arg1 as xs:time, $arg2 as xs:dayTimeDuration) as xs:time hStaticContext_operators["subtract-dayTimeDuration-from-time"] = function(oLeft, oRight) { var oValue = new cXSTime(oLeft.hours, oLeft.minutes, oLeft.seconds, oLeft.timezone); oValue.hours -= oRight.hours; oValue.minutes -= oRight.minutes; oValue.seconds -= oRight.seconds; - return fXSTime_normalize(oValue); + // + return fXSTime_normalize(oValue); }; function fOperator_compareTimes(oLeft, oRight, sComparator) { @@ -4633,7 +6096,8 @@ function fOperator_compareDates(oLeft, oRight, sComparator) { }; function fOperator_compareDateTimes(oLeft, oRight, sComparator) { - var oTimezone = new cXSDayTimeDuration(0, 0, 0, 0), + // Adjust object time zone to Z and compare as strings + var oTimezone = new cXSDayTimeDuration(0, 0, 0, 0), sLeft = fFunction_dateTime_adjustTimezone(oLeft, oTimezone).toString(), sRight = fFunction_dateTime_adjustTimezone(oRight, oTimezone).toString(); return new cXSBoolean(sComparator == 'lt' ? sLeft < sRight : sComparator == 'gt' ? sLeft > sRight : sLeft == sRight); @@ -4646,13 +6110,17 @@ function fOperator_addYearMonthDuration2DateTime(oLeft, oRight, sOperator) { else if (oLeft instanceof cXSDateTime) oValue = new cXSDateTime(oLeft.year, oLeft.month, oLeft.day, oLeft.hours, oLeft.minutes, oLeft.seconds, oLeft.timezone, oLeft.negative); - oValue.year = oValue.year + oRight.year * (sOperator == '-' ?-1 : 1); + // + oValue.year = oValue.year + oRight.year * (sOperator == '-' ?-1 : 1); oValue.month = oValue.month + oRight.month * (sOperator == '-' ?-1 : 1); - fXSDate_normalize(oValue, true); - var nDay = fXSDate_getDaysForYearMonth(oValue.year, oValue.month); + // + fXSDate_normalize(oValue, true); + // Correct day if out of month range + var nDay = fXSDate_getDaysForYearMonth(oValue.year, oValue.month); if (oValue.day > nDay) oValue.day = nDay; - return oValue; + // + return oValue; }; function fOperator_addDayTimeDuration2DateTime(oLeft, oRight, sOperator) { @@ -4661,7 +6129,8 @@ function fOperator_addDayTimeDuration2DateTime(oLeft, oRight, sOperator) { var nValue = (oRight.hours * 60 + oRight.minutes) * 60 + oRight.seconds; oValue = new cXSDate(oLeft.year, oLeft.month, oLeft.day, oLeft.timezone, oLeft.negative); oValue.day = oValue.day + oRight.day * (sOperator == '-' ?-1 : 1) - 1 * (nValue && sOperator == '-'); - fXSDate_normalize(oValue); + // + fXSDate_normalize(oValue); } else if (oLeft instanceof cXSDateTime) { @@ -4670,11 +6139,13 @@ function fOperator_addDayTimeDuration2DateTime(oLeft, oRight, sOperator) { oValue.minutes = oValue.minutes + oRight.minutes * (sOperator == '-' ?-1 : 1); oValue.hours = oValue.hours + oRight.hours * (sOperator == '-' ?-1 : 1); oValue.day = oValue.day + oRight.day * (sOperator == '-' ?-1 : 1); - fXSDateTime_normalize(oValue); + // + fXSDateTime_normalize(oValue); } return oValue; }; +// xs:dayTimeDuration to/from seconds function fOperator_dayTimeDuration_toSeconds(oDuration) { return (((oDuration.day * 24 + oDuration.hours) * 60 + oDuration.minutes) * 60 + oDuration.seconds) * (oDuration.negative ? -1 : 1); }; @@ -4688,6 +6159,7 @@ function fOperator_dayTimeDuration_fromSeconds(nValue) { return new cXSDayTimeDuration(nDays, nHours, nMinutes, nSeconds, bNegative); }; +// xs:yearMonthDuration to/from months function fOperator_yearMonthDuration_toMonths(oDuration) { return (oDuration.year * 12 + oDuration.month) * (oDuration.negative ? -1 : 1); }; @@ -4699,10 +6171,12 @@ function fOperator_yearMonthDuration_fromMonths(nValue) { return new cXSYearMonthDuration(nYears, nMonths, nNegative); }; +// xs:time to seconds function fOperator_time_toSeconds(oTime) { return oTime.seconds + (oTime.minutes - (oTime.timezone != null ? oTime.timezone % 60 : 0) + (oTime.hours - (oTime.timezone != null ? ~~(oTime.timezone / 60) : 0)) * 60) * 60; }; +// This function unlike all other date-related functions rely on interpretor's dateTime handling function fOperator_dateTime_toSeconds(oValue) { var oDate = new cDate((oValue.negative ? -1 : 1) * oValue.year, oValue.month, oValue.day, 0, 0, 0, 0); if (oValue instanceof cXSDateTime) { @@ -4715,27 +6189,77 @@ function fOperator_dateTime_toSeconds(oValue) { return oDate.getTime() / 1000; }; +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ +/* + 14 Functions and Operators on Nodes + op:is-same-node + op:node-before + op:node-after +*/ - +// 14 Operators on Nodes +// op:is-same-node($parameter1 as node(), $parameter2 as node()) as xs:boolean hStaticContext_operators["is-same-node"] = function(oLeft, oRight) { return new cXSBoolean(this.DOMAdapter.isSameNode(oLeft, oRight)); }; +// op:node-before($parameter1 as node(), $parameter2 as node()) as xs:boolean hStaticContext_operators["node-before"] = function(oLeft, oRight) { return new cXSBoolean(!!(this.DOMAdapter.compareDocumentPosition(oLeft, oRight) & 4)); }; +// op:node-after($parameter1 as node(), $parameter2 as node()) as xs:boolean hStaticContext_operators["node-after"] = function(oLeft, oRight) { return new cXSBoolean(!!(this.DOMAdapter.compareDocumentPosition(oLeft, oRight) & 2)); }; +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ +/* + 13.1 Operators on NOTATION + op:NOTATION-equal +*/ +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ +/* + 6.2 Operators on Numeric Values + op:numeric-add + op:numeric-subtract + op:numeric-multiply + op:numeric-divide + op:numeric-integer-divide + op:numeric-mod + op:numeric-unary-plus + op:numeric-unary-minus + 6.3 Comparison Operators on Numeric Values + op:numeric-equal + op:numeric-less-than + op:numeric-greater-than +*/ - - - +// 6.2 Operators on Numeric Values function fFunctionCall_numeric_getPower(oLeft, oRight) { if (fIsNaN(oLeft) || (cMath.abs(oLeft) == nInfinity) || fIsNaN(oRight) || (cMath.abs(oRight) == nInfinity)) return 0; @@ -4745,6 +6269,7 @@ function fFunctionCall_numeric_getPower(oLeft, oRight) { return nPower + (nPower % 2 ? 0 : 1); }; +// op:numeric-add($arg1 as numeric, $arg2 as numeric) as numeric hStaticContext_operators["numeric-add"] = function(oLeft, oRight) { var nLeft = oLeft.valueOf(), nRight = oRight.valueOf(), @@ -4752,6 +6277,7 @@ hStaticContext_operators["numeric-add"] = function(oLeft, oRight) { return fOperator_numeric_getResultOfType(oLeft, oRight, ((nLeft * nPower) + (nRight * nPower))/nPower); }; +// op:numeric-subtract($arg1 as numeric, $arg2 as numeric) as numeric hStaticContext_operators["numeric-subtract"] = function(oLeft, oRight) { var nLeft = oLeft.valueOf(), nRight = oRight.valueOf(), @@ -4759,6 +6285,7 @@ hStaticContext_operators["numeric-subtract"] = function(oLeft, oRight) { return fOperator_numeric_getResultOfType(oLeft, oRight, ((nLeft * nPower) - (nRight * nPower))/nPower); }; +// op:numeric-multiply($arg1 as numeric, $arg2 as numeric) as numeric hStaticContext_operators["numeric-multiply"] = function(oLeft, oRight) { var nLeft = oLeft.valueOf(), nRight = oRight.valueOf(), @@ -4766,6 +6293,7 @@ hStaticContext_operators["numeric-multiply"] = function(oLeft, oRight) { return fOperator_numeric_getResultOfType(oLeft, oRight, ((nLeft * nPower) * (nRight * nPower))/(nPower * nPower)); }; +// op:numeric-divide($arg1 as numeric, $arg2 as numeric) as numeric hStaticContext_operators["numeric-divide"] = function(oLeft, oRight) { var nLeft = oLeft.valueOf(), nRight = oRight.valueOf(), @@ -4773,10 +6301,13 @@ hStaticContext_operators["numeric-divide"] = function(oLeft, oRight) { return fOperator_numeric_getResultOfType(oLeft, oRight, (oLeft * nPower) / (oRight * nPower)); }; +// op:numeric-integer-divide($arg1 as numeric, $arg2 as numeric) as xs:integer hStaticContext_operators["numeric-integer-divide"] = function(oLeft, oRight) { - return new cXSInteger(~~(oLeft / oRight)); + var oValue = oLeft / oRight; + return new cXSInteger(cMath.floor(oValue) + (oValue < 0)); }; +// op:numeric-mod($arg1 as numeric, $arg2 as numeric) as numeric hStaticContext_operators["numeric-mod"] = function(oLeft, oRight) { var nLeft = oLeft.valueOf(), nRight = oRight.valueOf(), @@ -4784,24 +6315,30 @@ hStaticContext_operators["numeric-mod"] = function(oLeft, oRight) { return fOperator_numeric_getResultOfType(oLeft, oRight, ((nLeft * nPower) % (nRight * nPower)) / nPower); }; +// op:numeric-unary-plus($arg as numeric) as numeric hStaticContext_operators["numeric-unary-plus"] = function(oRight) { return oRight; }; +// op:numeric-unary-minus($arg as numeric) as numeric hStaticContext_operators["numeric-unary-minus"] = function(oRight) { oRight.value *=-1; return oRight; }; +// 6.3 Comparison Operators on Numeric Values +// op:numeric-equal($arg1 as numeric, $arg2 as numeric) as xs:boolean hStaticContext_operators["numeric-equal"] = function(oLeft, oRight) { return new cXSBoolean(oLeft.valueOf() == oRight.valueOf()); }; +// op:numeric-less-than($arg1 as numeric, $arg2 as numeric) as xs:boolean hStaticContext_operators["numeric-less-than"] = function(oLeft, oRight) { return new cXSBoolean(oLeft.valueOf() < oRight.valueOf()); }; +// op:numeric-greater-than($arg1 as numeric, $arg2 as numeric) as xs:boolean hStaticContext_operators["numeric-greater-than"] = function(oLeft, oRight) { return new cXSBoolean(oLeft.valueOf() > oRight.valueOf()); }; @@ -4809,112 +6346,195 @@ hStaticContext_operators["numeric-greater-than"] = function(oLeft, oRight) { function fOperator_numeric_getResultOfType(oLeft, oRight, nResult) { return new (oLeft instanceof cXSInteger && oRight instanceof cXSInteger && nResult == cMath.round(nResult) ? cXSInteger : cXSDecimal)(nResult); }; +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ +/* + 11.2 Functions and Operators Related to QNames + op:QName-equal +*/ - +// 11.2 Operators Related to QNames +// op:QName-equal($arg1 as xs:QName, $arg2 as xs:QName) as xs:boolean hStaticContext_operators["QName-equal"] = function(oLeft, oRight) { return new cXSBoolean(oLeft.localName == oRight.localName && oLeft.namespaceURI == oRight.namespaceURI); }; +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ +/* + 15.1 General Functions and Operators on Sequences + op:concatenate + 15.3 Equals, Union, Intersection and Except + op:union + op:intersect + op:except + 15.5 Functions and Operators that Generate Sequences + op:to +*/ + +// 15.1 General Functions and Operators on Sequences +// op:concatenate($seq1 as item()*, $seq2 as item()*) as item()* hStaticContext_operators["concatenate"] = function(oSequence1, oSequence2) { return oSequence1.concat(oSequence2); }; +// 15.3 Equals, Union, Intersection and Except +// op:union($parameter1 as node()*, $parameter2 as node()*) as node()* hStaticContext_operators["union"] = function(oSequence1, oSequence2) { var oSequence = []; - for (var nIndex = 0, nLength = oSequence1.length, oItem; nIndex < nLength; nIndex++) { + // Process first collection + for (var nIndex = 0, nLength = oSequence1.length, oItem; nIndex < nLength; nIndex++) { if (!this.DOMAdapter.isNode(oItem = oSequence1[nIndex])) throw new cException("XPTY0004" - , "Required item type of first operand of 'union' is node()" - ); if (fArray_indexOf(oSequence, oItem) ==-1) + + ); // Required item type of second operand of 'intersect' is node(); supplied value has item type xs:integer + // + if (fArray_indexOf(oSequence, oItem) ==-1) oSequence.push(oItem); } - for (var nIndex = 0, nLength = oSequence2.length, oItem; nIndex < nLength; nIndex++) { + // Process second collection + for (var nIndex = 0, nLength = oSequence2.length, oItem; nIndex < nLength; nIndex++) { if (!this.DOMAdapter.isNode(oItem = oSequence2[nIndex])) throw new cException("XPTY0004" - , "Required item type of second operand of 'union' is node()" - ); if (fArray_indexOf(oSequence, oItem) ==-1) + + ); // Required item type of second operand of 'intersect' is node(); supplied value has item type xs:integer + // + if (fArray_indexOf(oSequence, oItem) ==-1) oSequence.push(oItem); } return fFunction_sequence_order(oSequence, this); }; +// op:intersect($parameter1 as node()*, $parameter2 as node()*) as node()* hStaticContext_operators["intersect"] = function(oSequence1, oSequence2) { var oSequence = []; for (var nIndex = 0, nLength = oSequence1.length, oItem, bFound; nIndex < nLength; nIndex++) { if (!this.DOMAdapter.isNode(oItem = oSequence1[nIndex])) throw new cException("XPTY0004" - , "Required item type of second operand of 'intersect' is node()" - ); bFound = false; + + ); // Required item type of second operand of 'intersect' is node(); supplied value has item type xs:integer + // + bFound = false; for (var nRightIndex = 0, nRightLength = oSequence2.length;(nRightIndex < nRightLength) && !bFound; nRightIndex++) { if (!this.DOMAdapter.isNode(oSequence2[nRightIndex])) throw new cException("XPTY0004" - , "Required item type of first operand of 'intersect' is node()" + ); bFound = this.DOMAdapter.isSameNode(oSequence2[nRightIndex], oItem); } - if (bFound && fArray_indexOf(oSequence, oItem) ==-1) + // + if (bFound && fArray_indexOf(oSequence, oItem) ==-1) oSequence.push(oItem); } return fFunction_sequence_order(oSequence, this); }; +// op:except($parameter1 as node()*, $parameter2 as node()*) as node()* hStaticContext_operators["except"] = function(oSequence1, oSequence2) { var oSequence = []; for (var nIndex = 0, nLength = oSequence1.length, oItem, bFound; nIndex < nLength; nIndex++) { if (!this.DOMAdapter.isNode(oItem = oSequence1[nIndex])) throw new cException("XPTY0004" - , "Required item type of second operand of 'except' is node()" - ); bFound = false; + + ); // Required item type of second operand of 'intersect' is node(); supplied value has item type xs:integer + // + bFound = false; for (var nRightIndex = 0, nRightLength = oSequence2.length;(nRightIndex < nRightLength) && !bFound; nRightIndex++) { if (!this.DOMAdapter.isNode(oSequence2[nRightIndex])) throw new cException("XPTY0004" - , "Required item type of first operand of 'except' is node()" + ); bFound = this.DOMAdapter.isSameNode(oSequence2[nRightIndex], oItem); } - if (!bFound && fArray_indexOf(oSequence, oItem) ==-1) + // + if (!bFound && fArray_indexOf(oSequence, oItem) ==-1) oSequence.push(oItem); } return fFunction_sequence_order(oSequence, this); }; +// 15.5 Functions and Operators that Generate Sequences +// op:to($firstval as xs:integer, $lastval as xs:integer) as xs:integer* hStaticContext_operators["to"] = function(oLeft, oRight) { var oSequence = []; for (var nIndex = oLeft.valueOf(), nLength = oRight.valueOf(); nIndex <= nLength; nIndex++) oSequence.push(new cXSInteger(nIndex)); - return oSequence; + // + return oSequence; }; +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ +/* + 2 Accessors + node-name + nilled + string + data + base-uri + document-uri +*/ +// fn:node-name($arg as node()?) as xs:QName? fStaticContext_defineSystemFunction("node-name", [[cXTNode, '?']], function(oNode) { if (oNode != null) { var fGetProperty = this.DOMAdapter.getProperty; switch (fGetProperty(oNode, "nodeType")) { - case 1: case 2: return new cXSQName(fGetProperty(oNode, "prefix"), fGetProperty(oNode, "localName"), fGetProperty(oNode, "namespaceURI")); - case 5: throw "Not implemented"; - case 6: throw "Not implemented"; - case 7: return new cXSQName(null, fGetProperty(oNode, "target"), null); - case 10: return new cXSQName(null, fGetProperty(oNode, "name"), null); + case 1: // ELEMENT_NAME + case 2: // ATTRIBUTE_NODE + return new cXSQName(fGetProperty(oNode, "prefix"), fGetProperty(oNode, "localName"), fGetProperty(oNode, "namespaceURI")); + case 5: // ENTITY_REFERENCE_NODE + throw "Not implemented"; + case 6: // ENTITY_NODE + throw "Not implemented"; + case 7: // PROCESSING_INSTRUCTION_NODE + return new cXSQName(null, fGetProperty(oNode, "target"), null); + case 10: // DOCUMENT_TYPE_NODE + return new cXSQName(null, fGetProperty(oNode, "name"), null); } } - return null; + // + return null; }); +// fn:nilled($arg as node()?) as xs:boolean? fStaticContext_defineSystemFunction("nilled", [[cXTNode, '?']], function(oNode) { if (oNode != null) { if (this.DOMAdapter.getProperty(oNode, "nodeType") == 1) - return new cXSBoolean(false); } - return null; + return new cXSBoolean(false); // TODO: Determine if node is nilled + } + // + return null; }); -fStaticContext_defineSystemFunction("string", [[cXTItem, '?', true]], function(oItem) { +// fn:string() as xs:string +// fn:string($arg as item()?) as xs:string +fStaticContext_defineSystemFunction("string", [[cXTItem, '?', true]], function(/*[*/oItem/*]*/) { if (!arguments.length) { if (!this.item) throw new cException("XPDY0002"); @@ -4923,39 +6543,56 @@ fStaticContext_defineSystemFunction("string", [[cXTItem, '?', true]], function(o return oItem == null ? new cXSString('') : cXSString.cast(fFunction_sequence_atomize([oItem], this)[0]); }); +// fn:data($arg as item()*) as xs:anyAtomicType* fStaticContext_defineSystemFunction("data", [[cXTItem, '*']], function(oSequence1) { return fFunction_sequence_atomize(oSequence1, this); }); +// fn:base-uri() as xs:anyURI? +// fn:base-uri($arg as node()?) as xs:anyURI? fStaticContext_defineSystemFunction("base-uri", [[cXTNode, '?', true]], function(oNode) { if (!arguments.length) { if (!this.DOMAdapter.isNode(this.item)) throw new cException("XPTY0004" - , "base-uri() function called when the context item is not a node" + ); oNode = this.item; } - return cXSAnyURI.cast(new cXSString(this.DOMAdapter.getProperty(oNode, "baseURI") || '')); + // + return cXSAnyURI.cast(new cXSString(this.DOMAdapter.getProperty(oNode, "baseURI") || '')); }); +// fn:document-uri($arg as node()?) as xs:anyURI? fStaticContext_defineSystemFunction("document-uri", [[cXTNode, '?']], function(oNode) { if (oNode != null) { var fGetProperty = this.DOMAdapter.getProperty; if (fGetProperty(oNode, "nodeType") == 9) return cXSAnyURI.cast(new cXSString(fGetProperty(oNode, "documentURI") || '')); } - return null; + // + return null; }); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ +/* + 8 Functions on anyURI + resolve-uri +*/ - - +// fn:resolve-uri($relative as xs:string?) as xs:anyURI? +// fn:resolve-uri($relative as xs:string?, $base as xs:string) as xs:anyURI? fStaticContext_defineSystemFunction("resolve-uri", [[cXSString, '?'], [cXSString, '', true]], function(sUri, sBaseUri) { - var sBaseUri; if (arguments.length < 2) { if (!this.DOMAdapter.isNode(this.item)) throw new cException("XPTY0004" - , "resolve-uri() function called when the context item is not a node" + ); sBaseUri = new cXSString(this.DOMAdapter.getProperty(this.item, "baseURI") || ''); } @@ -4963,7 +6600,8 @@ fStaticContext_defineSystemFunction("resolve-uri", [[cXSString, '?'], [cXSString if (sUri == null) return null; - if (sUri.valueOf() == '' || sUri.valueOf().charAt(0) == '#') + // + if (sUri.valueOf() == '' || sUri.valueOf().charAt(0) == '#') return cXSAnyURI.cast(sBaseUri); var oUri = cXSAnyURI.cast(sUri); @@ -4974,9 +6612,11 @@ fStaticContext_defineSystemFunction("resolve-uri", [[cXSString, '?'], [cXSString oUri.scheme = oBaseUri.scheme; if (!oUri.authority) { - oUri.authority = oBaseUri.authority; + // authority + oUri.authority = oBaseUri.authority; - if (oUri.path.charAt(0) != '/') { + // path + if (oUri.path.charAt(0) != '/') { var aUriSegments = oUri.path.split('/'), aBaseUriSegments = oBaseUri.path.split('/'); aBaseUriSegments.pop(); @@ -4997,162 +6637,277 @@ fStaticContext_defineSystemFunction("resolve-uri", [[cXSString, '?'], [cXSString } if (aUriSegments[--nIndex] == '..' || aUriSegments[nIndex] == '.') aBaseUriSegments.push(''); - oUri.path = aBaseUriSegments.join('/'); + // + oUri.path = aBaseUriSegments.join('/'); } } return oUri; }); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ +/* + 9.1 Additional Boolean Constructor Functions + true + false + 9.3 Functions on Boolean Values + not +*/ - +// 9.1 Additional Boolean Constructor Functions +// fn:true() as xs:boolean fStaticContext_defineSystemFunction("true", [], function() { return new cXSBoolean(true); }); +// fn:false() as xs:boolean fStaticContext_defineSystemFunction("false", [], function() { return new cXSBoolean(false); }); +// 9.3 Functions on Boolean Values +// fn:not($arg as item()*) as xs:boolean fStaticContext_defineSystemFunction("not", [[cXTItem, '*']], function(oSequence1) { return new cXSBoolean(!fFunction_sequence_toEBV(oSequence1, this)); }); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ +/* + 16 Context Functions + position + last + current-dateTime + current-date + current-time + implicit-timezone + default-collation + static-base-uri - +*/ +// fn:position() as xs:integer fStaticContext_defineSystemFunction("position", [], function() { return new cXSInteger(this.position); }); +// fn:last() as xs:integer fStaticContext_defineSystemFunction("last", [], function() { return new cXSInteger(this.size); }); +// fn:current-dateTime() as xs:dateTime (2004-05-12T18:17:15.125Z) fStaticContext_defineSystemFunction("current-dateTime", [], function() { return this.dateTime; }); +// fn:current-date() as xs:date (2004-05-12+01:00) fStaticContext_defineSystemFunction("current-date", [], function() { return cXSDate.cast(this.dateTime); }); +// fn:current-time() as xs:time (23:17:00.000-05:00) fStaticContext_defineSystemFunction("current-time", [], function() { return cXSTime.cast(this.dateTime); }); +// fn:implicit-timezone() as xs:dayTimeDuration fStaticContext_defineSystemFunction("implicit-timezone", [], function() { return this.timezone; }); +// fn:default-collation() as xs:string fStaticContext_defineSystemFunction("default-collation", [], function() { return new cXSString(this.staticContext.defaultCollationName); }); +// fn:static-base-uri() as xs:anyURI? fStaticContext_defineSystemFunction("static-base-uri", [], function() { return cXSAnyURI.cast(new cXSString(this.staticContext.baseURI || '')); }); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ +/* + 10.5 Component Extraction Functions on Durations, Dates and Times + years-from-duration + months-from-duration + days-from-duration + hours-from-duration + minutes-from-duration + seconds-from-duration + year-from-dateTime + month-from-dateTime + day-from-dateTime + hours-from-dateTime + minutes-from-dateTime + seconds-from-dateTime + timezone-from-dateTime + year-from-date + month-from-date + day-from-date + timezone-from-date + hours-from-time + minutes-from-time + seconds-from-time + timezone-from-time + 10.7 Timezone Adjustment Functions on Dates and Time Values + adjust-dateTime-to-timezone + adjust-date-to-timezone + adjust-time-to-timezone +*/ - +// 10.5 Component Extraction Functions on Durations, Dates and Times +// functions on duration +// fn:years-from-duration($arg as xs:duration?) as xs:integer? fStaticContext_defineSystemFunction("years-from-duration", [[cXSDuration, '?']], function(oDuration) { return fFunction_duration_getComponent(oDuration, "year"); }); +// fn:months-from-duration($arg as xs:duration?) as xs:integer? fStaticContext_defineSystemFunction("months-from-duration", [[cXSDuration, '?']], function(oDuration) { return fFunction_duration_getComponent(oDuration, "month"); }); +// fn:days-from-duration($arg as xs:duration?) as xs:integer? fStaticContext_defineSystemFunction("days-from-duration", [[cXSDuration, '?']], function(oDuration) { return fFunction_duration_getComponent(oDuration, "day"); }); +// fn:hours-from-duration($arg as xs:duration?) as xs:integer? fStaticContext_defineSystemFunction("hours-from-duration", [[cXSDuration, '?']], function(oDuration) { return fFunction_duration_getComponent(oDuration, "hours"); }); +// fn:minutes-from-duration($arg as xs:duration?) as xs:integer? fStaticContext_defineSystemFunction("minutes-from-duration", [[cXSDuration, '?']], function(oDuration) { return fFunction_duration_getComponent(oDuration, "minutes"); }); +// fn:seconds-from-duration($arg as xs:duration?) as xs:decimal? fStaticContext_defineSystemFunction("seconds-from-duration", [[cXSDuration, '?']], function(oDuration) { return fFunction_duration_getComponent(oDuration, "seconds"); }); +// functions on dateTime +// fn:year-from-dateTime($arg as xs:dateTime?) as xs:integer? fStaticContext_defineSystemFunction("year-from-dateTime", [[cXSDateTime, '?']], function(oDateTime) { return fFunction_dateTime_getComponent(oDateTime, "year"); }); +// fn:month-from-dateTime($arg as xs:dateTime?) as xs:integer? fStaticContext_defineSystemFunction("month-from-dateTime", [[cXSDateTime, '?']], function(oDateTime) { return fFunction_dateTime_getComponent(oDateTime, "month"); }); +// fn:day-from-dateTime($arg as xs:dateTime?) as xs:integer? fStaticContext_defineSystemFunction("day-from-dateTime", [[cXSDateTime, '?']], function(oDateTime) { return fFunction_dateTime_getComponent(oDateTime, "day"); }); +// fn:hours-from-dateTime($arg as xs:dateTime?) as xs:integer? fStaticContext_defineSystemFunction("hours-from-dateTime", [[cXSDateTime, '?']], function(oDateTime) { return fFunction_dateTime_getComponent(oDateTime, "hours"); }); +// fn:minutes-from-dateTime($arg as xs:dateTime?) as xs:integer? fStaticContext_defineSystemFunction("minutes-from-dateTime", [[cXSDateTime, '?']], function(oDateTime) { return fFunction_dateTime_getComponent(oDateTime, "minutes"); }); +// fn:seconds-from-dateTime($arg as xs:dateTime?) as xs:decimal? fStaticContext_defineSystemFunction("seconds-from-dateTime", [[cXSDateTime, '?']], function(oDateTime) { return fFunction_dateTime_getComponent(oDateTime, "seconds"); }); +// fn:timezone-from-dateTime($arg as xs:dateTime?) as xs:dayTimeDuration? fStaticContext_defineSystemFunction("timezone-from-dateTime", [[cXSDateTime, '?']], function(oDateTime) { return fFunction_dateTime_getComponent(oDateTime, "timezone"); }); +// functions on date +// fn:year-from-date($arg as xs:date?) as xs:integer? fStaticContext_defineSystemFunction("year-from-date", [[cXSDate, '?']], function(oDate) { return fFunction_dateTime_getComponent(oDate, "year"); }); +// fn:month-from-date($arg as xs:date?) as xs:integer? fStaticContext_defineSystemFunction("month-from-date", [[cXSDate, '?']], function(oDate) { return fFunction_dateTime_getComponent(oDate, "month"); }); +// fn:day-from-date($arg as xs:date?) as xs:integer? fStaticContext_defineSystemFunction("day-from-date", [[cXSDate, '?']], function(oDate) { return fFunction_dateTime_getComponent(oDate, "day"); }); +// fn:timezone-from-date($arg as xs:date?) as xs:dayTimeDuration? fStaticContext_defineSystemFunction("timezone-from-date", [[cXSDate, '?']], function(oDate) { return fFunction_dateTime_getComponent(oDate, "timezone"); }); +// functions on time +// fn:hours-from-time($arg as xs:time?) as xs:integer? fStaticContext_defineSystemFunction("hours-from-time", [[cXSTime, '?']], function(oTime) { return fFunction_dateTime_getComponent(oTime, "hours"); }); +// fn:minutes-from-time($arg as xs:time?) as xs:integer? fStaticContext_defineSystemFunction("minutes-from-time", [[cXSTime, '?']], function(oTime) { return fFunction_dateTime_getComponent(oTime, "minutes"); }); +// fn:seconds-from-time($arg as xs:time?) as xs:decimal? fStaticContext_defineSystemFunction("seconds-from-time", [[cXSTime, '?']], function(oTime) { return fFunction_dateTime_getComponent(oTime, "seconds"); }); +// fn:timezone-from-time($arg as xs:time?) as xs:dayTimeDuration? fStaticContext_defineSystemFunction("timezone-from-time", [[cXSTime, '?']], function(oTime) { return fFunction_dateTime_getComponent(oTime, "timezone"); }); +// 10.7 Timezone Adjustment Functions on Dates and Time Values +// fn:adjust-dateTime-to-timezone($arg as xs:dateTime?) as xs:dateTime? +// fn:adjust-dateTime-to-timezone($arg as xs:dateTime?, $timezone as xs:dayTimeDuration?) as xs:dateTime? fStaticContext_defineSystemFunction("adjust-dateTime-to-timezone", [[cXSDateTime, '?'], [cXSDayTimeDuration, '?', true]], function(oDateTime, oDayTimeDuration) { return fFunction_dateTime_adjustTimezone(oDateTime, arguments.length > 1 && oDayTimeDuration != null ? arguments.length > 1 ? oDayTimeDuration : this.timezone : null); }); +// fn:adjust-date-to-timezone($arg as xs:date?) as xs:date? +// fn:adjust-date-to-timezone($arg as xs:date?, $timezone as xs:dayTimeDuration?) as xs:date? fStaticContext_defineSystemFunction("adjust-date-to-timezone", [[cXSDate, '?'], [cXSDayTimeDuration, '?', true]], function(oDate, oDayTimeDuration) { return fFunction_dateTime_adjustTimezone(oDate, arguments.length > 1 && oDayTimeDuration != null ? arguments.length > 1 ? oDayTimeDuration : this.timezone : null); }); +// fn:adjust-time-to-timezone($arg as xs:time?) as xs:time? +// fn:adjust-time-to-timezone($arg as xs:time?, $timezone as xs:dayTimeDuration?) as xs:time? fStaticContext_defineSystemFunction("adjust-time-to-timezone", [[cXSTime, '?'], [cXSDayTimeDuration, '?', true]], function(oTime, oDayTimeDuration) { return fFunction_dateTime_adjustTimezone(oTime, arguments.length > 1 && oDayTimeDuration != null ? arguments.length > 1 ? oDayTimeDuration : this.timezone : null); }); +// function fFunction_duration_getComponent(oDuration, sName) { if (oDuration == null) return null; @@ -5161,6 +6916,7 @@ function fFunction_duration_getComponent(oDuration, sName) { return sName == "seconds" ? new cXSDecimal(nValue) : new cXSInteger(nValue); }; +// function fFunction_dateTime_getComponent(oDateTime, sName) { if (oDateTime == null) return null; @@ -5184,11 +6940,13 @@ function fFunction_dateTime_getComponent(oDateTime, sName) { } }; +// function fFunction_dateTime_adjustTimezone(oDateTime, oTimezone) { if (oDateTime == null) return null; - var oValue; + // Create a copy + var oValue; if (oDateTime instanceof cXSDate) oValue = new cXSDate(oDateTime.year, oDateTime.month, oDateTime.day, oDateTime.timezone, oDateTime.negative); else @@ -5197,7 +6955,8 @@ function fFunction_dateTime_adjustTimezone(oDateTime, oTimezone) { else oValue = new cXSDateTime(oDateTime.year, oDateTime.month, oDateTime.day, oDateTime.hours, oDateTime.minutes, oDateTime.seconds, oDateTime.timezone, oDateTime.negative); - if (oTimezone == null) + // + if (oTimezone == null) oValue.timezone = null; else { var nTimezone = fOperator_dayTimeDuration_toSeconds(oTimezone) / 60; @@ -5211,67 +6970,97 @@ function fFunction_dateTime_adjustTimezone(oDateTime, oTimezone) { oValue.minutes += nDiff % 60; oValue.hours += ~~(nDiff / 60); } - fXSDateTime_normalize(oValue); + // + fXSDateTime_normalize(oValue); } oValue.timezone = nTimezone; } return oValue; }; +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ +/* + 14 Functions and Operators on Nodes + name + local-name + namespace-uri + number + lang + root +*/ - +// 14 Functions on Nodes +// fn:name() as xs:string +// fn:name($arg as node()?) as xs:string fStaticContext_defineSystemFunction("name", [[cXTNode, '?', true]], function(oNode) { if (!arguments.length) { if (!this.DOMAdapter.isNode(this.item)) throw new cException("XPTY0004" - , "name() function called when the context item is not a node" + ); oNode = this.item; } else if (oNode == null) return new cXSString(''); - var vValue = hStaticContext_functions["node-name"].call(this, oNode); + // + var vValue = hStaticContext_functions["node-name"].call(this, oNode); return new cXSString(vValue == null ? '' : vValue.toString()); }); +// fn:local-name() as xs:string +// fn:local-name($arg as node()?) as xs:string fStaticContext_defineSystemFunction("local-name", [[cXTNode, '?', true]], function(oNode) { if (!arguments.length) { if (!this.DOMAdapter.isNode(this.item)) throw new cException("XPTY0004" - , "local-name() function called when the context item is not a node" + ); oNode = this.item; } else if (oNode == null) return new cXSString(''); - return new cXSString(this.DOMAdapter.getProperty(oNode, "localName") || ''); + // + return new cXSString(this.DOMAdapter.getProperty(oNode, "localName") || ''); }); +// fn:namespace-uri() as xs:anyURI +// fn:namespace-uri($arg as node()?) as xs:anyURI fStaticContext_defineSystemFunction("namespace-uri", [[cXTNode, '?', true]], function(oNode) { if (!arguments.length) { if (!this.DOMAdapter.isNode(this.item)) throw new cException("XPTY0004" - , "namespace-uri() function called when the context item is not a node" + ); oNode = this.item; } else if (oNode == null) return cXSAnyURI.cast(new cXSString('')); - return cXSAnyURI.cast(new cXSString(this.DOMAdapter.getProperty(oNode, "namespaceURI") || '')); + // + return cXSAnyURI.cast(new cXSString(this.DOMAdapter.getProperty(oNode, "namespaceURI") || '')); }); -fStaticContext_defineSystemFunction("number", [[cXSAnyAtomicType, '?', true]], function(oItem) { +// fn:number() as xs:double +// fn:number($arg as xs:anyAtomicType?) as xs:double +fStaticContext_defineSystemFunction("number", [[cXSAnyAtomicType, '?', true]], function(/*[*/oItem/*]*/) { if (!arguments.length) { if (!this.item) throw new cException("XPDY0002"); oItem = fFunction_sequence_atomize([this.item], this)[0]; } - var vValue = new cXSDouble(nNaN); + // If input item cannot be cast to xs:decimal, a NaN should be returned + var vValue = new cXSDouble(nNaN); if (oItem != null) { try { vValue = cXSDouble.cast(oItem); @@ -5283,11 +7072,13 @@ fStaticContext_defineSystemFunction("number", [[cXSAnyAtomicType, '?', true]], f return vValue; }); +// fn:lang($testlang as xs:string?) as xs:boolean +// fn:lang($testlang as xs:string?, $node as node()) as xs:boolean fStaticContext_defineSystemFunction("lang", [[cXSString, '?'], [cXTNode, '', true]], function(sLang, oNode) { if (arguments.length < 2) { if (!this.DOMAdapter.isNode(this.item)) throw new cException("XPTY0004" - , "lang() function called when the context item is not a node" + ); oNode = this.item; } @@ -5296,19 +7087,23 @@ fStaticContext_defineSystemFunction("lang", [[cXSString, '?'], [cXTNode, '', tru if (fGetProperty(oNode, "nodeType") == 2) oNode = fGetProperty(oNode, "ownerElement"); - for (var aAttributes; oNode; oNode = fGetProperty(oNode, "parentNode")) + // walk up the tree looking for xml:lang attribute + for (var aAttributes; oNode; oNode = fGetProperty(oNode, "parentNode")) if (aAttributes = fGetProperty(oNode, "attributes")) for (var nIndex = 0, nLength = aAttributes.length; nIndex < nLength; nIndex++) if (fGetProperty(aAttributes[nIndex], "nodeName") == "xml:lang") return new cXSBoolean(fGetProperty(aAttributes[nIndex], "value").replace(/-.+/, '').toLowerCase() == sLang.valueOf().replace(/-.+/, '').toLowerCase()); - return new cXSBoolean(false); + // + return new cXSBoolean(false); }); +// fn:root() as node() +// fn:root($arg as node()?) as node()? fStaticContext_defineSystemFunction("root", [[cXTNode, '?', true]], function(oNode) { if (!arguments.length) { if (!this.DOMAdapter.isNode(this.item)) throw new cException("XPTY0004" - , "root() function called when the context item is not a node" + ); oNode = this.item; } @@ -5318,7 +7113,8 @@ fStaticContext_defineSystemFunction("root", [[cXTNode, '?', true]], function(oNo var fGetProperty = this.DOMAdapter.getProperty; - if (fGetProperty(oNode, "nodeType") == 2) + // If context node is Attribute + if (fGetProperty(oNode, "nodeType") == 2) oNode = fGetProperty(oNode, "ownerElement"); for (var oParent = oNode; oParent; oParent = fGetProperty(oNode, "parentNode")) @@ -5327,29 +7123,52 @@ fStaticContext_defineSystemFunction("root", [[cXTNode, '?', true]], function(oNo return oNode; }); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ +/* + 6.4 Functions on Numeric Values + abs + ceiling + floor + round + round-half-to-even +*/ - +// 6.4 Functions on Numeric Values +// fn:abs($arg as numeric?) as numeric? fStaticContext_defineSystemFunction("abs", [[cXSDouble, '?']], function(oValue) { return new cXSDecimal(cMath.abs(oValue)); }); +// fn:ceiling($arg as numeric?) as numeric? fStaticContext_defineSystemFunction("ceiling", [[cXSDouble, '?']], function(oValue) { return new cXSDecimal(cMath.ceil(oValue)); }); +// fn:floor($arg as numeric?) as numeric? fStaticContext_defineSystemFunction("floor", [[cXSDouble, '?']], function(oValue) { return new cXSDecimal(cMath.floor(oValue)); }); +// fn:round($arg as numeric?) as numeric? fStaticContext_defineSystemFunction("round", [[cXSDouble, '?']], function(oValue) { return new cXSDecimal(cMath.round(oValue)); }); +// fn:round-half-to-even($arg as numeric?) as numeric? +// fn:round-half-to-even($arg as numeric?, $precision as xs:integer) as numeric? fStaticContext_defineSystemFunction("round-half-to-even", [[cXSDouble, '?'], [cXSInteger, '', true]], function(oValue, oPrecision) { var nPrecision = arguments.length > 1 ? oPrecision.valueOf() : 0; - if (nPrecision < 0) { + // + if (nPrecision < 0) { var oPower = new cXSInteger(cMath.pow(10,-nPrecision)), nRounded= cMath.round(hStaticContext_operators["numeric-divide"].call(this, oValue, oPower)), oRounded= new cXSInteger(nRounded); @@ -5364,10 +7183,31 @@ fStaticContext_defineSystemFunction("round-half-to-even", [[cXSDouble, '?'], [cX return hStaticContext_operators["numeric-divide"].call(this, hStaticContext_operators["numeric-add"].call(this, oRounded, new cXSDecimal(nDecimal == 0.5 && nRounded % 2 ?-1 : 0)), oPower); } }); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ +/* + 11.1 Additional Constructor Functions for QNames + resolve-QName + QName + 11.2 Functions and Operators Related to QNames + prefix-from-QName + local-name-from-QName + namespace-uri-from-QName + namespace-uri-for-prefix + in-scope-prefixes +*/ +// 11.1 Additional Constructor Functions for QNames +// fn:resolve-QName($qname as xs:string?, $element as element()) as xs:QName? fStaticContext_defineSystemFunction("resolve-QName", [[cXSString, '?'], [cXTElement]], function(oQName, oElement) { if (oQName == null) return null; @@ -5376,40 +7216,46 @@ fStaticContext_defineSystemFunction("resolve-QName", [[cXSString, '?'], [cXTElem aMatch = sQName.match(rXSQName); if (!aMatch) throw new cException("FOCA0002" - , "Invalid QName '" + sQName + "'" + ); var sPrefix = aMatch[1] || null, sLocalName = aMatch[2], sNameSpaceURI = this.DOMAdapter.lookupNamespaceURI(oElement, sPrefix); - if (sPrefix != null &&!sNameSpaceURI) + // + if (sPrefix != null &&!sNameSpaceURI) throw new cException("FONS0004" - , "Namespace prefix '" + sPrefix + "' has not been declared" + ); return new cXSQName(sPrefix, sLocalName, sNameSpaceURI || null); }); +// fn:QName($paramURI as xs:string?, $paramQName as xs:string) as xs:QName fStaticContext_defineSystemFunction("QName", [[cXSString, '?'], [cXSString]], function(oUri, oQName) { var sQName = oQName.valueOf(), aMatch = sQName.match(rXSQName); if (!aMatch) throw new cException("FOCA0002" - , "Invalid QName '" + sQName + "'" + ); return new cXSQName(aMatch[1] || null, aMatch[2] || null, oUri == null ? '' : oUri.valueOf()); }); +// 11.2 Functions Related to QNames +// fn:prefix-from-QName($arg as xs:QName?) as xs:NCName? fStaticContext_defineSystemFunction("prefix-from-QName", [[cXSQName, '?']], function(oQName) { if (oQName != null) { if (oQName.prefix) return new cXSNCName(oQName.prefix); } - return null; + // + return null; }); +// fn:local-name-from-QName($arg as xs:QName?) as xs:NCName? fStaticContext_defineSystemFunction("local-name-from-QName", [[cXSQName, '?']], function(oQName) { if (oQName == null) return null; @@ -5417,6 +7263,7 @@ fStaticContext_defineSystemFunction("local-name-from-QName", [[cXSQName, '?']], return new cXSNCName(oQName.localName); }); +// fn:namespace-uri-from-QName($arg as xs:QName?) as xs:anyURI? fStaticContext_defineSystemFunction("namespace-uri-from-QName", [[cXSQName, '?']], function(oQName) { if (oQName == null) return null; @@ -5424,6 +7271,7 @@ fStaticContext_defineSystemFunction("namespace-uri-from-QName", [[cXSQName, '?'] return cXSAnyURI.cast(new cXSString(oQName.namespaceURI || '')); }); +// fn:namespace-uri-for-prefix($prefix as xs:string?, $element as element()) as xs:anyURI? fStaticContext_defineSystemFunction("namespace-uri-for-prefix", [[cXSString, '?'], [cXTElement]], function(oPrefix, oElement) { var sPrefix = oPrefix == null ? '' : oPrefix.valueOf(), sNameSpaceURI = this.DOMAdapter.lookupNamespaceURI(oElement, sPrefix || null); @@ -5431,60 +7279,123 @@ fStaticContext_defineSystemFunction("namespace-uri-for-prefix", [[cXSString, '?' return sNameSpaceURI == null ? null : cXSAnyURI.cast(new cXSString(sNameSpaceURI)); }); +// fn:in-scope-prefixes($element as element()) as xs:string* fStaticContext_defineSystemFunction("in-scope-prefixes", [[cXTElement]], function(oElement) { throw "Function '" + "in-scope-prefixes" + "' not implemented"; }); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ +/* + 15.1 General Functions and Operators on Sequences + boolean + index-of + empty + exists + distinct-values + insert-before + remove + reverse + subsequence + unordered + 15.2 Functions That Test the Cardinality of Sequences + zero-or-one + one-or-more + exactly-one + 15.3 Equals, Union, Intersection and Except + deep-equal + + 15.4 Aggregate Functions + count + avg + max + min + sum + + 15.5 Functions and Operators that Generate Sequences + id + idref + doc + doc-available + collection + element-with-id + +*/ + +// 15.1 General Functions and Operators on Sequences +// fn:boolean($arg as item()*) as xs:boolean fStaticContext_defineSystemFunction("boolean", [[cXTItem, '*']], function(oSequence1) { return new cXSBoolean(fFunction_sequence_toEBV(oSequence1, this)); }); +// fn:index-of($seqParam as xs:anyAtomicType*, $srchParam as xs:anyAtomicType) as xs:integer* +// fn:index-of($seqParam as xs:anyAtomicType*, $srchParam as xs:anyAtomicType, $collation as xs:string) as xs:integer* fStaticContext_defineSystemFunction("index-of", [[cXSAnyAtomicType, '*'], [cXSAnyAtomicType], [cXSString, '', true]], function(oSequence1, oSearch, oCollation) { if (!oSequence1.length || oSearch == null) return []; - + // TODO: Implement collation + var vLeft = oSearch; - if (vLeft instanceof cXSUntypedAtomic) + // Cast to XSString if Untyped + if (vLeft instanceof cXSUntypedAtomic) vLeft = cXSString.cast(vLeft); var oSequence = []; for (var nIndex = 0, nLength = oSequence1.length, vRight; nIndex < nLength; nIndex++) { vRight = oSequence1[nIndex]; - if (vRight instanceof cXSUntypedAtomic) + // Cast to XSString if Untyped + if (vRight instanceof cXSUntypedAtomic) vRight = cXSString.cast(vRight); - if (vRight.valueOf() === vLeft.valueOf()) + // + if (vRight.valueOf() === vLeft.valueOf()) oSequence.push(new cXSInteger(nIndex + 1)); } return oSequence; }); +// fn:empty($arg as item()*) as xs:boolean fStaticContext_defineSystemFunction("empty", [[cXTItem, '*']], function(oSequence1) { return new cXSBoolean(!oSequence1.length); }); +// fn:exists($arg as item()*) as xs:boolean fStaticContext_defineSystemFunction("exists", [[cXTItem, '*']], function(oSequence1) { return new cXSBoolean(!!oSequence1.length); }); +// fn:distinct-values($arg as xs:anyAtomicType*) as xs:anyAtomicType* +// fn:distinct-values($arg as xs:anyAtomicType*, $collation as xs:string) as xs:anyAtomicType* fStaticContext_defineSystemFunction("distinct-values", [[cXSAnyAtomicType, '*'], [cXSString, '', true]], function(oSequence1, oCollation) { + if (arguments.length > 1) + throw "Collation parameter in function '" + "distinct-values" + "' is not implemented"; + if (!oSequence1.length) return null; var oSequence = []; for (var nIndex = 0, nLength = oSequence1.length, vLeft; nIndex < nLength; nIndex++) { vLeft = oSequence1[nIndex]; - if (vLeft instanceof cXSUntypedAtomic) + // Cast to XSString if Untyped + if (vLeft instanceof cXSUntypedAtomic) vLeft = cXSString.cast(vLeft); for (var nRightIndex = 0, nRightLength = oSequence.length, vRight, bFound = false; (nRightIndex < nRightLength) &&!bFound; nRightIndex++) { vRight = oSequence[nRightIndex]; - if (vRight instanceof cXSUntypedAtomic) + // Cast to XSString if Untyped + if (vRight instanceof cXSUntypedAtomic) vRight = cXSString.cast(vRight); - if (vRight.valueOf() === vLeft.valueOf()) + // + if (vRight.valueOf() === vLeft.valueOf()) bFound = true; } if (!bFound) @@ -5494,6 +7405,7 @@ fStaticContext_defineSystemFunction("distinct-values", [[cXSAnyAtomicType, '*'], return oSequence; }); +// fn:insert-before($target as item()*, $position as xs:integer, $inserts as item()*) as item()* fStaticContext_defineSystemFunction("insert-before", [[cXTItem, '*'], [cXSInteger], [cXTItem, '*']], function(oSequence1, oPosition, oSequence3) { if (!oSequence1.length) return oSequence3; @@ -5520,6 +7432,7 @@ fStaticContext_defineSystemFunction("insert-before", [[cXTItem, '*'], [cXSIntege return oSequence; }); +// fn:remove($target as item()*, $position as xs:integer) as item()* fStaticContext_defineSystemFunction("remove", [[cXTItem, '*'], [cXSInteger]], function(oSequence1, oPosition) { if (!oSequence1.length) return []; @@ -5538,24 +7451,31 @@ fStaticContext_defineSystemFunction("remove", [[cXTItem, '*'], [cXSInteger]], fu return oSequence; }); +// fn:reverse($arg as item()*) as item()* fStaticContext_defineSystemFunction("reverse", [[cXTItem, '*']], function(oSequence1) { oSequence1.reverse(); return oSequence1; }); +// fn:subsequence($sourceSeq as item()*, $startingLoc as xs:double) as item()* +// fn:subsequence($sourceSeq as item()*, $startingLoc as xs:double, $length as xs:double) as item()* fStaticContext_defineSystemFunction("subsequence", [[cXTItem, '*'], [cXSDouble, ''], [cXSDouble, '', true]], function(oSequence1, oStart, oLength) { var nPosition = cMath.round(oStart), nLength = arguments.length > 2 ? cMath.round(oLength) : oSequence1.length - nPosition + 1; - return oSequence1.slice(nPosition - 1, nPosition - 1 + nLength); + // TODO: Handle out-of-range position and length values + return oSequence1.slice(nPosition - 1, nPosition - 1 + nLength); }); +// fn:unordered($sourceSeq as item()*) as item()* fStaticContext_defineSystemFunction("unordered", [[cXTItem, '*']], function(oSequence1) { return oSequence1; }); +// 15.2 Functions That Test the Cardinality of Sequences +// fn:zero-or-one($arg as item()*) as item()? fStaticContext_defineSystemFunction("zero-or-one", [[cXTItem, '*']], function(oSequence1) { if (oSequence1.length > 1) throw new cException("FORG0003"); @@ -5563,6 +7483,7 @@ fStaticContext_defineSystemFunction("zero-or-one", [[cXTItem, '*']], function(oS return oSequence1; }); +// fn:one-or-more($arg as item()*) as item()+ fStaticContext_defineSystemFunction("one-or-more", [[cXTItem, '*']], function(oSequence1) { if (!oSequence1.length) throw new cException("FORG0004"); @@ -5570,6 +7491,7 @@ fStaticContext_defineSystemFunction("one-or-more", [[cXTItem, '*']], function(oS return oSequence1; }); +// fn:exactly-one($arg as item()*) as item() fStaticContext_defineSystemFunction("exactly-one", [[cXTItem, '*']], function(oSequence1) { if (oSequence1.length != 1) throw new cException("FORG0005"); @@ -5578,20 +7500,27 @@ fStaticContext_defineSystemFunction("exactly-one", [[cXTItem, '*']], function(oS }); +// 15.3 Equals, Union, Intersection and Except +// fn:deep-equal($parameter1 as item()*, $parameter2 as item()*) as xs:boolean +// fn:deep-equal($parameter1 as item()*, $parameter2 as item()*, $collation as string) as xs:boolean fStaticContext_defineSystemFunction("deep-equal", [[cXTItem, '*'], [cXTItem, '*'], [cXSString, '', true]], function(oSequence1, oSequence2, oCollation) { throw "Function '" + "deep-equal" + "' not implemented"; }); +// 15.4 Aggregate Functions +// fn:count($arg as item()*) as xs:integer fStaticContext_defineSystemFunction("count", [[cXTItem, '*']], function(oSequence1) { return new cXSInteger(oSequence1.length); }); +// fn:avg($arg as xs:anyAtomicType*) as xs:anyAtomicType? fStaticContext_defineSystemFunction("avg", [[cXSAnyAtomicType, '*']], function(oSequence1) { if (!oSequence1.length) return null; - try { + // + try { var vValue = oSequence1[0]; if (vValue instanceof cXSUntypedAtomic) vValue = cXSDouble.cast(vValue); @@ -5604,50 +7533,75 @@ fStaticContext_defineSystemFunction("avg", [[cXSAnyAtomicType, '*']], function(o return hMultiplicativeExpr_operators['div'](vValue, new cXSInteger(nLength), this); } catch (e) { - throw e.code != "XPTY0004" ? e : new cException("FORG0006" - , "Input to avg() contains a mix of types" + // XPTY0004: Arithmetic operator is not defined for provided arguments + throw e.code != "XPTY0004" ? e : new cException("FORG0006" + ); } }); +// fn:max($arg as xs:anyAtomicType*) as xs:anyAtomicType? +// fn:max($arg as xs:anyAtomicType*, $collation as string) as xs:anyAtomicType? fStaticContext_defineSystemFunction("max", [[cXSAnyAtomicType, '*'], [cXSString, '', true]], function(oSequence1, oCollation) { if (!oSequence1.length) return null; - - try { + // TODO: Implement collation + + // + try { var vValue = oSequence1[0]; - for (var nIndex = 1, nLength = oSequence1.length; nIndex < nLength; nIndex++) - if (hComparisonExpr_ValueComp_operators['ge'](oSequence1[nIndex], vValue, this).valueOf()) - vValue = oSequence1[nIndex]; + if (vValue instanceof cXSUntypedAtomic) + vValue = cXSDouble.cast(vValue); + for (var nIndex = 1, nLength = oSequence1.length, vRight; nIndex < nLength; nIndex++) { + vRight = oSequence1[nIndex]; + if (vRight instanceof cXSUntypedAtomic) + vRight = cXSDouble.cast(vRight); + if (hComparisonExpr_ValueComp_operators['ge'](vRight, vValue, this).valueOf()) + vValue = vRight; + } return vValue; } catch (e) { - throw e.code != "XPTY0004" ? e : new cException("FORG0006" - , "Input to max() contains a mix of not comparable values" + // XPTY0004: Cannot compare {type1} with {type2} + throw e.code != "XPTY0004" ? e : new cException("FORG0006" + ); } }); +// fn:min($arg as xs:anyAtomicType*) as xs:anyAtomicType? +// fn:min($arg as xs:anyAtomicType*, $collation as string) as xs:anyAtomicType? fStaticContext_defineSystemFunction("min", [[cXSAnyAtomicType, '*'], [cXSString, '', true]], function(oSequence1, oCollation) { if (!oSequence1.length) return null; - - try { + // TODO: Implement collation + + // + try { var vValue = oSequence1[0]; - for (var nIndex = 1, nLength = oSequence1.length; nIndex < nLength; nIndex++) - if (hComparisonExpr_ValueComp_operators['le'](oSequence1[nIndex], vValue, this).valueOf()) - vValue = oSequence1[nIndex]; + if (vValue instanceof cXSUntypedAtomic) + vValue = cXSDouble.cast(vValue); + for (var nIndex = 1, nLength = oSequence1.length, vRight; nIndex < nLength; nIndex++) { + vRight = oSequence1[nIndex]; + if (vRight instanceof cXSUntypedAtomic) + vRight = cXSDouble.cast(vRight); + if (hComparisonExpr_ValueComp_operators['le'](vRight, vValue, this).valueOf()) + vValue = vRight; + } return vValue; } catch (e) { - throw e.code != "XPTY0004" ? e : new cException("FORG0006" - , "Input to min() contains a mix of not comparable values" + // Cannot compare {type1} with {type2} + throw e.code != "XPTY0004" ? e : new cException("FORG0006" + ); } }); +// fn:sum($arg as xs:anyAtomicType*) as xs:anyAtomicType +// fn:sum($arg as xs:anyAtomicType*, $zero as xs:anyAtomicType?) as xs:anyAtomicType? fStaticContext_defineSystemFunction("sum", [[cXSAnyAtomicType, '*'], [cXSAnyAtomicType, '?', true]], function(oSequence1, oZero) { if (!oSequence1.length) { if (arguments.length > 1) @@ -5658,8 +7612,10 @@ fStaticContext_defineSystemFunction("sum", [[cXSAnyAtomicType, '*'], [cXSAnyAtom return null; } - - try { + // TODO: Implement collation + + // + try { var vValue = oSequence1[0]; if (vValue instanceof cXSUntypedAtomic) vValue = cXSDouble.cast(vValue); @@ -5672,54 +7628,70 @@ fStaticContext_defineSystemFunction("sum", [[cXSAnyAtomicType, '*'], [cXSAnyAtom return vValue; } catch (e) { - throw e.code != "XPTY0004" ? e : new cException("FORG0006" - , "Input to sum() contains a mix of types" + // XPTY0004: Arithmetic operator is not defined for provided arguments + throw e.code != "XPTY0004" ? e : new cException("FORG0006" + ); } }); +// 15.5 Functions and Operators that Generate Sequences +// fn:id($arg as xs:string*) as element()* +// fn:id($arg as xs:string*, $node as node()) as element()* fStaticContext_defineSystemFunction("id", [[cXSString, '*'], [cXTNode, '', true]], function(oSequence1, oNode) { if (arguments.length < 2) { if (!this.DOMAdapter.isNode(this.item)) throw new cException("XPTY0004" - , "id() function called when the context item is not a node" + ); oNode = this.item; } - var oDocument = hStaticContext_functions["root"].call(this, oNode); + // Get root node and check if it is Document + var oDocument = hStaticContext_functions["root"].call(this, oNode); if (this.DOMAdapter.getProperty(oDocument, "nodeType") != 9) throw new cException("FODC0001"); - var oSequence = []; + // Search for elements + var oSequence = []; for (var nIndex = 0; nIndex < oSequence1.length; nIndex++) for (var nRightIndex = 0, aValue = fString_trim(oSequence1[nIndex]).split(/\s+/), nRightLength = aValue.length; nRightIndex < nRightLength; nRightIndex++) if ((oNode = this.DOMAdapter.getElementById(oDocument, aValue[nRightIndex])) && fArray_indexOf(oSequence, oNode) ==-1) oSequence.push(oNode); - return fFunction_sequence_order(oSequence, this); + // + return fFunction_sequence_order(oSequence, this); }); +// fn:idref($arg as xs:string*) as node()* +// fn:idref($arg as xs:string*, $node as node()) as node()* fStaticContext_defineSystemFunction("idref", [[cXSString, '*'], [cXTNode, '', true]], function(oSequence1, oNode) { throw "Function '" + "idref" + "' not implemented"; }); +// fn:doc($uri as xs:string?) as document-node()? fStaticContext_defineSystemFunction("doc", [[cXSString, '?', true]], function(oUri) { throw "Function '" + "doc" + "' not implemented"; }); +// fn:doc-available($uri as xs:string?) as xs:boolean fStaticContext_defineSystemFunction("doc-available", [[cXSString, '?', true]], function(oUri) { throw "Function '" + "doc-available" + "' not implemented"; }); +// fn:collection() as node()* +// fn:collection($arg as xs:string?) as node()* fStaticContext_defineSystemFunction("collection", [[cXSString, '?', true]], function(oUri) { throw "Function '" + "collection" + "' not implemented"; }); +// fn:element-with-id($arg as xs:string*) as element()* +// fn:element-with-id($arg as xs:string*, $node as node()) as element()* fStaticContext_defineSystemFunction("element-with-id", [[cXSString, '*'], [cXTNode, '', true]], function(oSequence1, oNode) { throw "Function '" + "element-with-id" + "' not implemented"; }); +// EBV calculation function fFunction_sequence_toEBV(oSequence1, oContext) { if (!oSequence1.length) return false; @@ -5737,12 +7709,12 @@ function fFunction_sequence_toEBV(oSequence1, oContext) { return !(fIsNaN(oItem.valueOf()) || oItem.valueOf() == 0); throw new cException("FORG0006" - , "Effective boolean value is defined only for sequences containing booleans, strings, numbers, URIs, or nodes" + ); } throw new cException("FORG0006" - , "Effective boolean value is not defined for a sequence of two or more items" + ); }; @@ -5751,36 +7723,48 @@ function fFunction_sequence_atomize(oSequence1, oContext) { for (var nIndex = 0, nLength = oSequence1.length, oItem, vItem; nIndex < nLength; nIndex++) { oItem = oSequence1[nIndex]; vItem = null; - if (oItem == null) + // Untyped + if (oItem == null) vItem = null; - else + // Node type + else if (oContext.DOMAdapter.isNode(oItem)) { var fGetProperty = oContext.DOMAdapter.getProperty; switch (fGetProperty(oItem, "nodeType")) { - case 1: vItem = new cXSUntypedAtomic(fGetProperty(oItem, "textContent")); + case 1: // ELEMENT_NODE + vItem = new cXSUntypedAtomic(fGetProperty(oItem, "textContent")); break; - case 2: vItem = new cXSUntypedAtomic(fGetProperty(oItem, "value")); + case 2: // ATTRIBUTE_NODE + vItem = new cXSUntypedAtomic(fGetProperty(oItem, "value")); break; - case 3: case 4: case 8: vItem = new cXSUntypedAtomic(fGetProperty(oItem, "data")); + case 3: // TEXT_NODE + case 4: // CDATA_SECTION_NODE + case 8: // COMMENT_NODE + vItem = new cXSUntypedAtomic(fGetProperty(oItem, "data")); break; - case 7: vItem = new cXSUntypedAtomic(fGetProperty(oItem, "data")); + case 7: // PROCESSING_INSTRUCTION_NODE + vItem = new cXSUntypedAtomic(fGetProperty(oItem, "data")); break; - case 9: var oNode = fGetProperty(oItem, "documentElement"); + case 9: // DOCUMENT_NODE + var oNode = fGetProperty(oItem, "documentElement"); vItem = new cXSUntypedAtomic(oNode ? fGetProperty(oNode, "textContent") : ''); break; } } - else + // Base types + else if (oItem instanceof cXSAnyAtomicType) vItem = oItem; - if (vItem != null) + // + if (vItem != null) oSequence.push(vItem); } return oSequence; }; +// Orders items in sequence in document order function fFunction_sequence_order(oSequence1, oContext) { return oSequence1.sort(function(oNode, oNode2) { var nPosition = oContext.DOMAdapter.compareDocumentPosition(oNode, oNode2); @@ -5788,9 +7772,53 @@ function fFunction_sequence_order(oSequence1, oContext) { }); }; +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ +/* + 7.2 Functions to Assemble and Disassemble Strings + codepoints-to-string + string-to-codepoints + 7.3 Equality and Comparison of Strings + compare + codepoint-equal + 7.4 Functions on String Values + concat + string-join + substring + string-length + normalize-space + normalize-unicode + upper-case + lower-case + translate + encode-for-uri + iri-to-uri + escape-html-uri + + 7.5 Functions Based on Substring Matching + contains + starts-with + ends-with + substring-before + substring-after + + 7.6 String Functions that Use Pattern Matching + matches + replace + tokenize +*/ + +// 7.2 Functions to Assemble and Disassemble Strings +// fn:codepoints-to-string($arg as xs:integer*) as xs:string fStaticContext_defineSystemFunction("codepoints-to-string", [[cXSInteger, '*']], function(oSequence1) { var aValue = []; for (var nIndex = 0, nLength = oSequence1.length; nIndex < nLength; nIndex++) @@ -5799,6 +7827,7 @@ fStaticContext_defineSystemFunction("codepoints-to-string", [[cXSInteger, '*']], return new cXSString(aValue.join('')); }); +// fn:string-to-codepoints($arg as xs:string?) as xs:integer* fStaticContext_defineSystemFunction("string-to-codepoints", [[cXSString, '?']], function(oValue) { if (oValue == null) return null; @@ -5814,6 +7843,9 @@ fStaticContext_defineSystemFunction("string-to-codepoints", [[cXSString, '?']], return oSequence; }); +// 7.3 Equality and Comparison of Strings +// fn:compare($comparand1 as xs:string?, $comparand2 as xs:string?) as xs:integer? +// fn:compare($comparand1 as xs:string?, $comparand2 as xs:string?, $collation as xs:string) as xs:integer? fStaticContext_defineSystemFunction("compare", [[cXSString, '?'], [cXSString, '?'], [cXSString, '', true]], function(oValue1, oValue2, oCollation) { if (oValue1 == null || oValue2 == null) return null; @@ -5826,52 +7858,65 @@ fStaticContext_defineSystemFunction("compare", [[cXSString, '?'], [cXSString, '? vCollation = sCollation == sNS_XPF + "/collation/codepoint" ? oCodepointStringCollator : this.staticContext.getCollation(sCollation); if (!vCollation) throw new cException("FOCH0002" - , "Unknown collation " + '{' + sCollation + '}' + ); return new cXSInteger(vCollation.compare(oValue1.valueOf(), oValue2.valueOf())); }); +// fn:codepoint-equal($comparand1 as xs:string?, $comparand2 as xs:string?) as xs:boolean? fStaticContext_defineSystemFunction("codepoint-equal", [[cXSString, '?'], [cXSString, '?']], function(oValue1, oValue2) { if (oValue1 == null || oValue2 == null) return null; - + // TODO: Check if JS uses 'Unicode code point collation' here + return new cXSBoolean(oValue1.valueOf() == oValue2.valueOf()); }); +// 7.4 Functions on String Values +// fn:concat($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?, ...) as xs:string fStaticContext_defineSystemFunction("concat", null, function() { - if (arguments.length < 2) + // check arguments length + if (arguments.length < 2) throw new cException("XPST0017" - , "Function concat() must have at least 2 arguments" + ); var aValue = []; for (var nIndex = 0, nLength = arguments.length, oSequence; nIndex < nLength; nIndex++) { oSequence = arguments[nIndex]; - fFunctionCall_assertSequenceCardinality(this, oSequence, '?' - , "each argument of concat()" + // Assert cardinality + fFunctionCall_assertSequenceCardinality(this, oSequence, '?' + ); - if (oSequence.length) + // + if (oSequence.length) aValue[aValue.length] = cXSString.cast(fFunction_sequence_atomize(oSequence, this)[0]).valueOf(); } return new cXSString(aValue.join('')); }); +// fn:string-join($arg1 as xs:string*, $arg2 as xs:string) as xs:string fStaticContext_defineSystemFunction("string-join", [[cXSString, '*'], [cXSString]], function(oSequence1, oValue) { return new cXSString(oSequence1.join(oValue)); }); +// fn:substring($sourceString as xs:string?, $startingLoc as xs:double) as xs:string +// fn:substring($sourceString as xs:string?, $startingLoc as xs:double, $length as xs:double) as xs:string fStaticContext_defineSystemFunction("substring", [[cXSString, '?'], [cXSDouble], [cXSDouble, '', true]], function(oValue, oStart, oLength) { var sValue = oValue == null ? '' : oValue.valueOf(), nStart = cMath.round(oStart) - 1, nEnd = arguments.length > 2 ? nStart + cMath.round(oLength) : sValue.length; - return new cXSString(nEnd > nStart ? sValue.substring(nStart, nEnd) : ''); + // TODO: start can be negative + return new cXSString(nEnd > nStart ? sValue.substring(nStart, nEnd) : ''); }); +// fn:string-length() as xs:integer +// fn:string-length($arg as xs:string?) as xs:integer fStaticContext_defineSystemFunction("string-length", [[cXSString, '?', true]], function(oValue) { if (!arguments.length) { if (!this.item) @@ -5881,6 +7926,8 @@ fStaticContext_defineSystemFunction("string-length", [[cXSString, '?', true]], f return new cXSInteger(oValue == null ? 0 : oValue.valueOf().length); }); +// fn:normalize-space() as xs:string +// fn:normalize-space($arg as xs:string?) as xs:string fStaticContext_defineSystemFunction("normalize-space", [[cXSString, '?', true]], function(oValue) { if (!arguments.length) { if (!this.item) @@ -5890,18 +7937,23 @@ fStaticContext_defineSystemFunction("normalize-space", [[cXSString, '?', true]], return new cXSString(oValue == null ? '' : fString_trim(oValue).replace(/\s\s+/g, ' ')); }); +// fn:normalize-unicode($arg as xs:string?) as xs:string +// fn:normalize-unicode($arg as xs:string?, $normalizationForm as xs:string) as xs:string fStaticContext_defineSystemFunction("normalize-unicode", [[cXSString, '?'], [cXSString, '', true]], function(oValue, oNormalization) { throw "Function '" + "normalize-unicode" + "' not implemented"; }); +// fn:upper-case($arg as xs:string?) as xs:string fStaticContext_defineSystemFunction("upper-case", [[cXSString, '?']], function(oValue) { return new cXSString(oValue == null ? '' : oValue.valueOf().toUpperCase()); }); +// fn:lower-case($arg as xs:string?) as xs:string fStaticContext_defineSystemFunction("lower-case", [[cXSString, '?']], function(oValue) { return new cXSString(oValue == null ? '' : oValue.valueOf().toLowerCase()); }); +// fn:translate($arg as xs:string?, $mapString as xs:string, $transString as xs:string) as xs:string fStaticContext_defineSystemFunction("translate", [[cXSString, '?'], [cXSString], [cXSString]], function(oValue, oMap, oTranslate) { if (oValue == null) return new cXSString(''); @@ -5921,18 +7973,22 @@ fStaticContext_defineSystemFunction("translate", [[cXSString, '?'], [cXSString], return new cXSString(aReturn.join('')); }); +// fn:encode-for-uri($uri-part as xs:string?) as xs:string fStaticContext_defineSystemFunction("encode-for-uri", [[cXSString, '?']], function(oValue) { return new cXSString(oValue == null ? '' : window.encodeURIComponent(oValue)); }); +// fn:iri-to-uri($iri as xs:string?) as xs:string fStaticContext_defineSystemFunction("iri-to-uri", [[cXSString, '?']], function(oValue) { return new cXSString(oValue == null ? '' : window.encodeURI(window.decodeURI(oValue))); }); +// fn:escape-html-uri($uri as xs:string?) as xs:string fStaticContext_defineSystemFunction("escape-html-uri", [[cXSString, '?']], function(oValue) { if (oValue == null || oValue.valueOf() == '') return new cXSString(''); - var aValue = oValue.valueOf().split(''); + // Encode + var aValue = oValue.valueOf().split(''); for (var nIndex = 0, nLength = aValue.length, nCode; nIndex < nLength; nIndex++) if ((nCode = aValue[nIndex].charCodeAt(0)) < 32 || nCode > 126) aValue[nIndex] = window.encodeURIComponent(aValue[nIndex]); @@ -5940,22 +7996,40 @@ fStaticContext_defineSystemFunction("escape-html-uri", [[cXSString, '?']], funct }); +// 7.5 Functions Based on Substring Matching +// fn:contains($arg1 as xs:string?, $arg2 as xs:string?) as xs:boolean +// fn:contains($arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:boolean fStaticContext_defineSystemFunction("contains", [[cXSString, '?'], [cXSString, '?'], [cXSString, '', true]], function(oValue, oSearch, oCollation) { + if (arguments.length > 2) + throw "Collation parameter in function '" + "contains" + "' is not implemented"; return new cXSBoolean((oValue == null ? '' : oValue.valueOf()).indexOf(oSearch == null ? '' : oSearch.valueOf()) >= 0); }); +// fn:starts-with($arg1 as xs:string?, $arg2 as xs:string?) as xs:boolean +// fn:starts-with($arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:boolean fStaticContext_defineSystemFunction("starts-with", [[cXSString, '?'], [cXSString, '?'], [cXSString, '', true]], function(oValue, oSearch, oCollation) { + if (arguments.length > 2) + throw "Collation parameter in function '" + "starts-with" + "' is not implemented"; return new cXSBoolean((oValue == null ? '' : oValue.valueOf()).indexOf(oSearch == null ? '' : oSearch.valueOf()) == 0); }); +// fn:ends-with($arg1 as xs:string?, $arg2 as xs:string?) as xs:boolean +// fn:ends-with($arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:boolean fStaticContext_defineSystemFunction("ends-with", [[cXSString, '?'], [cXSString, '?'], [cXSString, '', true]], function(oValue, oSearch, oCollation) { + if (arguments.length > 2) + throw "Collation parameter in function '" + "ends-with" + "' is not implemented"; var sValue = oValue == null ? '' : oValue.valueOf(), sSearch = oSearch == null ? '' : oSearch.valueOf(); return new cXSBoolean(sValue.indexOf(sSearch) == sValue.length - sSearch.length); }); +// fn:substring-before($arg1 as xs:string?, $arg2 as xs:string?) as xs:string +// fn:substring-before($arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:string fStaticContext_defineSystemFunction("substring-before", [[cXSString, '?'], [cXSString, '?'], [cXSString, '', true]], function(oValue, oSearch, oCollation) { + if (arguments.length > 2) + throw "Collation parameter in function '" + "substring-before" + "' is not implemented"; + var sValue = oValue == null ? '' : oValue.valueOf(), sSearch = oSearch == null ? '' : oSearch.valueOf(), nPosition; @@ -5963,7 +8037,12 @@ fStaticContext_defineSystemFunction("substring-before", [[cXSString, '?'], [cXSS return new cXSString((nPosition = sValue.indexOf(sSearch)) >= 0 ? sValue.substring(0, nPosition) : ''); }); +// fn:substring-after($arg1 as xs:string?, $arg2 as xs:string?) as xs:string +// fn:substring-after($arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:string fStaticContext_defineSystemFunction("substring-after", [[cXSString, '?'], [cXSString, '?'], [cXSString, '', true]], function(oValue, oSearch, oCollation) { + if (arguments.length > 2) + throw "Collation parameter in function '" + "substring-after" + "' is not implemented"; + var sValue = oValue == null ? '' : oValue.valueOf(), sSearch = oSearch == null ? '' : oSearch.valueOf(), nPosition; @@ -5972,6 +8051,7 @@ fStaticContext_defineSystemFunction("substring-after", [[cXSString, '?'], [cXSSt }); +// 7.6 String Functions that Use Pattern Matching function fFunction_string_createRegExp(sValue, sFlags) { var d1 = '\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF', d2 = '\u0370-\u037D\u037F-\u1FFF\u200C-\u200D', @@ -5987,12 +8067,15 @@ function fFunction_string_createRegExp(sValue, sFlags) { .replace(/\\c/g, '[:' + c + ']') .replace(/\\C/g, '[^:' + c + ']'); - if (sFlags && !sFlags.match(/^[smix]+$/)) - throw new cException("FORX0001"); + // Check if all flags are legal + if (sFlags && !sFlags.match(/^[smix]+$/)) + throw new cException("FORX0001"); // Invalid character '{%0}' in regular expression flags + var bFlagS = sFlags.indexOf('s') >= 0, bFlagX = sFlags.indexOf('x') >= 0; if (bFlagS || bFlagX) { - sFlags = sFlags.replace(/[sx]/g, ''); + // Strip 's' and 'x' from flags + sFlags = sFlags.replace(/[sx]/g, ''); var aValue = [], rValue = /\s/; for (var nIndex = 0, nLength = sValue.length, bValue = false, sCharCurr, sCharPrev = ''; nIndex < nLength; nIndex++) { @@ -6004,8 +8087,10 @@ function fFunction_string_createRegExp(sValue, sFlags) { if (sCharCurr == ']') bValue = false; } - if (bValue || !(bFlagX && rValue.test(sCharCurr))) { - if (!bValue && (bFlagS && sCharCurr == '.' && sCharPrev != '\\')) + // Replace '\s' for flag 'x' if not in [] + if (bValue || !(bFlagX && rValue.test(sCharCurr))) { + // Replace '.' for flag 's' if not in [] + if (!bValue && (bFlagS && sCharCurr == '.' && sCharPrev != '\\')) aValue[aValue.length] = '(?:.|\\s)'; else aValue[aValue.length] = sCharCurr; @@ -6018,6 +8103,8 @@ function fFunction_string_createRegExp(sValue, sFlags) { return new cRegExp(sValue, sFlags + 'g'); }; +// fn:matches($input as xs:string?, $pattern as xs:string) as xs:boolean +// fn:matches($input as xs:string?, $pattern as xs:string, $flags as xs:string) as xs:boolean fStaticContext_defineSystemFunction("matches", [[cXSString, '?'], [cXSString], [cXSString, '', true]], function(oValue, oPattern, oFlags) { var sValue = oValue == null ? '' : oValue.valueOf(), rRegExp = fFunction_string_createRegExp(oPattern.valueOf(), arguments.length > 2 ? oFlags.valueOf() : ''); @@ -6025,6 +8112,8 @@ fStaticContext_defineSystemFunction("matches", [[cXSString, '?'], [cXSString], [ return new cXSBoolean(rRegExp.test(sValue)); }); +// fn:replace($input as xs:string?, $pattern as xs:string, $replacement as xs:string) as xs:string +// fn:replace($input as xs:string?, $pattern as xs:string, $replacement as xs:string, $flags as xs:string) as xs:string fStaticContext_defineSystemFunction("replace", [[cXSString, '?'], [cXSString], [cXSString], [cXSString, '', true]], function(oValue, oPattern, oReplacement, oFlags) { var sValue = oValue == null ? '' : oValue.valueOf(), rRegExp = fFunction_string_createRegExp(oPattern.valueOf(), arguments.length > 3 ? oFlags.valueOf() : ''); @@ -6032,6 +8121,8 @@ fStaticContext_defineSystemFunction("replace", [[cXSString, '?'], [cXSString], return new cXSBoolean(sValue.replace(rRegExp, oReplacement.valueOf())); }); +// fn:tokenize($input as xs:string?, $pattern as xs:string) as xs:string* +// fn:tokenize($input as xs:string?, $pattern as xs:string, $flags as xs:string) as xs:string* fStaticContext_defineSystemFunction("tokenize", [[cXSString, '?'], [cXSString], [cXSString, '', true]], function(oValue, oPattern, oFlags) { var sValue = oValue == null ? '' : oValue.valueOf(), rRegExp = fFunction_string_createRegExp(oPattern.valueOf(), arguments.length > 2 ? oFlags.valueOf() : ''); @@ -6043,16 +8134,35 @@ fStaticContext_defineSystemFunction("tokenize", [[cXSString, '?'], [cXSString], return oSequence; }); +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ +/* + 4 The Trace Function + trace +*/ - +// fn:trace($value as item()*, $label as xs:string) as item()* fStaticContext_defineSystemFunction("trace", [[cXTItem, '*'], [cXSString]], function(oSequence1, oLabel) { var oConsole = window.console; if (oConsole && oConsole.log) oConsole.log(oLabel.valueOf(), oSequence1); return oSequence1; }); - +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ var oCodepointStringCollator = new cStringCollator; @@ -6063,33 +8173,6 @@ oCodepointStringCollator.equals = function(sValue1, sValue2) { oCodepointStringCollator.compare = function(sValue1, sValue2) { return sValue1 == sValue2 ? 0 : sValue1 > sValue2 ? 1 :-1; }; - - -var cAttr = function() { - -}; - -cAttr.prototype.nodeType = 2; -cAttr.prototype.nodeName = -cAttr.prototype.nodeValue = -cAttr.prototype.ownerDocument = -cAttr.prototype.localName = -cAttr.prototype.namespaceURI = -cAttr.prototype.prefix = -cAttr.prototype.attributes = -cAttr.prototype.childNodes = -cAttr.prototype.firstChild = -cAttr.prototype.lastChild = -cAttr.prototype.previousSibling = -cAttr.prototype.nextSibling = -cAttr.prototype.parentNode = - -cAttr.prototype.name = -cAttr.prototype.specified = -cAttr.prototype.value = -cAttr.prototype.ownerElement = null; - - function cLXDOMAdapter() { }; @@ -6219,24 +8302,6 @@ cLXDOMAdapter.prototype.getElementsByTagNameNS = function(oNode, sNameSpaceURI, return aElements; }; - -var oL2DOMAdapter = new cLXDOMAdapter; - - - -var oL2HTMLDOMAdapter = new cLXDOMAdapter; - -oL2HTMLDOMAdapter.getProperty = function(oNode, sName) { - if (sName == "localName") { - if (oNode.nodeType == 1) - return oNode.localName.toLowerCase(); - } - if (sName == "namespaceURI") - return oNode.nodeType == 1 ? "http://www.w3.org/1999/xhtml" : null; - return cLXDOMAdapter.prototype.getProperty.call(this, oNode, sName); -}; - - var oMSHTMLDOMAdapter = new cLXDOMAdapter; oMSHTMLDOMAdapter.getProperty = function(oNode, sName) { @@ -6315,66 +8380,87 @@ oMSXMLDOMAdapter.getElementById = function(oDocument, sId) { return oDocument.nodeFromID(sId); }; +function cEvaluator() { - - -var cQuery = window.jQuery, - oDocument = window.document, - bOldMS = !!oDocument.namespaces && !oDocument.createElementNS, - bOldW3 = !bOldMS && oDocument.documentElement.namespaceURI != "http://www.w3.org/1999/xhtml"; - -var oHTMLStaticContext = new cStaticContext, - oXMLStaticContext = new cStaticContext; - -oHTMLStaticContext.baseURI = oDocument.location.href; -oHTMLStaticContext.defaultFunctionNamespace = "http://www.w3.org/2005/xpath-functions"; -oHTMLStaticContext.defaultElementNamespace = "http://www.w3.org/1999/xhtml"; - -oXMLStaticContext.defaultFunctionNamespace = oHTMLStaticContext.defaultFunctionNamespace; - -function fXPath_evaluate(oQuery, sExpression, fNSResolver) { - if (typeof sExpression == "undefined" || sExpression === null) - sExpression = ''; - - var oNode = oQuery[0]; - if (typeof oNode == "undefined") - oNode = null; - - var oStaticContext = oNode && (oNode.nodeType == 9 ? oNode : oNode.ownerDocument).createElement("div").tagName == "DIV" ? oHTMLStaticContext : oXMLStaticContext; - - oStaticContext.namespaceResolver = fNSResolver; - - var oExpression = new cExpression(cString(sExpression), oStaticContext); - - oStaticContext.namespaceResolver = null; - - var aSequence, - oSequence = new cQuery, - oAdapter = oL2DOMAdapter; - - if (bOldMS) - oAdapter = oStaticContext == oHTMLStaticContext ? oMSHTMLDOMAdapter : oMSXMLDOMAdapter; - else - if (bOldW3 && oStaticContext == oHTMLStaticContext) - oAdapter = oL2HTMLDOMAdapter; - - aSequence = oExpression.evaluate(new cDynamicContext(oStaticContext, oNode, null, oAdapter)); - for (var nIndex = 0, nLength = aSequence.length, oItem; nIndex < nLength; nIndex++) - oSequence.push(oAdapter.isNode(oItem = aSequence[nIndex]) ? oItem : cStaticContext.xs2js(oItem)); - - return oSequence; }; -var oObject = {}; -oObject.xpath = function(oQuery, sExpression, fNSResolver) { - return fXPath_evaluate(oQuery instanceof cQuery ? oQuery : new cQuery(oQuery), sExpression, fNSResolver); -}; -cQuery.extend(cQuery, oObject); +cEvaluator.prototype.defaultOL2DOMAdapter = new cLXDOMAdapter; +cEvaluator.prototype.defaultOL2HTMLDOMAdapter = new cLXDOMAdapter; -oObject = {}; -oObject.xpath = function(sExpression, fNSResolver) { - return fXPath_evaluate(this, sExpression, fNSResolver); -}; -cQuery.extend(cQuery.prototype, oObject); +cEvaluator.prototype.defaultHTMLStaticContext = new cStaticContext; +cEvaluator.prototype.defaultHTMLStaticContext.baseURI = window.document.location.href; +cEvaluator.prototype.defaultHTMLStaticContext.defaultFunctionNamespace = "http://www.w3.org/2005/xpath-functions"; +cEvaluator.prototype.defaultHTMLStaticContext.defaultElementNamespace = "http://www.w3.org/1999/xhtml"; -})(); +cEvaluator.prototype.defaultXMLStaticContext = new cStaticContext; +cEvaluator.prototype.defaultXMLStaticContext.defaultFunctionNamespace = "http://www.w3.org/2005/xpath-functions"; + +cEvaluator.prototype.bOldMS = !!window.document.namespaces && !window.document.createElementNS; +cEvaluator.prototype.bOldW3 = !cEvaluator.prototype.bOldMS && window.document.documentElement.namespaceURI != "http://www.w3.org/1999/xhtml"; + +cEvaluator.prototype.defaultDOMAdapter = new cDOMAdapter; + +cEvaluator.prototype.compile = function(sExpression, oStaticContext) { + return new cExpression(sExpression, oStaticContext); +}; + +cEvaluator.prototype.evaluate = function(oQuery, sExpression, fNSResolver) { + if (! (oQuery instanceof window.jQuery)) + oQuery = new window.jQuery(oQuery) + + if (typeof sExpression == "undefined" || sExpression === null) + sExpression = ''; + + var oNode = oQuery[0]; + if (typeof oNode == "undefined") + oNode = null; + + var oStaticContext = oNode && (oNode.nodeType == 9 ? oNode : oNode.ownerDocument).createElement("div").tagName == "DIV" ? this.defaultHTMLStaticContext : this.defaultXMLStaticContext; + + oStaticContext.namespaceResolver = fNSResolver; + + var oExpression = new cExpression(cString(sExpression), oStaticContext); + + oStaticContext.namespaceResolver = null; + + var aSequence, + oSequence = new window.jQuery, + oAdapter = this.defaultOL2DOMAdapter; + + if (this.bOldMS) + oAdapter = oStaticContext == this.defaultHTMLStaticContext ? oMSHTMLDOMAdapter : oMSXMLDOMAdapter; + else + if (this.bOldW3 && oStaticContext == this.defaultHTMLStaticContext) + oAdapter = this.defaultOL2HTMLDOMAdapter; + + aSequence = oExpression.evaluate(new cDynamicContext(oStaticContext, oNode, null, oAdapter)); + for (var nIndex = 0, nLength = aSequence.length, oItem; nIndex < nLength; nIndex++) + oSequence.push(oAdapter.isNode(oItem = aSequence[nIndex]) ? oItem : cStaticContext.xs2js(oItem)); + + return oSequence; +}; + +/* + * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator + * + * Copyright (c) 2012 Sergey Ilinsky + * Dual licensed under the MIT and GPL licenses. + * + * + */ + +var oXPathEvaluator = new cEvaluator, + oXPathClasses = oXPathEvaluator.classes = {}; + +// +oXPathClasses.Exception = cException; +oXPathClasses.Expression = cExpression; +oXPathClasses.DOMAdapter = cDOMAdapter; +oXPathClasses.StaticContext = cStaticContext; +oXPathClasses.DynamicContext= cDynamicContext; +oXPathClasses.StringCollator= cStringCollator; + +// Publish object +window.xpath = oXPathEvaluator; + +})() \ No newline at end of file diff --git a/src/js/operations/Extract.js b/src/js/operations/Extract.js index f84719e6..470b43c2 100755 --- a/src/js/operations/Extract.js +++ b/src/js/operations/Extract.js @@ -1,3 +1,5 @@ +/* globals xpath */ + /** * Identifier extraction operations. * @@ -309,6 +311,8 @@ var Extract = { /** * Extract information (from an xml document) with an XPath query * + * @author Mikescher (https://github.com/Mikescher | https://mikescher.com) + * * @param {string} input * @param {Object[]} args * @returns {string} @@ -326,7 +330,7 @@ var Extract = { var result; try { - result = $.xpath(xml, query); + result = xpath.evaluate(xml, query); } catch (err) { return "Invalid XPath. Details:\n" + err.message; } @@ -362,6 +366,8 @@ var Extract = { /** * Extract information (from an hmtl document) with an css selector * + * @author Mikescher (https://github.com/Mikescher | https://mikescher.com) + * * @param {string} input * @param {Object[]} args * @returns {string} @@ -376,7 +382,7 @@ var Extract = { } catch (err) { return "Invalid input HTML."; } - + var result; try { result = $(html).find(query); @@ -388,7 +394,7 @@ var Extract = { switch (node.nodeType) { case Node.ELEMENT_NODE: return node.outerHTML; case Node.ATTRIBUTE_NODE: return node.value; - case Node.COMMENT_NODE: return node.ata; + case Node.COMMENT_NODE: return node.data; case Node.TEXT_NODE: return node.wholeText; case Node.DOCUMENT_NODE: return node.outerHTML; default: throw new Error("Unknown Node Type: " + node.nodeType); @@ -396,7 +402,9 @@ var Extract = { }; return Array.apply(null, Array(result.length)) - .map((_, i) => result[i]) + .map(function(_, i) { + return result[i]; + }) .map(nodeToString) .join(delimiter); }, From 4b5210585a8d0bb085b959d3d0ef27cbee48ec3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Sat, 17 Dec 2016 01:53:06 +0100 Subject: [PATCH 08/24] Added operation 'filter' --- src/js/config/Categories.js | 1 + src/js/config/OperationConfig.js | 23 +++++++++++++++++++++++ src/js/operations/StrUtils.js | 26 ++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) diff --git a/src/js/config/Categories.js b/src/js/config/Categories.js index f75a5484..304b006c 100755 --- a/src/js/config/Categories.js +++ b/src/js/config/Categories.js @@ -148,6 +148,7 @@ const Categories = [ "Sort", "Unique", "Split", + "Filter", "Count occurrences", "Expand alphabet range", "Parse escaped string", diff --git a/src/js/config/OperationConfig.js b/src/js/config/OperationConfig.js index 5591a43c..52f7a6a9 100755 --- a/src/js/config/OperationConfig.js +++ b/src/js/config/OperationConfig.js @@ -1764,6 +1764,29 @@ const OperationConfig = { } ] }, + "Filter": { + description: "Filter the string with an regular expression", + run: StrUtils.run_filter, + input_type: "string", + output_type: "string", + args: [ + { + name: "Delimiter", + type: "option", + value: StrUtils.DELIMITER_OPTIONS + }, + { + name: "Regex", + type: "string", + value: "" + }, + { + name: "Invert condition", + type: "boolean", + value: SeqUtils.SORT_REVERSE + }, + ] + }, "Strings": { description: "Extracts all strings from the input.", run: Extract.run_strings, diff --git a/src/js/operations/StrUtils.js b/src/js/operations/StrUtils.js index e0d10105..71d3436a 100755 --- a/src/js/operations/StrUtils.js +++ b/src/js/operations/StrUtils.js @@ -261,6 +261,32 @@ var StrUtils = { return sections.join(join_delim); }, + + /** + * Filter by regex operation. + * + * @author Mikescher (https://github.com/Mikescher | https://mikescher.com) + * + * @param {string} input + * @param {Object[]} args + * @returns {string} + */ + run_filter: function(input, args) { + var delim = Utils.char_rep[args[0]]; + var reverse = args[2]; + + try { + var regex = new RegExp(args[1]); + } catch (err) { + return "Invalid regex. Details: " + err.message; + } + + const regex_filter = function(value) { + return reverse ^ regex.test(value); + } + + return input.split(delim).filter(regex_filter).join(delim); + }, /** From 39d50093ae80d961f7ff138f844b34da153306ed Mon Sep 17 00:00:00 2001 From: n1474335 Date: Tue, 20 Dec 2016 18:49:25 +0000 Subject: [PATCH 09/24] Tweaks to 'XPath expression' and 'CSS selector' operations. Closes #13. --- build/prod/cyberchef.htm | 35 +++++---- build/prod/index.html | 2 +- build/prod/scripts.js | 31 +++++--- src/js/config/Categories.js | 2 + src/js/config/OperationConfig.js | 16 ++--- src/js/lib/xpath.js | 16 ++--- src/js/operations/Code.js | 117 ++++++++++++++++++++++++++++++- src/js/operations/Extract.js | 115 ------------------------------ src/static/stats.txt | 24 +++---- 9 files changed, 189 insertions(+), 169 deletions(-) mode change 100644 => 100755 src/js/lib/xpath.js diff --git a/build/prod/cyberchef.htm b/build/prod/cyberchef.htm index 538a7e35..ab9f4e68 100755 --- a/build/prod/cyberchef.htm +++ b/build/prod/cyberchef.htm @@ -91,11 +91,11 @@ 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. -*/.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.clo,.opn,.pun{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.kwd,.tag,.typ{font-weight:700}.str{color:#060}.kwd{color:#006}.com{color:#600;font-style:italic}.typ{color:#404}.lit{color:#044}.clo,.opn,.pun{color:#440}.tag{color:#006}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}#content-wrapper{top:0;left:0;width:100%;height:100%}#banner{height:30px;text-align:center;line-height:30px}#wrapper{top:30px;bottom:0}div#operations,div#recipe{width:50%;height:100%}div#input,div#output{width:100%;height:50%}.title{padding:10px;height:43px}.textarea-wrapper{top:43px;bottom:0;width:100%;overflow:hidden}#output-html,textarea{width:100%;height:100%;border:none;padding:3px;-moz-padding-start:3px;-moz-padding-end:3px}#input-text,#output-html,#output-text{position:relative;border-width:0;margin:0;resize:none;background-color:transparent;white-space:pre-wrap;word-wrap:break-word}#output-html{display:none;overflow-y:auto;-moz-padding-start:1px}.split{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;overflow:auto;position:relative}.gutter.gutter-horizontal,.split.split-horizontal{height:100%;float:left}#input-highlighter,#output-highlighter{position:absolute;left:0;top:0;width:100%;height:100%;padding:3px;margin:0;overflow:hidden;letter-spacing:normal;white-space:pre-wrap;word-wrap:break-word;color:#fff;background-color:transparent;border:none}#op_list,#rec_list,.op_list{margin:0;padding:0;list-style-type:none}#op_list,#rec_list{position:absolute;top:43px;bottom:0;width:100%}.io-btn-group,.io-info{margin-top:-4px;float:right}#rec_list{bottom:120px;overflow:auto}.operation{cursor:pointer;padding:10px;list-style-type:none;position:relative}#controls{position:absolute;width:100%;height:120px;bottom:0;padding:10px}.io-info{margin-right:20px;height:30px;text-align:right;line-height:10px}.arg-group,.inline-args input[type=checkbox]{margin-top:10px}#input-info{line-height:15px}.arg-group{display:table;width:100%}.arg-group-text{display:block}.inline-args{float:left;width:auto;margin-right:30px;height:34px}.inline-args input[type=number]{width:100px}.arg-input{display:table-cell;width:100%;padding:6px 12px}.short-string{width:150px}select{display:block}.arg[disabled]{cursor:not-allowed;opacity:1}textarea.arg{width:100%;min-height:50px;height:70px;margin-top:5px;border:1px solid #ddd;resize:vertical}.arg-label{display:table-cell;width:1px;padding-right:10px;font-weight:400;white-space:pre}.title,optgroup{font-weight:700}.editable-option{position:relative;display:inline-block}.editable-option-input{position:absolute;top:1px;left:1px;width:calc(100% - 20px);height:calc(100% - 2px)!important;border:none!important}#operational-controls{width:65%;float:left;text-align:center}#bake-group{display:table;width:100%}#bake{display:table-cell;width:100%;border-top-right-radius:0;border-bottom-right-radius:0}#auto-bake-label{display:table-cell;padding:1px;line-height:1.35;width:60px;border-top-left-radius:0;border-bottom-left-radius:0;border-left:1px solid #5cb85c}#auto-bake-label:hover{border-left-color:#398439}#auto-bake-label div{font-size:10px;padding:2px}#extra-controls{float:right;width:35%;padding-left:10px}.op-icon{float:right;margin-left:10px;margin-top:3px}.recip-icons{position:absolute;top:13px;right:10px;height:16px}.recip-icon{margin-right:10px;vertical-align:baseline;float:right}.disable-icon{width:16px;height:16px;margin-top:-1px;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAACfElEQVQ4y6WTPWgTYRjHf8nlfVvuoDVIP4Yuki4WHKoUqggFRUTsUEGkVG2hmCq6OnTwIxYHB+eijZOKdLNDW1pKKyGigh8dBHUJElxyBgx3vEnukvdyDrUhRXDxGR+e/+/583xEwjDkfyIGwNVTzURm4tYAMA6MAoN/0tvAMrA48uL+l2bx4w0iYRjSuHKC6OnTZLqHk8CcaZq9bW1tSCkBqNVq+L5PpVIpAHdGfr5LN9bXiT7Z2nGgteb1/qFkLBJZ6OjowHEc8vk8pVIJgHg8TldXF52dnb2u6y5s7R/iuF5JSyAKkLl4eyAMwznLsrBtm1wu99Z13amk+BFJih8R13WXANrb27EsizAM5zIXbw+wC9Baj0spe5VSFAqFt4ZhXJ6ufXuK55E5cDKVSCTGenp6yGazKKWQUvZqrcebgCAIRqWUOI6DEOLR1K8POapVMgfPpoC7u2LLspYcx0FKSRAEo60OBg3DwPd9Jr5vPqWvj8zh83vEwL2J75vnfN/HMAy01oPNNQZBQBAEO1OvVsl0D/8lTuZfpYDd7gRBQKuD7XK5jGmarB679PIv8deVFJUKq8cuTZqmSblcRmu93QpYVkohhMCyrLE94n2/UlSrbJy5kRBCXBNCoJRCa73cClh0XbfgeR6WZZHNZunv719KvnmeYnWVVxdmJ2Ox2DMhxFHP83Bdt6C1XgR2LvHzQDvvb84npZQL8Xgc0zSJRqN7br7RaFCpVCiVStRqtZmhh9fTh754TQdMr82nPc+bsW27UCwWUUpRr9ep1+sopSgWi9i2XfA8b2Z6bT6ttabp4GMi0uz0aXbhn890+MFM85mO5MIdwP/Eb1pMUCdctYRzAAAAAElFTkSuQmCC) no-repeat}.disable-icon-selected{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACFUlEQVR4XqWTP0tbURjGn9zY3mjBwsUhBQtS6XKxiNypIGZJ6SKYUYdaKWg7OrrE3pYO+Qit3dpFuuQO6lI7Z4nESQdjlJbkJh0MksSb3Jvk9H0gjZFu9YWH83LO7zn/3nNCSincJobAeP1sEDBFi6J50UyPy4l2RNuioz756Ts0tt1OB4jH2a52Ne2HGh9PwrJm2EcxZx/HyPRYMDgB2u02/N3d1c7w8BZMM1ptNJBPp3GwsUExB/s4RoYsPf0JOkFgdoH34YkJ/D48xC/HyTTOzl5ayWSIktwxqlVo0SjIkKWnP0Hg+4swjGitVMJFNpu5o+svptfXv6DZBDIZezoWS3Db3A0ZsvRcH8H354dGR9EoFHA3EvlorqycwvOAXM4G8Pav+f7YmEOGLD1gsIzl54+V+vBK/Yw9ZAv1LQW1FrdFSnKVfQTK5liPUfRI9I8ArqiPjLAF9vcHVybyzlpasgcZeq7voNXKNSsV3DMMXB4fp/8xLyzYuLri2DIZsvQM3sFOzXURiUR4zsQNcyrFleFVKpNyP2/IkKVnsArbF65bbkqplJSJZrl5x5qbs7G3h3artSyV+arr+lMyZOnpP2Wp6ZFos3R+vvUgCGDNzgKalkA4rECIr07662J2i0X4nrfJJ33jJT6Zmvpcr9XWCicn5WI+j7rrAmKgmLOPY2TI0sPgb8TBZOi/PpN1qnDr7/wH3jxgB/FKIXkAAAAASUVORK5CYII=) no-repeat}.breakpoint{float:right;width:14px;height:14px;background-color:#eee;border:1px solid #aaa}.breakpoint-selected{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAXVBMVEXIUkvzUVHzTEzzn5785eXrbW24BgbzWVnze3vzVVXzY2Pyion509PzbW3zXV1UMxj0l5f1srKbRTRgOxzJDg796ur74ODfIyP5zs6LLx3pNTXYGxuxdkVZNhn////sCC1eAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAABWSURBVBjTnc+7EoAgDERRTOQVxMEZFAf//z8FjAUFDbfb060QU2FwxngimxnCea3bjegSgz+0tguAfBgIy64QGfZQdg91dgAtqUZgnfz6IacYVWvu2AvR4wNAv0nxrAAAAABJRU5ErkJggg==) -2px -2px no-repeat #eee}.banner-right{float:right;margin-right:10px}#banner img{margin-bottom:2px;margin-left:8px}.category-title{display:block;padding:10px}.category{margin:0!important;border-radius:0!important;border:none}#search{border-radius:0;border:none}.loading_file{background:url(data:image/gif;base64,R0lGODlhPAA8APcAAAAAAAEBAQICAgMDAwQEBAUFBQYGBgcHBwgICAkJCQoKCgsLCwwMDA0NDQ4ODg8PDxAQEBERERISEhMTExQUFBUVFRYWFhcXFxgYGBkZGRoaGhsbGxwcHB0dHR4eHh8fHyAgICEhISIiIiMjIyQkJCUlJSYmJicnJygoKCkpKSoqKisrKywsLC0tLS4uLi8vLzAwMDExMTIyMjMzMzQ0NDU1NTY2Njc3Nzg4ODk5OTo6Ojs7Ozw8PD09PT4+Pj8/P0BAQEFBQUJCQkNDQ0REREVFRUZGRkdHR0hISElJSUpKSktLS0xMTE1NTU5OTk9PT1BQUFFRUVJSUlNTU1RUVFVVVVZWVldXV1hYWFlZWVpaWltbW1xcXF1dXV5eXl9fX2BgYGFhYWJiYmNjY2RkZGVlZWZmZmdnZ2hoaGlpaWpqamtra2xsbG1tbW5ubm9vb3BwcHFxcXJycnNzc3R0dHV1dXZ2dnd3d3h4eHl5eXp6ent7e3x8fH19fX5+fn9/f4CAgIGBgYKCgoODg4SEhIWFhYaGhoeHh4iIiImJiYqKiouLi4yMjI2NjY6Ojo+Pj5CQkJGRkZKSkpOTk5SUlJWVlZaWlpeXl5iYmJmZmZqampubm5ycnJ2dnZ6enp+fn6CgoKGhoaKioqOjo6SkpKWlpaampqenp6ioqKmpqaqqqqurq6ysrK2tra6urq+vr7CwsLGxsbKysrOzs7S0tLW1tba2tre3t7i4uLm5ubq6uru7u7y8vL29vb6+vr+/v8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XYbi6Ch7MkF/Yq/z2lRIFq2u/UJkiN76aTFPkTKKAQo226bKoclf9iYqsKTDXfrRIBSPMurVrfuXAuRPczRkzZ/q4yrPNjFm0wyLL9e4d7R5XacOldWUHLZo04En90YPuWnA8eYL3nStXTh31iem4IXOfF3q7eHZc1Yk3R54ru3Pn1hXMl3tjv3swCa47h256QAA7) center center no-repeat #f5f5f5}#alert{position:fixed;width:30%;margin:30px auto;top:10px;left:0;right:0;z-index:2000;display:none}#alert a{text-decoration:underline}.option-item .bootstrap-switch{margin:15px 10px}.option-item button{margin:10px}.option-item input[type=number]{margin:15px 10px;width:80px;height:28px;padding:3px 10px;vertical-align:middle}.option-item select{margin:10px;display:inline-block}button img,span.btn img{margin-right:3px;margin-bottom:1px}#edit-favourites{float:right;margin-top:-5px}#edit-favourites-list{margin:10px}.about-img-left{float:left;margin:10px 20px 20px 0}.about-img-right{float:right;margin:10px 0 20px 20px}.save-link-options{float:right}.save-link-options input{margin-left:10px}#save-footer{border-top:none;margin-top:0}a:focus,button{outline:0;-moz-outline-style:none}.btn-default{border-color:#ddd}.btn-default:focus{background-color:#fff;border-color:#adadad}.btn-default:active,.btn-default:hover{background-color:#ebebeb;border-color:#adadad}.alert,.btn,.btn-lg,.dropdown-menu,.form-control,.modal-content,.nav-tabs>li>a,.popover,.tooltip-inner{border-radius:0!important}input[type=search]{-webkit-appearance:searchfield;box-shadow:none}input[type=search]::-webkit-search-cancel-button{-webkit-appearance:searchfield-cancel-button}.modal{overflow-y:auto}.form-control{background-color:transparent}code{border:0;white-space:pre-wrap}.bootstrap-switch,.bootstrap-switch-container,.bootstrap-switch-handle-off,.bootstrap-switch-handle-on,.bootstrap-switch-label,pre{border-radius:0!important}#banner,.title{border-bottom:1px solid #ddd}blockquote{font-size:inherit}.panel-body:after,.panel-body:before{content:""}.sortable-ghost{opacity:.6}.colorpicker-element{float:left;margin-right:15px}.colorpicker-color,.colorpicker-color div{height:100px}.word-wrap{white-space:pre!important;word-wrap:normal!important;overflow-x:scroll!important}.clearfix{height:0}.blur{color:transparent!important;text-shadow:rgba(0,0,0,.95) 0 0 10px!important}.no-select{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.konami{-ms-transform:rotate(180deg);-webkit-transform:rotate(180deg);transform:rotate(180deg);-moz-transform:rotate(180deg)}.hl1,.hlyellow{background-color:#fff000}.hl2,.hlblue{background-color:#95dfff}.hl3,.hlred{background-color:#ffb6b6}.hl4,.hlorange{background-color:#fcf8e3}.hl5,.hlgreen{background-color:#8de768}.title{color:#424242;background-color:#fafafa}.gutter{background-color:#eee;background-repeat:no-repeat;background-position:50%}.gutter.gutter-horizontal{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAAeCAYAAAAGos/EAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAlSURBVChTYzxz5sx/BiBgAhEgwPju3TtUEZZ79+6BGcNcDQMDACWJMFs4hNOSAAAAAElFTkSuQmCC);cursor:ew-resize}.gutter.gutter-vertical{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAACCAYAAABPJGxCAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACHDwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKL2lDQ1BJQ0MgUHJvZmlsZQAASMedlndUVNcWh8+9d3qhzTDSGXqTLjCA9C4gHQRRGGYGGMoAwwxNbIioQEQREQFFkKCAAaOhSKyIYiEoqGAPSBBQYjCKqKhkRtZKfHl57+Xl98e939pn73P32XuftS4AJE8fLi8FlgIgmSfgB3o401eFR9Cx/QAGeIABpgAwWempvkHuwUAkLzcXerrICfyL3gwBSPy+ZejpT6eD/0/SrFS+AADIX8TmbE46S8T5Ik7KFKSK7TMipsYkihlGiZkvSlDEcmKOW+Sln30W2VHM7GQeW8TinFPZyWwx94h4e4aQI2LER8Q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YgUFJSAlEM9+7dA9O05jOBSboDBgYAtPcYZ1oUA30AAAAASUVORK5CYII=);cursor:ns-resize}.operation{border:1px solid #999;border-top-width:0}.op_list .operation{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1}#rec_list .operation{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.arg-input,select{height:34px;border:1px solid #ddd;background-color:#fff;color:#424242}#controls{border-top:1px solid #ddd;background-color:#fafafa}.textarea-wrapper div,.textarea-wrapper textarea{font-family:Consolas,monospace;font-size:inherit}.io-info{font-weight:400;font-size:8pt}.arg-title,.category-title{font-weight:700}.arg-input{font-size:15px;line-height:1.428571429}select{padding:6px 8px}.arg[disabled]{background-color:#eee}textarea.arg{color:#424242}.break{color:#b94a48!important;background-color:#f2dede!important;border-color:#eed3d7!important}.category-title{background-color:#fafafa;border-bottom:1px solid #eee}.category-title[aria-expanded=true],.category-title[href='#catFavourites']{border-bottom-color:#ddd}.category-title.collapsed{border-bottom-color:#eee}.category-title:hover{color:#3a87ad}#search{border-bottom:1px solid #e3e3e3}.dropping-file{border:5px dashed #3a87ad!important}.selected-op{color:#c09853!important;background-color:#fcf8e3!important;border-color:#fbeed5!important}.option-item input[type=number]{font-size:14px;line-height:1.428571429;color:#555;background-color:#fff;border:1px solid #ccc}.favourites-hover{color:#468847;background-color:#dff0d8;border:2px dashed #468847!important;padding:8px 8px 9px}#edit-favourites-list{border:1px solid #bce8f1}#edit-favourites-list .operation{border-left:none;border-right:none}#edit-favourites-list .operation:last-child{border-bottom:none}.subtext{font-style:italic;font-size:13px;color:#999}#save-footer{border-bottom:1px solid #e5e5e5}.flow-control-op{color:#396f3a!important;background-color:#c7e4ba!important;border-color:#b3dba2!important}.flow-control-op.break{color:#94312f!important;background-color:#eabfbf!important;border-color:#e2aeb5!important}#support-modal textarea{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif}#load-text,#save-text{font-family:Consolas,monospace}button.dropdown-toggle{background-color:#f4f4f4}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-track{background-color:#fafafa}::-webkit-scrollbar-thumb{background-color:#ccc}::-webkit-scrollbar-thumb:hover{background-color:#bbb}::-webkit-scrollbar-corner{background-color:#fafafa}.disabled{color:#999!important;background-color:#dfdfdf!important;border-color:#cdcdcd!important}.grey{color:#333;background-color:#f5f5f5;border-color:#ddd}.dark-blue{color:#fff;background-color:#428bca;border-color:#428bca}.red{color:#b94a48;background-color:#f2dede;border-color:#eed3d7}.amber{color:#c09853;background-color:#fcf8e3;border-color:#fbeed5}.green{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.blue{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1} Edit
Operations
    Recipe
      Input
      Output
      Operations
        Recipe
          Input
          Output
          \ No newline at end of file +function(a){"function"==typeof define&&define.amd?define(a):"undefined"!=typeof module&&"undefined"!=typeof module.exports?module.exports=a():"undefined"!=typeof Package?Sortable=a():window.Sortable=a()}(function(){function a(a,b){if(!a||!a.nodeType||1!==a.nodeType)throw"Sortable: `el` must be HTMLElement, and not "+{}.toString.call(a);this.el=a,this.options=b=s({},b),a[M]=this;var c={group:Math.random(),sort:!0,disabled:!1,store:null,handle:null,scroll:!0,scrollSensitivity:30,scrollSpeed:10,draggable:/[uo]l/i.test(a.nodeName)?"li":">*",ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",ignore:"a, img",filter:null,animation:0,setData:function(a,b){a.setData("Text",b.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1};for(var d in c)!(d in b)&&(b[d]=c[d]);W(b);for(var f in this)"_"===f.charAt(0)&&(this[f]=this[f].bind(this));this.nativeDraggable=!b.forceFallback&&Q,e(a,"mousedown",this._onTapStart),e(a,"touchstart",this._onTapStart),this.nativeDraggable&&(e(a,"dragover",this),e(a,"dragenter",this)),U.push(this._onDragOver),b.store&&this.sort(b.store.get(this))}function b(a){w&&w.state!==a&&(h(w,"display",a?"none":""),!a&&w.state&&x.insertBefore(w,t),w.state=a)}function c(a,b,c){if(a){c=c||O;do if(">*"===b&&a.parentNode===c||q(a,b))return a;while(a!==c&&(a=a.parentNode))}return null}function d(a){a.dataTransfer&&(a.dataTransfer.dropEffect="move"),a.preventDefault()}function e(a,b,c){a.addEventListener(b,c,!1)}function f(a,b,c){a.removeEventListener(b,c,!1)}function g(a,b,c){if(a)if(a.classList)a.classList[c?"add":"remove"](b);else{var d=(" "+a.className+" ").replace(L," ").replace(" "+b+" "," ");a.className=(d+(c?" "+b:"")).replace(L," ")}}function h(a,b,c){var d=a&&a.style;if(d){if(void 0===c)return O.defaultView&&O.defaultView.getComputedStyle?c=O.defaultView.getComputedStyle(a,""):a.currentStyle&&(c=a.currentStyle),void 0===b?c:c[b];b in d||(b="-webkit-"+b),d[b]=c+("string"==typeof c?"":"px")}}function i(a,b,c){if(a){var d=a.getElementsByTagName(b),e=0,f=d.length;if(c)for(;e5||b.clientX-(d.right+d.width)>5)&&c}function o(a){for(var b=a.tagName+a.className+a.src+a.href+a.textContent,c=b.length,d=0;c--;)d+=b.charCodeAt(c);return d.toString(36)}function p(a,b){var c=0;if(!a||!a.parentNode)return-1;for(;a&&(a=a.previousElementSibling);)"TEMPLATE"!==a.nodeName.toUpperCase()&&q(a,b)&&c++;return c}function q(a,b){if(a){b=b.split(".");var c=b.shift().toUpperCase(),d=new RegExp("\\s("+b.join("|")+")(?=\\s)","g");return!(""!==c&&a.nodeName.toUpperCase()!=c||b.length&&((" "+a.className+" ").match(d)||[]).length!=b.length)}return!1}function r(a,b){var c,d;return function(){void 0===c&&(c=arguments,d=this,setTimeout(function(){1===c.length?a.call(d,c[0]):a.apply(d,c),c=void 0},b))}}function s(a,b){if(a&&b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}if("undefined"==typeof window||"undefined"==typeof window.document)return function(){throw new Error("Sortable.js requires a window with a document")};var t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K={},L=/\s+/g,M="Sortable"+(new Date).getTime(),N=window,O=N.document,P=N.parseInt,Q=!!("draggable"in O.createElement("div")),R=function(a){return a=O.createElement("x"),a.style.cssText="pointer-events:auto","auto"===a.style.pointerEvents}(),S=!1,T=Math.abs,U=([].slice,[]),V=r(function(a,b,c){if(c&&b.scroll){var d,e,f,g,h=b.scrollSensitivity,i=b.scrollSpeed,j=a.clientX,k=a.clientY,l=window.innerWidth,m=window.innerHeight;if(A!==c&&(z=b.scroll,A=c,z===!0)){z=c;do if(z.offsetWidth-1){for(;d--;)U[d]({clientX:I.clientX,clientY:I.clientY,target:a,rootEl:b});break}a=b}while(b=b.parentNode);R||h(v,"display","")}},_onTouchMove:function(b){if(H){a.active||this._dragStarted(),this._appendGhost();var c=b.touches?b.touches[0]:b,d=c.clientX-H.clientX,e=c.clientY-H.clientY,f=b.touches?"translate3d("+d+"px,"+e+"px,0)":"translate("+d+"px,"+e+"px)";J=!0,I=c,h(v,"webkitTransform",f),h(v,"mozTransform",f),h(v,"msTransform",f),h(v,"transform",f),b.preventDefault()}},_appendGhost:function(){if(!v){var a,b=t.getBoundingClientRect(),c=h(t),d=this.options;v=t.cloneNode(!0),g(v,d.ghostClass,!1),g(v,d.fallbackClass,!0),h(v,"top",b.top-P(c.marginTop,10)),h(v,"left",b.left-P(c.marginLeft,10)),h(v,"width",b.width),h(v,"height",b.height),h(v,"opacity","0.8"),h(v,"position","fixed"),h(v,"zIndex","100000"),h(v,"pointerEvents","none"),d.fallbackOnBody&&O.body.appendChild(v)||x.appendChild(v),a=v.getBoundingClientRect(),h(v,"width",2*b.width-a.width),h(v,"height",2*b.height-a.height)}},_onDragStart:function(a,b){var c=a.dataTransfer,d=this.options;this._offUpEvents(),"clone"==G.pull&&(w=t.cloneNode(!0),h(w,"display","none"),x.insertBefore(w,t)),b?("touch"===b?(e(O,"touchmove",this._onTouchMove),e(O,"touchend",this._onDrop),e(O,"touchcancel",this._onDrop)):(e(O,"mousemove",this._onTouchMove),e(O,"mouseup",this._onDrop)),this._loopId=setInterval(this._emulateDragOver,50)):(c&&(c.effectAllowed="move",d.setData&&d.setData.call(this,c,t)),e(O,"drop",this),setTimeout(this._dragStarted,0))},_onDragOver:function(a){var d,e,f,g=this.el,i=this.options,j=i.group,l=j.put,o=G===j,p=i.sort;if(void 0!==a.preventDefault&&(a.preventDefault(),!i.dragoverBubble&&a.stopPropagation()),J=!0,G&&!i.disabled&&(o?p||(f=!x.contains(t)):G.pull&&l&&(G.name===j.name||l.indexOf&&~l.indexOf(G.name)))&&(void 0===a.rootEl||a.rootEl===this.el)){if(V(a,i,this.el),S)return;if(d=c(a.target,i.draggable,g),e=t.getBoundingClientRect(),f)return b(!0),void(w||y?x.insertBefore(t,w||y):p||x.appendChild(t));if(0===g.children.length||g.children[0]===v||g===a.target&&(d=n(g,a))){if(d){if(d.animated)return;r=d.getBoundingClientRect()}b(o),k(x,g,t,e,d,r)!==!1&&(t.contains(g)||(g.appendChild(t),u=g),this._animate(e,t),d&&this._animate(r,d))}else if(d&&!d.animated&&d!==t&&void 0!==d.parentNode[M]){B!==d&&(B=d,C=h(d),D=h(d.parentNode));var q,r=d.getBoundingClientRect(),s=r.right-r.left,z=r.bottom-r.top,A=/left|right|inline/.test(C.cssFloat+C.display)||"flex"==D.display&&0===D["flex-direction"].indexOf("row"),E=d.offsetWidth>t.offsetWidth,F=d.offsetHeight>t.offsetHeight,H=(A?(a.clientX-r.left)/s:(a.clientY-r.top)/z)>.5,I=d.nextElementSibling,K=k(x,g,t,e,d,r);if(K!==!1){if(S=!0,setTimeout(m,30),b(o),1===K||K===-1)q=1===K;else if(A){var L=t.offsetTop,N=d.offsetTop;q=L===N?d.previousElementSibling===t&&!E||H&&E:N>L}else q=I!==t&&!F||H&&F;t.contains(g)||(q&&!I?g.appendChild(t):d.parentNode.insertBefore(t,q?I:d)),u=t.parentNode,this._animate(e,t),this._animate(r,d)}}}},_animate:function(a,b){var c=this.options.animation;if(c){var d=b.getBoundingClientRect();h(b,"transition","none"),h(b,"transform","translate3d("+(a.left-d.left)+"px,"+(a.top-d.top)+"px,0)"),b.offsetWidth,h(b,"transition","all "+c+"ms"),h(b,"transform","translate3d(0,0,0)"),clearTimeout(b.animated),b.animated=setTimeout(function(){h(b,"transition",""),h(b,"transform",""),b.animated=!1},c)}},_offUpEvents:function(){var a=this.el.ownerDocument;f(O,"touchmove",this._onTouchMove),f(a,"mouseup",this._onDrop),f(a,"touchend",this._onDrop),f(a,"touchcancel",this._onDrop)},_onDrop:function(b){var c=this.el,d=this.options;clearInterval(this._loopId),clearInterval(K.pid),clearTimeout(this._dragStartTimer),f(O,"mousemove",this._onTouchMove),this.nativeDraggable&&(f(O,"drop",this),f(c,"dragstart",this._onDragStart)),this._offUpEvents(),b&&(J&&(b.preventDefault(),!d.dropBubble&&b.stopPropagation()),v&&v.parentNode.removeChild(v),t&&(this.nativeDraggable&&f(t,"dragend",this),l(t),g(t,this.options.ghostClass,!1),g(t,this.options.chosenClass,!1),x!==u?(F=p(t,d.draggable),F>=0&&(j(null,u,"sort",t,x,E,F),j(this,x,"sort",t,x,E,F),j(null,u,"add",t,x,E,F),j(this,x,"remove",t,x,E,F))):(w&&w.parentNode.removeChild(w),t.nextSibling!==y&&(F=p(t,d.draggable),F>=0&&(j(this,x,"update",t,x,E,F),j(this,x,"sort",t,x,E,F)))),a.active&&(null!==F&&F!==-1||(F=E),j(this,x,"end",t,x,E,F),this.save()))),this._nulling()},_nulling:function(){x=t=u=v=y=w=z=A=H=I=J=F=B=C=G=a.active=null},handleEvent:function(a){var b=a.type;"dragover"===b||"dragenter"===b?t&&(this._onDragOver(a),d(a)):"drop"!==b&&"dragend"!==b||this._onDrop(a)},toArray:function(){for(var a,b=[],d=this.el.children,e=0,f=d.length,g=this.options;e0&&f<=1?f:2-f,f/=2,g>1&&(g=1),{h:isNaN(e)?0:e,s:isNaN(g)?0:g,l:isNaN(f)?0:f,a:isNaN(d)?0:d}},toAlias:function(a,b,c,d){var e=this.toHex(a,b,c,d);for(var f in this.colors)if(this.colors[f]===e)return f;return!1},RGBtoHSB:function(a,b,c,d){a/=255,b/=255,c/=255;var e,f,g,h;return g=Math.max(a,b,c),h=g-Math.min(a,b,c),e=0===h?null:g===a?(b-c)/h:g===b?(c-a)/h+2:(a-b)/h+4,e=(e+360)%6*60/360,f=0===h?0:h/g,{h:this._sanitizeNumber(e),s:f,b:g,a:this._sanitizeNumber(d)}},HueToRGB:function(a,b,c){return c<0?c+=1:c>1&&(c-=1),6*c<1?a+(b-a)*c*6:2*c<1?b:3*c<2?a+(b-a)*(2/3-c)*6:a},HSLtoRGB:function(a,b,c,d){b<0&&(b=0);var e;e=c<=.5?c*(1+b):c+b-c*b;var f=2*c-e,g=a+1/3,h=a,i=a-1/3,j=Math.round(255*this.HueToRGB(f,e,g)),k=Math.round(255*this.HueToRGB(f,e,h)),l=Math.round(255*this.HueToRGB(f,e,i));return[j,k,l,this._sanitizeNumber(d)]},toString:function(a){a=a||"rgba";var b=!1;switch(a){case"rgb":return b=this.toRGB(),this.rgbaIsTransparent(b)?"transparent":"rgb("+b.r+","+b.g+","+b.b+")";case"rgba":return b=this.toRGB(),"rgba("+b.r+","+b.g+","+b.b+","+b.a+")";case"hsl":return b=this.toHSL(),"hsl("+Math.round(360*b.h)+","+Math.round(100*b.s)+"%,"+Math.round(100*b.l)+"%)";case"hsla":return b=this.toHSL(),"hsla("+Math.round(360*b.h)+","+Math.round(100*b.s)+"%,"+Math.round(100*b.l)+"%,"+b.a+")";case"hex":return this.toHex();case"alias":return this.toAlias()||this.toHex();default:return b}},stringParsers:[{re:/rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*?\)/,format:"rgb",parse:function(a){return[a[1],a[2],a[3],1]}},{re:/rgb\(\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*?\)/,format:"rgb",parse:function(a){return[2.55*a[1],2.55*a[2],2.55*a[3],1]}},{re:/rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d*(?:\.\d+)?)\s*)?\)/,format:"rgba",parse:function(a){return[a[1],a[2],a[3],a[4]]}},{re:/rgba\(\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*(?:,\s*(\d*(?:\.\d+)?)\s*)?\)/,format:"rgba",parse:function(a){return[2.55*a[1],2.55*a[2],2.55*a[3],a[4]]}},{re:/hsl\(\s*(\d*(?:\.\d+)?)\s*,\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*?\)/,format:"hsl",parse:function(a){return[a[1]/360,a[2]/100,a[3]/100,a[4]]}},{re:/hsla\(\s*(\d*(?:\.\d+)?)\s*,\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*(?:,\s*(\d*(?:\.\d+)?)\s*)?\)/,format:"hsla",parse:function(a){return[a[1]/360,a[2]/100,a[3]/100,a[4]]}},{re:/#?([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/,format:"hex",parse:function(a){return[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16),1]}},{re:/#?([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/,format:"hex",parse:function(a){return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16),1]}}],colorNameToHex:function(a){return"undefined"!=typeof this.colors[a.toLowerCase()]&&this.colors[a.toLowerCase()]}};var c={horizontal:!1,inline:!1,color:!1,format:!1,input:"input",container:!1,component:".add-on, .input-group-addon",sliders:{saturation:{maxLeft:100,maxTop:100,callLeft:"setSaturation",callTop:"setBrightness"},hue:{maxLeft:0,maxTop:100,callLeft:!1,callTop:"setHue"},alpha:{maxLeft:0,maxTop:100,callLeft:!1,callTop:"setAlpha"}},slidersHorz:{saturation:{maxLeft:100,maxTop:100,callLeft:"setSaturation",callTop:"setBrightness"},hue:{maxLeft:100,maxTop:0,callLeft:"setHue",callTop:!1},alpha:{maxLeft:100,maxTop:0,callLeft:"setAlpha",callTop:!1}},template:'
          Operations
            Recipe
              Input
              Output
              \ No newline at end of file +};ControlsWaiter.prototype.adjust_width=function(){var a=document.getElementById("controls"),b=document.getElementById("step"),c=document.getElementById("clr-breaks"),d=document.querySelector("#save img"),e=document.querySelector("#load img"),f=document.querySelector("#step img"),g=document.querySelector("#clr-recipe img"),h=document.querySelector("#clr-breaks img");a.clientWidth<470?b.childNodes[1].nodeValue=" Step":b.childNodes[1].nodeValue=" Step through",a.clientWidth<400?(d.style.display="none",e.style.display="none",f.style.display="none",g.style.display="none",h.style.display="none"):(d.style.display="inline",e.style.display="inline",f.style.display="inline",g.style.display="inline",h.style.display="inline"),a.clientWidth<330?c.childNodes[1].nodeValue=" Clear breaks":c.childNodes[1].nodeValue=" Clear breakpoints"},ControlsWaiter.prototype.set_auto_bake=function(a){var b=document.getElementById("auto-bake");b.checked!==a&&b.click()},ControlsWaiter.prototype.bake_click=function(){this.app.bake(),$("#output-text").selectRange(0)},ControlsWaiter.prototype.step_click=function(){this.app.bake(!0),$("#output-text").selectRange(0)},ControlsWaiter.prototype.auto_bake_change=function(){var a=document.getElementById("auto-bake-label"),b=document.getElementById("auto-bake");this.app.auto_bake_=b.checked,b.checked?(a.classList.remove("btn-default"),a.classList.add("btn-success")):(a.classList.remove("btn-success"),a.classList.add("btn-default"))},ControlsWaiter.prototype.clear_recipe_click=function(){this.manager.recipe.clear_recipe()},ControlsWaiter.prototype.clear_breaks_click=function(){for(var a=document.querySelectorAll("#rec_list li.operation .breakpoint"),b=0;b0,b=b&&f.length>0&&f.length<8e3,a&&(d+="?recipe="+encodeURIComponent(e)),a&&b?d+="&input="+encodeURIComponent(f):b&&(d+="?input="+encodeURIComponent(f)),d},ControlsWaiter.prototype.save_text_change=function(){try{var a=JSON.parse(document.getElementById("save-text").value);this.initialise_save_link(a)}catch(a){}},ControlsWaiter.prototype.save_click=function(){var a=this.app.get_recipe_config(),b=JSON.stringify(a).replace(/},{/g,"},\n{");document.getElementById("save-text").value=b,this.initialise_save_link(a),$("#save-modal").modal()},ControlsWaiter.prototype.slr_check_change=function(){this.initialise_save_link()},ControlsWaiter.prototype.sli_check_change=function(){this.initialise_save_link()},ControlsWaiter.prototype.load_click=function(){this.populate_load_recipes_list(),$("#load-modal").modal()},ControlsWaiter.prototype.save_button_click=function(){var a=document.getElementById("save-name").value,b=document.getElementById("save-text").value;if(!a)return void this.app.alert("Please enter a recipe name","danger",2e3);var c=localStorage.saved_recipes?JSON.parse(localStorage.saved_recipes):[],d=localStorage.recipe_id||0;c.push({id:++d,name:a,recipe:b}),localStorage.saved_recipes=JSON.stringify(c),localStorage.recipe_id=d,this.app.alert('Recipe saved as "'+a+'".',"success",2e3)},ControlsWaiter.prototype.populate_load_recipes_list=function(){for(var a=document.getElementById("load-name"),b=a.options.length;b--;)a.remove(b);var c=localStorage.saved_recipes?JSON.parse(localStorage.saved_recipes):[];for(b=0;bend: "+e+"
              length: "+f},HighlighterWaiter.prototype.remove_highlights=function(){document.getElementById("input-highlighter").innerHTML="",document.getElementById("output-highlighter").innerHTML="",document.getElementById("input-selection-info").innerHTML="",document.getElementById("output-selection-info").innerHTML=""},HighlighterWaiter.prototype.generate_highlight_list=function(){for(var a=this.app.get_recipe_config(),b=[],c=0;c=0)return!1;var d="[start_highlight]",e=/\[start_highlight\]/g,f="[end_highlight]",g=/\[end_highlight\]/g,h=a.value;if(1===c.length){if(c[0].end/g,">").replace(/\n/g," ").replace(e,'').replace(g,"")+" ",b.style.width=a.clientWidth+"px",b.innerHTML=h,b.scrollTop=a.scrollTop,b.scrollLeft=a.scrollLeft};var HTMLApp=function(a,b,c,d){this.categories=a,this.operations=b,this.dfavourites=c,this.doptions=d,this.options=Utils.extend({},d),this.chef=new Chef,this.manager=new Manager(this),this.auto_bake_=!1,this.progress=0,this.ing_id=0,window.chef=this.chef};HTMLApp.prototype.setup=function(){document.dispatchEvent(this.manager.appstart),this.initialise_splitter(),this.load_local_storage(),this.populate_operations_list(),this.manager.setup(),this.reset_layout(),this.set_compile_message(),this.load_URI_params()},HTMLApp.prototype.handle_error=function(a){console.error(a);var b=a.display_str||a.toString();this.alert(b,"danger",this.options.error_timeout,!this.options.show_errors)},HTMLApp.prototype.bake=function(a){var b;try{b=this.chef.bake(this.get_input(),this.get_recipe_config(),this.options,this.progress,a)}catch(a){this.handle_error(a)}b&&(b.error&&this.handle_error(b.error),this.options=b.options,this.dish_str="html"===b.type?Utils.strip_html_tags(b.result,!0):b.result,this.progress=b.progress,this.manager.recipe.update_breakpoint_indicator(b.progress),this.manager.output.set(b.result,b.type,b.duration),b.duration>this.options.auto_bake_threshold&&this.auto_bake_&&(this.manager.controls.set_auto_bake(!1),this.alert("Baking took longer than "+this.options.auto_bake_threshold+"ms, Auto Bake has been disabled.","warning",5e3)))},HTMLApp.prototype.auto_bake=function(){this.auto_bake_&&this.bake()},HTMLApp.prototype.silent_bake=function(){var a=(new Date).getTime(),b=this.get_recipe_config();return this.auto_bake_&&this.chef.silent_bake(b),(new Date).getTime()-a},HTMLApp.prototype.get_input=function(){var a=this.manager.input.get();return sessionStorage.setItem("input_length",a.length),sessionStorage.setItem("input",a),a},HTMLApp.prototype.set_input=function(a){sessionStorage.setItem("input_length",a.length),sessionStorage.setItem("input",a),this.manager.input.set(a)},HTMLApp.prototype.populate_operations_list=function(){document.body.appendChild(document.getElementById("edit-favourites"));for(var a="",b=0;b2?JSON.parse(localStorage.favourites):this.dfavourites;a=this.valid_favourites(a),this.save_favourites(a);var b=this.categories.filter(function(a){return"Favourites"===a.name})[0];b?b.ops=a:this.categories.unshift({name:"Favourites",ops:a})},HTMLApp.prototype.valid_favourites=function(a){for(var b=[],c=0;c=0?void this.alert("'"+a+"' is already in your favourites","info",2e3):(b.push(a),this.save_favourites(b),this.load_favourites(),this.populate_operations_list(),void this.manager.recipe.initialise_operation_drag_n_drop())},HTMLApp.prototype.load_URI_params=function(){this.query_string=function(a){if(""===a)return{};for(var b={},c=0;c"):d[e].value=a[b].args[e];a[b].disabled&&c.querySelector(".disable-icon").click(),a[b].breakpoint&&c.querySelector(".breakpoint").click(),this.progress=0}},HTMLApp.prototype.reset_layout=function(){this.column_splitter.setSizes([20,30,50]),this.io_splitter.setSizes([50,50]),this.manager.controls.adjust_width()},HTMLApp.prototype.set_compile_message=function(){var a=new Date,b=Utils.fuzzy_time(a.getTime()-window.compile_time),c='Last build: '+b.substr(0,1).toUpperCase()+b.substr(1)+" ago";""!==window.compile_message&&(c+=" - "+window.compile_message),c+="",document.getElementById("notice").innerHTML=c},HTMLApp.prototype.alert=function(a,b,c,d){var e=new Date;if(console.log("["+e.toLocaleString()+"] "+a),!d){b=b||"danger",c=c||0;var f=document.getElementById("alert"),g=document.getElementById("alert-content");f.classList.remove("alert-danger"),f.classList.remove("alert-warning"),f.classList.remove("alert-info"),f.classList.remove("alert-success"),f.classList.add("alert-"+b),"block"===f.style.display?g.innerHTML+="

              ["+e.toLocaleTimeString()+"] "+a:g.innerHTML="["+e.toLocaleTimeString()+"] "+a,$("#alert").stop(),f.style.display="block",f.style.opacity=1,c>0&&(clearTimeout(this.alert_timeout),this.alert_timeout=setTimeout(function(){$("#alert").slideUp(100)},c))}},HTMLApp.prototype.confirm=function(a,b,c,d){d=d||this,document.getElementById("confirm-title").innerHTML=a,document.getElementById("confirm-body").innerHTML=b,document.getElementById("confirm-modal").style.display="block",this.confirm_closed=!1,$("#confirm-modal").modal().one("show.bs.modal",function(a){this.confirm_closed=!1}.bind(this)).one("click","#confirm-yes",function(){this.confirm_closed=!0,c.bind(d)(!0),$("#confirm-modal").modal("hide")}.bind(this)).one("hide.bs.modal",function(a){this.confirm_closed||c.bind(d)(!1),this.confirm_closed=!0}.bind(this))},HTMLApp.prototype.alert_close_click=function(){document.getElementById("alert").style.display="none"},HTMLApp.prototype.state_change=function(a){this.auto_bake(),this.options.update_url&&(this.last_state_url=this.manager.controls.generate_state_url(!0,!0),window.history.replaceState({},"CyberChef",this.last_state_url))},HTMLApp.prototype.pop_state=function(a){window.location.href.split("#")[0]!==this.last_state_url&&this.load_URI_params()},HTMLApp.prototype.call_api=function(a,b,c,d,e){b=b||"POST",c=c||{},d=d||void 0,e=e||"application/json";var f=null,g=!1;return $.ajax({url:a,async:!1,type:b,data:c,dataType:d,contentType:e,success:function(a){g=!0,f=a},error:function(a){g=!1,f=a}}),{success:g,response:f}};var HTMLCategory=function(a,b){this.name=a,this.selected=b,this.op_list=[]};HTMLCategory.prototype.add_operation=function(a){this.op_list.push(a)},HTMLCategory.prototype.to_html=function(){for(var a="cat"+this.name.replace(/[\s\/-:_]/g,""),b="
              "+this.name+"
                ",c=0;c 
              ";switch(d+="
              ",this.type){case"string":case"binary_string":case"byte_array":d+="";break;case"short_string":case"binary_short_string":d+="";break;case"toggle_string":for(d+="
              ";break;case"number":d+="";break;case"boolean":d+="",this.disable_args&&this.manager.add_dynamic_listener("#"+this.id,"click",this.toggle_disable_args,this);break;case"option":for(d+="";break;case"populate_option":for(d+="",this.manager.add_dynamic_listener("#"+this.id,"change",this.populate_option_change,this);break;case"editable_option":for(d+="
              ",d+="",d+="",d+="
              ",this.manager.add_dynamic_listener("#sel-"+this.id,"change",this.editable_option_change,this);break;case"text":d+=""}return d+="
              "},HTMLIngredient.prototype.toggle_disable_args=function(a){for(var b,c=a.target,d=c.parentNode.parentNode,e=d.querySelectorAll(".arg-group"),f=0;f"),this.description&&(b+=""),b+=""},HTMLOperation.prototype.to_full_html=function(){for(var a="
              "+this.name+"
              ",b=0;b=0&&(this.name=this.name.slice(0,b)+""+this.name.slice(b,b+a.length)+""+this.name.slice(b+a.length)),this.description&&c>=0&&(this.description=this.description.slice(0,c)+""+this.description.slice(c,c+a.length)+""+this.description.slice(c+a.length))};var InputWaiter=function(a,b){this.app=a,this.manager=b,this.bad_keys=[16,17,18,19,20,27,33,34,35,36,37,38,39,40,44,91,92,93,112,113,114,115,116,117,118,119,120,121,122,123,144,145]};InputWaiter.prototype.get=function(){return document.getElementById("input-text").value},InputWaiter.prototype.set=function(a){document.getElementById("input-text").value=a,window.dispatchEvent(this.manager.statechange)},InputWaiter.prototype.set_input_info=function(a,b){var c=a.toString().length;c=c<2?2:c;var d=Utils.pad(a.toString(),c," ").replace(/ /g," "),e=Utils.pad(b.toString(),c," ").replace(/ /g," ");document.getElementById("input-info").innerHTML="length: "+d+"
              lines: "+e},InputWaiter.prototype.input_change=function(a){this.manager.highlighter.remove_highlights(),this.app.progress=0;var b=this.get(),c=b.count("\n")+1;this.set_input_info(b.length,c),this.bad_keys.indexOf(a.keyCode)<0&&window.dispatchEvent(this.manager.statechange)},InputWaiter.prototype.input_dragover=function(a){return"move"!==a.dataTransfer.effectAllowed&&(a.stopPropagation(),a.preventDefault(),void a.target.classList.add("dropping-file"))},InputWaiter.prototype.input_dragleave=function(a){a.stopPropagation(),a.preventDefault(),a.target.classList.remove("dropping-file")},InputWaiter.prototype.input_drop=function(a){if("move"===a.dataTransfer.effectAllowed)return!1;a.stopPropagation(),a.preventDefault();var b=a.target,c=a.dataTransfer.files[0],d=a.dataTransfer.getData("Text"),e=new FileReader,f="",g=0,h=20480,i=function(){f.length>1e5&&this.app.auto_bake_&&(this.manager.controls.set_auto_bake(!1),this.app.alert("Turned off Auto Bake as the input is large","warning",5e3)),this.set(f);var a=this.app.get_recipe_config();a[0]&&"From Hex"===a[0].op||(a.unshift({op:"From Hex",args:["Space"]}),this.app.set_recipe_config(a)),b.classList.remove("loading_file")}.bind(this),j=function(){if(g>=c.size)return void i();b.value="Processing... "+Math.round(g/c.size*100)+"%";var a=c.slice(g,g+h);e.readAsArrayBuffer(a)};e.onload=function(a){var b=new Uint8Array(e.result);f+=Utils.to_hex_fast(b),g+=h,j()},b.classList.remove("dropping-file"),c?(b.classList.add("loading_file"),j()):d&&this.set(d)},InputWaiter.prototype.clear_io_click=function(){this.manager.highlighter.remove_highlights(),document.getElementById("input-text").value="",document.getElementById("output-text").value="",document.getElementById("input-info").innerHTML="",document.getElementById("output-info").innerHTML="",document.getElementById("input-selection-info").innerHTML="",document.getElementById("output-selection-info").innerHTML="",window.dispatchEvent(this.manager.statechange)};var Manager=function(a){this.app=a,this.appstart=new CustomEvent("appstart",{bubbles:!0}),this.operationadd=new CustomEvent("operationadd",{bubbles:!0}),this.operationremove=new CustomEvent("operationremove",{bubbles:!0}),this.oplistcreate=new CustomEvent("oplistcreate",{bubbles:!0}),this.statechange=new CustomEvent("statechange",{bubbles:!0}),this.window=new WindowWaiter(this.app),this.controls=new ControlsWaiter(this.app,this),this.recipe=new RecipeWaiter(this.app,this),this.ops=new OperationsWaiter(this.app,this),this.input=new InputWaiter(this.app,this),this.output=new OutputWaiter(this.app,this),this.options=new OptionsWaiter(this.app),this.highlighter=new HighlighterWaiter(this.app),this.seasonal=new SeasonalWaiter(this.app,this), +this.dynamic_handlers={},this.initialise_event_listeners()};Manager.prototype.setup=function(){this.recipe.initialise_operation_drag_n_drop(),this.controls.auto_bake_change(),this.seasonal.load()},Manager.prototype.initialise_event_listeners=function(){window.addEventListener("resize",this.window.window_resize.bind(this.window)),window.addEventListener("blur",this.window.window_blur.bind(this.window)),window.addEventListener("focus",this.window.window_focus.bind(this.window)),window.addEventListener("statechange",this.app.state_change.bind(this.app)),window.addEventListener("popstate",this.app.pop_state.bind(this.app)),document.getElementById("bake").addEventListener("click",this.controls.bake_click.bind(this.controls)),document.getElementById("auto-bake").addEventListener("change",this.controls.auto_bake_change.bind(this.controls)),document.getElementById("step").addEventListener("click",this.controls.step_click.bind(this.controls)),document.getElementById("clr-recipe").addEventListener("click",this.controls.clear_recipe_click.bind(this.controls)),document.getElementById("clr-breaks").addEventListener("click",this.controls.clear_breaks_click.bind(this.controls)),document.getElementById("save").addEventListener("click",this.controls.save_click.bind(this.controls)),document.getElementById("save-button").addEventListener("click",this.controls.save_button_click.bind(this.controls)),document.getElementById("save-link-recipe-checkbox").addEventListener("change",this.controls.slr_check_change.bind(this.controls)),document.getElementById("save-link-input-checkbox").addEventListener("change",this.controls.sli_check_change.bind(this.controls)),document.getElementById("load").addEventListener("click",this.controls.load_click.bind(this.controls)),document.getElementById("load-delete-button").addEventListener("click",this.controls.load_delete_click.bind(this.controls)),document.getElementById("load-name").addEventListener("change",this.controls.load_name_change.bind(this.controls)),document.getElementById("load-button").addEventListener("click",this.controls.load_button_click.bind(this.controls)),this.add_multi_event_listener("#save-text","keyup paste",this.controls.save_text_change,this.controls),this.add_multi_event_listener("#search","keyup paste search",this.ops.search_operations,this.ops),this.add_dynamic_listener(".op_list li.operation","dblclick",this.ops.operation_dblclick,this.ops),document.getElementById("edit-favourites").addEventListener("click",this.ops.edit_favourites_click.bind(this.ops)),document.getElementById("save-favourites").addEventListener("click",this.ops.save_favourites_click.bind(this.ops)),document.getElementById("reset-favourites").addEventListener("click",this.ops.reset_favourites_click.bind(this.ops)),this.add_dynamic_listener(".op_list .op-icon","mouseover",this.ops.op_icon_mouseover,this.ops),this.add_dynamic_listener(".op_list .op-icon","mouseleave",this.ops.op_icon_mouseleave,this.ops),this.add_dynamic_listener(".op_list","oplistcreate",this.ops.op_list_create,this.ops),this.add_dynamic_listener("li.operation","operationadd",this.recipe.op_add.bind(this.recipe)),this.add_dynamic_listener(".arg","keyup",this.recipe.ing_change,this.recipe),this.add_dynamic_listener(".arg","change",this.recipe.ing_change,this.recipe),this.add_dynamic_listener(".disable-icon","click",this.recipe.disable_click,this.recipe),this.add_dynamic_listener(".breakpoint","click",this.recipe.breakpoint_click,this.recipe),this.add_dynamic_listener("#rec_list li.operation","dblclick",this.recipe.operation_dblclick,this.recipe),this.add_dynamic_listener("#rec_list li.operation > div","dblclick",this.recipe.operation_child_dblclick,this.recipe),this.add_dynamic_listener("#rec_list .input-group .dropdown-menu a","click",this.recipe.dropdown_toggle_click,this.recipe),this.add_dynamic_listener("#rec_list","operationremove",this.recipe.op_remove.bind(this.recipe)),this.add_multi_event_listener("#input-text","keyup paste",this.input.input_change,this.input),document.getElementById("reset-layout").addEventListener("click",this.app.reset_layout.bind(this.app)),document.getElementById("clr-io").addEventListener("click",this.input.clear_io_click.bind(this.input)),document.getElementById("input-text").addEventListener("dragover",this.input.input_dragover.bind(this.input)),document.getElementById("input-text").addEventListener("dragleave",this.input.input_dragleave.bind(this.input)),document.getElementById("input-text").addEventListener("drop",this.input.input_drop.bind(this.input)),document.getElementById("input-text").addEventListener("scroll",this.highlighter.input_scroll.bind(this.highlighter)),document.getElementById("input-text").addEventListener("mouseup",this.highlighter.input_mouseup.bind(this.highlighter)),document.getElementById("input-text").addEventListener("mousemove",this.highlighter.input_mousemove.bind(this.highlighter)),this.add_multi_event_listener("#input-text","mousedown dblclick select",this.highlighter.input_mousedown,this.highlighter),document.getElementById("save-to-file").addEventListener("click",this.output.save_click.bind(this.output)),document.getElementById("switch").addEventListener("click",this.output.switch_click.bind(this.output)),document.getElementById("undo-switch").addEventListener("click",this.output.undo_switch_click.bind(this.output)),document.getElementById("maximise-output").addEventListener("click",this.output.maximise_output_click.bind(this.output)),document.getElementById("output-text").addEventListener("scroll",this.highlighter.output_scroll.bind(this.highlighter)),document.getElementById("output-text").addEventListener("mouseup",this.highlighter.output_mouseup.bind(this.highlighter)),document.getElementById("output-text").addEventListener("mousemove",this.highlighter.output_mousemove.bind(this.highlighter)),document.getElementById("output-html").addEventListener("mouseup",this.highlighter.output_html_mouseup.bind(this.highlighter)),document.getElementById("output-html").addEventListener("mousemove",this.highlighter.output_html_mousemove.bind(this.highlighter)),this.add_multi_event_listener("#output-text","mousedown dblclick select",this.highlighter.output_mousedown,this.highlighter),this.add_multi_event_listener("#output-html","mousedown dblclick select",this.highlighter.output_html_mousedown,this.highlighter),document.getElementById("options").addEventListener("click",this.options.options_click.bind(this.options)),document.getElementById("reset-options").addEventListener("click",this.options.reset_options_click.bind(this.options)),$(document).on("switchChange.bootstrapSwitch",".option-item input:checkbox",this.options.switch_change.bind(this.options)),$(document).on("switchChange.bootstrapSwitch",".option-item input:checkbox",this.options.set_word_wrap.bind(this.options)),this.add_dynamic_listener(".option-item input[type=number]","keyup",this.options.number_change,this.options),this.add_dynamic_listener(".option-item input[type=number]","change",this.options.number_change,this.options),this.add_dynamic_listener(".option-item select","change",this.options.select_change,this.options),document.getElementById("alert-close").addEventListener("click",this.app.alert_close_click.bind(this.app))},Manager.prototype.add_listeners=function(a,b,c,d){d=d||this,[].forEach.call(document.querySelectorAll(a),function(a){a.addEventListener(b,c.bind(d))})},Manager.prototype.add_multi_event_listener=function(a,b,c,d){for(var e=b.split(" "),f=0;f-1&&(this.manager.recipe.add_operation(b[c].innerHTML),this.app.auto_bake()))),13===a.keyCode)a.preventDefault();else if(40===a.keyCode)a.preventDefault(),b=document.querySelectorAll("#search-results li"),b.length&&(c=this.get_selected_op(b),c>-1&&b[c].classList.remove("selected-op"),c===b.length-1&&(c=-1),b[c+1].classList.add("selected-op"));else if(38===a.keyCode)a.preventDefault(),b=document.querySelectorAll("#search-results li"),b.length&&(c=this.get_selected_op(b),c>-1&&b[c].classList.remove("selected-op"),0===c&&(c=b.length),b[c-1].classList.add("selected-op"));else{for(var d=document.getElementById("search-results"),e=a.target,f=e.value;d.firstChild;)$(d.firstChild).popover("destroy"),d.removeChild(d.firstChild);if($("#categories .in").collapse("hide"),f){for(var g=this.filter_operations(f,!0),h="",i=0;i=0||h>=0){var i=new HTMLOperation(e,this.app.operations[e],this.app,this.manager);b&&i.highlight_search_string(a,g,h),g<0?c.push(i):d.push(i)}}return d.concat(c)},OperationsWaiter.prototype.get_selected_op=function(a){for(var b=0;blength: "+e+"
              lines: "+f,document.getElementById("input-selection-info").innerHTML="",document.getElementById("output-selection-info").innerHTML=""},OutputWaiter.prototype.save_click=function(){var a=Utils.to_base64(this.app.dish_str),b=window.prompt("Please enter a filename:","download.dat");if(b){var c=document.createElement("a");c.setAttribute("href","data:application/octet-stream;base64;charset=utf-8,"+a),c.setAttribute("download",b),c.style.display="none",document.body.appendChild(c),c.click(),c.remove()}},OutputWaiter.prototype.switch_click=function(){this.switch_orig_data=this.manager.input.get(),document.getElementById("undo-switch").disabled=!1,this.app.set_input(this.app.dish_str)},OutputWaiter.prototype.undo_switch_click=function(){this.app.set_input(this.switch_orig_data),document.getElementById("undo-switch").disabled=!0},OutputWaiter.prototype.maximise_output_click=function(a){var b=a.target;b.textContent.indexOf("Max")>=0?(this.app.column_splitter.collapse(0),this.app.column_splitter.collapse(1),this.app.io_splitter.collapse(0),b.innerHTML=" Restore"):(this.app.reset_layout(),b.innerHTML=" Max")};var RecipeWaiter=function(a,b){this.app=a,this.manager=b,this.remove_intent=!1};RecipeWaiter.prototype.initialise_operation_drag_n_drop=function(){var a=document.getElementById("rec_list");Sortable.create(a,{group:"recipe",sort:!0,animation:0,delay:0,filter:".arg-input,.arg",setData:function(a,b){a.setData("Text",b.querySelector(".arg-title").textContent)},onEnd:function(a){this.remove_intent&&(a.item.remove(),a.target.dispatchEvent(this.manager.operationremove))}.bind(this)}),Sortable.utils.on(a,"dragover",function(){this.remove_intent=!1}.bind(this)),Sortable.utils.on(a,"dragleave",function(){this.remove_intent=!0,this.app.progress=0}.bind(this)),Sortable.utils.on(a,"touchend",function(b){var c=b.changedTouches[0],d=document.elementFromPoint(c.clientX,c.clientY);this.remove_intent=!a.contains(d)}.bind(this)),document.querySelector("#categories a").addEventListener("dragover",this.fav_dragover.bind(this)),document.querySelector("#categories a").addEventListener("dragleave",this.fav_dragleave.bind(this)),document.querySelector("#categories a").addEventListener("drop",this.fav_drop.bind(this))},RecipeWaiter.prototype.create_sortable_seed_list=function(a){Sortable.create(a,{group:{name:"recipe",pull:"clone",put:!1},sort:!1,setData:function(a,b){a.setData("Text",b.textContent)},onStart:function(a){$(a.item).popover("destroy"),a.item.setAttribute("data-toggle","popover-disabled")},onEnd:this.op_sort_end.bind(this)})},RecipeWaiter.prototype.op_sort_end=function(a){return this.remove_intent?void("rec_list"===a.item.parentNode.id&&a.item.remove()):($(a.clone).popover(),$(a.clone).children("[data-toggle=popover]").popover(),void("rec_list"===a.item.parentNode.id&&(this.build_recipe_operation(a.item),a.item.dispatchEvent(this.manager.operationadd))))},RecipeWaiter.prototype.fav_dragover=function(a){return"move"===a.dataTransfer.effectAllowed&&(a.stopPropagation(),a.preventDefault(),void(a.target.className&&a.target.className.indexOf("category-title")>-1?a.target.classList.add("favourites-hover"):a.target.parentNode.className&&a.target.parentNode.className.indexOf("category-title")>-1?a.target.parentNode.classList.add("favourites-hover"):a.target.parentNode.parentNode.className&&a.target.parentNode.parentNode.className.indexOf("category-title")>-1&&a.target.parentNode.parentNode.classList.add("favourites-hover")))},RecipeWaiter.prototype.fav_dragleave=function(a){a.stopPropagation(),a.preventDefault(),document.querySelector("#categories a").classList.remove("favourites-hover")},RecipeWaiter.prototype.fav_drop=function(a){a.stopPropagation(),a.preventDefault(),a.target.classList.remove("favourites-hover");var b=a.dataTransfer.getData("Text");this.app.add_favourite(b)},RecipeWaiter.prototype.ing_change=function(){window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.disable_click=function(a){var b=a.target;"false"===b.getAttribute("disabled")?(b.setAttribute("disabled","true"),b.classList.add("disable-icon-selected"),b.parentNode.parentNode.classList.add("disabled")):(b.setAttribute("disabled","false"),b.classList.remove("disable-icon-selected"),b.parentNode.parentNode.classList.remove("disabled")),this.app.progress=0,window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.breakpoint_click=function(a){var b=a.target;"false"===b.getAttribute("break")?(b.setAttribute("break","true"),b.classList.add("breakpoint-selected")):(b.setAttribute("break","false"),b.classList.remove("breakpoint-selected")),window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.operation_dblclick=function(a){a.target.remove(),window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.operation_child_dblclick=function(a){a.target.parentNode.remove(),window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.get_config=function(){for(var a,b,c,d,e,f=[],g=document.querySelectorAll("#rec_list li.operation"),h=0;h",this.ing_change()},RecipeWaiter.prototype.op_add=function(a){window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.op_remove=function(a){window.dispatchEvent(this.manager.statechange)};var SeasonalWaiter=function(a,b){this.app=a,this.manager=b};SeasonalWaiter.prototype.load=function(){var a=new Date;11===a.getMonth()&&a.getDate()>12&&(this.app.options.snow=!1,this.create_snow_option(),$(document).on("switchChange.bootstrapSwitch",".option-item input:checkbox[option='snow']",this.let_it_snow.bind(this)),window.addEventListener("resize",this.let_it_snow.bind(this)),this.manager.add_listeners(".btn","click",this.shake_off_snow,this),25===a.getDate()&&this.let_it_snow()),this.kkeys=[],window.addEventListener("keydown",this.konami_code_listener.bind(this))},SeasonalWaiter.prototype.insert_spider_icons=function(){var a="iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB3UlEQVQ4y2NgGJaAmYGBgVnf0oKJgYGBobWtXamqqoYTn2I4CI+LTzM2NTulpKbu+vPHz2dV5RWlluZmi3j5+KqFJSSEzpw8uQPdAEYYIzo5Kfjrl28rWFlZzjAzMYuEBQao3Lh+g+HGvbsMzExMDN++fWf4/PXLBzY2tqYNK1f2+4eHM2xcuRLigsT09Igf3384MTExbf767etBI319jU8fPsi+//jx/72HDxh5uLkZ7ty7y/Dz1687Avz8n2UUFR3Z2NjOySoqfmdhYGBg+PbtuwI7O8e5H79+8X379t357PnzYo+ePP7y6cuXc9++f69nYGRsvf/w4XdtLS2R799/bBUWFHr57sP7Jbs3b/ZkzswvUP3165fZ7z9//r988WIVAyPDr8tXr576+u3bpb9//7YwMjKeV1dV41NWVGoVEhDgPH761DJREeHaz1+/lqlpafUx6+jrRfz4+fPy+w8fTu/fsf3uw7t3L39+//4cv7DwGQYGhpdPbt9m4BcRFlNWVJC4fuvWASszs4C379792Ldt2xZBUdEdDP5hYSqQGIjDGa965uYKCalpZQwMDAxhMTG9DAwMDLaurhIkJ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IXTLEucJSHIIIMuO0BOcjn3A3ybU/lu5RCUBc5qA0Ih0Q2EWiCPRk7VfMNhjLW1zETic1tLYZDMKyuSsdfh5l6bwho5+0il4kyA0VohlNcF5FP8DlWo/VB16HYB2hJ0pzgIe2mcXxP2IOumPRY17U0tll8KIkZNb+sppafOxYkQPSaYfchyYoL9GMqWYpTLRIq1QUcT4O3aPQgqVqPwIOIMwDhzX6mQUFIQAgo+9MzcrWrML3mj6+YIKiFCZyhL87RqVQKrEskF+P1BUvfLCAkfRwoPUtq6l5o5+lZb5SolJo6oT8avTCl+c9OTmat6pKW8mLkvBpGzlvsiGuQr4ZEEwA1EQgoR/gNtxIxKBluz+OtMJiF31jHxqXBiAqAUj4WRxpADFM0DCFlv1khvX7Wol4vF4AIldVVxdZqlrIfiCYQPHDy6bAGv7nKYRVY6JewExZVAP+ey5Rv+Ba97aaUHMW5NauLmMZFkegBb/EP14d6NoS9QLWFSzWBmuZza8CQmSpXsAqmGtVy14VALWuuYWWy+W3OteXa4jwceQX6+BKG6J1/8+2VCNkm2222WabbbbZZpttttlmm22rt38DCdA0vq3bcAkAAAAASUVORK5CYII=";document.querySelector("link[rel=icon]").setAttribute("href","data:image/png;base64,"+a),document.querySelector("#bake img").setAttribute("src","data:image/png;base64,"+b),document.querySelector(".about-img-left").setAttribute("src","data:image/png;base64,"+c)},SeasonalWaiter.prototype.insert_spider_text=function(){document.title=document.title.replace(/Cyber/g,"Spider"),SeasonalWaiter.tree_walk(document.body,function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Cyber/g,"Spider"))},!0),SeasonalWaiter.tree_walk(document.getElementById("bake-group"),function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Bake/g,"Spin"))},!0),document.querySelector("#recipe .title").innerHTML="Web"},SeasonalWaiter.prototype.create_snow_option=function(){var a=document.getElementById("options-body"),b=document.createElement("div");b.className="option-item",b.innerHTML=" Let it snow",a.appendChild(b),this.manager.options.load()},SeasonalWaiter.prototype.let_it_snow=function(){if($(document).snowfall("clear"),this.app.options.snow){var a={},b=navigator.userAgent.match(/Firefox\/(\d\d?)/);a=b&&parseInt(b[1],10)<30?{flakeCount:10,flakeColor:"#fff",flakePosition:"absolute",minSize:1,maxSize:2,minSpeed:1,maxSpeed:5,round:!1,shadow:!1,collection:!1,collectionHeight:20,deviceorientation:!0}:{flakeCount:35,flakeColor:"#fff",flakePosition:"absolute",minSize:5,maxSize:8,minSpeed:1,maxSpeed:5,round:!0,shadow:!0,collection:".btn",collectionHeight:20,deviceorientation:!0},$(document).snowfall(a)}},SeasonalWaiter.prototype.shake_off_snow=function(a){for(var b=a.target,c=b.getBoundingClientRect(),d=document.querySelectorAll("canvas.snowfall-canvas"),e=null,f=function(){h.clearRect(0,0,e.width,e.height),$(this).fadeIn()},g=0;g6e4&&this.app.silent_bake()};var main=function(){var a=["To Base64","From Base64","To Hex","From Hex","To Hexdump","From Hexdump","URL Decode","Regular expression","Entropy","Fork"],b={update_url:!0,show_highlighter:!0,treat_as_utf8:!0,word_wrap:!0,show_errors:!0,error_timeout:4e3,auto_bake_threshold:200,attempt_highlight:!0,snow:!1};document.removeEventListener("DOMContentLoaded",main,!1),window.app=new HTMLApp(Categories,OperationConfig,a,b),window.app.setup()};window.console=console||{log:function(){},error:function(){}},window.compile_time=moment.tz("Tue Dec 20 2016 20:17:20","ddd MMM D YYYY HH:mm:ss","UTC").valueOf(),window.compile_message="Merry Christmas! Have a look in the options panel for some festive flavour.",document.addEventListener("DOMContentLoaded",main,!1); \ No newline at end of file diff --git a/build/prod/images/maximise-16x16.png b/build/prod/images/maximise-16x16.png new file mode 100755 index 0000000000000000000000000000000000000000..be47e6ee11a3d4b555254345ac2225b837fd91ae GIT binary patch literal 235 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^u-ntcF~s8Z*~^Apha3c2AL{RH?m8)WsanH-qH|=nA`8>Bs274x z?-raDJ6yIqv&KM&=Zw93OlKRt|YA&n} zXt{IoiqkrYKeK1)9(La48PC0gwS1S<0mk(@>dBdJ79Y*#NZ5GPyQe;y!ydJozf)z{dE$(p>3OC+FuDqKAcLo?pUXO@geCyl5nMn3 literal 0 HcmV?d00001 diff --git a/build/prod/index.html b/build/prod/index.html index abd8bafb..c1d70a4f 100755 --- a/build/prod/index.html +++ b/build/prod/index.html @@ -18,4 +18,4 @@ See the License for the specific language governing permissions and limitations under the License. --> -CyberChef Edit
              Operations
                Recipe
                  Input
                  Output
                  \ No newline at end of file +CyberChef Edit
                  Operations
                    Recipe
                      Input
                      Output
                      \ No newline at end of file diff --git a/build/prod/scripts.js b/build/prod/scripts.js index 5ce0d6ba..6e5e989d 100755 --- a/build/prod/scripts.js +++ b/build/prod/scripts.js @@ -52,7 +52,7 @@ function X509(){this.subjectPublicKeyRSA=null,this.subjectPublicKeyRSA_hN=null,t if(function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){function c(a){var b=a.length,c=_.type(a);return"function"!==c&&!_.isWindow(a)&&(!(1!==a.nodeType||!b)||("array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a))}function d(a,b,c){if(_.isFunction(b))return _.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return _.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(ha.test(b))return _.filter(b,a,c);b=_.filter(b,a)}return _.grep(a,function(a){return U.call(b,a)>=0!==c})}function e(a,b){for(;(a=a[b])&&1!==a.nodeType;);return a}function f(a){var b=oa[a]={};return _.each(a.match(na)||[],function(a,c){b[c]=!0}),b}function g(){Z.removeEventListener("DOMContentLoaded",g,!1),a.removeEventListener("load",g,!1),_.ready()}function h(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=_.expando+Math.random()}function i(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(ua,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c||"false"!==c&&("null"===c?null:+c+""===c?+c:ta.test(c)?_.parseJSON(c):c)}catch(a){}sa.set(a,b,c)}else c=void 0;return c}function j(){return!0}function k(){return!1}function l(){try{return Z.activeElement}catch(a){}}function m(a,b){return _.nodeName(a,"table")&&_.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function n(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function o(a){var b=Ka.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function p(a,b){for(var c=0,d=a.length;c")).appendTo(b.documentElement),b=Na[0].contentDocument,b.write(),b.close(),c=t(a,b),Na.detach()),Oa[a]=c),c}function v(a,b,c){var d,e,f,g,h=a.style;return c=c||Ra(a),c&&(g=c.getPropertyValue(b)||c[b]),c&&(""!==g||_.contains(a.ownerDocument,a)||(g=_.style(a,b)),Qa.test(g)&&Pa.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function w(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}function x(a,b){if(b in a)return b;for(var c=b[0].toUpperCase()+b.slice(1),d=b,e=Xa.length;e--;)if(b=Xa[e]+c,b in a)return b;return d}function y(a,b,c){var d=Ta.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function z(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;f<4;f+=2)"margin"===c&&(g+=_.css(a,c+wa[f],!0,e)),d?("content"===c&&(g-=_.css(a,"padding"+wa[f],!0,e)),"margin"!==c&&(g-=_.css(a,"border"+wa[f]+"Width",!0,e))):(g+=_.css(a,"padding"+wa[f],!0,e),"padding"!==c&&(g+=_.css(a,"border"+wa[f]+"Width",!0,e)));return g}function A(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ra(a),g="border-box"===_.css(a,"boxSizing",!1,f);if(e<=0||null==e){if(e=v(a,b,f),(e<0||null==e)&&(e=a.style[b]),Qa.test(e))return e;d=g&&(Y.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+z(a,b,c||(g?"border":"content"),d,f)+"px"}function B(a,b){for(var c,d,e,f=[],g=0,h=a.length;g=0&&c=0},isPlainObject:function(a){return"object"===_.type(a)&&!a.nodeType&&!_.isWindow(a)&&!(a.constructor&&!X.call(a.constructor.prototype,"isPrototypeOf"))},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?V[W.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=_.trim(a),a&&(1===a.indexOf("use strict")?(b=Z.createElement("script"),b.text=a,Z.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(ba,"ms-").replace(ca,da)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,d){var e,f=0,g=a.length,h=c(a);if(d){if(h)for(;fw.cacheLength&&delete a[b.shift()],a[c+" "]=d}var b=[];return a}function d(a){return a[N]=!0,a}function e(a){var b=G.createElement("div");try{return!!a(b)}catch(a){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function f(a,b){for(var c=a.split("|"),d=a.length;d--;)w.attrHandle[c[d]]=b}function g(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||W)-(~a.sourceIndex||W);if(d)return d;if(c)for(;c=c.nextSibling;)if(c===b)return-1;return a?1:-1}function h(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function i(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function j(a){return d(function(b){return b=+b,d(function(c,d){for(var e,f=a([],c.length,b),g=f.length;g--;)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function k(a){return a&&typeof a.getElementsByTagName!==V&&a}function l(){}function m(a){for(var b=0,c=a.length,d="";b1?function(b,c,d){for(var e=a.length;e--;)if(!a[e](b,c,d))return!1;return!0}:a[0]}function p(a,c,d){for(var e=0,f=c.length;e-1&&(d[j]=!(g[j]=l))}}else t=q(t===g?t.splice(o,t.length):t),f?f(null,g,t,i):_.apply(g,t)})}function s(a){for(var b,c,d,e=a.length,f=w.relative[a[0].type],g=f||w.relative[" "],h=f?1:0,i=n(function(a){return a===b},g,!0),j=n(function(a){return ba.call(b,a)>-1},g,!0),k=[function(a,c,d){return!f&&(d||c!==C)||((b=c).nodeType?i(a,c,d):j(a,c,d))}];h1&&o(k),h>1&&m(a.slice(0,h-1).concat({value:" "===a[h-2].type?"*":""})).replace(ia,"$1"),c,h0,f=a.length>0,g=function(d,g,h,i,j){var k,l,m,n=0,o="0",p=d&&[],r=[],s=C,t=d||f&&w.find.TAG("*",j),u=P+=null==s?1:Math.random()||.1,v=t.length;for(j&&(C=g!==G&&g);o!==v&&null!=(k=t[o]);o++){if(f&&k){for(l=0;m=a[l++];)if(m(k,g,h)){i.push(k);break}j&&(P=u)}e&&((k=!m&&k)&&n--,d&&p.push(k))}if(n+=o,e&&o!==n){for(l=0;m=c[l++];)m(p,r,g,h);if(d){if(n>0)for(;o--;)p[o]||r[o]||(r[o]=Z.call(i));r=q(r)}_.apply(i,r),j&&!d&&r.length>0&&n+c.length>1&&b.uniqueSort(i)}return j&&(P=u,C=s),p};return e?d(g):g}var u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N="sizzle"+-new Date,O=a.document,P=0,Q=0,R=c(),S=c(),T=c(),U=function(a,b){return a===b&&(E=!0),0},V="undefined",W=1<<31,X={}.hasOwnProperty,Y=[],Z=Y.pop,$=Y.push,_=Y.push,aa=Y.slice,ba=Y.indexOf||function(a){for(var b=0,c=this.length;b+~]|"+da+")"+da+"*"),la=new RegExp("="+da+"*([^\\]'\"]*?)"+da+"*\\]","g"),ma=new RegExp(ha),na=new RegExp("^"+fa+"$"),oa={ID:new RegExp("^#("+ea+")"),CLASS:new RegExp("^\\.("+ea+")"),TAG:new RegExp("^("+ea.replace("w","w*")+")"),ATTR:new RegExp("^"+ga),PSEUDO:new RegExp("^"+ha),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+da+"*(even|odd|(([+-]|)(\\d*)n|)"+da+"*(?:([+-]|)"+da+"*(\\d+)|))"+da+"*\\)|)","i"),bool:new RegExp("^(?:"+ca+")$","i"),needsContext:new RegExp("^"+da+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+da+"*((?:-\\d)?\\d*)"+da+"*\\)|)(?=[^-]|$)","i")},pa=/^(?:input|select|textarea|button)$/i,qa=/^h\d$/i,ra=/^[^{]+\{\s*\[native \w/,sa=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ta=/[+~]/,ua=/'|\\/g,va=new RegExp("\\\\([\\da-f]{1,6}"+da+"?|("+da+")|.)","ig"),wa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:d<0?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{_.apply(Y=aa.call(O.childNodes),O.childNodes),Y[O.childNodes.length].nodeType}catch(a){_={apply:Y.length?function(a,b){$.apply(a,aa.call(b))}:function(a,b){for(var c=a.length,d=0;a[c++]=b[d++];);a.length=c-1}}}v=b.support={},y=b.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&"HTML"!==b.nodeName},F=b.setDocument=function(a){var b,c=a?a.ownerDocument||a:O,d=c.defaultView;return c!==G&&9===c.nodeType&&c.documentElement?(G=c,H=c.documentElement,I=!y(c),d&&d!==d.top&&(d.addEventListener?d.addEventListener("unload",function(){F()},!1):d.attachEvent&&d.attachEvent("onunload",function(){F()})),v.attributes=e(function(a){return a.className="i",!a.getAttribute("className")}),v.getElementsByTagName=e(function(a){return a.appendChild(c.createComment("")),!a.getElementsByTagName("*").length}),v.getElementsByClassName=ra.test(c.getElementsByClassName)&&e(function(a){return a.innerHTML="
                      ",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),v.getById=e(function(a){return H.appendChild(a).id=N,!c.getElementsByName||!c.getElementsByName(N).length}),v.getById?(w.find.ID=function(a,b){if(typeof b.getElementById!==V&&I){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},w.filter.ID=function(a){var b=a.replace(va,wa);return function(a){return a.getAttribute("id")===b}}):(delete w.find.ID,w.filter.ID=function(a){var b=a.replace(va,wa);return function(a){var c=typeof a.getAttributeNode!==V&&a.getAttributeNode("id");return c&&c.value===b}}),w.find.TAG=v.getElementsByTagName?function(a,b){if(typeof b.getElementsByTagName!==V)return b.getElementsByTagName(a)}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){for(;c=f[e++];)1===c.nodeType&&d.push(c);return d}return f},w.find.CLASS=v.getElementsByClassName&&function(a,b){if(typeof b.getElementsByClassName!==V&&I)return b.getElementsByClassName(a)},K=[],J=[],(v.qsa=ra.test(c.querySelectorAll))&&(e(function(a){a.innerHTML="",a.querySelectorAll("[msallowclip^='']").length&&J.push("[*^$]="+da+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||J.push("\\["+da+"*(?:value|"+ca+")"),a.querySelectorAll(":checked").length||J.push(":checked")}),e(function(a){var b=c.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&J.push("name"+da+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||J.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),J.push(",.*:")})),(v.matchesSelector=ra.test(L=H.matches||H.webkitMatchesSelector||H.mozMatchesSelector||H.oMatchesSelector||H.msMatchesSelector))&&e(function(a){v.disconnectedMatch=L.call(a,"div"),L.call(a,"[s!='']:x"),K.push("!=",ha)}),J=J.length&&new RegExp(J.join("|")),K=K.length&&new RegExp(K.join("|")),b=ra.test(H.compareDocumentPosition),M=b||ra.test(H.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)for(;b=b.parentNode;)if(b===a)return!0;return!1},U=b?function(a,b){if(a===b)return E=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!v.sortDetached&&b.compareDocumentPosition(a)===d?a===c||a.ownerDocument===O&&M(O,a)?-1:b===c||b.ownerDocument===O&&M(O,b)?1:D?ba.call(D,a)-ba.call(D,b):0:4&d?-1:1)}:function(a,b){if(a===b)return E=!0,0;var d,e=0,f=a.parentNode,h=b.parentNode,i=[a],j=[b];if(!f||!h)return a===c?-1:b===c?1:f?-1:h?1:D?ba.call(D,a)-ba.call(D,b):0;if(f===h)return g(a,b);for(d=a;d=d.parentNode;)i.unshift(d);for(d=b;d=d.parentNode;)j.unshift(d);for(;i[e]===j[e];)e++;return e?g(i[e],j[e]):i[e]===O?-1:j[e]===O?1:0},c):G},b.matches=function(a,c){return b(a,null,null,c)},b.matchesSelector=function(a,c){if((a.ownerDocument||a)!==G&&F(a),c=c.replace(la,"='$1']"),v.matchesSelector&&I&&(!K||!K.test(c))&&(!J||!J.test(c)))try{var d=L.call(a,c);if(d||v.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(a){}return b(c,G,null,[a]).length>0},b.contains=function(a,b){return(a.ownerDocument||a)!==G&&F(a),M(a,b)},b.attr=function(a,b){(a.ownerDocument||a)!==G&&F(a);var c=w.attrHandle[b.toLowerCase()],d=c&&X.call(w.attrHandle,b.toLowerCase())?c(a,b,!I):void 0;return void 0!==d?d:v.attributes||!I?a.getAttribute(b):(d=a.getAttributeNode(b))&&d.specified?d.value:null},b.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},b.uniqueSort=function(a){var b,c=[],d=0,e=0;if(E=!v.detectDuplicates,D=!v.sortStable&&a.slice(0),a.sort(U),E){for(;b=a[e++];)b===a[e]&&(d=c.push(e));for(;d--;)a.splice(c[d],1)}return D=null,a},x=b.getText=function(a){var b,c="",d=0,e=a.nodeType;if(e){if(1===e||9===e||11===e){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=x(a)}else if(3===e||4===e)return a.nodeValue}else for(;b=a[d++];)c+=x(b);return c},w=b.selectors={cacheLength:50,createPseudo:d,match:oa,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(va,wa),a[3]=(a[3]||a[4]||a[5]||"").replace(va,wa),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||b.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&b.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return oa.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&ma.test(c)&&(b=z(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(va,wa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=R[a+" "];return b||(b=new RegExp("(^|"+da+")"+a+"("+da+"|$)"))&&R(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==V&&a.getAttribute("class")||"")})},ATTR:function(a,c,d){return function(e){var f=b.attr(e,a);return null==f?"!="===c:!c||(f+="","="===c?f===d:"!="===c?f!==d:"^="===c?d&&0===f.indexOf(d):"*="===c?d&&f.indexOf(d)>-1:"$="===c?d&&f.slice(-d.length)===d:"~="===c?(" "+f+" ").indexOf(d)>-1:"|="===c&&(f===d||f.slice(0,d.length+1)===d+"-"))}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){for(;p;){for(l=b;l=l[p];)if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){for(k=q[N]||(q[N]={}),j=k[a]||[],n=j[0]===P&&j[1],m=j[0]===P&&j[2],l=n&&q.childNodes[n];l=++n&&l&&l[p]||(m=n=0)||o.pop();)if(1===l.nodeType&&++m&&l===b){k[a]=[P,n,m];break}}else if(s&&(j=(b[N]||(b[N]={}))[a])&&j[0]===P)m=j[1];else for(;(l=++n&&l&&l[p]||(m=n=0)||o.pop())&&((h?l.nodeName.toLowerCase()!==r:1!==l.nodeType)||!++m||(s&&((l[N]||(l[N]={}))[a]=[P,m]),l!==b)););return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,c){var e,f=w.pseudos[a]||w.setFilters[a.toLowerCase()]||b.error("unsupported pseudo: "+a);return f[N]?f(c):f.length>1?(e=[a,a,"",c],w.setFilters.hasOwnProperty(a.toLowerCase())?d(function(a,b){for(var d,e=f(a,c),g=e.length;g--;)d=ba.call(a,e[g]),a[d]=!(b[d]=e[g])}):function(a){return f(a,0,e)}):f}},pseudos:{not:d(function(a){var b=[],c=[],e=A(a.replace(ia,"$1"));return e[N]?d(function(a,b,c,d){for(var f,g=e(a,null,d,[]),h=a.length;h--;)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,d,f){return b[0]=a,e(b,null,f,c),!c.pop()}}),has:d(function(a){return function(c){return b(a,c).length>0}}),contains:d(function(a){return function(b){return(b.textContent||b.innerText||x(b)).indexOf(a)>-1}}),lang:d(function(a){return na.test(a||"")||b.error("unsupported lang: "+a),a=a.replace(va,wa).toLowerCase(),function(b){var c;do if(c=I?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===H},focus:function(a){return a===G.activeElement&&(!G.hasFocus||G.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!w.pseudos.empty(a)},header:function(a){return qa.test(a.nodeName)},input:function(a){return pa.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:j(function(){return[0]}),last:j(function(a,b){return[b-1]}),eq:j(function(a,b,c){return[c<0?c+b:c]}),even:j(function(a,b){for(var c=0;c=0;)a.push(d);return a}),gt:j(function(a,b,c){for(var d=c<0?c+b:c;++d2&&"ID"===(g=f[0]).type&&v.getById&&9===b.nodeType&&I&&w.relative[f[1].type]){if(b=(w.find.ID(g.matches[0].replace(va,wa),b)||[])[0],!b)return c;j&&(b=b.parentNode),a=a.slice(f.shift().value.length)}for(e=oa.needsContext.test(a)?0:f.length;e--&&(g=f[e],!w.relative[h=g.type]);)if((i=w.find[h])&&(d=i(g.matches[0].replace(va,wa),ta.test(f[0].type)&&k(b.parentNode)||b))){if(f.splice(e,1),a=d.length&&m(f),!a)return _.apply(c,d),c;break}}return(j||A(a,l))(d,b,!I,c,ta.test(a)&&k(b.parentNode)||b),c},v.sortStable=N.split("").sort(U).join("")===N,v.detectDuplicates=!!E,F(),v.sortDetached=e(function(a){return 1&a.compareDocumentPosition(G.createElement("div"))}),e(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||f("type|href|height|width",function(a,b,c){if(!c)return a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),v.attributes&&e(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||f("value",function(a,b,c){if(!c&&"input"===a.nodeName.toLowerCase())return a.defaultValue}),e(function(a){return null==a.getAttribute("disabled")})||f(ca,function(a,b,c){var d;if(!c)return a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),b}(a);_.find=ea,_.expr=ea.selectors,_.expr[":"]=_.expr.pseudos,_.unique=ea.uniqueSort,_.text=ea.getText,_.isXMLDoc=ea.isXML,_.contains=ea.contains;var fa=_.expr.match.needsContext,ga=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,ha=/^.[^:#\[\.,]*$/;_.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?_.find.matchesSelector(d,a)?[d]:[]:_.find.matches(a,_.grep(b,function(a){return 1===a.nodeType}))},_.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(_(a).filter(function(){for(b=0;b1?_.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(d(this,a||[],!1))},not:function(a){return this.pushStack(d(this,a||[],!0))},is:function(a){return!!d(this,"string"==typeof a&&fa.test(a)?_(a):a||[],!1).length}});var ia,ja=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,ka=_.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:ja.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||ia).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof _?b[0]:b,_.merge(this,_.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:Z,!0)),ga.test(c[1])&&_.isPlainObject(b))for(c in b)_.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=Z.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=Z,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):_.isFunction(a)?"undefined"!=typeof ia.ready?ia.ready(a):a(_):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),_.makeArray(a,this))};ka.prototype=_.fn,ia=_(Z);var la=/^(?:parents|prev(?:Until|All))/,ma={children:!0,contents:!0,next:!0,prev:!0};_.extend({dir:function(a,b,c){for(var d=[],e=void 0!==c;(a=a[b])&&9!==a.nodeType;)if(1===a.nodeType){if(e&&_(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),_.fn.extend({has:function(a){var b=_(a,this),c=b.length;return this.filter(function(){for(var a=0;a-1:1===c.nodeType&&_.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?_.unique(f):f)},index:function(a){return a?"string"==typeof a?U.call(_(a),this[0]):U.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(_.unique(_.merge(this.get(),_(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}}),_.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return _.dir(a,"parentNode")},parentsUntil:function(a,b,c){return _.dir(a,"parentNode",c)},next:function(a){return e(a,"nextSibling")},prev:function(a){return e(a,"previousSibling")},nextAll:function(a){return _.dir(a,"nextSibling")},prevAll:function(a){return _.dir(a,"previousSibling")},nextUntil:function(a,b,c){return _.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return _.dir(a,"previousSibling",c)},siblings:function(a){return _.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return _.sibling(a.firstChild)},contents:function(a){return a.contentDocument||_.merge([],a.childNodes)}},function(a,b){_.fn[a]=function(c,d){var e=_.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=_.filter(d,e)),this.length>1&&(ma[a]||_.unique(e),la.test(a)&&e.reverse()),this.pushStack(e)}});var na=/\S+/g,oa={};_.Callbacks=function(a){a="string"==typeof a?oa[a]||f(a):_.extend({},a);var b,c,d,e,g,h,i=[],j=!a.once&&[],k=function(f){for(b=a.memory&&f,c=!0,h=e||0,e=0,g=i.length,d=!0;i&&h-1;)i.splice(c,1),d&&(c<=g&&g--,c<=h&&h--)}),this},has:function(a){return a?_.inArray(a,i)>-1:!(!i||!i.length)},empty:function(){return i=[],g=0,this},disable:function(){return i=j=b=void 0,this},disabled:function(){return!i},lock:function(){return j=void 0,b||l.disable(),this},locked:function(){return!j},fireWith:function(a,b){return!i||c&&!j||(b=b||[],b=[a,b.slice?b.slice():b],d?j.push(b):k(b)),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!c}};return l},_.extend({Deferred:function(a){var b=[["resolve","done",_.Callbacks("once memory"),"resolved"],["reject","fail",_.Callbacks("once memory"),"rejected"],["notify","progress",_.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return _.Deferred(function(c){_.each(b,function(b,f){var g=_.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&_.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?_.extend(a,d):d}},e={};return d.pipe=d.then,_.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b,c,d,e=0,f=R.call(arguments),g=f.length,h=1!==g||a&&_.isFunction(a.promise)?g:0,i=1===h?a:_.Deferred(),j=function(a,c,d){return function(e){c[a]=this,d[a]=arguments.length>1?R.call(arguments):e,d===b?i.notifyWith(c,d):--h||i.resolveWith(c,d)}};if(g>1)for(b=new Array(g),c=new Array(g),d=new Array(g);e0||(pa.resolveWith(Z,[_]),_.fn.triggerHandler&&(_(Z).triggerHandler("ready"),_(Z).off("ready"))))}}),_.ready.promise=function(b){return pa||(pa=_.Deferred(),"complete"===Z.readyState?setTimeout(_.ready):(Z.addEventListener("DOMContentLoaded",g,!1),a.addEventListener("load",g,!1))),pa.promise(b)},_.ready.promise();var qa=_.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===_.type(c)){e=!0;for(h in c)_.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,_.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(_(a),c)})),b))for(;h1,null,!0)},removeData:function(a){return this.each(function(){sa.remove(this,a)})}}),_.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=ra.get(a,b),c&&(!d||_.isArray(c)?d=ra.access(a,b,_.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=_.queue(a,b),d=c.length,e=c.shift(),f=_._queueHooks(a,b),g=function(){_.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return ra.get(a,c)||ra.access(a,c,{empty:_.Callbacks("once memory").add(function(){ra.remove(a,[b+"queue",c])})})}}),_.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthx",Y.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var za="undefined";Y.focusinBubbles="onfocusin"in a;var Aa=/^key/,Ba=/^(?:mouse|pointer|contextmenu)|click/,Ca=/^(?:focusinfocus|focusoutblur)$/,Da=/^([^.]*)(?:\.(.+)|)$/;_.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=ra.get(a);if(q)for(c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=_.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return typeof _!==za&&_.event.triggered!==b.type?_.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(na)||[""],j=b.length;j--;)h=Da.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=_.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=_.event.special[n]||{},k=_.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&_.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),_.event.global[n]=!0)},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=ra.hasData(a)&&ra.get(a);if(q&&(i=q.events)){for(b=(b||"").match(na)||[""],j=b.length;j--;)if(h=Da.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){for(l=_.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;f--;)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||_.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)_.event.remove(a,n+b[j],c,d,!0);_.isEmptyObject(i)&&(delete q.handle,ra.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,j,k,l,m=[d||Z],n=X.call(b,"type")?b.type:b,o=X.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||Z,3!==d.nodeType&&8!==d.nodeType&&!Ca.test(n+_.event.triggered)&&(n.indexOf(".")>=0&&(o=n.split("."),n=o.shift(),o.sort()),j=n.indexOf(":")<0&&"on"+n,b=b[_.expando]?b:new _.Event(n,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=o.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:_.makeArray(c,[b]),l=_.event.special[n]||{},e||!l.trigger||l.trigger.apply(d,c)!==!1)){if(!e&&!l.noBubble&&!_.isWindow(d)){for(i=l.delegateType||n,Ca.test(i+n)||(g=g.parentNode);g;g=g.parentNode)m.push(g),h=g;h===(d.ownerDocument||Z)&&m.push(h.defaultView||h.parentWindow||a)}for(f=0;(g=m[f++])&&!b.isPropagationStopped();)b.type=f>1?i:l.bindType||n,k=(ra.get(g,"events")||{})[b.type]&&ra.get(g,"handle"),k&&k.apply(g,c),k=j&&g[j],k&&k.apply&&_.acceptData(g)&&(b.result=k.apply(g,c),b.result===!1&&b.preventDefault());return b.type=n,e||b.isDefaultPrevented()||l._default&&l._default.apply(m.pop(),c)!==!1||!_.acceptData(d)||j&&_.isFunction(d[n])&&!_.isWindow(d)&&(h=d[j],h&&(d[j]=null),_.event.triggered=n,d[n](),_.event.triggered=void 0,h&&(d[j]=h)),b.result}},dispatch:function(a){a=_.event.fix(a);var b,c,d,e,f,g=[],h=R.call(arguments),i=(ra.get(this,"events")||{})[a.type]||[],j=_.event.special[a.type]||{};if(h[0]=a,a.delegateTarget=this,!j.preDispatch||j.preDispatch.call(this,a)!==!1){for(g=_.event.handlers.call(this,a,i),b=0;(e=g[b++])&&!a.isPropagationStopped();)for(a.currentTarget=e.elem,c=0;(f=e.handlers[c++])&&!a.isImmediatePropagationStopped();)a.namespace_re&&!a.namespace_re.test(f.namespace)||(a.handleObj=f,a.data=f.data,d=((_.event.special[f.origType]||{}).handle||f.handler).apply(e.elem,h),void 0!==d&&(a.result=d)===!1&&(a.preventDefault(),a.stopPropagation()));return j.postDispatch&&j.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;c=0:_.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h]*)\/>/gi,Fa=/<([\w:]+)/,Ga=/<|&#?\w+;/,Ha=/<(?:script|style|link)/i,Ia=/checked\s*(?:[^=]|=\s*.checked.)/i,Ja=/^$|\/(?:java|ecma)script/i,Ka=/^true\/(.*)/,La=/^\s*\s*$/g,Ma={option:[1,""],thead:[1,"","
                      "],col:[2,"","
                      "],tr:[2,"","
                      "],td:[3,"","
                      "],_default:[0,"",""]};Ma.optgroup=Ma.option,Ma.tbody=Ma.tfoot=Ma.colgroup=Ma.caption=Ma.thead,Ma.th=Ma.td,_.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=_.contains(a.ownerDocument,a);if(!(Y.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||_.isXMLDoc(a)))for(g=r(h),f=r(a),d=0,e=f.length;d0&&p(g,!i&&r(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,n=a.length;m")+h[2],j=h[0];j--;)f=f.lastChild;_.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));for(k.textContent="",m=0;e=l[m++];)if((!d||_.inArray(e,d)===-1)&&(i=_.contains(e.ownerDocument,e),f=r(k.appendChild(e),"script"),i&&p(f),c))for(j=0;e=f[j++];)Ja.test(e.type||"")&&c.push(e);return k},cleanData:function(a){for(var b,c,d,e,f=_.event.special,g=0;void 0!==(c=a[g]);g++){if(_.acceptData(c)&&(e=c[ra.expando],e&&(b=ra.cache[e]))){if(b.events)for(d in b.events)f[d]?_.event.remove(c,d):_.removeEvent(c,d,b.handle);ra.cache[e]&&delete ra.cache[e]}delete sa.cache[c[sa.expando]]}}}),_.fn.extend({text:function(a){return qa(this,function(a){return void 0===a?_.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=m(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=m(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?_.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||_.cleanData(r(c)),c.parentNode&&(b&&_.contains(c.ownerDocument,c)&&p(r(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(_.cleanData(r(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null!=a&&a,b=null==b?a:b,this.map(function(){return _.clone(this,a,b)})},html:function(a){return qa(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!Ha.test(a)&&!Ma[(Fa.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ea,"<$1>");try{for(;c1&&"string"==typeof m&&!Y.checkClone&&Ia.test(m))return this.each(function(c){var d=k.eq(c);p&&(a[0]=m.call(this,c,d.html())),d.domManip(a,b)});if(j&&(c=_.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(e=_.map(r(c,"script"),n),f=e.length;i1)},show:function(){return B(this,!0)},hide:function(){return B(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){xa(this)?_(this).show():_(this).hide()})}}),_.Tween=C,C.prototype={constructor:C,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(_.cssNumber[c]?"":"px")},cur:function(){var a=C.propHooks[this.prop];return a&&a.get?a.get(this):C.propHooks._default.get(this)},run:function(a){var b,c=C.propHooks[this.prop];return this.options.duration?this.pos=b=_.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):C.propHooks._default.set(this),this}},C.prototype.init.prototype=C.prototype,C.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=_.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){_.fx.step[a.prop]?_.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[_.cssProps[a.prop]]||_.cssHooks[a.prop])?_.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},C.propHooks.scrollTop=C.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},_.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},_.fx=C.prototype.init,_.fx.step={};var Ya,Za,$a=/^(?:toggle|show|hide)$/,_a=new RegExp("^(?:([+-])=|)("+va+")([a-z%]*)$","i"),ab=/queueHooks$/,bb=[G],cb={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=_a.exec(b),f=e&&e[3]||(_.cssNumber[a]?"":"px"),g=(_.cssNumber[a]||"px"!==f&&+d)&&_a.exec(_.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,_.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};_.Animation=_.extend(I,{tweener:function(a,b){_.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;d1)},removeAttr:function(a){return this.each(function(){_.removeAttr(this,a)})}}),_.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===za?_.prop(a,b,c):(1===f&&_.isXMLDoc(a)||(b=b.toLowerCase(),d=_.attrHooks[b]||(_.expr.match.bool.test(b)?eb:db)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=_.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void _.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(na);if(f&&1===a.nodeType)for(;c=f[e++];)d=_.propFix[c]||c,_.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)},attrHooks:{type:{set:function(a,b){if(!Y.radioValue&&"radio"===b&&_.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),eb={set:function(a,b,c){return b===!1?_.removeAttr(a,c):a.setAttribute(c,c),c}},_.each(_.expr.match.bool.source.match(/\w+/g),function(a,b){var c=fb[b]||_.find.attr;fb[b]=function(a,b,d){var e,f;return d||(f=fb[b],fb[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,fb[b]=f),e}});var gb=/^(?:input|select|textarea|button)$/i;_.fn.extend({prop:function(a,b){return qa(this,_.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[_.propFix[a]||a]})}}),_.extend({propFix:{for:"htmlFor",class:"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!_.isXMLDoc(a),f&&(b=_.propFix[b]||b,e=_.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){return a.hasAttribute("tabindex")||gb.test(a.nodeName)||a.href?a.tabIndex:-1}}}}),Y.optSelected||(_.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),_.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){_.propFix[this.toLowerCase()]=this});var hb=/[\t\r\n\f]/g;_.fn.extend({addClass:function(a){var b,c,d,e,f,g,h="string"==typeof a&&a,i=0,j=this.length;if(_.isFunction(a))return this.each(function(b){_(this).addClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(na)||[];i=0;)d=d.replace(" "+e+" "," ");g=a?_.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):_.isFunction(a)?this.each(function(c){_(this).toggleClass(a.call(this,c,this.className,b),b)}):this.each(function(){if("string"===c)for(var b,d=0,e=_(this),f=a.match(na)||[];b=f[d++];)e.hasClass(b)?e.removeClass(b):e.addClass(b);else c!==za&&"boolean"!==c||(this.className&&ra.set(this,"__className__",this.className),this.className=this.className||a===!1?"":ra.get(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;c=0)return!0;return!1}});var ib=/\r/g;_.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=_.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,_(this).val()):a,null==e?e="":"number"==typeof e?e+="":_.isArray(e)&&(e=_.map(e,function(a){return null==a?"":a+""})),b=_.valHooks[this.type]||_.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=_.valHooks[e.type]||_.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(ib,""):null==c?"":c)}}}),_.extend({valHooks:{option:{get:function(a){var b=_.find.attr(a,"value");return null!=b?b:_.trim(_.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||e<0,g=f?null:[],h=f?e+1:d.length,i=e<0?h:f?e:0;i=0)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),_.each(["radio","checkbox"],function(){_.valHooks[this]={set:function(a,b){if(_.isArray(b))return a.checked=_.inArray(_(a).val(),b)>=0}},Y.checkOn||(_.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})}),_.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){_.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),_.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var jb=_.now(),kb=/\?/;_.parseJSON=function(a){return JSON.parse(a+"")},_.parseXML=function(a){var b,c;if(!a||"string"!=typeof a)return null;try{c=new DOMParser,b=c.parseFromString(a,"text/xml")}catch(a){b=void 0}return b&&!b.getElementsByTagName("parsererror").length||_.error("Invalid XML: "+a),b};var lb,mb,nb=/#.*$/,ob=/([?&])_=[^&]*/,pb=/^(.*?):[ \t]*([^\r\n]*)$/gm,qb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,rb=/^(?:GET|HEAD)$/,sb=/^\/\//,tb=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,ub={},vb={},wb="*/".concat("*");try{mb=location.href}catch(a){mb=Z.createElement("a"),mb.href="",mb=mb.href}lb=tb.exec(mb.toLowerCase())||[],_.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:mb,type:"GET",isLocal:qb.test(lb[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":wb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":_.parseJSON,"text xml":_.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?L(L(a,_.ajaxSettings),b):L(_.ajaxSettings,a)},ajaxPrefilter:J(ub),ajaxTransport:J(vb),ajax:function(a,b){function c(a,b,c,g){var i,k,r,s,u,w=b;2!==t&&(t=2,h&&clearTimeout(h),d=void 0,f=g||"",v.readyState=a>0?4:0,i=a>=200&&a<300||304===a,c&&(s=M(l,v,c)),s=N(l,s,v,i),i?(l.ifModified&&(u=v.getResponseHeader("Last-Modified"),u&&(_.lastModified[e]=u),u=v.getResponseHeader("etag"),u&&(_.etag[e]=u)),204===a||"HEAD"===l.type?w="nocontent":304===a?w="notmodified":(w=s.state,k=s.data,r=s.error,i=!r)):(r=w,!a&&w||(w="error",a<0&&(a=0))),v.status=a,v.statusText=(b||w)+"",i?o.resolveWith(m,[k,w,v]):o.rejectWith(m,[v,w,r]),v.statusCode(q),q=void 0,j&&n.trigger(i?"ajaxSuccess":"ajaxError",[v,l,i?k:r]),p.fireWith(m,[v,w]),j&&(n.trigger("ajaxComplete",[v,l]),--_.active||_.event.trigger("ajaxStop")))}"object"==typeof a&&(b=a,a=void 0),b=b||{};var d,e,f,g,h,i,j,k,l=_.ajaxSetup({},b),m=l.context||l,n=l.context&&(m.nodeType||m.jquery)?_(m):_.event,o=_.Deferred(),p=_.Callbacks("once memory"),q=l.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!g)for(g={};b=pb.exec(f);)g[b[1].toLowerCase()]=b[2];b=g[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(l.mimeType=a),this},statusCode:function(a){var b;if(a)if(t<2)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return d&&d.abort(b),c(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,l.url=((a||l.url||mb)+"").replace(nb,"").replace(sb,lb[1]+"//"),l.type=b.method||b.type||l.method||l.type,l.dataTypes=_.trim(l.dataType||"*").toLowerCase().match(na)||[""],null==l.crossDomain&&(i=tb.exec(l.url.toLowerCase()),l.crossDomain=!(!i||i[1]===lb[1]&&i[2]===lb[2]&&(i[3]||("http:"===i[1]?"80":"443"))===(lb[3]||("http:"===lb[1]?"80":"443")))),l.data&&l.processData&&"string"!=typeof l.data&&(l.data=_.param(l.data,l.traditional)),K(ub,l,b,v),2===t)return v;j=l.global,j&&0===_.active++&&_.event.trigger("ajaxStart"),l.type=l.type.toUpperCase(),l.hasContent=!rb.test(l.type),e=l.url,l.hasContent||(l.data&&(e=l.url+=(kb.test(e)?"&":"?")+l.data,delete l.data),l.cache===!1&&(l.url=ob.test(e)?e.replace(ob,"$1_="+jb++):e+(kb.test(e)?"&":"?")+"_="+jb++)),l.ifModified&&(_.lastModified[e]&&v.setRequestHeader("If-Modified-Since",_.lastModified[e]),_.etag[e]&&v.setRequestHeader("If-None-Match",_.etag[e])),(l.data&&l.hasContent&&l.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",l.contentType),v.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+("*"!==l.dataTypes[0]?", "+wb+"; q=0.01":""):l.accepts["*"]);for(k in l.headers)v.setRequestHeader(k,l.headers[k]);if(l.beforeSend&&(l.beforeSend.call(m,v,l)===!1||2===t))return v.abort();u="abort";for(k in{success:1,error:1,complete:1})v[k](l[k]);if(d=K(vb,l,b,v)){v.readyState=1,j&&n.trigger("ajaxSend",[v,l]),l.async&&l.timeout>0&&(h=setTimeout(function(){v.abort("timeout")},l.timeout));try{t=1,d.send(r,c)}catch(a){if(!(t<2))throw a;c(-1,a)}}else c(-1,"No Transport");return v},getJSON:function(a,b,c){return _.get(a,b,c,"json")},getScript:function(a,b){return _.get(a,void 0,b,"script")}}),_.each(["get","post"],function(a,b){_[b]=function(a,c,d,e){return _.isFunction(c)&&(e=e||d,d=c,c=void 0),_.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),_.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){_.fn[b]=function(a){return this.on(b,a)}}),_._evalUrl=function(a){return _.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,throws:!0})},_.fn.extend({wrapAll:function(a){var b;return _.isFunction(a)?this.each(function(b){_(this).wrapAll(a.call(this,b))}):(this[0]&&(b=_(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){for(var a=this;a.firstElementChild;)a=a.firstElementChild;return a}).append(this)),this)},wrapInner:function(a){return _.isFunction(a)?this.each(function(b){_(this).wrapInner(a.call(this,b))}):this.each(function(){var b=_(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=_.isFunction(a);return this.each(function(c){_(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){_.nodeName(this,"body")||_(this).replaceWith(this.childNodes)}).end()}}),_.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0},_.expr.filters.visible=function(a){return!_.expr.filters.hidden(a)};var xb=/%20/g,yb=/\[\]$/,zb=/\r?\n/g,Ab=/^(?:submit|button|image|reset|file)$/i,Bb=/^(?:input|select|textarea|keygen)/i;_.param=function(a,b){var c,d=[],e=function(a,b){b=_.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=_.ajaxSettings&&_.ajaxSettings.traditional),_.isArray(a)||a.jquery&&!_.isPlainObject(a))_.each(a,function(){e(this.name,this.value)});else for(c in a)O(c,a[c],b,e);return d.join("&").replace(xb,"+")},_.fn.extend({serialize:function(){return _.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=_.prop(this,"elements");return a?_.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!_(this).is(":disabled")&&Bb.test(this.nodeName)&&!Ab.test(a)&&(this.checked||!ya.test(a))}).map(function(a,b){var c=_(this).val();return null==c?null:_.isArray(c)?_.map(c,function(a){return{name:b.name,value:a.replace(zb,"\r\n")}}):{name:b.name,value:c.replace(zb,"\r\n")}}).get()}}),_.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(a){}};var Cb=0,Db={},Eb={0:200,1223:204},Fb=_.ajaxSettings.xhr();a.ActiveXObject&&_(a).on("unload",function(){for(var a in Db)Db[a]()}),Y.cors=!!Fb&&"withCredentials"in Fb,Y.ajax=Fb=!!Fb,_.ajaxTransport(function(a){var b;if(Y.cors||Fb&&!a.crossDomain)return{send:function(c,d){var e,f=a.xhr(),g=++Cb;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)f.setRequestHeader(e,c[e]);b=function(a){return function(){b&&(delete Db[g],b=f.onload=f.onerror=null,"abort"===a?f.abort():"error"===a?d(f.status,f.statusText):d(Eb[f.status]||f.status,f.statusText,"string"==typeof f.responseText?{text:f.responseText}:void 0,f.getAllResponseHeaders()))}},f.onload=b(),f.onerror=b("error"),b=Db[g]=b("abort");try{f.send(a.hasContent&&a.data||null)}catch(a){if(b)throw a}},abort:function(){b&&b()}}}),_.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return _.globalEval(a),a}}}),_.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),_.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(d,e){b=_("
                      Operations
                        Recipe
                          Input
                          Output
                          Operations
                            Recipe
                              Input
                              Output
                              \ No newline at end of file +};ControlsWaiter.prototype.adjust_width=function(){var a=document.getElementById("controls"),b=document.getElementById("step"),c=document.getElementById("clr-breaks"),d=document.querySelector("#save img"),e=document.querySelector("#load img"),f=document.querySelector("#step img"),g=document.querySelector("#clr-recipe img"),h=document.querySelector("#clr-breaks img");a.clientWidth<470?b.childNodes[1].nodeValue=" Step":b.childNodes[1].nodeValue=" Step through",a.clientWidth<400?(d.style.display="none",e.style.display="none",f.style.display="none",g.style.display="none",h.style.display="none"):(d.style.display="inline",e.style.display="inline",f.style.display="inline",g.style.display="inline",h.style.display="inline"),a.clientWidth<330?c.childNodes[1].nodeValue=" Clear breaks":c.childNodes[1].nodeValue=" Clear breakpoints"},ControlsWaiter.prototype.set_auto_bake=function(a){var b=document.getElementById("auto-bake");b.checked!==a&&b.click()},ControlsWaiter.prototype.bake_click=function(){this.app.bake(),$("#output-text").selectRange(0)},ControlsWaiter.prototype.step_click=function(){this.app.bake(!0),$("#output-text").selectRange(0)},ControlsWaiter.prototype.auto_bake_change=function(){var a=document.getElementById("auto-bake-label"),b=document.getElementById("auto-bake");this.app.auto_bake_=b.checked,b.checked?(a.classList.remove("btn-default"),a.classList.add("btn-success")):(a.classList.remove("btn-success"),a.classList.add("btn-default"))},ControlsWaiter.prototype.clear_recipe_click=function(){this.manager.recipe.clear_recipe()},ControlsWaiter.prototype.clear_breaks_click=function(){for(var a=document.querySelectorAll("#rec_list li.operation .breakpoint"),b=0;b0,b=b&&f.length>0&&f.length<8e3,a&&(d+="?recipe="+encodeURIComponent(e)),a&&b?d+="&input="+encodeURIComponent(f):b&&(d+="?input="+encodeURIComponent(f)),d},ControlsWaiter.prototype.save_text_change=function(){try{var a=JSON.parse(document.getElementById("save-text").value);this.initialise_save_link(a)}catch(a){}},ControlsWaiter.prototype.save_click=function(){var a=this.app.get_recipe_config(),b=JSON.stringify(a).replace(/},{/g,"},\n{");document.getElementById("save-text").value=b,this.initialise_save_link(a),$("#save-modal").modal()},ControlsWaiter.prototype.slr_check_change=function(){this.initialise_save_link()},ControlsWaiter.prototype.sli_check_change=function(){this.initialise_save_link()},ControlsWaiter.prototype.load_click=function(){this.populate_load_recipes_list(),$("#load-modal").modal()},ControlsWaiter.prototype.save_button_click=function(){var a=document.getElementById("save-name").value,b=document.getElementById("save-text").value;if(!a)return void this.app.alert("Please enter a recipe name","danger",2e3);var c=localStorage.saved_recipes?JSON.parse(localStorage.saved_recipes):[],d=localStorage.recipe_id||0;c.push({id:++d,name:a,recipe:b}),localStorage.saved_recipes=JSON.stringify(c),localStorage.recipe_id=d,this.app.alert('Recipe saved as "'+a+'".',"success",2e3)},ControlsWaiter.prototype.populate_load_recipes_list=function(){for(var a=document.getElementById("load-name"),b=a.options.length;b--;)a.remove(b);var c=localStorage.saved_recipes?JSON.parse(localStorage.saved_recipes):[];for(b=0;bend: "+e+"
                              length: "+f},HighlighterWaiter.prototype.remove_highlights=function(){document.getElementById("input-highlighter").innerHTML="",document.getElementById("output-highlighter").innerHTML="",document.getElementById("input-selection-info").innerHTML="",document.getElementById("output-selection-info").innerHTML=""},HighlighterWaiter.prototype.generate_highlight_list=function(){for(var a=this.app.get_recipe_config(),b=[],c=0;c=0)return!1;var d="[start_highlight]",e=/\[start_highlight\]/g,f="[end_highlight]",g=/\[end_highlight\]/g,h=a.value;if(1===c.length){if(c[0].end/g,">").replace(/\n/g," ").replace(e,'').replace(g,"")+" ",b.style.width=a.clientWidth+"px",b.innerHTML=h,b.scrollTop=a.scrollTop,b.scrollLeft=a.scrollLeft};var HTMLApp=function(a,b,c,d){this.categories=a,this.operations=b,this.dfavourites=c,this.doptions=d,this.options=Utils.extend({},d),this.chef=new Chef,this.manager=new Manager(this),this.auto_bake_=!1,this.progress=0,this.ing_id=0,window.chef=this.chef};HTMLApp.prototype.setup=function(){document.dispatchEvent(this.manager.appstart),this.initialise_splitter(),this.load_local_storage(),this.populate_operations_list(),this.manager.setup(),this.reset_layout(),this.set_compile_message(),this.load_URI_params()},HTMLApp.prototype.handle_error=function(a){console.error(a);var b=a.display_str||a.toString();this.alert(b,"danger",this.options.error_timeout,!this.options.show_errors)},HTMLApp.prototype.bake=function(a){var b;try{b=this.chef.bake(this.get_input(),this.get_recipe_config(),this.options,this.progress,a)}catch(a){this.handle_error(a)}b&&(b.error&&this.handle_error(b.error),this.options=b.options,this.dish_str="html"===b.type?Utils.strip_html_tags(b.result,!0):b.result,this.progress=b.progress,this.manager.recipe.update_breakpoint_indicator(b.progress),this.manager.output.set(b.result,b.type,b.duration),b.duration>this.options.auto_bake_threshold&&this.auto_bake_&&(this.manager.controls.set_auto_bake(!1),this.alert("Baking took longer than "+this.options.auto_bake_threshold+"ms, Auto Bake has been disabled.","warning",5e3)))},HTMLApp.prototype.auto_bake=function(){this.auto_bake_&&this.bake()},HTMLApp.prototype.silent_bake=function(){var a=(new Date).getTime(),b=this.get_recipe_config();return this.auto_bake_&&this.chef.silent_bake(b),(new Date).getTime()-a},HTMLApp.prototype.get_input=function(){var a=this.manager.input.get();return sessionStorage.setItem("input_length",a.length),sessionStorage.setItem("input",a),a},HTMLApp.prototype.set_input=function(a){sessionStorage.setItem("input_length",a.length),sessionStorage.setItem("input",a),this.manager.input.set(a)},HTMLApp.prototype.populate_operations_list=function(){document.body.appendChild(document.getElementById("edit-favourites"));for(var a="",b=0;b2?JSON.parse(localStorage.favourites):this.dfavourites;a=this.valid_favourites(a),this.save_favourites(a);var b=this.categories.filter(function(a){return"Favourites"===a.name})[0];b?b.ops=a:this.categories.unshift({name:"Favourites",ops:a})},HTMLApp.prototype.valid_favourites=function(a){for(var b=[],c=0;c=0?void this.alert("'"+a+"' is already in your favourites","info",2e3):(b.push(a),this.save_favourites(b),this.load_favourites(),this.populate_operations_list(),void this.manager.recipe.initialise_operation_drag_n_drop())},HTMLApp.prototype.load_URI_params=function(){this.query_string=function(a){if(""===a)return{};for(var b={},c=0;c"):d[e].value=a[b].args[e];a[b].disabled&&c.querySelector(".disable-icon").click(),a[b].breakpoint&&c.querySelector(".breakpoint").click(),this.progress=0}},HTMLApp.prototype.reset_layout=function(){this.column_splitter.setSizes([20,30,50]),this.io_splitter.setSizes([50,50]),this.manager.controls.adjust_width(),this.manager.output.adjust_width()},HTMLApp.prototype.set_compile_message=function(){var a=new Date,b=Utils.fuzzy_time(a.getTime()-window.compile_time),c='Last build: '+b.substr(0,1).toUpperCase()+b.substr(1)+" ago";""!==window.compile_message&&(c+=" - "+window.compile_message),c+="",document.getElementById("notice").innerHTML=c},HTMLApp.prototype.alert=function(a,b,c,d){var e=new Date;if(console.log("["+e.toLocaleString()+"] "+a),!d){b=b||"danger",c=c||0;var f=document.getElementById("alert"),g=document.getElementById("alert-content");f.classList.remove("alert-danger"),f.classList.remove("alert-warning"),f.classList.remove("alert-info"),f.classList.remove("alert-success"),f.classList.add("alert-"+b),"block"===f.style.display?g.innerHTML+="

                              ["+e.toLocaleTimeString()+"] "+a:g.innerHTML="["+e.toLocaleTimeString()+"] "+a,$("#alert").stop(),f.style.display="block",f.style.opacity=1,c>0&&(clearTimeout(this.alert_timeout),this.alert_timeout=setTimeout(function(){$("#alert").slideUp(100)},c))}},HTMLApp.prototype.confirm=function(a,b,c,d){d=d||this,document.getElementById("confirm-title").innerHTML=a,document.getElementById("confirm-body").innerHTML=b,document.getElementById("confirm-modal").style.display="block",this.confirm_closed=!1,$("#confirm-modal").modal().one("show.bs.modal",function(a){this.confirm_closed=!1}.bind(this)).one("click","#confirm-yes",function(){this.confirm_closed=!0,c.bind(d)(!0),$("#confirm-modal").modal("hide")}.bind(this)).one("hide.bs.modal",function(a){this.confirm_closed||c.bind(d)(!1),this.confirm_closed=!0}.bind(this))},HTMLApp.prototype.alert_close_click=function(){document.getElementById("alert").style.display="none"},HTMLApp.prototype.state_change=function(a){this.auto_bake(),this.options.update_url&&(this.last_state_url=this.manager.controls.generate_state_url(!0,!0),window.history.replaceState({},"CyberChef",this.last_state_url))},HTMLApp.prototype.pop_state=function(a){window.location.href.split("#")[0]!==this.last_state_url&&this.load_URI_params()},HTMLApp.prototype.call_api=function(a,b,c,d,e){b=b||"POST",c=c||{},d=d||void 0,e=e||"application/json";var f=null,g=!1;return $.ajax({url:a,async:!1,type:b,data:c,dataType:d,contentType:e,success:function(a){g=!0,f=a},error:function(a){g=!1,f=a}}),{success:g,response:f}};var HTMLCategory=function(a,b){this.name=a,this.selected=b,this.op_list=[]};HTMLCategory.prototype.add_operation=function(a){this.op_list.push(a)},HTMLCategory.prototype.to_html=function(){for(var a="cat"+this.name.replace(/[\s\/-:_]/g,""),b="
                              "+this.name+"
                                ",c=0;c 
                              ";switch(d+="
                              ",this.type){case"string":case"binary_string":case"byte_array":d+="";break;case"short_string":case"binary_short_string":d+="";break;case"toggle_string":for(d+="
                              ";break;case"number":d+="";break;case"boolean":d+="",this.disable_args&&this.manager.add_dynamic_listener("#"+this.id,"click",this.toggle_disable_args,this);break;case"option":for(d+="";break;case"populate_option":for(d+="",this.manager.add_dynamic_listener("#"+this.id,"change",this.populate_option_change,this);break;case"editable_option":for(d+="
                              ",d+="",d+="",d+="
                              ",this.manager.add_dynamic_listener("#sel-"+this.id,"change",this.editable_option_change,this);break;case"text":d+=""}return d+="
                              "},HTMLIngredient.prototype.toggle_disable_args=function(a){for(var b,c=a.target,d=c.parentNode.parentNode,e=d.querySelectorAll(".arg-group"),f=0;f"),this.description&&(b+=""),b+=""},HTMLOperation.prototype.to_full_html=function(){for(var a="
                              "+this.name+"
                              ",b=0;b=0&&(this.name=this.name.slice(0,b)+""+this.name.slice(b,b+a.length)+""+this.name.slice(b+a.length)),this.description&&c>=0&&(this.description=this.description.slice(0,c)+""+this.description.slice(c,c+a.length)+""+this.description.slice(c+a.length))};var InputWaiter=function(a,b){this.app=a,this.manager=b,this.bad_keys=[16,17,18,19,20,27,33,34,35,36,37,38,39,40,44,91,92,93,112,113,114,115,116,117,118,119,120,121,122,123,144,145]};InputWaiter.prototype.get=function(){return document.getElementById("input-text").value},InputWaiter.prototype.set=function(a){document.getElementById("input-text").value=a,window.dispatchEvent(this.manager.statechange)},InputWaiter.prototype.set_input_info=function(a,b){var c=a.toString().length;c=c<2?2:c;var d=Utils.pad(a.toString(),c," ").replace(/ /g," "),e=Utils.pad(b.toString(),c," ").replace(/ /g," ");document.getElementById("input-info").innerHTML="length: "+d+"
                              lines: "+e},InputWaiter.prototype.input_change=function(a){this.manager.highlighter.remove_highlights(),this.app.progress=0;var b=this.get(),c=b.count("\n")+1;this.set_input_info(b.length,c),this.bad_keys.indexOf(a.keyCode)<0&&window.dispatchEvent(this.manager.statechange)},InputWaiter.prototype.input_dragover=function(a){return"move"!==a.dataTransfer.effectAllowed&&(a.stopPropagation(),a.preventDefault(),void a.target.classList.add("dropping-file"))},InputWaiter.prototype.input_dragleave=function(a){a.stopPropagation(),a.preventDefault(),a.target.classList.remove("dropping-file")},InputWaiter.prototype.input_drop=function(a){if("move"===a.dataTransfer.effectAllowed)return!1;a.stopPropagation(),a.preventDefault();var b=a.target,c=a.dataTransfer.files[0],d=a.dataTransfer.getData("Text"),e=new FileReader,f="",g=0,h=20480,i=function(){f.length>1e5&&this.app.auto_bake_&&(this.manager.controls.set_auto_bake(!1),this.app.alert("Turned off Auto Bake as the input is large","warning",5e3)),this.set(f);var a=this.app.get_recipe_config();a[0]&&"From Hex"===a[0].op||(a.unshift({op:"From Hex",args:["Space"]}),this.app.set_recipe_config(a)),b.classList.remove("loading_file")}.bind(this),j=function(){if(g>=c.size)return void i();b.value="Processing... "+Math.round(g/c.size*100)+"%";var a=c.slice(g,g+h);e.readAsArrayBuffer(a)};e.onload=function(a){var b=new Uint8Array(e.result);f+=Utils.to_hex_fast(b),g+=h,j()},b.classList.remove("dropping-file"),c?(b.classList.add("loading_file"),j()):d&&this.set(d)},InputWaiter.prototype.clear_io_click=function(){this.manager.highlighter.remove_highlights(),document.getElementById("input-text").value="",document.getElementById("output-text").value="",document.getElementById("input-info").innerHTML="",document.getElementById("output-info").innerHTML="",document.getElementById("input-selection-info").innerHTML="",document.getElementById("output-selection-info").innerHTML="",window.dispatchEvent(this.manager.statechange)};var Manager=function(a){this.app=a,this.appstart=new CustomEvent("appstart",{bubbles:!0}),this.operationadd=new CustomEvent("operationadd",{bubbles:!0}),this.operationremove=new CustomEvent("operationremove",{bubbles:!0}),this.oplistcreate=new CustomEvent("oplistcreate",{bubbles:!0}),this.statechange=new CustomEvent("statechange",{bubbles:!0}),this.window=new WindowWaiter(this.app),this.controls=new ControlsWaiter(this.app,this),this.recipe=new RecipeWaiter(this.app,this),this.ops=new OperationsWaiter(this.app,this),this.input=new InputWaiter(this.app,this),this.output=new OutputWaiter(this.app,this),this.options=new OptionsWaiter(this.app),this.highlighter=new HighlighterWaiter(this.app), +this.seasonal=new SeasonalWaiter(this.app,this),this.dynamic_handlers={},this.initialise_event_listeners()};Manager.prototype.setup=function(){this.recipe.initialise_operation_drag_n_drop(),this.controls.auto_bake_change(),this.seasonal.load()},Manager.prototype.initialise_event_listeners=function(){window.addEventListener("resize",this.window.window_resize.bind(this.window)),window.addEventListener("blur",this.window.window_blur.bind(this.window)),window.addEventListener("focus",this.window.window_focus.bind(this.window)),window.addEventListener("statechange",this.app.state_change.bind(this.app)),window.addEventListener("popstate",this.app.pop_state.bind(this.app)),document.getElementById("bake").addEventListener("click",this.controls.bake_click.bind(this.controls)),document.getElementById("auto-bake").addEventListener("change",this.controls.auto_bake_change.bind(this.controls)),document.getElementById("step").addEventListener("click",this.controls.step_click.bind(this.controls)),document.getElementById("clr-recipe").addEventListener("click",this.controls.clear_recipe_click.bind(this.controls)),document.getElementById("clr-breaks").addEventListener("click",this.controls.clear_breaks_click.bind(this.controls)),document.getElementById("save").addEventListener("click",this.controls.save_click.bind(this.controls)),document.getElementById("save-button").addEventListener("click",this.controls.save_button_click.bind(this.controls)),document.getElementById("save-link-recipe-checkbox").addEventListener("change",this.controls.slr_check_change.bind(this.controls)),document.getElementById("save-link-input-checkbox").addEventListener("change",this.controls.sli_check_change.bind(this.controls)),document.getElementById("load").addEventListener("click",this.controls.load_click.bind(this.controls)),document.getElementById("load-delete-button").addEventListener("click",this.controls.load_delete_click.bind(this.controls)),document.getElementById("load-name").addEventListener("change",this.controls.load_name_change.bind(this.controls)),document.getElementById("load-button").addEventListener("click",this.controls.load_button_click.bind(this.controls)),this.add_multi_event_listener("#save-text","keyup paste",this.controls.save_text_change,this.controls),this.add_multi_event_listener("#search","keyup paste search",this.ops.search_operations,this.ops),this.add_dynamic_listener(".op_list li.operation","dblclick",this.ops.operation_dblclick,this.ops),document.getElementById("edit-favourites").addEventListener("click",this.ops.edit_favourites_click.bind(this.ops)),document.getElementById("save-favourites").addEventListener("click",this.ops.save_favourites_click.bind(this.ops)),document.getElementById("reset-favourites").addEventListener("click",this.ops.reset_favourites_click.bind(this.ops)),this.add_dynamic_listener(".op_list .op-icon","mouseover",this.ops.op_icon_mouseover,this.ops),this.add_dynamic_listener(".op_list .op-icon","mouseleave",this.ops.op_icon_mouseleave,this.ops),this.add_dynamic_listener(".op_list","oplistcreate",this.ops.op_list_create,this.ops),this.add_dynamic_listener("li.operation","operationadd",this.recipe.op_add.bind(this.recipe)),this.add_dynamic_listener(".arg","keyup",this.recipe.ing_change,this.recipe),this.add_dynamic_listener(".arg","change",this.recipe.ing_change,this.recipe),this.add_dynamic_listener(".disable-icon","click",this.recipe.disable_click,this.recipe),this.add_dynamic_listener(".breakpoint","click",this.recipe.breakpoint_click,this.recipe),this.add_dynamic_listener("#rec_list li.operation","dblclick",this.recipe.operation_dblclick,this.recipe),this.add_dynamic_listener("#rec_list li.operation > div","dblclick",this.recipe.operation_child_dblclick,this.recipe),this.add_dynamic_listener("#rec_list .input-group .dropdown-menu a","click",this.recipe.dropdown_toggle_click,this.recipe),this.add_dynamic_listener("#rec_list","operationremove",this.recipe.op_remove.bind(this.recipe)),this.add_multi_event_listener("#input-text","keyup paste",this.input.input_change,this.input),document.getElementById("reset-layout").addEventListener("click",this.app.reset_layout.bind(this.app)),document.getElementById("clr-io").addEventListener("click",this.input.clear_io_click.bind(this.input)),document.getElementById("input-text").addEventListener("dragover",this.input.input_dragover.bind(this.input)),document.getElementById("input-text").addEventListener("dragleave",this.input.input_dragleave.bind(this.input)),document.getElementById("input-text").addEventListener("drop",this.input.input_drop.bind(this.input)),document.getElementById("input-text").addEventListener("scroll",this.highlighter.input_scroll.bind(this.highlighter)),document.getElementById("input-text").addEventListener("mouseup",this.highlighter.input_mouseup.bind(this.highlighter)),document.getElementById("input-text").addEventListener("mousemove",this.highlighter.input_mousemove.bind(this.highlighter)),this.add_multi_event_listener("#input-text","mousedown dblclick select",this.highlighter.input_mousedown,this.highlighter),document.getElementById("save-to-file").addEventListener("click",this.output.save_click.bind(this.output)),document.getElementById("switch").addEventListener("click",this.output.switch_click.bind(this.output)),document.getElementById("undo-switch").addEventListener("click",this.output.undo_switch_click.bind(this.output)),document.getElementById("maximise-output").addEventListener("click",this.output.maximise_output_click.bind(this.output)),document.getElementById("output-text").addEventListener("scroll",this.highlighter.output_scroll.bind(this.highlighter)),document.getElementById("output-text").addEventListener("mouseup",this.highlighter.output_mouseup.bind(this.highlighter)),document.getElementById("output-text").addEventListener("mousemove",this.highlighter.output_mousemove.bind(this.highlighter)),document.getElementById("output-html").addEventListener("mouseup",this.highlighter.output_html_mouseup.bind(this.highlighter)),document.getElementById("output-html").addEventListener("mousemove",this.highlighter.output_html_mousemove.bind(this.highlighter)),this.add_multi_event_listener("#output-text","mousedown dblclick select",this.highlighter.output_mousedown,this.highlighter),this.add_multi_event_listener("#output-html","mousedown dblclick select",this.highlighter.output_html_mousedown,this.highlighter),document.getElementById("options").addEventListener("click",this.options.options_click.bind(this.options)),document.getElementById("reset-options").addEventListener("click",this.options.reset_options_click.bind(this.options)),$(document).on("switchChange.bootstrapSwitch",".option-item input:checkbox",this.options.switch_change.bind(this.options)),$(document).on("switchChange.bootstrapSwitch",".option-item input:checkbox",this.options.set_word_wrap.bind(this.options)),this.add_dynamic_listener(".option-item input[type=number]","keyup",this.options.number_change,this.options),this.add_dynamic_listener(".option-item input[type=number]","change",this.options.number_change,this.options),this.add_dynamic_listener(".option-item select","change",this.options.select_change,this.options),document.getElementById("alert-close").addEventListener("click",this.app.alert_close_click.bind(this.app))},Manager.prototype.add_listeners=function(a,b,c,d){d=d||this,[].forEach.call(document.querySelectorAll(a),function(a){a.addEventListener(b,c.bind(d))})},Manager.prototype.add_multi_event_listener=function(a,b,c,d){for(var e=b.split(" "),f=0;f-1&&(this.manager.recipe.add_operation(b[c].innerHTML),this.app.auto_bake()))),13===a.keyCode)a.preventDefault();else if(40===a.keyCode)a.preventDefault(),b=document.querySelectorAll("#search-results li"),b.length&&(c=this.get_selected_op(b),c>-1&&b[c].classList.remove("selected-op"),c===b.length-1&&(c=-1),b[c+1].classList.add("selected-op"));else if(38===a.keyCode)a.preventDefault(),b=document.querySelectorAll("#search-results li"),b.length&&(c=this.get_selected_op(b),c>-1&&b[c].classList.remove("selected-op"),0===c&&(c=b.length),b[c-1].classList.add("selected-op"));else{for(var d=document.getElementById("search-results"),e=a.target,f=e.value;d.firstChild;)$(d.firstChild).popover("destroy"),d.removeChild(d.firstChild);if($("#categories .in").collapse("hide"),f){for(var g=this.filter_operations(f,!0),h="",i=0;i=0||h>=0){var i=new HTMLOperation(e,this.app.operations[e],this.app,this.manager);b&&i.highlight_search_string(a,g,h),g<0?c.push(i):d.push(i)}}return d.concat(c)},OperationsWaiter.prototype.get_selected_op=function(a){for(var b=0;blength: "+e+"
                              lines: "+f,document.getElementById("input-selection-info").innerHTML="",document.getElementById("output-selection-info").innerHTML=""},OutputWaiter.prototype.adjust_width=function(){var a=document.getElementById("output"),b=document.getElementById("save-to-file"),c=document.getElementById("switch"),d=document.getElementById("undo-switch"),e=document.getElementById("maximise-output");a.clientWidth<680?(b.childNodes[1].nodeValue="",c.childNodes[1].nodeValue="",d.childNodes[1].nodeValue="",e.childNodes[1].nodeValue=""):(b.childNodes[1].nodeValue=" Save to file",c.childNodes[1].nodeValue=" Move output to input",d.childNodes[1].nodeValue=" Undo",e.childNodes[1].nodeValue="Maximise"===e.getAttribute("title")?" Max":" Restore")},OutputWaiter.prototype.save_click=function(){var a=Utils.to_base64(this.app.dish_str),b=window.prompt("Please enter a filename:","download.dat");if(b){var c=document.createElement("a");c.setAttribute("href","data:application/octet-stream;base64;charset=utf-8,"+a),c.setAttribute("download",b),c.style.display="none",document.body.appendChild(c),c.click(),c.remove()}},OutputWaiter.prototype.switch_click=function(){this.switch_orig_data=this.manager.input.get(),document.getElementById("undo-switch").disabled=!1,this.app.set_input(this.app.dish_str)},OutputWaiter.prototype.undo_switch_click=function(){this.app.set_input(this.switch_orig_data),document.getElementById("undo-switch").disabled=!0},OutputWaiter.prototype.maximise_output_click=function(a){var b="maximise-output"===a.target.id?a.target:a.target.parentNode;"Maximise"===b.getAttribute("title")?(this.app.column_splitter.collapse(0),this.app.column_splitter.collapse(1),this.app.io_splitter.collapse(0),b.setAttribute("title","Restore"),b.innerHTML=" Restore",this.adjust_width()):(b.setAttribute("title","Maximise"),b.innerHTML=" Max",this.app.reset_layout())};var RecipeWaiter=function(a,b){this.app=a,this.manager=b,this.remove_intent=!1};RecipeWaiter.prototype.initialise_operation_drag_n_drop=function(){var a=document.getElementById("rec_list");Sortable.create(a,{group:"recipe",sort:!0,animation:0,delay:0,filter:".arg-input,.arg",setData:function(a,b){a.setData("Text",b.querySelector(".arg-title").textContent)},onEnd:function(a){this.remove_intent&&(a.item.remove(),a.target.dispatchEvent(this.manager.operationremove))}.bind(this)}),Sortable.utils.on(a,"dragover",function(){this.remove_intent=!1}.bind(this)),Sortable.utils.on(a,"dragleave",function(){this.remove_intent=!0,this.app.progress=0}.bind(this)),Sortable.utils.on(a,"touchend",function(b){var c=b.changedTouches[0],d=document.elementFromPoint(c.clientX,c.clientY);this.remove_intent=!a.contains(d)}.bind(this)),document.querySelector("#categories a").addEventListener("dragover",this.fav_dragover.bind(this)),document.querySelector("#categories a").addEventListener("dragleave",this.fav_dragleave.bind(this)),document.querySelector("#categories a").addEventListener("drop",this.fav_drop.bind(this))},RecipeWaiter.prototype.create_sortable_seed_list=function(a){Sortable.create(a,{group:{name:"recipe",pull:"clone",put:!1},sort:!1,setData:function(a,b){a.setData("Text",b.textContent)},onStart:function(a){$(a.item).popover("destroy"),a.item.setAttribute("data-toggle","popover-disabled")},onEnd:this.op_sort_end.bind(this)})},RecipeWaiter.prototype.op_sort_end=function(a){return this.remove_intent?void("rec_list"===a.item.parentNode.id&&a.item.remove()):($(a.clone).popover(),$(a.clone).children("[data-toggle=popover]").popover(),void("rec_list"===a.item.parentNode.id&&(this.build_recipe_operation(a.item),a.item.dispatchEvent(this.manager.operationadd))))},RecipeWaiter.prototype.fav_dragover=function(a){return"move"===a.dataTransfer.effectAllowed&&(a.stopPropagation(),a.preventDefault(),void(a.target.className&&a.target.className.indexOf("category-title")>-1?a.target.classList.add("favourites-hover"):a.target.parentNode.className&&a.target.parentNode.className.indexOf("category-title")>-1?a.target.parentNode.classList.add("favourites-hover"):a.target.parentNode.parentNode.className&&a.target.parentNode.parentNode.className.indexOf("category-title")>-1&&a.target.parentNode.parentNode.classList.add("favourites-hover")))},RecipeWaiter.prototype.fav_dragleave=function(a){a.stopPropagation(),a.preventDefault(),document.querySelector("#categories a").classList.remove("favourites-hover")},RecipeWaiter.prototype.fav_drop=function(a){a.stopPropagation(),a.preventDefault(),a.target.classList.remove("favourites-hover");var b=a.dataTransfer.getData("Text");this.app.add_favourite(b)},RecipeWaiter.prototype.ing_change=function(){window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.disable_click=function(a){var b=a.target;"false"===b.getAttribute("disabled")?(b.setAttribute("disabled","true"),b.classList.add("disable-icon-selected"),b.parentNode.parentNode.classList.add("disabled")):(b.setAttribute("disabled","false"),b.classList.remove("disable-icon-selected"),b.parentNode.parentNode.classList.remove("disabled")),this.app.progress=0,window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.breakpoint_click=function(a){var b=a.target;"false"===b.getAttribute("break")?(b.setAttribute("break","true"),b.classList.add("breakpoint-selected")):(b.setAttribute("break","false"),b.classList.remove("breakpoint-selected")),window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.operation_dblclick=function(a){a.target.remove(),window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.operation_child_dblclick=function(a){a.target.parentNode.remove(),window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.get_config=function(){for(var a,b,c,d,e,f=[],g=document.querySelectorAll("#rec_list li.operation"),h=0;h",this.ing_change()},RecipeWaiter.prototype.op_add=function(a){window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.op_remove=function(a){window.dispatchEvent(this.manager.statechange)};var SeasonalWaiter=function(a,b){this.app=a,this.manager=b};SeasonalWaiter.prototype.load=function(){var a=new Date;11===a.getMonth()&&a.getDate()>12&&(this.app.options.snow=!1,this.create_snow_option(),$(document).on("switchChange.bootstrapSwitch",".option-item input:checkbox[option='snow']",this.let_it_snow.bind(this)),window.addEventListener("resize",this.let_it_snow.bind(this)),this.manager.add_listeners(".btn","click",this.shake_off_snow,this),25===a.getDate()&&this.let_it_snow()),this.kkeys=[],window.addEventListener("keydown",this.konami_code_listener.bind(this))},SeasonalWaiter.prototype.insert_spider_icons=function(){var a="iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB3UlEQVQ4y2NgGJaAmYGBgVnf0oKJgYGBobWtXamqqoYTn2I4CI+LTzM2NTulpKbu+vPHz2dV5RWlluZmi3j5+KqFJSSEzpw8uQPdAEYYIzo5Kfjrl28rWFlZzjAzMYuEBQao3Lh+g+HGvbsMzExMDN++fWf4/PXLBzY2tqYNK1f2+4eHM2xcuRLigsT09Igf3384MTExbf767etBI319jU8fPsi+//jx/72HDxh5uLkZ7ty7y/Dz1687Avz8n2UUFR3Z2NjOySoqfmdhYGBg+PbtuwI7O8e5H79+8X379t357PnzYo+ePP7y6cuXc9++f69nYGRsvf/w4XdtLS2R799/bBUWFHr57sP7Jbs3b/ZkzswvUP3165fZ7z9//r988WIVAyPDr8tXr576+u3bpb9//7YwMjKeV1dV41NWVGoVEhDgPH761DJREeHaz1+/lqlpafUx6+jrRfz4+fPy+w8fTu/fsf3uw7t3L39+//4cv7DwGQYGhpdPbt9m4BcRFlNWVJC4fuvWASszs4C379792Ldt2xZBUdEdDP5hYSqQGIjDGa965uYKCalpZQwMDAxhMTG9DAwMDLaurhIkJY7A8IgGB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HIIIMuO0BOcjn3A3ybU/lu5RCUBc5qA0Ih0Q2EWiCPRk7VfMNhjLW1zETic1tLYZDMKyuSsdfh5l6bwho5+0il4kyA0VohlNcF5FP8DlWo/VB16HYB2hJ0pzgIe2mcXxP2IOumPRY17U0tll8KIkZNb+sppafOxYkQPSaYfchyYoL9GMqWYpTLRIq1QUcT4O3aPQgqVqPwIOIMwDhzX6mQUFIQAgo+9MzcrWrML3mj6+YIKiFCZyhL87RqVQKrEskF+P1BUvfLCAkfRwoPUtq6l5o5+lZb5SolJo6oT8avTCl+c9OTmat6pKW8mLkvBpGzlvsiGuQr4ZEEwA1EQgoR/gNtxIxKBluz+OtMJiF31jHxqXBiAqAUj4WRxpADFM0DCFlv1khvX7Wol4vF4AIldVVxdZqlrIfiCYQPHDy6bAGv7nKYRVY6JewExZVAP+ey5Rv+Ba97aaUHMW5NauLmMZFkegBb/EP14d6NoS9QLWFSzWBmuZza8CQmSpXsAqmGtVy14VALWuuYWWy+W3OteXa4jwceQX6+BKG6J1/8+2VCNkm2222WabbbbZZpttttlmm22rt38DCdA0vq3bcAkAAAAASUVORK5CYII=";document.querySelector("link[rel=icon]").setAttribute("href","data:image/png;base64,"+a),document.querySelector("#bake img").setAttribute("src","data:image/png;base64,"+b),document.querySelector(".about-img-left").setAttribute("src","data:image/png;base64,"+c)},SeasonalWaiter.prototype.insert_spider_text=function(){document.title=document.title.replace(/Cyber/g,"Spider"),SeasonalWaiter.tree_walk(document.body,function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Cyber/g,"Spider"))},!0),SeasonalWaiter.tree_walk(document.getElementById("bake-group"),function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Bake/g,"Spin"))},!0),document.querySelector("#recipe .title").innerHTML="Web"},SeasonalWaiter.prototype.create_snow_option=function(){var a=document.getElementById("options-body"),b=document.createElement("div");b.className="option-item",b.innerHTML=" Let it snow",a.appendChild(b),this.manager.options.load()},SeasonalWaiter.prototype.let_it_snow=function(){if($(document).snowfall("clear"),this.app.options.snow){var a={},b=navigator.userAgent.match(/Firefox\/(\d\d?)/);a=b&&parseInt(b[1],10)<30?{flakeCount:10,flakeColor:"#fff",flakePosition:"absolute",minSize:1,maxSize:2,minSpeed:1,maxSpeed:5,round:!1,shadow:!1,collection:!1,collectionHeight:20,deviceorientation:!0}:{flakeCount:35,flakeColor:"#fff",flakePosition:"absolute",minSize:5,maxSize:8,minSpeed:1,maxSpeed:5, +round:!0,shadow:!0,collection:".btn",collectionHeight:20,deviceorientation:!0},$(document).snowfall(a)}},SeasonalWaiter.prototype.shake_off_snow=function(a){for(var b=a.target,c=b.getBoundingClientRect(),d=document.querySelectorAll("canvas.snowfall-canvas"),e=null,f=function(){h.clearRect(0,0,e.width,e.height),$(this).fadeIn()},g=0;g6e4&&this.app.silent_bake()};var main=function(){var a=["To Base64","From Base64","To Hex","From Hex","To Hexdump","From Hexdump","URL Decode","Regular expression","Entropy","Fork"],b={update_url:!0,show_highlighter:!0,treat_as_utf8:!0,word_wrap:!0,show_errors:!0,error_timeout:4e3,auto_bake_threshold:200,attempt_highlight:!0,snow:!1};document.removeEventListener("DOMContentLoaded",main,!1),window.app=new HTMLApp(Categories,OperationConfig,a,b),window.app.setup()};window.console=console||{log:function(){},error:function(){}},window.compile_time=moment.tz("Wed Dec 21 2016 12:12:01","ddd MMM D YYYY HH:mm:ss","UTC").valueOf(),window.compile_message="Merry Christmas! Have a look in the options panel for some festive flavour.",document.addEventListener("DOMContentLoaded",main,!1); \ No newline at end of file diff --git a/build/prod/index.html b/build/prod/index.html index c1d70a4f..fabbe97f 100755 --- a/build/prod/index.html +++ b/build/prod/index.html @@ -18,4 +18,4 @@ See the License for the specific language governing permissions and limitations under the License. --> -CyberChef Edit
                              Operations
                                Recipe
                                  Input
                                  Output
                                  \ No newline at end of file +CyberChef Edit
                                  Operations
                                    Recipe
                                      Input
                                      Output
                                      \ No newline at end of file diff --git a/build/prod/scripts.js b/build/prod/scripts.js index 6e5e989d..43360cb9 100755 --- a/build/prod/scripts.js +++ b/build/prod/scripts.js @@ -272,6 +272,6 @@ _ipv4_cidr_range:function(a,b,c,d){var e="",f=IP._str_to_ipv4(a[1]),g=parseInt(a "06032b06010505070401":"caProtEncCert","06032b06010505070402":"signKeyPairTypes","06032b06010505070403":"encKeyPairTypes","06032b06010505070404":"preferredSymmAlg","06032b06010505070405":"caKeyUpdateInfo","06032b06010505070406":"currentCRL","06032b06010505073001":"ocsp","06032b06010505073002":"caIssuers","06032b06010505080101":"HMAC-MD5","06032b06010505080102":"HMAC-SHA","060360864801650201010a":"mosaicKeyManagementAlgorithm","060360864801650201010b":"sdnsKMandSigAlgorithm","060360864801650201010c":"mosaicKMandSigAlgorithm","060360864801650201010d":"SuiteASignatureAlgorithm","060360864801650201010e":"SuiteAConfidentialityAlgorithm","060360864801650201010f":"SuiteAIntegrityAlgorithm","06036086480186f84201":"cert-extension","06036086480186f842010a":"EntityLogo","06036086480186f842010b":"UserPicture","06036086480186f8420109":"HomePage-url","06036086480186f84202":"data-type","06036086480186f8420201":"GIF","06036086480186f8420202":"JPEG","06036086480186f8420203":"URL","06036086480186f8420204":"HTML","06036086480186f8420205":"netscape-cert-sequence","06036086480186f8420206":"netscape-cert-url","06036086480186f84203":"directory","06036086480186f8420401":"serverGatedCrypto","06036086480186f845010603":"Unknown Verisign extension","06036086480186f845010606":"Unknown Verisign extension","06036086480186f84501070101":"Verisign certificatePolicy","06036086480186f8450107010101":"Unknown Verisign policy qualifier","06036086480186f8450107010102":"Unknown Verisign policy qualifier","0603678105":"TCPA","060367810501":"tcpa_specVersion","060367810502":"tcpa_attribute","06036781050201":"tcpa_at_tpmManufacturer","0603678105020a":"tcpa_at_securityQualities","0603678105020b":"tcpa_at_tpmProtectionProfile","0603678105020c":"tcpa_at_tpmSecurityTarget","0603678105020d":"tcpa_at_foundationProtectionProfile","0603678105020e":"tcpa_at_foundationSecurityTarget","0603678105020f":"tcpa_at_tpmIdLabel","06036781050202":"tcpa_at_tpmModel","06036781050203":"tcpa_at_tpmVersion","06036781050204":"tcpa_at_platformManufacturer","06036781050205":"tcpa_at_platformModel","06036781050206":"tcpa_at_platformVersion","06036781050207":"tcpa_at_componentManufacturer","06036781050208":"tcpa_at_componentModel","06036781050209":"tcpa_at_componentVersion","060367810503":"tcpa_protocol","06036781050301":"tcpa_prtt_tpmIdProtocol","0603672a00":"contentType","0603672a0000":"PANData","0603672a0001":"PANToken","0603672a0002":"PANOnly","0603672a01":"msgExt","0603672a0a":"national","0603672a0a8140":"Japan","0603672a02":"field","0603672a0200":"fullName","0603672a0201":"givenName","0603672a020a":"amount","0603672a0202":"familyName","0603672a0203":"birthFamilyName","0603672a0204":"placeName","0603672a0205":"identificationNumber","0603672a0206":"month","0603672a0207":"date","0603672a02070b":"accountNumber","0603672a02070c":"passPhrase","0603672a0208":"address","0603672a0209":"telephone","0603672a03":"attribute","0603672a0300":"cert","0603672a030000":"rootKeyThumb","0603672a030001":"additionalPolicy","0603672a04":"algorithm","0603672a05":"policy","0603672a0500":"root","0603672a06":"module","0603672a07":"certExt","0603672a0700":"hashedRootKey","0603672a0701":"certificateType","0603672a0702":"merchantData","0603672a0703":"cardCertRequired","0603672a0704":"tunneling","0603672a0705":"setExtensions","0603672a0706":"setQualifier","0603672a08":"brand","0603672a0801":"IATA-ATA","0603672a081e":"Diners","0603672a0822":"AmericanExpress","0603672a0804":"VISA","0603672a0805":"MasterCard","0603672a08ae7b":"Novus","0603672a09":"vendor","0603672a0900":"GlobeSet","0603672a0901":"IBM","0603672a090a":"Griffin","0603672a090b":"Certicom","0603672a090c":"OSS","0603672a090d":"TenthMountain","0603672a090e":"Antares","0603672a090f":"ECC","0603672a0910":"Maithean","0603672a0911":"Netscape","0603672a0912":"Verisign","0603672a0913":"BlueMoney","0603672a0902":"CyberCash","0603672a0914":"Lacerte","0603672a0915":"Fujitsu","0603672a0916":"eLab","0603672a0917":"Entrust","0603672a0918":"VIAnet","0603672a0919":"III","0603672a091a":"OpenMarket","0603672a091b":"Lexem","0603672a091c":"Intertrader","0603672a091d":"Persimmon","0603672a0903":"Terisa","0603672a091e":"NABLE","0603672a091f":"espace-net","0603672a0920":"Hitachi","0603672a0921":"Microsoft","0603672a0922":"NEC","0603672a0923":"Mitsubishi","0603672a0924":"NCR","0603672a0925":"e-COMM","0603672a0926":"Gemplus","0603672a0904":"RSADSI","0603672a0905":"VeriFone","0603672a0906":"TrinTech","0603672a0907":"BankGate","0603672a0908":"GTE","0603672a0909":"CompuSource","0603551d01":"authorityKeyIdentifier","0603551d0a":"basicConstraints","0603551d0b":"nameConstraints","0603551d0c":"policyConstraints","0603551d0d":"basicConstraints","0603551d0e":"subjectKeyIdentifier","0603551d0f":"keyUsage","0603551d10":"privateKeyUsagePeriod","0603551d11":"subjectAltName","0603551d12":"issuerAltName","0603551d13":"basicConstraints","0603551d02":"keyAttributes","0603551d14":"cRLNumber","0603551d15":"cRLReason","0603551d16":"expirationDate","0603551d17":"instructionCode","0603551d18":"invalidityDate","0603551d1a":"issuingDistributionPoint","0603551d1b":"deltaCRLIndicator","0603551d1c":"issuingDistributionPoint","0603551d1d":"certificateIssuer","0603551d03":"certificatePolicies","0603551d1e":"nameConstraints","0603551d1f":"cRLDistributionPoints","0603551d20":"certificatePolicies","0603551d21":"policyMappings","0603551d22":"policyConstraints","0603551d23":"authorityKeyIdentifier","0603551d24":"policyConstraints","0603551d25":"extKeyUsage","0603551d04":"keyUsageRestriction","0603551d05":"policyMapping","0603551d06":"subtreesConstraint","0603551d07":"subjectAltName","0603551d08":"issuerAltName","0603551d09":"subjectDirectoryAttributes","0603550400":"objectClass","0603550401":"aliasObjectName","060355040d":"description","060355040e":"searchGuide","060355040f":"businessCategory","0603550410":"postalAddress","0603550411":"postalCode","0603550412":"postOfficeBox","0603550413":"physicalDeliveryOfficeName","0603550402":"knowledgeInformation","0603550415":"telexNumber","0603550416":"teletexTerminalIdentifier","0603550417":"facsimileTelephoneNumber","0603550418":"x121Address","0603550419":"internationalISDNNumber","060355041a":"registeredAddress","060355041b":"destinationIndicator","060355041c":"preferredDeliveryMehtod","060355041d":"presentationAddress","060355041e":"supportedApplicationContext","060355041f":"member","0603550420":"owner","0603550421":"roleOccupant","0603550422":"seeAlso","0603550423":"userPassword","0603550424":"userCertificate","0603550425":"caCertificate","0603550426":"authorityRevocationList","0603550427":"certificateRevocationList","0603550428":"crossCertificatePair","0603550429":"givenName","0603550405":"serialNumber","0603550434":"supportedAlgorithms","0603550435":"deltaRevocationList","060355043a":"crossCertificatePair","06035508":"X.500-Algorithms","0603550801":"X.500-Alg-Encryption","060355080101":"rsa","0603604c0101":"DPC"};var Punycode={IDN:!1,run_to_ascii:function(a,b){var c=b[0];return c?punycode.ToASCII(a):punycode.encode(a)},run_to_unicode:function(a,b){var c=b[0];return c?punycode.ToUnicode(a):punycode.decode(a)}},QuotedPrintable={run_to:function(a,b){var c=QuotedPrintable.mimeEncode(a);return c=c.replace(/\r?\n|\r/g,function(){return"\r\n"}).replace(/[\t ]+$/gm,function(a){return a.replace(/ /g,"=20").replace(/\t/g,"=09")}),QuotedPrintable._addSoftLinebreaks(c,"qp")},run_from:function(a,b){var c=a.replace(/\=(?:\r?\n|$)/g,"");return QuotedPrintable.mimeDecode(c)},mimeDecode:function(a){for(var b,c,d=(a.match(/\=[\da-fA-F]{2}/g)||[]).length,e=a.length-2*d,f=new Array(e),g=0,h=0,i=a.length;h=0;c--)if(b[c].length){if(1===b[c].length&&a===b[c][0])return!0;if(2===b[c].length&&a>=b[c][0]&&a<=b[c][1])return!0}return!1},_addSoftLinebreaks:function(a,b){var c=76;return b=(b||"base64").toString().toLowerCase().trim(),"qp"===b?this._addQPSoftLinebreaks(a,c):this._addBase64SoftLinebreaks(a,c)},_addBase64SoftLinebreaks:function(a,b){return a=(a||"").toString().trim(),a.replace(new RegExp(".{"+b+"}","g"),"$&\r\n").trim()},_addQPSoftLinebreaks:function(a,b){for(var c,d,e,f=0,g=a.length,h=Math.floor(b/3),i="";fb-h&&(c=e.substr(-h).match(/[ \t\.,!\?][^ \t\.,!\?]*$/)))e=e.substr(0,e.length-(c[0].length-1));else if("\r"===e.substr(-1))e=e.substr(0,e.length-1);else if(e.match(/\=[\da-f]{0,2}$/i))for((c=e.match(/\=[\da-f]{0,1}$/i))&&(e=e.substr(0,e.length-c[0].length));e.length>3&&e.length=192)););f+e.length=65&&c<=90?(c=(c-65+d)%26,e[h]=c+65):f&&c>=97&&c<=122&&(c=(c-97+d)%26,e[h]=c+97)}return e},ROT47_AMOUNT:47,run_rot47:function(a,b){var c,d=b[0],e=a;if(d){d<0&&(d=94-Math.abs(d)%94);for(var f=0;f=33&&c<=126&&(c=(c-33+d)%94,e[f]=c+33)}return e},_rotr:function(a){var b=(1&a)<<7;return a>>1|b},_rotl:function(a){var b=a>>7&1;return 255&(a<<1|b)},_rotr_whole:function(a,b){var c,d=0,e=[];b%=8;for(var f=0;f>>0;c=g>>b|d,d=(g&Math.pow(2,b)-1)<<8-b,e.push(c)}return e[0]|=d,e},_rotl_whole:function(a,b){var c,d=0,e=[];b%=8;for(var f=a.length-1;f>=0;f--){var g=a[f];c=255&(g<>8-b&Math.pow(2,b)-1,e[f]=c}return e[a.length-1]=e[a.length-1]|d,e}},SeqUtils={DELIMITER_OPTIONS:["Line feed","CRLF","Space","Comma","Semi-colon","Colon","Nothing (separate chars)"],SORT_REVERSE:!1,SORT_ORDER:["Alphabetical (case sensitive)","Alphabetical (case insensitive)","IP address"],run_sort:function(a,b){var c=Utils.char_rep[b[0]],d=b[1],e=b[2],f=a.split(c);return"Alphabetical (case sensitive)"===e?f=f.sort():"Alphabetical (case insensitive)"===e?f=f.sort(SeqUtils._case_insensitive_sort):"IP address"===e&&(f=f.sort(SeqUtils._ip_sort)),d&&f.reverse(),f.join(c)},run_unique:function(a,b){var c=Utils.char_rep[b[0]];return a.split(c).unique().join(c)},SEARCH_TYPE:["Regex","Extended (\\n, \\t, \\x...)","Simple string"],run_count:function(a,b){var c=b[0].string,d=b[0].option;if("Regex"!==d||!c)return c?(0===d.indexOf("Extended")&&(c=Utils.parse_escaped_chars(c)),a.count(c)):0;try{var e=new RegExp(c,"gi"),f=a.match(e);return f.length}catch(a){return 0}},REVERSE_BY:["Character","Line"],run_reverse:function(a,b){if("Line"===b[0]){for(var c=[],d=[],e=[],f=0;f()\\[\\]{}\\s\\x7F-\\xFF]*(?:[.!,?]+[^.!,?;"\\x27<>()\\[\\]{}\\s\\x7F-\\xFF]+)*)?'},{name:"Domain",value:"(?:(https?):\\/\\/)?([-\\w.]+)\\.(com|net|org|biz|info|co|uk|onion|int|mobi|name|edu|gov|mil|eu|ac|ae|af|de|ca|ch|cn|cy|es|gb|hk|il|in|io|tv|me|nl|no|nz|ro|ru|tr|us|az|ir|kz|uz|pk)+"},{name:"Windows file path",value:"([A-Za-z]):\\\\((?:[A-Za-z\\d][A-Za-z\\d\\- \\x27_\\(\\)]{0,61}\\\\?)*[A-Za-z\\d][A-Za-z\\d\\- \\x27_\\(\\)]{0,61})(\\.[A-Za-z\\d]{1,6})?"},{name:"UNIX file path",value:"(?:/[A-Za-z\\d.][A-Za-z\\d\\-.]{0,61})+"},{name:"MAC address",value:"[A-Fa-f\\d]{2}(?:[:-][A-Fa-f\\d]{2}){5}"},{name:"Date (yyyy-mm-dd)",value:"((?:19|20)\\d\\d)[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])"},{name:"Date (dd/mm/yyyy)",value:"(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.]((?:19|20)\\d\\d)"},{name:"Date (mm/dd/yyyy)",value:"(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.]((?:19|20)\\d\\d)"},{name:"Strings",value:'[A-Za-z\\d/\\-:.,_$%\\x27"()<>= !\\[\\]{}@]{4,}'}],REGEX_CASE_INSENSITIVE:!0,REGEX_MULTILINE_MATCHING:!0,OUTPUT_FORMAT:["Highlight matches","List matches","List capture groups","List matches with capture groups"],DISPLAY_TOTAL:!1,run_regex:function(a,b){var c=b[1],d=b[2],e=b[3],f=b[4],g=b[5],h="g";if(d&&(h+="i"),e&&(h+="m"),!c||"^"===c||"$"===c)return Utils.escape_html(a);try{var i=new RegExp(c,h);switch(g){case"Highlight matches":return StrUtils._regex_highlight(a,i,f);case"List matches":return Utils.escape_html(StrUtils._regex_list(a,i,f,!0,!1));case"List capture groups":return Utils.escape_html(StrUtils._regex_list(a,i,f,!1,!0));case"List matches with capture groups":return Utils.escape_html(StrUtils._regex_list(a,i,f,!0,!0));default:return"Error: Invalid output format"}}catch(a){return"Invalid regex. Details: "+a.message}},CASE_SCOPE:["All","Word","Sentence","Paragraph"],run_upper:function(a,b){var c=b[0];switch(c){case"Word":return a.replace(/(\b\w)/gi,function(a){return a.toUpperCase()});case"Sentence":return a.replace(/(?:\.|^)\s*(\b\w)/gi,function(a){return a.toUpperCase()});case"Paragraph":return a.replace(/(?:\n|^)\s*(\b\w)/gi,function(a){return a.toUpperCase()});case"All":default:return a.toUpperCase()}},run_lower:function(a,b){return a.toLowerCase()},SEARCH_TYPE:["Regex","Extended (\\n, \\t, \\x...)","Simple string"],FIND_REPLACE_GLOBAL:!0,FIND_REPLACE_CASE:!1,FIND_REPLACE_MULTILINE:!0,run_find_replace:function(a,b){var c=b[0].string,d=b[0].option,e=b[1],f=b[2],g=b[3],h=b[4],i="";return f&&(i+="g"),g&&(i+="i"),h&&(i+="m"),"Regex"===d?c=new RegExp(c,i):0===d.indexOf("Extended")&&(c=Utils.parse_escaped_chars(c)),a.replace(c,e,i)},SPLIT_DELIM:",",DELIMITER_OPTIONS:["Line feed","CRLF","Space","Comma","Semi-colon","Colon","Nothing (separate chars)"],run_split:function(a,b){var c=b[0]||StrUtils.SPLIT_DELIM,d=Utils.char_rep[b[1]],e=a.split(c);return e.join(d)},DIFF_SAMPLE_DELIMITER:"\\n\\n",DIFF_BY:["Character","Word","Line","Sentence","CSS","JSON"],run_diff:function(a,b){var c,d=b[0],e=b[1],f=b[2],g=b[3],h=b[4],i=a.split(d),j="";if(!i||2!==i.length)return"Incorrect number of samples, perhaps you need to modify the sample delimiter or add more samples?";switch(e){case"Character":c=JsDiff.diffChars(i[0],i[1]);break;case"Word":c=h?JsDiff.diffWords(i[0],i[1]):JsDiff.diffWordsWithSpace(i[0],i[1]);break;case"Line":c=h?JsDiff.diffTrimmedLines(i[0],i[1]):JsDiff.diffLines(i[0],i[1]);break;case"Sentence":c=JsDiff.diffSentences(i[0],i[1]);break;case"CSS":c=JsDiff.diffCss(i[0],i[1]);break;case"JSON":c=JsDiff.diffJson(i[0],i[1]);break;default:return"Invalid 'Diff by' option."}for(var k=0;k"+Utils.escape_html(c[k].value)+""):c[k].removed?g&&(j+=""+Utils.escape_html(c[k].value)+""):j+=Utils.escape_html(c[k].value);return j},OFF_CHK_SAMPLE_DELIMITER:"\\n\\n",run_offset_checker:function(a,b){var c,d=b[0],e=a.split(d),f=[],g=0,h=0,i=!1,j=!1;if(!e||e.length<2)return"Not enough samples, perhaps you need to modify the sample delimiter or add more data?";for(h=0;h"),h===e.length-1&&(j=!1)):(i&&!j?(f[h]+=""+Utils.escape_html(e[h][g]),e[h].length===g+1&&(f[h]+=""),h===e.length-1&&(j=!0)):!i&&j?(f[h]+=""+Utils.escape_html(e[h][g]),h===e.length-1&&(j=!1)):(f[h]+=Utils.escape_html(e[h][g]),j&&e[h].length===g+1&&(f[h]+="",e[h].length-1!==g&&(j=!1))),e[0].length-1===g&&(j&&(f[h]+=""),f[h]+=Utils.escape_html(e[h].substring(g+1))))}return f.join(d)},run_parse_escaped_string:function(a,b){return Utils.parse_escaped_chars(a)},_regex_highlight:function(a,b,c){for(var d,e="",f=1,g=0,h=0;d=b.exec(a);)e+=Utils.escape_html(a.slice(g,d.index)),e+=""+Utils.escape_html(d[0])+"",f=1===f?2:1,g=b.lastIndex,h++;return e+=Utils.escape_html(a.slice(g,a.length)),c&&(e="Total found: "+h+"\n\n"+e),e},_regex_list:function(a,b,c,d,e){for(var f,g="",h=0;f=b.exec(a);)if(h++,d&&(g+=f[0]+"\n"),e)for(var i=1;ih?g[i][0].length:h;for(i=0;i1&&g[i][1].length?" = "+g[i][1]+"\n":"\n"}return d}return"Invalid URI"},_encode_all_chars:function(a){return encodeURIComponent(a).replace(/!/g,"%21").replace(/#/g,"%23").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A").replace(/\-/g,"%2D").replace(/\./g,"%2E").replace(/_/g,"%5F").replace(/~/g,"%7E")}},UUID={run_generate_v4:function(a,b){if("undefined"!=typeof window.crypto&&"undefined"!=typeof window.crypto.getRandomValues){var c=new Uint32Array(4),d=0;return window.crypto.getRandomValues(c),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=c[d>>3]>>d%8*4&15,e="x"===a?b:3&b|8;return d++,e.toString(16)})}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"===a?b:3&b|8;return c.toString(16)})}},Chef=function(){this.dish=new Dish};Chef.prototype.bake=function(a,b,c,d,e){var f=(new Date).getTime(),g=new Recipe(b),h=g.contains_flow_control(),i=!1;c.hasOwnProperty("attempt_highlight")&&(c.attempt_highlight=!0),h&&(c.attempt_highlight=!1),d>=b.length&&(d=0),e&&(g.set_breakpoint(d,!1),g.set_breakpoint(d+1,!0)),d>0&&h&&(g.remove_breaks_up_to(d),d=0),0===d&&this.dish.set(a,Dish.STRING);try{d=g.execute(this.dish,d)}catch(a){i=a,d=a.progress}return{result:this.dish.type===Dish.HTML?this.dish.get(Dish.HTML):this.dish.get(Dish.STRING),type:Dish.enum_lookup(this.dish.type),progress:d,options:c,duration:(new Date).getTime()-f,error:i}},Chef.prototype.silent_bake=function(a){var b=(new Date).getTime(),c=new Recipe(a),d=new Dish("",Dish.STRING);try{c.execute(d)}catch(a){}return(new Date).getTime()-b};var Dish=function(a,b){this.value=a||"string"==typeof a?a:null,this.type=b||Dish.BYTE_ARRAY};Dish.BYTE_ARRAY=0,Dish.STRING=1,Dish.NUMBER=2,Dish.HTML=3,Dish.type_enum=function(a){switch(a){case"byte_array":case"Byte array":return Dish.BYTE_ARRAY;case"string":case"String":return Dish.STRING;case"number":case"Number":return Dish.NUMBER;case"html":case"HTML":return Dish.HTML;default:throw"Invalid data type string. No matching enum."}},Dish.enum_lookup=function(a){switch(a){case Dish.BYTE_ARRAY:return"byte_array";case Dish.STRING:return"string";case Dish.NUMBER:return"number";case Dish.HTML:return"html";default:throw"Invalid data type enum. No matching type."}},Dish.prototype.set=function(a,b){if(this.value=a,this.type=b,!this.valid()){var c=Utils.truncate(JSON.stringify(this.value),13);throw"Data is not a valid "+Dish.enum_lookup(b)+": "+c}},Dish.prototype.get=function(a){return this.type!==a&&this.translate(a),this.value},Dish.prototype.translate=function(a){switch(this.type){case Dish.STRING:this.value=this.value?Utils.str_to_byte_array(this.value):[],this.type=Dish.BYTE_ARRAY;break;case Dish.NUMBER:this.value="number"==typeof this.value?Utils.str_to_byte_array(this.value.toString()):[],this.type=Dish.BYTE_ARRAY;break;case Dish.HTML:this.value=this.value?Utils.str_to_byte_array(Utils.strip_html_tags(this.value,!0)):[],this.type=Dish.BYTE_ARRAY}switch(a){case Dish.STRING:case Dish.HTML:this.value=this.value?Utils.byte_array_to_utf8(this.value):"",this.type=Dish.STRING;break;case Dish.NUMBER:this.value=this.value?parseFloat(Utils.byte_array_to_utf8(this.value)):0,this.type=Dish.NUMBER}},Dish.prototype.valid=function(){switch(this.type){case Dish.BYTE_ARRAY:if(!(this.value instanceof Array))return!1;for(var a=0;a255)return!1;return!0;case Dish.STRING:case Dish.HTML:return"string"==typeof this.value;case Dish.NUMBER:return"number"==typeof this.value;default:return!1}};const FlowControl={FORK_DELIM:"\\n",MERGE_DELIM:"\\n",run_fork:function(a){var b=a.op_list,c=b[a.progress].input_type,d=b[a.progress].output_type,e=a.dish.get(c),f=b[a.progress].get_ing_values(),g=f[0],h=f[1],i=[],j=[];e&&(j=e.split(g));for(var k=a.progress+1;k=d)throw"Reached maximum jumps, sorry!";return a.progress+=c,a.num_jumps++,a},run_cond_jump:function(a){var b=a.op_list[a.progress].get_ing_values(),c=a.dish,d=b[0],e=b[1],f=b[2];if(a.num_jumps>=f)throw"Reached maximum jumps, sorry!";return""!==d&&c.get(Dish.STRING).search(d)>-1&&(a.progress+=e,a.num_jumps++),a},run_return:function(a){return a.progress=a.op_list.length,a}};var Ingredient=function(a){this.name="",this.type="",this.value=null,a&&this._parse_config(a)};Ingredient.prototype._parse_config=function(a){this.name=a.name,this.type=a.type},Ingredient.prototype.get_config=function(){return this.value},Ingredient.prototype.set_value=function(a){this.value=Ingredient.prepare(a,this.type)},Ingredient.prepare=function(a,b){switch(b){case"binary_string":case"binary_short_string":case"editable_option":return Utils.parse_escaped_chars(a);case"byte_array":return"string"==typeof a?(a=a.replace(/\s+/g,""),Utils.hex_to_byte_array(a)):a;case"number":var c=parseFloat(a);if(isNaN(c)){var d=Utils.truncate(a.toString(),10);throw"Invalid ingredient value. Not a number: "+d}return c;default:return a}};var Operation=function(a,b){this.name=a,this.description="",this.input_type=-1,this.output_type=-1,this.run=null,this.highlight=null,this.highlight_reverse=null,this.breakpoint=!1,this.disabled=!1,this.ing_list=[],b&&this._parse_config(b)};Operation.prototype._parse_config=function(a){this.description=a.description,this.input_type=Dish.type_enum(a.input_type),this.output_type=Dish.type_enum(a.output_type),this.run=a.run,this.highlight=a.highlight,this.highlight_reverse=a.highlight_reverse,this.flow_control=a.flow_control;for(var b=0;b
                                      Message: "+i.message:i.display_str+=i.message,i}}return this.op_list.length},Recipe.prototype.to_string=function(){return JSON.stringify(this.get_config())},Recipe.prototype.from_string=function(a){var b=JSON.parse(a);this._parse_config(b)};const Categories=[{name:"Favourites",ops:[]},{name:"Data format",ops:["To Hexdump","From Hexdump","To Hex","From Hex","To Charcode","From Charcode","To Decimal","From Decimal","To Binary","From Binary","To Base64","From Base64","Show Base64 offsets","To Base32","From Base32","To Base","From Base","To HTML Entity","From HTML Entity","URL Encode","URL Decode","Unescape Unicode Characters","To Quoted Printable","From Quoted Printable","To Punycode","From Punycode","To Hex Content","From Hex Content","PEM to Hex","Hex to PEM","Parse ASN.1 hex string","Change IP format","Text encoding","Swap endianness"]},{name:"Encryption / Encoding",ops:["AES Encrypt","AES Decrypt","Blowfish Encrypt","Blowfish Decrypt","DES Encrypt","DES Decrypt","Triple DES Encrypt","Triple DES Decrypt","Rabbit Encrypt","Rabbit Decrypt","RC4","RC4 Drop","ROT13","ROT47","XOR","XOR Brute Force","Vigen\xe8re Encode","Vigen\xe8re Decode","Derive PBKDF2 key","Derive EVP key"]},{name:"Public Key",ops:["Parse X.509 certificate","Parse ASN.1 hex string","PEM to Hex","Hex to PEM","Hex to Object Identifier","Object Identifier to Hex"]},{name:"Logical operations",ops:["XOR","XOR Brute Force","OR","NOT","AND","ADD","SUB","Rotate left","Rotate right","ROT13"]},{name:"Networking",ops:["Strip HTTP headers","Parse User Agent","Parse IP range","Parse IPv6 address","Parse URI","URL Encode","URL Decode","Format MAC addresses","Change IP format","Group IP addresses"]},{name:"Language",ops:["Text encoding","Unescape Unicode Characters"]},{name:"Utils",ops:["Diff","Remove whitespace","Remove null bytes","To Upper case","To Lower case","Add line numbers","Remove line numbers","Reverse","Sort","Unique","Split","Count occurrences","Expand alphabet range","Parse escaped string","Drop bytes","Take bytes","Pad lines","Find / Replace","Regular expression","Offset checker","Convert distance","Convert area","Convert mass","Convert speed","Convert data units","Parse UNIX file permissions","Swap endianness","Parse colour code"]},{name:"Date / Time",ops:["Parse DateTime","Translate DateTime Format","From UNIX Timestamp","To UNIX Timestamp","Extract dates"]},{name:"Extractors",ops:["Strings","Extract IP addresses","Extract email addresses","Extract MAC addresses","Extract URLs","Extract domains","Extract file paths","Extract dates","Regular expression","XPath expression","CSS selector"] },{name:"Compression",ops:["Raw Deflate","Raw Inflate","Zlib Deflate","Zlib Inflate","Gzip","Gunzip","Zip","Unzip","Bzip2 Decompress"]},{name:"Hashing",ops:["Analyse hash","Generate all hashes","MD5","SHA1","SHA224","SHA256","SHA384","SHA512","SHA3","RIPEMD-160","HMAC","Fletcher-16 Checksum","Adler-32 Checksum","CRC-32 Checksum","TCP/IP Checksum"]},{name:"Code tidy",ops:["Syntax highlighter","Generic Code Beautify","JavaScript Parser","JavaScript Beautify","JavaScript Minify","JSON Beautify","JSON Minify","XML Beautify","XML Minify","SQL Beautify","SQL Minify","CSS Beautify","CSS Minify","XPath expression","CSS selector","Strip HTML tags","Diff"]},{name:"Other",ops:["Entropy","Frequency distribution","Detect File Type","Scan for Embedded Files","Generate UUID","Numberwang"]},{name:"Flow control",ops:["Fork","Merge","Jump","Conditional Jump","Return"]}],OperationConfig={Fork:{description:"Split the input data up based on the specified delimiter and run all subsequent operations on each branch separately.

                                      For example, to decode multiple Base64 strings, enter them all on separate lines then add the 'Fork' and 'From Base64' operations to the recipe. Each string will be decoded separately.",run:FlowControl.run_fork,input_type:"string",output_type:"string",flow_control:!0,args:[{name:"Split delimiter",type:"binary_short_string",value:FlowControl.FORK_DELIM},{name:"Merge delimiter",type:"binary_short_string",value:FlowControl.MERGE_DELIM}]},Merge:{description:"Consolidate all branches back into a single trunk. The opposite of Fork.",run:FlowControl.run_merge,input_type:"string",output_type:"string",flow_control:!0,args:[]},Jump:{description:"Jump forwards or backwards over the specified number of operations.",run:FlowControl.run_jump,input_type:"string",output_type:"string",flow_control:!0,args:[{name:"Number of operations to jump over",type:"number",value:FlowControl.JUMP_NUM},{name:"Maximum jumps (if jumping backwards)",type:"number",value:FlowControl.MAX_JUMPS}]},"Conditional Jump":{description:"Conditionally jump forwards or backwards over the specified number of operations based on whether the data matches the specified regular expression.",run:FlowControl.run_cond_jump,input_type:"string",output_type:"string",flow_control:!0,args:[{name:"Match (regex)",type:"string",value:""},{name:"Number of operations to jump over if match found",type:"number",value:FlowControl.JUMP_NUM},{name:"Maximum jumps (if jumping backwards)",type:"number",value:FlowControl.MAX_JUMPS}]},Return:{description:"End execution of operations at this point in the recipe.",run:FlowControl.run_return,input_type:"string",output_type:"string",flow_control:!0,args:[]},"From Base64":{description:"Base64 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers.

                                      This operation decodes data from an ASCII Base64 string back into its raw format.

                                      e.g. aGVsbG8= becomes hello",run:Base64.run_from,highlight:Base64.highlight_from,highlight_reverse:Base64.highlight_to,input_type:"string",output_type:"byte_array",args:[{name:"Alphabet",type:"editable_option",value:Base64.ALPHABET_OPTIONS},{name:"Remove non‑alphabet chars",type:"boolean",value:Base64.REMOVE_NON_ALPH_CHARS}]},"To Base64":{description:"Base64 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers.

                                      This operation encodes data in an ASCII Base64 string.

                                      e.g. hello becomes aGVsbG8=",run:Base64.run_to,highlight:Base64.highlight_to,highlight_reverse:Base64.highlight_from,input_type:"byte_array",output_type:"string",args:[{name:"Alphabet",type:"editable_option",value:Base64.ALPHABET_OPTIONS}]},"From Base32":{description:"Base32 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers. It uses a smaller set of characters than Base64, usually the uppercase alphabet and the numbers 2 to 7.",run:Base64.run_from_32,input_type:"string",output_type:"byte_array",args:[{name:"Alphabet",type:"binary_string",value:Base64.BASE32_ALPHABET},{name:"Remove non‑alphabet chars",type:"boolean",value:Base64.REMOVE_NON_ALPH_CHARS}]},"To Base32":{description:"Base32 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers. It uses a smaller set of characters than Base64, usually the uppercase alphabet and the numbers 2 to 7.",run:Base64.run_to_32,input_type:"byte_array",output_type:"string",args:[{name:"Alphabet",type:"binary_string",value:Base64.BASE32_ALPHABET}]},"Show Base64 offsets":{description:"When a string is within a block of data and the whole block is Base64'd, the string itself could be represented in Base64 in three distinct ways depending on its offset within the block.

                                      This operation shows all possible offsets for a given string so that each possible encoding can be considered.",run:Base64.run_offsets,input_type:"byte_array",output_type:"html",args:[{name:"Alphabet",type:"binary_string",value:Base64.ALPHABET},{name:"Show variable chars and padding",type:"boolean",value:Base64.OFFSETS_SHOW_VARIABLE}]},XOR:{description:"XOR the input with the given key.
                                      e.g. fe023da5

                                      Options
                                      Null preserving: If the current byte is 0x00 or the same as the key, skip it.

                                      Scheme:
                                      • Standard - key is unchanged after each round
                                      • Input differential - key is set to the value of the previous unprocessed byte
                                      • Output differential - key is set to the value of the previous processed byte
                                      ",run:BitwiseOp.run_xor,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Key",type:"toggle_string",value:"",toggle_values:BitwiseOp.KEY_FORMAT},{name:"Scheme",type:"option",value:BitwiseOp.XOR_SCHEME},{name:"Null preserving",type:"boolean",value:BitwiseOp.XOR_PRESERVE_NULLS}]},"XOR Brute Force":{description:"Enumerate all possible XOR solutions. Current maximum key length is 2 due to browser performance.

                                      Optionally enter a regex string that you expect to find in the plaintext to filter results (crib).",run:BitwiseOp.run_xor_brute,input_type:"byte_array",output_type:"string",args:[{name:"Key length",type:"option",value:BitwiseOp.XOR_BRUTE_KEY_LENGTH},{name:"Length of sample",type:"number",value:BitwiseOp.XOR_BRUTE_SAMPLE_LENGTH},{name:"Offset of sample",type:"number",value:BitwiseOp.XOR_BRUTE_SAMPLE_OFFSET},{name:"Null preserving",type:"boolean",value:BitwiseOp.XOR_PRESERVE_NULLS},{name:"Differential",type:"boolean",value:BitwiseOp.XOR_DIFFERENTIAL},{name:"Crib (known plaintext string)",type:"binary_string",value:""},{name:"Print key",type:"boolean",value:BitwiseOp.XOR_BRUTE_PRINT_KEY},{name:"Output as hex",type:"boolean",value:BitwiseOp.XOR_BRUTE_OUTPUT_HEX}]},NOT:{description:"Returns the inverse of each byte.",run:BitwiseOp.run_not,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[]},AND:{description:"AND the input with the given key.
                                      e.g. fe023da5",run:BitwiseOp.run_and,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Key",type:"toggle_string",value:"",toggle_values:BitwiseOp.KEY_FORMAT}]},OR:{description:"OR the input with the given key.
                                      e.g. fe023da5",run:BitwiseOp.run_or,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Key",type:"toggle_string",value:"",toggle_values:BitwiseOp.KEY_FORMAT}]},ADD:{description:"ADD the input with the given key (e.g. fe023da5), MOD 255",run:BitwiseOp.run_add,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Key",type:"toggle_string",value:"",toggle_values:BitwiseOp.KEY_FORMAT}]},SUB:{description:"SUB the input with the given key (e.g. fe023da5), MOD 255",run:BitwiseOp.run_sub,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Key",type:"toggle_string",value:"",toggle_values:BitwiseOp.KEY_FORMAT}]},"From Hex":{description:"Converts a hexadecimal byte string back into a its raw value.

                                      e.g. ce 93 ce b5 ce b9 ce ac 20 cf 83 ce bf cf 85 0a becomes the UTF-8 encoded string \u0393\u03b5\u03b9\u03ac \u03c3\u03bf\u03c5",run:ByteRepr.run_from_hex,highlight:ByteRepr.highlight_from,highlight_reverse:ByteRepr.highlight_to,input_type:"string",output_type:"byte_array",args:[{name:"Delimiter",type:"option",value:ByteRepr.HEX_DELIM_OPTIONS}]},"To Hex":{description:"Converts the input string to hexadecimal bytes separated by the specified delimiter.

                                      e.g. The UTF-8 encoded string \u0393\u03b5\u03b9\u03ac \u03c3\u03bf\u03c5 becomes ce 93 ce b5 ce b9 ce ac 20 cf 83 ce bf cf 85 0a",run:ByteRepr.run_to_hex,highlight:ByteRepr.highlight_to,highlight_reverse:ByteRepr.highlight_from,input_type:"byte_array",output_type:"string",args:[{name:"Delimiter",type:"option",value:ByteRepr.HEX_DELIM_OPTIONS}]},"From Charcode":{description:"Converts unicode character codes back into text.

                                      e.g. 0393 03b5 03b9 03ac 20 03c3 03bf 03c5 becomes \u0393\u03b5\u03b9\u03ac \u03c3\u03bf\u03c5",run:ByteRepr.run_from_charcode,highlight:ByteRepr.highlight_from,highlight_reverse:ByteRepr.highlight_to,input_type:"string",output_type:"byte_array",args:[{name:"Delimiter",type:"option",value:ByteRepr.DELIM_OPTIONS},{name:"Base",type:"number",value:ByteRepr.CHARCODE_BASE}]},"To Charcode":{description:"Converts text to its unicode character code equivalent.

                                      e.g. \u0393\u03b5\u03b9\u03ac \u03c3\u03bf\u03c5 becomes 0393 03b5 03b9 03ac 20 03c3 03bf 03c5",run:ByteRepr.run_to_charcode,highlight:ByteRepr.highlight_to,highlight_reverse:ByteRepr.highlight_from,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"option",value:ByteRepr.DELIM_OPTIONS},{name:"Base",type:"number",value:ByteRepr.CHARCODE_BASE}]},"From Binary":{description:"Converts a binary string back into its raw form.

                                      e.g. 01001000 01101001 becomes Hi",run:ByteRepr.run_from_binary,highlight:ByteRepr.highlight_from_binary,highlight_reverse:ByteRepr.highlight_to_binary,input_type:"string",output_type:"byte_array",args:[{name:"Delimiter",type:"option",value:ByteRepr.BIN_DELIM_OPTIONS}]},"To Binary":{description:"Displays the input data as a binary string.

                                      e.g. Hi becomes 01001000 01101001",run:ByteRepr.run_to_binary,highlight:ByteRepr.highlight_to_binary,highlight_reverse:ByteRepr.highlight_from_binary,input_type:"byte_array",output_type:"string",args:[{name:"Delimiter",type:"option",value:ByteRepr.BIN_DELIM_OPTIONS}]},"From Decimal":{description:"Converts the data from an ordinal integer array back into its raw form.

                                      e.g. 72 101 108 108 111 becomes Hello",run:ByteRepr.run_from_decimal,input_type:"string",output_type:"byte_array",args:[{name:"Delimiter",type:"option",value:ByteRepr.DELIM_OPTIONS}]},"To Decimal":{description:"Converts the input data to an ordinal integer array.

                                      e.g. Hello becomes 72 101 108 108 111",run:ByteRepr.run_to_decimal,input_type:"byte_array",output_type:"string",args:[{name:"Delimiter",type:"option",value:ByteRepr.DELIM_OPTIONS}]},"From Hexdump":{description:"Attempts to convert a hexdump back into raw data. This operation supports many different hexdump variations, but probably not all. Make sure you verify that the data it gives you is correct before continuing analysis.",run:Hexdump.run_from,highlight:Hexdump.highlight_from,highlight_reverse:Hexdump.highlight_to,input_type:"string",output_type:"byte_array",args:[]},"To Hexdump":{description:"Creates a hexdump of the input data, displaying both the hexademinal values of each byte and an ASCII representation alongside.",run:Hexdump.run_to,highlight:Hexdump.highlight_to,highlight_reverse:Hexdump.highlight_from,input_type:"byte_array",output_type:"string",args:[{name:"Width",type:"number",value:Hexdump.WIDTH},{name:"Upper case hex",type:"boolean",value:Hexdump.UPPER_CASE},{name:"Include final length",type:"boolean",value:Hexdump.INCLUDE_FINAL_LENGTH}]},"From Base":{description:"Converts a number to decimal from a given numerical base.",run:Base.run_from,input_type:"string",output_type:"number",args:[{name:"Radix",type:"number",value:Base.DEFAULT_RADIX}]},"To Base":{description:"Converts a decimal number to a given numerical base.",run:Base.run_to,input_type:"number",output_type:"string",args:[{name:"Radix",type:"number",value:Base.DEFAULT_RADIX}]},"From HTML Entity":{description:"Converts HTML entities back to characters

                                      e.g. &amp; becomes &",run:HTML.run_from_entity,input_type:"string",output_type:"string",args:[]},"To HTML Entity":{description:"Converts characters to HTML entities

                                      e.g. & becomes &amp;",run:HTML.run_to_entity,input_type:"string",output_type:"string",args:[{name:"Convert all characters",type:"boolean",value:HTML.CONVERT_ALL},{name:"Convert to",type:"option",value:HTML.CONVERT_OPTIONS}]},"Strip HTML tags":{description:"Removes all HTML tags from the input.",run:HTML.run_strip_tags,input_type:"string",output_type:"string",args:[{name:"Remove indentation",type:"boolean",value:HTML.REMOVE_INDENTATION},{name:"Remove excess line breaks",type:"boolean",value:HTML.REMOVE_LINE_BREAKS}]},"URL Decode":{description:"Converts URI/URL percent-encoded characters back to their raw values.

                                      e.g. %3d becomes =",run:URL_.run_from,input_type:"string",output_type:"string",args:[]},"URL Encode":{description:"Encodes problematic characters into percent-encoding, a format supported by URIs/URLs.

                                      e.g. = becomes %3d",run:URL_.run_to,input_type:"string",output_type:"string",args:[{name:"Encode all special chars",type:"boolean",value:URL_.ENCODE_ALL}]},"Parse URI":{description:"Pretty prints complicated Uniform Resource Identifier (URI) strings for ease of reading. Particularly useful for Uniform Resource Locators (URLs) with a lot of arguments.",run:URL_.run_parse,input_type:"string",output_type:"string",args:[]},"Unescape Unicode Characters":{description:"Converts unicode-escaped character notation back into raw characters.

                                      Supports the prefixes:
                                      • \\u
                                      • %u
                                      • U+
                                      e.g. \\u03c3\\u03bf\\u03c5 becomes \u03c3\u03bf\u03c5",run:Unicode.run_unescape,input_type:"string",output_type:"string",args:[{name:"Prefix",type:"option",value:Unicode.PREFIXES}]},"From Quoted Printable":{description:"Converts QP-encoded text back to standard text.",run:QuotedPrintable.run_from,input_type:"string",output_type:"byte_array",args:[]},"To Quoted Printable":{description:"Quoted-Printable, or QP encoding, is an encoding using printable ASCII characters (alphanumeric and the equals sign '=') to transmit 8-bit data over a 7-bit data path or, generally, over a medium which is not 8-bit clean. It is defined as a MIME content transfer encoding for use in e-mail.

                                      QP works by using the equals sign '=' as an escape character. It also limits line length to 76, as some software has limits on line length.",run:QuotedPrintable.run_to,input_type:"byte_array",output_type:"string",args:[]},"From Punycode":{description:"Punycode is a way to represent Unicode with the limited character subset of ASCII supported by the Domain Name System.

                                      e.g. mnchen-3ya decodes to m\xfcnchen",run:Punycode.run_to_unicode,input_type:"string",output_type:"string",args:[{name:"Internationalised domain name",type:"boolean",value:Punycode.IDN}]},"To Punycode":{description:"Punycode is a way to represent Unicode with the limited character subset of ASCII supported by the Domain Name System.

                                      e.g. m\xfcnchen encodes to mnchen-3ya",run:Punycode.run_to_ascii,input_type:"string",output_type:"string",args:[{name:"Internationalised domain name",type:"boolean",value:Punycode.IDN}]},"From Hex Content":{description:"Translates hexadecimal bytes in text back to raw bytes.

                                      e.g. foo|3d|bar becomes foo=bar.",run:ByteRepr.run_from_hex_content,input_type:"string",output_type:"byte_array",args:[]},"To Hex Content":{description:"Converts special characters in a string to hexadecimal.

                                      e.g. foo=bar becomes foo|3d|bar.",run:ByteRepr.run_to_hex_content,input_type:"byte_array",output_type:"string",args:[{name:"Convert",type:"option",value:ByteRepr.HEX_CONTENT_CONVERT_WHICH},{name:"Print spaces between bytes",type:"boolean",value:ByteRepr.HEX_CONTENT_SPACES_BETWEEN_BYTES}]},"Change IP format":{description:"Convert an IP address from one format to another, e.g. 172.20.23.54 to ac141736",run:IP.run_change_ip_format,input_type:"string",output_type:"string",args:[{name:"Input format",type:"option",value:IP.IP_FORMAT_LIST},{name:"Output format",type:"option",value:IP.IP_FORMAT_LIST}]},"Parse IP range":{description:"Given a CIDR range (e.g. 10.0.0.0/24) or a hyphenated range (e.g. 10.0.0.0 - 10.0.1.0), this operation provides network information and enumerates all IP addresses in the range.

                                      IPv6 is supported but will not be enumerated.",run:IP.run_parse_ip_range,input_type:"string",output_type:"string",args:[{name:"Include network info",type:"boolean",value:IP.INCLUDE_NETWORK_INFO},{name:"Enumerate IP addresses",type:"boolean",value:IP.ENUMERATE_ADDRESSES},{name:"Allow large queries",type:"boolean",value:IP.ALLOW_LARGE_LIST}]},"Group IP addresses":{description:"Groups a list of IP addresses into subnets. Supports both IPv4 and IPv6 addresses.",run:IP.run_group_ips,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"option",value:IP.DELIM_OPTIONS},{name:"Subnet (CIDR)",type:"number",value:IP.GROUP_CIDR},{name:"Only show the subnets",type:"boolean",value:IP.GROUP_ONLY_SUBNET}]},"Parse IPv6 address":{description:"Displays the longhand and shorthand versions of a valid IPv6 address.

                                      Recognises all reserved ranges and parses encapsulated or tunnelled addresses including Teredo and 6to4.",run:IP.run_parse_ipv6,input_type:"string",output_type:"string",args:[]},"Text encoding":{description:"Translates the data between different character encodings.

                                      Supported charsets are:
                                      • UTF8
                                      • UTF16
                                      • UTF16LE (little-endian)
                                      • UTF16BE (big-endian)
                                      • Hex
                                      • Base64
                                      • Latin1 (ISO-8859-1)
                                      • Windows-1251
                                      ",run:CharEnc.run,input_type:"string",output_type:"string",args:[{name:"Input type",type:"option",value:CharEnc.IO_FORMAT},{name:"Output type",type:"option",value:CharEnc.IO_FORMAT}]},"AES Decrypt":{description:"To successfully decrypt AES, you need either:
                                      • The passphrase
                                      • Or the key and IV
                                      The IV should be the first 16 bytes of encrypted material.",run:Cipher.run_aes_dec,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Input format",type:"option",value:Cipher.IO_FORMAT1},{name:"Output format",type:"option",value:Cipher.IO_FORMAT2}]},"AES Encrypt":{description:"Input: Either enter a passphrase (which will be used to derive a key using the OpenSSL KDF) or both the key and IV.

                                      Advanced Encryption Standard (AES) is a U.S. Federal Information Processing Standard (FIPS). It was selected after a 5-year process where 15 competing designs were evaluated.

                                      AES-128, AES-192, and AES-256 are supported. The variant will be chosen based on the size of the key passed in. If a passphrase is used, a 256-bit key will be generated.",run:Cipher.run_aes_enc,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Output result",type:"option",value:Cipher.RESULT_TYPE},{name:"Output format",type:"option",value:Cipher.IO_FORMAT1}]},"DES Decrypt":{description:"To successfully decrypt DES, you need either:
                                      • The passphrase
                                      • Or the key and IV
                                      The IV should be the first 8 bytes of encrypted material.",run:Cipher.run_des_dec,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Input format",type:"option",value:Cipher.IO_FORMAT1},{name:"Output format",type:"option",value:Cipher.IO_FORMAT2}]},"DES Encrypt":{description:"Input: Either enter a passphrase (which will be used to derive a key using the OpenSSL KDF) or both the key and IV.

                                      DES is a previously dominant algorithm for encryption, and was published as an official U.S. Federal Information Processing Standard (FIPS). It is now considered to be insecure due to its small key size.",run:Cipher.run_des_enc,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Output result",type:"option",value:Cipher.RESULT_TYPE},{name:"Output format",type:"option",value:Cipher.IO_FORMAT1}]},"Triple DES Decrypt":{description:"To successfully decrypt Triple DES, you need either:
                                      • The passphrase
                                      • Or the key and IV
                                      The IV should be the first 8 bytes of encrypted material.",run:Cipher.run_triple_des_dec,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Input format",type:"option",value:Cipher.IO_FORMAT1},{name:"Output format",type:"option",value:Cipher.IO_FORMAT2}]},"Triple DES Encrypt":{description:"Input: Either enter a passphrase (which will be used to derive a key using the OpenSSL KDF) or both the key and IV.

                                      Triple DES applies DES three times to each block to increase key size.",run:Cipher.run_triple_des_enc,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Output result",type:"option",value:Cipher.RESULT_TYPE},{name:"Output format",type:"option",value:Cipher.IO_FORMAT1}]},"Blowfish Decrypt":{description:"Blowfish is a symmetric-key block cipher designed in 1993 by Bruce Schneier and included in a large number of cipher suites and encryption products. AES now receives more attention.",run:Cipher.run_blowfish_dec,input_type:"string",output_type:"string",args:[{name:"Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"Mode",type:"option",value:Cipher.BLOWFISH_MODES},{name:"Input format",type:"option",value:Cipher.IO_FORMAT3}]},"Blowfish Encrypt":{description:"Blowfish is a symmetric-key block cipher designed in 1993 by Bruce Schneier and included in a large number of cipher suites and encryption products. AES now receives more attention.",run:Cipher.run_blowfish_enc,input_type:"string",output_type:"string",args:[{name:"Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"Mode",type:"option",value:Cipher.BLOWFISH_MODES},{name:"Output format",type:"option",value:Cipher.IO_FORMAT3}]},"Rabbit Decrypt":{description:"To successfully decrypt Rabbit, you need either:
                                      • The passphrase
                                      • Or the key and IV (This is currently broken. You need the key and salt at the moment.)
                                      The IV should be the first 8 bytes of encrypted material.",run:Cipher.run_rabbit_dec,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Input format",type:"option",value:Cipher.IO_FORMAT1},{name:"Output format",type:"option",value:Cipher.IO_FORMAT2}]},"Rabbit Encrypt":{description:"Input: Either enter a passphrase (which will be used to derive a key using the OpenSSL KDF) or both the key and IV.

                                      Rabbit is a high-performance stream cipher and a finalist in the eSTREAM Portfolio. It is one of the four designs selected after a 3 1/2 year process where 22 designs were evaluated.",run:Cipher.run_rabbit_enc,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Output result",type:"option",value:Cipher.RESULT_TYPE},{name:"Output format",type:"option",value:Cipher.IO_FORMAT1}]},RC4:{description:"RC4 is a widely-used stream cipher. It is used in popular protocols such as SSL and WEP. Although remarkable for its simplicity and speed, the algorithm's history doesn't inspire confidence in its security.",run:Cipher.run_rc4,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[{name:"Passphrase",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"Input format",type:"option",value:Cipher.IO_FORMAT4},{name:"Output format",type:"option",value:Cipher.IO_FORMAT4}]},"RC4 Drop":{description:"It was discovered that the first few bytes of the RC4 keystream are strongly non-random and leak information about the key. We can defend against this attack by discarding the initial portion of the keystream. This modified algorithm is traditionally called RC4-drop.",run:Cipher.run_rc4drop,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[{name:"Passphrase",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"Input format",type:"option",value:Cipher.IO_FORMAT4},{name:"Output format",type:"option",value:Cipher.IO_FORMAT4},{name:"Number of bytes to drop",type:"number",value:Cipher.RC4DROP_BYTES}]},"Derive PBKDF2 key":{description:"PBKDF2 is a password-based key derivation function. In many applications of cryptography, user security is ultimately dependent on a password, and because a password usually can't be used directly as a cryptographic key, some processing is required.

                                      A salt provides a large set of keys for any given password, and an iteration count increases the cost of producing keys from a password, thereby also increasing the difficulty of attack.

                                      Enter your passphrase as the input and then set the relevant options to generate a key.",run:Cipher.run_pbkdf2,input_type:"string",output_type:"string",args:[{name:"Key size",type:"number",value:Cipher.KDF_KEY_SIZE},{name:"Iterations",type:"number",value:Cipher.KDF_ITERATIONS},{name:"Salt (hex)",type:"string",value:""},{name:"Input format",type:"option",value:Cipher.IO_FORMAT2},{name:"Output format",type:"option",value:Cipher.IO_FORMAT3}]},"Derive EVP key":{description:"EVP is a password-based key derivation function used extensively in OpenSSL. In many applications of cryptography, user security is ultimately dependent on a password, and because a password usually can't be used directly as a cryptographic key, some processing is required.

                                      A salt provides a large set of keys for any given password, and an iteration count increases the cost of producing keys from a password, thereby also increasing the difficulty of attack.

                                      Enter your passphrase as the input and then set the relevant options to generate a key.",run:Cipher.run_evpkdf,input_type:"string",output_type:"string",args:[{name:"Key size",type:"number",value:Cipher.KDF_KEY_SIZE},{name:"Iterations",type:"number",value:Cipher.KDF_ITERATIONS},{name:"Salt (hex)",type:"string",value:""},{name:"Input format",type:"option",value:Cipher.IO_FORMAT2},{name:"Output format",type:"option",value:Cipher.IO_FORMAT3}]},"Vigen\xe8re Encode":{description:"The Vigenere cipher is a method of encrypting alphabetic text by using a series of different Caesar ciphers based on the letters of a keyword. It is a simple form of polyalphabetic substitution.",run:Cipher.run_vigenere_enc,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[{name:"Key",type:"string",value:""}]},"Vigen\xe8re Decode":{description:"The Vigenere cipher is a method of encrypting alphabetic text by using a series of different Caesar ciphers based on the letters of a keyword. It is a simple form of polyalphabetic substitution.",run:Cipher.run_vigenere_dec,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[{name:"Key",type:"string",value:""}]},"Rotate right":{description:"Rotates each byte to the right by the number of bits specified. Currently only supports 8-bit values.",run:Rotate.run_rotr,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Number of bits",type:"number",value:Rotate.ROTATE_AMOUNT},{name:"Rotate as a whole",type:"boolean",value:Rotate.ROTATE_WHOLE}]},"Rotate left":{description:"Rotates each byte to the left by the number of bits specified. Currently only supports 8-bit values.",run:Rotate.run_rotl,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Number of bits",type:"number",value:Rotate.ROTATE_AMOUNT},{name:"Rotate as a whole",type:"boolean",value:Rotate.ROTATE_WHOLE}]},ROT13:{description:"A simple caesar substitution cipher which rotates alphabet characters by the specified amount (default 13).",run:Rotate.run_rot13,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Rotate lower case chars",type:"boolean",value:Rotate.ROT13_LOWERCASE},{name:"Rotate upper case chars",type:"boolean",value:Rotate.ROT13_UPPERCASE},{name:"Amount",type:"number",value:Rotate.ROT13_AMOUNT}]},ROT47:{description:"A slightly more complex variation of a caesar cipher, which includes ASCII characters from 33 '!' to 126 '~'. Default rotation: 47.",run:Rotate.run_rot47,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Amount", type:"number",value:Rotate.ROT47_AMOUNT}]},"Strip HTTP headers":{description:"Removes HTTP headers from a request or response by looking for the first instance of a double newline.",run:HTTP.run_strip_headers,input_type:"string",output_type:"string",args:[]},"Parse User Agent":{description:"Attempts to identify and categorise information contained in a user-agent string.",run:HTTP.run_parse_user_agent,input_type:"string",output_type:"string",args:[]},"Format MAC addresses":{description:"Displays given MAC addresses in multiple different formats.

                                      Expects addresses in a list separated by newlines, spaces or commas.

                                      WARNING: There are no validity checks.",run:MAC.run_format,input_type:"string",output_type:"string",args:[{name:"Output case",type:"option",value:MAC.OUTPUT_CASE},{name:"No delimiter",type:"boolean",value:MAC.NO_DELIM},{name:"Dash delimiter",type:"boolean",value:MAC.DASH_DELIM},{name:"Colon delimiter",type:"boolean",value:MAC.COLON_DELIM},{name:"Cisco style",type:"boolean",value:MAC.CISCO_STYLE}]},"Offset checker":{description:"Compares multiple inputs (separated by the specified delimiter) and highlights matching characters which appear at the same position in all samples.",run:StrUtils.run_offset_checker,input_type:"string",output_type:"html",args:[{name:"Sample delimiter",type:"binary_string",value:StrUtils.OFF_CHK_SAMPLE_DELIMITER}]},"Remove whitespace":{description:"Optionally removes all spaces, carriage returns, line feeds, tabs and form feeds from the input data.

                                      This operation also supports the removal of full stops which are sometimes used to represent non-printable bytes in ASCII output.",run:Tidy.run_remove_whitespace,input_type:"string",output_type:"string",args:[{name:"Spaces",type:"boolean",value:Tidy.REMOVE_SPACES},{name:"Carriage returns (\\r)",type:"boolean",value:Tidy.REMOVE_CARIAGE_RETURNS},{name:"Line feeds (\\n)",type:"boolean",value:Tidy.REMOVE_LINE_FEEDS},{name:"Tabs",type:"boolean",value:Tidy.REMOVE_TABS},{name:"Form feeds (\\f)",type:"boolean",value:Tidy.REMOVE_FORM_FEEDS},{name:"Full stops",type:"boolean",value:Tidy.REMOVE_FULL_STOPS}]},"Remove null bytes":{description:"Removes all null bytes (0x00) from the input.",run:Tidy.run_remove_nulls,input_type:"byte_array",output_type:"byte_array",args:[]},"Drop bytes":{description:"Cuts the specified number of bytes out of the data.",run:Tidy.run_drop_bytes,input_type:"byte_array",output_type:"byte_array",args:[{name:"Start",type:"number",value:Tidy.DROP_START},{name:"Length",type:"number",value:Tidy.DROP_LENGTH},{name:"Apply to each line",type:"boolean",value:Tidy.APPLY_TO_EACH_LINE}]},"Take bytes":{description:"Takes a slice of the specified number of bytes from the data.",run:Tidy.run_take_bytes,input_type:"byte_array",output_type:"byte_array",args:[{name:"Start",type:"number",value:Tidy.TAKE_START},{name:"Length",type:"number",value:Tidy.TAKE_LENGTH},{name:"Apply to each line",type:"boolean",value:Tidy.APPLY_TO_EACH_LINE}]},"Pad lines":{description:"Add the specified number of the specified character to the beginning or end of each line",run:Tidy.run_pad,input_type:"string",output_type:"string",args:[{name:"Position",type:"option",value:Tidy.PAD_POSITION},{name:"Length",type:"number",value:Tidy.PAD_LENGTH},{name:"Character",type:"binary_short_string",value:Tidy.PAD_CHAR}]},Reverse:{description:"Reverses the input string.",run:SeqUtils.run_reverse,input_type:"byte_array",output_type:"byte_array",args:[{name:"By",type:"option",value:SeqUtils.REVERSE_BY}]},Sort:{description:"Alphabetically sorts strings separated by the specified delimiter.

                                      The IP address option supports IPv4 only.",run:SeqUtils.run_sort,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"option",value:SeqUtils.DELIMITER_OPTIONS},{name:"Reverse",type:"boolean",value:SeqUtils.SORT_REVERSE},{name:"Order",type:"option",value:SeqUtils.SORT_ORDER}]},Unique:{description:"Removes duplicate strings from the input.",run:SeqUtils.run_unique,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"option",value:SeqUtils.DELIMITER_OPTIONS}]},"Count occurrences":{description:"Counts the number of times the provided string occurs in the input.",run:SeqUtils.run_count,input_type:"string",output_type:"number",args:[{name:"Search string",type:"toggle_string",value:"",toggle_values:SeqUtils.SEARCH_TYPE}]},"Add line numbers":{description:"Adds line numbers to the output.",run:SeqUtils.run_add_line_numbers,input_type:"string",output_type:"string",args:[]},"Remove line numbers":{description:"Removes line numbers from the output if they can be trivially detected.",run:SeqUtils.run_remove_line_numbers,input_type:"string",output_type:"string",args:[]},"Find / Replace":{description:"Replaces all occurrences of the first string with the second.

                                      The three match options are only relevant to regex search strings.",run:StrUtils.run_find_replace,manual_bake:!0,input_type:"string",output_type:"string",args:[{name:"Find",type:"toggle_string",value:"",toggle_values:StrUtils.SEARCH_TYPE},{name:"Replace",type:"binary_string",value:""},{name:"Global match",type:"boolean",value:StrUtils.FIND_REPLACE_GLOBAL},{name:"Case insensitive",type:"boolean",value:StrUtils.FIND_REPLACE_CASE},{name:"Multiline matching",type:"boolean",value:StrUtils.FIND_REPLACE_MULTILINE}]},"To Upper case":{description:"Converts the input string to upper case, optionally limiting scope to only the first character in each word, sentence or paragraph.",run:StrUtils.run_upper,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[{name:"Scope",type:"option",value:StrUtils.CASE_SCOPE}]},"To Lower case":{description:"Converts every character in the input to lower case.",run:StrUtils.run_lower,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[]},Split:{description:"Splits a string into sections around a given delimiter.",run:StrUtils.run_split,input_type:"string",output_type:"string",args:[{name:"Split delimiter",type:"binary_short_string",value:StrUtils.SPLIT_DELIM},{name:"Join delimiter",type:"option",value:StrUtils.DELIMITER_OPTIONS}]},Strings:{description:"Extracts all strings from the input.",run:Extract.run_strings,input_type:"string",output_type:"string",args:[{name:"Minimum length",type:"number",value:Extract.MIN_STRING_LEN},{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract IP addresses":{description:"Extracts all IPv4 and IPv6 addresses.

                                      Warning: Given a string 710.65.0.456, this will match 10.65.0.45 so always check the original input!",run:Extract.run_ip,input_type:"string",output_type:"string",args:[{name:"IPv4",type:"boolean",value:Extract.INCLUDE_IPV4},{name:"IPv6",type:"boolean",value:Extract.INCLUDE_IPV6},{name:"Remove local IPv4 addresses",type:"boolean",value:Extract.REMOVE_LOCAL},{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract email addresses":{description:"Extracts all email addresses from the input.",run:Extract.run_email,input_type:"string",output_type:"string",args:[{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract MAC addresses":{description:"Extracts all Media Access Control (MAC) addresses from the input.",run:Extract.run_mac,input_type:"string",output_type:"string",args:[{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract URLs":{description:"Extracts Uniform Resource Locators (URLs) from the input. The protocol (http, ftp etc.) is required otherwise there will be far too many false positives.",run:Extract.run_urls,input_type:"string",output_type:"string",args:[{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract domains":{description:"Extracts domain names with common Top-Level Domains (TLDs).
                                      Note that this will not include paths. Use Extract URLs to find entire URLs.",run:Extract.run_domains,input_type:"string",output_type:"string",args:[{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract file paths":{description:"Extracts anything that looks like a Windows or UNIX file path.

                                      Note that if UNIX is selected, there will likely be a lot of false positives.",run:Extract.run_file_paths,input_type:"string",output_type:"string",args:[{name:"Windows",type:"boolean",value:Extract.INCLUDE_WIN_PATH},{name:"UNIX",type:"boolean",value:Extract.INCLUDE_UNIX_PATH},{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract dates":{description:"Extracts dates in the following formats
                                      • yyyy-mm-dd
                                      • dd/mm/yyyy
                                      • mm/dd/yyyy
                                      Dividers can be any of /, -, . or space",run:Extract.run_dates,input_type:"string",output_type:"string",args:[{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Regular expression":{description:"Define your own regular expression to search the input data with, optionally choosing from a list of pre-defined patterns.",run:StrUtils.run_regex,manual_bake:!0,input_type:"string",output_type:"html",args:[{name:"Built in regexes",type:"populate_option",value:StrUtils.REGEX_PRE_POPULATE,target:1},{name:"Regex",type:"text",value:""},{name:"Case insensitive",type:"boolean",value:StrUtils.REGEX_CASE_INSENSITIVE},{name:"Multiline matching",type:"boolean",value:StrUtils.REGEX_MULTILINE_MATCHING},{name:"Display total",type:"boolean",value:StrUtils.DISPLAY_TOTAL},{name:"Output format",type:"option",value:StrUtils.OUTPUT_FORMAT}]},"XPath expression":{description:"Extract information from an XML document with an XPath query",run:Code.run_xpath,input_type:"string",output_type:"string",args:[{name:"XPath",type:"string",value:Code.XPATH_INITIAL},{name:"Result delimiter",type:"binary_short_string",value:Code.XPATH_DELIMITER}]},"CSS selector":{description:"Extract information from an HTML document with a CSS selector",run:Code.run_css_query,input_type:"string",output_type:"string",args:[{name:"CSS selector",type:"string",value:Code.CSS_SELECTOR_INITIAL},{name:"Delimiter",type:"binary_short_string",value:Code.CSS_QUERY_DELIMITER}]},"From UNIX Timestamp":{description:"Converts a UNIX timestamp to a datetime string.

                                      e.g. 978346800 becomes Mon 1 January 2001 11:00:00 UTC",run:DateTime.run_from_unix_timestamp,input_type:"number",output_type:"string",args:[{name:"Units",type:"option",value:DateTime.UNITS}]},"To UNIX Timestamp":{description:"Parses a datetime string and returns the corresponding UNIX timestamp.

                                      e.g. Mon 1 January 2001 11:00:00 UTC becomes 978346800",run:DateTime.run_to_unix_timestamp,input_type:"string",output_type:"number",args:[{name:"Units",type:"option",value:DateTime.UNITS}]},"Translate DateTime Format":{description:"Parses a datetime string in one format and re-writes it in another.

                                      Run with no input to see the relevant format string examples.",run:DateTime.run_translate_format,input_type:"string",output_type:"html",args:[{name:"Built in formats",type:"populate_option",value:DateTime.DATETIME_FORMATS,target:1},{name:"Input format string",type:"binary_string",value:DateTime.INPUT_FORMAT_STRING},{name:"Input timezone",type:"option",value:DateTime.TIMEZONES},{name:"Output format string",type:"binary_string",value:DateTime.OUTPUT_FORMAT_STRING},{name:"Output timezone",type:"option",value:DateTime.TIMEZONES}]},"Parse DateTime":{description:"Parses a DateTime string in your specified format and displays it in whichever timezone you choose with the following information:
                                      • Date
                                      • Time
                                      • Period (AM/PM)
                                      • Timezone
                                      • UTC offset
                                      • Daylight Saving Time
                                      • Leap year
                                      • Days in this month
                                      • Day of year
                                      • Week number
                                      • Quarter
                                      Run with no input to see format string examples if required.",run:DateTime.run_parse,input_type:"string",output_type:"html",args:[{name:"Built in formats",type:"populate_option",value:DateTime.DATETIME_FORMATS,target:1},{name:"Input format string",type:"binary_string",value:DateTime.INPUT_FORMAT_STRING},{name:"Input timezone",type:"option",value:DateTime.TIMEZONES}]},"Convert distance":{description:"Converts a unit of distance to another format.",run:Convert.run_distance,input_type:"number",output_type:"number",args:[{name:"Input units",type:"option",value:Convert.DISTANCE_UNITS},{name:"Output units",type:"option",value:Convert.DISTANCE_UNITS}]},"Convert area":{description:"Converts a unit of area to another format.",run:Convert.run_area,input_type:"number",output_type:"number",args:[{name:"Input units",type:"option",value:Convert.AREA_UNITS},{name:"Output units",type:"option",value:Convert.AREA_UNITS}]},"Convert mass":{description:"Converts a unit of mass to another format.",run:Convert.run_mass,input_type:"number",output_type:"number",args:[{name:"Input units",type:"option",value:Convert.MASS_UNITS},{name:"Output units",type:"option",value:Convert.MASS_UNITS}]},"Convert speed":{description:"Converts a unit of speed to another format.",run:Convert.run_speed,input_type:"number",output_type:"number",args:[{name:"Input units",type:"option",value:Convert.SPEED_UNITS},{name:"Output units",type:"option",value:Convert.SPEED_UNITS}]},"Convert data units":{description:"Converts a unit of data to another format.",run:Convert.run_data_size,input_type:"number",output_type:"number",args:[{name:"Input units",type:"option",value:Convert.DATA_UNITS},{name:"Output units",type:"option",value:Convert.DATA_UNITS}]},"Raw Deflate":{description:"Compresses data using the deflate algorithm with no headers.",run:Compress.run_raw_deflate,input_type:"byte_array",output_type:"byte_array",args:[{name:"Compression type",type:"option",value:Compress.COMPRESSION_TYPE}]},"Raw Inflate":{description:"Decompresses data which has been compressed using the deflate algorithm with no headers.",run:Compress.run_raw_inflate,input_type:"byte_array",output_type:"byte_array",args:[{name:"Start index",type:"number",value:Compress.INFLATE_INDEX},{name:"Initial output buffer size",type:"number",value:Compress.INFLATE_BUFFER_SIZE},{name:"Buffer expansion type",type:"option",value:Compress.INFLATE_BUFFER_TYPE},{name:"Resize buffer after decompression",type:"boolean",value:Compress.INFLATE_RESIZE},{name:"Verify result",type:"boolean",value:Compress.INFLATE_VERIFY}]},"Zlib Deflate":{description:"Compresses data using the deflate algorithm adding zlib headers.",run:Compress.run_zlib_deflate,input_type:"byte_array",output_type:"byte_array",args:[{name:"Compression type",type:"option",value:Compress.COMPRESSION_TYPE}]},"Zlib Inflate":{description:"Decompresses data which has been compressed using the deflate algorithm with zlib headers.",run:Compress.run_zlib_inflate,input_type:"byte_array",output_type:"byte_array",args:[{name:"Start index",type:"number",value:Compress.INFLATE_INDEX},{name:"Initial output buffer size",type:"number",value:Compress.INFLATE_BUFFER_SIZE},{name:"Buffer expansion type",type:"option",value:Compress.INFLATE_BUFFER_TYPE},{name:"Resize buffer after decompression",type:"boolean",value:Compress.INFLATE_RESIZE},{name:"Verify result",type:"boolean",value:Compress.INFLATE_VERIFY}]},Gzip:{description:"Compresses data using the deflate algorithm with gzip headers.",run:Compress.run_gzip,input_type:"byte_array",output_type:"byte_array",args:[{name:"Compression type",type:"option",value:Compress.COMPRESSION_TYPE},{name:"Filename (optional)",type:"string",value:""},{name:"Comment (optional)",type:"string",value:""},{name:"Include file checksum",type:"boolean",value:Compress.GZIP_CHECKSUM}]},Gunzip:{description:"Decompresses data which has been compressed using the deflate algorithm with gzip headers.",run:Compress.run_gunzip,input_type:"byte_array",output_type:"byte_array",args:[]},Zip:{description:"Compresses data using the PKZIP algorithm with the given filename.

                                      No support for multiple files at this time.",run:Compress.run_pkzip,input_type:"byte_array",output_type:"byte_array",args:[{name:"Filename",type:"string",value:Compress.PKZIP_FILENAME},{name:"Comment",type:"string",value:""},{name:"Password",type:"binary_string",value:""},{name:"Compression method",type:"option",value:Compress.COMPRESSION_METHOD},{name:"Operating system",type:"option",value:Compress.OS},{name:"Compression type",type:"option",value:Compress.COMPRESSION_TYPE}]},Unzip:{description:"Decompresses data using the PKZIP algorithm and displays it per file, with support for passwords.",run:Compress.run_pkunzip,input_type:"byte_array",output_type:"html",args:[{name:"Password",type:"binary_string",value:""},{name:"Verify result",type:"boolean",value:Compress.PKUNZIP_VERIFY}]},"Bzip2 Decompress":{description:"Decompresses data using the Bzip2 algorithm.",run:Compress.run_bzip2_decompress,input_type:"byte_array",output_type:"string",args:[]},"Generic Code Beautify":{description:"Attempts to pretty print C-style languages such as C, C++, C#, Java, PHP, JavaScript etc.

                                      This will not do a perfect job, and the resulting code may not work any more. This operation is designed purely to make obfuscated or minified code more easy to read and understand.

                                      Things which will not work properly:
                                      • For loop formatting
                                      • Do-While loop formatting
                                      • Switch/Case indentation
                                      • Certain bit shift operators
                                      ",run:Code.run_generic_beautify,input_type:"string",output_type:"string",args:[]},"JavaScript Parser":{description:"Returns an Abstract Syntax Tree for valid JavaScript code.",run:JS.run_parse,input_type:"string",output_type:"string",args:[{name:"Location info",type:"boolean",value:JS.PARSE_LOC},{name:"Range info",type:"boolean",value:JS.PARSE_RANGE},{name:"Include tokens array",type:"boolean",value:JS.PARSE_TOKENS},{name:"Include comments array",type:"boolean",value:JS.PARSE_COMMENT},{name:"Report errors and try to continue",type:"boolean",value:JS.PARSE_TOLERANT}]},"JavaScript Beautify":{description:"Parses and pretty prints valid JavaScript code. Also works with JavaScript Object Notation (JSON).",run:JS.run_beautify,input_type:"string",output_type:"string",args:[{name:"Indent string",type:"binary_short_string",value:JS.BEAUTIFY_INDENT},{name:"Quotes",type:"option",value:JS.BEAUTIFY_QUOTES},{name:"Semicolons before closing braces",type:"boolean",value:JS.BEAUTIFY_SEMICOLONS},{name:"Include comments",type:"boolean",value:JS.BEAUTIFY_COMMENT}]},"JavaScript Minify":{description:"Compresses JavaScript code.",run:JS.run_minify,input_type:"string",output_type:"string",args:[]},"XML Beautify":{description:"Indents and prettifies eXtensible Markup Language (XML) code.",run:Code.run_xml_beautify,input_type:"string",output_type:"string",args:[{name:"Indent string",type:"binary_short_string",value:Code.BEAUTIFY_INDENT}]},"JSON Beautify":{description:"Indents and prettifies JavaScript Object Notation (JSON) code.",run:Code.run_json_beautify,input_type:"string",output_type:"string",args:[{name:"Indent string",type:"binary_short_string",value:Code.BEAUTIFY_INDENT}]},"CSS Beautify":{description:"Indents and prettifies Cascading Style Sheets (CSS) code.",run:Code.run_css_beautify,input_type:"string",output_type:"string",args:[{name:"Indent string",type:"binary_short_string",value:Code.BEAUTIFY_INDENT}]},"SQL Beautify":{description:"Indents and prettifies Structured Query Language (SQL) code.",run:Code.run_sql_beautify,input_type:"string",output_type:"string",args:[{name:"Indent string",type:"binary_short_string",value:Code.BEAUTIFY_INDENT}]},"XML Minify":{description:"Compresses eXtensible Markup Language (XML) code.",run:Code.run_xml_minify,input_type:"string",output_type:"string",args:[{name:"Preserve comments",type:"boolean",value:Code.PRESERVE_COMMENTS}]},"JSON Minify":{description:"Compresses JavaScript Object Notation (JSON) code.",run:Code.run_json_minify,input_type:"string",output_type:"string",args:[]},"CSS Minify":{description:"Compresses Cascading Style Sheets (CSS) code.",run:Code.run_css_minify,input_type:"string",output_type:"string",args:[{name:"Preserve comments",type:"boolean",value:Code.PRESERVE_COMMENTS}]},"SQL Minify":{description:"Compresses Structured Query Language (SQL) code.",run:Code.run_sql_minify,input_type:"string",output_type:"string",args:[]},"Analyse hash":{description:"Tries to determine information about a given hash and suggests which algorithm may have been used to generate it based on its length.",run:Hash.run_analyse,input_type:"string",output_type:"string",args:[]},MD5:{description:"MD5 (Message-Digest 5) is a widely used hash function. It has been used in a variety of security applications and is also commonly used to check the integrity of files.

                                      However, MD5 is not collision resistant and it isn't suitable for applications like SSL/TLS certificates or digital signatures that rely on this property.",run:Hash.run_md5,input_type:"string",output_type:"string",args:[]},SHA1:{description:"The SHA (Secure Hash Algorithm) hash functions were designed by the NSA. SHA-1 is the most established of the existing SHA hash functions and it is used in a variety of security applications and protocols.

                                      However, SHA-1's collision resistance has been weakening as new attacks are discovered or improved.",run:Hash.run_sha1,input_type:"string",output_type:"string",args:[]},SHA224:{description:"SHA-224 is largely identical to SHA-256 but is truncated to 224 bytes.",run:Hash.run_sha224,input_type:"string",output_type:"string",args:[]},SHA256:{description:"SHA-256 is one of the four variants in the SHA-2 set. It isn't as widely used as SHA-1, though it provides much better security.",run:Hash.run_sha256,input_type:"string",output_type:"string",args:[]},SHA384:{description:"SHA-384 is largely identical to SHA-512 but is truncated to 384 bytes.",run:Hash.run_sha384,input_type:"string",output_type:"string",args:[]},SHA512:{description:"SHA-512 is largely identical to SHA-256 but operates on 64-bit words rather than 32.",run:Hash.run_sha512,input_type:"string",output_type:"string",args:[]},SHA3:{description:"This is an implementation of Keccak[c=2d]. SHA3 functions based on different implementations of Keccak will give different results.",run:Hash.run_sha3,input_type:"string",output_type:"string",args:[{name:"Output length",type:"option",value:Hash.SHA3_LENGTH}]},"RIPEMD-160":{description:"RIPEMD (RACE Integrity Primitives Evaluation Message Digest) is a family of cryptographic hash functions developed in Leuven, Belgium, by Hans Dobbertin, Antoon Bosselaers and Bart Preneel at the COSIC research group at the Katholieke Universiteit Leuven, and first published in 1996.

                                      RIPEMD was based upon the design principles used in MD4, and is similar in performance to the more popular SHA-1.

                                      RIPEMD-160 is an improved, 160-bit version of the original RIPEMD, and the most common version in the family.",run:Hash.run_ripemd160,input_type:"string",output_type:"string",args:[]},HMAC:{description:"Keyed-Hash Message Authentication Codes (HMAC) are a mechanism for message authentication using cryptographic hash functions.",run:Hash.run_hmac,input_type:"string",output_type:"string",args:[{name:"Password",type:"binary_string",value:""},{name:"Hashing function",type:"option",value:Hash.HMAC_FUNCTIONS}]},"Fletcher-16 Checksum":{description:"The Fletcher checksum is an algorithm for computing a position-dependent checksum devised by John Gould Fletcher at Lawrence Livermore Labs in the late 1970s.

                                      The objective of the Fletcher checksum was to provide error-detection properties approaching those of a cyclic redundancy check but with the lower computational effort associated with summation techniques.",run:Checksum.run_fletcher16,input_type:"byte_array",output_type:"string",args:[]},"Adler-32 Checksum":{description:"Adler-32 is a checksum algorithm which was invented by Mark Adler in 1995, and is a modification of the Fletcher checksum. Compared to a cyclic redundancy check of the same length, it trades reliability for speed (preferring the latter).

                                      Adler-32 is more reliable than Fletcher-16, and slightly less reliable than Fletcher-32.",run:Checksum.run_adler32,input_type:"byte_array",output_type:"string",args:[]},"CRC-32 Checksum":{description:"A cyclic redundancy check (CRC) is an error-detecting code commonly used in digital networks and storage devices to detect accidental changes to raw data.

                                      The CRC was invented by W. Wesley Peterson in 1961; the 32-bit CRC function of Ethernet and many other standards is the work of several researchers and was published in 1975.",run:Checksum.run_crc32,input_type:"byte_array",output_type:"string",args:[]},"Generate all hashes":{description:"Generates all available hashes and checksums for the input.",run:Hash.run_all,input_type:"string",output_type:"string",args:[]},Entropy:{description:"Calculates the Shannon entropy of the input data which gives an idea of its randomness. 8 is the maximum.",run:Entropy.run_entropy,input_type:"byte_array",output_type:"html",args:[{name:"Chunk size",type:"number",value:Entropy.CHUNK_SIZE}]},"Frequency distribution":{description:"Displays the distribution of bytes in the data as a graph.",run:Entropy.run_freq_distrib,input_type:"byte_array",output_type:"html",args:[{name:"Show 0%'s",type:"boolean",value:Entropy.FREQ_ZEROS}]},Numberwang:{description:"Based on the popular gameshow by Mitchell and Webb.",run:Numberwang.run,input_type:"string",output_type:"string",args:[]},"Parse X.509 certificate":{description:"X.509 is an ITU-T standard for a public key infrastructure (PKI) and Privilege Management Infrastructure (PMI). It is commonly involved with SSL/TLS security.

                                      This operation displays the contents of a certificate in a human readable format, similar to the openssl command line tool.",run:PublicKey.run_parse_x509,input_type:"string",output_type:"string",args:[{name:"Input format",type:"option",value:PublicKey.X509_INPUT_FORMAT}]},"PEM to Hex":{description:"Converts PEM (Privacy Enhanced Mail) format to a hexadecimal DER (Distinguished Encoding Rules) string.",run:PublicKey.run_pem_to_hex,input_type:"string",output_type:"string",args:[]},"Hex to PEM":{description:"Converts a hexadecimal DER (Distinguished Encoding Rules) string into PEM (Privacy Enhanced Mail) format.",run:PublicKey.run_hex_to_pem,input_type:"string",output_type:"string",args:[{name:"Header string",type:"string",value:PublicKey.PEM_HEADER_STRING}]},"Hex to Object Identifier":{description:"Converts a hexadecimal string into an object identifier (OID).",run:PublicKey.run_hex_to_object_identifier,input_type:"string",output_type:"string",args:[]},"Object Identifier to Hex":{description:"Converts an object identifier (OID) into a hexadecimal string.",run:PublicKey.run_object_identifier_to_hex,input_type:"string",output_type:"string",args:[]},"Parse ASN.1 hex string":{description:"Abstract Syntax Notation One (ASN.1) is a standard and notation that describes rules and structures for representing, encoding, transmitting, and decoding data in telecommunications and computer networking.

                                      This operation parses arbitrary ASN.1 data and presents the resulting tree.",run:PublicKey.run_parse_asn1_hex_string,input_type:"string",output_type:"string",args:[{name:"Starting index",type:"number",value:0},{name:"Truncate octet strings longer than",type:"number",value:PublicKey.ASN1_TRUNCATE_LENGTH}]},"Detect File Type":{description:"Attempts to guess the MIME (Multipurpose Internet Mail Extensions) type of the data based on 'magic bytes'.

                                      Currently supports the following file types: 7z, amr, avi, bmp, bz2, class, cr2, crx, dex, dmg, doc, elf, eot, epub, exe, flac, flv, gif, gz, ico, iso, jpg, jxr, m4a, m4v, mid, mkv, mov, mp3, mp4, mpg, ogg, otf, pdf, png, ppt, ps, psd, rar, rtf, sqlite, swf, tar, tar.z, tif, ttf, utf8, vmdk, wav, webm, webp, wmv, woff, woff2, xls, xz, zip.",run:FileType.run_detect,input_type:"byte_array",output_type:"string",args:[]},"Scan for Embedded Files":{description:"Scans the data for potential embedded files by looking for magic bytes at all offsets. This operation is prone to false positives.

                                      WARNING: Files over about 100KB in size will take a VERY long time to process.",run:FileType.run_scan_for_embedded_files,input_type:"byte_array",output_type:"string",args:[{name:"Ignore common byte sequences",type:"boolean",value:FileType.IGNORE_COMMON_BYTE_SEQUENCES}]},"Expand alphabet range":{description:"Expand an alphabet range string into a list of the characters in that range.

                                      e.g. a-z becomes abcdefghijklmnopqrstuvwxyz.",run:SeqUtils.run_expand_alph_range,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"binary_string",value:""}]},Diff:{description:"Compares two inputs (separated by the specified delimiter) and highlights the differences between them.",run:StrUtils.run_diff,input_type:"string",output_type:"html",args:[{name:"Sample delimiter",type:"binary_string",value:StrUtils.DIFF_SAMPLE_DELIMITER},{name:"Diff by",type:"option",value:StrUtils.DIFF_BY},{name:"Show added",type:"boolean",value:!0},{name:"Show removed",type:"boolean",value:!0},{name:"Ignore whitespace (relevant for word and line)",type:"boolean",value:!1}]},"Parse UNIX file permissions":{description:"Given a UNIX/Linux file permission string in octal or textual format, this operation explains which permissions are granted to which user groups.

                                      Input should be in either octal (e.g. 755) or textual (e.g. drwxr-xr-x) format.",run:OS.run_parse_unix_perms,input_type:"string",output_type:"string",args:[]},"Swap endianness":{description:"Switches the data from big-endian to little-endian or vice-versa. Data can be read in as hexadecimal or raw bytes. It will be returned in the same format as it is entered.",run:Endian.run_swap_endianness,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[{name:"Data format",type:"option",value:Endian.DATA_FORMAT},{name:"Word length (bytes)",type:"number",value:Endian.WORD_LENGTH},{name:"Pad incomplete words",type:"boolean",value:Endian.PAD_INCOMPLETE_WORDS}]},"Syntax highlighter":{description:"Adds syntax highlighting to a range of source code languages. Note that this will not indent the code. Use one of the 'Beautify' operations for that.",run:Code.run_syntax_highlight,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"html",args:[{name:"Language/File extension",type:"option",value:Code.LANGUAGES},{name:"Display line numbers",type:"boolean",value:Code.LINE_NUMS}]},"Parse escaped string":{description:"Replaces escaped characters with the bytes they represent.

                                      e.g.Hello\\nWorld becomes Hello
                                      World
                                      ",run:StrUtils.run_parse_escaped_string,input_type:"string",output_type:"string",args:[]},"TCP/IP Checksum":{description:"Calculates the checksum for a TCP (Transport Control Protocol) or IP (Internet Protocol) header from an input of raw bytes.",run:Checksum.run_tcp_ip,input_type:"byte_array",output_type:"string",args:[]},"Parse colour code":{description:"Converts a colour code in a standard format to other standard formats and displays the colour itself.

                                      Example inputs
                                      • #d9edf7
                                      • rgba(217,237,247,1)
                                      • hsla(200,65%,91%,1)
                                      • cmyk(0.12, 0.04, 0.00, 0.03)
                                      ",run:HTML.run_parse_colour_code,input_type:"string",output_type:"html",args:[]},"Generate UUID":{description:"Generates an RFC 4122 version 4 compliant Universally Unique Identifier (UUID), also known as a Globally Unique Identifier (GUID).

                                      A version 4 UUID relies on random numbers, in this case generated using window.crypto if available and falling back to Math.random if not.",run:UUID.run_generate_v4,input_type:"string",output_type:"string",args:[]}};var ControlsWaiter=function(a,b){this.app=a,this.manager=b; -};ControlsWaiter.prototype.adjust_width=function(){var a=document.getElementById("controls"),b=document.getElementById("step"),c=document.getElementById("clr-breaks"),d=document.querySelector("#save img"),e=document.querySelector("#load img"),f=document.querySelector("#step img"),g=document.querySelector("#clr-recipe img"),h=document.querySelector("#clr-breaks img");a.clientWidth<470?b.childNodes[1].nodeValue=" Step":b.childNodes[1].nodeValue=" Step through",a.clientWidth<400?(d.style.display="none",e.style.display="none",f.style.display="none",g.style.display="none",h.style.display="none"):(d.style.display="inline",e.style.display="inline",f.style.display="inline",g.style.display="inline",h.style.display="inline"),a.clientWidth<330?c.childNodes[1].nodeValue=" Clear breaks":c.childNodes[1].nodeValue=" Clear breakpoints"},ControlsWaiter.prototype.set_auto_bake=function(a){var b=document.getElementById("auto-bake");b.checked!==a&&b.click()},ControlsWaiter.prototype.bake_click=function(){this.app.bake(),$("#output-text").selectRange(0)},ControlsWaiter.prototype.step_click=function(){this.app.bake(!0),$("#output-text").selectRange(0)},ControlsWaiter.prototype.auto_bake_change=function(){var a=document.getElementById("auto-bake-label"),b=document.getElementById("auto-bake");this.app.auto_bake_=b.checked,b.checked?(a.classList.remove("btn-default"),a.classList.add("btn-success")):(a.classList.remove("btn-success"),a.classList.add("btn-default"))},ControlsWaiter.prototype.clear_recipe_click=function(){this.manager.recipe.clear_recipe()},ControlsWaiter.prototype.clear_breaks_click=function(){for(var a=document.querySelectorAll("#rec_list li.operation .breakpoint"),b=0;b0,b=b&&f.length>0&&f.length<8e3,a&&(d+="?recipe="+encodeURIComponent(e)),a&&b?d+="&input="+encodeURIComponent(f):b&&(d+="?input="+encodeURIComponent(f)),d},ControlsWaiter.prototype.save_text_change=function(){try{var a=JSON.parse(document.getElementById("save-text").value);this.initialise_save_link(a)}catch(a){}},ControlsWaiter.prototype.save_click=function(){var a=this.app.get_recipe_config(),b=JSON.stringify(a).replace(/},{/g,"},\n{");document.getElementById("save-text").value=b,this.initialise_save_link(a),$("#save-modal").modal()},ControlsWaiter.prototype.slr_check_change=function(){this.initialise_save_link()},ControlsWaiter.prototype.sli_check_change=function(){this.initialise_save_link()},ControlsWaiter.prototype.load_click=function(){this.populate_load_recipes_list(),$("#load-modal").modal()},ControlsWaiter.prototype.save_button_click=function(){var a=document.getElementById("save-name").value,b=document.getElementById("save-text").value;if(!a)return void this.app.alert("Please enter a recipe name","danger",2e3);var c=localStorage.saved_recipes?JSON.parse(localStorage.saved_recipes):[],d=localStorage.recipe_id||0;c.push({id:++d,name:a,recipe:b}),localStorage.saved_recipes=JSON.stringify(c),localStorage.recipe_id=d,this.app.alert('Recipe saved as "'+a+'".',"success",2e3)},ControlsWaiter.prototype.populate_load_recipes_list=function(){for(var a=document.getElementById("load-name"),b=a.options.length;b--;)a.remove(b);var c=localStorage.saved_recipes?JSON.parse(localStorage.saved_recipes):[];for(b=0;bend: "+e+"
                                      length: "+f},HighlighterWaiter.prototype.remove_highlights=function(){document.getElementById("input-highlighter").innerHTML="",document.getElementById("output-highlighter").innerHTML="",document.getElementById("input-selection-info").innerHTML="",document.getElementById("output-selection-info").innerHTML=""},HighlighterWaiter.prototype.generate_highlight_list=function(){for(var a=this.app.get_recipe_config(),b=[],c=0;c=0)return!1;var d="[start_highlight]",e=/\[start_highlight\]/g,f="[end_highlight]",g=/\[end_highlight\]/g,h=a.value;if(1===c.length){if(c[0].end/g,">").replace(/\n/g," ").replace(e,'').replace(g,"")+" ",b.style.width=a.clientWidth+"px",b.innerHTML=h,b.scrollTop=a.scrollTop,b.scrollLeft=a.scrollLeft};var HTMLApp=function(a,b,c,d){this.categories=a,this.operations=b,this.dfavourites=c,this.doptions=d,this.options=Utils.extend({},d),this.chef=new Chef,this.manager=new Manager(this),this.auto_bake_=!1,this.progress=0,this.ing_id=0,window.chef=this.chef};HTMLApp.prototype.setup=function(){document.dispatchEvent(this.manager.appstart),this.initialise_splitter(),this.load_local_storage(),this.populate_operations_list(),this.manager.setup(),this.reset_layout(),this.set_compile_message(),this.load_URI_params()},HTMLApp.prototype.handle_error=function(a){console.error(a);var b=a.display_str||a.toString();this.alert(b,"danger",this.options.error_timeout,!this.options.show_errors)},HTMLApp.prototype.bake=function(a){var b;try{b=this.chef.bake(this.get_input(),this.get_recipe_config(),this.options,this.progress,a)}catch(a){this.handle_error(a)}b&&(b.error&&this.handle_error(b.error),this.options=b.options,this.dish_str="html"===b.type?Utils.strip_html_tags(b.result,!0):b.result,this.progress=b.progress,this.manager.recipe.update_breakpoint_indicator(b.progress),this.manager.output.set(b.result,b.type,b.duration),b.duration>this.options.auto_bake_threshold&&this.auto_bake_&&(this.manager.controls.set_auto_bake(!1),this.alert("Baking took longer than "+this.options.auto_bake_threshold+"ms, Auto Bake has been disabled.","warning",5e3)))},HTMLApp.prototype.auto_bake=function(){this.auto_bake_&&this.bake()},HTMLApp.prototype.silent_bake=function(){var a=(new Date).getTime(),b=this.get_recipe_config();return this.auto_bake_&&this.chef.silent_bake(b),(new Date).getTime()-a},HTMLApp.prototype.get_input=function(){var a=this.manager.input.get();return sessionStorage.setItem("input_length",a.length),sessionStorage.setItem("input",a),a},HTMLApp.prototype.set_input=function(a){sessionStorage.setItem("input_length",a.length),sessionStorage.setItem("input",a),this.manager.input.set(a)},HTMLApp.prototype.populate_operations_list=function(){document.body.appendChild(document.getElementById("edit-favourites"));for(var a="",b=0;b2?JSON.parse(localStorage.favourites):this.dfavourites;a=this.valid_favourites(a),this.save_favourites(a);var b=this.categories.filter(function(a){return"Favourites"===a.name})[0];b?b.ops=a:this.categories.unshift({name:"Favourites",ops:a})},HTMLApp.prototype.valid_favourites=function(a){for(var b=[],c=0;c=0?void this.alert("'"+a+"' is already in your favourites","info",2e3):(b.push(a),this.save_favourites(b),this.load_favourites(),this.populate_operations_list(),void this.manager.recipe.initialise_operation_drag_n_drop())},HTMLApp.prototype.load_URI_params=function(){this.query_string=function(a){if(""===a)return{};for(var b={},c=0;c"):d[e].value=a[b].args[e];a[b].disabled&&c.querySelector(".disable-icon").click(),a[b].breakpoint&&c.querySelector(".breakpoint").click(),this.progress=0}},HTMLApp.prototype.reset_layout=function(){this.column_splitter.setSizes([20,30,50]),this.io_splitter.setSizes([50,50]),this.manager.controls.adjust_width()},HTMLApp.prototype.set_compile_message=function(){var a=new Date,b=Utils.fuzzy_time(a.getTime()-window.compile_time),c='Last build: '+b.substr(0,1).toUpperCase()+b.substr(1)+" ago";""!==window.compile_message&&(c+=" - "+window.compile_message),c+="",document.getElementById("notice").innerHTML=c},HTMLApp.prototype.alert=function(a,b,c,d){var e=new Date;if(console.log("["+e.toLocaleString()+"] "+a),!d){b=b||"danger",c=c||0;var f=document.getElementById("alert"),g=document.getElementById("alert-content");f.classList.remove("alert-danger"),f.classList.remove("alert-warning"),f.classList.remove("alert-info"),f.classList.remove("alert-success"),f.classList.add("alert-"+b),"block"===f.style.display?g.innerHTML+="

                                      ["+e.toLocaleTimeString()+"] "+a:g.innerHTML="["+e.toLocaleTimeString()+"] "+a,$("#alert").stop(),f.style.display="block",f.style.opacity=1,c>0&&(clearTimeout(this.alert_timeout),this.alert_timeout=setTimeout(function(){$("#alert").slideUp(100)},c))}},HTMLApp.prototype.confirm=function(a,b,c,d){d=d||this,document.getElementById("confirm-title").innerHTML=a,document.getElementById("confirm-body").innerHTML=b,document.getElementById("confirm-modal").style.display="block",this.confirm_closed=!1,$("#confirm-modal").modal().one("show.bs.modal",function(a){this.confirm_closed=!1}.bind(this)).one("click","#confirm-yes",function(){this.confirm_closed=!0,c.bind(d)(!0),$("#confirm-modal").modal("hide")}.bind(this)).one("hide.bs.modal",function(a){this.confirm_closed||c.bind(d)(!1),this.confirm_closed=!0}.bind(this))},HTMLApp.prototype.alert_close_click=function(){document.getElementById("alert").style.display="none"},HTMLApp.prototype.state_change=function(a){this.auto_bake(),this.options.update_url&&(this.last_state_url=this.manager.controls.generate_state_url(!0,!0),window.history.replaceState({},"CyberChef",this.last_state_url))},HTMLApp.prototype.pop_state=function(a){window.location.href.split("#")[0]!==this.last_state_url&&this.load_URI_params()},HTMLApp.prototype.call_api=function(a,b,c,d,e){b=b||"POST",c=c||{},d=d||void 0,e=e||"application/json";var f=null,g=!1;return $.ajax({url:a,async:!1,type:b,data:c,dataType:d,contentType:e,success:function(a){g=!0,f=a},error:function(a){g=!1,f=a}}),{success:g,response:f}};var HTMLCategory=function(a,b){this.name=a,this.selected=b,this.op_list=[]};HTMLCategory.prototype.add_operation=function(a){this.op_list.push(a)},HTMLCategory.prototype.to_html=function(){for(var a="cat"+this.name.replace(/[\s\/-:_]/g,""),b="
                                      "+this.name+"
                                        ",c=0;c 
                                      ";switch(d+="
                                      ",this.type){case"string":case"binary_string":case"byte_array":d+="";break;case"short_string":case"binary_short_string":d+="";break;case"toggle_string":for(d+="
                                      ";break;case"number":d+="";break;case"boolean":d+="",this.disable_args&&this.manager.add_dynamic_listener("#"+this.id,"click",this.toggle_disable_args,this);break;case"option":for(d+="";break;case"populate_option":for(d+="",this.manager.add_dynamic_listener("#"+this.id,"change",this.populate_option_change,this);break;case"editable_option":for(d+="
                                      ",d+="",d+="",d+="
                                      ",this.manager.add_dynamic_listener("#sel-"+this.id,"change",this.editable_option_change,this);break;case"text":d+=""}return d+="
                                      "},HTMLIngredient.prototype.toggle_disable_args=function(a){for(var b,c=a.target,d=c.parentNode.parentNode,e=d.querySelectorAll(".arg-group"),f=0;f"),this.description&&(b+=""),b+=""},HTMLOperation.prototype.to_full_html=function(){for(var a="
                                      "+this.name+"
                                      ",b=0;b=0&&(this.name=this.name.slice(0,b)+""+this.name.slice(b,b+a.length)+""+this.name.slice(b+a.length)),this.description&&c>=0&&(this.description=this.description.slice(0,c)+""+this.description.slice(c,c+a.length)+""+this.description.slice(c+a.length))};var InputWaiter=function(a,b){this.app=a,this.manager=b,this.bad_keys=[16,17,18,19,20,27,33,34,35,36,37,38,39,40,44,91,92,93,112,113,114,115,116,117,118,119,120,121,122,123,144,145]};InputWaiter.prototype.get=function(){return document.getElementById("input-text").value},InputWaiter.prototype.set=function(a){document.getElementById("input-text").value=a,window.dispatchEvent(this.manager.statechange)},InputWaiter.prototype.set_input_info=function(a,b){var c=a.toString().length;c=c<2?2:c;var d=Utils.pad(a.toString(),c," ").replace(/ /g," "),e=Utils.pad(b.toString(),c," ").replace(/ /g," ");document.getElementById("input-info").innerHTML="length: "+d+"
                                      lines: "+e},InputWaiter.prototype.input_change=function(a){this.manager.highlighter.remove_highlights(),this.app.progress=0;var b=this.get(),c=b.count("\n")+1;this.set_input_info(b.length,c),this.bad_keys.indexOf(a.keyCode)<0&&window.dispatchEvent(this.manager.statechange)},InputWaiter.prototype.input_dragover=function(a){return"move"!==a.dataTransfer.effectAllowed&&(a.stopPropagation(),a.preventDefault(),void a.target.classList.add("dropping-file"))},InputWaiter.prototype.input_dragleave=function(a){a.stopPropagation(),a.preventDefault(),a.target.classList.remove("dropping-file")},InputWaiter.prototype.input_drop=function(a){if("move"===a.dataTransfer.effectAllowed)return!1;a.stopPropagation(),a.preventDefault();var b=a.target,c=a.dataTransfer.files[0],d=a.dataTransfer.getData("Text"),e=new FileReader,f="",g=0,h=20480,i=function(){f.length>1e5&&this.app.auto_bake_&&(this.manager.controls.set_auto_bake(!1),this.app.alert("Turned off Auto Bake as the input is large","warning",5e3)),this.set(f);var a=this.app.get_recipe_config();a[0]&&"From Hex"===a[0].op||(a.unshift({op:"From Hex",args:["Space"]}),this.app.set_recipe_config(a)),b.classList.remove("loading_file")}.bind(this),j=function(){if(g>=c.size)return void i();b.value="Processing... "+Math.round(g/c.size*100)+"%";var a=c.slice(g,g+h);e.readAsArrayBuffer(a)};e.onload=function(a){var b=new Uint8Array(e.result);f+=Utils.to_hex_fast(b),g+=h,j()},b.classList.remove("dropping-file"),c?(b.classList.add("loading_file"),j()):d&&this.set(d)},InputWaiter.prototype.clear_io_click=function(){this.manager.highlighter.remove_highlights(),document.getElementById("input-text").value="",document.getElementById("output-text").value="",document.getElementById("input-info").innerHTML="",document.getElementById("output-info").innerHTML="",document.getElementById("input-selection-info").innerHTML="",document.getElementById("output-selection-info").innerHTML="",window.dispatchEvent(this.manager.statechange)};var Manager=function(a){this.app=a,this.appstart=new CustomEvent("appstart",{bubbles:!0}),this.operationadd=new CustomEvent("operationadd",{bubbles:!0}),this.operationremove=new CustomEvent("operationremove",{bubbles:!0}),this.oplistcreate=new CustomEvent("oplistcreate",{bubbles:!0}),this.statechange=new CustomEvent("statechange",{bubbles:!0}),this.window=new WindowWaiter(this.app),this.controls=new ControlsWaiter(this.app,this),this.recipe=new RecipeWaiter(this.app,this),this.ops=new OperationsWaiter(this.app,this),this.input=new InputWaiter(this.app,this),this.output=new OutputWaiter(this.app,this),this.options=new OptionsWaiter(this.app),this.highlighter=new HighlighterWaiter(this.app),this.seasonal=new SeasonalWaiter(this.app,this), -this.dynamic_handlers={},this.initialise_event_listeners()};Manager.prototype.setup=function(){this.recipe.initialise_operation_drag_n_drop(),this.controls.auto_bake_change(),this.seasonal.load()},Manager.prototype.initialise_event_listeners=function(){window.addEventListener("resize",this.window.window_resize.bind(this.window)),window.addEventListener("blur",this.window.window_blur.bind(this.window)),window.addEventListener("focus",this.window.window_focus.bind(this.window)),window.addEventListener("statechange",this.app.state_change.bind(this.app)),window.addEventListener("popstate",this.app.pop_state.bind(this.app)),document.getElementById("bake").addEventListener("click",this.controls.bake_click.bind(this.controls)),document.getElementById("auto-bake").addEventListener("change",this.controls.auto_bake_change.bind(this.controls)),document.getElementById("step").addEventListener("click",this.controls.step_click.bind(this.controls)),document.getElementById("clr-recipe").addEventListener("click",this.controls.clear_recipe_click.bind(this.controls)),document.getElementById("clr-breaks").addEventListener("click",this.controls.clear_breaks_click.bind(this.controls)),document.getElementById("save").addEventListener("click",this.controls.save_click.bind(this.controls)),document.getElementById("save-button").addEventListener("click",this.controls.save_button_click.bind(this.controls)),document.getElementById("save-link-recipe-checkbox").addEventListener("change",this.controls.slr_check_change.bind(this.controls)),document.getElementById("save-link-input-checkbox").addEventListener("change",this.controls.sli_check_change.bind(this.controls)),document.getElementById("load").addEventListener("click",this.controls.load_click.bind(this.controls)),document.getElementById("load-delete-button").addEventListener("click",this.controls.load_delete_click.bind(this.controls)),document.getElementById("load-name").addEventListener("change",this.controls.load_name_change.bind(this.controls)),document.getElementById("load-button").addEventListener("click",this.controls.load_button_click.bind(this.controls)),this.add_multi_event_listener("#save-text","keyup paste",this.controls.save_text_change,this.controls),this.add_multi_event_listener("#search","keyup paste search",this.ops.search_operations,this.ops),this.add_dynamic_listener(".op_list li.operation","dblclick",this.ops.operation_dblclick,this.ops),document.getElementById("edit-favourites").addEventListener("click",this.ops.edit_favourites_click.bind(this.ops)),document.getElementById("save-favourites").addEventListener("click",this.ops.save_favourites_click.bind(this.ops)),document.getElementById("reset-favourites").addEventListener("click",this.ops.reset_favourites_click.bind(this.ops)),this.add_dynamic_listener(".op_list .op-icon","mouseover",this.ops.op_icon_mouseover,this.ops),this.add_dynamic_listener(".op_list .op-icon","mouseleave",this.ops.op_icon_mouseleave,this.ops),this.add_dynamic_listener(".op_list","oplistcreate",this.ops.op_list_create,this.ops),this.add_dynamic_listener("li.operation","operationadd",this.recipe.op_add.bind(this.recipe)),this.add_dynamic_listener(".arg","keyup",this.recipe.ing_change,this.recipe),this.add_dynamic_listener(".arg","change",this.recipe.ing_change,this.recipe),this.add_dynamic_listener(".disable-icon","click",this.recipe.disable_click,this.recipe),this.add_dynamic_listener(".breakpoint","click",this.recipe.breakpoint_click,this.recipe),this.add_dynamic_listener("#rec_list li.operation","dblclick",this.recipe.operation_dblclick,this.recipe),this.add_dynamic_listener("#rec_list li.operation > div","dblclick",this.recipe.operation_child_dblclick,this.recipe),this.add_dynamic_listener("#rec_list .input-group .dropdown-menu a","click",this.recipe.dropdown_toggle_click,this.recipe),this.add_dynamic_listener("#rec_list","operationremove",this.recipe.op_remove.bind(this.recipe)),this.add_multi_event_listener("#input-text","keyup paste",this.input.input_change,this.input),document.getElementById("reset-layout").addEventListener("click",this.app.reset_layout.bind(this.app)),document.getElementById("clr-io").addEventListener("click",this.input.clear_io_click.bind(this.input)),document.getElementById("input-text").addEventListener("dragover",this.input.input_dragover.bind(this.input)),document.getElementById("input-text").addEventListener("dragleave",this.input.input_dragleave.bind(this.input)),document.getElementById("input-text").addEventListener("drop",this.input.input_drop.bind(this.input)),document.getElementById("input-text").addEventListener("scroll",this.highlighter.input_scroll.bind(this.highlighter)),document.getElementById("input-text").addEventListener("mouseup",this.highlighter.input_mouseup.bind(this.highlighter)),document.getElementById("input-text").addEventListener("mousemove",this.highlighter.input_mousemove.bind(this.highlighter)),this.add_multi_event_listener("#input-text","mousedown dblclick select",this.highlighter.input_mousedown,this.highlighter),document.getElementById("save-to-file").addEventListener("click",this.output.save_click.bind(this.output)),document.getElementById("switch").addEventListener("click",this.output.switch_click.bind(this.output)),document.getElementById("undo-switch").addEventListener("click",this.output.undo_switch_click.bind(this.output)),document.getElementById("maximise-output").addEventListener("click",this.output.maximise_output_click.bind(this.output)),document.getElementById("output-text").addEventListener("scroll",this.highlighter.output_scroll.bind(this.highlighter)),document.getElementById("output-text").addEventListener("mouseup",this.highlighter.output_mouseup.bind(this.highlighter)),document.getElementById("output-text").addEventListener("mousemove",this.highlighter.output_mousemove.bind(this.highlighter)),document.getElementById("output-html").addEventListener("mouseup",this.highlighter.output_html_mouseup.bind(this.highlighter)),document.getElementById("output-html").addEventListener("mousemove",this.highlighter.output_html_mousemove.bind(this.highlighter)),this.add_multi_event_listener("#output-text","mousedown dblclick select",this.highlighter.output_mousedown,this.highlighter),this.add_multi_event_listener("#output-html","mousedown dblclick select",this.highlighter.output_html_mousedown,this.highlighter),document.getElementById("options").addEventListener("click",this.options.options_click.bind(this.options)),document.getElementById("reset-options").addEventListener("click",this.options.reset_options_click.bind(this.options)),$(document).on("switchChange.bootstrapSwitch",".option-item input:checkbox",this.options.switch_change.bind(this.options)),$(document).on("switchChange.bootstrapSwitch",".option-item input:checkbox",this.options.set_word_wrap.bind(this.options)),this.add_dynamic_listener(".option-item input[type=number]","keyup",this.options.number_change,this.options),this.add_dynamic_listener(".option-item input[type=number]","change",this.options.number_change,this.options),this.add_dynamic_listener(".option-item select","change",this.options.select_change,this.options),document.getElementById("alert-close").addEventListener("click",this.app.alert_close_click.bind(this.app))},Manager.prototype.add_listeners=function(a,b,c,d){d=d||this,[].forEach.call(document.querySelectorAll(a),function(a){a.addEventListener(b,c.bind(d))})},Manager.prototype.add_multi_event_listener=function(a,b,c,d){for(var e=b.split(" "),f=0;f-1&&(this.manager.recipe.add_operation(b[c].innerHTML),this.app.auto_bake()))),13===a.keyCode)a.preventDefault();else if(40===a.keyCode)a.preventDefault(),b=document.querySelectorAll("#search-results li"),b.length&&(c=this.get_selected_op(b),c>-1&&b[c].classList.remove("selected-op"),c===b.length-1&&(c=-1),b[c+1].classList.add("selected-op"));else if(38===a.keyCode)a.preventDefault(),b=document.querySelectorAll("#search-results li"),b.length&&(c=this.get_selected_op(b),c>-1&&b[c].classList.remove("selected-op"),0===c&&(c=b.length),b[c-1].classList.add("selected-op"));else{for(var d=document.getElementById("search-results"),e=a.target,f=e.value;d.firstChild;)$(d.firstChild).popover("destroy"),d.removeChild(d.firstChild);if($("#categories .in").collapse("hide"),f){for(var g=this.filter_operations(f,!0),h="",i=0;i=0||h>=0){var i=new HTMLOperation(e,this.app.operations[e],this.app,this.manager);b&&i.highlight_search_string(a,g,h),g<0?c.push(i):d.push(i)}}return d.concat(c)},OperationsWaiter.prototype.get_selected_op=function(a){for(var b=0;blength: "+e+"
                                      lines: "+f,document.getElementById("input-selection-info").innerHTML="",document.getElementById("output-selection-info").innerHTML=""},OutputWaiter.prototype.save_click=function(){var a=Utils.to_base64(this.app.dish_str),b=window.prompt("Please enter a filename:","download.dat");if(b){var c=document.createElement("a");c.setAttribute("href","data:application/octet-stream;base64;charset=utf-8,"+a),c.setAttribute("download",b),c.style.display="none",document.body.appendChild(c),c.click(),c.remove()}},OutputWaiter.prototype.switch_click=function(){this.switch_orig_data=this.manager.input.get(),document.getElementById("undo-switch").disabled=!1,this.app.set_input(this.app.dish_str)},OutputWaiter.prototype.undo_switch_click=function(){this.app.set_input(this.switch_orig_data),document.getElementById("undo-switch").disabled=!0},OutputWaiter.prototype.maximise_output_click=function(a){var b=a.target;b.textContent.indexOf("Max")>=0?(this.app.column_splitter.collapse(0),this.app.column_splitter.collapse(1),this.app.io_splitter.collapse(0),b.innerHTML=" Restore"):(this.app.reset_layout(),b.innerHTML=" Max")};var RecipeWaiter=function(a,b){this.app=a,this.manager=b,this.remove_intent=!1};RecipeWaiter.prototype.initialise_operation_drag_n_drop=function(){var a=document.getElementById("rec_list");Sortable.create(a,{group:"recipe",sort:!0,animation:0,delay:0,filter:".arg-input,.arg",setData:function(a,b){a.setData("Text",b.querySelector(".arg-title").textContent)},onEnd:function(a){this.remove_intent&&(a.item.remove(),a.target.dispatchEvent(this.manager.operationremove))}.bind(this)}),Sortable.utils.on(a,"dragover",function(){this.remove_intent=!1}.bind(this)),Sortable.utils.on(a,"dragleave",function(){this.remove_intent=!0,this.app.progress=0}.bind(this)),Sortable.utils.on(a,"touchend",function(b){var c=b.changedTouches[0],d=document.elementFromPoint(c.clientX,c.clientY);this.remove_intent=!a.contains(d)}.bind(this)),document.querySelector("#categories a").addEventListener("dragover",this.fav_dragover.bind(this)),document.querySelector("#categories a").addEventListener("dragleave",this.fav_dragleave.bind(this)),document.querySelector("#categories a").addEventListener("drop",this.fav_drop.bind(this))},RecipeWaiter.prototype.create_sortable_seed_list=function(a){Sortable.create(a,{group:{name:"recipe",pull:"clone",put:!1},sort:!1,setData:function(a,b){a.setData("Text",b.textContent)},onStart:function(a){$(a.item).popover("destroy"),a.item.setAttribute("data-toggle","popover-disabled")},onEnd:this.op_sort_end.bind(this)})},RecipeWaiter.prototype.op_sort_end=function(a){return this.remove_intent?void("rec_list"===a.item.parentNode.id&&a.item.remove()):($(a.clone).popover(),$(a.clone).children("[data-toggle=popover]").popover(),void("rec_list"===a.item.parentNode.id&&(this.build_recipe_operation(a.item),a.item.dispatchEvent(this.manager.operationadd))))},RecipeWaiter.prototype.fav_dragover=function(a){return"move"===a.dataTransfer.effectAllowed&&(a.stopPropagation(),a.preventDefault(),void(a.target.className&&a.target.className.indexOf("category-title")>-1?a.target.classList.add("favourites-hover"):a.target.parentNode.className&&a.target.parentNode.className.indexOf("category-title")>-1?a.target.parentNode.classList.add("favourites-hover"):a.target.parentNode.parentNode.className&&a.target.parentNode.parentNode.className.indexOf("category-title")>-1&&a.target.parentNode.parentNode.classList.add("favourites-hover")))},RecipeWaiter.prototype.fav_dragleave=function(a){a.stopPropagation(),a.preventDefault(),document.querySelector("#categories a").classList.remove("favourites-hover")},RecipeWaiter.prototype.fav_drop=function(a){a.stopPropagation(),a.preventDefault(),a.target.classList.remove("favourites-hover");var b=a.dataTransfer.getData("Text");this.app.add_favourite(b)},RecipeWaiter.prototype.ing_change=function(){window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.disable_click=function(a){var b=a.target;"false"===b.getAttribute("disabled")?(b.setAttribute("disabled","true"),b.classList.add("disable-icon-selected"),b.parentNode.parentNode.classList.add("disabled")):(b.setAttribute("disabled","false"),b.classList.remove("disable-icon-selected"),b.parentNode.parentNode.classList.remove("disabled")),this.app.progress=0,window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.breakpoint_click=function(a){var b=a.target;"false"===b.getAttribute("break")?(b.setAttribute("break","true"),b.classList.add("breakpoint-selected")):(b.setAttribute("break","false"),b.classList.remove("breakpoint-selected")),window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.operation_dblclick=function(a){a.target.remove(),window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.operation_child_dblclick=function(a){a.target.parentNode.remove(),window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.get_config=function(){for(var a,b,c,d,e,f=[],g=document.querySelectorAll("#rec_list li.operation"),h=0;h",this.ing_change()},RecipeWaiter.prototype.op_add=function(a){window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.op_remove=function(a){window.dispatchEvent(this.manager.statechange)};var SeasonalWaiter=function(a,b){this.app=a,this.manager=b};SeasonalWaiter.prototype.load=function(){var a=new Date;11===a.getMonth()&&a.getDate()>12&&(this.app.options.snow=!1,this.create_snow_option(),$(document).on("switchChange.bootstrapSwitch",".option-item input:checkbox[option='snow']",this.let_it_snow.bind(this)),window.addEventListener("resize",this.let_it_snow.bind(this)),this.manager.add_listeners(".btn","click",this.shake_off_snow,this),25===a.getDate()&&this.let_it_snow()),this.kkeys=[],window.addEventListener("keydown",this.konami_code_listener.bind(this))},SeasonalWaiter.prototype.insert_spider_icons=function(){var a="iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB3UlEQVQ4y2NgGJaAmYGBgVnf0oKJgYGBobWtXamqqoYTn2I4CI+LTzM2NTulpKbu+vPHz2dV5RWlluZmi3j5+KqFJSSEzpw8uQPdAEYYIzo5Kfjrl28rWFlZzjAzMYuEBQao3Lh+g+HGvbsMzExMDN++fWf4/PXLBzY2tqYNK1f2+4eHM2xcuRLigsT09Igf3384MTExbf767etBI319jU8fPsi+//jx/72HDxh5uLkZ7ty7y/Dz1687Avz8n2UUFR3Z2NjOySoqfmdhYGBg+PbtuwI7O8e5H79+8X379t357PnzYo+ePP7y6cuXc9++f69nYGRsvf/w4XdtLS2R799/bBUWFHr57sP7Jbs3b/ZkzswvUP3165fZ7z9//r988WIVAyPDr8tXr576+u3bpb9//7YwMjKeV1dV41NWVGoVEhDgPH761DJREeHaz1+/lqlpafUx6+jrRfz4+fPy+w8fTu/fsf3uw7t3L39+//4cv7DwGQYGhpdPbt9m4BcRFlNWVJC4fuvWASszs4C379792Ldt2xZBUdEdDP5hYSqQGIjDGa965uYKCalpZQwMDAxhMTG9DAwMDLaurhIkJY7A8IgGBgYGBgd3Dz2yUpeFo6O4rasrA9T24ZRxAAMTwMpgEJwLAAAAAElFTkSuQmCC",b="iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAACYVBMVEUAAAAcJSU2Pz85QkM9RUWEhIWMjI2MkJEcJSU2Pz85QkM9RUWWlpc9RU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MqWYpTLRIq1QUcT4O3aPQgqVqPwIOIMwDhzX6mQUFIQAgo+9MzcrWrML3mj6+YIKiFCZyhL87RqVQKrEskF+P1BUvfLCAkfRwoPUtq6l5o5+lZb5SolJo6oT8avTCl+c9OTmat6pKW8mLkvBpGzlvsiGuQr4ZEEwA1EQgoR/gNtxIxKBluz+OtMJiF31jHxqXBiAqAUj4WRxpADFM0DCFlv1khvX7Wol4vF4AIldVVxdZqlrIfiCYQPHDy6bAGv7nKYRVY6JewExZVAP+ey5Rv+Ba97aaUHMW5NauLmMZFkegBb/EP14d6NoS9QLWFSzWBmuZza8CQmSpXsAqmGtVy14VALWuuYWWy+W3OteXa4jwceQX6+BKG6J1/8+2VCNkm2222WabbbbZZpttttlmm22rt38DCdA0vq3bcAkAAAAASUVORK5CYII=";document.querySelector("link[rel=icon]").setAttribute("href","data:image/png;base64,"+a),document.querySelector("#bake img").setAttribute("src","data:image/png;base64,"+b),document.querySelector(".about-img-left").setAttribute("src","data:image/png;base64,"+c)},SeasonalWaiter.prototype.insert_spider_text=function(){document.title=document.title.replace(/Cyber/g,"Spider"),SeasonalWaiter.tree_walk(document.body,function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Cyber/g,"Spider"))},!0),SeasonalWaiter.tree_walk(document.getElementById("bake-group"),function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Bake/g,"Spin"))},!0),document.querySelector("#recipe .title").innerHTML="Web"},SeasonalWaiter.prototype.create_snow_option=function(){var a=document.getElementById("options-body"),b=document.createElement("div");b.className="option-item",b.innerHTML=" Let it snow",a.appendChild(b),this.manager.options.load()},SeasonalWaiter.prototype.let_it_snow=function(){if($(document).snowfall("clear"),this.app.options.snow){var a={},b=navigator.userAgent.match(/Firefox\/(\d\d?)/);a=b&&parseInt(b[1],10)<30?{flakeCount:10,flakeColor:"#fff",flakePosition:"absolute",minSize:1,maxSize:2,minSpeed:1,maxSpeed:5,round:!1,shadow:!1,collection:!1,collectionHeight:20,deviceorientation:!0}:{flakeCount:35,flakeColor:"#fff",flakePosition:"absolute",minSize:5,maxSize:8,minSpeed:1,maxSpeed:5,round:!0,shadow:!0,collection:".btn",collectionHeight:20,deviceorientation:!0},$(document).snowfall(a)}},SeasonalWaiter.prototype.shake_off_snow=function(a){for(var b=a.target,c=b.getBoundingClientRect(),d=document.querySelectorAll("canvas.snowfall-canvas"),e=null,f=function(){h.clearRect(0,0,e.width,e.height),$(this).fadeIn()},g=0;g6e4&&this.app.silent_bake()};var main=function(){var a=["To Base64","From Base64","To Hex","From Hex","To Hexdump","From Hexdump","URL Decode","Regular expression","Entropy","Fork"],b={update_url:!0,show_highlighter:!0,treat_as_utf8:!0,word_wrap:!0,show_errors:!0,error_timeout:4e3,auto_bake_threshold:200,attempt_highlight:!0,snow:!1};document.removeEventListener("DOMContentLoaded",main,!1),window.app=new HTMLApp(Categories,OperationConfig,a,b),window.app.setup()};window.console=console||{log:function(){},error:function(){}},window.compile_time=moment.tz("Tue Dec 20 2016 20:17:20","ddd MMM D YYYY HH:mm:ss","UTC").valueOf(),window.compile_message="Merry Christmas! Have a look in the options panel for some festive flavour.",document.addEventListener("DOMContentLoaded",main,!1); \ No newline at end of file +};ControlsWaiter.prototype.adjust_width=function(){var a=document.getElementById("controls"),b=document.getElementById("step"),c=document.getElementById("clr-breaks"),d=document.querySelector("#save img"),e=document.querySelector("#load img"),f=document.querySelector("#step img"),g=document.querySelector("#clr-recipe img"),h=document.querySelector("#clr-breaks img");a.clientWidth<470?b.childNodes[1].nodeValue=" Step":b.childNodes[1].nodeValue=" Step through",a.clientWidth<400?(d.style.display="none",e.style.display="none",f.style.display="none",g.style.display="none",h.style.display="none"):(d.style.display="inline",e.style.display="inline",f.style.display="inline",g.style.display="inline",h.style.display="inline"),a.clientWidth<330?c.childNodes[1].nodeValue=" Clear breaks":c.childNodes[1].nodeValue=" Clear breakpoints"},ControlsWaiter.prototype.set_auto_bake=function(a){var b=document.getElementById("auto-bake");b.checked!==a&&b.click()},ControlsWaiter.prototype.bake_click=function(){this.app.bake(),$("#output-text").selectRange(0)},ControlsWaiter.prototype.step_click=function(){this.app.bake(!0),$("#output-text").selectRange(0)},ControlsWaiter.prototype.auto_bake_change=function(){var a=document.getElementById("auto-bake-label"),b=document.getElementById("auto-bake");this.app.auto_bake_=b.checked,b.checked?(a.classList.remove("btn-default"),a.classList.add("btn-success")):(a.classList.remove("btn-success"),a.classList.add("btn-default"))},ControlsWaiter.prototype.clear_recipe_click=function(){this.manager.recipe.clear_recipe()},ControlsWaiter.prototype.clear_breaks_click=function(){for(var a=document.querySelectorAll("#rec_list li.operation .breakpoint"),b=0;b0,b=b&&f.length>0&&f.length<8e3,a&&(d+="?recipe="+encodeURIComponent(e)),a&&b?d+="&input="+encodeURIComponent(f):b&&(d+="?input="+encodeURIComponent(f)),d},ControlsWaiter.prototype.save_text_change=function(){try{var a=JSON.parse(document.getElementById("save-text").value);this.initialise_save_link(a)}catch(a){}},ControlsWaiter.prototype.save_click=function(){var a=this.app.get_recipe_config(),b=JSON.stringify(a).replace(/},{/g,"},\n{");document.getElementById("save-text").value=b,this.initialise_save_link(a),$("#save-modal").modal()},ControlsWaiter.prototype.slr_check_change=function(){this.initialise_save_link()},ControlsWaiter.prototype.sli_check_change=function(){this.initialise_save_link()},ControlsWaiter.prototype.load_click=function(){this.populate_load_recipes_list(),$("#load-modal").modal()},ControlsWaiter.prototype.save_button_click=function(){var a=document.getElementById("save-name").value,b=document.getElementById("save-text").value;if(!a)return void this.app.alert("Please enter a recipe name","danger",2e3);var c=localStorage.saved_recipes?JSON.parse(localStorage.saved_recipes):[],d=localStorage.recipe_id||0;c.push({id:++d,name:a,recipe:b}),localStorage.saved_recipes=JSON.stringify(c),localStorage.recipe_id=d,this.app.alert('Recipe saved as "'+a+'".',"success",2e3)},ControlsWaiter.prototype.populate_load_recipes_list=function(){for(var a=document.getElementById("load-name"),b=a.options.length;b--;)a.remove(b);var c=localStorage.saved_recipes?JSON.parse(localStorage.saved_recipes):[];for(b=0;bend: "+e+"
                                      length: "+f},HighlighterWaiter.prototype.remove_highlights=function(){document.getElementById("input-highlighter").innerHTML="",document.getElementById("output-highlighter").innerHTML="",document.getElementById("input-selection-info").innerHTML="",document.getElementById("output-selection-info").innerHTML=""},HighlighterWaiter.prototype.generate_highlight_list=function(){for(var a=this.app.get_recipe_config(),b=[],c=0;c=0)return!1;var d="[start_highlight]",e=/\[start_highlight\]/g,f="[end_highlight]",g=/\[end_highlight\]/g,h=a.value;if(1===c.length){if(c[0].end/g,">").replace(/\n/g," ").replace(e,'').replace(g,"")+" ",b.style.width=a.clientWidth+"px",b.innerHTML=h,b.scrollTop=a.scrollTop,b.scrollLeft=a.scrollLeft};var HTMLApp=function(a,b,c,d){this.categories=a,this.operations=b,this.dfavourites=c,this.doptions=d,this.options=Utils.extend({},d),this.chef=new Chef,this.manager=new Manager(this),this.auto_bake_=!1,this.progress=0,this.ing_id=0,window.chef=this.chef};HTMLApp.prototype.setup=function(){document.dispatchEvent(this.manager.appstart),this.initialise_splitter(),this.load_local_storage(),this.populate_operations_list(),this.manager.setup(),this.reset_layout(),this.set_compile_message(),this.load_URI_params()},HTMLApp.prototype.handle_error=function(a){console.error(a);var b=a.display_str||a.toString();this.alert(b,"danger",this.options.error_timeout,!this.options.show_errors)},HTMLApp.prototype.bake=function(a){var b;try{b=this.chef.bake(this.get_input(),this.get_recipe_config(),this.options,this.progress,a)}catch(a){this.handle_error(a)}b&&(b.error&&this.handle_error(b.error),this.options=b.options,this.dish_str="html"===b.type?Utils.strip_html_tags(b.result,!0):b.result,this.progress=b.progress,this.manager.recipe.update_breakpoint_indicator(b.progress),this.manager.output.set(b.result,b.type,b.duration),b.duration>this.options.auto_bake_threshold&&this.auto_bake_&&(this.manager.controls.set_auto_bake(!1),this.alert("Baking took longer than "+this.options.auto_bake_threshold+"ms, Auto Bake has been disabled.","warning",5e3)))},HTMLApp.prototype.auto_bake=function(){this.auto_bake_&&this.bake()},HTMLApp.prototype.silent_bake=function(){var a=(new Date).getTime(),b=this.get_recipe_config();return this.auto_bake_&&this.chef.silent_bake(b),(new Date).getTime()-a},HTMLApp.prototype.get_input=function(){var a=this.manager.input.get();return sessionStorage.setItem("input_length",a.length),sessionStorage.setItem("input",a),a},HTMLApp.prototype.set_input=function(a){sessionStorage.setItem("input_length",a.length),sessionStorage.setItem("input",a),this.manager.input.set(a)},HTMLApp.prototype.populate_operations_list=function(){document.body.appendChild(document.getElementById("edit-favourites"));for(var a="",b=0;b2?JSON.parse(localStorage.favourites):this.dfavourites;a=this.valid_favourites(a),this.save_favourites(a);var b=this.categories.filter(function(a){return"Favourites"===a.name})[0];b?b.ops=a:this.categories.unshift({name:"Favourites",ops:a})},HTMLApp.prototype.valid_favourites=function(a){for(var b=[],c=0;c=0?void this.alert("'"+a+"' is already in your favourites","info",2e3):(b.push(a),this.save_favourites(b),this.load_favourites(),this.populate_operations_list(),void this.manager.recipe.initialise_operation_drag_n_drop())},HTMLApp.prototype.load_URI_params=function(){this.query_string=function(a){if(""===a)return{};for(var b={},c=0;c"):d[e].value=a[b].args[e];a[b].disabled&&c.querySelector(".disable-icon").click(),a[b].breakpoint&&c.querySelector(".breakpoint").click(),this.progress=0}},HTMLApp.prototype.reset_layout=function(){this.column_splitter.setSizes([20,30,50]),this.io_splitter.setSizes([50,50]),this.manager.controls.adjust_width(),this.manager.output.adjust_width()},HTMLApp.prototype.set_compile_message=function(){var a=new Date,b=Utils.fuzzy_time(a.getTime()-window.compile_time),c='Last build: '+b.substr(0,1).toUpperCase()+b.substr(1)+" ago";""!==window.compile_message&&(c+=" - "+window.compile_message),c+="",document.getElementById("notice").innerHTML=c},HTMLApp.prototype.alert=function(a,b,c,d){var e=new Date;if(console.log("["+e.toLocaleString()+"] "+a),!d){b=b||"danger",c=c||0;var f=document.getElementById("alert"),g=document.getElementById("alert-content");f.classList.remove("alert-danger"),f.classList.remove("alert-warning"),f.classList.remove("alert-info"),f.classList.remove("alert-success"),f.classList.add("alert-"+b),"block"===f.style.display?g.innerHTML+="

                                      ["+e.toLocaleTimeString()+"] "+a:g.innerHTML="["+e.toLocaleTimeString()+"] "+a,$("#alert").stop(),f.style.display="block",f.style.opacity=1,c>0&&(clearTimeout(this.alert_timeout),this.alert_timeout=setTimeout(function(){$("#alert").slideUp(100)},c))}},HTMLApp.prototype.confirm=function(a,b,c,d){d=d||this,document.getElementById("confirm-title").innerHTML=a,document.getElementById("confirm-body").innerHTML=b,document.getElementById("confirm-modal").style.display="block",this.confirm_closed=!1,$("#confirm-modal").modal().one("show.bs.modal",function(a){this.confirm_closed=!1}.bind(this)).one("click","#confirm-yes",function(){this.confirm_closed=!0,c.bind(d)(!0),$("#confirm-modal").modal("hide")}.bind(this)).one("hide.bs.modal",function(a){this.confirm_closed||c.bind(d)(!1),this.confirm_closed=!0}.bind(this))},HTMLApp.prototype.alert_close_click=function(){document.getElementById("alert").style.display="none"},HTMLApp.prototype.state_change=function(a){this.auto_bake(),this.options.update_url&&(this.last_state_url=this.manager.controls.generate_state_url(!0,!0),window.history.replaceState({},"CyberChef",this.last_state_url))},HTMLApp.prototype.pop_state=function(a){window.location.href.split("#")[0]!==this.last_state_url&&this.load_URI_params()},HTMLApp.prototype.call_api=function(a,b,c,d,e){b=b||"POST",c=c||{},d=d||void 0,e=e||"application/json";var f=null,g=!1;return $.ajax({url:a,async:!1,type:b,data:c,dataType:d,contentType:e,success:function(a){g=!0,f=a},error:function(a){g=!1,f=a}}),{success:g,response:f}};var HTMLCategory=function(a,b){this.name=a,this.selected=b,this.op_list=[]};HTMLCategory.prototype.add_operation=function(a){this.op_list.push(a)},HTMLCategory.prototype.to_html=function(){for(var a="cat"+this.name.replace(/[\s\/-:_]/g,""),b="
                                      "+this.name+"
                                        ",c=0;c 
                                      ";switch(d+="
                                      ",this.type){case"string":case"binary_string":case"byte_array":d+="";break;case"short_string":case"binary_short_string":d+="";break;case"toggle_string":for(d+="
                                      ";break;case"number":d+="";break;case"boolean":d+="",this.disable_args&&this.manager.add_dynamic_listener("#"+this.id,"click",this.toggle_disable_args,this);break;case"option":for(d+="";break;case"populate_option":for(d+="",this.manager.add_dynamic_listener("#"+this.id,"change",this.populate_option_change,this);break;case"editable_option":for(d+="
                                      ",d+="",d+="",d+="
                                      ",this.manager.add_dynamic_listener("#sel-"+this.id,"change",this.editable_option_change,this);break;case"text":d+=""}return d+="
                                      "},HTMLIngredient.prototype.toggle_disable_args=function(a){for(var b,c=a.target,d=c.parentNode.parentNode,e=d.querySelectorAll(".arg-group"),f=0;f"),this.description&&(b+=""),b+=""},HTMLOperation.prototype.to_full_html=function(){for(var a="
                                      "+this.name+"
                                      ",b=0;b=0&&(this.name=this.name.slice(0,b)+""+this.name.slice(b,b+a.length)+""+this.name.slice(b+a.length)),this.description&&c>=0&&(this.description=this.description.slice(0,c)+""+this.description.slice(c,c+a.length)+""+this.description.slice(c+a.length))};var InputWaiter=function(a,b){this.app=a,this.manager=b,this.bad_keys=[16,17,18,19,20,27,33,34,35,36,37,38,39,40,44,91,92,93,112,113,114,115,116,117,118,119,120,121,122,123,144,145]};InputWaiter.prototype.get=function(){return document.getElementById("input-text").value},InputWaiter.prototype.set=function(a){document.getElementById("input-text").value=a,window.dispatchEvent(this.manager.statechange)},InputWaiter.prototype.set_input_info=function(a,b){var c=a.toString().length;c=c<2?2:c;var d=Utils.pad(a.toString(),c," ").replace(/ /g," "),e=Utils.pad(b.toString(),c," ").replace(/ /g," ");document.getElementById("input-info").innerHTML="length: "+d+"
                                      lines: "+e},InputWaiter.prototype.input_change=function(a){this.manager.highlighter.remove_highlights(),this.app.progress=0;var b=this.get(),c=b.count("\n")+1;this.set_input_info(b.length,c),this.bad_keys.indexOf(a.keyCode)<0&&window.dispatchEvent(this.manager.statechange)},InputWaiter.prototype.input_dragover=function(a){return"move"!==a.dataTransfer.effectAllowed&&(a.stopPropagation(),a.preventDefault(),void a.target.classList.add("dropping-file"))},InputWaiter.prototype.input_dragleave=function(a){a.stopPropagation(),a.preventDefault(),a.target.classList.remove("dropping-file")},InputWaiter.prototype.input_drop=function(a){if("move"===a.dataTransfer.effectAllowed)return!1;a.stopPropagation(),a.preventDefault();var b=a.target,c=a.dataTransfer.files[0],d=a.dataTransfer.getData("Text"),e=new FileReader,f="",g=0,h=20480,i=function(){f.length>1e5&&this.app.auto_bake_&&(this.manager.controls.set_auto_bake(!1),this.app.alert("Turned off Auto Bake as the input is large","warning",5e3)),this.set(f);var a=this.app.get_recipe_config();a[0]&&"From Hex"===a[0].op||(a.unshift({op:"From Hex",args:["Space"]}),this.app.set_recipe_config(a)),b.classList.remove("loading_file")}.bind(this),j=function(){if(g>=c.size)return void i();b.value="Processing... "+Math.round(g/c.size*100)+"%";var a=c.slice(g,g+h);e.readAsArrayBuffer(a)};e.onload=function(a){var b=new Uint8Array(e.result);f+=Utils.to_hex_fast(b),g+=h,j()},b.classList.remove("dropping-file"),c?(b.classList.add("loading_file"),j()):d&&this.set(d)},InputWaiter.prototype.clear_io_click=function(){this.manager.highlighter.remove_highlights(),document.getElementById("input-text").value="",document.getElementById("output-text").value="",document.getElementById("input-info").innerHTML="",document.getElementById("output-info").innerHTML="",document.getElementById("input-selection-info").innerHTML="",document.getElementById("output-selection-info").innerHTML="",window.dispatchEvent(this.manager.statechange)};var Manager=function(a){this.app=a,this.appstart=new CustomEvent("appstart",{bubbles:!0}),this.operationadd=new CustomEvent("operationadd",{bubbles:!0}),this.operationremove=new CustomEvent("operationremove",{bubbles:!0}),this.oplistcreate=new CustomEvent("oplistcreate",{bubbles:!0}),this.statechange=new CustomEvent("statechange",{bubbles:!0}),this.window=new WindowWaiter(this.app),this.controls=new ControlsWaiter(this.app,this),this.recipe=new RecipeWaiter(this.app,this),this.ops=new OperationsWaiter(this.app,this),this.input=new InputWaiter(this.app,this),this.output=new OutputWaiter(this.app,this),this.options=new OptionsWaiter(this.app),this.highlighter=new HighlighterWaiter(this.app), +this.seasonal=new SeasonalWaiter(this.app,this),this.dynamic_handlers={},this.initialise_event_listeners()};Manager.prototype.setup=function(){this.recipe.initialise_operation_drag_n_drop(),this.controls.auto_bake_change(),this.seasonal.load()},Manager.prototype.initialise_event_listeners=function(){window.addEventListener("resize",this.window.window_resize.bind(this.window)),window.addEventListener("blur",this.window.window_blur.bind(this.window)),window.addEventListener("focus",this.window.window_focus.bind(this.window)),window.addEventListener("statechange",this.app.state_change.bind(this.app)),window.addEventListener("popstate",this.app.pop_state.bind(this.app)),document.getElementById("bake").addEventListener("click",this.controls.bake_click.bind(this.controls)),document.getElementById("auto-bake").addEventListener("change",this.controls.auto_bake_change.bind(this.controls)),document.getElementById("step").addEventListener("click",this.controls.step_click.bind(this.controls)),document.getElementById("clr-recipe").addEventListener("click",this.controls.clear_recipe_click.bind(this.controls)),document.getElementById("clr-breaks").addEventListener("click",this.controls.clear_breaks_click.bind(this.controls)),document.getElementById("save").addEventListener("click",this.controls.save_click.bind(this.controls)),document.getElementById("save-button").addEventListener("click",this.controls.save_button_click.bind(this.controls)),document.getElementById("save-link-recipe-checkbox").addEventListener("change",this.controls.slr_check_change.bind(this.controls)),document.getElementById("save-link-input-checkbox").addEventListener("change",this.controls.sli_check_change.bind(this.controls)),document.getElementById("load").addEventListener("click",this.controls.load_click.bind(this.controls)),document.getElementById("load-delete-button").addEventListener("click",this.controls.load_delete_click.bind(this.controls)),document.getElementById("load-name").addEventListener("change",this.controls.load_name_change.bind(this.controls)),document.getElementById("load-button").addEventListener("click",this.controls.load_button_click.bind(this.controls)),this.add_multi_event_listener("#save-text","keyup paste",this.controls.save_text_change,this.controls),this.add_multi_event_listener("#search","keyup paste search",this.ops.search_operations,this.ops),this.add_dynamic_listener(".op_list li.operation","dblclick",this.ops.operation_dblclick,this.ops),document.getElementById("edit-favourites").addEventListener("click",this.ops.edit_favourites_click.bind(this.ops)),document.getElementById("save-favourites").addEventListener("click",this.ops.save_favourites_click.bind(this.ops)),document.getElementById("reset-favourites").addEventListener("click",this.ops.reset_favourites_click.bind(this.ops)),this.add_dynamic_listener(".op_list .op-icon","mouseover",this.ops.op_icon_mouseover,this.ops),this.add_dynamic_listener(".op_list .op-icon","mouseleave",this.ops.op_icon_mouseleave,this.ops),this.add_dynamic_listener(".op_list","oplistcreate",this.ops.op_list_create,this.ops),this.add_dynamic_listener("li.operation","operationadd",this.recipe.op_add.bind(this.recipe)),this.add_dynamic_listener(".arg","keyup",this.recipe.ing_change,this.recipe),this.add_dynamic_listener(".arg","change",this.recipe.ing_change,this.recipe),this.add_dynamic_listener(".disable-icon","click",this.recipe.disable_click,this.recipe),this.add_dynamic_listener(".breakpoint","click",this.recipe.breakpoint_click,this.recipe),this.add_dynamic_listener("#rec_list li.operation","dblclick",this.recipe.operation_dblclick,this.recipe),this.add_dynamic_listener("#rec_list li.operation > div","dblclick",this.recipe.operation_child_dblclick,this.recipe),this.add_dynamic_listener("#rec_list .input-group .dropdown-menu a","click",this.recipe.dropdown_toggle_click,this.recipe),this.add_dynamic_listener("#rec_list","operationremove",this.recipe.op_remove.bind(this.recipe)),this.add_multi_event_listener("#input-text","keyup paste",this.input.input_change,this.input),document.getElementById("reset-layout").addEventListener("click",this.app.reset_layout.bind(this.app)),document.getElementById("clr-io").addEventListener("click",this.input.clear_io_click.bind(this.input)),document.getElementById("input-text").addEventListener("dragover",this.input.input_dragover.bind(this.input)),document.getElementById("input-text").addEventListener("dragleave",this.input.input_dragleave.bind(this.input)),document.getElementById("input-text").addEventListener("drop",this.input.input_drop.bind(this.input)),document.getElementById("input-text").addEventListener("scroll",this.highlighter.input_scroll.bind(this.highlighter)),document.getElementById("input-text").addEventListener("mouseup",this.highlighter.input_mouseup.bind(this.highlighter)),document.getElementById("input-text").addEventListener("mousemove",this.highlighter.input_mousemove.bind(this.highlighter)),this.add_multi_event_listener("#input-text","mousedown dblclick select",this.highlighter.input_mousedown,this.highlighter),document.getElementById("save-to-file").addEventListener("click",this.output.save_click.bind(this.output)),document.getElementById("switch").addEventListener("click",this.output.switch_click.bind(this.output)),document.getElementById("undo-switch").addEventListener("click",this.output.undo_switch_click.bind(this.output)),document.getElementById("maximise-output").addEventListener("click",this.output.maximise_output_click.bind(this.output)),document.getElementById("output-text").addEventListener("scroll",this.highlighter.output_scroll.bind(this.highlighter)),document.getElementById("output-text").addEventListener("mouseup",this.highlighter.output_mouseup.bind(this.highlighter)),document.getElementById("output-text").addEventListener("mousemove",this.highlighter.output_mousemove.bind(this.highlighter)),document.getElementById("output-html").addEventListener("mouseup",this.highlighter.output_html_mouseup.bind(this.highlighter)),document.getElementById("output-html").addEventListener("mousemove",this.highlighter.output_html_mousemove.bind(this.highlighter)),this.add_multi_event_listener("#output-text","mousedown dblclick select",this.highlighter.output_mousedown,this.highlighter),this.add_multi_event_listener("#output-html","mousedown dblclick select",this.highlighter.output_html_mousedown,this.highlighter),document.getElementById("options").addEventListener("click",this.options.options_click.bind(this.options)),document.getElementById("reset-options").addEventListener("click",this.options.reset_options_click.bind(this.options)),$(document).on("switchChange.bootstrapSwitch",".option-item input:checkbox",this.options.switch_change.bind(this.options)),$(document).on("switchChange.bootstrapSwitch",".option-item input:checkbox",this.options.set_word_wrap.bind(this.options)),this.add_dynamic_listener(".option-item input[type=number]","keyup",this.options.number_change,this.options),this.add_dynamic_listener(".option-item input[type=number]","change",this.options.number_change,this.options),this.add_dynamic_listener(".option-item select","change",this.options.select_change,this.options),document.getElementById("alert-close").addEventListener("click",this.app.alert_close_click.bind(this.app))},Manager.prototype.add_listeners=function(a,b,c,d){d=d||this,[].forEach.call(document.querySelectorAll(a),function(a){a.addEventListener(b,c.bind(d))})},Manager.prototype.add_multi_event_listener=function(a,b,c,d){for(var e=b.split(" "),f=0;f-1&&(this.manager.recipe.add_operation(b[c].innerHTML),this.app.auto_bake()))),13===a.keyCode)a.preventDefault();else if(40===a.keyCode)a.preventDefault(),b=document.querySelectorAll("#search-results li"),b.length&&(c=this.get_selected_op(b),c>-1&&b[c].classList.remove("selected-op"),c===b.length-1&&(c=-1),b[c+1].classList.add("selected-op"));else if(38===a.keyCode)a.preventDefault(),b=document.querySelectorAll("#search-results li"),b.length&&(c=this.get_selected_op(b),c>-1&&b[c].classList.remove("selected-op"),0===c&&(c=b.length),b[c-1].classList.add("selected-op"));else{for(var d=document.getElementById("search-results"),e=a.target,f=e.value;d.firstChild;)$(d.firstChild).popover("destroy"),d.removeChild(d.firstChild);if($("#categories .in").collapse("hide"),f){for(var g=this.filter_operations(f,!0),h="",i=0;i=0||h>=0){var i=new HTMLOperation(e,this.app.operations[e],this.app,this.manager);b&&i.highlight_search_string(a,g,h),g<0?c.push(i):d.push(i)}}return d.concat(c)},OperationsWaiter.prototype.get_selected_op=function(a){for(var b=0;blength: "+e+"
                                      lines: "+f,document.getElementById("input-selection-info").innerHTML="",document.getElementById("output-selection-info").innerHTML=""},OutputWaiter.prototype.adjust_width=function(){var a=document.getElementById("output"),b=document.getElementById("save-to-file"),c=document.getElementById("switch"),d=document.getElementById("undo-switch"),e=document.getElementById("maximise-output");a.clientWidth<680?(b.childNodes[1].nodeValue="",c.childNodes[1].nodeValue="",d.childNodes[1].nodeValue="",e.childNodes[1].nodeValue=""):(b.childNodes[1].nodeValue=" Save to file",c.childNodes[1].nodeValue=" Move output to input",d.childNodes[1].nodeValue=" Undo",e.childNodes[1].nodeValue="Maximise"===e.getAttribute("title")?" Max":" Restore")},OutputWaiter.prototype.save_click=function(){var a=Utils.to_base64(this.app.dish_str),b=window.prompt("Please enter a filename:","download.dat");if(b){var c=document.createElement("a");c.setAttribute("href","data:application/octet-stream;base64;charset=utf-8,"+a),c.setAttribute("download",b),c.style.display="none",document.body.appendChild(c),c.click(),c.remove()}},OutputWaiter.prototype.switch_click=function(){this.switch_orig_data=this.manager.input.get(),document.getElementById("undo-switch").disabled=!1,this.app.set_input(this.app.dish_str)},OutputWaiter.prototype.undo_switch_click=function(){this.app.set_input(this.switch_orig_data),document.getElementById("undo-switch").disabled=!0},OutputWaiter.prototype.maximise_output_click=function(a){var b="maximise-output"===a.target.id?a.target:a.target.parentNode;"Maximise"===b.getAttribute("title")?(this.app.column_splitter.collapse(0),this.app.column_splitter.collapse(1),this.app.io_splitter.collapse(0),b.setAttribute("title","Restore"),b.innerHTML=" Restore",this.adjust_width()):(b.setAttribute("title","Maximise"),b.innerHTML=" Max",this.app.reset_layout())};var RecipeWaiter=function(a,b){this.app=a,this.manager=b,this.remove_intent=!1};RecipeWaiter.prototype.initialise_operation_drag_n_drop=function(){var a=document.getElementById("rec_list");Sortable.create(a,{group:"recipe",sort:!0,animation:0,delay:0,filter:".arg-input,.arg",setData:function(a,b){a.setData("Text",b.querySelector(".arg-title").textContent)},onEnd:function(a){this.remove_intent&&(a.item.remove(),a.target.dispatchEvent(this.manager.operationremove))}.bind(this)}),Sortable.utils.on(a,"dragover",function(){this.remove_intent=!1}.bind(this)),Sortable.utils.on(a,"dragleave",function(){this.remove_intent=!0,this.app.progress=0}.bind(this)),Sortable.utils.on(a,"touchend",function(b){var c=b.changedTouches[0],d=document.elementFromPoint(c.clientX,c.clientY);this.remove_intent=!a.contains(d)}.bind(this)),document.querySelector("#categories a").addEventListener("dragover",this.fav_dragover.bind(this)),document.querySelector("#categories a").addEventListener("dragleave",this.fav_dragleave.bind(this)),document.querySelector("#categories a").addEventListener("drop",this.fav_drop.bind(this))},RecipeWaiter.prototype.create_sortable_seed_list=function(a){Sortable.create(a,{group:{name:"recipe",pull:"clone",put:!1},sort:!1,setData:function(a,b){a.setData("Text",b.textContent)},onStart:function(a){$(a.item).popover("destroy"),a.item.setAttribute("data-toggle","popover-disabled")},onEnd:this.op_sort_end.bind(this)})},RecipeWaiter.prototype.op_sort_end=function(a){return this.remove_intent?void("rec_list"===a.item.parentNode.id&&a.item.remove()):($(a.clone).popover(),$(a.clone).children("[data-toggle=popover]").popover(),void("rec_list"===a.item.parentNode.id&&(this.build_recipe_operation(a.item),a.item.dispatchEvent(this.manager.operationadd))))},RecipeWaiter.prototype.fav_dragover=function(a){return"move"===a.dataTransfer.effectAllowed&&(a.stopPropagation(),a.preventDefault(),void(a.target.className&&a.target.className.indexOf("category-title")>-1?a.target.classList.add("favourites-hover"):a.target.parentNode.className&&a.target.parentNode.className.indexOf("category-title")>-1?a.target.parentNode.classList.add("favourites-hover"):a.target.parentNode.parentNode.className&&a.target.parentNode.parentNode.className.indexOf("category-title")>-1&&a.target.parentNode.parentNode.classList.add("favourites-hover")))},RecipeWaiter.prototype.fav_dragleave=function(a){a.stopPropagation(),a.preventDefault(),document.querySelector("#categories a").classList.remove("favourites-hover")},RecipeWaiter.prototype.fav_drop=function(a){a.stopPropagation(),a.preventDefault(),a.target.classList.remove("favourites-hover");var b=a.dataTransfer.getData("Text");this.app.add_favourite(b)},RecipeWaiter.prototype.ing_change=function(){window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.disable_click=function(a){var b=a.target;"false"===b.getAttribute("disabled")?(b.setAttribute("disabled","true"),b.classList.add("disable-icon-selected"),b.parentNode.parentNode.classList.add("disabled")):(b.setAttribute("disabled","false"),b.classList.remove("disable-icon-selected"),b.parentNode.parentNode.classList.remove("disabled")),this.app.progress=0,window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.breakpoint_click=function(a){var b=a.target;"false"===b.getAttribute("break")?(b.setAttribute("break","true"),b.classList.add("breakpoint-selected")):(b.setAttribute("break","false"),b.classList.remove("breakpoint-selected")),window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.operation_dblclick=function(a){a.target.remove(),window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.operation_child_dblclick=function(a){a.target.parentNode.remove(),window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.get_config=function(){for(var a,b,c,d,e,f=[],g=document.querySelectorAll("#rec_list li.operation"),h=0;h",this.ing_change()},RecipeWaiter.prototype.op_add=function(a){window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.op_remove=function(a){window.dispatchEvent(this.manager.statechange)};var SeasonalWaiter=function(a,b){this.app=a,this.manager=b};SeasonalWaiter.prototype.load=function(){var a=new Date;11===a.getMonth()&&a.getDate()>12&&(this.app.options.snow=!1,this.create_snow_option(),$(document).on("switchChange.bootstrapSwitch",".option-item input:checkbox[option='snow']",this.let_it_snow.bind(this)),window.addEventListener("resize",this.let_it_snow.bind(this)),this.manager.add_listeners(".btn","click",this.shake_off_snow,this),25===a.getDate()&&this.let_it_snow()),this.kkeys=[],window.addEventListener("keydown",this.konami_code_listener.bind(this))},SeasonalWaiter.prototype.insert_spider_icons=function(){var a="iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB3UlEQVQ4y2NgGJaAmYGBgVnf0oKJgYGBobWtXamqqoYTn2I4CI+LTzM2NTulpKbu+vPHz2dV5RWlluZmi3j5+KqFJSSEzpw8uQPdAEYYIzo5Kfjrl28rWFlZzjAzMYuEBQao3Lh+g+HGvbsMzExMDN++fWf4/PXLBzY2tqYNK1f2+4eHM2xcuRLigsT09Igf3384MTExbf767etBI319jU8fPsi+//jx/72HDxh5uLkZ7ty7y/Dz1687Avz8n2UUFR3Z2NjOySoqfmdhYGBg+PbtuwI7O8e5H79+8X379t357PnzYo+ePP7y6cuXc9++f69nYGRsvf/w4XdtLS2R799/bBUWFHr57sP7Jbs3b/ZkzswvUP3165fZ7z9//r988WIVAyPDr8tXr576+u3bpb9//7YwMjKeV1dV41NWVGoVEhDgPH761DJREeHaz1+/lqlpafUx6+jrRfz4+fPy+w8fTu/fsf3uw7t3L39+//4cv7DwGQYGhpdPbt9m4BcRFlNWVJC4fuvWASszs4C379792Ldt2xZBUdEdDP5hYSqQGIjDGa965uYKCalpZQwMDAxhMTG9DAwMDLaurhIkJY7A8IgGBgYGBgd3Dz2yUpeFo6O4rasrA9T24ZRxAAMTwMpgEJwLAAAAAElFTkSuQmCC",b="iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAACYVBMVEUAAAAcJSU2Pz85QkM9RUWEhIWMjI2MkJEcJSU2Pz85QkM9RUWWlpc9RUVXXl4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TLRIq1QUcT4O3aPQgqVqPwIOIMwDhzX6mQUFIQAgo+9MzcrWrML3mj6+YIKiFCZyhL87RqVQKrEskF+P1BUvfLCAkfRwoPUtq6l5o5+lZb5SolJo6oT8avTCl+c9OTmat6pKW8mLkvBpGzlvsiGuQr4ZEEwA1EQgoR/gNtxIxKBluz+OtMJiF31jHxqXBiAqAUj4WRxpADFM0DCFlv1khvX7Wol4vF4AIldVVxdZqlrIfiCYQPHDy6bAGv7nKYRVY6JewExZVAP+ey5Rv+Ba97aaUHMW5NauLmMZFkegBb/EP14d6NoS9QLWFSzWBmuZza8CQmSpXsAqmGtVy14VALWuuYWWy+W3OteXa4jwceQX6+BKG6J1/8+2VCNkm2222WabbbbZZpttttlmm22rt38DCdA0vq3bcAkAAAAASUVORK5CYII=";document.querySelector("link[rel=icon]").setAttribute("href","data:image/png;base64,"+a),document.querySelector("#bake img").setAttribute("src","data:image/png;base64,"+b),document.querySelector(".about-img-left").setAttribute("src","data:image/png;base64,"+c)},SeasonalWaiter.prototype.insert_spider_text=function(){document.title=document.title.replace(/Cyber/g,"Spider"),SeasonalWaiter.tree_walk(document.body,function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Cyber/g,"Spider"))},!0),SeasonalWaiter.tree_walk(document.getElementById("bake-group"),function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Bake/g,"Spin"))},!0),document.querySelector("#recipe .title").innerHTML="Web"},SeasonalWaiter.prototype.create_snow_option=function(){var a=document.getElementById("options-body"),b=document.createElement("div");b.className="option-item",b.innerHTML=" Let it snow",a.appendChild(b),this.manager.options.load()},SeasonalWaiter.prototype.let_it_snow=function(){if($(document).snowfall("clear"),this.app.options.snow){var a={},b=navigator.userAgent.match(/Firefox\/(\d\d?)/);a=b&&parseInt(b[1],10)<30?{flakeCount:10,flakeColor:"#fff",flakePosition:"absolute",minSize:1,maxSize:2,minSpeed:1,maxSpeed:5,round:!1,shadow:!1,collection:!1,collectionHeight:20,deviceorientation:!0}:{flakeCount:35,flakeColor:"#fff",flakePosition:"absolute",minSize:5,maxSize:8,minSpeed:1,maxSpeed:5, +round:!0,shadow:!0,collection:".btn",collectionHeight:20,deviceorientation:!0},$(document).snowfall(a)}},SeasonalWaiter.prototype.shake_off_snow=function(a){for(var b=a.target,c=b.getBoundingClientRect(),d=document.querySelectorAll("canvas.snowfall-canvas"),e=null,f=function(){h.clearRect(0,0,e.width,e.height),$(this).fadeIn()},g=0;g6e4&&this.app.silent_bake()};var main=function(){var a=["To Base64","From Base64","To Hex","From Hex","To Hexdump","From Hexdump","URL Decode","Regular expression","Entropy","Fork"],b={update_url:!0,show_highlighter:!0,treat_as_utf8:!0,word_wrap:!0,show_errors:!0,error_timeout:4e3,auto_bake_threshold:200,attempt_highlight:!0,snow:!1};document.removeEventListener("DOMContentLoaded",main,!1),window.app=new HTMLApp(Categories,OperationConfig,a,b),window.app.setup()};window.console=console||{log:function(){},error:function(){}},window.compile_time=moment.tz("Wed Dec 21 2016 12:12:01","ddd MMM D YYYY HH:mm:ss","UTC").valueOf(),window.compile_message="Merry Christmas! Have a look in the options panel for some festive flavour.",document.addEventListener("DOMContentLoaded",main,!1); \ No newline at end of file diff --git a/src/html/index.html b/src/html/index.html index 50a2d2d0..57d78d74 100755 --- a/src/html/index.html +++ b/src/html/index.html @@ -114,10 +114,10 @@
                                      Output
                                      - - - - + + + +
                                      diff --git a/src/js/views/html/HTMLApp.js b/src/js/views/html/HTMLApp.js index b2fe6626..4440a88b 100755 --- a/src/js/views/html/HTMLApp.js +++ b/src/js/views/html/HTMLApp.js @@ -207,9 +207,12 @@ HTMLApp.prototype.populate_operations_list = function() { HTMLApp.prototype.initialise_splitter = function() { this.column_splitter = Split(["#operations", "#recipe", "#IO"], { sizes: [20, 30, 50], - minSize: [240, 325, 500], + minSize: [240, 325, 440], gutterSize: 4, - onDrag: this.manager.controls.adjust_width.bind(this.manager.controls) + onDrag: function() { + this.manager.controls.adjust_width(); + this.manager.output.adjust_width(); + }.bind(this) }); this.io_splitter = Split(["#input", "#output"], { @@ -467,6 +470,7 @@ HTMLApp.prototype.reset_layout = function() { this.io_splitter.setSizes([50, 50]); this.manager.controls.adjust_width(); + this.manager.output.adjust_width(); }; diff --git a/src/js/views/html/OutputWaiter.js b/src/js/views/html/OutputWaiter.js index da05dc8e..38f93708 100755 --- a/src/js/views/html/OutputWaiter.js +++ b/src/js/views/html/OutputWaiter.js @@ -95,6 +95,32 @@ OutputWaiter.prototype.set_output_info = function(length, lines, duration) { }; +/** + * Adjusts the display properties of the output buttons so that they fit within the current width + * without wrapping or overflowing. + */ +OutputWaiter.prototype.adjust_width = function() { + var output = document.getElementById("output"), + save_to_file = document.getElementById("save-to-file"), + switch_io = document.getElementById("switch"), + undo_switch = document.getElementById("undo-switch"), + maximise_output = document.getElementById("maximise-output"); + + if (output.clientWidth < 680) { + save_to_file.childNodes[1].nodeValue = ""; + switch_io.childNodes[1].nodeValue = ""; + undo_switch.childNodes[1].nodeValue = ""; + maximise_output.childNodes[1].nodeValue = ""; + } else { + save_to_file.childNodes[1].nodeValue = " Save to file"; + switch_io.childNodes[1].nodeValue = " Move output to input"; + undo_switch.childNodes[1].nodeValue = " Undo"; + maximise_output.childNodes[1].nodeValue = + maximise_output.getAttribute("title") === "Maximise" ? " Max" : " Restore"; + } +}; + + /** * Handler for save click events. * Saves the current output to a file, downloaded as a URL octet stream. @@ -144,16 +170,19 @@ OutputWaiter.prototype.undo_switch_click = function() { * Resizes the output frame to be as large as possible, or restores it to its original size. */ OutputWaiter.prototype.maximise_output_click = function(e) { - var el = e.target; - - if (el.textContent.indexOf("Max") >= 0) { + var el = e.target.id === "maximise-output" ? e.target : e.target.parentNode; + + if (el.getAttribute("title") === "Maximise") { this.app.column_splitter.collapse(0); this.app.column_splitter.collapse(1); this.app.io_splitter.collapse(0); + el.setAttribute("title", "Restore"); el.innerHTML = " Restore"; + this.adjust_width(); } else { - this.app.reset_layout(); + el.setAttribute("title", "Maximise"); el.innerHTML = " Max"; + this.app.reset_layout(); } }; diff --git a/src/static/stats.txt b/src/static/stats.txt index 8f261e4d..9251e6cf 100644 --- a/src/static/stats.txt +++ b/src/static/stats.txt @@ -1,9 +1,9 @@ 206 source files -113322 lines +113355 lines 4.2M size 137 JavaScript source files -104164 lines +104197 lines 3.7M size 79 third party JavaScript source files @@ -11,7 +11,7 @@ 3.0M size 58 first party JavaScript source files -19112 lines +19145 lines 724K size 3.4M uncompressed JavaScript size From ef464ab57c97dd3147aed3bd0ffce2c21de18110 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Wed, 21 Dec 2016 14:09:46 +0000 Subject: [PATCH 13/24] Added 'Substitute' operation. --- build/prod/cyberchef.htm | 24 ++++++++++----------- build/prod/index.html | 2 +- build/prod/scripts.js | 20 ++++++++--------- src/js/config/Categories.js | 1 + src/js/config/OperationConfig.js | 18 ++++++++++++++++ src/js/operations/Cipher.js | 37 ++++++++++++++++++++++++++++++++ src/static/stats.txt | 8 +++---- 7 files changed, 83 insertions(+), 27 deletions(-) diff --git a/build/prod/cyberchef.htm b/build/prod/cyberchef.htm index b2534f74..7f8177c7 100755 --- a/build/prod/cyberchef.htm +++ b/build/prod/cyberchef.htm @@ -91,11 +91,11 @@ 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. -*/.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.clo,.opn,.pun{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.kwd,.tag,.typ{font-weight:700}.str{color:#060}.kwd{color:#006}.com{color:#600;font-style:italic}.typ{color:#404}.lit{color:#044}.clo,.opn,.pun{color:#440}.tag{color:#006}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}#content-wrapper{top:0;left:0;width:100%;height:100%}#banner{height:30px;text-align:center;line-height:30px}#wrapper{top:30px;bottom:0}div#operations,div#recipe{width:50%;height:100%}div#input,div#output{width:100%;height:50%}.title{padding:10px;height:43px}.textarea-wrapper{top:43px;bottom:0;width:100%;overflow:hidden}#output-html,textarea{width:100%;height:100%;border:none;padding:3px;-moz-padding-start:3px;-moz-padding-end:3px}#input-text,#output-html,#output-text{position:relative;border-width:0;margin:0;resize:none;background-color:transparent;white-space:pre-wrap;word-wrap:break-word}#output-html{display:none;overflow-y:auto;-moz-padding-start:1px}.split{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;overflow:auto;position:relative}.gutter.gutter-horizontal,.split.split-horizontal{height:100%;float:left}#input-highlighter,#output-highlighter{position:absolute;left:0;top:0;width:100%;height:100%;padding:3px;margin:0;overflow:hidden;letter-spacing:normal;white-space:pre-wrap;word-wrap:break-word;color:#fff;background-color:transparent;border:none}#op_list,#rec_list,.op_list{margin:0;padding:0;list-style-type:none}#op_list,#rec_list{position:absolute;top:43px;bottom:0;width:100%}.io-btn-group,.io-info{margin-top:-4px;float:right}#rec_list{bottom:120px;overflow:auto}.operation{cursor:pointer;padding:10px;list-style-type:none;position:relative}#controls{position:absolute;width:100%;height:120px;bottom:0;padding:10px}.io-info{margin-right:20px;height:30px;text-align:right;line-height:10px}.arg-group,.inline-args input[type=checkbox]{margin-top:10px}#input-info{line-height:15px}.arg-group{display:table;width:100%}.arg-group-text{display:block}.inline-args{float:left;width:auto;margin-right:30px;height:34px}.inline-args input[type=number]{width:100px}.arg-input{display:table-cell;width:100%;padding:6px 12px}.short-string{width:150px}select{display:block}.arg[disabled]{cursor:not-allowed;opacity:1}textarea.arg{width:100%;min-height:50px;height:70px;margin-top:5px;border:1px solid #ddd;resize:vertical}.arg-label{display:table-cell;width:1px;padding-right:10px;font-weight:400;white-space:pre}.title,optgroup{font-weight:700}.editable-option{position:relative;display:inline-block}.editable-option-input{position:absolute;top:1px;left:1px;width:calc(100% - 20px);height:calc(100% - 2px)!important;border:none!important}#operational-controls{width:65%;float:left;text-align:center}#bake-group{display:table;width:100%}#bake{display:table-cell;width:100%;border-top-right-radius:0;border-bottom-right-radius:0}#auto-bake-label{display:table-cell;padding:1px;line-height:1.35;width:60px;border-top-left-radius:0;border-bottom-left-radius:0;border-left:1px solid #5cb85c}#auto-bake-label:hover{border-left-color:#398439}#auto-bake-label div{font-size:10px;padding:2px}#extra-controls{float:right;width:35%;padding-left:10px}.op-icon{float:right;margin-left:10px;margin-top:3px}.recip-icons{position:absolute;top:13px;right:10px;height:16px}.recip-icon{margin-right:10px;vertical-align:baseline;float:right}.disable-icon{width:16px;height:16px;margin-top:-1px;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAACfElEQVQ4y6WTPWgTYRjHf8nlfVvuoDVIP4Yuki4WHKoUqggFRUTsUEGkVG2hmCq6OnTwIxYHB+eijZOKdLNDW1pKKyGigh8dBHUJElxyBgx3vEnukvdyDrUhRXDxGR+e/+/583xEwjDkfyIGwNVTzURm4tYAMA6MAoN/0tvAMrA48uL+l2bx4w0iYRjSuHKC6OnTZLqHk8CcaZq9bW1tSCkBqNVq+L5PpVIpAHdGfr5LN9bXiT7Z2nGgteb1/qFkLBJZ6OjowHEc8vk8pVIJgHg8TldXF52dnb2u6y5s7R/iuF5JSyAKkLl4eyAMwznLsrBtm1wu99Z13amk+BFJih8R13WXANrb27EsizAM5zIXbw+wC9Baj0spe5VSFAqFt4ZhXJ6ufXuK55E5cDKVSCTGenp6yGazKKWQUvZqrcebgCAIRqWUOI6DEOLR1K8POapVMgfPpoC7u2LLspYcx0FKSRAEo60OBg3DwPd9Jr5vPqWvj8zh83vEwL2J75vnfN/HMAy01oPNNQZBQBAEO1OvVsl0D/8lTuZfpYDd7gRBQKuD7XK5jGmarB679PIv8deVFJUKq8cuTZqmSblcRmu93QpYVkohhMCyrLE94n2/UlSrbJy5kRBCXBNCoJRCa73cClh0XbfgeR6WZZHNZunv719KvnmeYnWVVxdmJ2Ox2DMhxFHP83Bdt6C1XgR2LvHzQDvvb84npZQL8Xgc0zSJRqN7br7RaFCpVCiVStRqtZmhh9fTh754TQdMr82nPc+bsW27UCwWUUpRr9ep1+sopSgWi9i2XfA8b2Z6bT6ttabp4GMi0uz0aXbhn890+MFM85mO5MIdwP/Eb1pMUCdctYRzAAAAAElFTkSuQmCC) no-repeat}.disable-icon-selected{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACFUlEQVR4XqWTP0tbURjGn9zY3mjBwsUhBQtS6XKxiNypIGZJ6SKYUYdaKWg7OrrE3pYO+Qit3dpFuuQO6lI7Z4nESQdjlJbkJh0MksSb3Jvk9H0gjZFu9YWH83LO7zn/3nNCSincJobAeP1sEDBFi6J50UyPy4l2RNuioz756Ts0tt1OB4jH2a52Ne2HGh9PwrJm2EcxZx/HyPRYMDgB2u02/N3d1c7w8BZMM1ptNJBPp3GwsUExB/s4RoYsPf0JOkFgdoH34YkJ/D48xC/HyTTOzl5ayWSIktwxqlVo0SjIkKWnP0Hg+4swjGitVMJFNpu5o+svptfXv6DZBDIZezoWS3Db3A0ZsvRcH8H354dGR9EoFHA3EvlorqycwvOAXM4G8Pav+f7YmEOGLD1gsIzl54+V+vBK/Yw9ZAv1LQW1FrdFSnKVfQTK5liPUfRI9I8ArqiPjLAF9vcHVybyzlpasgcZeq7voNXKNSsV3DMMXB4fp/8xLyzYuLri2DIZsvQM3sFOzXURiUR4zsQNcyrFleFVKpNyP2/IkKVnsArbF65bbkqplJSJZrl5x5qbs7G3h3artSyV+arr+lMyZOnpP2Wp6ZFos3R+vvUgCGDNzgKalkA4rECIr07662J2i0X4nrfJJ33jJT6Zmvpcr9XWCicn5WI+j7rrAmKgmLOPY2TI0sPgb8TBZOi/PpN1qnDr7/wH3jxgB/FKIXkAAAAASUVORK5CYII=) no-repeat}.breakpoint{float:right;width:14px;height:14px;background-color:#eee;border:1px solid #aaa}.breakpoint-selected{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAXVBMVEXIUkvzUVHzTEzzn5785eXrbW24BgbzWVnze3vzVVXzY2Pyion509PzbW3zXV1UMxj0l5f1srKbRTRgOxzJDg796ur74ODfIyP5zs6LLx3pNTXYGxuxdkVZNhn////sCC1eAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAABWSURBVBjTnc+7EoAgDERRTOQVxMEZFAf//z8FjAUFDbfb060QU2FwxngimxnCea3bjegSgz+0tguAfBgIy64QGfZQdg91dgAtqUZgnfz6IacYVWvu2AvR4wNAv0nxrAAAAABJRU5ErkJggg==) -2px -2px no-repeat #eee}.banner-right{float:right;margin-right:10px}#banner img{margin-bottom:2px;margin-left:8px}.category-title{display:block;padding:10px}.category{margin:0!important;border-radius:0!important;border:none}#search{border-radius:0;border:none}.loading_file{background:url(data:image/gif;base64,R0lGODlhPAA8APcAAAAAAAEBAQICAgMDAwQEBAUFBQYGBgcHBwgICAkJCQoKCgsLCwwMDA0NDQ4ODg8PDxAQEBERERISEhMTExQUFBUVFRYWFhcXFxgYGBkZGRoaGhsbGxwcHB0dHR4eHh8fHyAgICEhISIiIiMjIyQkJCUlJSYmJicnJygoKCkpKSoqKisrKywsLC0tLS4uLi8vLzAwMDExMTIyMjMzMzQ0NDU1NTY2Njc3Nzg4ODk5OTo6Ojs7Ozw8PD09PT4+Pj8/P0BAQEFBQUJCQkNDQ0REREVFRUZGRkdHR0hISElJSUpKSktLS0xMTE1NTU5OTk9PT1BQUFFRUVJSUlNTU1RUVFVVVVZWVldXV1hYWFlZWVpaWltbW1xcXF1dXV5eXl9fX2BgYGFhYWJiYmNjY2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ydbLntFzmTJlG9TvKDDRoUvCcmjJtKqw2UaNKqeXZL93syGXLUQ2LTxqzZtdGH63GrDiz3bSjGWe2zek1487SuYYWDRvCfPps7otHkeC6c+joId1Gqa6ceXPzCKMzb57d0X7n2JeT59Rf/HLSw9p7F290QAAh+QQhCAD/ACwCAAQAFgAvAAAI/gD/CRxIsKBAUkUOGVxYUE0CAAVwMGRoiwOAiww+TTToisJFiIo2GlTxEYO/jd1OEtzRAUa7fAztIUGSxF7BffwmfhsyoycTcyIJwtLRc8YOWUEHjhNSlAi3pAO7EZkxRBVUgtE+XbvKtaC7ciq5bspzZ0/XXXHMqO3D9ZFatXfaXVWF5u0dru0stUGz52nXYbi6Ch7MkF/Yq/z2lRIFq2u/UJkiN76aTFPkTKKAQo226bKoclf9iYqsKTDXfrRIBSPMurVrfuXAuRPczRkzZ/q4yrPNjFm0wyLL9e4d7R5XacOldWUHLZo04En90YPuWnA8eYL3nStXTh31iem4IXOfF3q7eHZc1Yk3R54ru3Pn1hXMl3tjv3swCa47h256QAA7) center center no-repeat #f5f5f5}#alert{position:fixed;width:30%;margin:30px auto;top:10px;left:0;right:0;z-index:2000;display:none}#alert a{text-decoration:underline}.option-item .bootstrap-switch{margin:15px 10px}.option-item button{margin:10px}.option-item input[type=number]{margin:15px 10px;width:80px;height:28px;padding:3px 10px;vertical-align:middle}.option-item select{margin:10px;display:inline-block}button img,span.btn img{margin-right:3px;margin-bottom:1px}#edit-favourites{float:right;margin-top:-5px}#edit-favourites-list{margin:10px}.about-img-left{float:left;margin:10px 20px 20px 0}.about-img-right{float:right;margin:10px 0 20px 20px}.save-link-options{float:right}.save-link-options input{margin-left:10px}#save-footer{border-top:none;margin-top:0}a:focus,button{outline:0;-moz-outline-style:none}.btn-default{border-color:#ddd}.btn-default:focus{background-color:#fff;border-color:#adadad}.btn-default:active,.btn-default:hover{background-color:#ebebeb;border-color:#adadad}.alert,.btn,.btn-lg,.dropdown-menu,.form-control,.modal-content,.nav-tabs>li>a,.popover,.tooltip-inner{border-radius:0!important}input[type=search]{-webkit-appearance:searchfield;box-shadow:none}input[type=search]::-webkit-search-cancel-button{-webkit-appearance:searchfield-cancel-button}.modal{overflow-y:auto}.form-control{background-color:transparent}code{border:0;white-space:pre-wrap}.bootstrap-switch,.bootstrap-switch-container,.bootstrap-switch-handle-off,.bootstrap-switch-handle-on,.bootstrap-switch-label,pre{border-radius:0!important}#banner,.title{border-bottom:1px solid #ddd}blockquote{font-size:inherit}.panel-body:after,.panel-body:before{content:""}.sortable-ghost{opacity:.6}.colorpicker-element{float:left;margin-right:15px}.colorpicker-color,.colorpicker-color div{height:100px}.word-wrap{white-space:pre!important;word-wrap:normal!important;overflow-x:scroll!important}.clearfix{height:0}.blur{color:transparent!important;text-shadow:rgba(0,0,0,.95) 0 0 10px!important}.no-select{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.konami{-ms-transform:rotate(180deg);-webkit-transform:rotate(180deg);transform:rotate(180deg);-moz-transform:rotate(180deg)}.hl1,.hlyellow{background-color:#fff000}.hl2,.hlblue{background-color:#95dfff}.hl3,.hlred{background-color:#ffb6b6}.hl4,.hlorange{background-color:#fcf8e3}.hl5,.hlgreen{background-color:#8de768}.title{color:#424242;background-color:#fafafa}.gutter{background-color:#eee;background-repeat:no-repeat;background-position:50%}.gutter.gutter-horizontal{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAAeCAYAAAAGos/EAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAlSURBVChTYzxz5sx/BiBgAhEgwPju3TtUEZZ79+6BGcNcDQMDACWJMFs4hNOSAAAAAElFTkSuQmCC);cursor:ew-resize}.gutter.gutter-vertical{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAACCAYAAABPJGxCAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACHDwAAj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++5K3ZXTl+1uXrqGuNax3XL6+19Fn1tP1j80NZv2d9+w+pG503rm10DywfODjoMXrjleuvyba/b1++svDMwFDJ0dzhyeOQu++7kvaR7L+9n3J9/sOkh+mHhI6lH5Y+VHtf9qPdj64jlyJlR19G+J0FPHoyxxp7/lP7Th/H8p+Sn5ROqE42TZpOnp9ynbj5b/Wz8eerz+emCn6V/rn6h++K7Xxx/6ZtZNTP+kv9y4dfiV/Kvjrxe9rp71n/28ZvkN/NzhW/l3x59x3jX+z7s/cR85gfsh4qPeh+7Pnl/eriQvLDwG/eE8/s3BCkeAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAI0lEQVQYV2M8c+bMfwYgUFJSAlEM9+7dA9O05jOBSboDBgYAtPcYZ1oUA30AAAAASUVORK5CYII=);cursor:ns-resize}.operation{border:1px solid #999;border-top-width:0}.op_list .operation{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1}#rec_list .operation{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.arg-input,select{height:34px;border:1px solid #ddd;background-color:#fff;color:#424242}#controls{border-top:1px solid #ddd;background-color:#fafafa}.textarea-wrapper div,.textarea-wrapper textarea{font-family:Consolas,monospace;font-size:inherit}.io-info{font-weight:400;font-size:8pt}.arg-title,.category-title{font-weight:700}.arg-input{font-size:15px;line-height:1.428571429}select{padding:6px 8px}.arg[disabled]{background-color:#eee}textarea.arg{color:#424242}.break{color:#b94a48!important;background-color:#f2dede!important;border-color:#eed3d7!important}.category-title{background-color:#fafafa;border-bottom:1px solid #eee}.category-title[aria-expanded=true],.category-title[href='#catFavourites']{border-bottom-color:#ddd}.category-title.collapsed{border-bottom-color:#eee}.category-title:hover{color:#3a87ad}#search{border-bottom:1px solid #e3e3e3}.dropping-file{border:5px dashed #3a87ad!important}.selected-op{color:#c09853!important;background-color:#fcf8e3!important;border-color:#fbeed5!important}.option-item input[type=number]{font-size:14px;line-height:1.428571429;color:#555;background-color:#fff;border:1px solid #ccc}.favourites-hover{color:#468847;background-color:#dff0d8;border:2px dashed #468847!important;padding:8px 8px 9px}#edit-favourites-list{border:1px solid #bce8f1}#edit-favourites-list .operation{border-left:none;border-right:none}#edit-favourites-list .operation:last-child{border-bottom:none}.subtext{font-style:italic;font-size:13px;color:#999}#save-footer{border-bottom:1px solid #e5e5e5}.flow-control-op{color:#396f3a!important;background-color:#c7e4ba!important;border-color:#b3dba2!important}.flow-control-op.break{color:#94312f!important;background-color:#eabfbf!important;border-color:#e2aeb5!important}#support-modal textarea{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif}#load-text,#save-text{font-family:Consolas,monospace}button.dropdown-toggle{background-color:#f4f4f4}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-track{background-color:#fafafa}::-webkit-scrollbar-thumb{background-color:#ccc}::-webkit-scrollbar-thumb:hover{background-color:#bbb}::-webkit-scrollbar-corner{background-color:#fafafa}.disabled{color:#999!important;background-color:#dfdfdf!important;border-color:#cdcdcd!important}.grey{color:#333;background-color:#f5f5f5;border-color:#ddd}.dark-blue{color:#fff;background-color:#428bca;border-color:#428bca}.red{color:#b94a48;background-color:#f2dede;border-color:#eed3d7}.amber{color:#c09853;background-color:#fcf8e3;border-color:#fbeed5}.green{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.blue{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1} Edit
                                      Operations
                                        Recipe
                                          Input
                                          Output
                                          Operations
                                            Recipe
                                              Input
                                              Output
                                              \ No newline at end of file +},pad_right:function(a,b,c){return c=c||" ",a.lengthb&&(a=a.slice(0,b-c.length)+c),a},hex:function(a,b){return a="string"==typeof a?Utils.ord(a):a,b=b||2,Utils.pad(a.toString(16),b)},bin:function(a,b){return a="string"==typeof a?Utils.ord(a):a,b=b||8,Utils.pad(a.toString(2),b)},printable:function(a,b){window&&window.app&&!window.app.options.treat_as_utf8&&(a=Utils.byte_array_to_chars(Utils.str_to_byte_array(a)));var c=/[\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-\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,d=/[\x09-\x10\x0D\u2028\u2029]/g;return a=a.replace(c,"."),b||(a=a.replace(d,".")),a},parse_escaped_chars:function(a){return a.replace(/(\\)?\\([nrtbf]|x[\da-f]{2})/g,function(a,b,c){if("\\"===b)return"\\"+c;switch(c[0]){case"n":return"\n";case"r":return"\r";case"t":return"\t";case"b":return"\b";case"f":return"\f";case"x":return Utils.chr(parseInt(c.substr(1),16))}})},expand_alph_range:function(a){for(var b=[],c=0;c255)return Utils.str_to_utf8_byte_array(a);return c},str_to_utf8_byte_array:function(a){var b=CryptoJS.enc.Utf8.parse(a),c=Utils.word_array_to_byte_array(b);return a.length!==b.sigBytes&&(window.app.options.attempt_highlight=!1),c},str_to_charcode:function(a){for(var b=new Array(a.length),c=a.length;c--;)b[c]=a.charCodeAt(c);return b},byte_array_to_utf8:function(a){try{for(var b=[],c=0;c>>2]|=a[c]<<24-c%4*8;var d=new CryptoJS.lib.WordArray.init(b,a.length),e=CryptoJS.enc.Utf8.stringify(d);return e.length!==d.sigBytes&&(window.app.options.attempt_highlight=!1),e}catch(b){return Utils.byte_array_to_chars(a)}},byte_array_to_chars:function(a){if(!a)return"";for(var b="",c=0;c>>2]>>>24-d%4*8&255);return c},UNIC_WIN1251_MAP:{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,14:14,15:15,16:16,17:17,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,28:28,29:29,30:30,31:31,32:32,33:33,34:34,35:35,36:36,37:37,38:38,39:39,40:40,41:41,42:42,43:43,44:44,45:45,46:46,47:47,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,58:58,59:59,60:60,61:61,62:62,63:63,64:64,65:65,66:66,67:67,68:68,69:69,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,82:82,83:83,84:84,85:85,86:86,87:87,88:88,89:89,90:90,91:91,92:92,93:93,94:94,95:95,96:96,97:97,98:98,99:99,100:100,101:101,102:102,103:103,104:104,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,125:125,126:126,127:127,1027:129,8225:135,1046:198,8222:132,1047:199,1168:165,1048:200,1113:154,1049:201,1045:197,1050:202,1028:170,160:160,1040:192,1051:203,164:164,166:166,167:167,169:169,171:171,172:172,173:173,174:174,1053:205,176:176,177:177,1114:156,181:181,182:182,183:183,8221:148,187:187,1029:189,1056:208,1057:209,1058:210,8364:136,1112:188,1115:158,1059:211,1060:212,1030:178,1061:213,1062:214,1063:215,1116:157,1064:216,1065:217,1031:175,1066:218,1067:219,1068:220,1069:221,1070:222,1032:163,8226:149,1071:223,1072:224,8482:153,1073:225,8240:137,1118:162,1074:226,1110:179,8230:133,1075:227,1033:138,1076:228,1077:229,8211:150,1078:230,1119:159,1079:231,1042:194,1080:232,1034:140,1025:168,1081:233,1082:234,8212:151,1083:235,1169:180,1084:236,1052:204,1085:237,1035:142,1086:238,1087:239,1088:240,1089:241,1090:242,1036:141,1041:193,1091:243,1092:244,8224:134,1093:245,8470:185,1094:246,1054:206,1095:247,1096:248,8249:139,1097:249,1098:250,1044:196,1099:251,1111:191,1055:207,1100:252,1038:161,8220:147,1101:253,8250:155,1102:254,8216:145,1103:255,1043:195,1105:184,1039:143,1026:128,1106:144,8218:130,1107:131,8217:146,1108:186,1109:190},WIN1251_UNIC_MAP:{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,14:14,15:15,16:16,17:17,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,28:28,29:29,30:30,31:31,32:32,33:33,34:34,35:35,36:36,37:37,38:38,39:39,40:40,41:41,42:42,43:43,44:44,45:45,46:46,47:47,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,58:58,59:59,60:60,61:61,62:62,63:63,64:64,65:65,66:66,67:67,68:68,69:69,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,82:82,83:83,84:84,85:85,86:86,87:87,88:88,89:89,90:90,91:91,92:92,93:93,94:94,95:95,96:96,97:97,98:98,99:99,100:100,101:101,102:102,103:103,104:104,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,125:125,126:126,127:127,160:160,164:164,166:166,167:167,169:169,171:171,172:172,173:173,174:174,176:176,177:177,181:181,182:182,183:183,187:187,168:1025,128:1026,129:1027,170:1028,189:1029,178:1030,175:1031,163:1032,138:1033,140:1034,142:1035,141:1036,161:1038,143:1039,192:1040,193:1041,194:1042,195:1043,196:1044,197:1045,198:1046,199:1047,200:1048,201:1049,202:1050,203:1051,204:1052,205:1053,206:1054,207:1055,208:1056,209:1057,210:1058,211:1059,212:1060,213:1061,214:1062,215:1063,216:1064,217:1065,218:1066,219:1067,220:1068,221:1069,222:1070,223:1071,224:1072,225:1073,226:1074,227:1075,228:1076,229:1077,230:1078,231:1079,232:1080,233:1081,234:1082,235:1083,236:1084,237:1085,238:1086,239:1087,240:1088,241:1089,242:1090,243:1091,244:1092,245:1093,246:1094,247:1095,248:1096,249:1097,250:1098,251:1099,252:1100,253:1101,254:1102,255:1103,184:1105,144:1106,131:1107,186:1108,190:1109,179:1110,191:1111,188:1112,154:1113,156:1114,158:1115,157:1116,162:1118,159:1119,165:1168,180:1169,150:8211,151:8212,145:8216,146:8217,130:8218,147:8220,148:8221,132:8222,134:8224,135:8225,149:8226,133:8230,137:8240,139:8249,155:8250,136:8364,185:8470,153:8482},unicode_to_win1251:function(a){for(var b=[],c=0;c>2,g=(3&c)<<4|d>>4,h=(15&d)<<2|e>>6,i=63&e,isNaN(d)?h=i=64:isNaN(e)&&(i=64),j+=b.charAt(f)+b.charAt(g)+b.charAt(h)+b.charAt(i);return j},from_base64:function(a,b,c,d){if(c=c||"string",!a)return"string"===c?"":[];b=b?Utils.expand_alph_range(b).join(""):"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",void 0===d&&(d=!0);var e,f,g,h,i,j,k,l=[],m=0;if(d){var n=new RegExp("[^"+b.replace(/[\[\]\\\-^$]/g,"\\$&")+"]","g");a=a.replace(n,"")}for(;m>4,f=(15&i)<<4|j>>2,g=(3&j)<<6|k,l.push(e),64!==j&&l.push(f),64!==k&&l.push(g);return"string"===c?Utils.byte_array_to_utf8(l):l},to_hex:function(a,b,c){if(!a)return"";b="string"==typeof b?b:" ",c=c||2;for(var d="",e=0;e>>4).toString(16)),b.push((15&a[c]).toString(16));return b.join("")},from_hex:function(a,b,c){if(b=b||(a.indexOf(" ")>=0?"Space":"None"),c=c||2,"None"!==b){var d=Utils.regex_rep[b];a=a.replace(d,"")}for(var e=[],f=0;f]*>.*<\/(script|style)>/gim,"")),a.replace(/<[^>\n]+>/g,"")},escape_html:function(a){return a.replace(/>>3]|=parseInt(a.substr(d,2),16)<<24-d%8*4;return new CryptoJS.lib.WordArray.init(c,b/2)};var Base={DEFAULT_RADIX:36,run_to:function(a,b){if(!a)throw"Error: Input must be a number";var c=b[0]||Base.DEFAULT_RADIX;if(c<2||c>36)throw"Error: Radix argument must be between 2 and 36";return a.toString(c)},run_from:function(a,b){var c=b[0]||Base.DEFAULT_RADIX;if(c<2||c>36)throw"Error: Radix argument must be between 2 and 36";return parseInt(a.replace(/\s/g,""),c)}},Base64={ALPHABET:"A-Za-z0-9+/=",ALPHABET_OPTIONS:[{name:"Standard: A-Za-z0-9+/=",value:"A-Za-z0-9+/="},{name:"URL safe: 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: 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+/="}],run_to:function(a,b){var c=b[0]||Base64.ALPHABET;return Utils.to_base64(a,c)},REMOVE_NON_ALPH_CHARS:!0,run_from:function(a,b){var c=b[0]||Base64.ALPHABET,d=b[1];return Utils.from_base64(a,c,"byte_array",d)},BASE32_ALPHABET:"A-Z2-7=",run_to_32:function(a,b){if(!a)return"";for(var c,d,e,f,g,h,i,j,k,l,m,n,o,p=b[0]?Utils.expand_alph_range(b[0]).join(""):"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",q="",r=0;r>3,i=(7&c)<<2|d>>6,j=d>>1&31,k=(1&d)<<4|e>>4,l=(15&e)<<1|f>>7,m=f>>2&63,n=(3&f)<<3|g>>5,o=31&g,isNaN(d)?j=k=l=m=n=o=32:isNaN(e)?l=m=n=o=32:isNaN(f)?m=n=o=32:isNaN(g)&&(o=32),q+=p.charAt(h)+p.charAt(i)+p.charAt(j)+p.charAt(k)+p.charAt(l)+p.charAt(m)+p.charAt(n)+p.charAt(o);return q},run_from_32:function(a,b){if(!a)return[];var c,d,e,f,g,h,i,j,k,l,m,n,o,p=b[0]?Utils.expand_alph_range(b[0]).join(""):"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",q=b[0],r=[],s=0;if(q){var t=new RegExp("[^"+p.replace(/[\]\\\-^]/g,"\\$&")+"]","g");a=a.replace(t,"")}for(;s>2,d=(3&i)<<6|j<<1|k>>4,e=(15&k)<<4|l>>1,f=(1&l)<<7|m<<2|n>>3,g=(7&n)<<5|o,r.push(c),(i&!0||32!==j)&&r.push(d),(k&!0||32!==l)&&r.push(e),(l&!0||32!==m)&&r.push(f),(n&!0||32!==o)&&r.push(g);return r},SHOW_IN_BINARY:!1,OFFSETS_SHOW_VARIABLE:!0,run_offsets:function(a,b){var c=b[0]||Base64.ALPHABET,d=b[1],e=Utils.to_base64(a,c),f=Utils.to_base64([0].concat(a),c),g=Utils.to_base64([0,0].concat(a),c),h=e.indexOf("="),i=f.indexOf("="),j=g.indexOf("="),k=" \ No newline at end of file diff --git a/build/prod/index.html b/build/prod/index.html index fabbe97f..7aea87fa 100755 --- a/build/prod/index.html +++ b/build/prod/index.html @@ -18,4 +18,4 @@ See the License for the specific language governing permissions and limitations under the License. --> -CyberChef Edit
                                              Operations
                                                Recipe
                                                  Input
                                                  Output
                                                  \ No newline at end of file +CyberChef Edit
                                                  Operations
                                                    Recipe
                                                      Input
                                                      Output
                                                      \ No newline at end of file diff --git a/build/prod/scripts.js b/build/prod/scripts.js index 43360cb9..7c89770a 100755 --- a/build/prod/scripts.js +++ b/build/prod/scripts.js @@ -265,13 +265,13 @@ function(a){"function"==typeof define&&define.amd?define(a):"undefined"!=typeof function(){function a(a){this.code=a,this.message=Vc[a]}function b(b){var c=b.match(/\$?(?:(?![0-9-])(?:\w[\w.-]*|\*):)?(?![0-9-])(?:\w[\w.-]*|\*)|\(:|:\)|\/\/|\.\.|::|\d+(?:\.\d*)?(?:[eE][+-]?\d+)?|\.\d+(?:[eE][+-]?\d+)?|"[^"]*(?:""[^"]*)*"|'[^']*(?:''[^']*)*'|<<|>>|[!<>]=|(?![0-9-])[\w-]+:\*|\s+|./g);if(c){for(var d=0,e=0,f=c.length;e0)}function e(){this.dataTypes={},this.documents={},this.functions={},this.collations={},this.collections={}}function f(a,b,c){Xc[a]=c,Yc[a]=b}function g(a,b){Zc[a]=b}function h(c,d){var e=new b(c),f=l(e,d);if(!e.eof())throw new a("XPST0003");if(!f)throw new a("XPST0003");this.internalExpression=f}function i(){}function j(){}function k(){this.items=[]}function l(b,c){var d;if(!b.eof()&&(d=m(b,c))){var e=new k;for(e.items.push(d);","==b.peek();){if(b.next(),b.eof()||!(d=m(b,c)))throw new a("XPST0003");e.items.push(d)}return e}}function m(a,b){if(!a.eof())return s(a,b)||o(a,b)||u(a,b)||K(a,b)}function n(){this.bindings=[],this.returnExpr=null}function o(b,c){if("for"==b.peek()&&"$"==b.peek(1).substr(0,1)){b.next();var d,e=new n;do e.bindings.push(q(b,c));while(","==b.peek()&&b.next());if("return"!=b.peek())throw new a("XPST0003");if(b.next(),b.eof()||!(d=m(b,c)))throw new a("XPST0003");return e.returnExpr=d,e}}function p(a,b,c,d){this.prefix=a,this.localName=b,this.namespaceURI=c,this.inExpr=d}function q(b,c){var d=b.peek().substr(1).match(id);if(!d)throw new a("XPST0003");if("*"==d[1]||"*"==d[2])throw new a("XPST0003");if(b.next(),"in"!=b.peek())throw new a("XPST0003");b.next();var e;if(b.eof()||!(e=m(b,c)))throw new a("XPST0003");return new p(d[1]||null,d[2],d[1]?c.getURIForPrefix(d[1]):null,e)}function r(a,b,c){this.condExpr=a,this.thenExpr=b,this.elseExpr=c}function s(b,c){var d,e,f;if("if"==b.peek()&&"("==b.peek(1)){if(b.next(2),b.eof()||!(d=l(b,c)))throw new a("XPST0003");if(")"!=b.peek())throw new a("XPST0003");if(b.next(),"then"!=b.peek())throw new a("XPST0003");if(b.next(),b.eof()||!(e=m(b,c)))throw new a("XPST0003");if("else"!=b.peek())throw new a("XPST0003");if(b.next(),b.eof()||!(f=m(b,c)))throw new a("XPST0003");return new r(d,e,f)}}function t(a){this.quantifier=a,this.bindings=[],this.satisfiesExpr=null}function u(b,c){var d=b.peek();if(("some"==d||"every"==d)&&"$"==b.peek(1).substr(0,1)){b.next();var e,f=new t(d);do f.bindings.push(w(b,c));while(","==b.peek()&&b.next());if("satisfies"!=b.peek())throw new a("XPST0003");if(b.next(),b.eof()||!(e=m(b,c)))throw new a("XPST0003");return f.satisfiesExpr=e,f}}function v(a,b,c,d){this.prefix=a,this.localName=b,this.namespaceURI=c,this.inExpr=d}function w(b,c){var d=b.peek().substr(1).match(id);if(!d)throw new a("XPST0003");if("*"==d[1]||"*"==d[2])throw new a("XPST0003");if(b.next(),"in"!=b.peek())throw new a("XPST0003");b.next();var e;if(b.eof()||!(e=m(b,c)))throw new a("XPST0003");return new v(d[1]||null,d[2],d[1]?c.getURIForPrefix(d[1]):null,e)}function x(a,b,c){this.left=a,this.right=b,this.operator=c}function y(b,c){var d,e;if(!b.eof()&&(d=ya(b,c))){if(!(b.peek()in cd))return d;var f=b.peek();if(b.next(),b.eof()||!(e=ya(b,c)))throw new a("XPST0003");return new x(d,e,f)}}function z(a,b){var c=vc(a.left.evaluate(b),b);if(!c.length)return new Xa(!1);var d=vc(a.right.evaluate(b),b);if(!d.length)return new Xa(!1);for(var e,f,g=!1,h=0,i=c.length;hj)throw new a("XPST0017");if(i1)throw new a("XPTY0004")}else if("+"==d){if(e<1)throw new a("XPTY0004")}else if("*"!=d&&1!=e)throw new a("XPTY0004")}function va(a){this.left=a,this.items=[]}function wa(b,c){var d,e;if(!b.eof()&&(d=Ca(b,c))){if("intersect"!=(e=b.peek())&&"except"!=e)return d;for(var f=new va(d);"intersect"==(e=b.peek())||"except"==e;){if(b.next(),b.eof()||!(d=Ca(b,c)))throw new a("XPST0003");f.items.push([e,d])}return f}}function xa(a,b){this.left=a,this.right=b}function ya(b,c){var d,e;if(!b.eof()&&(d=D(b,c))){if("to"!=b.peek())return d;if(b.next(),b.eof()||!(e=D(b,c)))throw new a("XPST0003");return new xa(d,e)}}function za(a){this.left=a,this.items=[]}function Aa(b,c){var d,e;if(!b.eof()&&(d=wa(b,c))){if("|"!=(e=b.peek())&&"union"!=e)return d;for(var f=new za(d);"|"==(e=b.peek())||"union"==e;){if(b.next(),b.eof()||!(d=wa(b,c)))throw new a("XPST0003");f.items.push(d)}return f}}function Ba(a,b){this.expression=a,this.type=b}function Ca(b,c){var d,e;if(!b.eof()&&(d=Ea(b,c))){if("instance"!=b.peek()||"of"!=b.peek(1))return d;if(b.next(2),b.eof()||!(e=Oa(b,c)))throw new a("XPST0003");return new Ba(d,e)}}function Da(a,b){this.expression=a,this.type=b}function Ea(b,c){var d,e;if(!b.eof()&&(d=Ga(b,c))){if("treat"!=b.peek()||"as"!=b.peek(1))return d;if(b.next(2),b.eof()||!(e=Oa(b,c)))throw new a("XPST0003");return new Da(d,e)}}function Fa(a,b){this.expression=a,this.type=b}function Ga(b,c){var d,e;if(!b.eof()&&(d=Ia(b,c))){if("castable"!=b.peek()||"as"!=b.peek(1))return d;if(b.next(2),b.eof()||!(e=Qa(b,c)))throw new a("XPST0003");return new Fa(d,e)}}function Ha(a,b){this.expression=a,this.type=b}function Ia(b,c){var d,e;if(!b.eof()&&(d=H(b,c))){if("cast"!=b.peek()||"as"!=b.peek(1))return d;if(b.next(2),b.eof()||!(e=Qa(b,c)))throw new a("XPST0003");return new Ha(d,e)}}function Ja(a,b,c){this.prefix=a,this.localName=b,this.namespaceURI=c}function Ka(b,c){var d=b.peek().match(id);if(d){if("*"==d[1]||"*"==d[2])throw new a("XPST0003");return b.next(),new Ja(d[1]||null,d[2],d[1]?c.getURIForPrefix(d[1]):null)}}function La(a){this.test=a}function Ma(b,c){if(!b.eof()){var d;if("item"==b.peek()&&"("==b.peek(1)){if(b.next(2),")"!=b.peek())throw new a("XPST0003");return b.next(),new La}return(d=Z(b,c))?new La(d):(d=Ka(b,c))?new La(d):void 0}}function Na(a,b){this.itemType=a||null,this.occurence=b||null}function Oa(b,c){if(!b.eof()){if("empty-sequence"==b.peek()&&"("==b.peek(1)){if(b.next(2),")"!=b.peek())throw new a("XPST0003");return b.next(),new Na}var d,e;return!b.eof()&&(d=Ma(b,c))?(e=b.peek(),"?"==e||"*"==e||"+"==e?b.next():e=null,new Na(d,e)):void 0}}function Pa(a,b){this.itemType=a||null,this.occurence=b||null}function Qa(a,b){var c,d;if(!a.eof()&&(c=Ka(a,b)))return d=a.peek(),"?"==d?a.next():d=null,new Pa(c,d)}function Ra(){}function Sa(){}function Ta(){}function Ua(a){return a instanceof lb||a instanceof gb||a instanceof fb}function Va(a,b,c,d,e){this.scheme=a,this.authority=b,this.path=c,this.query=d,this.fragment=e}function Wa(a){this.value=a}function Xa(a){this.value=a}function Ya(a,b,c,d,e){this.year=a,this.month=b,this.day=c,this.timezone=d,this.negative=e}function Za(a,b){return 2==b&&(a%400==0||a%100!=0&&a%4==0)?29:pd[b-1]}function $a(a,b){if(!b){var c=Za(a.year,a.month);if(a.day>c)for(;a.day>c;)a.month+=1,a.month>12&&(a.year+=1,0==a.year&&(a.year=1),a.month=1),a.day-=c,c=Za(a.year,a.month);else if(a.day<1)for(;a.day<1;)a.month-=1,a.month<1&&(a.year-=1,0==a.year&&(a.year=-1),a.month=12),c=Za(a.year,a.month),a.day+=c}return a.month>12?(a.year+=~~(a.month/12),0==a.year&&(a.year=1),a.month=a.month%12):a.month<1&&(a.year+=~~(a.month/12)-1,0==a.year&&(a.year=-1),a.month=a.month%12+12),a}function _a(a,b,c,d,e,f,g,h){this.year=a,this.month=b,this.day=c,this.hours=d,this.minutes=e,this.seconds=f,this.timezone=g,this.negative=h}function ab(a,b){var c=Ac(a);return arguments.length<2&&(b=2),(c.length0?"+":"-")+ab(Gc.abs(~~(b/60)))+":"+ab(Gc.abs(b%60)):"Z"}function cb(a){return(a.negative?"-":"")+ab(a.year,4)+"-"+ab(a.month)+"-"+ab(a.day)}function db(a){var b=Ac(a.seconds).split(".");return ab(a.hours)+":"+ab(a.minutes)+":"+ab(b[0])+(b.length>1?"."+b[1]:"")}function eb(a){return $a(wb(a))}function fb(a){this.value=a}function gb(a){this.value=a}function hb(a,b,c,d,e,f,g){this.year=a,this.month=b,this.day=c,this.hours=d,this.minutes=e,this.seconds=f,this.negative=g}function ib(a){return(a.year?a.year+"Y":"")+(a.month?a.month+"M":"")}function jb(a){return(a.day?a.day+"D":"")+(a.hours||a.minutes||a.seconds?"T"+(a.hours?a.hours+"H":"")+(a.minutes?a.minutes+"M":"")+(a.seconds?a.seconds+"S":""):"")}function kb(a){return zb(Bb(a))}function lb(a){this.value=a}function mb(a,b){this.day=a,this.timezone=b}function nb(a,b){this.month=a,this.timezone=b}function ob(a,b,c){this.month=a,this.day=b,this.timezone=c}function pb(a,b){this.year=a,this.timezone=b}function qb(a,b,c){this.year=a,this.month=b,this.timezone=c}function rb(a){this.value=a}function sb(){}function tb(a,b,c){this.prefix=a,this.localName=b,this.namespaceURI=c}function ub(a){this.value=a}function vb(a,b,c,d){this.hours=a,this.minutes=b,this.seconds=c,this.timezone=d}function wb(a){return(a.seconds>=60||a.seconds<0)&&(a.minutes+=~~(a.seconds/60)-(a.seconds<0&&a.seconds%60?1:0),a.seconds=a.seconds%60+(a.seconds<0&&a.seconds%60?60:0)),(a.minutes>=60||a.minutes<0)&&(a.hours+=~~(a.minutes/60)-(a.minutes<0&&a.minutes%60?1:0),a.minutes=a.minutes%60+(a.minutes<0&&a.minutes%60?60:0)),(a.hours>=24||a.hours<0)&&(a instanceof _a&&(a.day+=~~(a.hours/24)-(a.hours<0&&a.hours%24?1:0)),a.hours=a.hours%24+(a.hours<0&&a.hours%24?24:0)),a}function xb(a){this.value=a}function yb(a,b,c){hb.call(this,a,b,0,0,0,0,c)}function zb(a){return a.month>=12&&(a.year+=~~(a.month/12),a.month%=12),a}function Ab(a,b,c,d,e){hb.call(this,0,0,a,b,c,d,e)}function Bb(a){return a.seconds>=60&&(a.minutes+=~~(a.seconds/60),a.seconds%=60),a.minutes>=60&&(a.hours+=~~(a.minutes/60),a.minutes%=60),a.hours>=24&&(a.day+=~~(a.hours/24),a.hours%=24),a}function Cb(a){this.value=a}function Db(a){this.value=a}function Eb(a){this.value=a}function Fb(a){this.value=a}function Gb(a){this.value=a}function Hb(a){this.value=a}function Ib(a){this.value=a}function Jb(a){this.value=a}function Kb(a){this.value=a}function Lb(a){this.value=a}function Mb(a){this.value=a}function Nb(a){this.value=a}function Ob(a){this.value=a}function Pb(a){this.value=a}function Qb(a){this.value=a}function Rb(a){this.value=a}function Sb(a){this.value=a}function Tb(a){this.value=a}function Ub(a){this.value=a}function Vb(a){this.value=a}function Wb(a){this.value=a}function Xb(a){this.value=a}function Yb(){}function Zb(){}function $b(){}function _b(){}function ac(){}function bc(){}function cc(){}function dc(){}function ec(a,b,c){var d=nc(a),e=nc(b);return new Xa("lt"==c?de:d==e)}function fc(a,b,c){return gc(_a.cast(a),_a.cast(b),c)}function gc(a,b,c){var d=new Ab(0,0,0,0),e=tc(a,d).toString(),f=tc(b,d).toString();return new Xa("lt"==c?ef:e==f)}function hc(a,b,c){var d;a instanceof Ya?d=new Ya(a.year,a.month,a.day,a.timezone,a.negative):a instanceof _a&&(d=new _a(a.year,a.month,a.day,a.hours,a.minutes,a.seconds,a.timezone,a.negative)),d.year=d.year+b.year*("-"==c?-1:1),d.month=d.month+b.month*("-"==c?-1:1),$a(d,!0);var e=Za(d.year,d.month);return d.day>e&&(d.day=e),d}function ic(a,b,c){var d;if(a instanceof Ya){var e=60*(60*b.hours+b.minutes)+b.seconds;d=new Ya(a.year,a.month,a.day,a.timezone,a.negative),d.day=d.day+b.day*("-"==c?-1:1)-1*(e&&"-"==c),$a(d)}else a instanceof _a&&(d=new _a(a.year,a.month,a.day,a.hours,a.minutes,a.seconds,a.timezone,a.negative),d.seconds=d.seconds+b.seconds*("-"==c?-1:1),d.minutes=d.minutes+b.minutes*("-"==c?-1:1),d.hours=d.hours+b.hours*("-"==c?-1:1),d.day=d.day+b.day*("-"==c?-1:1),eb(d));return d}function jc(a){return(60*(60*(24*a.day+a.hours)+a.minutes)+a.seconds)*(a.negative?-1:1)}function kc(a){var b=(a=Gc.round(a))<0,c=~~((a=Gc.abs(a))/86400),d=~~((a-=3600*c*24)/3600),e=~~((a-=3600*d)/60),f=a-=60*e;return new Ab(c,d,e,f,b)}function lc(a){return(12*a.year+a.month)*(a.negative?-1:1)}function mc(a){var b=(a=Gc.round(a))<0,c=~~((a=Gc.abs(a))/12),d=a-=12*c;return new yb(c,d,b)}function nc(a){return a.seconds+60*(a.minutes-(null!=a.timezone?a.timezone%60:0)+60*(a.hours-(null!=a.timezone?~~(a.timezone/60):0)))}function oc(a){var b=new Ec((a.negative?-1:1)*a.year,a.month,a.day,0,0,0,0);return a instanceof _a&&(b.setHours(a.hours),b.setMinutes(a.minutes),b.setSeconds(a.seconds)),null!=a.timezone&&b.setMinutes(b.getMinutes()-a.timezone),b.getTime()/1e3}function pc(a,b){if(Ic(a)||Gc.abs(a)==Lc||Ic(b)||Gc.abs(b)==Lc)return 0;var c=Ac(a).match(jd),d=Ac(b).match(jd),e=Gc.max(1,(c[2]||c[3]||"").length+(c[5]||0)*("+"==c[4]?-1:1),(d[2]||d[3]||"").length+(d[5]||0)*("+"==d[4]?-1:1));return e+(e%2?0:1)}function qc(a,b,c){return new(a instanceof Cb&&b instanceof Cb&&c==Gc.round(c)?Cb:fb)(c)}function rc(a,b){if(null==a)return null;var c=a[b]*(a.negative?-1:1);return"seconds"==b?new fb(c):new Cb(c)}function sc(a,b){if(null==a)return null;if("timezone"==b){var c=a.timezone;return null==c?null:new Ab(0,Gc.abs(~~(c/60)),Gc.abs(c%60),0,c<0)}var d=a[b];return a instanceof Ya||"hours"==b&&24==d&&(d=0),a instanceof vb||(d*=a.negative?-1:1),"seconds"==b?new fb(d):new Cb(d)}function tc(a,b){if(null==a)return null;var c;if(c=a instanceof Ya?new Ya(a.year,a.month,a.day,a.timezone,a.negative):a instanceof vb?new vb(a.hours,a.minutes,a.seconds,a.timezone,a.negative):new _a(a.year,a.month,a.day,a.hours,a.minutes,a.seconds,a.timezone,a.negative),null==b)c.timezone=null;else{var d=jc(b)/60;if(null!=a.timezone){var e=d-a.timezone;a instanceof Ya?e<0&&c.day--:(c.minutes+=e%60,c.hours+=~~(e/60)),eb(c)}c.timezone=d}return c}function uc(b,c){if(!b.length)return!1;var d=b[0];if(c.DOMAdapter.isNode(d))return!0;if(1==b.length){if(d instanceof Xa)return d.value.valueOf();if(d instanceof ub)return!!d.valueOf().length;if(Ua(d))return!(Ic(d.valueOf())||0==d.valueOf());throw new a("FORG0006")}throw new a("FORG0006")}function vc(a,b){for(var c,d,e=[],f=0,g=a.length;f=0,j=c.indexOf("x")>=0;if(i||j){c=c.replace(/[sx]/g,"");for(var k,l=[],m=/\s/,n=0,o=b.length,p=!1,q="";n0},b.prototype.eof=function(){return this.index>=this.length},c.prototype.isNode=function(a){return a&&!!a.nodeType},c.prototype.getProperty=function(a,b){return a[b]},c.prototype.isSameNode=function(a,b){return a==b},c.prototype.compareDocumentPosition=function(a,b){return a.compareDocumentPosition(b)},c.prototype.lookupNamespaceURI=function(a,b){return a.lookupNamespaceURI(b)},c.prototype.getElementById=function(a,b){return a.getElementById(b)},c.prototype.getElementsByTagNameNS=function(a,b,c){return a.getElementsByTagNameNS(b,c)},d.prototype.item=null,d.prototype.position=0,d.prototype.size=0,d.prototype.scope=null,d.prototype.stack=null,d.prototype.dateTime=null,d.prototype.timezone=null,d.prototype.staticContext=null,d.prototype.pushVariable=function(a,b){this.stack.hasOwnProperty(a)||(this.stack[a]=[]),this.stack[a].push(this.scope[a]),this.scope[a]=b},d.prototype.popVariable=function(a){this.stack.hasOwnProperty(a)&&(this.scope[a]=this.stack[a].pop(),this.stack[a].length||(delete this.stack[a],"undefined"==typeof this.scope[a]&&delete this.scope[a]))},e.prototype.baseURI=null,e.prototype.dataTypes=null,e.prototype.documents=null,e.prototype.functions=null,e.prototype.defaultFunctionNamespace=null,e.prototype.collations=null,e.prototype.defaultCollationName=Sc+"/collation/codepoint",e.prototype.collections=null,e.prototype.namespaceResolver=null,e.prototype.defaultElementNamespace=null;var Wc=/^(?:\{([^\}]+)\})?(.+)$/;e.prototype.setDataType=function(a,b){var c=a.match(Wc);c&&c[1]!=Rc&&(this.dataTypes[a]=b)},e.prototype.getDataType=function(a){var b=a.match(Wc);if(b)return b[1]==Rc?Zc[b[2]]:this.dataTypes[a]},e.prototype.setDocument=function(a,b){this.documents[a]=b},e.prototype.getDocument=function(a){return this.documents[a]},e.prototype.setFunction=function(a,b){var c=a.match(Wc);c&&c[1]!=Sc&&(this.functions[a]=b)},e.prototype.getFunction=function(a){var b=a.match(Wc);if(b)return b[1]==Sc?Xc[b[2]]:this.functions[a]},e.prototype.setCollation=function(a,b){this.collations[a]=b},e.prototype.getCollation=function(a){return this.collations[a]},e.prototype.setCollection=function(a,b){this.collections[a]=b},e.prototype.getCollection=function(a){return this.collections[a]},e.prototype.getURIForPrefix=function(b){var c,d=this.namespaceResolver,e=d&&d.lookupNamespaceURI?d.lookupNamespaceURI:d;if(e instanceof Fc&&(c=e.call(d,b)))return c;if("fn"==b)return Sc;if("xs"==b)return Rc;if("xml"==b)return Uc;if("xmlns"==b)return Tc;throw new a("XPST0081")},e.js2xs=function(a){return a="boolean"==typeof a?new Xa(a):"number"==typeof a?Ic(a)||!Jc(a)?new gb(a):ja(Ac(a)):new ub(Ac(a))},e.xs2js=function(a){return a=a instanceof Xa?a.valueOf():Ua(a)?a.valueOf():a.toString()};var Xc={},Yc={},Zc={},$c={};h.prototype.internalExpression=null,h.prototype.evaluate=function(a){return this.internalExpression.evaluate(a)},i.prototype.equals=function(a,b){throw"Not implemented"},i.prototype.compare=function(a,b){throw"Not implemented"},j.ANYSIMPLETYPE_DT=1,j.STRING_DT=2,j.BOOLEAN_DT=3,j.DECIMAL_DT=4,j.FLOAT_DT=5,j.DOUBLE_DT=6,j.DURATION_DT=7,j.DATETIME_DT=8,j.TIME_DT=9,j.DATE_DT=10,j.GYEARMONTH_DT=11,j.GYEAR_DT=12,j.GMONTHDAY_DT=13,j.GDAY_DT=14,j.GMONTH_DT=15,j.HEXBINARY_DT=16,j.BASE64BINARY_DT=17,j.ANYURI_DT=18,j.QNAME_DT=19,j.NOTATION_DT=20,j.NORMALIZEDSTRING_DT=21,j.TOKEN_DT=22,j.LANGUAGE_DT=23,j.NMTOKEN_DT=24,j.NAME_DT=25,j.NCNAME_DT=26,j.ID_DT=27,j.IDREF_DT=28,j.ENTITY_DT=29,j.INTEGER_DT=30,j.NONPOSITIVEINTEGER_DT=31,j.NEGATIVEINTEGER_DT=32,j.LONG_DT=33,j.INT_DT=34,j.SHORT_DT=35,j.BYTE_DT=36,j.NONNEGATIVEINTEGER_DT=37,j.UNSIGNEDLONG_DT=38,j.UNSIGNEDINT_DT=39,j.UNSIGNEDSHORT_DT=40,j.UNSIGNEDBYTE_DT=41,j.POSITIVEINTEGER_DT=42,j.LISTOFUNION_DT=43,j.LIST_DT=44,j.UNAVAILABLE_DT=45,j.DATETIMESTAMP_DT=46,j.DAYMONTHDURATION_DT=47,j.DAYTIMEDURATION_DT=48,j.PRECISIONDECIMAL_DT=49,j.ANYATOMICTYPE_DT=50,j.ANYTYPE_DT=51,j.XT_YEARMONTHDURATION_DT=-1,j.XT_UNTYPEDATOMIC_DT=-2,k.prototype.items=null,k.prototype.evaluate=function(a){for(var b=[],c=0,d=this.items.length;c":"gt","<":"lt",">=":"ge","<=":"le"},ad={};ad.eq=function(b,c,d){var e="";if(Ua(b))Ua(c)&&(e="numeric-equal");else if(b instanceof Xa)c instanceof Xa&&(e="boolean-equal");else if(b instanceof ub){if(c instanceof ub)return $c["numeric-equal"].call(d,Xc.compare.call(d,b,c),new Cb(0))}else b instanceof Ya?c instanceof Ya&&(e="date-equal"):b instanceof vb?c instanceof vb&&(e="time-equal"):b instanceof _a?c instanceof _a&&(e="dateTime-equal"):b instanceof hb?c instanceof hb&&(e="duration-equal"):b instanceof qb?c instanceof qb&&(e="gYearMonth-equal"):b instanceof pb?c instanceof pb&&(e="gYear-equal"):b instanceof ob?c instanceof ob&&(e="gMonthDay-equal"):b instanceof nb?c instanceof nb&&(e="gMonth-equal"):b instanceof mb?c instanceof mb&&(e="gDay-equal"):b instanceof tb?c instanceof tb&&(e="QName-equal"):b instanceof rb?c instanceof rb&&(e="hexBinary-equal"):b instanceof Wa&&c instanceof Wa&&(e="base64Binary-equal");if(e)return $c[e].call(d,b,c);throw new a("XPTY0004")},ad.ne=function(a,b,c){return new Xa(!ad.eq(a,b,c).valueOf())},ad.gt=function(b,c,d){var e="";if(Ua(b))Ua(c)&&(e="numeric-greater-than");else if(b instanceof Xa)c instanceof Xa&&(e="boolean-greater-than");else if(b instanceof ub){if(c instanceof ub)return $c["numeric-greater-than"].call(d,Xc.compare.call(d,b,c),new Cb(0))}else b instanceof Ya?c instanceof Ya&&(e="date-greater-than"):b instanceof vb?c instanceof vb&&(e="time-greater-than"):b instanceof _a?c instanceof _a&&(e="dateTime-greater-than"):b instanceof yb?c instanceof yb&&(e="yearMonthDuration-greater-than"):b instanceof Ab&&c instanceof Ab&&(e="dayTimeDuration-greater-than"); if(e)return $c[e].call(d,b,c);throw new a("XPTY0004")},ad.lt=function(b,c,d){var e="";if(Ua(b))Ua(c)&&(e="numeric-less-than");else if(b instanceof Xa)c instanceof Xa&&(e="boolean-less-than");else if(b instanceof ub){if(c instanceof ub)return $c["numeric-less-than"].call(d,Xc.compare.call(d,b,c),new Cb(0))}else b instanceof Ya?c instanceof Ya&&(e="date-less-than"):b instanceof vb?c instanceof vb&&(e="time-less-than"):b instanceof _a?c instanceof _a&&(e="dateTime-less-than"):b instanceof yb?c instanceof yb&&(e="yearMonthDuration-less-than"):b instanceof Ab&&c instanceof Ab&&(e="dayTimeDuration-less-than");if(e)return $c[e].call(d,b,c);throw new a("XPTY0004")},ad.ge=function(b,c,d){var e="";if(Ua(b))Ua(c)&&(e="numeric-less-than");else if(b instanceof Xa)c instanceof Xa&&(e="boolean-less-than");else if(b instanceof ub){if(c instanceof ub)return $c["numeric-greater-than"].call(d,Xc.compare.call(d,b,c),new Cb(-1))}else b instanceof Ya?c instanceof Ya&&(e="date-less-than"):b instanceof vb?c instanceof vb&&(e="time-less-than"):b instanceof _a?c instanceof _a&&(e="dateTime-less-than"):b instanceof yb?c instanceof yb&&(e="yearMonthDuration-less-than"):b instanceof Ab&&c instanceof Ab&&(e="dayTimeDuration-less-than");if(e)return new Xa(!$c[e].call(d,b,c).valueOf());throw new a("XPTY0004")},ad.le=function(b,c,d){var e="";if(Ua(b))Ua(c)&&(e="numeric-greater-than");else if(b instanceof Xa)c instanceof Xa&&(e="boolean-greater-than");else if(b instanceof ub){if(c instanceof ub)return $c["numeric-less-than"].call(d,Xc.compare.call(d,b,c),new Cb(1))}else b instanceof Ya?c instanceof Ya&&(e="date-greater-than"):b instanceof vb?c instanceof vb&&(e="time-greater-than"):b instanceof _a?c instanceof _a&&(e="dateTime-greater-than"):b instanceof yb?c instanceof yb&&(e="yearMonthDuration-greater-than"):b instanceof Ab&&c instanceof Ab&&(e="dayTimeDuration-greater-than");if(e)return new Xa(!$c[e].call(d,b,c).valueOf());throw new a("XPTY0004")};var bd={};bd.is=function(a,b,c){return $c["is-same-node"].call(c,a,b)},bd[">>"]=function(a,b,c){return $c["node-after"].call(c,a,b)},bd["<<"]=function(a,b,c){return $c["node-before"].call(c,a,b)};var cd={"=":z,"!=":z,"<":z,"<=":z,">":z,">=":z,eq:A,ne:A,lt:A,le:A,gt:A,ge:A,is:B,">>":B,"<<":B};C.prototype.left=null,C.prototype.items=null;var dd={};dd["+"]=function(b,c,d){var e="",f=!1;if(Ua(b)?Ua(c)&&(e="numeric-add"):b instanceof Ya?c instanceof yb?e="add-yearMonthDuration-to-date":c instanceof Ab&&(e="add-dayTimeDuration-to-date"):b instanceof yb?c instanceof Ya?(e="add-yearMonthDuration-to-date",f=!0):c instanceof _a?(e="add-yearMonthDuration-to-dateTime",f=!0):c instanceof yb&&(e="add-yearMonthDurations"):b instanceof Ab?c instanceof Ya?(e="add-dayTimeDuration-to-date",f=!0):c instanceof vb?(e="add-dayTimeDuration-to-time",f=!0):c instanceof _a?(e="add-dayTimeDuration-to-dateTime",f=!0):c instanceof Ab&&(e="add-dayTimeDurations"):b instanceof vb?c instanceof Ab&&(e="add-dayTimeDuration-to-time"):b instanceof _a&&(c instanceof yb?e="add-yearMonthDuration-to-dateTime":c instanceof Ab&&(e="add-dayTimeDuration-to-dateTime")),e)return $c[e].call(d,f?c:b,f?b:c);throw new a("XPTY0004")},dd["-"]=function(b,c,d){var e="";if(Ua(b)?Ua(c)&&(e="numeric-subtract"):b instanceof Ya?c instanceof Ya?e="subtract-dates":c instanceof yb?e="subtract-yearMonthDuration-from-date":c instanceof Ab&&(e="subtract-dayTimeDuration-from-date"):b instanceof vb?c instanceof vb?e="subtract-times":c instanceof Ab&&(e="subtract-dayTimeDuration-from-time"):b instanceof _a?c instanceof _a?e="subtract-dateTimes":c instanceof yb?e="subtract-yearMonthDuration-from-dateTime":c instanceof Ab&&(e="subtract-dayTimeDuration-from-dateTime"):b instanceof yb?c instanceof yb&&(e="subtract-yearMonthDurations"):b instanceof Ab&&c instanceof Ab&&(e="subtract-dayTimeDurations"),e)return $c[e].call(d,b,c);throw new a("XPTY0004")},C.prototype.evaluate=function(a){var b=vc(this.left.evaluate(a),a);if(!b.length)return[];ua(a,b,"?");var c=b[0];c instanceof xb&&(c=gb.cast(c));for(var d,e,f=0,g=this.items.length;f1)return[new Xa(!1)];if(!c.length)return[new Xa("?"==e)];try{d.cast(vc(c,b)[0])}catch(b){if("XPST0051"==b.code)throw b;if("XPST0017"==b.code)throw new a("XPST0080");return[new Xa(!1)]}return[new Xa(!0)]},Ha.prototype.expression=null,Ha.prototype.type=null,Ha.prototype.evaluate=function(a){var b=this.expression.evaluate(a);return ua(a,b,this.type.occurence),b.length?[this.type.itemType.cast(vc(b,a)[0],a)]:[]},Ja.prototype.prefix=null,Ja.prototype.localName=null,Ja.prototype.namespaceURI=null,Ja.prototype.test=function(b,c){var d=(this.namespaceURI?"{"+this.namespaceURI+"}":"")+this.localName,e=this.namespaceURI==Rc?Zc[this.localName]:c.staticContext.getDataType(d);if(e)return b instanceof e;throw new a("XPST0051")},Ja.prototype.cast=function(b,c){var d=(this.namespaceURI?"{"+this.namespaceURI+"}":"")+this.localName,e=this.namespaceURI==Rc?Zc[this.localName]:c.staticContext.getDataType(d);if(e)return e.cast(b);throw new a("XPST0051")},La.prototype.test=null,Na.prototype.itemType=null,Na.prototype.occurence=null,Pa.prototype.itemType=null,Pa.prototype.occurence=null,Ra.prototype.builtInKind=j.ANYTYPE_DT,Sa.prototype=new Ra,Sa.prototype.builtInKind=j.ANYSIMPLETYPE_DT,Sa.prototype.primitiveKind=null,Sa.PRIMITIVE_ANYURI="anyURI",Sa.PRIMITIVE_BASE64BINARY="base64Binary",Sa.PRIMITIVE_BOOLEAN="boolean",Sa.PRIMITIVE_DATE="date",Sa.PRIMITIVE_DATETIME="dateTime",Sa.PRIMITIVE_DECIMAL="decimal",Sa.PRIMITIVE_DOUBLE="double",Sa.PRIMITIVE_DURATION="duration",Sa.PRIMITIVE_FLOAT="float",Sa.PRIMITIVE_GDAY="gDay",Sa.PRIMITIVE_GMONTH="gMonth",Sa.PRIMITIVE_GMONTHDAY="gMonthDay",Sa.PRIMITIVE_GYEAR="gYear",Sa.PRIMITIVE_GYEARMONTH="gYearMonth",Sa.PRIMITIVE_HEXBINARY="hexBinary",Sa.PRIMITIVE_NOTATION="NOTATION",Sa.PRIMITIVE_QNAME="QName",Sa.PRIMITIVE_STRING="string",Sa.PRIMITIVE_TIME="time",Ta.prototype=new Sa,Ta.prototype.builtInKind=j.ANYATOMICTYPE_DT,Ta.cast=function(b){throw new a("XPST0017")},g("anyAtomicType",Ta),Va.prototype=new Ta,Va.prototype.builtInKind=j.ANYURI_DT,Va.prototype.primitiveKind=Sa.PRIMITIVE_ANYURI,Va.prototype.scheme=null,Va.prototype.authority=null,Va.prototype.path=null,Va.prototype.query=null,Va.prototype.fragment=null,Va.prototype.toString=function(){return(this.scheme?this.scheme+":":"")+(this.authority?"//"+this.authority:"")+(this.path?this.path:"")+(this.query?"?"+this.query:"")+(this.fragment?"#"+this.fragment:"")};var ld=/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;Va.cast=function(b){if(b instanceof Va)return b;if(b instanceof ub||b instanceof xb){var c;if(c=Pc(b).match(ld))return new Va(c[2],c[4],c[5],c[7],c[9]);throw new a("FORG0001")}throw new a("XPTY0004")},g("anyURI",Va),Wa.prototype=new Ta,Wa.prototype.builtInKind=j.BASE64BINARY_DT,Wa.prototype.primitiveKind=Sa.PRIMITIVE_BASE64BINARY,Wa.prototype.value=null,Wa.prototype.valueOf=function(){return this.value},Wa.prototype.toString=function(){return this.value};var md=/^((([A-Za-z0-9+\/]\s*){4})*(([A-Za-z0-9+\/]\s*){3}[A-Za-z0-9+\/]|([A-Za-z0-9+\/]\s*){2}[AEIMQUYcgkosw048]\s*=|[A-Za-z0-9+\/]\s*[AQgw]\s*=\s*=))?$/;Wa.cast=function(b){if(b instanceof Wa)return b;if(b instanceof ub||b instanceof xb){var c=Pc(b).match(md);if(c)return new Wa(c[0]);throw new a("FORG0001")}if(b instanceof rb){for(var c=b.valueOf().match(/.{2}/g),d=[],e=0,f=c.length;e=-0x8000000000000000)return new Fb(c.value);throw new a("FORG0001")},g("long",Fb),Gb.prototype=new Fb,Gb.prototype.builtInKind=j.INT_DT,Gb.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value<=2147483647&&c.value>=-2147483648)return new Gb(c.value);throw new a("FORG0001")},g("int",Gb),Hb.prototype=new Gb,Hb.prototype.builtInKind=j.SHORT_DT,Hb.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value<=32767&&c.value>=-32768)return new Hb(c.value);throw new a("FORG0001")},g("short",Hb),Ib.prototype=new Hb,Ib.prototype.builtInKind=j.BYTE_DT,Ib.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value<=127&&c.value>=-128)return new Ib(c.value);throw new a("FORG0001")},g("byte",Ib),Jb.prototype=new Cb,Jb.prototype.builtInKind=j.NONNEGATIVEINTEGER_DT,Jb.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value>=0)return new Jb(c.value);throw new a("FORG0001")},g("nonNegativeInteger",Jb),Kb.prototype=new Jb,Kb.prototype.builtInKind=j.POSITIVEINTEGER_DT,Kb.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value>=1)return new Kb(c.value);throw new a("FORG0001")},g("positiveInteger",Kb),Lb.prototype=new Jb,Lb.prototype.builtInKind=j.UNSIGNEDLONG_DT,Lb.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value>=1&&c.value<=0x10000000000000000)return new Lb(c.value);throw new a("FORG0001")},g("unsignedLong",Lb),Mb.prototype=new Jb,Mb.prototype.builtInKind=j.UNSIGNEDINT_DT,Mb.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value>=1&&c.value<=4294967295)return new Mb(c.value);throw new a("FORG0001")},g("unsignedInt",Mb),Nb.prototype=new Mb,Nb.prototype.builtInKind=j.UNSIGNEDSHORT_DT,Nb.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value>=1&&c.value<=65535)return new Nb(c.value);throw new a("FORG0001")},g("unsignedShort",Nb),Ob.prototype=new Nb,Ob.prototype.builtInKind=j.UNSIGNEDBYTE_DT, Ob.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value>=1&&c.value<=255)return new Ob(c.value);throw new a("FORG0001")},g("unsignedByte",Ob),Pb.prototype=new ub,Pb.prototype.builtInKind=j.NORMALIZEDSTRING_DT,Pb.cast=function(a){return new Pb(Ac(a))},g("normalizedString",Pb),Qb.prototype=new Pb,Qb.prototype.builtInKind=j.TOKEN_DT,Qb.cast=function(a){return new Qb(Ac(a))},g("token",Qb),Rb.prototype=new Qb,Rb.prototype.builtInKind=j.NAME_DT,Rb.cast=function(a){return new Rb(Ac(a))},g("Name",Rb),Sb.prototype=new Rb,Sb.prototype.builtInKind=j.NCNAME_DT,Sb.cast=function(a){return new Sb(Ac(a))},g("NCName",Sb),Tb.prototype=new Sb,Tb.prototype.builtInKind=j.ENTITY_DT,Tb.cast=function(a){return new Tb(Ac(a))},g("ENTITY",Tb),Ub.prototype=new Sb,Ub.prototype.builtInKind=j.ID_DT,Ub.cast=function(a){return new Ub(Ac(a))},g("ID",Ub),Vb.prototype=new Sb,Vb.prototype.builtInKind=j.IDREF_DT,Vb.cast=function(a){return new Vb(Ac(a))},g("IDREF",Vb),Wb.prototype=new Qb,Wb.prototype.builtInKind=j.LANGUAGE_DT,Wb.cast=function(a){return new Wb(Ac(a))},g("language",Wb),Xb.prototype=new Qb,Xb.prototype.builtInKind=j.NMTOKEN_DT,Xb.cast=function(a){return new Xb(Ac(a))},g("NMTOKEN",Xb),Zb.prototype=new Yb,$b.prototype=new Zb,_b.prototype=new Zb,ac.prototype=new Zb,bc.prototype=new Zb,cc.prototype=new Zb,dc.prototype=new Zb,$c["hexBinary-equal"]=function(a,b){return new Xa(a.valueOf()==b.valueOf())},$c["base64Binary-equal"]=function(a,b){return new Xa(a.valueOf()==b.valueOf())},$c["boolean-equal"]=function(a,b){return new Xa(a.valueOf()==b.valueOf())},$c["boolean-less-than"]=function(a,b){return new Xa(a.valueOf()b.valueOf())},$c["yearMonthDuration-less-than"]=function(a,b){return new Xa(lc(a)lc(b))},$c["dayTimeDuration-less-than"]=function(a,b){return new Xa(jc(a)jc(b))},$c["duration-equal"]=function(a,b){return new Xa(a.negative==b.negative&&lc(a)==lc(b)&&jc(a)==jc(b))},$c["dateTime-equal"]=function(a,b){return gc(a,b,"eq")},$c["dateTime-less-than"]=function(a,b){return gc(a,b,"lt")},$c["dateTime-greater-than"]=function(a,b){return gc(a,b,"gt")},$c["date-equal"]=function(a,b){return fc(a,b,"eq")},$c["date-less-than"]=function(a,b){return fc(a,b,"lt")},$c["date-greater-than"]=function(a,b){return fc(a,b,"gt")},$c["time-equal"]=function(a,b){return ec(a,b,"eq")},$c["time-less-than"]=function(a,b){return ec(a,b,"lt")},$c["time-greater-than"]=function(a,b){return ec(a,b,"gt")},$c["gYearMonth-equal"]=function(a,b){return gc(new _a(a.year,a.month,Za(a.year,a.month),0,0,0,null==a.timezone?this.timezone:a.timezone),new _a(b.year,b.month,Za(b.year,b.month),0,0,0,null==b.timezone?this.timezone:b.timezone),"eq")},$c["gYear-equal"]=function(a,b){return gc(new _a(a.year,1,1,0,0,0,null==a.timezone?this.timezone:a.timezone),new _a(b.year,1,1,0,0,0,null==b.timezone?this.timezone:b.timezone),"eq")},$c["gMonthDay-equal"]=function(a,b){return gc(new _a(1972,a.month,a.day,0,0,0,null==a.timezone?this.timezone:a.timezone),new _a(1972,b.month,b.day,0,0,0,null==b.timezone?this.timezone:b.timezone),"eq")},$c["gMonth-equal"]=function(a,b){return gc(new _a(1972,a.month,Za(1972,b.month),0,0,0,null==a.timezone?this.timezone:a.timezone),new _a(1972,b.month,Za(1972,b.month),0,0,0,null==b.timezone?this.timezone:b.timezone),"eq")},$c["gDay-equal"]=function(a,b){return gc(new _a(1972,12,a.day,0,0,0,null==a.timezone?this.timezone:a.timezone),new _a(1972,12,b.day,0,0,0,null==b.timezone?this.timezone:b.timezone),"eq")},$c["add-yearMonthDurations"]=function(a,b){return mc(lc(a)+lc(b))},$c["subtract-yearMonthDurations"]=function(a,b){return mc(lc(a)-lc(b))},$c["multiply-yearMonthDuration"]=function(a,b){return mc(lc(a)*b)},$c["divide-yearMonthDuration"]=function(a,b){return mc(lc(a)/b)},$c["divide-yearMonthDuration-by-yearMonthDuration"]=function(a,b){return new fb(lc(a)/lc(b))},$c["add-dayTimeDurations"]=function(a,b){return kc(jc(a)+jc(b))},$c["subtract-dayTimeDurations"]=function(a,b){return kc(jc(a)-jc(b))},$c["multiply-dayTimeDuration"]=function(a,b){return kc(jc(a)*b)},$c["divide-dayTimeDuration"]=function(a,b){return kc(jc(a)/b)},$c["divide-dayTimeDuration-by-dayTimeDuration"]=function(a,b){return new fb(jc(a)/jc(b))},$c["subtract-dateTimes"]=function(a,b){return kc(oc(a)-oc(b))},$c["subtract-dates"]=function(a,b){return kc(oc(a)-oc(b))},$c["subtract-times"]=function(a,b){return kc(nc(a)-nc(b))},$c["add-yearMonthDuration-to-dateTime"]=function(a,b){return hc(a,b,"+")},$c["add-dayTimeDuration-to-dateTime"]=function(a,b){return ic(a,b,"+")},$c["subtract-yearMonthDuration-from-dateTime"]=function(a,b){return hc(a,b,"-")},$c["subtract-dayTimeDuration-from-dateTime"]=function(a,b){return ic(a,b,"-")},$c["add-yearMonthDuration-to-date"]=function(a,b){return hc(a,b,"+")},$c["add-dayTimeDuration-to-date"]=function(a,b){return ic(a,b,"+")},$c["subtract-yearMonthDuration-from-date"]=function(a,b){return hc(a,b,"-")},$c["subtract-dayTimeDuration-from-date"]=function(a,b){return ic(a,b,"-")},$c["add-dayTimeDuration-to-time"]=function(a,b){var c=new vb(a.hours,a.minutes,a.seconds,a.timezone);return c.hours+=b.hours,c.minutes+=b.minutes,c.seconds+=b.seconds,wb(c)},$c["subtract-dayTimeDuration-from-time"]=function(a,b){var c=new vb(a.hours,a.minutes,a.seconds,a.timezone);return c.hours-=b.hours,c.minutes-=b.minutes,c.seconds-=b.seconds,wb(c)},$c["is-same-node"]=function(a,b){return new Xa(this.DOMAdapter.isSameNode(a,b))},$c["node-before"]=function(a,b){return new Xa(!!(4&this.DOMAdapter.compareDocumentPosition(a,b)))},$c["node-after"]=function(a,b){return new Xa(!!(2&this.DOMAdapter.compareDocumentPosition(a,b)))},$c["numeric-add"]=function(a,b){var c=a.valueOf(),d=b.valueOf(),e=Gc.pow(10,pc(c,d));return qc(a,b,(c*e+d*e)/e)},$c["numeric-subtract"]=function(a,b){var c=a.valueOf(),d=b.valueOf(),e=Gc.pow(10,pc(c,d));return qc(a,b,(c*e-d*e)/e)},$c["numeric-multiply"]=function(a,b){var c=a.valueOf(),d=b.valueOf(),e=Gc.pow(10,pc(c,d));return qc(a,b,c*e*(d*e)/(e*e))},$c["numeric-divide"]=function(a,b){var c=a.valueOf(),d=b.valueOf(),e=Gc.pow(10,pc(c,d));return qc(a,b,a*e/(b*e))},$c["numeric-integer-divide"]=function(a,b){var c=a/b;return new Cb(Gc.floor(c)+(c<0))},$c["numeric-mod"]=function(a,b){var c=a.valueOf(),d=b.valueOf(),e=Gc.pow(10,pc(c,d));return qc(a,b,c*e%(d*e)/e)},$c["numeric-unary-plus"]=function(a){return a},$c["numeric-unary-minus"]=function(a){return a.value*=-1,a},$c["numeric-equal"]=function(a,b){return new Xa(a.valueOf()==b.valueOf())},$c["numeric-less-than"]=function(a,b){return new Xa(a.valueOf()b.valueOf())},$c["QName-equal"]=function(a,b){return new Xa(a.localName==b.localName&&a.namespaceURI==b.namespaceURI)},$c.concatenate=function(a,b){return a.concat(b)},$c.union=function(b,c){for(var d,e=[],f=0,g=b.length;fh?g.pop():(g.push(f[i]),h++):"."!=f[i]&&g.push(f[i]);".."!=f[--i]&&"."!=f[i]||g.push(""),d.path=g.join("/")}return d}),f("true",[],function(){return new Xa(!0)}),f("false",[],function(){return new Xa(!1)}),f("not",[[Yb,"*"]],function(a){return new Xa(!uc(a,this))}),f("position",[],function(){return new Cb(this.position)}),f("last",[],function(){return new Cb(this.size)}),f("current-dateTime",[],function(){return this.dateTime}),f("current-date",[],function(){return Ya.cast(this.dateTime)}),f("current-time",[],function(){return vb.cast(this.dateTime)}),f("implicit-timezone",[],function(){return this.timezone}),f("default-collation",[],function(){return new ub(this.staticContext.defaultCollationName)}),f("static-base-uri",[],function(){return Va.cast(new ub(this.staticContext.baseURI||""))}),f("years-from-duration",[[hb,"?"]],function(a){return rc(a,"year")}),f("months-from-duration",[[hb,"?"]],function(a){return rc(a,"month")}),f("days-from-duration",[[hb,"?"]],function(a){return rc(a,"day")}),f("hours-from-duration",[[hb,"?"]],function(a){return rc(a,"hours")}),f("minutes-from-duration",[[hb,"?"]],function(a){return rc(a,"minutes")}),f("seconds-from-duration",[[hb,"?"]],function(a){return rc(a,"seconds")}),f("year-from-dateTime",[[_a,"?"]],function(a){return sc(a,"year")}),f("month-from-dateTime",[[_a,"?"]],function(a){return sc(a,"month")}),f("day-from-dateTime",[[_a,"?"]],function(a){return sc(a,"day")}),f("hours-from-dateTime",[[_a,"?"]],function(a){return sc(a,"hours")}),f("minutes-from-dateTime",[[_a,"?"]],function(a){return sc(a,"minutes")}),f("seconds-from-dateTime",[[_a,"?"]],function(a){return sc(a,"seconds")}),f("timezone-from-dateTime",[[_a,"?"]],function(a){return sc(a,"timezone")}),f("year-from-date",[[Ya,"?"]],function(a){return sc(a,"year")}),f("month-from-date",[[Ya,"?"]],function(a){return sc(a,"month")}),f("day-from-date",[[Ya,"?"]],function(a){return sc(a,"day")}),f("timezone-from-date",[[Ya,"?"]],function(a){return sc(a,"timezone")}),f("hours-from-time",[[vb,"?"]],function(a){return sc(a,"hours")}),f("minutes-from-time",[[vb,"?"]],function(a){return sc(a,"minutes")}),f("seconds-from-time",[[vb,"?"]],function(a){return sc(a,"seconds")}),f("timezone-from-time",[[vb,"?"]],function(a){return sc(a,"timezone")}),f("adjust-dateTime-to-timezone",[[_a,"?"],[Ab,"?",!0]],function(a,b){return tc(a,arguments.length>1&&null!=b?arguments.length>1?b:this.timezone:null)});f("adjust-date-to-timezone",[[Ya,"?"],[Ab,"?",!0]],function(a,b){return tc(a,arguments.length>1&&null!=b?arguments.length>1?b:this.timezone:null)});f("adjust-time-to-timezone",[[vb,"?"],[Ab,"?",!0]],function(a,b){return tc(a,arguments.length>1&&null!=b?arguments.length>1?b:this.timezone:null)}),f("name",[[Zb,"?",!0]],function(b){if(arguments.length){if(null==b)return new ub("")}else{if(!this.DOMAdapter.isNode(this.item))throw new a("XPTY0004");b=this.item}var c=Xc["node-name"].call(this,b);return new ub(null==c?"":c.toString())}),f("local-name",[[Zb,"?",!0]],function(b){if(arguments.length){if(null==b)return new ub("")}else{if(!this.DOMAdapter.isNode(this.item))throw new a("XPTY0004");b=this.item}return new ub(this.DOMAdapter.getProperty(b,"localName")||"")}),f("namespace-uri",[[Zb,"?",!0]],function(b){if(arguments.length){if(null==b)return Va.cast(new ub(""))}else{if(!this.DOMAdapter.isNode(this.item))throw new a("XPTY0004");b=this.item}return Va.cast(new ub(this.DOMAdapter.getProperty(b,"namespaceURI")||""))}),f("number",[[Ta,"?",!0]],function(b){if(!arguments.length){if(!this.item)throw new a("XPDY0002");b=vc([this.item],this)[0]}var c=new gb(Kc);if(null!=b)try{c=gb.cast(b)}catch(a){}return c}),f("lang",[[ub,"?"],[Zb,"",!0]],function(b,c){if(arguments.length<2){if(!this.DOMAdapter.isNode(this.item))throw new a("XPTY0004");c=this.item}var d=this.DOMAdapter.getProperty;2==d(c,"nodeType")&&(c=d(c,"ownerElement"));for(var e;c;c=d(c,"parentNode"))if(e=d(c,"attributes"))for(var f=0,g=e.length;f1?b.valueOf():0;if(c<0){var d=new Cb(Gc.pow(10,-c)),e=Gc.round($c["numeric-divide"].call(this,a,d)),f=new Cb(e);return nDecimal=Gc.abs($c["numeric-subtract"].call(this,f,$c["numeric-divide"].call(this,a,d))),$c["numeric-multiply"].call(this,$c["numeric-add"].call(this,f,new fb(.5==nDecimal&&e%2?-1:0)),d)}var d=new Cb(Gc.pow(10,c)),e=Gc.round($c["numeric-multiply"].call(this,a,d)),f=new Cb(e);return nDecimal=Gc.abs($c["numeric-subtract"].call(this,f,$c["numeric-multiply"].call(this,a,d))),$c["numeric-divide"].call(this,$c["numeric-add"].call(this,f,new fb(.5==nDecimal&&e%2?-1:0)),d)}),f("resolve-QName",[[ub,"?"],[bc]],function(b,c){if(null==b)return null;var d=b.valueOf(),e=d.match(Bd);if(!e)throw new a("FOCA0002");var f=e[1]||null,g=e[2],h=this.DOMAdapter.lookupNamespaceURI(c,f);if(null!=f&&!h)throw new a("FONS0004");return new tb(f,g,h||null)}),f("QName",[[ub,"?"],[ub]],function(b,c){var d=c.valueOf(),e=d.match(Bd);if(!e)throw new a("FOCA0002");return new tb(e[1]||null,e[2]||null,null==b?"":b.valueOf())}),f("prefix-from-QName",[[tb,"?"]],function(a){return null!=a&&a.prefix?new Sb(a.prefix):null}),f("local-name-from-QName",[[tb,"?"]],function(a){return null==a?null:new Sb(a.localName)}),f("namespace-uri-from-QName",[[tb,"?"]],function(a){return null==a?null:Va.cast(new ub(a.namespaceURI||""))}),f("namespace-uri-for-prefix",[[ub,"?"],[bc]],function(a,b){var c=null==a?"":a.valueOf(),d=this.DOMAdapter.lookupNamespaceURI(b,c||null);return null==d?null:Va.cast(new ub(d))}),f("in-scope-prefixes",[[bc]],function(a){throw"Function 'in-scope-prefixes' not implemented"}),f("boolean",[[Yb,"*"]],function(a){return new Xa(uc(a,this))}),f("index-of",[[Ta,"*"],[Ta],[ub,"",!0]],function(a,b,c){if(!a.length||null==b)return[];var d=b;d instanceof xb&&(d=ub.cast(d));for(var e,f=[],g=0,h=a.length;g1)throw"Collation parameter in function 'distinct-values' is not implemented";if(!a.length)return null;for(var c,d=[],e=0,f=a.length;ed&&(e=d+1);for(var f=[],g=0;gc)return a;for(var e=[],f=0;f2?Gc.round(c):a.length-d+1;return a.slice(d-1,d-1+e)}),f("unordered",[[Yb,"*"]],function(a){return a}),f("zero-or-one",[[Yb,"*"]],function(b){if(b.length>1)throw new a("FORG0003");return b}),f("one-or-more",[[Yb,"*"]],function(b){if(!b.length)throw new a("FORG0004");return b}),f("exactly-one",[[Yb,"*"]],function(b){if(1!=b.length)throw new a("FORG0005");return b}),f("deep-equal",[[Yb,"*"],[Yb,"*"],[ub,"",!0]],function(a,b,c){throw"Function 'deep-equal' not implemented"}),f("count",[[Yb,"*"]],function(a){return new Cb(a.length)}),f("avg",[[Ta,"*"]],function(b){if(!b.length)return null;try{var c=b[0];c instanceof xb&&(c=gb.cast(c));for(var d,e=1,f=b.length;e1?c:new gb(0);try{var d=b[0];d instanceof xb&&(d=gb.cast(d));for(var e,f=1,g=b.length;f2&&(f=d.valueOf()),e=f==Sc+"/collation/codepoint"?Gd:this.staticContext.getCollation(f),!e)throw new a("FOCH0002");return new Cb(e.compare(b.valueOf(),c.valueOf()))}),f("codepoint-equal",[[ub,"?"],[ub,"?"]],function(a,b){return null==a||null==b?null:new Xa(a.valueOf()==b.valueOf())}),f("concat",null,function(){if(arguments.length<2)throw new a("XPST0017");for(var b,c=[],d=0,e=arguments.length;d2?e+Gc.round(c):d.length;return new ub(f>e?d.substring(e,f):"")}),f("string-length",[[ub,"?",!0]],function(b){if(!arguments.length){if(!this.item)throw new a("XPDY0002");b=ub.cast(vc([this.item],this)[0])}return new Cb(null==b?0:b.valueOf().length)}),f("normalize-space",[[ub,"?",!0]],function(b){if(!arguments.length){if(!this.item)throw new a("XPDY0002");b=ub.cast(vc([this.item],this)[0])}return new ub(null==b?"":Pc(b).replace(/\s\s+/g," "))}),f("normalize-unicode",[[ub,"?"],[ub,"",!0]],function(a,b){throw"Function 'normalize-unicode' not implemented"}),f("upper-case",[[ub,"?"]],function(a){return new ub(null==a?"":a.valueOf().toUpperCase())}),f("lower-case",[[ub,"?"]],function(a){return new ub(null==a?"":a.valueOf().toLowerCase())}),f("translate",[[ub,"?"],[ub],[ub]],function(a,b,c){if(null==a)return new ub("");for(var d,e=a.valueOf().split(""),f=b.valueOf().split(""),g=c.valueOf().split(""),h=g.length,i=[],j=0,k=e.length;j126)&&(c[d]=window.encodeURIComponent(c[d]));return new ub(c.join(""))}),f("contains",[[ub,"?"],[ub,"?"],[ub,"",!0]],function(a,b,c){if(arguments.length>2)throw"Collation parameter in function 'contains' is not implemented";return new Xa((null==a?"":a.valueOf()).indexOf(null==b?"":b.valueOf())>=0)}),f("starts-with",[[ub,"?"],[ub,"?"],[ub,"",!0]],function(a,b,c){if(arguments.length>2)throw"Collation parameter in function 'starts-with' is not implemented";return new Xa(0==(null==a?"":a.valueOf()).indexOf(null==b?"":b.valueOf()))}),f("ends-with",[[ub,"?"],[ub,"?"],[ub,"",!0]],function(a,b,c){if(arguments.length>2)throw"Collation parameter in function 'ends-with' is not implemented";var d=null==a?"":a.valueOf(),e=null==b?"":b.valueOf();return new Xa(d.indexOf(e)==d.length-e.length)}),f("substring-before",[[ub,"?"],[ub,"?"],[ub,"",!0]],function(a,b,c){if(arguments.length>2)throw"Collation parameter in function 'substring-before' is not implemented";var d,e=null==a?"":a.valueOf(),f=null==b?"":b.valueOf();return new ub((d=e.indexOf(f))>=0?e.substring(0,d):"")}),f("substring-after",[[ub,"?"],[ub,"?"],[ub,"",!0]],function(a,b,c){if(arguments.length>2)throw"Collation parameter in function 'substring-after' is not implemented";var d,e=null==a?"":a.valueOf(),f=null==b?"":b.valueOf();return new ub((d=e.indexOf(f))>=0?e.substring(d+f.length):"")}),f("matches",[[ub,"?"],[ub],[ub,"",!0]],function(a,b,c){var d=null==a?"":a.valueOf(),e=xc(b.valueOf(),arguments.length>2?c.valueOf():"");return new Xa(e.test(d))}),f("replace",[[ub,"?"],[ub],[ub],[ub,"",!0]],function(a,b,c,d){var e=null==a?"":a.valueOf(),f=xc(b.valueOf(),arguments.length>3?d.valueOf():"");return new Xa(e.replace(f,c.valueOf()))}),f("tokenize",[[ub,"?"],[ub],[ub,"",!0]],function(a,b,c){for(var d=null==a?"":a.valueOf(),e=xc(b.valueOf(),arguments.length>2?c.valueOf():""),f=[],g=0,h=d.split(e),i=h.length;gb?1:-1},yc.prototype=new c;var Hd=new e;yc.prototype.getProperty=function(a,b){if(b in a)return a[b];if("baseURI"==b){for(var c,d="",e=Hd.getFunction("{http://www.w3.org/2005/xpath-functions}resolve-uri"),f=Hd.getDataType("{http://www.w3.org/2001/XMLSchema}string"),g=a;g;g=g.parentNode)1==g.nodeType&&(c=g.getAttribute("xml:base"))&&(d=e(new f(c),new f(d)).toString());return d}if("textContent"==b){var h=[];return function(a){for(var b,c=0;b=a.childNodes[c];c++)3==b.nodeType||4==b.nodeType?h.push(b.data):1==b.nodeType&&b.firstChild&&arguments.callee(b)}(a),h.join("")}},yc.prototype.compareDocumentPosition=function(a,b){if("compareDocumentPosition"in a)return a.compareDocumentPosition(b);if(b==a)return 0;var c,d,e,f,g,h=null,i=null;if(2==a.nodeType&&(h=a,a=this.getProperty(h,"ownerElement")),2==b.nodeType&&(i=b,b=this.getProperty(i,"ownerElement")),h&&i&&a&&a==b)for(f=0,c=this.getProperty(a,"attributes"),g=c.length;fMath.round(a.width/50))&&(e=Math.round(a.width/50)),(!f||f>Math.round(a.width/50))&&(f=Math.round(a.height/50));var h=a.getContext("2d"),i=.08*a.width,j=.03*a.width,k=.08*a.height,l=.15*a.height,m=a.height-k-l,n=a.width-i-j,o=k+m,p=k;h.font=g+"px Arial",h.lineWidth="1.0",h.strokeStyle="#444",CanvasComponents.draw_line(h,i,o,n+i,o),CanvasComponents.draw_line(h,i,o,i,p);var q=.003*n,r=(n-q*b.length)/b.length,s=i+q,t=Math.max.apply(Math,b);h.fillStyle="green";for(var u=0;u=b.length)for(var u=0;u<=b.length;u++)h.fillText(u,s,o+.3*l),s+=r+q;else for(var u=0;u<=e;u++){var w=Math.ceil(b.length/e*u);s=n/e*u+i,h.fillText(w,s,o+.3*l)}h.textAlign="right";var x;if(f>=t)for(var u=0;u<=t;u++)x=o-u/t*m+g/3,h.fillText(u,.8*i,x);else for(var u=0;u<=f;u++){var w=Math.ceil(t/f*u);x=o-w/t*m+g/3,h.fillText(w,.8*i,x)}if(c&&(h.textAlign="center",h.fillText(c,n/2+i,o+.8*l)),d){h.save();var y=.3*i,z=m/2+k;h.translate(y,z),h.rotate(-Math.PI/2),h.textAlign="center",h.fillText(d,0,0),h.restore()}},draw_scale_bar:function(a,b,c,d){var e=a.getContext("2d"),f=.01*a.width,g=.01*a.width,h=.1*a.height,i=.3*a.height,j=a.height-h-i,k=a.width-f-g,l=b/c;e.strokeRect(f,h,k,j);var m=e.createLinearGradient(f,0,k+f,0);m.addColorStop(0,"green"),m.addColorStop(.5,"gold"),m.addColorStop(1,"red"),e.fillStyle=m,e.fillRect(f,h,k*l,j);var n,o,p,q;e.fillStyle="black",e.textAlign="center",e.font="13px Arial";for(var r=0;r=.9*c?(e.textAlign="right",n=p):d[r].max<=.1*c?e.textAlign="left":n+=(p-n)/2,o=h+j+.8*i,e.fillText(d[r].label,n,o)}},Utils={chr:function(a){return String.fromCharCode(a)},ord:function(a){return a.charCodeAt(0)},pad_left:function(a,b,c){c=c||"0";var d=c.length-(b-a.length);return d=d<0?0:d,a.lengthb&&(a=a.slice(0,b-c.length)+c),a},hex:function(a,b){return a="string"==typeof a?Utils.ord(a):a,b=b||2,Utils.pad(a.toString(16),b)},bin:function(a,b){return a="string"==typeof a?Utils.ord(a):a,b=b||8,Utils.pad(a.toString(2),b)},printable:function(a,b){window&&window.app&&!window.app.options.treat_as_utf8&&(a=Utils.byte_array_to_chars(Utils.str_to_byte_array(a)));var c=/[\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-\u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0FBD\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-\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,d=/[\x09-\x10\x0D\u2028\u2029]/g;return a=a.replace(c,"."),b||(a=a.replace(d,".")),a},parse_escaped_chars:function(a){return a.replace(/(\\)?\\([nrtbf]|x[\da-f]{2})/g,function(a,b,c){if("\\"===b)return"\\"+c;switch(c[0]){case"n":return"\n";case"r":return"\r";case"t":return"\t";case"b":return"\b";case"f":return"\f";case"x":return Utils.chr(parseInt(c.substr(1),16))}})},expand_alph_range:function(a){for(var b=[],c=0;c255)return Utils.str_to_utf8_byte_array(a);return c},str_to_utf8_byte_array:function(a){var b=CryptoJS.enc.Utf8.parse(a),c=Utils.word_array_to_byte_array(b);return a.length!==b.sigBytes&&(window.app.options.attempt_highlight=!1),c},str_to_charcode:function(a){for(var b=new Array(a.length),c=a.length;c--;)b[c]=a.charCodeAt(c);return b},byte_array_to_utf8:function(a){try{for(var b=[],c=0;c>>2]|=a[c]<<24-c%4*8;var d=new CryptoJS.lib.WordArray.init(b,a.length),e=CryptoJS.enc.Utf8.stringify(d);return e.length!==d.sigBytes&&(window.app.options.attempt_highlight=!1),e}catch(b){return Utils.byte_array_to_chars(a)}},byte_array_to_chars:function(a){if(!a)return"";for(var b="",c=0;c>>2]>>>24-d%4*8&255);return c},UNIC_WIN1251_MAP:{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,14:14,15:15,16:16,17:17,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,28:28,29:29,30:30,31:31,32:32,33:33,34:34,35:35,36:36,37:37,38:38,39:39,40:40,41:41,42:42,43:43,44:44,45:45,46:46,47:47,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,58:58,59:59,60:60,61:61,62:62,63:63,64:64,65:65,66:66,67:67,68:68,69:69,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,82:82,83:83,84:84,85:85,86:86,87:87,88:88,89:89,90:90,91:91,92:92,93:93,94:94,95:95,96:96,97:97,98:98,99:99,100:100,101:101,102:102,103:103,104:104,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,125:125,126:126,127:127,1027:129,8225:135,1046:198,8222:132,1047:199,1168:165,1048:200,1113:154,1049:201,1045:197,1050:202,1028:170,160:160,1040:192,1051:203,164:164,166:166,167:167,169:169,171:171,172:172,173:173,174:174,1053:205,176:176,177:177,1114:156,181:181,182:182,183:183,8221:148,187:187,1029:189,1056:208,1057:209,1058:210,8364:136,1112:188,1115:158,1059:211,1060:212,1030:178,1061:213,1062:214,1063:215,1116:157,1064:216,1065:217,1031:175,1066:218,1067:219,1068:220,1069:221,1070:222,1032:163,8226:149,1071:223,1072:224,8482:153,1073:225,8240:137,1118:162,1074:226,1110:179,8230:133,1075:227,1033:138,1076:228,1077:229,8211:150,1078:230,1119:159,1079:231,1042:194,1080:232,1034:140,1025:168,1081:233,1082:234,8212:151,1083:235,1169:180,1084:236,1052:204,1085:237,1035:142,1086:238,1087:239,1088:240,1089:241,1090:242,1036:141,1041:193,1091:243,1092:244,8224:134,1093:245,8470:185,1094:246,1054:206,1095:247,1096:248,8249:139,1097:249,1098:250,1044:196,1099:251,1111:191,1055:207,1100:252,1038:161,8220:147,1101:253,8250:155,1102:254,8216:145,1103:255,1043:195,1105:184,1039:143,1026:128,1106:144,8218:130,1107:131,8217:146,1108:186,1109:190},WIN1251_UNIC_MAP:{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,14:14,15:15,16:16,17:17,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,28:28,29:29,30:30,31:31,32:32,33:33,34:34,35:35,36:36,37:37,38:38,39:39,40:40,41:41,42:42,43:43,44:44,45:45,46:46,47:47,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,58:58,59:59,60:60,61:61,62:62,63:63,64:64,65:65,66:66,67:67,68:68,69:69,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,82:82,83:83,84:84,85:85,86:86,87:87,88:88,89:89,90:90,91:91,92:92,93:93,94:94,95:95,96:96,97:97,98:98,99:99,100:100,101:101,102:102,103:103,104:104,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,125:125,126:126,127:127,160:160,164:164,166:166,167:167,169:169,171:171,172:172,173:173,174:174,176:176,177:177,181:181,182:182,183:183,187:187,168:1025,128:1026,129:1027,170:1028,189:1029,178:1030,175:1031,163:1032,138:1033,140:1034,142:1035,141:1036,161:1038,143:1039,192:1040,193:1041,194:1042,195:1043,196:1044,197:1045,198:1046,199:1047,200:1048,201:1049,202:1050,203:1051,204:1052,205:1053,206:1054,207:1055,208:1056,209:1057,210:1058,211:1059,212:1060,213:1061,214:1062,215:1063,216:1064,217:1065,218:1066,219:1067,220:1068,221:1069,222:1070,223:1071,224:1072,225:1073,226:1074,227:1075,228:1076,229:1077,230:1078,231:1079,232:1080,233:1081,234:1082,235:1083,236:1084,237:1085,238:1086,239:1087,240:1088,241:1089,242:1090,243:1091,244:1092,245:1093,246:1094,247:1095,248:1096,249:1097,250:1098,251:1099,252:1100,253:1101,254:1102,255:1103,184:1105,144:1106,131:1107,186:1108,190:1109,179:1110,191:1111,188:1112,154:1113,156:1114,158:1115,157:1116,162:1118,159:1119,165:1168,180:1169,150:8211,151:8212,145:8216,146:8217,130:8218,147:8220,148:8221,132:8222,134:8224,135:8225,149:8226,133:8230,137:8240,139:8249,155:8250,136:8364,185:8470,153:8482},unicode_to_win1251:function(a){for(var b=[],c=0;c>2,g=(3&c)<<4|d>>4,h=(15&d)<<2|e>>6,i=63&e,isNaN(d)?h=i=64:isNaN(e)&&(i=64),j+=b.charAt(f)+b.charAt(g)+b.charAt(h)+b.charAt(i);return j},from_base64:function(a,b,c,d){if(c=c||"string",!a)return"string"===c?"":[];b=b?Utils.expand_alph_range(b).join(""):"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",void 0===d&&(d=!0);var e,f,g,h,i,j,k,l=[],m=0;if(d){var n=new RegExp("[^"+b.replace(/[\[\]\\\-^$]/g,"\\$&")+"]","g");a=a.replace(n,"")}for(;m>4,f=(15&i)<<4|j>>2,g=(3&j)<<6|k,l.push(e),64!==j&&l.push(f),64!==k&&l.push(g);return"string"===c?Utils.byte_array_to_utf8(l):l},to_hex:function(a,b,c){if(!a)return"";b="string"==typeof b?b:" ",c=c||2;for(var d="",e=0;e>>4).toString(16)),b.push((15&a[c]).toString(16));return b.join("")},from_hex:function(a,b,c){if(b=b||(a.indexOf(" ")>=0?"Space":"None"),c=c||2,"None"!==b){var d=Utils.regex_rep[b];a=a.replace(d,"")}for(var e=[],f=0;f]*>.*<\/(script|style)>/gim,"")),a.replace(/<[^>\n]+>/g,"")},escape_html:function(a){return a.replace(/>>3]|=parseInt(a.substr(d,2),16)<<24-d%8*4;return new CryptoJS.lib.WordArray.init(c,b/2)};var Base={DEFAULT_RADIX:36,run_to:function(a,b){if(!a)throw"Error: Input must be a number";var c=b[0]||Base.DEFAULT_RADIX;if(c<2||c>36)throw"Error: Radix argument must be between 2 and 36";return a.toString(c)},run_from:function(a,b){var c=b[0]||Base.DEFAULT_RADIX;if(c<2||c>36)throw"Error: Radix argument must be between 2 and 36";return parseInt(a.replace(/\s/g,""),c)}},Base64={ALPHABET:"A-Za-z0-9+/=",ALPHABET_OPTIONS:[{name:"Standard: A-Za-z0-9+/=",value:"A-Za-z0-9+/="},{name:"URL safe: 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: 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+/="}],run_to:function(a,b){var c=b[0]||Base64.ALPHABET;return Utils.to_base64(a,c)},REMOVE_NON_ALPH_CHARS:!0,run_from:function(a,b){var c=b[0]||Base64.ALPHABET,d=b[1];return Utils.from_base64(a,c,"byte_array",d)},BASE32_ALPHABET:"A-Z2-7=",run_to_32:function(a,b){if(!a)return"";for(var c,d,e,f,g,h,i,j,k,l,m,n,o,p=b[0]?Utils.expand_alph_range(b[0]).join(""):"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",q="",r=0;r>3,i=(7&c)<<2|d>>6,j=d>>1&31,k=(1&d)<<4|e>>4,l=(15&e)<<1|f>>7,m=f>>2&63,n=(3&f)<<3|g>>5,o=31&g,isNaN(d)?j=k=l=m=n=o=32:isNaN(e)?l=m=n=o=32:isNaN(f)?m=n=o=32:isNaN(g)&&(o=32),q+=p.charAt(h)+p.charAt(i)+p.charAt(j)+p.charAt(k)+p.charAt(l)+p.charAt(m)+p.charAt(n)+p.charAt(o);return q},run_from_32:function(a,b){if(!a)return[];var c,d,e,f,g,h,i,j,k,l,m,n,o,p=b[0]?Utils.expand_alph_range(b[0]).join(""):"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",q=b[0],r=[],s=0;if(q){var t=new RegExp("[^"+p.replace(/[\]\\\-^]/g,"\\$&")+"]","g");a=a.replace(t,"")}for(;s>2,d=(3&i)<<6|j<<1|k>>4,e=(15&k)<<4|l>>1,f=(1&l)<<7|m<<2|n>>3,g=(7&n)<<5|o,r.push(c),(i&!0||32!==j)&&r.push(d),(k&!0||32!==l)&&r.push(e),(l&!0||32!==m)&&r.push(f),(n&!0||32!==o)&&r.push(g);return r},SHOW_IN_BINARY:!1,OFFSETS_SHOW_VARIABLE:!0,run_offsets:function(a,b){var c=b[0]||Base64.ALPHABET,d=b[1],e=Utils.to_base64(a,c),f=Utils.to_base64([0].concat(a),c),g=Utils.to_base64([0,0].concat(a),c),h=e.indexOf("="),i=f.indexOf("="),j=g.indexOf("="),k="
                                                      Operations
                                                        Recipe
                                                          Input
                                                          Output
                                                          Operations
                                                            Recipe
                                                              Input
                                                              Output
                                                              \ No newline at end of file +"060a2b060104018237580301":"szOID_CAPICOM_ENCRYPTED_CONTENT","06032b0601050507":"pkix","06032b060105050701":"privateExtension","06032b06010505070101":"authorityInfoAccess","06032b06010505070c02":"CMC Data","06032b060105050702":"policyQualifierIds","06032b06010505070202":"unotice","06032b060105050703":"keyPurpose","06032b06010505070301":"serverAuth","06032b06010505070302":"clientAuth","06032b06010505070303":"codeSigning","06032b06010505070304":"emailProtection","06032b06010505070305":"ipsecEndSystem","06032b06010505070306":"ipsecTunnel","06032b06010505070307":"ipsecUser","06032b06010505070308":"timeStamping","06032b060105050704":"cmpInformationTypes","06032b06010505070401":"caProtEncCert","06032b06010505070402":"signKeyPairTypes","06032b06010505070403":"encKeyPairTypes","06032b06010505070404":"preferredSymmAlg","06032b06010505070405":"caKeyUpdateInfo","06032b06010505070406":"currentCRL","06032b06010505073001":"ocsp","06032b06010505073002":"caIssuers","06032b06010505080101":"HMAC-MD5","06032b06010505080102":"HMAC-SHA","060360864801650201010a":"mosaicKeyManagementAlgorithm","060360864801650201010b":"sdnsKMandSigAlgorithm","060360864801650201010c":"mosaicKMandSigAlgorithm","060360864801650201010d":"SuiteASignatureAlgorithm","060360864801650201010e":"SuiteAConfidentialityAlgorithm","060360864801650201010f":"SuiteAIntegrityAlgorithm","06036086480186f84201":"cert-extension","06036086480186f842010a":"EntityLogo","06036086480186f842010b":"UserPicture","06036086480186f8420109":"HomePage-url","06036086480186f84202":"data-type","06036086480186f8420201":"GIF","06036086480186f8420202":"JPEG","06036086480186f8420203":"URL","06036086480186f8420204":"HTML","06036086480186f8420205":"netscape-cert-sequence","06036086480186f8420206":"netscape-cert-url","06036086480186f84203":"directory","06036086480186f8420401":"serverGatedCrypto","06036086480186f845010603":"Unknown Verisign extension","06036086480186f845010606":"Unknown Verisign extension","06036086480186f84501070101":"Verisign certificatePolicy","06036086480186f8450107010101":"Unknown Verisign policy qualifier","06036086480186f8450107010102":"Unknown Verisign policy qualifier","0603678105":"TCPA","060367810501":"tcpa_specVersion","060367810502":"tcpa_attribute","06036781050201":"tcpa_at_tpmManufacturer","0603678105020a":"tcpa_at_securityQualities","0603678105020b":"tcpa_at_tpmProtectionProfile","0603678105020c":"tcpa_at_tpmSecurityTarget","0603678105020d":"tcpa_at_foundationProtectionProfile","0603678105020e":"tcpa_at_foundationSecurityTarget","0603678105020f":"tcpa_at_tpmIdLabel","06036781050202":"tcpa_at_tpmModel","06036781050203":"tcpa_at_tpmVersion","06036781050204":"tcpa_at_platformManufacturer","06036781050205":"tcpa_at_platformModel","06036781050206":"tcpa_at_platformVersion","06036781050207":"tcpa_at_componentManufacturer","06036781050208":"tcpa_at_componentModel","06036781050209":"tcpa_at_componentVersion","060367810503":"tcpa_protocol","06036781050301":"tcpa_prtt_tpmIdProtocol","0603672a00":"contentType","0603672a0000":"PANData","0603672a0001":"PANToken","0603672a0002":"PANOnly","0603672a01":"msgExt","0603672a0a":"national","0603672a0a8140":"Japan","0603672a02":"field","0603672a0200":"fullName","0603672a0201":"givenName","0603672a020a":"amount","0603672a0202":"familyName","0603672a0203":"birthFamilyName","0603672a0204":"placeName","0603672a0205":"identificationNumber","0603672a0206":"month","0603672a0207":"date","0603672a02070b":"accountNumber","0603672a02070c":"passPhrase","0603672a0208":"address","0603672a0209":"telephone","0603672a03":"attribute","0603672a0300":"cert","0603672a030000":"rootKeyThumb","0603672a030001":"additionalPolicy","0603672a04":"algorithm","0603672a05":"policy","0603672a0500":"root","0603672a06":"module","0603672a07":"certExt","0603672a0700":"hashedRootKey","0603672a0701":"certificateType","0603672a0702":"merchantData","0603672a0703":"cardCertRequired","0603672a0704":"tunneling","0603672a0705":"setExtensions","0603672a0706":"setQualifier","0603672a08":"brand","0603672a0801":"IATA-ATA","0603672a081e":"Diners","0603672a0822":"AmericanExpress","0603672a0804":"VISA","0603672a0805":"MasterCard","0603672a08ae7b":"Novus","0603672a09":"vendor","0603672a0900":"GlobeSet","0603672a0901":"IBM","0603672a090a":"Griffin","0603672a090b":"Certicom","0603672a090c":"OSS","0603672a090d":"TenthMountain","0603672a090e":"Antares","0603672a090f":"ECC","0603672a0910":"Maithean","0603672a0911":"Netscape","0603672a0912":"Verisign","0603672a0913":"BlueMoney","0603672a0902":"CyberCash","0603672a0914":"Lacerte","0603672a0915":"Fujitsu","0603672a0916":"eLab","0603672a0917":"Entrust","0603672a0918":"VIAnet","0603672a0919":"III","0603672a091a":"OpenMarket","0603672a091b":"Lexem","0603672a091c":"Intertrader","0603672a091d":"Persimmon","0603672a0903":"Terisa","0603672a091e":"NABLE","0603672a091f":"espace-net","0603672a0920":"Hitachi","0603672a0921":"Microsoft","0603672a0922":"NEC","0603672a0923":"Mitsubishi","0603672a0924":"NCR","0603672a0925":"e-COMM","0603672a0926":"Gemplus","0603672a0904":"RSADSI","0603672a0905":"VeriFone","0603672a0906":"TrinTech","0603672a0907":"BankGate","0603672a0908":"GTE","0603672a0909":"CompuSource","0603551d01":"authorityKeyIdentifier","0603551d0a":"basicConstraints","0603551d0b":"nameConstraints","0603551d0c":"policyConstraints","0603551d0d":"basicConstraints","0603551d0e":"subjectKeyIdentifier","0603551d0f":"keyUsage","0603551d10":"privateKeyUsagePeriod","0603551d11":"subjectAltName","0603551d12":"issuerAltName","0603551d13":"basicConstraints","0603551d02":"keyAttributes","0603551d14":"cRLNumber","0603551d15":"cRLReason","0603551d16":"expirationDate","0603551d17":"instructionCode","0603551d18":"invalidityDate","0603551d1a":"issuingDistributionPoint","0603551d1b":"deltaCRLIndicator","0603551d1c":"issuingDistributionPoint","0603551d1d":"certificateIssuer","0603551d03":"certificatePolicies","0603551d1e":"nameConstraints","0603551d1f":"cRLDistributionPoints","0603551d20":"certificatePolicies","0603551d21":"policyMappings","0603551d22":"policyConstraints","0603551d23":"authorityKeyIdentifier","0603551d24":"policyConstraints","0603551d25":"extKeyUsage","0603551d04":"keyUsageRestriction","0603551d05":"policyMapping","0603551d06":"subtreesConstraint","0603551d07":"subjectAltName","0603551d08":"issuerAltName","0603551d09":"subjectDirectoryAttributes","0603550400":"objectClass","0603550401":"aliasObjectName","060355040d":"description","060355040e":"searchGuide","060355040f":"businessCategory","0603550410":"postalAddress","0603550411":"postalCode","0603550412":"postOfficeBox","0603550413":"physicalDeliveryOfficeName","0603550402":"knowledgeInformation","0603550415":"telexNumber","0603550416":"teletexTerminalIdentifier","0603550417":"facsimileTelephoneNumber","0603550418":"x121Address","0603550419":"internationalISDNNumber","060355041a":"registeredAddress","060355041b":"destinationIndicator","060355041c":"preferredDeliveryMehtod","060355041d":"presentationAddress","060355041e":"supportedApplicationContext","060355041f":"member","0603550420":"owner","0603550421":"roleOccupant","0603550422":"seeAlso","0603550423":"userPassword","0603550424":"userCertificate","0603550425":"caCertificate","0603550426":"authorityRevocationList","0603550427":"certificateRevocationList","0603550428":"crossCertificatePair","0603550429":"givenName","0603550405":"serialNumber","0603550434":"supportedAlgorithms","0603550435":"deltaRevocationList","060355043a":"crossCertificatePair","06035508":"X.500-Algorithms","0603550801":"X.500-Alg-Encryption","060355080101":"rsa","0603604c0101":"DPC"};var Punycode={IDN:!1,run_to_ascii:function(a,b){var c=b[0];return c?punycode.ToASCII(a):punycode.encode(a)},run_to_unicode:function(a,b){var c=b[0];return c?punycode.ToUnicode(a):punycode.decode(a)}},QuotedPrintable={run_to:function(a,b){var c=QuotedPrintable.mimeEncode(a);return c=c.replace(/\r?\n|\r/g,function(){return"\r\n"}).replace(/[\t ]+$/gm,function(a){return a.replace(/ /g,"=20").replace(/\t/g,"=09")}),QuotedPrintable._addSoftLinebreaks(c,"qp")},run_from:function(a,b){var c=a.replace(/\=(?:\r?\n|$)/g,"");return QuotedPrintable.mimeDecode(c)},mimeDecode:function(a){for(var b,c,d=(a.match(/\=[\da-fA-F]{2}/g)||[]).length,e=a.length-2*d,f=new Array(e),g=0,h=0,i=a.length;h=0;c--)if(b[c].length){if(1===b[c].length&&a===b[c][0])return!0;if(2===b[c].length&&a>=b[c][0]&&a<=b[c][1])return!0}return!1},_addSoftLinebreaks:function(a,b){var c=76;return b=(b||"base64").toString().toLowerCase().trim(),"qp"===b?this._addQPSoftLinebreaks(a,c):this._addBase64SoftLinebreaks(a,c)},_addBase64SoftLinebreaks:function(a,b){return a=(a||"").toString().trim(),a.replace(new RegExp(".{"+b+"}","g"),"$&\r\n").trim()},_addQPSoftLinebreaks:function(a,b){for(var c,d,e,f=0,g=a.length,h=Math.floor(b/3),i="";fb-h&&(c=e.substr(-h).match(/[ \t\.,!\?][^ \t\.,!\?]*$/)))e=e.substr(0,e.length-(c[0].length-1));else if("\r"===e.substr(-1))e=e.substr(0,e.length-1);else if(e.match(/\=[\da-f]{0,2}$/i))for((c=e.match(/\=[\da-f]{0,1}$/i))&&(e=e.substr(0,e.length-c[0].length));e.length>3&&e.length=192)););f+e.length=65&&c<=90?(c=(c-65+d)%26,e[h]=c+65):f&&c>=97&&c<=122&&(c=(c-97+d)%26,e[h]=c+97)}return e},ROT47_AMOUNT:47,run_rot47:function(a,b){var c,d=b[0],e=a;if(d){d<0&&(d=94-Math.abs(d)%94);for(var f=0;f=33&&c<=126&&(c=(c-33+d)%94,e[f]=c+33)}return e},_rotr:function(a){var b=(1&a)<<7;return a>>1|b},_rotl:function(a){var b=a>>7&1;return 255&(a<<1|b)},_rotr_whole:function(a,b){var c,d=0,e=[];b%=8;for(var f=0;f>>0;c=g>>b|d,d=(g&Math.pow(2,b)-1)<<8-b,e.push(c)}return e[0]|=d,e},_rotl_whole:function(a,b){var c,d=0,e=[];b%=8;for(var f=a.length-1;f>=0;f--){var g=a[f];c=255&(g<>8-b&Math.pow(2,b)-1,e[f]=c}return e[a.length-1]=e[a.length-1]|d,e}},SeqUtils={DELIMITER_OPTIONS:["Line feed","CRLF","Space","Comma","Semi-colon","Colon","Nothing (separate chars)"],SORT_REVERSE:!1,SORT_ORDER:["Alphabetical (case sensitive)","Alphabetical (case insensitive)","IP address"],run_sort:function(a,b){var c=Utils.char_rep[b[0]],d=b[1],e=b[2],f=a.split(c);return"Alphabetical (case sensitive)"===e?f=f.sort():"Alphabetical (case insensitive)"===e?f=f.sort(SeqUtils._case_insensitive_sort):"IP address"===e&&(f=f.sort(SeqUtils._ip_sort)),d&&f.reverse(),f.join(c)},run_unique:function(a,b){var c=Utils.char_rep[b[0]];return a.split(c).unique().join(c)},SEARCH_TYPE:["Regex","Extended (\\n, \\t, \\x...)","Simple string"],run_count:function(a,b){var c=b[0].string,d=b[0].option;if("Regex"!==d||!c)return c?(0===d.indexOf("Extended")&&(c=Utils.parse_escaped_chars(c)),a.count(c)):0;try{var e=new RegExp(c,"gi"),f=a.match(e);return f.length}catch(a){return 0}},REVERSE_BY:["Character","Line"],run_reverse:function(a,b){if("Line"===b[0]){for(var c=[],d=[],e=[],f=0;f()\\[\\]{}\\s\\x7F-\\xFF]*(?:[.!,?]+[^.!,?;"\\x27<>()\\[\\]{}\\s\\x7F-\\xFF]+)*)?'},{name:"Domain",value:"(?:(https?):\\/\\/)?([-\\w.]+)\\.(com|net|org|biz|info|co|uk|onion|int|mobi|name|edu|gov|mil|eu|ac|ae|af|de|ca|ch|cn|cy|es|gb|hk|il|in|io|tv|me|nl|no|nz|ro|ru|tr|us|az|ir|kz|uz|pk)+"},{name:"Windows file path",value:"([A-Za-z]):\\\\((?:[A-Za-z\\d][A-Za-z\\d\\- \\x27_\\(\\)]{0,61}\\\\?)*[A-Za-z\\d][A-Za-z\\d\\- \\x27_\\(\\)]{0,61})(\\.[A-Za-z\\d]{1,6})?"},{name:"UNIX file path",value:"(?:/[A-Za-z\\d.][A-Za-z\\d\\-.]{0,61})+"},{name:"MAC address",value:"[A-Fa-f\\d]{2}(?:[:-][A-Fa-f\\d]{2}){5}"},{name:"Date (yyyy-mm-dd)",value:"((?:19|20)\\d\\d)[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])"},{name:"Date (dd/mm/yyyy)",value:"(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.]((?:19|20)\\d\\d)"},{name:"Date (mm/dd/yyyy)",value:"(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.]((?:19|20)\\d\\d)"},{name:"Strings",value:'[A-Za-z\\d/\\-:.,_$%\\x27"()<>= !\\[\\]{}@]{4,}'}],REGEX_CASE_INSENSITIVE:!0,REGEX_MULTILINE_MATCHING:!0,OUTPUT_FORMAT:["Highlight matches","List matches","List capture groups","List matches with capture groups"],DISPLAY_TOTAL:!1,run_regex:function(a,b){var c=b[1],d=b[2],e=b[3],f=b[4],g=b[5],h="g";if(d&&(h+="i"),e&&(h+="m"),!c||"^"===c||"$"===c)return Utils.escape_html(a);try{var i=new RegExp(c,h);switch(g){case"Highlight matches":return StrUtils._regex_highlight(a,i,f);case"List matches":return Utils.escape_html(StrUtils._regex_list(a,i,f,!0,!1));case"List capture groups":return Utils.escape_html(StrUtils._regex_list(a,i,f,!1,!0));case"List matches with capture groups":return Utils.escape_html(StrUtils._regex_list(a,i,f,!0,!0));default:return"Error: Invalid output format"}}catch(a){return"Invalid regex. Details: "+a.message}},CASE_SCOPE:["All","Word","Sentence","Paragraph"],run_upper:function(a,b){var c=b[0];switch(c){case"Word":return a.replace(/(\b\w)/gi,function(a){return a.toUpperCase()});case"Sentence":return a.replace(/(?:\.|^)\s*(\b\w)/gi,function(a){return a.toUpperCase()});case"Paragraph":return a.replace(/(?:\n|^)\s*(\b\w)/gi,function(a){return a.toUpperCase()});case"All":default:return a.toUpperCase()}},run_lower:function(a,b){return a.toLowerCase()},SEARCH_TYPE:["Regex","Extended (\\n, \\t, \\x...)","Simple string"],FIND_REPLACE_GLOBAL:!0,FIND_REPLACE_CASE:!1,FIND_REPLACE_MULTILINE:!0,run_find_replace:function(a,b){var c=b[0].string,d=b[0].option,e=b[1],f=b[2],g=b[3],h=b[4],i="";return f&&(i+="g"),g&&(i+="i"),h&&(i+="m"),"Regex"===d?c=new RegExp(c,i):0===d.indexOf("Extended")&&(c=Utils.parse_escaped_chars(c)),a.replace(c,e,i)},SPLIT_DELIM:",",DELIMITER_OPTIONS:["Line feed","CRLF","Space","Comma","Semi-colon","Colon","Nothing (separate chars)"],run_split:function(a,b){var c=b[0]||StrUtils.SPLIT_DELIM,d=Utils.char_rep[b[1]],e=a.split(c);return e.join(d)},run_filter:function(a,b){var c=Utils.char_rep[b[0]],d=b[2];try{var e=new RegExp(b[1])}catch(a){return"Invalid regex. Details: "+a.message}const f=function(a){return d^e.test(a)};return a.split(c).filter(f).join(c)},DIFF_SAMPLE_DELIMITER:"\\n\\n",DIFF_BY:["Character","Word","Line","Sentence","CSS","JSON"],run_diff:function(a,b){var c,d=b[0],e=b[1],f=b[2],g=b[3],h=b[4],i=a.split(d),j="";if(!i||2!==i.length)return"Incorrect number of samples, perhaps you need to modify the sample delimiter or add more samples?";switch(e){case"Character":c=JsDiff.diffChars(i[0],i[1]);break;case"Word":c=h?JsDiff.diffWords(i[0],i[1]):JsDiff.diffWordsWithSpace(i[0],i[1]);break;case"Line":c=h?JsDiff.diffTrimmedLines(i[0],i[1]):JsDiff.diffLines(i[0],i[1]);break;case"Sentence":c=JsDiff.diffSentences(i[0],i[1]);break;case"CSS":c=JsDiff.diffCss(i[0],i[1]);break;case"JSON":c=JsDiff.diffJson(i[0],i[1]);break;default:return"Invalid 'Diff by' option."}for(var k=0;k"+Utils.escape_html(c[k].value)+""):c[k].removed?g&&(j+=""+Utils.escape_html(c[k].value)+""):j+=Utils.escape_html(c[k].value);return j},OFF_CHK_SAMPLE_DELIMITER:"\\n\\n",run_offset_checker:function(a,b){var c,d=b[0],e=a.split(d),f=[],g=0,h=0,i=!1,j=!1;if(!e||e.length<2)return"Not enough samples, perhaps you need to modify the sample delimiter or add more data?";for(h=0;h"),h===e.length-1&&(j=!1)):(i&&!j?(f[h]+=""+Utils.escape_html(e[h][g]),e[h].length===g+1&&(f[h]+=""),h===e.length-1&&(j=!0)):!i&&j?(f[h]+=""+Utils.escape_html(e[h][g]),h===e.length-1&&(j=!1)):(f[h]+=Utils.escape_html(e[h][g]),j&&e[h].length===g+1&&(f[h]+="",e[h].length-1!==g&&(j=!1))),e[0].length-1===g&&(j&&(f[h]+=""),f[h]+=Utils.escape_html(e[h].substring(g+1))))}return f.join(d)},run_parse_escaped_string:function(a,b){return Utils.parse_escaped_chars(a)},_regex_highlight:function(a,b,c){for(var d,e="",f=1,g=0,h=0;d=b.exec(a);)e+=Utils.escape_html(a.slice(g,d.index)),e+=""+Utils.escape_html(d[0])+"",f=1===f?2:1,g=b.lastIndex,h++;return e+=Utils.escape_html(a.slice(g,a.length)),c&&(e="Total found: "+h+"\n\n"+e),e},_regex_list:function(a,b,c,d,e){for(var f,g="",h=0;f=b.exec(a);)if(h++,d&&(g+=f[0]+"\n"),e)for(var i=1;ih?g[i][0].length:h;for(i=0;i1&&g[i][1].length?" = "+g[i][1]+"\n":"\n"}return d}return"Invalid URI"},_encode_all_chars:function(a){return encodeURIComponent(a).replace(/!/g,"%21").replace(/#/g,"%23").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A").replace(/\-/g,"%2D").replace(/\./g,"%2E").replace(/_/g,"%5F").replace(/~/g,"%7E")}},UUID={run_generate_v4:function(a,b){if("undefined"!=typeof window.crypto&&"undefined"!=typeof window.crypto.getRandomValues){var c=new Uint32Array(4),d=0;return window.crypto.getRandomValues(c),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=c[d>>3]>>d%8*4&15,e="x"===a?b:3&b|8;return d++,e.toString(16)})}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"===a?b:3&b|8;return c.toString(16)})}},Chef=function(){this.dish=new Dish};Chef.prototype.bake=function(a,b,c,d,e){var f=(new Date).getTime(),g=new Recipe(b),h=g.contains_flow_control(),i=!1;c.hasOwnProperty("attempt_highlight")&&(c.attempt_highlight=!0),h&&(c.attempt_highlight=!1),d>=b.length&&(d=0),e&&(g.set_breakpoint(d,!1),g.set_breakpoint(d+1,!0)),d>0&&h&&(g.remove_breaks_up_to(d),d=0),0===d&&this.dish.set(a,Dish.STRING);try{d=g.execute(this.dish,d)}catch(a){i=a,d=a.progress}return{result:this.dish.type===Dish.HTML?this.dish.get(Dish.HTML):this.dish.get(Dish.STRING),type:Dish.enum_lookup(this.dish.type),progress:d,options:c,duration:(new Date).getTime()-f,error:i}},Chef.prototype.silent_bake=function(a){var b=(new Date).getTime(),c=new Recipe(a),d=new Dish("",Dish.STRING);try{c.execute(d)}catch(a){}return(new Date).getTime()-b};var Dish=function(a,b){this.value=a||"string"==typeof a?a:null,this.type=b||Dish.BYTE_ARRAY};Dish.BYTE_ARRAY=0,Dish.STRING=1,Dish.NUMBER=2,Dish.HTML=3,Dish.type_enum=function(a){switch(a){case"byte_array":case"Byte array":return Dish.BYTE_ARRAY;case"string":case"String":return Dish.STRING;case"number":case"Number":return Dish.NUMBER;case"html":case"HTML":return Dish.HTML;default:throw"Invalid data type string. No matching enum."}},Dish.enum_lookup=function(a){switch(a){case Dish.BYTE_ARRAY:return"byte_array";case Dish.STRING:return"string";case Dish.NUMBER:return"number";case Dish.HTML:return"html";default:throw"Invalid data type enum. No matching type."}},Dish.prototype.set=function(a,b){if(this.value=a,this.type=b,!this.valid()){var c=Utils.truncate(JSON.stringify(this.value),13);throw"Data is not a valid "+Dish.enum_lookup(b)+": "+c}},Dish.prototype.get=function(a){return this.type!==a&&this.translate(a),this.value},Dish.prototype.translate=function(a){switch(this.type){case Dish.STRING:this.value=this.value?Utils.str_to_byte_array(this.value):[],this.type=Dish.BYTE_ARRAY;break;case Dish.NUMBER:this.value="number"==typeof this.value?Utils.str_to_byte_array(this.value.toString()):[],this.type=Dish.BYTE_ARRAY;break;case Dish.HTML:this.value=this.value?Utils.str_to_byte_array(Utils.strip_html_tags(this.value,!0)):[],this.type=Dish.BYTE_ARRAY}switch(a){case Dish.STRING:case Dish.HTML:this.value=this.value?Utils.byte_array_to_utf8(this.value):"",this.type=Dish.STRING;break;case Dish.NUMBER:this.value=this.value?parseFloat(Utils.byte_array_to_utf8(this.value)):0,this.type=Dish.NUMBER}},Dish.prototype.valid=function(){switch(this.type){case Dish.BYTE_ARRAY:if(!(this.value instanceof Array))return!1;for(var a=0;a255)return!1;return!0;case Dish.STRING:case Dish.HTML:return"string"==typeof this.value;case Dish.NUMBER:return"number"==typeof this.value;default:return!1}};const FlowControl={FORK_DELIM:"\\n",MERGE_DELIM:"\\n",run_fork:function(a){var b=a.op_list,c=b[a.progress].input_type,d=b[a.progress].output_type,e=a.dish.get(c),f=b[a.progress].get_ing_values(),g=f[0],h=f[1],i=[],j=[];e&&(j=e.split(g));for(var k=a.progress+1;k=d)throw"Reached maximum jumps, sorry!";return a.progress+=c,a.num_jumps++,a},run_cond_jump:function(a){var b=a.op_list[a.progress].get_ing_values(),c=a.dish,d=b[0],e=b[1],f=b[2];if(a.num_jumps>=f)throw"Reached maximum jumps, sorry!";return""!==d&&c.get(Dish.STRING).search(d)>-1&&(a.progress+=e,a.num_jumps++),a},run_return:function(a){return a.progress=a.op_list.length,a}};var Ingredient=function(a){this.name="",this.type="",this.value=null,a&&this._parse_config(a)};Ingredient.prototype._parse_config=function(a){this.name=a.name,this.type=a.type},Ingredient.prototype.get_config=function(){return this.value},Ingredient.prototype.set_value=function(a){this.value=Ingredient.prepare(a,this.type)},Ingredient.prepare=function(a,b){switch(b){case"binary_string":case"binary_short_string":case"editable_option":return Utils.parse_escaped_chars(a);case"byte_array":return"string"==typeof a?(a=a.replace(/\s+/g,""),Utils.hex_to_byte_array(a)):a;case"number":var c=parseFloat(a);if(isNaN(c)){var d=Utils.truncate(a.toString(),10);throw"Invalid ingredient value. Not a number: "+d}return c;default:return a}};var Operation=function(a,b){this.name=a,this.description="",this.input_type=-1,this.output_type=-1,this.run=null,this.highlight=null,this.highlight_reverse=null,this.breakpoint=!1,this.disabled=!1,this.ing_list=[],b&&this._parse_config(b)};Operation.prototype._parse_config=function(a){this.description=a.description,this.input_type=Dish.type_enum(a.input_type),this.output_type=Dish.type_enum(a.output_type),this.run=a.run,this.highlight=a.highlight,this.highlight_reverse=a.highlight_reverse,this.flow_control=a.flow_control;for(var b=0;b
                                                              Message: "+i.message:i.display_str+=i.message,i}}return this.op_list.length},Recipe.prototype.to_string=function(){return JSON.stringify(this.get_config())},Recipe.prototype.from_string=function(a){var b=JSON.parse(a);this._parse_config(b)};const Categories=[{name:"Favourites",ops:[]},{name:"Data format",ops:["To Hexdump","From Hexdump","To Hex","From Hex","To Charcode","From Charcode","To Decimal","From Decimal","To Binary","From Binary","To Base64","From Base64","Show Base64 offsets","To Base32","From Base32","To Base","From Base","To HTML Entity","From HTML Entity","URL Encode","URL Decode","Unescape Unicode Characters","To Quoted Printable","From Quoted Printable","To Punycode","From Punycode","To Hex Content","From Hex Content","PEM to Hex","Hex to PEM","Parse ASN.1 hex string","Change IP format","Text encoding","Swap endianness"]},{name:"Encryption / Encoding",ops:["AES Encrypt","AES Decrypt","Blowfish Encrypt","Blowfish Decrypt","DES Encrypt","DES Decrypt","Triple DES Encrypt","Triple DES Decrypt","Rabbit Encrypt","Rabbit Decrypt","RC4","RC4 Drop","ROT13","ROT47","XOR","XOR Brute Force","Vigen\xe8re Encode","Vigen\xe8re Decode","Substitute","Derive PBKDF2 key","Derive EVP key"]},{name:"Public Key",ops:["Parse X.509 certificate","Parse ASN.1 hex string","PEM to Hex","Hex to PEM","Hex to Object Identifier","Object Identifier to Hex"]},{name:"Logical operations",ops:["XOR","XOR Brute Force","OR","NOT","AND","ADD","SUB","Rotate left","Rotate right","ROT13"]},{name:"Networking",ops:["Strip HTTP headers","Parse User Agent","Parse IP range","Parse IPv6 address","Parse URI","URL Encode","URL Decode","Format MAC addresses","Change IP format","Group IP addresses"] +},{name:"Language",ops:["Text encoding","Unescape Unicode Characters"]},{name:"Utils",ops:["Diff","Remove whitespace","Remove null bytes","To Upper case","To Lower case","Add line numbers","Remove line numbers","Reverse","Sort","Unique","Split","Filter","Count occurrences","Expand alphabet range","Parse escaped string","Drop bytes","Take bytes","Pad lines","Find / Replace","Regular expression","Offset checker","Convert distance","Convert area","Convert mass","Convert speed","Convert data units","Parse UNIX file permissions","Swap endianness","Parse colour code"]},{name:"Date / Time",ops:["Parse DateTime","Translate DateTime Format","From UNIX Timestamp","To UNIX Timestamp","Extract dates"]},{name:"Extractors",ops:["Strings","Extract IP addresses","Extract email addresses","Extract MAC addresses","Extract URLs","Extract domains","Extract file paths","Extract dates","Regular expression","XPath expression","CSS selector"]},{name:"Compression",ops:["Raw Deflate","Raw Inflate","Zlib Deflate","Zlib Inflate","Gzip","Gunzip","Zip","Unzip","Bzip2 Decompress"]},{name:"Hashing",ops:["Analyse hash","Generate all hashes","MD5","SHA1","SHA224","SHA256","SHA384","SHA512","SHA3","RIPEMD-160","HMAC","Fletcher-16 Checksum","Adler-32 Checksum","CRC-32 Checksum","TCP/IP Checksum"]},{name:"Code tidy",ops:["Syntax highlighter","Generic Code Beautify","JavaScript Parser","JavaScript Beautify","JavaScript Minify","JSON Beautify","JSON Minify","XML Beautify","XML Minify","SQL Beautify","SQL Minify","CSS Beautify","CSS Minify","XPath expression","CSS selector","Strip HTML tags","Diff"]},{name:"Other",ops:["Entropy","Frequency distribution","Detect File Type","Scan for Embedded Files","Generate UUID","Numberwang"]},{name:"Flow control",ops:["Fork","Merge","Jump","Conditional Jump","Return"]}],OperationConfig={Fork:{description:"Split the input data up based on the specified delimiter and run all subsequent operations on each branch separately.

                                                              For example, to decode multiple Base64 strings, enter them all on separate lines then add the 'Fork' and 'From Base64' operations to the recipe. Each string will be decoded separately.",run:FlowControl.run_fork,input_type:"string",output_type:"string",flow_control:!0,args:[{name:"Split delimiter",type:"binary_short_string",value:FlowControl.FORK_DELIM},{name:"Merge delimiter",type:"binary_short_string",value:FlowControl.MERGE_DELIM}]},Merge:{description:"Consolidate all branches back into a single trunk. The opposite of Fork.",run:FlowControl.run_merge,input_type:"string",output_type:"string",flow_control:!0,args:[]},Jump:{description:"Jump forwards or backwards over the specified number of operations.",run:FlowControl.run_jump,input_type:"string",output_type:"string",flow_control:!0,args:[{name:"Number of operations to jump over",type:"number",value:FlowControl.JUMP_NUM},{name:"Maximum jumps (if jumping backwards)",type:"number",value:FlowControl.MAX_JUMPS}]},"Conditional Jump":{description:"Conditionally jump forwards or backwards over the specified number of operations based on whether the data matches the specified regular expression.",run:FlowControl.run_cond_jump,input_type:"string",output_type:"string",flow_control:!0,args:[{name:"Match (regex)",type:"string",value:""},{name:"Number of operations to jump over if match found",type:"number",value:FlowControl.JUMP_NUM},{name:"Maximum jumps (if jumping backwards)",type:"number",value:FlowControl.MAX_JUMPS}]},Return:{description:"End execution of operations at this point in the recipe.",run:FlowControl.run_return,input_type:"string",output_type:"string",flow_control:!0,args:[]},"From Base64":{description:"Base64 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers.

                                                              This operation decodes data from an ASCII Base64 string back into its raw format.

                                                              e.g. aGVsbG8= becomes hello",run:Base64.run_from,highlight:Base64.highlight_from,highlight_reverse:Base64.highlight_to,input_type:"string",output_type:"byte_array",args:[{name:"Alphabet",type:"editable_option",value:Base64.ALPHABET_OPTIONS},{name:"Remove non‑alphabet chars",type:"boolean",value:Base64.REMOVE_NON_ALPH_CHARS}]},"To Base64":{description:"Base64 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers.

                                                              This operation encodes data in an ASCII Base64 string.

                                                              e.g. hello becomes aGVsbG8=",run:Base64.run_to,highlight:Base64.highlight_to,highlight_reverse:Base64.highlight_from,input_type:"byte_array",output_type:"string",args:[{name:"Alphabet",type:"editable_option",value:Base64.ALPHABET_OPTIONS}]},"From Base32":{description:"Base32 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers. It uses a smaller set of characters than Base64, usually the uppercase alphabet and the numbers 2 to 7.",run:Base64.run_from_32,input_type:"string",output_type:"byte_array",args:[{name:"Alphabet",type:"binary_string",value:Base64.BASE32_ALPHABET},{name:"Remove non‑alphabet chars",type:"boolean",value:Base64.REMOVE_NON_ALPH_CHARS}]},"To Base32":{description:"Base32 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers. It uses a smaller set of characters than Base64, usually the uppercase alphabet and the numbers 2 to 7.",run:Base64.run_to_32,input_type:"byte_array",output_type:"string",args:[{name:"Alphabet",type:"binary_string",value:Base64.BASE32_ALPHABET}]},"Show Base64 offsets":{description:"When a string is within a block of data and the whole block is Base64'd, the string itself could be represented in Base64 in three distinct ways depending on its offset within the block.

                                                              This operation shows all possible offsets for a given string so that each possible encoding can be considered.",run:Base64.run_offsets,input_type:"byte_array",output_type:"html",args:[{name:"Alphabet",type:"binary_string",value:Base64.ALPHABET},{name:"Show variable chars and padding",type:"boolean",value:Base64.OFFSETS_SHOW_VARIABLE}]},XOR:{description:"XOR the input with the given key.
                                                              e.g. fe023da5

                                                              Options
                                                              Null preserving: If the current byte is 0x00 or the same as the key, skip it.

                                                              Scheme:
                                                              • Standard - key is unchanged after each round
                                                              • Input differential - key is set to the value of the previous unprocessed byte
                                                              • Output differential - key is set to the value of the previous processed byte
                                                              ",run:BitwiseOp.run_xor,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Key",type:"toggle_string",value:"",toggle_values:BitwiseOp.KEY_FORMAT},{name:"Scheme",type:"option",value:BitwiseOp.XOR_SCHEME},{name:"Null preserving",type:"boolean",value:BitwiseOp.XOR_PRESERVE_NULLS}]},"XOR Brute Force":{description:"Enumerate all possible XOR solutions. Current maximum key length is 2 due to browser performance.

                                                              Optionally enter a regex string that you expect to find in the plaintext to filter results (crib).",run:BitwiseOp.run_xor_brute,input_type:"byte_array",output_type:"string",args:[{name:"Key length",type:"option",value:BitwiseOp.XOR_BRUTE_KEY_LENGTH},{name:"Length of sample",type:"number",value:BitwiseOp.XOR_BRUTE_SAMPLE_LENGTH},{name:"Offset of sample",type:"number",value:BitwiseOp.XOR_BRUTE_SAMPLE_OFFSET},{name:"Null preserving",type:"boolean",value:BitwiseOp.XOR_PRESERVE_NULLS},{name:"Differential",type:"boolean",value:BitwiseOp.XOR_DIFFERENTIAL},{name:"Crib (known plaintext string)",type:"binary_string",value:""},{name:"Print key",type:"boolean",value:BitwiseOp.XOR_BRUTE_PRINT_KEY},{name:"Output as hex",type:"boolean",value:BitwiseOp.XOR_BRUTE_OUTPUT_HEX}]},NOT:{description:"Returns the inverse of each byte.",run:BitwiseOp.run_not,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[]},AND:{description:"AND the input with the given key.
                                                              e.g. fe023da5",run:BitwiseOp.run_and,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Key",type:"toggle_string",value:"",toggle_values:BitwiseOp.KEY_FORMAT}]},OR:{description:"OR the input with the given key.
                                                              e.g. fe023da5",run:BitwiseOp.run_or,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Key",type:"toggle_string",value:"",toggle_values:BitwiseOp.KEY_FORMAT}]},ADD:{description:"ADD the input with the given key (e.g. fe023da5), MOD 255",run:BitwiseOp.run_add,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Key",type:"toggle_string",value:"",toggle_values:BitwiseOp.KEY_FORMAT}]},SUB:{description:"SUB the input with the given key (e.g. fe023da5), MOD 255",run:BitwiseOp.run_sub,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Key",type:"toggle_string",value:"",toggle_values:BitwiseOp.KEY_FORMAT}]},"From Hex":{description:"Converts a hexadecimal byte string back into a its raw value.

                                                              e.g. ce 93 ce b5 ce b9 ce ac 20 cf 83 ce bf cf 85 0a becomes the UTF-8 encoded string \u0393\u03b5\u03b9\u03ac \u03c3\u03bf\u03c5",run:ByteRepr.run_from_hex,highlight:ByteRepr.highlight_from,highlight_reverse:ByteRepr.highlight_to,input_type:"string",output_type:"byte_array",args:[{name:"Delimiter",type:"option",value:ByteRepr.HEX_DELIM_OPTIONS}]},"To Hex":{description:"Converts the input string to hexadecimal bytes separated by the specified delimiter.

                                                              e.g. The UTF-8 encoded string \u0393\u03b5\u03b9\u03ac \u03c3\u03bf\u03c5 becomes ce 93 ce b5 ce b9 ce ac 20 cf 83 ce bf cf 85 0a",run:ByteRepr.run_to_hex,highlight:ByteRepr.highlight_to,highlight_reverse:ByteRepr.highlight_from,input_type:"byte_array",output_type:"string",args:[{name:"Delimiter",type:"option",value:ByteRepr.HEX_DELIM_OPTIONS}]},"From Charcode":{description:"Converts unicode character codes back into text.

                                                              e.g. 0393 03b5 03b9 03ac 20 03c3 03bf 03c5 becomes \u0393\u03b5\u03b9\u03ac \u03c3\u03bf\u03c5",run:ByteRepr.run_from_charcode,highlight:ByteRepr.highlight_from,highlight_reverse:ByteRepr.highlight_to,input_type:"string",output_type:"byte_array",args:[{name:"Delimiter",type:"option",value:ByteRepr.DELIM_OPTIONS},{name:"Base",type:"number",value:ByteRepr.CHARCODE_BASE}]},"To Charcode":{description:"Converts text to its unicode character code equivalent.

                                                              e.g. \u0393\u03b5\u03b9\u03ac \u03c3\u03bf\u03c5 becomes 0393 03b5 03b9 03ac 20 03c3 03bf 03c5",run:ByteRepr.run_to_charcode,highlight:ByteRepr.highlight_to,highlight_reverse:ByteRepr.highlight_from,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"option",value:ByteRepr.DELIM_OPTIONS},{name:"Base",type:"number",value:ByteRepr.CHARCODE_BASE}]},"From Binary":{description:"Converts a binary string back into its raw form.

                                                              e.g. 01001000 01101001 becomes Hi",run:ByteRepr.run_from_binary,highlight:ByteRepr.highlight_from_binary,highlight_reverse:ByteRepr.highlight_to_binary,input_type:"string",output_type:"byte_array",args:[{name:"Delimiter",type:"option",value:ByteRepr.BIN_DELIM_OPTIONS}]},"To Binary":{description:"Displays the input data as a binary string.

                                                              e.g. Hi becomes 01001000 01101001",run:ByteRepr.run_to_binary,highlight:ByteRepr.highlight_to_binary,highlight_reverse:ByteRepr.highlight_from_binary,input_type:"byte_array",output_type:"string",args:[{name:"Delimiter",type:"option",value:ByteRepr.BIN_DELIM_OPTIONS}]},"From Decimal":{description:"Converts the data from an ordinal integer array back into its raw form.

                                                              e.g. 72 101 108 108 111 becomes Hello",run:ByteRepr.run_from_decimal,input_type:"string",output_type:"byte_array",args:[{name:"Delimiter",type:"option",value:ByteRepr.DELIM_OPTIONS}]},"To Decimal":{description:"Converts the input data to an ordinal integer array.

                                                              e.g. Hello becomes 72 101 108 108 111",run:ByteRepr.run_to_decimal,input_type:"byte_array",output_type:"string",args:[{name:"Delimiter",type:"option",value:ByteRepr.DELIM_OPTIONS}]},"From Hexdump":{description:"Attempts to convert a hexdump back into raw data. This operation supports many different hexdump variations, but probably not all. Make sure you verify that the data it gives you is correct before continuing analysis.",run:Hexdump.run_from,highlight:Hexdump.highlight_from,highlight_reverse:Hexdump.highlight_to,input_type:"string",output_type:"byte_array",args:[]},"To Hexdump":{description:"Creates a hexdump of the input data, displaying both the hexademinal values of each byte and an ASCII representation alongside.",run:Hexdump.run_to,highlight:Hexdump.highlight_to,highlight_reverse:Hexdump.highlight_from,input_type:"byte_array",output_type:"string",args:[{name:"Width",type:"number",value:Hexdump.WIDTH},{name:"Upper case hex",type:"boolean",value:Hexdump.UPPER_CASE},{name:"Include final length",type:"boolean",value:Hexdump.INCLUDE_FINAL_LENGTH}]},"From Base":{description:"Converts a number to decimal from a given numerical base.",run:Base.run_from,input_type:"string",output_type:"number",args:[{name:"Radix",type:"number",value:Base.DEFAULT_RADIX}]},"To Base":{description:"Converts a decimal number to a given numerical base.",run:Base.run_to,input_type:"number",output_type:"string",args:[{name:"Radix",type:"number",value:Base.DEFAULT_RADIX}]},"From HTML Entity":{description:"Converts HTML entities back to characters

                                                              e.g. &amp; becomes &",run:HTML.run_from_entity,input_type:"string",output_type:"string",args:[]},"To HTML Entity":{description:"Converts characters to HTML entities

                                                              e.g. & becomes &amp;",run:HTML.run_to_entity,input_type:"string",output_type:"string",args:[{name:"Convert all characters",type:"boolean",value:HTML.CONVERT_ALL},{name:"Convert to",type:"option",value:HTML.CONVERT_OPTIONS}]},"Strip HTML tags":{description:"Removes all HTML tags from the input.",run:HTML.run_strip_tags,input_type:"string",output_type:"string",args:[{name:"Remove indentation",type:"boolean",value:HTML.REMOVE_INDENTATION},{name:"Remove excess line breaks",type:"boolean",value:HTML.REMOVE_LINE_BREAKS}]},"URL Decode":{description:"Converts URI/URL percent-encoded characters back to their raw values.

                                                              e.g. %3d becomes =",run:URL_.run_from,input_type:"string",output_type:"string",args:[]},"URL Encode":{description:"Encodes problematic characters into percent-encoding, a format supported by URIs/URLs.

                                                              e.g. = becomes %3d",run:URL_.run_to,input_type:"string",output_type:"string",args:[{name:"Encode all special chars",type:"boolean",value:URL_.ENCODE_ALL}]},"Parse URI":{description:"Pretty prints complicated Uniform Resource Identifier (URI) strings for ease of reading. Particularly useful for Uniform Resource Locators (URLs) with a lot of arguments.",run:URL_.run_parse,input_type:"string",output_type:"string",args:[]},"Unescape Unicode Characters":{description:"Converts unicode-escaped character notation back into raw characters.

                                                              Supports the prefixes:
                                                              • \\u
                                                              • %u
                                                              • U+
                                                              e.g. \\u03c3\\u03bf\\u03c5 becomes \u03c3\u03bf\u03c5",run:Unicode.run_unescape,input_type:"string",output_type:"string",args:[{name:"Prefix",type:"option",value:Unicode.PREFIXES}]},"From Quoted Printable":{description:"Converts QP-encoded text back to standard text.",run:QuotedPrintable.run_from,input_type:"string",output_type:"byte_array",args:[]},"To Quoted Printable":{description:"Quoted-Printable, or QP encoding, is an encoding using printable ASCII characters (alphanumeric and the equals sign '=') to transmit 8-bit data over a 7-bit data path or, generally, over a medium which is not 8-bit clean. It is defined as a MIME content transfer encoding for use in e-mail.

                                                              QP works by using the equals sign '=' as an escape character. It also limits line length to 76, as some software has limits on line length.",run:QuotedPrintable.run_to,input_type:"byte_array",output_type:"string",args:[]},"From Punycode":{description:"Punycode is a way to represent Unicode with the limited character subset of ASCII supported by the Domain Name System.

                                                              e.g. mnchen-3ya decodes to m\xfcnchen",run:Punycode.run_to_unicode,input_type:"string",output_type:"string",args:[{name:"Internationalised domain name",type:"boolean",value:Punycode.IDN}]},"To Punycode":{description:"Punycode is a way to represent Unicode with the limited character subset of ASCII supported by the Domain Name System.

                                                              e.g. m\xfcnchen encodes to mnchen-3ya",run:Punycode.run_to_ascii,input_type:"string",output_type:"string",args:[{name:"Internationalised domain name",type:"boolean",value:Punycode.IDN}]},"From Hex Content":{description:"Translates hexadecimal bytes in text back to raw bytes.

                                                              e.g. foo|3d|bar becomes foo=bar.",run:ByteRepr.run_from_hex_content,input_type:"string",output_type:"byte_array",args:[]},"To Hex Content":{description:"Converts special characters in a string to hexadecimal.

                                                              e.g. foo=bar becomes foo|3d|bar.",run:ByteRepr.run_to_hex_content,input_type:"byte_array",output_type:"string",args:[{name:"Convert",type:"option",value:ByteRepr.HEX_CONTENT_CONVERT_WHICH},{name:"Print spaces between bytes",type:"boolean",value:ByteRepr.HEX_CONTENT_SPACES_BETWEEN_BYTES}]},"Change IP format":{description:"Convert an IP address from one format to another, e.g. 172.20.23.54 to ac141736",run:IP.run_change_ip_format,input_type:"string",output_type:"string",args:[{name:"Input format",type:"option",value:IP.IP_FORMAT_LIST},{name:"Output format",type:"option",value:IP.IP_FORMAT_LIST}]},"Parse IP range":{description:"Given a CIDR range (e.g. 10.0.0.0/24) or a hyphenated range (e.g. 10.0.0.0 - 10.0.1.0), this operation provides network information and enumerates all IP addresses in the range.

                                                              IPv6 is supported but will not be enumerated.",run:IP.run_parse_ip_range,input_type:"string",output_type:"string",args:[{name:"Include network info",type:"boolean",value:IP.INCLUDE_NETWORK_INFO},{name:"Enumerate IP addresses",type:"boolean",value:IP.ENUMERATE_ADDRESSES},{name:"Allow large queries",type:"boolean",value:IP.ALLOW_LARGE_LIST}]},"Group IP addresses":{description:"Groups a list of IP addresses into subnets. Supports both IPv4 and IPv6 addresses.",run:IP.run_group_ips,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"option",value:IP.DELIM_OPTIONS},{name:"Subnet (CIDR)",type:"number",value:IP.GROUP_CIDR},{name:"Only show the subnets",type:"boolean",value:IP.GROUP_ONLY_SUBNET}]},"Parse IPv6 address":{description:"Displays the longhand and shorthand versions of a valid IPv6 address.

                                                              Recognises all reserved ranges and parses encapsulated or tunnelled addresses including Teredo and 6to4.",run:IP.run_parse_ipv6,input_type:"string",output_type:"string",args:[]},"Text encoding":{description:"Translates the data between different character encodings.

                                                              Supported charsets are:
                                                              • UTF8
                                                              • UTF16
                                                              • UTF16LE (little-endian)
                                                              • UTF16BE (big-endian)
                                                              • Hex
                                                              • Base64
                                                              • Latin1 (ISO-8859-1)
                                                              • Windows-1251
                                                              ",run:CharEnc.run,input_type:"string",output_type:"string",args:[{name:"Input type",type:"option",value:CharEnc.IO_FORMAT},{name:"Output type",type:"option",value:CharEnc.IO_FORMAT}]},"AES Decrypt":{description:"To successfully decrypt AES, you need either:
                                                              • The passphrase
                                                              • Or the key and IV
                                                              The IV should be the first 16 bytes of encrypted material.",run:Cipher.run_aes_dec,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Input format",type:"option",value:Cipher.IO_FORMAT1},{name:"Output format",type:"option",value:Cipher.IO_FORMAT2}]},"AES Encrypt":{description:"Input: Either enter a passphrase (which will be used to derive a key using the OpenSSL KDF) or both the key and IV.

                                                              Advanced Encryption Standard (AES) is a U.S. Federal Information Processing Standard (FIPS). It was selected after a 5-year process where 15 competing designs were evaluated.

                                                              AES-128, AES-192, and AES-256 are supported. The variant will be chosen based on the size of the key passed in. If a passphrase is used, a 256-bit key will be generated.",run:Cipher.run_aes_enc,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Output result",type:"option",value:Cipher.RESULT_TYPE},{name:"Output format",type:"option",value:Cipher.IO_FORMAT1}]},"DES Decrypt":{description:"To successfully decrypt DES, you need either:
                                                              • The passphrase
                                                              • Or the key and IV
                                                              The IV should be the first 8 bytes of encrypted material.",run:Cipher.run_des_dec,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Input format",type:"option",value:Cipher.IO_FORMAT1},{name:"Output format",type:"option",value:Cipher.IO_FORMAT2}]},"DES Encrypt":{description:"Input: Either enter a passphrase (which will be used to derive a key using the OpenSSL KDF) or both the key and IV.

                                                              DES is a previously dominant algorithm for encryption, and was published as an official U.S. Federal Information Processing Standard (FIPS). It is now considered to be insecure due to its small key size.",run:Cipher.run_des_enc,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Output result",type:"option",value:Cipher.RESULT_TYPE},{name:"Output format",type:"option",value:Cipher.IO_FORMAT1}]},"Triple DES Decrypt":{description:"To successfully decrypt Triple DES, you need either:
                                                              • The passphrase
                                                              • Or the key and IV
                                                              The IV should be the first 8 bytes of encrypted material.",run:Cipher.run_triple_des_dec,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Input format",type:"option",value:Cipher.IO_FORMAT1},{name:"Output format",type:"option",value:Cipher.IO_FORMAT2}]},"Triple DES Encrypt":{description:"Input: Either enter a passphrase (which will be used to derive a key using the OpenSSL KDF) or both the key and IV.

                                                              Triple DES applies DES three times to each block to increase key size.",run:Cipher.run_triple_des_enc,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Output result",type:"option",value:Cipher.RESULT_TYPE},{name:"Output format",type:"option",value:Cipher.IO_FORMAT1}]},"Blowfish Decrypt":{description:"Blowfish is a symmetric-key block cipher designed in 1993 by Bruce Schneier and included in a large number of cipher suites and encryption products. AES now receives more attention.",run:Cipher.run_blowfish_dec,input_type:"string",output_type:"string",args:[{name:"Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"Mode",type:"option",value:Cipher.BLOWFISH_MODES},{name:"Input format",type:"option",value:Cipher.IO_FORMAT3}]},"Blowfish Encrypt":{description:"Blowfish is a symmetric-key block cipher designed in 1993 by Bruce Schneier and included in a large number of cipher suites and encryption products. AES now receives more attention.",run:Cipher.run_blowfish_enc,input_type:"string",output_type:"string",args:[{name:"Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"Mode",type:"option",value:Cipher.BLOWFISH_MODES},{name:"Output format",type:"option",value:Cipher.IO_FORMAT3}]},"Rabbit Decrypt":{description:"To successfully decrypt Rabbit, you need either:
                                                              • The passphrase
                                                              • Or the key and IV (This is currently broken. You need the key and salt at the moment.)
                                                              The IV should be the first 8 bytes of encrypted material.",run:Cipher.run_rabbit_dec,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Input format",type:"option",value:Cipher.IO_FORMAT1},{name:"Output format",type:"option",value:Cipher.IO_FORMAT2}]},"Rabbit Encrypt":{description:"Input: Either enter a passphrase (which will be used to derive a key using the OpenSSL KDF) or both the key and IV.

                                                              Rabbit is a high-performance stream cipher and a finalist in the eSTREAM Portfolio. It is one of the four designs selected after a 3 1/2 year process where 22 designs were evaluated.",run:Cipher.run_rabbit_enc,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Output result",type:"option",value:Cipher.RESULT_TYPE},{name:"Output format",type:"option",value:Cipher.IO_FORMAT1}]},RC4:{description:"RC4 is a widely-used stream cipher. It is used in popular protocols such as SSL and WEP. Although remarkable for its simplicity and speed, the algorithm's history doesn't inspire confidence in its security.",run:Cipher.run_rc4,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[{name:"Passphrase",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"Input format",type:"option",value:Cipher.IO_FORMAT4},{name:"Output format",type:"option",value:Cipher.IO_FORMAT4}]},"RC4 Drop":{description:"It was discovered that the first few bytes of the RC4 keystream are strongly non-random and leak information about the key. We can defend against this attack by discarding the initial portion of the keystream. This modified algorithm is traditionally called RC4-drop.",run:Cipher.run_rc4drop,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[{name:"Passphrase",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"Input format",type:"option",value:Cipher.IO_FORMAT4},{name:"Output format",type:"option",value:Cipher.IO_FORMAT4},{name:"Number of bytes to drop",type:"number",value:Cipher.RC4DROP_BYTES}]},"Derive PBKDF2 key":{description:"PBKDF2 is a password-based key derivation function. In many applications of cryptography, user security is ultimately dependent on a password, and because a password usually can't be used directly as a cryptographic key, some processing is required.

                                                              A salt provides a large set of keys for any given password, and an iteration count increases the cost of producing keys from a password, thereby also increasing the difficulty of attack.

                                                              Enter your passphrase as the input and then set the relevant options to generate a key.",run:Cipher.run_pbkdf2,input_type:"string",output_type:"string",args:[{name:"Key size",type:"number",value:Cipher.KDF_KEY_SIZE},{name:"Iterations",type:"number",value:Cipher.KDF_ITERATIONS},{name:"Salt (hex)",type:"string",value:""},{name:"Input format",type:"option",value:Cipher.IO_FORMAT2},{name:"Output format",type:"option",value:Cipher.IO_FORMAT3}]},"Derive EVP key":{description:"EVP is a password-based key derivation function used extensively in OpenSSL. In many applications of cryptography, user security is ultimately dependent on a password, and because a password usually can't be used directly as a cryptographic key, some processing is required.

                                                              A salt provides a large set of keys for any given password, and an iteration count increases the cost of producing keys from a password, thereby also increasing the difficulty of attack.

                                                              Enter your passphrase as the input and then set the relevant options to generate a key.",run:Cipher.run_evpkdf,input_type:"string",output_type:"string",args:[{name:"Key size",type:"number",value:Cipher.KDF_KEY_SIZE},{name:"Iterations",type:"number",value:Cipher.KDF_ITERATIONS},{name:"Salt (hex)",type:"string",value:""},{name:"Input format",type:"option",value:Cipher.IO_FORMAT2},{name:"Output format",type:"option",value:Cipher.IO_FORMAT3}]},"Vigen\xe8re Encode":{description:"The Vigenere cipher is a method of encrypting alphabetic text by using a series of different Caesar ciphers based on the letters of a keyword. It is a simple form of polyalphabetic substitution.",run:Cipher.run_vigenere_enc,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[{name:"Key",type:"string",value:""}]},"Vigen\xe8re Decode":{description:"The Vigenere cipher is a method of encrypting alphabetic text by using a series of different Caesar ciphers based on the letters of a keyword. It is a simple form of polyalphabetic substitution.",run:Cipher.run_vigenere_dec,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[{name:"Key",type:"string",value:""}]},"Rotate right":{description:"Rotates each byte to the right by the number of bits specified. Currently only supports 8-bit values.",run:Rotate.run_rotr,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Number of bits",type:"number",value:Rotate.ROTATE_AMOUNT},{name:"Rotate as a whole",type:"boolean",value:Rotate.ROTATE_WHOLE}]},"Rotate left":{description:"Rotates each byte to the left by the number of bits specified. Currently only supports 8-bit values.",run:Rotate.run_rotl,highlight:!0, +highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Number of bits",type:"number",value:Rotate.ROTATE_AMOUNT},{name:"Rotate as a whole",type:"boolean",value:Rotate.ROTATE_WHOLE}]},ROT13:{description:"A simple caesar substitution cipher which rotates alphabet characters by the specified amount (default 13).",run:Rotate.run_rot13,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Rotate lower case chars",type:"boolean",value:Rotate.ROT13_LOWERCASE},{name:"Rotate upper case chars",type:"boolean",value:Rotate.ROT13_UPPERCASE},{name:"Amount",type:"number",value:Rotate.ROT13_AMOUNT}]},ROT47:{description:"A slightly more complex variation of a caesar cipher, which includes ASCII characters from 33 '!' to 126 '~'. Default rotation: 47.",run:Rotate.run_rot47,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Amount",type:"number",value:Rotate.ROT47_AMOUNT}]},"Strip HTTP headers":{description:"Removes HTTP headers from a request or response by looking for the first instance of a double newline.",run:HTTP.run_strip_headers,input_type:"string",output_type:"string",args:[]},"Parse User Agent":{description:"Attempts to identify and categorise information contained in a user-agent string.",run:HTTP.run_parse_user_agent,input_type:"string",output_type:"string",args:[]},"Format MAC addresses":{description:"Displays given MAC addresses in multiple different formats.

                                                              Expects addresses in a list separated by newlines, spaces or commas.

                                                              WARNING: There are no validity checks.",run:MAC.run_format,input_type:"string",output_type:"string",args:[{name:"Output case",type:"option",value:MAC.OUTPUT_CASE},{name:"No delimiter",type:"boolean",value:MAC.NO_DELIM},{name:"Dash delimiter",type:"boolean",value:MAC.DASH_DELIM},{name:"Colon delimiter",type:"boolean",value:MAC.COLON_DELIM},{name:"Cisco style",type:"boolean",value:MAC.CISCO_STYLE}]},"Offset checker":{description:"Compares multiple inputs (separated by the specified delimiter) and highlights matching characters which appear at the same position in all samples.",run:StrUtils.run_offset_checker,input_type:"string",output_type:"html",args:[{name:"Sample delimiter",type:"binary_string",value:StrUtils.OFF_CHK_SAMPLE_DELIMITER}]},"Remove whitespace":{description:"Optionally removes all spaces, carriage returns, line feeds, tabs and form feeds from the input data.

                                                              This operation also supports the removal of full stops which are sometimes used to represent non-printable bytes in ASCII output.",run:Tidy.run_remove_whitespace,input_type:"string",output_type:"string",args:[{name:"Spaces",type:"boolean",value:Tidy.REMOVE_SPACES},{name:"Carriage returns (\\r)",type:"boolean",value:Tidy.REMOVE_CARIAGE_RETURNS},{name:"Line feeds (\\n)",type:"boolean",value:Tidy.REMOVE_LINE_FEEDS},{name:"Tabs",type:"boolean",value:Tidy.REMOVE_TABS},{name:"Form feeds (\\f)",type:"boolean",value:Tidy.REMOVE_FORM_FEEDS},{name:"Full stops",type:"boolean",value:Tidy.REMOVE_FULL_STOPS}]},"Remove null bytes":{description:"Removes all null bytes (0x00) from the input.",run:Tidy.run_remove_nulls,input_type:"byte_array",output_type:"byte_array",args:[]},"Drop bytes":{description:"Cuts the specified number of bytes out of the data.",run:Tidy.run_drop_bytes,input_type:"byte_array",output_type:"byte_array",args:[{name:"Start",type:"number",value:Tidy.DROP_START},{name:"Length",type:"number",value:Tidy.DROP_LENGTH},{name:"Apply to each line",type:"boolean",value:Tidy.APPLY_TO_EACH_LINE}]},"Take bytes":{description:"Takes a slice of the specified number of bytes from the data.",run:Tidy.run_take_bytes,input_type:"byte_array",output_type:"byte_array",args:[{name:"Start",type:"number",value:Tidy.TAKE_START},{name:"Length",type:"number",value:Tidy.TAKE_LENGTH},{name:"Apply to each line",type:"boolean",value:Tidy.APPLY_TO_EACH_LINE}]},"Pad lines":{description:"Add the specified number of the specified character to the beginning or end of each line",run:Tidy.run_pad,input_type:"string",output_type:"string",args:[{name:"Position",type:"option",value:Tidy.PAD_POSITION},{name:"Length",type:"number",value:Tidy.PAD_LENGTH},{name:"Character",type:"binary_short_string",value:Tidy.PAD_CHAR}]},Reverse:{description:"Reverses the input string.",run:SeqUtils.run_reverse,input_type:"byte_array",output_type:"byte_array",args:[{name:"By",type:"option",value:SeqUtils.REVERSE_BY}]},Sort:{description:"Alphabetically sorts strings separated by the specified delimiter.

                                                              The IP address option supports IPv4 only.",run:SeqUtils.run_sort,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"option",value:SeqUtils.DELIMITER_OPTIONS},{name:"Reverse",type:"boolean",value:SeqUtils.SORT_REVERSE},{name:"Order",type:"option",value:SeqUtils.SORT_ORDER}]},Unique:{description:"Removes duplicate strings from the input.",run:SeqUtils.run_unique,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"option",value:SeqUtils.DELIMITER_OPTIONS}]},"Count occurrences":{description:"Counts the number of times the provided string occurs in the input.",run:SeqUtils.run_count,input_type:"string",output_type:"number",args:[{name:"Search string",type:"toggle_string",value:"",toggle_values:SeqUtils.SEARCH_TYPE}]},"Add line numbers":{description:"Adds line numbers to the output.",run:SeqUtils.run_add_line_numbers,input_type:"string",output_type:"string",args:[]},"Remove line numbers":{description:"Removes line numbers from the output if they can be trivially detected.",run:SeqUtils.run_remove_line_numbers,input_type:"string",output_type:"string",args:[]},"Find / Replace":{description:"Replaces all occurrences of the first string with the second.

                                                              The three match options are only relevant to regex search strings.",run:StrUtils.run_find_replace,manual_bake:!0,input_type:"string",output_type:"string",args:[{name:"Find",type:"toggle_string",value:"",toggle_values:StrUtils.SEARCH_TYPE},{name:"Replace",type:"binary_string",value:""},{name:"Global match",type:"boolean",value:StrUtils.FIND_REPLACE_GLOBAL},{name:"Case insensitive",type:"boolean",value:StrUtils.FIND_REPLACE_CASE},{name:"Multiline matching",type:"boolean",value:StrUtils.FIND_REPLACE_MULTILINE}]},"To Upper case":{description:"Converts the input string to upper case, optionally limiting scope to only the first character in each word, sentence or paragraph.",run:StrUtils.run_upper,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[{name:"Scope",type:"option",value:StrUtils.CASE_SCOPE}]},"To Lower case":{description:"Converts every character in the input to lower case.",run:StrUtils.run_lower,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[]},Split:{description:"Splits a string into sections around a given delimiter.",run:StrUtils.run_split,input_type:"string",output_type:"string",args:[{name:"Split delimiter",type:"binary_short_string",value:StrUtils.SPLIT_DELIM},{name:"Join delimiter",type:"option",value:StrUtils.DELIMITER_OPTIONS}]},Filter:{description:"Splits up the input using the specified delimiter and then filters each branch based on a regular expression.",run:StrUtils.run_filter,manual_bake:!0,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"option",value:StrUtils.DELIMITER_OPTIONS},{name:"Regex",type:"string",value:""},{name:"Invert condition",type:"boolean",value:SeqUtils.SORT_REVERSE}]},Strings:{description:"Extracts all strings from the input.",run:Extract.run_strings,input_type:"string",output_type:"string",args:[{name:"Minimum length",type:"number",value:Extract.MIN_STRING_LEN},{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract IP addresses":{description:"Extracts all IPv4 and IPv6 addresses.

                                                              Warning: Given a string 710.65.0.456, this will match 10.65.0.45 so always check the original input!",run:Extract.run_ip,input_type:"string",output_type:"string",args:[{name:"IPv4",type:"boolean",value:Extract.INCLUDE_IPV4},{name:"IPv6",type:"boolean",value:Extract.INCLUDE_IPV6},{name:"Remove local IPv4 addresses",type:"boolean",value:Extract.REMOVE_LOCAL},{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract email addresses":{description:"Extracts all email addresses from the input.",run:Extract.run_email,input_type:"string",output_type:"string",args:[{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract MAC addresses":{description:"Extracts all Media Access Control (MAC) addresses from the input.",run:Extract.run_mac,input_type:"string",output_type:"string",args:[{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract URLs":{description:"Extracts Uniform Resource Locators (URLs) from the input. The protocol (http, ftp etc.) is required otherwise there will be far too many false positives.",run:Extract.run_urls,input_type:"string",output_type:"string",args:[{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract domains":{description:"Extracts domain names with common Top-Level Domains (TLDs).
                                                              Note that this will not include paths. Use Extract URLs to find entire URLs.",run:Extract.run_domains,input_type:"string",output_type:"string",args:[{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract file paths":{description:"Extracts anything that looks like a Windows or UNIX file path.

                                                              Note that if UNIX is selected, there will likely be a lot of false positives.",run:Extract.run_file_paths,input_type:"string",output_type:"string",args:[{name:"Windows",type:"boolean",value:Extract.INCLUDE_WIN_PATH},{name:"UNIX",type:"boolean",value:Extract.INCLUDE_UNIX_PATH},{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract dates":{description:"Extracts dates in the following formats
                                                              • yyyy-mm-dd
                                                              • dd/mm/yyyy
                                                              • mm/dd/yyyy
                                                              Dividers can be any of /, -, . or space",run:Extract.run_dates,input_type:"string",output_type:"string",args:[{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Regular expression":{description:"Define your own regular expression to search the input data with, optionally choosing from a list of pre-defined patterns.",run:StrUtils.run_regex,manual_bake:!0,input_type:"string",output_type:"html",args:[{name:"Built in regexes",type:"populate_option",value:StrUtils.REGEX_PRE_POPULATE,target:1},{name:"Regex",type:"text",value:""},{name:"Case insensitive",type:"boolean",value:StrUtils.REGEX_CASE_INSENSITIVE},{name:"Multiline matching",type:"boolean",value:StrUtils.REGEX_MULTILINE_MATCHING},{name:"Display total",type:"boolean",value:StrUtils.DISPLAY_TOTAL},{name:"Output format",type:"option",value:StrUtils.OUTPUT_FORMAT}]},"XPath expression":{description:"Extract information from an XML document with an XPath query",run:Code.run_xpath,input_type:"string",output_type:"string",args:[{name:"XPath",type:"string",value:Code.XPATH_INITIAL},{name:"Result delimiter",type:"binary_short_string",value:Code.XPATH_DELIMITER}]},"CSS selector":{description:"Extract information from an HTML document with a CSS selector",run:Code.run_css_query,input_type:"string",output_type:"string",args:[{name:"CSS selector",type:"string",value:Code.CSS_SELECTOR_INITIAL},{name:"Delimiter",type:"binary_short_string",value:Code.CSS_QUERY_DELIMITER}]},"From UNIX Timestamp":{description:"Converts a UNIX timestamp to a datetime string.

                                                              e.g. 978346800 becomes Mon 1 January 2001 11:00:00 UTC",run:DateTime.run_from_unix_timestamp,input_type:"number",output_type:"string",args:[{name:"Units",type:"option",value:DateTime.UNITS}]},"To UNIX Timestamp":{description:"Parses a datetime string and returns the corresponding UNIX timestamp.

                                                              e.g. Mon 1 January 2001 11:00:00 UTC becomes 978346800",run:DateTime.run_to_unix_timestamp,input_type:"string",output_type:"number",args:[{name:"Units",type:"option",value:DateTime.UNITS}]},"Translate DateTime Format":{description:"Parses a datetime string in one format and re-writes it in another.

                                                              Run with no input to see the relevant format string examples.",run:DateTime.run_translate_format,input_type:"string",output_type:"html",args:[{name:"Built in formats",type:"populate_option",value:DateTime.DATETIME_FORMATS,target:1},{name:"Input format string",type:"binary_string",value:DateTime.INPUT_FORMAT_STRING},{name:"Input timezone",type:"option",value:DateTime.TIMEZONES},{name:"Output format string",type:"binary_string",value:DateTime.OUTPUT_FORMAT_STRING},{name:"Output timezone",type:"option",value:DateTime.TIMEZONES}]},"Parse DateTime":{description:"Parses a DateTime string in your specified format and displays it in whichever timezone you choose with the following information:
                                                              • Date
                                                              • Time
                                                              • Period (AM/PM)
                                                              • Timezone
                                                              • UTC offset
                                                              • Daylight Saving Time
                                                              • Leap year
                                                              • Days in this month
                                                              • Day of year
                                                              • Week number
                                                              • Quarter
                                                              Run with no input to see format string examples if required.",run:DateTime.run_parse,input_type:"string",output_type:"html",args:[{name:"Built in formats",type:"populate_option",value:DateTime.DATETIME_FORMATS,target:1},{name:"Input format string",type:"binary_string",value:DateTime.INPUT_FORMAT_STRING},{name:"Input timezone",type:"option",value:DateTime.TIMEZONES}]},"Convert distance":{description:"Converts a unit of distance to another format.",run:Convert.run_distance,input_type:"number",output_type:"number",args:[{name:"Input units",type:"option",value:Convert.DISTANCE_UNITS},{name:"Output units",type:"option",value:Convert.DISTANCE_UNITS}]},"Convert area":{description:"Converts a unit of area to another format.",run:Convert.run_area,input_type:"number",output_type:"number",args:[{name:"Input units",type:"option",value:Convert.AREA_UNITS},{name:"Output units",type:"option",value:Convert.AREA_UNITS}]},"Convert mass":{description:"Converts a unit of mass to another format.",run:Convert.run_mass,input_type:"number",output_type:"number",args:[{name:"Input units",type:"option",value:Convert.MASS_UNITS},{name:"Output units",type:"option",value:Convert.MASS_UNITS}]},"Convert speed":{description:"Converts a unit of speed to another format.",run:Convert.run_speed,input_type:"number",output_type:"number",args:[{name:"Input units",type:"option",value:Convert.SPEED_UNITS},{name:"Output units",type:"option",value:Convert.SPEED_UNITS}]},"Convert data units":{description:"Converts a unit of data to another format.",run:Convert.run_data_size,input_type:"number",output_type:"number",args:[{name:"Input units",type:"option",value:Convert.DATA_UNITS},{name:"Output units",type:"option",value:Convert.DATA_UNITS}]},"Raw Deflate":{description:"Compresses data using the deflate algorithm with no headers.",run:Compress.run_raw_deflate,input_type:"byte_array",output_type:"byte_array",args:[{name:"Compression type",type:"option",value:Compress.COMPRESSION_TYPE}]},"Raw Inflate":{description:"Decompresses data which has been compressed using the deflate algorithm with no headers.",run:Compress.run_raw_inflate,input_type:"byte_array",output_type:"byte_array",args:[{name:"Start index",type:"number",value:Compress.INFLATE_INDEX},{name:"Initial output buffer size",type:"number",value:Compress.INFLATE_BUFFER_SIZE},{name:"Buffer expansion type",type:"option",value:Compress.INFLATE_BUFFER_TYPE},{name:"Resize buffer after decompression",type:"boolean",value:Compress.INFLATE_RESIZE},{name:"Verify result",type:"boolean",value:Compress.INFLATE_VERIFY}]},"Zlib Deflate":{description:"Compresses data using the deflate algorithm adding zlib headers.",run:Compress.run_zlib_deflate,input_type:"byte_array",output_type:"byte_array",args:[{name:"Compression type",type:"option",value:Compress.COMPRESSION_TYPE}]},"Zlib Inflate":{description:"Decompresses data which has been compressed using the deflate algorithm with zlib headers.",run:Compress.run_zlib_inflate,input_type:"byte_array",output_type:"byte_array",args:[{name:"Start index",type:"number",value:Compress.INFLATE_INDEX},{name:"Initial output buffer size",type:"number",value:Compress.INFLATE_BUFFER_SIZE},{name:"Buffer expansion type",type:"option",value:Compress.INFLATE_BUFFER_TYPE},{name:"Resize buffer after decompression",type:"boolean",value:Compress.INFLATE_RESIZE},{name:"Verify result",type:"boolean",value:Compress.INFLATE_VERIFY}]},Gzip:{description:"Compresses data using the deflate algorithm with gzip headers.",run:Compress.run_gzip,input_type:"byte_array",output_type:"byte_array",args:[{name:"Compression type",type:"option",value:Compress.COMPRESSION_TYPE},{name:"Filename (optional)",type:"string",value:""},{name:"Comment (optional)",type:"string",value:""},{name:"Include file checksum",type:"boolean",value:Compress.GZIP_CHECKSUM}]},Gunzip:{description:"Decompresses data which has been compressed using the deflate algorithm with gzip headers.",run:Compress.run_gunzip,input_type:"byte_array",output_type:"byte_array",args:[]},Zip:{description:"Compresses data using the PKZIP algorithm with the given filename.

                                                              No support for multiple files at this time.",run:Compress.run_pkzip,input_type:"byte_array",output_type:"byte_array",args:[{name:"Filename",type:"string",value:Compress.PKZIP_FILENAME},{name:"Comment",type:"string",value:""},{name:"Password",type:"binary_string",value:""},{name:"Compression method",type:"option",value:Compress.COMPRESSION_METHOD},{name:"Operating system",type:"option",value:Compress.OS},{name:"Compression type",type:"option",value:Compress.COMPRESSION_TYPE}]},Unzip:{description:"Decompresses data using the PKZIP algorithm and displays it per file, with support for passwords.",run:Compress.run_pkunzip,input_type:"byte_array",output_type:"html",args:[{name:"Password",type:"binary_string",value:""},{name:"Verify result",type:"boolean",value:Compress.PKUNZIP_VERIFY}]},"Bzip2 Decompress":{description:"Decompresses data using the Bzip2 algorithm.",run:Compress.run_bzip2_decompress,input_type:"byte_array",output_type:"string",args:[]},"Generic Code Beautify":{description:"Attempts to pretty print C-style languages such as C, C++, C#, Java, PHP, JavaScript etc.

                                                              This will not do a perfect job, and the resulting code may not work any more. This operation is designed purely to make obfuscated or minified code more easy to read and understand.

                                                              Things which will not work properly:
                                                              • For loop formatting
                                                              • Do-While loop formatting
                                                              • Switch/Case indentation
                                                              • Certain bit shift operators
                                                              ",run:Code.run_generic_beautify,input_type:"string",output_type:"string",args:[]},"JavaScript Parser":{description:"Returns an Abstract Syntax Tree for valid JavaScript code.",run:JS.run_parse,input_type:"string",output_type:"string",args:[{name:"Location info",type:"boolean",value:JS.PARSE_LOC},{name:"Range info",type:"boolean",value:JS.PARSE_RANGE},{name:"Include tokens array",type:"boolean",value:JS.PARSE_TOKENS},{name:"Include comments array",type:"boolean",value:JS.PARSE_COMMENT},{name:"Report errors and try to continue",type:"boolean",value:JS.PARSE_TOLERANT}]},"JavaScript Beautify":{description:"Parses and pretty prints valid JavaScript code. Also works with JavaScript Object Notation (JSON).",run:JS.run_beautify,input_type:"string",output_type:"string",args:[{name:"Indent string",type:"binary_short_string",value:JS.BEAUTIFY_INDENT},{name:"Quotes",type:"option",value:JS.BEAUTIFY_QUOTES},{name:"Semicolons before closing braces",type:"boolean",value:JS.BEAUTIFY_SEMICOLONS},{name:"Include comments",type:"boolean",value:JS.BEAUTIFY_COMMENT}]},"JavaScript Minify":{description:"Compresses JavaScript code.",run:JS.run_minify,input_type:"string",output_type:"string",args:[]},"XML Beautify":{description:"Indents and prettifies eXtensible Markup Language (XML) code.",run:Code.run_xml_beautify,input_type:"string",output_type:"string",args:[{name:"Indent string",type:"binary_short_string",value:Code.BEAUTIFY_INDENT}]},"JSON Beautify":{description:"Indents and prettifies JavaScript Object Notation (JSON) code.",run:Code.run_json_beautify,input_type:"string",output_type:"string",args:[{name:"Indent string",type:"binary_short_string",value:Code.BEAUTIFY_INDENT}]},"CSS Beautify":{description:"Indents and prettifies Cascading Style Sheets (CSS) code.",run:Code.run_css_beautify,input_type:"string",output_type:"string",args:[{name:"Indent string",type:"binary_short_string",value:Code.BEAUTIFY_INDENT}]},"SQL Beautify":{description:"Indents and prettifies Structured Query Language (SQL) code.",run:Code.run_sql_beautify,input_type:"string",output_type:"string",args:[{name:"Indent string",type:"binary_short_string",value:Code.BEAUTIFY_INDENT}]},"XML Minify":{description:"Compresses eXtensible Markup Language (XML) code.",run:Code.run_xml_minify,input_type:"string",output_type:"string",args:[{name:"Preserve comments",type:"boolean",value:Code.PRESERVE_COMMENTS}]},"JSON Minify":{description:"Compresses JavaScript Object Notation (JSON) code.",run:Code.run_json_minify,input_type:"string",output_type:"string",args:[]},"CSS Minify":{description:"Compresses Cascading Style Sheets (CSS) code.",run:Code.run_css_minify,input_type:"string",output_type:"string",args:[{name:"Preserve comments",type:"boolean",value:Code.PRESERVE_COMMENTS}]},"SQL Minify":{description:"Compresses Structured Query Language (SQL) code.",run:Code.run_sql_minify,input_type:"string",output_type:"string",args:[]},"Analyse hash":{description:"Tries to determine information about a given hash and suggests which algorithm may have been used to generate it based on its length.",run:Hash.run_analyse,input_type:"string",output_type:"string",args:[]},MD5:{description:"MD5 (Message-Digest 5) is a widely used hash function. It has been used in a variety of security applications and is also commonly used to check the integrity of files.

                                                              However, MD5 is not collision resistant and it isn't suitable for applications like SSL/TLS certificates or digital signatures that rely on this property.",run:Hash.run_md5,input_type:"string",output_type:"string",args:[]},SHA1:{description:"The SHA (Secure Hash Algorithm) hash functions were designed by the NSA. SHA-1 is the most established of the existing SHA hash functions and it is used in a variety of security applications and protocols.

                                                              However, SHA-1's collision resistance has been weakening as new attacks are discovered or improved.",run:Hash.run_sha1,input_type:"string",output_type:"string",args:[]},SHA224:{description:"SHA-224 is largely identical to SHA-256 but is truncated to 224 bytes.",run:Hash.run_sha224,input_type:"string",output_type:"string",args:[]},SHA256:{description:"SHA-256 is one of the four variants in the SHA-2 set. It isn't as widely used as SHA-1, though it provides much better security.",run:Hash.run_sha256,input_type:"string",output_type:"string",args:[]},SHA384:{description:"SHA-384 is largely identical to SHA-512 but is truncated to 384 bytes.",run:Hash.run_sha384,input_type:"string",output_type:"string",args:[]},SHA512:{description:"SHA-512 is largely identical to SHA-256 but operates on 64-bit words rather than 32.",run:Hash.run_sha512,input_type:"string",output_type:"string",args:[]},SHA3:{description:"This is an implementation of Keccak[c=2d]. SHA3 functions based on different implementations of Keccak will give different results.",run:Hash.run_sha3,input_type:"string",output_type:"string",args:[{name:"Output length",type:"option",value:Hash.SHA3_LENGTH}]},"RIPEMD-160":{description:"RIPEMD (RACE Integrity Primitives Evaluation Message Digest) is a family of cryptographic hash functions developed in Leuven, Belgium, by Hans Dobbertin, Antoon Bosselaers and Bart Preneel at the COSIC research group at the Katholieke Universiteit Leuven, and first published in 1996.

                                                              RIPEMD was based upon the design principles used in MD4, and is similar in performance to the more popular SHA-1.

                                                              RIPEMD-160 is an improved, 160-bit version of the original RIPEMD, and the most common version in the family.",run:Hash.run_ripemd160,input_type:"string",output_type:"string",args:[]},HMAC:{description:"Keyed-Hash Message Authentication Codes (HMAC) are a mechanism for message authentication using cryptographic hash functions.",run:Hash.run_hmac,input_type:"string",output_type:"string",args:[{name:"Password",type:"binary_string",value:""},{name:"Hashing function",type:"option",value:Hash.HMAC_FUNCTIONS}]},"Fletcher-16 Checksum":{description:"The Fletcher checksum is an algorithm for computing a position-dependent checksum devised by John Gould Fletcher at Lawrence Livermore Labs in the late 1970s.

                                                              The objective of the Fletcher checksum was to provide error-detection properties approaching those of a cyclic redundancy check but with the lower computational effort associated with summation techniques.",run:Checksum.run_fletcher16,input_type:"byte_array",output_type:"string",args:[]},"Adler-32 Checksum":{description:"Adler-32 is a checksum algorithm which was invented by Mark Adler in 1995, and is a modification of the Fletcher checksum. Compared to a cyclic redundancy check of the same length, it trades reliability for speed (preferring the latter).

                                                              Adler-32 is more reliable than Fletcher-16, and slightly less reliable than Fletcher-32.",run:Checksum.run_adler32,input_type:"byte_array",output_type:"string",args:[]},"CRC-32 Checksum":{description:"A cyclic redundancy check (CRC) is an error-detecting code commonly used in digital networks and storage devices to detect accidental changes to raw data.

                                                              The CRC was invented by W. Wesley Peterson in 1961; the 32-bit CRC function of Ethernet and many other standards is the work of several researchers and was published in 1975.",run:Checksum.run_crc32,input_type:"byte_array",output_type:"string",args:[]},"Generate all hashes":{description:"Generates all available hashes and checksums for the input.",run:Hash.run_all,input_type:"string",output_type:"string",args:[]},Entropy:{description:"Calculates the Shannon entropy of the input data which gives an idea of its randomness. 8 is the maximum.",run:Entropy.run_entropy,input_type:"byte_array",output_type:"html",args:[{name:"Chunk size",type:"number",value:Entropy.CHUNK_SIZE}]},"Frequency distribution":{description:"Displays the distribution of bytes in the data as a graph.",run:Entropy.run_freq_distrib,input_type:"byte_array",output_type:"html",args:[{name:"Show 0%'s",type:"boolean",value:Entropy.FREQ_ZEROS}]},Numberwang:{description:"Based on the popular gameshow by Mitchell and Webb.",run:Numberwang.run,input_type:"string",output_type:"string",args:[]},"Parse X.509 certificate":{description:"X.509 is an ITU-T standard for a public key infrastructure (PKI) and Privilege Management Infrastructure (PMI). It is commonly involved with SSL/TLS security.

                                                              This operation displays the contents of a certificate in a human readable format, similar to the openssl command line tool.",run:PublicKey.run_parse_x509,input_type:"string",output_type:"string",args:[{name:"Input format",type:"option",value:PublicKey.X509_INPUT_FORMAT}]},"PEM to Hex":{description:"Converts PEM (Privacy Enhanced Mail) format to a hexadecimal DER (Distinguished Encoding Rules) string.",run:PublicKey.run_pem_to_hex,input_type:"string",output_type:"string",args:[]},"Hex to PEM":{description:"Converts a hexadecimal DER (Distinguished Encoding Rules) string into PEM (Privacy Enhanced Mail) format.",run:PublicKey.run_hex_to_pem,input_type:"string",output_type:"string",args:[{name:"Header string",type:"string",value:PublicKey.PEM_HEADER_STRING}]},"Hex to Object Identifier":{description:"Converts a hexadecimal string into an object identifier (OID).",run:PublicKey.run_hex_to_object_identifier,input_type:"string",output_type:"string",args:[]},"Object Identifier to Hex":{description:"Converts an object identifier (OID) into a hexadecimal string.",run:PublicKey.run_object_identifier_to_hex,input_type:"string",output_type:"string",args:[]},"Parse ASN.1 hex string":{description:"Abstract Syntax Notation One (ASN.1) is a standard and notation that describes rules and structures for representing, encoding, transmitting, and decoding data in telecommunications and computer networking.

                                                              This operation parses arbitrary ASN.1 data and presents the resulting tree.",run:PublicKey.run_parse_asn1_hex_string,input_type:"string",output_type:"string",args:[{name:"Starting index",type:"number",value:0},{name:"Truncate octet strings longer than",type:"number",value:PublicKey.ASN1_TRUNCATE_LENGTH}]},"Detect File Type":{description:"Attempts to guess the MIME (Multipurpose Internet Mail Extensions) type of the data based on 'magic bytes'.

                                                              Currently supports the following file types: 7z, amr, avi, bmp, bz2, class, cr2, crx, dex, dmg, doc, elf, eot, epub, exe, flac, flv, gif, gz, ico, iso, jpg, jxr, m4a, m4v, mid, mkv, mov, mp3, mp4, mpg, ogg, otf, pdf, png, ppt, ps, psd, rar, rtf, sqlite, swf, tar, tar.z, tif, ttf, utf8, vmdk, wav, webm, webp, wmv, woff, woff2, xls, xz, zip.",run:FileType.run_detect,input_type:"byte_array",output_type:"string",args:[]},"Scan for Embedded Files":{description:"Scans the data for potential embedded files by looking for magic bytes at all offsets. This operation is prone to false positives.

                                                              WARNING: Files over about 100KB in size will take a VERY long time to process.",run:FileType.run_scan_for_embedded_files,input_type:"byte_array",output_type:"string",args:[{name:"Ignore common byte sequences",type:"boolean",value:FileType.IGNORE_COMMON_BYTE_SEQUENCES}]},"Expand alphabet range":{description:"Expand an alphabet range string into a list of the characters in that range.

                                                              e.g. a-z becomes abcdefghijklmnopqrstuvwxyz.",run:SeqUtils.run_expand_alph_range,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"binary_string",value:""}]},Diff:{description:"Compares two inputs (separated by the specified delimiter) and highlights the differences between them.",run:StrUtils.run_diff,input_type:"string",output_type:"html",args:[{name:"Sample delimiter",type:"binary_string",value:StrUtils.DIFF_SAMPLE_DELIMITER},{name:"Diff by",type:"option",value:StrUtils.DIFF_BY},{name:"Show added",type:"boolean",value:!0},{name:"Show removed",type:"boolean",value:!0},{name:"Ignore whitespace (relevant for word and line)",type:"boolean",value:!1}]},"Parse UNIX file permissions":{description:"Given a UNIX/Linux file permission string in octal or textual format, this operation explains which permissions are granted to which user groups.

                                                              Input should be in either octal (e.g. 755) or textual (e.g. drwxr-xr-x) format.",run:OS.run_parse_unix_perms,input_type:"string",output_type:"string",args:[]},"Swap endianness":{description:"Switches the data from big-endian to little-endian or vice-versa. Data can be read in as hexadecimal or raw bytes. It will be returned in the same format as it is entered.",run:Endian.run_swap_endianness,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[{name:"Data format",type:"option",value:Endian.DATA_FORMAT},{name:"Word length (bytes)",type:"number",value:Endian.WORD_LENGTH},{name:"Pad incomplete words",type:"boolean",value:Endian.PAD_INCOMPLETE_WORDS}]},"Syntax highlighter":{description:"Adds syntax highlighting to a range of source code languages. Note that this will not indent the code. Use one of the 'Beautify' operations for that.",run:Code.run_syntax_highlight,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"html",args:[{name:"Language/File extension",type:"option",value:Code.LANGUAGES},{name:"Display line numbers",type:"boolean",value:Code.LINE_NUMS}]},"Parse escaped string":{description:"Replaces escaped characters with the bytes they represent.

                                                              e.g.Hello\\nWorld becomes Hello
                                                              World
                                                              ", +run:StrUtils.run_parse_escaped_string,input_type:"string",output_type:"string",args:[]},"TCP/IP Checksum":{description:"Calculates the checksum for a TCP (Transport Control Protocol) or IP (Internet Protocol) header from an input of raw bytes.",run:Checksum.run_tcp_ip,input_type:"byte_array",output_type:"string",args:[]},"Parse colour code":{description:"Converts a colour code in a standard format to other standard formats and displays the colour itself.

                                                              Example inputs
                                                              • #d9edf7
                                                              • rgba(217,237,247,1)
                                                              • hsla(200,65%,91%,1)
                                                              • cmyk(0.12, 0.04, 0.00, 0.03)
                                                              ",run:HTML.run_parse_colour_code,input_type:"string",output_type:"html",args:[]},"Generate UUID":{description:"Generates an RFC 4122 version 4 compliant Universally Unique Identifier (UUID), also known as a Globally Unique Identifier (GUID).

                                                              A version 4 UUID relies on random numbers, in this case generated using window.crypto if available and falling back to Math.random if not.",run:UUID.run_generate_v4,input_type:"string",output_type:"string",args:[]},Substitute:{description:"A substitution cipher allowing you to specify bytes to replace with other byte values. This can be used to create Caesar ciphers but is more powerful as any byte value can be substituted, not just letters, and the substitution values need not be in order.

                                                              Enter the bytes you want to replace in the Plaintext field and the bytes to replace them with in the Ciphertext field.

                                                              Non-printable bytes can be specified using string escape notation. For example, a line feed character can be written as either \\n or \\x0a.

                                                              Byte ranges can be specified using a hyphen. For example, the sequence 0123456789 can be written as 0-9.",run:Cipher.run_substitute,input_type:"byte_array",output_type:"byte_array",args:[{name:"Plaintext",type:"binary_string",value:Cipher.SUBS_PLAINTEXT},{name:"Ciphertext",type:"binary_string",value:Cipher.SUBS_CIPHERTEXT}]}};var ControlsWaiter=function(a,b){this.app=a,this.manager=b};ControlsWaiter.prototype.adjust_width=function(){var a=document.getElementById("controls"),b=document.getElementById("step"),c=document.getElementById("clr-breaks"),d=document.querySelector("#save img"),e=document.querySelector("#load img"),f=document.querySelector("#step img"),g=document.querySelector("#clr-recipe img"),h=document.querySelector("#clr-breaks img");a.clientWidth<470?b.childNodes[1].nodeValue=" Step":b.childNodes[1].nodeValue=" Step through",a.clientWidth<400?(d.style.display="none",e.style.display="none",f.style.display="none",g.style.display="none",h.style.display="none"):(d.style.display="inline",e.style.display="inline",f.style.display="inline",g.style.display="inline",h.style.display="inline"),a.clientWidth<330?c.childNodes[1].nodeValue=" Clear breaks":c.childNodes[1].nodeValue=" Clear breakpoints"},ControlsWaiter.prototype.set_auto_bake=function(a){var b=document.getElementById("auto-bake");b.checked!==a&&b.click()},ControlsWaiter.prototype.bake_click=function(){this.app.bake(),$("#output-text").selectRange(0)},ControlsWaiter.prototype.step_click=function(){this.app.bake(!0),$("#output-text").selectRange(0)},ControlsWaiter.prototype.auto_bake_change=function(){var a=document.getElementById("auto-bake-label"),b=document.getElementById("auto-bake");this.app.auto_bake_=b.checked,b.checked?(a.classList.remove("btn-default"),a.classList.add("btn-success")):(a.classList.remove("btn-success"),a.classList.add("btn-default"))},ControlsWaiter.prototype.clear_recipe_click=function(){this.manager.recipe.clear_recipe()},ControlsWaiter.prototype.clear_breaks_click=function(){for(var a=document.querySelectorAll("#rec_list li.operation .breakpoint"),b=0;b0,b=b&&f.length>0&&f.length<8e3,a&&(d+="?recipe="+encodeURIComponent(e)),a&&b?d+="&input="+encodeURIComponent(f):b&&(d+="?input="+encodeURIComponent(f)),d},ControlsWaiter.prototype.save_text_change=function(){try{var a=JSON.parse(document.getElementById("save-text").value);this.initialise_save_link(a)}catch(a){}},ControlsWaiter.prototype.save_click=function(){var a=this.app.get_recipe_config(),b=JSON.stringify(a).replace(/},{/g,"},\n{");document.getElementById("save-text").value=b,this.initialise_save_link(a),$("#save-modal").modal()},ControlsWaiter.prototype.slr_check_change=function(){this.initialise_save_link()},ControlsWaiter.prototype.sli_check_change=function(){this.initialise_save_link()},ControlsWaiter.prototype.load_click=function(){this.populate_load_recipes_list(),$("#load-modal").modal()},ControlsWaiter.prototype.save_button_click=function(){var a=document.getElementById("save-name").value,b=document.getElementById("save-text").value;if(!a)return void this.app.alert("Please enter a recipe name","danger",2e3);var c=localStorage.saved_recipes?JSON.parse(localStorage.saved_recipes):[],d=localStorage.recipe_id||0;c.push({id:++d,name:a,recipe:b}),localStorage.saved_recipes=JSON.stringify(c),localStorage.recipe_id=d,this.app.alert('Recipe saved as "'+a+'".',"success",2e3)},ControlsWaiter.prototype.populate_load_recipes_list=function(){for(var a=document.getElementById("load-name"),b=a.options.length;b--;)a.remove(b);var c=localStorage.saved_recipes?JSON.parse(localStorage.saved_recipes):[];for(b=0;bend: "+e+"
                                                              length: "+f},HighlighterWaiter.prototype.remove_highlights=function(){document.getElementById("input-highlighter").innerHTML="",document.getElementById("output-highlighter").innerHTML="",document.getElementById("input-selection-info").innerHTML="",document.getElementById("output-selection-info").innerHTML=""},HighlighterWaiter.prototype.generate_highlight_list=function(){for(var a=this.app.get_recipe_config(),b=[],c=0;c=0)return!1;var d="[start_highlight]",e=/\[start_highlight\]/g,f="[end_highlight]",g=/\[end_highlight\]/g,h=a.value;if(1===c.length){if(c[0].end/g,">").replace(/\n/g," ").replace(e,'').replace(g,"")+" ",b.style.width=a.clientWidth+"px",b.innerHTML=h,b.scrollTop=a.scrollTop,b.scrollLeft=a.scrollLeft};var HTMLApp=function(a,b,c,d){this.categories=a,this.operations=b,this.dfavourites=c,this.doptions=d,this.options=Utils.extend({},d),this.chef=new Chef,this.manager=new Manager(this),this.auto_bake_=!1,this.progress=0,this.ing_id=0,window.chef=this.chef};HTMLApp.prototype.setup=function(){document.dispatchEvent(this.manager.appstart),this.initialise_splitter(),this.load_local_storage(),this.populate_operations_list(),this.manager.setup(),this.reset_layout(),this.set_compile_message(),this.load_URI_params()},HTMLApp.prototype.handle_error=function(a){console.error(a);var b=a.display_str||a.toString();this.alert(b,"danger",this.options.error_timeout,!this.options.show_errors)},HTMLApp.prototype.bake=function(a){var b;try{b=this.chef.bake(this.get_input(),this.get_recipe_config(),this.options,this.progress,a)}catch(a){this.handle_error(a)}b&&(b.error&&this.handle_error(b.error),this.options=b.options,this.dish_str="html"===b.type?Utils.strip_html_tags(b.result,!0):b.result,this.progress=b.progress,this.manager.recipe.update_breakpoint_indicator(b.progress),this.manager.output.set(b.result,b.type,b.duration),b.duration>this.options.auto_bake_threshold&&this.auto_bake_&&(this.manager.controls.set_auto_bake(!1),this.alert("Baking took longer than "+this.options.auto_bake_threshold+"ms, Auto Bake has been disabled.","warning",5e3)))},HTMLApp.prototype.auto_bake=function(){this.auto_bake_&&this.bake()},HTMLApp.prototype.silent_bake=function(){var a=(new Date).getTime(),b=this.get_recipe_config();return this.auto_bake_&&this.chef.silent_bake(b),(new Date).getTime()-a},HTMLApp.prototype.get_input=function(){var a=this.manager.input.get();return sessionStorage.setItem("input_length",a.length),sessionStorage.setItem("input",a),a},HTMLApp.prototype.set_input=function(a){sessionStorage.setItem("input_length",a.length),sessionStorage.setItem("input",a),this.manager.input.set(a)},HTMLApp.prototype.populate_operations_list=function(){document.body.appendChild(document.getElementById("edit-favourites"));for(var a="",b=0;b2?JSON.parse(localStorage.favourites):this.dfavourites;a=this.valid_favourites(a),this.save_favourites(a);var b=this.categories.filter(function(a){return"Favourites"===a.name})[0];b?b.ops=a:this.categories.unshift({name:"Favourites",ops:a})},HTMLApp.prototype.valid_favourites=function(a){for(var b=[],c=0;c=0?void this.alert("'"+a+"' is already in your favourites","info",2e3):(b.push(a),this.save_favourites(b),this.load_favourites(),this.populate_operations_list(),void this.manager.recipe.initialise_operation_drag_n_drop())},HTMLApp.prototype.load_URI_params=function(){this.query_string=function(a){if(""===a)return{};for(var b={},c=0;c"):d[e].value=a[b].args[e];a[b].disabled&&c.querySelector(".disable-icon").click(),a[b].breakpoint&&c.querySelector(".breakpoint").click(),this.progress=0}},HTMLApp.prototype.reset_layout=function(){this.column_splitter.setSizes([20,30,50]),this.io_splitter.setSizes([50,50]),this.manager.controls.adjust_width(),this.manager.output.adjust_width()},HTMLApp.prototype.set_compile_message=function(){var a=new Date,b=Utils.fuzzy_time(a.getTime()-window.compile_time),c='Last build: '+b.substr(0,1).toUpperCase()+b.substr(1)+" ago";""!==window.compile_message&&(c+=" - "+window.compile_message),c+="",document.getElementById("notice").innerHTML=c},HTMLApp.prototype.alert=function(a,b,c,d){var e=new Date;if(console.log("["+e.toLocaleString()+"] "+a),!d){b=b||"danger",c=c||0;var f=document.getElementById("alert"),g=document.getElementById("alert-content");f.classList.remove("alert-danger"),f.classList.remove("alert-warning"),f.classList.remove("alert-info"),f.classList.remove("alert-success"),f.classList.add("alert-"+b),"block"===f.style.display?g.innerHTML+="

                                                              ["+e.toLocaleTimeString()+"] "+a:g.innerHTML="["+e.toLocaleTimeString()+"] "+a,$("#alert").stop(),f.style.display="block",f.style.opacity=1,c>0&&(clearTimeout(this.alert_timeout),this.alert_timeout=setTimeout(function(){$("#alert").slideUp(100)},c))}},HTMLApp.prototype.confirm=function(a,b,c,d){d=d||this,document.getElementById("confirm-title").innerHTML=a,document.getElementById("confirm-body").innerHTML=b,document.getElementById("confirm-modal").style.display="block",this.confirm_closed=!1,$("#confirm-modal").modal().one("show.bs.modal",function(a){this.confirm_closed=!1}.bind(this)).one("click","#confirm-yes",function(){this.confirm_closed=!0,c.bind(d)(!0),$("#confirm-modal").modal("hide")}.bind(this)).one("hide.bs.modal",function(a){this.confirm_closed||c.bind(d)(!1),this.confirm_closed=!0}.bind(this))},HTMLApp.prototype.alert_close_click=function(){document.getElementById("alert").style.display="none"},HTMLApp.prototype.state_change=function(a){this.auto_bake(),this.options.update_url&&(this.last_state_url=this.manager.controls.generate_state_url(!0,!0),window.history.replaceState({},"CyberChef",this.last_state_url))},HTMLApp.prototype.pop_state=function(a){window.location.href.split("#")[0]!==this.last_state_url&&this.load_URI_params()},HTMLApp.prototype.call_api=function(a,b,c,d,e){b=b||"POST",c=c||{},d=d||void 0,e=e||"application/json";var f=null,g=!1;return $.ajax({url:a,async:!1,type:b,data:c,dataType:d,contentType:e,success:function(a){g=!0,f=a},error:function(a){g=!1,f=a}}),{success:g,response:f}};var HTMLCategory=function(a,b){this.name=a,this.selected=b,this.op_list=[]};HTMLCategory.prototype.add_operation=function(a){this.op_list.push(a)},HTMLCategory.prototype.to_html=function(){for(var a="cat"+this.name.replace(/[\s\/-:_]/g,""),b="
                                                              "+this.name+"
                                                                ",c=0;c 
                                                              ";switch(d+="
                                                              ",this.type){case"string":case"binary_string":case"byte_array":d+="";break;case"short_string":case"binary_short_string":d+="";break;case"toggle_string":for(d+="
                                                              ";break;case"number":d+="";break;case"boolean":d+="",this.disable_args&&this.manager.add_dynamic_listener("#"+this.id,"click",this.toggle_disable_args,this);break;case"option":for(d+="";break;case"populate_option":for(d+="",this.manager.add_dynamic_listener("#"+this.id,"change",this.populate_option_change,this);break;case"editable_option":for(d+="
                                                              ",d+="",d+="",d+="
                                                              ",this.manager.add_dynamic_listener("#sel-"+this.id,"change",this.editable_option_change,this);break;case"text":d+=""}return d+="
                                                              "},HTMLIngredient.prototype.toggle_disable_args=function(a){for(var b,c=a.target,d=c.parentNode.parentNode,e=d.querySelectorAll(".arg-group"),f=0;f"),this.description&&(b+=""),b+=""},HTMLOperation.prototype.to_full_html=function(){for(var a="
                                                              "+this.name+"
                                                              ",b=0;b=0&&(this.name=this.name.slice(0,b)+""+this.name.slice(b,b+a.length)+""+this.name.slice(b+a.length)),this.description&&c>=0&&(this.description=this.description.slice(0,c)+""+this.description.slice(c,c+a.length)+""+this.description.slice(c+a.length))};var InputWaiter=function(a,b){this.app=a,this.manager=b,this.bad_keys=[16,17,18,19,20,27,33,34,35,36,37,38,39,40,44,91,92,93,112,113,114,115,116,117,118,119,120,121,122,123,144,145]};InputWaiter.prototype.get=function(){return document.getElementById("input-text").value},InputWaiter.prototype.set=function(a){document.getElementById("input-text").value=a,window.dispatchEvent(this.manager.statechange)},InputWaiter.prototype.set_input_info=function(a,b){var c=a.toString().length;c=c<2?2:c;var d=Utils.pad(a.toString(),c," ").replace(/ /g," "),e=Utils.pad(b.toString(),c," ").replace(/ /g," ");document.getElementById("input-info").innerHTML="length: "+d+"
                                                              lines: "+e},InputWaiter.prototype.input_change=function(a){this.manager.highlighter.remove_highlights(),this.app.progress=0;var b=this.get(),c=b.count("\n")+1;this.set_input_info(b.length,c),this.bad_keys.indexOf(a.keyCode)<0&&window.dispatchEvent(this.manager.statechange)},InputWaiter.prototype.input_dragover=function(a){return"move"!==a.dataTransfer.effectAllowed&&(a.stopPropagation(),a.preventDefault(),void a.target.classList.add("dropping-file"))},InputWaiter.prototype.input_dragleave=function(a){ +a.stopPropagation(),a.preventDefault(),a.target.classList.remove("dropping-file")},InputWaiter.prototype.input_drop=function(a){if("move"===a.dataTransfer.effectAllowed)return!1;a.stopPropagation(),a.preventDefault();var b=a.target,c=a.dataTransfer.files[0],d=a.dataTransfer.getData("Text"),e=new FileReader,f="",g=0,h=20480,i=function(){f.length>1e5&&this.app.auto_bake_&&(this.manager.controls.set_auto_bake(!1),this.app.alert("Turned off Auto Bake as the input is large","warning",5e3)),this.set(f);var a=this.app.get_recipe_config();a[0]&&"From Hex"===a[0].op||(a.unshift({op:"From Hex",args:["Space"]}),this.app.set_recipe_config(a)),b.classList.remove("loading_file")}.bind(this),j=function(){if(g>=c.size)return void i();b.value="Processing... "+Math.round(g/c.size*100)+"%";var a=c.slice(g,g+h);e.readAsArrayBuffer(a)};e.onload=function(a){var b=new Uint8Array(e.result);f+=Utils.to_hex_fast(b),g+=h,j()},b.classList.remove("dropping-file"),c?(b.classList.add("loading_file"),j()):d&&this.set(d)},InputWaiter.prototype.clear_io_click=function(){this.manager.highlighter.remove_highlights(),document.getElementById("input-text").value="",document.getElementById("output-text").value="",document.getElementById("input-info").innerHTML="",document.getElementById("output-info").innerHTML="",document.getElementById("input-selection-info").innerHTML="",document.getElementById("output-selection-info").innerHTML="",window.dispatchEvent(this.manager.statechange)};var Manager=function(a){this.app=a,this.appstart=new CustomEvent("appstart",{bubbles:!0}),this.operationadd=new CustomEvent("operationadd",{bubbles:!0}),this.operationremove=new CustomEvent("operationremove",{bubbles:!0}),this.oplistcreate=new CustomEvent("oplistcreate",{bubbles:!0}),this.statechange=new CustomEvent("statechange",{bubbles:!0}),this.window=new WindowWaiter(this.app),this.controls=new ControlsWaiter(this.app,this),this.recipe=new RecipeWaiter(this.app,this),this.ops=new OperationsWaiter(this.app,this),this.input=new InputWaiter(this.app,this),this.output=new OutputWaiter(this.app,this),this.options=new OptionsWaiter(this.app),this.highlighter=new HighlighterWaiter(this.app),this.seasonal=new SeasonalWaiter(this.app,this),this.dynamic_handlers={},this.initialise_event_listeners()};Manager.prototype.setup=function(){this.recipe.initialise_operation_drag_n_drop(),this.controls.auto_bake_change(),this.seasonal.load()},Manager.prototype.initialise_event_listeners=function(){window.addEventListener("resize",this.window.window_resize.bind(this.window)),window.addEventListener("blur",this.window.window_blur.bind(this.window)),window.addEventListener("focus",this.window.window_focus.bind(this.window)),window.addEventListener("statechange",this.app.state_change.bind(this.app)),window.addEventListener("popstate",this.app.pop_state.bind(this.app)),document.getElementById("bake").addEventListener("click",this.controls.bake_click.bind(this.controls)),document.getElementById("auto-bake").addEventListener("change",this.controls.auto_bake_change.bind(this.controls)),document.getElementById("step").addEventListener("click",this.controls.step_click.bind(this.controls)),document.getElementById("clr-recipe").addEventListener("click",this.controls.clear_recipe_click.bind(this.controls)),document.getElementById("clr-breaks").addEventListener("click",this.controls.clear_breaks_click.bind(this.controls)),document.getElementById("save").addEventListener("click",this.controls.save_click.bind(this.controls)),document.getElementById("save-button").addEventListener("click",this.controls.save_button_click.bind(this.controls)),document.getElementById("save-link-recipe-checkbox").addEventListener("change",this.controls.slr_check_change.bind(this.controls)),document.getElementById("save-link-input-checkbox").addEventListener("change",this.controls.sli_check_change.bind(this.controls)),document.getElementById("load").addEventListener("click",this.controls.load_click.bind(this.controls)),document.getElementById("load-delete-button").addEventListener("click",this.controls.load_delete_click.bind(this.controls)),document.getElementById("load-name").addEventListener("change",this.controls.load_name_change.bind(this.controls)),document.getElementById("load-button").addEventListener("click",this.controls.load_button_click.bind(this.controls)),this.add_multi_event_listener("#save-text","keyup paste",this.controls.save_text_change,this.controls),this.add_multi_event_listener("#search","keyup paste search",this.ops.search_operations,this.ops),this.add_dynamic_listener(".op_list li.operation","dblclick",this.ops.operation_dblclick,this.ops),document.getElementById("edit-favourites").addEventListener("click",this.ops.edit_favourites_click.bind(this.ops)),document.getElementById("save-favourites").addEventListener("click",this.ops.save_favourites_click.bind(this.ops)),document.getElementById("reset-favourites").addEventListener("click",this.ops.reset_favourites_click.bind(this.ops)),this.add_dynamic_listener(".op_list .op-icon","mouseover",this.ops.op_icon_mouseover,this.ops),this.add_dynamic_listener(".op_list .op-icon","mouseleave",this.ops.op_icon_mouseleave,this.ops),this.add_dynamic_listener(".op_list","oplistcreate",this.ops.op_list_create,this.ops),this.add_dynamic_listener("li.operation","operationadd",this.recipe.op_add.bind(this.recipe)),this.add_dynamic_listener(".arg","keyup",this.recipe.ing_change,this.recipe),this.add_dynamic_listener(".arg","change",this.recipe.ing_change,this.recipe),this.add_dynamic_listener(".disable-icon","click",this.recipe.disable_click,this.recipe),this.add_dynamic_listener(".breakpoint","click",this.recipe.breakpoint_click,this.recipe),this.add_dynamic_listener("#rec_list li.operation","dblclick",this.recipe.operation_dblclick,this.recipe),this.add_dynamic_listener("#rec_list li.operation > div","dblclick",this.recipe.operation_child_dblclick,this.recipe),this.add_dynamic_listener("#rec_list .input-group .dropdown-menu a","click",this.recipe.dropdown_toggle_click,this.recipe),this.add_dynamic_listener("#rec_list","operationremove",this.recipe.op_remove.bind(this.recipe)),this.add_multi_event_listener("#input-text","keyup paste",this.input.input_change,this.input),document.getElementById("reset-layout").addEventListener("click",this.app.reset_layout.bind(this.app)),document.getElementById("clr-io").addEventListener("click",this.input.clear_io_click.bind(this.input)),document.getElementById("input-text").addEventListener("dragover",this.input.input_dragover.bind(this.input)),document.getElementById("input-text").addEventListener("dragleave",this.input.input_dragleave.bind(this.input)),document.getElementById("input-text").addEventListener("drop",this.input.input_drop.bind(this.input)),document.getElementById("input-text").addEventListener("scroll",this.highlighter.input_scroll.bind(this.highlighter)),document.getElementById("input-text").addEventListener("mouseup",this.highlighter.input_mouseup.bind(this.highlighter)),document.getElementById("input-text").addEventListener("mousemove",this.highlighter.input_mousemove.bind(this.highlighter)),this.add_multi_event_listener("#input-text","mousedown dblclick select",this.highlighter.input_mousedown,this.highlighter),document.getElementById("save-to-file").addEventListener("click",this.output.save_click.bind(this.output)),document.getElementById("switch").addEventListener("click",this.output.switch_click.bind(this.output)),document.getElementById("undo-switch").addEventListener("click",this.output.undo_switch_click.bind(this.output)),document.getElementById("maximise-output").addEventListener("click",this.output.maximise_output_click.bind(this.output)),document.getElementById("output-text").addEventListener("scroll",this.highlighter.output_scroll.bind(this.highlighter)),document.getElementById("output-text").addEventListener("mouseup",this.highlighter.output_mouseup.bind(this.highlighter)),document.getElementById("output-text").addEventListener("mousemove",this.highlighter.output_mousemove.bind(this.highlighter)),document.getElementById("output-html").addEventListener("mouseup",this.highlighter.output_html_mouseup.bind(this.highlighter)),document.getElementById("output-html").addEventListener("mousemove",this.highlighter.output_html_mousemove.bind(this.highlighter)),this.add_multi_event_listener("#output-text","mousedown dblclick select",this.highlighter.output_mousedown,this.highlighter),this.add_multi_event_listener("#output-html","mousedown dblclick select",this.highlighter.output_html_mousedown,this.highlighter),document.getElementById("options").addEventListener("click",this.options.options_click.bind(this.options)),document.getElementById("reset-options").addEventListener("click",this.options.reset_options_click.bind(this.options)),$(document).on("switchChange.bootstrapSwitch",".option-item input:checkbox",this.options.switch_change.bind(this.options)),$(document).on("switchChange.bootstrapSwitch",".option-item input:checkbox",this.options.set_word_wrap.bind(this.options)),this.add_dynamic_listener(".option-item input[type=number]","keyup",this.options.number_change,this.options),this.add_dynamic_listener(".option-item input[type=number]","change",this.options.number_change,this.options),this.add_dynamic_listener(".option-item select","change",this.options.select_change,this.options),document.getElementById("alert-close").addEventListener("click",this.app.alert_close_click.bind(this.app))},Manager.prototype.add_listeners=function(a,b,c,d){d=d||this,[].forEach.call(document.querySelectorAll(a),function(a){a.addEventListener(b,c.bind(d))})},Manager.prototype.add_multi_event_listener=function(a,b,c,d){for(var e=b.split(" "),f=0;f-1&&(this.manager.recipe.add_operation(b[c].innerHTML),this.app.auto_bake()))),13===a.keyCode)a.preventDefault();else if(40===a.keyCode)a.preventDefault(),b=document.querySelectorAll("#search-results li"),b.length&&(c=this.get_selected_op(b),c>-1&&b[c].classList.remove("selected-op"),c===b.length-1&&(c=-1),b[c+1].classList.add("selected-op"));else if(38===a.keyCode)a.preventDefault(),b=document.querySelectorAll("#search-results li"),b.length&&(c=this.get_selected_op(b),c>-1&&b[c].classList.remove("selected-op"),0===c&&(c=b.length),b[c-1].classList.add("selected-op"));else{for(var d=document.getElementById("search-results"),e=a.target,f=e.value;d.firstChild;)$(d.firstChild).popover("destroy"),d.removeChild(d.firstChild);if($("#categories .in").collapse("hide"),f){for(var g=this.filter_operations(f,!0),h="",i=0;i=0||h>=0){var i=new HTMLOperation(e,this.app.operations[e],this.app,this.manager);b&&i.highlight_search_string(a,g,h),g<0?c.push(i):d.push(i)}}return d.concat(c)},OperationsWaiter.prototype.get_selected_op=function(a){for(var b=0;blength: "+e+"
                                                              lines: "+f,document.getElementById("input-selection-info").innerHTML="",document.getElementById("output-selection-info").innerHTML=""},OutputWaiter.prototype.adjust_width=function(){var a=document.getElementById("output"),b=document.getElementById("save-to-file"),c=document.getElementById("switch"),d=document.getElementById("undo-switch"),e=document.getElementById("maximise-output");a.clientWidth<680?(b.childNodes[1].nodeValue="",c.childNodes[1].nodeValue="",d.childNodes[1].nodeValue="",e.childNodes[1].nodeValue=""):(b.childNodes[1].nodeValue=" Save to file",c.childNodes[1].nodeValue=" Move output to input",d.childNodes[1].nodeValue=" Undo",e.childNodes[1].nodeValue="Maximise"===e.getAttribute("title")?" Max":" Restore")},OutputWaiter.prototype.save_click=function(){var a=Utils.to_base64(this.app.dish_str),b=window.prompt("Please enter a filename:","download.dat");if(b){var c=document.createElement("a");c.setAttribute("href","data:application/octet-stream;base64;charset=utf-8,"+a),c.setAttribute("download",b),c.style.display="none",document.body.appendChild(c),c.click(),c.remove()}},OutputWaiter.prototype.switch_click=function(){this.switch_orig_data=this.manager.input.get(),document.getElementById("undo-switch").disabled=!1,this.app.set_input(this.app.dish_str)},OutputWaiter.prototype.undo_switch_click=function(){this.app.set_input(this.switch_orig_data),document.getElementById("undo-switch").disabled=!0},OutputWaiter.prototype.maximise_output_click=function(a){var b="maximise-output"===a.target.id?a.target:a.target.parentNode;"Maximise"===b.getAttribute("title")?(this.app.column_splitter.collapse(0),this.app.column_splitter.collapse(1),this.app.io_splitter.collapse(0),b.setAttribute("title","Restore"),b.innerHTML=" Restore",this.adjust_width()):(b.setAttribute("title","Maximise"),b.innerHTML=" Max",this.app.reset_layout())};var RecipeWaiter=function(a,b){this.app=a,this.manager=b,this.remove_intent=!1};RecipeWaiter.prototype.initialise_operation_drag_n_drop=function(){var a=document.getElementById("rec_list");Sortable.create(a,{group:"recipe",sort:!0,animation:0,delay:0,filter:".arg-input,.arg",setData:function(a,b){a.setData("Text",b.querySelector(".arg-title").textContent)},onEnd:function(a){this.remove_intent&&(a.item.remove(),a.target.dispatchEvent(this.manager.operationremove))}.bind(this)}),Sortable.utils.on(a,"dragover",function(){this.remove_intent=!1}.bind(this)),Sortable.utils.on(a,"dragleave",function(){this.remove_intent=!0,this.app.progress=0}.bind(this)),Sortable.utils.on(a,"touchend",function(b){var c=b.changedTouches[0],d=document.elementFromPoint(c.clientX,c.clientY);this.remove_intent=!a.contains(d)}.bind(this)),document.querySelector("#categories a").addEventListener("dragover",this.fav_dragover.bind(this)),document.querySelector("#categories a").addEventListener("dragleave",this.fav_dragleave.bind(this)),document.querySelector("#categories a").addEventListener("drop",this.fav_drop.bind(this))},RecipeWaiter.prototype.create_sortable_seed_list=function(a){Sortable.create(a,{group:{name:"recipe",pull:"clone",put:!1},sort:!1,setData:function(a,b){a.setData("Text",b.textContent)},onStart:function(a){$(a.item).popover("destroy"),a.item.setAttribute("data-toggle","popover-disabled")},onEnd:this.op_sort_end.bind(this)})},RecipeWaiter.prototype.op_sort_end=function(a){return this.remove_intent?void("rec_list"===a.item.parentNode.id&&a.item.remove()):($(a.clone).popover(),$(a.clone).children("[data-toggle=popover]").popover(),void("rec_list"===a.item.parentNode.id&&(this.build_recipe_operation(a.item),a.item.dispatchEvent(this.manager.operationadd))))},RecipeWaiter.prototype.fav_dragover=function(a){return"move"===a.dataTransfer.effectAllowed&&(a.stopPropagation(),a.preventDefault(),void(a.target.className&&a.target.className.indexOf("category-title")>-1?a.target.classList.add("favourites-hover"):a.target.parentNode.className&&a.target.parentNode.className.indexOf("category-title")>-1?a.target.parentNode.classList.add("favourites-hover"):a.target.parentNode.parentNode.className&&a.target.parentNode.parentNode.className.indexOf("category-title")>-1&&a.target.parentNode.parentNode.classList.add("favourites-hover")))},RecipeWaiter.prototype.fav_dragleave=function(a){a.stopPropagation(),a.preventDefault(),document.querySelector("#categories a").classList.remove("favourites-hover")},RecipeWaiter.prototype.fav_drop=function(a){a.stopPropagation(),a.preventDefault(),a.target.classList.remove("favourites-hover");var b=a.dataTransfer.getData("Text");this.app.add_favourite(b)},RecipeWaiter.prototype.ing_change=function(){window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.disable_click=function(a){var b=a.target;"false"===b.getAttribute("disabled")?(b.setAttribute("disabled","true"),b.classList.add("disable-icon-selected"),b.parentNode.parentNode.classList.add("disabled")):(b.setAttribute("disabled","false"),b.classList.remove("disable-icon-selected"),b.parentNode.parentNode.classList.remove("disabled")),this.app.progress=0,window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.breakpoint_click=function(a){var b=a.target;"false"===b.getAttribute("break")?(b.setAttribute("break","true"),b.classList.add("breakpoint-selected")):(b.setAttribute("break","false"),b.classList.remove("breakpoint-selected")),window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.operation_dblclick=function(a){a.target.remove(),window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.operation_child_dblclick=function(a){a.target.parentNode.remove(),window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.get_config=function(){for(var a,b,c,d,e,f=[],g=document.querySelectorAll("#rec_list li.operation"),h=0;h",this.ing_change()},RecipeWaiter.prototype.op_add=function(a){window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.op_remove=function(a){window.dispatchEvent(this.manager.statechange)};var SeasonalWaiter=function(a,b){this.app=a,this.manager=b};SeasonalWaiter.prototype.load=function(){var a=new Date;11===a.getMonth()&&a.getDate()>12&&(this.app.options.snow=!1,this.create_snow_option(),$(document).on("switchChange.bootstrapSwitch",".option-item input:checkbox[option='snow']",this.let_it_snow.bind(this)),window.addEventListener("resize",this.let_it_snow.bind(this)),this.manager.add_listeners(".btn","click",this.shake_off_snow,this),25===a.getDate()&&this.let_it_snow()),this.kkeys=[],window.addEventListener("keydown",this.konami_code_listener.bind(this))},SeasonalWaiter.prototype.insert_spider_icons=function(){var a="iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB3UlEQVQ4y2NgGJaAmYGBgVnf0oKJgYGBobWtXamqqoYTn2I4CI+LTzM2NTulpKbu+vPHz2dV5RWlluZmi3j5+KqFJSSEzpw8uQPdAEYYIzo5Kfjrl28rWFlZzjAzMYuEBQao3Lh+g+HGvbsMzExMDN++fWf4/PXLBzY2tqYNK1f2+4eHM2xcuRLigsT09Igf3384MTExbf767etBI319jU8fPsi+//jx/72HDxh5uLkZ7ty7y/Dz1687Avz8n2UUFR3Z2NjOySoqfmdhYGBg+PbtuwI7O8e5H79+8X379t357PnzYo+ePP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f0045vdoe0zATHagSYMeWFMkbscnHRYPZjoFJaIiUkz9EJy15j/X3qCsAIqMcFjSWrNE1Iygg0fEmrtLzEUTdT/OhBFht9fHDVCbEUt3LJxi08B8Xj6vTDESriq9lVWqBECgHujqiqAUmufb1X3cfRXoluhjZWiwkOnSUcUS6ZD8LUmmhks6b5j1ezkAkAKZBe5QvPPcNBnoCawMwT66Qxk0R2xwwRAui2iSDGuaPDcubzo3EJq8wcx/9Vmk3QryH42QBQCFF0UagIiJtjX6DskIXTLEucJSHIIIMuO0BOcjn3A3ybU/lu5RCUBc5qA0Ih0Q2EWiCPRk7VfMNhjLW1zETic1tLYZDMKyuSsdfh5l6bwho5+0il4kyA0VohlNcF5FP8DlWo/VB16HYB2hJ0pzgIe2mcXxP2IOumPRY17U0tll8KIkZNb+sppafOxYkQPSaYfchyYoL9GMqWYpTLRIq1QUcT4O3aPQgqVqPwIOIMwDhzX6mQUFIQAgo+9MzcrWrML3mj6+YIKiFCZyhL87RqVQKrEskF+P1BUvfLCAkfRwoPUtq6l5o5+lZb5SolJo6oT8avTCl+c9OTmat6pKW8mLkvBpGzlvsiGuQr4ZEEwA1EQgoR/gNtxIxKBluz+OtMJiF31jHxqXBiAqAUj4WRxpADFM0DCFlv1khvX7Wol4vF4AIldVVxdZqlrIfiCYQPHDy6bAGv7nKYRVY6JewExZVAP+ey5Rv+Ba97aaUHMW5NauLmMZFkegBb/EP14d6NoS9QLWFSzWBmuZza8CQmSpXsAqmGtVy14VALWuuYWWy+W3OteXa4jwceQX6+BKG6J1/8+2VCNkm2222WabbbbZZpttttlmm22rt38DCdA0vq3bcAkAAAAASUVORK5CYII="; +document.querySelector("link[rel=icon]").setAttribute("href","data:image/png;base64,"+a),document.querySelector("#bake img").setAttribute("src","data:image/png;base64,"+b),document.querySelector(".about-img-left").setAttribute("src","data:image/png;base64,"+c)},SeasonalWaiter.prototype.insert_spider_text=function(){document.title=document.title.replace(/Cyber/g,"Spider"),SeasonalWaiter.tree_walk(document.body,function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Cyber/g,"Spider"))},!0),SeasonalWaiter.tree_walk(document.getElementById("bake-group"),function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Bake/g,"Spin"))},!0),document.querySelector("#recipe .title").innerHTML="Web"},SeasonalWaiter.prototype.create_snow_option=function(){var a=document.getElementById("options-body"),b=document.createElement("div");b.className="option-item",b.innerHTML=" Let it snow",a.appendChild(b),this.manager.options.load()},SeasonalWaiter.prototype.let_it_snow=function(){if($(document).snowfall("clear"),this.app.options.snow){var a={},b=navigator.userAgent.match(/Firefox\/(\d\d?)/);a=b&&parseInt(b[1],10)<30?{flakeCount:10,flakeColor:"#fff",flakePosition:"absolute",minSize:1,maxSize:2,minSpeed:1,maxSpeed:5,round:!1,shadow:!1,collection:!1,collectionHeight:20,deviceorientation:!0}:{flakeCount:35,flakeColor:"#fff",flakePosition:"absolute",minSize:5,maxSize:8,minSpeed:1,maxSpeed:5,round:!0,shadow:!0,collection:".btn",collectionHeight:20,deviceorientation:!0},$(document).snowfall(a)}},SeasonalWaiter.prototype.shake_off_snow=function(a){for(var b=a.target,c=b.getBoundingClientRect(),d=document.querySelectorAll("canvas.snowfall-canvas"),e=null,f=function(){h.clearRect(0,0,e.width,e.height),$(this).fadeIn()},g=0;g6e4&&this.app.silent_bake()};var main=function(){var a=["To Base64","From Base64","To Hex","From Hex","To Hexdump","From Hexdump","URL Decode","Regular expression","Entropy","Fork"],b={update_url:!0,show_highlighter:!0,treat_as_utf8:!0,word_wrap:!0,show_errors:!0,error_timeout:4e3,auto_bake_threshold:200,attempt_highlight:!0,snow:!1};document.removeEventListener("DOMContentLoaded",main,!1),window.app=new HTMLApp(Categories,OperationConfig,a,b),window.app.setup()};window.console=console||{log:function(){},error:function(){}},window.compile_time=moment.tz("Fri Dec 23 2016 14:35:21","ddd MMM D YYYY HH:mm:ss","UTC").valueOf(),window.compile_message="Merry Christmas! Have a look in the options panel for some festive flavour.",document.addEventListener("DOMContentLoaded",main,!1); \ No newline at end of file diff --git a/build/prod/index.html b/build/prod/index.html index 7aea87fa..5aee76d7 100755 --- a/build/prod/index.html +++ b/build/prod/index.html @@ -18,4 +18,4 @@ See the License for the specific language governing permissions and limitations under the License. --> -CyberChef Edit
                                                              Operations
                                                                Recipe
                                                                  Input
                                                                  Output
                                                                  \ No newline at end of file +CyberChef Edit
                                                                  Operations
                                                                    Recipe
                                                                      Input
                                                                      Output
                                                                      \ No newline at end of file diff --git a/build/prod/scripts.js b/build/prod/scripts.js index 7c89770a..ee5893f7 100755 --- a/build/prod/scripts.js +++ b/build/prod/scripts.js @@ -269,9 +269,9 @@ Ob.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value>=1&&c.val SUBS_CIPHERTEXT:"XYZABCDEFGHIJKLMNOPQRSTUVW",run_substitute:function(a,b){var c=Utils.str_to_byte_array(Utils.expand_alph_range(b[0]).join()),d=Utils.str_to_byte_array(Utils.expand_alph_range(b[1]).join()),e=[],f=-1;c.length!==d.length&&(e=Utils.str_to_byte_array("Warning: Plaintext and Ciphertext lengths differ\n\n"));for(var g=0;g-1&&f"+prettyPrintOne(Utils.escape_html(a),c,d)+""},BEAUTIFY_INDENT:"\\t",run_xml_beautify:function(a,b){var c=b[0];return vkbeautify.xml(a,c)},run_json_beautify:function(a,b){var c=b[0];return a?vkbeautify.json(a,c):""},run_css_beautify:function(a,b){var c=b[0];return vkbeautify.css(a,c)},run_sql_beautify:function(a,b){var c=b[0];return vkbeautify.sql(a,c)},PRESERVE_COMMENTS:!1,run_xml_minify:function(a,b){var c=b[0];return vkbeautify.xmlmin(a,c)},run_json_minify:function(a,b){return a?vkbeautify.jsonmin(a):""},run_css_minify:function(a,b){var c=b[0];return vkbeautify.cssmin(a,c)},run_sql_minify:function(a,b){return vkbeautify.sqlmin(a)},run_generic_beautify:function(a,b){function c(a,b,c){return g[c]=b[0],a.substring(0,b.index)+"###preserved_token"+c+"###"+a.substring(b.index+b[0].length)}for(var d,e=a,f=0,g=[],h=/'([^'\\]|\\.)*'/g;d=h.exec(e);)e=c(e,d,f++),h.lastIndex=d.index;for(var i=/"([^"\\]|\\.)*"/g;d=i.exec(e);)e=c(e,d,f++),i.lastIndex=d.index;for(var j=/\/\/[^\n\r]*/g;d=j.exec(e);)e=c(e,d,f++),j.lastIndex=d.index;for(var k=/\/\*[\s\S]*?\*\//gm;d=k.exec(e);)e=c(e,d,f++),k.lastIndex=d.index;for(var l=/(^|\n)#[^\n\r#]+/g;d=l.exec(e);)e=c(e,d,f++),l.lastIndex=d.index;for(var m=/\/.*?[^\\]\/[gim]{0,3}/gi;d=m.exec(e);)e=c(e,d,f++),m.lastIndex=d.index;e=e.replace(/;/g,";\n"),e=e.replace(/{/g,"{\n"),e=e.replace(/}/g,"\n}\n"),e=e.replace(/\r/g,""),e=e.replace(/^\s+/g,""),e=e.replace(/\n\s+/g,"\n"),e=e.replace(/\s*$/g,""),e=e.replace(/\n{/g,"{");for(var n=0,o=0;n=e.length)break;"}"===e[n+1]&&o--;var p=o>=0?Array(4*o+1).join(" "):"";e=e.substring(0,n+1)+p+e.substring(n+1),o>0&&(n+=4*o)}n++}e=e.replace(/\s*([!<>=+-\/*]?)=\s*/g," $1= "),e=e.replace(/\s*<([=]?)\s*/g," <$1 "),e=e.replace(/\s*>([=]?)\s*/g," >$1 "),e=e.replace(/([^+])\+([^+=])/g,"$1 + $2"),e=e.replace(/([^-])-([^-=])/g,"$1 - $2"),e=e.replace(/([^*])\*([^*=])/g,"$1 * $2"),e=e.replace(/([^\/])\/([^\/=])/g,"$1 / $2"),e=e.replace(/\s*,\s*/g,", "),e=e.replace(/\s*{/g," {"),e=e.replace(/}\n/g,"}\n\n"),e=e.replace(/(if|for|while|with|elif|elseif)\s*\(([^\n]*)\)\s*\n([^{])/gim,"$1 ($2)\n $3"),e=e.replace(/(if|for|while|with|elif|elseif)\s*\(([^\n]*)\)([^{])/gim,"$1 ($2) $3"),e=e.replace(/else\s*\n([^{])/gim,"else\n $1"),e=e.replace(/else\s+([^{])/gim,"else $1"),e=e.replace(/\s+;/g,";"),e=e.replace(/\{\s+\}/g,"{}"),e=e.replace(/\[\s+\]/g,"[]"),e=e.replace(/}\s*(else|catch|except|finally|elif|elseif|else if)/gi,"} $1");for(var q=/###preserved_token(\d+)###/g;d=q.exec(e);){var r=parseInt(d[1],10);e=e.substring(0,d.index)+g[r]+e.substring(d.index+d[0].length),q.lastIndex=d.index}return e},XPATH_INITIAL:"",XPATH_DELIMITER:"\\n",run_xpath:function(a,b){const c=b[0],d=b[1];var e;try{e=$.parseXML(a)}catch(a){return"Invalid input XML."}var f;try{f=xpath.evaluate(e,c)}catch(a){return"Invalid XPath. Details:\n"+a.message}const g=new XMLSerializer,h=function(a){switch(a.nodeType){case Node.ELEMENT_NODE:return g.serializeToString(a);case Node.ATTRIBUTE_NODE:return a.value;case Node.COMMENT_NODE:return a.data;case Node.DOCUMENT_NODE:return g.serializeToString(a);default:throw new Error("Unknown Node Type: "+a.nodeType)}};return Object.keys(f).map(function(a){return f[a]}).slice(0,-1).map(h).join(d)},CSS_SELECTOR_INITIAL:"",CSS_QUERY_DELIMITER:"\\n",run_css_query:function(a,b){const c=b[0],d=b[1];var e;try{e=$.parseHTML(a)}catch(a){return"Invalid input HTML."}var f;try{f=$(e).find(c)}catch(a){return"Invalid CSS Selector. Details:\n"+a.message}const g=function(a){switch(a.nodeType){case Node.ELEMENT_NODE:return a.outerHTML;case Node.ATTRIBUTE_NODE:return a.value;case Node.COMMENT_NODE:return a.data;case Node.TEXT_NODE:return a.wholeText;case Node.DOCUMENT_NODE:return a.outerHTML;default:throw new Error("Unknown Node Type: "+a.nodeType)}};return Array.apply(null,Array(f.length)).map(function(a,b){return f[b]}).map(g).join(d)}},Compress={COMPRESSION_TYPE:["Dynamic Huffman Coding","Fixed Huffman Coding","None (Store)"],INFLATE_BUFFER_TYPE:["Adaptive","Block"],COMPRESSION_METHOD:["Deflate","None (Store)"],OS:["MSDOS","Unix","Macintosh"],RAW_COMPRESSION_TYPE_LOOKUP:{"Fixed Huffman Coding":Zlib.RawDeflate.CompressionType.FIXED,"Dynamic Huffman Coding":Zlib.RawDeflate.CompressionType.DYNAMIC,"None (Store)":Zlib.RawDeflate.CompressionType.NONE},run_raw_deflate:function(a,b){var c=new Zlib.RawDeflate(a,{compressionType:Compress.RAW_COMPRESSION_TYPE_LOOKUP[b[0]]});return Array.prototype.slice.call(c.compress())},INFLATE_INDEX:0,INFLATE_BUFFER_SIZE:0,INFLATE_RESIZE:!1,INFLATE_VERIFY:!1,RAW_BUFFER_TYPE_LOOKUP:{Adaptive:Zlib.RawInflate.BufferType.ADAPTIVE,Block:Zlib.RawInflate.BufferType.BLOCK},run_raw_inflate:function(a,b){a=Utils.str_to_byte_array(Utils.byte_array_to_utf8(a));var c=new Zlib.RawInflate(a,{index:b[0],bufferSize:b[1],bufferType:Compress.RAW_BUFFER_TYPE_LOOKUP[b[2]],resize:b[3],verify:b[4]}),d=Array.prototype.slice.call(c.decompress());if(d.length>158&&93===d[0]&&93===d[5]){for(var e=!1,f=0;f<155;f+=5)93!==d[f]&&(e=!0);if(!e)throw"Error: Unable to inflate data"}return d},ZLIB_COMPRESSION_TYPE_LOOKUP:{"Fixed Huffman Coding":Zlib.Deflate.CompressionType.FIXED,"Dynamic Huffman Coding":Zlib.Deflate.CompressionType.DYNAMIC,"None (Store)":Zlib.Deflate.CompressionType.NONE},run_zlib_deflate:function(a,b){var c=new Zlib.Deflate(a,{compressionType:Compress.ZLIB_COMPRESSION_TYPE_LOOKUP[b[0]]});return Array.prototype.slice.call(c.compress())},ZLIB_BUFFER_TYPE_LOOKUP:{Adaptive:Zlib.Inflate.BufferType.ADAPTIVE,Block:Zlib.Inflate.BufferType.BLOCK},run_zlib_inflate:function(a,b){a=Utils.str_to_byte_array(Utils.byte_array_to_utf8(a));var c=new Zlib.Inflate(a,{index:b[0],bufferSize:b[1],bufferType:Compress.ZLIB_BUFFER_TYPE_LOOKUP[b[2]],resize:b[3],verify:b[4]});return Array.prototype.slice.call(c.decompress())},GZIP_CHECKSUM:!1,run_gzip:function(a,b){var c=b[1],d=b[2],e={deflateOptions:{compressionType:Compress.ZLIB_COMPRESSION_TYPE_LOOKUP[b[0]]},flags:{fhcrc:b[3]}};c.length&&(e.flags.fname=!0,e.filename=c),d.length&&(e.flags.fcommenct=!0,e.comment=d);var f=new Zlib.Gzip(a,e);return Array.prototype.slice.call(f.compress())},run_gunzip:function(a,b){a=Utils.str_to_byte_array(Utils.byte_array_to_utf8(a));var c=new Zlib.Gunzip(a);return Array.prototype.slice.call(c.decompress())},PKZIP_FILENAME:"file.txt",ZIP_COMPRESSION_METHOD_LOOKUP:{Deflate:Zlib.Zip.CompressionMethod.DEFLATE,"None (Store)":Zlib.Zip.CompressionMethod.STORE},ZIP_OS_LOOKUP:{MSDOS:Zlib.Zip.OperatingSystem.MSDOS,Unix:Zlib.Zip.OperatingSystem.UNIX,Macintosh:Zlib.Zip.OperatingSystem.MACINTOSH},run_pkzip:function(a,b){var c=Utils.str_to_byte_array(b[2]),d={filename:Utils.str_to_byte_array(b[0]),comment:Utils.str_to_byte_array(b[1]),compressionMethod:Compress.ZIP_COMPRESSION_METHOD_LOOKUP[b[3]],os:Compress.ZIP_OS_LOOKUP[b[4]],deflateOption:{compressionType:Compress.ZLIB_COMPRESSION_TYPE_LOOKUP[b[5]]}},e=new Zlib.Zip;return c.length&&e.setPassword(c),e.addFile(a,d),Array.prototype.slice.call(e.compress())},PKUNZIP_VERIFY:!1,run_pkunzip:function(a,b){var c={password:Utils.str_to_byte_array(b[0]),verify:b[1]},d="",e=new Zlib.Unzip(a,c),f=e.getFilenames(),g="
                                                                      "+f.length+" file(s) found
                                                                      \n";g+="
                                                                      ",window.uzip=e;for(var h=0;h
                                                                      "+Utils.escape_html(d)+"
                                                                      ";return g+"
                                                                      "},run_bzip2_decompress:function(a,b){var c,d=new Uint8Array(a),e="";return c=bzip2.array(d),e=bzip2.simple(c)}},Convert={DISTANCE_UNITS:["[Metric]","Nanometres (nm)","Micrometres (\xb5m)","Millimetres (mm)","Centimetres (cm)","Metres (m)","Kilometers (km)","[/Metric]","[Imperial]","Thou (th)","Inches (in)","Feet (ft)","Yards (yd)","Chains (ch)","Furlongs (fur)","Miles (mi)","Leagues (lea)","[/Imperial]","[Maritime]","Fathoms (ftm)","Cables","Nautical miles","[/Maritime]","[Comparisons]","Cars (4m)","Buses (8.4m)","American football fields (91m)","Football pitches (105m)","[/Comparisons]","[Astronomical]","Earth-to-Moons","Earth's equators","Astronomical units (au)","Light-years (ly)","Parsecs (pc)","[/Astronomical]"],DISTANCE_FACTOR:{"Nanometres (nm)":1e-9,"Micrometres (\xb5m)":1e-6,"Millimetres (mm)":.001,"Centimetres (cm)":.01,"Metres (m)":1,"Kilometers (km)":1e3,"Thou (th)":254e-7,"Inches (in)":.0254,"Feet (ft)":.3048,"Yards (yd)":.9144,"Chains (ch)":20.1168,"Furlongs (fur)":201.168,"Miles (mi)":1609.344,"Leagues (lea)":4828.032,"Fathoms (ftm)":1.853184,Cables:185.3184,"Nautical miles":1853.184,"Cars (4m)":4,"Buses (8.4m)":8.4,"American football fields (91m)":91,"Football pitches (105m)":105,"Earth-to-Moons":38e7,"Earth's equators":40075016.686,"Astronomical units (au)":149597870700,"Light-years (ly)":9460730472580800,"Parsecs (pc)":30856776e9},run_distance:function(a,b){var c=b[0],d=b[1];return a*=Convert.DISTANCE_FACTOR[c],a/Convert.DISTANCE_FACTOR[d]},DATA_UNITS:["Bits (b)","Nibbles","Octets","Bytes (B)","[Binary bits (2^n)]","Kibibits (Kib)","Mebibits (Mib)","Gibibits (Gib)","Tebibits (Tib)","Pebibits (Pib)","Exbibits (Eib)","Zebibits (Zib)","Yobibits (Yib)","[/Binary bits (2^n)]","[Decimal bits (10^n)]","Decabits","Hectobits","Kilobits (kb)","Megabits (Mb)","Gigabits (Gb)","Terabits (Tb)","Petabits (Pb)","Exabits (Eb)","Zettabits (Zb)","Yottabits (Yb)","[/Decimal bits (10^n)]","[Binary bytes (8 x 2^n)]","Kibibytes (KiB)","Mebibytes (MiB)","Gibibytes (GiB)","Tebibytes (TiB)","Pebibytes (PiB)","Exbibytes (EiB)","Zebibytes (ZiB)","Yobibytes (YiB)","[/Binary bytes (8 x 2^n)]","[Decimal bytes (8 x 10^n)]","Kilobytes (KB)","Megabytes (MB)","Gigabytes (GB)","Terabytes (TB)","Petabytes (PB)","Exabytes (EB)","Zettabytes (ZB)","Yottabytes (YB)","[/Decimal bytes (8 x 10^n)]"],DATA_FACTOR:{"Bits (b)":1,Nibbles:4,Octets:8,"Bytes (B)":8,"Kibibits (Kib)":1024,"Mebibits (Mib)":1048576,"Gibibits (Gib)":1073741824,"Tebibits (Tib)":1099511627776,"Pebibits (Pib)":0x4000000000000,"Exbibits (Eib)":0x1000000000000000,"Zebibits (Zib)":0x400000000000000000,"Yobibits (Yib)":1.2089258196146292e24,Decabits:10,Hectobits:100,"Kilobits (Kb)":1e3,"Megabits (Mb)":1e6,"Gigabits (Gb)":1e9,"Terabits (Tb)":1e12,"Petabits (Pb)":1e15,"Exabits (Eb)":1e18,"Zettabits (Zb)":1e21,"Yottabits (Yb)":1e24,"Kibibytes (KiB)":8192,"Mebibytes (MiB)":8388608,"Gibibytes (GiB)":8589934592,"Tebibytes (TiB)":8796093022208,"Pebibytes (PiB)":9007199254740992,"Exbibytes (EiB)":0x8000000000000000,"Zebibytes (ZiB)":9.44473296573929e21,"Yobibytes (YiB)":9.671406556917033e24,"Kilobytes (KB)":8e3,"Megabytes (MB)":8e6,"Gigabytes (GB)":8e9,"Terabytes (TB)":8e12,"Petabytes (PB)":8e15,"Exabytes (EB)":8e18,"Zettabytes (ZB)":8e21,"Yottabytes (YB)":8e24},run_data_size:function(a,b){var c=b[0],d=b[1];return a*=Convert.DATA_FACTOR[c],a/Convert.DATA_FACTOR[d]},AREA_UNITS:["[Metric]","Square metre (sq m)","Square kilometre (sq km)","Centiare (ca)","Deciare (da)","Are (a)","Decare (daa)","Hectare (ha)","[/Metric]","[Imperial]","Square inch (sq in)","Square foot (sq ft)","Square yard (sq yd)","Square mile (sq mi)","Perch (sq per)","Rood (ro)","International acre (ac)","[/Imperial]","[US customary units]","US survey acre (ac)","US survey square mile (sq mi)","US survey township","[/US customary units]","[Nuclear physics]","Yoctobarn (yb)","Zeptobarn (zb)","Attobarn (ab)","Femtobarn (fb)","Picobarn (pb)","Nanobarn (nb)","Microbarn (\u03bcb)","Millibarn (mb)","Barn (b)","Kilobarn (kb)","Megabarn (Mb)","Outhouse","Shed","Planck area","[/Nuclear physics]","[Comparisons]","Washington D.C.","Isle of Wight","Wales","Texas","[/Comparisons]"],AREA_FACTOR:{"Square metre (sq m)":1,"Square kilometre (sq km)":1e6,"Centiare (ca)":1,"Deciare (da)":10,"Are (a)":100,"Decare (daa)":1e3,"Hectare (ha)":1e4,"Square inch (sq in)":64516e-8,"Square foot (sq ft)":.09290304,"Square yard (sq yd)":.83612736,"Square mile (sq mi)":2589988.110336,"Perch (sq per)":42.21,"Rood (ro)":1011,"International acre (ac)":4046.8564224,"US survey acre (ac)":4046.87261,"US survey square mile (sq mi)":2589998.470305239,"US survey township":93239944.9309886,"Yoctobarn (yb)":1e-52,"Zeptobarn (zb)":1e-49,"Attobarn (ab)":1e-46,"Femtobarn (fb)":1e-43,"Picobarn (pb)":1e-40,"Nanobarn (nb)":1e-37,"Microbarn (\u03bcb)":1e-34,"Millibarn (mb)":1e-31,"Barn (b)":1e-28,"Kilobarn (kb)":1e-25,"Megabarn (Mb)":1e-22,"Planck area":2.6e-70,Shed:1e-52,Outhouse:1e-34,"Washington D.C.":176119191.502848,"Isle of Wight":38e7,Wales:20779e6,Texas:696241e6},run_area:function(a,b){var c=b[0],d=b[1];return a*=Convert.AREA_FACTOR[c],a/Convert.AREA_FACTOR[d]},MASS_UNITS:["[Metric]","Yoctogram (yg)","Zeptogram (zg)","Attogram (ag)","Femtogram (fg)","Picogram (pg)","Nanogram (ng)","Microgram (\u03bcg)","Milligram (mg)","Centigram (cg)","Decigram (dg)","Gram (g)","Decagram (dag)","Hectogram (hg)","Kilogram (kg)","Megagram (Mg)","Tonne (t)","Gigagram (Gg)","Teragram (Tg)","Petagram (Pg)","Exagram (Eg)","Zettagram (Zg)","Yottagram (Yg)","[/Metric]","[Imperial Avoirdupois]","Grain (gr)","Dram (dr)","Ounce (oz)","Pound (lb)","Nail","Stone (st)","Quarter (gr)","Tod","US hundredweight (cwt)","Imperial hundredweight (cwt)","US ton (t)","Imperial ton (t)","[/Imperial Avoirdupois]","[Imperial Troy]","Grain (gr)","Pennyweight (dwt)","Troy dram (dr t)","Troy ounce (oz t)","Troy pound (lb t)","Mark","[/Imperial Troy]","[Archaic]","Wey","Wool wey","Suffolk wey","Wool sack","Coal sack","Load","Last","Flax or feather last","Gunpowder last","Picul","Rice last","[/Archaic]","[Comparisons]","Big Ben (14 tonnes)","Blue whale (180 tonnes)","International Space Station (417 tonnes)","Space Shuttle (2,041 tonnes)","RMS Titanic (52,000 tonnes)","Great Pyramid of Giza (6,000,000 tonnes)","Earth's oceans (1.4 yottagrams)","[/Comparisons]","[Astronomical]","A teaspoon of neutron star (5,500 million tonnes)","Lunar mass (ML)","Earth mass (M\u2295)","Jupiter mass (MJ)","Solar mass (M\u2609)","Sagittarius A* (7.5 x 10^36 kgs-ish)","Milky Way galaxy (1.2 x 10^42 kgs)","The observable universe (1.45 x 10^53 kgs)","[/Astronomical]"],MASS_FACTOR:{"Yoctogram (yg)":1e-24,"Zeptogram (zg)":1e-21,"Attogram (ag)":1e-18,"Femtogram (fg)":1e-15,"Picogram (pg)":1e-12,"Nanogram (ng)":1e-9,"Microgram (\u03bcg)":1e-6,"Milligram (mg)":.001,"Centigram (cg)":.01,"Decigram (dg)":.1,"Gram (g)":1,"Decagram (dag)":10,"Hectogram (hg)":100,"Kilogram (kg)":1e3,"Megagram (Mg)":1e6,"Tonne (t)":1e6,"Gigagram (Gg)":1e9,"Teragram (Tg)":1e12,"Petagram (Pg)":1e15,"Exagram (Eg)":1e18,"Zettagram (Zg)":1e21,"Yottagram (Yg)":1e24,"Grain (gr)":.06479891,"Dram (dr)":1.7718451953125,"Ounce (oz)":28.349523125,"Pound (lb)":453.59237,Nail:3175.14659,"Stone (st)":6350.29318,"Quarter (gr)":12700.58636,Tod:12700.58636,"US hundredweight (cwt)":45359.237,"Imperial hundredweight (cwt)":50802.34544,"US ton (t)":907184.74,"Imperial ton (t)":1016046.9088,"Pennyweight (dwt)":1.55517384,"Troy dram (dr t)":3.8879346,"Troy ounce (oz t)":31.1034768,"Troy pound (lb t)":373.2417216,Mark:248.8278144,Wey:76500,"Wool wey":101700,"Suffolk wey":161500,"Wool sack":153e3,"Coal sack":50802.34544,Load:918e3,Last:1836e3,"Flax or feather last":77e4,"Gunpowder last":109e4,Picul:60478.982,"Rice last":12e5,"Big Ben (14 tonnes)":14e6,"Blue whale (180 tonnes)":18e7,"International Space Station (417 tonnes)":417e6,"Space Shuttle (2,041 tonnes)":2041e6,"RMS Titanic (52,000 tonnes)":52e9,"Great Pyramid of Giza (6,000,000 tonnes)":6e12,"Earth's oceans (1.4 yottagrams)":1.4e24,"A teaspoon of neutron star (5,500 million tonnes)":55e14,"Lunar mass (ML)":7.342e25,"Earth mass (M\u2295)":5.97219e27,"Jupiter mass (MJ)":1.8981411476999997e30,"Solar mass (M\u2609)":1.98855e33,"Sagittarius A* (7.5 x 10^36 kgs-ish)":7.5e39,"Milky Way galaxy (1.2 x 10^42 kgs)":1.2e45,"The observable universe (1.45 x 10^53 kgs)":1.45e56},run_mass:function(a,b){var c=b[0],d=b[1];return a*=Convert.MASS_FACTOR[c],a/Convert.MASS_FACTOR[d]},SPEED_UNITS:["[Metric]","Metres per second (m/s)","Kilometres per hour (km/h)","[/Metric]","[Imperial]","Miles per hour (mph)","Knots (kn)","[/Imperial]","[Comparisons]","Human hair growth rate","Bamboo growth rate","World's fastest snail","Usain Bolt's top speed","Jet airliner cruising speed","Concorde","SR-71 Blackbird","Space Shuttle","International Space Station","[/Comparisons]","[Scientific]","Sound in standard atmosphere","Sound in water","Lunar escape velocity","Earth escape velocity","Earth's solar orbit","Solar system's Milky Way orbit","Milky Way relative to the cosmic microwave background","Solar escape velocity","Neutron star escape velocity (0.3c)","Light in a diamond (0.4136c)","Signal in an optical fibre (0.667c)","Light (c)","[/Scientific]"],SPEED_FACTOR:{"Metres per second (m/s)":1,"Kilometres per hour (km/h)":.2778,"Miles per hour (mph)":.44704,"Knots (kn)":.5144,"Human hair growth rate":4.8e-9,"Bamboo growth rate":14e-6,"World's fastest snail":.00275,"Usain Bolt's top speed":12.42,"Jet airliner cruising speed":250,Concorde:603,"SR-71 Blackbird":981,"Space Shuttle":1400,"International Space Station":7700,"Sound in standard atmosphere":340.3,"Sound in water":1500,"Lunar escape velocity":2375,"Earth escape velocity":11200,"Earth's solar orbit":29800,"Solar system's Milky Way orbit":2e5,"Milky Way relative to the cosmic microwave background":552e3,"Solar escape velocity":617700,"Neutron star escape velocity (0.3c)":1e8,"Light in a diamond (0.4136c)":124e6,"Signal in an optical fibre (0.667c)":2e8,"Light (c)":299792458},run_speed:function(a,b){var c=b[0],d=b[1];return a*=Convert.SPEED_FACTOR[c],a/Convert.SPEED_FACTOR[d]}},DateTime={UNITS:["Seconds (s)","Milliseconds (ms)","Microseconds (\u03bcs)","Nanoseconds (ns)"],run_from_unix_timestamp:function(a,b){var c,d=b[0];if(a=parseFloat(a),"Seconds (s)"===d)return c=moment.unix(a),c.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss")+" UTC";if("Milliseconds (ms)"===d)return c=moment(a),c.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss.SSS")+" UTC";if("Microseconds (\u03bcs)"===d)return c=moment(a/1e3),c.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss.SSS")+" UTC";if("Nanoseconds (ns)"===d)return c=moment(a/1e6),c.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss.SSS")+" UTC";throw"Unrecognised unit"},run_to_unix_timestamp:function(a,b){var c=b[0],d=moment(a);if("Seconds (s)"===c)return d.unix();if("Milliseconds (ms)"===c)return d.valueOf();if("Microseconds (\u03bcs)"===c)return 1e3*d.valueOf();if("Nanoseconds (ns)"===c)return 1e6*d.valueOf();throw"Unrecognised unit"},DATETIME_FORMATS:[{name:"Standard date and time",value:"DD/MM/YYYY HH:mm:ss"},{name:"American-style date and time",value:"MM/DD/YYYY HH:mm:ss"},{name:"International date and time",value:"YYYY-MM-DD HH:mm:ss"},{name:"Verbose date and time",value:"dddd Do MMMM YYYY HH:mm:ss Z z"},{name:"UNIX timestamp (seconds)",value:"X"},{name:"UNIX timestamp offset (milliseconds)",value:"x"},{name:"Automatic",value:""}],INPUT_FORMAT_STRING:"DD/MM/YYYY HH:mm:ss",OUTPUT_FORMAT_STRING:"dddd Do MMMM YYYY HH:mm:ss Z z",TIMEZONES:["UTC"].concat(moment.tz.names()),run_translate_format:function(a,b){var c,d=b[1],e=b[2],f=b[3],g=b[4];try{if(c=moment.tz(a,d,e),!c||"Invalid date"===c.format())throw Error}catch(a){return"Invalid format.\n\n"+DateTime.FORMAT_EXAMPLES}return c.tz(g).format(f)},run_parse:function(a,b){var c,d=b[1],e=b[2],f="";try{if(c=moment.tz(a,d,e),!c||"Invalid date"===c.format())throw Error}catch(a){return"Invalid format.\n\n"+DateTime.FORMAT_EXAMPLES}return f+="Date: "+c.format("dddd Do MMMM YYYY")+"\nTime: "+c.format("HH:mm:ss")+"\nPeriod: "+c.format("A")+"\nTimezone: "+c.format("z")+"\nUTC offset: "+c.format("ZZ")+"\n\nDaylight Saving Time: "+c.isDST()+"\nLeap year: "+c.isLeapYear()+"\nDays in this month: "+c.daysInMonth()+"\n\nDay of year: "+c.dayOfYear()+"\nWeek number: "+c.weekYear()+"\nQuarter: "+c.quarter()},FORMAT_EXAMPLES:"Format string tokens:\n\n
                                                                      Category Token Output
                                                                      Month M 1 2 ... 11 12
                                                                      Mo 1st 2nd ... 11th 12th
                                                                      MM 01 02 ... 11 12
                                                                      MMM Jan Feb ... Nov Dec
                                                                      MMMM January February ... November December
                                                                      Quarter Q 1 2 3 4
                                                                      Day of Month D 1 2 ... 30 31
                                                                      Do 1st 2nd ... 30th 31st
                                                                      DD 01 02 ... 30 31
                                                                      Day of Year DDD 1 2 ... 364 365
                                                                      DDDo 1st 2nd ... 364th 365th
                                                                      DDDD 001 002 ... 364 365
                                                                      Day of Week d 0 1 ... 5 6
                                                                      do 0th 1st ... 5th 6th
                                                                      dd Su Mo ... Fr Sa
                                                                      ddd Sun Mon ... Fri Sat
                                                                      dddd Sunday Monday ... Friday Saturday
                                                                      Day of Week (Locale) e 0 1 ... 5 6
                                                                      Day of Week (ISO) E 1 2 ... 6 7
                                                                      Week of Year w 1 2 ... 52 53
                                                                      wo 1st 2nd ... 52nd 53rd
                                                                      ww 01 02 ... 52 53
                                                                      Week of Year (ISO) W 1 2 ... 52 53
                                                                      Wo 1st 2nd ... 52nd 53rd
                                                                      WW 01 02 ... 52 53
                                                                      Year YY 70 71 ... 29 30
                                                                      YYYY 1970 1971 ... 2029 2030
                                                                      Week Year gg 70 71 ... 29 30
                                                                      gggg 1970 1971 ... 2029 2030
                                                                      Week Year (ISO) GG 70 71 ... 29 30
                                                                      GGGG 1970 1971 ... 2029 2030
                                                                      AM/PM A AM PM
                                                                      a am pm
                                                                      Hour H 0 1 ... 22 23
                                                                      HH 00 01 ... 22 23
                                                                      h 1 2 ... 11 12
                                                                      hh 01 02 ... 11 12
                                                                      Minute m 0 1 ... 58 59
                                                                      mm 00 01 ... 58 59
                                                                      Second s 0 1 ... 58 59
                                                                      ss 00 01 ... 58 59
                                                                      Fractional Second S 0 1 ... 8 9
                                                                      SS 00 01 ... 98 99
                                                                      SSS 000 001 ... 998 999
                                                                      SSSS ... SSSSSSSSS 000[0..] 001[0..] ... 998[0..] 999[0..]
                                                                      Timezone z or zz EST CST ... MST PST
                                                                      Z -07:00 -06:00 ... +06:00 +07:00
                                                                      ZZ -0700 -0600 ... +0600 +0700
                                                                      Unix Timestamp X 1360013296
                                                                      Unix Millisecond Timestamp x 1360013296123
                                                                      "},Endian={DATA_FORMAT:["Hex","Raw"],WORD_LENGTH:4,PAD_INCOMPLETE_WORDS:!0,run_swap_endianness:function(a,b){var c=b[0],d=b[1],e=b[2],f=[],g=[],h=[],i=0,j=0;if(d<=0)return"Word length must be greater than 0";switch(c){case"Hex":f=Utils.from_hex(a);break;case"Raw":f=Utils.str_to_byte_array(a);break;default:f=a}for(i=0;i
                                                                      \n- 0 represents no randomness (i.e. all the bytes in the data have the same value) whereas 8, the maximum, represents a completely random string.\n- Standard English text usually falls somewhere between 3.5 and 5.\n- Properly encrypted or compressed data of a reasonable length should have an entropy of over 7.5.\n\nThe following results show the entropy of chunks of the input data. Chunks with particularly high entropy could suggest encrypted or compressed sections.\n\n
                                                                      Operations
                                                                        Recipe
                                                                          Input
                                                                          Output
                                                                          Operations
                                                                            Recipe
                                                                              Input
                                                                              Output
                                                                              \ No newline at end of file +document.querySelector("link[rel=icon]").setAttribute("href","data:image/png;base64,"+a),document.querySelector("#bake img").setAttribute("src","data:image/png;base64,"+b),document.querySelector(".about-img-left").setAttribute("src","data:image/png;base64,"+c)},SeasonalWaiter.prototype.insert_spider_text=function(){document.title=document.title.replace(/Cyber/g,"Spider"),SeasonalWaiter.tree_walk(document.body,function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Cyber/g,"Spider"))},!0),SeasonalWaiter.tree_walk(document.getElementById("bake-group"),function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Bake/g,"Spin"))},!0),document.querySelector("#recipe .title").innerHTML="Web"},SeasonalWaiter.prototype.create_snow_option=function(){var a=document.getElementById("options-body"),b=document.createElement("div");b.className="option-item",b.innerHTML=" Let it snow",a.appendChild(b),this.manager.options.load()},SeasonalWaiter.prototype.let_it_snow=function(){if($(document).snowfall("clear"),this.app.options.snow){var a={},b=navigator.userAgent.match(/Firefox\/(\d\d?)/);a=b&&parseInt(b[1],10)<30?{flakeCount:10,flakeColor:"#fff",flakePosition:"absolute",minSize:1,maxSize:2,minSpeed:1,maxSpeed:5,round:!1,shadow:!1,collection:!1,collectionHeight:20,deviceorientation:!0}:{flakeCount:35,flakeColor:"#fff",flakePosition:"absolute",minSize:5,maxSize:8,minSpeed:1,maxSpeed:5,round:!0,shadow:!0,collection:".btn",collectionHeight:20,deviceorientation:!0},$(document).snowfall(a)}},SeasonalWaiter.prototype.shake_off_snow=function(a){for(var b=a.target,c=b.getBoundingClientRect(),d=document.querySelectorAll("canvas.snowfall-canvas"),e=null,f=function(){h.clearRect(0,0,e.width,e.height),$(this).fadeIn()},g=0;g6e4&&this.app.silent_bake()};var main=function(){var a=["To Base64","From Base64","To Hex","From Hex","To Hexdump","From Hexdump","URL Decode","Regular expression","Entropy","Fork"],b={update_url:!0,show_highlighter:!0,treat_as_utf8:!0,word_wrap:!0,show_errors:!0,error_timeout:4e3,auto_bake_threshold:200,attempt_highlight:!0,snow:!1};document.removeEventListener("DOMContentLoaded",main,!1),window.app=new HTMLApp(Categories,OperationConfig,a,b),window.app.setup()};window.console=console||{log:function(){},error:function(){}},window.compile_time=moment.tz("Sat Dec 31 2016 17:09:43","ddd MMM D YYYY HH:mm:ss","UTC").valueOf(),window.compile_message="",document.addEventListener("DOMContentLoaded",main,!1); \ No newline at end of file diff --git a/build/prod/index.html b/build/prod/index.html index 5aee76d7..0f4a546a 100755 --- a/build/prod/index.html +++ b/build/prod/index.html @@ -18,4 +18,4 @@ See the License for the specific language governing permissions and limitations under the License. --> -CyberChef Edit
                                                                              Operations
                                                                                Recipe
                                                                                  Input
                                                                                  Output
                                                                                  \ No newline at end of file +CyberChef Edit
                                                                                  Operations
                                                                                    Recipe
                                                                                      Input
                                                                                      Output
                                                                                      \ No newline at end of file diff --git a/build/prod/scripts.js b/build/prod/scripts.js index ee5893f7..f3ad3b43 100755 --- a/build/prod/scripts.js +++ b/build/prod/scripts.js @@ -266,12 +266,12 @@ function(){function a(a){this.code=a,this.message=Vc[a]}function b(b){var c=b.ma if(e)return $c[e].call(d,b,c);throw new a("XPTY0004")},ad.lt=function(b,c,d){var e="";if(Ua(b))Ua(c)&&(e="numeric-less-than");else if(b instanceof Xa)c instanceof Xa&&(e="boolean-less-than");else if(b instanceof ub){if(c instanceof ub)return $c["numeric-less-than"].call(d,Xc.compare.call(d,b,c),new Cb(0))}else b instanceof Ya?c instanceof Ya&&(e="date-less-than"):b instanceof vb?c instanceof vb&&(e="time-less-than"):b instanceof _a?c instanceof _a&&(e="dateTime-less-than"):b instanceof yb?c instanceof yb&&(e="yearMonthDuration-less-than"):b instanceof Ab&&c instanceof Ab&&(e="dayTimeDuration-less-than");if(e)return $c[e].call(d,b,c);throw new a("XPTY0004")},ad.ge=function(b,c,d){var e="";if(Ua(b))Ua(c)&&(e="numeric-less-than");else if(b instanceof Xa)c instanceof Xa&&(e="boolean-less-than");else if(b instanceof ub){if(c instanceof ub)return $c["numeric-greater-than"].call(d,Xc.compare.call(d,b,c),new Cb(-1))}else b instanceof Ya?c instanceof Ya&&(e="date-less-than"):b instanceof vb?c instanceof vb&&(e="time-less-than"):b instanceof _a?c instanceof _a&&(e="dateTime-less-than"):b instanceof yb?c instanceof yb&&(e="yearMonthDuration-less-than"):b instanceof Ab&&c instanceof Ab&&(e="dayTimeDuration-less-than");if(e)return new Xa(!$c[e].call(d,b,c).valueOf());throw new a("XPTY0004")},ad.le=function(b,c,d){var e="";if(Ua(b))Ua(c)&&(e="numeric-greater-than");else if(b instanceof Xa)c instanceof Xa&&(e="boolean-greater-than");else if(b instanceof ub){if(c instanceof ub)return $c["numeric-less-than"].call(d,Xc.compare.call(d,b,c),new Cb(1))}else b instanceof Ya?c instanceof Ya&&(e="date-greater-than"):b instanceof vb?c instanceof vb&&(e="time-greater-than"):b instanceof _a?c instanceof _a&&(e="dateTime-greater-than"):b instanceof yb?c instanceof yb&&(e="yearMonthDuration-greater-than"):b instanceof Ab&&c instanceof Ab&&(e="dayTimeDuration-greater-than");if(e)return new Xa(!$c[e].call(d,b,c).valueOf());throw new a("XPTY0004")};var bd={};bd.is=function(a,b,c){return $c["is-same-node"].call(c,a,b)},bd[">>"]=function(a,b,c){return $c["node-after"].call(c,a,b)},bd["<<"]=function(a,b,c){return $c["node-before"].call(c,a,b)};var cd={"=":z,"!=":z,"<":z,"<=":z,">":z,">=":z,eq:A,ne:A,lt:A,le:A,gt:A,ge:A,is:B,">>":B,"<<":B};C.prototype.left=null,C.prototype.items=null;var dd={};dd["+"]=function(b,c,d){var e="",f=!1;if(Ua(b)?Ua(c)&&(e="numeric-add"):b instanceof Ya?c instanceof yb?e="add-yearMonthDuration-to-date":c instanceof Ab&&(e="add-dayTimeDuration-to-date"):b instanceof yb?c instanceof Ya?(e="add-yearMonthDuration-to-date",f=!0):c instanceof _a?(e="add-yearMonthDuration-to-dateTime",f=!0):c instanceof yb&&(e="add-yearMonthDurations"):b instanceof Ab?c instanceof Ya?(e="add-dayTimeDuration-to-date",f=!0):c instanceof vb?(e="add-dayTimeDuration-to-time",f=!0):c instanceof _a?(e="add-dayTimeDuration-to-dateTime",f=!0):c instanceof Ab&&(e="add-dayTimeDurations"):b instanceof vb?c instanceof Ab&&(e="add-dayTimeDuration-to-time"):b instanceof _a&&(c instanceof yb?e="add-yearMonthDuration-to-dateTime":c instanceof Ab&&(e="add-dayTimeDuration-to-dateTime")),e)return $c[e].call(d,f?c:b,f?b:c);throw new a("XPTY0004")},dd["-"]=function(b,c,d){var e="";if(Ua(b)?Ua(c)&&(e="numeric-subtract"):b instanceof Ya?c instanceof Ya?e="subtract-dates":c instanceof yb?e="subtract-yearMonthDuration-from-date":c instanceof Ab&&(e="subtract-dayTimeDuration-from-date"):b instanceof vb?c instanceof vb?e="subtract-times":c instanceof Ab&&(e="subtract-dayTimeDuration-from-time"):b instanceof _a?c instanceof _a?e="subtract-dateTimes":c instanceof yb?e="subtract-yearMonthDuration-from-dateTime":c instanceof Ab&&(e="subtract-dayTimeDuration-from-dateTime"):b instanceof yb?c instanceof yb&&(e="subtract-yearMonthDurations"):b instanceof Ab&&c instanceof Ab&&(e="subtract-dayTimeDurations"),e)return $c[e].call(d,b,c);throw new a("XPTY0004")},C.prototype.evaluate=function(a){var b=vc(this.left.evaluate(a),a);if(!b.length)return[];ua(a,b,"?");var c=b[0];c instanceof xb&&(c=gb.cast(c));for(var d,e,f=0,g=this.items.length;f1)return[new Xa(!1)];if(!c.length)return[new Xa("?"==e)];try{d.cast(vc(c,b)[0])}catch(b){if("XPST0051"==b.code)throw b;if("XPST0017"==b.code)throw new a("XPST0080");return[new Xa(!1)]}return[new Xa(!0)]},Ha.prototype.expression=null,Ha.prototype.type=null,Ha.prototype.evaluate=function(a){var b=this.expression.evaluate(a);return ua(a,b,this.type.occurence),b.length?[this.type.itemType.cast(vc(b,a)[0],a)]:[]},Ja.prototype.prefix=null,Ja.prototype.localName=null,Ja.prototype.namespaceURI=null,Ja.prototype.test=function(b,c){var d=(this.namespaceURI?"{"+this.namespaceURI+"}":"")+this.localName,e=this.namespaceURI==Rc?Zc[this.localName]:c.staticContext.getDataType(d);if(e)return b instanceof e;throw new a("XPST0051")},Ja.prototype.cast=function(b,c){var d=(this.namespaceURI?"{"+this.namespaceURI+"}":"")+this.localName,e=this.namespaceURI==Rc?Zc[this.localName]:c.staticContext.getDataType(d);if(e)return e.cast(b);throw new a("XPST0051")},La.prototype.test=null,Na.prototype.itemType=null,Na.prototype.occurence=null,Pa.prototype.itemType=null,Pa.prototype.occurence=null,Ra.prototype.builtInKind=j.ANYTYPE_DT,Sa.prototype=new Ra,Sa.prototype.builtInKind=j.ANYSIMPLETYPE_DT,Sa.prototype.primitiveKind=null,Sa.PRIMITIVE_ANYURI="anyURI",Sa.PRIMITIVE_BASE64BINARY="base64Binary",Sa.PRIMITIVE_BOOLEAN="boolean",Sa.PRIMITIVE_DATE="date",Sa.PRIMITIVE_DATETIME="dateTime",Sa.PRIMITIVE_DECIMAL="decimal",Sa.PRIMITIVE_DOUBLE="double",Sa.PRIMITIVE_DURATION="duration",Sa.PRIMITIVE_FLOAT="float",Sa.PRIMITIVE_GDAY="gDay",Sa.PRIMITIVE_GMONTH="gMonth",Sa.PRIMITIVE_GMONTHDAY="gMonthDay",Sa.PRIMITIVE_GYEAR="gYear",Sa.PRIMITIVE_GYEARMONTH="gYearMonth",Sa.PRIMITIVE_HEXBINARY="hexBinary",Sa.PRIMITIVE_NOTATION="NOTATION",Sa.PRIMITIVE_QNAME="QName",Sa.PRIMITIVE_STRING="string",Sa.PRIMITIVE_TIME="time",Ta.prototype=new Sa,Ta.prototype.builtInKind=j.ANYATOMICTYPE_DT,Ta.cast=function(b){throw new a("XPST0017")},g("anyAtomicType",Ta),Va.prototype=new Ta,Va.prototype.builtInKind=j.ANYURI_DT,Va.prototype.primitiveKind=Sa.PRIMITIVE_ANYURI,Va.prototype.scheme=null,Va.prototype.authority=null,Va.prototype.path=null,Va.prototype.query=null,Va.prototype.fragment=null,Va.prototype.toString=function(){return(this.scheme?this.scheme+":":"")+(this.authority?"//"+this.authority:"")+(this.path?this.path:"")+(this.query?"?"+this.query:"")+(this.fragment?"#"+this.fragment:"")};var ld=/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;Va.cast=function(b){if(b instanceof Va)return b;if(b instanceof ub||b instanceof xb){var c;if(c=Pc(b).match(ld))return new Va(c[2],c[4],c[5],c[7],c[9]);throw new a("FORG0001")}throw new a("XPTY0004")},g("anyURI",Va),Wa.prototype=new Ta,Wa.prototype.builtInKind=j.BASE64BINARY_DT,Wa.prototype.primitiveKind=Sa.PRIMITIVE_BASE64BINARY,Wa.prototype.value=null,Wa.prototype.valueOf=function(){return this.value},Wa.prototype.toString=function(){return this.value};var md=/^((([A-Za-z0-9+\/]\s*){4})*(([A-Za-z0-9+\/]\s*){3}[A-Za-z0-9+\/]|([A-Za-z0-9+\/]\s*){2}[AEIMQUYcgkosw048]\s*=|[A-Za-z0-9+\/]\s*[AQgw]\s*=\s*=))?$/;Wa.cast=function(b){if(b instanceof Wa)return b;if(b instanceof ub||b instanceof xb){var c=Pc(b).match(md);if(c)return new Wa(c[0]);throw new a("FORG0001")}if(b instanceof rb){for(var c=b.valueOf().match(/.{2}/g),d=[],e=0,f=c.length;e=-0x8000000000000000)return new Fb(c.value);throw new a("FORG0001")},g("long",Fb),Gb.prototype=new Fb,Gb.prototype.builtInKind=j.INT_DT,Gb.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value<=2147483647&&c.value>=-2147483648)return new Gb(c.value);throw new a("FORG0001")},g("int",Gb),Hb.prototype=new Gb,Hb.prototype.builtInKind=j.SHORT_DT,Hb.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value<=32767&&c.value>=-32768)return new Hb(c.value);throw new a("FORG0001")},g("short",Hb),Ib.prototype=new Hb,Ib.prototype.builtInKind=j.BYTE_DT,Ib.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value<=127&&c.value>=-128)return new Ib(c.value);throw new a("FORG0001")},g("byte",Ib),Jb.prototype=new Cb,Jb.prototype.builtInKind=j.NONNEGATIVEINTEGER_DT,Jb.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value>=0)return new Jb(c.value);throw new a("FORG0001")},g("nonNegativeInteger",Jb),Kb.prototype=new Jb,Kb.prototype.builtInKind=j.POSITIVEINTEGER_DT,Kb.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value>=1)return new Kb(c.value);throw new a("FORG0001")},g("positiveInteger",Kb),Lb.prototype=new Jb,Lb.prototype.builtInKind=j.UNSIGNEDLONG_DT,Lb.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value>=1&&c.value<=0x10000000000000000)return new Lb(c.value);throw new a("FORG0001")},g("unsignedLong",Lb),Mb.prototype=new Jb,Mb.prototype.builtInKind=j.UNSIGNEDINT_DT,Mb.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value>=1&&c.value<=4294967295)return new Mb(c.value);throw new a("FORG0001")},g("unsignedInt",Mb),Nb.prototype=new Mb,Nb.prototype.builtInKind=j.UNSIGNEDSHORT_DT,Nb.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value>=1&&c.value<=65535)return new Nb(c.value);throw new a("FORG0001")},g("unsignedShort",Nb),Ob.prototype=new Nb,Ob.prototype.builtInKind=j.UNSIGNEDBYTE_DT, Ob.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value>=1&&c.value<=255)return new Ob(c.value);throw new a("FORG0001")},g("unsignedByte",Ob),Pb.prototype=new ub,Pb.prototype.builtInKind=j.NORMALIZEDSTRING_DT,Pb.cast=function(a){return new Pb(Ac(a))},g("normalizedString",Pb),Qb.prototype=new Pb,Qb.prototype.builtInKind=j.TOKEN_DT,Qb.cast=function(a){return new Qb(Ac(a))},g("token",Qb),Rb.prototype=new Qb,Rb.prototype.builtInKind=j.NAME_DT,Rb.cast=function(a){return new Rb(Ac(a))},g("Name",Rb),Sb.prototype=new Rb,Sb.prototype.builtInKind=j.NCNAME_DT,Sb.cast=function(a){return new Sb(Ac(a))},g("NCName",Sb),Tb.prototype=new Sb,Tb.prototype.builtInKind=j.ENTITY_DT,Tb.cast=function(a){return new Tb(Ac(a))},g("ENTITY",Tb),Ub.prototype=new Sb,Ub.prototype.builtInKind=j.ID_DT,Ub.cast=function(a){return new Ub(Ac(a))},g("ID",Ub),Vb.prototype=new Sb,Vb.prototype.builtInKind=j.IDREF_DT,Vb.cast=function(a){return new Vb(Ac(a))},g("IDREF",Vb),Wb.prototype=new Qb,Wb.prototype.builtInKind=j.LANGUAGE_DT,Wb.cast=function(a){return new Wb(Ac(a))},g("language",Wb),Xb.prototype=new Qb,Xb.prototype.builtInKind=j.NMTOKEN_DT,Xb.cast=function(a){return new Xb(Ac(a))},g("NMTOKEN",Xb),Zb.prototype=new Yb,$b.prototype=new Zb,_b.prototype=new Zb,ac.prototype=new Zb,bc.prototype=new Zb,cc.prototype=new Zb,dc.prototype=new Zb,$c["hexBinary-equal"]=function(a,b){return new Xa(a.valueOf()==b.valueOf())},$c["base64Binary-equal"]=function(a,b){return new Xa(a.valueOf()==b.valueOf())},$c["boolean-equal"]=function(a,b){return new Xa(a.valueOf()==b.valueOf())},$c["boolean-less-than"]=function(a,b){return new Xa(a.valueOf()b.valueOf())},$c["yearMonthDuration-less-than"]=function(a,b){return new Xa(lc(a)lc(b))},$c["dayTimeDuration-less-than"]=function(a,b){return new Xa(jc(a)jc(b))},$c["duration-equal"]=function(a,b){return new Xa(a.negative==b.negative&&lc(a)==lc(b)&&jc(a)==jc(b))},$c["dateTime-equal"]=function(a,b){return gc(a,b,"eq")},$c["dateTime-less-than"]=function(a,b){return gc(a,b,"lt")},$c["dateTime-greater-than"]=function(a,b){return gc(a,b,"gt")},$c["date-equal"]=function(a,b){return fc(a,b,"eq")},$c["date-less-than"]=function(a,b){return fc(a,b,"lt")},$c["date-greater-than"]=function(a,b){return fc(a,b,"gt")},$c["time-equal"]=function(a,b){return ec(a,b,"eq")},$c["time-less-than"]=function(a,b){return ec(a,b,"lt")},$c["time-greater-than"]=function(a,b){return ec(a,b,"gt")},$c["gYearMonth-equal"]=function(a,b){return gc(new _a(a.year,a.month,Za(a.year,a.month),0,0,0,null==a.timezone?this.timezone:a.timezone),new _a(b.year,b.month,Za(b.year,b.month),0,0,0,null==b.timezone?this.timezone:b.timezone),"eq")},$c["gYear-equal"]=function(a,b){return gc(new _a(a.year,1,1,0,0,0,null==a.timezone?this.timezone:a.timezone),new _a(b.year,1,1,0,0,0,null==b.timezone?this.timezone:b.timezone),"eq")},$c["gMonthDay-equal"]=function(a,b){return gc(new _a(1972,a.month,a.day,0,0,0,null==a.timezone?this.timezone:a.timezone),new _a(1972,b.month,b.day,0,0,0,null==b.timezone?this.timezone:b.timezone),"eq")},$c["gMonth-equal"]=function(a,b){return gc(new _a(1972,a.month,Za(1972,b.month),0,0,0,null==a.timezone?this.timezone:a.timezone),new _a(1972,b.month,Za(1972,b.month),0,0,0,null==b.timezone?this.timezone:b.timezone),"eq")},$c["gDay-equal"]=function(a,b){return gc(new _a(1972,12,a.day,0,0,0,null==a.timezone?this.timezone:a.timezone),new _a(1972,12,b.day,0,0,0,null==b.timezone?this.timezone:b.timezone),"eq")},$c["add-yearMonthDurations"]=function(a,b){return mc(lc(a)+lc(b))},$c["subtract-yearMonthDurations"]=function(a,b){return mc(lc(a)-lc(b))},$c["multiply-yearMonthDuration"]=function(a,b){return mc(lc(a)*b)},$c["divide-yearMonthDuration"]=function(a,b){return mc(lc(a)/b)},$c["divide-yearMonthDuration-by-yearMonthDuration"]=function(a,b){return new fb(lc(a)/lc(b))},$c["add-dayTimeDurations"]=function(a,b){return kc(jc(a)+jc(b))},$c["subtract-dayTimeDurations"]=function(a,b){return kc(jc(a)-jc(b))},$c["multiply-dayTimeDuration"]=function(a,b){return kc(jc(a)*b)},$c["divide-dayTimeDuration"]=function(a,b){return kc(jc(a)/b)},$c["divide-dayTimeDuration-by-dayTimeDuration"]=function(a,b){return new fb(jc(a)/jc(b))},$c["subtract-dateTimes"]=function(a,b){return kc(oc(a)-oc(b))},$c["subtract-dates"]=function(a,b){return kc(oc(a)-oc(b))},$c["subtract-times"]=function(a,b){return kc(nc(a)-nc(b))},$c["add-yearMonthDuration-to-dateTime"]=function(a,b){return hc(a,b,"+")},$c["add-dayTimeDuration-to-dateTime"]=function(a,b){return ic(a,b,"+")},$c["subtract-yearMonthDuration-from-dateTime"]=function(a,b){return hc(a,b,"-")},$c["subtract-dayTimeDuration-from-dateTime"]=function(a,b){return ic(a,b,"-")},$c["add-yearMonthDuration-to-date"]=function(a,b){return hc(a,b,"+")},$c["add-dayTimeDuration-to-date"]=function(a,b){return ic(a,b,"+")},$c["subtract-yearMonthDuration-from-date"]=function(a,b){return hc(a,b,"-")},$c["subtract-dayTimeDuration-from-date"]=function(a,b){return ic(a,b,"-")},$c["add-dayTimeDuration-to-time"]=function(a,b){var c=new vb(a.hours,a.minutes,a.seconds,a.timezone);return c.hours+=b.hours,c.minutes+=b.minutes,c.seconds+=b.seconds,wb(c)},$c["subtract-dayTimeDuration-from-time"]=function(a,b){var c=new vb(a.hours,a.minutes,a.seconds,a.timezone);return c.hours-=b.hours,c.minutes-=b.minutes,c.seconds-=b.seconds,wb(c)},$c["is-same-node"]=function(a,b){return new Xa(this.DOMAdapter.isSameNode(a,b))},$c["node-before"]=function(a,b){return new Xa(!!(4&this.DOMAdapter.compareDocumentPosition(a,b)))},$c["node-after"]=function(a,b){return new Xa(!!(2&this.DOMAdapter.compareDocumentPosition(a,b)))},$c["numeric-add"]=function(a,b){var c=a.valueOf(),d=b.valueOf(),e=Gc.pow(10,pc(c,d));return qc(a,b,(c*e+d*e)/e)},$c["numeric-subtract"]=function(a,b){var c=a.valueOf(),d=b.valueOf(),e=Gc.pow(10,pc(c,d));return qc(a,b,(c*e-d*e)/e)},$c["numeric-multiply"]=function(a,b){var c=a.valueOf(),d=b.valueOf(),e=Gc.pow(10,pc(c,d));return qc(a,b,c*e*(d*e)/(e*e))},$c["numeric-divide"]=function(a,b){var c=a.valueOf(),d=b.valueOf(),e=Gc.pow(10,pc(c,d));return qc(a,b,a*e/(b*e))},$c["numeric-integer-divide"]=function(a,b){var c=a/b;return new Cb(Gc.floor(c)+(c<0))},$c["numeric-mod"]=function(a,b){var c=a.valueOf(),d=b.valueOf(),e=Gc.pow(10,pc(c,d));return qc(a,b,c*e%(d*e)/e)},$c["numeric-unary-plus"]=function(a){return a},$c["numeric-unary-minus"]=function(a){return a.value*=-1,a},$c["numeric-equal"]=function(a,b){return new Xa(a.valueOf()==b.valueOf())},$c["numeric-less-than"]=function(a,b){return new Xa(a.valueOf()b.valueOf())},$c["QName-equal"]=function(a,b){return new Xa(a.localName==b.localName&&a.namespaceURI==b.namespaceURI)},$c.concatenate=function(a,b){return a.concat(b)},$c.union=function(b,c){for(var d,e=[],f=0,g=b.length;fh?g.pop():(g.push(f[i]),h++):"."!=f[i]&&g.push(f[i]);".."!=f[--i]&&"."!=f[i]||g.push(""),d.path=g.join("/")}return d}),f("true",[],function(){return new Xa(!0)}),f("false",[],function(){return new Xa(!1)}),f("not",[[Yb,"*"]],function(a){return new Xa(!uc(a,this))}),f("position",[],function(){return new Cb(this.position)}),f("last",[],function(){return new Cb(this.size)}),f("current-dateTime",[],function(){return this.dateTime}),f("current-date",[],function(){return Ya.cast(this.dateTime)}),f("current-time",[],function(){return vb.cast(this.dateTime)}),f("implicit-timezone",[],function(){return this.timezone}),f("default-collation",[],function(){return new ub(this.staticContext.defaultCollationName)}),f("static-base-uri",[],function(){return Va.cast(new ub(this.staticContext.baseURI||""))}),f("years-from-duration",[[hb,"?"]],function(a){return rc(a,"year")}),f("months-from-duration",[[hb,"?"]],function(a){return rc(a,"month")}),f("days-from-duration",[[hb,"?"]],function(a){return rc(a,"day")}),f("hours-from-duration",[[hb,"?"]],function(a){return rc(a,"hours")}),f("minutes-from-duration",[[hb,"?"]],function(a){return rc(a,"minutes")}),f("seconds-from-duration",[[hb,"?"]],function(a){return rc(a,"seconds")}),f("year-from-dateTime",[[_a,"?"]],function(a){return sc(a,"year")}),f("month-from-dateTime",[[_a,"?"]],function(a){return sc(a,"month")}),f("day-from-dateTime",[[_a,"?"]],function(a){return sc(a,"day")}),f("hours-from-dateTime",[[_a,"?"]],function(a){return sc(a,"hours")}),f("minutes-from-dateTime",[[_a,"?"]],function(a){return sc(a,"minutes")}),f("seconds-from-dateTime",[[_a,"?"]],function(a){return sc(a,"seconds")}),f("timezone-from-dateTime",[[_a,"?"]],function(a){return sc(a,"timezone")}),f("year-from-date",[[Ya,"?"]],function(a){return sc(a,"year")}),f("month-from-date",[[Ya,"?"]],function(a){return sc(a,"month")}),f("day-from-date",[[Ya,"?"]],function(a){return sc(a,"day")}),f("timezone-from-date",[[Ya,"?"]],function(a){return sc(a,"timezone")}),f("hours-from-time",[[vb,"?"]],function(a){return sc(a,"hours")}),f("minutes-from-time",[[vb,"?"]],function(a){return sc(a,"minutes")}),f("seconds-from-time",[[vb,"?"]],function(a){return sc(a,"seconds")}),f("timezone-from-time",[[vb,"?"]],function(a){return sc(a,"timezone")}),f("adjust-dateTime-to-timezone",[[_a,"?"],[Ab,"?",!0]],function(a,b){return tc(a,arguments.length>1&&null!=b?arguments.length>1?b:this.timezone:null)});f("adjust-date-to-timezone",[[Ya,"?"],[Ab,"?",!0]],function(a,b){return tc(a,arguments.length>1&&null!=b?arguments.length>1?b:this.timezone:null)});f("adjust-time-to-timezone",[[vb,"?"],[Ab,"?",!0]],function(a,b){return tc(a,arguments.length>1&&null!=b?arguments.length>1?b:this.timezone:null)}),f("name",[[Zb,"?",!0]],function(b){if(arguments.length){if(null==b)return new ub("")}else{if(!this.DOMAdapter.isNode(this.item))throw new a("XPTY0004");b=this.item}var c=Xc["node-name"].call(this,b);return new ub(null==c?"":c.toString())}),f("local-name",[[Zb,"?",!0]],function(b){if(arguments.length){if(null==b)return new ub("")}else{if(!this.DOMAdapter.isNode(this.item))throw new a("XPTY0004");b=this.item}return new ub(this.DOMAdapter.getProperty(b,"localName")||"")}),f("namespace-uri",[[Zb,"?",!0]],function(b){if(arguments.length){if(null==b)return Va.cast(new ub(""))}else{if(!this.DOMAdapter.isNode(this.item))throw new a("XPTY0004");b=this.item}return Va.cast(new ub(this.DOMAdapter.getProperty(b,"namespaceURI")||""))}),f("number",[[Ta,"?",!0]],function(b){if(!arguments.length){if(!this.item)throw new a("XPDY0002");b=vc([this.item],this)[0]}var c=new gb(Kc);if(null!=b)try{c=gb.cast(b)}catch(a){}return c}),f("lang",[[ub,"?"],[Zb,"",!0]],function(b,c){if(arguments.length<2){if(!this.DOMAdapter.isNode(this.item))throw new a("XPTY0004");c=this.item}var d=this.DOMAdapter.getProperty;2==d(c,"nodeType")&&(c=d(c,"ownerElement"));for(var e;c;c=d(c,"parentNode"))if(e=d(c,"attributes"))for(var f=0,g=e.length;f1?b.valueOf():0;if(c<0){var d=new Cb(Gc.pow(10,-c)),e=Gc.round($c["numeric-divide"].call(this,a,d)),f=new Cb(e);return nDecimal=Gc.abs($c["numeric-subtract"].call(this,f,$c["numeric-divide"].call(this,a,d))),$c["numeric-multiply"].call(this,$c["numeric-add"].call(this,f,new fb(.5==nDecimal&&e%2?-1:0)),d)}var d=new Cb(Gc.pow(10,c)),e=Gc.round($c["numeric-multiply"].call(this,a,d)),f=new Cb(e);return nDecimal=Gc.abs($c["numeric-subtract"].call(this,f,$c["numeric-multiply"].call(this,a,d))),$c["numeric-divide"].call(this,$c["numeric-add"].call(this,f,new fb(.5==nDecimal&&e%2?-1:0)),d)}),f("resolve-QName",[[ub,"?"],[bc]],function(b,c){if(null==b)return null;var d=b.valueOf(),e=d.match(Bd);if(!e)throw new a("FOCA0002");var f=e[1]||null,g=e[2],h=this.DOMAdapter.lookupNamespaceURI(c,f);if(null!=f&&!h)throw new a("FONS0004");return new tb(f,g,h||null)}),f("QName",[[ub,"?"],[ub]],function(b,c){var d=c.valueOf(),e=d.match(Bd);if(!e)throw new a("FOCA0002");return new tb(e[1]||null,e[2]||null,null==b?"":b.valueOf())}),f("prefix-from-QName",[[tb,"?"]],function(a){return null!=a&&a.prefix?new Sb(a.prefix):null}),f("local-name-from-QName",[[tb,"?"]],function(a){return null==a?null:new Sb(a.localName)}),f("namespace-uri-from-QName",[[tb,"?"]],function(a){return null==a?null:Va.cast(new ub(a.namespaceURI||""))}),f("namespace-uri-for-prefix",[[ub,"?"],[bc]],function(a,b){var c=null==a?"":a.valueOf(),d=this.DOMAdapter.lookupNamespaceURI(b,c||null);return null==d?null:Va.cast(new ub(d))}),f("in-scope-prefixes",[[bc]],function(a){throw"Function 'in-scope-prefixes' not implemented"}),f("boolean",[[Yb,"*"]],function(a){return new Xa(uc(a,this))}),f("index-of",[[Ta,"*"],[Ta],[ub,"",!0]],function(a,b,c){if(!a.length||null==b)return[];var d=b;d instanceof xb&&(d=ub.cast(d));for(var e,f=[],g=0,h=a.length;g1)throw"Collation parameter in function 'distinct-values' is not implemented";if(!a.length)return null;for(var c,d=[],e=0,f=a.length;ed&&(e=d+1);for(var f=[],g=0;gc)return a;for(var e=[],f=0;f2?Gc.round(c):a.length-d+1;return a.slice(d-1,d-1+e)}),f("unordered",[[Yb,"*"]],function(a){return a}),f("zero-or-one",[[Yb,"*"]],function(b){if(b.length>1)throw new a("FORG0003");return b}),f("one-or-more",[[Yb,"*"]],function(b){if(!b.length)throw new a("FORG0004");return b}),f("exactly-one",[[Yb,"*"]],function(b){if(1!=b.length)throw new a("FORG0005");return b}),f("deep-equal",[[Yb,"*"],[Yb,"*"],[ub,"",!0]],function(a,b,c){throw"Function 'deep-equal' not implemented"}),f("count",[[Yb,"*"]],function(a){return new Cb(a.length)}),f("avg",[[Ta,"*"]],function(b){if(!b.length)return null;try{var c=b[0];c instanceof xb&&(c=gb.cast(c));for(var d,e=1,f=b.length;e1?c:new gb(0);try{var d=b[0];d instanceof xb&&(d=gb.cast(d));for(var e,f=1,g=b.length;f2&&(f=d.valueOf()),e=f==Sc+"/collation/codepoint"?Gd:this.staticContext.getCollation(f),!e)throw new a("FOCH0002");return new Cb(e.compare(b.valueOf(),c.valueOf()))}),f("codepoint-equal",[[ub,"?"],[ub,"?"]],function(a,b){return null==a||null==b?null:new Xa(a.valueOf()==b.valueOf())}),f("concat",null,function(){if(arguments.length<2)throw new a("XPST0017");for(var b,c=[],d=0,e=arguments.length;d2?e+Gc.round(c):d.length;return new ub(f>e?d.substring(e,f):"")}),f("string-length",[[ub,"?",!0]],function(b){if(!arguments.length){if(!this.item)throw new a("XPDY0002");b=ub.cast(vc([this.item],this)[0])}return new Cb(null==b?0:b.valueOf().length)}),f("normalize-space",[[ub,"?",!0]],function(b){if(!arguments.length){if(!this.item)throw new a("XPDY0002");b=ub.cast(vc([this.item],this)[0])}return new ub(null==b?"":Pc(b).replace(/\s\s+/g," "))}),f("normalize-unicode",[[ub,"?"],[ub,"",!0]],function(a,b){throw"Function 'normalize-unicode' not implemented"}),f("upper-case",[[ub,"?"]],function(a){return new ub(null==a?"":a.valueOf().toUpperCase())}),f("lower-case",[[ub,"?"]],function(a){return new ub(null==a?"":a.valueOf().toLowerCase())}),f("translate",[[ub,"?"],[ub],[ub]],function(a,b,c){if(null==a)return new ub("");for(var d,e=a.valueOf().split(""),f=b.valueOf().split(""),g=c.valueOf().split(""),h=g.length,i=[],j=0,k=e.length;j126)&&(c[d]=window.encodeURIComponent(c[d]));return new ub(c.join(""))}),f("contains",[[ub,"?"],[ub,"?"],[ub,"",!0]],function(a,b,c){if(arguments.length>2)throw"Collation parameter in function 'contains' is not implemented";return new Xa((null==a?"":a.valueOf()).indexOf(null==b?"":b.valueOf())>=0)}),f("starts-with",[[ub,"?"],[ub,"?"],[ub,"",!0]],function(a,b,c){if(arguments.length>2)throw"Collation parameter in function 'starts-with' is not implemented";return new Xa(0==(null==a?"":a.valueOf()).indexOf(null==b?"":b.valueOf()))}),f("ends-with",[[ub,"?"],[ub,"?"],[ub,"",!0]],function(a,b,c){if(arguments.length>2)throw"Collation parameter in function 'ends-with' is not implemented";var d=null==a?"":a.valueOf(),e=null==b?"":b.valueOf();return new Xa(d.indexOf(e)==d.length-e.length)}),f("substring-before",[[ub,"?"],[ub,"?"],[ub,"",!0]],function(a,b,c){if(arguments.length>2)throw"Collation parameter in function 'substring-before' is not implemented";var d,e=null==a?"":a.valueOf(),f=null==b?"":b.valueOf();return new ub((d=e.indexOf(f))>=0?e.substring(0,d):"")}),f("substring-after",[[ub,"?"],[ub,"?"],[ub,"",!0]],function(a,b,c){if(arguments.length>2)throw"Collation parameter in function 'substring-after' is not implemented";var d,e=null==a?"":a.valueOf(),f=null==b?"":b.valueOf();return new ub((d=e.indexOf(f))>=0?e.substring(d+f.length):"")}),f("matches",[[ub,"?"],[ub],[ub,"",!0]],function(a,b,c){var d=null==a?"":a.valueOf(),e=xc(b.valueOf(),arguments.length>2?c.valueOf():"");return new Xa(e.test(d))}),f("replace",[[ub,"?"],[ub],[ub],[ub,"",!0]],function(a,b,c,d){var e=null==a?"":a.valueOf(),f=xc(b.valueOf(),arguments.length>3?d.valueOf():"");return new Xa(e.replace(f,c.valueOf()))}),f("tokenize",[[ub,"?"],[ub],[ub,"",!0]],function(a,b,c){for(var d=null==a?"":a.valueOf(),e=xc(b.valueOf(),arguments.length>2?c.valueOf():""),f=[],g=0,h=d.split(e),i=h.length;gb?1:-1},yc.prototype=new c;var Hd=new e;yc.prototype.getProperty=function(a,b){if(b in a)return a[b];if("baseURI"==b){for(var c,d="",e=Hd.getFunction("{http://www.w3.org/2005/xpath-functions}resolve-uri"),f=Hd.getDataType("{http://www.w3.org/2001/XMLSchema}string"),g=a;g;g=g.parentNode)1==g.nodeType&&(c=g.getAttribute("xml:base"))&&(d=e(new f(c),new f(d)).toString());return d}if("textContent"==b){var h=[];return function(a){for(var b,c=0;b=a.childNodes[c];c++)3==b.nodeType||4==b.nodeType?h.push(b.data):1==b.nodeType&&b.firstChild&&arguments.callee(b)}(a),h.join("")}},yc.prototype.compareDocumentPosition=function(a,b){if("compareDocumentPosition"in a)return a.compareDocumentPosition(b);if(b==a)return 0;var c,d,e,f,g,h=null,i=null;if(2==a.nodeType&&(h=a,a=this.getProperty(h,"ownerElement")),2==b.nodeType&&(i=b,b=this.getProperty(i,"ownerElement")),h&&i&&a&&a==b)for(f=0,c=this.getProperty(a,"attributes"),g=c.length;fMath.round(a.width/50))&&(e=Math.round(a.width/50)),(!f||f>Math.round(a.width/50))&&(f=Math.round(a.height/50));var h=a.getContext("2d"),i=.08*a.width,j=.03*a.width,k=.08*a.height,l=.15*a.height,m=a.height-k-l,n=a.width-i-j,o=k+m,p=k;h.font=g+"px Arial",h.lineWidth="1.0",h.strokeStyle="#444",CanvasComponents.draw_line(h,i,o,n+i,o),CanvasComponents.draw_line(h,i,o,i,p);var q=.003*n,r=(n-q*b.length)/b.length,s=i+q,t=Math.max.apply(Math,b);h.fillStyle="green";for(var u=0;u=b.length)for(var u=0;u<=b.length;u++)h.fillText(u,s,o+.3*l),s+=r+q;else for(var u=0;u<=e;u++){var w=Math.ceil(b.length/e*u);s=n/e*u+i,h.fillText(w,s,o+.3*l)}h.textAlign="right";var x;if(f>=t)for(var u=0;u<=t;u++)x=o-u/t*m+g/3,h.fillText(u,.8*i,x);else for(var u=0;u<=f;u++){var w=Math.ceil(t/f*u);x=o-w/t*m+g/3,h.fillText(w,.8*i,x)}if(c&&(h.textAlign="center",h.fillText(c,n/2+i,o+.8*l)),d){h.save();var y=.3*i,z=m/2+k;h.translate(y,z),h.rotate(-Math.PI/2),h.textAlign="center",h.fillText(d,0,0),h.restore()}},draw_scale_bar:function(a,b,c,d){var e=a.getContext("2d"),f=.01*a.width,g=.01*a.width,h=.1*a.height,i=.3*a.height,j=a.height-h-i,k=a.width-f-g,l=b/c;e.strokeRect(f,h,k,j);var m=e.createLinearGradient(f,0,k+f,0);m.addColorStop(0,"green"),m.addColorStop(.5,"gold"),m.addColorStop(1,"red"),e.fillStyle=m,e.fillRect(f,h,k*l,j);var n,o,p,q;e.fillStyle="black",e.textAlign="center",e.font="13px Arial";for(var r=0;r=.9*c?(e.textAlign="right",n=p):d[r].max<=.1*c?e.textAlign="left":n+=(p-n)/2,o=h+j+.8*i,e.fillText(d[r].label,n,o)}},Utils={chr:function(a){return String.fromCharCode(a)},ord:function(a){return a.charCodeAt(0)},pad_left:function(a,b,c){c=c||"0";var d=c.length-(b-a.length);return d=d<0?0:d,a.lengthb&&(a=a.slice(0,b-c.length)+c),a},hex:function(a,b){return a="string"==typeof a?Utils.ord(a):a,b=b||2,Utils.pad(a.toString(16),b)},bin:function(a,b){return a="string"==typeof a?Utils.ord(a):a,b=b||8,Utils.pad(a.toString(2),b)},printable:function(a,b){window&&window.app&&!window.app.options.treat_as_utf8&&(a=Utils.byte_array_to_chars(Utils.str_to_byte_array(a)));var c=/[\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-\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,d=/[\x09-\x10\x0D\u2028\u2029]/g;return a=a.replace(c,"."),b||(a=a.replace(d,".")),a},parse_escaped_chars:function(a){return a.replace(/(\\)?\\([nrtbf]|x[\da-f]{2})/g,function(a,b,c){if("\\"===b)return"\\"+c;switch(c[0]){case"n":return"\n";case"r":return"\r";case"t":return"\t";case"b":return"\b";case"f":return"\f";case"x":return Utils.chr(parseInt(c.substr(1),16))}})},expand_alph_range:function(a){for(var b=[],c=0;c255)return Utils.str_to_utf8_byte_array(a);return c},str_to_utf8_byte_array:function(a){var b=CryptoJS.enc.Utf8.parse(a),c=Utils.word_array_to_byte_array(b);return a.length!==b.sigBytes&&(window.app.options.attempt_highlight=!1),c},str_to_charcode:function(a){for(var b=new Array(a.length),c=a.length;c--;)b[c]=a.charCodeAt(c);return b},byte_array_to_utf8:function(a){try{for(var b=[],c=0;c>>2]|=a[c]<<24-c%4*8;var d=new CryptoJS.lib.WordArray.init(b,a.length),e=CryptoJS.enc.Utf8.stringify(d);return e.length!==d.sigBytes&&(window.app.options.attempt_highlight=!1),e}catch(b){return Utils.byte_array_to_chars(a)}},byte_array_to_chars:function(a){if(!a)return"";for(var b="",c=0;c>>2]>>>24-d%4*8&255);return c},UNIC_WIN1251_MAP:{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,14:14,15:15,16:16,17:17,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,28:28,29:29,30:30,31:31,32:32,33:33,34:34,35:35,36:36,37:37,38:38,39:39,40:40,41:41,42:42,43:43,44:44,45:45,46:46,47:47,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,58:58,59:59,60:60,61:61,62:62,63:63,64:64,65:65,66:66,67:67,68:68,69:69,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,82:82,83:83,84:84,85:85,86:86,87:87,88:88,89:89,90:90,91:91,92:92,93:93,94:94,95:95,96:96,97:97,98:98,99:99,100:100,101:101,102:102,103:103,104:104,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,125:125,126:126,127:127,1027:129,8225:135,1046:198,8222:132,1047:199,1168:165,1048:200,1113:154,1049:201,1045:197,1050:202,1028:170,160:160,1040:192,1051:203,164:164,166:166,167:167,169:169,171:171,172:172,173:173,174:174,1053:205,176:176,177:177,1114:156,181:181,182:182,183:183,8221:148,187:187,1029:189,1056:208,1057:209,1058:210,8364:136,1112:188,1115:158,1059:211,1060:212,1030:178,1061:213,1062:214,1063:215,1116:157,1064:216,1065:217,1031:175,1066:218,1067:219,1068:220,1069:221,1070:222,1032:163,8226:149,1071:223,1072:224,8482:153,1073:225,8240:137,1118:162,1074:226,1110:179,8230:133,1075:227,1033:138,1076:228,1077:229,8211:150,1078:230,1119:159,1079:231,1042:194,1080:232,1034:140,1025:168,1081:233,1082:234,8212:151,1083:235,1169:180,1084:236,1052:204,1085:237,1035:142,1086:238,1087:239,1088:240,1089:241,1090:242,1036:141,1041:193,1091:243,1092:244,8224:134,1093:245,8470:185,1094:246,1054:206,1095:247,1096:248,8249:139,1097:249,1098:250,1044:196,1099:251,1111:191,1055:207,1100:252,1038:161,8220:147,1101:253,8250:155,1102:254,8216:145,1103:255,1043:195,1105:184,1039:143,1026:128,1106:144,8218:130,1107:131,8217:146,1108:186,1109:190},WIN1251_UNIC_MAP:{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,14:14,15:15,16:16,17:17,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,28:28,29:29,30:30,31:31,32:32,33:33,34:34,35:35,36:36,37:37,38:38,39:39,40:40,41:41,42:42,43:43,44:44,45:45,46:46,47:47,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,58:58,59:59,60:60,61:61,62:62,63:63,64:64,65:65,66:66,67:67,68:68,69:69,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,82:82,83:83,84:84,85:85,86:86,87:87,88:88,89:89,90:90,91:91,92:92,93:93,94:94,95:95,96:96,97:97,98:98,99:99,100:100,101:101,102:102,103:103,104:104,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,125:125,126:126,127:127,160:160,164:164,166:166,167:167,169:169,171:171,172:172,173:173,174:174,176:176,177:177,181:181,182:182,183:183,187:187,168:1025,128:1026,129:1027,170:1028,189:1029,178:1030,175:1031,163:1032,138:1033,140:1034,142:1035,141:1036,161:1038,143:1039,192:1040,193:1041,194:1042,195:1043,196:1044,197:1045,198:1046,199:1047,200:1048,201:1049,202:1050,203:1051,204:1052,205:1053,206:1054,207:1055,208:1056,209:1057,210:1058,211:1059,212:1060,213:1061,214:1062,215:1063,216:1064,217:1065,218:1066,219:1067,220:1068,221:1069,222:1070,223:1071,224:1072,225:1073,226:1074,227:1075,228:1076,229:1077,230:1078,231:1079,232:1080,233:1081,234:1082,235:1083,236:1084,237:1085,238:1086,239:1087,240:1088,241:1089,242:1090,243:1091,244:1092,245:1093,246:1094,247:1095,248:1096,249:1097,250:1098,251:1099,252:1100,253:1101,254:1102,255:1103,184:1105,144:1106,131:1107,186:1108,190:1109,179:1110,191:1111,188:1112,154:1113,156:1114,158:1115,157:1116,162:1118,159:1119,165:1168,180:1169,150:8211,151:8212,145:8216,146:8217,130:8218,147:8220,148:8221,132:8222,134:8224,135:8225,149:8226,133:8230,137:8240,139:8249,155:8250,136:8364,185:8470,153:8482},unicode_to_win1251:function(a){for(var b=[],c=0;c>2,g=(3&c)<<4|d>>4,h=(15&d)<<2|e>>6,i=63&e,isNaN(d)?h=i=64:isNaN(e)&&(i=64),j+=b.charAt(f)+b.charAt(g)+b.charAt(h)+b.charAt(i);return j},from_base64:function(a,b,c,d){if(c=c||"string",!a)return"string"===c?"":[];b=b?Utils.expand_alph_range(b).join(""):"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",void 0===d&&(d=!0);var e,f,g,h,i,j,k,l=[],m=0;if(d){var n=new RegExp("[^"+b.replace(/[\[\]\\\-^$]/g,"\\$&")+"]","g");a=a.replace(n,"")}for(;m>4,f=(15&i)<<4|j>>2,g=(3&j)<<6|k,l.push(e),64!==j&&l.push(f),64!==k&&l.push(g);return"string"===c?Utils.byte_array_to_utf8(l):l},to_hex:function(a,b,c){if(!a)return"";b="string"==typeof b?b:" ",c=c||2;for(var d="",e=0;e>>4).toString(16)),b.push((15&a[c]).toString(16));return b.join("")},from_hex:function(a,b,c){if(b=b||(a.indexOf(" ")>=0?"Space":"None"),c=c||2,"None"!==b){var d=Utils.regex_rep[b];a=a.replace(d,"")}for(var e=[],f=0;f]*>.*<\/(script|style)>/gim,"")),a.replace(/<[^>\n]+>/g,"")},escape_html:function(a){return a.replace(/>>3]|=parseInt(a.substr(d,2),16)<<24-d%8*4;return new CryptoJS.lib.WordArray.init(c,b/2)};var Base={DEFAULT_RADIX:36,run_to:function(a,b){if(!a)throw"Error: Input must be a number";var c=b[0]||Base.DEFAULT_RADIX;if(c<2||c>36)throw"Error: Radix argument must be between 2 and 36";return a.toString(c)},run_from:function(a,b){var c=b[0]||Base.DEFAULT_RADIX;if(c<2||c>36)throw"Error: Radix argument must be between 2 and 36";return parseInt(a.replace(/\s/g,""),c)}},Base64={ALPHABET:"A-Za-z0-9+/=",ALPHABET_OPTIONS:[{name:"Standard: A-Za-z0-9+/=",value:"A-Za-z0-9+/="},{name:"URL safe: 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: 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+/="}],run_to:function(a,b){var c=b[0]||Base64.ALPHABET;return Utils.to_base64(a,c)},REMOVE_NON_ALPH_CHARS:!0,run_from:function(a,b){var c=b[0]||Base64.ALPHABET,d=b[1];return Utils.from_base64(a,c,"byte_array",d)},BASE32_ALPHABET:"A-Z2-7=",run_to_32:function(a,b){if(!a)return"";for(var c,d,e,f,g,h,i,j,k,l,m,n,o,p=b[0]?Utils.expand_alph_range(b[0]).join(""):"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",q="",r=0;r>3,i=(7&c)<<2|d>>6,j=d>>1&31,k=(1&d)<<4|e>>4,l=(15&e)<<1|f>>7,m=f>>2&63,n=(3&f)<<3|g>>5,o=31&g,isNaN(d)?j=k=l=m=n=o=32:isNaN(e)?l=m=n=o=32:isNaN(f)?m=n=o=32:isNaN(g)&&(o=32),q+=p.charAt(h)+p.charAt(i)+p.charAt(j)+p.charAt(k)+p.charAt(l)+p.charAt(m)+p.charAt(n)+p.charAt(o);return q},run_from_32:function(a,b){if(!a)return[];var c,d,e,f,g,h,i,j,k,l,m,n,o,p=b[0]?Utils.expand_alph_range(b[0]).join(""):"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",q=b[0],r=[],s=0;if(q){var t=new RegExp("[^"+p.replace(/[\]\\\-^]/g,"\\$&")+"]","g");a=a.replace(t,"")}for(;s>2,d=(3&i)<<6|j<<1|k>>4,e=(15&k)<<4|l>>1,f=(1&l)<<7|m<<2|n>>3,g=(7&n)<<5|o,r.push(c),(i&!0||32!==j)&&r.push(d),(k&!0||32!==l)&&r.push(e),(l&!0||32!==m)&&r.push(f),(n&!0||32!==o)&&r.push(g);return r},SHOW_IN_BINARY:!1,OFFSETS_SHOW_VARIABLE:!0,run_offsets:function(a,b){var c=b[0]||Base64.ALPHABET,d=b[1],e=Utils.to_base64(a,c),f=Utils.to_base64([0].concat(a),c),g=Utils.to_base64([0,0].concat(a),c),h=e.indexOf("="),i=f.indexOf("="),j=g.indexOf("="),k="
                                                                                      Operations
                                                                                        Recipe
                                                                                          Input
                                                                                          Output
                                                                                          Operations
                                                                                            Recipe
                                                                                              Input
                                                                                              Output
                                                                                              \ No newline at end of file +document.querySelector("link[rel=icon]").setAttribute("href","data:image/png;base64,"+a),document.querySelector("#bake img").setAttribute("src","data:image/png;base64,"+b),document.querySelector(".about-img-left").setAttribute("src","data:image/png;base64,"+c)},SeasonalWaiter.prototype.insert_spider_text=function(){document.title=document.title.replace(/Cyber/g,"Spider"),SeasonalWaiter.tree_walk(document.body,function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Cyber/g,"Spider"))},!0),SeasonalWaiter.tree_walk(document.getElementById("bake-group"),function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Bake/g,"Spin"))},!0),document.querySelector("#recipe .title").innerHTML="Web"},SeasonalWaiter.prototype.create_snow_option=function(){var a=document.getElementById("options-body"),b=document.createElement("div");b.className="option-item",b.innerHTML=" Let it snow",a.appendChild(b),this.manager.options.load()},SeasonalWaiter.prototype.let_it_snow=function(){if($(document).snowfall("clear"),this.app.options.snow){var a={},b=navigator.userAgent.match(/Firefox\/(\d\d?)/);a=b&&parseInt(b[1],10)<30?{flakeCount:10,flakeColor:"#fff",flakePosition:"absolute",minSize:1,maxSize:2,minSpeed:1,maxSpeed:5,round:!1,shadow:!1,collection:!1,collectionHeight:20,deviceorientation:!0}:{flakeCount:35,flakeColor:"#fff",flakePosition:"absolute",minSize:5,maxSize:8,minSpeed:1,maxSpeed:5,round:!0,shadow:!0,collection:".btn",collectionHeight:20,deviceorientation:!0},$(document).snowfall(a)}},SeasonalWaiter.prototype.shake_off_snow=function(a){for(var b=a.target,c=b.getBoundingClientRect(),d=document.querySelectorAll("canvas.snowfall-canvas"),e=null,f=function(){h.clearRect(0,0,e.width,e.height),$(this).fadeIn()},g=0;g6e4&&this.app.silent_bake()};var main=function(){var a=["To Base64","From Base64","To Hex","From Hex","To Hexdump","From Hexdump","URL Decode","Regular expression","Entropy","Fork"],b={update_url:!0,show_highlighter:!0,treat_as_utf8:!0,word_wrap:!0,show_errors:!0,error_timeout:4e3,auto_bake_threshold:200,attempt_highlight:!0,snow:!1};document.removeEventListener("DOMContentLoaded",main,!1),window.app=new HTMLApp(Categories,OperationConfig,a,b),window.app.setup()};window.console=console||{log:function(){},error:function(){}},window.compile_time=moment.tz("Mon Jan 16 2017 15:02:01","ddd MMM D YYYY HH:mm:ss","UTC").valueOf(),window.compile_message="",document.addEventListener("DOMContentLoaded",main,!1); \ No newline at end of file diff --git a/build/prod/index.html b/build/prod/index.html index 0f4a546a..20858598 100755 --- a/build/prod/index.html +++ b/build/prod/index.html @@ -18,4 +18,4 @@ See the License for the specific language governing permissions and limitations under the License. --> -CyberChef Edit
                                                                                              Operations
                                                                                                Recipe
                                                                                                  Input
                                                                                                  Output
                                                                                                  \ No newline at end of file +CyberChef Edit
                                                                                                  Operations
                                                                                                    Recipe
                                                                                                      Input
                                                                                                      Output
                                                                                                      \ No newline at end of file diff --git a/build/prod/scripts.js b/build/prod/scripts.js index f3ad3b43..e57654e8 100755 --- a/build/prod/scripts.js +++ b/build/prod/scripts.js @@ -272,6 +272,6 @@ o=IP._ipv6_to_str(n,!0),j.hasOwnProperty(o)?j[o].push(m):j[o]=[m]}for(n in i)if( "06032b0601050507":"pkix","06032b060105050701":"privateExtension","06032b06010505070101":"authorityInfoAccess","06032b06010505070c02":"CMC Data","06032b060105050702":"policyQualifierIds","06032b06010505070202":"unotice","06032b060105050703":"keyPurpose","06032b06010505070301":"serverAuth","06032b06010505070302":"clientAuth","06032b06010505070303":"codeSigning","06032b06010505070304":"emailProtection","06032b06010505070305":"ipsecEndSystem","06032b06010505070306":"ipsecTunnel","06032b06010505070307":"ipsecUser","06032b06010505070308":"timeStamping","06032b060105050704":"cmpInformationTypes","06032b06010505070401":"caProtEncCert","06032b06010505070402":"signKeyPairTypes","06032b06010505070403":"encKeyPairTypes","06032b06010505070404":"preferredSymmAlg","06032b06010505070405":"caKeyUpdateInfo","06032b06010505070406":"currentCRL","06032b06010505073001":"ocsp","06032b06010505073002":"caIssuers","06032b06010505080101":"HMAC-MD5","06032b06010505080102":"HMAC-SHA","060360864801650201010a":"mosaicKeyManagementAlgorithm","060360864801650201010b":"sdnsKMandSigAlgorithm","060360864801650201010c":"mosaicKMandSigAlgorithm","060360864801650201010d":"SuiteASignatureAlgorithm","060360864801650201010e":"SuiteAConfidentialityAlgorithm","060360864801650201010f":"SuiteAIntegrityAlgorithm","06036086480186f84201":"cert-extension","06036086480186f842010a":"EntityLogo","06036086480186f842010b":"UserPicture","06036086480186f8420109":"HomePage-url","06036086480186f84202":"data-type","06036086480186f8420201":"GIF","06036086480186f8420202":"JPEG","06036086480186f8420203":"URL","06036086480186f8420204":"HTML","06036086480186f8420205":"netscape-cert-sequence","06036086480186f8420206":"netscape-cert-url","06036086480186f84203":"directory","06036086480186f8420401":"serverGatedCrypto","06036086480186f845010603":"Unknown Verisign extension","06036086480186f845010606":"Unknown Verisign extension","06036086480186f84501070101":"Verisign certificatePolicy","06036086480186f8450107010101":"Unknown Verisign policy qualifier","06036086480186f8450107010102":"Unknown Verisign policy qualifier","0603678105":"TCPA","060367810501":"tcpa_specVersion","060367810502":"tcpa_attribute","06036781050201":"tcpa_at_tpmManufacturer","0603678105020a":"tcpa_at_securityQualities","0603678105020b":"tcpa_at_tpmProtectionProfile","0603678105020c":"tcpa_at_tpmSecurityTarget","0603678105020d":"tcpa_at_foundationProtectionProfile","0603678105020e":"tcpa_at_foundationSecurityTarget","0603678105020f":"tcpa_at_tpmIdLabel","06036781050202":"tcpa_at_tpmModel","06036781050203":"tcpa_at_tpmVersion","06036781050204":"tcpa_at_platformManufacturer","06036781050205":"tcpa_at_platformModel","06036781050206":"tcpa_at_platformVersion","06036781050207":"tcpa_at_componentManufacturer","06036781050208":"tcpa_at_componentModel","06036781050209":"tcpa_at_componentVersion","060367810503":"tcpa_protocol","06036781050301":"tcpa_prtt_tpmIdProtocol","0603672a00":"contentType","0603672a0000":"PANData","0603672a0001":"PANToken","0603672a0002":"PANOnly","0603672a01":"msgExt","0603672a0a":"national","0603672a0a8140":"Japan","0603672a02":"field","0603672a0200":"fullName","0603672a0201":"givenName","0603672a020a":"amount","0603672a0202":"familyName","0603672a0203":"birthFamilyName","0603672a0204":"placeName","0603672a0205":"identificationNumber","0603672a0206":"month","0603672a0207":"date","0603672a02070b":"accountNumber","0603672a02070c":"passPhrase","0603672a0208":"address","0603672a0209":"telephone","0603672a03":"attribute","0603672a0300":"cert","0603672a030000":"rootKeyThumb","0603672a030001":"additionalPolicy","0603672a04":"algorithm","0603672a05":"policy","0603672a0500":"root","0603672a06":"module","0603672a07":"certExt","0603672a0700":"hashedRootKey","0603672a0701":"certificateType","0603672a0702":"merchantData","0603672a0703":"cardCertRequired","0603672a0704":"tunneling","0603672a0705":"setExtensions","0603672a0706":"setQualifier","0603672a08":"brand","0603672a0801":"IATA-ATA","0603672a081e":"Diners","0603672a0822":"AmericanExpress","0603672a0804":"VISA","0603672a0805":"MasterCard","0603672a08ae7b":"Novus","0603672a09":"vendor","0603672a0900":"GlobeSet","0603672a0901":"IBM","0603672a090a":"Griffin","0603672a090b":"Certicom","0603672a090c":"OSS","0603672a090d":"TenthMountain","0603672a090e":"Antares","0603672a090f":"ECC","0603672a0910":"Maithean","0603672a0911":"Netscape","0603672a0912":"Verisign","0603672a0913":"BlueMoney","0603672a0902":"CyberCash","0603672a0914":"Lacerte","0603672a0915":"Fujitsu","0603672a0916":"eLab","0603672a0917":"Entrust","0603672a0918":"VIAnet","0603672a0919":"III","0603672a091a":"OpenMarket","0603672a091b":"Lexem","0603672a091c":"Intertrader","0603672a091d":"Persimmon","0603672a0903":"Terisa","0603672a091e":"NABLE","0603672a091f":"espace-net","0603672a0920":"Hitachi","0603672a0921":"Microsoft","0603672a0922":"NEC","0603672a0923":"Mitsubishi","0603672a0924":"NCR","0603672a0925":"e-COMM","0603672a0926":"Gemplus","0603672a0904":"RSADSI","0603672a0905":"VeriFone","0603672a0906":"TrinTech","0603672a0907":"BankGate","0603672a0908":"GTE","0603672a0909":"CompuSource","0603551d01":"authorityKeyIdentifier","0603551d0a":"basicConstraints","0603551d0b":"nameConstraints","0603551d0c":"policyConstraints","0603551d0d":"basicConstraints","0603551d0e":"subjectKeyIdentifier","0603551d0f":"keyUsage","0603551d10":"privateKeyUsagePeriod","0603551d11":"subjectAltName","0603551d12":"issuerAltName","0603551d13":"basicConstraints","0603551d02":"keyAttributes","0603551d14":"cRLNumber","0603551d15":"cRLReason","0603551d16":"expirationDate","0603551d17":"instructionCode","0603551d18":"invalidityDate","0603551d1a":"issuingDistributionPoint","0603551d1b":"deltaCRLIndicator","0603551d1c":"issuingDistributionPoint","0603551d1d":"certificateIssuer","0603551d03":"certificatePolicies","0603551d1e":"nameConstraints","0603551d1f":"cRLDistributionPoints","0603551d20":"certificatePolicies","0603551d21":"policyMappings","0603551d22":"policyConstraints","0603551d23":"authorityKeyIdentifier","0603551d24":"policyConstraints","0603551d25":"extKeyUsage","0603551d04":"keyUsageRestriction","0603551d05":"policyMapping","0603551d06":"subtreesConstraint","0603551d07":"subjectAltName","0603551d08":"issuerAltName","0603551d09":"subjectDirectoryAttributes","0603550400":"objectClass","0603550401":"aliasObjectName","060355040d":"description","060355040e":"searchGuide","060355040f":"businessCategory","0603550410":"postalAddress","0603550411":"postalCode","0603550412":"postOfficeBox","0603550413":"physicalDeliveryOfficeName","0603550402":"knowledgeInformation","0603550415":"telexNumber","0603550416":"teletexTerminalIdentifier","0603550417":"facsimileTelephoneNumber","0603550418":"x121Address","0603550419":"internationalISDNNumber","060355041a":"registeredAddress","060355041b":"destinationIndicator","060355041c":"preferredDeliveryMehtod","060355041d":"presentationAddress","060355041e":"supportedApplicationContext","060355041f":"member","0603550420":"owner","0603550421":"roleOccupant","0603550422":"seeAlso","0603550423":"userPassword","0603550424":"userCertificate","0603550425":"caCertificate","0603550426":"authorityRevocationList","0603550427":"certificateRevocationList","0603550428":"crossCertificatePair","0603550429":"givenName","0603550405":"serialNumber","0603550434":"supportedAlgorithms","0603550435":"deltaRevocationList","060355043a":"crossCertificatePair","06035508":"X.500-Algorithms","0603550801":"X.500-Alg-Encryption","060355080101":"rsa","0603604c0101":"DPC"};var Punycode={IDN:!1,run_to_ascii:function(a,b){var c=b[0];return c?punycode.ToASCII(a):punycode.encode(a)},run_to_unicode:function(a,b){var c=b[0];return c?punycode.ToUnicode(a):punycode.decode(a)}},QuotedPrintable={run_to:function(a,b){var c=QuotedPrintable.mimeEncode(a);return c=c.replace(/\r?\n|\r/g,function(){return"\r\n"}).replace(/[\t ]+$/gm,function(a){return a.replace(/ /g,"=20").replace(/\t/g,"=09")}),QuotedPrintable._addSoftLinebreaks(c,"qp")},run_from:function(a,b){var c=a.replace(/\=(?:\r?\n|$)/g,"");return QuotedPrintable.mimeDecode(c)},mimeDecode:function(a){for(var b,c,d=(a.match(/\=[\da-fA-F]{2}/g)||[]).length,e=a.length-2*d,f=new Array(e),g=0,h=0,i=a.length;h=0;c--)if(b[c].length){if(1===b[c].length&&a===b[c][0])return!0;if(2===b[c].length&&a>=b[c][0]&&a<=b[c][1])return!0}return!1},_addSoftLinebreaks:function(a,b){var c=76;return b=(b||"base64").toString().toLowerCase().trim(),"qp"===b?this._addQPSoftLinebreaks(a,c):this._addBase64SoftLinebreaks(a,c)},_addBase64SoftLinebreaks:function(a,b){return a=(a||"").toString().trim(),a.replace(new RegExp(".{"+b+"}","g"),"$&\r\n").trim()},_addQPSoftLinebreaks:function(a,b){for(var c,d,e,f=0,g=a.length,h=Math.floor(b/3),i="";fb-h&&(c=e.substr(-h).match(/[ \t\.,!\?][^ \t\.,!\?]*$/)))e=e.substr(0,e.length-(c[0].length-1));else if("\r"===e.substr(-1))e=e.substr(0,e.length-1);else if(e.match(/\=[\da-f]{0,2}$/i))for((c=e.match(/\=[\da-f]{0,1}$/i))&&(e=e.substr(0,e.length-c[0].length));e.length>3&&e.length=192)););f+e.length=65&&c<=90?(c=(c-65+d)%26,e[h]=c+65):f&&c>=97&&c<=122&&(c=(c-97+d)%26,e[h]=c+97)}return e},ROT47_AMOUNT:47,run_rot47:function(a,b){var c,d=b[0],e=a;if(d){d<0&&(d=94-Math.abs(d)%94);for(var f=0;f=33&&c<=126&&(c=(c-33+d)%94,e[f]=c+33)}return e},_rotr:function(a){var b=(1&a)<<7;return a>>1|b},_rotl:function(a){var b=a>>7&1;return 255&(a<<1|b)},_rotr_whole:function(a,b){var c,d=0,e=[];b%=8;for(var f=0;f>>0;c=g>>b|d,d=(g&Math.pow(2,b)-1)<<8-b,e.push(c)}return e[0]|=d,e},_rotl_whole:function(a,b){var c,d=0,e=[];b%=8;for(var f=a.length-1;f>=0;f--){var g=a[f];c=255&(g<>8-b&Math.pow(2,b)-1,e[f]=c}return e[a.length-1]=e[a.length-1]|d,e}},SeqUtils={DELIMITER_OPTIONS:["Line feed","CRLF","Space","Comma","Semi-colon","Colon","Nothing (separate chars)"],SORT_REVERSE:!1,SORT_ORDER:["Alphabetical (case sensitive)","Alphabetical (case insensitive)","IP address"],run_sort:function(a,b){var c=Utils.char_rep[b[0]],d=b[1],e=b[2],f=a.split(c);return"Alphabetical (case sensitive)"===e?f=f.sort():"Alphabetical (case insensitive)"===e?f=f.sort(SeqUtils._case_insensitive_sort):"IP address"===e&&(f=f.sort(SeqUtils._ip_sort)),d&&f.reverse(),f.join(c)},run_unique:function(a,b){var c=Utils.char_rep[b[0]];return a.split(c).unique().join(c)},SEARCH_TYPE:["Regex","Extended (\\n, \\t, \\x...)","Simple string"],run_count:function(a,b){var c=b[0].string,d=b[0].option;if("Regex"!==d||!c)return c?(0===d.indexOf("Extended")&&(c=Utils.parse_escaped_chars(c)),a.count(c)):0;try{var e=new RegExp(c,"gi"),f=a.match(e);return f.length}catch(a){return 0}},REVERSE_BY:["Character","Line"],run_reverse:function(a,b){if("Line"===b[0]){for(var c=[],d=[],e=[],f=0;f()\\[\\]{}\\s\\x7F-\\xFF]*(?:[.!,?]+[^.!,?;"\\x27<>()\\[\\]{}\\s\\x7F-\\xFF]+)*)?'},{name:"Domain",value:"(?:(https?):\\/\\/)?([-\\w.]+)\\.(com|net|org|biz|info|co|uk|onion|int|mobi|name|edu|gov|mil|eu|ac|ae|af|de|ca|ch|cn|cy|es|gb|hk|il|in|io|tv|me|nl|no|nz|ro|ru|tr|us|az|ir|kz|uz|pk)+"},{name:"Windows file path",value:"([A-Za-z]):\\\\((?:[A-Za-z\\d][A-Za-z\\d\\- \\x27_\\(\\)]{0,61}\\\\?)*[A-Za-z\\d][A-Za-z\\d\\- \\x27_\\(\\)]{0,61})(\\.[A-Za-z\\d]{1,6})?"},{name:"UNIX file path",value:"(?:/[A-Za-z\\d.][A-Za-z\\d\\-.]{0,61})+"},{name:"MAC address",value:"[A-Fa-f\\d]{2}(?:[:-][A-Fa-f\\d]{2}){5}"},{name:"Date (yyyy-mm-dd)",value:"((?:19|20)\\d\\d)[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])"},{name:"Date (dd/mm/yyyy)",value:"(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.]((?:19|20)\\d\\d)"},{name:"Date (mm/dd/yyyy)",value:"(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.]((?:19|20)\\d\\d)"},{name:"Strings",value:'[A-Za-z\\d/\\-:.,_$%\\x27"()<>= !\\[\\]{}@]{4,}'}],REGEX_CASE_INSENSITIVE:!0,REGEX_MULTILINE_MATCHING:!0,OUTPUT_FORMAT:["Highlight matches","List matches","List capture groups","List matches with capture groups"],DISPLAY_TOTAL:!1,run_regex:function(a,b){var c=b[1],d=b[2],e=b[3],f=b[4],g=b[5],h="g";if(d&&(h+="i"),e&&(h+="m"),!c||"^"===c||"$"===c)return Utils.escape_html(a);try{var i=new RegExp(c,h);switch(g){case"Highlight matches":return StrUtils._regex_highlight(a,i,f);case"List matches":return Utils.escape_html(StrUtils._regex_list(a,i,f,!0,!1));case"List capture groups":return Utils.escape_html(StrUtils._regex_list(a,i,f,!1,!0));case"List matches with capture groups":return Utils.escape_html(StrUtils._regex_list(a,i,f,!0,!0));default:return"Error: Invalid output format"}}catch(a){return"Invalid regex. Details: "+a.message}},CASE_SCOPE:["All","Word","Sentence","Paragraph"],run_upper:function(a,b){var c=b[0];switch(c){case"Word":return a.replace(/(\b\w)/gi,function(a){return a.toUpperCase()});case"Sentence":return a.replace(/(?:\.|^)\s*(\b\w)/gi,function(a){return a.toUpperCase()});case"Paragraph":return a.replace(/(?:\n|^)\s*(\b\w)/gi,function(a){return a.toUpperCase()});case"All":default:return a.toUpperCase()}},run_lower:function(a,b){return a.toLowerCase()},SEARCH_TYPE:["Regex","Extended (\\n, \\t, \\x...)","Simple string"],FIND_REPLACE_GLOBAL:!0,FIND_REPLACE_CASE:!1,FIND_REPLACE_MULTILINE:!0,run_find_replace:function(a,b){var c=b[0].string,d=b[0].option,e=b[1],f=b[2],g=b[3],h=b[4],i="";return f&&(i+="g"),g&&(i+="i"),h&&(i+="m"),"Regex"===d?c=new RegExp(c,i):0===d.indexOf("Extended")&&(c=Utils.parse_escaped_chars(c)),a.replace(c,e,i)},SPLIT_DELIM:",",DELIMITER_OPTIONS:["Line feed","CRLF","Space","Comma","Semi-colon","Colon","Nothing (separate chars)"],run_split:function(a,b){var c=b[0]||StrUtils.SPLIT_DELIM,d=Utils.char_rep[b[1]],e=a.split(c);return e.join(d)},run_filter:function(a,b){var c=Utils.char_rep[b[0]],d=b[2];try{var e=new RegExp(b[1])}catch(a){return"Invalid regex. Details: "+a.message}var f=function(a){return d^e.test(a)};return a.split(c).filter(f).join(c)},DIFF_SAMPLE_DELIMITER:"\\n\\n",DIFF_BY:["Character","Word","Line","Sentence","CSS","JSON"],run_diff:function(a,b){var c,d=b[0],e=b[1],f=b[2],g=b[3],h=b[4],i=a.split(d),j="";if(!i||2!==i.length)return"Incorrect number of samples, perhaps you need to modify the sample delimiter or add more samples?";switch(e){case"Character":c=JsDiff.diffChars(i[0],i[1]);break;case"Word":c=h?JsDiff.diffWords(i[0],i[1]):JsDiff.diffWordsWithSpace(i[0],i[1]);break;case"Line":c=h?JsDiff.diffTrimmedLines(i[0],i[1]):JsDiff.diffLines(i[0],i[1]);break;case"Sentence":c=JsDiff.diffSentences(i[0],i[1]);break;case"CSS":c=JsDiff.diffCss(i[0],i[1]);break;case"JSON":c=JsDiff.diffJson(i[0],i[1]);break;default:return"Invalid 'Diff by' option."}for(var k=0;k"+Utils.escape_html(c[k].value)+""):c[k].removed?g&&(j+=""+Utils.escape_html(c[k].value)+""):j+=Utils.escape_html(c[k].value);return j},OFF_CHK_SAMPLE_DELIMITER:"\\n\\n",run_offset_checker:function(a,b){var c,d=b[0],e=a.split(d),f=[],g=0,h=0,i=!1,j=!1;if(!e||e.length<2)return"Not enough samples, perhaps you need to modify the sample delimiter or add more data?";for(h=0;h"),h===e.length-1&&(j=!1)):(i&&!j?(f[h]+=""+Utils.escape_html(e[h][g]),e[h].length===g+1&&(f[h]+=""),h===e.length-1&&(j=!0)):!i&&j?(f[h]+=""+Utils.escape_html(e[h][g]),h===e.length-1&&(j=!1)):(f[h]+=Utils.escape_html(e[h][g]),j&&e[h].length===g+1&&(f[h]+="",e[h].length-1!==g&&(j=!1))),e[0].length-1===g&&(j&&(f[h]+=""),f[h]+=Utils.escape_html(e[h].substring(g+1))))}return f.join(d)},run_parse_escaped_string:function(a,b){return Utils.parse_escaped_chars(a)},_regex_highlight:function(a,b,c){for(var d,e="",f=1,g=0,h=0;d=b.exec(a);)e+=Utils.escape_html(a.slice(g,d.index)),e+=""+Utils.escape_html(d[0])+"",f=1===f?2:1,g=b.lastIndex,h++;return e+=Utils.escape_html(a.slice(g,a.length)),c&&(e="Total found: "+h+"\n\n"+e),e},_regex_list:function(a,b,c,d,e){for(var f,g="",h=0;f=b.exec(a);)if(h++,d&&(g+=f[0]+"\n"),e)for(var i=1;ih?g[i][0].length:h;for(i=0;i1&&g[i][1].length?" = "+g[i][1]+"\n":"\n"}return d}return"Invalid URI"},_encode_all_chars:function(a){return encodeURIComponent(a).replace(/!/g,"%21").replace(/#/g,"%23").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A").replace(/\-/g,"%2D").replace(/\./g,"%2E").replace(/_/g,"%5F").replace(/~/g,"%7E")}},UUID={run_generate_v4:function(a,b){if("undefined"!=typeof window.crypto&&"undefined"!=typeof window.crypto.getRandomValues){var c=new Uint32Array(4),d=0;return window.crypto.getRandomValues(c),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=c[d>>3]>>d%8*4&15,e="x"===a?b:3&b|8;return d++,e.toString(16)})}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"===a?b:3&b|8;return c.toString(16)})}},Chef=function(){this.dish=new Dish};Chef.prototype.bake=function(a,b,c,d,e){var f=(new Date).getTime(),g=new Recipe(b),h=g.contains_flow_control(),i=!1;c.hasOwnProperty("attempt_highlight")&&(c.attempt_highlight=!0),h&&(c.attempt_highlight=!1),d>=b.length&&(d=0),e&&(g.set_breakpoint(d,!1),g.set_breakpoint(d+1,!0)),d>0&&h&&(g.remove_breaks_up_to(d),d=0),0===d&&this.dish.set(a,Dish.STRING);try{d=g.execute(this.dish,d)}catch(a){i=a,d=a.progress}return{result:this.dish.type===Dish.HTML?this.dish.get(Dish.HTML):this.dish.get(Dish.STRING),type:Dish.enum_lookup(this.dish.type),progress:d,options:c,duration:(new Date).getTime()-f,error:i}},Chef.prototype.silent_bake=function(a){var b=(new Date).getTime(),c=new Recipe(a),d=new Dish("",Dish.STRING);try{c.execute(d)}catch(a){}return(new Date).getTime()-b};var Dish=function(a,b){this.value=a||"string"==typeof a?a:null,this.type=b||Dish.BYTE_ARRAY};Dish.BYTE_ARRAY=0,Dish.STRING=1,Dish.NUMBER=2,Dish.HTML=3,Dish.type_enum=function(a){switch(a){case"byte_array":case"Byte array":return Dish.BYTE_ARRAY;case"string":case"String":return Dish.STRING;case"number":case"Number":return Dish.NUMBER;case"html":case"HTML":return Dish.HTML;default:throw"Invalid data type string. No matching enum."}},Dish.enum_lookup=function(a){switch(a){case Dish.BYTE_ARRAY:return"byte_array";case Dish.STRING:return"string";case Dish.NUMBER:return"number";case Dish.HTML:return"html";default:throw"Invalid data type enum. No matching type."}},Dish.prototype.set=function(a,b){if(this.value=a,this.type=b,!this.valid()){var c=Utils.truncate(JSON.stringify(this.value),13);throw"Data is not a valid "+Dish.enum_lookup(b)+": "+c}},Dish.prototype.get=function(a){return this.type!==a&&this.translate(a),this.value},Dish.prototype.translate=function(a){switch(this.type){case Dish.STRING:this.value=this.value?Utils.str_to_byte_array(this.value):[],this.type=Dish.BYTE_ARRAY;break;case Dish.NUMBER:this.value="number"==typeof this.value?Utils.str_to_byte_array(this.value.toString()):[],this.type=Dish.BYTE_ARRAY;break;case Dish.HTML:this.value=this.value?Utils.str_to_byte_array(Utils.strip_html_tags(this.value,!0)):[],this.type=Dish.BYTE_ARRAY}switch(a){case Dish.STRING:case Dish.HTML:this.value=this.value?Utils.byte_array_to_utf8(this.value):"",this.type=Dish.STRING;break;case Dish.NUMBER:this.value=this.value?parseFloat(Utils.byte_array_to_utf8(this.value)):0,this.type=Dish.NUMBER}},Dish.prototype.valid=function(){switch(this.type){case Dish.BYTE_ARRAY:if(!(this.value instanceof Array))return!1;for(var a=0;a255)return!1;return!0;case Dish.STRING:case Dish.HTML:return"string"==typeof this.value;case Dish.NUMBER:return"number"==typeof this.value;default:return!1}};var FlowControl={FORK_DELIM:"\\n",MERGE_DELIM:"\\n",run_fork:function(a){var b=a.op_list,c=b[a.progress].input_type,d=b[a.progress].output_type,e=a.dish.get(c),f=b[a.progress].get_ing_values(),g=f[0],h=f[1],i=[],j=[];e&&(j=e.split(g));for(var k=a.progress+1;k=d)throw"Reached maximum jumps, sorry!";return a.progress+=c,a.num_jumps++,a},run_cond_jump:function(a){var b=a.op_list[a.progress].get_ing_values(),c=a.dish,d=b[0],e=b[1],f=b[2];if(a.num_jumps>=f)throw"Reached maximum jumps, sorry!";return""!==d&&c.get(Dish.STRING).search(d)>-1&&(a.progress+=e,a.num_jumps++),a},run_return:function(a){return a.progress=a.op_list.length,a}},Ingredient=function(a){this.name="",this.type="",this.value=null,a&&this._parse_config(a)};Ingredient.prototype._parse_config=function(a){this.name=a.name,this.type=a.type},Ingredient.prototype.get_config=function(){return this.value},Ingredient.prototype.set_value=function(a){this.value=Ingredient.prepare(a,this.type)},Ingredient.prepare=function(a,b){switch(b){case"binary_string":case"binary_short_string":case"editable_option":return Utils.parse_escaped_chars(a);case"byte_array":return"string"==typeof a?(a=a.replace(/\s+/g,""),Utils.hex_to_byte_array(a)):a;case"number":var c=parseFloat(a);if(isNaN(c)){var d=Utils.truncate(a.toString(),10);throw"Invalid ingredient value. Not a number: "+d}return c;default:return a}};var Operation=function(a,b){this.name=a,this.description="",this.input_type=-1,this.output_type=-1,this.run=null,this.highlight=null,this.highlight_reverse=null,this.breakpoint=!1,this.disabled=!1,this.ing_list=[],b&&this._parse_config(b)};Operation.prototype._parse_config=function(a){this.description=a.description,this.input_type=Dish.type_enum(a.input_type),this.output_type=Dish.type_enum(a.output_type),this.run=a.run,this.highlight=a.highlight,this.highlight_reverse=a.highlight_reverse,this.flow_control=a.flow_control;for(var b=0;b
                                                                                                      Message: "+i.message:i.display_str+=i.message,i}}return this.op_list.length},Recipe.prototype.to_string=function(){return JSON.stringify(this.get_config())},Recipe.prototype.from_string=function(a){var b=JSON.parse(a);this._parse_config(b)};var Categories=[{name:"Favourites",ops:[]},{name:"Data format",ops:["To Hexdump","From Hexdump","To Hex","From Hex","To Charcode","From Charcode","To Decimal","From Decimal","To Binary","From Binary","To Base64","From Base64","Show Base64 offsets","To Base32","From Base32","To Base","From Base","To HTML Entity","From HTML Entity","URL Encode","URL Decode","Unescape Unicode Characters","To Quoted Printable","From Quoted Printable","To Punycode","From Punycode","To Hex Content","From Hex Content","PEM to Hex","Hex to PEM","Parse ASN.1 hex string","Change IP format","Text encoding","Swap endianness"]},{name:"Encryption / Encoding",ops:["AES Encrypt","AES Decrypt","Blowfish Encrypt","Blowfish Decrypt","DES Encrypt","DES Decrypt","Triple DES Encrypt","Triple DES Decrypt","Rabbit Encrypt","Rabbit Decrypt","RC4","RC4 Drop","ROT13","ROT47","XOR","XOR Brute Force","Vigen\xe8re Encode","Vigen\xe8re Decode","Substitute","Derive PBKDF2 key","Derive EVP key"]},{name:"Public Key",ops:["Parse X.509 certificate","Parse ASN.1 hex string","PEM to Hex","Hex to PEM","Hex to Object Identifier","Object Identifier to Hex"]},{name:"Logical operations",ops:["XOR","XOR Brute Force","OR","NOT","AND","ADD","SUB","Rotate left","Rotate right","ROT13"]},{name:"Networking",ops:["Strip HTTP headers","Parse User Agent","Parse IP range","Parse IPv6 address","Parse URI","URL Encode","URL Decode","Format MAC addresses","Change IP format","Group IP addresses"] },{name:"Language",ops:["Text encoding","Unescape Unicode Characters"]},{name:"Utils",ops:["Diff","Remove whitespace","Remove null bytes","To Upper case","To Lower case","Add line numbers","Remove line numbers","Reverse","Sort","Unique","Split","Filter","Count occurrences","Expand alphabet range","Parse escaped string","Drop bytes","Take bytes","Pad lines","Find / Replace","Regular expression","Offset checker","Convert distance","Convert area","Convert mass","Convert speed","Convert data units","Parse UNIX file permissions","Swap endianness","Parse colour code"]},{name:"Date / Time",ops:["Parse DateTime","Translate DateTime Format","From UNIX Timestamp","To UNIX Timestamp","Extract dates"]},{name:"Extractors",ops:["Strings","Extract IP addresses","Extract email addresses","Extract MAC addresses","Extract URLs","Extract domains","Extract file paths","Extract dates","Regular expression","XPath expression","CSS selector"]},{name:"Compression",ops:["Raw Deflate","Raw Inflate","Zlib Deflate","Zlib Inflate","Gzip","Gunzip","Zip","Unzip","Bzip2 Decompress"]},{name:"Hashing",ops:["Analyse hash","Generate all hashes","MD5","SHA1","SHA224","SHA256","SHA384","SHA512","SHA3","RIPEMD-160","HMAC","Fletcher-16 Checksum","Adler-32 Checksum","CRC-32 Checksum","TCP/IP Checksum"]},{name:"Code tidy",ops:["Syntax highlighter","Generic Code Beautify","JavaScript Parser","JavaScript Beautify","JavaScript Minify","JSON Beautify","JSON Minify","XML Beautify","XML Minify","SQL Beautify","SQL Minify","CSS Beautify","CSS Minify","XPath expression","CSS selector","Strip HTML tags","Diff"]},{name:"Other",ops:["Entropy","Frequency distribution","Detect File Type","Scan for Embedded Files","Generate UUID","Numberwang"]},{name:"Flow control",ops:["Fork","Merge","Jump","Conditional Jump","Return"]}],OperationConfig={Fork:{description:"Split the input data up based on the specified delimiter and run all subsequent operations on each branch separately.

                                                                                                      For example, to decode multiple Base64 strings, enter them all on separate lines then add the 'Fork' and 'From Base64' operations to the recipe. Each string will be decoded separately.",run:FlowControl.run_fork,input_type:"string",output_type:"string",flow_control:!0,args:[{name:"Split delimiter",type:"binary_short_string",value:FlowControl.FORK_DELIM},{name:"Merge delimiter",type:"binary_short_string",value:FlowControl.MERGE_DELIM}]},Merge:{description:"Consolidate all branches back into a single trunk. The opposite of Fork.",run:FlowControl.run_merge,input_type:"string",output_type:"string",flow_control:!0,args:[]},Jump:{description:"Jump forwards or backwards over the specified number of operations.",run:FlowControl.run_jump,input_type:"string",output_type:"string",flow_control:!0,args:[{name:"Number of operations to jump over",type:"number",value:FlowControl.JUMP_NUM},{name:"Maximum jumps (if jumping backwards)",type:"number",value:FlowControl.MAX_JUMPS}]},"Conditional Jump":{description:"Conditionally jump forwards or backwards over the specified number of operations based on whether the data matches the specified regular expression.",run:FlowControl.run_cond_jump,input_type:"string",output_type:"string",flow_control:!0,args:[{name:"Match (regex)",type:"string",value:""},{name:"Number of operations to jump over if match found",type:"number",value:FlowControl.JUMP_NUM},{name:"Maximum jumps (if jumping backwards)",type:"number",value:FlowControl.MAX_JUMPS}]},Return:{description:"End execution of operations at this point in the recipe.",run:FlowControl.run_return,input_type:"string",output_type:"string",flow_control:!0,args:[]},"From Base64":{description:"Base64 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers.

                                                                                                      This operation decodes data from an ASCII Base64 string back into its raw format.

                                                                                                      e.g. aGVsbG8= becomes hello",run:Base64.run_from,highlight:Base64.highlight_from,highlight_reverse:Base64.highlight_to,input_type:"string",output_type:"byte_array",args:[{name:"Alphabet",type:"editable_option",value:Base64.ALPHABET_OPTIONS},{name:"Remove non‑alphabet chars",type:"boolean",value:Base64.REMOVE_NON_ALPH_CHARS}]},"To Base64":{description:"Base64 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers.

                                                                                                      This operation encodes data in an ASCII Base64 string.

                                                                                                      e.g. hello becomes aGVsbG8=",run:Base64.run_to,highlight:Base64.highlight_to,highlight_reverse:Base64.highlight_from,input_type:"byte_array",output_type:"string",args:[{name:"Alphabet",type:"editable_option",value:Base64.ALPHABET_OPTIONS}]},"From Base32":{description:"Base32 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers. It uses a smaller set of characters than Base64, usually the uppercase alphabet and the numbers 2 to 7.",run:Base64.run_from_32,input_type:"string",output_type:"byte_array",args:[{name:"Alphabet",type:"binary_string",value:Base64.BASE32_ALPHABET},{name:"Remove non‑alphabet chars",type:"boolean",value:Base64.REMOVE_NON_ALPH_CHARS}]},"To Base32":{description:"Base32 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers. It uses a smaller set of characters than Base64, usually the uppercase alphabet and the numbers 2 to 7.",run:Base64.run_to_32,input_type:"byte_array",output_type:"string",args:[{name:"Alphabet",type:"binary_string",value:Base64.BASE32_ALPHABET}]},"Show Base64 offsets":{description:"When a string is within a block of data and the whole block is Base64'd, the string itself could be represented in Base64 in three distinct ways depending on its offset within the block.

                                                                                                      This operation shows all possible offsets for a given string so that each possible encoding can be considered.",run:Base64.run_offsets,input_type:"byte_array",output_type:"html",args:[{name:"Alphabet",type:"binary_string",value:Base64.ALPHABET},{name:"Show variable chars and padding",type:"boolean",value:Base64.OFFSETS_SHOW_VARIABLE}]},XOR:{description:"XOR the input with the given key.
                                                                                                      e.g. fe023da5

                                                                                                      Options
                                                                                                      Null preserving: If the current byte is 0x00 or the same as the key, skip it.

                                                                                                      Scheme:
                                                                                                      • Standard - key is unchanged after each round
                                                                                                      • Input differential - key is set to the value of the previous unprocessed byte
                                                                                                      • Output differential - key is set to the value of the previous processed byte
                                                                                                      ",run:BitwiseOp.run_xor,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Key",type:"toggle_string",value:"",toggle_values:BitwiseOp.KEY_FORMAT},{name:"Scheme",type:"option",value:BitwiseOp.XOR_SCHEME},{name:"Null preserving",type:"boolean",value:BitwiseOp.XOR_PRESERVE_NULLS}]},"XOR Brute Force":{description:"Enumerate all possible XOR solutions. Current maximum key length is 2 due to browser performance.

                                                                                                      Optionally enter a regex string that you expect to find in the plaintext to filter results (crib).",run:BitwiseOp.run_xor_brute,input_type:"byte_array",output_type:"string",args:[{name:"Key length",type:"option",value:BitwiseOp.XOR_BRUTE_KEY_LENGTH},{name:"Length of sample",type:"number",value:BitwiseOp.XOR_BRUTE_SAMPLE_LENGTH},{name:"Offset of sample",type:"number",value:BitwiseOp.XOR_BRUTE_SAMPLE_OFFSET},{name:"Null preserving",type:"boolean",value:BitwiseOp.XOR_PRESERVE_NULLS},{name:"Differential",type:"boolean",value:BitwiseOp.XOR_DIFFERENTIAL},{name:"Crib (known plaintext string)",type:"binary_string",value:""},{name:"Print key",type:"boolean",value:BitwiseOp.XOR_BRUTE_PRINT_KEY},{name:"Output as hex",type:"boolean",value:BitwiseOp.XOR_BRUTE_OUTPUT_HEX}]},NOT:{description:"Returns the inverse of each byte.",run:BitwiseOp.run_not,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[]},AND:{description:"AND the input with the given key.
                                                                                                      e.g. fe023da5",run:BitwiseOp.run_and,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Key",type:"toggle_string",value:"",toggle_values:BitwiseOp.KEY_FORMAT}]},OR:{description:"OR the input with the given key.
                                                                                                      e.g. fe023da5",run:BitwiseOp.run_or,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Key",type:"toggle_string",value:"",toggle_values:BitwiseOp.KEY_FORMAT}]},ADD:{description:"ADD the input with the given key (e.g. fe023da5), MOD 255",run:BitwiseOp.run_add,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Key",type:"toggle_string",value:"",toggle_values:BitwiseOp.KEY_FORMAT}]},SUB:{description:"SUB the input with the given key (e.g. fe023da5), MOD 255",run:BitwiseOp.run_sub,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Key",type:"toggle_string",value:"",toggle_values:BitwiseOp.KEY_FORMAT}]},"From Hex":{description:"Converts a hexadecimal byte string back into a its raw value.

                                                                                                      e.g. ce 93 ce b5 ce b9 ce ac 20 cf 83 ce bf cf 85 0a becomes the UTF-8 encoded string \u0393\u03b5\u03b9\u03ac \u03c3\u03bf\u03c5",run:ByteRepr.run_from_hex,highlight:ByteRepr.highlight_from,highlight_reverse:ByteRepr.highlight_to,input_type:"string",output_type:"byte_array",args:[{name:"Delimiter",type:"option",value:ByteRepr.HEX_DELIM_OPTIONS}]},"To Hex":{description:"Converts the input string to hexadecimal bytes separated by the specified delimiter.

                                                                                                      e.g. The UTF-8 encoded string \u0393\u03b5\u03b9\u03ac \u03c3\u03bf\u03c5 becomes ce 93 ce b5 ce b9 ce ac 20 cf 83 ce bf cf 85 0a",run:ByteRepr.run_to_hex,highlight:ByteRepr.highlight_to,highlight_reverse:ByteRepr.highlight_from,input_type:"byte_array",output_type:"string",args:[{name:"Delimiter",type:"option",value:ByteRepr.HEX_DELIM_OPTIONS}]},"From Charcode":{description:"Converts unicode character codes back into text.

                                                                                                      e.g. 0393 03b5 03b9 03ac 20 03c3 03bf 03c5 becomes \u0393\u03b5\u03b9\u03ac \u03c3\u03bf\u03c5",run:ByteRepr.run_from_charcode,highlight:ByteRepr.highlight_from,highlight_reverse:ByteRepr.highlight_to,input_type:"string",output_type:"byte_array",args:[{name:"Delimiter",type:"option",value:ByteRepr.DELIM_OPTIONS},{name:"Base",type:"number",value:ByteRepr.CHARCODE_BASE}]},"To Charcode":{description:"Converts text to its unicode character code equivalent.

                                                                                                      e.g. \u0393\u03b5\u03b9\u03ac \u03c3\u03bf\u03c5 becomes 0393 03b5 03b9 03ac 20 03c3 03bf 03c5",run:ByteRepr.run_to_charcode,highlight:ByteRepr.highlight_to,highlight_reverse:ByteRepr.highlight_from,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"option",value:ByteRepr.DELIM_OPTIONS},{name:"Base",type:"number",value:ByteRepr.CHARCODE_BASE}]},"From Binary":{description:"Converts a binary string back into its raw form.

                                                                                                      e.g. 01001000 01101001 becomes Hi",run:ByteRepr.run_from_binary,highlight:ByteRepr.highlight_from_binary,highlight_reverse:ByteRepr.highlight_to_binary,input_type:"string",output_type:"byte_array",args:[{name:"Delimiter",type:"option",value:ByteRepr.BIN_DELIM_OPTIONS}]},"To Binary":{description:"Displays the input data as a binary string.

                                                                                                      e.g. Hi becomes 01001000 01101001",run:ByteRepr.run_to_binary,highlight:ByteRepr.highlight_to_binary,highlight_reverse:ByteRepr.highlight_from_binary,input_type:"byte_array",output_type:"string",args:[{name:"Delimiter",type:"option",value:ByteRepr.BIN_DELIM_OPTIONS}]},"From Decimal":{description:"Converts the data from an ordinal integer array back into its raw form.

                                                                                                      e.g. 72 101 108 108 111 becomes Hello",run:ByteRepr.run_from_decimal,input_type:"string",output_type:"byte_array",args:[{name:"Delimiter",type:"option",value:ByteRepr.DELIM_OPTIONS}]},"To Decimal":{description:"Converts the input data to an ordinal integer array.

                                                                                                      e.g. Hello becomes 72 101 108 108 111",run:ByteRepr.run_to_decimal,input_type:"byte_array",output_type:"string",args:[{name:"Delimiter",type:"option",value:ByteRepr.DELIM_OPTIONS}]},"From Hexdump":{description:"Attempts to convert a hexdump back into raw data. This operation supports many different hexdump variations, but probably not all. Make sure you verify that the data it gives you is correct before continuing analysis.",run:Hexdump.run_from,highlight:Hexdump.highlight_from,highlight_reverse:Hexdump.highlight_to,input_type:"string",output_type:"byte_array",args:[]},"To Hexdump":{description:"Creates a hexdump of the input data, displaying both the hexademinal values of each byte and an ASCII representation alongside.",run:Hexdump.run_to,highlight:Hexdump.highlight_to,highlight_reverse:Hexdump.highlight_from,input_type:"byte_array",output_type:"string",args:[{name:"Width",type:"number",value:Hexdump.WIDTH},{name:"Upper case hex",type:"boolean",value:Hexdump.UPPER_CASE},{name:"Include final length",type:"boolean",value:Hexdump.INCLUDE_FINAL_LENGTH}]},"From Base":{description:"Converts a number to decimal from a given numerical base.",run:Base.run_from,input_type:"string",output_type:"number",args:[{name:"Radix",type:"number",value:Base.DEFAULT_RADIX}]},"To Base":{description:"Converts a decimal number to a given numerical base.",run:Base.run_to,input_type:"number",output_type:"string",args:[{name:"Radix",type:"number",value:Base.DEFAULT_RADIX}]},"From HTML Entity":{description:"Converts HTML entities back to characters

                                                                                                      e.g. &amp; becomes &",run:HTML.run_from_entity,input_type:"string",output_type:"string",args:[]},"To HTML Entity":{description:"Converts characters to HTML entities

                                                                                                      e.g. & becomes &amp;",run:HTML.run_to_entity,input_type:"string",output_type:"string",args:[{name:"Convert all characters",type:"boolean",value:HTML.CONVERT_ALL},{name:"Convert to",type:"option",value:HTML.CONVERT_OPTIONS}]},"Strip HTML tags":{description:"Removes all HTML tags from the input.",run:HTML.run_strip_tags,input_type:"string",output_type:"string",args:[{name:"Remove indentation",type:"boolean",value:HTML.REMOVE_INDENTATION},{name:"Remove excess line breaks",type:"boolean",value:HTML.REMOVE_LINE_BREAKS}]},"URL Decode":{description:"Converts URI/URL percent-encoded characters back to their raw values.

                                                                                                      e.g. %3d becomes =",run:URL_.run_from,input_type:"string",output_type:"string",args:[]},"URL Encode":{description:"Encodes problematic characters into percent-encoding, a format supported by URIs/URLs.

                                                                                                      e.g. = becomes %3d",run:URL_.run_to,input_type:"string",output_type:"string",args:[{name:"Encode all special chars",type:"boolean",value:URL_.ENCODE_ALL}]},"Parse URI":{description:"Pretty prints complicated Uniform Resource Identifier (URI) strings for ease of reading. Particularly useful for Uniform Resource Locators (URLs) with a lot of arguments.",run:URL_.run_parse,input_type:"string",output_type:"string",args:[]},"Unescape Unicode Characters":{description:"Converts unicode-escaped character notation back into raw characters.

                                                                                                      Supports the prefixes:
                                                                                                      • \\u
                                                                                                      • %u
                                                                                                      • U+
                                                                                                      e.g. \\u03c3\\u03bf\\u03c5 becomes \u03c3\u03bf\u03c5",run:Unicode.run_unescape,input_type:"string",output_type:"string",args:[{name:"Prefix",type:"option",value:Unicode.PREFIXES}]},"From Quoted Printable":{description:"Converts QP-encoded text back to standard text.",run:QuotedPrintable.run_from,input_type:"string",output_type:"byte_array",args:[]},"To Quoted Printable":{description:"Quoted-Printable, or QP encoding, is an encoding using printable ASCII characters (alphanumeric and the equals sign '=') to transmit 8-bit data over a 7-bit data path or, generally, over a medium which is not 8-bit clean. It is defined as a MIME content transfer encoding for use in e-mail.

                                                                                                      QP works by using the equals sign '=' as an escape character. It also limits line length to 76, as some software has limits on line length.",run:QuotedPrintable.run_to,input_type:"byte_array",output_type:"string",args:[]},"From Punycode":{description:"Punycode is a way to represent Unicode with the limited character subset of ASCII supported by the Domain Name System.

                                                                                                      e.g. mnchen-3ya decodes to m\xfcnchen",run:Punycode.run_to_unicode,input_type:"string",output_type:"string",args:[{name:"Internationalised domain name",type:"boolean",value:Punycode.IDN}]},"To Punycode":{description:"Punycode is a way to represent Unicode with the limited character subset of ASCII supported by the Domain Name System.

                                                                                                      e.g. m\xfcnchen encodes to mnchen-3ya",run:Punycode.run_to_ascii,input_type:"string",output_type:"string",args:[{name:"Internationalised domain name",type:"boolean",value:Punycode.IDN}]},"From Hex Content":{description:"Translates hexadecimal bytes in text back to raw bytes.

                                                                                                      e.g. foo|3d|bar becomes foo=bar.",run:ByteRepr.run_from_hex_content,input_type:"string",output_type:"byte_array",args:[]},"To Hex Content":{description:"Converts special characters in a string to hexadecimal.

                                                                                                      e.g. foo=bar becomes foo|3d|bar.",run:ByteRepr.run_to_hex_content,input_type:"byte_array",output_type:"string",args:[{name:"Convert",type:"option",value:ByteRepr.HEX_CONTENT_CONVERT_WHICH},{name:"Print spaces between bytes",type:"boolean",value:ByteRepr.HEX_CONTENT_SPACES_BETWEEN_BYTES}]},"Change IP format":{description:"Convert an IP address from one format to another, e.g. 172.20.23.54 to ac141736",run:IP.run_change_ip_format,input_type:"string",output_type:"string",args:[{name:"Input format",type:"option",value:IP.IP_FORMAT_LIST},{name:"Output format",type:"option",value:IP.IP_FORMAT_LIST}]},"Parse IP range":{description:"Given a CIDR range (e.g. 10.0.0.0/24) or a hyphenated range (e.g. 10.0.0.0 - 10.0.1.0), this operation provides network information and enumerates all IP addresses in the range.

                                                                                                      IPv6 is supported but will not be enumerated.",run:IP.run_parse_ip_range,input_type:"string",output_type:"string",args:[{name:"Include network info",type:"boolean",value:IP.INCLUDE_NETWORK_INFO},{name:"Enumerate IP addresses",type:"boolean",value:IP.ENUMERATE_ADDRESSES},{name:"Allow large queries",type:"boolean",value:IP.ALLOW_LARGE_LIST}]},"Group IP addresses":{description:"Groups a list of IP addresses into subnets. Supports both IPv4 and IPv6 addresses.",run:IP.run_group_ips,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"option",value:IP.DELIM_OPTIONS},{name:"Subnet (CIDR)",type:"number",value:IP.GROUP_CIDR},{name:"Only show the subnets",type:"boolean",value:IP.GROUP_ONLY_SUBNET}]},"Parse IPv6 address":{description:"Displays the longhand and shorthand versions of a valid IPv6 address.

                                                                                                      Recognises all reserved ranges and parses encapsulated or tunnelled addresses including Teredo and 6to4.",run:IP.run_parse_ipv6,input_type:"string",output_type:"string",args:[]},"Text encoding":{description:"Translates the data between different character encodings.

                                                                                                      Supported charsets are:
                                                                                                      • UTF8
                                                                                                      • UTF16
                                                                                                      • UTF16LE (little-endian)
                                                                                                      • UTF16BE (big-endian)
                                                                                                      • Hex
                                                                                                      • Base64
                                                                                                      • Latin1 (ISO-8859-1)
                                                                                                      • Windows-1251
                                                                                                      ",run:CharEnc.run,input_type:"string",output_type:"string",args:[{name:"Input type",type:"option",value:CharEnc.IO_FORMAT},{name:"Output type",type:"option",value:CharEnc.IO_FORMAT}]},"AES Decrypt":{description:"To successfully decrypt AES, you need either:
                                                                                                      • The passphrase
                                                                                                      • Or the key and IV
                                                                                                      The IV should be the first 16 bytes of encrypted material.",run:Cipher.run_aes_dec,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Input format",type:"option",value:Cipher.IO_FORMAT1},{name:"Output format",type:"option",value:Cipher.IO_FORMAT2}]},"AES Encrypt":{description:"Input: Either enter a passphrase (which will be used to derive a key using the OpenSSL KDF) or both the key and IV.

                                                                                                      Advanced Encryption Standard (AES) is a U.S. Federal Information Processing Standard (FIPS). It was selected after a 5-year process where 15 competing designs were evaluated.

                                                                                                      AES-128, AES-192, and AES-256 are supported. The variant will be chosen based on the size of the key passed in. If a passphrase is used, a 256-bit key will be generated.",run:Cipher.run_aes_enc,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Output result",type:"option",value:Cipher.RESULT_TYPE},{name:"Output format",type:"option",value:Cipher.IO_FORMAT1}]},"DES Decrypt":{description:"To successfully decrypt DES, you need either:
                                                                                                      • The passphrase
                                                                                                      • Or the key and IV
                                                                                                      The IV should be the first 8 bytes of encrypted material.",run:Cipher.run_des_dec,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Input format",type:"option",value:Cipher.IO_FORMAT1},{name:"Output format",type:"option",value:Cipher.IO_FORMAT2}]},"DES Encrypt":{description:"Input: Either enter a passphrase (which will be used to derive a key using the OpenSSL KDF) or both the key and IV.

                                                                                                      DES is a previously dominant algorithm for encryption, and was published as an official U.S. Federal Information Processing Standard (FIPS). It is now considered to be insecure due to its small key size.",run:Cipher.run_des_enc,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Output result",type:"option",value:Cipher.RESULT_TYPE},{name:"Output format",type:"option",value:Cipher.IO_FORMAT1}]},"Triple DES Decrypt":{description:"To successfully decrypt Triple DES, you need either:
                                                                                                      • The passphrase
                                                                                                      • Or the key and IV
                                                                                                      The IV should be the first 8 bytes of encrypted material.",run:Cipher.run_triple_des_dec,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Input format",type:"option",value:Cipher.IO_FORMAT1},{name:"Output format",type:"option",value:Cipher.IO_FORMAT2}]},"Triple DES Encrypt":{description:"Input: Either enter a passphrase (which will be used to derive a key using the OpenSSL KDF) or both the key and IV.

                                                                                                      Triple DES applies DES three times to each block to increase key size.",run:Cipher.run_triple_des_enc,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Output result",type:"option",value:Cipher.RESULT_TYPE},{name:"Output format",type:"option",value:Cipher.IO_FORMAT1}]},"Blowfish Decrypt":{description:"Blowfish is a symmetric-key block cipher designed in 1993 by Bruce Schneier and included in a large number of cipher suites and encryption products. AES now receives more attention.",run:Cipher.run_blowfish_dec,input_type:"string",output_type:"string",args:[{name:"Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"Mode",type:"option",value:Cipher.BLOWFISH_MODES},{name:"Input format",type:"option",value:Cipher.IO_FORMAT3}]},"Blowfish Encrypt":{description:"Blowfish is a symmetric-key block cipher designed in 1993 by Bruce Schneier and included in a large number of cipher suites and encryption products. AES now receives more attention.",run:Cipher.run_blowfish_enc,input_type:"string",output_type:"string",args:[{name:"Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"Mode",type:"option",value:Cipher.BLOWFISH_MODES},{name:"Output format",type:"option",value:Cipher.IO_FORMAT3}]},"Rabbit Decrypt":{description:"To successfully decrypt Rabbit, you need either:
                                                                                                      • The passphrase
                                                                                                      • Or the key and IV (This is currently broken. You need the key and salt at the moment.)
                                                                                                      The IV should be the first 8 bytes of encrypted material.",run:Cipher.run_rabbit_dec,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Input format",type:"option",value:Cipher.IO_FORMAT1},{name:"Output format",type:"option",value:Cipher.IO_FORMAT2}]},"Rabbit Encrypt":{description:"Input: Either enter a passphrase (which will be used to derive a key using the OpenSSL KDF) or both the key and IV.

                                                                                                      Rabbit is a high-performance stream cipher and a finalist in the eSTREAM Portfolio. It is one of the four designs selected after a 3 1/2 year process where 22 designs were evaluated.",run:Cipher.run_rabbit_enc,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Output result",type:"option",value:Cipher.RESULT_TYPE},{name:"Output format",type:"option",value:Cipher.IO_FORMAT1}]},RC4:{description:"RC4 is a widely-used stream cipher. It is used in popular protocols such as SSL and WEP. Although remarkable for its simplicity and speed, the algorithm's history doesn't inspire confidence in its security.",run:Cipher.run_rc4,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[{name:"Passphrase",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"Input format",type:"option",value:Cipher.IO_FORMAT4},{name:"Output format",type:"option",value:Cipher.IO_FORMAT4}]},"RC4 Drop":{description:"It was discovered that the first few bytes of the RC4 keystream are strongly non-random and leak information about the key. We can defend against this attack by discarding the initial portion of the keystream. This modified algorithm is traditionally called RC4-drop.",run:Cipher.run_rc4drop,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[{name:"Passphrase",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"Input format",type:"option",value:Cipher.IO_FORMAT4},{name:"Output format",type:"option",value:Cipher.IO_FORMAT4},{name:"Number of bytes to drop",type:"number",value:Cipher.RC4DROP_BYTES}]},"Derive PBKDF2 key":{description:"PBKDF2 is a password-based key derivation function. In many applications of cryptography, user security is ultimately dependent on a password, and because a password usually can't be used directly as a cryptographic key, some processing is required.

                                                                                                      A salt provides a large set of keys for any given password, and an iteration count increases the cost of producing keys from a password, thereby also increasing the difficulty of attack.

                                                                                                      Enter your passphrase as the input and then set the relevant options to generate a key.",run:Cipher.run_pbkdf2,input_type:"string",output_type:"string",args:[{name:"Key size",type:"number",value:Cipher.KDF_KEY_SIZE},{name:"Iterations",type:"number",value:Cipher.KDF_ITERATIONS},{name:"Salt (hex)",type:"string",value:""},{name:"Input format",type:"option",value:Cipher.IO_FORMAT2},{name:"Output format",type:"option",value:Cipher.IO_FORMAT3}]},"Derive EVP key":{description:"EVP is a password-based key derivation function used extensively in OpenSSL. In many applications of cryptography, user security is ultimately dependent on a password, and because a password usually can't be used directly as a cryptographic key, some processing is required.

                                                                                                      A salt provides a large set of keys for any given password, and an iteration count increases the cost of producing keys from a password, thereby also increasing the difficulty of attack.

                                                                                                      Enter your passphrase as the input and then set the relevant options to generate a key.",run:Cipher.run_evpkdf,input_type:"string",output_type:"string",args:[{name:"Key size",type:"number",value:Cipher.KDF_KEY_SIZE},{name:"Iterations",type:"number",value:Cipher.KDF_ITERATIONS},{name:"Salt (hex)",type:"string",value:""},{name:"Input format",type:"option",value:Cipher.IO_FORMAT2},{name:"Output format",type:"option",value:Cipher.IO_FORMAT3}]},"Vigen\xe8re Encode":{description:"The Vigenere cipher is a method of encrypting alphabetic text by using a series of different Caesar ciphers based on the letters of a keyword. It is a simple form of polyalphabetic substitution.",run:Cipher.run_vigenere_enc,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[{name:"Key",type:"string",value:""}]},"Vigen\xe8re Decode":{description:"The Vigenere cipher is a method of encrypting alphabetic text by using a series of different Caesar ciphers based on the letters of a keyword. It is a simple form of polyalphabetic substitution.",run:Cipher.run_vigenere_dec,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[{name:"Key",type:"string",value:""}]},"Rotate right":{description:"Rotates each byte to the right by the number of bits specified. Currently only supports 8-bit values.",run:Rotate.run_rotr,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Number of bits",type:"number",value:Rotate.ROTATE_AMOUNT},{name:"Rotate as a whole",type:"boolean",value:Rotate.ROTATE_WHOLE}]},"Rotate left":{description:"Rotates each byte to the left by the number of bits specified. Currently only supports 8-bit values.",run:Rotate.run_rotl,highlight:!0, highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Number of bits",type:"number",value:Rotate.ROTATE_AMOUNT},{name:"Rotate as a whole",type:"boolean",value:Rotate.ROTATE_WHOLE}]},ROT13:{description:"A simple caesar substitution cipher which rotates alphabet characters by the specified amount (default 13).",run:Rotate.run_rot13,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Rotate lower case chars",type:"boolean",value:Rotate.ROT13_LOWERCASE},{name:"Rotate upper case chars",type:"boolean",value:Rotate.ROT13_UPPERCASE},{name:"Amount",type:"number",value:Rotate.ROT13_AMOUNT}]},ROT47:{description:"A slightly more complex variation of a caesar cipher, which includes ASCII characters from 33 '!' to 126 '~'. Default rotation: 47.",run:Rotate.run_rot47,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Amount",type:"number",value:Rotate.ROT47_AMOUNT}]},"Strip HTTP headers":{description:"Removes HTTP headers from a request or response by looking for the first instance of a double newline.",run:HTTP.run_strip_headers,input_type:"string",output_type:"string",args:[]},"Parse User Agent":{description:"Attempts to identify and categorise information contained in a user-agent string.",run:HTTP.run_parse_user_agent,input_type:"string",output_type:"string",args:[]},"Format MAC addresses":{description:"Displays given MAC addresses in multiple different formats.

                                                                                                      Expects addresses in a list separated by newlines, spaces or commas.

                                                                                                      WARNING: There are no validity checks.",run:MAC.run_format,input_type:"string",output_type:"string",args:[{name:"Output case",type:"option",value:MAC.OUTPUT_CASE},{name:"No delimiter",type:"boolean",value:MAC.NO_DELIM},{name:"Dash delimiter",type:"boolean",value:MAC.DASH_DELIM},{name:"Colon delimiter",type:"boolean",value:MAC.COLON_DELIM},{name:"Cisco style",type:"boolean",value:MAC.CISCO_STYLE}]},"Offset checker":{description:"Compares multiple inputs (separated by the specified delimiter) and highlights matching characters which appear at the same position in all samples.",run:StrUtils.run_offset_checker,input_type:"string",output_type:"html",args:[{name:"Sample delimiter",type:"binary_string",value:StrUtils.OFF_CHK_SAMPLE_DELIMITER}]},"Remove whitespace":{description:"Optionally removes all spaces, carriage returns, line feeds, tabs and form feeds from the input data.

                                                                                                      This operation also supports the removal of full stops which are sometimes used to represent non-printable bytes in ASCII output.",run:Tidy.run_remove_whitespace,input_type:"string",output_type:"string",args:[{name:"Spaces",type:"boolean",value:Tidy.REMOVE_SPACES},{name:"Carriage returns (\\r)",type:"boolean",value:Tidy.REMOVE_CARIAGE_RETURNS},{name:"Line feeds (\\n)",type:"boolean",value:Tidy.REMOVE_LINE_FEEDS},{name:"Tabs",type:"boolean",value:Tidy.REMOVE_TABS},{name:"Form feeds (\\f)",type:"boolean",value:Tidy.REMOVE_FORM_FEEDS},{name:"Full stops",type:"boolean",value:Tidy.REMOVE_FULL_STOPS}]},"Remove null bytes":{description:"Removes all null bytes (0x00) from the input.",run:Tidy.run_remove_nulls,input_type:"byte_array",output_type:"byte_array",args:[]},"Drop bytes":{description:"Cuts the specified number of bytes out of the data.",run:Tidy.run_drop_bytes,input_type:"byte_array",output_type:"byte_array",args:[{name:"Start",type:"number",value:Tidy.DROP_START},{name:"Length",type:"number",value:Tidy.DROP_LENGTH},{name:"Apply to each line",type:"boolean",value:Tidy.APPLY_TO_EACH_LINE}]},"Take bytes":{description:"Takes a slice of the specified number of bytes from the data.",run:Tidy.run_take_bytes,input_type:"byte_array",output_type:"byte_array",args:[{name:"Start",type:"number",value:Tidy.TAKE_START},{name:"Length",type:"number",value:Tidy.TAKE_LENGTH},{name:"Apply to each line",type:"boolean",value:Tidy.APPLY_TO_EACH_LINE}]},"Pad lines":{description:"Add the specified number of the specified character to the beginning or end of each line",run:Tidy.run_pad,input_type:"string",output_type:"string",args:[{name:"Position",type:"option",value:Tidy.PAD_POSITION},{name:"Length",type:"number",value:Tidy.PAD_LENGTH},{name:"Character",type:"binary_short_string",value:Tidy.PAD_CHAR}]},Reverse:{description:"Reverses the input string.",run:SeqUtils.run_reverse,input_type:"byte_array",output_type:"byte_array",args:[{name:"By",type:"option",value:SeqUtils.REVERSE_BY}]},Sort:{description:"Alphabetically sorts strings separated by the specified delimiter.

                                                                                                      The IP address option supports IPv4 only.",run:SeqUtils.run_sort,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"option",value:SeqUtils.DELIMITER_OPTIONS},{name:"Reverse",type:"boolean",value:SeqUtils.SORT_REVERSE},{name:"Order",type:"option",value:SeqUtils.SORT_ORDER}]},Unique:{description:"Removes duplicate strings from the input.",run:SeqUtils.run_unique,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"option",value:SeqUtils.DELIMITER_OPTIONS}]},"Count occurrences":{description:"Counts the number of times the provided string occurs in the input.",run:SeqUtils.run_count,input_type:"string",output_type:"number",args:[{name:"Search string",type:"toggle_string",value:"",toggle_values:SeqUtils.SEARCH_TYPE}]},"Add line numbers":{description:"Adds line numbers to the output.",run:SeqUtils.run_add_line_numbers,input_type:"string",output_type:"string",args:[]},"Remove line numbers":{description:"Removes line numbers from the output if they can be trivially detected.",run:SeqUtils.run_remove_line_numbers,input_type:"string",output_type:"string",args:[]},"Find / Replace":{description:"Replaces all occurrences of the first string with the second.

                                                                                                      The three match options are only relevant to regex search strings.",run:StrUtils.run_find_replace,manual_bake:!0,input_type:"string",output_type:"string",args:[{name:"Find",type:"toggle_string",value:"",toggle_values:StrUtils.SEARCH_TYPE},{name:"Replace",type:"binary_string",value:""},{name:"Global match",type:"boolean",value:StrUtils.FIND_REPLACE_GLOBAL},{name:"Case insensitive",type:"boolean",value:StrUtils.FIND_REPLACE_CASE},{name:"Multiline matching",type:"boolean",value:StrUtils.FIND_REPLACE_MULTILINE}]},"To Upper case":{description:"Converts the input string to upper case, optionally limiting scope to only the first character in each word, sentence or paragraph.",run:StrUtils.run_upper,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[{name:"Scope",type:"option",value:StrUtils.CASE_SCOPE}]},"To Lower case":{description:"Converts every character in the input to lower case.",run:StrUtils.run_lower,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[]},Split:{description:"Splits a string into sections around a given delimiter.",run:StrUtils.run_split,input_type:"string",output_type:"string",args:[{name:"Split delimiter",type:"binary_short_string",value:StrUtils.SPLIT_DELIM},{name:"Join delimiter",type:"option",value:StrUtils.DELIMITER_OPTIONS}]},Filter:{description:"Splits up the input using the specified delimiter and then filters each branch based on a regular expression.",run:StrUtils.run_filter,manual_bake:!0,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"option",value:StrUtils.DELIMITER_OPTIONS},{name:"Regex",type:"string",value:""},{name:"Invert condition",type:"boolean",value:SeqUtils.SORT_REVERSE}]},Strings:{description:"Extracts all strings from the input.",run:Extract.run_strings,input_type:"string",output_type:"string",args:[{name:"Minimum length",type:"number",value:Extract.MIN_STRING_LEN},{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract IP addresses":{description:"Extracts all IPv4 and IPv6 addresses.

                                                                                                      Warning: Given a string 710.65.0.456, this will match 10.65.0.45 so always check the original input!",run:Extract.run_ip,input_type:"string",output_type:"string",args:[{name:"IPv4",type:"boolean",value:Extract.INCLUDE_IPV4},{name:"IPv6",type:"boolean",value:Extract.INCLUDE_IPV6},{name:"Remove local IPv4 addresses",type:"boolean",value:Extract.REMOVE_LOCAL},{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract email addresses":{description:"Extracts all email addresses from the input.",run:Extract.run_email,input_type:"string",output_type:"string",args:[{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract MAC addresses":{description:"Extracts all Media Access Control (MAC) addresses from the input.",run:Extract.run_mac,input_type:"string",output_type:"string",args:[{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract URLs":{description:"Extracts Uniform Resource Locators (URLs) from the input. The protocol (http, ftp etc.) is required otherwise there will be far too many false positives.",run:Extract.run_urls,input_type:"string",output_type:"string",args:[{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract domains":{description:"Extracts domain names with common Top-Level Domains (TLDs).
                                                                                                      Note that this will not include paths. Use Extract URLs to find entire URLs.",run:Extract.run_domains,input_type:"string",output_type:"string",args:[{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract file paths":{description:"Extracts anything that looks like a Windows or UNIX file path.

                                                                                                      Note that if UNIX is selected, there will likely be a lot of false positives.",run:Extract.run_file_paths,input_type:"string",output_type:"string",args:[{name:"Windows",type:"boolean",value:Extract.INCLUDE_WIN_PATH},{name:"UNIX",type:"boolean",value:Extract.INCLUDE_UNIX_PATH},{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract dates":{description:"Extracts dates in the following formats
                                                                                                      • yyyy-mm-dd
                                                                                                      • dd/mm/yyyy
                                                                                                      • mm/dd/yyyy
                                                                                                      Dividers can be any of /, -, . or space",run:Extract.run_dates,input_type:"string",output_type:"string",args:[{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Regular expression":{description:"Define your own regular expression to search the input data with, optionally choosing from a list of pre-defined patterns.",run:StrUtils.run_regex,manual_bake:!0,input_type:"string",output_type:"html",args:[{name:"Built in regexes",type:"populate_option",value:StrUtils.REGEX_PRE_POPULATE,target:1},{name:"Regex",type:"text",value:""},{name:"Case insensitive",type:"boolean",value:StrUtils.REGEX_CASE_INSENSITIVE},{name:"Multiline matching",type:"boolean",value:StrUtils.REGEX_MULTILINE_MATCHING},{name:"Display total",type:"boolean",value:StrUtils.DISPLAY_TOTAL},{name:"Output format",type:"option",value:StrUtils.OUTPUT_FORMAT}]},"XPath expression":{description:"Extract information from an XML document with an XPath query",run:Code.run_xpath,input_type:"string",output_type:"string",args:[{name:"XPath",type:"string",value:Code.XPATH_INITIAL},{name:"Result delimiter",type:"binary_short_string",value:Code.XPATH_DELIMITER}]},"CSS selector":{description:"Extract information from an HTML document with a CSS selector",run:Code.run_css_query,input_type:"string",output_type:"string",args:[{name:"CSS selector",type:"string",value:Code.CSS_SELECTOR_INITIAL},{name:"Delimiter",type:"binary_short_string",value:Code.CSS_QUERY_DELIMITER}]},"From UNIX Timestamp":{description:"Converts a UNIX timestamp to a datetime string.

                                                                                                      e.g. 978346800 becomes Mon 1 January 2001 11:00:00 UTC",run:DateTime.run_from_unix_timestamp,input_type:"number",output_type:"string",args:[{name:"Units",type:"option",value:DateTime.UNITS}]},"To UNIX Timestamp":{description:"Parses a datetime string and returns the corresponding UNIX timestamp.

                                                                                                      e.g. Mon 1 January 2001 11:00:00 UTC becomes 978346800",run:DateTime.run_to_unix_timestamp,input_type:"string",output_type:"number",args:[{name:"Units",type:"option",value:DateTime.UNITS}]},"Translate DateTime Format":{description:"Parses a datetime string in one format and re-writes it in another.

                                                                                                      Run with no input to see the relevant format string examples.",run:DateTime.run_translate_format,input_type:"string",output_type:"html",args:[{name:"Built in formats",type:"populate_option",value:DateTime.DATETIME_FORMATS,target:1},{name:"Input format string",type:"binary_string",value:DateTime.INPUT_FORMAT_STRING},{name:"Input timezone",type:"option",value:DateTime.TIMEZONES},{name:"Output format string",type:"binary_string",value:DateTime.OUTPUT_FORMAT_STRING},{name:"Output timezone",type:"option",value:DateTime.TIMEZONES}]},"Parse DateTime":{description:"Parses a DateTime string in your specified format and displays it in whichever timezone you choose with the following information:
                                                                                                      • Date
                                                                                                      • Time
                                                                                                      • Period (AM/PM)
                                                                                                      • Timezone
                                                                                                      • UTC offset
                                                                                                      • Daylight Saving Time
                                                                                                      • Leap year
                                                                                                      • Days in this month
                                                                                                      • Day of year
                                                                                                      • Week number
                                                                                                      • Quarter
                                                                                                      Run with no input to see format string examples if required.",run:DateTime.run_parse,input_type:"string",output_type:"html",args:[{name:"Built in formats",type:"populate_option",value:DateTime.DATETIME_FORMATS,target:1},{name:"Input format string",type:"binary_string",value:DateTime.INPUT_FORMAT_STRING},{name:"Input timezone",type:"option",value:DateTime.TIMEZONES}]},"Convert distance":{description:"Converts a unit of distance to another format.",run:Convert.run_distance,input_type:"number",output_type:"number",args:[{name:"Input units",type:"option",value:Convert.DISTANCE_UNITS},{name:"Output units",type:"option",value:Convert.DISTANCE_UNITS}]},"Convert area":{description:"Converts a unit of area to another format.",run:Convert.run_area,input_type:"number",output_type:"number",args:[{name:"Input units",type:"option",value:Convert.AREA_UNITS},{name:"Output units",type:"option",value:Convert.AREA_UNITS}]},"Convert mass":{description:"Converts a unit of mass to another format.",run:Convert.run_mass,input_type:"number",output_type:"number",args:[{name:"Input units",type:"option",value:Convert.MASS_UNITS},{name:"Output units",type:"option",value:Convert.MASS_UNITS}]},"Convert speed":{description:"Converts a unit of speed to another format.",run:Convert.run_speed,input_type:"number",output_type:"number",args:[{name:"Input units",type:"option",value:Convert.SPEED_UNITS},{name:"Output units",type:"option",value:Convert.SPEED_UNITS}]},"Convert data units":{description:"Converts a unit of data to another format.",run:Convert.run_data_size,input_type:"number",output_type:"number",args:[{name:"Input units",type:"option",value:Convert.DATA_UNITS},{name:"Output units",type:"option",value:Convert.DATA_UNITS}]},"Raw Deflate":{description:"Compresses data using the deflate algorithm with no headers.",run:Compress.run_raw_deflate,input_type:"byte_array",output_type:"byte_array",args:[{name:"Compression type",type:"option",value:Compress.COMPRESSION_TYPE}]},"Raw Inflate":{description:"Decompresses data which has been compressed using the deflate algorithm with no headers.",run:Compress.run_raw_inflate,input_type:"byte_array",output_type:"byte_array",args:[{name:"Start index",type:"number",value:Compress.INFLATE_INDEX},{name:"Initial output buffer size",type:"number",value:Compress.INFLATE_BUFFER_SIZE},{name:"Buffer expansion type",type:"option",value:Compress.INFLATE_BUFFER_TYPE},{name:"Resize buffer after decompression",type:"boolean",value:Compress.INFLATE_RESIZE},{name:"Verify result",type:"boolean",value:Compress.INFLATE_VERIFY}]},"Zlib Deflate":{description:"Compresses data using the deflate algorithm adding zlib headers.",run:Compress.run_zlib_deflate,input_type:"byte_array",output_type:"byte_array",args:[{name:"Compression type",type:"option",value:Compress.COMPRESSION_TYPE}]},"Zlib Inflate":{description:"Decompresses data which has been compressed using the deflate algorithm with zlib headers.",run:Compress.run_zlib_inflate,input_type:"byte_array",output_type:"byte_array",args:[{name:"Start index",type:"number",value:Compress.INFLATE_INDEX},{name:"Initial output buffer size",type:"number",value:Compress.INFLATE_BUFFER_SIZE},{name:"Buffer expansion type",type:"option",value:Compress.INFLATE_BUFFER_TYPE},{name:"Resize buffer after decompression",type:"boolean",value:Compress.INFLATE_RESIZE},{name:"Verify result",type:"boolean",value:Compress.INFLATE_VERIFY}]},Gzip:{description:"Compresses data using the deflate algorithm with gzip headers.",run:Compress.run_gzip,input_type:"byte_array",output_type:"byte_array",args:[{name:"Compression type",type:"option",value:Compress.COMPRESSION_TYPE},{name:"Filename (optional)",type:"string",value:""},{name:"Comment (optional)",type:"string",value:""},{name:"Include file checksum",type:"boolean",value:Compress.GZIP_CHECKSUM}]},Gunzip:{description:"Decompresses data which has been compressed using the deflate algorithm with gzip headers.",run:Compress.run_gunzip,input_type:"byte_array",output_type:"byte_array",args:[]},Zip:{description:"Compresses data using the PKZIP algorithm with the given filename.

                                                                                                      No support for multiple files at this time.",run:Compress.run_pkzip,input_type:"byte_array",output_type:"byte_array",args:[{name:"Filename",type:"string",value:Compress.PKZIP_FILENAME},{name:"Comment",type:"string",value:""},{name:"Password",type:"binary_string",value:""},{name:"Compression method",type:"option",value:Compress.COMPRESSION_METHOD},{name:"Operating system",type:"option",value:Compress.OS},{name:"Compression type",type:"option",value:Compress.COMPRESSION_TYPE}]},Unzip:{description:"Decompresses data using the PKZIP algorithm and displays it per file, with support for passwords.",run:Compress.run_pkunzip,input_type:"byte_array",output_type:"html",args:[{name:"Password",type:"binary_string",value:""},{name:"Verify result",type:"boolean",value:Compress.PKUNZIP_VERIFY}]},"Bzip2 Decompress":{description:"Decompresses data using the Bzip2 algorithm.",run:Compress.run_bzip2_decompress,input_type:"byte_array",output_type:"string",args:[]},"Generic Code Beautify":{description:"Attempts to pretty print C-style languages such as C, C++, C#, Java, PHP, JavaScript etc.

                                                                                                      This will not do a perfect job, and the resulting code may not work any more. This operation is designed purely to make obfuscated or minified code more easy to read and understand.

                                                                                                      Things which will not work properly:
                                                                                                      • For loop formatting
                                                                                                      • Do-While loop formatting
                                                                                                      • Switch/Case indentation
                                                                                                      • Certain bit shift operators
                                                                                                      ",run:Code.run_generic_beautify,input_type:"string",output_type:"string",args:[]},"JavaScript Parser":{description:"Returns an Abstract Syntax Tree for valid JavaScript code.",run:JS.run_parse,input_type:"string",output_type:"string",args:[{name:"Location info",type:"boolean",value:JS.PARSE_LOC},{name:"Range info",type:"boolean",value:JS.PARSE_RANGE},{name:"Include tokens array",type:"boolean",value:JS.PARSE_TOKENS},{name:"Include comments array",type:"boolean",value:JS.PARSE_COMMENT},{name:"Report errors and try to continue",type:"boolean",value:JS.PARSE_TOLERANT}]},"JavaScript Beautify":{description:"Parses and pretty prints valid JavaScript code. Also works with JavaScript Object Notation (JSON).",run:JS.run_beautify,input_type:"string",output_type:"string",args:[{name:"Indent string",type:"binary_short_string",value:JS.BEAUTIFY_INDENT},{name:"Quotes",type:"option",value:JS.BEAUTIFY_QUOTES},{name:"Semicolons before closing braces",type:"boolean",value:JS.BEAUTIFY_SEMICOLONS},{name:"Include comments",type:"boolean",value:JS.BEAUTIFY_COMMENT}]},"JavaScript Minify":{description:"Compresses JavaScript code.",run:JS.run_minify,input_type:"string",output_type:"string",args:[]},"XML Beautify":{description:"Indents and prettifies eXtensible Markup Language (XML) code.",run:Code.run_xml_beautify,input_type:"string",output_type:"string",args:[{name:"Indent string",type:"binary_short_string",value:Code.BEAUTIFY_INDENT}]},"JSON Beautify":{description:"Indents and prettifies JavaScript Object Notation (JSON) code.",run:Code.run_json_beautify,input_type:"string",output_type:"string",args:[{name:"Indent string",type:"binary_short_string",value:Code.BEAUTIFY_INDENT}]},"CSS Beautify":{description:"Indents and prettifies Cascading Style Sheets (CSS) code.",run:Code.run_css_beautify,input_type:"string",output_type:"string",args:[{name:"Indent string",type:"binary_short_string",value:Code.BEAUTIFY_INDENT}]},"SQL Beautify":{description:"Indents and prettifies Structured Query Language (SQL) code.",run:Code.run_sql_beautify,input_type:"string",output_type:"string",args:[{name:"Indent string",type:"binary_short_string",value:Code.BEAUTIFY_INDENT}]},"XML Minify":{description:"Compresses eXtensible Markup Language (XML) code.",run:Code.run_xml_minify,input_type:"string",output_type:"string",args:[{name:"Preserve comments",type:"boolean",value:Code.PRESERVE_COMMENTS}]},"JSON Minify":{description:"Compresses JavaScript Object Notation (JSON) code.",run:Code.run_json_minify,input_type:"string",output_type:"string",args:[]},"CSS Minify":{description:"Compresses Cascading Style Sheets (CSS) code.",run:Code.run_css_minify,input_type:"string",output_type:"string",args:[{name:"Preserve comments",type:"boolean",value:Code.PRESERVE_COMMENTS}]},"SQL Minify":{description:"Compresses Structured Query Language (SQL) code.",run:Code.run_sql_minify,input_type:"string",output_type:"string",args:[]},"Analyse hash":{description:"Tries to determine information about a given hash and suggests which algorithm may have been used to generate it based on its length.",run:Hash.run_analyse,input_type:"string",output_type:"string",args:[]},MD5:{description:"MD5 (Message-Digest 5) is a widely used hash function. It has been used in a variety of security applications and is also commonly used to check the integrity of files.

                                                                                                      However, MD5 is not collision resistant and it isn't suitable for applications like SSL/TLS certificates or digital signatures that rely on this property.",run:Hash.run_md5,input_type:"string",output_type:"string",args:[]},SHA1:{description:"The SHA (Secure Hash Algorithm) hash functions were designed by the NSA. SHA-1 is the most established of the existing SHA hash functions and it is used in a variety of security applications and protocols.

                                                                                                      However, SHA-1's collision resistance has been weakening as new attacks are discovered or improved.",run:Hash.run_sha1,input_type:"string",output_type:"string",args:[]},SHA224:{description:"SHA-224 is largely identical to SHA-256 but is truncated to 224 bytes.",run:Hash.run_sha224,input_type:"string",output_type:"string",args:[]},SHA256:{description:"SHA-256 is one of the four variants in the SHA-2 set. It isn't as widely used as SHA-1, though it provides much better security.",run:Hash.run_sha256,input_type:"string",output_type:"string",args:[]},SHA384:{description:"SHA-384 is largely identical to SHA-512 but is truncated to 384 bytes.",run:Hash.run_sha384,input_type:"string",output_type:"string",args:[]},SHA512:{description:"SHA-512 is largely identical to SHA-256 but operates on 64-bit words rather than 32.",run:Hash.run_sha512,input_type:"string",output_type:"string",args:[]},SHA3:{description:"This is an implementation of Keccak[c=2d]. SHA3 functions based on different implementations of Keccak will give different results.",run:Hash.run_sha3,input_type:"string",output_type:"string",args:[{name:"Output length",type:"option",value:Hash.SHA3_LENGTH}]},"RIPEMD-160":{description:"RIPEMD (RACE Integrity Primitives Evaluation Message Digest) is a family of cryptographic hash functions developed in Leuven, Belgium, by Hans Dobbertin, Antoon Bosselaers and Bart Preneel at the COSIC research group at the Katholieke Universiteit Leuven, and first published in 1996.

                                                                                                      RIPEMD was based upon the design principles used in MD4, and is similar in performance to the more popular SHA-1.

                                                                                                      RIPEMD-160 is an improved, 160-bit version of the original RIPEMD, and the most common version in the family.",run:Hash.run_ripemd160,input_type:"string",output_type:"string",args:[]},HMAC:{description:"Keyed-Hash Message Authentication Codes (HMAC) are a mechanism for message authentication using cryptographic hash functions.",run:Hash.run_hmac,input_type:"string",output_type:"string",args:[{name:"Password",type:"binary_string",value:""},{name:"Hashing function",type:"option",value:Hash.HMAC_FUNCTIONS}]},"Fletcher-16 Checksum":{description:"The Fletcher checksum is an algorithm for computing a position-dependent checksum devised by John Gould Fletcher at Lawrence Livermore Labs in the late 1970s.

                                                                                                      The objective of the Fletcher checksum was to provide error-detection properties approaching those of a cyclic redundancy check but with the lower computational effort associated with summation techniques.",run:Checksum.run_fletcher16,input_type:"byte_array",output_type:"string",args:[]},"Adler-32 Checksum":{description:"Adler-32 is a checksum algorithm which was invented by Mark Adler in 1995, and is a modification of the Fletcher checksum. Compared to a cyclic redundancy check of the same length, it trades reliability for speed (preferring the latter).

                                                                                                      Adler-32 is more reliable than Fletcher-16, and slightly less reliable than Fletcher-32.",run:Checksum.run_adler32,input_type:"byte_array",output_type:"string",args:[]},"CRC-32 Checksum":{description:"A cyclic redundancy check (CRC) is an error-detecting code commonly used in digital networks and storage devices to detect accidental changes to raw data.

                                                                                                      The CRC was invented by W. Wesley Peterson in 1961; the 32-bit CRC function of Ethernet and many other standards is the work of several researchers and was published in 1975.",run:Checksum.run_crc32,input_type:"byte_array",output_type:"string",args:[]},"Generate all hashes":{description:"Generates all available hashes and checksums for the input.",run:Hash.run_all,input_type:"string",output_type:"string",args:[]},Entropy:{description:"Calculates the Shannon entropy of the input data which gives an idea of its randomness. 8 is the maximum.",run:Entropy.run_entropy,input_type:"byte_array",output_type:"html",args:[{name:"Chunk size",type:"number",value:Entropy.CHUNK_SIZE}]},"Frequency distribution":{description:"Displays the distribution of bytes in the data as a graph.",run:Entropy.run_freq_distrib,input_type:"byte_array",output_type:"html",args:[{name:"Show 0%'s",type:"boolean",value:Entropy.FREQ_ZEROS}]},Numberwang:{description:"Based on the popular gameshow by Mitchell and Webb.",run:Numberwang.run,input_type:"string",output_type:"string",args:[]},"Parse X.509 certificate":{description:"X.509 is an ITU-T standard for a public key infrastructure (PKI) and Privilege Management Infrastructure (PMI). It is commonly involved with SSL/TLS security.

                                                                                                      This operation displays the contents of a certificate in a human readable format, similar to the openssl command line tool.",run:PublicKey.run_parse_x509,input_type:"string",output_type:"string",args:[{name:"Input format",type:"option",value:PublicKey.X509_INPUT_FORMAT}]},"PEM to Hex":{description:"Converts PEM (Privacy Enhanced Mail) format to a hexadecimal DER (Distinguished Encoding Rules) string.",run:PublicKey.run_pem_to_hex,input_type:"string",output_type:"string",args:[]},"Hex to PEM":{description:"Converts a hexadecimal DER (Distinguished Encoding Rules) string into PEM (Privacy Enhanced Mail) format.",run:PublicKey.run_hex_to_pem,input_type:"string",output_type:"string",args:[{name:"Header string",type:"string",value:PublicKey.PEM_HEADER_STRING}]},"Hex to Object Identifier":{description:"Converts a hexadecimal string into an object identifier (OID).",run:PublicKey.run_hex_to_object_identifier,input_type:"string",output_type:"string",args:[]},"Object Identifier to Hex":{description:"Converts an object identifier (OID) into a hexadecimal string.",run:PublicKey.run_object_identifier_to_hex,input_type:"string",output_type:"string",args:[]},"Parse ASN.1 hex string":{description:"Abstract Syntax Notation One (ASN.1) is a standard and notation that describes rules and structures for representing, encoding, transmitting, and decoding data in telecommunications and computer networking.

                                                                                                      This operation parses arbitrary ASN.1 data and presents the resulting tree.",run:PublicKey.run_parse_asn1_hex_string,input_type:"string",output_type:"string",args:[{name:"Starting index",type:"number",value:0},{name:"Truncate octet strings longer than",type:"number",value:PublicKey.ASN1_TRUNCATE_LENGTH}]},"Detect File Type":{description:"Attempts to guess the MIME (Multipurpose Internet Mail Extensions) type of the data based on 'magic bytes'.

                                                                                                      Currently supports the following file types: 7z, amr, avi, bmp, bz2, class, cr2, crx, dex, dmg, doc, elf, eot, epub, exe, flac, flv, gif, gz, ico, iso, jpg, jxr, m4a, m4v, mid, mkv, mov, mp3, mp4, mpg, ogg, otf, pdf, png, ppt, ps, psd, rar, rtf, sqlite, swf, tar, tar.z, tif, ttf, utf8, vmdk, wav, webm, webp, wmv, woff, woff2, xls, xz, zip.",run:FileType.run_detect,input_type:"byte_array",output_type:"string",args:[]},"Scan for Embedded Files":{description:"Scans the data for potential embedded files by looking for magic bytes at all offsets. This operation is prone to false positives.

                                                                                                      WARNING: Files over about 100KB in size will take a VERY long time to process.",run:FileType.run_scan_for_embedded_files,input_type:"byte_array",output_type:"string",args:[{name:"Ignore common byte sequences",type:"boolean",value:FileType.IGNORE_COMMON_BYTE_SEQUENCES}]},"Expand alphabet range":{description:"Expand an alphabet range string into a list of the characters in that range.

                                                                                                      e.g. a-z becomes abcdefghijklmnopqrstuvwxyz.",run:SeqUtils.run_expand_alph_range,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"binary_string",value:""}]},Diff:{description:"Compares two inputs (separated by the specified delimiter) and highlights the differences between them.",run:StrUtils.run_diff,input_type:"string",output_type:"html",args:[{name:"Sample delimiter",type:"binary_string",value:StrUtils.DIFF_SAMPLE_DELIMITER},{name:"Diff by",type:"option",value:StrUtils.DIFF_BY},{name:"Show added",type:"boolean",value:!0},{name:"Show removed",type:"boolean",value:!0},{name:"Ignore whitespace (relevant for word and line)",type:"boolean",value:!1}]},"Parse UNIX file permissions":{description:"Given a UNIX/Linux file permission string in octal or textual format, this operation explains which permissions are granted to which user groups.

                                                                                                      Input should be in either octal (e.g. 755) or textual (e.g. drwxr-xr-x) format.",run:OS.run_parse_unix_perms,input_type:"string",output_type:"string",args:[]},"Swap endianness":{description:"Switches the data from big-endian to little-endian or vice-versa. Data can be read in as hexadecimal or raw bytes. It will be returned in the same format as it is entered.",run:Endian.run_swap_endianness,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[{name:"Data format",type:"option",value:Endian.DATA_FORMAT},{name:"Word length (bytes)",type:"number",value:Endian.WORD_LENGTH},{name:"Pad incomplete words",type:"boolean",value:Endian.PAD_INCOMPLETE_WORDS}]},"Syntax highlighter":{description:"Adds syntax highlighting to a range of source code languages. Note that this will not indent the code. Use one of the 'Beautify' operations for that.",run:Code.run_syntax_highlight,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"html",args:[{name:"Language/File extension",type:"option",value:Code.LANGUAGES},{name:"Display line numbers",type:"boolean",value:Code.LINE_NUMS}]},"Parse escaped string":{description:"Replaces escaped characters with the bytes they represent.

                                                                                                      e.g.Hello\\nWorld becomes Hello
                                                                                                      World
                                                                                                      ", -run:StrUtils.run_parse_escaped_string,input_type:"string",output_type:"string",args:[]},"TCP/IP Checksum":{description:"Calculates the checksum for a TCP (Transport Control Protocol) or IP (Internet Protocol) header from an input of raw bytes.",run:Checksum.run_tcp_ip,input_type:"byte_array",output_type:"string",args:[]},"Parse colour code":{description:"Converts a colour code in a standard format to other standard formats and displays the colour itself.

                                                                                                      Example inputs
                                                                                                      • #d9edf7
                                                                                                      • rgba(217,237,247,1)
                                                                                                      • hsla(200,65%,91%,1)
                                                                                                      • cmyk(0.12, 0.04, 0.00, 0.03)
                                                                                                      ",run:HTML.run_parse_colour_code,input_type:"string",output_type:"html",args:[]},"Generate UUID":{description:"Generates an RFC 4122 version 4 compliant Universally Unique Identifier (UUID), also known as a Globally Unique Identifier (GUID).

                                                                                                      A version 4 UUID relies on random numbers, in this case generated using window.crypto if available and falling back to Math.random if not.",run:UUID.run_generate_v4,input_type:"string",output_type:"string",args:[]},Substitute:{description:"A substitution cipher allowing you to specify bytes to replace with other byte values. This can be used to create Caesar ciphers but is more powerful as any byte value can be substituted, not just letters, and the substitution values need not be in order.

                                                                                                      Enter the bytes you want to replace in the Plaintext field and the bytes to replace them with in the Ciphertext field.

                                                                                                      Non-printable bytes can be specified using string escape notation. For example, a line feed character can be written as either \\n or \\x0a.

                                                                                                      Byte ranges can be specified using a hyphen. For example, the sequence 0123456789 can be written as 0-9.",run:Cipher.run_substitute,input_type:"byte_array",output_type:"byte_array",args:[{name:"Plaintext",type:"binary_string",value:Cipher.SUBS_PLAINTEXT},{name:"Ciphertext",type:"binary_string",value:Cipher.SUBS_CIPHERTEXT}]}},ControlsWaiter=function(a,b){this.app=a,this.manager=b};ControlsWaiter.prototype.adjust_width=function(){var a=document.getElementById("controls"),b=document.getElementById("step"),c=document.getElementById("clr-breaks"),d=document.querySelector("#save img"),e=document.querySelector("#load img"),f=document.querySelector("#step img"),g=document.querySelector("#clr-recipe img"),h=document.querySelector("#clr-breaks img");a.clientWidth<470?b.childNodes[1].nodeValue=" Step":b.childNodes[1].nodeValue=" Step through",a.clientWidth<400?(d.style.display="none",e.style.display="none",f.style.display="none",g.style.display="none",h.style.display="none"):(d.style.display="inline",e.style.display="inline",f.style.display="inline",g.style.display="inline",h.style.display="inline"),a.clientWidth<330?c.childNodes[1].nodeValue=" Clear breaks":c.childNodes[1].nodeValue=" Clear breakpoints"},ControlsWaiter.prototype.set_auto_bake=function(a){var b=document.getElementById("auto-bake");b.checked!==a&&b.click()},ControlsWaiter.prototype.bake_click=function(){this.app.bake(),$("#output-text").selectRange(0)},ControlsWaiter.prototype.step_click=function(){this.app.bake(!0),$("#output-text").selectRange(0)},ControlsWaiter.prototype.auto_bake_change=function(){var a=document.getElementById("auto-bake-label"),b=document.getElementById("auto-bake");this.app.auto_bake_=b.checked,b.checked?(a.classList.remove("btn-default"),a.classList.add("btn-success")):(a.classList.remove("btn-success"),a.classList.add("btn-default"))},ControlsWaiter.prototype.clear_recipe_click=function(){this.manager.recipe.clear_recipe()},ControlsWaiter.prototype.clear_breaks_click=function(){for(var a=document.querySelectorAll("#rec_list li.operation .breakpoint"),b=0;b0,b=b&&f.length>0&&f.length<8e3,a&&(d+="?recipe="+encodeURIComponent(e)),a&&b?d+="&input="+encodeURIComponent(f):b&&(d+="?input="+encodeURIComponent(f)),d},ControlsWaiter.prototype.save_text_change=function(){try{var a=JSON.parse(document.getElementById("save-text").value);this.initialise_save_link(a)}catch(a){}},ControlsWaiter.prototype.save_click=function(){var a=this.app.get_recipe_config(),b=JSON.stringify(a).replace(/},{/g,"},\n{");document.getElementById("save-text").value=b,this.initialise_save_link(a),$("#save-modal").modal()},ControlsWaiter.prototype.slr_check_change=function(){this.initialise_save_link()},ControlsWaiter.prototype.sli_check_change=function(){this.initialise_save_link()},ControlsWaiter.prototype.load_click=function(){this.populate_load_recipes_list(),$("#load-modal").modal()},ControlsWaiter.prototype.save_button_click=function(){var a=document.getElementById("save-name").value,b=document.getElementById("save-text").value;if(!a)return void this.app.alert("Please enter a recipe name","danger",2e3);var c=localStorage.saved_recipes?JSON.parse(localStorage.saved_recipes):[],d=localStorage.recipe_id||0;c.push({id:++d,name:a,recipe:b}),localStorage.saved_recipes=JSON.stringify(c),localStorage.recipe_id=d,this.app.alert('Recipe saved as "'+a+'".',"success",2e3)},ControlsWaiter.prototype.populate_load_recipes_list=function(){for(var a=document.getElementById("load-name"),b=a.options.length;b--;)a.remove(b);var c=localStorage.saved_recipes?JSON.parse(localStorage.saved_recipes):[];for(b=0;bend: "+e+"
                                                                                                      length: "+f},HighlighterWaiter.prototype.remove_highlights=function(){document.getElementById("input-highlighter").innerHTML="",document.getElementById("output-highlighter").innerHTML="",document.getElementById("input-selection-info").innerHTML="",document.getElementById("output-selection-info").innerHTML=""},HighlighterWaiter.prototype.generate_highlight_list=function(){for(var a=this.app.get_recipe_config(),b=[],c=0;c=0)return!1;var d="[start_highlight]",e=/\[start_highlight\]/g,f="[end_highlight]",g=/\[end_highlight\]/g,h=a.value;if(1===c.length){if(c[0].end/g,">").replace(/\n/g," ").replace(e,'').replace(g,"")+" ",b.style.width=a.clientWidth+"px",b.innerHTML=h,b.scrollTop=a.scrollTop,b.scrollLeft=a.scrollLeft};var HTMLApp=function(a,b,c,d){this.categories=a,this.operations=b,this.dfavourites=c,this.doptions=d,this.options=Utils.extend({},d),this.chef=new Chef,this.manager=new Manager(this),this.auto_bake_=!1,this.progress=0,this.ing_id=0,window.chef=this.chef};HTMLApp.prototype.setup=function(){document.dispatchEvent(this.manager.appstart),this.initialise_splitter(),this.load_local_storage(),this.populate_operations_list(),this.manager.setup(),this.reset_layout(),this.set_compile_message(),this.load_URI_params()},HTMLApp.prototype.handle_error=function(a){console.error(a);var b=a.display_str||a.toString();this.alert(b,"danger",this.options.error_timeout,!this.options.show_errors)},HTMLApp.prototype.bake=function(a){var b;try{b=this.chef.bake(this.get_input(),this.get_recipe_config(),this.options,this.progress,a)}catch(a){this.handle_error(a)}b&&(b.error&&this.handle_error(b.error),this.options=b.options,this.dish_str="html"===b.type?Utils.strip_html_tags(b.result,!0):b.result,this.progress=b.progress,this.manager.recipe.update_breakpoint_indicator(b.progress),this.manager.output.set(b.result,b.type,b.duration),b.duration>this.options.auto_bake_threshold&&this.auto_bake_&&(this.manager.controls.set_auto_bake(!1),this.alert("Baking took longer than "+this.options.auto_bake_threshold+"ms, Auto Bake has been disabled.","warning",5e3)))},HTMLApp.prototype.auto_bake=function(){this.auto_bake_&&this.bake()},HTMLApp.prototype.silent_bake=function(){var a=(new Date).getTime(),b=this.get_recipe_config();return this.auto_bake_&&this.chef.silent_bake(b),(new Date).getTime()-a},HTMLApp.prototype.get_input=function(){var a=this.manager.input.get();return sessionStorage.setItem("input_length",a.length),sessionStorage.setItem("input",a),a},HTMLApp.prototype.set_input=function(a){sessionStorage.setItem("input_length",a.length),sessionStorage.setItem("input",a),this.manager.input.set(a)},HTMLApp.prototype.populate_operations_list=function(){document.body.appendChild(document.getElementById("edit-favourites"));for(var a="",b=0;b2?JSON.parse(localStorage.favourites):this.dfavourites;a=this.valid_favourites(a),this.save_favourites(a);var b=this.categories.filter(function(a){return"Favourites"===a.name})[0];b?b.ops=a:this.categories.unshift({name:"Favourites",ops:a})},HTMLApp.prototype.valid_favourites=function(a){for(var b=[],c=0;c=0?void this.alert("'"+a+"' is already in your favourites","info",2e3):(b.push(a),this.save_favourites(b),this.load_favourites(),this.populate_operations_list(),void this.manager.recipe.initialise_operation_drag_n_drop())},HTMLApp.prototype.load_URI_params=function(){this.query_string=function(a){if(""===a)return{};for(var b={},c=0;c"):d[e].value=a[b].args[e];a[b].disabled&&c.querySelector(".disable-icon").click(),a[b].breakpoint&&c.querySelector(".breakpoint").click(),this.progress=0}},HTMLApp.prototype.reset_layout=function(){this.column_splitter.setSizes([20,30,50]),this.io_splitter.setSizes([50,50]),this.manager.controls.adjust_width(),this.manager.output.adjust_width()},HTMLApp.prototype.set_compile_message=function(){var a=new Date,b=Utils.fuzzy_time(a.getTime()-window.compile_time),c='Last build: '+b.substr(0,1).toUpperCase()+b.substr(1)+" ago";""!==window.compile_message&&(c+=" - "+window.compile_message),c+="",document.getElementById("notice").innerHTML=c},HTMLApp.prototype.alert=function(a,b,c,d){var e=new Date;if(console.log("["+e.toLocaleString()+"] "+a),!d){b=b||"danger",c=c||0;var f=document.getElementById("alert"),g=document.getElementById("alert-content");f.classList.remove("alert-danger"),f.classList.remove("alert-warning"),f.classList.remove("alert-info"),f.classList.remove("alert-success"),f.classList.add("alert-"+b),"block"===f.style.display?g.innerHTML+="

                                                                                                      ["+e.toLocaleTimeString()+"] "+a:g.innerHTML="["+e.toLocaleTimeString()+"] "+a,$("#alert").stop(),f.style.display="block",f.style.opacity=1,c>0&&(clearTimeout(this.alert_timeout),this.alert_timeout=setTimeout(function(){$("#alert").slideUp(100)},c))}},HTMLApp.prototype.confirm=function(a,b,c,d){d=d||this,document.getElementById("confirm-title").innerHTML=a,document.getElementById("confirm-body").innerHTML=b,document.getElementById("confirm-modal").style.display="block",this.confirm_closed=!1,$("#confirm-modal").modal().one("show.bs.modal",function(a){this.confirm_closed=!1}.bind(this)).one("click","#confirm-yes",function(){this.confirm_closed=!0,c.bind(d)(!0),$("#confirm-modal").modal("hide")}.bind(this)).one("hide.bs.modal",function(a){this.confirm_closed||c.bind(d)(!1),this.confirm_closed=!0}.bind(this))},HTMLApp.prototype.alert_close_click=function(){document.getElementById("alert").style.display="none"},HTMLApp.prototype.state_change=function(a){this.auto_bake(),this.options.update_url&&(this.last_state_url=this.manager.controls.generate_state_url(!0,!0),window.history.replaceState({},"CyberChef",this.last_state_url))},HTMLApp.prototype.pop_state=function(a){window.location.href.split("#")[0]!==this.last_state_url&&this.load_URI_params()},HTMLApp.prototype.call_api=function(a,b,c,d,e){b=b||"POST",c=c||{},d=d||void 0,e=e||"application/json";var f=null,g=!1;return $.ajax({url:a,async:!1,type:b,data:c,dataType:d,contentType:e,success:function(a){g=!0,f=a},error:function(a){g=!1,f=a}}),{success:g,response:f}};var HTMLCategory=function(a,b){this.name=a,this.selected=b,this.op_list=[]};HTMLCategory.prototype.add_operation=function(a){this.op_list.push(a)},HTMLCategory.prototype.to_html=function(){for(var a="cat"+this.name.replace(/[\s\/-:_]/g,""),b="
                                                                                                      "+this.name+"
                                                                                                        ",c=0;c 
                                                                                                      ";switch(d+="
                                                                                                      ",this.type){case"string":case"binary_string":case"byte_array":d+="";break;case"short_string":case"binary_short_string":d+="";break;case"toggle_string":for(d+="
                                                                                                      ";break;case"number":d+="";break;case"boolean":d+="",this.disable_args&&this.manager.add_dynamic_listener("#"+this.id,"click",this.toggle_disable_args,this);break;case"option":for(d+="";break;case"populate_option":for(d+="",this.manager.add_dynamic_listener("#"+this.id,"change",this.populate_option_change,this);break;case"editable_option":for(d+="
                                                                                                      ",d+="",d+="",d+="
                                                                                                      ",this.manager.add_dynamic_listener("#sel-"+this.id,"change",this.editable_option_change,this);break;case"text":d+=""}return d+="
                                                                                                      "},HTMLIngredient.prototype.toggle_disable_args=function(a){for(var b,c=a.target,d=c.parentNode.parentNode,e=d.querySelectorAll(".arg-group"),f=0;f"),this.description&&(b+=""),b+=""},HTMLOperation.prototype.to_full_html=function(){for(var a="
                                                                                                      "+this.name+"
                                                                                                      ",b=0;b=0&&(this.name=this.name.slice(0,b)+""+this.name.slice(b,b+a.length)+""+this.name.slice(b+a.length)),this.description&&c>=0&&(this.description=this.description.slice(0,c)+""+this.description.slice(c,c+a.length)+""+this.description.slice(c+a.length))};var InputWaiter=function(a,b){this.app=a,this.manager=b,this.bad_keys=[16,17,18,19,20,27,33,34,35,36,37,38,39,40,44,91,92,93,112,113,114,115,116,117,118,119,120,121,122,123,144,145]};InputWaiter.prototype.get=function(){return document.getElementById("input-text").value},InputWaiter.prototype.set=function(a){document.getElementById("input-text").value=a,window.dispatchEvent(this.manager.statechange)},InputWaiter.prototype.set_input_info=function(a,b){var c=a.toString().length;c=c<2?2:c;var d=Utils.pad(a.toString(),c," ").replace(/ /g," "),e=Utils.pad(b.toString(),c," ").replace(/ /g," ");document.getElementById("input-info").innerHTML="length: "+d+"
                                                                                                      lines: "+e},InputWaiter.prototype.input_change=function(a){this.manager.highlighter.remove_highlights(),this.app.progress=0;var b=this.get(),c=b.count("\n")+1;this.set_input_info(b.length,c),this.bad_keys.indexOf(a.keyCode)<0&&window.dispatchEvent(this.manager.statechange)},InputWaiter.prototype.input_dragover=function(a){return"move"!==a.dataTransfer.effectAllowed&&(a.stopPropagation(),a.preventDefault(),void a.target.classList.add("dropping-file"))},InputWaiter.prototype.input_dragleave=function(a){ +run:StrUtils.run_parse_escaped_string,input_type:"string",output_type:"string",args:[]},"TCP/IP Checksum":{description:"Calculates the checksum for a TCP (Transport Control Protocol) or IP (Internet Protocol) header from an input of raw bytes.",run:Checksum.run_tcp_ip,input_type:"byte_array",output_type:"string",args:[]},"Parse colour code":{description:"Converts a colour code in a standard format to other standard formats and displays the colour itself.

                                                                                                      Example inputs
                                                                                                      • #d9edf7
                                                                                                      • rgba(217,237,247,1)
                                                                                                      • hsla(200,65%,91%,1)
                                                                                                      • cmyk(0.12, 0.04, 0.00, 0.03)
                                                                                                      ",run:HTML.run_parse_colour_code,input_type:"string",output_type:"html",args:[]},"Generate UUID":{description:"Generates an RFC 4122 version 4 compliant Universally Unique Identifier (UUID), also known as a Globally Unique Identifier (GUID).

                                                                                                      A version 4 UUID relies on random numbers, in this case generated using window.crypto if available and falling back to Math.random if not.",run:UUID.run_generate_v4,input_type:"string",output_type:"string",args:[]},Substitute:{description:"A substitution cipher allowing you to specify bytes to replace with other byte values. This can be used to create Caesar ciphers but is more powerful as any byte value can be substituted, not just letters, and the substitution values need not be in order.

                                                                                                      Enter the bytes you want to replace in the Plaintext field and the bytes to replace them with in the Ciphertext field.

                                                                                                      Non-printable bytes can be specified using string escape notation. For example, a line feed character can be written as either \\n or \\x0a.

                                                                                                      Byte ranges can be specified using a hyphen. For example, the sequence 0123456789 can be written as 0-9.",run:Cipher.run_substitute,input_type:"byte_array",output_type:"byte_array",args:[{name:"Plaintext",type:"binary_string",value:Cipher.SUBS_PLAINTEXT},{name:"Ciphertext",type:"binary_string",value:Cipher.SUBS_CIPHERTEXT}]}},ControlsWaiter=function(a,b){this.app=a,this.manager=b};ControlsWaiter.prototype.adjust_width=function(){var a=document.getElementById("controls"),b=document.getElementById("step"),c=document.getElementById("clr-breaks"),d=document.querySelector("#save img"),e=document.querySelector("#load img"),f=document.querySelector("#step img"),g=document.querySelector("#clr-recipe img"),h=document.querySelector("#clr-breaks img");a.clientWidth<470?b.childNodes[1].nodeValue=" Step":b.childNodes[1].nodeValue=" Step through",a.clientWidth<400?(d.style.display="none",e.style.display="none",f.style.display="none",g.style.display="none",h.style.display="none"):(d.style.display="inline",e.style.display="inline",f.style.display="inline",g.style.display="inline",h.style.display="inline"),a.clientWidth<330?c.childNodes[1].nodeValue=" Clear breaks":c.childNodes[1].nodeValue=" Clear breakpoints"},ControlsWaiter.prototype.set_auto_bake=function(a){var b=document.getElementById("auto-bake");b.checked!==a&&b.click()},ControlsWaiter.prototype.bake_click=function(){this.app.bake(),$("#output-text").selectRange(0)},ControlsWaiter.prototype.step_click=function(){this.app.bake(!0),$("#output-text").selectRange(0)},ControlsWaiter.prototype.auto_bake_change=function(){var a=document.getElementById("auto-bake-label"),b=document.getElementById("auto-bake");this.app.auto_bake_=b.checked,b.checked?(a.classList.remove("btn-default"),a.classList.add("btn-success")):(a.classList.remove("btn-success"),a.classList.add("btn-default"))},ControlsWaiter.prototype.clear_recipe_click=function(){this.manager.recipe.clear_recipe()},ControlsWaiter.prototype.clear_breaks_click=function(){for(var a=document.querySelectorAll("#rec_list li.operation .breakpoint"),b=0;b0,b=b&&f.length>0&&f.length<8e3,a&&(d+="?recipe="+encodeURIComponent(e)),a&&b?d+="&input="+encodeURIComponent(f):b&&(d+="?input="+encodeURIComponent(f)),d},ControlsWaiter.prototype.save_text_change=function(){try{var a=JSON.parse(document.getElementById("save-text").value);this.initialise_save_link(a)}catch(a){}},ControlsWaiter.prototype.save_click=function(){var a=this.app.get_recipe_config(),b=JSON.stringify(a).replace(/},{/g,"},\n{");document.getElementById("save-text").value=b,this.initialise_save_link(a),$("#save-modal").modal()},ControlsWaiter.prototype.slr_check_change=function(){this.initialise_save_link()},ControlsWaiter.prototype.sli_check_change=function(){this.initialise_save_link()},ControlsWaiter.prototype.load_click=function(){this.populate_load_recipes_list(),$("#load-modal").modal()},ControlsWaiter.prototype.save_button_click=function(){var a=document.getElementById("save-name").value,b=document.getElementById("save-text").value;if(!a)return void this.app.alert("Please enter a recipe name","danger",2e3);var c=localStorage.saved_recipes?JSON.parse(localStorage.saved_recipes):[],d=localStorage.recipe_id||0;c.push({id:++d,name:a,recipe:b}),localStorage.saved_recipes=JSON.stringify(c),localStorage.recipe_id=d,this.app.alert('Recipe saved as "'+a+'".',"success",2e3)},ControlsWaiter.prototype.populate_load_recipes_list=function(){for(var a=document.getElementById("load-name"),b=a.options.length;b--;)a.remove(b);var c=localStorage.saved_recipes?JSON.parse(localStorage.saved_recipes):[];for(b=0;bend: "+e+"
                                                                                                      length: "+f},HighlighterWaiter.prototype.remove_highlights=function(){document.getElementById("input-highlighter").innerHTML="",document.getElementById("output-highlighter").innerHTML="",document.getElementById("input-selection-info").innerHTML="",document.getElementById("output-selection-info").innerHTML=""},HighlighterWaiter.prototype.generate_highlight_list=function(){for(var a=this.app.get_recipe_config(),b=[],c=0;c=0)return!1;var d="[start_highlight]",e=/\[start_highlight\]/g,f="[end_highlight]",g=/\[end_highlight\]/g,h=a.value;if(1===c.length){if(c[0].end/g,">").replace(/\n/g," ").replace(e,'').replace(g,"")+" ",b.style.width=a.clientWidth+"px",b.innerHTML=h,b.scrollTop=a.scrollTop,b.scrollLeft=a.scrollLeft};var HTMLApp=function(a,b,c,d){this.categories=a,this.operations=b,this.dfavourites=c,this.doptions=d,this.options=Utils.extend({},d),this.chef=new Chef,this.manager=new Manager(this),this.auto_bake_=!1,this.progress=0,this.ing_id=0,window.chef=this.chef};HTMLApp.prototype.setup=function(){document.dispatchEvent(this.manager.appstart),this.initialise_splitter(),this.load_local_storage(),this.populate_operations_list(),this.manager.setup(),this.reset_layout(),this.set_compile_message(),this.load_URI_params()},HTMLApp.prototype.handle_error=function(a){console.error(a);var b=a.display_str||a.toString();this.alert(b,"danger",this.options.error_timeout,!this.options.show_errors)},HTMLApp.prototype.bake=function(a){var b;try{b=this.chef.bake(this.get_input(),this.get_recipe_config(),this.options,this.progress,a)}catch(a){this.handle_error(a)}b&&(b.error&&this.handle_error(b.error),this.options=b.options,this.dish_str="html"===b.type?Utils.strip_html_tags(b.result,!0):b.result,this.progress=b.progress,this.manager.recipe.update_breakpoint_indicator(b.progress),this.manager.output.set(b.result,b.type,b.duration),b.duration>this.options.auto_bake_threshold&&this.auto_bake_&&(this.manager.controls.set_auto_bake(!1),this.alert("Baking took longer than "+this.options.auto_bake_threshold+"ms, Auto Bake has been disabled.","warning",5e3)))},HTMLApp.prototype.auto_bake=function(){this.auto_bake_&&this.bake()},HTMLApp.prototype.silent_bake=function(){var a=(new Date).getTime(),b=this.get_recipe_config();return this.auto_bake_&&this.chef.silent_bake(b),(new Date).getTime()-a},HTMLApp.prototype.get_input=function(){var a=this.manager.input.get();return sessionStorage.setItem("input_length",a.length),sessionStorage.setItem("input",a),a},HTMLApp.prototype.set_input=function(a){sessionStorage.setItem("input_length",a.length),sessionStorage.setItem("input",a),this.manager.input.set(a)},HTMLApp.prototype.populate_operations_list=function(){document.body.appendChild(document.getElementById("edit-favourites"));for(var a="",b=0;b2?JSON.parse(localStorage.favourites):this.dfavourites;a=this.valid_favourites(a),this.save_favourites(a);var b=this.categories.filter(function(a){return"Favourites"===a.name})[0];b?b.ops=a:this.categories.unshift({name:"Favourites",ops:a})},HTMLApp.prototype.valid_favourites=function(a){for(var b=[],c=0;c=0?void this.alert("'"+a+"' is already in your favourites","info",2e3):(b.push(a),this.save_favourites(b),this.load_favourites(),this.populate_operations_list(),void this.manager.recipe.initialise_operation_drag_n_drop())},HTMLApp.prototype.load_URI_params=function(){this.query_string=function(a){if(""===a)return{};for(var b={},c=0;c"):d[e].value=a[b].args[e];a[b].disabled&&c.querySelector(".disable-icon").click(),a[b].breakpoint&&c.querySelector(".breakpoint").click(),this.progress=0}},HTMLApp.prototype.reset_layout=function(){this.column_splitter.setSizes([20,30,50]),this.io_splitter.setSizes([50,50]),this.manager.controls.adjust_width(),this.manager.output.adjust_width()},HTMLApp.prototype.set_compile_message=function(){var a=new Date,b=Utils.fuzzy_time(a.getTime()-window.compile_time),c='Last build: '+b.substr(0,1).toUpperCase()+b.substr(1)+" ago";""!==window.compile_message&&(c+=" - "+window.compile_message),c+="",document.getElementById("notice").innerHTML=c},HTMLApp.prototype.alert=function(a,b,c,d){var e=new Date;if(console.log("["+e.toLocaleString()+"] "+a),!d){b=b||"danger",c=c||0;var f=document.getElementById("alert"),g=document.getElementById("alert-content");f.classList.remove("alert-danger"),f.classList.remove("alert-warning"),f.classList.remove("alert-info"),f.classList.remove("alert-success"),f.classList.add("alert-"+b),"block"===f.style.display?g.innerHTML+="

                                                                                                      ["+e.toLocaleTimeString()+"] "+a:g.innerHTML="["+e.toLocaleTimeString()+"] "+a,$("#alert").stop(),f.style.display="block",f.style.opacity=1,c>0&&(clearTimeout(this.alert_timeout),this.alert_timeout=setTimeout(function(){$("#alert").slideUp(100)},c))}},HTMLApp.prototype.confirm=function(a,b,c,d){d=d||this,document.getElementById("confirm-title").innerHTML=a,document.getElementById("confirm-body").innerHTML=b,document.getElementById("confirm-modal").style.display="block",this.confirm_closed=!1,$("#confirm-modal").modal().one("show.bs.modal",function(a){this.confirm_closed=!1}.bind(this)).one("click","#confirm-yes",function(){this.confirm_closed=!0,c.bind(d)(!0),$("#confirm-modal").modal("hide")}.bind(this)).one("hide.bs.modal",function(a){this.confirm_closed||c.bind(d)(!1),this.confirm_closed=!0}.bind(this))},HTMLApp.prototype.alert_close_click=function(){document.getElementById("alert").style.display="none"},HTMLApp.prototype.state_change=function(a){this.auto_bake(),this.options.update_url&&(this.last_state_url=this.manager.controls.generate_state_url(!0,!0),window.history.replaceState({},"CyberChef",this.last_state_url))},HTMLApp.prototype.pop_state=function(a){window.location.href.split("#")[0]!==this.last_state_url&&this.load_URI_params()},HTMLApp.prototype.call_api=function(a,b,c,d,e){b=b||"POST",c=c||{},d=d||void 0,e=e||"application/json";var f=null,g=!1;return $.ajax({url:a,async:!1,type:b,data:c,dataType:d,contentType:e,success:function(a){g=!0,f=a},error:function(a){g=!1,f=a}}),{success:g,response:f}};var HTMLCategory=function(a,b){this.name=a,this.selected=b,this.op_list=[]};HTMLCategory.prototype.add_operation=function(a){this.op_list.push(a)},HTMLCategory.prototype.to_html=function(){for(var a="cat"+this.name.replace(/[\s\/-:_]/g,""),b="
                                                                                                      "+this.name+"
                                                                                                        ",c=0;c 
                                                                                                      ";switch(d+="
                                                                                                      ",this.type){case"string":case"binary_string":case"byte_array":d+="";break;case"short_string":case"binary_short_string":d+="";break;case"toggle_string":for(d+="
                                                                                                      ";break;case"number":d+="";break;case"boolean":d+="",this.disable_args&&this.manager.add_dynamic_listener("#"+this.id,"click",this.toggle_disable_args,this);break;case"option":for(d+="";break;case"populate_option":for(d+="",this.manager.add_dynamic_listener("#"+this.id,"change",this.populate_option_change,this);break;case"editable_option":for(d+="
                                                                                                      ",d+="",d+="",d+="
                                                                                                      ",this.manager.add_dynamic_listener("#sel-"+this.id,"change",this.editable_option_change,this);break;case"text":d+=""}return d+="
                                                                                                      "},HTMLIngredient.prototype.toggle_disable_args=function(a){for(var b,c=a.target,d=c.parentNode.parentNode,e=d.querySelectorAll(".arg-group"),f=0;f"),this.description&&(b+=""),b+=""},HTMLOperation.prototype.to_full_html=function(){for(var a="
                                                                                                      "+this.name+"
                                                                                                      ",b=0;b=0&&(this.name=this.name.slice(0,b)+""+this.name.slice(b,b+a.length)+""+this.name.slice(b+a.length)),this.description&&c>=0&&(this.description=this.description.slice(0,c)+""+this.description.slice(c,c+a.length)+""+this.description.slice(c+a.length))};var InputWaiter=function(a,b){this.app=a,this.manager=b,this.bad_keys=[16,17,18,19,20,27,33,34,35,36,37,38,39,40,44,91,92,93,112,113,114,115,116,117,118,119,120,121,122,123,144,145]};InputWaiter.prototype.get=function(){return document.getElementById("input-text").value},InputWaiter.prototype.set=function(a){document.getElementById("input-text").value=a,window.dispatchEvent(this.manager.statechange)},InputWaiter.prototype.set_input_info=function(a,b){var c=a.toString().length;c=c<2?2:c;var d=Utils.pad(a.toString(),c," ").replace(/ /g," "),e=Utils.pad(b.toString(),c," ").replace(/ /g," ");document.getElementById("input-info").innerHTML="length: "+d+"
                                                                                                      lines: "+e},InputWaiter.prototype.input_change=function(a){this.manager.highlighter.remove_highlights(),this.app.progress=0;var b=this.get(),c=b.count("\n")+1;this.set_input_info(b.length,c),this.bad_keys.indexOf(a.keyCode)<0&&window.dispatchEvent(this.manager.statechange)},InputWaiter.prototype.input_dragover=function(a){return"move"!==a.dataTransfer.effectAllowed&&(a.stopPropagation(),a.preventDefault(),void a.target.classList.add("dropping-file"))},InputWaiter.prototype.input_dragleave=function(a){ a.stopPropagation(),a.preventDefault(),a.target.classList.remove("dropping-file")},InputWaiter.prototype.input_drop=function(a){if("move"===a.dataTransfer.effectAllowed)return!1;a.stopPropagation(),a.preventDefault();var b=a.target,c=a.dataTransfer.files[0],d=a.dataTransfer.getData("Text"),e=new FileReader,f="",g=0,h=20480,i=function(){f.length>1e5&&this.app.auto_bake_&&(this.manager.controls.set_auto_bake(!1),this.app.alert("Turned off Auto Bake as the input is large","warning",5e3)),this.set(f);var a=this.app.get_recipe_config();a[0]&&"From Hex"===a[0].op||(a.unshift({op:"From Hex",args:["Space"]}),this.app.set_recipe_config(a)),b.classList.remove("loading_file")}.bind(this),j=function(){if(g>=c.size)return void i();b.value="Processing... "+Math.round(g/c.size*100)+"%";var a=c.slice(g,g+h);e.readAsArrayBuffer(a)};e.onload=function(a){var b=new Uint8Array(e.result);f+=Utils.to_hex_fast(b),g+=h,j()},b.classList.remove("dropping-file"),c?(b.classList.add("loading_file"),j()):d&&this.set(d)},InputWaiter.prototype.clear_io_click=function(){this.manager.highlighter.remove_highlights(),document.getElementById("input-text").value="",document.getElementById("output-text").value="",document.getElementById("input-info").innerHTML="",document.getElementById("output-info").innerHTML="",document.getElementById("input-selection-info").innerHTML="",document.getElementById("output-selection-info").innerHTML="",window.dispatchEvent(this.manager.statechange)};var Manager=function(a){this.app=a,this.appstart=new CustomEvent("appstart",{bubbles:!0}),this.operationadd=new CustomEvent("operationadd",{bubbles:!0}),this.operationremove=new CustomEvent("operationremove",{bubbles:!0}),this.oplistcreate=new CustomEvent("oplistcreate",{bubbles:!0}),this.statechange=new CustomEvent("statechange",{bubbles:!0}),this.window=new WindowWaiter(this.app),this.controls=new ControlsWaiter(this.app,this),this.recipe=new RecipeWaiter(this.app,this),this.ops=new OperationsWaiter(this.app,this),this.input=new InputWaiter(this.app,this),this.output=new OutputWaiter(this.app,this),this.options=new OptionsWaiter(this.app),this.highlighter=new HighlighterWaiter(this.app),this.seasonal=new SeasonalWaiter(this.app,this),this.dynamic_handlers={},this.initialise_event_listeners()};Manager.prototype.setup=function(){this.recipe.initialise_operation_drag_n_drop(),this.controls.auto_bake_change(),this.seasonal.load()},Manager.prototype.initialise_event_listeners=function(){window.addEventListener("resize",this.window.window_resize.bind(this.window)),window.addEventListener("blur",this.window.window_blur.bind(this.window)),window.addEventListener("focus",this.window.window_focus.bind(this.window)),window.addEventListener("statechange",this.app.state_change.bind(this.app)),window.addEventListener("popstate",this.app.pop_state.bind(this.app)),document.getElementById("bake").addEventListener("click",this.controls.bake_click.bind(this.controls)),document.getElementById("auto-bake").addEventListener("change",this.controls.auto_bake_change.bind(this.controls)),document.getElementById("step").addEventListener("click",this.controls.step_click.bind(this.controls)),document.getElementById("clr-recipe").addEventListener("click",this.controls.clear_recipe_click.bind(this.controls)),document.getElementById("clr-breaks").addEventListener("click",this.controls.clear_breaks_click.bind(this.controls)),document.getElementById("save").addEventListener("click",this.controls.save_click.bind(this.controls)),document.getElementById("save-button").addEventListener("click",this.controls.save_button_click.bind(this.controls)),document.getElementById("save-link-recipe-checkbox").addEventListener("change",this.controls.slr_check_change.bind(this.controls)),document.getElementById("save-link-input-checkbox").addEventListener("change",this.controls.sli_check_change.bind(this.controls)),document.getElementById("load").addEventListener("click",this.controls.load_click.bind(this.controls)),document.getElementById("load-delete-button").addEventListener("click",this.controls.load_delete_click.bind(this.controls)),document.getElementById("load-name").addEventListener("change",this.controls.load_name_change.bind(this.controls)),document.getElementById("load-button").addEventListener("click",this.controls.load_button_click.bind(this.controls)),this.add_multi_event_listener("#save-text","keyup paste",this.controls.save_text_change,this.controls),this.add_multi_event_listener("#search","keyup paste search",this.ops.search_operations,this.ops),this.add_dynamic_listener(".op_list li.operation","dblclick",this.ops.operation_dblclick,this.ops),document.getElementById("edit-favourites").addEventListener("click",this.ops.edit_favourites_click.bind(this.ops)),document.getElementById("save-favourites").addEventListener("click",this.ops.save_favourites_click.bind(this.ops)),document.getElementById("reset-favourites").addEventListener("click",this.ops.reset_favourites_click.bind(this.ops)),this.add_dynamic_listener(".op_list .op-icon","mouseover",this.ops.op_icon_mouseover,this.ops),this.add_dynamic_listener(".op_list .op-icon","mouseleave",this.ops.op_icon_mouseleave,this.ops),this.add_dynamic_listener(".op_list","oplistcreate",this.ops.op_list_create,this.ops),this.add_dynamic_listener("li.operation","operationadd",this.recipe.op_add.bind(this.recipe)),this.add_dynamic_listener(".arg","keyup",this.recipe.ing_change,this.recipe),this.add_dynamic_listener(".arg","change",this.recipe.ing_change,this.recipe),this.add_dynamic_listener(".disable-icon","click",this.recipe.disable_click,this.recipe),this.add_dynamic_listener(".breakpoint","click",this.recipe.breakpoint_click,this.recipe),this.add_dynamic_listener("#rec_list li.operation","dblclick",this.recipe.operation_dblclick,this.recipe),this.add_dynamic_listener("#rec_list li.operation > div","dblclick",this.recipe.operation_child_dblclick,this.recipe),this.add_dynamic_listener("#rec_list .input-group .dropdown-menu a","click",this.recipe.dropdown_toggle_click,this.recipe),this.add_dynamic_listener("#rec_list","operationremove",this.recipe.op_remove.bind(this.recipe)),this.add_multi_event_listener("#input-text","keyup paste",this.input.input_change,this.input),document.getElementById("reset-layout").addEventListener("click",this.app.reset_layout.bind(this.app)),document.getElementById("clr-io").addEventListener("click",this.input.clear_io_click.bind(this.input)),document.getElementById("input-text").addEventListener("dragover",this.input.input_dragover.bind(this.input)),document.getElementById("input-text").addEventListener("dragleave",this.input.input_dragleave.bind(this.input)),document.getElementById("input-text").addEventListener("drop",this.input.input_drop.bind(this.input)),document.getElementById("input-text").addEventListener("scroll",this.highlighter.input_scroll.bind(this.highlighter)),document.getElementById("input-text").addEventListener("mouseup",this.highlighter.input_mouseup.bind(this.highlighter)),document.getElementById("input-text").addEventListener("mousemove",this.highlighter.input_mousemove.bind(this.highlighter)),this.add_multi_event_listener("#input-text","mousedown dblclick select",this.highlighter.input_mousedown,this.highlighter),document.getElementById("save-to-file").addEventListener("click",this.output.save_click.bind(this.output)),document.getElementById("switch").addEventListener("click",this.output.switch_click.bind(this.output)),document.getElementById("undo-switch").addEventListener("click",this.output.undo_switch_click.bind(this.output)),document.getElementById("maximise-output").addEventListener("click",this.output.maximise_output_click.bind(this.output)),document.getElementById("output-text").addEventListener("scroll",this.highlighter.output_scroll.bind(this.highlighter)),document.getElementById("output-text").addEventListener("mouseup",this.highlighter.output_mouseup.bind(this.highlighter)),document.getElementById("output-text").addEventListener("mousemove",this.highlighter.output_mousemove.bind(this.highlighter)),document.getElementById("output-html").addEventListener("mouseup",this.highlighter.output_html_mouseup.bind(this.highlighter)),document.getElementById("output-html").addEventListener("mousemove",this.highlighter.output_html_mousemove.bind(this.highlighter)),this.add_multi_event_listener("#output-text","mousedown dblclick select",this.highlighter.output_mousedown,this.highlighter),this.add_multi_event_listener("#output-html","mousedown dblclick select",this.highlighter.output_html_mousedown,this.highlighter),document.getElementById("options").addEventListener("click",this.options.options_click.bind(this.options)),document.getElementById("reset-options").addEventListener("click",this.options.reset_options_click.bind(this.options)),$(document).on("switchChange.bootstrapSwitch",".option-item input:checkbox",this.options.switch_change.bind(this.options)),$(document).on("switchChange.bootstrapSwitch",".option-item input:checkbox",this.options.set_word_wrap.bind(this.options)),this.add_dynamic_listener(".option-item input[type=number]","keyup",this.options.number_change,this.options),this.add_dynamic_listener(".option-item input[type=number]","change",this.options.number_change,this.options),this.add_dynamic_listener(".option-item select","change",this.options.select_change,this.options),document.getElementById("alert-close").addEventListener("click",this.app.alert_close_click.bind(this.app))},Manager.prototype.add_listeners=function(a,b,c,d){d=d||this,[].forEach.call(document.querySelectorAll(a),function(a){a.addEventListener(b,c.bind(d))})},Manager.prototype.add_multi_event_listener=function(a,b,c,d){for(var e=b.split(" "),f=0;f-1&&(this.manager.recipe.add_operation(b[c].innerHTML),this.app.auto_bake()))),13===a.keyCode)a.preventDefault();else if(40===a.keyCode)a.preventDefault(),b=document.querySelectorAll("#search-results li"),b.length&&(c=this.get_selected_op(b),c>-1&&b[c].classList.remove("selected-op"),c===b.length-1&&(c=-1),b[c+1].classList.add("selected-op"));else if(38===a.keyCode)a.preventDefault(),b=document.querySelectorAll("#search-results li"),b.length&&(c=this.get_selected_op(b),c>-1&&b[c].classList.remove("selected-op"),0===c&&(c=b.length),b[c-1].classList.add("selected-op"));else{for(var d=document.getElementById("search-results"),e=a.target,f=e.value;d.firstChild;)$(d.firstChild).popover("destroy"),d.removeChild(d.firstChild);if($("#categories .in").collapse("hide"),f){for(var g=this.filter_operations(f,!0),h="",i=0;i=0||h>=0){var i=new HTMLOperation(e,this.app.operations[e],this.app,this.manager);b&&i.highlight_search_string(a,g,h),g<0?c.push(i):d.push(i)}}return d.concat(c)},OperationsWaiter.prototype.get_selected_op=function(a){for(var b=0;blength: "+e+"
                                                                                                      lines: "+f,document.getElementById("input-selection-info").innerHTML="",document.getElementById("output-selection-info").innerHTML=""},OutputWaiter.prototype.adjust_width=function(){var a=document.getElementById("output"),b=document.getElementById("save-to-file"),c=document.getElementById("switch"),d=document.getElementById("undo-switch"),e=document.getElementById("maximise-output");a.clientWidth<680?(b.childNodes[1].nodeValue="",c.childNodes[1].nodeValue="",d.childNodes[1].nodeValue="",e.childNodes[1].nodeValue=""):(b.childNodes[1].nodeValue=" Save to file",c.childNodes[1].nodeValue=" Move output to input",d.childNodes[1].nodeValue=" Undo",e.childNodes[1].nodeValue="Maximise"===e.getAttribute("title")?" Max":" Restore")},OutputWaiter.prototype.save_click=function(){var a=Utils.to_base64(this.app.dish_str),b=window.prompt("Please enter a filename:","download.dat");if(b){var c=document.createElement("a");c.setAttribute("href","data:application/octet-stream;base64;charset=utf-8,"+a),c.setAttribute("download",b),c.style.display="none",document.body.appendChild(c),c.click(),c.remove()}},OutputWaiter.prototype.switch_click=function(){this.switch_orig_data=this.manager.input.get(),document.getElementById("undo-switch").disabled=!1,this.app.set_input(this.app.dish_str)},OutputWaiter.prototype.undo_switch_click=function(){this.app.set_input(this.switch_orig_data),document.getElementById("undo-switch").disabled=!0},OutputWaiter.prototype.maximise_output_click=function(a){var b="maximise-output"===a.target.id?a.target:a.target.parentNode;"Maximise"===b.getAttribute("title")?(this.app.column_splitter.collapse(0),this.app.column_splitter.collapse(1),this.app.io_splitter.collapse(0),b.setAttribute("title","Restore"),b.innerHTML=" Restore",this.adjust_width()):(b.setAttribute("title","Maximise"),b.innerHTML=" Max",this.app.reset_layout())};var RecipeWaiter=function(a,b){this.app=a,this.manager=b,this.remove_intent=!1};RecipeWaiter.prototype.initialise_operation_drag_n_drop=function(){var a=document.getElementById("rec_list");Sortable.create(a,{group:"recipe",sort:!0,animation:0,delay:0,filter:".arg-input,.arg",setData:function(a,b){a.setData("Text",b.querySelector(".arg-title").textContent)},onEnd:function(a){this.remove_intent&&(a.item.remove(),a.target.dispatchEvent(this.manager.operationremove))}.bind(this)}),Sortable.utils.on(a,"dragover",function(){this.remove_intent=!1}.bind(this)),Sortable.utils.on(a,"dragleave",function(){this.remove_intent=!0,this.app.progress=0}.bind(this)),Sortable.utils.on(a,"touchend",function(b){var c=b.changedTouches[0],d=document.elementFromPoint(c.clientX,c.clientY);this.remove_intent=!a.contains(d)}.bind(this)),document.querySelector("#categories a").addEventListener("dragover",this.fav_dragover.bind(this)),document.querySelector("#categories a").addEventListener("dragleave",this.fav_dragleave.bind(this)),document.querySelector("#categories a").addEventListener("drop",this.fav_drop.bind(this))},RecipeWaiter.prototype.create_sortable_seed_list=function(a){Sortable.create(a,{group:{name:"recipe",pull:"clone",put:!1},sort:!1,setData:function(a,b){a.setData("Text",b.textContent)},onStart:function(a){$(a.item).popover("destroy"),a.item.setAttribute("data-toggle","popover-disabled")},onEnd:this.op_sort_end.bind(this)})},RecipeWaiter.prototype.op_sort_end=function(a){return this.remove_intent?void("rec_list"===a.item.parentNode.id&&a.item.remove()):($(a.clone).popover(),$(a.clone).children("[data-toggle=popover]").popover(),void("rec_list"===a.item.parentNode.id&&(this.build_recipe_operation(a.item),a.item.dispatchEvent(this.manager.operationadd))))},RecipeWaiter.prototype.fav_dragover=function(a){return"move"===a.dataTransfer.effectAllowed&&(a.stopPropagation(),a.preventDefault(),void(a.target.className&&a.target.className.indexOf("category-title")>-1?a.target.classList.add("favourites-hover"):a.target.parentNode.className&&a.target.parentNode.className.indexOf("category-title")>-1?a.target.parentNode.classList.add("favourites-hover"):a.target.parentNode.parentNode.className&&a.target.parentNode.parentNode.className.indexOf("category-title")>-1&&a.target.parentNode.parentNode.classList.add("favourites-hover")))},RecipeWaiter.prototype.fav_dragleave=function(a){a.stopPropagation(),a.preventDefault(),document.querySelector("#categories a").classList.remove("favourites-hover")},RecipeWaiter.prototype.fav_drop=function(a){a.stopPropagation(),a.preventDefault(),a.target.classList.remove("favourites-hover");var b=a.dataTransfer.getData("Text");this.app.add_favourite(b)},RecipeWaiter.prototype.ing_change=function(){window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.disable_click=function(a){var b=a.target;"false"===b.getAttribute("disabled")?(b.setAttribute("disabled","true"),b.classList.add("disable-icon-selected"),b.parentNode.parentNode.classList.add("disabled")):(b.setAttribute("disabled","false"),b.classList.remove("disable-icon-selected"),b.parentNode.parentNode.classList.remove("disabled")),this.app.progress=0,window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.breakpoint_click=function(a){var b=a.target;"false"===b.getAttribute("break")?(b.setAttribute("break","true"),b.classList.add("breakpoint-selected")):(b.setAttribute("break","false"),b.classList.remove("breakpoint-selected")),window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.operation_dblclick=function(a){a.target.remove(),window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.operation_child_dblclick=function(a){a.target.parentNode.remove(),window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.get_config=function(){for(var a,b,c,d,e,f=[],g=document.querySelectorAll("#rec_list li.operation"),h=0;h",this.ing_change()},RecipeWaiter.prototype.op_add=function(a){window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.op_remove=function(a){window.dispatchEvent(this.manager.statechange)};var SeasonalWaiter=function(a,b){this.app=a,this.manager=b};SeasonalWaiter.prototype.load=function(){var a=new Date;11===a.getMonth()&&a.getDate()>12&&(this.app.options.snow=!1,this.create_snow_option(),$(document).on("switchChange.bootstrapSwitch",".option-item input:checkbox[option='snow']",this.let_it_snow.bind(this)),window.addEventListener("resize",this.let_it_snow.bind(this)),this.manager.add_listeners(".btn","click",this.shake_off_snow,this),25===a.getDate()&&this.let_it_snow()),this.kkeys=[],window.addEventListener("keydown",this.konami_code_listener.bind(this))},SeasonalWaiter.prototype.insert_spider_icons=function(){var a="iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB3UlEQVQ4y2NgGJaAmYGBgVnf0oKJgYGBobWtXamqqoYTn2I4CI+LTzM2NTulpKbu+vPHz2dV5RWlluZmi3j5+KqFJSSEzpw8uQPdAEYYIzo5Kfjrl28rWFlZzjAzMYuEBQao3Lh+g+HGvbsMzExMDN++fWf4/PXLBzY2tqYNK1f2+4eHM2xcuRLigsT09Igf3384MTExbf767etBI319jU8fPsi+//jx/72HDxh5uLkZ7ty7y/Dz1687Avz8n2UUFR3Z2NjOySoqfmdhYGBg+PbtuwI7O8e5H79+8X379t357PnzYo+ePP7y6cuXc9++f69nYGRsvf/w4XdtLS2R799/bBUWFHr57sP7Jbs3b/ZkzswvUP3165fZ7z9//r988WIVAyPDr8tXr576+u3bpb9//7YwMjKeV1dV41NWVGoVEhDgPH761DJREeHaz1+/lqlpafUx6+jrRfz4+fPy+w8fTu/fsf3uw7t3L39+//4cv7DwGQYGhpdPbt9m4BcRFlNWVJC4fuvWASszs4C379792Ldt2xZBUdEdDP5hYSqQGIjDGa965uYKCalpZQwMDAxhMTG9DAwMDLaurhIkJY7A8IgGBgYGBgd3Dz2yUpeFo6O4rasrA9T24ZRxAAMTwMpgEJwLAAAAAElFTkSuQmCC",b="iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAACYVBMVEUAAAAcJSU2P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cXxP2IOumPRY17U0tll8KIkZNb+sppafOxYkQPSaYfchyYoL9GMqWYpTLRIq1QUcT4O3aPQgqVqPwIOIMwDhzX6mQUFIQAgo+9MzcrWrML3mj6+YIKiFCZyhL87RqVQKrEskF+P1BUvfLCAkfRwoPUtq6l5o5+lZb5SolJo6oT8avTCl+c9OTmat6pKW8mLkvBpGzlvsiGuQr4ZEEwA1EQgoR/gNtxIxKBluz+OtMJiF31jHxqXBiAqAUj4WRxpADFM0DCFlv1khvX7Wol4vF4AIldVVxdZqlrIfiCYQPHDy6bAGv7nKYRVY6JewExZVAP+ey5Rv+Ba97aaUHMW5NauLmMZFkegBb/EP14d6NoS9QLWFSzWBmuZza8CQmSpXsAqmGtVy14VALWuuYWWy+W3OteXa4jwceQX6+BKG6J1/8+2VCNkm2222WabbbbZZpttttlmm22rt38DCdA0vq3bcAkAAAAASUVORK5CYII="; -document.querySelector("link[rel=icon]").setAttribute("href","data:image/png;base64,"+a),document.querySelector("#bake img").setAttribute("src","data:image/png;base64,"+b),document.querySelector(".about-img-left").setAttribute("src","data:image/png;base64,"+c)},SeasonalWaiter.prototype.insert_spider_text=function(){document.title=document.title.replace(/Cyber/g,"Spider"),SeasonalWaiter.tree_walk(document.body,function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Cyber/g,"Spider"))},!0),SeasonalWaiter.tree_walk(document.getElementById("bake-group"),function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Bake/g,"Spin"))},!0),document.querySelector("#recipe .title").innerHTML="Web"},SeasonalWaiter.prototype.create_snow_option=function(){var a=document.getElementById("options-body"),b=document.createElement("div");b.className="option-item",b.innerHTML=" Let it snow",a.appendChild(b),this.manager.options.load()},SeasonalWaiter.prototype.let_it_snow=function(){if($(document).snowfall("clear"),this.app.options.snow){var a={},b=navigator.userAgent.match(/Firefox\/(\d\d?)/);a=b&&parseInt(b[1],10)<30?{flakeCount:10,flakeColor:"#fff",flakePosition:"absolute",minSize:1,maxSize:2,minSpeed:1,maxSpeed:5,round:!1,shadow:!1,collection:!1,collectionHeight:20,deviceorientation:!0}:{flakeCount:35,flakeColor:"#fff",flakePosition:"absolute",minSize:5,maxSize:8,minSpeed:1,maxSpeed:5,round:!0,shadow:!0,collection:".btn",collectionHeight:20,deviceorientation:!0},$(document).snowfall(a)}},SeasonalWaiter.prototype.shake_off_snow=function(a){for(var b=a.target,c=b.getBoundingClientRect(),d=document.querySelectorAll("canvas.snowfall-canvas"),e=null,f=function(){h.clearRect(0,0,e.width,e.height),$(this).fadeIn()},g=0;g6e4&&this.app.silent_bake()};var main=function(){var a=["To Base64","From Base64","To Hex","From Hex","To Hexdump","From Hexdump","URL Decode","Regular expression","Entropy","Fork"],b={update_url:!0,show_highlighter:!0,treat_as_utf8:!0,word_wrap:!0,show_errors:!0,error_timeout:4e3,auto_bake_threshold:200,attempt_highlight:!0,snow:!1};document.removeEventListener("DOMContentLoaded",main,!1),window.app=new HTMLApp(Categories,OperationConfig,a,b),window.app.setup()};window.console=console||{log:function(){},error:function(){}},window.compile_time=moment.tz("Sat Dec 31 2016 17:09:43","ddd MMM D YYYY HH:mm:ss","UTC").valueOf(),window.compile_message="",document.addEventListener("DOMContentLoaded",main,!1); \ No newline at end of file +document.querySelector("link[rel=icon]").setAttribute("href","data:image/png;base64,"+a),document.querySelector("#bake img").setAttribute("src","data:image/png;base64,"+b),document.querySelector(".about-img-left").setAttribute("src","data:image/png;base64,"+c)},SeasonalWaiter.prototype.insert_spider_text=function(){document.title=document.title.replace(/Cyber/g,"Spider"),SeasonalWaiter.tree_walk(document.body,function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Cyber/g,"Spider"))},!0),SeasonalWaiter.tree_walk(document.getElementById("bake-group"),function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Bake/g,"Spin"))},!0),document.querySelector("#recipe .title").innerHTML="Web"},SeasonalWaiter.prototype.create_snow_option=function(){var a=document.getElementById("options-body"),b=document.createElement("div");b.className="option-item",b.innerHTML=" Let it snow",a.appendChild(b),this.manager.options.load()},SeasonalWaiter.prototype.let_it_snow=function(){if($(document).snowfall("clear"),this.app.options.snow){var a={},b=navigator.userAgent.match(/Firefox\/(\d\d?)/);a=b&&parseInt(b[1],10)<30?{flakeCount:10,flakeColor:"#fff",flakePosition:"absolute",minSize:1,maxSize:2,minSpeed:1,maxSpeed:5,round:!1,shadow:!1,collection:!1,collectionHeight:20,deviceorientation:!0}:{flakeCount:35,flakeColor:"#fff",flakePosition:"absolute",minSize:5,maxSize:8,minSpeed:1,maxSpeed:5,round:!0,shadow:!0,collection:".btn",collectionHeight:20,deviceorientation:!0},$(document).snowfall(a)}},SeasonalWaiter.prototype.shake_off_snow=function(a){for(var b=a.target,c=b.getBoundingClientRect(),d=document.querySelectorAll("canvas.snowfall-canvas"),e=null,f=function(){h.clearRect(0,0,e.width,e.height),$(this).fadeIn()},g=0;g6e4&&this.app.silent_bake()};var main=function(){var a=["To Base64","From Base64","To Hex","From Hex","To Hexdump","From Hexdump","URL Decode","Regular expression","Entropy","Fork"],b={update_url:!0,show_highlighter:!0,treat_as_utf8:!0,word_wrap:!0,show_errors:!0,error_timeout:4e3,auto_bake_threshold:200,attempt_highlight:!0,snow:!1};document.removeEventListener("DOMContentLoaded",main,!1),window.app=new HTMLApp(Categories,OperationConfig,a,b),window.app.setup()};window.console=console||{log:function(){},error:function(){}},window.compile_time=moment.tz("Mon Jan 16 2017 15:02:01","ddd MMM D YYYY HH:mm:ss","UTC").valueOf(),window.compile_message="",document.addEventListener("DOMContentLoaded",main,!1); \ No newline at end of file diff --git a/src/js/views/html/ControlsWaiter.js b/src/js/views/html/ControlsWaiter.js index c34e3150..6ddc08d1 100755 --- a/src/js/views/html/ControlsWaiter.js +++ b/src/js/views/html/ControlsWaiter.js @@ -293,7 +293,7 @@ ControlsWaiter.prototype.populate_load_recipes_list = function() { * Removes the currently selected recipe from local storage. */ ControlsWaiter.prototype.load_delete_click = function() { - var id = document.getElementById("load-name").value, + var id = parseInt(document.getElementById("load-name").value, 10), saved_recipes = localStorage.saved_recipes ? JSON.parse(localStorage.saved_recipes) : []; From baa433ab805f2d9d739554b6fc3d301563afc866 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Mon, 16 Jan 2017 15:58:38 +0000 Subject: [PATCH 17/24] 'Fork' operation now has an option to ignore errors occuring on each branch --- src/js/config/OperationConfig.js | 5 +++++ src/js/core/FlowControl.js | 35 ++++++++++++++++++++++---------- src/js/core/Recipe.js | 9 ++++---- 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/src/js/config/OperationConfig.js b/src/js/config/OperationConfig.js index 441cbbb1..2c6f5e9e 100755 --- a/src/js/config/OperationConfig.js +++ b/src/js/config/OperationConfig.js @@ -62,6 +62,11 @@ var OperationConfig = { name: "Merge delimiter", type: "binary_short_string", value: FlowControl.MERGE_DELIM + }, + { + name: "Ignore errors", + type: "boolean", + value: FlowControl.FORK_IGNORE_ERRORS } ] }, diff --git a/src/js/core/FlowControl.js b/src/js/core/FlowControl.js index 2730eed6..35801c16 100755 --- a/src/js/core/FlowControl.js +++ b/src/js/core/FlowControl.js @@ -19,6 +19,11 @@ var FlowControl = { * @default */ MERGE_DELIM: "\\n", + /** + * @constant + * @default + */ + FORK_IGNORE_ERRORS: false, /** * Fork operation. @@ -30,15 +35,16 @@ var FlowControl = { * @returns {Object} The updated state of the recipe. */ run_fork: function(state) { - var op_list = state.op_list, - input_type = op_list[state.progress].input_type, - output_type = op_list[state.progress].output_type, - input = state.dish.get(input_type), - ings = op_list[state.progress].get_ing_values(), - split_delim = ings[0], - merge_delim = ings[1], - sub_op_list = [], - inputs = []; + var op_list = state.op_list, + input_type = op_list[state.progress].input_type, + output_type = op_list[state.progress].output_type, + input = state.dish.get(input_type), + ings = op_list[state.progress].get_ing_values(), + split_delim = ings[0], + merge_delim = ings[1], + ignore_errors = ings[2], + sub_op_list = [], + inputs = []; if (input) inputs = input.split(split_delim); @@ -55,14 +61,21 @@ var FlowControl = { var recipe = new Recipe(), output = "", - progress; + progress = 0; recipe.add_operations(sub_op_list); // Run recipe over each tranche for (i = 0; i < inputs.length; i++) { var dish = new Dish(inputs[i], input_type); - progress = recipe.execute(dish, 0); + try { + progress = recipe.execute(dish, 0); + } catch(err) { + if (!ignore_errors) { + throw err; + } + progress = err.progress + 1; + } output += dish.get(output_type) + merge_delim; } diff --git a/src/js/core/Recipe.js b/src/js/core/Recipe.js index b93d7560..b5173bcb 100755 --- a/src/js/core/Recipe.js +++ b/src/js/core/Recipe.js @@ -177,13 +177,12 @@ Recipe.prototype.execute = function(dish, start_from) { var e = typeof err == "string" ? { message: err } : err; e.progress = i; - e.display_str = op.name + " - "; if (e.fileName) { - e.display_str += e.name + " in " + e.fileName + - " on line " + e.lineNumber + - ".

                                                                                                      Message: " + e.message; + e.display_str = op.name + " - " + e.name + " in " + + e.fileName + " on line " + e.lineNumber + + ".

                                                                                                      Message: " + (e.display_str || e.message); } else { - e.display_str += e.message; + e.display_str = op.name + " - " + (e.display_str || e.message); } throw e; From 2257754b94ac4e1044088a3905e58e3d36ebb2ee Mon Sep 17 00:00:00 2001 From: n1474335 Date: Mon, 16 Jan 2017 16:00:44 +0000 Subject: [PATCH 18/24] Jump operations now return the final state when the maximum jump count is reached instead of throwing an error. --- build/prod/cyberchef.htm | 16 ++++++++-------- build/prod/index.html | 2 +- build/prod/scripts.js | 12 ++++++------ src/js/core/FlowControl.js | 6 ++++-- src/static/stats.txt | 6 +++--- 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/build/prod/cyberchef.htm b/build/prod/cyberchef.htm index a3acee35..74e06029 100755 --- a/build/prod/cyberchef.htm +++ b/build/prod/cyberchef.htm @@ -91,11 +91,11 @@ 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. -*/.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.clo,.opn,.pun{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.kwd,.tag,.typ{font-weight:700}.str{color:#060}.kwd{color:#006}.com{color:#600;font-style:italic}.typ{color:#404}.lit{color:#044}.clo,.opn,.pun{color:#440}.tag{color:#006}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}#content-wrapper{top:0;left:0;width:100%;height:100%}#banner{height:30px;text-align:center;line-height:30px}#wrapper{top:30px;bottom:0}div#operations,div#recipe{width:50%;height:100%}div#input,div#output{width:100%;height:50%}.title{padding:10px;height:43px}.textarea-wrapper{top:43px;bottom:0;width:100%;overflow:hidden}#output-html,textarea{width:100%;height:100%;border:none;padding:3px;-moz-padding-start:3px;-moz-padding-end:3px}#input-text,#output-html,#output-text{position:relative;border-width:0;margin:0;resize:none;background-color:transparent;white-space:pre-wrap;word-wrap:break-word}#output-html{display:none;overflow-y:auto;-moz-padding-start:1px}.split{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;overflow:auto;position:relative}.gutter.gutter-horizontal,.split.split-horizontal{height:100%;float:left}#input-highlighter,#output-highlighter{position:absolute;left:0;top:0;width:100%;height:100%;padding:3px;margin:0;overflow:hidden;letter-spacing:normal;white-space:pre-wrap;word-wrap:break-word;color:#fff;background-color:transparent;border:none}#op_list,#rec_list,.op_list{margin:0;padding:0;list-style-type:none}#op_list,#rec_list{position:absolute;top:43px;bottom:0;width:100%}.io-btn-group,.io-info{margin-top:-4px;float:right}#rec_list{bottom:120px;overflow:auto}.operation{cursor:pointer;padding:10px;list-style-type:none;position:relative}#controls{position:absolute;width:100%;height:120px;bottom:0;padding:10px}.io-info{margin-right:20px;height:30px;text-align:right;line-height:10px}.arg-group,.inline-args input[type=checkbox]{margin-top:10px}#input-info{line-height:15px}.arg-group{display:table;width:100%}.arg-group-text{display:block}.inline-args{float:left;width:auto;margin-right:30px;height:34px}.inline-args input[type=number]{width:100px}.arg-input{display:table-cell;width:100%;padding:6px 12px}.short-string{width:150px}select{display:block}.arg[disabled]{cursor:not-allowed;opacity:1}textarea.arg{width:100%;min-height:50px;height:70px;margin-top:5px;border:1px solid #ddd;resize:vertical}.arg-label{display:table-cell;width:1px;padding-right:10px;font-weight:400;white-space:pre}.title,optgroup{font-weight:700}.editable-option{position:relative;display:inline-block}.editable-option-input{position:absolute;top:1px;left:1px;width:calc(100% - 20px);height:calc(100% - 2px)!important;border:none!important}#operational-controls{width:65%;float:left;text-align:center}#bake-group{display:table;width:100%}#bake{display:table-cell;width:100%;border-top-right-radius:0;border-bottom-right-radius:0}#auto-bake-label{display:table-cell;padding:1px;line-height:1.35;width:60px;border-top-left-radius:0;border-bottom-left-radius:0;border-left:1px solid #5cb85c}#auto-bake-label:hover{border-left-color:#398439}#auto-bake-label div{font-size:10px;padding:2px}#extra-controls{float:right;width:35%;padding-left:10px}.op-icon{float:right;margin-left:10px;margin-top:3px}.recip-icons{position:absolute;top:13px;right:10px;height:16px}.recip-icon{margin-right:10px;vertical-align:baseline;float:right}.disable-icon{width:16px;height:16px;margin-top:-1px;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAACfElEQVQ4y6WTPWgTYRjHf8nlfVvuoDVIP4Yuki4WHKoUqggFRUTsUEGkVG2hmCq6OnTwIxYHB+eijZOKdLNDW1pKKyGigh8dBHUJElxyBgx3vEnukvdyDrUhRXDxGR+e/+/583xEwjDkfyIGwNVTzURm4tYAMA6MAoN/0tvAMrA48uL+l2bx4w0iYRjSuHKC6OnTZLqHk8CcaZq9bW1tSCkBqNVq+L5PpVIpAHdGfr5LN9bXiT7Z2nGgteb1/qFkLBJZ6OjowHEc8vk8pVIJgHg8TldXF52dnb2u6y5s7R/iuF5JSyAKkLl4eyAMwznLsrBtm1wu99Z13amk+BFJih8R13WXANrb27EsizAM5zIXbw+wC9Baj0spe5VSFAqFt4ZhXJ6ufXuK55E5cDKVSCTGenp6yGazKKWQUvZqrcebgCAIRqWUOI6DEOLR1K8POapVMgfPpoC7u2LLspYcx0FKSRAEo60OBg3DwPd9Jr5vPqWvj8zh83vEwL2J75vnfN/HMAy01oPNNQZBQBAEO1OvVsl0D/8lTuZfpYDd7gRBQKuD7XK5jGmarB679PIv8deVFJUKq8cuTZqmSblcRmu93QpYVkohhMCyrLE94n2/UlSrbJy5kRBCXBNCoJRCa73cClh0XbfgeR6WZZHNZunv719KvnmeYnWVVxdmJ2Ox2DMhxFHP83Bdt6C1XgR2LvHzQDvvb84npZQL8Xgc0zSJRqN7br7RaFCpVCiVStRqtZmhh9fTh754TQdMr82nPc+bsW27UCwWUUpRr9ep1+sopSgWi9i2XfA8b2Z6bT6ttabp4GMi0uz0aXbhn890+MFM85mO5MIdwP/Eb1pMUCdctYRzAAAAAElFTkSuQmCC) no-repeat}.disable-icon-selected{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACFUlEQVR4XqWTP0tbURjGn9zY3mjBwsUhBQtS6XKxiNypIGZJ6SKYUYdaKWg7OrrE3pYO+Qit3dpFuuQO6lI7Z4nESQdjlJbkJh0MksSb3Jvk9H0gjZFu9YWH83LO7zn/3nNCSincJobAeP1sEDBFi6J50UyPy4l2RNuioz756Ts0tt1OB4jH2a52Ne2HGh9PwrJm2EcxZx/HyPRYMDgB2u02/N3d1c7w8BZMM1ptNJBPp3GwsUExB/s4RoYsPf0JOkFgdoH34YkJ/D48xC/HyTTOzl5ayWSIktwxqlVo0SjIkKWnP0Hg+4swjGitVMJFNpu5o+svptfXv6DZBDIZezoWS3Db3A0ZsvRcH8H354dGR9EoFHA3EvlorqycwvOAXM4G8Pav+f7YmEOGLD1gsIzl54+V+vBK/Yw9ZAv1LQW1FrdFSnKVfQTK5liPUfRI9I8ArqiPjLAF9vcHVybyzlpasgcZeq7voNXKNSsV3DMMXB4fp/8xLyzYuLri2DIZsvQM3sFOzXURiUR4zsQNcyrFleFVKpNyP2/IkKVnsArbF65bbkqplJSJZrl5x5qbs7G3h3artSyV+arr+lMyZOnpP2Wp6ZFos3R+vvUgCGDNzgKalkA4rECIr07662J2i0X4nrfJJ33jJT6Zmvpcr9XWCicn5WI+j7rrAmKgmLOPY2TI0sPgb8TBZOi/PpN1qnDr7/wH3jxgB/FKIXkAAAAASUVORK5CYII=) no-repeat}.breakpoint{float:right;width:14px;height:14px;background-color:#eee;border:1px solid #aaa}.breakpoint-selected{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAXVBMVEXIUkvzUVHzTEzzn5785eXrbW24BgbzWVnze3vzVVXzY2Pyion509PzbW3zXV1UMxj0l5f1srKbRTRgOxzJDg796ur74ODfIyP5zs6LLx3pNTXYGxuxdkVZNhn////sCC1eAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAABWSURBVBjTnc+7EoAgDERRTOQVxMEZFAf//z8FjAUFDbfb060QU2FwxngimxnCea3bjegSgz+0tguAfBgIy64QGfZQdg91dgAtqUZgnfz6IacYVWvu2AvR4wNAv0nxrAAAAABJRU5ErkJggg==) -2px -2px no-repeat #eee}.banner-right{float:right;margin-right:10px}#banner img{margin-bottom:2px;margin-left:8px}.category-title{display:block;padding:10px}.category{margin:0!important;border-radius:0!important;border:none}#search{border-radius:0;border:none}.loading_file{background:url(data:image/gif;base64,R0lGODlhPAA8APcAAAAAAAEBAQICAgMDAwQEBAUFBQYGBgcHBwgICAkJCQoKCgsLCwwMDA0NDQ4ODg8PDxAQEBERERISEhMTExQUFBUVFRYWFhcXFxgYGBkZGRoaGhsbGxwcHB0dHR4eHh8fHyAgICEhISIiIiM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Ah+QQhCAD/ACwCAAkAFgAvAAAI/gD/CRxIsJo/gv/WoUPH7yBCgfQ2SKSH0J/Dh/+uUQDA8QM4jCA5JeAIQMEnkBi7TSBZgRpKjNUqAKBQ6SVIY4ia2dzJMx23izwF5mGi5EnQgaWEzFg65eg/NUuXKjl31NGNqEucnpvTo8YTaE4FvgIVtqxZkPuABuWXb0+dRWH5zTFDF+7RWWnomqnD7agvNXrraDvqrw5dNJjC9ouEp9TZx5Aj62MWzFtZXp0ydbLntFzmTJlG9TvKDDRoUvCcmjJtKqw2UaNKqeXZL93syGXLUQ2LTxqzZtdGH63GrDiz3bSjGWe2zek1487SuYYWDRvCfPps7otHkeC6c+joId1Gqa6ceXPzCKMzb57d0X7n2JeT59Rf/HLSw9p7F290QAAh+QQhCAD/ACwCAAQAFgAvAAAI/gD/CRxIsKBAUkUOGVxYUE0CAAVwMGRoiwOAiww+TTToisJFiIo2GlTxEYO/jd1OEtzRAUa7fAztIUGSxF7BffwmfhsyoycTcyIJwtLRc8YOWUEHjhNSlAi3pAO7EZkxRBVUgtE+XbvKtaC7ciq5bspzZ0/XXXHMqO3D9ZFatXfaXVWF5u0dru0stUGz52nXYbi6Ch7MkF/Yq/z2lRIFq2u/UJkiN76aTFPkTKKAQo226bKoclf9iYqsKTDXfrRIBSPMurVrfuXAuRPczRkzZ/q4yrPNjFm0wyLL9e4d7R5XacOldWUHLZo04En90YPuWnA8eYL3nStXTh31iem4IXOfF3q7eHZc1Yk3R54ru3Pn1hXMl3tjv3swCa47h256QAA7) center center no-repeat #f5f5f5}#alert{position:fixed;width:30%;margin:30px auto;top:10px;left:0;right:0;z-index:2000;display:none}#alert a{text-decoration:underline}.option-item .bootstrap-switch{margin:15px 10px}.option-item button{margin:10px}.option-item input[type=number]{margin:15px 10px;width:80px;height:28px;padding:3px 10px;vertical-align:middle}.option-item select{margin:10px;display:inline-block}button img,span.btn img{margin-right:3px;margin-bottom:1px}#edit-favourites{float:right;margin-top:-5px}#edit-favourites-list{margin:10px}.about-img-left{float:left;margin:10px 20px 20px 0}.about-img-right{float:right;margin:10px 0 20px 20px}.save-link-options{float:right}.save-link-options input{margin-left:10px}#save-footer{border-top:none;margin-top:0}a:focus,button{outline:0;-moz-outline-style:none}.btn-default{border-color:#ddd}.btn-default:focus{background-color:#fff;border-color:#adadad}.btn-default:active,.btn-default:hover{background-color:#ebebeb;border-color:#adadad}.alert,.btn,.btn-lg,.dropdown-menu,.form-control,.modal-content,.nav-tabs>li>a,.popover,.tooltip-inner{border-radius:0!important}input[type=search]{-webkit-appearance:searchfield;box-shadow:none}input[type=search]::-webkit-search-cancel-button{-webkit-appearance:searchfield-cancel-button}.modal{overflow-y:auto}.form-control{background-color:transparent}code{border:0;white-space:pre-wrap}.bootstrap-switch,.bootstrap-switch-container,.bootstrap-switch-handle-off,.bootstrap-switch-handle-on,.bootstrap-switch-label,pre{border-radius:0!important}#banner,.title{border-bottom:1px solid #ddd}blockquote{font-size:inherit}.panel-body:after,.panel-body:before{content:""}.sortable-ghost{opacity:.6}.colorpicker-element{float:left;margin-right:15px}.colorpicker-color,.colorpicker-color div{height:100px}.word-wrap{white-space:pre!important;word-wrap:normal!important;overflow-x:scroll!important}.clearfix{height:0}.blur{color:transparent!important;text-shadow:rgba(0,0,0,.95) 0 0 10px!important}.no-select{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.konami{-ms-transform:rotate(180deg);-webkit-transform:rotate(180deg);transform:rotate(180deg);-moz-transform:rotate(180deg)}.hl1,.hlyellow{background-color:#fff000}.hl2,.hlblue{background-color:#95dfff}.hl3,.hlred{background-color:#ffb6b6}.hl4,.hlorange{background-color:#fcf8e3}.hl5,.hlgreen{background-color:#8de768}.title{color:#424242;background-color:#fafafa}.gutter{background-color:#eee;background-repeat:no-repeat;background-position:50%}.gutter.gutter-horizontal{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAAeCAYAAAAGos/EAAA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lfeqXKuaq1Wqt5RPXeAfWDwoOPBlhrlmqKa94e4h+7WetS212nXlR/GHM44/LQ+tL73a8bXjQ0KDUUNH4/wjowcDTza02jV2Nik1FTSDDcLm6eORR67+Y3rN50thi21rbTWouPguPD4s2+jvx064X2i+yTjZMt3Wt9Vt1HaCtuh9uz2mY74jpHO8M6BUytOdXfZdrV9b/T9kdNqp6vOyJ4pOUs4m3924VzOudnzqeenL8RdGOuO6n5wcdXF2z0BPf2XvC9duex++WKvU++5K3ZXTl+1uXrqGuNax3XL6+19Fn1tP1j80NZv2d9+w+pG503rm10DywfODjoMXrjleuvyba/b1++svDMwFDJ0dzhyeOQu++7kvaR7L+9n3J9/sOkh+mHhI6lH5Y+VHtf9qPdj64jlyJlR19G+J0FPHoyxxp7/lP7Th/H8p+Sn5ROqE42TZpOnp9ynbj5b/Wz8eerz+emCn6V/rn6h++K7Xxx/6ZtZNTP+kv9y4dfiV/Kvjrxe9rp71n/28ZvkN/NzhW/l3x59x3jX+z7s/cR85gfsh4qPeh+7Pnl/eriQvLDwG/eE8/s3BCkeAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAI0lEQVQYV2M8c+bMfwYgUFJSAlEM9+7dA9O05jOBSboDBgYAtPcYZ1oUA30AAAAASUVORK5CYII=);cursor:ns-resize}.operation{border:1px solid #999;border-top-width:0}.op_list .operation{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1}#rec_list .operation{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.arg-input,select{height:34px;border:1px solid #ddd;background-color:#fff;color:#424242}#controls{border-top:1px solid #ddd;background-color:#fafafa}.textarea-wrapper div,.textarea-wrapper textarea{font-family:Consolas,monospace;font-size:inherit}.io-info{font-weight:400;font-size:8pt}.arg-title,.category-title{font-weight:700}.arg-input{font-size:15px;line-height:1.428571429}select{padding:6px 8px}.arg[disabled]{background-color:#eee}textarea.arg{color:#424242}.break{color:#b94a48!important;background-color:#f2dede!important;border-color:#eed3d7!important}.category-title{background-color:#fafafa;border-bottom:1px solid #eee}.category-title[aria-expanded=true],.category-title[href='#catFavourites']{border-bottom-color:#ddd}.category-title.collapsed{border-bottom-color:#eee}.category-title:hover{color:#3a87ad}#search{border-bottom:1px solid #e3e3e3}.dropping-file{border:5px dashed #3a87ad!important}.selected-op{color:#c09853!important;background-color:#fcf8e3!important;border-color:#fbeed5!important}.option-item input[type=number]{font-size:14px;line-height:1.428571429;color:#555;background-color:#fff;border:1px solid #ccc}.favourites-hover{color:#468847;background-color:#dff0d8;border:2px dashed #468847!important;padding:8px 8px 9px}#edit-favourites-list{border:1px solid #bce8f1}#edit-favourites-list .operation{border-left:none;border-right:none}#edit-favourites-list .operation:last-child{border-bottom:none}.subtext{font-style:italic;font-size:13px;color:#999}#save-footer{border-bottom:1px solid #e5e5e5}.flow-control-op{color:#396f3a!important;background-color:#c7e4ba!important;border-color:#b3dba2!important}.flow-control-op.break{color:#94312f!important;background-color:#eabfbf!important;border-color:#e2aeb5!important}#support-modal textarea{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif}#load-text,#save-text{font-family:Consolas,monospace}button.dropdown-toggle{background-color:#f4f4f4}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-track{background-color:#fafafa}::-webkit-scrollbar-thumb{background-color:#ccc}::-webkit-scrollbar-thumb:hover{background-color:#bbb}::-webkit-scrollbar-corner{background-color:#fafafa}.disabled{color:#999!important;background-color:#dfdfdf!important;border-color:#cdcdcd!important}.grey{color:#333;background-color:#f5f5f5;border-color:#ddd}.dark-blue{color:#fff;background-color:#428bca;border-color:#428bca}.red{color:#b94a48;background-color:#f2dede;border-color:#eed3d7}.amber{color:#c09853;background-color:#fcf8e3;border-color:#fbeed5}.green{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.blue{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1} Edit
                                                                                                      Operations
                                                                                                        Recipe
                                                                                                          Input
                                                                                                          Output
                                                                                                          Operations
                                                                                                            Recipe
                                                                                                              Input
                                                                                                              Output
                                                                                                              \ No newline at end of file +"06032b0601050507":"pkix","06032b060105050701":"privateExtension","06032b06010505070101":"authorityInfoAccess","06032b06010505070c02":"CMC Data","06032b060105050702":"policyQualifierIds","06032b06010505070202":"unotice","06032b060105050703":"keyPurpose","06032b06010505070301":"serverAuth","06032b06010505070302":"clientAuth","06032b06010505070303":"codeSigning","06032b06010505070304":"emailProtection","06032b06010505070305":"ipsecEndSystem","06032b06010505070306":"ipsecTunnel","06032b06010505070307":"ipsecUser","06032b06010505070308":"timeStamping","06032b060105050704":"cmpInformationTypes","06032b06010505070401":"caProtEncCert","06032b06010505070402":"signKeyPairTypes","06032b06010505070403":"encKeyPairTypes","06032b06010505070404":"preferredSymmAlg","06032b06010505070405":"caKeyUpdateInfo","06032b06010505070406":"currentCRL","06032b06010505073001":"ocsp","06032b06010505073002":"caIssuers","06032b06010505080101":"HMAC-MD5","06032b06010505080102":"HMAC-SHA","060360864801650201010a":"mosaicKeyManagementAlgorithm","060360864801650201010b":"sdnsKMandSigAlgorithm","060360864801650201010c":"mosaicKMandSigAlgorithm","060360864801650201010d":"SuiteASignatureAlgorithm","060360864801650201010e":"SuiteAConfidentialityAlgorithm","060360864801650201010f":"SuiteAIntegrityAlgorithm","06036086480186f84201":"cert-extension","06036086480186f842010a":"EntityLogo","06036086480186f842010b":"UserPicture","06036086480186f8420109":"HomePage-url","06036086480186f84202":"data-type","06036086480186f8420201":"GIF","06036086480186f8420202":"JPEG","06036086480186f8420203":"URL","06036086480186f8420204":"HTML","06036086480186f8420205":"netscape-cert-sequence","06036086480186f8420206":"netscape-cert-url","06036086480186f84203":"directory","06036086480186f8420401":"serverGatedCrypto","06036086480186f845010603":"Unknown Verisign extension","06036086480186f845010606":"Unknown Verisign extension","06036086480186f84501070101":"Verisign certificatePolicy","06036086480186f8450107010101":"Unknown Verisign policy qualifier","06036086480186f8450107010102":"Unknown Verisign policy qualifier","0603678105":"TCPA","060367810501":"tcpa_specVersion","060367810502":"tcpa_attribute","06036781050201":"tcpa_at_tpmManufacturer","0603678105020a":"tcpa_at_securityQualities","0603678105020b":"tcpa_at_tpmProtectionProfile","0603678105020c":"tcpa_at_tpmSecurityTarget","0603678105020d":"tcpa_at_foundationProtectionProfile","0603678105020e":"tcpa_at_foundationSecurityTarget","0603678105020f":"tcpa_at_tpmIdLabel","06036781050202":"tcpa_at_tpmModel","06036781050203":"tcpa_at_tpmVersion","06036781050204":"tcpa_at_platformManufacturer","06036781050205":"tcpa_at_platformModel","06036781050206":"tcpa_at_platformVersion","06036781050207":"tcpa_at_componentManufacturer","06036781050208":"tcpa_at_componentModel","06036781050209":"tcpa_at_componentVersion","060367810503":"tcpa_protocol","06036781050301":"tcpa_prtt_tpmIdProtocol","0603672a00":"contentType","0603672a0000":"PANData","0603672a0001":"PANToken","0603672a0002":"PANOnly","0603672a01":"msgExt","0603672a0a":"national","0603672a0a8140":"Japan","0603672a02":"field","0603672a0200":"fullName","0603672a0201":"givenName","0603672a020a":"amount","0603672a0202":"familyName","0603672a0203":"birthFamilyName","0603672a0204":"placeName","0603672a0205":"identificationNumber","0603672a0206":"month","0603672a0207":"date","0603672a02070b":"accountNumber","0603672a02070c":"passPhrase","0603672a0208":"address","0603672a0209":"telephone","0603672a03":"attribute","0603672a0300":"cert","0603672a030000":"rootKeyThumb","0603672a030001":"additionalPolicy","0603672a04":"algorithm","0603672a05":"policy","0603672a0500":"root","0603672a06":"module","0603672a07":"certExt","0603672a0700":"hashedRootKey","0603672a0701":"certificateType","0603672a0702":"merchantData","0603672a0703":"cardCertRequired","0603672a0704":"tunneling","0603672a0705":"setExtensions","0603672a0706":"setQualifier","0603672a08":"brand","0603672a0801":"IATA-ATA","0603672a081e":"Diners","0603672a0822":"AmericanExpress","0603672a0804":"VISA","0603672a0805":"MasterCard","0603672a08ae7b":"Novus","0603672a09":"vendor","0603672a0900":"GlobeSet","0603672a0901":"IBM","0603672a090a":"Griffin","0603672a090b":"Certicom","0603672a090c":"OSS","0603672a090d":"TenthMountain","0603672a090e":"Antares","0603672a090f":"ECC","0603672a0910":"Maithean","0603672a0911":"Netscape","0603672a0912":"Verisign","0603672a0913":"BlueMoney","0603672a0902":"CyberCash","0603672a0914":"Lacerte","0603672a0915":"Fujitsu","0603672a0916":"eLab","0603672a0917":"Entrust","0603672a0918":"VIAnet","0603672a0919":"III","0603672a091a":"OpenMarket","0603672a091b":"Lexem","0603672a091c":"Intertrader","0603672a091d":"Persimmon","0603672a0903":"Terisa","0603672a091e":"NABLE","0603672a091f":"espace-net","0603672a0920":"Hitachi","0603672a0921":"Microsoft","0603672a0922":"NEC","0603672a0923":"Mitsubishi","0603672a0924":"NCR","0603672a0925":"e-COMM","0603672a0926":"Gemplus","0603672a0904":"RSADSI","0603672a0905":"VeriFone","0603672a0906":"TrinTech","0603672a0907":"BankGate","0603672a0908":"GTE","0603672a0909":"CompuSource","0603551d01":"authorityKeyIdentifier","0603551d0a":"basicConstraints","0603551d0b":"nameConstraints","0603551d0c":"policyConstraints","0603551d0d":"basicConstraints","0603551d0e":"subjectKeyIdentifier","0603551d0f":"keyUsage","0603551d10":"privateKeyUsagePeriod","0603551d11":"subjectAltName","0603551d12":"issuerAltName","0603551d13":"basicConstraints","0603551d02":"keyAttributes","0603551d14":"cRLNumber","0603551d15":"cRLReason","0603551d16":"expirationDate","0603551d17":"instructionCode","0603551d18":"invalidityDate","0603551d1a":"issuingDistributionPoint","0603551d1b":"deltaCRLIndicator","0603551d1c":"issuingDistributionPoint","0603551d1d":"certificateIssuer","0603551d03":"certificatePolicies","0603551d1e":"nameConstraints","0603551d1f":"cRLDistributionPoints","0603551d20":"certificatePolicies","0603551d21":"policyMappings","0603551d22":"policyConstraints","0603551d23":"authorityKeyIdentifier","0603551d24":"policyConstraints","0603551d25":"extKeyUsage","0603551d04":"keyUsageRestriction","0603551d05":"policyMapping","0603551d06":"subtreesConstraint","0603551d07":"subjectAltName","0603551d08":"issuerAltName","0603551d09":"subjectDirectoryAttributes","0603550400":"objectClass","0603550401":"aliasObjectName","060355040d":"description","060355040e":"searchGuide","060355040f":"businessCategory","0603550410":"postalAddress","0603550411":"postalCode","0603550412":"postOfficeBox","0603550413":"physicalDeliveryOfficeName","0603550402":"knowledgeInformation","0603550415":"telexNumber","0603550416":"teletexTerminalIdentifier","0603550417":"facsimileTelephoneNumber","0603550418":"x121Address","0603550419":"internationalISDNNumber","060355041a":"registeredAddress","060355041b":"destinationIndicator","060355041c":"preferredDeliveryMehtod","060355041d":"presentationAddress","060355041e":"supportedApplicationContext","060355041f":"member","0603550420":"owner","0603550421":"roleOccupant","0603550422":"seeAlso","0603550423":"userPassword","0603550424":"userCertificate","0603550425":"caCertificate","0603550426":"authorityRevocationList","0603550427":"certificateRevocationList","0603550428":"crossCertificatePair","0603550429":"givenName","0603550405":"serialNumber","0603550434":"supportedAlgorithms","0603550435":"deltaRevocationList","060355043a":"crossCertificatePair","06035508":"X.500-Algorithms","0603550801":"X.500-Alg-Encryption","060355080101":"rsa","0603604c0101":"DPC"};var Punycode={IDN:!1,run_to_ascii:function(a,b){var c=b[0];return c?punycode.ToASCII(a):punycode.encode(a)},run_to_unicode:function(a,b){var c=b[0];return c?punycode.ToUnicode(a):punycode.decode(a)}},QuotedPrintable={run_to:function(a,b){var c=QuotedPrintable.mimeEncode(a);return c=c.replace(/\r?\n|\r/g,function(){return"\r\n"}).replace(/[\t ]+$/gm,function(a){return a.replace(/ /g,"=20").replace(/\t/g,"=09")}),QuotedPrintable._addSoftLinebreaks(c,"qp")},run_from:function(a,b){var c=a.replace(/\=(?:\r?\n|$)/g,"");return QuotedPrintable.mimeDecode(c)},mimeDecode:function(a){for(var b,c,d=(a.match(/\=[\da-fA-F]{2}/g)||[]).length,e=a.length-2*d,f=new Array(e),g=0,h=0,i=a.length;h=0;c--)if(b[c].length){if(1===b[c].length&&a===b[c][0])return!0;if(2===b[c].length&&a>=b[c][0]&&a<=b[c][1])return!0}return!1},_addSoftLinebreaks:function(a,b){var c=76;return b=(b||"base64").toString().toLowerCase().trim(),"qp"===b?this._addQPSoftLinebreaks(a,c):this._addBase64SoftLinebreaks(a,c)},_addBase64SoftLinebreaks:function(a,b){return a=(a||"").toString().trim(),a.replace(new RegExp(".{"+b+"}","g"),"$&\r\n").trim()},_addQPSoftLinebreaks:function(a,b){for(var c,d,e,f=0,g=a.length,h=Math.floor(b/3),i="";fb-h&&(c=e.substr(-h).match(/[ \t\.,!\?][^ \t\.,!\?]*$/)))e=e.substr(0,e.length-(c[0].length-1));else if("\r"===e.substr(-1))e=e.substr(0,e.length-1);else if(e.match(/\=[\da-f]{0,2}$/i))for((c=e.match(/\=[\da-f]{0,1}$/i))&&(e=e.substr(0,e.length-c[0].length));e.length>3&&e.length=192)););f+e.length=65&&c<=90?(c=(c-65+d)%26,e[h]=c+65):f&&c>=97&&c<=122&&(c=(c-97+d)%26,e[h]=c+97)}return e},ROT47_AMOUNT:47,run_rot47:function(a,b){var c,d=b[0],e=a;if(d){d<0&&(d=94-Math.abs(d)%94);for(var f=0;f=33&&c<=126&&(c=(c-33+d)%94,e[f]=c+33)}return e},_rotr:function(a){var b=(1&a)<<7;return a>>1|b},_rotl:function(a){var b=a>>7&1;return 255&(a<<1|b)},_rotr_whole:function(a,b){var c,d=0,e=[];b%=8;for(var f=0;f>>0;c=g>>b|d,d=(g&Math.pow(2,b)-1)<<8-b,e.push(c)}return e[0]|=d,e},_rotl_whole:function(a,b){var c,d=0,e=[];b%=8;for(var f=a.length-1;f>=0;f--){var g=a[f];c=255&(g<>8-b&Math.pow(2,b)-1,e[f]=c}return e[a.length-1]=e[a.length-1]|d,e}},SeqUtils={DELIMITER_OPTIONS:["Line feed","CRLF","Space","Comma","Semi-colon","Colon","Nothing (separate chars)"],SORT_REVERSE:!1,SORT_ORDER:["Alphabetical (case sensitive)","Alphabetical (case insensitive)","IP address"],run_sort:function(a,b){var c=Utils.char_rep[b[0]],d=b[1],e=b[2],f=a.split(c);return"Alphabetical (case sensitive)"===e?f=f.sort():"Alphabetical (case insensitive)"===e?f=f.sort(SeqUtils._case_insensitive_sort):"IP address"===e&&(f=f.sort(SeqUtils._ip_sort)),d&&f.reverse(),f.join(c)},run_unique:function(a,b){var c=Utils.char_rep[b[0]];return a.split(c).unique().join(c)},SEARCH_TYPE:["Regex","Extended (\\n, \\t, \\x...)","Simple string"],run_count:function(a,b){var c=b[0].string,d=b[0].option;if("Regex"!==d||!c)return c?(0===d.indexOf("Extended")&&(c=Utils.parse_escaped_chars(c)),a.count(c)):0;try{var e=new RegExp(c,"gi"),f=a.match(e);return f.length}catch(a){return 0}},REVERSE_BY:["Character","Line"],run_reverse:function(a,b){if("Line"===b[0]){for(var c=[],d=[],e=[],f=0;f()\\[\\]{}\\s\\x7F-\\xFF]*(?:[.!,?]+[^.!,?;"\\x27<>()\\[\\]{}\\s\\x7F-\\xFF]+)*)?'},{name:"Domain",value:"(?:(https?):\\/\\/)?([-\\w.]+)\\.(com|net|org|biz|info|co|uk|onion|int|mobi|name|edu|gov|mil|eu|ac|ae|af|de|ca|ch|cn|cy|es|gb|hk|il|in|io|tv|me|nl|no|nz|ro|ru|tr|us|az|ir|kz|uz|pk)+"},{name:"Windows file path",value:"([A-Za-z]):\\\\((?:[A-Za-z\\d][A-Za-z\\d\\- \\x27_\\(\\)]{0,61}\\\\?)*[A-Za-z\\d][A-Za-z\\d\\- \\x27_\\(\\)]{0,61})(\\.[A-Za-z\\d]{1,6})?"},{name:"UNIX file path",value:"(?:/[A-Za-z\\d.][A-Za-z\\d\\-.]{0,61})+"},{name:"MAC address",value:"[A-Fa-f\\d]{2}(?:[:-][A-Fa-f\\d]{2}){5}"},{name:"Date (yyyy-mm-dd)",value:"((?:19|20)\\d\\d)[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])"},{name:"Date (dd/mm/yyyy)",value:"(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.]((?:19|20)\\d\\d)"},{name:"Date (mm/dd/yyyy)",value:"(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.]((?:19|20)\\d\\d)"},{name:"Strings",value:'[A-Za-z\\d/\\-:.,_$%\\x27"()<>= !\\[\\]{}@]{4,}'}],REGEX_CASE_INSENSITIVE:!0,REGEX_MULTILINE_MATCHING:!0,OUTPUT_FORMAT:["Highlight matches","List matches","List capture groups","List matches with capture groups"],DISPLAY_TOTAL:!1,run_regex:function(a,b){var c=b[1],d=b[2],e=b[3],f=b[4],g=b[5],h="g";if(d&&(h+="i"),e&&(h+="m"),!c||"^"===c||"$"===c)return Utils.escape_html(a);try{var i=new RegExp(c,h);switch(g){case"Highlight matches":return StrUtils._regex_highlight(a,i,f);case"List matches":return Utils.escape_html(StrUtils._regex_list(a,i,f,!0,!1));case"List capture groups":return Utils.escape_html(StrUtils._regex_list(a,i,f,!1,!0));case"List matches with capture groups":return Utils.escape_html(StrUtils._regex_list(a,i,f,!0,!0));default:return"Error: Invalid output format"}}catch(a){return"Invalid regex. Details: "+a.message}},CASE_SCOPE:["All","Word","Sentence","Paragraph"],run_upper:function(a,b){var c=b[0];switch(c){case"Word":return a.replace(/(\b\w)/gi,function(a){return a.toUpperCase()});case"Sentence":return a.replace(/(?:\.|^)\s*(\b\w)/gi,function(a){return a.toUpperCase()});case"Paragraph":return a.replace(/(?:\n|^)\s*(\b\w)/gi,function(a){return a.toUpperCase()});case"All":default:return a.toUpperCase()}},run_lower:function(a,b){return a.toLowerCase()},SEARCH_TYPE:["Regex","Extended (\\n, \\t, \\x...)","Simple string"],FIND_REPLACE_GLOBAL:!0,FIND_REPLACE_CASE:!1,FIND_REPLACE_MULTILINE:!0,run_find_replace:function(a,b){var c=b[0].string,d=b[0].option,e=b[1],f=b[2],g=b[3],h=b[4],i="";return f&&(i+="g"),g&&(i+="i"),h&&(i+="m"),"Regex"===d?c=new RegExp(c,i):0===d.indexOf("Extended")&&(c=Utils.parse_escaped_chars(c)),a.replace(c,e,i)},SPLIT_DELIM:",",DELIMITER_OPTIONS:["Line feed","CRLF","Space","Comma","Semi-colon","Colon","Nothing (separate chars)"],run_split:function(a,b){var c=b[0]||StrUtils.SPLIT_DELIM,d=Utils.char_rep[b[1]],e=a.split(c);return e.join(d)},run_filter:function(a,b){var c=Utils.char_rep[b[0]],d=b[2];try{var e=new RegExp(b[1])}catch(a){return"Invalid regex. Details: "+a.message}var f=function(a){return d^e.test(a)};return a.split(c).filter(f).join(c)},DIFF_SAMPLE_DELIMITER:"\\n\\n",DIFF_BY:["Character","Word","Line","Sentence","CSS","JSON"],run_diff:function(a,b){var c,d=b[0],e=b[1],f=b[2],g=b[3],h=b[4],i=a.split(d),j="";if(!i||2!==i.length)return"Incorrect number of samples, perhaps you need to modify the sample delimiter or add more samples?";switch(e){case"Character":c=JsDiff.diffChars(i[0],i[1]);break;case"Word":c=h?JsDiff.diffWords(i[0],i[1]):JsDiff.diffWordsWithSpace(i[0],i[1]);break;case"Line":c=h?JsDiff.diffTrimmedLines(i[0],i[1]):JsDiff.diffLines(i[0],i[1]);break;case"Sentence":c=JsDiff.diffSentences(i[0],i[1]);break;case"CSS":c=JsDiff.diffCss(i[0],i[1]);break;case"JSON":c=JsDiff.diffJson(i[0],i[1]);break;default:return"Invalid 'Diff by' option."}for(var k=0;k"+Utils.escape_html(c[k].value)+""):c[k].removed?g&&(j+=""+Utils.escape_html(c[k].value)+""):j+=Utils.escape_html(c[k].value);return j},OFF_CHK_SAMPLE_DELIMITER:"\\n\\n",run_offset_checker:function(a,b){var c,d=b[0],e=a.split(d),f=[],g=0,h=0,i=!1,j=!1;if(!e||e.length<2)return"Not enough samples, perhaps you need to modify the sample delimiter or add more data?";for(h=0;h"),h===e.length-1&&(j=!1)):(i&&!j?(f[h]+=""+Utils.escape_html(e[h][g]),e[h].length===g+1&&(f[h]+=""),h===e.length-1&&(j=!0)):!i&&j?(f[h]+=""+Utils.escape_html(e[h][g]),h===e.length-1&&(j=!1)):(f[h]+=Utils.escape_html(e[h][g]),j&&e[h].length===g+1&&(f[h]+="",e[h].length-1!==g&&(j=!1))),e[0].length-1===g&&(j&&(f[h]+=""),f[h]+=Utils.escape_html(e[h].substring(g+1))))}return f.join(d)},run_parse_escaped_string:function(a,b){return Utils.parse_escaped_chars(a)},_regex_highlight:function(a,b,c){for(var d,e="",f=1,g=0,h=0;d=b.exec(a);)e+=Utils.escape_html(a.slice(g,d.index)),e+=""+Utils.escape_html(d[0])+"",f=1===f?2:1,g=b.lastIndex,h++;return e+=Utils.escape_html(a.slice(g,a.length)),c&&(e="Total found: "+h+"\n\n"+e),e},_regex_list:function(a,b,c,d,e){for(var f,g="",h=0;f=b.exec(a);)if(h++,d&&(g+=f[0]+"\n"),e)for(var i=1;ih?g[i][0].length:h;for(i=0;i1&&g[i][1].length?" = "+g[i][1]+"\n":"\n"}return d}return"Invalid URI"},_encode_all_chars:function(a){return encodeURIComponent(a).replace(/!/g,"%21").replace(/#/g,"%23").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A").replace(/\-/g,"%2D").replace(/\./g,"%2E").replace(/_/g,"%5F").replace(/~/g,"%7E")}},UUID={run_generate_v4:function(a,b){if("undefined"!=typeof window.crypto&&"undefined"!=typeof window.crypto.getRandomValues){var c=new Uint32Array(4),d=0;return window.crypto.getRandomValues(c),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=c[d>>3]>>d%8*4&15,e="x"===a?b:3&b|8;return d++,e.toString(16)})}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"===a?b:3&b|8;return c.toString(16)})}},Chef=function(){this.dish=new Dish};Chef.prototype.bake=function(a,b,c,d,e){var f=(new Date).getTime(),g=new Recipe(b),h=g.contains_flow_control(),i=!1;c.hasOwnProperty("attempt_highlight")&&(c.attempt_highlight=!0),h&&(c.attempt_highlight=!1),d>=b.length&&(d=0),e&&(g.set_breakpoint(d,!1),g.set_breakpoint(d+1,!0)),d>0&&h&&(g.remove_breaks_up_to(d),d=0),0===d&&this.dish.set(a,Dish.STRING);try{d=g.execute(this.dish,d)}catch(a){i=a,d=a.progress}return{result:this.dish.type===Dish.HTML?this.dish.get(Dish.HTML):this.dish.get(Dish.STRING),type:Dish.enum_lookup(this.dish.type),progress:d,options:c,duration:(new Date).getTime()-f,error:i}},Chef.prototype.silent_bake=function(a){var b=(new Date).getTime(),c=new Recipe(a),d=new Dish("",Dish.STRING);try{c.execute(d)}catch(a){}return(new Date).getTime()-b};var Dish=function(a,b){this.value=a||"string"==typeof a?a:null,this.type=b||Dish.BYTE_ARRAY};Dish.BYTE_ARRAY=0,Dish.STRING=1,Dish.NUMBER=2,Dish.HTML=3,Dish.type_enum=function(a){switch(a){case"byte_array":case"Byte array":return Dish.BYTE_ARRAY;case"string":case"String":return Dish.STRING;case"number":case"Number":return Dish.NUMBER;case"html":case"HTML":return Dish.HTML;default:throw"Invalid data type string. No matching enum."}},Dish.enum_lookup=function(a){switch(a){case Dish.BYTE_ARRAY:return"byte_array";case Dish.STRING:return"string";case Dish.NUMBER:return"number";case Dish.HTML:return"html";default:throw"Invalid data type enum. No matching type."}},Dish.prototype.set=function(a,b){if(this.value=a,this.type=b,!this.valid()){var c=Utils.truncate(JSON.stringify(this.value),13);throw"Data is not a valid "+Dish.enum_lookup(b)+": "+c}},Dish.prototype.get=function(a){return this.type!==a&&this.translate(a),this.value},Dish.prototype.translate=function(a){switch(this.type){case Dish.STRING:this.value=this.value?Utils.str_to_byte_array(this.value):[],this.type=Dish.BYTE_ARRAY;break;case Dish.NUMBER:this.value="number"==typeof this.value?Utils.str_to_byte_array(this.value.toString()):[],this.type=Dish.BYTE_ARRAY;break;case Dish.HTML:this.value=this.value?Utils.str_to_byte_array(Utils.strip_html_tags(this.value,!0)):[],this.type=Dish.BYTE_ARRAY}switch(a){case Dish.STRING:case Dish.HTML:this.value=this.value?Utils.byte_array_to_utf8(this.value):"",this.type=Dish.STRING;break;case Dish.NUMBER:this.value=this.value?parseFloat(Utils.byte_array_to_utf8(this.value)):0,this.type=Dish.NUMBER}},Dish.prototype.valid=function(){switch(this.type){case Dish.BYTE_ARRAY:if(!(this.value instanceof Array))return!1;for(var a=0;a255)return!1;return!0;case Dish.STRING:case Dish.HTML:return"string"==typeof this.value;case Dish.NUMBER:return"number"==typeof this.value;default:return!1}};var FlowControl={FORK_DELIM:"\\n",MERGE_DELIM:"\\n",FORK_IGNORE_ERRORS:!1,run_fork:function(a){var b=a.op_list,c=b[a.progress].input_type,d=b[a.progress].output_type,e=a.dish.get(c),f=b[a.progress].get_ing_values(),g=f[0],h=f[1],i=f[2],j=[],k=[];e&&(k=e.split(g));for(var l=a.progress+1;l=d?(a.progress++,a):(a.progress+=c,a.num_jumps++,a)},run_cond_jump:function(a){var b=a.op_list[a.progress].get_ing_values(),c=a.dish,d=b[0],e=b[1],f=b[2];return a.num_jumps>=f?(a.progress++,a):(""!==d&&c.get(Dish.STRING).search(d)>-1&&(a.progress+=e,a.num_jumps++),a)},run_return:function(a){return a.progress=a.op_list.length,a}},Ingredient=function(a){this.name="",this.type="",this.value=null,a&&this._parse_config(a)};Ingredient.prototype._parse_config=function(a){this.name=a.name,this.type=a.type},Ingredient.prototype.get_config=function(){return this.value},Ingredient.prototype.set_value=function(a){this.value=Ingredient.prepare(a,this.type)},Ingredient.prepare=function(a,b){switch(b){case"binary_string":case"binary_short_string":case"editable_option":return Utils.parse_escaped_chars(a);case"byte_array":return"string"==typeof a?(a=a.replace(/\s+/g,""),Utils.hex_to_byte_array(a)):a;case"number":var c=parseFloat(a);if(isNaN(c)){var d=Utils.truncate(a.toString(),10);throw"Invalid ingredient value. Not a number: "+d}return c;default:return a}};var Operation=function(a,b){this.name=a,this.description="",this.input_type=-1,this.output_type=-1,this.run=null,this.highlight=null,this.highlight_reverse=null,this.breakpoint=!1,this.disabled=!1,this.ing_list=[],b&&this._parse_config(b)};Operation.prototype._parse_config=function(a){this.description=a.description,this.input_type=Dish.type_enum(a.input_type),this.output_type=Dish.type_enum(a.output_type),this.run=a.run,this.highlight=a.highlight,this.highlight_reverse=a.highlight_reverse,this.flow_control=a.flow_control;for(var b=0;b
                                                                                                              Message: "+(i.display_str||i.message):i.display_str=c.name+" - "+(i.display_str||i.message),i}}return this.op_list.length},Recipe.prototype.to_string=function(){return JSON.stringify(this.get_config())},Recipe.prototype.from_string=function(a){var b=JSON.parse(a);this._parse_config(b)};var Categories=[{name:"Favourites",ops:[]},{name:"Data format",ops:["To Hexdump","From Hexdump","To Hex","From Hex","To Charcode","From Charcode","To Decimal","From Decimal","To Binary","From Binary","To Base64","From Base64","Show Base64 offsets","To Base32","From Base32","To Base","From Base","To HTML Entity","From HTML Entity","URL Encode","URL Decode","Unescape Unicode Characters","To Quoted Printable","From Quoted Printable","To Punycode","From Punycode","To Hex Content","From Hex Content","PEM to Hex","Hex to PEM","Parse ASN.1 hex string","Change IP format","Text encoding","Swap endianness"]},{name:"Encryption / Encoding",ops:["AES Encrypt","AES Decrypt","Blowfish Encrypt","Blowfish Decrypt","DES Encrypt","DES Decrypt","Triple DES Encrypt","Triple DES Decrypt","Rabbit Encrypt","Rabbit Decrypt","RC4","RC4 Drop","ROT13","ROT47","XOR","XOR Brute Force","Vigen\xe8re Encode","Vigen\xe8re Decode","Substitute","Derive PBKDF2 key","Derive EVP key"]},{name:"Public Key",ops:["Parse X.509 certificate","Parse ASN.1 hex string","PEM to Hex","Hex to PEM","Hex to Object Identifier","Object Identifier to Hex"]},{name:"Logical operations",ops:["XOR","XOR Brute Force","OR","NOT","AND","ADD","SUB","Rotate left","Rotate right","ROT13"] +},{name:"Networking",ops:["Strip HTTP headers","Parse User Agent","Parse IP range","Parse IPv6 address","Parse URI","URL Encode","URL Decode","Format MAC addresses","Change IP format","Group IP addresses"]},{name:"Language",ops:["Text encoding","Unescape Unicode Characters"]},{name:"Utils",ops:["Diff","Remove whitespace","Remove null bytes","To Upper case","To Lower case","Add line numbers","Remove line numbers","Reverse","Sort","Unique","Split","Filter","Count occurrences","Expand alphabet range","Parse escaped string","Drop bytes","Take bytes","Pad lines","Find / Replace","Regular expression","Offset checker","Convert distance","Convert area","Convert mass","Convert speed","Convert data units","Parse UNIX file permissions","Swap endianness","Parse colour code"]},{name:"Date / Time",ops:["Parse DateTime","Translate DateTime Format","From UNIX Timestamp","To UNIX Timestamp","Extract dates"]},{name:"Extractors",ops:["Strings","Extract IP addresses","Extract email addresses","Extract MAC addresses","Extract URLs","Extract domains","Extract file paths","Extract dates","Regular expression","XPath expression","CSS selector"]},{name:"Compression",ops:["Raw Deflate","Raw Inflate","Zlib Deflate","Zlib Inflate","Gzip","Gunzip","Zip","Unzip","Bzip2 Decompress"]},{name:"Hashing",ops:["Analyse hash","Generate all hashes","MD5","SHA1","SHA224","SHA256","SHA384","SHA512","SHA3","RIPEMD-160","HMAC","Fletcher-16 Checksum","Adler-32 Checksum","CRC-32 Checksum","TCP/IP Checksum"]},{name:"Code tidy",ops:["Syntax highlighter","Generic Code Beautify","JavaScript Parser","JavaScript Beautify","JavaScript Minify","JSON Beautify","JSON Minify","XML Beautify","XML Minify","SQL Beautify","SQL Minify","CSS Beautify","CSS Minify","XPath expression","CSS selector","Strip HTML tags","Diff"]},{name:"Other",ops:["Entropy","Frequency distribution","Detect File Type","Scan for Embedded Files","Generate UUID","Numberwang"]},{name:"Flow control",ops:["Fork","Merge","Jump","Conditional Jump","Return"]}],OperationConfig={Fork:{description:"Split the input data up based on the specified delimiter and run all subsequent operations on each branch separately.

                                                                                                              For example, to decode multiple Base64 strings, enter them all on separate lines then add the 'Fork' and 'From Base64' operations to the recipe. Each string will be decoded separately.",run:FlowControl.run_fork,input_type:"string",output_type:"string",flow_control:!0,args:[{name:"Split delimiter",type:"binary_short_string",value:FlowControl.FORK_DELIM},{name:"Merge delimiter",type:"binary_short_string",value:FlowControl.MERGE_DELIM},{name:"Ignore errors",type:"boolean",value:FlowControl.FORK_IGNORE_ERRORS}]},Merge:{description:"Consolidate all branches back into a single trunk. The opposite of Fork.",run:FlowControl.run_merge,input_type:"string",output_type:"string",flow_control:!0,args:[]},Jump:{description:"Jump forwards or backwards over the specified number of operations.",run:FlowControl.run_jump,input_type:"string",output_type:"string",flow_control:!0,args:[{name:"Number of operations to jump over",type:"number",value:FlowControl.JUMP_NUM},{name:"Maximum jumps (if jumping backwards)",type:"number",value:FlowControl.MAX_JUMPS}]},"Conditional Jump":{description:"Conditionally jump forwards or backwards over the specified number of operations based on whether the data matches the specified regular expression.",run:FlowControl.run_cond_jump,input_type:"string",output_type:"string",flow_control:!0,args:[{name:"Match (regex)",type:"string",value:""},{name:"Number of operations to jump over if match found",type:"number",value:FlowControl.JUMP_NUM},{name:"Maximum jumps (if jumping backwards)",type:"number",value:FlowControl.MAX_JUMPS}]},Return:{description:"End execution of operations at this point in the recipe.",run:FlowControl.run_return,input_type:"string",output_type:"string",flow_control:!0,args:[]},"From Base64":{description:"Base64 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers.

                                                                                                              This operation decodes data from an ASCII Base64 string back into its raw format.

                                                                                                              e.g. aGVsbG8= becomes hello",run:Base64.run_from,highlight:Base64.highlight_from,highlight_reverse:Base64.highlight_to,input_type:"string",output_type:"byte_array",args:[{name:"Alphabet",type:"editable_option",value:Base64.ALPHABET_OPTIONS},{name:"Remove non‑alphabet chars",type:"boolean",value:Base64.REMOVE_NON_ALPH_CHARS}]},"To Base64":{description:"Base64 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers.

                                                                                                              This operation encodes data in an ASCII Base64 string.

                                                                                                              e.g. hello becomes aGVsbG8=",run:Base64.run_to,highlight:Base64.highlight_to,highlight_reverse:Base64.highlight_from,input_type:"byte_array",output_type:"string",args:[{name:"Alphabet",type:"editable_option",value:Base64.ALPHABET_OPTIONS}]},"From Base32":{description:"Base32 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers. It uses a smaller set of characters than Base64, usually the uppercase alphabet and the numbers 2 to 7.",run:Base64.run_from_32,input_type:"string",output_type:"byte_array",args:[{name:"Alphabet",type:"binary_string",value:Base64.BASE32_ALPHABET},{name:"Remove non‑alphabet chars",type:"boolean",value:Base64.REMOVE_NON_ALPH_CHARS}]},"To Base32":{description:"Base32 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers. It uses a smaller set of characters than Base64, usually the uppercase alphabet and the numbers 2 to 7.",run:Base64.run_to_32,input_type:"byte_array",output_type:"string",args:[{name:"Alphabet",type:"binary_string",value:Base64.BASE32_ALPHABET}]},"Show Base64 offsets":{description:"When a string is within a block of data and the whole block is Base64'd, the string itself could be represented in Base64 in three distinct ways depending on its offset within the block.

                                                                                                              This operation shows all possible offsets for a given string so that each possible encoding can be considered.",run:Base64.run_offsets,input_type:"byte_array",output_type:"html",args:[{name:"Alphabet",type:"binary_string",value:Base64.ALPHABET},{name:"Show variable chars and padding",type:"boolean",value:Base64.OFFSETS_SHOW_VARIABLE}]},XOR:{description:"XOR the input with the given key.
                                                                                                              e.g. fe023da5

                                                                                                              Options
                                                                                                              Null preserving: If the current byte is 0x00 or the same as the key, skip it.

                                                                                                              Scheme:
                                                                                                              • Standard - key is unchanged after each round
                                                                                                              • Input differential - key is set to the value of the previous unprocessed byte
                                                                                                              • Output differential - key is set to the value of the previous processed byte
                                                                                                              ",run:BitwiseOp.run_xor,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Key",type:"toggle_string",value:"",toggle_values:BitwiseOp.KEY_FORMAT},{name:"Scheme",type:"option",value:BitwiseOp.XOR_SCHEME},{name:"Null preserving",type:"boolean",value:BitwiseOp.XOR_PRESERVE_NULLS}]},"XOR Brute Force":{description:"Enumerate all possible XOR solutions. Current maximum key length is 2 due to browser performance.

                                                                                                              Optionally enter a regex string that you expect to find in the plaintext to filter results (crib).",run:BitwiseOp.run_xor_brute,input_type:"byte_array",output_type:"string",args:[{name:"Key length",type:"option",value:BitwiseOp.XOR_BRUTE_KEY_LENGTH},{name:"Length of sample",type:"number",value:BitwiseOp.XOR_BRUTE_SAMPLE_LENGTH},{name:"Offset of sample",type:"number",value:BitwiseOp.XOR_BRUTE_SAMPLE_OFFSET},{name:"Null preserving",type:"boolean",value:BitwiseOp.XOR_PRESERVE_NULLS},{name:"Differential",type:"boolean",value:BitwiseOp.XOR_DIFFERENTIAL},{name:"Crib (known plaintext string)",type:"binary_string",value:""},{name:"Print key",type:"boolean",value:BitwiseOp.XOR_BRUTE_PRINT_KEY},{name:"Output as hex",type:"boolean",value:BitwiseOp.XOR_BRUTE_OUTPUT_HEX}]},NOT:{description:"Returns the inverse of each byte.",run:BitwiseOp.run_not,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[]},AND:{description:"AND the input with the given key.
                                                                                                              e.g. fe023da5",run:BitwiseOp.run_and,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Key",type:"toggle_string",value:"",toggle_values:BitwiseOp.KEY_FORMAT}]},OR:{description:"OR the input with the given key.
                                                                                                              e.g. fe023da5",run:BitwiseOp.run_or,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Key",type:"toggle_string",value:"",toggle_values:BitwiseOp.KEY_FORMAT}]},ADD:{description:"ADD the input with the given key (e.g. fe023da5), MOD 255",run:BitwiseOp.run_add,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Key",type:"toggle_string",value:"",toggle_values:BitwiseOp.KEY_FORMAT}]},SUB:{description:"SUB the input with the given key (e.g. fe023da5), MOD 255",run:BitwiseOp.run_sub,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Key",type:"toggle_string",value:"",toggle_values:BitwiseOp.KEY_FORMAT}]},"From Hex":{description:"Converts a hexadecimal byte string back into a its raw value.

                                                                                                              e.g. ce 93 ce b5 ce b9 ce ac 20 cf 83 ce bf cf 85 0a becomes the UTF-8 encoded string \u0393\u03b5\u03b9\u03ac \u03c3\u03bf\u03c5",run:ByteRepr.run_from_hex,highlight:ByteRepr.highlight_from,highlight_reverse:ByteRepr.highlight_to,input_type:"string",output_type:"byte_array",args:[{name:"Delimiter",type:"option",value:ByteRepr.HEX_DELIM_OPTIONS}]},"To Hex":{description:"Converts the input string to hexadecimal bytes separated by the specified delimiter.

                                                                                                              e.g. The UTF-8 encoded string \u0393\u03b5\u03b9\u03ac \u03c3\u03bf\u03c5 becomes ce 93 ce b5 ce b9 ce ac 20 cf 83 ce bf cf 85 0a",run:ByteRepr.run_to_hex,highlight:ByteRepr.highlight_to,highlight_reverse:ByteRepr.highlight_from,input_type:"byte_array",output_type:"string",args:[{name:"Delimiter",type:"option",value:ByteRepr.HEX_DELIM_OPTIONS}]},"From Charcode":{description:"Converts unicode character codes back into text.

                                                                                                              e.g. 0393 03b5 03b9 03ac 20 03c3 03bf 03c5 becomes \u0393\u03b5\u03b9\u03ac \u03c3\u03bf\u03c5",run:ByteRepr.run_from_charcode,highlight:ByteRepr.highlight_from,highlight_reverse:ByteRepr.highlight_to,input_type:"string",output_type:"byte_array",args:[{name:"Delimiter",type:"option",value:ByteRepr.DELIM_OPTIONS},{name:"Base",type:"number",value:ByteRepr.CHARCODE_BASE}]},"To Charcode":{description:"Converts text to its unicode character code equivalent.

                                                                                                              e.g. \u0393\u03b5\u03b9\u03ac \u03c3\u03bf\u03c5 becomes 0393 03b5 03b9 03ac 20 03c3 03bf 03c5",run:ByteRepr.run_to_charcode,highlight:ByteRepr.highlight_to,highlight_reverse:ByteRepr.highlight_from,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"option",value:ByteRepr.DELIM_OPTIONS},{name:"Base",type:"number",value:ByteRepr.CHARCODE_BASE}]},"From Binary":{description:"Converts a binary string back into its raw form.

                                                                                                              e.g. 01001000 01101001 becomes Hi",run:ByteRepr.run_from_binary,highlight:ByteRepr.highlight_from_binary,highlight_reverse:ByteRepr.highlight_to_binary,input_type:"string",output_type:"byte_array",args:[{name:"Delimiter",type:"option",value:ByteRepr.BIN_DELIM_OPTIONS}]},"To Binary":{description:"Displays the input data as a binary string.

                                                                                                              e.g. Hi becomes 01001000 01101001",run:ByteRepr.run_to_binary,highlight:ByteRepr.highlight_to_binary,highlight_reverse:ByteRepr.highlight_from_binary,input_type:"byte_array",output_type:"string",args:[{name:"Delimiter",type:"option",value:ByteRepr.BIN_DELIM_OPTIONS}]},"From Decimal":{description:"Converts the data from an ordinal integer array back into its raw form.

                                                                                                              e.g. 72 101 108 108 111 becomes Hello",run:ByteRepr.run_from_decimal,input_type:"string",output_type:"byte_array",args:[{name:"Delimiter",type:"option",value:ByteRepr.DELIM_OPTIONS}]},"To Decimal":{description:"Converts the input data to an ordinal integer array.

                                                                                                              e.g. Hello becomes 72 101 108 108 111",run:ByteRepr.run_to_decimal,input_type:"byte_array",output_type:"string",args:[{name:"Delimiter",type:"option",value:ByteRepr.DELIM_OPTIONS}]},"From Hexdump":{description:"Attempts to convert a hexdump back into raw data. This operation supports many different hexdump variations, but probably not all. Make sure you verify that the data it gives you is correct before continuing analysis.",run:Hexdump.run_from,highlight:Hexdump.highlight_from,highlight_reverse:Hexdump.highlight_to,input_type:"string",output_type:"byte_array",args:[]},"To Hexdump":{description:"Creates a hexdump of the input data, displaying both the hexademinal values of each byte and an ASCII representation alongside.",run:Hexdump.run_to,highlight:Hexdump.highlight_to,highlight_reverse:Hexdump.highlight_from,input_type:"byte_array",output_type:"string",args:[{name:"Width",type:"number",value:Hexdump.WIDTH},{name:"Upper case hex",type:"boolean",value:Hexdump.UPPER_CASE},{name:"Include final length",type:"boolean",value:Hexdump.INCLUDE_FINAL_LENGTH}]},"From Base":{description:"Converts a number to decimal from a given numerical base.",run:Base.run_from,input_type:"string",output_type:"number",args:[{name:"Radix",type:"number",value:Base.DEFAULT_RADIX}]},"To Base":{description:"Converts a decimal number to a given numerical base.",run:Base.run_to,input_type:"number",output_type:"string",args:[{name:"Radix",type:"number",value:Base.DEFAULT_RADIX}]},"From HTML Entity":{description:"Converts HTML entities back to characters

                                                                                                              e.g. &amp; becomes &",run:HTML.run_from_entity,input_type:"string",output_type:"string",args:[]},"To HTML Entity":{description:"Converts characters to HTML entities

                                                                                                              e.g. & becomes &amp;",run:HTML.run_to_entity,input_type:"string",output_type:"string",args:[{name:"Convert all characters",type:"boolean",value:HTML.CONVERT_ALL},{name:"Convert to",type:"option",value:HTML.CONVERT_OPTIONS}]},"Strip HTML tags":{description:"Removes all HTML tags from the input.",run:HTML.run_strip_tags,input_type:"string",output_type:"string",args:[{name:"Remove indentation",type:"boolean",value:HTML.REMOVE_INDENTATION},{name:"Remove excess line breaks",type:"boolean",value:HTML.REMOVE_LINE_BREAKS}]},"URL Decode":{description:"Converts URI/URL percent-encoded characters back to their raw values.

                                                                                                              e.g. %3d becomes =",run:URL_.run_from,input_type:"string",output_type:"string",args:[]},"URL Encode":{description:"Encodes problematic characters into percent-encoding, a format supported by URIs/URLs.

                                                                                                              e.g. = becomes %3d",run:URL_.run_to,input_type:"string",output_type:"string",args:[{name:"Encode all special chars",type:"boolean",value:URL_.ENCODE_ALL}]},"Parse URI":{description:"Pretty prints complicated Uniform Resource Identifier (URI) strings for ease of reading. Particularly useful for Uniform Resource Locators (URLs) with a lot of arguments.",run:URL_.run_parse,input_type:"string",output_type:"string",args:[]},"Unescape Unicode Characters":{description:"Converts unicode-escaped character notation back into raw characters.

                                                                                                              Supports the prefixes:
                                                                                                              • \\u
                                                                                                              • %u
                                                                                                              • U+
                                                                                                              e.g. \\u03c3\\u03bf\\u03c5 becomes \u03c3\u03bf\u03c5",run:Unicode.run_unescape,input_type:"string",output_type:"string",args:[{name:"Prefix",type:"option",value:Unicode.PREFIXES}]},"From Quoted Printable":{description:"Converts QP-encoded text back to standard text.",run:QuotedPrintable.run_from,input_type:"string",output_type:"byte_array",args:[]},"To Quoted Printable":{description:"Quoted-Printable, or QP encoding, is an encoding using printable ASCII characters (alphanumeric and the equals sign '=') to transmit 8-bit data over a 7-bit data path or, generally, over a medium which is not 8-bit clean. It is defined as a MIME content transfer encoding for use in e-mail.

                                                                                                              QP works by using the equals sign '=' as an escape character. It also limits line length to 76, as some software has limits on line length.",run:QuotedPrintable.run_to,input_type:"byte_array",output_type:"string",args:[]},"From Punycode":{description:"Punycode is a way to represent Unicode with the limited character subset of ASCII supported by the Domain Name System.

                                                                                                              e.g. mnchen-3ya decodes to m\xfcnchen",run:Punycode.run_to_unicode,input_type:"string",output_type:"string",args:[{name:"Internationalised domain name",type:"boolean",value:Punycode.IDN}]},"To Punycode":{description:"Punycode is a way to represent Unicode with the limited character subset of ASCII supported by the Domain Name System.

                                                                                                              e.g. m\xfcnchen encodes to mnchen-3ya",run:Punycode.run_to_ascii,input_type:"string",output_type:"string",args:[{name:"Internationalised domain name",type:"boolean",value:Punycode.IDN}]},"From Hex Content":{description:"Translates hexadecimal bytes in text back to raw bytes.

                                                                                                              e.g. foo|3d|bar becomes foo=bar.",run:ByteRepr.run_from_hex_content,input_type:"string",output_type:"byte_array",args:[]},"To Hex Content":{description:"Converts special characters in a string to hexadecimal.

                                                                                                              e.g. foo=bar becomes foo|3d|bar.",run:ByteRepr.run_to_hex_content,input_type:"byte_array",output_type:"string",args:[{name:"Convert",type:"option",value:ByteRepr.HEX_CONTENT_CONVERT_WHICH},{name:"Print spaces between bytes",type:"boolean",value:ByteRepr.HEX_CONTENT_SPACES_BETWEEN_BYTES}]},"Change IP format":{description:"Convert an IP address from one format to another, e.g. 172.20.23.54 to ac141736",run:IP.run_change_ip_format,input_type:"string",output_type:"string",args:[{name:"Input format",type:"option",value:IP.IP_FORMAT_LIST},{name:"Output format",type:"option",value:IP.IP_FORMAT_LIST}]},"Parse IP range":{description:"Given a CIDR range (e.g. 10.0.0.0/24) or a hyphenated range (e.g. 10.0.0.0 - 10.0.1.0), this operation provides network information and enumerates all IP addresses in the range.

                                                                                                              IPv6 is supported but will not be enumerated.",run:IP.run_parse_ip_range,input_type:"string",output_type:"string",args:[{name:"Include network info",type:"boolean",value:IP.INCLUDE_NETWORK_INFO},{name:"Enumerate IP addresses",type:"boolean",value:IP.ENUMERATE_ADDRESSES},{name:"Allow large queries",type:"boolean",value:IP.ALLOW_LARGE_LIST}]},"Group IP addresses":{description:"Groups a list of IP addresses into subnets. Supports both IPv4 and IPv6 addresses.",run:IP.run_group_ips,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"option",value:IP.DELIM_OPTIONS},{name:"Subnet (CIDR)",type:"number",value:IP.GROUP_CIDR},{name:"Only show the subnets",type:"boolean",value:IP.GROUP_ONLY_SUBNET}]},"Parse IPv6 address":{description:"Displays the longhand and shorthand versions of a valid IPv6 address.

                                                                                                              Recognises all reserved ranges and parses encapsulated or tunnelled addresses including Teredo and 6to4.",run:IP.run_parse_ipv6,input_type:"string",output_type:"string",args:[]},"Text encoding":{description:"Translates the data between different character encodings.

                                                                                                              Supported charsets are:
                                                                                                              • UTF8
                                                                                                              • UTF16
                                                                                                              • UTF16LE (little-endian)
                                                                                                              • UTF16BE (big-endian)
                                                                                                              • Hex
                                                                                                              • Base64
                                                                                                              • Latin1 (ISO-8859-1)
                                                                                                              • Windows-1251
                                                                                                              ",run:CharEnc.run,input_type:"string",output_type:"string",args:[{name:"Input type",type:"option",value:CharEnc.IO_FORMAT},{name:"Output type",type:"option",value:CharEnc.IO_FORMAT}]},"AES Decrypt":{description:"To successfully decrypt AES, you need either:
                                                                                                              • The passphrase
                                                                                                              • Or the key and IV
                                                                                                              The IV should be the first 16 bytes of encrypted material.",run:Cipher.run_aes_dec,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Input format",type:"option",value:Cipher.IO_FORMAT1},{name:"Output format",type:"option",value:Cipher.IO_FORMAT2}]},"AES Encrypt":{description:"Input: Either enter a passphrase (which will be used to derive a key using the OpenSSL KDF) or both the key and IV.

                                                                                                              Advanced Encryption Standard (AES) is a U.S. Federal Information Processing Standard (FIPS). It was selected after a 5-year process where 15 competing designs were evaluated.

                                                                                                              AES-128, AES-192, and AES-256 are supported. The variant will be chosen based on the size of the key passed in. If a passphrase is used, a 256-bit key will be generated.",run:Cipher.run_aes_enc,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Output result",type:"option",value:Cipher.RESULT_TYPE},{name:"Output format",type:"option",value:Cipher.IO_FORMAT1}]},"DES Decrypt":{description:"To successfully decrypt DES, you need either:
                                                                                                              • The passphrase
                                                                                                              • Or the key and IV
                                                                                                              The IV should be the first 8 bytes of encrypted material.",run:Cipher.run_des_dec,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Input format",type:"option",value:Cipher.IO_FORMAT1},{name:"Output format",type:"option",value:Cipher.IO_FORMAT2}]},"DES Encrypt":{description:"Input: Either enter a passphrase (which will be used to derive a key using the OpenSSL KDF) or both the key and IV.

                                                                                                              DES is a previously dominant algorithm for encryption, and was published as an official U.S. Federal Information Processing Standard (FIPS). It is now considered to be insecure due to its small key size.",run:Cipher.run_des_enc,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Output result",type:"option",value:Cipher.RESULT_TYPE},{name:"Output format",type:"option",value:Cipher.IO_FORMAT1}]},"Triple DES Decrypt":{description:"To successfully decrypt Triple DES, you need either:
                                                                                                              • The passphrase
                                                                                                              • Or the key and IV
                                                                                                              The IV should be the first 8 bytes of encrypted material.",run:Cipher.run_triple_des_dec,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Input format",type:"option",value:Cipher.IO_FORMAT1},{name:"Output format",type:"option",value:Cipher.IO_FORMAT2}]},"Triple DES Encrypt":{description:"Input: Either enter a passphrase (which will be used to derive a key using the OpenSSL KDF) or both the key and IV.

                                                                                                              Triple DES applies DES three times to each block to increase key size.",run:Cipher.run_triple_des_enc,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Output result",type:"option",value:Cipher.RESULT_TYPE},{name:"Output format",type:"option",value:Cipher.IO_FORMAT1}]},"Blowfish Decrypt":{description:"Blowfish is a symmetric-key block cipher designed in 1993 by Bruce Schneier and included in a large number of cipher suites and encryption products. AES now receives more attention.",run:Cipher.run_blowfish_dec,input_type:"string",output_type:"string",args:[{name:"Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"Mode",type:"option",value:Cipher.BLOWFISH_MODES},{name:"Input format",type:"option",value:Cipher.IO_FORMAT3}]},"Blowfish Encrypt":{description:"Blowfish is a symmetric-key block cipher designed in 1993 by Bruce Schneier and included in a large number of cipher suites and encryption products. AES now receives more attention.",run:Cipher.run_blowfish_enc,input_type:"string",output_type:"string",args:[{name:"Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"Mode",type:"option",value:Cipher.BLOWFISH_MODES},{name:"Output format",type:"option",value:Cipher.IO_FORMAT3}]},"Rabbit Decrypt":{description:"To successfully decrypt Rabbit, you need either:
                                                                                                              • The passphrase
                                                                                                              • Or the key and IV (This is currently broken. You need the key and salt at the moment.)
                                                                                                              The IV should be the first 8 bytes of encrypted material.",run:Cipher.run_rabbit_dec,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Input format",type:"option",value:Cipher.IO_FORMAT1},{name:"Output format",type:"option",value:Cipher.IO_FORMAT2}]},"Rabbit Encrypt":{description:"Input: Either enter a passphrase (which will be used to derive a key using the OpenSSL KDF) or both the key and IV.

                                                                                                              Rabbit is a high-performance stream cipher and a finalist in the eSTREAM Portfolio. It is one of the four designs selected after a 3 1/2 year process where 22 designs were evaluated.",run:Cipher.run_rabbit_enc,input_type:"string",output_type:"string",args:[{name:"Passphrase/Key",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"IV",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Salt",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT1},{name:"Mode",type:"option",value:Cipher.MODES},{name:"Padding",type:"option",value:Cipher.PADDING},{name:"Output result",type:"option",value:Cipher.RESULT_TYPE},{name:"Output format",type:"option",value:Cipher.IO_FORMAT1}]},RC4:{description:"RC4 is a widely-used stream cipher. It is used in popular protocols such as SSL and WEP. Although remarkable for its simplicity and speed, the algorithm's history doesn't inspire confidence in its security.",run:Cipher.run_rc4,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[{name:"Passphrase",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"Input format",type:"option",value:Cipher.IO_FORMAT4},{name:"Output format",type:"option",value:Cipher.IO_FORMAT4}]},"RC4 Drop":{description:"It was discovered that the first few bytes of the RC4 keystream are strongly non-random and leak information about the key. We can defend against this attack by discarding the initial portion of the keystream. This modified algorithm is traditionally called RC4-drop.",run:Cipher.run_rc4drop,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[{name:"Passphrase",type:"toggle_string",value:"",toggle_values:Cipher.IO_FORMAT2},{name:"Input format",type:"option",value:Cipher.IO_FORMAT4},{name:"Output format",type:"option",value:Cipher.IO_FORMAT4},{name:"Number of bytes to drop",type:"number",value:Cipher.RC4DROP_BYTES}]},"Derive PBKDF2 key":{description:"PBKDF2 is a password-based key derivation function. In many applications of cryptography, user security is ultimately dependent on a password, and because a password usually can't be used directly as a cryptographic key, some processing is required.

                                                                                                              A salt provides a large set of keys for any given password, and an iteration count increases the cost of producing keys from a password, thereby also increasing the difficulty of attack.

                                                                                                              Enter your passphrase as the input and then set the relevant options to generate a key.",run:Cipher.run_pbkdf2,input_type:"string",output_type:"string",args:[{name:"Key size",type:"number",value:Cipher.KDF_KEY_SIZE},{name:"Iterations",type:"number",value:Cipher.KDF_ITERATIONS},{name:"Salt (hex)",type:"string",value:""},{name:"Input format",type:"option",value:Cipher.IO_FORMAT2},{name:"Output format",type:"option",value:Cipher.IO_FORMAT3}]},"Derive EVP key":{description:"EVP is a password-based key derivation function used extensively in OpenSSL. In many applications of cryptography, user security is ultimately dependent on a password, and because a password usually can't be used directly as a cryptographic key, some processing is required.

                                                                                                              A salt provides a large set of keys for any given password, and an iteration count increases the cost of producing keys from a password, thereby also increasing the difficulty of attack.

                                                                                                              Enter your passphrase as the input and then set the relevant options to generate a key.",run:Cipher.run_evpkdf,input_type:"string",output_type:"string",args:[{name:"Key size",type:"number",value:Cipher.KDF_KEY_SIZE},{name:"Iterations",type:"number",value:Cipher.KDF_ITERATIONS},{name:"Salt (hex)",type:"string",value:""},{name:"Input format",type:"option",value:Cipher.IO_FORMAT2},{name:"Output format",type:"option",value:Cipher.IO_FORMAT3}]},"Vigen\xe8re Encode":{description:"The Vigenere cipher is a method of encrypting alphabetic text by using a series of different Caesar ciphers based on the letters of a keyword. It is a simple form of polyalphabetic substitution.",run:Cipher.run_vigenere_enc,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[{name:"Key",type:"string",value:""}]},"Vigen\xe8re Decode":{description:"The Vigenere cipher is a method of encrypting alphabetic text by using a series of different Caesar ciphers based on the letters of a keyword. It is a simple form of polyalphabetic substitution.",run:Cipher.run_vigenere_dec,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[{name:"Key",type:"string",value:""}]},"Rotate right":{description:"Rotates each byte to the right by the number of bits specified. Currently only supports 8-bit values.",run:Rotate.run_rotr,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Number of bits", +type:"number",value:Rotate.ROTATE_AMOUNT},{name:"Rotate as a whole",type:"boolean",value:Rotate.ROTATE_WHOLE}]},"Rotate left":{description:"Rotates each byte to the left by the number of bits specified. Currently only supports 8-bit values.",run:Rotate.run_rotl,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Number of bits",type:"number",value:Rotate.ROTATE_AMOUNT},{name:"Rotate as a whole",type:"boolean",value:Rotate.ROTATE_WHOLE}]},ROT13:{description:"A simple caesar substitution cipher which rotates alphabet characters by the specified amount (default 13).",run:Rotate.run_rot13,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Rotate lower case chars",type:"boolean",value:Rotate.ROT13_LOWERCASE},{name:"Rotate upper case chars",type:"boolean",value:Rotate.ROT13_UPPERCASE},{name:"Amount",type:"number",value:Rotate.ROT13_AMOUNT}]},ROT47:{description:"A slightly more complex variation of a caesar cipher, which includes ASCII characters from 33 '!' to 126 '~'. Default rotation: 47.",run:Rotate.run_rot47,highlight:!0,highlight_reverse:!0,input_type:"byte_array",output_type:"byte_array",args:[{name:"Amount",type:"number",value:Rotate.ROT47_AMOUNT}]},"Strip HTTP headers":{description:"Removes HTTP headers from a request or response by looking for the first instance of a double newline.",run:HTTP.run_strip_headers,input_type:"string",output_type:"string",args:[]},"Parse User Agent":{description:"Attempts to identify and categorise information contained in a user-agent string.",run:HTTP.run_parse_user_agent,input_type:"string",output_type:"string",args:[]},"Format MAC addresses":{description:"Displays given MAC addresses in multiple different formats.

                                                                                                              Expects addresses in a list separated by newlines, spaces or commas.

                                                                                                              WARNING: There are no validity checks.",run:MAC.run_format,input_type:"string",output_type:"string",args:[{name:"Output case",type:"option",value:MAC.OUTPUT_CASE},{name:"No delimiter",type:"boolean",value:MAC.NO_DELIM},{name:"Dash delimiter",type:"boolean",value:MAC.DASH_DELIM},{name:"Colon delimiter",type:"boolean",value:MAC.COLON_DELIM},{name:"Cisco style",type:"boolean",value:MAC.CISCO_STYLE}]},"Offset checker":{description:"Compares multiple inputs (separated by the specified delimiter) and highlights matching characters which appear at the same position in all samples.",run:StrUtils.run_offset_checker,input_type:"string",output_type:"html",args:[{name:"Sample delimiter",type:"binary_string",value:StrUtils.OFF_CHK_SAMPLE_DELIMITER}]},"Remove whitespace":{description:"Optionally removes all spaces, carriage returns, line feeds, tabs and form feeds from the input data.

                                                                                                              This operation also supports the removal of full stops which are sometimes used to represent non-printable bytes in ASCII output.",run:Tidy.run_remove_whitespace,input_type:"string",output_type:"string",args:[{name:"Spaces",type:"boolean",value:Tidy.REMOVE_SPACES},{name:"Carriage returns (\\r)",type:"boolean",value:Tidy.REMOVE_CARIAGE_RETURNS},{name:"Line feeds (\\n)",type:"boolean",value:Tidy.REMOVE_LINE_FEEDS},{name:"Tabs",type:"boolean",value:Tidy.REMOVE_TABS},{name:"Form feeds (\\f)",type:"boolean",value:Tidy.REMOVE_FORM_FEEDS},{name:"Full stops",type:"boolean",value:Tidy.REMOVE_FULL_STOPS}]},"Remove null bytes":{description:"Removes all null bytes (0x00) from the input.",run:Tidy.run_remove_nulls,input_type:"byte_array",output_type:"byte_array",args:[]},"Drop bytes":{description:"Cuts the specified number of bytes out of the data.",run:Tidy.run_drop_bytes,input_type:"byte_array",output_type:"byte_array",args:[{name:"Start",type:"number",value:Tidy.DROP_START},{name:"Length",type:"number",value:Tidy.DROP_LENGTH},{name:"Apply to each line",type:"boolean",value:Tidy.APPLY_TO_EACH_LINE}]},"Take bytes":{description:"Takes a slice of the specified number of bytes from the data.",run:Tidy.run_take_bytes,input_type:"byte_array",output_type:"byte_array",args:[{name:"Start",type:"number",value:Tidy.TAKE_START},{name:"Length",type:"number",value:Tidy.TAKE_LENGTH},{name:"Apply to each line",type:"boolean",value:Tidy.APPLY_TO_EACH_LINE}]},"Pad lines":{description:"Add the specified number of the specified character to the beginning or end of each line",run:Tidy.run_pad,input_type:"string",output_type:"string",args:[{name:"Position",type:"option",value:Tidy.PAD_POSITION},{name:"Length",type:"number",value:Tidy.PAD_LENGTH},{name:"Character",type:"binary_short_string",value:Tidy.PAD_CHAR}]},Reverse:{description:"Reverses the input string.",run:SeqUtils.run_reverse,input_type:"byte_array",output_type:"byte_array",args:[{name:"By",type:"option",value:SeqUtils.REVERSE_BY}]},Sort:{description:"Alphabetically sorts strings separated by the specified delimiter.

                                                                                                              The IP address option supports IPv4 only.",run:SeqUtils.run_sort,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"option",value:SeqUtils.DELIMITER_OPTIONS},{name:"Reverse",type:"boolean",value:SeqUtils.SORT_REVERSE},{name:"Order",type:"option",value:SeqUtils.SORT_ORDER}]},Unique:{description:"Removes duplicate strings from the input.",run:SeqUtils.run_unique,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"option",value:SeqUtils.DELIMITER_OPTIONS}]},"Count occurrences":{description:"Counts the number of times the provided string occurs in the input.",run:SeqUtils.run_count,input_type:"string",output_type:"number",args:[{name:"Search string",type:"toggle_string",value:"",toggle_values:SeqUtils.SEARCH_TYPE}]},"Add line numbers":{description:"Adds line numbers to the output.",run:SeqUtils.run_add_line_numbers,input_type:"string",output_type:"string",args:[]},"Remove line numbers":{description:"Removes line numbers from the output if they can be trivially detected.",run:SeqUtils.run_remove_line_numbers,input_type:"string",output_type:"string",args:[]},"Find / Replace":{description:"Replaces all occurrences of the first string with the second.

                                                                                                              The three match options are only relevant to regex search strings.",run:StrUtils.run_find_replace,manual_bake:!0,input_type:"string",output_type:"string",args:[{name:"Find",type:"toggle_string",value:"",toggle_values:StrUtils.SEARCH_TYPE},{name:"Replace",type:"binary_string",value:""},{name:"Global match",type:"boolean",value:StrUtils.FIND_REPLACE_GLOBAL},{name:"Case insensitive",type:"boolean",value:StrUtils.FIND_REPLACE_CASE},{name:"Multiline matching",type:"boolean",value:StrUtils.FIND_REPLACE_MULTILINE}]},"To Upper case":{description:"Converts the input string to upper case, optionally limiting scope to only the first character in each word, sentence or paragraph.",run:StrUtils.run_upper,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[{name:"Scope",type:"option",value:StrUtils.CASE_SCOPE}]},"To Lower case":{description:"Converts every character in the input to lower case.",run:StrUtils.run_lower,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[]},Split:{description:"Splits a string into sections around a given delimiter.",run:StrUtils.run_split,input_type:"string",output_type:"string",args:[{name:"Split delimiter",type:"binary_short_string",value:StrUtils.SPLIT_DELIM},{name:"Join delimiter",type:"option",value:StrUtils.DELIMITER_OPTIONS}]},Filter:{description:"Splits up the input using the specified delimiter and then filters each branch based on a regular expression.",run:StrUtils.run_filter,manual_bake:!0,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"option",value:StrUtils.DELIMITER_OPTIONS},{name:"Regex",type:"string",value:""},{name:"Invert condition",type:"boolean",value:SeqUtils.SORT_REVERSE}]},Strings:{description:"Extracts all strings from the input.",run:Extract.run_strings,input_type:"string",output_type:"string",args:[{name:"Minimum length",type:"number",value:Extract.MIN_STRING_LEN},{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract IP addresses":{description:"Extracts all IPv4 and IPv6 addresses.

                                                                                                              Warning: Given a string 710.65.0.456, this will match 10.65.0.45 so always check the original input!",run:Extract.run_ip,input_type:"string",output_type:"string",args:[{name:"IPv4",type:"boolean",value:Extract.INCLUDE_IPV4},{name:"IPv6",type:"boolean",value:Extract.INCLUDE_IPV6},{name:"Remove local IPv4 addresses",type:"boolean",value:Extract.REMOVE_LOCAL},{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract email addresses":{description:"Extracts all email addresses from the input.",run:Extract.run_email,input_type:"string",output_type:"string",args:[{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract MAC addresses":{description:"Extracts all Media Access Control (MAC) addresses from the input.",run:Extract.run_mac,input_type:"string",output_type:"string",args:[{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract URLs":{description:"Extracts Uniform Resource Locators (URLs) from the input. The protocol (http, ftp etc.) is required otherwise there will be far too many false positives.",run:Extract.run_urls,input_type:"string",output_type:"string",args:[{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract domains":{description:"Extracts domain names with common Top-Level Domains (TLDs).
                                                                                                              Note that this will not include paths. Use Extract URLs to find entire URLs.",run:Extract.run_domains,input_type:"string",output_type:"string",args:[{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract file paths":{description:"Extracts anything that looks like a Windows or UNIX file path.

                                                                                                              Note that if UNIX is selected, there will likely be a lot of false positives.",run:Extract.run_file_paths,input_type:"string",output_type:"string",args:[{name:"Windows",type:"boolean",value:Extract.INCLUDE_WIN_PATH},{name:"UNIX",type:"boolean",value:Extract.INCLUDE_UNIX_PATH},{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract dates":{description:"Extracts dates in the following formats
                                                                                                              • yyyy-mm-dd
                                                                                                              • dd/mm/yyyy
                                                                                                              • mm/dd/yyyy
                                                                                                              Dividers can be any of /, -, . or space",run:Extract.run_dates,input_type:"string",output_type:"string",args:[{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Regular expression":{description:"Define your own regular expression to search the input data with, optionally choosing from a list of pre-defined patterns.",run:StrUtils.run_regex,manual_bake:!0,input_type:"string",output_type:"html",args:[{name:"Built in regexes",type:"populate_option",value:StrUtils.REGEX_PRE_POPULATE,target:1},{name:"Regex",type:"text",value:""},{name:"Case insensitive",type:"boolean",value:StrUtils.REGEX_CASE_INSENSITIVE},{name:"Multiline matching",type:"boolean",value:StrUtils.REGEX_MULTILINE_MATCHING},{name:"Display total",type:"boolean",value:StrUtils.DISPLAY_TOTAL},{name:"Output format",type:"option",value:StrUtils.OUTPUT_FORMAT}]},"XPath expression":{description:"Extract information from an XML document with an XPath query",run:Code.run_xpath,input_type:"string",output_type:"string",args:[{name:"XPath",type:"string",value:Code.XPATH_INITIAL},{name:"Result delimiter",type:"binary_short_string",value:Code.XPATH_DELIMITER}]},"CSS selector":{description:"Extract information from an HTML document with a CSS selector",run:Code.run_css_query,input_type:"string",output_type:"string",args:[{name:"CSS selector",type:"string",value:Code.CSS_SELECTOR_INITIAL},{name:"Delimiter",type:"binary_short_string",value:Code.CSS_QUERY_DELIMITER}]},"From UNIX Timestamp":{description:"Converts a UNIX timestamp to a datetime string.

                                                                                                              e.g. 978346800 becomes Mon 1 January 2001 11:00:00 UTC",run:DateTime.run_from_unix_timestamp,input_type:"number",output_type:"string",args:[{name:"Units",type:"option",value:DateTime.UNITS}]},"To UNIX Timestamp":{description:"Parses a datetime string and returns the corresponding UNIX timestamp.

                                                                                                              e.g. Mon 1 January 2001 11:00:00 UTC becomes 978346800",run:DateTime.run_to_unix_timestamp,input_type:"string",output_type:"number",args:[{name:"Units",type:"option",value:DateTime.UNITS}]},"Translate DateTime Format":{description:"Parses a datetime string in one format and re-writes it in another.

                                                                                                              Run with no input to see the relevant format string examples.",run:DateTime.run_translate_format,input_type:"string",output_type:"html",args:[{name:"Built in formats",type:"populate_option",value:DateTime.DATETIME_FORMATS,target:1},{name:"Input format string",type:"binary_string",value:DateTime.INPUT_FORMAT_STRING},{name:"Input timezone",type:"option",value:DateTime.TIMEZONES},{name:"Output format string",type:"binary_string",value:DateTime.OUTPUT_FORMAT_STRING},{name:"Output timezone",type:"option",value:DateTime.TIMEZONES}]},"Parse DateTime":{description:"Parses a DateTime string in your specified format and displays it in whichever timezone you choose with the following information:
                                                                                                              • Date
                                                                                                              • Time
                                                                                                              • Period (AM/PM)
                                                                                                              • Timezone
                                                                                                              • UTC offset
                                                                                                              • Daylight Saving Time
                                                                                                              • Leap year
                                                                                                              • Days in this month
                                                                                                              • Day of year
                                                                                                              • Week number
                                                                                                              • Quarter
                                                                                                              Run with no input to see format string examples if required.",run:DateTime.run_parse,input_type:"string",output_type:"html",args:[{name:"Built in formats",type:"populate_option",value:DateTime.DATETIME_FORMATS,target:1},{name:"Input format string",type:"binary_string",value:DateTime.INPUT_FORMAT_STRING},{name:"Input timezone",type:"option",value:DateTime.TIMEZONES}]},"Convert distance":{description:"Converts a unit of distance to another format.",run:Convert.run_distance,input_type:"number",output_type:"number",args:[{name:"Input units",type:"option",value:Convert.DISTANCE_UNITS},{name:"Output units",type:"option",value:Convert.DISTANCE_UNITS}]},"Convert area":{description:"Converts a unit of area to another format.",run:Convert.run_area,input_type:"number",output_type:"number",args:[{name:"Input units",type:"option",value:Convert.AREA_UNITS},{name:"Output units",type:"option",value:Convert.AREA_UNITS}]},"Convert mass":{description:"Converts a unit of mass to another format.",run:Convert.run_mass,input_type:"number",output_type:"number",args:[{name:"Input units",type:"option",value:Convert.MASS_UNITS},{name:"Output units",type:"option",value:Convert.MASS_UNITS}]},"Convert speed":{description:"Converts a unit of speed to another format.",run:Convert.run_speed,input_type:"number",output_type:"number",args:[{name:"Input units",type:"option",value:Convert.SPEED_UNITS},{name:"Output units",type:"option",value:Convert.SPEED_UNITS}]},"Convert data units":{description:"Converts a unit of data to another format.",run:Convert.run_data_size,input_type:"number",output_type:"number",args:[{name:"Input units",type:"option",value:Convert.DATA_UNITS},{name:"Output units",type:"option",value:Convert.DATA_UNITS}]},"Raw Deflate":{description:"Compresses data using the deflate algorithm with no headers.",run:Compress.run_raw_deflate,input_type:"byte_array",output_type:"byte_array",args:[{name:"Compression type",type:"option",value:Compress.COMPRESSION_TYPE}]},"Raw Inflate":{description:"Decompresses data which has been compressed using the deflate algorithm with no headers.",run:Compress.run_raw_inflate,input_type:"byte_array",output_type:"byte_array",args:[{name:"Start index",type:"number",value:Compress.INFLATE_INDEX},{name:"Initial output buffer size",type:"number",value:Compress.INFLATE_BUFFER_SIZE},{name:"Buffer expansion type",type:"option",value:Compress.INFLATE_BUFFER_TYPE},{name:"Resize buffer after decompression",type:"boolean",value:Compress.INFLATE_RESIZE},{name:"Verify result",type:"boolean",value:Compress.INFLATE_VERIFY}]},"Zlib Deflate":{description:"Compresses data using the deflate algorithm adding zlib headers.",run:Compress.run_zlib_deflate,input_type:"byte_array",output_type:"byte_array",args:[{name:"Compression type",type:"option",value:Compress.COMPRESSION_TYPE}]},"Zlib Inflate":{description:"Decompresses data which has been compressed using the deflate algorithm with zlib headers.",run:Compress.run_zlib_inflate,input_type:"byte_array",output_type:"byte_array",args:[{name:"Start index",type:"number",value:Compress.INFLATE_INDEX},{name:"Initial output buffer size",type:"number",value:Compress.INFLATE_BUFFER_SIZE},{name:"Buffer expansion type",type:"option",value:Compress.INFLATE_BUFFER_TYPE},{name:"Resize buffer after decompression",type:"boolean",value:Compress.INFLATE_RESIZE},{name:"Verify result",type:"boolean",value:Compress.INFLATE_VERIFY}]},Gzip:{description:"Compresses data using the deflate algorithm with gzip headers.",run:Compress.run_gzip,input_type:"byte_array",output_type:"byte_array",args:[{name:"Compression type",type:"option",value:Compress.COMPRESSION_TYPE},{name:"Filename (optional)",type:"string",value:""},{name:"Comment (optional)",type:"string",value:""},{name:"Include file checksum",type:"boolean",value:Compress.GZIP_CHECKSUM}]},Gunzip:{description:"Decompresses data which has been compressed using the deflate algorithm with gzip headers.",run:Compress.run_gunzip,input_type:"byte_array",output_type:"byte_array",args:[]},Zip:{description:"Compresses data using the PKZIP algorithm with the given filename.

                                                                                                              No support for multiple files at this time.",run:Compress.run_pkzip,input_type:"byte_array",output_type:"byte_array",args:[{name:"Filename",type:"string",value:Compress.PKZIP_FILENAME},{name:"Comment",type:"string",value:""},{name:"Password",type:"binary_string",value:""},{name:"Compression method",type:"option",value:Compress.COMPRESSION_METHOD},{name:"Operating system",type:"option",value:Compress.OS},{name:"Compression type",type:"option",value:Compress.COMPRESSION_TYPE}]},Unzip:{description:"Decompresses data using the PKZIP algorithm and displays it per file, with support for passwords.",run:Compress.run_pkunzip,input_type:"byte_array",output_type:"html",args:[{name:"Password",type:"binary_string",value:""},{name:"Verify result",type:"boolean",value:Compress.PKUNZIP_VERIFY}]},"Bzip2 Decompress":{description:"Decompresses data using the Bzip2 algorithm.",run:Compress.run_bzip2_decompress,input_type:"byte_array",output_type:"string",args:[]},"Generic Code Beautify":{description:"Attempts to pretty print C-style languages such as C, C++, C#, Java, PHP, JavaScript etc.

                                                                                                              This will not do a perfect job, and the resulting code may not work any more. This operation is designed purely to make obfuscated or minified code more easy to read and understand.

                                                                                                              Things which will not work properly:
                                                                                                              • For loop formatting
                                                                                                              • Do-While loop formatting
                                                                                                              • Switch/Case indentation
                                                                                                              • Certain bit shift operators
                                                                                                              ",run:Code.run_generic_beautify,input_type:"string",output_type:"string",args:[]},"JavaScript Parser":{description:"Returns an Abstract Syntax Tree for valid JavaScript code.",run:JS.run_parse,input_type:"string",output_type:"string",args:[{name:"Location info",type:"boolean",value:JS.PARSE_LOC},{name:"Range info",type:"boolean",value:JS.PARSE_RANGE},{name:"Include tokens array",type:"boolean",value:JS.PARSE_TOKENS},{name:"Include comments array",type:"boolean",value:JS.PARSE_COMMENT},{name:"Report errors and try to continue",type:"boolean",value:JS.PARSE_TOLERANT}]},"JavaScript Beautify":{description:"Parses and pretty prints valid JavaScript code. Also works with JavaScript Object Notation (JSON).",run:JS.run_beautify,input_type:"string",output_type:"string",args:[{name:"Indent string",type:"binary_short_string",value:JS.BEAUTIFY_INDENT},{name:"Quotes",type:"option",value:JS.BEAUTIFY_QUOTES},{name:"Semicolons before closing braces",type:"boolean",value:JS.BEAUTIFY_SEMICOLONS},{name:"Include comments",type:"boolean",value:JS.BEAUTIFY_COMMENT}]},"JavaScript Minify":{description:"Compresses JavaScript code.",run:JS.run_minify,input_type:"string",output_type:"string",args:[]},"XML Beautify":{description:"Indents and prettifies eXtensible Markup Language (XML) code.",run:Code.run_xml_beautify,input_type:"string",output_type:"string",args:[{name:"Indent string",type:"binary_short_string",value:Code.BEAUTIFY_INDENT}]},"JSON Beautify":{description:"Indents and prettifies JavaScript Object Notation (JSON) code.",run:Code.run_json_beautify,input_type:"string",output_type:"string",args:[{name:"Indent string",type:"binary_short_string",value:Code.BEAUTIFY_INDENT}]},"CSS Beautify":{description:"Indents and prettifies Cascading Style Sheets (CSS) code.",run:Code.run_css_beautify,input_type:"string",output_type:"string",args:[{name:"Indent string",type:"binary_short_string",value:Code.BEAUTIFY_INDENT}]},"SQL Beautify":{description:"Indents and prettifies Structured Query Language (SQL) code.",run:Code.run_sql_beautify,input_type:"string",output_type:"string",args:[{name:"Indent string",type:"binary_short_string",value:Code.BEAUTIFY_INDENT}]},"XML Minify":{description:"Compresses eXtensible Markup Language (XML) code.",run:Code.run_xml_minify,input_type:"string",output_type:"string",args:[{name:"Preserve comments",type:"boolean",value:Code.PRESERVE_COMMENTS}]},"JSON Minify":{description:"Compresses JavaScript Object Notation (JSON) code.",run:Code.run_json_minify,input_type:"string",output_type:"string",args:[]},"CSS Minify":{description:"Compresses Cascading Style Sheets (CSS) code.",run:Code.run_css_minify,input_type:"string",output_type:"string",args:[{name:"Preserve comments",type:"boolean",value:Code.PRESERVE_COMMENTS}]},"SQL Minify":{description:"Compresses Structured Query Language (SQL) code.",run:Code.run_sql_minify,input_type:"string",output_type:"string",args:[]},"Analyse hash":{description:"Tries to determine information about a given hash and suggests which algorithm may have been used to generate it based on its length.",run:Hash.run_analyse,input_type:"string",output_type:"string",args:[]},MD5:{description:"MD5 (Message-Digest 5) is a widely used hash function. It has been used in a variety of security applications and is also commonly used to check the integrity of files.

                                                                                                              However, MD5 is not collision resistant and it isn't suitable for applications like SSL/TLS certificates or digital signatures that rely on this property.",run:Hash.run_md5,input_type:"string",output_type:"string",args:[]},SHA1:{description:"The SHA (Secure Hash Algorithm) hash functions were designed by the NSA. SHA-1 is the most established of the existing SHA hash functions and it is used in a variety of security applications and protocols.

                                                                                                              However, SHA-1's collision resistance has been weakening as new attacks are discovered or improved.",run:Hash.run_sha1,input_type:"string",output_type:"string",args:[]},SHA224:{description:"SHA-224 is largely identical to SHA-256 but is truncated to 224 bytes.",run:Hash.run_sha224,input_type:"string",output_type:"string",args:[]},SHA256:{description:"SHA-256 is one of the four variants in the SHA-2 set. It isn't as widely used as SHA-1, though it provides much better security.",run:Hash.run_sha256,input_type:"string",output_type:"string",args:[]},SHA384:{description:"SHA-384 is largely identical to SHA-512 but is truncated to 384 bytes.",run:Hash.run_sha384,input_type:"string",output_type:"string",args:[]},SHA512:{description:"SHA-512 is largely identical to SHA-256 but operates on 64-bit words rather than 32.",run:Hash.run_sha512,input_type:"string",output_type:"string",args:[]},SHA3:{description:"This is an implementation of Keccak[c=2d]. SHA3 functions based on different implementations of Keccak will give different results.",run:Hash.run_sha3,input_type:"string",output_type:"string",args:[{name:"Output length",type:"option",value:Hash.SHA3_LENGTH}]},"RIPEMD-160":{description:"RIPEMD (RACE Integrity Primitives Evaluation Message Digest) is a family of cryptographic hash functions developed in Leuven, Belgium, by Hans Dobbertin, Antoon Bosselaers and Bart Preneel at the COSIC research group at the Katholieke Universiteit Leuven, and first published in 1996.

                                                                                                              RIPEMD was based upon the design principles used in MD4, and is similar in performance to the more popular SHA-1.

                                                                                                              RIPEMD-160 is an improved, 160-bit version of the original RIPEMD, and the most common version in the family.",run:Hash.run_ripemd160,input_type:"string",output_type:"string",args:[]},HMAC:{description:"Keyed-Hash Message Authentication Codes (HMAC) are a mechanism for message authentication using cryptographic hash functions.",run:Hash.run_hmac,input_type:"string",output_type:"string",args:[{name:"Password",type:"binary_string",value:""},{name:"Hashing function",type:"option",value:Hash.HMAC_FUNCTIONS}]},"Fletcher-16 Checksum":{description:"The Fletcher checksum is an algorithm for computing a position-dependent checksum devised by John Gould Fletcher at Lawrence Livermore Labs in the late 1970s.

                                                                                                              The objective of the Fletcher checksum was to provide error-detection properties approaching those of a cyclic redundancy check but with the lower computational effort associated with summation techniques.",run:Checksum.run_fletcher16,input_type:"byte_array",output_type:"string",args:[]},"Adler-32 Checksum":{description:"Adler-32 is a checksum algorithm which was invented by Mark Adler in 1995, and is a modification of the Fletcher checksum. Compared to a cyclic redundancy check of the same length, it trades reliability for speed (preferring the latter).

                                                                                                              Adler-32 is more reliable than Fletcher-16, and slightly less reliable than Fletcher-32.",run:Checksum.run_adler32,input_type:"byte_array",output_type:"string",args:[]},"CRC-32 Checksum":{description:"A cyclic redundancy check (CRC) is an error-detecting code commonly used in digital networks and storage devices to detect accidental changes to raw data.

                                                                                                              The CRC was invented by W. Wesley Peterson in 1961; the 32-bit CRC function of Ethernet and many other standards is the work of several researchers and was published in 1975.",run:Checksum.run_crc32,input_type:"byte_array",output_type:"string",args:[]},"Generate all hashes":{description:"Generates all available hashes and checksums for the input.",run:Hash.run_all,input_type:"string",output_type:"string",args:[]},Entropy:{description:"Calculates the Shannon entropy of the input data which gives an idea of its randomness. 8 is the maximum.",run:Entropy.run_entropy,input_type:"byte_array",output_type:"html",args:[{name:"Chunk size",type:"number",value:Entropy.CHUNK_SIZE}]},"Frequency distribution":{description:"Displays the distribution of bytes in the data as a graph.",run:Entropy.run_freq_distrib,input_type:"byte_array",output_type:"html",args:[{name:"Show 0%'s",type:"boolean",value:Entropy.FREQ_ZEROS}]},Numberwang:{description:"Based on the popular gameshow by Mitchell and Webb.",run:Numberwang.run,input_type:"string",output_type:"string",args:[]},"Parse X.509 certificate":{description:"X.509 is an ITU-T standard for a public key infrastructure (PKI) and Privilege Management Infrastructure (PMI). It is commonly involved with SSL/TLS security.

                                                                                                              This operation displays the contents of a certificate in a human readable format, similar to the openssl command line tool.",run:PublicKey.run_parse_x509,input_type:"string",output_type:"string",args:[{name:"Input format",type:"option",value:PublicKey.X509_INPUT_FORMAT}]},"PEM to Hex":{description:"Converts PEM (Privacy Enhanced Mail) format to a hexadecimal DER (Distinguished Encoding Rules) string.",run:PublicKey.run_pem_to_hex,input_type:"string",output_type:"string",args:[]},"Hex to PEM":{description:"Converts a hexadecimal DER (Distinguished Encoding Rules) string into PEM (Privacy Enhanced Mail) format.",run:PublicKey.run_hex_to_pem,input_type:"string",output_type:"string",args:[{name:"Header string",type:"string",value:PublicKey.PEM_HEADER_STRING}]},"Hex to Object Identifier":{description:"Converts a hexadecimal string into an object identifier (OID).",run:PublicKey.run_hex_to_object_identifier,input_type:"string",output_type:"string",args:[]},"Object Identifier to Hex":{description:"Converts an object identifier (OID) into a hexadecimal string.",run:PublicKey.run_object_identifier_to_hex,input_type:"string",output_type:"string",args:[]},"Parse ASN.1 hex string":{description:"Abstract Syntax Notation One (ASN.1) is a standard and notation that describes rules and structures for representing, encoding, transmitting, and decoding data in telecommunications and computer networking.

                                                                                                              This operation parses arbitrary ASN.1 data and presents the resulting tree.",run:PublicKey.run_parse_asn1_hex_string,input_type:"string",output_type:"string",args:[{name:"Starting index",type:"number",value:0},{name:"Truncate octet strings longer than",type:"number",value:PublicKey.ASN1_TRUNCATE_LENGTH}]},"Detect File Type":{description:"Attempts to guess the MIME (Multipurpose Internet Mail Extensions) type of the data based on 'magic bytes'.

                                                                                                              Currently supports the following file types: 7z, amr, avi, bmp, bz2, class, cr2, crx, dex, dmg, doc, elf, eot, epub, exe, flac, flv, gif, gz, ico, iso, jpg, jxr, m4a, m4v, mid, mkv, mov, mp3, mp4, mpg, ogg, otf, pdf, png, ppt, ps, psd, rar, rtf, sqlite, swf, tar, tar.z, tif, ttf, utf8, vmdk, wav, webm, webp, wmv, woff, woff2, xls, xz, zip.",run:FileType.run_detect,input_type:"byte_array",output_type:"string",args:[]},"Scan for Embedded Files":{description:"Scans the data for potential embedded files by looking for magic bytes at all offsets. This operation is prone to false positives.

                                                                                                              WARNING: Files over about 100KB in size will take a VERY long time to process.",run:FileType.run_scan_for_embedded_files,input_type:"byte_array",output_type:"string",args:[{name:"Ignore common byte sequences",type:"boolean",value:FileType.IGNORE_COMMON_BYTE_SEQUENCES}]},"Expand alphabet range":{description:"Expand an alphabet range string into a list of the characters in that range.

                                                                                                              e.g. a-z becomes abcdefghijklmnopqrstuvwxyz.",run:SeqUtils.run_expand_alph_range,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"binary_string",value:""}]},Diff:{description:"Compares two inputs (separated by the specified delimiter) and highlights the differences between them.",run:StrUtils.run_diff,input_type:"string",output_type:"html",args:[{name:"Sample delimiter",type:"binary_string",value:StrUtils.DIFF_SAMPLE_DELIMITER},{name:"Diff by",type:"option",value:StrUtils.DIFF_BY},{name:"Show added",type:"boolean",value:!0},{name:"Show removed",type:"boolean",value:!0},{name:"Ignore whitespace (relevant for word and line)",type:"boolean",value:!1}]},"Parse UNIX file permissions":{description:"Given a UNIX/Linux file permission string in octal or textual format, this operation explains which permissions are granted to which user groups.

                                                                                                              Input should be in either octal (e.g. 755) or textual (e.g. drwxr-xr-x) format.",run:OS.run_parse_unix_perms,input_type:"string",output_type:"string",args:[]},"Swap endianness":{description:"Switches the data from big-endian to little-endian or vice-versa. Data can be read in as hexadecimal or raw bytes. It will be returned in the same format as it is entered.",run:Endian.run_swap_endianness,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[{name:"Data format",type:"option",value:Endian.DATA_FORMAT},{name:"Word length (bytes)",type:"number",value:Endian.WORD_LENGTH},{name:"Pad incomplete words",type:"boolean",value:Endian.PAD_INCOMPLETE_WORDS}]},"Syntax highlighter":{description:"Adds syntax highlighting to a range of source code languages. Note that this will not indent the code. Use one of the 'Beautify' operations for that.",run:Code.run_syntax_highlight, +highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"html",args:[{name:"Language/File extension",type:"option",value:Code.LANGUAGES},{name:"Display line numbers",type:"boolean",value:Code.LINE_NUMS}]},"Parse escaped string":{description:"Replaces escaped characters with the bytes they represent.

                                                                                                              e.g.Hello\\nWorld becomes Hello
                                                                                                              World
                                                                                                              ",run:StrUtils.run_parse_escaped_string,input_type:"string",output_type:"string",args:[]},"TCP/IP Checksum":{description:"Calculates the checksum for a TCP (Transport Control Protocol) or IP (Internet Protocol) header from an input of raw bytes.",run:Checksum.run_tcp_ip,input_type:"byte_array",output_type:"string",args:[]},"Parse colour code":{description:"Converts a colour code in a standard format to other standard formats and displays the colour itself.

                                                                                                              Example inputs
                                                                                                              • #d9edf7
                                                                                                              • rgba(217,237,247,1)
                                                                                                              • hsla(200,65%,91%,1)
                                                                                                              • cmyk(0.12, 0.04, 0.00, 0.03)
                                                                                                              ",run:HTML.run_parse_colour_code,input_type:"string",output_type:"html",args:[]},"Generate UUID":{description:"Generates an RFC 4122 version 4 compliant Universally Unique Identifier (UUID), also known as a Globally Unique Identifier (GUID).

                                                                                                              A version 4 UUID relies on random numbers, in this case generated using window.crypto if available and falling back to Math.random if not.",run:UUID.run_generate_v4,input_type:"string",output_type:"string",args:[]},Substitute:{description:"A substitution cipher allowing you to specify bytes to replace with other byte values. This can be used to create Caesar ciphers but is more powerful as any byte value can be substituted, not just letters, and the substitution values need not be in order.

                                                                                                              Enter the bytes you want to replace in the Plaintext field and the bytes to replace them with in the Ciphertext field.

                                                                                                              Non-printable bytes can be specified using string escape notation. For example, a line feed character can be written as either \\n or \\x0a.

                                                                                                              Byte ranges can be specified using a hyphen. For example, the sequence 0123456789 can be written as 0-9.",run:Cipher.run_substitute,input_type:"byte_array",output_type:"byte_array",args:[{name:"Plaintext",type:"binary_string",value:Cipher.SUBS_PLAINTEXT},{name:"Ciphertext",type:"binary_string",value:Cipher.SUBS_CIPHERTEXT}]}},ControlsWaiter=function(a,b){this.app=a,this.manager=b};ControlsWaiter.prototype.adjust_width=function(){var a=document.getElementById("controls"),b=document.getElementById("step"),c=document.getElementById("clr-breaks"),d=document.querySelector("#save img"),e=document.querySelector("#load img"),f=document.querySelector("#step img"),g=document.querySelector("#clr-recipe img"),h=document.querySelector("#clr-breaks img");a.clientWidth<470?b.childNodes[1].nodeValue=" Step":b.childNodes[1].nodeValue=" Step through",a.clientWidth<400?(d.style.display="none",e.style.display="none",f.style.display="none",g.style.display="none",h.style.display="none"):(d.style.display="inline",e.style.display="inline",f.style.display="inline",g.style.display="inline",h.style.display="inline"),a.clientWidth<330?c.childNodes[1].nodeValue=" Clear breaks":c.childNodes[1].nodeValue=" Clear breakpoints"},ControlsWaiter.prototype.set_auto_bake=function(a){var b=document.getElementById("auto-bake");b.checked!==a&&b.click()},ControlsWaiter.prototype.bake_click=function(){this.app.bake(),$("#output-text").selectRange(0)},ControlsWaiter.prototype.step_click=function(){this.app.bake(!0),$("#output-text").selectRange(0)},ControlsWaiter.prototype.auto_bake_change=function(){var a=document.getElementById("auto-bake-label"),b=document.getElementById("auto-bake");this.app.auto_bake_=b.checked,b.checked?(a.classList.remove("btn-default"),a.classList.add("btn-success")):(a.classList.remove("btn-success"),a.classList.add("btn-default"))},ControlsWaiter.prototype.clear_recipe_click=function(){this.manager.recipe.clear_recipe()},ControlsWaiter.prototype.clear_breaks_click=function(){for(var a=document.querySelectorAll("#rec_list li.operation .breakpoint"),b=0;b0,b=b&&f.length>0&&f.length<8e3,a&&(d+="?recipe="+encodeURIComponent(e)),a&&b?d+="&input="+encodeURIComponent(f):b&&(d+="?input="+encodeURIComponent(f)),d},ControlsWaiter.prototype.save_text_change=function(){try{var a=JSON.parse(document.getElementById("save-text").value);this.initialise_save_link(a)}catch(a){}},ControlsWaiter.prototype.save_click=function(){var a=this.app.get_recipe_config(),b=JSON.stringify(a).replace(/},{/g,"},\n{");document.getElementById("save-text").value=b,this.initialise_save_link(a),$("#save-modal").modal()},ControlsWaiter.prototype.slr_check_change=function(){this.initialise_save_link()},ControlsWaiter.prototype.sli_check_change=function(){this.initialise_save_link()},ControlsWaiter.prototype.load_click=function(){this.populate_load_recipes_list(),$("#load-modal").modal()},ControlsWaiter.prototype.save_button_click=function(){var a=document.getElementById("save-name").value,b=document.getElementById("save-text").value;if(!a)return void this.app.alert("Please enter a recipe name","danger",2e3);var c=localStorage.saved_recipes?JSON.parse(localStorage.saved_recipes):[],d=localStorage.recipe_id||0;c.push({id:++d,name:a,recipe:b}),localStorage.saved_recipes=JSON.stringify(c),localStorage.recipe_id=d,this.app.alert('Recipe saved as "'+a+'".',"success",2e3)},ControlsWaiter.prototype.populate_load_recipes_list=function(){for(var a=document.getElementById("load-name"),b=a.options.length;b--;)a.remove(b);var c=localStorage.saved_recipes?JSON.parse(localStorage.saved_recipes):[];for(b=0;bend: "+e+"
                                                                                                              length: "+f},HighlighterWaiter.prototype.remove_highlights=function(){document.getElementById("input-highlighter").innerHTML="",document.getElementById("output-highlighter").innerHTML="",document.getElementById("input-selection-info").innerHTML="",document.getElementById("output-selection-info").innerHTML=""},HighlighterWaiter.prototype.generate_highlight_list=function(){for(var a=this.app.get_recipe_config(),b=[],c=0;c=0)return!1;var d="[start_highlight]",e=/\[start_highlight\]/g,f="[end_highlight]",g=/\[end_highlight\]/g,h=a.value;if(1===c.length){if(c[0].end/g,">").replace(/\n/g," ").replace(e,'').replace(g,"")+" ",b.style.width=a.clientWidth+"px",b.innerHTML=h,b.scrollTop=a.scrollTop,b.scrollLeft=a.scrollLeft};var HTMLApp=function(a,b,c,d){this.categories=a,this.operations=b,this.dfavourites=c,this.doptions=d,this.options=Utils.extend({},d),this.chef=new Chef,this.manager=new Manager(this),this.auto_bake_=!1,this.progress=0,this.ing_id=0,window.chef=this.chef};HTMLApp.prototype.setup=function(){document.dispatchEvent(this.manager.appstart),this.initialise_splitter(),this.load_local_storage(),this.populate_operations_list(),this.manager.setup(),this.reset_layout(),this.set_compile_message(),this.load_URI_params()},HTMLApp.prototype.handle_error=function(a){console.error(a);var b=a.display_str||a.toString();this.alert(b,"danger",this.options.error_timeout,!this.options.show_errors)},HTMLApp.prototype.bake=function(a){var b;try{b=this.chef.bake(this.get_input(),this.get_recipe_config(),this.options,this.progress,a)}catch(a){this.handle_error(a)}b&&(b.error&&this.handle_error(b.error),this.options=b.options,this.dish_str="html"===b.type?Utils.strip_html_tags(b.result,!0):b.result,this.progress=b.progress,this.manager.recipe.update_breakpoint_indicator(b.progress),this.manager.output.set(b.result,b.type,b.duration),b.duration>this.options.auto_bake_threshold&&this.auto_bake_&&(this.manager.controls.set_auto_bake(!1),this.alert("Baking took longer than "+this.options.auto_bake_threshold+"ms, Auto Bake has been disabled.","warning",5e3)))},HTMLApp.prototype.auto_bake=function(){this.auto_bake_&&this.bake()},HTMLApp.prototype.silent_bake=function(){var a=(new Date).getTime(),b=this.get_recipe_config();return this.auto_bake_&&this.chef.silent_bake(b),(new Date).getTime()-a},HTMLApp.prototype.get_input=function(){var a=this.manager.input.get();return sessionStorage.setItem("input_length",a.length),sessionStorage.setItem("input",a),a},HTMLApp.prototype.set_input=function(a){sessionStorage.setItem("input_length",a.length),sessionStorage.setItem("input",a),this.manager.input.set(a)},HTMLApp.prototype.populate_operations_list=function(){document.body.appendChild(document.getElementById("edit-favourites"));for(var a="",b=0;b2?JSON.parse(localStorage.favourites):this.dfavourites;a=this.valid_favourites(a),this.save_favourites(a);var b=this.categories.filter(function(a){return"Favourites"===a.name})[0];b?b.ops=a:this.categories.unshift({name:"Favourites",ops:a})},HTMLApp.prototype.valid_favourites=function(a){for(var b=[],c=0;c=0?void this.alert("'"+a+"' is already in your favourites","info",2e3):(b.push(a),this.save_favourites(b),this.load_favourites(),this.populate_operations_list(),void this.manager.recipe.initialise_operation_drag_n_drop())},HTMLApp.prototype.load_URI_params=function(){this.query_string=function(a){if(""===a)return{};for(var b={},c=0;c"):d[e].value=a[b].args[e];a[b].disabled&&c.querySelector(".disable-icon").click(),a[b].breakpoint&&c.querySelector(".breakpoint").click(),this.progress=0}},HTMLApp.prototype.reset_layout=function(){this.column_splitter.setSizes([20,30,50]),this.io_splitter.setSizes([50,50]),this.manager.controls.adjust_width(),this.manager.output.adjust_width()},HTMLApp.prototype.set_compile_message=function(){var a=new Date,b=Utils.fuzzy_time(a.getTime()-window.compile_time),c='Last build: '+b.substr(0,1).toUpperCase()+b.substr(1)+" ago";""!==window.compile_message&&(c+=" - "+window.compile_message),c+="",document.getElementById("notice").innerHTML=c},HTMLApp.prototype.alert=function(a,b,c,d){var e=new Date;if(console.log("["+e.toLocaleString()+"] "+a),!d){b=b||"danger",c=c||0;var f=document.getElementById("alert"),g=document.getElementById("alert-content");f.classList.remove("alert-danger"),f.classList.remove("alert-warning"),f.classList.remove("alert-info"),f.classList.remove("alert-success"),f.classList.add("alert-"+b),"block"===f.style.display?g.innerHTML+="

                                                                                                              ["+e.toLocaleTimeString()+"] "+a:g.innerHTML="["+e.toLocaleTimeString()+"] "+a,$("#alert").stop(),f.style.display="block",f.style.opacity=1,c>0&&(clearTimeout(this.alert_timeout),this.alert_timeout=setTimeout(function(){$("#alert").slideUp(100)},c))}},HTMLApp.prototype.confirm=function(a,b,c,d){d=d||this,document.getElementById("confirm-title").innerHTML=a,document.getElementById("confirm-body").innerHTML=b,document.getElementById("confirm-modal").style.display="block",this.confirm_closed=!1,$("#confirm-modal").modal().one("show.bs.modal",function(a){this.confirm_closed=!1}.bind(this)).one("click","#confirm-yes",function(){this.confirm_closed=!0,c.bind(d)(!0),$("#confirm-modal").modal("hide")}.bind(this)).one("hide.bs.modal",function(a){this.confirm_closed||c.bind(d)(!1),this.confirm_closed=!0}.bind(this))},HTMLApp.prototype.alert_close_click=function(){document.getElementById("alert").style.display="none"},HTMLApp.prototype.state_change=function(a){this.auto_bake(),this.options.update_url&&(this.last_state_url=this.manager.controls.generate_state_url(!0,!0),window.history.replaceState({},"CyberChef",this.last_state_url))},HTMLApp.prototype.pop_state=function(a){window.location.href.split("#")[0]!==this.last_state_url&&this.load_URI_params()},HTMLApp.prototype.call_api=function(a,b,c,d,e){b=b||"POST",c=c||{},d=d||void 0,e=e||"application/json";var f=null,g=!1;return $.ajax({url:a,async:!1,type:b,data:c,dataType:d,contentType:e,success:function(a){g=!0,f=a},error:function(a){g=!1,f=a}}),{success:g,response:f}};var HTMLCategory=function(a,b){this.name=a,this.selected=b,this.op_list=[]};HTMLCategory.prototype.add_operation=function(a){this.op_list.push(a)},HTMLCategory.prototype.to_html=function(){for(var a="cat"+this.name.replace(/[\s\/-:_]/g,""),b="
                                                                                                              "+this.name+"
                                                                                                                ",c=0;c 
                                                                                                              ";switch(d+="
                                                                                                              ",this.type){case"string":case"binary_string":case"byte_array":d+="";break;case"short_string":case"binary_short_string":d+="";break;case"toggle_string":for(d+="
                                                                                                              ";break;case"number":d+="";break;case"boolean":d+="",this.disable_args&&this.manager.add_dynamic_listener("#"+this.id,"click",this.toggle_disable_args,this);break;case"option":for(d+="";break;case"populate_option":for(d+="",this.manager.add_dynamic_listener("#"+this.id,"change",this.populate_option_change,this);break;case"editable_option":for(d+="
                                                                                                              ",d+="",d+="",d+="
                                                                                                              ",this.manager.add_dynamic_listener("#sel-"+this.id,"change",this.editable_option_change,this);break;case"text":d+=""}return d+="
                                                                                                              "},HTMLIngredient.prototype.toggle_disable_args=function(a){for(var b,c=a.target,d=c.parentNode.parentNode,e=d.querySelectorAll(".arg-group"),f=0;f"),this.description&&(b+=""),b+=""},HTMLOperation.prototype.to_full_html=function(){for(var a="
                                                                                                              "+this.name+"
                                                                                                              ",b=0;b=0&&(this.name=this.name.slice(0,b)+""+this.name.slice(b,b+a.length)+""+this.name.slice(b+a.length)),this.description&&c>=0&&(this.description=this.description.slice(0,c)+""+this.description.slice(c,c+a.length)+""+this.description.slice(c+a.length))};var InputWaiter=function(a,b){this.app=a,this.manager=b,this.bad_keys=[16,17,18,19,20,27,33,34,35,36,37,38,39,40,44,91,92,93,112,113,114,115,116,117,118,119,120,121,122,123,144,145]};InputWaiter.prototype.get=function(){return document.getElementById("input-text").value},InputWaiter.prototype.set=function(a){document.getElementById("input-text").value=a,window.dispatchEvent(this.manager.statechange)},InputWaiter.prototype.set_input_info=function(a,b){var c=a.toString().length;c=c<2?2:c;var d=Utils.pad(a.toString(),c," ").replace(/ /g," "),e=Utils.pad(b.toString(),c," ").replace(/ /g," ");document.getElementById("input-info").innerHTML="length: "+d+"
                                                                                                              lines: "+e},InputWaiter.prototype.input_change=function(a){this.manager.highlighter.remove_highlights(), +this.app.progress=0;var b=this.get(),c=b.count("\n")+1;this.set_input_info(b.length,c),this.bad_keys.indexOf(a.keyCode)<0&&window.dispatchEvent(this.manager.statechange)},InputWaiter.prototype.input_dragover=function(a){return"move"!==a.dataTransfer.effectAllowed&&(a.stopPropagation(),a.preventDefault(),void a.target.classList.add("dropping-file"))},InputWaiter.prototype.input_dragleave=function(a){a.stopPropagation(),a.preventDefault(),a.target.classList.remove("dropping-file")},InputWaiter.prototype.input_drop=function(a){if("move"===a.dataTransfer.effectAllowed)return!1;a.stopPropagation(),a.preventDefault();var b=a.target,c=a.dataTransfer.files[0],d=a.dataTransfer.getData("Text"),e=new FileReader,f="",g=0,h=20480,i=function(){f.length>1e5&&this.app.auto_bake_&&(this.manager.controls.set_auto_bake(!1),this.app.alert("Turned off Auto Bake as the input is large","warning",5e3)),this.set(f);var a=this.app.get_recipe_config();a[0]&&"From Hex"===a[0].op||(a.unshift({op:"From Hex",args:["Space"]}),this.app.set_recipe_config(a)),b.classList.remove("loading_file")}.bind(this),j=function(){if(g>=c.size)return void i();b.value="Processing... "+Math.round(g/c.size*100)+"%";var a=c.slice(g,g+h);e.readAsArrayBuffer(a)};e.onload=function(a){var b=new Uint8Array(e.result);f+=Utils.to_hex_fast(b),g+=h,j()},b.classList.remove("dropping-file"),c?(b.classList.add("loading_file"),j()):d&&this.set(d)},InputWaiter.prototype.clear_io_click=function(){this.manager.highlighter.remove_highlights(),document.getElementById("input-text").value="",document.getElementById("output-text").value="",document.getElementById("input-info").innerHTML="",document.getElementById("output-info").innerHTML="",document.getElementById("input-selection-info").innerHTML="",document.getElementById("output-selection-info").innerHTML="",window.dispatchEvent(this.manager.statechange)};var Manager=function(a){this.app=a,this.appstart=new CustomEvent("appstart",{bubbles:!0}),this.operationadd=new CustomEvent("operationadd",{bubbles:!0}),this.operationremove=new CustomEvent("operationremove",{bubbles:!0}),this.oplistcreate=new CustomEvent("oplistcreate",{bubbles:!0}),this.statechange=new CustomEvent("statechange",{bubbles:!0}),this.window=new WindowWaiter(this.app),this.controls=new ControlsWaiter(this.app,this),this.recipe=new RecipeWaiter(this.app,this),this.ops=new OperationsWaiter(this.app,this),this.input=new InputWaiter(this.app,this),this.output=new OutputWaiter(this.app,this),this.options=new OptionsWaiter(this.app),this.highlighter=new HighlighterWaiter(this.app),this.seasonal=new SeasonalWaiter(this.app,this),this.dynamic_handlers={},this.initialise_event_listeners()};Manager.prototype.setup=function(){this.recipe.initialise_operation_drag_n_drop(),this.controls.auto_bake_change(),this.seasonal.load()},Manager.prototype.initialise_event_listeners=function(){window.addEventListener("resize",this.window.window_resize.bind(this.window)),window.addEventListener("blur",this.window.window_blur.bind(this.window)),window.addEventListener("focus",this.window.window_focus.bind(this.window)),window.addEventListener("statechange",this.app.state_change.bind(this.app)),window.addEventListener("popstate",this.app.pop_state.bind(this.app)),document.getElementById("bake").addEventListener("click",this.controls.bake_click.bind(this.controls)),document.getElementById("auto-bake").addEventListener("change",this.controls.auto_bake_change.bind(this.controls)),document.getElementById("step").addEventListener("click",this.controls.step_click.bind(this.controls)),document.getElementById("clr-recipe").addEventListener("click",this.controls.clear_recipe_click.bind(this.controls)),document.getElementById("clr-breaks").addEventListener("click",this.controls.clear_breaks_click.bind(this.controls)),document.getElementById("save").addEventListener("click",this.controls.save_click.bind(this.controls)),document.getElementById("save-button").addEventListener("click",this.controls.save_button_click.bind(this.controls)),document.getElementById("save-link-recipe-checkbox").addEventListener("change",this.controls.slr_check_change.bind(this.controls)),document.getElementById("save-link-input-checkbox").addEventListener("change",this.controls.sli_check_change.bind(this.controls)),document.getElementById("load").addEventListener("click",this.controls.load_click.bind(this.controls)),document.getElementById("load-delete-button").addEventListener("click",this.controls.load_delete_click.bind(this.controls)),document.getElementById("load-name").addEventListener("change",this.controls.load_name_change.bind(this.controls)),document.getElementById("load-button").addEventListener("click",this.controls.load_button_click.bind(this.controls)),this.add_multi_event_listener("#save-text","keyup paste",this.controls.save_text_change,this.controls),this.add_multi_event_listener("#search","keyup paste search",this.ops.search_operations,this.ops),this.add_dynamic_listener(".op_list li.operation","dblclick",this.ops.operation_dblclick,this.ops),document.getElementById("edit-favourites").addEventListener("click",this.ops.edit_favourites_click.bind(this.ops)),document.getElementById("save-favourites").addEventListener("click",this.ops.save_favourites_click.bind(this.ops)),document.getElementById("reset-favourites").addEventListener("click",this.ops.reset_favourites_click.bind(this.ops)),this.add_dynamic_listener(".op_list .op-icon","mouseover",this.ops.op_icon_mouseover,this.ops),this.add_dynamic_listener(".op_list .op-icon","mouseleave",this.ops.op_icon_mouseleave,this.ops),this.add_dynamic_listener(".op_list","oplistcreate",this.ops.op_list_create,this.ops),this.add_dynamic_listener("li.operation","operationadd",this.recipe.op_add.bind(this.recipe)),this.add_dynamic_listener(".arg","keyup",this.recipe.ing_change,this.recipe),this.add_dynamic_listener(".arg","change",this.recipe.ing_change,this.recipe),this.add_dynamic_listener(".disable-icon","click",this.recipe.disable_click,this.recipe),this.add_dynamic_listener(".breakpoint","click",this.recipe.breakpoint_click,this.recipe),this.add_dynamic_listener("#rec_list li.operation","dblclick",this.recipe.operation_dblclick,this.recipe),this.add_dynamic_listener("#rec_list li.operation > div","dblclick",this.recipe.operation_child_dblclick,this.recipe),this.add_dynamic_listener("#rec_list .input-group .dropdown-menu a","click",this.recipe.dropdown_toggle_click,this.recipe),this.add_dynamic_listener("#rec_list","operationremove",this.recipe.op_remove.bind(this.recipe)),this.add_multi_event_listener("#input-text","keyup paste",this.input.input_change,this.input),document.getElementById("reset-layout").addEventListener("click",this.app.reset_layout.bind(this.app)),document.getElementById("clr-io").addEventListener("click",this.input.clear_io_click.bind(this.input)),document.getElementById("input-text").addEventListener("dragover",this.input.input_dragover.bind(this.input)),document.getElementById("input-text").addEventListener("dragleave",this.input.input_dragleave.bind(this.input)),document.getElementById("input-text").addEventListener("drop",this.input.input_drop.bind(this.input)),document.getElementById("input-text").addEventListener("scroll",this.highlighter.input_scroll.bind(this.highlighter)),document.getElementById("input-text").addEventListener("mouseup",this.highlighter.input_mouseup.bind(this.highlighter)),document.getElementById("input-text").addEventListener("mousemove",this.highlighter.input_mousemove.bind(this.highlighter)),this.add_multi_event_listener("#input-text","mousedown dblclick select",this.highlighter.input_mousedown,this.highlighter),document.getElementById("save-to-file").addEventListener("click",this.output.save_click.bind(this.output)),document.getElementById("switch").addEventListener("click",this.output.switch_click.bind(this.output)),document.getElementById("undo-switch").addEventListener("click",this.output.undo_switch_click.bind(this.output)),document.getElementById("maximise-output").addEventListener("click",this.output.maximise_output_click.bind(this.output)),document.getElementById("output-text").addEventListener("scroll",this.highlighter.output_scroll.bind(this.highlighter)),document.getElementById("output-text").addEventListener("mouseup",this.highlighter.output_mouseup.bind(this.highlighter)),document.getElementById("output-text").addEventListener("mousemove",this.highlighter.output_mousemove.bind(this.highlighter)),document.getElementById("output-html").addEventListener("mouseup",this.highlighter.output_html_mouseup.bind(this.highlighter)),document.getElementById("output-html").addEventListener("mousemove",this.highlighter.output_html_mousemove.bind(this.highlighter)),this.add_multi_event_listener("#output-text","mousedown dblclick select",this.highlighter.output_mousedown,this.highlighter),this.add_multi_event_listener("#output-html","mousedown dblclick select",this.highlighter.output_html_mousedown,this.highlighter),document.getElementById("options").addEventListener("click",this.options.options_click.bind(this.options)),document.getElementById("reset-options").addEventListener("click",this.options.reset_options_click.bind(this.options)),$(document).on("switchChange.bootstrapSwitch",".option-item input:checkbox",this.options.switch_change.bind(this.options)),$(document).on("switchChange.bootstrapSwitch",".option-item input:checkbox",this.options.set_word_wrap.bind(this.options)),this.add_dynamic_listener(".option-item input[type=number]","keyup",this.options.number_change,this.options),this.add_dynamic_listener(".option-item input[type=number]","change",this.options.number_change,this.options),this.add_dynamic_listener(".option-item select","change",this.options.select_change,this.options),document.getElementById("alert-close").addEventListener("click",this.app.alert_close_click.bind(this.app))},Manager.prototype.add_listeners=function(a,b,c,d){d=d||this,[].forEach.call(document.querySelectorAll(a),function(a){a.addEventListener(b,c.bind(d))})},Manager.prototype.add_multi_event_listener=function(a,b,c,d){for(var e=b.split(" "),f=0;f-1&&(this.manager.recipe.add_operation(b[c].innerHTML),this.app.auto_bake()))),13===a.keyCode)a.preventDefault();else if(40===a.keyCode)a.preventDefault(),b=document.querySelectorAll("#search-results li"),b.length&&(c=this.get_selected_op(b),c>-1&&b[c].classList.remove("selected-op"),c===b.length-1&&(c=-1),b[c+1].classList.add("selected-op"));else if(38===a.keyCode)a.preventDefault(),b=document.querySelectorAll("#search-results li"),b.length&&(c=this.get_selected_op(b),c>-1&&b[c].classList.remove("selected-op"),0===c&&(c=b.length),b[c-1].classList.add("selected-op"));else{for(var d=document.getElementById("search-results"),e=a.target,f=e.value;d.firstChild;)$(d.firstChild).popover("destroy"),d.removeChild(d.firstChild);if($("#categories .in").collapse("hide"),f){for(var g=this.filter_operations(f,!0),h="",i=0;i=0||h>=0){var i=new HTMLOperation(e,this.app.operations[e],this.app,this.manager);b&&i.highlight_search_string(a,g,h),g<0?c.push(i):d.push(i)}}return d.concat(c)},OperationsWaiter.prototype.get_selected_op=function(a){for(var b=0;blength: "+e+"
                                                                                                              lines: "+f,document.getElementById("input-selection-info").innerHTML="",document.getElementById("output-selection-info").innerHTML=""},OutputWaiter.prototype.adjust_width=function(){var a=document.getElementById("output"),b=document.getElementById("save-to-file"),c=document.getElementById("switch"),d=document.getElementById("undo-switch"),e=document.getElementById("maximise-output");a.clientWidth<680?(b.childNodes[1].nodeValue="",c.childNodes[1].nodeValue="",d.childNodes[1].nodeValue="",e.childNodes[1].nodeValue=""):(b.childNodes[1].nodeValue=" Save to file",c.childNodes[1].nodeValue=" Move output to input",d.childNodes[1].nodeValue=" Undo",e.childNodes[1].nodeValue="Maximise"===e.getAttribute("title")?" Max":" Restore")},OutputWaiter.prototype.save_click=function(){var a=Utils.to_base64(this.app.dish_str),b=window.prompt("Please enter a filename:","download.dat");if(b){var c=document.createElement("a");c.setAttribute("href","data:application/octet-stream;base64;charset=utf-8,"+a),c.setAttribute("download",b),c.style.display="none",document.body.appendChild(c),c.click(),c.remove()}},OutputWaiter.prototype.switch_click=function(){this.switch_orig_data=this.manager.input.get(),document.getElementById("undo-switch").disabled=!1,this.app.set_input(this.app.dish_str)},OutputWaiter.prototype.undo_switch_click=function(){this.app.set_input(this.switch_orig_data),document.getElementById("undo-switch").disabled=!0},OutputWaiter.prototype.maximise_output_click=function(a){var b="maximise-output"===a.target.id?a.target:a.target.parentNode;"Maximise"===b.getAttribute("title")?(this.app.column_splitter.collapse(0),this.app.column_splitter.collapse(1),this.app.io_splitter.collapse(0),b.setAttribute("title","Restore"),b.innerHTML=" Restore",this.adjust_width()):(b.setAttribute("title","Maximise"),b.innerHTML=" Max",this.app.reset_layout())};var RecipeWaiter=function(a,b){this.app=a,this.manager=b,this.remove_intent=!1};RecipeWaiter.prototype.initialise_operation_drag_n_drop=function(){var a=document.getElementById("rec_list");Sortable.create(a,{group:"recipe",sort:!0,animation:0,delay:0,filter:".arg-input,.arg",setData:function(a,b){a.setData("Text",b.querySelector(".arg-title").textContent)},onEnd:function(a){this.remove_intent&&(a.item.remove(),a.target.dispatchEvent(this.manager.operationremove))}.bind(this)}),Sortable.utils.on(a,"dragover",function(){this.remove_intent=!1}.bind(this)),Sortable.utils.on(a,"dragleave",function(){this.remove_intent=!0,this.app.progress=0}.bind(this)),Sortable.utils.on(a,"touchend",function(b){var c=b.changedTouches[0],d=document.elementFromPoint(c.clientX,c.clientY);this.remove_intent=!a.contains(d)}.bind(this)),document.querySelector("#categories a").addEventListener("dragover",this.fav_dragover.bind(this)),document.querySelector("#categories a").addEventListener("dragleave",this.fav_dragleave.bind(this)),document.querySelector("#categories a").addEventListener("drop",this.fav_drop.bind(this))},RecipeWaiter.prototype.create_sortable_seed_list=function(a){Sortable.create(a,{group:{name:"recipe",pull:"clone",put:!1},sort:!1,setData:function(a,b){a.setData("Text",b.textContent)},onStart:function(a){$(a.item).popover("destroy"),a.item.setAttribute("data-toggle","popover-disabled")},onEnd:this.op_sort_end.bind(this)})},RecipeWaiter.prototype.op_sort_end=function(a){return this.remove_intent?void("rec_list"===a.item.parentNode.id&&a.item.remove()):($(a.clone).popover(),$(a.clone).children("[data-toggle=popover]").popover(),void("rec_list"===a.item.parentNode.id&&(this.build_recipe_operation(a.item),a.item.dispatchEvent(this.manager.operationadd))))},RecipeWaiter.prototype.fav_dragover=function(a){return"move"===a.dataTransfer.effectAllowed&&(a.stopPropagation(),a.preventDefault(),void(a.target.className&&a.target.className.indexOf("category-title")>-1?a.target.classList.add("favourites-hover"):a.target.parentNode.className&&a.target.parentNode.className.indexOf("category-title")>-1?a.target.parentNode.classList.add("favourites-hover"):a.target.parentNode.parentNode.className&&a.target.parentNode.parentNode.className.indexOf("category-title")>-1&&a.target.parentNode.parentNode.classList.add("favourites-hover")))},RecipeWaiter.prototype.fav_dragleave=function(a){a.stopPropagation(),a.preventDefault(),document.querySelector("#categories a").classList.remove("favourites-hover")},RecipeWaiter.prototype.fav_drop=function(a){a.stopPropagation(),a.preventDefault(),a.target.classList.remove("favourites-hover");var b=a.dataTransfer.getData("Text");this.app.add_favourite(b)},RecipeWaiter.prototype.ing_change=function(){window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.disable_click=function(a){var b=a.target;"false"===b.getAttribute("disabled")?(b.setAttribute("disabled","true"),b.classList.add("disable-icon-selected"),b.parentNode.parentNode.classList.add("disabled")):(b.setAttribute("disabled","false"),b.classList.remove("disable-icon-selected"),b.parentNode.parentNode.classList.remove("disabled")),this.app.progress=0,window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.breakpoint_click=function(a){var b=a.target;"false"===b.getAttribute("break")?(b.setAttribute("break","true"),b.classList.add("breakpoint-selected")):(b.setAttribute("break","false"),b.classList.remove("breakpoint-selected")),window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.operation_dblclick=function(a){a.target.remove(),window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.operation_child_dblclick=function(a){a.target.parentNode.remove(),window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.get_config=function(){for(var a,b,c,d,e,f=[],g=document.querySelectorAll("#rec_list li.operation"),h=0;h",this.ing_change()},RecipeWaiter.prototype.op_add=function(a){window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.op_remove=function(a){window.dispatchEvent(this.manager.statechange)};var SeasonalWaiter=function(a,b){this.app=a,this.manager=b};SeasonalWaiter.prototype.load=function(){var a=new Date;11===a.getMonth()&&a.getDate()>12&&(this.app.options.snow=!1,this.create_snow_option(),$(document).on("switchChange.bootstrapSwitch",".option-item input:checkbox[option='snow']",this.let_it_snow.bind(this)),window.addEventListener("resize",this.let_it_snow.bind(this)),this.manager.add_listeners(".btn","click",this.shake_off_snow,this),25===a.getDate()&&this.let_it_snow()),this.kkeys=[],window.addEventListener("keydown",this.konami_code_listener.bind(this))},SeasonalWaiter.prototype.insert_spider_icons=function(){var a="iVBORw0KGgoAAAANSUhEUg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lrIfiCYQPHDy6bAGv7nKYRVY6JewExZVAP+ey5Rv+Ba97aaUHMW5NauLmMZFkegBb/EP14d6NoS9QLWFSzWBmuZza8CQmSpXsAqmGtVy14VALWuuYWWy+W3OteXa4jwceQX6+BKG6J1/8+2VCNkm2222WabbbbZZpttttlmm22rt38DCdA0vq3bcAkAAAAASUVORK5CYII="; +document.querySelector("link[rel=icon]").setAttribute("href","data:image/png;base64,"+a),document.querySelector("#bake img").setAttribute("src","data:image/png;base64,"+b),document.querySelector(".about-img-left").setAttribute("src","data:image/png;base64,"+c)},SeasonalWaiter.prototype.insert_spider_text=function(){document.title=document.title.replace(/Cyber/g,"Spider"),SeasonalWaiter.tree_walk(document.body,function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Cyber/g,"Spider"))},!0),SeasonalWaiter.tree_walk(document.getElementById("bake-group"),function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Bake/g,"Spin"))},!0),document.querySelector("#recipe .title").innerHTML="Web"},SeasonalWaiter.prototype.create_snow_option=function(){var a=document.getElementById("options-body"),b=document.createElement("div");b.className="option-item",b.innerHTML=" Let it snow",a.appendChild(b),this.manager.options.load()},SeasonalWaiter.prototype.let_it_snow=function(){if($(document).snowfall("clear"),this.app.options.snow){var a={},b=navigator.userAgent.match(/Firefox\/(\d\d?)/);a=b&&parseInt(b[1],10)<30?{flakeCount:10,flakeColor:"#fff",flakePosition:"absolute",minSize:1,maxSize:2,minSpeed:1,maxSpeed:5,round:!1,shadow:!1,collection:!1,collectionHeight:20,deviceorientation:!0}:{flakeCount:35,flakeColor:"#fff",flakePosition:"absolute",minSize:5,maxSize:8,minSpeed:1,maxSpeed:5,round:!0,shadow:!0,collection:".btn",collectionHeight:20,deviceorientation:!0},$(document).snowfall(a)}},SeasonalWaiter.prototype.shake_off_snow=function(a){for(var b=a.target,c=b.getBoundingClientRect(),d=document.querySelectorAll("canvas.snowfall-canvas"),e=null,f=function(){h.clearRect(0,0,e.width,e.height),$(this).fadeIn()},g=0;g6e4&&this.app.silent_bake()};var main=function(){var a=["To Base64","From Base64","To Hex","From Hex","To Hexdump","From Hexdump","URL Decode","Regular expression","Entropy","Fork"],b={update_url:!0,show_highlighter:!0,treat_as_utf8:!0,word_wrap:!0,show_errors:!0,error_timeout:4e3,auto_bake_threshold:200,attempt_highlight:!0,snow:!1};document.removeEventListener("DOMContentLoaded",main,!1),window.app=new HTMLApp(Categories,OperationConfig,a,b),window.app.setup()};window.console=console||{log:function(){},error:function(){}},window.compile_time=moment.tz("Mon Jan 16 2017 15:59:10","ddd MMM D YYYY HH:mm:ss","UTC").valueOf(),window.compile_message="",document.addEventListener("DOMContentLoaded",main,!1); \ No newline at end of file diff --git a/build/prod/index.html b/build/prod/index.html index 20858598..bc90daec 100755 --- a/build/prod/index.html +++ b/build/prod/index.html @@ -18,4 +18,4 @@ See the License for the specific language governing permissions and limitations under the License. --> -CyberChef Edit
                                                                                                              Operations
                                                                                                                Recipe
                                                                                                                  Input
                                                                                                                  Output
                                                                                                                  \ No newline at end of file +CyberChef Edit
                                                                                                                  Operations
                                                                                                                    Recipe
                                                                                                                      Input
                                                                                                                      Output
                                                                                                                      \ No newline at end of file diff --git a/build/prod/scripts.js b/build/prod/scripts.js index e57654e8..76460a20 100755 --- a/build/prod/scripts.js +++ b/build/prod/scripts.js @@ -269,9 +269,9 @@ Ob.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value>=1&&c.val SUBS_CIPHERTEXT:"XYZABCDEFGHIJKLMNOPQRSTUVW",run_substitute:function(a,b){var c=Utils.str_to_byte_array(Utils.expand_alph_range(b[0]).join()),d=Utils.str_to_byte_array(Utils.expand_alph_range(b[1]).join()),e=[],f=-1;c.length!==d.length&&(e=Utils.str_to_byte_array("Warning: Plaintext and Ciphertext lengths differ\n\n"));for(var g=0;g-1&&f"+prettyPrintOne(Utils.escape_html(a),c,d)+""},BEAUTIFY_INDENT:"\\t",run_xml_beautify:function(a,b){var c=b[0];return vkbeautify.xml(a,c)},run_json_beautify:function(a,b){var c=b[0];return a?vkbeautify.json(a,c):""},run_css_beautify:function(a,b){var c=b[0];return vkbeautify.css(a,c)},run_sql_beautify:function(a,b){var c=b[0];return vkbeautify.sql(a,c)},PRESERVE_COMMENTS:!1,run_xml_minify:function(a,b){var c=b[0];return vkbeautify.xmlmin(a,c)},run_json_minify:function(a,b){return a?vkbeautify.jsonmin(a):""},run_css_minify:function(a,b){var c=b[0];return vkbeautify.cssmin(a,c)},run_sql_minify:function(a,b){return vkbeautify.sqlmin(a)},run_generic_beautify:function(a,b){function c(a,b,c){return g[c]=b[0],a.substring(0,b.index)+"###preserved_token"+c+"###"+a.substring(b.index+b[0].length)}for(var d,e=a,f=0,g=[],h=/'([^'\\]|\\.)*'/g;d=h.exec(e);)e=c(e,d,f++),h.lastIndex=d.index;for(var i=/"([^"\\]|\\.)*"/g;d=i.exec(e);)e=c(e,d,f++),i.lastIndex=d.index;for(var j=/\/\/[^\n\r]*/g;d=j.exec(e);)e=c(e,d,f++),j.lastIndex=d.index;for(var k=/\/\*[\s\S]*?\*\//gm;d=k.exec(e);)e=c(e,d,f++),k.lastIndex=d.index;for(var l=/(^|\n)#[^\n\r#]+/g;d=l.exec(e);)e=c(e,d,f++),l.lastIndex=d.index;for(var m=/\/.*?[^\\]\/[gim]{0,3}/gi;d=m.exec(e);)e=c(e,d,f++),m.lastIndex=d.index;e=e.replace(/;/g,";\n"),e=e.replace(/{/g,"{\n"),e=e.replace(/}/g,"\n}\n"),e=e.replace(/\r/g,""),e=e.replace(/^\s+/g,""),e=e.replace(/\n\s+/g,"\n"),e=e.replace(/\s*$/g,""),e=e.replace(/\n{/g,"{");for(var n=0,o=0;n=e.length)break;"}"===e[n+1]&&o--;var p=o>=0?Array(4*o+1).join(" "):"";e=e.substring(0,n+1)+p+e.substring(n+1),o>0&&(n+=4*o)}n++}e=e.replace(/\s*([!<>=+-\/*]?)=\s*/g," $1= "),e=e.replace(/\s*<([=]?)\s*/g," <$1 "),e=e.replace(/\s*>([=]?)\s*/g," >$1 "),e=e.replace(/([^+])\+([^+=])/g,"$1 + $2"),e=e.replace(/([^-])-([^-=])/g,"$1 - $2"),e=e.replace(/([^*])\*([^*=])/g,"$1 * $2"),e=e.replace(/([^\/])\/([^\/=])/g,"$1 / $2"),e=e.replace(/\s*,\s*/g,", "),e=e.replace(/\s*{/g," {"),e=e.replace(/}\n/g,"}\n\n"),e=e.replace(/(if|for|while|with|elif|elseif)\s*\(([^\n]*)\)\s*\n([^{])/gim,"$1 ($2)\n $3"),e=e.replace(/(if|for|while|with|elif|elseif)\s*\(([^\n]*)\)([^{])/gim,"$1 ($2) $3"),e=e.replace(/else\s*\n([^{])/gim,"else\n $1"),e=e.replace(/else\s+([^{])/gim,"else $1"),e=e.replace(/\s+;/g,";"),e=e.replace(/\{\s+\}/g,"{}"),e=e.replace(/\[\s+\]/g,"[]"),e=e.replace(/}\s*(else|catch|except|finally|elif|elseif|else if)/gi,"} $1");for(var q=/###preserved_token(\d+)###/g;d=q.exec(e);){var r=parseInt(d[1],10);e=e.substring(0,d.index)+g[r]+e.substring(d.index+d[0].length),q.lastIndex=d.index}return e},XPATH_INITIAL:"",XPATH_DELIMITER:"\\n",run_xpath:function(a,b){var c,d=b[0],e=b[1];try{c=$.parseXML(a)}catch(a){return"Invalid input XML."}var f;try{f=xpath.evaluate(c,d)}catch(a){return"Invalid XPath. Details:\n"+a.message}var g=new XMLSerializer,h=function(a){switch(a.nodeType){case Node.ELEMENT_NODE:return g.serializeToString(a);case Node.ATTRIBUTE_NODE:return a.value;case Node.COMMENT_NODE:return a.data;case Node.DOCUMENT_NODE:return g.serializeToString(a);default:throw new Error("Unknown Node Type: "+a.nodeType)}};return Object.keys(f).map(function(a){return f[a]}).slice(0,-1).map(h).join(e)},CSS_SELECTOR_INITIAL:"",CSS_QUERY_DELIMITER:"\\n",run_css_query:function(a,b){var c,d=b[0],e=b[1];try{c=$.parseHTML(a)}catch(a){return"Invalid input HTML."}var f;try{f=$(c).find(d)}catch(a){return"Invalid CSS Selector. Details:\n"+a.message}var g=function(a){switch(a.nodeType){case Node.ELEMENT_NODE:return a.outerHTML;case Node.ATTRIBUTE_NODE:return a.value;case Node.COMMENT_NODE:return a.data;case Node.TEXT_NODE:return a.wholeText;case Node.DOCUMENT_NODE:return a.outerHTML;default:throw new Error("Unknown Node Type: "+a.nodeType)}};return Array.apply(null,Array(f.length)).map(function(a,b){return f[b]}).map(g).join(e)}},Compress={COMPRESSION_TYPE:["Dynamic Huffman Coding","Fixed Huffman Coding","None (Store)"],INFLATE_BUFFER_TYPE:["Adaptive","Block"],COMPRESSION_METHOD:["Deflate","None (Store)"],OS:["MSDOS","Unix","Macintosh"],RAW_COMPRESSION_TYPE_LOOKUP:{"Fixed Huffman Coding":Zlib.RawDeflate.CompressionType.FIXED,"Dynamic Huffman Coding":Zlib.RawDeflate.CompressionType.DYNAMIC,"None (Store)":Zlib.RawDeflate.CompressionType.NONE},run_raw_deflate:function(a,b){var c=new Zlib.RawDeflate(a,{compressionType:Compress.RAW_COMPRESSION_TYPE_LOOKUP[b[0]]});return Array.prototype.slice.call(c.compress())},INFLATE_INDEX:0,INFLATE_BUFFER_SIZE:0,INFLATE_RESIZE:!1,INFLATE_VERIFY:!1,RAW_BUFFER_TYPE_LOOKUP:{Adaptive:Zlib.RawInflate.BufferType.ADAPTIVE,Block:Zlib.RawInflate.BufferType.BLOCK},run_raw_inflate:function(a,b){a=Utils.str_to_byte_array(Utils.byte_array_to_utf8(a));var c=new Zlib.RawInflate(a,{index:b[0],bufferSize:b[1],bufferType:Compress.RAW_BUFFER_TYPE_LOOKUP[b[2]],resize:b[3],verify:b[4]}),d=Array.prototype.slice.call(c.decompress());if(d.length>158&&93===d[0]&&93===d[5]){for(var e=!1,f=0;f<155;f+=5)93!==d[f]&&(e=!0);if(!e)throw"Error: Unable to inflate data"}return d},ZLIB_COMPRESSION_TYPE_LOOKUP:{"Fixed Huffman Coding":Zlib.Deflate.CompressionType.FIXED,"Dynamic Huffman Coding":Zlib.Deflate.CompressionType.DYNAMIC,"None (Store)":Zlib.Deflate.CompressionType.NONE},run_zlib_deflate:function(a,b){var c=new Zlib.Deflate(a,{compressionType:Compress.ZLIB_COMPRESSION_TYPE_LOOKUP[b[0]]});return Array.prototype.slice.call(c.compress())},ZLIB_BUFFER_TYPE_LOOKUP:{Adaptive:Zlib.Inflate.BufferType.ADAPTIVE,Block:Zlib.Inflate.BufferType.BLOCK},run_zlib_inflate:function(a,b){a=Utils.str_to_byte_array(Utils.byte_array_to_utf8(a));var c=new Zlib.Inflate(a,{index:b[0],bufferSize:b[1],bufferType:Compress.ZLIB_BUFFER_TYPE_LOOKUP[b[2]],resize:b[3],verify:b[4]});return Array.prototype.slice.call(c.decompress())},GZIP_CHECKSUM:!1,run_gzip:function(a,b){var c=b[1],d=b[2],e={deflateOptions:{compressionType:Compress.ZLIB_COMPRESSION_TYPE_LOOKUP[b[0]]},flags:{fhcrc:b[3]}};c.length&&(e.flags.fname=!0,e.filename=c),d.length&&(e.flags.fcommenct=!0,e.comment=d);var f=new Zlib.Gzip(a,e);return Array.prototype.slice.call(f.compress())},run_gunzip:function(a,b){a=Utils.str_to_byte_array(Utils.byte_array_to_utf8(a));var c=new Zlib.Gunzip(a);return Array.prototype.slice.call(c.decompress())},PKZIP_FILENAME:"file.txt",ZIP_COMPRESSION_METHOD_LOOKUP:{Deflate:Zlib.Zip.CompressionMethod.DEFLATE,"None (Store)":Zlib.Zip.CompressionMethod.STORE},ZIP_OS_LOOKUP:{MSDOS:Zlib.Zip.OperatingSystem.MSDOS,Unix:Zlib.Zip.OperatingSystem.UNIX,Macintosh:Zlib.Zip.OperatingSystem.MACINTOSH},run_pkzip:function(a,b){var c=Utils.str_to_byte_array(b[2]),d={filename:Utils.str_to_byte_array(b[0]),comment:Utils.str_to_byte_array(b[1]),compressionMethod:Compress.ZIP_COMPRESSION_METHOD_LOOKUP[b[3]],os:Compress.ZIP_OS_LOOKUP[b[4]],deflateOption:{compressionType:Compress.ZLIB_COMPRESSION_TYPE_LOOKUP[b[5]]}},e=new Zlib.Zip;return c.length&&e.setPassword(c),e.addFile(a,d),Array.prototype.slice.call(e.compress())},PKUNZIP_VERIFY:!1,run_pkunzip:function(a,b){var c={password:Utils.str_to_byte_array(b[0]),verify:b[1]},d="",e=new Zlib.Unzip(a,c),f=e.getFilenames(),g="
                                                                                                                      "+f.length+" file(s) found
                                                                                                                      \n";g+="
                                                                                                                      ",window.uzip=e;for(var h=0;h
                                                                                                                      "+Utils.escape_html(d)+"
                                                                                                                      ";return g+"
                                                                                                                      "},run_bzip2_decompress:function(a,b){var c,d=new Uint8Array(a),e="";return c=bzip2.array(d),e=bzip2.simple(c)}},Convert={DISTANCE_UNITS:["[Metric]","Nanometres (nm)","Micrometres (\xb5m)","Millimetres (mm)","Centimetres (cm)","Metres (m)","Kilometers (km)","[/Metric]","[Imperial]","Thou (th)","Inches (in)","Feet (ft)","Yards (yd)","Chains (ch)","Furlongs (fur)","Miles (mi)","Leagues (lea)","[/Imperial]","[Maritime]","Fathoms (ftm)","Cables","Nautical miles","[/Maritime]","[Comparisons]","Cars (4m)","Buses (8.4m)","American football fields (91m)","Football pitches (105m)","[/Comparisons]","[Astronomical]","Earth-to-Moons","Earth's equators","Astronomical units (au)","Light-years (ly)","Parsecs (pc)","[/Astronomical]"],DISTANCE_FACTOR:{"Nanometres (nm)":1e-9,"Micrometres (\xb5m)":1e-6,"Millimetres (mm)":.001,"Centimetres (cm)":.01,"Metres (m)":1,"Kilometers (km)":1e3,"Thou (th)":254e-7,"Inches (in)":.0254,"Feet (ft)":.3048,"Yards (yd)":.9144,"Chains (ch)":20.1168,"Furlongs (fur)":201.168,"Miles (mi)":1609.344,"Leagues (lea)":4828.032,"Fathoms (ftm)":1.853184,Cables:185.3184,"Nautical miles":1853.184,"Cars (4m)":4,"Buses (8.4m)":8.4,"American football fields (91m)":91,"Football pitches (105m)":105,"Earth-to-Moons":38e7,"Earth's equators":40075016.686,"Astronomical units (au)":149597870700,"Light-years (ly)":9460730472580800,"Parsecs (pc)":30856776e9},run_distance:function(a,b){var c=b[0],d=b[1];return a*=Convert.DISTANCE_FACTOR[c],a/Convert.DISTANCE_FACTOR[d]},DATA_UNITS:["Bits (b)","Nibbles","Octets","Bytes (B)","[Binary bits (2^n)]","Kibibits (Kib)","Mebibits (Mib)","Gibibits (Gib)","Tebibits (Tib)","Pebibits (Pib)","Exbibits (Eib)","Zebibits (Zib)","Yobibits (Yib)","[/Binary bits (2^n)]","[Decimal bits (10^n)]","Decabits","Hectobits","Kilobits (kb)","Megabits (Mb)","Gigabits (Gb)","Terabits (Tb)","Petabits (Pb)","Exabits (Eb)","Zettabits (Zb)","Yottabits (Yb)","[/Decimal bits (10^n)]","[Binary bytes (8 x 2^n)]","Kibibytes (KiB)","Mebibytes (MiB)","Gibibytes (GiB)","Tebibytes (TiB)","Pebibytes (PiB)","Exbibytes (EiB)","Zebibytes (ZiB)","Yobibytes (YiB)","[/Binary bytes (8 x 2^n)]","[Decimal bytes (8 x 10^n)]","Kilobytes (KB)","Megabytes (MB)","Gigabytes (GB)","Terabytes (TB)","Petabytes (PB)","Exabytes (EB)","Zettabytes (ZB)","Yottabytes (YB)","[/Decimal bytes (8 x 10^n)]"],DATA_FACTOR:{"Bits (b)":1,Nibbles:4,Octets:8,"Bytes (B)":8,"Kibibits (Kib)":1024,"Mebibits (Mib)":1048576,"Gibibits (Gib)":1073741824,"Tebibits (Tib)":1099511627776,"Pebibits (Pib)":0x4000000000000,"Exbibits (Eib)":0x1000000000000000,"Zebibits (Zib)":0x400000000000000000,"Yobibits (Yib)":1.2089258196146292e24,Decabits:10,Hectobits:100,"Kilobits (Kb)":1e3,"Megabits (Mb)":1e6,"Gigabits (Gb)":1e9,"Terabits (Tb)":1e12,"Petabits (Pb)":1e15,"Exabits (Eb)":1e18,"Zettabits (Zb)":1e21,"Yottabits (Yb)":1e24,"Kibibytes (KiB)":8192,"Mebibytes (MiB)":8388608,"Gibibytes (GiB)":8589934592,"Tebibytes (TiB)":8796093022208,"Pebibytes (PiB)":9007199254740992,"Exbibytes (EiB)":0x8000000000000000,"Zebibytes (ZiB)":9.44473296573929e21,"Yobibytes (YiB)":9.671406556917033e24,"Kilobytes (KB)":8e3,"Megabytes (MB)":8e6,"Gigabytes (GB)":8e9,"Terabytes (TB)":8e12,"Petabytes (PB)":8e15,"Exabytes (EB)":8e18,"Zettabytes (ZB)":8e21,"Yottabytes (YB)":8e24},run_data_size:function(a,b){var c=b[0],d=b[1];return a*=Convert.DATA_FACTOR[c],a/Convert.DATA_FACTOR[d]},AREA_UNITS:["[Metric]","Square metre (sq m)","Square kilometre (sq km)","Centiare (ca)","Deciare (da)","Are (a)","Decare (daa)","Hectare (ha)","[/Metric]","[Imperial]","Square inch (sq in)","Square foot (sq ft)","Square yard (sq yd)","Square mile (sq mi)","Perch (sq per)","Rood (ro)","International acre (ac)","[/Imperial]","[US customary units]","US survey acre (ac)","US survey square mile (sq mi)","US survey township","[/US customary units]","[Nuclear physics]","Yoctobarn (yb)","Zeptobarn (zb)","Attobarn (ab)","Femtobarn (fb)","Picobarn (pb)","Nanobarn (nb)","Microbarn (\u03bcb)","Millibarn (mb)","Barn (b)","Kilobarn (kb)","Megabarn (Mb)","Outhouse","Shed","Planck area","[/Nuclear physics]","[Comparisons]","Washington D.C.","Isle of Wight","Wales","Texas","[/Comparisons]"],AREA_FACTOR:{"Square metre (sq m)":1,"Square kilometre (sq km)":1e6,"Centiare (ca)":1,"Deciare (da)":10,"Are (a)":100,"Decare (daa)":1e3,"Hectare (ha)":1e4,"Square inch (sq in)":64516e-8,"Square foot (sq ft)":.09290304,"Square yard (sq yd)":.83612736,"Square mile (sq mi)":2589988.110336,"Perch (sq per)":42.21,"Rood (ro)":1011,"International acre (ac)":4046.8564224,"US survey acre (ac)":4046.87261,"US survey square mile (sq mi)":2589998.470305239,"US survey township":93239944.9309886,"Yoctobarn (yb)":1e-52,"Zeptobarn (zb)":1e-49,"Attobarn (ab)":1e-46,"Femtobarn (fb)":1e-43,"Picobarn (pb)":1e-40,"Nanobarn (nb)":1e-37,"Microbarn (\u03bcb)":1e-34,"Millibarn (mb)":1e-31,"Barn (b)":1e-28,"Kilobarn (kb)":1e-25,"Megabarn (Mb)":1e-22,"Planck area":2.6e-70,Shed:1e-52,Outhouse:1e-34,"Washington D.C.":176119191.502848,"Isle of Wight":38e7,Wales:20779e6,Texas:696241e6},run_area:function(a,b){var c=b[0],d=b[1];return a*=Convert.AREA_FACTOR[c],a/Convert.AREA_FACTOR[d]},MASS_UNITS:["[Metric]","Yoctogram (yg)","Zeptogram (zg)","Attogram (ag)","Femtogram (fg)","Picogram (pg)","Nanogram (ng)","Microgram (\u03bcg)","Milligram (mg)","Centigram (cg)","Decigram (dg)","Gram (g)","Decagram (dag)","Hectogram (hg)","Kilogram (kg)","Megagram (Mg)","Tonne (t)","Gigagram (Gg)","Teragram (Tg)","Petagram (Pg)","Exagram (Eg)","Zettagram (Zg)","Yottagram (Yg)","[/Metric]","[Imperial Avoirdupois]","Grain (gr)","Dram (dr)","Ounce (oz)","Pound (lb)","Nail","Stone (st)","Quarter (gr)","Tod","US hundredweight (cwt)","Imperial hundredweight (cwt)","US ton (t)","Imperial ton (t)","[/Imperial Avoirdupois]","[Imperial Troy]","Grain (gr)","Pennyweight (dwt)","Troy dram (dr t)","Troy ounce (oz t)","Troy pound (lb t)","Mark","[/Imperial Troy]","[Archaic]","Wey","Wool wey","Suffolk wey","Wool sack","Coal sack","Load","Last","Flax or feather last","Gunpowder last","Picul","Rice last","[/Archaic]","[Comparisons]","Big Ben (14 tonnes)","Blue whale (180 tonnes)","International Space Station (417 tonnes)","Space Shuttle (2,041 tonnes)","RMS Titanic (52,000 tonnes)","Great Pyramid of Giza (6,000,000 tonnes)","Earth's oceans (1.4 yottagrams)","[/Comparisons]","[Astronomical]","A teaspoon of neutron star (5,500 million tonnes)","Lunar mass (ML)","Earth mass (M\u2295)","Jupiter mass (MJ)","Solar mass (M\u2609)","Sagittarius A* (7.5 x 10^36 kgs-ish)","Milky Way galaxy (1.2 x 10^42 kgs)","The observable universe (1.45 x 10^53 kgs)","[/Astronomical]"],MASS_FACTOR:{"Yoctogram (yg)":1e-24,"Zeptogram (zg)":1e-21,"Attogram (ag)":1e-18,"Femtogram (fg)":1e-15,"Picogram (pg)":1e-12,"Nanogram (ng)":1e-9,"Microgram (\u03bcg)":1e-6,"Milligram (mg)":.001,"Centigram (cg)":.01,"Decigram (dg)":.1,"Gram (g)":1,"Decagram (dag)":10,"Hectogram (hg)":100,"Kilogram (kg)":1e3,"Megagram (Mg)":1e6,"Tonne (t)":1e6,"Gigagram (Gg)":1e9,"Teragram (Tg)":1e12,"Petagram (Pg)":1e15,"Exagram (Eg)":1e18,"Zettagram (Zg)":1e21,"Yottagram (Yg)":1e24,"Grain (gr)":.06479891,"Dram (dr)":1.7718451953125,"Ounce (oz)":28.349523125,"Pound (lb)":453.59237,Nail:3175.14659,"Stone (st)":6350.29318,"Quarter (gr)":12700.58636,Tod:12700.58636,"US hundredweight (cwt)":45359.237,"Imperial hundredweight (cwt)":50802.34544,"US ton (t)":907184.74,"Imperial ton (t)":1016046.9088,"Pennyweight (dwt)":1.55517384,"Troy dram (dr t)":3.8879346,"Troy ounce (oz t)":31.1034768,"Troy pound (lb t)":373.2417216,Mark:248.8278144,Wey:76500,"Wool wey":101700,"Suffolk wey":161500,"Wool sack":153e3,"Coal sack":50802.34544,Load:918e3,Last:1836e3,"Flax or feather last":77e4,"Gunpowder last":109e4,Picul:60478.982,"Rice last":12e5,"Big Ben (14 tonnes)":14e6,"Blue whale (180 tonnes)":18e7,"International Space Station (417 tonnes)":417e6,"Space Shuttle (2,041 tonnes)":2041e6,"RMS Titanic (52,000 tonnes)":52e9,"Great Pyramid of Giza (6,000,000 tonnes)":6e12,"Earth's oceans (1.4 yottagrams)":1.4e24,"A teaspoon of neutron star (5,500 million tonnes)":55e14,"Lunar mass (ML)":7.342e25,"Earth mass (M\u2295)":5.97219e27,"Jupiter mass (MJ)":1.8981411476999997e30,"Solar mass (M\u2609)":1.98855e33,"Sagittarius A* (7.5 x 10^36 kgs-ish)":7.5e39,"Milky Way galaxy (1.2 x 10^42 kgs)":1.2e45,"The observable universe (1.45 x 10^53 kgs)":1.45e56},run_mass:function(a,b){var c=b[0],d=b[1];return a*=Convert.MASS_FACTOR[c],a/Convert.MASS_FACTOR[d]},SPEED_UNITS:["[Metric]","Metres per second (m/s)","Kilometres per hour (km/h)","[/Metric]","[Imperial]","Miles per hour (mph)","Knots (kn)","[/Imperial]","[Comparisons]","Human hair growth rate","Bamboo growth rate","World's fastest snail","Usain Bolt's top speed","Jet airliner cruising speed","Concorde","SR-71 Blackbird","Space Shuttle","International Space Station","[/Comparisons]","[Scientific]","Sound in standard atmosphere","Sound in water","Lunar escape velocity","Earth escape velocity","Earth's solar orbit","Solar system's Milky Way orbit","Milky Way relative to the cosmic microwave background","Solar escape velocity","Neutron star escape velocity (0.3c)","Light in a diamond (0.4136c)","Signal in an optical fibre (0.667c)","Light (c)","[/Scientific]"],SPEED_FACTOR:{"Metres per second (m/s)":1,"Kilometres per hour (km/h)":.2778,"Miles per hour (mph)":.44704,"Knots (kn)":.5144,"Human hair growth rate":4.8e-9,"Bamboo growth rate":14e-6,"World's fastest snail":.00275,"Usain Bolt's top speed":12.42,"Jet airliner cruising speed":250,Concorde:603,"SR-71 Blackbird":981,"Space Shuttle":1400,"International Space Station":7700,"Sound in standard atmosphere":340.3,"Sound in water":1500,"Lunar escape velocity":2375,"Earth escape velocity":11200,"Earth's solar orbit":29800,"Solar system's Milky Way orbit":2e5,"Milky Way relative to the cosmic microwave background":552e3,"Solar escape velocity":617700,"Neutron star escape velocity (0.3c)":1e8,"Light in a diamond (0.4136c)":124e6,"Signal in an optical fibre (0.667c)":2e8,"Light (c)":299792458},run_speed:function(a,b){var c=b[0],d=b[1];return a*=Convert.SPEED_FACTOR[c],a/Convert.SPEED_FACTOR[d]}},DateTime={UNITS:["Seconds (s)","Milliseconds (ms)","Microseconds (\u03bcs)","Nanoseconds (ns)"],run_from_unix_timestamp:function(a,b){var c,d=b[0];if(a=parseFloat(a),"Seconds (s)"===d)return c=moment.unix(a),c.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss")+" UTC";if("Milliseconds (ms)"===d)return c=moment(a),c.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss.SSS")+" UTC";if("Microseconds (\u03bcs)"===d)return c=moment(a/1e3),c.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss.SSS")+" UTC";if("Nanoseconds (ns)"===d)return c=moment(a/1e6),c.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss.SSS")+" UTC";throw"Unrecognised unit"},run_to_unix_timestamp:function(a,b){var c=b[0],d=moment(a);if("Seconds (s)"===c)return d.unix();if("Milliseconds (ms)"===c)return d.valueOf();if("Microseconds (\u03bcs)"===c)return 1e3*d.valueOf();if("Nanoseconds (ns)"===c)return 1e6*d.valueOf();throw"Unrecognised unit"},DATETIME_FORMATS:[{name:"Standard date and time",value:"DD/MM/YYYY HH:mm:ss"},{name:"American-style date and time",value:"MM/DD/YYYY HH:mm:ss"},{name:"International date and time",value:"YYYY-MM-DD HH:mm:ss"},{name:"Verbose date and time",value:"dddd Do MMMM YYYY HH:mm:ss Z z"},{name:"UNIX timestamp (seconds)",value:"X"},{name:"UNIX timestamp offset (milliseconds)",value:"x"},{name:"Automatic",value:""}],INPUT_FORMAT_STRING:"DD/MM/YYYY HH:mm:ss",OUTPUT_FORMAT_STRING:"dddd Do MMMM YYYY HH:mm:ss Z z",TIMEZONES:["UTC"].concat(moment.tz.names()),run_translate_format:function(a,b){var c,d=b[1],e=b[2],f=b[3],g=b[4];try{if(c=moment.tz(a,d,e),!c||"Invalid date"===c.format())throw Error}catch(a){return"Invalid format.\n\n"+DateTime.FORMAT_EXAMPLES}return c.tz(g).format(f)},run_parse:function(a,b){var c,d=b[1],e=b[2],f="";try{if(c=moment.tz(a,d,e),!c||"Invalid date"===c.format())throw Error}catch(a){return"Invalid format.\n\n"+DateTime.FORMAT_EXAMPLES}return f+="Date: "+c.format("dddd Do MMMM YYYY")+"\nTime: "+c.format("HH:mm:ss")+"\nPeriod: "+c.format("A")+"\nTimezone: "+c.format("z")+"\nUTC offset: "+c.format("ZZ")+"\n\nDaylight Saving Time: "+c.isDST()+"\nLeap year: "+c.isLeapYear()+"\nDays in this month: "+c.daysInMonth()+"\n\nDay of year: "+c.dayOfYear()+"\nWeek number: "+c.weekYear()+"\nQuarter: "+c.quarter()},FORMAT_EXAMPLES:"Format string tokens:\n\n
                                                                                                                      Category Token Output
                                                                                                                      Month M 1 2 ... 11 12
                                                                                                                      Mo 1st 2nd ... 11th 12th
                                                                                                                      MM 01 02 ... 11 12
                                                                                                                      MMM Jan Feb ... Nov Dec
                                                                                                                      MMMM January February ... November December
                                                                                                                      Quarter Q 1 2 3 4
                                                                                                                      Day of Month D 1 2 ... 30 31
                                                                                                                      Do 1st 2nd ... 30th 31st
                                                                                                                      DD 01 02 ... 30 31
                                                                                                                      Day of Year DDD 1 2 ... 364 365
                                                                                                                      DDDo 1st 2nd ... 364th 365th
                                                                                                                      DDDD 001 002 ... 364 365
                                                                                                                      Day of Week d 0 1 ... 5 6
                                                                                                                      do 0th 1st ... 5th 6th
                                                                                                                      dd Su Mo ... Fr Sa
                                                                                                                      ddd Sun Mon ... Fri Sat
                                                                                                                      dddd Sunday Monday ... Friday Saturday
                                                                                                                      Day of Week (Locale) e 0 1 ... 5 6
                                                                                                                      Day of Week (ISO) E 1 2 ... 6 7
                                                                                                                      Week of Year w 1 2 ... 52 53
                                                                                                                      wo 1st 2nd ... 52nd 53rd
                                                                                                                      ww 01 02 ... 52 53
                                                                                                                      Week of Year (ISO) W 1 2 ... 52 53
                                                                                                                      Wo 1st 2nd ... 52nd 53rd
                                                                                                                      WW 01 02 ... 52 53
                                                                                                                      Year YY 70 71 ... 29 30
                                                                                                                      YYYY 1970 1971 ... 2029 2030
                                                                                                                      Week Year gg 70 71 ... 29 30
                                                                                                                      gggg 1970 1971 ... 2029 2030
                                                                                                                      Week Year (ISO) GG 70 71 ... 29 30
                                                                                                                      GGGG 1970 1971 ... 2029 2030
                                                                                                                      AM/PM A AM PM
                                                                                                                      a am pm
                                                                                                                      Hour H 0 1 ... 22 23
                                                                                                                      HH 00 01 ... 22 23
                                                                                                                      h 1 2 ... 11 12
                                                                                                                      hh 01 02 ... 11 12
                                                                                                                      Minute m 0 1 ... 58 59
                                                                                                                      mm 00 01 ... 58 59
                                                                                                                      Second s 0 1 ... 58 59
                                                                                                                      ss 00 01 ... 58 59
                                                                                                                      Fractional Second S 0 1 ... 8 9
                                                                                                                      SS 00 01 ... 98 99
                                                                                                                      SSS 000 001 ... 998 999
                                                                                                                      SSSS ... SSSSSSSSS 000[0..] 001[0..] ... 998[0..] 999[0..]
                                                                                                                      Timezone z or zz EST CST ... MST PST
                                                                                                                      Z -07:00 -06:00 ... +06:00 +07:00
                                                                                                                      ZZ -0700 -0600 ... +0600 +0700
                                                                                                                      Unix Timestamp X 1360013296
                                                                                                                      Unix Millisecond Timestamp x 1360013296123
                                                                                                                      "},Endian={DATA_FORMAT:["Hex","Raw"],WORD_LENGTH:4,PAD_INCOMPLETE_WORDS:!0,run_swap_endianness:function(a,b){var c=b[0],d=b[1],e=b[2],f=[],g=[],h=[],i=0,j=0;if(d<=0)return"Word length must be greater than 0";switch(c){case"Hex":f=Utils.from_hex(a);break;case"Raw":f=Utils.str_to_byte_array(a);break;default:f=a}for(i=0;i
                                                                                                                      \n- 0 represents no randomness (i.e. all the bytes in the data have the same value) whereas 8, the maximum, represents a completely random string.\n- Standard English text usually falls somewhere between 3.5 and 5.\n- Properly encrypted or compressed data of a reasonable length should have an entropy of over 7.5.\n\nThe following results show the entropy of chunks of the input data. Chunks with particularly high entropy could suggest encrypted or compressed sections.\n\n
                                                                                                                      Operations
                                                                                                                        Recipe
                                                                                                                          Input
                                                                                                                          Output
                                                                                                                          Operations
                                                                                                                            Recipe
                                                                                                                              Input
                                                                                                                              Output
                                                                                                                              \ No newline at end of file +var c="";return c+="IP addresses\n",c+=Extract.run_ip(a,[!0,!0,!1]),c+="\nEmail addresses\n",c+=Extract.run_email(a,[]),c+="\nMAC addresses\n",c+=Extract.run_mac(a,[]),c+="\nURLs\n",c+=Extract.run_urls(a,[]),c+="\nDomain names\n",c+=Extract.run_domains(a,[]),c+="\nFile paths\n",c+=Extract.run_file_paths(a,[!0,!0]),c+="\nDates\n",c+=Extract.run_dates(a,[])}},FileType={run_detect:function(a,b){var c=FileType._magic_type(a);if(c){var d="File extension: "+c.ext+"\nMIME type: "+c.mime;return c.desc&&c.desc.length&&(d+="\nDescription: "+c.desc),d}return"Unknown file type. Have you tried checking the entropy of this data to determine whether it might be encrypted or compressed?"},IGNORE_COMMON_BYTE_SEQUENCES:!0,run_scan_for_embedded_files:function(a,b){for(var c,d="Scanning data for 'magic bytes' which may indicate embedded files. The following results may be false positives and should not be treat as reliable. Any suffiently long file is likely to contain these magic bytes coincidentally.\n",e=b[0],f=["ico","ttf",""],g=0,h=0,i=0;i-1){h++;continue}g++,d+="\nOffset "+i+" (0x"+Utils.hex(i)+"):\n File extension: "+c.ext+"\n MIME type: "+c.mime+"\n",c.desc&&c.desc.length&&(d+=" Description: "+c.desc+"\n")}return 0===g&&(d+="\nNo embedded files were found."),h>0&&(d+="\n\n"+h,d+=1===h?" file type was detected that has a common byte sequence. This is likely to be a false positive.":" file types were detected that have common byte sequences. These are likely to be false positives.",d+=" Run this operation with the 'Ignore common byte sequences' option unchecked to see details."),d},_magic_type:function(a){return a&&a.length>1?255===a[0]&&216===a[1]&&255===a[2]?{ext:"jpg",mime:"image/jpeg"}:137===a[0]&&80===a[1]&&78===a[2]&&71===a[3]?{ext:"png",mime:"image/png"}:71===a[0]&&73===a[1]&&70===a[2]?{ext:"gif",mime:"image/gif"}:87===a[8]&&69===a[9]&&66===a[10]&&80===a[11]?{ext:"webp",mime:"image/webp"}:(73===a[0]&&73===a[1]&&42===a[2]&&0===a[3]||77===a[0]&&77===a[1]&&0===a[2]&&42===a[3])&&67===a[8]&&82===a[9]?{ext:"cr2",mime:"image/x-canon-cr2"}:73===a[0]&&73===a[1]&&42===a[2]&&0===a[3]||77===a[0]&&77===a[1]&&0===a[2]&&42===a[3]?{ext:"tif",mime:"image/tiff"}:66===a[0]&&77===a[1]?{ext:"bmp",mime:"image/bmp"}:73===a[0]&&73===a[1]&&188===a[2]?{ext:"jxr",mime:"image/vnd.ms-photo"}:56===a[0]&&66===a[1]&&80===a[2]&&83===a[3]?{ext:"psd",mime:"image/vnd.adobe.photoshop"}:80===a[0]&&75===a[1]&&3===a[2]&&4===a[3]&&109===a[30]&&105===a[31]&&109===a[32]&&101===a[33]&&116===a[34]&&121===a[35]&&112===a[36]&&101===a[37]&&97===a[38]&&112===a[39]&&112===a[40]&&108===a[41]&&105===a[42]&&99===a[43]&&97===a[44]&&116===a[45]&&105===a[46]&&111===a[47]&&110===a[48]&&47===a[49]&&101===a[50]&&112===a[51]&&117===a[52]&&98===a[53]&&43===a[54]&&122===a[55]&&105===a[56]&&112===a[57]?{ext:"epub",mime:"application/epub+zip"}:80!==a[0]||75!==a[1]||3!==a[2]&&5!==a[2]&&7!==a[2]||4!==a[3]&&6!==a[3]&&8!==a[3]?117===a[257]&&115===a[258]&&116===a[259]&&97===a[260]&&114===a[261]?{ext:"tar",mime:"application/x-tar"}:82!==a[0]||97!==a[1]||114!==a[2]||33!==a[3]||26!==a[4]||7!==a[5]||0!==a[6]&&1!==a[6]?31===a[0]&&139===a[1]&&8===a[2]?{ext:"gz",mime:"application/gzip"}:66===a[0]&&90===a[1]&&104===a[2]?{ext:"bz2",mime:"application/x-bzip2"}:55===a[0]&&122===a[1]&&188===a[2]&&175===a[3]&&39===a[4]&&28===a[5]?{ext:"7z",mime:"application/x-7z-compressed"}:120===a[0]&&1===a[1]?{ext:"dmg",mime:"application/x-apple-diskimage"}:0===a[0]&&0===a[1]&&0===a[2]&&(24===a[3]||32===a[3])&&102===a[4]&&116===a[5]&&121===a[6]&&112===a[7]||51===a[0]&&103===a[1]&&112===a[2]&&53===a[3]||0===a[0]&&0===a[1]&&0===a[2]&&28===a[3]&&102===a[4]&&116===a[5]&&121===a[6]&&112===a[7]&&109===a[8]&&112===a[9]&&52===a[10]&&50===a[11]&&109===a[16]&&112===a[17]&&52===a[18]&&49===a[19]&&109===a[20]&&112===a[21]&&52===a[22]&&50===a[23]&&105===a[24]&&115===a[25]&&111===a[26]&&109===a[27]?{ext:"mp4",mime:"video/mp4"}:0===a[0]&&0===a[1]&&0===a[2]&&28===a[3]&&102===a[4]&&116===a[5]&&121===a[6]&&112===a[7]&&77===a[8]&&52===a[9]&&86===a[10]?{ext:"m4v",mime:"video/x-m4v"}:77===a[0]&&84===a[1]&&104===a[2]&&100===a[3]?{ext:"mid",mime:"audio/midi"}:109===a[31]&&97===a[32]&&116===a[33]&&114===a[34]&&111===a[35]&&115===a[36]&&107===a[37]&&97===a[38]?{ext:"mkv",mime:"video/x-matroska"}:26===a[0]&&69===a[1]&&223===a[2]&&163===a[3]?{ext:"webm",mime:"video/webm"}:0===a[0]&&0===a[1]&&0===a[2]&&20===a[3]&&102===a[4]&&116===a[5]&&121===a[6]&&112===a[7]?{ext:"mov",mime:"video/quicktime"}:82===a[0]&&73===a[1]&&70===a[2]&&70===a[3]&&65===a[8]&&86===a[9]&&73===a[10]?{ext:"avi",mime:"video/x-msvideo"}:48===a[0]&&38===a[1]&&178===a[2]&&117===a[3]&&142===a[4]&&102===a[5]&&207===a[6]&&17===a[7]&&166===a[8]&&217===a[9]?{ext:"wmv",mime:"video/x-ms-wmv"}:0===a[0]&&0===a[1]&&1===a[2]&&"b"===a[3].toString(16)[0]?{ext:"mpg",mime:"video/mpeg"}:73===a[0]&&68===a[1]&&51===a[2]||255===a[0]&&251===a[1]?{ext:"mp3",mime:"audio/mpeg"}:102===a[4]&&116===a[5]&&121===a[6]&&112===a[7]&&77===a[8]&&52===a[9]&&65===a[10]||77===a[0]&&52===a[1]&&65===a[2]&&32===a[3]?{ext:"m4a",mime:"audio/m4a"}:79===a[0]&&103===a[1]&&103===a[2]&&83===a[3]?{ext:"ogg",mime:"audio/ogg"}:102===a[0]&&76===a[1]&&97===a[2]&&67===a[3]?{ext:"flac",mime:"audio/x-flac"}:82===a[0]&&73===a[1]&&70===a[2]&&70===a[3]&&87===a[8]&&65===a[9]&&86===a[10]&&69===a[11]?{ext:"wav",mime:"audio/x-wav"}:35===a[0]&&33===a[1]&&65===a[2]&&77===a[3]&&82===a[4]&&10===a[5]?{ext:"amr",mime:"audio/amr"}:37===a[0]&&80===a[1]&&68===a[2]&&70===a[3]?{ext:"pdf",mime:"application/pdf"}:77===a[0]&&90===a[1]?{ext:"exe",mime:"application/x-msdownload"}:67!==a[0]&&70!==a[0]||87!==a[1]||83!==a[2]?123===a[0]&&92===a[1]&&114===a[2]&&116===a[3]&&102===a[4]?{ext:"rtf",mime:"application/rtf"}:119===a[0]&&79===a[1]&&70===a[2]&&70===a[3]&&0===a[4]&&1===a[5]&&0===a[6]&&0===a[7]?{ext:"woff",mime:"application/font-woff"}:119===a[0]&&79===a[1]&&70===a[2]&&50===a[3]&&0===a[4]&&1===a[5]&&0===a[6]&&0===a[7]?{ext:"woff2",mime:"application/font-woff"}:76===a[34]&&80===a[35]&&(2===a[8]&&0===a[9]&&1===a[10]||1===a[8]&&0===a[9]&&0===a[10]||2===a[8]&&0===a[9]&&2===a[10])?{ext:"eot",mime:"application/octet-stream"}:0===a[0]&&1===a[1]&&0===a[2]&&0===a[3]&&0===a[4]?{ext:"ttf",mime:"application/font-sfnt"}:79===a[0]&&84===a[1]&&84===a[2]&&79===a[3]&&0===a[4]?{ext:"otf",mime:"application/font-sfnt"}:0===a[0]&&0===a[1]&&1===a[2]&&0===a[3]?{ext:"ico",mime:"image/x-icon"}:70===a[0]&&76===a[1]&&86===a[2]&&1===a[3]?{ext:"flv",mime:"video/x-flv"}:37===a[0]&&33===a[1]?{ext:"ps",mime:"application/postscript"}:253===a[0]&&55===a[1]&&122===a[2]&&88===a[3]&&90===a[4]&&0===a[5]?{ext:"xz",mime:"application/x-xz"}:83===a[0]&&81===a[1]&&76===a[2]&&105===a[3]?{ext:"sqlite",mime:"application/x-sqlite3"}:31===a[0]&&157===a[1]||31===a[0]&&160===a[1]?{ext:"z, tar.z",mime:"application/x-gtar"}:127===a[0]&&69===a[1]&&76===a[2]&&70===a[3]?{ext:"none, axf, bin, elf, o, prx, puff, so",mime:"application/x-executable",desc:"Executable and Linkable Format file. No standard file extension."}:202===a[0]&&254===a[1]&&186===a[2]&&190===a[3]?{ext:"class",mime:"application/java-vm"}:239===a[0]&&187===a[1]&&191===a[2]?{ext:"txt",mime:"text/plain",desc:"UTF-8 encoded Unicode byte order mark detected, commonly but not exclusively seen in text files."}:255===a[0]&&254===a[1]&&0===a[2]&&0===a[3]?{ext:"",mime:"",desc:"Little-endian UTF-32 encoded Unicode byte order mark detected."}:255===a[0]&&254===a[1]?{ext:"",mime:"",desc:"Little-endian UTF-16 encoded Unicode byte order mark detected."}:67===a[32769]&&68===a[32770]&&48===a[32771]&&48===a[32772]&&49===a[32773]||67===a[34817]&&68===a[34818]&&48===a[34819]&&48===a[34820]&&49===a[34821]||67===a[36865]&&68===a[36866]&&48===a[36867]&&48===a[36868]&&49===a[36869]?{ext:"iso",mime:"application/octet-stream",desc:"ISO 9660 CD/DVD image file"}:208===a[0]&&207===a[1]&&17===a[2]&&224===a[3]&&161===a[4]&&177===a[5]&&26===a[6]&&225===a[7]?{ext:"doc, xls, ppt",mime:"application/msword, application/vnd.ms-excel, application/vnd.ms-powerpoint",desc:"Microsoft Office documents"}:100===a[0]&&101===a[1]&&120===a[2]&&10===a[3]&&48===a[4]&&51===a[5]&&53===a[6]&&0===a[7]?{ext:"dex",mime:"application/octet-stream",desc:"Dalvik Executable (Android)"}:75===a[0]&&68===a[1]&&77===a[2]?{ext:"vmdk",mime:"application/vmdk, application/x-virtualbox-vmdk"}:67===a[0]&&114===a[1]&&50===a[2]&&52===a[3]?{ext:"crx",mime:"application/crx",desc:"Google Chrome extension or packaged app"}:null:{ext:"swf",mime:"application/x-shockwave-flash"}:{ext:"rar",mime:"application/x-rar-compressed"}:{ext:"zip",mime:"application/zip"}:null}},Hash={run_md2:function(a,b){return Utils.to_hex_fast(CryptoApi.hash("md2",a,{}))},run_md4:function(a,b){return Utils.to_hex_fast(CryptoApi.hash("md4",a,{}))},run_md5:function(a,b){return a=CryptoJS.enc.Latin1.parse(a),CryptoJS.MD5(a).toString(CryptoJS.enc.Hex)},run_sha0:function(a,b){return Utils.to_hex_fast(CryptoApi.hash("sha0",a,{}))},run_sha1:function(a,b){return a=CryptoJS.enc.Latin1.parse(a),CryptoJS.SHA1(a).toString(CryptoJS.enc.Hex)},run_sha224:function(a,b){return a=CryptoJS.enc.Latin1.parse(a),CryptoJS.SHA224(a).toString(CryptoJS.enc.Hex)},run_sha256:function(a,b){return a=CryptoJS.enc.Latin1.parse(a),CryptoJS.SHA256(a).toString(CryptoJS.enc.Hex)},run_sha384:function(a,b){return a=CryptoJS.enc.Latin1.parse(a),CryptoJS.SHA384(a).toString(CryptoJS.enc.Hex)},run_sha512:function(a,b){return a=CryptoJS.enc.Latin1.parse(a),CryptoJS.SHA512(a).toString(CryptoJS.enc.Hex)},SHA3_LENGTH:["512","384","256","224"],run_sha3:function(a,b){a=CryptoJS.enc.Latin1.parse(a);var c=b[0],d={outputLength:parseInt(c,10)};return CryptoJS.SHA3(a,d).toString(CryptoJS.enc.Hex)},run_ripemd160:function(a,b){return a=CryptoJS.enc.Latin1.parse(a),CryptoJS.RIPEMD160(a).toString(CryptoJS.enc.Hex)},HMAC_FUNCTIONS:["MD5","SHA1","SHA224","SHA256","SHA384","SHA512","SHA3","RIPEMD-160"],run_hmac:function(a,b){var c=b[1];a=CryptoJS.enc.Latin1.parse(a);var d={MD5:CryptoJS.HmacMD5(a,b[0]),SHA1:CryptoJS.HmacSHA1(a,b[0]),SHA224:CryptoJS.HmacSHA224(a,b[0]),SHA256:CryptoJS.HmacSHA256(a,b[0]),SHA384:CryptoJS.HmacSHA384(a,b[0]),SHA512:CryptoJS.HmacSHA512(a,b[0]),SHA3:CryptoJS.HmacSHA3(a,b[0]),"RIPEMD-160":CryptoJS.HmacRIPEMD160(a,b[0])};return d[c].toString(CryptoJS.enc.Hex)},run_all:function(a,b){var c=Utils.str_to_byte_array(a),d="MD2: "+Hash.run_md2(a,[])+"\nMD4: "+Hash.run_md4(a,[])+"\nMD5: "+Hash.run_md5(a,[])+"\nSHA0: "+Hash.run_sha0(a,[])+"\nSHA1: "+Hash.run_sha1(a,[])+"\nSHA2 224: "+Hash.run_sha224(a,[])+"\nSHA2 256: "+Hash.run_sha256(a,[])+"\nSHA2 384: "+Hash.run_sha384(a,[])+"\nSHA2 512: "+Hash.run_sha512(a,[])+"\nSHA3 224: "+Hash.run_sha3(a,["224"])+"\nSHA3 256: "+Hash.run_sha3(a,["256"])+"\nSHA3 384: "+Hash.run_sha3(a,["384"])+"\nSHA3 512: "+Hash.run_sha3(a,["512"])+"\nRIPEMD-160: "+Hash.run_ripemd160(a,[])+"\n\nChecksums:\nFletcher-16: "+Checksum.run_fletcher16(c,[])+"\nAdler-32: "+Checksum.run_adler32(c,[])+"\nCRC-32: "+Checksum.run_crc32(c,[]);return d},run_analyse:function(a,b){a=a.replace(/\s/g,"");var c="",d=a.length/2,e=8*d,f=[];if(!/^[a-f0-9]+$/i.test(a))return"Invalid hash";switch(c+="Hash length: "+a.length+"\nByte length: "+d+"\nBit length: "+e+"\n\nBased on the length, this hash could have been generated by one of the following hashing functions:\n",e){case 4:f=["Fletcher-4","Luhn algorithm","Verhoeff algorithm"];break;case 8:f=["Fletcher-8"];break;case 16:f=["BSD checksum","CRC-16","SYSV checksum","Fletcher-16"];break;case 32:f=["CRC-32","Fletcher-32","Adler-32"];break;case 64:f=["CRC-64","RIPEMD-64","SipHash"];break;case 128:f=["MD5","MD4","MD2","HAVAL-128","RIPEMD-128","Snefru","Tiger-128"];break;case 160:f=["SHA-1","SHA-0","FSB-160","HAS-160","HAVAL-160","RIPEMD-160","Tiger-160"];break;case 192:f=["Tiger","HAVAL-192"];break;case 224:f=["SHA-224","SHA3-224","ECOH-224","FSB-224","HAVAL-224"];break;case 256:f=["SHA-256","SHA3-256","BLAKE-256","ECOH-256","FSB-256","GOST","Gr\xf8stl-256","HAVAL-256","PANAMA","RIPEMD-256","Snefru"];break;case 320:f=["RIPEMD-320"];break;case 384:f=["SHA-384","SHA3-384","ECOH-384","FSB-384"];break;case 512:f=["SHA-512","SHA3-512","BLAKE-512","ECOH-512","FSB-512","Gr\xf8stl-512","JH","MD6","Spectral Hash","SWIFFT","Whirlpool"];break;case 1024:f=["Fowler-Noll-Vo"];break;default:f=["Unknown"]}return c+f.join("\n")}},Hexdump={WIDTH:16,UPPER_CASE:!1,INCLUDE_FINAL_LENGTH:!1,run_to:function(a,b){for(var c=b[0]||Hexdump.WIDTH,d=b[1],e=b[2],f="",g=2,h=0;ha[0].end&&(h=a[0].end),a.push({start:g,end:h});var k=a.length,l=0;g=0,h=0;for(var m=1;m10+3*c?a[0].start=(e+1)*c:a[0].start=e*c+Math.floor((f-10)/3),e=Math.floor(a[0].end/d),f=a[0].end%d,f<10?a[0].end=e*c:f>10+3*c?a[0].end=(e+1)*c:a[0].end=e*c+Math.ceil((f-10)/3),a}},HTML={CONVERT_ALL:!1,CONVERT_OPTIONS:["Named entities where possible","Numeric entities","Hex entities"],run_to_entity:function(a,b){for(var c=b[0],d="Numeric entities"===b[1],e="Hex entities"===b[1],f=Utils.str_to_charcode(a),g="",h=0;h255||HTML._byte_to_entity.hasOwnProperty(f[h])?"&#"+f[h]+";":Utils.chr(f[h]):e?f[h]>255||HTML._byte_to_entity.hasOwnProperty(f[h])?"&#x"+Utils.hex(f[h])+";":Utils.chr(f[h]):HTML._byte_to_entity[f[h]]||(f[h]>255?"&#"+f[h]+";":Utils.chr(f[h]));return g},run_from_entity:function(a,b){for(var c,d=/&(#?x?[a-zA-Z0-9]{1,8});/g,e="",f=0;c=d.exec(a);){for(;f1&&/^#\d{1,5}$/.test(c[1])){var h=c[1].slice(1,c[1].length);e+=Utils.chr(parseInt(h,10))}else if(!g&&"#"===c[1][0]&&c[1].length>3&&/^#x[\dA-F]{2,8}$/i.test(c[1])){var i=c[1].slice(2,c[1].length);e+=Utils.chr(parseInt(i,16))}else for(;fHex: "+w+"\nRGB: "+x+"\nRGBA: "+y+"\nHSL: "+z+"\nHSLA: "+A+"\nCMYK: "+B+" \ No newline at end of file diff --git a/build/prod/index.html b/build/prod/index.html index bc90daec..b427a012 100755 --- a/build/prod/index.html +++ b/build/prod/index.html @@ -18,4 +18,4 @@ See the License for the specific language governing permissions and limitations under the License. --> -CyberChef Edit
                                                                                                                              Operations
                                                                                                                                Recipe
                                                                                                                                  Input
                                                                                                                                  Output
                                                                                                                                  \ No newline at end of file +CyberChef Edit
                                                                                                                                  Operations
                                                                                                                                    Recipe
                                                                                                                                      Input
                                                                                                                                      Output
                                                                                                                                      \ No newline at end of file diff --git a/build/prod/scripts.js b/build/prod/scripts.js index 76460a20..540441c0 100755 --- a/build/prod/scripts.js +++ b/build/prod/scripts.js @@ -122,7 +122,21 @@ CryptoJS.mode.CTRGladman=function(){function a(a){if(255===(a>>24&255)){var b=a> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -function(a){function b(a,b,c){return a^b^c}function c(a,b,c){return a&b|~a&c}function d(a,b,c){return(a|~b)^c}function e(a,b,c){return a&c|b&~c}function f(a,b,c){return a^(b|~c)}function g(a,b){return a<>>32-b}var h=CryptoJS,i=h.lib,j=i.WordArray,k=i.Hasher,l=h.algo,m=j.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),n=j.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),o=j.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),p=j.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),q=j.create([0,1518500249,1859775393,2400959708,2840853838]),r=j.create([1352829926,1548603684,1836072691,2053994217,0]),s=l.RIPEMD160=k.extend({_doReset:function(){this._hash=j.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(a,h){for(var i=0;i<16;i++){var j=h+i,k=a[j];a[j]=16711935&(k<<8|k>>>24)|4278255360&(k<<24|k>>>8)}var l,s,t,u,v,w,x,y,z,A,B=this._hash.words,C=q.words,D=r.words,E=m.words,F=n.words,G=o.words,H=p.words;w=l=B[0],x=s=B[1],y=t=B[2],z=u=B[3],A=v=B[4];for(var I,i=0;i<80;i+=1)I=l+a[h+E[i]]|0,I+=i<16?b(s,t,u)+C[0]:i<32?c(s,t,u)+C[1]:i<48?d(s,t,u)+C[2]:i<64?e(s,t,u)+C[3]:f(s,t,u)+C[4],I|=0,I=g(I,G[i]),I=I+v|0,l=v,v=u,u=g(t,10),t=s,s=I,I=w+a[h+F[i]]|0,I+=i<16?f(x,y,z)+D[0]:i<32?e(x,y,z)+D[1]:i<48?d(x,y,z)+D[2]:i<64?c(x,y,z)+D[3]:b(x,y,z)+D[4],I|=0,I=g(I,H[i]),I=I+A|0,w=A,A=z,z=g(y,10),y=x,x=I;I=B[1]+t+z|0,B[1]=B[2]+u+A|0,B[2]=B[3]+v+w|0,B[3]=B[4]+l+x|0,B[4]=B[0]+s+y|0,B[0]=I},_doFinalize:function(){var a=this._data,b=a.words,c=8*this._nDataBytes,d=8*a.sigBytes;b[d>>>5]|=128<<24-d%32,b[(d+64>>>9<<4)+14]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8),a.sigBytes=4*(b.length+1),this._process();for(var e=this._hash,f=e.words,g=0;g<5;g++){var h=f[g];f[g]=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8)}return e},clone:function(){var a=k.clone.call(this);return a._hash=this._hash.clone(),a}});h.RIPEMD160=k._createHelper(s),h.HmacRIPEMD160=k._createHmacHelper(s)}(Math),function(){var a=CryptoJS,b=a.lib,c=b.WordArray,d=b.Hasher,e=a.algo,f=[],g=e.SHA1=d.extend({_doReset:function(){this._hash=new c.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(a,b){for(var c=this._hash.words,d=c[0],e=c[1],g=c[2],h=c[3],i=c[4],j=0;j<80;j++){if(j<16)f[j]=0|a[b+j];else{var k=f[j-3]^f[j-8]^f[j-14]^f[j-16];f[j]=k<<1|k>>>31}var l=(d<<5|d>>>27)+i+f[j];l+=j<20?(e&g|~e&h)+1518500249:j<40?(e^g^h)+1859775393:j<60?(e&g|e&h|g&h)-1894007588:(e^g^h)-899497514,i=h,h=g,g=e<<30|e>>>2,e=d,d=l}c[0]=c[0]+d|0,c[1]=c[1]+e|0,c[2]=c[2]+g|0,c[3]=c[3]+h|0,c[4]=c[4]+i|0},_doFinalize:function(){var a=this._data,b=a.words,c=8*this._nDataBytes,d=8*a.sigBytes;return b[d>>>5]|=128<<24-d%32,b[(d+64>>>9<<4)+14]=Math.floor(c/4294967296),b[(d+64>>>9<<4)+15]=c,a.sigBytes=4*b.length,this._process(),this._hash},clone:function(){var a=d.clone.call(this);return a._hash=this._hash.clone(),a}});a.SHA1=d._createHelper(g),a.HmacSHA1=d._createHmacHelper(g)}(),function(a){var b=CryptoJS,c=b.lib,d=c.WordArray,e=c.Hasher,f=b.algo,g=[],h=[];!function(){function b(b){for(var c=a.sqrt(b),d=2;d<=c;d++)if(!(b%d))return!1;return!0}function c(a){return 4294967296*(a-(0|a))|0}for(var d=2,e=0;e<64;)b(d)&&(e<8&&(g[e]=c(a.pow(d,.5))),h[e]=c(a.pow(d,1/3)),e++),d++}();var i=[],j=f.SHA256=e.extend({_doReset:function(){this._hash=new d.init(g.slice(0))},_doProcessBlock:function(a,b){for(var c=this._hash.words,d=c[0],e=c[1],f=c[2],g=c[3],j=c[4],k=c[5],l=c[6],m=c[7],n=0;n<64;n++){if(n<16)i[n]=0|a[b+n];else{var o=i[n-15],p=(o<<25|o>>>7)^(o<<14|o>>>18)^o>>>3,q=i[n-2],r=(q<<15|q>>>17)^(q<<13|q>>>19)^q>>>10;i[n]=p+i[n-7]+r+i[n-16]}var s=j&k^~j&l,t=d&e^d&f^e&f,u=(d<<30|d>>>2)^(d<<19|d>>>13)^(d<<10|d>>>22),v=(j<<26|j>>>6)^(j<<21|j>>>11)^(j<<7|j>>>25),w=m+v+s+h[n]+i[n],x=u+t;m=l,l=k,k=j,j=g+w|0,g=f,f=e,e=d,d=w+x|0}c[0]=c[0]+d|0,c[1]=c[1]+e|0,c[2]=c[2]+f|0,c[3]=c[3]+g|0,c[4]=c[4]+j|0,c[5]=c[5]+k|0,c[6]=c[6]+l|0,c[7]=c[7]+m|0},_doFinalize:function(){var b=this._data,c=b.words,d=8*this._nDataBytes,e=8*b.sigBytes;return c[e>>>5]|=128<<24-e%32,c[(e+64>>>9<<4)+14]=a.floor(d/4294967296),c[(e+64>>>9<<4)+15]=d,b.sigBytes=4*c.length,this._process(),this._hash},clone:function(){var a=e.clone.call(this);return a._hash=this._hash.clone(),a}});b.SHA256=e._createHelper(j),b.HmacSHA256=e._createHmacHelper(j)}(Math),function(){var a=CryptoJS,b=a.lib,c=b.WordArray,d=a.algo,e=d.SHA256,f=d.SHA224=e.extend({_doReset:function(){this._hash=new c.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var a=e._doFinalize.call(this);return a.sigBytes-=4,a}});a.SHA224=e._createHelper(f),a.HmacSHA224=e._createHmacHelper(f)}(),function(){function a(){return f.create.apply(f,arguments)}var b=CryptoJS,c=b.lib,d=c.Hasher,e=b.x64,f=e.Word,g=e.WordArray,h=b.algo,i=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],j=[];!function(){for(var b=0;b<80;b++)j[b]=a()}();var k=h.SHA512=d.extend({_doReset:function(){this._hash=new g.init([new f.init(1779033703,4089235720),new f.init(3144134277,2227873595),new f.init(1013904242,4271175723),new f.init(2773480762,1595750129),new f.init(1359893119,2917565137),new f.init(2600822924,725511199),new f.init(528734635,4215389547),new f.init(1541459225,327033209)])},_doProcessBlock:function(a,b){for(var c=this._hash.words,d=c[0],e=c[1],f=c[2],g=c[3],h=c[4],k=c[5],l=c[6],m=c[7],n=d.high,o=d.low,p=e.high,q=e.low,r=f.high,s=f.low,t=g.high,u=g.low,v=h.high,w=h.low,x=k.high,y=k.low,z=l.high,A=l.low,B=m.high,C=m.low,D=n,E=o,F=p,G=q,H=r,I=s,J=t,K=u,L=v,M=w,N=x,O=y,P=z,Q=A,R=B,S=C,T=0;T<80;T++){var U=j[T];if(T<16)var V=U.high=0|a[b+2*T],W=U.low=0|a[b+2*T+1];else{var X=j[T-15],Y=X.high,Z=X.low,$=(Y>>>1|Z<<31)^(Y>>>8|Z<<24)^Y>>>7,_=(Z>>>1|Y<<31)^(Z>>>8|Y<<24)^(Z>>>7|Y<<25),aa=j[T-2],ba=aa.high,ca=aa.low,da=(ba>>>19|ca<<13)^(ba<<3|ca>>>29)^ba>>>6,ea=(ca>>>19|ba<<13)^(ca<<3|ba>>>29)^(ca>>>6|ba<<26),fa=j[T-7],ga=fa.high,ha=fa.low,ia=j[T-16],ja=ia.high,ka=ia.low,W=_+ha,V=$+ga+(W>>>0<_>>>0?1:0),W=W+ea,V=V+da+(W>>>0>>0?1:0),W=W+ka,V=V+ja+(W>>>0>>0?1:0);U.high=V,U.low=W}var la=L&N^~L&P,ma=M&O^~M&Q,na=D&F^D&H^F&H,oa=E&G^E&I^G&I,pa=(D>>>28|E<<4)^(D<<30|E>>>2)^(D<<25|E>>>7),qa=(E>>>28|D<<4)^(E<<30|D>>>2)^(E<<25|D>>>7),ra=(L>>>14|M<<18)^(L>>>18|M<<14)^(L<<23|M>>>9),sa=(M>>>14|L<<18)^(M>>>18|L<<14)^(M<<23|L>>>9),ta=i[T],ua=ta.high,va=ta.low,wa=S+sa,xa=R+ra+(wa>>>0>>0?1:0),wa=wa+ma,xa=xa+la+(wa>>>0>>0?1:0),wa=wa+va,xa=xa+ua+(wa>>>0>>0?1:0),wa=wa+W,xa=xa+V+(wa>>>0>>0?1:0),ya=qa+oa,za=pa+na+(ya>>>0>>0?1:0);R=P,S=Q,P=N,Q=O,N=L,O=M,M=K+wa|0,L=J+xa+(M>>>0>>0?1:0)|0,J=H,K=I,H=F,I=G,F=D,G=E,E=wa+ya|0,D=xa+za+(E>>>0>>0?1:0)|0}o=d.low=o+E,d.high=n+D+(o>>>0>>0?1:0),q=e.low=q+G,e.high=p+F+(q>>>0>>0?1:0),s=f.low=s+I,f.high=r+H+(s>>>0>>0?1:0),u=g.low=u+K,g.high=t+J+(u>>>0>>0?1:0),w=h.low=w+M,h.high=v+L+(w>>>0>>0?1:0),y=k.low=y+O,k.high=x+N+(y>>>0>>0?1:0),A=l.low=A+Q,l.high=z+P+(A>>>0>>0?1:0),C=m.low=C+S,m.high=B+R+(C>>>0>>0?1:0)},_doFinalize:function(){var a=this._data,b=a.words,c=8*this._nDataBytes,d=8*a.sigBytes;b[d>>>5]|=128<<24-d%32,b[(d+128>>>10<<5)+30]=Math.floor(c/4294967296),b[(d+128>>>10<<5)+31]=c,a.sigBytes=4*b.length,this._process();var e=this._hash.toX32();return e},clone:function(){var a=d.clone.call(this);return a._hash=this._hash.clone(),a},blockSize:32});b.SHA512=d._createHelper(k),b.HmacSHA512=d._createHmacHelper(k)}(),function(){var a=CryptoJS,b=a.x64,c=b.Word,d=b.WordArray,e=a.algo,f=e.SHA512,g=e.SHA384=f.extend({_doReset:function(){this._hash=new d.init([new c.init(3418070365,3238371032),new c.init(1654270250,914150663),new c.init(2438529370,812702999),new c.init(355462360,4144912697),new c.init(1731405415,4290775857),new c.init(2394180231,1750603025),new c.init(3675008525,1694076839),new c.init(1203062813,3204075428)])},_doFinalize:function(){var a=f._doFinalize.call(this);return a.sigBytes-=16,a}});a.SHA384=f._createHelper(g),a.HmacSHA384=f._createHmacHelper(g)}(),function(a){var b=CryptoJS,c=b.lib,d=c.WordArray,e=c.Hasher,f=b.x64,g=f.Word,h=b.algo,i=[],j=[],k=[];!function(){for(var a=1,b=0,c=0;c<24;c++){i[a+5*b]=(c+1)*(c+2)/2%64;var d=b%5,e=(2*a+3*b)%5;a=d,b=e}for(var a=0;a<5;a++)for(var b=0;b<5;b++)j[a+5*b]=b+(2*a+3*b)%5*5;for(var f=1,h=0;h<24;h++){for(var l=0,m=0,n=0;n<7;n++){if(1&f){var o=(1<>>24)|4278255360&(f<<24|f>>>8),g=16711935&(g<<8|g>>>24)|4278255360&(g<<24|g>>>8);var h=c[e];h.high^=g,h.low^=f}for(var m=0;m<24;m++){for(var n=0;n<5;n++){for(var o=0,p=0,q=0;q<5;q++){var h=c[n+5*q];o^=h.high,p^=h.low}var r=l[n];r.high=o,r.low=p}for(var n=0;n<5;n++)for(var s=l[(n+4)%5],t=l[(n+1)%5],u=t.high,v=t.low,o=s.high^(u<<1|v>>>31),p=s.low^(v<<1|u>>>31),q=0;q<5;q++){var h=c[n+5*q];h.high^=o,h.low^=p}for(var w=1;w<25;w++){var h=c[w],x=h.high,y=h.low,z=i[w];if(z<32)var o=x<>>32-z,p=y<>>32-z;else var o=y<>>64-z,p=x<>>64-z;var A=l[j[w]];A.high=o,A.low=p}var B=l[0],C=c[0];B.high=C.high,B.low=C.low;for(var n=0;n<5;n++)for(var q=0;q<5;q++){var w=n+5*q,h=c[w],D=l[w],E=l[(n+1)%5+5*q],F=l[(n+2)%5+5*q];h.high=D.high^~E.high&F.high,h.low=D.low^~E.low&F.low}var h=c[0],G=k[m];h.high^=G.high,h.low^=G.low}},_doFinalize:function(){var b=this._data,c=b.words,e=(8*this._nDataBytes,8*b.sigBytes),f=32*this.blockSize;c[e>>>5]|=1<<24-e%32,c[(a.ceil((e+1)/f)*f>>>5)-1]|=128,b.sigBytes=4*c.length,this._process();for(var g=this._state,h=this.cfg.outputLength/8,i=h/8,j=[],k=0;k>>24)|4278255360&(m<<24|m>>>8),n=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),j.push(n),j.push(m)}return new d.init(j,h)},clone:function(){for(var a=e.clone.call(this),b=a._state=this._state.slice(0),c=0;c<25;c++)b[c]=b[c].clone();return a}});b.SHA3=e._createHelper(m),b.HmacSHA3=e._createHmacHelper(m)}(Math),function(){function a(a,b){var c=(this._lBlock>>>a^this._rBlock)&b;this._rBlock^=c,this._lBlock^=c<>>a^this._lBlock)&b;this._lBlock^=c,this._rBlock^=c<>>5]>>>31-e%32&1}for(var f=this._subKeys=[],g=0;g<16;g++){for(var k=f[g]=[],l=j[g],d=0;d<24;d++)k[d/6|0]|=c[(i[d]-1+l)%28]<<31-d%6,k[4+(d/6|0)]|=c[28+(i[d+24]-1+l)%28]<<31-d%6;k[0]=k[0]<<1|k[0]>>>31;for(var d=1;d<7;d++)k[d]=k[d]>>>4*(d-1)+3;k[7]=k[7]<<5|k[7]>>>27}for(var m=this._invSubKeys=[],d=0;d<16;d++)m[d]=f[15-d]},encryptBlock:function(a,b){this._doCryptBlock(a,b,this._subKeys)},decryptBlock:function(a,b){this._doCryptBlock(a,b,this._invSubKeys)},_doCryptBlock:function(c,d,e){this._lBlock=c[d],this._rBlock=c[d+1],a.call(this,4,252645135),a.call(this,16,65535),b.call(this,2,858993459),b.call(this,8,16711935),a.call(this,1,1431655765);for(var f=0;f<16;f++){for(var g=e[f],h=this._lBlock,i=this._rBlock,j=0,m=0;m<8;m++)j|=k[m][((i^g[m])&l[m])>>>0];this._lBlock=i,this._rBlock=h^j}var n=this._lBlock;this._lBlock=this._rBlock,this._rBlock=n,a.call(this,1,1431655765),b.call(this,8,16711935),b.call(this,2,858993459),a.call(this,16,65535),a.call(this,4,252645135),c[d]=this._lBlock,c[d+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});c.DES=f._createHelper(m);var n=g.TripleDES=f.extend({_doReset:function(){var a=this._key,b=a.words;this._des1=m.createEncryptor(e.create(b.slice(0,2))),this._des2=m.createEncryptor(e.create(b.slice(2,4))),this._des3=m.createEncryptor(e.create(b.slice(4,6)))},encryptBlock:function(a,b){this._des1.encryptBlock(a,b),this._des2.decryptBlock(a,b),this._des3.encryptBlock(a,b)},decryptBlock:function(a,b){this._des3.decryptBlock(a,b),this._des2.encryptBlock(a,b),this._des1.decryptBlock(a,b)},keySize:6,ivSize:2,blockSize:2});c.TripleDES=f._createHelper(n)}(),function(){function a(){for(var a=this._S,b=this._i,c=this._j,d=0,e=0;e<4;e++){b=(b+1)%256,c=(c+a[b])%256;var f=a[b];a[b]=a[c],a[c]=f,d|=a[(a[b]+a[c])%256]<<24-8*e}return this._i=b,this._j=c,d}var b=CryptoJS,c=b.lib,d=c.StreamCipher,e=b.algo,f=e.RC4=d.extend({_doReset:function(){for(var a=this._key,b=a.words,c=a.sigBytes,d=this._S=[],e=0;e<256;e++)d[e]=e;for(var e=0,f=0;e<256;e++){var g=e%c,h=b[g>>>2]>>>24-g%4*8&255;f=(f+d[e]+h)%256;var i=d[e];d[e]=d[f],d[f]=i}this._i=this._j=0},_doProcessBlock:function(b,c){b[c]^=a.call(this)},keySize:8,ivSize:0});b.RC4=d._createHelper(f);var g=e.RC4Drop=f.extend({cfg:f.cfg.extend({drop:192}),_doReset:function(){f._doReset.call(this);for(var b=this.cfg.drop;b>0;b--)a.call(this)}});b.RC4Drop=d._createHelper(g)}(),function(){var a=CryptoJS,b=a.lib,c=b.Base,d=b.WordArray,e=a.algo,f=e.SHA1,g=e.HMAC,h=e.PBKDF2=c.extend({cfg:c.extend({keySize:4,hasher:f,iterations:1}),init:function(a){this.cfg=this.cfg.extend(a)},compute:function(a,b){for(var c=this.cfg,e=g.create(c.hasher,a),f=d.create(),h=d.create([1]),i=f.words,j=h.words,k=c.keySize,l=c.iterations;i.length>>32-b}var h=CryptoJS,i=h.lib,j=i.WordArray,k=i.Hasher,l=h.algo,m=j.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),n=j.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),o=j.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),p=j.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),q=j.create([0,1518500249,1859775393,2400959708,2840853838]),r=j.create([1352829926,1548603684,1836072691,2053994217,0]),s=l.RIPEMD160=k.extend({_doReset:function(){this._hash=j.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(a,h){for(var i=0;i<16;i++){var j=h+i,k=a[j];a[j]=16711935&(k<<8|k>>>24)|4278255360&(k<<24|k>>>8)}var l,s,t,u,v,w,x,y,z,A,B=this._hash.words,C=q.words,D=r.words,E=m.words,F=n.words,G=o.words,H=p.words;w=l=B[0],x=s=B[1],y=t=B[2],z=u=B[3],A=v=B[4];for(var I,i=0;i<80;i+=1)I=l+a[h+E[i]]|0,I+=i<16?b(s,t,u)+C[0]:i<32?c(s,t,u)+C[1]:i<48?d(s,t,u)+C[2]:i<64?e(s,t,u)+C[3]:f(s,t,u)+C[4],I|=0,I=g(I,G[i]),I=I+v|0,l=v,v=u,u=g(t,10),t=s,s=I,I=w+a[h+F[i]]|0,I+=i<16?f(x,y,z)+D[0]:i<32?e(x,y,z)+D[1]:i<48?d(x,y,z)+D[2]:i<64?c(x,y,z)+D[3]:b(x,y,z)+D[4],I|=0,I=g(I,H[i]),I=I+A|0,w=A,A=z,z=g(y,10),y=x,x=I;I=B[1]+t+z|0,B[1]=B[2]+u+A|0,B[2]=B[3]+v+w|0,B[3]=B[4]+l+x|0,B[4]=B[0]+s+y|0,B[0]=I},_doFinalize:function(){var a=this._data,b=a.words,c=8*this._nDataBytes,d=8*a.sigBytes;b[d>>>5]|=128<<24-d%32,b[(d+64>>>9<<4)+14]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8),a.sigBytes=4*(b.length+1),this._process();for(var e=this._hash,f=e.words,g=0;g<5;g++){var h=f[g];f[g]=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8)}return e},clone:function(){var a=k.clone.call(this);return a._hash=this._hash.clone(),a}});h.RIPEMD160=k._createHelper(s),h.HmacRIPEMD160=k._createHmacHelper(s)}(Math),function(){var a=CryptoJS,b=a.lib,c=b.WordArray,d=b.Hasher,e=a.algo,f=[],g=e.SHA1=d.extend({_doReset:function(){this._hash=new c.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(a,b){for(var c=this._hash.words,d=c[0],e=c[1],g=c[2],h=c[3],i=c[4],j=0;j<80;j++){if(j<16)f[j]=0|a[b+j];else{var k=f[j-3]^f[j-8]^f[j-14]^f[j-16];f[j]=k<<1|k>>>31}var l=(d<<5|d>>>27)+i+f[j];l+=j<20?(e&g|~e&h)+1518500249:j<40?(e^g^h)+1859775393:j<60?(e&g|e&h|g&h)-1894007588:(e^g^h)-899497514,i=h,h=g,g=e<<30|e>>>2,e=d,d=l}c[0]=c[0]+d|0,c[1]=c[1]+e|0,c[2]=c[2]+g|0,c[3]=c[3]+h|0,c[4]=c[4]+i|0},_doFinalize:function(){var a=this._data,b=a.words,c=8*this._nDataBytes,d=8*a.sigBytes;return b[d>>>5]|=128<<24-d%32,b[(d+64>>>9<<4)+14]=Math.floor(c/4294967296),b[(d+64>>>9<<4)+15]=c,a.sigBytes=4*b.length,this._process(),this._hash},clone:function(){var a=d.clone.call(this);return a._hash=this._hash.clone(),a}});a.SHA1=d._createHelper(g),a.HmacSHA1=d._createHmacHelper(g)}(),function(a){var b=CryptoJS,c=b.lib,d=c.WordArray,e=c.Hasher,f=b.algo,g=[],h=[];!function(){function b(b){for(var c=a.sqrt(b),d=2;d<=c;d++)if(!(b%d))return!1;return!0}function c(a){return 4294967296*(a-(0|a))|0}for(var d=2,e=0;e<64;)b(d)&&(e<8&&(g[e]=c(a.pow(d,.5))),h[e]=c(a.pow(d,1/3)),e++),d++}();var i=[],j=f.SHA256=e.extend({_doReset:function(){this._hash=new d.init(g.slice(0))},_doProcessBlock:function(a,b){for(var c=this._hash.words,d=c[0],e=c[1],f=c[2],g=c[3],j=c[4],k=c[5],l=c[6],m=c[7],n=0;n<64;n++){if(n<16)i[n]=0|a[b+n];else{var o=i[n-15],p=(o<<25|o>>>7)^(o<<14|o>>>18)^o>>>3,q=i[n-2],r=(q<<15|q>>>17)^(q<<13|q>>>19)^q>>>10;i[n]=p+i[n-7]+r+i[n-16]}var s=j&k^~j&l,t=d&e^d&f^e&f,u=(d<<30|d>>>2)^(d<<19|d>>>13)^(d<<10|d>>>22),v=(j<<26|j>>>6)^(j<<21|j>>>11)^(j<<7|j>>>25),w=m+v+s+h[n]+i[n],x=u+t;m=l,l=k,k=j,j=g+w|0,g=f,f=e,e=d,d=w+x|0}c[0]=c[0]+d|0,c[1]=c[1]+e|0,c[2]=c[2]+f|0,c[3]=c[3]+g|0,c[4]=c[4]+j|0,c[5]=c[5]+k|0,c[6]=c[6]+l|0,c[7]=c[7]+m|0},_doFinalize:function(){var b=this._data,c=b.words,d=8*this._nDataBytes,e=8*b.sigBytes;return c[e>>>5]|=128<<24-e%32,c[(e+64>>>9<<4)+14]=a.floor(d/4294967296),c[(e+64>>>9<<4)+15]=d,b.sigBytes=4*c.length,this._process(),this._hash},clone:function(){var a=e.clone.call(this);return a._hash=this._hash.clone(),a}});b.SHA256=e._createHelper(j),b.HmacSHA256=e._createHmacHelper(j)}(Math),function(){var a=CryptoJS,b=a.lib,c=b.WordArray,d=a.algo,e=d.SHA256,f=d.SHA224=e.extend({_doReset:function(){this._hash=new c.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var a=e._doFinalize.call(this);return a.sigBytes-=4,a}});a.SHA224=e._createHelper(f),a.HmacSHA224=e._createHmacHelper(f)}(),function(){function a(){return f.create.apply(f,arguments)}var b=CryptoJS,c=b.lib,d=c.Hasher,e=b.x64,f=e.Word,g=e.WordArray,h=b.algo,i=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],j=[];!function(){for(var b=0;b<80;b++)j[b]=a()}();var k=h.SHA512=d.extend({_doReset:function(){this._hash=new g.init([new f.init(1779033703,4089235720),new f.init(3144134277,2227873595),new f.init(1013904242,4271175723),new f.init(2773480762,1595750129),new f.init(1359893119,2917565137),new f.init(2600822924,725511199),new f.init(528734635,4215389547),new f.init(1541459225,327033209)])},_doProcessBlock:function(a,b){for(var c=this._hash.words,d=c[0],e=c[1],f=c[2],g=c[3],h=c[4],k=c[5],l=c[6],m=c[7],n=d.high,o=d.low,p=e.high,q=e.low,r=f.high,s=f.low,t=g.high,u=g.low,v=h.high,w=h.low,x=k.high,y=k.low,z=l.high,A=l.low,B=m.high,C=m.low,D=n,E=o,F=p,G=q,H=r,I=s,J=t,K=u,L=v,M=w,N=x,O=y,P=z,Q=A,R=B,S=C,T=0;T<80;T++){var U=j[T];if(T<16)var V=U.high=0|a[b+2*T],W=U.low=0|a[b+2*T+1];else{var X=j[T-15],Y=X.high,Z=X.low,$=(Y>>>1|Z<<31)^(Y>>>8|Z<<24)^Y>>>7,_=(Z>>>1|Y<<31)^(Z>>>8|Y<<24)^(Z>>>7|Y<<25),aa=j[T-2],ba=aa.high,ca=aa.low,da=(ba>>>19|ca<<13)^(ba<<3|ca>>>29)^ba>>>6,ea=(ca>>>19|ba<<13)^(ca<<3|ba>>>29)^(ca>>>6|ba<<26),fa=j[T-7],ga=fa.high,ha=fa.low,ia=j[T-16],ja=ia.high,ka=ia.low,W=_+ha,V=$+ga+(W>>>0<_>>>0?1:0),W=W+ea,V=V+da+(W>>>0>>0?1:0),W=W+ka,V=V+ja+(W>>>0>>0?1:0);U.high=V,U.low=W}var la=L&N^~L&P,ma=M&O^~M&Q,na=D&F^D&H^F&H,oa=E&G^E&I^G&I,pa=(D>>>28|E<<4)^(D<<30|E>>>2)^(D<<25|E>>>7),qa=(E>>>28|D<<4)^(E<<30|D>>>2)^(E<<25|D>>>7),ra=(L>>>14|M<<18)^(L>>>18|M<<14)^(L<<23|M>>>9),sa=(M>>>14|L<<18)^(M>>>18|L<<14)^(M<<23|L>>>9),ta=i[T],ua=ta.high,va=ta.low,wa=S+sa,xa=R+ra+(wa>>>0>>0?1:0),wa=wa+ma,xa=xa+la+(wa>>>0>>0?1:0),wa=wa+va,xa=xa+ua+(wa>>>0>>0?1:0),wa=wa+W,xa=xa+V+(wa>>>0>>0?1:0),ya=qa+oa,za=pa+na+(ya>>>0>>0?1:0);R=P,S=Q,P=N,Q=O,N=L,O=M,M=K+wa|0,L=J+xa+(M>>>0>>0?1:0)|0,J=H,K=I,H=F,I=G,F=D,G=E,E=wa+ya|0,D=xa+za+(E>>>0>>0?1:0)|0}o=d.low=o+E,d.high=n+D+(o>>>0>>0?1:0),q=e.low=q+G,e.high=p+F+(q>>>0>>0?1:0),s=f.low=s+I,f.high=r+H+(s>>>0>>0?1:0),u=g.low=u+K,g.high=t+J+(u>>>0>>0?1:0),w=h.low=w+M,h.high=v+L+(w>>>0>>0?1:0),y=k.low=y+O,k.high=x+N+(y>>>0>>0?1:0),A=l.low=A+Q,l.high=z+P+(A>>>0>>0?1:0),C=m.low=C+S,m.high=B+R+(C>>>0>>0?1:0)},_doFinalize:function(){var a=this._data,b=a.words,c=8*this._nDataBytes,d=8*a.sigBytes;b[d>>>5]|=128<<24-d%32,b[(d+128>>>10<<5)+30]=Math.floor(c/4294967296),b[(d+128>>>10<<5)+31]=c,a.sigBytes=4*b.length,this._process();var e=this._hash.toX32();return e},clone:function(){var a=d.clone.call(this);return a._hash=this._hash.clone(),a},blockSize:32});b.SHA512=d._createHelper(k),b.HmacSHA512=d._createHmacHelper(k)}(),function(){var a=CryptoJS,b=a.x64,c=b.Word,d=b.WordArray,e=a.algo,f=e.SHA512,g=e.SHA384=f.extend({_doReset:function(){this._hash=new d.init([new c.init(3418070365,3238371032),new c.init(1654270250,914150663),new c.init(2438529370,812702999),new c.init(355462360,4144912697),new c.init(1731405415,4290775857),new c.init(2394180231,1750603025),new c.init(3675008525,1694076839),new c.init(1203062813,3204075428)])},_doFinalize:function(){var a=f._doFinalize.call(this);return a.sigBytes-=16,a}});a.SHA384=f._createHelper(g),a.HmacSHA384=f._createHmacHelper(g)}(),function(a){var b=CryptoJS,c=b.lib,d=c.WordArray,e=c.Hasher,f=b.x64,g=f.Word,h=b.algo,i=[],j=[],k=[];!function(){for(var a=1,b=0,c=0;c<24;c++){i[a+5*b]=(c+1)*(c+2)/2%64;var d=b%5,e=(2*a+3*b)%5;a=d,b=e}for(var a=0;a<5;a++)for(var b=0;b<5;b++)j[a+5*b]=b+(2*a+3*b)%5*5;for(var f=1,h=0;h<24;h++){for(var l=0,m=0,n=0;n<7;n++){if(1&f){var o=(1<>>24)|4278255360&(f<<24|f>>>8),g=16711935&(g<<8|g>>>24)|4278255360&(g<<24|g>>>8);var h=c[e];h.high^=g,h.low^=f}for(var m=0;m<24;m++){for(var n=0;n<5;n++){for(var o=0,p=0,q=0;q<5;q++){var h=c[n+5*q];o^=h.high,p^=h.low}var r=l[n];r.high=o,r.low=p}for(var n=0;n<5;n++)for(var s=l[(n+4)%5],t=l[(n+1)%5],u=t.high,v=t.low,o=s.high^(u<<1|v>>>31),p=s.low^(v<<1|u>>>31),q=0;q<5;q++){var h=c[n+5*q];h.high^=o,h.low^=p}for(var w=1;w<25;w++){var h=c[w],x=h.high,y=h.low,z=i[w];if(z<32)var o=x<>>32-z,p=y<>>32-z;else var o=y<>>64-z,p=x<>>64-z;var A=l[j[w]];A.high=o,A.low=p}var B=l[0],C=c[0];B.high=C.high,B.low=C.low;for(var n=0;n<5;n++)for(var q=0;q<5;q++){var w=n+5*q,h=c[w],D=l[w],E=l[(n+1)%5+5*q],F=l[(n+2)%5+5*q];h.high=D.high^~E.high&F.high,h.low=D.low^~E.low&F.low}var h=c[0],G=k[m];h.high^=G.high,h.low^=G.low}},_doFinalize:function(){var b=this._data,c=b.words,e=(8*this._nDataBytes,8*b.sigBytes),f=32*this.blockSize;c[e>>>5]|=1<<24-e%32,c[(a.ceil((e+1)/f)*f>>>5)-1]|=128,b.sigBytes=4*c.length,this._process();for(var g=this._state,h=this.cfg.outputLength/8,i=h/8,j=[],k=0;k>>24)|4278255360&(m<<24|m>>>8),n=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),j.push(n),j.push(m)}return new d.init(j,h)},clone:function(){for(var a=e.clone.call(this),b=a._state=this._state.slice(0),c=0;c<25;c++)b[c]=b[c].clone();return a}});b.SHA3=e._createHelper(m),b.HmacSHA3=e._createHmacHelper(m)}(Math),function(){function a(a,b){var c=(this._lBlock>>>a^this._rBlock)&b;this._rBlock^=c,this._lBlock^=c<>>a^this._lBlock)&b;this._lBlock^=c,this._rBlock^=c<>>5]>>>31-e%32&1}for(var f=this._subKeys=[],g=0;g<16;g++){for(var k=f[g]=[],l=j[g],d=0;d<24;d++)k[d/6|0]|=c[(i[d]-1+l)%28]<<31-d%6,k[4+(d/6|0)]|=c[28+(i[d+24]-1+l)%28]<<31-d%6;k[0]=k[0]<<1|k[0]>>>31;for(var d=1;d<7;d++)k[d]=k[d]>>>4*(d-1)+3;k[7]=k[7]<<5|k[7]>>>27}for(var m=this._invSubKeys=[],d=0;d<16;d++)m[d]=f[15-d]},encryptBlock:function(a,b){this._doCryptBlock(a,b,this._subKeys)},decryptBlock:function(a,b){this._doCryptBlock(a,b,this._invSubKeys)},_doCryptBlock:function(c,d,e){this._lBlock=c[d],this._rBlock=c[d+1],a.call(this,4,252645135),a.call(this,16,65535),b.call(this,2,858993459),b.call(this,8,16711935),a.call(this,1,1431655765);for(var f=0;f<16;f++){for(var g=e[f],h=this._lBlock,i=this._rBlock,j=0,m=0;m<8;m++)j|=k[m][((i^g[m])&l[m])>>>0];this._lBlock=i,this._rBlock=h^j}var n=this._lBlock;this._lBlock=this._rBlock,this._rBlock=n,a.call(this,1,1431655765),b.call(this,8,16711935),b.call(this,2,858993459),a.call(this,16,65535),a.call(this,4,252645135),c[d]=this._lBlock,c[d+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});c.DES=f._createHelper(m);var n=g.TripleDES=f.extend({_doReset:function(){var a=this._key,b=a.words;this._des1=m.createEncryptor(e.create(b.slice(0,2))),this._des2=m.createEncryptor(e.create(b.slice(2,4))),this._des3=m.createEncryptor(e.create(b.slice(4,6)))},encryptBlock:function(a,b){this._des1.encryptBlock(a,b),this._des2.decryptBlock(a,b),this._des3.encryptBlock(a,b)},decryptBlock:function(a,b){this._des3.decryptBlock(a,b),this._des2.encryptBlock(a,b),this._des1.decryptBlock(a,b)},keySize:6,ivSize:2,blockSize:2});c.TripleDES=f._createHelper(n)}(),function(){function a(){for(var a=this._S,b=this._i,c=this._j,d=0,e=0;e<4;e++){b=(b+1)%256,c=(c+a[b])%256;var f=a[b];a[b]=a[c],a[c]=f,d|=a[(a[b]+a[c])%256]<<24-8*e}return this._i=b,this._j=c,d}var b=CryptoJS,c=b.lib,d=c.StreamCipher,e=b.algo,f=e.RC4=d.extend({_doReset:function(){for(var a=this._key,b=a.words,c=a.sigBytes,d=this._S=[],e=0;e<256;e++)d[e]=e;for(var e=0,f=0;e<256;e++){var g=e%c,h=b[g>>>2]>>>24-g%4*8&255;f=(f+d[e]+h)%256;var i=d[e];d[e]=d[f],d[f]=i}this._i=this._j=0},_doProcessBlock:function(b,c){b[c]^=a.call(this)},keySize:8,ivSize:0});b.RC4=d._createHelper(f);var g=e.RC4Drop=f.extend({cfg:f.cfg.extend({drop:192}),_doReset:function(){f._doReset.call(this);for(var b=this.cfg.drop;b>0;b--)a.call(this)}});b.RC4Drop=d._createHelper(g)}(),function(){var a=CryptoJS,b=a.lib,c=b.Base,d=b.WordArray,e=a.algo,f=e.SHA1,g=e.HMAC,h=e.PBKDF2=c.extend({cfg:c.extend({keySize:4,hasher:f,iterations:1}),init:function(a){this.cfg=this.cfg.extend(a)},compute:function(a,b){for(var c=this.cfg,e=g.create(c.hasher,a),f=d.create(),h=d.create([1]),i=f.words,j=h.words,k=c.keySize,l=c.iterations;i.length>6,128|63&e),b+=2):e<55296||e>=57344?(this.state.message.push(224|e>>12,128|e>>6&63,128|63&e),b+=3):(c++,e=65536+((1023&e)<<10|1023&a.charCodeAt(c)),this.state.message.push(240|e>>18,128|e>>12&63,128|e>>6&63,128|63&e),b+=4)}this.state.length+=b,this.process()},d.prototype.updateFromArray=function(a){return this.state.length+=a.length,this.state.message=this.state.message.concat(a),this.process(),this},d.prototype.process=function(){for(;this.state.message.length>=this.blockSize*this.unitSize;){var a=0,b=0,c=this.state.message.splice(0,this.blockSize*this.unitSize);if(this.unitSize>1){this.blockUnits=[];for(var d=0,e=0;d=0;a--,b+=8)this.blockUnits[e]|=c[d+a]<=this.blockSize*this.unitSize;){var a=this.state.message.splice(0,this.blockSize*this.unitSize);this.blockUnits=[];for(var b=0;b=this.blockSize*this.unitSize;){var a=this.state.message.splice(0,this.blockSize*this.unitSize);this.blockUnits=[];for(var b=0,c=0;b=this.blockSize*this.unitSize;){var a=this.state.message.splice(0,this.blockSize*this.unitSize);this.blockUnits=[];for(var b=0,c=0;b>>32-b|0},o.prototype.rotateRight=function(a,b){return a>>>b|a<<32-b|0};var p=function(a,b){Array.prototype.push.apply(this,a),this.Encodes=b};return p.prototype=Object.create(Array.prototype),p.prototype.constructor=p,p.prototype.stringify=function(a){return this.Encodes.get(a,this).stringify()},b.prototype.hash=function a(b,c,d){var a=this.hasher(b,d);return a.update(c),a.finalize()},b.prototype.hasher=function(a,b){return this.Hashers.get(a,b)},b.prototype.mac=function(a,b,c,d){return this.Macs.get(a,b,c,d)},b.prototype.hashArray=function(a){return new p(a,this.Encodes)},a.CryptoApi=new b,"undefined"!=typeof module&&module.exports?void(module.exports=a.CryptoApi):a.CryptoApi}(this),function(a){var b=function(a,b){this.constructor(a,b)};return b.prototype=Object.create(a.Hasher8.prototype),b.prototype.constructor=function(b,c){a.Hasher8.prototype.constructor.call(this,b,c),this.state.hash=new Array(48),this.state.checksum=new Array(16)},b.prototype.piSubst=[41,46,67,201,162,216,124,1,61,54,84,161,236,240,6,19,98,167,5,243,192,199,115,140,152,147,43,217,188,76,130,202,30,155,87,60,253,212,224,22,103,66,111,24,138,23,229,18,190,78,196,214,218,158,222,73,160,251,245,142,187,47,238,122,169,104,121,145,21,178,7,63,148,194,16,137,11,34,95,33,128,127,93,154,90,144,50,39,53,62,204,231,191,247,151,3,255,25,48,179,72,165,181,209,215,94,146,42,172,86,170,198,79,184,56,210,150,164,125,182,118,252,107,226,156,116,4,241,69,157,112,89,100,113,135,32,134,91,207,101,230,45,168,2,27,96,37,173,174,176,185,246,28,70,97,105,52,64,126,15,85,71,163,35,221,81,175,58,195,92,249,206,186,197,234,38,44,83,13,110,133,40,132,9,211,223,205,244,65,129,77,82,106,220,55,200,108,193,171,250,36,225,123,8,12,189,177,74,120,136,149,139,227,99,232,109,233,203,213,254,59,0,29,57,242,239,183,14,102,88,208,228,166,119,114,248,235,117,75,10,49,68,80,180,143,237,31,26,219,153,141,51,159,17,131,20],b.prototype.processBlock=function(a){for(var b=0;b<16;b++)this.state.hash[16+b]=a[b],this.state.hash[32+b]=this.state.hash[16+b]^this.state.hash[b];var c=0;for(b=0;b<18;b++){for(var d=0;d<48;d++)c=this.state.hash[d]^=this.piSubst[c];c=c+b&255}for(c=this.state.checksum[15],b=0;b<16;b++)c=this.state.checksum[b]^=this.piSubst[a[b]^c]},b.prototype.finalize=function(){var b=15&this.state.message.length;return this.update(new Array(17-b).join(String.fromCharCode(16-b))),this.updateFromArray(this.state.checksum),a.hashArray(this.state.hash.slice(0,16))},a.Hashers.add("md2",b),b}(this.CryptoApi||require("./crypto-api")),function(a){var b=function(a,b){this.constructor(a,b)};return b.prototype=Object.create(a.Hasher32le.prototype),b.prototype.constructor=function(b,c){a.Hasher32le.prototype.constructor.call(this,b,c),this.state.hash=[1732584193,4023233417,2562383102,271733878]},b.prototype.S=[[3,7,11,19],[3,5,9,13],[3,9,11,15]],b.prototype.F=0,b.prototype.G=1518500249,b.prototype.H=1859775393,b.prototype.FF=function(a,b,c){return a&b|~a&c},b.prototype.GG=function(a,b,c){return a&b|a&c|b&c},b.prototype.HH=function(a,b,c){return a^b^c},b.prototype.CC=function(b,c,d,e,f,g,h,i){return 0|a.Tools.rotateLeft(d+b(e,f,g)+h+c,i)},b.prototype.processBlock=function(a){var b=0|this.state.hash[0],c=0|this.state.hash[1],d=0|this.state.hash[2],e=0|this.state.hash[3];b=this.CC(this.FF,this.F,b,c,d,e,a[0],this.S[0][0]),e=this.CC(this.FF,this.F,e,b,c,d,a[1],this.S[0][1]),d=this.CC(this.FF,this.F,d,e,b,c,a[2],this.S[0][2]),c=this.CC(this.FF,this.F,c,d,e,b,a[3],this.S[0][3]),b=this.CC(this.FF,this.F,b,c,d,e,a[4],this.S[0][0]),e=this.CC(this.FF,this.F,e,b,c,d,a[5],this.S[0][1]),d=this.CC(this.FF,this.F,d,e,b,c,a[6],this.S[0][2]),c=this.CC(this.FF,this.F,c,d,e,b,a[7],this.S[0][3]),b=this.CC(this.FF,this.F,b,c,d,e,a[8],this.S[0][0]),e=this.CC(this.FF,this.F,e,b,c,d,a[9],this.S[0][1]),d=this.CC(this.FF,this.F,d,e,b,c,a[10],this.S[0][2]),c=this.CC(this.FF,this.F,c,d,e,b,a[11],this.S[0][3]),b=this.CC(this.FF,this.F,b,c,d,e,a[12],this.S[0][0]),e=this.CC(this.FF,this.F,e,b,c,d,a[13],this.S[0][1]),d=this.CC(this.FF,this.F,d,e,b,c,a[14],this.S[0][2]),c=this.CC(this.FF,this.F,c,d,e,b,a[15],this.S[0][3]),b=this.CC(this.GG,this.G,b,c,d,e,a[0],this.S[1][0]),e=this.CC(this.GG,this.G,e,b,c,d,a[4],this.S[1][1]),d=this.CC(this.GG,this.G,d,e,b,c,a[8],this.S[1][2]),c=this.CC(this.GG,this.G,c,d,e,b,a[12],this.S[1][3]),b=this.CC(this.GG,this.G,b,c,d,e,a[1],this.S[1][0]),e=this.CC(this.GG,this.G,e,b,c,d,a[5],this.S[1][1]),d=this.CC(this.GG,this.G,d,e,b,c,a[9],this.S[1][2]),c=this.CC(this.GG,this.G,c,d,e,b,a[13],this.S[1][3]),b=this.CC(this.GG,this.G,b,c,d,e,a[2],this.S[1][0]),e=this.CC(this.GG,this.G,e,b,c,d,a[6],this.S[1][1]),d=this.CC(this.GG,this.G,d,e,b,c,a[10],this.S[1][2]),c=this.CC(this.GG,this.G,c,d,e,b,a[14],this.S[1][3]),b=this.CC(this.GG,this.G,b,c,d,e,a[3],this.S[1][0]),e=this.CC(this.GG,this.G,e,b,c,d,a[7],this.S[1][1]),d=this.CC(this.GG,this.G,d,e,b,c,a[11],this.S[1][2]),c=this.CC(this.GG,this.G,c,d,e,b,a[15],this.S[1][3]),b=this.CC(this.HH,this.H,b,c,d,e,a[0],this.S[2][0]),e=this.CC(this.HH,this.H,e,b,c,d,a[8],this.S[2][1]),d=this.CC(this.HH,this.H,d,e,b,c,a[4],this.S[2][2]),c=this.CC(this.HH,this.H,c,d,e,b,a[12],this.S[2][3]),b=this.CC(this.HH,this.H,b,c,d,e,a[2],this.S[2][0]),e=this.CC(this.HH,this.H,e,b,c,d,a[10],this.S[2][1]),d=this.CC(this.HH,this.H,d,e,b,c,a[6],this.S[2][2]),c=this.CC(this.HH,this.H,c,d,e,b,a[14],this.S[2][3]),b=this.CC(this.HH,this.H,b,c,d,e,a[1],this.S[2][0]),e=this.CC(this.HH,this.H,e,b,c,d,a[9],this.S[2][1]),d=this.CC(this.HH,this.H,d,e,b,c,a[5],this.S[2][2]),c=this.CC(this.HH,this.H,c,d,e,b,a[13],this.S[2][3]),b=this.CC(this.HH,this.H,b,c,d,e,a[3],this.S[2][0]),e=this.CC(this.HH,this.H,e,b,c,d,a[11],this.S[2][1]),d=this.CC(this.HH,this.H,d,e,b,c,a[7],this.S[2][2]),c=this.CC(this.HH,this.H,c,d,e,b,a[15],this.S[2][3]),this.state.hash=[this.state.hash[0]+b|0,this.state.hash[1]+c|0,this.state.hash[2]+d|0,this.state.hash[3]+e|0]},b.prototype.finalize=function(){var b=this.state.message.length<56?56-this.state.message.length:120-this.state.message.length,c=new Array(b);c[0]=128;for(var d=8*this.state.length,e=0;e<4;e++)c.push(d>>8*e&255);for(e=0;e<4;e++)c.push(0);this.updateFromArray(c);var f=[];for(e=0;e>8*g&255);return a.hashArray(f)},a.Hashers.add("md4",b),b}(this.CryptoApi||require("./crypto-api")),function(a){var b=[1518500249,1859775393,2400959708,3395469782],c=function(a,b){this.constructor(a,b)};return c.prototype=Object.create(a.Hasher32be.prototype),c.prototype.constructor=function(b,c){a.Hasher32be.prototype.constructor.call(this,b,c),this.state.hash=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=[]},c.prototype.processBlock=function(c){for(var d=0|this.state.hash[0],e=0|this.state.hash[1],f=0|this.state.hash[2],g=0|this.state.hash[3],h=0|this.state.hash[4],i=0;i<80;i++){i<16?this.W[i]=0|c[i]:this.W[i]=this.W[i-3]^this.W[i-8]^this.W[i-14]^this.W[i-16]|0;var j=a.Tools.rotateLeft(d,5)+h+this.W[i]+b[i/20>>0]|0;j=i<20?j+(e&f|~e&g)|0:i<40?j+(e^f^g)|0:i<60?j+(e&f|e&g|f&g)|0:j+(e^f^g)|0,h=g,g=f,f=0|a.Tools.rotateLeft(e,30),e=d,d=j}this.state.hash[0]=this.state.hash[0]+d|0,this.state.hash[1]=this.state.hash[1]+e|0,this.state.hash[2]=this.state.hash[2]+f|0,this.state.hash[3]=this.state.hash[3]+g|0,this.state.hash[4]=this.state.hash[4]+h|0},c.prototype.finalize=function(){var b=this.state.message.length<56?56-this.state.message.length:120-this.state.message.length;b+=4;var c=new Array(b);c[0]=128;for(var d=8*this.state.length,e=3;e>=0;e--)c.push(d>>8*e&255);this.updateFromArray(c);for(var f=[],g=0,h=this.state.hash.length;g=0;i--)f.push(this.state.hash[g]>>8*i&255);return a.hashArray(f)},a.Hashers.add("sha0",c),c}(this.CryptoApi||require("./crypto-api"));/** @license ======================================================================== Copyright (c) 2005 Tom Wu All Rights Reserved. @@ -267,11 +281,11 @@ if(e)return $c[e].call(d,b,c);throw new a("XPTY0004")},ad.lt=function(b,c,d){var Ob.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value>=1&&c.value<=255)return new Ob(c.value);throw new a("FORG0001")},g("unsignedByte",Ob),Pb.prototype=new ub,Pb.prototype.builtInKind=j.NORMALIZEDSTRING_DT,Pb.cast=function(a){return new Pb(Ac(a))},g("normalizedString",Pb),Qb.prototype=new Pb,Qb.prototype.builtInKind=j.TOKEN_DT,Qb.cast=function(a){return new Qb(Ac(a))},g("token",Qb),Rb.prototype=new Qb,Rb.prototype.builtInKind=j.NAME_DT,Rb.cast=function(a){return new Rb(Ac(a))},g("Name",Rb),Sb.prototype=new Rb,Sb.prototype.builtInKind=j.NCNAME_DT,Sb.cast=function(a){return new Sb(Ac(a))},g("NCName",Sb),Tb.prototype=new Sb,Tb.prototype.builtInKind=j.ENTITY_DT,Tb.cast=function(a){return new Tb(Ac(a))},g("ENTITY",Tb),Ub.prototype=new Sb,Ub.prototype.builtInKind=j.ID_DT,Ub.cast=function(a){return new Ub(Ac(a))},g("ID",Ub),Vb.prototype=new Sb,Vb.prototype.builtInKind=j.IDREF_DT,Vb.cast=function(a){return new Vb(Ac(a))},g("IDREF",Vb),Wb.prototype=new Qb,Wb.prototype.builtInKind=j.LANGUAGE_DT,Wb.cast=function(a){return new Wb(Ac(a))},g("language",Wb),Xb.prototype=new Qb,Xb.prototype.builtInKind=j.NMTOKEN_DT,Xb.cast=function(a){return new Xb(Ac(a))},g("NMTOKEN",Xb),Zb.prototype=new Yb,$b.prototype=new Zb,_b.prototype=new Zb,ac.prototype=new Zb,bc.prototype=new Zb,cc.prototype=new Zb,dc.prototype=new Zb,$c["hexBinary-equal"]=function(a,b){return new Xa(a.valueOf()==b.valueOf())},$c["base64Binary-equal"]=function(a,b){return new Xa(a.valueOf()==b.valueOf())},$c["boolean-equal"]=function(a,b){return new Xa(a.valueOf()==b.valueOf())},$c["boolean-less-than"]=function(a,b){return new Xa(a.valueOf()b.valueOf())},$c["yearMonthDuration-less-than"]=function(a,b){return new Xa(lc(a)lc(b))},$c["dayTimeDuration-less-than"]=function(a,b){return new Xa(jc(a)jc(b))},$c["duration-equal"]=function(a,b){return new Xa(a.negative==b.negative&&lc(a)==lc(b)&&jc(a)==jc(b))},$c["dateTime-equal"]=function(a,b){return gc(a,b,"eq")},$c["dateTime-less-than"]=function(a,b){return gc(a,b,"lt")},$c["dateTime-greater-than"]=function(a,b){return gc(a,b,"gt")},$c["date-equal"]=function(a,b){return fc(a,b,"eq")},$c["date-less-than"]=function(a,b){return fc(a,b,"lt")},$c["date-greater-than"]=function(a,b){return fc(a,b,"gt")},$c["time-equal"]=function(a,b){return ec(a,b,"eq")},$c["time-less-than"]=function(a,b){return ec(a,b,"lt")},$c["time-greater-than"]=function(a,b){return ec(a,b,"gt")},$c["gYearMonth-equal"]=function(a,b){return gc(new _a(a.year,a.month,Za(a.year,a.month),0,0,0,null==a.timezone?this.timezone:a.timezone),new _a(b.year,b.month,Za(b.year,b.month),0,0,0,null==b.timezone?this.timezone:b.timezone),"eq")},$c["gYear-equal"]=function(a,b){return gc(new _a(a.year,1,1,0,0,0,null==a.timezone?this.timezone:a.timezone),new _a(b.year,1,1,0,0,0,null==b.timezone?this.timezone:b.timezone),"eq")},$c["gMonthDay-equal"]=function(a,b){return gc(new _a(1972,a.month,a.day,0,0,0,null==a.timezone?this.timezone:a.timezone),new _a(1972,b.month,b.day,0,0,0,null==b.timezone?this.timezone:b.timezone),"eq")},$c["gMonth-equal"]=function(a,b){return gc(new _a(1972,a.month,Za(1972,b.month),0,0,0,null==a.timezone?this.timezone:a.timezone),new _a(1972,b.month,Za(1972,b.month),0,0,0,null==b.timezone?this.timezone:b.timezone),"eq")},$c["gDay-equal"]=function(a,b){return gc(new _a(1972,12,a.day,0,0,0,null==a.timezone?this.timezone:a.timezone),new _a(1972,12,b.day,0,0,0,null==b.timezone?this.timezone:b.timezone),"eq")},$c["add-yearMonthDurations"]=function(a,b){return mc(lc(a)+lc(b))},$c["subtract-yearMonthDurations"]=function(a,b){return mc(lc(a)-lc(b))},$c["multiply-yearMonthDuration"]=function(a,b){return mc(lc(a)*b)},$c["divide-yearMonthDuration"]=function(a,b){return mc(lc(a)/b)},$c["divide-yearMonthDuration-by-yearMonthDuration"]=function(a,b){return new fb(lc(a)/lc(b))},$c["add-dayTimeDurations"]=function(a,b){return kc(jc(a)+jc(b))},$c["subtract-dayTimeDurations"]=function(a,b){return kc(jc(a)-jc(b))},$c["multiply-dayTimeDuration"]=function(a,b){return kc(jc(a)*b)},$c["divide-dayTimeDuration"]=function(a,b){return kc(jc(a)/b)},$c["divide-dayTimeDuration-by-dayTimeDuration"]=function(a,b){return new fb(jc(a)/jc(b))},$c["subtract-dateTimes"]=function(a,b){return kc(oc(a)-oc(b))},$c["subtract-dates"]=function(a,b){return kc(oc(a)-oc(b))},$c["subtract-times"]=function(a,b){return kc(nc(a)-nc(b))},$c["add-yearMonthDuration-to-dateTime"]=function(a,b){return hc(a,b,"+")},$c["add-dayTimeDuration-to-dateTime"]=function(a,b){return ic(a,b,"+")},$c["subtract-yearMonthDuration-from-dateTime"]=function(a,b){return hc(a,b,"-")},$c["subtract-dayTimeDuration-from-dateTime"]=function(a,b){return ic(a,b,"-")},$c["add-yearMonthDuration-to-date"]=function(a,b){return hc(a,b,"+")},$c["add-dayTimeDuration-to-date"]=function(a,b){return ic(a,b,"+")},$c["subtract-yearMonthDuration-from-date"]=function(a,b){return hc(a,b,"-")},$c["subtract-dayTimeDuration-from-date"]=function(a,b){return ic(a,b,"-")},$c["add-dayTimeDuration-to-time"]=function(a,b){var c=new vb(a.hours,a.minutes,a.seconds,a.timezone);return c.hours+=b.hours,c.minutes+=b.minutes,c.seconds+=b.seconds,wb(c)},$c["subtract-dayTimeDuration-from-time"]=function(a,b){var c=new vb(a.hours,a.minutes,a.seconds,a.timezone);return c.hours-=b.hours,c.minutes-=b.minutes,c.seconds-=b.seconds,wb(c)},$c["is-same-node"]=function(a,b){return new Xa(this.DOMAdapter.isSameNode(a,b))},$c["node-before"]=function(a,b){return new Xa(!!(4&this.DOMAdapter.compareDocumentPosition(a,b)))},$c["node-after"]=function(a,b){return new Xa(!!(2&this.DOMAdapter.compareDocumentPosition(a,b)))},$c["numeric-add"]=function(a,b){var c=a.valueOf(),d=b.valueOf(),e=Gc.pow(10,pc(c,d));return qc(a,b,(c*e+d*e)/e)},$c["numeric-subtract"]=function(a,b){var c=a.valueOf(),d=b.valueOf(),e=Gc.pow(10,pc(c,d));return qc(a,b,(c*e-d*e)/e)},$c["numeric-multiply"]=function(a,b){var c=a.valueOf(),d=b.valueOf(),e=Gc.pow(10,pc(c,d));return qc(a,b,c*e*(d*e)/(e*e))},$c["numeric-divide"]=function(a,b){var c=a.valueOf(),d=b.valueOf(),e=Gc.pow(10,pc(c,d));return qc(a,b,a*e/(b*e))},$c["numeric-integer-divide"]=function(a,b){var c=a/b;return new Cb(Gc.floor(c)+(c<0))},$c["numeric-mod"]=function(a,b){var c=a.valueOf(),d=b.valueOf(),e=Gc.pow(10,pc(c,d));return qc(a,b,c*e%(d*e)/e)},$c["numeric-unary-plus"]=function(a){return a},$c["numeric-unary-minus"]=function(a){return a.value*=-1,a},$c["numeric-equal"]=function(a,b){return new Xa(a.valueOf()==b.valueOf())},$c["numeric-less-than"]=function(a,b){return new Xa(a.valueOf()b.valueOf())},$c["QName-equal"]=function(a,b){return new Xa(a.localName==b.localName&&a.namespaceURI==b.namespaceURI)},$c.concatenate=function(a,b){return a.concat(b)},$c.union=function(b,c){for(var d,e=[],f=0,g=b.length;fh?g.pop():(g.push(f[i]),h++):"."!=f[i]&&g.push(f[i]);".."!=f[--i]&&"."!=f[i]||g.push(""),d.path=g.join("/")}return d}),f("true",[],function(){return new Xa(!0)}),f("false",[],function(){return new Xa(!1)}),f("not",[[Yb,"*"]],function(a){return new Xa(!uc(a,this))}),f("position",[],function(){return new Cb(this.position)}),f("last",[],function(){return new Cb(this.size)}),f("current-dateTime",[],function(){return this.dateTime}),f("current-date",[],function(){return Ya.cast(this.dateTime)}),f("current-time",[],function(){return vb.cast(this.dateTime)}),f("implicit-timezone",[],function(){return this.timezone}),f("default-collation",[],function(){return new ub(this.staticContext.defaultCollationName)}),f("static-base-uri",[],function(){return Va.cast(new ub(this.staticContext.baseURI||""))}),f("years-from-duration",[[hb,"?"]],function(a){return rc(a,"year")}),f("months-from-duration",[[hb,"?"]],function(a){return rc(a,"month")}),f("days-from-duration",[[hb,"?"]],function(a){return rc(a,"day")}),f("hours-from-duration",[[hb,"?"]],function(a){return rc(a,"hours")}),f("minutes-from-duration",[[hb,"?"]],function(a){return rc(a,"minutes")}),f("seconds-from-duration",[[hb,"?"]],function(a){return rc(a,"seconds")}),f("year-from-dateTime",[[_a,"?"]],function(a){return sc(a,"year")}),f("month-from-dateTime",[[_a,"?"]],function(a){return sc(a,"month")}),f("day-from-dateTime",[[_a,"?"]],function(a){return sc(a,"day")}),f("hours-from-dateTime",[[_a,"?"]],function(a){return sc(a,"hours")}),f("minutes-from-dateTime",[[_a,"?"]],function(a){return sc(a,"minutes")}),f("seconds-from-dateTime",[[_a,"?"]],function(a){return sc(a,"seconds")}),f("timezone-from-dateTime",[[_a,"?"]],function(a){return sc(a,"timezone")}),f("year-from-date",[[Ya,"?"]],function(a){return sc(a,"year")}),f("month-from-date",[[Ya,"?"]],function(a){return sc(a,"month")}),f("day-from-date",[[Ya,"?"]],function(a){return sc(a,"day")}),f("timezone-from-date",[[Ya,"?"]],function(a){return sc(a,"timezone")}),f("hours-from-time",[[vb,"?"]],function(a){return sc(a,"hours")}),f("minutes-from-time",[[vb,"?"]],function(a){return sc(a,"minutes")}),f("seconds-from-time",[[vb,"?"]],function(a){return sc(a,"seconds")}),f("timezone-from-time",[[vb,"?"]],function(a){return sc(a,"timezone")}),f("adjust-dateTime-to-timezone",[[_a,"?"],[Ab,"?",!0]],function(a,b){return tc(a,arguments.length>1&&null!=b?arguments.length>1?b:this.timezone:null)});f("adjust-date-to-timezone",[[Ya,"?"],[Ab,"?",!0]],function(a,b){return tc(a,arguments.length>1&&null!=b?arguments.length>1?b:this.timezone:null)});f("adjust-time-to-timezone",[[vb,"?"],[Ab,"?",!0]],function(a,b){return tc(a,arguments.length>1&&null!=b?arguments.length>1?b:this.timezone:null)}),f("name",[[Zb,"?",!0]],function(b){if(arguments.length){if(null==b)return new ub("")}else{if(!this.DOMAdapter.isNode(this.item))throw new a("XPTY0004");b=this.item}var c=Xc["node-name"].call(this,b);return new ub(null==c?"":c.toString())}),f("local-name",[[Zb,"?",!0]],function(b){if(arguments.length){if(null==b)return new ub("")}else{if(!this.DOMAdapter.isNode(this.item))throw new a("XPTY0004");b=this.item}return new ub(this.DOMAdapter.getProperty(b,"localName")||"")}),f("namespace-uri",[[Zb,"?",!0]],function(b){if(arguments.length){if(null==b)return Va.cast(new ub(""))}else{if(!this.DOMAdapter.isNode(this.item))throw new a("XPTY0004");b=this.item}return Va.cast(new ub(this.DOMAdapter.getProperty(b,"namespaceURI")||""))}),f("number",[[Ta,"?",!0]],function(b){if(!arguments.length){if(!this.item)throw new a("XPDY0002");b=vc([this.item],this)[0]}var c=new gb(Kc);if(null!=b)try{c=gb.cast(b)}catch(a){}return c}),f("lang",[[ub,"?"],[Zb,"",!0]],function(b,c){if(arguments.length<2){if(!this.DOMAdapter.isNode(this.item))throw new a("XPTY0004");c=this.item}var d=this.DOMAdapter.getProperty;2==d(c,"nodeType")&&(c=d(c,"ownerElement"));for(var e;c;c=d(c,"parentNode"))if(e=d(c,"attributes"))for(var f=0,g=e.length;f1?b.valueOf():0;if(c<0){var d=new Cb(Gc.pow(10,-c)),e=Gc.round($c["numeric-divide"].call(this,a,d)),f=new Cb(e);return nDecimal=Gc.abs($c["numeric-subtract"].call(this,f,$c["numeric-divide"].call(this,a,d))),$c["numeric-multiply"].call(this,$c["numeric-add"].call(this,f,new fb(.5==nDecimal&&e%2?-1:0)),d)}var d=new Cb(Gc.pow(10,c)),e=Gc.round($c["numeric-multiply"].call(this,a,d)),f=new Cb(e);return nDecimal=Gc.abs($c["numeric-subtract"].call(this,f,$c["numeric-multiply"].call(this,a,d))),$c["numeric-divide"].call(this,$c["numeric-add"].call(this,f,new fb(.5==nDecimal&&e%2?-1:0)),d)}),f("resolve-QName",[[ub,"?"],[bc]],function(b,c){if(null==b)return null;var d=b.valueOf(),e=d.match(Bd);if(!e)throw new a("FOCA0002");var f=e[1]||null,g=e[2],h=this.DOMAdapter.lookupNamespaceURI(c,f);if(null!=f&&!h)throw new a("FONS0004");return new tb(f,g,h||null)}),f("QName",[[ub,"?"],[ub]],function(b,c){var d=c.valueOf(),e=d.match(Bd);if(!e)throw new a("FOCA0002");return new tb(e[1]||null,e[2]||null,null==b?"":b.valueOf())}),f("prefix-from-QName",[[tb,"?"]],function(a){return null!=a&&a.prefix?new Sb(a.prefix):null}),f("local-name-from-QName",[[tb,"?"]],function(a){return null==a?null:new Sb(a.localName)}),f("namespace-uri-from-QName",[[tb,"?"]],function(a){return null==a?null:Va.cast(new ub(a.namespaceURI||""))}),f("namespace-uri-for-prefix",[[ub,"?"],[bc]],function(a,b){var c=null==a?"":a.valueOf(),d=this.DOMAdapter.lookupNamespaceURI(b,c||null);return null==d?null:Va.cast(new ub(d))}),f("in-scope-prefixes",[[bc]],function(a){throw"Function 'in-scope-prefixes' not implemented"}),f("boolean",[[Yb,"*"]],function(a){return new Xa(uc(a,this))}),f("index-of",[[Ta,"*"],[Ta],[ub,"",!0]],function(a,b,c){if(!a.length||null==b)return[];var d=b;d instanceof xb&&(d=ub.cast(d));for(var e,f=[],g=0,h=a.length;g1)throw"Collation parameter in function 'distinct-values' is not implemented";if(!a.length)return null;for(var c,d=[],e=0,f=a.length;ed&&(e=d+1);for(var f=[],g=0;gc)return a;for(var e=[],f=0;f2?Gc.round(c):a.length-d+1;return a.slice(d-1,d-1+e)}),f("unordered",[[Yb,"*"]],function(a){return a}),f("zero-or-one",[[Yb,"*"]],function(b){if(b.length>1)throw new a("FORG0003");return b}),f("one-or-more",[[Yb,"*"]],function(b){if(!b.length)throw new a("FORG0004");return b}),f("exactly-one",[[Yb,"*"]],function(b){if(1!=b.length)throw new a("FORG0005");return b}),f("deep-equal",[[Yb,"*"],[Yb,"*"],[ub,"",!0]],function(a,b,c){throw"Function 'deep-equal' not implemented"}),f("count",[[Yb,"*"]],function(a){return new Cb(a.length)}),f("avg",[[Ta,"*"]],function(b){if(!b.length)return null;try{var c=b[0];c instanceof xb&&(c=gb.cast(c));for(var d,e=1,f=b.length;e1?c:new gb(0);try{var d=b[0];d instanceof xb&&(d=gb.cast(d));for(var e,f=1,g=b.length;f2&&(f=d.valueOf()),e=f==Sc+"/collation/codepoint"?Gd:this.staticContext.getCollation(f),!e)throw new a("FOCH0002");return new Cb(e.compare(b.valueOf(),c.valueOf()))}),f("codepoint-equal",[[ub,"?"],[ub,"?"]],function(a,b){return null==a||null==b?null:new Xa(a.valueOf()==b.valueOf())}),f("concat",null,function(){if(arguments.length<2)throw new a("XPST0017");for(var b,c=[],d=0,e=arguments.length;d2?e+Gc.round(c):d.length;return new ub(f>e?d.substring(e,f):"")}),f("string-length",[[ub,"?",!0]],function(b){if(!arguments.length){if(!this.item)throw new a("XPDY0002");b=ub.cast(vc([this.item],this)[0])}return new Cb(null==b?0:b.valueOf().length)}),f("normalize-space",[[ub,"?",!0]],function(b){if(!arguments.length){if(!this.item)throw new a("XPDY0002");b=ub.cast(vc([this.item],this)[0])}return new ub(null==b?"":Pc(b).replace(/\s\s+/g," "))}),f("normalize-unicode",[[ub,"?"],[ub,"",!0]],function(a,b){throw"Function 'normalize-unicode' not implemented"}),f("upper-case",[[ub,"?"]],function(a){return new ub(null==a?"":a.valueOf().toUpperCase())}),f("lower-case",[[ub,"?"]],function(a){return new ub(null==a?"":a.valueOf().toLowerCase())}),f("translate",[[ub,"?"],[ub],[ub]],function(a,b,c){if(null==a)return new ub("");for(var d,e=a.valueOf().split(""),f=b.valueOf().split(""),g=c.valueOf().split(""),h=g.length,i=[],j=0,k=e.length;j126)&&(c[d]=window.encodeURIComponent(c[d]));return new ub(c.join(""))}),f("contains",[[ub,"?"],[ub,"?"],[ub,"",!0]],function(a,b,c){if(arguments.length>2)throw"Collation parameter in function 'contains' is not implemented";return new Xa((null==a?"":a.valueOf()).indexOf(null==b?"":b.valueOf())>=0)}),f("starts-with",[[ub,"?"],[ub,"?"],[ub,"",!0]],function(a,b,c){if(arguments.length>2)throw"Collation parameter in function 'starts-with' is not implemented";return new Xa(0==(null==a?"":a.valueOf()).indexOf(null==b?"":b.valueOf()))}),f("ends-with",[[ub,"?"],[ub,"?"],[ub,"",!0]],function(a,b,c){if(arguments.length>2)throw"Collation parameter in function 'ends-with' is not implemented";var d=null==a?"":a.valueOf(),e=null==b?"":b.valueOf();return new Xa(d.indexOf(e)==d.length-e.length)}),f("substring-before",[[ub,"?"],[ub,"?"],[ub,"",!0]],function(a,b,c){if(arguments.length>2)throw"Collation parameter in function 'substring-before' is not implemented";var d,e=null==a?"":a.valueOf(),f=null==b?"":b.valueOf();return new ub((d=e.indexOf(f))>=0?e.substring(0,d):"")}),f("substring-after",[[ub,"?"],[ub,"?"],[ub,"",!0]],function(a,b,c){if(arguments.length>2)throw"Collation parameter in function 'substring-after' is not implemented";var d,e=null==a?"":a.valueOf(),f=null==b?"":b.valueOf();return new ub((d=e.indexOf(f))>=0?e.substring(d+f.length):"")}),f("matches",[[ub,"?"],[ub],[ub,"",!0]],function(a,b,c){var d=null==a?"":a.valueOf(),e=xc(b.valueOf(),arguments.length>2?c.valueOf():"");return new Xa(e.test(d))}),f("replace",[[ub,"?"],[ub],[ub],[ub,"",!0]],function(a,b,c,d){var e=null==a?"":a.valueOf(),f=xc(b.valueOf(),arguments.length>3?d.valueOf():"");return new Xa(e.replace(f,c.valueOf()))}),f("tokenize",[[ub,"?"],[ub],[ub,"",!0]],function(a,b,c){for(var d=null==a?"":a.valueOf(),e=xc(b.valueOf(),arguments.length>2?c.valueOf():""),f=[],g=0,h=d.split(e),i=h.length;gb?1:-1},yc.prototype=new c;var Hd=new e;yc.prototype.getProperty=function(a,b){if(b in a)return a[b];if("baseURI"==b){for(var c,d="",e=Hd.getFunction("{http://www.w3.org/2005/xpath-functions}resolve-uri"),f=Hd.getDataType("{http://www.w3.org/2001/XMLSchema}string"),g=a;g;g=g.parentNode)1==g.nodeType&&(c=g.getAttribute("xml:base"))&&(d=e(new f(c),new f(d)).toString());return d}if("textContent"==b){var h=[];return function(a){for(var b,c=0;b=a.childNodes[c];c++)3==b.nodeType||4==b.nodeType?h.push(b.data):1==b.nodeType&&b.firstChild&&arguments.callee(b)}(a),h.join("")}},yc.prototype.compareDocumentPosition=function(a,b){if("compareDocumentPosition"in a)return a.compareDocumentPosition(b);if(b==a)return 0;var c,d,e,f,g,h=null,i=null;if(2==a.nodeType&&(h=a,a=this.getProperty(h,"ownerElement")),2==b.nodeType&&(i=b,b=this.getProperty(i,"ownerElement")),h&&i&&a&&a==b)for(f=0,c=this.getProperty(a,"attributes"),g=c.length;fMath.round(a.width/50))&&(e=Math.round(a.width/50)),(!f||f>Math.round(a.width/50))&&(f=Math.round(a.height/50));var h=a.getContext("2d"),i=.08*a.width,j=.03*a.width,k=.08*a.height,l=.15*a.height,m=a.height-k-l,n=a.width-i-j,o=k+m,p=k;h.font=g+"px Arial",h.lineWidth="1.0",h.strokeStyle="#444",CanvasComponents.draw_line(h,i,o,n+i,o),CanvasComponents.draw_line(h,i,o,i,p);var q=.003*n,r=(n-q*b.length)/b.length,s=i+q,t=Math.max.apply(Math,b);h.fillStyle="green";for(var u=0;u=b.length)for(var u=0;u<=b.length;u++)h.fillText(u,s,o+.3*l),s+=r+q;else for(var u=0;u<=e;u++){var w=Math.ceil(b.length/e*u);s=n/e*u+i,h.fillText(w,s,o+.3*l)}h.textAlign="right";var x;if(f>=t)for(var u=0;u<=t;u++)x=o-u/t*m+g/3,h.fillText(u,.8*i,x);else for(var u=0;u<=f;u++){var w=Math.ceil(t/f*u);x=o-w/t*m+g/3,h.fillText(w,.8*i,x)}if(c&&(h.textAlign="center",h.fillText(c,n/2+i,o+.8*l)),d){h.save();var y=.3*i,z=m/2+k;h.translate(y,z),h.rotate(-Math.PI/2),h.textAlign="center",h.fillText(d,0,0),h.restore()}},draw_scale_bar:function(a,b,c,d){var e=a.getContext("2d"),f=.01*a.width,g=.01*a.width,h=.1*a.height,i=.3*a.height,j=a.height-h-i,k=a.width-f-g,l=b/c;e.strokeRect(f,h,k,j);var m=e.createLinearGradient(f,0,k+f,0);m.addColorStop(0,"green"),m.addColorStop(.5,"gold"),m.addColorStop(1,"red"),e.fillStyle=m,e.fillRect(f,h,k*l,j);var n,o,p,q;e.fillStyle="black",e.textAlign="center",e.font="13px Arial";for(var r=0;r=.9*c?(e.textAlign="right",n=p):d[r].max<=.1*c?e.textAlign="left":n+=(p-n)/2,o=h+j+.8*i,e.fillText(d[r].label,n,o)}},Utils={chr:function(a){return String.fromCharCode(a)},ord:function(a){return a.charCodeAt(0)},pad_left:function(a,b,c){c=c||"0";var d=c.length-(b-a.length);return d=d<0?0:d,a.lengthb&&(a=a.slice(0,b-c.length)+c),a},hex:function(a,b){return a="string"==typeof a?Utils.ord(a):a,b=b||2,Utils.pad(a.toString(16),b)},bin:function(a,b){return a="string"==typeof a?Utils.ord(a):a,b=b||8,Utils.pad(a.toString(2),b)},printable:function(a,b){window&&window.app&&!window.app.options.treat_as_utf8&&(a=Utils.byte_array_to_chars(Utils.str_to_byte_array(a)));var c=/[\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-\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,d=/[\x09-\x10\x0D\u2028\u2029]/g;return a=a.replace(c,"."),b||(a=a.replace(d,".")),a},parse_escaped_chars:function(a){return a.replace(/(\\)?\\([nrtbf]|x[\da-f]{2})/g,function(a,b,c){if("\\"===b)return"\\"+c;switch(c[0]){case"n":return"\n";case"r":return"\r";case"t":return"\t";case"b":return"\b";case"f":return"\f";case"x":return Utils.chr(parseInt(c.substr(1),16))}})},expand_alph_range:function(a){for(var b=[],c=0;c255)return Utils.str_to_utf8_byte_array(a);return c},str_to_utf8_byte_array:function(a){var b=CryptoJS.enc.Utf8.parse(a),c=Utils.word_array_to_byte_array(b);return a.length!==b.sigBytes&&(window.app.options.attempt_highlight=!1),c},str_to_charcode:function(a){for(var b=new Array(a.length),c=a.length;c--;)b[c]=a.charCodeAt(c);return b},byte_array_to_utf8:function(a){try{for(var b=[],c=0;c>>2]|=a[c]<<24-c%4*8;var d=new CryptoJS.lib.WordArray.init(b,a.length),e=CryptoJS.enc.Utf8.stringify(d);return e.length!==d.sigBytes&&(window.app.options.attempt_highlight=!1),e}catch(b){return Utils.byte_array_to_chars(a)}},byte_array_to_chars:function(a){if(!a)return"";for(var b="",c=0;c>>2]>>>24-d%4*8&255);return c},UNIC_WIN1251_MAP:{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,14:14,15:15,16:16,17:17,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,28:28,29:29,30:30,31:31,32:32,33:33,34:34,35:35,36:36,37:37,38:38,39:39,40:40,41:41,42:42,43:43,44:44,45:45,46:46,47:47,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,58:58,59:59,60:60,61:61,62:62,63:63,64:64,65:65,66:66,67:67,68:68,69:69,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,82:82,83:83,84:84,85:85,86:86,87:87,88:88,89:89,90:90,91:91,92:92,93:93,94:94,95:95,96:96,97:97,98:98,99:99,100:100,101:101,102:102,103:103,104:104,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,125:125,126:126,127:127,1027:129,8225:135,1046:198,8222:132,1047:199,1168:165,1048:200,1113:154,1049:201,1045:197,1050:202,1028:170,160:160,1040:192,1051:203,164:164,166:166,167:167,169:169,171:171,172:172,173:173,174:174,1053:205,176:176,177:177,1114:156,181:181,182:182,183:183,8221:148,187:187,1029:189,1056:208,1057:209,1058:210,8364:136,1112:188,1115:158,1059:211,1060:212,1030:178,1061:213,1062:214,1063:215,1116:157,1064:216,1065:217,1031:175,1066:218,1067:219,1068:220,1069:221,1070:222,1032:163,8226:149,1071:223,1072:224,8482:153,1073:225,8240:137,1118:162,1074:226,1110:179,8230:133,1075:227,1033:138,1076:228,1077:229,8211:150,1078:230,1119:159,1079:231,1042:194,1080:232,1034:140,1025:168,1081:233,1082:234,8212:151,1083:235,1169:180,1084:236,1052:204,1085:237,1035:142,1086:238,1087:239,1088:240,1089:241,1090:242,1036:141,1041:193,1091:243,1092:244,8224:134,1093:245,8470:185,1094:246,1054:206,1095:247,1096:248,8249:139,1097:249,1098:250,1044:196,1099:251,1111:191,1055:207,1100:252,1038:161,8220:147,1101:253,8250:155,1102:254,8216:145,1103:255,1043:195,1105:184,1039:143,1026:128,1106:144,8218:130,1107:131,8217:146,1108:186,1109:190},WIN1251_UNIC_MAP:{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,14:14,15:15,16:16,17:17,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,28:28,29:29,30:30,31:31,32:32,33:33,34:34,35:35,36:36,37:37,38:38,39:39,40:40,41:41,42:42,43:43,44:44,45:45,46:46,47:47,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,58:58,59:59,60:60,61:61,62:62,63:63,64:64,65:65,66:66,67:67,68:68,69:69,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,82:82,83:83,84:84,85:85,86:86,87:87,88:88,89:89,90:90,91:91,92:92,93:93,94:94,95:95,96:96,97:97,98:98,99:99,100:100,101:101,102:102,103:103,104:104,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,125:125,126:126,127:127,160:160,164:164,166:166,167:167,169:169,171:171,172:172,173:173,174:174,176:176,177:177,181:181,182:182,183:183,187:187,168:1025,128:1026,129:1027,170:1028,189:1029,178:1030,175:1031,163:1032,138:1033,140:1034,142:1035,141:1036,161:1038,143:1039,192:1040,193:1041,194:1042,195:1043,196:1044,197:1045,198:1046,199:1047,200:1048,201:1049,202:1050,203:1051,204:1052,205:1053,206:1054,207:1055,208:1056,209:1057,210:1058,211:1059,212:1060,213:1061,214:1062,215:1063,216:1064,217:1065,218:1066,219:1067,220:1068,221:1069,222:1070,223:1071,224:1072,225:1073,226:1074,227:1075,228:1076,229:1077,230:1078,231:1079,232:1080,233:1081,234:1082,235:1083,236:1084,237:1085,238:1086,239:1087,240:1088,241:1089,242:1090,243:1091,244:1092,245:1093,246:1094,247:1095,248:1096,249:1097,250:1098,251:1099,252:1100,253:1101,254:1102,255:1103,184:1105,144:1106,131:1107,186:1108,190:1109,179:1110,191:1111,188:1112,154:1113,156:1114,158:1115,157:1116,162:1118,159:1119,165:1168,180:1169,150:8211,151:8212,145:8216,146:8217,130:8218,147:8220,148:8221,132:8222,134:8224,135:8225,149:8226,133:8230,137:8240,139:8249,155:8250,136:8364,185:8470,153:8482},unicode_to_win1251:function(a){for(var b=[],c=0;c>2,g=(3&c)<<4|d>>4,h=(15&d)<<2|e>>6,i=63&e,isNaN(d)?h=i=64:isNaN(e)&&(i=64),j+=b.charAt(f)+b.charAt(g)+b.charAt(h)+b.charAt(i);return j},from_base64:function(a,b,c,d){if(c=c||"string",!a)return"string"===c?"":[];b=b?Utils.expand_alph_range(b).join(""):"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",void 0===d&&(d=!0);var e,f,g,h,i,j,k,l=[],m=0;if(d){var n=new RegExp("[^"+b.replace(/[\[\]\\\-^$]/g,"\\$&")+"]","g");a=a.replace(n,"")}for(;m>4,f=(15&i)<<4|j>>2,g=(3&j)<<6|k,l.push(e),64!==j&&l.push(f),64!==k&&l.push(g);return"string"===c?Utils.byte_array_to_utf8(l):l},to_hex:function(a,b,c){if(!a)return"";b="string"==typeof b?b:" ",c=c||2;for(var d="",e=0;e>>4).toString(16)),b.push((15&a[c]).toString(16));return b.join("")},from_hex:function(a,b,c){if(b=b||(a.indexOf(" ")>=0?"Space":"None"),c=c||2,"None"!==b){var d=Utils.regex_rep[b];a=a.replace(d,"")}for(var e=[],f=0;f]*>.*<\/(script|style)>/gim,"")),a.replace(/<[^>\n]+>/g,"")},escape_html:function(a){return a.replace(/>>3]|=parseInt(a.substr(d,2),16)<<24-d%8*4;return new CryptoJS.lib.WordArray.init(c,b/2)};var Base={DEFAULT_RADIX:36,run_to:function(a,b){if(!a)throw"Error: Input must be a number";var c=b[0]||Base.DEFAULT_RADIX;if(c<2||c>36)throw"Error: Radix argument must be between 2 and 36";return a.toString(c)},run_from:function(a,b){var c=b[0]||Base.DEFAULT_RADIX;if(c<2||c>36)throw"Error: Radix argument must be between 2 and 36";return parseInt(a.replace(/\s/g,""),c)}},Base64={ALPHABET:"A-Za-z0-9+/=",ALPHABET_OPTIONS:[{name:"Standard: A-Za-z0-9+/=",value:"A-Za-z0-9+/="},{name:"URL safe: 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: 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+/="}],run_to:function(a,b){var c=b[0]||Base64.ALPHABET;return Utils.to_base64(a,c)},REMOVE_NON_ALPH_CHARS:!0,run_from:function(a,b){var c=b[0]||Base64.ALPHABET,d=b[1];return Utils.from_base64(a,c,"byte_array",d)},BASE32_ALPHABET:"A-Z2-7=",run_to_32:function(a,b){if(!a)return"";for(var c,d,e,f,g,h,i,j,k,l,m,n,o,p=b[0]?Utils.expand_alph_range(b[0]).join(""):"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",q="",r=0;r>3,i=(7&c)<<2|d>>6,j=d>>1&31,k=(1&d)<<4|e>>4,l=(15&e)<<1|f>>7,m=f>>2&63,n=(3&f)<<3|g>>5,o=31&g,isNaN(d)?j=k=l=m=n=o=32:isNaN(e)?l=m=n=o=32:isNaN(f)?m=n=o=32:isNaN(g)&&(o=32),q+=p.charAt(h)+p.charAt(i)+p.charAt(j)+p.charAt(k)+p.charAt(l)+p.charAt(m)+p.charAt(n)+p.charAt(o);return q},run_from_32:function(a,b){if(!a)return[];var c,d,e,f,g,h,i,j,k,l,m,n,o,p=b[0]?Utils.expand_alph_range(b[0]).join(""):"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",q=b[0],r=[],s=0;if(q){var t=new RegExp("[^"+p.replace(/[\]\\\-^]/g,"\\$&")+"]","g");a=a.replace(t,"")}for(;s>2,d=(3&i)<<6|j<<1|k>>4,e=(15&k)<<4|l>>1,f=(1&l)<<7|m<<2|n>>3,g=(7&n)<<5|o,r.push(c),(i&!0||32!==j)&&r.push(d),(k&!0||32!==l)&&r.push(e),(l&!0||32!==m)&&r.push(f),(n&!0||32!==o)&&r.push(g);return r},SHOW_IN_BINARY:!1,OFFSETS_SHOW_VARIABLE:!0,run_offsets:function(a,b){var c=b[0]||Base64.ALPHABET,d=b[1],e=Utils.to_base64(a,c),f=Utils.to_base64([0].concat(a),c),g=Utils.to_base64([0,0].concat(a),c),h=e.indexOf("="),i=f.indexOf("="),j=g.indexOf("="),k="
                                                                                                                                      Operations
                                                                                                                                        Recipe
                                                                                                                                          Input
                                                                                                                                          Output
                                                                                                                                          Operations
                                                                                                                                            Recipe
                                                                                                                                              Input
                                                                                                                                              Output
                                                                                                                                              \ No newline at end of file +},pad_right:function(a,b,c){return c=c||" ",a.lengthb&&(a=a.slice(0,b-c.length)+c),a},hex:function(a,b){return a="string"==typeof a?Utils.ord(a):a,b=b||2,Utils.pad(a.toString(16),b)},bin:function(a,b){return a="string"==typeof a?Utils.ord(a):a,b=b||8,Utils.pad(a.toString(2),b)},printable:function(a,b){window&&window.app&&!window.app.options.treat_as_utf8&&(a=Utils.byte_array_to_chars(Utils.str_to_byte_array(a)));var c=/[\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\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DD5\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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FEF-\uFFFB\uFFFE\uFFFF]/g,d=/[\x09-\x10\x0D\u2028\u2029]/g;return a=a.replace(c,"."),b||(a=a.replace(d,".")),a},parse_escaped_chars:function(a){return a.replace(/(\\)?\\([nrtbf]|x[\da-f]{2})/g,function(a,b,c){if("\\"===b)return"\\"+c;switch(c[0]){case"n":return"\n";case"r":return"\r";case"t":return"\t";case"b":return"\b";case"f":return"\f";case"x":return Utils.chr(parseInt(c.substr(1),16))}})},expand_alph_range:function(a){for(var b=[],c=0;c255)return Utils.str_to_utf8_byte_array(a);return c},str_to_utf8_byte_array:function(a){var b=CryptoJS.enc.Utf8.parse(a),c=Utils.word_array_to_byte_array(b);return a.length!==b.sigBytes&&(window.app.options.attempt_highlight=!1),c},str_to_charcode:function(a){for(var b=new Array(a.length),c=a.length;c--;)b[c]=a.charCodeAt(c);return b},byte_array_to_utf8:function(a){try{for(var b=[],c=0;c>>2]|=a[c]<<24-c%4*8;var d=new CryptoJS.lib.WordArray.init(b,a.length),e=CryptoJS.enc.Utf8.stringify(d);return e.length!==d.sigBytes&&(window.app.options.attempt_highlight=!1),e}catch(b){return Utils.byte_array_to_chars(a)}},byte_array_to_chars:function(a){if(!a)return"";for(var b="",c=0;c>>2]>>>24-d%4*8&255);return c},UNIC_WIN1251_MAP:{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,14:14,15:15,16:16,17:17,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,28:28,29:29,30:30,31:31,32:32,33:33,34:34,35:35,36:36,37:37,38:38,39:39,40:40,41:41,42:42,43:43,44:44,45:45,46:46,47:47,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,58:58,59:59,60:60,61:61,62:62,63:63,64:64,65:65,66:66,67:67,68:68,69:69,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,82:82,83:83,84:84,85:85,86:86,87:87,88:88,89:89,90:90,91:91,92:92,93:93,94:94,95:95,96:96,97:97,98:98,99:99,100:100,101:101,102:102,103:103,104:104,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,125:125,126:126,127:127,1027:129,8225:135,1046:198,8222:132,1047:199,1168:165,1048:200,1113:154,1049:201,1045:197,1050:202,1028:170,160:160,1040:192,1051:203,164:164,166:166,167:167,169:169,171:171,172:172,173:173,174:174,1053:205,176:176,177:177,1114:156,181:181,182:182,183:183,8221:148,187:187,1029:189,1056:208,1057:209,1058:210,8364:136,1112:188,1115:158,1059:211,1060:212,1030:178,1061:213,1062:214,1063:215,1116:157,1064:216,1065:217,1031:175,1066:218,1067:219,1068:220,1069:221,1070:222,1032:163,8226:149,1071:223,1072:224,8482:153,1073:225,8240:137,1118:162,1074:226,1110:179,8230:133,1075:227,1033:138,1076:228,1077:229,8211:150,1078:230,1119:159,1079:231,1042:194,1080:232,1034:140,1025:168,1081:233,1082:234,8212:151,1083:235,1169:180,1084:236,1052:204,1085:237,1035:142,1086:238,1087:239,1088:240,1089:241,1090:242,1036:141,1041:193,1091:243,1092:244,8224:134,1093:245,8470:185,1094:246,1054:206,1095:247,1096:248,8249:139,1097:249,1098:250,1044:196,1099:251,1111:191,1055:207,1100:252,1038:161,8220:147,1101:253,8250:155,1102:254,8216:145,1103:255,1043:195,1105:184,1039:143,1026:128,1106:144,8218:130,1107:131,8217:146,1108:186,1109:190},WIN1251_UNIC_MAP:{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,14:14,15:15,16:16,17:17,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,28:28,29:29,30:30,31:31,32:32,33:33,34:34,35:35,36:36,37:37,38:38,39:39,40:40,41:41,42:42,43:43,44:44,45:45,46:46,47:47,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,58:58,59:59,60:60,61:61,62:62,63:63,64:64,65:65,66:66,67:67,68:68,69:69,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,82:82,83:83,84:84,85:85,86:86,87:87,88:88,89:89,90:90,91:91,92:92,93:93,94:94,95:95,96:96,97:97,98:98,99:99,100:100,101:101,102:102,103:103,104:104,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,125:125,126:126,127:127,160:160,164:164,166:166,167:167,169:169,171:171,172:172,173:173,174:174,176:176,177:177,181:181,182:182,183:183,187:187,168:1025,128:1026,129:1027,170:1028,189:1029,178:1030,175:1031,163:1032,138:1033,140:1034,142:1035,141:1036,161:1038,143:1039,192:1040,193:1041,194:1042,195:1043,196:1044,197:1045,198:1046,199:1047,200:1048,201:1049,202:1050,203:1051,204:1052,205:1053,206:1054,207:1055,208:1056,209:1057,210:1058,211:1059,212:1060,213:1061,214:1062,215:1063,216:1064,217:1065,218:1066,219:1067,220:1068,221:1069,222:1070,223:1071,224:1072,225:1073,226:1074,227:1075,228:1076,229:1077,230:1078,231:1079,232:1080,233:1081,234:1082,235:1083,236:1084,237:1085,238:1086,239:1087,240:1088,241:1089,242:1090,243:1091,244:1092,245:1093,246:1094,247:1095,248:1096,249:1097,250:1098,251:1099,252:1100,253:1101,254:1102,255:1103,184:1105,144:1106,131:1107,186:1108,190:1109,179:1110,191:1111,188:1112,154:1113,156:1114,158:1115,157:1116,162:1118,159:1119,165:1168,180:1169,150:8211,151:8212,145:8216,146:8217,130:8218,147:8220,148:8221,132:8222,134:8224,135:8225,149:8226,133:8230,137:8240,139:8249,155:8250,136:8364,185:8470,153:8482},unicode_to_win1251:function(a){for(var b=[],c=0;c>2,g=(3&c)<<4|d>>4,h=(15&d)<<2|e>>6,i=63&e,isNaN(d)?h=i=64:isNaN(e)&&(i=64),j+=b.charAt(f)+b.charAt(g)+b.charAt(h)+b.charAt(i);return j},from_base64:function(a,b,c,d){if(c=c||"string",!a)return"string"===c?"":[];b=b?Utils.expand_alph_range(b).join(""):"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",void 0===d&&(d=!0);var e,f,g,h,i,j,k,l=[],m=0;if(d){var n=new RegExp("[^"+b.replace(/[\[\]\\\-^$]/g,"\\$&")+"]","g");a=a.replace(n,"")}for(;m>4,f=(15&i)<<4|j>>2,g=(3&j)<<6|k,l.push(e),64!==j&&l.push(f),64!==k&&l.push(g);return"string"===c?Utils.byte_array_to_utf8(l):l},to_hex:function(a,b,c){if(!a)return"";b="string"==typeof b?b:" ",c=c||2;for(var d="",e=0;e>>4).toString(16)),b.push((15&a[c]).toString(16));return b.join("")},from_hex:function(a,b,c){if(b=b||(a.indexOf(" ")>=0?"Space":"None"),c=c||2,"None"!==b){var d=Utils.regex_rep[b];a=a.replace(d,"")}for(var e=[],f=0;f]*>.*<\/(script|style)>/gim,"")),a.replace(/<[^>\n]+>/g,"")},escape_html:function(a){return a.replace(/>>3]|=parseInt(a.substr(d,2),16)<<24-d%8*4;return new CryptoJS.lib.WordArray.init(c,b/2)};var Base={DEFAULT_RADIX:36,run_to:function(a,b){if(!a)throw"Error: Input must be a number";var c=b[0]||Base.DEFAULT_RADIX;if(c<2||c>36)throw"Error: Radix argument must be between 2 and 36";return a.toString(c)},run_from:function(a,b){var c=b[0]||Base.DEFAULT_RADIX;if(c<2||c>36)throw"Error: Radix argument must be between 2 and 36";return parseInt(a.replace(/\s/g,""),c)}},Base64={ALPHABET:"A-Za-z0-9+/=",ALPHABET_OPTIONS:[{name:"Standard: A-Za-z0-9+/=",value:"A-Za-z0-9+/="},{name:"URL safe: 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: 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+/="}],run_to:function(a,b){var c=b[0]||Base64.ALPHABET;return Utils.to_base64(a,c)},REMOVE_NON_ALPH_CHARS:!0,run_from:function(a,b){var c=b[0]||Base64.ALPHABET,d=b[1];return Utils.from_base64(a,c,"byte_array",d)},BASE32_ALPHABET:"A-Z2-7=",run_to_32:function(a,b){if(!a)return"";for(var c,d,e,f,g,h,i,j,k,l,m,n,o,p=b[0]?Utils.expand_alph_range(b[0]).join(""):"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",q="",r=0;r>3,i=(7&c)<<2|d>>6,j=d>>1&31,k=(1&d)<<4|e>>4,l=(15&e)<<1|f>>7,m=f>>2&63,n=(3&f)<<3|g>>5,o=31&g,isNaN(d)?j=k=l=m=n=o=32:isNaN(e)?l=m=n=o=32:isNaN(f)?m=n=o=32:isNaN(g)&&(o=32),q+=p.charAt(h)+p.charAt(i)+p.charAt(j)+p.charAt(k)+p.charAt(l)+p.charAt(m)+p.charAt(n)+p.charAt(o);return q},run_from_32:function(a,b){if(!a)return[];var c,d,e,f,g,h,i,j,k,l,m,n,o,p=b[0]?Utils.expand_alph_range(b[0]).join(""):"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",q=b[0],r=[],s=0;if(q){var t=new RegExp("[^"+p.replace(/[\]\\\-^]/g,"\\$&")+"]","g");a=a.replace(t,"")}for(;s>2,d=(3&i)<<6|j<<1|k>>4,e=(15&k)<<4|l>>1,f=(1&l)<<7|m<<2|n>>3,g=(7&n)<<5|o,r.push(c),(i&!0||32!==j)&&r.push(d),(k&!0||32!==l)&&r.push(e),(l&!0||32!==m)&&r.push(f),(n&!0||32!==o)&&r.push(g);return r},SHOW_IN_BINARY:!1,OFFSETS_SHOW_VARIABLE:!0,run_offsets:function(a,b){var c=b[0]||Base64.ALPHABET,d=b[1],e=Utils.to_base64(a,c),f=Utils.to_base64([0].concat(a),c),g=Utils.to_base64([0,0].concat(a),c),h=e.indexOf("="),i=f.indexOf("="),j=g.indexOf("="),k=" \ No newline at end of file diff --git a/build/prod/index.html b/build/prod/index.html index b427a012..5cb1b203 100755 --- a/build/prod/index.html +++ b/build/prod/index.html @@ -18,4 +18,4 @@ See the License for the specific language governing permissions and limitations under the License. --> -CyberChef Edit
                                                                                                                                              Operations
                                                                                                                                                Recipe
                                                                                                                                                  Input
                                                                                                                                                  Output
                                                                                                                                                  \ No newline at end of file +CyberChef Edit
                                                                                                                                                  Operations
                                                                                                                                                    Recipe
                                                                                                                                                      Input
                                                                                                                                                      Output
                                                                                                                                                      \ No newline at end of file diff --git a/build/prod/scripts.js b/build/prod/scripts.js index 540441c0..fa4ac148 100755 --- a/build/prod/scripts.js +++ b/build/prod/scripts.js @@ -279,13 +279,13 @@ function(a){"function"==typeof define&&define.amd?define(a):"undefined"!=typeof function(){function a(a){this.code=a,this.message=Vc[a]}function b(b){var c=b.match(/\$?(?:(?![0-9-])(?:\w[\w.-]*|\*):)?(?![0-9-])(?:\w[\w.-]*|\*)|\(:|:\)|\/\/|\.\.|::|\d+(?:\.\d*)?(?:[eE][+-]?\d+)?|\.\d+(?:[eE][+-]?\d+)?|"[^"]*(?:""[^"]*)*"|'[^']*(?:''[^']*)*'|<<|>>|[!<>]=|(?![0-9-])[\w-]+:\*|\s+|./g);if(c){for(var d=0,e=0,f=c.length;e0)}function e(){this.dataTypes={},this.documents={},this.functions={},this.collations={},this.collections={}}function f(a,b,c){Xc[a]=c,Yc[a]=b}function g(a,b){Zc[a]=b}function h(c,d){var e=new b(c),f=l(e,d);if(!e.eof())throw new a("XPST0003");if(!f)throw new a("XPST0003");this.internalExpression=f}function i(){}function j(){}function k(){this.items=[]}function l(b,c){var d;if(!b.eof()&&(d=m(b,c))){var e=new k;for(e.items.push(d);","==b.peek();){if(b.next(),b.eof()||!(d=m(b,c)))throw new a("XPST0003");e.items.push(d)}return e}}function m(a,b){if(!a.eof())return s(a,b)||o(a,b)||u(a,b)||K(a,b)}function n(){this.bindings=[],this.returnExpr=null}function o(b,c){if("for"==b.peek()&&"$"==b.peek(1).substr(0,1)){b.next();var d,e=new n;do e.bindings.push(q(b,c));while(","==b.peek()&&b.next());if("return"!=b.peek())throw new a("XPST0003");if(b.next(),b.eof()||!(d=m(b,c)))throw new a("XPST0003");return e.returnExpr=d,e}}function p(a,b,c,d){this.prefix=a,this.localName=b,this.namespaceURI=c,this.inExpr=d}function q(b,c){var d=b.peek().substr(1).match(id);if(!d)throw new a("XPST0003");if("*"==d[1]||"*"==d[2])throw new a("XPST0003");if(b.next(),"in"!=b.peek())throw new a("XPST0003");b.next();var e;if(b.eof()||!(e=m(b,c)))throw new a("XPST0003");return new p(d[1]||null,d[2],d[1]?c.getURIForPrefix(d[1]):null,e)}function r(a,b,c){this.condExpr=a,this.thenExpr=b,this.elseExpr=c}function s(b,c){var d,e,f;if("if"==b.peek()&&"("==b.peek(1)){if(b.next(2),b.eof()||!(d=l(b,c)))throw new a("XPST0003");if(")"!=b.peek())throw new a("XPST0003");if(b.next(),"then"!=b.peek())throw new a("XPST0003");if(b.next(),b.eof()||!(e=m(b,c)))throw new a("XPST0003");if("else"!=b.peek())throw new a("XPST0003");if(b.next(),b.eof()||!(f=m(b,c)))throw new a("XPST0003");return new r(d,e,f)}}function t(a){this.quantifier=a,this.bindings=[],this.satisfiesExpr=null}function u(b,c){var d=b.peek();if(("some"==d||"every"==d)&&"$"==b.peek(1).substr(0,1)){b.next();var e,f=new t(d);do f.bindings.push(w(b,c));while(","==b.peek()&&b.next());if("satisfies"!=b.peek())throw new a("XPST0003");if(b.next(),b.eof()||!(e=m(b,c)))throw new a("XPST0003");return f.satisfiesExpr=e,f}}function v(a,b,c,d){this.prefix=a,this.localName=b,this.namespaceURI=c,this.inExpr=d}function w(b,c){var d=b.peek().substr(1).match(id);if(!d)throw new a("XPST0003");if("*"==d[1]||"*"==d[2])throw new a("XPST0003");if(b.next(),"in"!=b.peek())throw new a("XPST0003");b.next();var e;if(b.eof()||!(e=m(b,c)))throw new a("XPST0003");return new v(d[1]||null,d[2],d[1]?c.getURIForPrefix(d[1]):null,e)}function x(a,b,c){this.left=a,this.right=b,this.operator=c}function y(b,c){var d,e;if(!b.eof()&&(d=ya(b,c))){if(!(b.peek()in cd))return d;var f=b.peek();if(b.next(),b.eof()||!(e=ya(b,c)))throw new a("XPST0003");return new x(d,e,f)}}function z(a,b){var c=vc(a.left.evaluate(b),b);if(!c.length)return new Xa(!1);var d=vc(a.right.evaluate(b),b);if(!d.length)return new Xa(!1);for(var e,f,g=!1,h=0,i=c.length;hj)throw new a("XPST0017");if(i1)throw new a("XPTY0004")}else if("+"==d){if(e<1)throw new a("XPTY0004")}else if("*"!=d&&1!=e)throw new a("XPTY0004")}function va(a){this.left=a,this.items=[]}function wa(b,c){var d,e;if(!b.eof()&&(d=Ca(b,c))){if("intersect"!=(e=b.peek())&&"except"!=e)return d;for(var f=new va(d);"intersect"==(e=b.peek())||"except"==e;){if(b.next(),b.eof()||!(d=Ca(b,c)))throw new a("XPST0003");f.items.push([e,d])}return f}}function xa(a,b){this.left=a,this.right=b}function ya(b,c){var d,e;if(!b.eof()&&(d=D(b,c))){if("to"!=b.peek())return d;if(b.next(),b.eof()||!(e=D(b,c)))throw new a("XPST0003");return new xa(d,e)}}function za(a){this.left=a,this.items=[]}function Aa(b,c){var d,e;if(!b.eof()&&(d=wa(b,c))){if("|"!=(e=b.peek())&&"union"!=e)return d;for(var f=new za(d);"|"==(e=b.peek())||"union"==e;){if(b.next(),b.eof()||!(d=wa(b,c)))throw new a("XPST0003");f.items.push(d)}return f}}function Ba(a,b){this.expression=a,this.type=b}function Ca(b,c){var d,e;if(!b.eof()&&(d=Ea(b,c))){if("instance"!=b.peek()||"of"!=b.peek(1))return d;if(b.next(2),b.eof()||!(e=Oa(b,c)))throw new a("XPST0003");return new Ba(d,e)}}function Da(a,b){this.expression=a,this.type=b}function Ea(b,c){var d,e;if(!b.eof()&&(d=Ga(b,c))){if("treat"!=b.peek()||"as"!=b.peek(1))return d;if(b.next(2),b.eof()||!(e=Oa(b,c)))throw new a("XPST0003");return new Da(d,e)}}function Fa(a,b){this.expression=a,this.type=b}function Ga(b,c){var d,e;if(!b.eof()&&(d=Ia(b,c))){if("castable"!=b.peek()||"as"!=b.peek(1))return d;if(b.next(2),b.eof()||!(e=Qa(b,c)))throw new a("XPST0003");return new Fa(d,e)}}function Ha(a,b){this.expression=a,this.type=b}function Ia(b,c){var d,e;if(!b.eof()&&(d=H(b,c))){if("cast"!=b.peek()||"as"!=b.peek(1))return d;if(b.next(2),b.eof()||!(e=Qa(b,c)))throw new a("XPST0003");return new Ha(d,e)}}function Ja(a,b,c){this.prefix=a,this.localName=b,this.namespaceURI=c}function Ka(b,c){var d=b.peek().match(id);if(d){if("*"==d[1]||"*"==d[2])throw new a("XPST0003");return b.next(),new Ja(d[1]||null,d[2],d[1]?c.getURIForPrefix(d[1]):null)}}function La(a){this.test=a}function Ma(b,c){if(!b.eof()){var d;if("item"==b.peek()&&"("==b.peek(1)){if(b.next(2),")"!=b.peek())throw new a("XPST0003");return b.next(),new La}return(d=Z(b,c))?new La(d):(d=Ka(b,c))?new La(d):void 0}}function Na(a,b){this.itemType=a||null,this.occurence=b||null}function Oa(b,c){if(!b.eof()){if("empty-sequence"==b.peek()&&"("==b.peek(1)){if(b.next(2),")"!=b.peek())throw new a("XPST0003");return b.next(),new Na}var d,e;return!b.eof()&&(d=Ma(b,c))?(e=b.peek(),"?"==e||"*"==e||"+"==e?b.next():e=null,new Na(d,e)):void 0}}function Pa(a,b){this.itemType=a||null,this.occurence=b||null}function Qa(a,b){var c,d;if(!a.eof()&&(c=Ka(a,b)))return d=a.peek(),"?"==d?a.next():d=null,new Pa(c,d)}function Ra(){}function Sa(){}function Ta(){}function Ua(a){return a instanceof lb||a instanceof gb||a instanceof fb}function Va(a,b,c,d,e){this.scheme=a,this.authority=b,this.path=c,this.query=d,this.fragment=e}function Wa(a){this.value=a}function Xa(a){this.value=a}function Ya(a,b,c,d,e){this.year=a,this.month=b,this.day=c,this.timezone=d,this.negative=e}function Za(a,b){return 2==b&&(a%400==0||a%100!=0&&a%4==0)?29:pd[b-1]}function $a(a,b){if(!b){var c=Za(a.year,a.month);if(a.day>c)for(;a.day>c;)a.month+=1,a.month>12&&(a.year+=1,0==a.year&&(a.year=1),a.month=1),a.day-=c,c=Za(a.year,a.month);else if(a.day<1)for(;a.day<1;)a.month-=1,a.month<1&&(a.year-=1,0==a.year&&(a.year=-1),a.month=12),c=Za(a.year,a.month),a.day+=c}return a.month>12?(a.year+=~~(a.month/12),0==a.year&&(a.year=1),a.month=a.month%12):a.month<1&&(a.year+=~~(a.month/12)-1,0==a.year&&(a.year=-1),a.month=a.month%12+12),a}function _a(a,b,c,d,e,f,g,h){this.year=a,this.month=b,this.day=c,this.hours=d,this.minutes=e,this.seconds=f,this.timezone=g,this.negative=h}function ab(a,b){var c=Ac(a);return arguments.length<2&&(b=2),(c.length0?"+":"-")+ab(Gc.abs(~~(b/60)))+":"+ab(Gc.abs(b%60)):"Z"}function cb(a){return(a.negative?"-":"")+ab(a.year,4)+"-"+ab(a.month)+"-"+ab(a.day)}function db(a){var b=Ac(a.seconds).split(".");return ab(a.hours)+":"+ab(a.minutes)+":"+ab(b[0])+(b.length>1?"."+b[1]:"")}function eb(a){return $a(wb(a))}function fb(a){this.value=a}function gb(a){this.value=a}function hb(a,b,c,d,e,f,g){this.year=a,this.month=b,this.day=c,this.hours=d,this.minutes=e,this.seconds=f,this.negative=g}function ib(a){return(a.year?a.year+"Y":"")+(a.month?a.month+"M":"")}function jb(a){return(a.day?a.day+"D":"")+(a.hours||a.minutes||a.seconds?"T"+(a.hours?a.hours+"H":"")+(a.minutes?a.minutes+"M":"")+(a.seconds?a.seconds+"S":""):"")}function kb(a){return zb(Bb(a))}function lb(a){this.value=a}function mb(a,b){this.day=a,this.timezone=b}function nb(a,b){this.month=a,this.timezone=b}function ob(a,b,c){this.month=a,this.day=b,this.timezone=c}function pb(a,b){this.year=a,this.timezone=b}function qb(a,b,c){this.year=a,this.month=b,this.timezone=c}function rb(a){this.value=a}function sb(){}function tb(a,b,c){this.prefix=a,this.localName=b,this.namespaceURI=c}function ub(a){this.value=a}function vb(a,b,c,d){this.hours=a,this.minutes=b,this.seconds=c,this.timezone=d}function wb(a){return(a.seconds>=60||a.seconds<0)&&(a.minutes+=~~(a.seconds/60)-(a.seconds<0&&a.seconds%60?1:0),a.seconds=a.seconds%60+(a.seconds<0&&a.seconds%60?60:0)),(a.minutes>=60||a.minutes<0)&&(a.hours+=~~(a.minutes/60)-(a.minutes<0&&a.minutes%60?1:0),a.minutes=a.minutes%60+(a.minutes<0&&a.minutes%60?60:0)),(a.hours>=24||a.hours<0)&&(a instanceof _a&&(a.day+=~~(a.hours/24)-(a.hours<0&&a.hours%24?1:0)),a.hours=a.hours%24+(a.hours<0&&a.hours%24?24:0)),a}function xb(a){this.value=a}function yb(a,b,c){hb.call(this,a,b,0,0,0,0,c)}function zb(a){return a.month>=12&&(a.year+=~~(a.month/12),a.month%=12),a}function Ab(a,b,c,d,e){hb.call(this,0,0,a,b,c,d,e)}function Bb(a){return a.seconds>=60&&(a.minutes+=~~(a.seconds/60),a.seconds%=60),a.minutes>=60&&(a.hours+=~~(a.minutes/60),a.minutes%=60),a.hours>=24&&(a.day+=~~(a.hours/24),a.hours%=24),a}function Cb(a){this.value=a}function Db(a){this.value=a}function Eb(a){this.value=a}function Fb(a){this.value=a}function Gb(a){this.value=a}function Hb(a){this.value=a}function Ib(a){this.value=a}function Jb(a){this.value=a}function Kb(a){this.value=a}function Lb(a){this.value=a}function Mb(a){this.value=a}function Nb(a){this.value=a}function Ob(a){this.value=a}function Pb(a){this.value=a}function Qb(a){this.value=a}function Rb(a){this.value=a}function Sb(a){this.value=a}function Tb(a){this.value=a}function Ub(a){this.value=a}function Vb(a){this.value=a}function Wb(a){this.value=a}function Xb(a){this.value=a}function Yb(){}function Zb(){}function $b(){}function _b(){}function ac(){}function bc(){}function cc(){}function dc(){}function ec(a,b,c){var d=nc(a),e=nc(b);return new Xa("lt"==c?de:d==e)}function fc(a,b,c){return gc(_a.cast(a),_a.cast(b),c)}function gc(a,b,c){var d=new Ab(0,0,0,0),e=tc(a,d).toString(),f=tc(b,d).toString();return new Xa("lt"==c?ef:e==f)}function hc(a,b,c){var d;a instanceof Ya?d=new Ya(a.year,a.month,a.day,a.timezone,a.negative):a instanceof _a&&(d=new _a(a.year,a.month,a.day,a.hours,a.minutes,a.seconds,a.timezone,a.negative)),d.year=d.year+b.year*("-"==c?-1:1),d.month=d.month+b.month*("-"==c?-1:1),$a(d,!0);var e=Za(d.year,d.month);return d.day>e&&(d.day=e),d}function ic(a,b,c){var d;if(a instanceof Ya){var e=60*(60*b.hours+b.minutes)+b.seconds;d=new Ya(a.year,a.month,a.day,a.timezone,a.negative),d.day=d.day+b.day*("-"==c?-1:1)-1*(e&&"-"==c),$a(d)}else a instanceof _a&&(d=new _a(a.year,a.month,a.day,a.hours,a.minutes,a.seconds,a.timezone,a.negative),d.seconds=d.seconds+b.seconds*("-"==c?-1:1),d.minutes=d.minutes+b.minutes*("-"==c?-1:1),d.hours=d.hours+b.hours*("-"==c?-1:1),d.day=d.day+b.day*("-"==c?-1:1),eb(d));return d}function jc(a){return(60*(60*(24*a.day+a.hours)+a.minutes)+a.seconds)*(a.negative?-1:1)}function kc(a){var b=(a=Gc.round(a))<0,c=~~((a=Gc.abs(a))/86400),d=~~((a-=3600*c*24)/3600),e=~~((a-=3600*d)/60),f=a-=60*e;return new Ab(c,d,e,f,b)}function lc(a){return(12*a.year+a.month)*(a.negative?-1:1)}function mc(a){var b=(a=Gc.round(a))<0,c=~~((a=Gc.abs(a))/12),d=a-=12*c;return new yb(c,d,b)}function nc(a){return a.seconds+60*(a.minutes-(null!=a.timezone?a.timezone%60:0)+60*(a.hours-(null!=a.timezone?~~(a.timezone/60):0)))}function oc(a){var b=new Ec((a.negative?-1:1)*a.year,a.month,a.day,0,0,0,0);return a instanceof _a&&(b.setHours(a.hours),b.setMinutes(a.minutes),b.setSeconds(a.seconds)),null!=a.timezone&&b.setMinutes(b.getMinutes()-a.timezone),b.getTime()/1e3}function pc(a,b){if(Ic(a)||Gc.abs(a)==Lc||Ic(b)||Gc.abs(b)==Lc)return 0;var c=Ac(a).match(jd),d=Ac(b).match(jd),e=Gc.max(1,(c[2]||c[3]||"").length+(c[5]||0)*("+"==c[4]?-1:1),(d[2]||d[3]||"").length+(d[5]||0)*("+"==d[4]?-1:1));return e+(e%2?0:1)}function qc(a,b,c){return new(a instanceof Cb&&b instanceof Cb&&c==Gc.round(c)?Cb:fb)(c)}function rc(a,b){if(null==a)return null;var c=a[b]*(a.negative?-1:1);return"seconds"==b?new fb(c):new Cb(c)}function sc(a,b){if(null==a)return null;if("timezone"==b){var c=a.timezone;return null==c?null:new Ab(0,Gc.abs(~~(c/60)),Gc.abs(c%60),0,c<0)}var d=a[b];return a instanceof Ya||"hours"==b&&24==d&&(d=0),a instanceof vb||(d*=a.negative?-1:1),"seconds"==b?new fb(d):new Cb(d)}function tc(a,b){if(null==a)return null;var c;if(c=a instanceof Ya?new Ya(a.year,a.month,a.day,a.timezone,a.negative):a instanceof vb?new vb(a.hours,a.minutes,a.seconds,a.timezone,a.negative):new _a(a.year,a.month,a.day,a.hours,a.minutes,a.seconds,a.timezone,a.negative),null==b)c.timezone=null;else{var d=jc(b)/60;if(null!=a.timezone){var e=d-a.timezone;a instanceof Ya?e<0&&c.day--:(c.minutes+=e%60,c.hours+=~~(e/60)),eb(c)}c.timezone=d}return c}function uc(b,c){if(!b.length)return!1;var d=b[0];if(c.DOMAdapter.isNode(d))return!0;if(1==b.length){if(d instanceof Xa)return d.value.valueOf();if(d instanceof ub)return!!d.valueOf().length;if(Ua(d))return!(Ic(d.valueOf())||0==d.valueOf());throw new a("FORG0006")}throw new a("FORG0006")}function vc(a,b){for(var c,d,e=[],f=0,g=a.length;f=0,j=c.indexOf("x")>=0;if(i||j){c=c.replace(/[sx]/g,"");for(var k,l=[],m=/\s/,n=0,o=b.length,p=!1,q="";n0},b.prototype.eof=function(){return this.index>=this.length},c.prototype.isNode=function(a){return a&&!!a.nodeType},c.prototype.getProperty=function(a,b){return a[b]},c.prototype.isSameNode=function(a,b){return a==b},c.prototype.compareDocumentPosition=function(a,b){return a.compareDocumentPosition(b)},c.prototype.lookupNamespaceURI=function(a,b){return a.lookupNamespaceURI(b)},c.prototype.getElementById=function(a,b){return a.getElementById(b)},c.prototype.getElementsByTagNameNS=function(a,b,c){return a.getElementsByTagNameNS(b,c)},d.prototype.item=null,d.prototype.position=0,d.prototype.size=0,d.prototype.scope=null,d.prototype.stack=null,d.prototype.dateTime=null,d.prototype.timezone=null,d.prototype.staticContext=null,d.prototype.pushVariable=function(a,b){this.stack.hasOwnProperty(a)||(this.stack[a]=[]),this.stack[a].push(this.scope[a]),this.scope[a]=b},d.prototype.popVariable=function(a){this.stack.hasOwnProperty(a)&&(this.scope[a]=this.stack[a].pop(),this.stack[a].length||(delete this.stack[a],"undefined"==typeof this.scope[a]&&delete this.scope[a]))},e.prototype.baseURI=null,e.prototype.dataTypes=null,e.prototype.documents=null,e.prototype.functions=null,e.prototype.defaultFunctionNamespace=null,e.prototype.collations=null,e.prototype.defaultCollationName=Sc+"/collation/codepoint",e.prototype.collections=null,e.prototype.namespaceResolver=null,e.prototype.defaultElementNamespace=null;var Wc=/^(?:\{([^\}]+)\})?(.+)$/;e.prototype.setDataType=function(a,b){var c=a.match(Wc);c&&c[1]!=Rc&&(this.dataTypes[a]=b)},e.prototype.getDataType=function(a){var b=a.match(Wc);if(b)return b[1]==Rc?Zc[b[2]]:this.dataTypes[a]},e.prototype.setDocument=function(a,b){this.documents[a]=b},e.prototype.getDocument=function(a){return this.documents[a]},e.prototype.setFunction=function(a,b){var c=a.match(Wc);c&&c[1]!=Sc&&(this.functions[a]=b)},e.prototype.getFunction=function(a){var b=a.match(Wc);if(b)return b[1]==Sc?Xc[b[2]]:this.functions[a]},e.prototype.setCollation=function(a,b){this.collations[a]=b},e.prototype.getCollation=function(a){return this.collations[a]},e.prototype.setCollection=function(a,b){this.collections[a]=b},e.prototype.getCollection=function(a){return this.collections[a]},e.prototype.getURIForPrefix=function(b){var c,d=this.namespaceResolver,e=d&&d.lookupNamespaceURI?d.lookupNamespaceURI:d;if(e instanceof Fc&&(c=e.call(d,b)))return c;if("fn"==b)return Sc;if("xs"==b)return Rc;if("xml"==b)return Uc;if("xmlns"==b)return Tc;throw new a("XPST0081")},e.js2xs=function(a){return a="boolean"==typeof a?new Xa(a):"number"==typeof a?Ic(a)||!Jc(a)?new gb(a):ja(Ac(a)):new ub(Ac(a))},e.xs2js=function(a){return a=a instanceof Xa?a.valueOf():Ua(a)?a.valueOf():a.toString()};var Xc={},Yc={},Zc={},$c={};h.prototype.internalExpression=null,h.prototype.evaluate=function(a){return this.internalExpression.evaluate(a)},i.prototype.equals=function(a,b){throw"Not implemented"},i.prototype.compare=function(a,b){throw"Not implemented"},j.ANYSIMPLETYPE_DT=1,j.STRING_DT=2,j.BOOLEAN_DT=3,j.DECIMAL_DT=4,j.FLOAT_DT=5,j.DOUBLE_DT=6,j.DURATION_DT=7,j.DATETIME_DT=8,j.TIME_DT=9,j.DATE_DT=10,j.GYEARMONTH_DT=11,j.GYEAR_DT=12,j.GMONTHDAY_DT=13,j.GDAY_DT=14,j.GMONTH_DT=15,j.HEXBINARY_DT=16,j.BASE64BINARY_DT=17,j.ANYURI_DT=18,j.QNAME_DT=19,j.NOTATION_DT=20,j.NORMALIZEDSTRING_DT=21,j.TOKEN_DT=22,j.LANGUAGE_DT=23,j.NMTOKEN_DT=24,j.NAME_DT=25,j.NCNAME_DT=26,j.ID_DT=27,j.IDREF_DT=28,j.ENTITY_DT=29,j.INTEGER_DT=30,j.NONPOSITIVEINTEGER_DT=31,j.NEGATIVEINTEGER_DT=32,j.LONG_DT=33,j.INT_DT=34,j.SHORT_DT=35,j.BYTE_DT=36,j.NONNEGATIVEINTEGER_DT=37,j.UNSIGNEDLONG_DT=38,j.UNSIGNEDINT_DT=39,j.UNSIGNEDSHORT_DT=40,j.UNSIGNEDBYTE_DT=41,j.POSITIVEINTEGER_DT=42,j.LISTOFUNION_DT=43,j.LIST_DT=44,j.UNAVAILABLE_DT=45,j.DATETIMESTAMP_DT=46,j.DAYMONTHDURATION_DT=47,j.DAYTIMEDURATION_DT=48,j.PRECISIONDECIMAL_DT=49,j.ANYATOMICTYPE_DT=50,j.ANYTYPE_DT=51,j.XT_YEARMONTHDURATION_DT=-1,j.XT_UNTYPEDATOMIC_DT=-2,k.prototype.items=null,k.prototype.evaluate=function(a){for(var b=[],c=0,d=this.items.length;c":"gt","<":"lt",">=":"ge","<=":"le"},ad={};ad.eq=function(b,c,d){var e="";if(Ua(b))Ua(c)&&(e="numeric-equal");else if(b instanceof Xa)c instanceof Xa&&(e="boolean-equal");else if(b instanceof ub){if(c instanceof ub)return $c["numeric-equal"].call(d,Xc.compare.call(d,b,c),new Cb(0))}else b instanceof Ya?c instanceof Ya&&(e="date-equal"):b instanceof vb?c instanceof vb&&(e="time-equal"):b instanceof _a?c instanceof _a&&(e="dateTime-equal"):b instanceof hb?c instanceof hb&&(e="duration-equal"):b instanceof qb?c instanceof qb&&(e="gYearMonth-equal"):b instanceof pb?c instanceof pb&&(e="gYear-equal"):b instanceof ob?c instanceof ob&&(e="gMonthDay-equal"):b instanceof nb?c instanceof nb&&(e="gMonth-equal"):b instanceof mb?c instanceof mb&&(e="gDay-equal"):b instanceof tb?c instanceof tb&&(e="QName-equal"):b instanceof rb?c instanceof rb&&(e="hexBinary-equal"):b instanceof Wa&&c instanceof Wa&&(e="base64Binary-equal");if(e)return $c[e].call(d,b,c);throw new a("XPTY0004")},ad.ne=function(a,b,c){return new Xa(!ad.eq(a,b,c).valueOf())},ad.gt=function(b,c,d){var e="";if(Ua(b))Ua(c)&&(e="numeric-greater-than");else if(b instanceof Xa)c instanceof Xa&&(e="boolean-greater-than");else if(b instanceof ub){if(c instanceof ub)return $c["numeric-greater-than"].call(d,Xc.compare.call(d,b,c),new Cb(0))}else b instanceof Ya?c instanceof Ya&&(e="date-greater-than"):b instanceof vb?c instanceof vb&&(e="time-greater-than"):b instanceof _a?c instanceof _a&&(e="dateTime-greater-than"):b instanceof yb?c instanceof yb&&(e="yearMonthDuration-greater-than"):b instanceof Ab&&c instanceof Ab&&(e="dayTimeDuration-greater-than"); if(e)return $c[e].call(d,b,c);throw new a("XPTY0004")},ad.lt=function(b,c,d){var e="";if(Ua(b))Ua(c)&&(e="numeric-less-than");else if(b instanceof Xa)c instanceof Xa&&(e="boolean-less-than");else if(b instanceof ub){if(c instanceof ub)return $c["numeric-less-than"].call(d,Xc.compare.call(d,b,c),new Cb(0))}else b instanceof Ya?c instanceof Ya&&(e="date-less-than"):b instanceof vb?c instanceof vb&&(e="time-less-than"):b instanceof _a?c instanceof _a&&(e="dateTime-less-than"):b instanceof yb?c instanceof yb&&(e="yearMonthDuration-less-than"):b instanceof Ab&&c instanceof Ab&&(e="dayTimeDuration-less-than");if(e)return $c[e].call(d,b,c);throw new a("XPTY0004")},ad.ge=function(b,c,d){var e="";if(Ua(b))Ua(c)&&(e="numeric-less-than");else if(b instanceof Xa)c instanceof Xa&&(e="boolean-less-than");else if(b instanceof ub){if(c instanceof ub)return $c["numeric-greater-than"].call(d,Xc.compare.call(d,b,c),new Cb(-1))}else b instanceof Ya?c instanceof Ya&&(e="date-less-than"):b instanceof vb?c instanceof vb&&(e="time-less-than"):b instanceof _a?c instanceof _a&&(e="dateTime-less-than"):b instanceof yb?c instanceof yb&&(e="yearMonthDuration-less-than"):b instanceof Ab&&c instanceof Ab&&(e="dayTimeDuration-less-than");if(e)return new Xa(!$c[e].call(d,b,c).valueOf());throw new a("XPTY0004")},ad.le=function(b,c,d){var e="";if(Ua(b))Ua(c)&&(e="numeric-greater-than");else if(b instanceof Xa)c instanceof Xa&&(e="boolean-greater-than");else if(b instanceof ub){if(c instanceof ub)return $c["numeric-less-than"].call(d,Xc.compare.call(d,b,c),new Cb(1))}else b instanceof Ya?c instanceof Ya&&(e="date-greater-than"):b instanceof vb?c instanceof vb&&(e="time-greater-than"):b instanceof _a?c instanceof _a&&(e="dateTime-greater-than"):b instanceof yb?c instanceof yb&&(e="yearMonthDuration-greater-than"):b instanceof Ab&&c instanceof Ab&&(e="dayTimeDuration-greater-than");if(e)return new Xa(!$c[e].call(d,b,c).valueOf());throw new a("XPTY0004")};var bd={};bd.is=function(a,b,c){return $c["is-same-node"].call(c,a,b)},bd[">>"]=function(a,b,c){return $c["node-after"].call(c,a,b)},bd["<<"]=function(a,b,c){return $c["node-before"].call(c,a,b)};var cd={"=":z,"!=":z,"<":z,"<=":z,">":z,">=":z,eq:A,ne:A,lt:A,le:A,gt:A,ge:A,is:B,">>":B,"<<":B};C.prototype.left=null,C.prototype.items=null;var dd={};dd["+"]=function(b,c,d){var e="",f=!1;if(Ua(b)?Ua(c)&&(e="numeric-add"):b instanceof Ya?c instanceof yb?e="add-yearMonthDuration-to-date":c instanceof Ab&&(e="add-dayTimeDuration-to-date"):b instanceof yb?c instanceof Ya?(e="add-yearMonthDuration-to-date",f=!0):c instanceof _a?(e="add-yearMonthDuration-to-dateTime",f=!0):c instanceof yb&&(e="add-yearMonthDurations"):b instanceof Ab?c instanceof Ya?(e="add-dayTimeDuration-to-date",f=!0):c instanceof vb?(e="add-dayTimeDuration-to-time",f=!0):c instanceof _a?(e="add-dayTimeDuration-to-dateTime",f=!0):c instanceof Ab&&(e="add-dayTimeDurations"):b instanceof vb?c instanceof Ab&&(e="add-dayTimeDuration-to-time"):b instanceof _a&&(c instanceof yb?e="add-yearMonthDuration-to-dateTime":c instanceof Ab&&(e="add-dayTimeDuration-to-dateTime")),e)return $c[e].call(d,f?c:b,f?b:c);throw new a("XPTY0004")},dd["-"]=function(b,c,d){var e="";if(Ua(b)?Ua(c)&&(e="numeric-subtract"):b instanceof Ya?c instanceof Ya?e="subtract-dates":c instanceof yb?e="subtract-yearMonthDuration-from-date":c instanceof Ab&&(e="subtract-dayTimeDuration-from-date"):b instanceof vb?c instanceof vb?e="subtract-times":c instanceof Ab&&(e="subtract-dayTimeDuration-from-time"):b instanceof _a?c instanceof _a?e="subtract-dateTimes":c instanceof yb?e="subtract-yearMonthDuration-from-dateTime":c instanceof Ab&&(e="subtract-dayTimeDuration-from-dateTime"):b instanceof yb?c instanceof yb&&(e="subtract-yearMonthDurations"):b instanceof Ab&&c instanceof Ab&&(e="subtract-dayTimeDurations"),e)return $c[e].call(d,b,c);throw new a("XPTY0004")},C.prototype.evaluate=function(a){var b=vc(this.left.evaluate(a),a);if(!b.length)return[];ua(a,b,"?");var c=b[0];c instanceof xb&&(c=gb.cast(c));for(var d,e,f=0,g=this.items.length;f1)return[new Xa(!1)];if(!c.length)return[new Xa("?"==e)];try{d.cast(vc(c,b)[0])}catch(b){if("XPST0051"==b.code)throw b;if("XPST0017"==b.code)throw new a("XPST0080");return[new Xa(!1)]}return[new Xa(!0)]},Ha.prototype.expression=null,Ha.prototype.type=null,Ha.prototype.evaluate=function(a){var b=this.expression.evaluate(a);return ua(a,b,this.type.occurence),b.length?[this.type.itemType.cast(vc(b,a)[0],a)]:[]},Ja.prototype.prefix=null,Ja.prototype.localName=null,Ja.prototype.namespaceURI=null,Ja.prototype.test=function(b,c){var d=(this.namespaceURI?"{"+this.namespaceURI+"}":"")+this.localName,e=this.namespaceURI==Rc?Zc[this.localName]:c.staticContext.getDataType(d);if(e)return b instanceof e;throw new a("XPST0051")},Ja.prototype.cast=function(b,c){var d=(this.namespaceURI?"{"+this.namespaceURI+"}":"")+this.localName,e=this.namespaceURI==Rc?Zc[this.localName]:c.staticContext.getDataType(d);if(e)return e.cast(b);throw new a("XPST0051")},La.prototype.test=null,Na.prototype.itemType=null,Na.prototype.occurence=null,Pa.prototype.itemType=null,Pa.prototype.occurence=null,Ra.prototype.builtInKind=j.ANYTYPE_DT,Sa.prototype=new Ra,Sa.prototype.builtInKind=j.ANYSIMPLETYPE_DT,Sa.prototype.primitiveKind=null,Sa.PRIMITIVE_ANYURI="anyURI",Sa.PRIMITIVE_BASE64BINARY="base64Binary",Sa.PRIMITIVE_BOOLEAN="boolean",Sa.PRIMITIVE_DATE="date",Sa.PRIMITIVE_DATETIME="dateTime",Sa.PRIMITIVE_DECIMAL="decimal",Sa.PRIMITIVE_DOUBLE="double",Sa.PRIMITIVE_DURATION="duration",Sa.PRIMITIVE_FLOAT="float",Sa.PRIMITIVE_GDAY="gDay",Sa.PRIMITIVE_GMONTH="gMonth",Sa.PRIMITIVE_GMONTHDAY="gMonthDay",Sa.PRIMITIVE_GYEAR="gYear",Sa.PRIMITIVE_GYEARMONTH="gYearMonth",Sa.PRIMITIVE_HEXBINARY="hexBinary",Sa.PRIMITIVE_NOTATION="NOTATION",Sa.PRIMITIVE_QNAME="QName",Sa.PRIMITIVE_STRING="string",Sa.PRIMITIVE_TIME="time",Ta.prototype=new Sa,Ta.prototype.builtInKind=j.ANYATOMICTYPE_DT,Ta.cast=function(b){throw new a("XPST0017")},g("anyAtomicType",Ta),Va.prototype=new Ta,Va.prototype.builtInKind=j.ANYURI_DT,Va.prototype.primitiveKind=Sa.PRIMITIVE_ANYURI,Va.prototype.scheme=null,Va.prototype.authority=null,Va.prototype.path=null,Va.prototype.query=null,Va.prototype.fragment=null,Va.prototype.toString=function(){return(this.scheme?this.scheme+":":"")+(this.authority?"//"+this.authority:"")+(this.path?this.path:"")+(this.query?"?"+this.query:"")+(this.fragment?"#"+this.fragment:"")};var ld=/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;Va.cast=function(b){if(b instanceof Va)return b;if(b instanceof ub||b instanceof xb){var c;if(c=Pc(b).match(ld))return new Va(c[2],c[4],c[5],c[7],c[9]);throw new a("FORG0001")}throw new a("XPTY0004")},g("anyURI",Va),Wa.prototype=new Ta,Wa.prototype.builtInKind=j.BASE64BINARY_DT,Wa.prototype.primitiveKind=Sa.PRIMITIVE_BASE64BINARY,Wa.prototype.value=null,Wa.prototype.valueOf=function(){return this.value},Wa.prototype.toString=function(){return this.value};var md=/^((([A-Za-z0-9+\/]\s*){4})*(([A-Za-z0-9+\/]\s*){3}[A-Za-z0-9+\/]|([A-Za-z0-9+\/]\s*){2}[AEIMQUYcgkosw048]\s*=|[A-Za-z0-9+\/]\s*[AQgw]\s*=\s*=))?$/;Wa.cast=function(b){if(b instanceof Wa)return b;if(b instanceof ub||b instanceof xb){var c=Pc(b).match(md);if(c)return new Wa(c[0]);throw new a("FORG0001")}if(b instanceof rb){for(var c=b.valueOf().match(/.{2}/g),d=[],e=0,f=c.length;e=-0x8000000000000000)return new Fb(c.value);throw new a("FORG0001")},g("long",Fb),Gb.prototype=new Fb,Gb.prototype.builtInKind=j.INT_DT,Gb.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value<=2147483647&&c.value>=-2147483648)return new Gb(c.value);throw new a("FORG0001")},g("int",Gb),Hb.prototype=new Gb,Hb.prototype.builtInKind=j.SHORT_DT,Hb.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value<=32767&&c.value>=-32768)return new Hb(c.value);throw new a("FORG0001")},g("short",Hb),Ib.prototype=new Hb,Ib.prototype.builtInKind=j.BYTE_DT,Ib.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value<=127&&c.value>=-128)return new Ib(c.value);throw new a("FORG0001")},g("byte",Ib),Jb.prototype=new Cb,Jb.prototype.builtInKind=j.NONNEGATIVEINTEGER_DT,Jb.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value>=0)return new Jb(c.value);throw new a("FORG0001")},g("nonNegativeInteger",Jb),Kb.prototype=new Jb,Kb.prototype.builtInKind=j.POSITIVEINTEGER_DT,Kb.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value>=1)return new Kb(c.value);throw new a("FORG0001")},g("positiveInteger",Kb),Lb.prototype=new Jb,Lb.prototype.builtInKind=j.UNSIGNEDLONG_DT,Lb.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value>=1&&c.value<=0x10000000000000000)return new Lb(c.value);throw new a("FORG0001")},g("unsignedLong",Lb),Mb.prototype=new Jb,Mb.prototype.builtInKind=j.UNSIGNEDINT_DT,Mb.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value>=1&&c.value<=4294967295)return new Mb(c.value);throw new a("FORG0001")},g("unsignedInt",Mb),Nb.prototype=new Mb,Nb.prototype.builtInKind=j.UNSIGNEDSHORT_DT,Nb.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value>=1&&c.value<=65535)return new Nb(c.value);throw new a("FORG0001")},g("unsignedShort",Nb),Ob.prototype=new Nb,Ob.prototype.builtInKind=j.UNSIGNEDBYTE_DT, Ob.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value>=1&&c.value<=255)return new Ob(c.value);throw new a("FORG0001")},g("unsignedByte",Ob),Pb.prototype=new ub,Pb.prototype.builtInKind=j.NORMALIZEDSTRING_DT,Pb.cast=function(a){return new Pb(Ac(a))},g("normalizedString",Pb),Qb.prototype=new Pb,Qb.prototype.builtInKind=j.TOKEN_DT,Qb.cast=function(a){return new Qb(Ac(a))},g("token",Qb),Rb.prototype=new Qb,Rb.prototype.builtInKind=j.NAME_DT,Rb.cast=function(a){return new Rb(Ac(a))},g("Name",Rb),Sb.prototype=new Rb,Sb.prototype.builtInKind=j.NCNAME_DT,Sb.cast=function(a){return new Sb(Ac(a))},g("NCName",Sb),Tb.prototype=new Sb,Tb.prototype.builtInKind=j.ENTITY_DT,Tb.cast=function(a){return new Tb(Ac(a))},g("ENTITY",Tb),Ub.prototype=new Sb,Ub.prototype.builtInKind=j.ID_DT,Ub.cast=function(a){return new Ub(Ac(a))},g("ID",Ub),Vb.prototype=new Sb,Vb.prototype.builtInKind=j.IDREF_DT,Vb.cast=function(a){return new Vb(Ac(a))},g("IDREF",Vb),Wb.prototype=new Qb,Wb.prototype.builtInKind=j.LANGUAGE_DT,Wb.cast=function(a){return new Wb(Ac(a))},g("language",Wb),Xb.prototype=new Qb,Xb.prototype.builtInKind=j.NMTOKEN_DT,Xb.cast=function(a){return new Xb(Ac(a))},g("NMTOKEN",Xb),Zb.prototype=new Yb,$b.prototype=new Zb,_b.prototype=new Zb,ac.prototype=new Zb,bc.prototype=new Zb,cc.prototype=new Zb,dc.prototype=new Zb,$c["hexBinary-equal"]=function(a,b){return new Xa(a.valueOf()==b.valueOf())},$c["base64Binary-equal"]=function(a,b){return new Xa(a.valueOf()==b.valueOf())},$c["boolean-equal"]=function(a,b){return new Xa(a.valueOf()==b.valueOf())},$c["boolean-less-than"]=function(a,b){return new Xa(a.valueOf()b.valueOf())},$c["yearMonthDuration-less-than"]=function(a,b){return new Xa(lc(a)lc(b))},$c["dayTimeDuration-less-than"]=function(a,b){return new Xa(jc(a)jc(b))},$c["duration-equal"]=function(a,b){return new Xa(a.negative==b.negative&&lc(a)==lc(b)&&jc(a)==jc(b))},$c["dateTime-equal"]=function(a,b){return gc(a,b,"eq")},$c["dateTime-less-than"]=function(a,b){return gc(a,b,"lt")},$c["dateTime-greater-than"]=function(a,b){return gc(a,b,"gt")},$c["date-equal"]=function(a,b){return fc(a,b,"eq")},$c["date-less-than"]=function(a,b){return fc(a,b,"lt")},$c["date-greater-than"]=function(a,b){return fc(a,b,"gt")},$c["time-equal"]=function(a,b){return ec(a,b,"eq")},$c["time-less-than"]=function(a,b){return ec(a,b,"lt")},$c["time-greater-than"]=function(a,b){return ec(a,b,"gt")},$c["gYearMonth-equal"]=function(a,b){return gc(new _a(a.year,a.month,Za(a.year,a.month),0,0,0,null==a.timezone?this.timezone:a.timezone),new _a(b.year,b.month,Za(b.year,b.month),0,0,0,null==b.timezone?this.timezone:b.timezone),"eq")},$c["gYear-equal"]=function(a,b){return gc(new _a(a.year,1,1,0,0,0,null==a.timezone?this.timezone:a.timezone),new _a(b.year,1,1,0,0,0,null==b.timezone?this.timezone:b.timezone),"eq")},$c["gMonthDay-equal"]=function(a,b){return gc(new _a(1972,a.month,a.day,0,0,0,null==a.timezone?this.timezone:a.timezone),new _a(1972,b.month,b.day,0,0,0,null==b.timezone?this.timezone:b.timezone),"eq")},$c["gMonth-equal"]=function(a,b){return gc(new _a(1972,a.month,Za(1972,b.month),0,0,0,null==a.timezone?this.timezone:a.timezone),new _a(1972,b.month,Za(1972,b.month),0,0,0,null==b.timezone?this.timezone:b.timezone),"eq")},$c["gDay-equal"]=function(a,b){return gc(new _a(1972,12,a.day,0,0,0,null==a.timezone?this.timezone:a.timezone),new _a(1972,12,b.day,0,0,0,null==b.timezone?this.timezone:b.timezone),"eq")},$c["add-yearMonthDurations"]=function(a,b){return mc(lc(a)+lc(b))},$c["subtract-yearMonthDurations"]=function(a,b){return mc(lc(a)-lc(b))},$c["multiply-yearMonthDuration"]=function(a,b){return mc(lc(a)*b)},$c["divide-yearMonthDuration"]=function(a,b){return mc(lc(a)/b)},$c["divide-yearMonthDuration-by-yearMonthDuration"]=function(a,b){return new fb(lc(a)/lc(b))},$c["add-dayTimeDurations"]=function(a,b){return kc(jc(a)+jc(b))},$c["subtract-dayTimeDurations"]=function(a,b){return kc(jc(a)-jc(b))},$c["multiply-dayTimeDuration"]=function(a,b){return kc(jc(a)*b)},$c["divide-dayTimeDuration"]=function(a,b){return kc(jc(a)/b)},$c["divide-dayTimeDuration-by-dayTimeDuration"]=function(a,b){return new fb(jc(a)/jc(b))},$c["subtract-dateTimes"]=function(a,b){return kc(oc(a)-oc(b))},$c["subtract-dates"]=function(a,b){return kc(oc(a)-oc(b))},$c["subtract-times"]=function(a,b){return kc(nc(a)-nc(b))},$c["add-yearMonthDuration-to-dateTime"]=function(a,b){return hc(a,b,"+")},$c["add-dayTimeDuration-to-dateTime"]=function(a,b){return ic(a,b,"+")},$c["subtract-yearMonthDuration-from-dateTime"]=function(a,b){return hc(a,b,"-")},$c["subtract-dayTimeDuration-from-dateTime"]=function(a,b){return ic(a,b,"-")},$c["add-yearMonthDuration-to-date"]=function(a,b){return hc(a,b,"+")},$c["add-dayTimeDuration-to-date"]=function(a,b){return ic(a,b,"+")},$c["subtract-yearMonthDuration-from-date"]=function(a,b){return hc(a,b,"-")},$c["subtract-dayTimeDuration-from-date"]=function(a,b){return ic(a,b,"-")},$c["add-dayTimeDuration-to-time"]=function(a,b){var c=new vb(a.hours,a.minutes,a.seconds,a.timezone);return c.hours+=b.hours,c.minutes+=b.minutes,c.seconds+=b.seconds,wb(c)},$c["subtract-dayTimeDuration-from-time"]=function(a,b){var c=new vb(a.hours,a.minutes,a.seconds,a.timezone);return c.hours-=b.hours,c.minutes-=b.minutes,c.seconds-=b.seconds,wb(c)},$c["is-same-node"]=function(a,b){return new Xa(this.DOMAdapter.isSameNode(a,b))},$c["node-before"]=function(a,b){return new Xa(!!(4&this.DOMAdapter.compareDocumentPosition(a,b)))},$c["node-after"]=function(a,b){return new Xa(!!(2&this.DOMAdapter.compareDocumentPosition(a,b)))},$c["numeric-add"]=function(a,b){var c=a.valueOf(),d=b.valueOf(),e=Gc.pow(10,pc(c,d));return qc(a,b,(c*e+d*e)/e)},$c["numeric-subtract"]=function(a,b){var c=a.valueOf(),d=b.valueOf(),e=Gc.pow(10,pc(c,d));return qc(a,b,(c*e-d*e)/e)},$c["numeric-multiply"]=function(a,b){var c=a.valueOf(),d=b.valueOf(),e=Gc.pow(10,pc(c,d));return qc(a,b,c*e*(d*e)/(e*e))},$c["numeric-divide"]=function(a,b){var c=a.valueOf(),d=b.valueOf(),e=Gc.pow(10,pc(c,d));return qc(a,b,a*e/(b*e))},$c["numeric-integer-divide"]=function(a,b){var c=a/b;return new Cb(Gc.floor(c)+(c<0))},$c["numeric-mod"]=function(a,b){var c=a.valueOf(),d=b.valueOf(),e=Gc.pow(10,pc(c,d));return qc(a,b,c*e%(d*e)/e)},$c["numeric-unary-plus"]=function(a){return a},$c["numeric-unary-minus"]=function(a){return a.value*=-1,a},$c["numeric-equal"]=function(a,b){return new Xa(a.valueOf()==b.valueOf())},$c["numeric-less-than"]=function(a,b){return new Xa(a.valueOf()b.valueOf())},$c["QName-equal"]=function(a,b){return new Xa(a.localName==b.localName&&a.namespaceURI==b.namespaceURI)},$c.concatenate=function(a,b){return a.concat(b)},$c.union=function(b,c){for(var d,e=[],f=0,g=b.length;fh?g.pop():(g.push(f[i]),h++):"."!=f[i]&&g.push(f[i]);".."!=f[--i]&&"."!=f[i]||g.push(""),d.path=g.join("/")}return d}),f("true",[],function(){return new Xa(!0)}),f("false",[],function(){return new Xa(!1)}),f("not",[[Yb,"*"]],function(a){return new Xa(!uc(a,this))}),f("position",[],function(){return new Cb(this.position)}),f("last",[],function(){return new Cb(this.size)}),f("current-dateTime",[],function(){return this.dateTime}),f("current-date",[],function(){return Ya.cast(this.dateTime)}),f("current-time",[],function(){return vb.cast(this.dateTime)}),f("implicit-timezone",[],function(){return this.timezone}),f("default-collation",[],function(){return new ub(this.staticContext.defaultCollationName)}),f("static-base-uri",[],function(){return Va.cast(new ub(this.staticContext.baseURI||""))}),f("years-from-duration",[[hb,"?"]],function(a){return rc(a,"year")}),f("months-from-duration",[[hb,"?"]],function(a){return rc(a,"month")}),f("days-from-duration",[[hb,"?"]],function(a){return rc(a,"day")}),f("hours-from-duration",[[hb,"?"]],function(a){return rc(a,"hours")}),f("minutes-from-duration",[[hb,"?"]],function(a){return rc(a,"minutes")}),f("seconds-from-duration",[[hb,"?"]],function(a){return rc(a,"seconds")}),f("year-from-dateTime",[[_a,"?"]],function(a){return sc(a,"year")}),f("month-from-dateTime",[[_a,"?"]],function(a){return sc(a,"month")}),f("day-from-dateTime",[[_a,"?"]],function(a){return sc(a,"day")}),f("hours-from-dateTime",[[_a,"?"]],function(a){return sc(a,"hours")}),f("minutes-from-dateTime",[[_a,"?"]],function(a){return sc(a,"minutes")}),f("seconds-from-dateTime",[[_a,"?"]],function(a){return sc(a,"seconds")}),f("timezone-from-dateTime",[[_a,"?"]],function(a){return sc(a,"timezone")}),f("year-from-date",[[Ya,"?"]],function(a){return sc(a,"year")}),f("month-from-date",[[Ya,"?"]],function(a){return sc(a,"month")}),f("day-from-date",[[Ya,"?"]],function(a){return sc(a,"day")}),f("timezone-from-date",[[Ya,"?"]],function(a){return sc(a,"timezone")}),f("hours-from-time",[[vb,"?"]],function(a){return sc(a,"hours")}),f("minutes-from-time",[[vb,"?"]],function(a){return sc(a,"minutes")}),f("seconds-from-time",[[vb,"?"]],function(a){return sc(a,"seconds")}),f("timezone-from-time",[[vb,"?"]],function(a){return sc(a,"timezone")}),f("adjust-dateTime-to-timezone",[[_a,"?"],[Ab,"?",!0]],function(a,b){return tc(a,arguments.length>1&&null!=b?arguments.length>1?b:this.timezone:null)});f("adjust-date-to-timezone",[[Ya,"?"],[Ab,"?",!0]],function(a,b){return tc(a,arguments.length>1&&null!=b?arguments.length>1?b:this.timezone:null)});f("adjust-time-to-timezone",[[vb,"?"],[Ab,"?",!0]],function(a,b){return tc(a,arguments.length>1&&null!=b?arguments.length>1?b:this.timezone:null)}),f("name",[[Zb,"?",!0]],function(b){if(arguments.length){if(null==b)return new ub("")}else{if(!this.DOMAdapter.isNode(this.item))throw new a("XPTY0004");b=this.item}var c=Xc["node-name"].call(this,b);return new ub(null==c?"":c.toString())}),f("local-name",[[Zb,"?",!0]],function(b){if(arguments.length){if(null==b)return new ub("")}else{if(!this.DOMAdapter.isNode(this.item))throw new a("XPTY0004");b=this.item}return new ub(this.DOMAdapter.getProperty(b,"localName")||"")}),f("namespace-uri",[[Zb,"?",!0]],function(b){if(arguments.length){if(null==b)return Va.cast(new ub(""))}else{if(!this.DOMAdapter.isNode(this.item))throw new a("XPTY0004");b=this.item}return Va.cast(new ub(this.DOMAdapter.getProperty(b,"namespaceURI")||""))}),f("number",[[Ta,"?",!0]],function(b){if(!arguments.length){if(!this.item)throw new a("XPDY0002");b=vc([this.item],this)[0]}var c=new gb(Kc);if(null!=b)try{c=gb.cast(b)}catch(a){}return c}),f("lang",[[ub,"?"],[Zb,"",!0]],function(b,c){if(arguments.length<2){if(!this.DOMAdapter.isNode(this.item))throw new a("XPTY0004");c=this.item}var d=this.DOMAdapter.getProperty;2==d(c,"nodeType")&&(c=d(c,"ownerElement"));for(var e;c;c=d(c,"parentNode"))if(e=d(c,"attributes"))for(var f=0,g=e.length;f1?b.valueOf():0;if(c<0){var d=new Cb(Gc.pow(10,-c)),e=Gc.round($c["numeric-divide"].call(this,a,d)),f=new Cb(e);return nDecimal=Gc.abs($c["numeric-subtract"].call(this,f,$c["numeric-divide"].call(this,a,d))),$c["numeric-multiply"].call(this,$c["numeric-add"].call(this,f,new fb(.5==nDecimal&&e%2?-1:0)),d)}var d=new Cb(Gc.pow(10,c)),e=Gc.round($c["numeric-multiply"].call(this,a,d)),f=new Cb(e);return nDecimal=Gc.abs($c["numeric-subtract"].call(this,f,$c["numeric-multiply"].call(this,a,d))),$c["numeric-divide"].call(this,$c["numeric-add"].call(this,f,new fb(.5==nDecimal&&e%2?-1:0)),d)}),f("resolve-QName",[[ub,"?"],[bc]],function(b,c){if(null==b)return null;var d=b.valueOf(),e=d.match(Bd);if(!e)throw new a("FOCA0002");var f=e[1]||null,g=e[2],h=this.DOMAdapter.lookupNamespaceURI(c,f);if(null!=f&&!h)throw new a("FONS0004");return new tb(f,g,h||null)}),f("QName",[[ub,"?"],[ub]],function(b,c){var d=c.valueOf(),e=d.match(Bd);if(!e)throw new a("FOCA0002");return new tb(e[1]||null,e[2]||null,null==b?"":b.valueOf())}),f("prefix-from-QName",[[tb,"?"]],function(a){return null!=a&&a.prefix?new Sb(a.prefix):null}),f("local-name-from-QName",[[tb,"?"]],function(a){return null==a?null:new Sb(a.localName)}),f("namespace-uri-from-QName",[[tb,"?"]],function(a){return null==a?null:Va.cast(new ub(a.namespaceURI||""))}),f("namespace-uri-for-prefix",[[ub,"?"],[bc]],function(a,b){var c=null==a?"":a.valueOf(),d=this.DOMAdapter.lookupNamespaceURI(b,c||null);return null==d?null:Va.cast(new ub(d))}),f("in-scope-prefixes",[[bc]],function(a){throw"Function 'in-scope-prefixes' not implemented"}),f("boolean",[[Yb,"*"]],function(a){return new Xa(uc(a,this))}),f("index-of",[[Ta,"*"],[Ta],[ub,"",!0]],function(a,b,c){if(!a.length||null==b)return[];var d=b;d instanceof xb&&(d=ub.cast(d));for(var e,f=[],g=0,h=a.length;g1)throw"Collation parameter in function 'distinct-values' is not implemented";if(!a.length)return null;for(var c,d=[],e=0,f=a.length;ed&&(e=d+1);for(var f=[],g=0;gc)return a;for(var e=[],f=0;f2?Gc.round(c):a.length-d+1;return a.slice(d-1,d-1+e)}),f("unordered",[[Yb,"*"]],function(a){return a}),f("zero-or-one",[[Yb,"*"]],function(b){if(b.length>1)throw new a("FORG0003");return b}),f("one-or-more",[[Yb,"*"]],function(b){if(!b.length)throw new a("FORG0004");return b}),f("exactly-one",[[Yb,"*"]],function(b){if(1!=b.length)throw new a("FORG0005");return b}),f("deep-equal",[[Yb,"*"],[Yb,"*"],[ub,"",!0]],function(a,b,c){throw"Function 'deep-equal' not implemented"}),f("count",[[Yb,"*"]],function(a){return new Cb(a.length)}),f("avg",[[Ta,"*"]],function(b){if(!b.length)return null;try{var c=b[0];c instanceof xb&&(c=gb.cast(c));for(var d,e=1,f=b.length;e1?c:new gb(0);try{var d=b[0];d instanceof xb&&(d=gb.cast(d));for(var e,f=1,g=b.length;f2&&(f=d.valueOf()),e=f==Sc+"/collation/codepoint"?Gd:this.staticContext.getCollation(f),!e)throw new a("FOCH0002");return new Cb(e.compare(b.valueOf(),c.valueOf()))}),f("codepoint-equal",[[ub,"?"],[ub,"?"]],function(a,b){return null==a||null==b?null:new Xa(a.valueOf()==b.valueOf())}),f("concat",null,function(){if(arguments.length<2)throw new a("XPST0017");for(var b,c=[],d=0,e=arguments.length;d2?e+Gc.round(c):d.length;return new ub(f>e?d.substring(e,f):"")}),f("string-length",[[ub,"?",!0]],function(b){if(!arguments.length){if(!this.item)throw new a("XPDY0002");b=ub.cast(vc([this.item],this)[0])}return new Cb(null==b?0:b.valueOf().length)}),f("normalize-space",[[ub,"?",!0]],function(b){if(!arguments.length){if(!this.item)throw new a("XPDY0002");b=ub.cast(vc([this.item],this)[0])}return new ub(null==b?"":Pc(b).replace(/\s\s+/g," "))}),f("normalize-unicode",[[ub,"?"],[ub,"",!0]],function(a,b){throw"Function 'normalize-unicode' not implemented"}),f("upper-case",[[ub,"?"]],function(a){return new ub(null==a?"":a.valueOf().toUpperCase())}),f("lower-case",[[ub,"?"]],function(a){return new ub(null==a?"":a.valueOf().toLowerCase())}),f("translate",[[ub,"?"],[ub],[ub]],function(a,b,c){if(null==a)return new ub("");for(var d,e=a.valueOf().split(""),f=b.valueOf().split(""),g=c.valueOf().split(""),h=g.length,i=[],j=0,k=e.length;j126)&&(c[d]=window.encodeURIComponent(c[d]));return new ub(c.join(""))}),f("contains",[[ub,"?"],[ub,"?"],[ub,"",!0]],function(a,b,c){if(arguments.length>2)throw"Collation parameter in function 'contains' is not implemented";return new Xa((null==a?"":a.valueOf()).indexOf(null==b?"":b.valueOf())>=0)}),f("starts-with",[[ub,"?"],[ub,"?"],[ub,"",!0]],function(a,b,c){if(arguments.length>2)throw"Collation parameter in function 'starts-with' is not implemented";return new Xa(0==(null==a?"":a.valueOf()).indexOf(null==b?"":b.valueOf()))}),f("ends-with",[[ub,"?"],[ub,"?"],[ub,"",!0]],function(a,b,c){if(arguments.length>2)throw"Collation parameter in function 'ends-with' is not implemented";var d=null==a?"":a.valueOf(),e=null==b?"":b.valueOf();return new Xa(d.indexOf(e)==d.length-e.length)}),f("substring-before",[[ub,"?"],[ub,"?"],[ub,"",!0]],function(a,b,c){if(arguments.length>2)throw"Collation parameter in function 'substring-before' is not implemented";var d,e=null==a?"":a.valueOf(),f=null==b?"":b.valueOf();return new ub((d=e.indexOf(f))>=0?e.substring(0,d):"")}),f("substring-after",[[ub,"?"],[ub,"?"],[ub,"",!0]],function(a,b,c){if(arguments.length>2)throw"Collation parameter in function 'substring-after' is not implemented";var d,e=null==a?"":a.valueOf(),f=null==b?"":b.valueOf();return new ub((d=e.indexOf(f))>=0?e.substring(d+f.length):"")}),f("matches",[[ub,"?"],[ub],[ub,"",!0]],function(a,b,c){var d=null==a?"":a.valueOf(),e=xc(b.valueOf(),arguments.length>2?c.valueOf():"");return new Xa(e.test(d))}),f("replace",[[ub,"?"],[ub],[ub],[ub,"",!0]],function(a,b,c,d){var e=null==a?"":a.valueOf(),f=xc(b.valueOf(),arguments.length>3?d.valueOf():"");return new Xa(e.replace(f,c.valueOf()))}),f("tokenize",[[ub,"?"],[ub],[ub,"",!0]],function(a,b,c){for(var d=null==a?"":a.valueOf(),e=xc(b.valueOf(),arguments.length>2?c.valueOf():""),f=[],g=0,h=d.split(e),i=h.length;gb?1:-1},yc.prototype=new c;var Hd=new e;yc.prototype.getProperty=function(a,b){if(b in a)return a[b];if("baseURI"==b){for(var c,d="",e=Hd.getFunction("{http://www.w3.org/2005/xpath-functions}resolve-uri"),f=Hd.getDataType("{http://www.w3.org/2001/XMLSchema}string"),g=a;g;g=g.parentNode)1==g.nodeType&&(c=g.getAttribute("xml:base"))&&(d=e(new f(c),new f(d)).toString());return d}if("textContent"==b){var h=[];return function(a){for(var b,c=0;b=a.childNodes[c];c++)3==b.nodeType||4==b.nodeType?h.push(b.data):1==b.nodeType&&b.firstChild&&arguments.callee(b)}(a),h.join("")}},yc.prototype.compareDocumentPosition=function(a,b){if("compareDocumentPosition"in a)return a.compareDocumentPosition(b);if(b==a)return 0;var c,d,e,f,g,h=null,i=null;if(2==a.nodeType&&(h=a,a=this.getProperty(h,"ownerElement")),2==b.nodeType&&(i=b,b=this.getProperty(i,"ownerElement")),h&&i&&a&&a==b)for(f=0,c=this.getProperty(a,"attributes"),g=c.length;fMath.round(a.width/50))&&(e=Math.round(a.width/50)),(!f||f>Math.round(a.width/50))&&(f=Math.round(a.height/50));var h=a.getContext("2d"),i=.08*a.width,j=.03*a.width,k=.08*a.height,l=.15*a.height,m=a.height-k-l,n=a.width-i-j,o=k+m,p=k;h.font=g+"px Arial",h.lineWidth="1.0",h.strokeStyle="#444",CanvasComponents.draw_line(h,i,o,n+i,o),CanvasComponents.draw_line(h,i,o,i,p);var q=.003*n,r=(n-q*b.length)/b.length,s=i+q,t=Math.max.apply(Math,b);h.fillStyle="green";for(var u=0;u=b.length)for(var u=0;u<=b.length;u++)h.fillText(u,s,o+.3*l),s+=r+q;else for(var u=0;u<=e;u++){var w=Math.ceil(b.length/e*u);s=n/e*u+i,h.fillText(w,s,o+.3*l)}h.textAlign="right";var x;if(f>=t)for(var u=0;u<=t;u++)x=o-u/t*m+g/3,h.fillText(u,.8*i,x);else for(var u=0;u<=f;u++){var w=Math.ceil(t/f*u);x=o-w/t*m+g/3,h.fillText(w,.8*i,x)}if(c&&(h.textAlign="center",h.fillText(c,n/2+i,o+.8*l)),d){h.save();var y=.3*i,z=m/2+k;h.translate(y,z),h.rotate(-Math.PI/2),h.textAlign="center",h.fillText(d,0,0),h.restore()}},draw_scale_bar:function(a,b,c,d){var e=a.getContext("2d"),f=.01*a.width,g=.01*a.width,h=.1*a.height,i=.3*a.height,j=a.height-h-i,k=a.width-f-g,l=b/c;e.strokeRect(f,h,k,j);var m=e.createLinearGradient(f,0,k+f,0);m.addColorStop(0,"green"),m.addColorStop(.5,"gold"),m.addColorStop(1,"red"),e.fillStyle=m,e.fillRect(f,h,k*l,j);var n,o,p,q;e.fillStyle="black",e.textAlign="center",e.font="13px Arial";for(var r=0;r=.9*c?(e.textAlign="right",n=p):d[r].max<=.1*c?e.textAlign="left":n+=(p-n)/2,o=h+j+.8*i,e.fillText(d[r].label,n,o)}},Utils={chr:function(a){return String.fromCharCode(a)},ord:function(a){return a.charCodeAt(0)},pad_left:function(a,b,c){c=c||"0";var d=c.length-(b-a.length);return d=d<0?0:d,a.lengthb&&(a=a.slice(0,b-c.length)+c),a},hex:function(a,b){return a="string"==typeof a?Utils.ord(a):a,b=b||2,Utils.pad(a.toString(16),b)},bin:function(a,b){return a="string"==typeof a?Utils.ord(a):a,b=b||8,Utils.pad(a.toString(2),b)},printable:function(a,b){window&&window.app&&!window.app.options.treat_as_utf8&&(a=Utils.byte_array_to_chars(Utils.str_to_byte_array(a)));var c=/[\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-\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,d=/[\x09-\x10\x0D\u2028\u2029]/g;return a=a.replace(c,"."),b||(a=a.replace(d,".")),a},parse_escaped_chars:function(a){return a.replace(/(\\)?\\([nrtbf]|x[\da-f]{2})/g,function(a,b,c){if("\\"===b)return"\\"+c;switch(c[0]){case"n":return"\n";case"r":return"\r";case"t":return"\t";case"b":return"\b";case"f":return"\f";case"x":return Utils.chr(parseInt(c.substr(1),16))}})},expand_alph_range:function(a){for(var b=[],c=0;c255)return Utils.str_to_utf8_byte_array(a);return c},str_to_utf8_byte_array:function(a){var b=CryptoJS.enc.Utf8.parse(a),c=Utils.word_array_to_byte_array(b);return a.length!==b.sigBytes&&(window.app.options.attempt_highlight=!1),c},str_to_charcode:function(a){for(var b=new Array(a.length),c=a.length;c--;)b[c]=a.charCodeAt(c);return b},byte_array_to_utf8:function(a){try{for(var b=[],c=0;c>>2]|=a[c]<<24-c%4*8;var d=new CryptoJS.lib.WordArray.init(b,a.length),e=CryptoJS.enc.Utf8.stringify(d);return e.length!==d.sigBytes&&(window.app.options.attempt_highlight=!1),e}catch(b){return Utils.byte_array_to_chars(a)}},byte_array_to_chars:function(a){if(!a)return"";for(var b="",c=0;c>>2]>>>24-d%4*8&255);return c},UNIC_WIN1251_MAP:{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,14:14,15:15,16:16,17:17,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,28:28,29:29,30:30,31:31,32:32,33:33,34:34,35:35,36:36,37:37,38:38,39:39,40:40,41:41,42:42,43:43,44:44,45:45,46:46,47:47,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,58:58,59:59,60:60,61:61,62:62,63:63,64:64,65:65,66:66,67:67,68:68,69:69,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,82:82,83:83,84:84,85:85,86:86,87:87,88:88,89:89,90:90,91:91,92:92,93:93,94:94,95:95,96:96,97:97,98:98,99:99,100:100,101:101,102:102,103:103,104:104,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,125:125,126:126,127:127,1027:129,8225:135,1046:198,8222:132,1047:199,1168:165,1048:200,1113:154,1049:201,1045:197,1050:202,1028:170,160:160,1040:192,1051:203,164:164,166:166,167:167,169:169,171:171,172:172,173:173,174:174,1053:205,176:176,177:177,1114:156,181:181,182:182,183:183,8221:148,187:187,1029:189,1056:208,1057:209,1058:210,8364:136,1112:188,1115:158,1059:211,1060:212,1030:178,1061:213,1062:214,1063:215,1116:157,1064:216,1065:217,1031:175,1066:218,1067:219,1068:220,1069:221,1070:222,1032:163,8226:149,1071:223,1072:224,8482:153,1073:225,8240:137,1118:162,1074:226,1110:179,8230:133,1075:227,1033:138,1076:228,1077:229,8211:150,1078:230,1119:159,1079:231,1042:194,1080:232,1034:140,1025:168,1081:233,1082:234,8212:151,1083:235,1169:180,1084:236,1052:204,1085:237,1035:142,1086:238,1087:239,1088:240,1089:241,1090:242,1036:141,1041:193,1091:243,1092:244,8224:134,1093:245,8470:185,1094:246,1054:206,1095:247,1096:248,8249:139,1097:249,1098:250,1044:196,1099:251,1111:191,1055:207,1100:252,1038:161,8220:147,1101:253,8250:155,1102:254,8216:145,1103:255,1043:195,1105:184,1039:143,1026:128,1106:144,8218:130,1107:131,8217:146,1108:186,1109:190},WIN1251_UNIC_MAP:{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,14:14,15:15,16:16,17:17,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,28:28,29:29,30:30,31:31,32:32,33:33,34:34,35:35,36:36,37:37,38:38,39:39,40:40,41:41,42:42,43:43,44:44,45:45,46:46,47:47,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,58:58,59:59,60:60,61:61,62:62,63:63,64:64,65:65,66:66,67:67,68:68,69:69,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,82:82,83:83,84:84,85:85,86:86,87:87,88:88,89:89,90:90,91:91,92:92,93:93,94:94,95:95,96:96,97:97,98:98,99:99,100:100,101:101,102:102,103:103,104:104,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,125:125,126:126,127:127,160:160,164:164,166:166,167:167,169:169,171:171,172:172,173:173,174:174,176:176,177:177,181:181,182:182,183:183,187:187,168:1025,128:1026,129:1027,170:1028,189:1029,178:1030,175:1031,163:1032,138:1033,140:1034,142:1035,141:1036,161:1038,143:1039,192:1040,193:1041,194:1042,195:1043,196:1044,197:1045,198:1046,199:1047,200:1048,201:1049,202:1050,203:1051,204:1052,205:1053,206:1054,207:1055,208:1056,209:1057,210:1058,211:1059,212:1060,213:1061,214:1062,215:1063,216:1064,217:1065,218:1066,219:1067,220:1068,221:1069,222:1070,223:1071,224:1072,225:1073,226:1074,227:1075,228:1076,229:1077,230:1078,231:1079,232:1080,233:1081,234:1082,235:1083,236:1084,237:1085,238:1086,239:1087,240:1088,241:1089,242:1090,243:1091,244:1092,245:1093,246:1094,247:1095,248:1096,249:1097,250:1098,251:1099,252:1100,253:1101,254:1102,255:1103,184:1105,144:1106,131:1107,186:1108,190:1109,179:1110,191:1111,188:1112,154:1113,156:1114,158:1115,157:1116,162:1118,159:1119,165:1168,180:1169,150:8211,151:8212,145:8216,146:8217,130:8218,147:8220,148:8221,132:8222,134:8224,135:8225,149:8226,133:8230,137:8240,139:8249,155:8250,136:8364,185:8470,153:8482},unicode_to_win1251:function(a){for(var b=[],c=0;c>2,g=(3&c)<<4|d>>4,h=(15&d)<<2|e>>6,i=63&e,isNaN(d)?h=i=64:isNaN(e)&&(i=64),j+=b.charAt(f)+b.charAt(g)+b.charAt(h)+b.charAt(i);return j},from_base64:function(a,b,c,d){if(c=c||"string",!a)return"string"===c?"":[];b=b?Utils.expand_alph_range(b).join(""):"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",void 0===d&&(d=!0);var e,f,g,h,i,j,k,l=[],m=0;if(d){var n=new RegExp("[^"+b.replace(/[\[\]\\\-^$]/g,"\\$&")+"]","g");a=a.replace(n,"")}for(;m>4,f=(15&i)<<4|j>>2,g=(3&j)<<6|k,l.push(e),64!==j&&l.push(f),64!==k&&l.push(g);return"string"===c?Utils.byte_array_to_utf8(l):l},to_hex:function(a,b,c){if(!a)return"";b="string"==typeof b?b:" ",c=c||2;for(var d="",e=0;e>>4).toString(16)),b.push((15&a[c]).toString(16));return b.join("")},from_hex:function(a,b,c){if(b=b||(a.indexOf(" ")>=0?"Space":"None"),c=c||2,"None"!==b){var d=Utils.regex_rep[b];a=a.replace(d,"")}for(var e=[],f=0;f]*>.*<\/(script|style)>/gim,"")),a.replace(/<[^>\n]+>/g,"")},escape_html:function(a){return a.replace(/>>3]|=parseInt(a.substr(d,2),16)<<24-d%8*4;return new CryptoJS.lib.WordArray.init(c,b/2)};var Base={DEFAULT_RADIX:36,run_to:function(a,b){if(!a)throw"Error: Input must be a number";var c=b[0]||Base.DEFAULT_RADIX;if(c<2||c>36)throw"Error: Radix argument must be between 2 and 36";return a.toString(c)},run_from:function(a,b){var c=b[0]||Base.DEFAULT_RADIX;if(c<2||c>36)throw"Error: Radix argument must be between 2 and 36";return parseInt(a.replace(/\s/g,""),c)}},Base64={ALPHABET:"A-Za-z0-9+/=",ALPHABET_OPTIONS:[{name:"Standard: A-Za-z0-9+/=",value:"A-Za-z0-9+/="},{name:"URL safe: 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: 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+/="}],run_to:function(a,b){var c=b[0]||Base64.ALPHABET;return Utils.to_base64(a,c)},REMOVE_NON_ALPH_CHARS:!0,run_from:function(a,b){var c=b[0]||Base64.ALPHABET,d=b[1];return Utils.from_base64(a,c,"byte_array",d)},BASE32_ALPHABET:"A-Z2-7=",run_to_32:function(a,b){if(!a)return"";for(var c,d,e,f,g,h,i,j,k,l,m,n,o,p=b[0]?Utils.expand_alph_range(b[0]).join(""):"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",q="",r=0;r>3,i=(7&c)<<2|d>>6,j=d>>1&31,k=(1&d)<<4|e>>4,l=(15&e)<<1|f>>7,m=f>>2&63,n=(3&f)<<3|g>>5,o=31&g,isNaN(d)?j=k=l=m=n=o=32:isNaN(e)?l=m=n=o=32:isNaN(f)?m=n=o=32:isNaN(g)&&(o=32),q+=p.charAt(h)+p.charAt(i)+p.charAt(j)+p.charAt(k)+p.charAt(l)+p.charAt(m)+p.charAt(n)+p.charAt(o);return q},run_from_32:function(a,b){if(!a)return[];var c,d,e,f,g,h,i,j,k,l,m,n,o,p=b[0]?Utils.expand_alph_range(b[0]).join(""):"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",q=b[0],r=[],s=0;if(q){var t=new RegExp("[^"+p.replace(/[\]\\\-^]/g,"\\$&")+"]","g");a=a.replace(t,"")}for(;s>2,d=(3&i)<<6|j<<1|k>>4,e=(15&k)<<4|l>>1,f=(1&l)<<7|m<<2|n>>3,g=(7&n)<<5|o,r.push(c),(i&!0||32!==j)&&r.push(d),(k&!0||32!==l)&&r.push(e),(l&!0||32!==m)&&r.push(f),(n&!0||32!==o)&&r.push(g);return r},SHOW_IN_BINARY:!1,OFFSETS_SHOW_VARIABLE:!0,run_offsets:function(a,b){var c=b[0]||Base64.ALPHABET,d=b[1],e=Utils.to_base64(a,c),f=Utils.to_base64([0].concat(a),c),g=Utils.to_base64([0,0].concat(a),c),h=e.indexOf("="),i=f.indexOf("="),j=g.indexOf("="),k="
                                                                                                                                                      Operations
                                                                                                                                                        Recipe
                                                                                                                                                          Input
                                                                                                                                                          Output
                                                                                                                                                          Operations
                                                                                                                                                            Recipe
                                                                                                                                                              Input
                                                                                                                                                              Output
                                                                                                                                                              \ No newline at end of file +document.querySelector("link[rel=icon]").setAttribute("href","data:image/png;base64,"+a),document.querySelector("#bake img").setAttribute("src","data:image/png;base64,"+b),document.querySelector(".about-img-left").setAttribute("src","data:image/png;base64,"+c)},SeasonalWaiter.prototype.insert_spider_text=function(){document.title=document.title.replace(/Cyber/g,"Spider"),SeasonalWaiter.tree_walk(document.body,function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Cyber/g,"Spider"))},!0),SeasonalWaiter.tree_walk(document.getElementById("bake-group"),function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Bake/g,"Spin"))},!0),document.querySelector("#recipe .title").innerHTML="Web"},SeasonalWaiter.prototype.create_snow_option=function(){var a=document.getElementById("options-body"),b=document.createElement("div");b.className="option-item",b.innerHTML=" Let it snow",a.appendChild(b),this.manager.options.load()},SeasonalWaiter.prototype.let_it_snow=function(){if($(document).snowfall("clear"),this.app.options.snow){var a={},b=navigator.userAgent.match(/Firefox\/(\d\d?)/);a=b&&parseInt(b[1],10)<30?{flakeCount:10,flakeColor:"#fff",flakePosition:"absolute",minSize:1,maxSize:2,minSpeed:1,maxSpeed:5,round:!1,shadow:!1,collection:!1,collectionHeight:20,deviceorientation:!0}:{flakeCount:35,flakeColor:"#fff",flakePosition:"absolute",minSize:5,maxSize:8,minSpeed:1,maxSpeed:5,round:!0,shadow:!0,collection:".btn",collectionHeight:20,deviceorientation:!0},$(document).snowfall(a)}},SeasonalWaiter.prototype.shake_off_snow=function(a){for(var b=a.target,c=b.getBoundingClientRect(),d=document.querySelectorAll("canvas.snowfall-canvas"),e=null,f=function(){h.clearRect(0,0,e.width,e.height),$(this).fadeIn()},g=0;g6e4&&this.app.silent_bake()};var main=function(){var a=["To Base64","From Base64","To Hex","From Hex","To Hexdump","From Hexdump","URL Decode","Regular expression","Entropy","Fork"],b={update_url:!0,show_highlighter:!0,treat_as_utf8:!0,word_wrap:!0,show_errors:!0,error_timeout:4e3,auto_bake_threshold:200,attempt_highlight:!0,snow:!1};document.removeEventListener("DOMContentLoaded",main,!1),window.app=new HTMLApp(Categories,OperationConfig,a,b),window.app.setup()};window.console=console||{log:function(){},error:function(){}},window.compile_time=moment.tz("Tue Jan 31 2017 14:02:48","ddd MMM D YYYY HH:mm:ss","UTC").valueOf(),window.compile_message="",document.addEventListener("DOMContentLoaded",main,!1); \ No newline at end of file diff --git a/build/prod/images/fork_me.png b/build/prod/images/fork_me.png new file mode 100755 index 0000000000000000000000000000000000000000..6e0c3a7882e8eefbeee4746f4c1466283f244a84 GIT binary patch literal 7660 zcmV~Yt zXx`{%&^Ze@4V-HXL*mVy}g~ZOsCUX z@5;A+^8F$5{UP*K`f==(*yon$mrzZ84Q;F1M!sS*Cd{DEM16+NHJ_sokA7Hr^WB?| zQYBrseCd{a-Bw*~mdh+(?eazK&i+BdoSLqOpi-`(^zZb;(9qClA5MIj>aNz&M^zuu zrIt%R@#IDg8%1|U-pP+^|B3yT^d3D))pW@QSZaU?V0pm&-2M%Jq}-;1m?nOT#QzfPDG$n?t%37FOOsI{6Kz z6Hw_LrqbE`!xg6Tm#+YNnzBZQjQraD3HQ_aE9dExnosEZ?dv}ABqM?%C~R8a;j|)dMNDvda6V0=2{w%7FW(Br>I3)JZU-dwWuzAl9zK}2ao0w= z)pm>7!Ixa&kqbv?%GfD1FKV8i?xmL~$_lJu0$AR4e_Fx1whNT5Ve|xjYpQjFP7&6HbPKLj!%{iC?&Kfl5x7aFTTO?A0-$UkDY9 z)d!$z*KmQ#yVn*_w`|_+Hvp{tW&4dU?tGDhcVBXah^tCZmGUWd=9HOwT4OoG3SfEF z{b}W`luP+%4|U-RpNX9jYe4W0me_iDtIuTKhx-qw&qjZi8m=`^`Kj{imMtwJc<%%E z*CWQNK3;9yQnrQsbbg%W_7%H!>l&HrO_VSxftJo#8Xfpx;7fwByvtN>GgeS|kU>c| zY^&bJw_dS!C(l4OoKzP@F5>jZffENr@a{#Xa+|T5&o<}pJ++snkDpE{u_@H6Z}9dm zUK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+>A@D&02U?pQYN zWEZqkAbChhUAVsi<_gD0j<+`YVevS(CX)?R9sZc-AHQI#0mfL3ryKJ>J^3j`jEkUU z`elv)@?h*Fm}-zQmLdv*S|Jt)pp@b*6HGNg84IEyht3`1)xD3*f5cuCq_^J;f~f{J zV@;km*?^rjST_D~^~VBK!aM`4snJup(GTJqEDF+cQMf;0?zzJAC(h>=9V?+nIML`hl(1#;@fz6~R=(Ji=I*gkC*!HJxrc-O=bL zKqbswU`?Mnofine71}Kj5bjU7!k)Uqs$*3~^tr?AG)M(g33HdRf~N*s(+yB6_5@=I zrW)jo1yPVawR^Y?7)esWRKh&QSi>g`H$W!xe6zGb0Mguosf4-3Sl7;9V+~S_vOkvm z7%%u1OeM@Cj1>_RVSt1Ywn11$K?JCTxeKhYX<@8E3Q>^vE8g#Rtx&i>;R+pGVO?!q zK2CxmBSPqo$U6j63G*CdK@{YnIS*NDg;?n(m`a%23k1;U2etyZu!C7Jl`xMmR%k@1 zVbzRPbh`0$#{vNXDq-#dOFv!DQ##1FTNelj_b1F9S9r4OWd7TS-zNVd{w#7Pm`a$( z7;Eg5vE1DN#zN0Ki-HKI66RK;-?^6jeP{MjLRbQ=j$6&EPXtp5bCS!UnWA)Bu)R*io%#+%9(02y^KT zWw6*XkD2U6v&||_6rd8;BVehO*zFv#0F|)r0;}DYm9(NZ0V-kL1s18m)h?Jyn7hCt z6}Z%26QC027Pv?wu^~Vu%<~`<8FgVEHvuYP9ygsR2n!QTB}{-ym;jY9VFFabe9!)0 afB^viL;vDGZO9Y=0000 -CyberChef Edit
                                                                                                                                                              Operations
                                                                                                                                                                Recipe
                                                                                                                                                                  Input
                                                                                                                                                                  Output
                                                                                                                                                                  \ No newline at end of file +CyberChef Edit
                                                                                                                                                                  Operations
                                                                                                                                                                    Recipe
                                                                                                                                                                      Input
                                                                                                                                                                      Output
                                                                                                                                                                      \ No newline at end of file diff --git a/build/prod/scripts.js b/build/prod/scripts.js index fa4ac148..10796b9a 100755 --- a/build/prod/scripts.js +++ b/build/prod/scripts.js @@ -288,4 +288,4 @@ var l="";for(g=0;g
                                                                                                                                                                      Expects addresses in a list separated by newlines, spaces or commas.

                                                                                                                                                                      WARNING: There are no validity checks.",run:MAC.run_format,input_type:"string",output_type:"string",args:[{name:"Output case",type:"option",value:MAC.OUTPUT_CASE},{name:"No delimiter",type:"boolean",value:MAC.NO_DELIM},{name:"Dash delimiter",type:"boolean",value:MAC.DASH_DELIM},{name:"Colon delimiter",type:"boolean",value:MAC.COLON_DELIM},{name:"Cisco style",type:"boolean",value:MAC.CISCO_STYLE}]},"Offset checker":{description:"Compares multiple inputs (separated by the specified delimiter) and highlights matching characters which appear at the same position in all samples.",run:StrUtils.run_offset_checker,input_type:"string",output_type:"html",args:[{name:"Sample delimiter",type:"binary_string",value:StrUtils.OFF_CHK_SAMPLE_DELIMITER}]},"Remove whitespace":{description:"Optionally removes all spaces, carriage returns, line feeds, tabs and form feeds from the input data.

                                                                                                                                                                      This operation also supports the removal of full stops which are sometimes used to represent non-printable bytes in ASCII output.",run:Tidy.run_remove_whitespace,input_type:"string",output_type:"string",args:[{name:"Spaces",type:"boolean",value:Tidy.REMOVE_SPACES},{name:"Carriage returns (\\r)",type:"boolean",value:Tidy.REMOVE_CARIAGE_RETURNS},{name:"Line feeds (\\n)",type:"boolean",value:Tidy.REMOVE_LINE_FEEDS},{name:"Tabs",type:"boolean",value:Tidy.REMOVE_TABS},{name:"Form feeds (\\f)",type:"boolean",value:Tidy.REMOVE_FORM_FEEDS},{name:"Full stops",type:"boolean",value:Tidy.REMOVE_FULL_STOPS}]},"Remove null bytes":{description:"Removes all null bytes (0x00) from the input.",run:Tidy.run_remove_nulls,input_type:"byte_array",output_type:"byte_array",args:[]},"Drop bytes":{description:"Cuts the specified number of bytes out of the data.",run:Tidy.run_drop_bytes,input_type:"byte_array",output_type:"byte_array",args:[{name:"Start",type:"number",value:Tidy.DROP_START},{name:"Length",type:"number",value:Tidy.DROP_LENGTH},{name:"Apply to each line",type:"boolean",value:Tidy.APPLY_TO_EACH_LINE}]},"Take bytes":{description:"Takes a slice of the specified number of bytes from the data.",run:Tidy.run_take_bytes,input_type:"byte_array",output_type:"byte_array",args:[{name:"Start",type:"number",value:Tidy.TAKE_START},{name:"Length",type:"number",value:Tidy.TAKE_LENGTH},{name:"Apply to each line",type:"boolean",value:Tidy.APPLY_TO_EACH_LINE}]},"Pad lines":{description:"Add the specified number of the specified character to the beginning or end of each line",run:Tidy.run_pad,input_type:"string",output_type:"string",args:[{name:"Position",type:"option",value:Tidy.PAD_POSITION},{name:"Length",type:"number",value:Tidy.PAD_LENGTH},{name:"Character",type:"binary_short_string",value:Tidy.PAD_CHAR}]},Reverse:{description:"Reverses the input string.",run:SeqUtils.run_reverse,input_type:"byte_array",output_type:"byte_array",args:[{name:"By",type:"option",value:SeqUtils.REVERSE_BY}]},Sort:{description:"Alphabetically sorts strings separated by the specified delimiter.

                                                                                                                                                                      The IP address option supports IPv4 only.",run:SeqUtils.run_sort,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"option",value:SeqUtils.DELIMITER_OPTIONS},{name:"Reverse",type:"boolean",value:SeqUtils.SORT_REVERSE},{name:"Order",type:"option",value:SeqUtils.SORT_ORDER}]},Unique:{description:"Removes duplicate strings from the input.",run:SeqUtils.run_unique,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"option",value:SeqUtils.DELIMITER_OPTIONS}]},"Count occurrences":{description:"Counts the number of times the provided string occurs in the input.",run:SeqUtils.run_count,input_type:"string",output_type:"number",args:[{name:"Search string",type:"toggle_string",value:"",toggle_values:SeqUtils.SEARCH_TYPE}]},"Add line numbers":{description:"Adds line numbers to the output.",run:SeqUtils.run_add_line_numbers,input_type:"string",output_type:"string",args:[]},"Remove line numbers":{description:"Removes line numbers from the output if they can be trivially detected.",run:SeqUtils.run_remove_line_numbers,input_type:"string",output_type:"string",args:[]},"Find / Replace":{description:"Replaces all occurrences of the first string with the second.

                                                                                                                                                                      The three match options are only relevant to regex search strings.",run:StrUtils.run_find_replace,manual_bake:!0,input_type:"string",output_type:"string",args:[{name:"Find",type:"toggle_string",value:"",toggle_values:StrUtils.SEARCH_TYPE},{name:"Replace",type:"binary_string",value:""},{name:"Global match",type:"boolean",value:StrUtils.FIND_REPLACE_GLOBAL},{name:"Case insensitive",type:"boolean",value:StrUtils.FIND_REPLACE_CASE},{name:"Multiline matching",type:"boolean",value:StrUtils.FIND_REPLACE_MULTILINE}]},"To Upper case":{description:"Converts the input string to upper case, optionally limiting scope to only the first character in each word, sentence or paragraph.",run:StrUtils.run_upper,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[{name:"Scope",type:"option",value:StrUtils.CASE_SCOPE}]},"To Lower case":{description:"Converts every character in the input to lower case.",run:StrUtils.run_lower,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[]},Split:{description:"Splits a string into sections around a given delimiter.",run:StrUtils.run_split,input_type:"string",output_type:"string",args:[{name:"Split delimiter",type:"binary_short_string",value:StrUtils.SPLIT_DELIM},{name:"Join delimiter",type:"option",value:StrUtils.DELIMITER_OPTIONS}]},Filter:{description:"Splits up the input using the specified delimiter and then filters each branch based on a regular expression.",run:StrUtils.run_filter,manual_bake:!0,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"option",value:StrUtils.DELIMITER_OPTIONS},{name:"Regex",type:"string",value:""},{name:"Invert condition",type:"boolean",value:SeqUtils.SORT_REVERSE}]},Strings:{description:"Extracts all strings from the input.",run:Extract.run_strings,input_type:"string",output_type:"string",args:[{name:"Minimum length",type:"number",value:Extract.MIN_STRING_LEN},{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract IP addresses":{description:"Extracts all IPv4 and IPv6 addresses.

                                                                                                                                                                      Warning: Given a string 710.65.0.456, this will match 10.65.0.45 so always check the original input!",run:Extract.run_ip,input_type:"string",output_type:"string",args:[{name:"IPv4",type:"boolean",value:Extract.INCLUDE_IPV4},{name:"IPv6",type:"boolean",value:Extract.INCLUDE_IPV6},{name:"Remove local IPv4 addresses",type:"boolean",value:Extract.REMOVE_LOCAL},{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract email addresses":{description:"Extracts all email addresses from the input.",run:Extract.run_email,input_type:"string",output_type:"string",args:[{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract MAC addresses":{description:"Extracts all Media Access Control (MAC) addresses from the input.",run:Extract.run_mac,input_type:"string",output_type:"string",args:[{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract URLs":{description:"Extracts Uniform Resource Locators (URLs) from the input. The protocol (http, ftp etc.) is required otherwise there will be far too many false positives.",run:Extract.run_urls,input_type:"string",output_type:"string",args:[{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract domains":{description:"Extracts domain names with common Top-Level Domains (TLDs).
                                                                                                                                                                      Note that this will not include paths. Use Extract URLs to find entire URLs.",run:Extract.run_domains,input_type:"string",output_type:"string",args:[{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract file paths":{description:"Extracts anything that looks like a Windows or UNIX file path.

                                                                                                                                                                      Note that if UNIX is selected, there will likely be a lot of false positives.",run:Extract.run_file_paths,input_type:"string",output_type:"string",args:[{name:"Windows",type:"boolean",value:Extract.INCLUDE_WIN_PATH},{name:"UNIX",type:"boolean",value:Extract.INCLUDE_UNIX_PATH},{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract dates":{description:"Extracts dates in the following formats
                                                                                                                                                                      • yyyy-mm-dd
                                                                                                                                                                      • dd/mm/yyyy
                                                                                                                                                                      • mm/dd/yyyy
                                                                                                                                                                      Dividers can be any of /, -, . or space",run:Extract.run_dates,input_type:"string",output_type:"string",args:[{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Regular expression":{description:"Define your own regular expression to search the input data with, optionally choosing from a list of pre-defined patterns.",run:StrUtils.run_regex,manual_bake:!0,input_type:"string",output_type:"html",args:[{name:"Built in regexes",type:"populate_option",value:StrUtils.REGEX_PRE_POPULATE,target:1},{name:"Regex",type:"text",value:""},{name:"Case insensitive",type:"boolean",value:StrUtils.REGEX_CASE_INSENSITIVE},{name:"Multiline matching",type:"boolean",value:StrUtils.REGEX_MULTILINE_MATCHING},{name:"Display total",type:"boolean",value:StrUtils.DISPLAY_TOTAL},{name:"Output format",type:"option",value:StrUtils.OUTPUT_FORMAT}]},"XPath expression":{description:"Extract information from an XML document with an XPath query",run:Code.run_xpath,input_type:"string",output_type:"string",args:[{name:"XPath",type:"string",value:Code.XPATH_INITIAL},{name:"Result delimiter",type:"binary_short_string",value:Code.XPATH_DELIMITER}]},"CSS selector":{description:"Extract information from an HTML document with a CSS selector",run:Code.run_css_query,input_type:"string",output_type:"string",args:[{name:"CSS selector",type:"string",value:Code.CSS_SELECTOR_INITIAL},{name:"Delimiter",type:"binary_short_string",value:Code.CSS_QUERY_DELIMITER}]},"From UNIX Timestamp":{description:"Converts a UNIX timestamp to a datetime string.

                                                                                                                                                                      e.g. 978346800 becomes Mon 1 January 2001 11:00:00 UTC",run:DateTime.run_from_unix_timestamp,input_type:"number",output_type:"string",args:[{name:"Units",type:"option",value:DateTime.UNITS}]},"To UNIX Timestamp":{description:"Parses a datetime string and returns the corresponding UNIX timestamp.

                                                                                                                                                                      e.g. Mon 1 January 2001 11:00:00 UTC becomes 978346800",run:DateTime.run_to_unix_timestamp,input_type:"string",output_type:"number",args:[{name:"Units",type:"option",value:DateTime.UNITS}]},"Translate DateTime Format":{description:"Parses a datetime string in one format and re-writes it in another.

                                                                                                                                                                      Run with no input to see the relevant format string examples.",run:DateTime.run_translate_format,input_type:"string",output_type:"html",args:[{name:"Built in formats",type:"populate_option",value:DateTime.DATETIME_FORMATS,target:1},{name:"Input format string",type:"binary_string",value:DateTime.INPUT_FORMAT_STRING},{name:"Input timezone",type:"option",value:DateTime.TIMEZONES},{name:"Output format string",type:"binary_string",value:DateTime.OUTPUT_FORMAT_STRING},{name:"Output timezone",type:"option",value:DateTime.TIMEZONES}]},"Parse DateTime":{description:"Parses a DateTime string in your specified format and displays it in whichever timezone you choose with the following information:
                                                                                                                                                                      • Date
                                                                                                                                                                      • Time
                                                                                                                                                                      • Period (AM/PM)
                                                                                                                                                                      • Timezone
                                                                                                                                                                      • UTC offset
                                                                                                                                                                      • Daylight Saving Time
                                                                                                                                                                      • Leap year
                                                                                                                                                                      • Days in this month
                                                                                                                                                                      • Day of year
                                                                                                                                                                      • Week number
                                                                                                                                                                      • Quarter
                                                                                                                                                                      Run with no input to see format string examples if required.",run:DateTime.run_parse,input_type:"string",output_type:"html",args:[{name:"Built in formats",type:"populate_option",value:DateTime.DATETIME_FORMATS,target:1},{name:"Input format string",type:"binary_string",value:DateTime.INPUT_FORMAT_STRING},{name:"Input timezone",type:"option",value:DateTime.TIMEZONES}]},"Convert distance":{description:"Converts a unit of distance to another format.",run:Convert.run_distance,input_type:"number",output_type:"number",args:[{name:"Input units",type:"option",value:Convert.DISTANCE_UNITS},{name:"Output units",type:"option",value:Convert.DISTANCE_UNITS}]},"Convert area":{description:"Converts a unit of area to another format.",run:Convert.run_area,input_type:"number",output_type:"number",args:[{name:"Input units",type:"option",value:Convert.AREA_UNITS},{name:"Output units",type:"option",value:Convert.AREA_UNITS}]},"Convert mass":{description:"Converts a unit of mass to another format.",run:Convert.run_mass,input_type:"number",output_type:"number",args:[{name:"Input units",type:"option",value:Convert.MASS_UNITS},{name:"Output units",type:"option",value:Convert.MASS_UNITS}]},"Convert speed":{description:"Converts a unit of speed to another format.",run:Convert.run_speed,input_type:"number",output_type:"number",args:[{name:"Input units",type:"option",value:Convert.SPEED_UNITS},{name:"Output units",type:"option",value:Convert.SPEED_UNITS}]},"Convert data units":{description:"Converts a unit of data to another format.",run:Convert.run_data_size,input_type:"number",output_type:"number",args:[{name:"Input units",type:"option",value:Convert.DATA_UNITS},{name:"Output units",type:"option",value:Convert.DATA_UNITS}]},"Raw Deflate":{description:"Compresses data using the deflate algorithm with no headers.",run:Compress.run_raw_deflate,input_type:"byte_array",output_type:"byte_array",args:[{name:"Compression type",type:"option",value:Compress.COMPRESSION_TYPE}]},"Raw Inflate":{description:"Decompresses data which has been compressed using the deflate algorithm with no headers.",run:Compress.run_raw_inflate,input_type:"byte_array",output_type:"byte_array",args:[{name:"Start index",type:"number",value:Compress.INFLATE_INDEX},{name:"Initial output buffer size",type:"number",value:Compress.INFLATE_BUFFER_SIZE},{name:"Buffer expansion type",type:"option",value:Compress.INFLATE_BUFFER_TYPE},{name:"Resize buffer after decompression",type:"boolean",value:Compress.INFLATE_RESIZE},{name:"Verify result",type:"boolean",value:Compress.INFLATE_VERIFY}]},"Zlib Deflate":{description:"Compresses data using the deflate algorithm adding zlib headers.",run:Compress.run_zlib_deflate,input_type:"byte_array",output_type:"byte_array",args:[{name:"Compression type",type:"option",value:Compress.COMPRESSION_TYPE}]},"Zlib Inflate":{description:"Decompresses data which has been compressed using the deflate algorithm with zlib headers.",run:Compress.run_zlib_inflate,input_type:"byte_array",output_type:"byte_array",args:[{name:"Start index",type:"number",value:Compress.INFLATE_INDEX},{name:"Initial output buffer size",type:"number",value:Compress.INFLATE_BUFFER_SIZE},{name:"Buffer expansion type",type:"option",value:Compress.INFLATE_BUFFER_TYPE},{name:"Resize buffer after decompression",type:"boolean",value:Compress.INFLATE_RESIZE},{name:"Verify result",type:"boolean",value:Compress.INFLATE_VERIFY}]},Gzip:{description:"Compresses data using the deflate algorithm with gzip headers.",run:Compress.run_gzip,input_type:"byte_array",output_type:"byte_array",args:[{name:"Compression type",type:"option",value:Compress.COMPRESSION_TYPE},{name:"Filename (optional)",type:"string",value:""},{name:"Comment (optional)",type:"string",value:""},{name:"Include file checksum",type:"boolean",value:Compress.GZIP_CHECKSUM}]},Gunzip:{description:"Decompresses data which has been compressed using the deflate algorithm with gzip headers.",run:Compress.run_gunzip,input_type:"byte_array",output_type:"byte_array",args:[]},Zip:{description:"Compresses data using the PKZIP algorithm with the given filename.

                                                                                                                                                                      No support for multiple files at this time.",run:Compress.run_pkzip,input_type:"byte_array",output_type:"byte_array",args:[{name:"Filename",type:"string",value:Compress.PKZIP_FILENAME},{name:"Comment",type:"string",value:""},{name:"Password",type:"binary_string",value:""},{name:"Compression method",type:"option",value:Compress.COMPRESSION_METHOD},{name:"Operating system",type:"option",value:Compress.OS},{name:"Compression type",type:"option",value:Compress.COMPRESSION_TYPE}]},Unzip:{description:"Decompresses data using the PKZIP algorithm and displays it per file, with support for passwords.",run:Compress.run_pkunzip,input_type:"byte_array",output_type:"html",args:[{name:"Password",type:"binary_string",value:""},{name:"Verify result",type:"boolean",value:Compress.PKUNZIP_VERIFY}]},"Bzip2 Decompress":{description:"Decompresses data using the Bzip2 algorithm.",run:Compress.run_bzip2_decompress,input_type:"byte_array",output_type:"string",args:[]},"Generic Code Beautify":{description:"Attempts to pretty print C-style languages such as C, C++, C#, Java, PHP, JavaScript etc.

                                                                                                                                                                      This will not do a perfect job, and the resulting code may not work any more. This operation is designed purely to make obfuscated or minified code more easy to read and understand.

                                                                                                                                                                      Things which will not work properly:
                                                                                                                                                                      • For loop formatting
                                                                                                                                                                      • Do-While loop formatting
                                                                                                                                                                      • Switch/Case indentation
                                                                                                                                                                      • Certain bit shift operators
                                                                                                                                                                      ",run:Code.run_generic_beautify,input_type:"string",output_type:"string",args:[]},"JavaScript Parser":{description:"Returns an Abstract Syntax Tree for valid JavaScript code.",run:JS.run_parse,input_type:"string",output_type:"string",args:[{name:"Location info",type:"boolean",value:JS.PARSE_LOC},{name:"Range info",type:"boolean",value:JS.PARSE_RANGE},{name:"Include tokens array",type:"boolean",value:JS.PARSE_TOKENS},{name:"Include comments array",type:"boolean",value:JS.PARSE_COMMENT},{name:"Report errors and try to continue",type:"boolean",value:JS.PARSE_TOLERANT}]},"JavaScript Beautify":{description:"Parses and pretty prints valid JavaScript code. Also works with JavaScript Object Notation (JSON).",run:JS.run_beautify,input_type:"string",output_type:"string",args:[{name:"Indent string",type:"binary_short_string",value:JS.BEAUTIFY_INDENT},{name:"Quotes",type:"option",value:JS.BEAUTIFY_QUOTES},{name:"Semicolons before closing braces",type:"boolean",value:JS.BEAUTIFY_SEMICOLONS},{name:"Include comments",type:"boolean",value:JS.BEAUTIFY_COMMENT}]},"JavaScript Minify":{description:"Compresses JavaScript code.",run:JS.run_minify,input_type:"string",output_type:"string",args:[]},"XML Beautify":{description:"Indents and prettifies eXtensible Markup Language (XML) code.",run:Code.run_xml_beautify,input_type:"string",output_type:"string",args:[{name:"Indent string",type:"binary_short_string",value:Code.BEAUTIFY_INDENT}]},"JSON Beautify":{description:"Indents and prettifies JavaScript Object Notation (JSON) code.",run:Code.run_json_beautify,input_type:"string",output_type:"string",args:[{name:"Indent string",type:"binary_short_string",value:Code.BEAUTIFY_INDENT}]},"CSS Beautify":{description:"Indents and prettifies Cascading Style Sheets (CSS) code.",run:Code.run_css_beautify,input_type:"string",output_type:"string",args:[{name:"Indent string",type:"binary_short_string",value:Code.BEAUTIFY_INDENT}]},"SQL Beautify":{description:"Indents and prettifies Structured Query Language (SQL) code.",run:Code.run_sql_beautify,input_type:"string",output_type:"string",args:[{name:"Indent string",type:"binary_short_string",value:Code.BEAUTIFY_INDENT}]},"XML Minify":{description:"Compresses eXtensible Markup Language (XML) code.",run:Code.run_xml_minify,input_type:"string",output_type:"string",args:[{name:"Preserve comments",type:"boolean",value:Code.PRESERVE_COMMENTS}]},"JSON Minify":{description:"Compresses JavaScript Object Notation (JSON) code.",run:Code.run_json_minify,input_type:"string",output_type:"string",args:[]},"CSS Minify":{description:"Compresses Cascading Style Sheets (CSS) code.",run:Code.run_css_minify,input_type:"string",output_type:"string",args:[{name:"Preserve comments",type:"boolean",value:Code.PRESERVE_COMMENTS}]},"SQL Minify":{description:"Compresses Structured Query Language (SQL) code.",run:Code.run_sql_minify,input_type:"string",output_type:"string",args:[]},"Analyse hash":{description:"Tries to determine information about a given hash and suggests which algorithm may have been used to generate it based on its length.",run:Hash.run_analyse,input_type:"string",output_type:"string",args:[]},MD2:{description:"The MD2 (Message-Digest 2) algorithm is a cryptographic hash function developed by Ronald Rivest in 1989. The algorithm is optimized for 8-bit computers.

                                                                                                                                                                      Although MD2 is no longer considered secure, even as of 2014, it remains in use in public key infrastructures as part of certificates generated with MD2 and RSA.",run:Hash.run_md2,input_type:"string",output_type:"string",args:[]},MD4:{description:"The MD4 (Message-Digest 4) algorithm is a cryptographic hash function developed by Ronald Rivest in 1990. The digest length is 128 bits. The algorithm has influenced later designs, such as the MD5, SHA-1 and RIPEMD algorithms.

                                                                                                                                                                      The security of MD4 has been severely compromised.",run:Hash.run_md4,input_type:"string",output_type:"string",args:[]},MD5:{description:"MD5 (Message-Digest 5) is a widely used hash function. It has been used in a variety of security applications and is also commonly used to check the integrity of files.

                                                                                                                                                                      However, MD5 is not collision resistant and it isn't suitable for applications like SSL/TLS certificates or digital signatures that rely on this property.",run:Hash.run_md5,input_type:"string",output_type:"string",args:[]},SHA0:{description:"SHA-0 is a retronym applied to the original version of the 160-bit hash function published in 1993 under the name 'SHA'. It was withdrawn shortly after publication due to an undisclosed 'significant flaw' and replaced by the slightly revised version SHA-1.",run:Hash.run_sha0,input_type:"string",output_type:"string",args:[]},SHA1:{description:"The SHA (Secure Hash Algorithm) hash functions were designed by the NSA. SHA-1 is the most established of the existing SHA hash functions and it is used in a variety of security applications and protocols.

                                                                                                                                                                      However, SHA-1's collision resistance has been weakening as new attacks are discovered or improved.",run:Hash.run_sha1,input_type:"string",output_type:"string",args:[]},SHA224:{description:"SHA-224 is largely identical to SHA-256 but is truncated to 224 bytes.",run:Hash.run_sha224,input_type:"string",output_type:"string",args:[]},SHA256:{description:"SHA-256 is one of the four variants in the SHA-2 set. It isn't as widely used as SHA-1, though it provides much better security.",run:Hash.run_sha256,input_type:"string",output_type:"string",args:[]},SHA384:{description:"SHA-384 is largely identical to SHA-512 but is truncated to 384 bytes.",run:Hash.run_sha384,input_type:"string",output_type:"string",args:[]},SHA512:{description:"SHA-512 is largely identical to SHA-256 but operates on 64-bit words rather than 32.",run:Hash.run_sha512,input_type:"string",output_type:"string",args:[]},SHA3:{description:"This is an implementation of Keccak[c=2d]. SHA3 functions based on different implementations of Keccak will give different results.",run:Hash.run_sha3,input_type:"string",output_type:"string",args:[{name:"Output length",type:"option",value:Hash.SHA3_LENGTH}]},"RIPEMD-160":{description:"RIPEMD (RACE Integrity Primitives Evaluation Message Digest) is a family of cryptographic hash functions developed in Leuven, Belgium, by Hans Dobbertin, Antoon Bosselaers and Bart Preneel at the COSIC research group at the Katholieke Universiteit Leuven, and first published in 1996.

                                                                                                                                                                      RIPEMD was based upon the design principles used in MD4, and is similar in performance to the more popular SHA-1.

                                                                                                                                                                      RIPEMD-160 is an improved, 160-bit version of the original RIPEMD, and the most common version in the family.",run:Hash.run_ripemd160,input_type:"string",output_type:"string",args:[]},HMAC:{description:"Keyed-Hash Message Authentication Codes (HMAC) are a mechanism for message authentication using cryptographic hash functions.",run:Hash.run_hmac,input_type:"string",output_type:"string",args:[{name:"Password",type:"binary_string",value:""},{name:"Hashing function",type:"option",value:Hash.HMAC_FUNCTIONS}]},"Fletcher-8 Checksum":{description:"The Fletcher checksum is an algorithm for computing a position-dependent checksum devised by John Gould Fletcher at Lawrence Livermore Labs in the late 1970s.

                                                                                                                                                                      The objective of the Fletcher checksum was to provide error-detection properties approaching those of a cyclic redundancy check but with the lower computational effort associated with summation techniques.",run:Checksum.run_fletcher8,input_type:"byte_array",output_type:"string",args:[]},"Fletcher-16 Checksum":{description:"The Fletcher checksum is an algorithm for computing a position-dependent checksum devised by John Gould Fletcher at Lawrence Livermore Labs in the late 1970s.

                                                                                                                                                                      The objective of the Fletcher checksum was to provide error-detection properties approaching those of a cyclic redundancy check but with the lower computational effort associated with summation techniques.",run:Checksum.run_fletcher16,input_type:"byte_array",output_type:"string",args:[]},"Fletcher-32 Checksum":{description:"The Fletcher checksum is an algorithm for computing a position-dependent checksum devised by John Gould Fletcher at Lawrence Livermore Labs in the late 1970s.

                                                                                                                                                                      The objective of the Fletcher checksum was to provide error-detection properties approaching those of a cyclic redundancy check but with the lower computational effort associated with summation techniques.",run:Checksum.run_fletcher32,input_type:"byte_array",output_type:"string",args:[]},"Fletcher-64 Checksum":{description:"The Fletcher checksum is an algorithm for computing a position-dependent checksum devised by John Gould Fletcher at Lawrence Livermore Labs in the late 1970s.

                                                                                                                                                                      The objective of the Fletcher checksum was to provide error-detection properties approaching those of a cyclic redundancy check but with the lower computational effort associated with summation techniques.",run:Checksum.run_fletcher64,input_type:"byte_array",output_type:"string",args:[]},"Adler-32 Checksum":{description:"Adler-32 is a checksum algorithm which was invented by Mark Adler in 1995, and is a modification of the Fletcher checksum. Compared to a cyclic redundancy check of the same length, it trades reliability for speed (preferring the latter).

                                                                                                                                                                      Adler-32 is more reliable than Fletcher-16, and slightly less reliable than Fletcher-32.",run:Checksum.run_adler32,input_type:"byte_array",output_type:"string",args:[]},"CRC-32 Checksum":{description:"A cyclic redundancy check (CRC) is an error-detecting code commonly used in digital networks and storage devices to detect accidental changes to raw data.

                                                                                                                                                                      The CRC was invented by W. Wesley Peterson in 1961; the 32-bit CRC function of Ethernet and many other standards is the work of several researchers and was published in 1975.",run:Checksum.run_crc32,input_type:"byte_array",output_type:"string",args:[]},"Generate all hashes":{description:"Generates all available hashes and checksums for the input.",run:Hash.run_all,input_type:"string",output_type:"string",args:[]},Entropy:{description:"Calculates the Shannon entropy of the input data which gives an idea of its randomness. 8 is the maximum.",run:Entropy.run_entropy,input_type:"byte_array",output_type:"html",args:[{name:"Chunk size",type:"number",value:Entropy.CHUNK_SIZE}]},"Frequency distribution":{description:"Displays the distribution of bytes in the data as a graph.",run:Entropy.run_freq_distrib,input_type:"byte_array",output_type:"html",args:[{name:"Show 0%'s",type:"boolean",value:Entropy.FREQ_ZEROS}]},Numberwang:{description:"Based on the popular gameshow by Mitchell and Webb.",run:Numberwang.run,input_type:"string",output_type:"string",args:[]},"Parse X.509 certificate":{description:"X.509 is an ITU-T standard for a public key infrastructure (PKI) and Privilege Management Infrastructure (PMI). It is commonly involved with SSL/TLS security.

                                                                                                                                                                      This operation displays the contents of a certificate in a human readable format, similar to the openssl command line tool.",run:PublicKey.run_parse_x509,input_type:"string",output_type:"string",args:[{name:"Input format",type:"option",value:PublicKey.X509_INPUT_FORMAT}]},"PEM to Hex":{description:"Converts PEM (Privacy Enhanced Mail) format to a hexadecimal DER (Distinguished Encoding Rules) string.",run:PublicKey.run_pem_to_hex,input_type:"string",output_type:"string",args:[]},"Hex to PEM":{description:"Converts a hexadecimal DER (Distinguished Encoding Rules) string into PEM (Privacy Enhanced Mail) format.",run:PublicKey.run_hex_to_pem,input_type:"string",output_type:"string",args:[{name:"Header string",type:"string",value:PublicKey.PEM_HEADER_STRING}]},"Hex to Object Identifier":{description:"Converts a hexadecimal string into an object identifier (OID).",run:PublicKey.run_hex_to_object_identifier,input_type:"string",output_type:"string",args:[]},"Object Identifier to Hex":{description:"Converts an object identifier (OID) into a hexadecimal string.",run:PublicKey.run_object_identifier_to_hex,input_type:"string",output_type:"string",args:[]},"Parse ASN.1 hex string":{description:"Abstract Syntax Notation One (ASN.1) is a standard and notation that describes rules and structures for representing, encoding, transmitting, and decoding data in telecommunications and computer networking.

                                                                                                                                                                      This operation parses arbitrary ASN.1 data and presents the resulting tree.", run:PublicKey.run_parse_asn1_hex_string,input_type:"string",output_type:"string",args:[{name:"Starting index",type:"number",value:0},{name:"Truncate octet strings longer than",type:"number",value:PublicKey.ASN1_TRUNCATE_LENGTH}]},"Detect File Type":{description:"Attempts to guess the MIME (Multipurpose Internet Mail Extensions) type of the data based on 'magic bytes'.

                                                                                                                                                                      Currently supports the following file types: 7z, amr, avi, bmp, bz2, class, cr2, crx, dex, dmg, doc, elf, eot, epub, exe, flac, flv, gif, gz, ico, iso, jpg, jxr, m4a, m4v, mid, mkv, mov, mp3, mp4, mpg, ogg, otf, pdf, png, ppt, ps, psd, rar, rtf, sqlite, swf, tar, tar.z, tif, ttf, utf8, vmdk, wav, webm, webp, wmv, woff, woff2, xls, xz, zip.",run:FileType.run_detect,input_type:"byte_array",output_type:"string",args:[]},"Scan for Embedded Files":{description:"Scans the data for potential embedded files by looking for magic bytes at all offsets. This operation is prone to false positives.

                                                                                                                                                                      WARNING: Files over about 100KB in size will take a VERY long time to process.",run:FileType.run_scan_for_embedded_files,input_type:"byte_array",output_type:"string",args:[{name:"Ignore common byte sequences",type:"boolean",value:FileType.IGNORE_COMMON_BYTE_SEQUENCES}]},"Expand alphabet range":{description:"Expand an alphabet range string into a list of the characters in that range.

                                                                                                                                                                      e.g. a-z becomes abcdefghijklmnopqrstuvwxyz.",run:SeqUtils.run_expand_alph_range,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"binary_string",value:""}]},Diff:{description:"Compares two inputs (separated by the specified delimiter) and highlights the differences between them.",run:StrUtils.run_diff,input_type:"string",output_type:"html",args:[{name:"Sample delimiter",type:"binary_string",value:StrUtils.DIFF_SAMPLE_DELIMITER},{name:"Diff by",type:"option",value:StrUtils.DIFF_BY},{name:"Show added",type:"boolean",value:!0},{name:"Show removed",type:"boolean",value:!0},{name:"Ignore whitespace (relevant for word and line)",type:"boolean",value:!1}]},"Parse UNIX file permissions":{description:"Given a UNIX/Linux file permission string in octal or textual format, this operation explains which permissions are granted to which user groups.

                                                                                                                                                                      Input should be in either octal (e.g. 755) or textual (e.g. drwxr-xr-x) format.",run:OS.run_parse_unix_perms,input_type:"string",output_type:"string",args:[]},"Swap endianness":{description:"Switches the data from big-endian to little-endian or vice-versa. Data can be read in as hexadecimal or raw bytes. It will be returned in the same format as it is entered.",run:Endian.run_swap_endianness,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[{name:"Data format",type:"option",value:Endian.DATA_FORMAT},{name:"Word length (bytes)",type:"number",value:Endian.WORD_LENGTH},{name:"Pad incomplete words",type:"boolean",value:Endian.PAD_INCOMPLETE_WORDS}]},"Syntax highlighter":{description:"Adds syntax highlighting to a range of source code languages. Note that this will not indent the code. Use one of the 'Beautify' operations for that.",run:Code.run_syntax_highlight,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"html",args:[{name:"Language/File extension",type:"option",value:Code.LANGUAGES},{name:"Display line numbers",type:"boolean",value:Code.LINE_NUMS}]},"Parse escaped string":{description:"Replaces escaped characters with the bytes they represent.

                                                                                                                                                                      e.g.Hello\\nWorld becomes Hello
                                                                                                                                                                      World
                                                                                                                                                                      ",run:StrUtils.run_parse_escaped_string,input_type:"string",output_type:"string",args:[]},"TCP/IP Checksum":{description:"Calculates the checksum for a TCP (Transport Control Protocol) or IP (Internet Protocol) header from an input of raw bytes.",run:Checksum.run_tcp_ip,input_type:"byte_array",output_type:"string",args:[]},"Parse colour code":{description:"Converts a colour code in a standard format to other standard formats and displays the colour itself.

                                                                                                                                                                      Example inputs
                                                                                                                                                                      • #d9edf7
                                                                                                                                                                      • rgba(217,237,247,1)
                                                                                                                                                                      • hsla(200,65%,91%,1)
                                                                                                                                                                      • cmyk(0.12, 0.04, 0.00, 0.03)
                                                                                                                                                                      ",run:HTML.run_parse_colour_code,input_type:"string",output_type:"html",args:[]},"Generate UUID":{description:"Generates an RFC 4122 version 4 compliant Universally Unique Identifier (UUID), also known as a Globally Unique Identifier (GUID).

                                                                                                                                                                      A version 4 UUID relies on random numbers, in this case generated using window.crypto if available and falling back to Math.random if not.",run:UUID.run_generate_v4,input_type:"string",output_type:"string",args:[]},Substitute:{description:"A substitution cipher allowing you to specify bytes to replace with other byte values. This can be used to create Caesar ciphers but is more powerful as any byte value can be substituted, not just letters, and the substitution values need not be in order.

                                                                                                                                                                      Enter the bytes you want to replace in the Plaintext field and the bytes to replace them with in the Ciphertext field.

                                                                                                                                                                      Non-printable bytes can be specified using string escape notation. For example, a line feed character can be written as either \\n or \\x0a.

                                                                                                                                                                      Byte ranges can be specified using a hyphen. For example, the sequence 0123456789 can be written as 0-9.",run:Cipher.run_substitute,input_type:"byte_array",output_type:"byte_array",args:[{name:"Plaintext",type:"binary_string",value:Cipher.SUBS_PLAINTEXT},{name:"Ciphertext",type:"binary_string",value:Cipher.SUBS_CIPHERTEXT}]}},ControlsWaiter=function(a,b){this.app=a,this.manager=b};ControlsWaiter.prototype.adjust_width=function(){var a=document.getElementById("controls"),b=document.getElementById("step"),c=document.getElementById("clr-breaks"),d=document.querySelector("#save img"),e=document.querySelector("#load img"),f=document.querySelector("#step img"),g=document.querySelector("#clr-recipe img"),h=document.querySelector("#clr-breaks img");a.clientWidth<470?b.childNodes[1].nodeValue=" Step":b.childNodes[1].nodeValue=" Step through",a.clientWidth<400?(d.style.display="none",e.style.display="none",f.style.display="none",g.style.display="none",h.style.display="none"):(d.style.display="inline",e.style.display="inline",f.style.display="inline",g.style.display="inline",h.style.display="inline"),a.clientWidth<330?c.childNodes[1].nodeValue=" Clear breaks":c.childNodes[1].nodeValue=" Clear breakpoints"},ControlsWaiter.prototype.set_auto_bake=function(a){var b=document.getElementById("auto-bake");b.checked!==a&&b.click()},ControlsWaiter.prototype.bake_click=function(){this.app.bake(),$("#output-text").selectRange(0)},ControlsWaiter.prototype.step_click=function(){this.app.bake(!0),$("#output-text").selectRange(0)},ControlsWaiter.prototype.auto_bake_change=function(){var a=document.getElementById("auto-bake-label"),b=document.getElementById("auto-bake");this.app.auto_bake_=b.checked,b.checked?(a.classList.remove("btn-default"),a.classList.add("btn-success")):(a.classList.remove("btn-success"),a.classList.add("btn-default"))},ControlsWaiter.prototype.clear_recipe_click=function(){this.manager.recipe.clear_recipe()},ControlsWaiter.prototype.clear_breaks_click=function(){for(var a=document.querySelectorAll("#rec_list li.operation .breakpoint"),b=0;b0,b=b&&f.length>0&&f.length<8e3,a&&(d+="?recipe="+encodeURIComponent(e)),a&&b?d+="&input="+encodeURIComponent(f):b&&(d+="?input="+encodeURIComponent(f)),d},ControlsWaiter.prototype.save_text_change=function(){try{var a=JSON.parse(document.getElementById("save-text").value);this.initialise_save_link(a)}catch(a){}},ControlsWaiter.prototype.save_click=function(){var a=this.app.get_recipe_config(),b=JSON.stringify(a).replace(/},{/g,"},\n{");document.getElementById("save-text").value=b,this.initialise_save_link(a),$("#save-modal").modal()},ControlsWaiter.prototype.slr_check_change=function(){this.initialise_save_link()},ControlsWaiter.prototype.sli_check_change=function(){this.initialise_save_link()},ControlsWaiter.prototype.load_click=function(){this.populate_load_recipes_list(),$("#load-modal").modal()},ControlsWaiter.prototype.save_button_click=function(){var a=document.getElementById("save-name").value,b=document.getElementById("save-text").value;if(!a)return void this.app.alert("Please enter a recipe name","danger",2e3);var c=localStorage.saved_recipes?JSON.parse(localStorage.saved_recipes):[],d=localStorage.recipe_id||0;c.push({id:++d,name:a,recipe:b}),localStorage.saved_recipes=JSON.stringify(c),localStorage.recipe_id=d,this.app.alert('Recipe saved as "'+a+'".',"success",2e3)},ControlsWaiter.prototype.populate_load_recipes_list=function(){for(var a=document.getElementById("load-name"),b=a.options.length;b--;)a.remove(b);var c=localStorage.saved_recipes?JSON.parse(localStorage.saved_recipes):[];for(b=0;bend: "+e+"
                                                                                                                                                                      length: "+f},HighlighterWaiter.prototype.remove_highlights=function(){document.getElementById("input-highlighter").innerHTML="",document.getElementById("output-highlighter").innerHTML="",document.getElementById("input-selection-info").innerHTML="",document.getElementById("output-selection-info").innerHTML=""},HighlighterWaiter.prototype.generate_highlight_list=function(){for(var a=this.app.get_recipe_config(),b=[],c=0;c=0)return!1;var d="[start_highlight]",e=/\[start_highlight\]/g,f="[end_highlight]",g=/\[end_highlight\]/g,h=a.value;if(1===c.length){if(c[0].end/g,">").replace(/\n/g," ").replace(e,'').replace(g,"")+" ",b.style.width=a.clientWidth+"px",b.innerHTML=h,b.scrollTop=a.scrollTop,b.scrollLeft=a.scrollLeft};var HTMLApp=function(a,b,c,d){this.categories=a,this.operations=b,this.dfavourites=c,this.doptions=d,this.options=Utils.extend({},d),this.chef=new Chef,this.manager=new Manager(this),this.auto_bake_=!1,this.progress=0,this.ing_id=0,window.chef=this.chef};HTMLApp.prototype.setup=function(){document.dispatchEvent(this.manager.appstart),this.initialise_splitter(),this.load_local_storage(),this.populate_operations_list(),this.manager.setup(),this.reset_layout(),this.set_compile_message(),this.load_URI_params()},HTMLApp.prototype.handle_error=function(a){console.error(a);var b=a.display_str||a.toString();this.alert(b,"danger",this.options.error_timeout,!this.options.show_errors)},HTMLApp.prototype.bake=function(a){var b;try{b=this.chef.bake(this.get_input(),this.get_recipe_config(),this.options,this.progress,a)}catch(a){this.handle_error(a)}b&&(b.error&&this.handle_error(b.error),this.options=b.options,this.dish_str="html"===b.type?Utils.strip_html_tags(b.result,!0):b.result,this.progress=b.progress,this.manager.recipe.update_breakpoint_indicator(b.progress),this.manager.output.set(b.result,b.type,b.duration),b.duration>this.options.auto_bake_threshold&&this.auto_bake_&&(this.manager.controls.set_auto_bake(!1),this.alert("Baking took longer than "+this.options.auto_bake_threshold+"ms, Auto Bake has been disabled.","warning",5e3)))},HTMLApp.prototype.auto_bake=function(){this.auto_bake_&&this.bake()},HTMLApp.prototype.silent_bake=function(){var a=(new Date).getTime(),b=this.get_recipe_config();return this.auto_bake_&&this.chef.silent_bake(b),(new Date).getTime()-a},HTMLApp.prototype.get_input=function(){var a=this.manager.input.get();return sessionStorage.setItem("input_length",a.length),sessionStorage.setItem("input",a),a},HTMLApp.prototype.set_input=function(a){sessionStorage.setItem("input_length",a.length),sessionStorage.setItem("input",a),this.manager.input.set(a)},HTMLApp.prototype.populate_operations_list=function(){document.body.appendChild(document.getElementById("edit-favourites"));for(var a="",b=0;b2?JSON.parse(localStorage.favourites):this.dfavourites;a=this.valid_favourites(a),this.save_favourites(a);var b=this.categories.filter(function(a){return"Favourites"===a.name})[0];b?b.ops=a:this.categories.unshift({name:"Favourites",ops:a})},HTMLApp.prototype.valid_favourites=function(a){for(var b=[],c=0;c=0?void this.alert("'"+a+"' is already in your favourites","info",2e3):(b.push(a),this.save_favourites(b),this.load_favourites(),this.populate_operations_list(),void this.manager.recipe.initialise_operation_drag_n_drop())},HTMLApp.prototype.load_URI_params=function(){this.query_string=function(a){if(""===a)return{};for(var b={},c=0;c"):d[e].value=a[b].args[e];a[b].disabled&&c.querySelector(".disable-icon").click(),a[b].breakpoint&&c.querySelector(".breakpoint").click(),this.progress=0}},HTMLApp.prototype.reset_layout=function(){this.column_splitter.setSizes([20,30,50]),this.io_splitter.setSizes([50,50]),this.manager.controls.adjust_width(),this.manager.output.adjust_width()},HTMLApp.prototype.set_compile_message=function(){var a=new Date,b=Utils.fuzzy_time(a.getTime()-window.compile_time),c='Last build: '+b.substr(0,1).toUpperCase()+b.substr(1)+" ago";""!==window.compile_message&&(c+=" - "+window.compile_message),c+="",document.getElementById("notice").innerHTML=c},HTMLApp.prototype.alert=function(a,b,c,d){var e=new Date;if(console.log("["+e.toLocaleString()+"] "+a),!d){b=b||"danger",c=c||0;var f=document.getElementById("alert"),g=document.getElementById("alert-content");f.classList.remove("alert-danger"),f.classList.remove("alert-warning"),f.classList.remove("alert-info"),f.classList.remove("alert-success"),f.classList.add("alert-"+b),"block"===f.style.display?g.innerHTML+="

                                                                                                                                                                      ["+e.toLocaleTimeString()+"] "+a:g.innerHTML="["+e.toLocaleTimeString()+"] "+a,$("#alert").stop(),f.style.display="block",f.style.opacity=1,c>0&&(clearTimeout(this.alert_timeout),this.alert_timeout=setTimeout(function(){$("#alert").slideUp(100)},c))}},HTMLApp.prototype.confirm=function(a,b,c,d){d=d||this,document.getElementById("confirm-title").innerHTML=a,document.getElementById("confirm-body").innerHTML=b,document.getElementById("confirm-modal").style.display="block",this.confirm_closed=!1,$("#confirm-modal").modal().one("show.bs.modal",function(a){this.confirm_closed=!1}.bind(this)).one("click","#confirm-yes",function(){this.confirm_closed=!0,c.bind(d)(!0),$("#confirm-modal").modal("hide")}.bind(this)).one("hide.bs.modal",function(a){this.confirm_closed||c.bind(d)(!1),this.confirm_closed=!0}.bind(this))},HTMLApp.prototype.alert_close_click=function(){document.getElementById("alert").style.display="none"},HTMLApp.prototype.state_change=function(a){this.auto_bake(),this.options.update_url&&(this.last_state_url=this.manager.controls.generate_state_url(!0,!0),window.history.replaceState({},"CyberChef",this.last_state_url))},HTMLApp.prototype.pop_state=function(a){window.location.href.split("#")[0]!==this.last_state_url&&this.load_URI_params()},HTMLApp.prototype.call_api=function(a,b,c,d,e){b=b||"POST",c=c||{},d=d||void 0,e=e||"application/json";var f=null,g=!1;return $.ajax({url:a,async:!1,type:b,data:c,dataType:d,contentType:e,success:function(a){g=!0,f=a},error:function(a){g=!1,f=a}}),{success:g,response:f}};var HTMLCategory=function(a,b){this.name=a,this.selected=b,this.op_list=[]};HTMLCategory.prototype.add_operation=function(a){this.op_list.push(a)},HTMLCategory.prototype.to_html=function(){for(var a="cat"+this.name.replace(/[\s\/-:_]/g,""),b="
                                                                                                                                                                      "+this.name+"
                                                                                                                                                                        ",c=0;c 
                                                                                                                                                                      ";switch(d+="
                                                                                                                                                                      ",this.type){case"string":case"binary_string":case"byte_array":d+="";break;case"short_string":case"binary_short_string":d+="";break;case"toggle_string":for(d+="
                                                                                                                                                                      ";break;case"number":d+="";break;case"boolean":d+="",this.disable_args&&this.manager.add_dynamic_listener("#"+this.id,"click",this.toggle_disable_args,this);break;case"option":for(d+="";break;case"populate_option":for(d+="",this.manager.add_dynamic_listener("#"+this.id,"change",this.populate_option_change,this);break;case"editable_option":for(d+="
                                                                                                                                                                      ",d+="",d+="",d+="
                                                                                                                                                                      ",this.manager.add_dynamic_listener("#sel-"+this.id,"change",this.editable_option_change,this);break;case"text":d+=""}return d+="
                                                                                                                                                                      "},HTMLIngredient.prototype.toggle_disable_args=function(a){for(var b,c=a.target,d=c.parentNode.parentNode,e=d.querySelectorAll(".arg-group"),f=0;f"),this.description&&(b+=""),b+=""},HTMLOperation.prototype.to_full_html=function(){for(var a="
                                                                                                                                                                      "+this.name+"
                                                                                                                                                                      ",b=0;b=0&&(this.name=this.name.slice(0,b)+""+this.name.slice(b,b+a.length)+""+this.name.slice(b+a.length)),this.description&&c>=0&&(this.description=this.description.slice(0,c)+""+this.description.slice(c,c+a.length)+""+this.description.slice(c+a.length))};var InputWaiter=function(a,b){this.app=a,this.manager=b,this.bad_keys=[16,17,18,19,20,27,33,34,35,36,37,38,39,40,44,91,92,93,112,113,114,115,116,117,118,119,120,121,122,123,144,145]};InputWaiter.prototype.get=function(){return document.getElementById("input-text").value},InputWaiter.prototype.set=function(a){document.getElementById("input-text").value=a,window.dispatchEvent(this.manager.statechange)},InputWaiter.prototype.set_input_info=function(a,b){var c=a.toString().length;c=c<2?2:c;var d=Utils.pad(a.toString(),c," ").replace(/ /g," "),e=Utils.pad(b.toString(),c," ").replace(/ /g," ");document.getElementById("input-info").innerHTML="length: "+d+"
                                                                                                                                                                      lines: "+e},InputWaiter.prototype.input_change=function(a){this.manager.highlighter.remove_highlights(),this.app.progress=0;var b=this.get(),c=b.count("\n")+1;this.set_input_info(b.length,c),this.bad_keys.indexOf(a.keyCode)<0&&window.dispatchEvent(this.manager.statechange)},InputWaiter.prototype.input_dragover=function(a){return"move"!==a.dataTransfer.effectAllowed&&(a.stopPropagation(),a.preventDefault(),void a.target.classList.add("dropping-file"))},InputWaiter.prototype.input_dragleave=function(a){a.stopPropagation(),a.preventDefault(),a.target.classList.remove("dropping-file")},InputWaiter.prototype.input_drop=function(a){if("move"===a.dataTransfer.effectAllowed)return!1;a.stopPropagation(),a.preventDefault();var b=a.target,c=a.dataTransfer.files[0],d=a.dataTransfer.getData("Text"),e=new FileReader,f="",g=0,h=20480,i=function(){f.length>1e5&&this.app.auto_bake_&&(this.manager.controls.set_auto_bake(!1),this.app.alert("Turned off Auto Bake as the input is large","warning",5e3)),this.set(f);var a=this.app.get_recipe_config();a[0]&&"From Hex"===a[0].op||(a.unshift({op:"From Hex",args:["Space"]}),this.app.set_recipe_config(a)),b.classList.remove("loading_file")}.bind(this),j=function(){if(g>=c.size)return void i();b.value="Processing... "+Math.round(g/c.size*100)+"%";var a=c.slice(g,g+h);e.readAsArrayBuffer(a)};e.onload=function(a){var b=new Uint8Array(e.result);f+=Utils.to_hex_fast(b),g+=h,j()},b.classList.remove("dropping-file"),c?(b.classList.add("loading_file"),j()):d&&this.set(d)},InputWaiter.prototype.clear_io_click=function(){this.manager.highlighter.remove_highlights(),document.getElementById("input-text").value="",document.getElementById("output-text").value="",document.getElementById("input-info").innerHTML="",document.getElementById("output-info").innerHTML="",document.getElementById("input-selection-info").innerHTML="",document.getElementById("output-selection-info").innerHTML="",window.dispatchEvent(this.manager.statechange)};var Manager=function(a){this.app=a,this.appstart=new CustomEvent("appstart",{bubbles:!0}),this.operationadd=new CustomEvent("operationadd",{bubbles:!0}),this.operationremove=new CustomEvent("operationremove",{bubbles:!0}),this.oplistcreate=new CustomEvent("oplistcreate",{bubbles:!0}),this.statechange=new CustomEvent("statechange",{bubbles:!0}),this.window=new WindowWaiter(this.app),this.controls=new ControlsWaiter(this.app,this),this.recipe=new RecipeWaiter(this.app,this),this.ops=new OperationsWaiter(this.app,this),this.input=new InputWaiter(this.app,this),this.output=new OutputWaiter(this.app,this),this.options=new OptionsWaiter(this.app),this.highlighter=new HighlighterWaiter(this.app),this.seasonal=new SeasonalWaiter(this.app,this),this.dynamic_handlers={},this.initialise_event_listeners()};Manager.prototype.setup=function(){this.recipe.initialise_operation_drag_n_drop(),this.controls.auto_bake_change(),this.seasonal.load()},Manager.prototype.initialise_event_listeners=function(){window.addEventListener("resize",this.window.window_resize.bind(this.window)),window.addEventListener("blur",this.window.window_blur.bind(this.window)),window.addEventListener("focus",this.window.window_focus.bind(this.window)),window.addEventListener("statechange",this.app.state_change.bind(this.app)),window.addEventListener("popstate",this.app.pop_state.bind(this.app)),document.getElementById("bake").addEventListener("click",this.controls.bake_click.bind(this.controls)),document.getElementById("auto-bake").addEventListener("change",this.controls.auto_bake_change.bind(this.controls)),document.getElementById("step").addEventListener("click",this.controls.step_click.bind(this.controls)),document.getElementById("clr-recipe").addEventListener("click",this.controls.clear_recipe_click.bind(this.controls)),document.getElementById("clr-breaks").addEventListener("click",this.controls.clear_breaks_click.bind(this.controls)),document.getElementById("save").addEventListener("click",this.controls.save_click.bind(this.controls)),document.getElementById("save-button").addEventListener("click",this.controls.save_button_click.bind(this.controls)),document.getElementById("save-link-recipe-checkbox").addEventListener("change",this.controls.slr_check_change.bind(this.controls)),document.getElementById("save-link-input-checkbox").addEventListener("change",this.controls.sli_check_change.bind(this.controls)),document.getElementById("load").addEventListener("click",this.controls.load_click.bind(this.controls)),document.getElementById("load-delete-button").addEventListener("click",this.controls.load_delete_click.bind(this.controls)),document.getElementById("load-name").addEventListener("change",this.controls.load_name_change.bind(this.controls)),document.getElementById("load-button").addEventListener("click",this.controls.load_button_click.bind(this.controls)),this.add_multi_event_listener("#save-text","keyup paste",this.controls.save_text_change,this.controls),this.add_multi_event_listener("#search","keyup paste search",this.ops.search_operations,this.ops),this.add_dynamic_listener(".op_list li.operation","dblclick",this.ops.operation_dblclick,this.ops),document.getElementById("edit-favourites").addEventListener("click",this.ops.edit_favourites_click.bind(this.ops)),document.getElementById("save-favourites").addEventListener("click",this.ops.save_favourites_click.bind(this.ops)),document.getElementById("reset-favourites").addEventListener("click",this.ops.reset_favourites_click.bind(this.ops)),this.add_dynamic_listener(".op_list .op-icon","mouseover",this.ops.op_icon_mouseover,this.ops),this.add_dynamic_listener(".op_list .op-icon","mouseleave",this.ops.op_icon_mouseleave,this.ops),this.add_dynamic_listener(".op_list","oplistcreate",this.ops.op_list_create,this.ops),this.add_dynamic_listener("li.operation","operationadd",this.recipe.op_add.bind(this.recipe)),this.add_dynamic_listener(".arg","keyup",this.recipe.ing_change,this.recipe),this.add_dynamic_listener(".arg","change",this.recipe.ing_change,this.recipe),this.add_dynamic_listener(".disable-icon","click",this.recipe.disable_click,this.recipe),this.add_dynamic_listener(".breakpoint","click",this.recipe.breakpoint_click,this.recipe),this.add_dynamic_listener("#rec_list li.operation","dblclick",this.recipe.operation_dblclick,this.recipe),this.add_dynamic_listener("#rec_list li.operation > div","dblclick",this.recipe.operation_child_dblclick,this.recipe),this.add_dynamic_listener("#rec_list .input-group .dropdown-menu a","click",this.recipe.dropdown_toggle_click,this.recipe),this.add_dynamic_listener("#rec_list","operationremove",this.recipe.op_remove.bind(this.recipe)),this.add_multi_event_listener("#input-text","keyup paste",this.input.input_change,this.input),document.getElementById("reset-layout").addEventListener("click",this.app.reset_layout.bind(this.app)),document.getElementById("clr-io").addEventListener("click",this.input.clear_io_click.bind(this.input)),document.getElementById("input-text").addEventListener("dragover",this.input.input_dragover.bind(this.input)),document.getElementById("input-text").addEventListener("dragleave",this.input.input_dragleave.bind(this.input)),document.getElementById("input-text").addEventListener("drop",this.input.input_drop.bind(this.input)),document.getElementById("input-text").addEventListener("scroll",this.highlighter.input_scroll.bind(this.highlighter)),document.getElementById("input-text").addEventListener("mouseup",this.highlighter.input_mouseup.bind(this.highlighter)),document.getElementById("input-text").addEventListener("mousemove",this.highlighter.input_mousemove.bind(this.highlighter)),this.add_multi_event_listener("#input-text","mousedown dblclick select",this.highlighter.input_mousedown,this.highlighter),document.getElementById("save-to-file").addEventListener("click",this.output.save_click.bind(this.output)),document.getElementById("switch").addEventListener("click",this.output.switch_click.bind(this.output)),document.getElementById("undo-switch").addEventListener("click",this.output.undo_switch_click.bind(this.output)),document.getElementById("maximise-output").addEventListener("click",this.output.maximise_output_click.bind(this.output)),document.getElementById("output-text").addEventListener("scroll",this.highlighter.output_scroll.bind(this.highlighter)),document.getElementById("output-text").addEventListener("mouseup",this.highlighter.output_mouseup.bind(this.highlighter)),document.getElementById("output-text").addEventListener("mousemove",this.highlighter.output_mousemove.bind(this.highlighter)),document.getElementById("output-html").addEventListener("mouseup",this.highlighter.output_html_mouseup.bind(this.highlighter)),document.getElementById("output-html").addEventListener("mousemove",this.highlighter.output_html_mousemove.bind(this.highlighter)),this.add_multi_event_listener("#output-text","mousedown dblclick select",this.highlighter.output_mousedown,this.highlighter),this.add_multi_event_listener("#output-html","mousedown dblclick select",this.highlighter.output_html_mousedown,this.highlighter),document.getElementById("options").addEventListener("click",this.options.options_click.bind(this.options)),document.getElementById("reset-options").addEventListener("click",this.options.reset_options_click.bind(this.options)),$(document).on("switchChange.bootstrapSwitch",".option-item input:checkbox",this.options.switch_change.bind(this.options)),$(document).on("switchChange.bootstrapSwitch",".option-item input:checkbox",this.options.set_word_wrap.bind(this.options)),this.add_dynamic_listener(".option-item input[type=number]","keyup",this.options.number_change,this.options),this.add_dynamic_listener(".option-item input[type=number]","change",this.options.number_change,this.options),this.add_dynamic_listener(".option-item select","change",this.options.select_change,this.options),document.getElementById("alert-close").addEventListener("click",this.app.alert_close_click.bind(this.app))},Manager.prototype.add_listeners=function(a,b,c,d){d=d||this,[].forEach.call(document.querySelectorAll(a),function(a){a.addEventListener(b,c.bind(d))})},Manager.prototype.add_multi_event_listener=function(a,b,c,d){for(var e=b.split(" "),f=0;f-1&&(this.manager.recipe.add_operation(b[c].innerHTML),this.app.auto_bake()))),13===a.keyCode)a.preventDefault();else if(40===a.keyCode)a.preventDefault(),b=document.querySelectorAll("#search-results li"),b.length&&(c=this.get_selected_op(b),c>-1&&b[c].classList.remove("selected-op"),c===b.length-1&&(c=-1),b[c+1].classList.add("selected-op"));else if(38===a.keyCode)a.preventDefault(),b=document.querySelectorAll("#search-results li"),b.length&&(c=this.get_selected_op(b),c>-1&&b[c].classList.remove("selected-op"),0===c&&(c=b.length),b[c-1].classList.add("selected-op"));else{for(var d=document.getElementById("search-results"),e=a.target,f=e.value;d.firstChild;)$(d.firstChild).popover("destroy"),d.removeChild(d.firstChild);if($("#categories .in").collapse("hide"),f){for(var g=this.filter_operations(f,!0),h="",i=0;i=0||h>=0){var i=new HTMLOperation(e,this.app.operations[e],this.app,this.manager);b&&i.highlight_search_string(a,g,h),g<0?c.push(i):d.push(i)}}return d.concat(c)},OperationsWaiter.prototype.get_selected_op=function(a){for(var b=0;blength: "+e+"
                                                                                                                                                                      lines: "+f,document.getElementById("input-selection-info").innerHTML="",document.getElementById("output-selection-info").innerHTML=""},OutputWaiter.prototype.adjust_width=function(){var a=document.getElementById("output"),b=document.getElementById("save-to-file"),c=document.getElementById("switch"),d=document.getElementById("undo-switch"),e=document.getElementById("maximise-output");a.clientWidth<680?(b.childNodes[1].nodeValue="",c.childNodes[1].nodeValue="",d.childNodes[1].nodeValue="",e.childNodes[1].nodeValue=""):(b.childNodes[1].nodeValue=" Save to file",c.childNodes[1].nodeValue=" Move output to input",d.childNodes[1].nodeValue=" Undo",e.childNodes[1].nodeValue="Maximise"===e.getAttribute("title")?" Max":" Restore")},OutputWaiter.prototype.save_click=function(){var a=Utils.to_base64(this.app.dish_str),b=window.prompt("Please enter a filename:","download.dat");if(b){var c=document.createElement("a");c.setAttribute("href","data:application/octet-stream;base64;charset=utf-8,"+a),c.setAttribute("download",b),c.style.display="none",document.body.appendChild(c),c.click(),c.remove()}},OutputWaiter.prototype.switch_click=function(){this.switch_orig_data=this.manager.input.get(),document.getElementById("undo-switch").disabled=!1,this.app.set_input(this.app.dish_str)},OutputWaiter.prototype.undo_switch_click=function(){this.app.set_input(this.switch_orig_data),document.getElementById("undo-switch").disabled=!0},OutputWaiter.prototype.maximise_output_click=function(a){var b="maximise-output"===a.target.id?a.target:a.target.parentNode;"Maximise"===b.getAttribute("title")?(this.app.column_splitter.collapse(0),this.app.column_splitter.collapse(1),this.app.io_splitter.collapse(0),b.setAttribute("title","Restore"),b.innerHTML=" Restore",this.adjust_width()):(b.setAttribute("title","Maximise"),b.innerHTML=" Max",this.app.reset_layout())};var RecipeWaiter=function(a,b){this.app=a,this.manager=b,this.remove_intent=!1};RecipeWaiter.prototype.initialise_operation_drag_n_drop=function(){var a=document.getElementById("rec_list");Sortable.create(a,{group:"recipe",sort:!0,animation:0,delay:0,filter:".arg-input,.arg",setData:function(a,b){a.setData("Text",b.querySelector(".arg-title").textContent)},onEnd:function(a){this.remove_intent&&(a.item.remove(),a.target.dispatchEvent(this.manager.operationremove))}.bind(this)}),Sortable.utils.on(a,"dragover",function(){this.remove_intent=!1}.bind(this)),Sortable.utils.on(a,"dragleave",function(){this.remove_intent=!0,this.app.progress=0}.bind(this)),Sortable.utils.on(a,"touchend",function(b){var c=b.changedTouches[0],d=document.elementFromPoint(c.clientX,c.clientY);this.remove_intent=!a.contains(d)}.bind(this)),document.querySelector("#categories a").addEventListener("dragover",this.fav_dragover.bind(this)),document.querySelector("#categories a").addEventListener("dragleave",this.fav_dragleave.bind(this)),document.querySelector("#categories a").addEventListener("drop",this.fav_drop.bind(this))},RecipeWaiter.prototype.create_sortable_seed_list=function(a){Sortable.create(a,{group:{name:"recipe",pull:"clone",put:!1},sort:!1,setData:function(a,b){a.setData("Text",b.textContent)},onStart:function(a){$(a.item).popover("destroy"),a.item.setAttribute("data-toggle","popover-disabled")},onEnd:this.op_sort_end.bind(this)})},RecipeWaiter.prototype.op_sort_end=function(a){return this.remove_intent?void("rec_list"===a.item.parentNode.id&&a.item.remove()):($(a.clone).popover(),$(a.clone).children("[data-toggle=popover]").popover(),void("rec_list"===a.item.parentNode.id&&(this.build_recipe_operation(a.item),a.item.dispatchEvent(this.manager.operationadd))))},RecipeWaiter.prototype.fav_dragover=function(a){return"move"===a.dataTransfer.effectAllowed&&(a.stopPropagation(),a.preventDefault(),void(a.target.className&&a.target.className.indexOf("category-title")>-1?a.target.classList.add("favourites-hover"):a.target.parentNode.className&&a.target.parentNode.className.indexOf("category-title")>-1?a.target.parentNode.classList.add("favourites-hover"):a.target.parentNode.parentNode.className&&a.target.parentNode.parentNode.className.indexOf("category-title")>-1&&a.target.parentNode.parentNode.classList.add("favourites-hover")))},RecipeWaiter.prototype.fav_dragleave=function(a){a.stopPropagation(),a.preventDefault(),document.querySelector("#categories a").classList.remove("favourites-hover")},RecipeWaiter.prototype.fav_drop=function(a){a.stopPropagation(),a.preventDefault(),a.target.classList.remove("favourites-hover");var b=a.dataTransfer.getData("Text");this.app.add_favourite(b)},RecipeWaiter.prototype.ing_change=function(){window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.disable_click=function(a){var b=a.target;"false"===b.getAttribute("disabled")?(b.setAttribute("disabled","true"),b.classList.add("disable-icon-selected"),b.parentNode.parentNode.classList.add("disabled")):(b.setAttribute("disabled","false"),b.classList.remove("disable-icon-selected"),b.parentNode.parentNode.classList.remove("disabled")),this.app.progress=0,window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.breakpoint_click=function(a){var b=a.target;"false"===b.getAttribute("break")?(b.setAttribute("break","true"),b.classList.add("breakpoint-selected")):(b.setAttribute("break","false"),b.classList.remove("breakpoint-selected")),window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.operation_dblclick=function(a){a.target.remove(),window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.operation_child_dblclick=function(a){a.target.parentNode.remove(),window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.get_config=function(){for(var a,b,c,d,e,f=[],g=document.querySelectorAll("#rec_list li.operation"),h=0;h",this.ing_change()},RecipeWaiter.prototype.op_add=function(a){window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.op_remove=function(a){window.dispatchEvent(this.manager.statechange)};var SeasonalWaiter=function(a,b){this.app=a,this.manager=b};SeasonalWaiter.prototype.load=function(){var a=new Date;11===a.getMonth()&&a.getDate()>12&&(this.app.options.snow=!1,this.create_snow_option(),$(document).on("switchChange.bootstrapSwitch",".option-item input:checkbox[option='snow']",this.let_it_snow.bind(this)),window.addEventListener("resize",this.let_it_snow.bind(this)),this.manager.add_listeners(".btn","click",this.shake_off_snow,this),25===a.getDate()&&this.let_it_snow()),this.kkeys=[],window.addEventListener("keydown",this.konami_code_listener.bind(this))},SeasonalWaiter.prototype.insert_spider_icons=function(){var a="iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB3UlEQVQ4y2NgGJaAmYGBgVnf0oKJgYGBobWtXamqqoYTn2I4CI+LTzM2NTulpKbu+vPHz2dV5RWlluZmi3j5+KqFJSSEzpw8uQPdAEYYIzo5Kfjrl28rWFlZzjAzMYuEBQao3Lh+g+HGvbs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8tFmVym3nc6rZOPyi0cD8HxeHPg3x2InNrbS79JTsYzNXmPuBclsO3ZvKwAOJEGsmI5rT0M+gSf3y9K5LIA1LUEIlL1k0AhCYBH5r9TCqBqib4D+c/1PyInGOThkvuaHCYALhlpbQWBMGR/4IpzTqlpbKQyf0045vdoe0zATHagSYMeWFMkbscnHRYPZjoFJaIiUkz9EJy15j/X3qCsAIqMcFjSWrNE1Iygg0fEmrtLzEUTdT/OhBFht9fHDVCbEUt3LJxi08B8Xj6vTDESriq9lVWqBECgHujqiqAUmufb1X3cfRXoluhjZWiwkOnSUcUS6ZD8LUmmhks6b5j1ezkAkAKZBe5QvPPcNBnoCawMwT66Qxk0R2xwwRAui2iSDGuaPDcubzo3EJq8wcx/9Vmk3QryH42QBQCFF0UagIiJtjX6DskIXTLEucJSHIIIMuO0BOcjn3A3ybU/lu5RCUBc5qA0Ih0Q2EWiCPRk7VfMNhjLW1zETic1tLYZDMKyuSsdfh5l6bwho5+0il4kyA0VohlNcF5FP8DlWo/VB16HYB2hJ0pzgIe2mcXxP2IOumPRY17U0tll8KIkZNb+sppafOxYkQPSaYfchyYoL9GMqWYpTLRIq1QUcT4O3aPQgqVqPwIOIMwDhzX6mQUFIQAgo+9MzcrWrML3mj6+YIKiFCZyhL87RqVQKrEskF+P1BUvfLCAkfRwoPUtq6l5o5+lZb5SolJo6oT8avTCl+c9OTmat6pKW8mLkvBpGzlvsiGuQr4ZEEwA1EQgoR/gNtxIxKBluz+OtMJiF31jHxqXBiAqAUj4WRxpADFM0DCFlv1khvX7Wol4vF4AIldVVxdZqlrIfiCYQPHDy6bAGv7nKYRVY6JewExZVAP+ey5Rv+Ba97aaUHMW5NauLmMZFkegBb/EP14d6NoS9QLWFSzWBmuZza8CQmSpXsAqmGtVy14VALWuuYWWy+W3OteXa4jwceQX6+BKG6J1/8+2VCNkm2222WabbbbZZpttttlmm22rt38DCdA0vq3bcAkAAAAASUVORK5CYII="; -document.querySelector("link[rel=icon]").setAttribute("href","data:image/png;base64,"+a),document.querySelector("#bake img").setAttribute("src","data:image/png;base64,"+b),document.querySelector(".about-img-left").setAttribute("src","data:image/png;base64,"+c)},SeasonalWaiter.prototype.insert_spider_text=function(){document.title=document.title.replace(/Cyber/g,"Spider"),SeasonalWaiter.tree_walk(document.body,function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Cyber/g,"Spider"))},!0),SeasonalWaiter.tree_walk(document.getElementById("bake-group"),function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Bake/g,"Spin"))},!0),document.querySelector("#recipe .title").innerHTML="Web"},SeasonalWaiter.prototype.create_snow_option=function(){var a=document.getElementById("options-body"),b=document.createElement("div");b.className="option-item",b.innerHTML=" Let it snow",a.appendChild(b),this.manager.options.load()},SeasonalWaiter.prototype.let_it_snow=function(){if($(document).snowfall("clear"),this.app.options.snow){var a={},b=navigator.userAgent.match(/Firefox\/(\d\d?)/);a=b&&parseInt(b[1],10)<30?{flakeCount:10,flakeColor:"#fff",flakePosition:"absolute",minSize:1,maxSize:2,minSpeed:1,maxSpeed:5,round:!1,shadow:!1,collection:!1,collectionHeight:20,deviceorientation:!0}:{flakeCount:35,flakeColor:"#fff",flakePosition:"absolute",minSize:5,maxSize:8,minSpeed:1,maxSpeed:5,round:!0,shadow:!0,collection:".btn",collectionHeight:20,deviceorientation:!0},$(document).snowfall(a)}},SeasonalWaiter.prototype.shake_off_snow=function(a){for(var b=a.target,c=b.getBoundingClientRect(),d=document.querySelectorAll("canvas.snowfall-canvas"),e=null,f=function(){h.clearRect(0,0,e.width,e.height),$(this).fadeIn()},g=0;g6e4&&this.app.silent_bake()};var main=function(){var a=["To Base64","From Base64","To Hex","From Hex","To Hexdump","From Hexdump","URL Decode","Regular expression","Entropy","Fork"],b={update_url:!0,show_highlighter:!0,treat_as_utf8:!0,word_wrap:!0,show_errors:!0,error_timeout:4e3,auto_bake_threshold:200,attempt_highlight:!0,snow:!1};document.removeEventListener("DOMContentLoaded",main,!1),window.app=new HTMLApp(Categories,OperationConfig,a,b),window.app.setup()};window.console=console||{log:function(){},error:function(){}},window.compile_time=moment.tz("Tue Jan 17 2017 15:51:04","ddd MMM D YYYY HH:mm:ss","UTC").valueOf(),window.compile_message="",document.addEventListener("DOMContentLoaded",main,!1); \ No newline at end of file +document.querySelector("link[rel=icon]").setAttribute("href","data:image/png;base64,"+a),document.querySelector("#bake img").setAttribute("src","data:image/png;base64,"+b),document.querySelector(".about-img-left").setAttribute("src","data:image/png;base64,"+c)},SeasonalWaiter.prototype.insert_spider_text=function(){document.title=document.title.replace(/Cyber/g,"Spider"),SeasonalWaiter.tree_walk(document.body,function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Cyber/g,"Spider"))},!0),SeasonalWaiter.tree_walk(document.getElementById("bake-group"),function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Bake/g,"Spin"))},!0),document.querySelector("#recipe .title").innerHTML="Web"},SeasonalWaiter.prototype.create_snow_option=function(){var a=document.getElementById("options-body"),b=document.createElement("div");b.className="option-item",b.innerHTML=" Let it snow",a.appendChild(b),this.manager.options.load()},SeasonalWaiter.prototype.let_it_snow=function(){if($(document).snowfall("clear"),this.app.options.snow){var a={},b=navigator.userAgent.match(/Firefox\/(\d\d?)/);a=b&&parseInt(b[1],10)<30?{flakeCount:10,flakeColor:"#fff",flakePosition:"absolute",minSize:1,maxSize:2,minSpeed:1,maxSpeed:5,round:!1,shadow:!1,collection:!1,collectionHeight:20,deviceorientation:!0}:{flakeCount:35,flakeColor:"#fff",flakePosition:"absolute",minSize:5,maxSize:8,minSpeed:1,maxSpeed:5,round:!0,shadow:!0,collection:".btn",collectionHeight:20,deviceorientation:!0},$(document).snowfall(a)}},SeasonalWaiter.prototype.shake_off_snow=function(a){for(var b=a.target,c=b.getBoundingClientRect(),d=document.querySelectorAll("canvas.snowfall-canvas"),e=null,f=function(){h.clearRect(0,0,e.width,e.height),$(this).fadeIn()},g=0;g6e4&&this.app.silent_bake()};var main=function(){var a=["To Base64","From Base64","To Hex","From Hex","To Hexdump","From Hexdump","URL Decode","Regular expression","Entropy","Fork"],b={update_url:!0,show_highlighter:!0,treat_as_utf8:!0,word_wrap:!0,show_errors:!0,error_timeout:4e3,auto_bake_threshold:200,attempt_highlight:!0,snow:!1};document.removeEventListener("DOMContentLoaded",main,!1),window.app=new HTMLApp(Categories,OperationConfig,a,b),window.app.setup()};window.console=console||{log:function(){},error:function(){}},window.compile_time=moment.tz("Tue Jan 31 2017 14:02:48","ddd MMM D YYYY HH:mm:ss","UTC").valueOf(),window.compile_message="",document.addEventListener("DOMContentLoaded",main,!1); \ No newline at end of file diff --git a/src/html/index.html b/src/html/index.html index 57d78d74..ba1e36d7 100755 --- a/src/html/index.html +++ b/src/html/index.html @@ -365,6 +365,9 @@ + + Fork me on GitHub +
                                                                                                                                                                      diff --git a/src/static/images/fork_me.png b/src/static/images/fork_me.png new file mode 100644 index 0000000000000000000000000000000000000000..6e0c3a7882e8eefbeee4746f4c1466283f244a84 GIT binary patch literal 7660 zcmV~Yt zXx`{%&^Ze@4V-HXL*mVy}g~ZOsCUX z@5;A+^8F$5{UP*K`f==(*yon$mrzZ84Q;F1M!sS*Cd{DEM16+NHJ_sokA7Hr^WB?| zQYBrseCd{a-Bw*~mdh+(?eazK&i+BdoSLqOpi-`(^zZb;(9qClA5MIj>aNz&M^zuu zrIt%R@#IDg8%1|U-pP+^|B3yT^d3D))pW@QSZaU?V0pm&-2M%Jq}-;1m?nOT#QzfPDG$n?t%37FOOsI{6Kz z6Hw_LrqbE`!xg6Tm#+YNnzBZQjQraD3HQ_aE9dExnosEZ?dv}ABqM?%C~R8a;j|)dMNDvda6V0=2{w%7FW(Br>I3)JZU-dwWuzAl9zK}2ao0w= z)pm>7!Ixa&kqbv?%GfD1FKV8i?xmL~$_lJu0$AR4e_Fx1whNT5Ve|xjYpQjFP7&6HbPKLj!%{iC?&Kfl5x7aFTTO?A0-$UkDY9 z)d!$z*KmQ#yVn*_w`|_+Hv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GZO9Y=0000 Date: Tue, 31 Jan 2017 16:10:42 +0000 Subject: [PATCH 23/24] Small CSS tweak to correct the cursor when hovering over FAQ links. Fixes #59. --- build/prod/cyberchef.htm | 6 +++--- build/prod/index.html | 2 +- build/prod/scripts.js | 2 +- build/prod/styles.css | 2 +- src/css/structure/overrides.css | 4 ++++ src/static/stats.txt | 4 ++-- 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/build/prod/cyberchef.htm b/build/prod/cyberchef.htm index 7aa3565f..d590b2c2 100755 --- a/build/prod/cyberchef.htm +++ b/build/prod/cyberchef.htm @@ -85,11 +85,11 @@ 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. -*/.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.clo,.opn,.pun{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.kwd,.tag,.typ{font-weight:700}.str{color:#060}.kwd{color:#006}.com{color:#600;font-style:italic}.typ{color:#404}.lit{color:#044}.clo,.opn,.pun{color:#440}.tag{color:#006}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}#content-wrapper{top:0;left:0;width:100%;height:100%}#banner{height:30px;width:100%;text-align:center;line-height:30px}#wrapper{top:30px;bottom:0;width:100%}div#operations,div#recipe{width:50%;height:100%}div#input,div#output{width:100%;height:50%}.title{padding:10px;height:43px}.textarea-wrapper{top:43px;bottom:0;width:100%;overflow:hidden}#output-html,textarea{width:100%;height:100%;border:none;padding:3px;-moz-padding-start:3px;-moz-padding-end:3px}#input-text,#output-html,#output-text{position:relative;border-width:0;margin:0;resize:none;background-color:transparent;white-space:pre-wrap;word-wrap:break-word}#output-html{display:none;overflow-y:auto;-moz-padding-start:1px}.split{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;overflow:auto;position:relative}.gutter.gutter-horizontal,.split.split-horizontal{height:100%;float:left}#input-highlighter,#output-highlighter{position:absolute;left:0;top:0;width:100%;height:100%;padding:3px;margin:0;overflow:hidden;letter-spacing:normal;white-space:pre-wrap;word-wrap:break-word;color:#fff;background-color:transparent;border:none}#op_list,#rec_list,.op_list{margin:0;padding:0;list-style-type:none}#op_list,#rec_list{position:absolute;top:43px;bottom:0;width:100%}.io-btn-group,.io-info{margin-top:-4px;float:right}#rec_list{bottom:120px;overflow:auto}.operation{cursor:pointer;padding:10px;list-style-type:none;position:relative}#controls{position:absolute;width:100%;height:120px;bottom:0;padding:10px}.io-info{margin-right:20px;height:30px;text-align:right;line-height:10px}.arg-group,.inline-args input[type=checkbox]{margin-top:10px}#input-info{line-height:15px}.arg-group{display:table;width:100%}.arg-group-text{display:block}.inline-args{float:left;width:auto;margin-right:30px;height:34px}.inline-args input[type=number]{width:100px}.arg-input{display:table-cell;width:100%;padding:6px 12px}.short-string{width:150px}select{display:block}.arg[disabled]{cursor:not-allowed;opacity:1}textarea.arg{width:100%;min-height:50px;height:70px;margin-top:5px;border:1px solid #ddd;resize:vertical}.arg-label{display:table-cell;width:1px;padding-right:10px;font-weight:400;white-space:pre}.title,optgroup{font-weight:700}.editable-option{position:relative;display:inline-block}.editable-option-input{position:absolute;top:1px;left:1px;width:calc(100% - 20px);height:calc(100% - 2px)!important;border:none!important}#operational-controls{width:65%;float:left;text-align:center}#bake-group{display:table;width:100%}#bake{display:table-cell;width:100%;border-top-right-radius:0;border-bottom-right-radius:0}#auto-bake-label{display:table-cell;padding:1px;line-height:1.35;width:60px;border-top-left-radius:0;border-bottom-left-radius:0;border-left:1px solid #5cb85c}#auto-bake-label:hover{border-left-color:#398439}#auto-bake-label div{font-size:10px;padding:2px}#extra-controls{float:right;width:35%;padding-left:10px}.op-icon{float:right;margin-left:10px;margin-top:3px}.recip-icons{position:absolute;top:13px;right:10px;height:16px}.recip-icon{margin-right:10px;vertical-align:baseline;float:right}.disable-icon{width:16px;height:16px;margin-top:-1px;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAACfElEQVQ4y6WTPWgTYRjHf8nlfVvuoDVIP4Yuki4WHKoUqggFRUTsUEGkVG2hmCq6OnTwIxYHB+eijZOKdLNDW1pKKyGigh8dBHUJElxyBgx3vEnukvdyDrUhRXDxGR+e/+/583xEwjDkfyIGwNVTzURm4tYAMA6MAoN/0tvAMrA48uL+l2bx4w0iYRjSuHKC6OnTZLqHk8CcaZq9bW1tSCkBqNVq+L5PpVIpAHdGfr5LN9bXiT7Z2nGgteb1/qFkLBJZ6OjowHEc8vk8pVIJgHg8TldXF52dnb2u6y5s7R/iuF5JSyAKkLl4eyAMwznLsrBtm1wu99Z13amk+BFJih8R13WXANrb27EsizAM5zIXbw+wC9Baj0spe5VSFAqFt4ZhXJ6ufXuK55E5cDKVSCTGenp6yGazKKWQUvZqrcebgCAIRqWUOI6DEOLR1K8POapVMgfPpoC7u2LLspYcx0FKSRAEo60OBg3DwPd9Jr5vPqWvj8zh83vEwL2J75vnfN/HMAy01oPNNQZBQBAEO1OvVsl0D/8lTuZfpYDd7gRBQKuD7XK5jGmarB679PIv8deVFJUKq8cuTZqmSblcRmu93QpYVkohhMCyrLE94n2/UlSrbJy5kRBCXBNCoJRCa73cClh0XbfgeR6WZZHNZunv719KvnmeYnWVVxdmJ2Ox2DMhxFHP83Bdt6C1XgR2LvHzQDvvb84npZQL8Xgc0zSJRqN7br7RaFCpVCiVStRqtZmhh9fTh754TQdMr82nPc+bsW27UCwWUUpRr9ep1+sopSgWi9i2XfA8b2Z6bT6ttabp4GMi0uz0aXbhn890+MFM85mO5MIdwP/Eb1pMUCdctYRzAAAAAElFTkSuQmCC) no-repeat}.disable-icon-selected{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACFUlEQVR4XqWTP0tbURjGn9zY3mjBwsUhBQtS6XKxiNypIGZJ6SKYUYdaKWg7OrrE3pYO+Qit3dpFuuQO6lI7Z4nESQdjlJbkJh0MksSb3Jvk9H0gjZFu9YWH83LO7zn/3nNCSincJobAeP1sEDBFi6J50UyPy4l2RNuioz756Ts0tt1OB4jH2a52Ne2HGh9PwrJm2EcxZx/HyPRYMDgB2u02/N3d1c7w8BZMM1ptNJBPp3GwsUExB/s4RoYsPf0JOkFgdoH34YkJ/D48xC/HyTTOzl5ayWSIktwxqlVo0SjIkKWnP0Hg+4swjGitVMJFNpu5o+svptfXv6DZBDIZezoWS3Db3A0ZsvRcH8H354dGR9EoFHA3EvlorqycwvOAXM4G8Pav+f7YmEOGLD1gsIzl54+V+vBK/Yw9ZAv1LQW1FrdFSnKVfQTK5liPUfRI9I8ArqiPjLAF9vcHVybyzlpasgcZeq7voNXKNSsV3DMMXB4fp/8xLyzYuLri2DIZsvQM3sFOzXURiUR4zsQNcyrFleFVKpNyP2/IkKVnsArbF65bbkqplJSJZrl5x5qbs7G3h3artSyV+arr+lMyZOnpP2Wp6ZFos3R+vvUgCGDNzgKalkA4rECIr07662J2i0X4nrfJJ33jJT6Zmvpcr9XWCicn5WI+j7rrAmKgmLOPY2TI0sPgb8TBZOi/PpN1qnDr7/wH3jxgB/FKIXkAAAAASUVORK5CYII=) no-repeat}.breakpoint{float:right;width:14px;height:14px;background-color:#eee;border:1px solid #aaa}.breakpoint-selected{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAXVBMVEXIUkvzUVHzTEzzn5785eXrbW24BgbzWVnze3vzVVXzY2Pyion509PzbW3zXV1UMxj0l5f1srKbRTRgOxzJDg796ur74ODfIyP5zs6LLx3pNTXYGxuxdkVZNhn////sCC1eAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAABWSURBVBjTnc+7EoAgDERRTOQVxMEZFAf//z8FjAUFDbfb060QU2FwxngimxnCea3bjegSgz+0tguAfBgIy64QGfZQdg91dgAtqUZgnfz6IacYVWvu2AvR4wNAv0nxrAAAAABJRU5ErkJggg==) -2px -2px no-repeat #eee}.banner-right{float:right;margin-right:10px}#banner img{margin-bottom:2px;margin-left:8px}.category-title{display:block;padding:10px}.category{margin:0!important;border-radius:0!important;border:none}#search{border-radius:0;border:none}.loading_file{background:url(data:image/gif;base64,R0lGODlhPAA8APcAAAAAAAEBAQICAgMDAwQEBAUFBQYGBgcHBwgICAkJCQoKCgsLCwwMDA0NDQ4ODg8PDxAQEBERERISEhMTExQUFBUVFRYWFhcXFxgYGBkZGRoaGhsbGxwcHB0dHR4eHh8fHyAgICEhISIiIiMjIyQkJCUlJSYmJicnJygoKCkpKSoqKisrKywsLC0tLS4uLi8vLzAwMDExMTIyMjMzMzQ0NDU1NTY2Njc3Nzg4ODk5OTo6Ojs7Ozw8PD09PT4+Pj8/P0BAQEFBQUJCQkNDQ0REREVFRUZGRkdHR0hISElJSUpKSktLS0xMTE1NTU5OTk9PT1BQUFFRUVJSUlNTU1RUVFVVVVZWVldXV1hYWFlZWVpaWltbW1xcXF1dXV5eXl9fX2BgYGFhYWJiYmNjY2RkZGVlZWZmZmdnZ2hoaGlpaWpqamtra2xsbG1tbW5ubm9vb3BwcHFxcXJycnNzc3R0dHV1dXZ2dnd3d3h4eHl5eXp6ent7e3x8fH19fX5+fn9/f4CAgIGBgYKCgoODg4SEhIWFhYaGhoeHh4iIiImJiYqKiouLi4yMjI2NjY6Ojo+Pj5CQkJGRkZKSkpOTk5SUlJWVlZaWlpeXl5iYmJmZmZqampubm5ycnJ2dnZ6enp+fn6CgoKGhoaKioqOjo6SkpKWlpaampqenp6ioqKmpqaqqqqurq6ysrK2tra6urq+vr7CwsLGxsb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bvKtaC7ciq5bspzZ0/XXXHMqO3D9ZFatXfaXVWF5u0dru0stUGz52nXYbi6Ch7MkF/Yq/z2lRIFq2u/UJkiN76aTFPkTKKAQo226bKoclf9iYqsKTDXfrRIBSPMurVrfuXAuRPczRkzZ/q4yrPNjFm0wyLL9e4d7R5XacOldWUHLZo04En90YPuWnA8eYL3nStXTh31iem4IXOfF3q7eHZc1Yk3R54ru3Pn1hXMl3tjv3swCa47h256QAA7) center center no-repeat #f5f5f5}#alert{position:fixed;width:30%;margin:30px auto;top:10px;left:0;right:0;z-index:2000;display:none}#alert a{text-decoration:underline}.option-item .bootstrap-switch{margin:15px 10px}.option-item button{margin:10px}.option-item input[type=number]{margin:15px 10px;width:80px;height:28px;padding:3px 10px;vertical-align:middle}.option-item select{margin:10px;display:inline-block}button img,span.btn img{margin-right:3px;margin-bottom:1px}#edit-favourites{float:right;margin-top:-5px}#edit-favourites-list{margin:10px}.about-img-left{float:left;margin:10px 20px 20px 0}.about-img-right{float:right;margin:10px 0 20px 20px}.save-link-options{float:right}.save-link-options input{margin-left:10px}#save-footer{border-top:none;margin-top:0}a:focus,button{outline:0;-moz-outline-style:none}.btn-default{border-color:#ddd}.btn-default:focus{background-color:#fff;border-color:#adadad}.btn-default:active,.btn-default:hover{background-color:#ebebeb;border-color:#adadad}.alert,.btn,.btn-lg,.dropdown-menu,.form-control,.modal-content,.nav-tabs>li>a,.popover,.tooltip-inner{border-radius:0!important}input[type=search]{-webkit-appearance:searchfield;box-shadow:none}input[type=search]::-webkit-search-cancel-button{-webkit-appearance:searchfield-cancel-button}.modal{overflow-y:auto}.form-control{background-color:transparent}code{border:0;white-space:pre-wrap}.bootstrap-switch,.bootstrap-switch-container,.bootstrap-switch-handle-off,.bootstrap-switch-handle-on,.bootstrap-switch-label,pre{border-radius:0!important}#banner,.title{border-bottom:1px solid #ddd}blockquote{font-size:inherit}.panel-body:after,.panel-body:before{content:""}.sortable-ghost{opacity:.6}.colorpicker-element{float:left;margin-right:15px}.colorpicker-color,.colorpicker-color div{height:100px}.word-wrap{white-space:pre!important;word-wrap:normal!important;overflow-x:scroll!important}.clearfix{height:0}.blur{color:transparent!important;text-shadow:rgba(0,0,0,.95) 0 0 10px!important}.no-select{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.konami{-ms-transform:rotate(180deg);-webkit-transform:rotate(180deg);transform:rotate(180deg);-moz-transform:rotate(180deg)}.hl1,.hlyellow{background-color:#fff000}.hl2,.hlblue{background-color:#95dfff}.hl3,.hlred{background-color:#ffb6b6}.hl4,.hlorange{background-color:#fcf8e3}.hl5,.hlgreen{background-color:#8de768}.title{color:#424242;background-color:#fafafa}.gutter{background-color:#eee;background-repeat:no-repeat;background-position:50%}.gutter.gutter-horizontal{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAAeCAYAAAAGos/EAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAlSURBVChTYzxz5sx/BiBgAhEgwPju3TtUEZZ79+6BGcNcDQMDACWJMFs4hNOSAAAAAElFTkSuQmCC);cursor:ew-resize}.gutter.gutter-vertical{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAACCAYAAABPJGxCAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACHDwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKL2lDQ1BJQ0MgUHJvZmlsZQAASMedlndUVNcWh8+9d3qhzTDSGXqTLjCA9C4gHQRRGGYGGMoAwwxNbIioQEQREQFFkKCAAaOhSKyIYiEoqGAPSBBQYjCKqKhkRtZKfHl57+Xl98e939pn73P32XuftS4AJE8fLi8FlgIgmSfgB3o401eFR9Cx/QAGeIABpgAwWempvkHuwUAkLzcXerrICfyL3gwBSPy+ZejpT6eD/0/SrFS+AADIX8TmbE46S8T5Ik7KFKSK7TMipsYkihlG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keAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAI0lEQVQYV2M8c+bMfwYgUFJSAlEM9+7dA9O05jOBSboDBgYAtPcYZ1oUA30AAAAASUVORK5CYII=);cursor:ns-resize}.operation{border:1px solid #999;border-top-width:0}.op_list .operation{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1}#rec_list .operation{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.arg-input,select{height:34px;border:1px solid #ddd;background-color:#fff;color:#424242}#controls{border-top:1px solid #ddd;background-color:#fafafa}.textarea-wrapper div,.textarea-wrapper textarea{font-family:Consolas,monospace;font-size:inherit}.io-info{font-weight:400;font-size:8pt}.arg-title,.category-title{font-weight:700}.arg-input{font-size:15px;line-height:1.428571429}select{padding:6px 8px}.arg[disabled]{background-color:#eee}textarea.arg{color:#424242}.break{color:#b94a48!important;background-color:#f2dede!important;border-color:#eed3d7!important}.category-title{background-color:#fafafa;border-bottom:1px solid #eee}.category-title[aria-expanded=true],.category-title[href='#catFavourites']{border-bottom-color:#ddd}.category-title.collapsed{border-bottom-color:#eee}.category-title:hover{color:#3a87ad}#search{border-bottom:1px solid #e3e3e3}.dropping-file{border:5px dashed #3a87ad!important}.selected-op{color:#c09853!important;background-color:#fcf8e3!important;border-color:#fbeed5!important}.option-item input[type=number]{font-size:14px;line-height:1.428571429;color:#555;background-color:#fff;border:1px solid #ccc}.favourites-hover{color:#468847;background-color:#dff0d8;border:2px dashed #468847!important;padding:8px 8px 9px}#edit-favourites-list{border:1px solid #bce8f1}#edit-favourites-list .operation{border-left:none;border-right:none}#edit-favourites-list .operation:last-child{border-bottom:none}.subtext{font-style:italic;font-size:13px;color:#999}#save-footer{border-bottom:1px solid #e5e5e5}.flow-control-op{color:#396f3a!important;background-color:#c7e4ba!important;border-color:#b3dba2!important}.flow-control-op.break{color:#94312f!important;background-color:#eabfbf!important;border-color:#e2aeb5!important}#support-modal textarea{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif}#load-text,#save-text{font-family:Consolas,monospace}button.dropdown-toggle{background-color:#f4f4f4}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-track{background-color:#fafafa}::-webkit-scrollbar-thumb{background-color:#ccc}::-webkit-scrollbar-thumb:hover{background-color:#bbb}::-webkit-scrollbar-corner{background-color:#fafafa}.disabled{color:#999!important;background-color:#dfdfdf!important;border-color:#cdcdcd!important}.grey{color:#333;background-color:#f5f5f5;border-color:#ddd}.dark-blue{color:#fff;background-color:#428bca;border-color:#428bca}.red{color:#b94a48;background-color:#f2dede;border-color:#eed3d7}.amber{color:#c09853;background-color:#fcf8e3;border-color:#fbeed5}.green{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.blue{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1} Edit
                                                                                                                                                                      Operations
                                                                                                                                                                        Recipe
                                                                                                                                                                          Input
                                                                                                                                                                          Output
                                                                                                                                                                          Operations
                                                                                                                                                                            Recipe
                                                                                                                                                                              Input
                                                                                                                                                                              Output
                                                                                                                                                                              \ No newline at end of file +document.querySelector("link[rel=icon]").setAttribute("href","data:image/png;base64,"+a),document.querySelector("#bake img").setAttribute("src","data:image/png;base64,"+b),document.querySelector(".about-img-left").setAttribute("src","data:image/png;base64,"+c)},SeasonalWaiter.prototype.insert_spider_text=function(){document.title=document.title.replace(/Cyber/g,"Spider"),SeasonalWaiter.tree_walk(document.body,function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Cyber/g,"Spider"))},!0),SeasonalWaiter.tree_walk(document.getElementById("bake-group"),function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Bake/g,"Spin"))},!0),document.querySelector("#recipe .title").innerHTML="Web"},SeasonalWaiter.prototype.create_snow_option=function(){var a=document.getElementById("options-body"),b=document.createElement("div");b.className="option-item",b.innerHTML=" Let it snow",a.appendChild(b),this.manager.options.load()},SeasonalWaiter.prototype.let_it_snow=function(){if($(document).snowfall("clear"),this.app.options.snow){var a={},b=navigator.userAgent.match(/Firefox\/(\d\d?)/);a=b&&parseInt(b[1],10)<30?{flakeCount:10,flakeColor:"#fff",flakePosition:"absolute",minSize:1,maxSize:2,minSpeed:1,maxSpeed:5,round:!1,shadow:!1,collection:!1,collectionHeight:20,deviceorientation:!0}:{flakeCount:35,flakeColor:"#fff",flakePosition:"absolute",minSize:5,maxSize:8,minSpeed:1,maxSpeed:5,round:!0,shadow:!0,collection:".btn",collectionHeight:20,deviceorientation:!0},$(document).snowfall(a)}},SeasonalWaiter.prototype.shake_off_snow=function(a){for(var b=a.target,c=b.getBoundingClientRect(),d=document.querySelectorAll("canvas.snowfall-canvas"),e=null,f=function(){h.clearRect(0,0,e.width,e.height),$(this).fadeIn()},g=0;g6e4&&this.app.silent_bake()};var main=function(){var a=["To Base64","From Base64","To Hex","From Hex","To Hexdump","From Hexdump","URL Decode","Regular expression","Entropy","Fork"],b={update_url:!0,show_highlighter:!0,treat_as_utf8:!0,word_wrap:!0,show_errors:!0,error_timeout:4e3,auto_bake_threshold:200,attempt_highlight:!0,snow:!1};document.removeEventListener("DOMContentLoaded",main,!1),window.app=new HTMLApp(Categories,OperationConfig,a,b),window.app.setup()};window.console=console||{log:function(){},error:function(){}},window.compile_time=moment.tz("Tue Jan 31 2017 16:09:09","ddd MMM D YYYY HH:mm:ss","UTC").valueOf(),window.compile_message="",document.addEventListener("DOMContentLoaded",main,!1); \ No newline at end of file diff --git a/build/prod/index.html b/build/prod/index.html index bdfc1d6f..824ff968 100755 --- a/build/prod/index.html +++ b/build/prod/index.html @@ -18,4 +18,4 @@ See the License for the specific language governing permissions and limitations under the License. --> -CyberChef Edit
                                                                                                                                                                              Operations
                                                                                                                                                                                Recipe
                                                                                                                                                                                  Input
                                                                                                                                                                                  Output
                                                                                                                                                                                  \ No newline at end of file +CyberChef Edit
                                                                                                                                                                                  Operations
                                                                                                                                                                                    Recipe
                                                                                                                                                                                      Input
                                                                                                                                                                                      Output
                                                                                                                                                                                      \ No newline at end of file diff --git a/build/prod/scripts.js b/build/prod/scripts.js index 10796b9a..29232a45 100755 --- a/build/prod/scripts.js +++ b/build/prod/scripts.js @@ -288,4 +288,4 @@ var l="";for(g=0;g
                                                                                                                                                                                      Expects addresses in a list separated by newlines, spaces or commas.

                                                                                                                                                                                      WARNING: There are no validity checks.",run:MAC.run_format,input_type:"string",output_type:"string",args:[{name:"Output case",type:"option",value:MAC.OUTPUT_CASE},{name:"No delimiter",type:"boolean",value:MAC.NO_DELIM},{name:"Dash delimiter",type:"boolean",value:MAC.DASH_DELIM},{name:"Colon delimiter",type:"boolean",value:MAC.COLON_DELIM},{name:"Cisco style",type:"boolean",value:MAC.CISCO_STYLE}]},"Offset checker":{description:"Compares multiple inputs (separated by the specified delimiter) and highlights matching characters which appear at the same position in all samples.",run:StrUtils.run_offset_checker,input_type:"string",output_type:"html",args:[{name:"Sample delimiter",type:"binary_string",value:StrUtils.OFF_CHK_SAMPLE_DELIMITER}]},"Remove whitespace":{description:"Optionally removes all spaces, carriage returns, line feeds, tabs and form feeds from the input data.

                                                                                                                                                                                      This operation also supports the removal of full stops which are sometimes used to represent non-printable bytes in ASCII output.",run:Tidy.run_remove_whitespace,input_type:"string",output_type:"string",args:[{name:"Spaces",type:"boolean",value:Tidy.REMOVE_SPACES},{name:"Carriage returns (\\r)",type:"boolean",value:Tidy.REMOVE_CARIAGE_RETURNS},{name:"Line feeds (\\n)",type:"boolean",value:Tidy.REMOVE_LINE_FEEDS},{name:"Tabs",type:"boolean",value:Tidy.REMOVE_TABS},{name:"Form feeds (\\f)",type:"boolean",value:Tidy.REMOVE_FORM_FEEDS},{name:"Full stops",type:"boolean",value:Tidy.REMOVE_FULL_STOPS}]},"Remove null bytes":{description:"Removes all null bytes (0x00) from the input.",run:Tidy.run_remove_nulls,input_type:"byte_array",output_type:"byte_array",args:[]},"Drop bytes":{description:"Cuts the specified number of bytes out of the data.",run:Tidy.run_drop_bytes,input_type:"byte_array",output_type:"byte_array",args:[{name:"Start",type:"number",value:Tidy.DROP_START},{name:"Length",type:"number",value:Tidy.DROP_LENGTH},{name:"Apply to each line",type:"boolean",value:Tidy.APPLY_TO_EACH_LINE}]},"Take bytes":{description:"Takes a slice of the specified number of bytes from the data.",run:Tidy.run_take_bytes,input_type:"byte_array",output_type:"byte_array",args:[{name:"Start",type:"number",value:Tidy.TAKE_START},{name:"Length",type:"number",value:Tidy.TAKE_LENGTH},{name:"Apply to each line",type:"boolean",value:Tidy.APPLY_TO_EACH_LINE}]},"Pad lines":{description:"Add the specified number of the specified character to the beginning or end of each line",run:Tidy.run_pad,input_type:"string",output_type:"string",args:[{name:"Position",type:"option",value:Tidy.PAD_POSITION},{name:"Length",type:"number",value:Tidy.PAD_LENGTH},{name:"Character",type:"binary_short_string",value:Tidy.PAD_CHAR}]},Reverse:{description:"Reverses the input string.",run:SeqUtils.run_reverse,input_type:"byte_array",output_type:"byte_array",args:[{name:"By",type:"option",value:SeqUtils.REVERSE_BY}]},Sort:{description:"Alphabetically sorts strings separated by the specified delimiter.

                                                                                                                                                                                      The IP address option supports IPv4 only.",run:SeqUtils.run_sort,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"option",value:SeqUtils.DELIMITER_OPTIONS},{name:"Reverse",type:"boolean",value:SeqUtils.SORT_REVERSE},{name:"Order",type:"option",value:SeqUtils.SORT_ORDER}]},Unique:{description:"Removes duplicate strings from the input.",run:SeqUtils.run_unique,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"option",value:SeqUtils.DELIMITER_OPTIONS}]},"Count occurrences":{description:"Counts the number of times the provided string occurs in the input.",run:SeqUtils.run_count,input_type:"string",output_type:"number",args:[{name:"Search string",type:"toggle_string",value:"",toggle_values:SeqUtils.SEARCH_TYPE}]},"Add line numbers":{description:"Adds line numbers to the output.",run:SeqUtils.run_add_line_numbers,input_type:"string",output_type:"string",args:[]},"Remove line numbers":{description:"Removes line numbers from the output if they can be trivially detected.",run:SeqUtils.run_remove_line_numbers,input_type:"string",output_type:"string",args:[]},"Find / Replace":{description:"Replaces all occurrences of the first string with the second.

                                                                                                                                                                                      The three match options are only relevant to regex search strings.",run:StrUtils.run_find_replace,manual_bake:!0,input_type:"string",output_type:"string",args:[{name:"Find",type:"toggle_string",value:"",toggle_values:StrUtils.SEARCH_TYPE},{name:"Replace",type:"binary_string",value:""},{name:"Global match",type:"boolean",value:StrUtils.FIND_REPLACE_GLOBAL},{name:"Case insensitive",type:"boolean",value:StrUtils.FIND_REPLACE_CASE},{name:"Multiline matching",type:"boolean",value:StrUtils.FIND_REPLACE_MULTILINE}]},"To Upper case":{description:"Converts the input string to upper case, optionally limiting scope to only the first character in each word, sentence or paragraph.",run:StrUtils.run_upper,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[{name:"Scope",type:"option",value:StrUtils.CASE_SCOPE}]},"To Lower case":{description:"Converts every character in the input to lower case.",run:StrUtils.run_lower,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[]},Split:{description:"Splits a string into sections around a given delimiter.",run:StrUtils.run_split,input_type:"string",output_type:"string",args:[{name:"Split delimiter",type:"binary_short_string",value:StrUtils.SPLIT_DELIM},{name:"Join delimiter",type:"option",value:StrUtils.DELIMITER_OPTIONS}]},Filter:{description:"Splits up the input using the specified delimiter and then filters each branch based on a regular expression.",run:StrUtils.run_filter,manual_bake:!0,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"option",value:StrUtils.DELIMITER_OPTIONS},{name:"Regex",type:"string",value:""},{name:"Invert condition",type:"boolean",value:SeqUtils.SORT_REVERSE}]},Strings:{description:"Extracts all strings from the input.",run:Extract.run_strings,input_type:"string",output_type:"string",args:[{name:"Minimum length",type:"number",value:Extract.MIN_STRING_LEN},{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract IP addresses":{description:"Extracts all IPv4 and IPv6 addresses.

                                                                                                                                                                                      Warning: Given a string 710.65.0.456, this will match 10.65.0.45 so always check the original input!",run:Extract.run_ip,input_type:"string",output_type:"string",args:[{name:"IPv4",type:"boolean",value:Extract.INCLUDE_IPV4},{name:"IPv6",type:"boolean",value:Extract.INCLUDE_IPV6},{name:"Remove local IPv4 addresses",type:"boolean",value:Extract.REMOVE_LOCAL},{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract email addresses":{description:"Extracts all email addresses from the input.",run:Extract.run_email,input_type:"string",output_type:"string",args:[{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract MAC addresses":{description:"Extracts all Media Access Control (MAC) addresses from the input.",run:Extract.run_mac,input_type:"string",output_type:"string",args:[{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract URLs":{description:"Extracts Uniform Resource Locators (URLs) from the input. The protocol (http, ftp etc.) is required otherwise there will be far too many false positives.",run:Extract.run_urls,input_type:"string",output_type:"string",args:[{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract domains":{description:"Extracts domain names with common Top-Level Domains (TLDs).
                                                                                                                                                                                      Note that this will not include paths. Use Extract URLs to find entire URLs.",run:Extract.run_domains,input_type:"string",output_type:"string",args:[{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract file paths":{description:"Extracts anything that looks like a Windows or UNIX file path.

                                                                                                                                                                                      Note that if UNIX is selected, there will likely be a lot of false positives.",run:Extract.run_file_paths,input_type:"string",output_type:"string",args:[{name:"Windows",type:"boolean",value:Extract.INCLUDE_WIN_PATH},{name:"UNIX",type:"boolean",value:Extract.INCLUDE_UNIX_PATH},{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Extract dates":{description:"Extracts dates in the following formats
                                                                                                                                                                                      • yyyy-mm-dd
                                                                                                                                                                                      • dd/mm/yyyy
                                                                                                                                                                                      • mm/dd/yyyy
                                                                                                                                                                                      Dividers can be any of /, -, . or space",run:Extract.run_dates,input_type:"string",output_type:"string",args:[{name:"Display total",type:"boolean",value:Extract.DISPLAY_TOTAL}]},"Regular expression":{description:"Define your own regular expression to search the input data with, optionally choosing from a list of pre-defined patterns.",run:StrUtils.run_regex,manual_bake:!0,input_type:"string",output_type:"html",args:[{name:"Built in regexes",type:"populate_option",value:StrUtils.REGEX_PRE_POPULATE,target:1},{name:"Regex",type:"text",value:""},{name:"Case insensitive",type:"boolean",value:StrUtils.REGEX_CASE_INSENSITIVE},{name:"Multiline matching",type:"boolean",value:StrUtils.REGEX_MULTILINE_MATCHING},{name:"Display total",type:"boolean",value:StrUtils.DISPLAY_TOTAL},{name:"Output format",type:"option",value:StrUtils.OUTPUT_FORMAT}]},"XPath expression":{description:"Extract information from an XML document with an XPath query",run:Code.run_xpath,input_type:"string",output_type:"string",args:[{name:"XPath",type:"string",value:Code.XPATH_INITIAL},{name:"Result delimiter",type:"binary_short_string",value:Code.XPATH_DELIMITER}]},"CSS selector":{description:"Extract information from an HTML document with a CSS selector",run:Code.run_css_query,input_type:"string",output_type:"string",args:[{name:"CSS selector",type:"string",value:Code.CSS_SELECTOR_INITIAL},{name:"Delimiter",type:"binary_short_string",value:Code.CSS_QUERY_DELIMITER}]},"From UNIX Timestamp":{description:"Converts a UNIX timestamp to a datetime string.

                                                                                                                                                                                      e.g. 978346800 becomes Mon 1 January 2001 11:00:00 UTC",run:DateTime.run_from_unix_timestamp,input_type:"number",output_type:"string",args:[{name:"Units",type:"option",value:DateTime.UNITS}]},"To UNIX Timestamp":{description:"Parses a datetime string and returns the corresponding UNIX timestamp.

                                                                                                                                                                                      e.g. Mon 1 January 2001 11:00:00 UTC becomes 978346800",run:DateTime.run_to_unix_timestamp,input_type:"string",output_type:"number",args:[{name:"Units",type:"option",value:DateTime.UNITS}]},"Translate DateTime Format":{description:"Parses a datetime string in one format and re-writes it in another.

                                                                                                                                                                                      Run with no input to see the relevant format string examples.",run:DateTime.run_translate_format,input_type:"string",output_type:"html",args:[{name:"Built in formats",type:"populate_option",value:DateTime.DATETIME_FORMATS,target:1},{name:"Input format string",type:"binary_string",value:DateTime.INPUT_FORMAT_STRING},{name:"Input timezone",type:"option",value:DateTime.TIMEZONES},{name:"Output format string",type:"binary_string",value:DateTime.OUTPUT_FORMAT_STRING},{name:"Output timezone",type:"option",value:DateTime.TIMEZONES}]},"Parse DateTime":{description:"Parses a DateTime string in your specified format and displays it in whichever timezone you choose with the following information:
                                                                                                                                                                                      • Date
                                                                                                                                                                                      • Time
                                                                                                                                                                                      • Period (AM/PM)
                                                                                                                                                                                      • Timezone
                                                                                                                                                                                      • UTC offset
                                                                                                                                                                                      • Daylight Saving Time
                                                                                                                                                                                      • Leap year
                                                                                                                                                                                      • Days in this month
                                                                                                                                                                                      • Day of year
                                                                                                                                                                                      • Week number
                                                                                                                                                                                      • Quarter
                                                                                                                                                                                      Run with no input to see format string examples if required.",run:DateTime.run_parse,input_type:"string",output_type:"html",args:[{name:"Built in formats",type:"populate_option",value:DateTime.DATETIME_FORMATS,target:1},{name:"Input format string",type:"binary_string",value:DateTime.INPUT_FORMAT_STRING},{name:"Input timezone",type:"option",value:DateTime.TIMEZONES}]},"Convert distance":{description:"Converts a unit of distance to another format.",run:Convert.run_distance,input_type:"number",output_type:"number",args:[{name:"Input units",type:"option",value:Convert.DISTANCE_UNITS},{name:"Output units",type:"option",value:Convert.DISTANCE_UNITS}]},"Convert area":{description:"Converts a unit of area to another format.",run:Convert.run_area,input_type:"number",output_type:"number",args:[{name:"Input units",type:"option",value:Convert.AREA_UNITS},{name:"Output units",type:"option",value:Convert.AREA_UNITS}]},"Convert mass":{description:"Converts a unit of mass to another format.",run:Convert.run_mass,input_type:"number",output_type:"number",args:[{name:"Input units",type:"option",value:Convert.MASS_UNITS},{name:"Output units",type:"option",value:Convert.MASS_UNITS}]},"Convert speed":{description:"Converts a unit of speed to another format.",run:Convert.run_speed,input_type:"number",output_type:"number",args:[{name:"Input units",type:"option",value:Convert.SPEED_UNITS},{name:"Output units",type:"option",value:Convert.SPEED_UNITS}]},"Convert data units":{description:"Converts a unit of data to another format.",run:Convert.run_data_size,input_type:"number",output_type:"number",args:[{name:"Input units",type:"option",value:Convert.DATA_UNITS},{name:"Output units",type:"option",value:Convert.DATA_UNITS}]},"Raw Deflate":{description:"Compresses data using the deflate algorithm with no headers.",run:Compress.run_raw_deflate,input_type:"byte_array",output_type:"byte_array",args:[{name:"Compression type",type:"option",value:Compress.COMPRESSION_TYPE}]},"Raw Inflate":{description:"Decompresses data which has been compressed using the deflate algorithm with no headers.",run:Compress.run_raw_inflate,input_type:"byte_array",output_type:"byte_array",args:[{name:"Start index",type:"number",value:Compress.INFLATE_INDEX},{name:"Initial output buffer size",type:"number",value:Compress.INFLATE_BUFFER_SIZE},{name:"Buffer expansion type",type:"option",value:Compress.INFLATE_BUFFER_TYPE},{name:"Resize buffer after decompression",type:"boolean",value:Compress.INFLATE_RESIZE},{name:"Verify result",type:"boolean",value:Compress.INFLATE_VERIFY}]},"Zlib Deflate":{description:"Compresses data using the deflate algorithm adding zlib headers.",run:Compress.run_zlib_deflate,input_type:"byte_array",output_type:"byte_array",args:[{name:"Compression type",type:"option",value:Compress.COMPRESSION_TYPE}]},"Zlib Inflate":{description:"Decompresses data which has been compressed using the deflate algorithm with zlib headers.",run:Compress.run_zlib_inflate,input_type:"byte_array",output_type:"byte_array",args:[{name:"Start index",type:"number",value:Compress.INFLATE_INDEX},{name:"Initial output buffer size",type:"number",value:Compress.INFLATE_BUFFER_SIZE},{name:"Buffer expansion type",type:"option",value:Compress.INFLATE_BUFFER_TYPE},{name:"Resize buffer after decompression",type:"boolean",value:Compress.INFLATE_RESIZE},{name:"Verify result",type:"boolean",value:Compress.INFLATE_VERIFY}]},Gzip:{description:"Compresses data using the deflate algorithm with gzip headers.",run:Compress.run_gzip,input_type:"byte_array",output_type:"byte_array",args:[{name:"Compression type",type:"option",value:Compress.COMPRESSION_TYPE},{name:"Filename (optional)",type:"string",value:""},{name:"Comment (optional)",type:"string",value:""},{name:"Include file checksum",type:"boolean",value:Compress.GZIP_CHECKSUM}]},Gunzip:{description:"Decompresses data which has been compressed using the deflate algorithm with gzip headers.",run:Compress.run_gunzip,input_type:"byte_array",output_type:"byte_array",args:[]},Zip:{description:"Compresses data using the PKZIP algorithm with the given filename.

                                                                                                                                                                                      No support for multiple files at this time.",run:Compress.run_pkzip,input_type:"byte_array",output_type:"byte_array",args:[{name:"Filename",type:"string",value:Compress.PKZIP_FILENAME},{name:"Comment",type:"string",value:""},{name:"Password",type:"binary_string",value:""},{name:"Compression method",type:"option",value:Compress.COMPRESSION_METHOD},{name:"Operating system",type:"option",value:Compress.OS},{name:"Compression type",type:"option",value:Compress.COMPRESSION_TYPE}]},Unzip:{description:"Decompresses data using the PKZIP algorithm and displays it per file, with support for passwords.",run:Compress.run_pkunzip,input_type:"byte_array",output_type:"html",args:[{name:"Password",type:"binary_string",value:""},{name:"Verify result",type:"boolean",value:Compress.PKUNZIP_VERIFY}]},"Bzip2 Decompress":{description:"Decompresses data using the Bzip2 algorithm.",run:Compress.run_bzip2_decompress,input_type:"byte_array",output_type:"string",args:[]},"Generic Code Beautify":{description:"Attempts to pretty print C-style languages such as C, C++, C#, Java, PHP, JavaScript etc.

                                                                                                                                                                                      This will not do a perfect job, and the resulting code may not work any more. This operation is designed purely to make obfuscated or minified code more easy to read and understand.

                                                                                                                                                                                      Things which will not work properly:
                                                                                                                                                                                      • For loop formatting
                                                                                                                                                                                      • Do-While loop formatting
                                                                                                                                                                                      • Switch/Case indentation
                                                                                                                                                                                      • Certain bit shift operators
                                                                                                                                                                                      ",run:Code.run_generic_beautify,input_type:"string",output_type:"string",args:[]},"JavaScript Parser":{description:"Returns an Abstract Syntax Tree for valid JavaScript code.",run:JS.run_parse,input_type:"string",output_type:"string",args:[{name:"Location info",type:"boolean",value:JS.PARSE_LOC},{name:"Range info",type:"boolean",value:JS.PARSE_RANGE},{name:"Include tokens array",type:"boolean",value:JS.PARSE_TOKENS},{name:"Include comments array",type:"boolean",value:JS.PARSE_COMMENT},{name:"Report errors and try to continue",type:"boolean",value:JS.PARSE_TOLERANT}]},"JavaScript Beautify":{description:"Parses and pretty prints valid JavaScript code. Also works with JavaScript Object Notation (JSON).",run:JS.run_beautify,input_type:"string",output_type:"string",args:[{name:"Indent string",type:"binary_short_string",value:JS.BEAUTIFY_INDENT},{name:"Quotes",type:"option",value:JS.BEAUTIFY_QUOTES},{name:"Semicolons before closing braces",type:"boolean",value:JS.BEAUTIFY_SEMICOLONS},{name:"Include comments",type:"boolean",value:JS.BEAUTIFY_COMMENT}]},"JavaScript Minify":{description:"Compresses JavaScript code.",run:JS.run_minify,input_type:"string",output_type:"string",args:[]},"XML Beautify":{description:"Indents and prettifies eXtensible Markup Language (XML) code.",run:Code.run_xml_beautify,input_type:"string",output_type:"string",args:[{name:"Indent string",type:"binary_short_string",value:Code.BEAUTIFY_INDENT}]},"JSON Beautify":{description:"Indents and prettifies JavaScript Object Notation (JSON) code.",run:Code.run_json_beautify,input_type:"string",output_type:"string",args:[{name:"Indent string",type:"binary_short_string",value:Code.BEAUTIFY_INDENT}]},"CSS Beautify":{description:"Indents and prettifies Cascading Style Sheets (CSS) code.",run:Code.run_css_beautify,input_type:"string",output_type:"string",args:[{name:"Indent string",type:"binary_short_string",value:Code.BEAUTIFY_INDENT}]},"SQL Beautify":{description:"Indents and prettifies Structured Query Language (SQL) code.",run:Code.run_sql_beautify,input_type:"string",output_type:"string",args:[{name:"Indent string",type:"binary_short_string",value:Code.BEAUTIFY_INDENT}]},"XML Minify":{description:"Compresses eXtensible Markup Language (XML) code.",run:Code.run_xml_minify,input_type:"string",output_type:"string",args:[{name:"Preserve comments",type:"boolean",value:Code.PRESERVE_COMMENTS}]},"JSON Minify":{description:"Compresses JavaScript Object Notation (JSON) code.",run:Code.run_json_minify,input_type:"string",output_type:"string",args:[]},"CSS Minify":{description:"Compresses Cascading Style Sheets (CSS) code.",run:Code.run_css_minify,input_type:"string",output_type:"string",args:[{name:"Preserve comments",type:"boolean",value:Code.PRESERVE_COMMENTS}]},"SQL Minify":{description:"Compresses Structured Query Language (SQL) code.",run:Code.run_sql_minify,input_type:"string",output_type:"string",args:[]},"Analyse hash":{description:"Tries to determine information about a given hash and suggests which algorithm may have been used to generate it based on its length.",run:Hash.run_analyse,input_type:"string",output_type:"string",args:[]},MD2:{description:"The MD2 (Message-Digest 2) algorithm is a cryptographic hash function developed by Ronald Rivest in 1989. The algorithm is optimized for 8-bit computers.

                                                                                                                                                                                      Although MD2 is no longer considered secure, even as of 2014, it remains in use in public key infrastructures as part of certificates generated with MD2 and RSA.",run:Hash.run_md2,input_type:"string",output_type:"string",args:[]},MD4:{description:"The MD4 (Message-Digest 4) algorithm is a cryptographic hash function developed by Ronald Rivest in 1990. The digest length is 128 bits. The algorithm has influenced later designs, such as the MD5, SHA-1 and RIPEMD algorithms.

                                                                                                                                                                                      The security of MD4 has been severely compromised.",run:Hash.run_md4,input_type:"string",output_type:"string",args:[]},MD5:{description:"MD5 (Message-Digest 5) is a widely used hash function. It has been used in a variety of security applications and is also commonly used to check the integrity of files.

                                                                                                                                                                                      However, MD5 is not collision resistant and it isn't suitable for applications like SSL/TLS certificates or digital signatures that rely on this property.",run:Hash.run_md5,input_type:"string",output_type:"string",args:[]},SHA0:{description:"SHA-0 is a retronym applied to the original version of the 160-bit hash function published in 1993 under the name 'SHA'. It was withdrawn shortly after publication due to an undisclosed 'significant flaw' and replaced by the slightly revised version SHA-1.",run:Hash.run_sha0,input_type:"string",output_type:"string",args:[]},SHA1:{description:"The SHA (Secure Hash Algorithm) hash functions were designed by the NSA. SHA-1 is the most established of the existing SHA hash functions and it is used in a variety of security applications and protocols.

                                                                                                                                                                                      However, SHA-1's collision resistance has been weakening as new attacks are discovered or improved.",run:Hash.run_sha1,input_type:"string",output_type:"string",args:[]},SHA224:{description:"SHA-224 is largely identical to SHA-256 but is truncated to 224 bytes.",run:Hash.run_sha224,input_type:"string",output_type:"string",args:[]},SHA256:{description:"SHA-256 is one of the four variants in the SHA-2 set. It isn't as widely used as SHA-1, though it provides much better security.",run:Hash.run_sha256,input_type:"string",output_type:"string",args:[]},SHA384:{description:"SHA-384 is largely identical to SHA-512 but is truncated to 384 bytes.",run:Hash.run_sha384,input_type:"string",output_type:"string",args:[]},SHA512:{description:"SHA-512 is largely identical to SHA-256 but operates on 64-bit words rather than 32.",run:Hash.run_sha512,input_type:"string",output_type:"string",args:[]},SHA3:{description:"This is an implementation of Keccak[c=2d]. SHA3 functions based on different implementations of Keccak will give different results.",run:Hash.run_sha3,input_type:"string",output_type:"string",args:[{name:"Output length",type:"option",value:Hash.SHA3_LENGTH}]},"RIPEMD-160":{description:"RIPEMD (RACE Integrity Primitives Evaluation Message Digest) is a family of cryptographic hash functions developed in Leuven, Belgium, by Hans Dobbertin, Antoon Bosselaers and Bart Preneel at the COSIC research group at the Katholieke Universiteit Leuven, and first published in 1996.

                                                                                                                                                                                      RIPEMD was based upon the design principles used in MD4, and is similar in performance to the more popular SHA-1.

                                                                                                                                                                                      RIPEMD-160 is an improved, 160-bit version of the original RIPEMD, and the most common version in the family.",run:Hash.run_ripemd160,input_type:"string",output_type:"string",args:[]},HMAC:{description:"Keyed-Hash Message Authentication Codes (HMAC) are a mechanism for message authentication using cryptographic hash functions.",run:Hash.run_hmac,input_type:"string",output_type:"string",args:[{name:"Password",type:"binary_string",value:""},{name:"Hashing function",type:"option",value:Hash.HMAC_FUNCTIONS}]},"Fletcher-8 Checksum":{description:"The Fletcher checksum is an algorithm for computing a position-dependent checksum devised by John Gould Fletcher at Lawrence Livermore Labs in the late 1970s.

                                                                                                                                                                                      The objective of the Fletcher checksum was to provide error-detection properties approaching those of a cyclic redundancy check but with the lower computational effort associated with summation techniques.",run:Checksum.run_fletcher8,input_type:"byte_array",output_type:"string",args:[]},"Fletcher-16 Checksum":{description:"The Fletcher checksum is an algorithm for computing a position-dependent checksum devised by John Gould Fletcher at Lawrence Livermore Labs in the late 1970s.

                                                                                                                                                                                      The objective of the Fletcher checksum was to provide error-detection properties approaching those of a cyclic redundancy check but with the lower computational effort associated with summation techniques.",run:Checksum.run_fletcher16,input_type:"byte_array",output_type:"string",args:[]},"Fletcher-32 Checksum":{description:"The Fletcher checksum is an algorithm for computing a position-dependent checksum devised by John Gould Fletcher at Lawrence Livermore Labs in the late 1970s.

                                                                                                                                                                                      The objective of the Fletcher checksum was to provide error-detection properties approaching those of a cyclic redundancy check but with the lower computational effort associated with summation techniques.",run:Checksum.run_fletcher32,input_type:"byte_array",output_type:"string",args:[]},"Fletcher-64 Checksum":{description:"The Fletcher checksum is an algorithm for computing a position-dependent checksum devised by John Gould Fletcher at Lawrence Livermore Labs in the late 1970s.

                                                                                                                                                                                      The objective of the Fletcher checksum was to provide error-detection properties approaching those of a cyclic redundancy check but with the lower computational effort associated with summation techniques.",run:Checksum.run_fletcher64,input_type:"byte_array",output_type:"string",args:[]},"Adler-32 Checksum":{description:"Adler-32 is a checksum algorithm which was invented by Mark Adler in 1995, and is a modification of the Fletcher checksum. Compared to a cyclic redundancy check of the same length, it trades reliability for speed (preferring the latter).

                                                                                                                                                                                      Adler-32 is more reliable than Fletcher-16, and slightly less reliable than Fletcher-32.",run:Checksum.run_adler32,input_type:"byte_array",output_type:"string",args:[]},"CRC-32 Checksum":{description:"A cyclic redundancy check (CRC) is an error-detecting code commonly used in digital networks and storage devices to detect accidental changes to raw data.

                                                                                                                                                                                      The CRC was invented by W. Wesley Peterson in 1961; the 32-bit CRC function of Ethernet and many other standards is the work of several researchers and was published in 1975.",run:Checksum.run_crc32,input_type:"byte_array",output_type:"string",args:[]},"Generate all hashes":{description:"Generates all available hashes and checksums for the input.",run:Hash.run_all,input_type:"string",output_type:"string",args:[]},Entropy:{description:"Calculates the Shannon entropy of the input data which gives an idea of its randomness. 8 is the maximum.",run:Entropy.run_entropy,input_type:"byte_array",output_type:"html",args:[{name:"Chunk size",type:"number",value:Entropy.CHUNK_SIZE}]},"Frequency distribution":{description:"Displays the distribution of bytes in the data as a graph.",run:Entropy.run_freq_distrib,input_type:"byte_array",output_type:"html",args:[{name:"Show 0%'s",type:"boolean",value:Entropy.FREQ_ZEROS}]},Numberwang:{description:"Based on the popular gameshow by Mitchell and Webb.",run:Numberwang.run,input_type:"string",output_type:"string",args:[]},"Parse X.509 certificate":{description:"X.509 is an ITU-T standard for a public key infrastructure (PKI) and Privilege Management Infrastructure (PMI). It is commonly involved with SSL/TLS security.

                                                                                                                                                                                      This operation displays the contents of a certificate in a human readable format, similar to the openssl command line tool.",run:PublicKey.run_parse_x509,input_type:"string",output_type:"string",args:[{name:"Input format",type:"option",value:PublicKey.X509_INPUT_FORMAT}]},"PEM to Hex":{description:"Converts PEM (Privacy Enhanced Mail) format to a hexadecimal DER (Distinguished Encoding Rules) string.",run:PublicKey.run_pem_to_hex,input_type:"string",output_type:"string",args:[]},"Hex to PEM":{description:"Converts a hexadecimal DER (Distinguished Encoding Rules) string into PEM (Privacy Enhanced Mail) format.",run:PublicKey.run_hex_to_pem,input_type:"string",output_type:"string",args:[{name:"Header string",type:"string",value:PublicKey.PEM_HEADER_STRING}]},"Hex to Object Identifier":{description:"Converts a hexadecimal string into an object identifier (OID).",run:PublicKey.run_hex_to_object_identifier,input_type:"string",output_type:"string",args:[]},"Object Identifier to Hex":{description:"Converts an object identifier (OID) into a hexadecimal string.",run:PublicKey.run_object_identifier_to_hex,input_type:"string",output_type:"string",args:[]},"Parse ASN.1 hex string":{description:"Abstract Syntax Notation One (ASN.1) is a standard and notation that describes rules and structures for representing, encoding, transmitting, and decoding data in telecommunications and computer networking.

                                                                                                                                                                                      This operation parses arbitrary ASN.1 data and presents the resulting tree.", run:PublicKey.run_parse_asn1_hex_string,input_type:"string",output_type:"string",args:[{name:"Starting index",type:"number",value:0},{name:"Truncate octet strings longer than",type:"number",value:PublicKey.ASN1_TRUNCATE_LENGTH}]},"Detect File Type":{description:"Attempts to guess the MIME (Multipurpose Internet Mail Extensions) type of the data based on 'magic bytes'.

                                                                                                                                                                                      Currently supports the following file types: 7z, amr, avi, bmp, bz2, class, cr2, crx, dex, dmg, doc, elf, eot, epub, exe, flac, flv, gif, gz, ico, iso, jpg, jxr, m4a, m4v, mid, mkv, mov, mp3, mp4, mpg, ogg, otf, pdf, png, ppt, ps, psd, rar, rtf, sqlite, swf, tar, tar.z, tif, ttf, utf8, vmdk, wav, webm, webp, wmv, woff, woff2, xls, xz, zip.",run:FileType.run_detect,input_type:"byte_array",output_type:"string",args:[]},"Scan for Embedded Files":{description:"Scans the data for potential embedded files by looking for magic bytes at all offsets. This operation is prone to false positives.

                                                                                                                                                                                      WARNING: Files over about 100KB in size will take a VERY long time to process.",run:FileType.run_scan_for_embedded_files,input_type:"byte_array",output_type:"string",args:[{name:"Ignore common byte sequences",type:"boolean",value:FileType.IGNORE_COMMON_BYTE_SEQUENCES}]},"Expand alphabet range":{description:"Expand an alphabet range string into a list of the characters in that range.

                                                                                                                                                                                      e.g. a-z becomes abcdefghijklmnopqrstuvwxyz.",run:SeqUtils.run_expand_alph_range,input_type:"string",output_type:"string",args:[{name:"Delimiter",type:"binary_string",value:""}]},Diff:{description:"Compares two inputs (separated by the specified delimiter) and highlights the differences between them.",run:StrUtils.run_diff,input_type:"string",output_type:"html",args:[{name:"Sample delimiter",type:"binary_string",value:StrUtils.DIFF_SAMPLE_DELIMITER},{name:"Diff by",type:"option",value:StrUtils.DIFF_BY},{name:"Show added",type:"boolean",value:!0},{name:"Show removed",type:"boolean",value:!0},{name:"Ignore whitespace (relevant for word and line)",type:"boolean",value:!1}]},"Parse UNIX file permissions":{description:"Given a UNIX/Linux file permission string in octal or textual format, this operation explains which permissions are granted to which user groups.

                                                                                                                                                                                      Input should be in either octal (e.g. 755) or textual (e.g. drwxr-xr-x) format.",run:OS.run_parse_unix_perms,input_type:"string",output_type:"string",args:[]},"Swap endianness":{description:"Switches the data from big-endian to little-endian or vice-versa. Data can be read in as hexadecimal or raw bytes. It will be returned in the same format as it is entered.",run:Endian.run_swap_endianness,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"string",args:[{name:"Data format",type:"option",value:Endian.DATA_FORMAT},{name:"Word length (bytes)",type:"number",value:Endian.WORD_LENGTH},{name:"Pad incomplete words",type:"boolean",value:Endian.PAD_INCOMPLETE_WORDS}]},"Syntax highlighter":{description:"Adds syntax highlighting to a range of source code languages. Note that this will not indent the code. Use one of the 'Beautify' operations for that.",run:Code.run_syntax_highlight,highlight:!0,highlight_reverse:!0,input_type:"string",output_type:"html",args:[{name:"Language/File extension",type:"option",value:Code.LANGUAGES},{name:"Display line numbers",type:"boolean",value:Code.LINE_NUMS}]},"Parse escaped string":{description:"Replaces escaped characters with the bytes they represent.

                                                                                                                                                                                      e.g.Hello\\nWorld becomes Hello
                                                                                                                                                                                      World
                                                                                                                                                                                      ",run:StrUtils.run_parse_escaped_string,input_type:"string",output_type:"string",args:[]},"TCP/IP Checksum":{description:"Calculates the checksum for a TCP (Transport Control Protocol) or IP (Internet Protocol) header from an input of raw bytes.",run:Checksum.run_tcp_ip,input_type:"byte_array",output_type:"string",args:[]},"Parse colour code":{description:"Converts a colour code in a standard format to other standard formats and displays the colour itself.

                                                                                                                                                                                      Example inputs
                                                                                                                                                                                      • #d9edf7
                                                                                                                                                                                      • rgba(217,237,247,1)
                                                                                                                                                                                      • hsla(200,65%,91%,1)
                                                                                                                                                                                      • cmyk(0.12, 0.04, 0.00, 0.03)
                                                                                                                                                                                      ",run:HTML.run_parse_colour_code,input_type:"string",output_type:"html",args:[]},"Generate UUID":{description:"Generates an RFC 4122 version 4 compliant Universally Unique Identifier (UUID), also known as a Globally Unique Identifier (GUID).

                                                                                                                                                                                      A version 4 UUID relies on random numbers, in this case generated using window.crypto if available and falling back to Math.random if not.",run:UUID.run_generate_v4,input_type:"string",output_type:"string",args:[]},Substitute:{description:"A substitution cipher allowing you to specify bytes to replace with other byte values. This can be used to create Caesar ciphers but is more powerful as any byte value can be substituted, not just letters, and the substitution values need not be in order.

                                                                                                                                                                                      Enter the bytes you want to replace in the Plaintext field and the bytes to replace them with in the Ciphertext field.

                                                                                                                                                                                      Non-printable bytes can be specified using string escape notation. For example, a line feed character can be written as either \\n or \\x0a.

                                                                                                                                                                                      Byte ranges can be specified using a hyphen. For example, the sequence 0123456789 can be written as 0-9.",run:Cipher.run_substitute,input_type:"byte_array",output_type:"byte_array",args:[{name:"Plaintext",type:"binary_string",value:Cipher.SUBS_PLAINTEXT},{name:"Ciphertext",type:"binary_string",value:Cipher.SUBS_CIPHERTEXT}]}},ControlsWaiter=function(a,b){this.app=a,this.manager=b};ControlsWaiter.prototype.adjust_width=function(){var a=document.getElementById("controls"),b=document.getElementById("step"),c=document.getElementById("clr-breaks"),d=document.querySelector("#save img"),e=document.querySelector("#load img"),f=document.querySelector("#step img"),g=document.querySelector("#clr-recipe img"),h=document.querySelector("#clr-breaks img");a.clientWidth<470?b.childNodes[1].nodeValue=" Step":b.childNodes[1].nodeValue=" Step through",a.clientWidth<400?(d.style.display="none",e.style.display="none",f.style.display="none",g.style.display="none",h.style.display="none"):(d.style.display="inline",e.style.display="inline",f.style.display="inline",g.style.display="inline",h.style.display="inline"),a.clientWidth<330?c.childNodes[1].nodeValue=" Clear breaks":c.childNodes[1].nodeValue=" Clear breakpoints"},ControlsWaiter.prototype.set_auto_bake=function(a){var b=document.getElementById("auto-bake");b.checked!==a&&b.click()},ControlsWaiter.prototype.bake_click=function(){this.app.bake(),$("#output-text").selectRange(0)},ControlsWaiter.prototype.step_click=function(){this.app.bake(!0),$("#output-text").selectRange(0)},ControlsWaiter.prototype.auto_bake_change=function(){var a=document.getElementById("auto-bake-label"),b=document.getElementById("auto-bake");this.app.auto_bake_=b.checked,b.checked?(a.classList.remove("btn-default"),a.classList.add("btn-success")):(a.classList.remove("btn-success"),a.classList.add("btn-default"))},ControlsWaiter.prototype.clear_recipe_click=function(){this.manager.recipe.clear_recipe()},ControlsWaiter.prototype.clear_breaks_click=function(){for(var a=document.querySelectorAll("#rec_list li.operation .breakpoint"),b=0;b0,b=b&&f.length>0&&f.length<8e3,a&&(d+="?recipe="+encodeURIComponent(e)),a&&b?d+="&input="+encodeURIComponent(f):b&&(d+="?input="+encodeURIComponent(f)),d},ControlsWaiter.prototype.save_text_change=function(){try{var a=JSON.parse(document.getElementById("save-text").value);this.initialise_save_link(a)}catch(a){}},ControlsWaiter.prototype.save_click=function(){var a=this.app.get_recipe_config(),b=JSON.stringify(a).replace(/},{/g,"},\n{");document.getElementById("save-text").value=b,this.initialise_save_link(a),$("#save-modal").modal()},ControlsWaiter.prototype.slr_check_change=function(){this.initialise_save_link()},ControlsWaiter.prototype.sli_check_change=function(){this.initialise_save_link()},ControlsWaiter.prototype.load_click=function(){this.populate_load_recipes_list(),$("#load-modal").modal()},ControlsWaiter.prototype.save_button_click=function(){var a=document.getElementById("save-name").value,b=document.getElementById("save-text").value;if(!a)return void this.app.alert("Please enter a recipe name","danger",2e3);var c=localStorage.saved_recipes?JSON.parse(localStorage.saved_recipes):[],d=localStorage.recipe_id||0;c.push({id:++d,name:a,recipe:b}),localStorage.saved_recipes=JSON.stringify(c),localStorage.recipe_id=d,this.app.alert('Recipe saved as "'+a+'".',"success",2e3)},ControlsWaiter.prototype.populate_load_recipes_list=function(){for(var a=document.getElementById("load-name"),b=a.options.length;b--;)a.remove(b);var c=localStorage.saved_recipes?JSON.parse(localStorage.saved_recipes):[];for(b=0;bend: "+e+"
                                                                                                                                                                                      length: "+f},HighlighterWaiter.prototype.remove_highlights=function(){document.getElementById("input-highlighter").innerHTML="",document.getElementById("output-highlighter").innerHTML="",document.getElementById("input-selection-info").innerHTML="",document.getElementById("output-selection-info").innerHTML=""},HighlighterWaiter.prototype.generate_highlight_list=function(){for(var a=this.app.get_recipe_config(),b=[],c=0;c=0)return!1;var d="[start_highlight]",e=/\[start_highlight\]/g,f="[end_highlight]",g=/\[end_highlight\]/g,h=a.value;if(1===c.length){if(c[0].end/g,">").replace(/\n/g," ").replace(e,'').replace(g,"")+" ",b.style.width=a.clientWidth+"px",b.innerHTML=h,b.scrollTop=a.scrollTop,b.scrollLeft=a.scrollLeft};var HTMLApp=function(a,b,c,d){this.categories=a,this.operations=b,this.dfavourites=c,this.doptions=d,this.options=Utils.extend({},d),this.chef=new Chef,this.manager=new Manager(this),this.auto_bake_=!1,this.progress=0,this.ing_id=0,window.chef=this.chef};HTMLApp.prototype.setup=function(){document.dispatchEvent(this.manager.appstart),this.initialise_splitter(),this.load_local_storage(),this.populate_operations_list(),this.manager.setup(),this.reset_layout(),this.set_compile_message(),this.load_URI_params()},HTMLApp.prototype.handle_error=function(a){console.error(a);var b=a.display_str||a.toString();this.alert(b,"danger",this.options.error_timeout,!this.options.show_errors)},HTMLApp.prototype.bake=function(a){var b;try{b=this.chef.bake(this.get_input(),this.get_recipe_config(),this.options,this.progress,a)}catch(a){this.handle_error(a)}b&&(b.error&&this.handle_error(b.error),this.options=b.options,this.dish_str="html"===b.type?Utils.strip_html_tags(b.result,!0):b.result,this.progress=b.progress,this.manager.recipe.update_breakpoint_indicator(b.progress),this.manager.output.set(b.result,b.type,b.duration),b.duration>this.options.auto_bake_threshold&&this.auto_bake_&&(this.manager.controls.set_auto_bake(!1),this.alert("Baking took longer than "+this.options.auto_bake_threshold+"ms, Auto Bake has been disabled.","warning",5e3)))},HTMLApp.prototype.auto_bake=function(){this.auto_bake_&&this.bake()},HTMLApp.prototype.silent_bake=function(){var a=(new Date).getTime(),b=this.get_recipe_config();return this.auto_bake_&&this.chef.silent_bake(b),(new Date).getTime()-a},HTMLApp.prototype.get_input=function(){var a=this.manager.input.get();return sessionStorage.setItem("input_length",a.length),sessionStorage.setItem("input",a),a},HTMLApp.prototype.set_input=function(a){sessionStorage.setItem("input_length",a.length),sessionStorage.setItem("input",a),this.manager.input.set(a)},HTMLApp.prototype.populate_operations_list=function(){document.body.appendChild(document.getElementById("edit-favourites"));for(var a="",b=0;b2?JSON.parse(localStorage.favourites):this.dfavourites;a=this.valid_favourites(a),this.save_favourites(a);var b=this.categories.filter(function(a){return"Favourites"===a.name})[0];b?b.ops=a:this.categories.unshift({name:"Favourites",ops:a})},HTMLApp.prototype.valid_favourites=function(a){for(var b=[],c=0;c=0?void this.alert("'"+a+"' is already in your favourites","info",2e3):(b.push(a),this.save_favourites(b),this.load_favourites(),this.populate_operations_list(),void this.manager.recipe.initialise_operation_drag_n_drop())},HTMLApp.prototype.load_URI_params=function(){this.query_string=function(a){if(""===a)return{};for(var b={},c=0;c"):d[e].value=a[b].args[e];a[b].disabled&&c.querySelector(".disable-icon").click(),a[b].breakpoint&&c.querySelector(".breakpoint").click(),this.progress=0}},HTMLApp.prototype.reset_layout=function(){this.column_splitter.setSizes([20,30,50]),this.io_splitter.setSizes([50,50]),this.manager.controls.adjust_width(),this.manager.output.adjust_width()},HTMLApp.prototype.set_compile_message=function(){var a=new Date,b=Utils.fuzzy_time(a.getTime()-window.compile_time),c='Last build: '+b.substr(0,1).toUpperCase()+b.substr(1)+" ago";""!==window.compile_message&&(c+=" - "+window.compile_message),c+="",document.getElementById("notice").innerHTML=c},HTMLApp.prototype.alert=function(a,b,c,d){var e=new Date;if(console.log("["+e.toLocaleString()+"] "+a),!d){b=b||"danger",c=c||0;var f=document.getElementById("alert"),g=document.getElementById("alert-content");f.classList.remove("alert-danger"),f.classList.remove("alert-warning"),f.classList.remove("alert-info"),f.classList.remove("alert-success"),f.classList.add("alert-"+b),"block"===f.style.display?g.innerHTML+="

                                                                                                                                                                                      ["+e.toLocaleTimeString()+"] "+a:g.innerHTML="["+e.toLocaleTimeString()+"] "+a,$("#alert").stop(),f.style.display="block",f.style.opacity=1,c>0&&(clearTimeout(this.alert_timeout),this.alert_timeout=setTimeout(function(){$("#alert").slideUp(100)},c))}},HTMLApp.prototype.confirm=function(a,b,c,d){d=d||this,document.getElementById("confirm-title").innerHTML=a,document.getElementById("confirm-body").innerHTML=b,document.getElementById("confirm-modal").style.display="block",this.confirm_closed=!1,$("#confirm-modal").modal().one("show.bs.modal",function(a){this.confirm_closed=!1}.bind(this)).one("click","#confirm-yes",function(){this.confirm_closed=!0,c.bind(d)(!0),$("#confirm-modal").modal("hide")}.bind(this)).one("hide.bs.modal",function(a){this.confirm_closed||c.bind(d)(!1),this.confirm_closed=!0}.bind(this))},HTMLApp.prototype.alert_close_click=function(){document.getElementById("alert").style.display="none"},HTMLApp.prototype.state_change=function(a){this.auto_bake(),this.options.update_url&&(this.last_state_url=this.manager.controls.generate_state_url(!0,!0),window.history.replaceState({},"CyberChef",this.last_state_url))},HTMLApp.prototype.pop_state=function(a){window.location.href.split("#")[0]!==this.last_state_url&&this.load_URI_params()},HTMLApp.prototype.call_api=function(a,b,c,d,e){b=b||"POST",c=c||{},d=d||void 0,e=e||"application/json";var f=null,g=!1;return $.ajax({url:a,async:!1,type:b,data:c,dataType:d,contentType:e,success:function(a){g=!0,f=a},error:function(a){g=!1,f=a}}),{success:g,response:f}};var HTMLCategory=function(a,b){this.name=a,this.selected=b,this.op_list=[]};HTMLCategory.prototype.add_operation=function(a){this.op_list.push(a)},HTMLCategory.prototype.to_html=function(){for(var a="cat"+this.name.replace(/[\s\/-:_]/g,""),b="
                                                                                                                                                                                      "+this.name+"
                                                                                                                                                                                        ",c=0;c 
                                                                                                                                                                                      ";switch(d+="
                                                                                                                                                                                      ",this.type){case"string":case"binary_string":case"byte_array":d+="";break;case"short_string":case"binary_short_string":d+="";break;case"toggle_string":for(d+="
                                                                                                                                                                                      ";break;case"number":d+="";break;case"boolean":d+="",this.disable_args&&this.manager.add_dynamic_listener("#"+this.id,"click",this.toggle_disable_args,this);break;case"option":for(d+="";break;case"populate_option":for(d+="",this.manager.add_dynamic_listener("#"+this.id,"change",this.populate_option_change,this);break;case"editable_option":for(d+="
                                                                                                                                                                                      ",d+="",d+="",d+="
                                                                                                                                                                                      ",this.manager.add_dynamic_listener("#sel-"+this.id,"change",this.editable_option_change,this);break;case"text":d+=""}return d+="
                                                                                                                                                                                      "},HTMLIngredient.prototype.toggle_disable_args=function(a){for(var b,c=a.target,d=c.parentNode.parentNode,e=d.querySelectorAll(".arg-group"),f=0;f"),this.description&&(b+=""),b+=""},HTMLOperation.prototype.to_full_html=function(){for(var a="
                                                                                                                                                                                      "+this.name+"
                                                                                                                                                                                      ",b=0;b=0&&(this.name=this.name.slice(0,b)+""+this.name.slice(b,b+a.length)+""+this.name.slice(b+a.length)),this.description&&c>=0&&(this.description=this.description.slice(0,c)+""+this.description.slice(c,c+a.length)+""+this.description.slice(c+a.length))};var InputWaiter=function(a,b){this.app=a,this.manager=b,this.bad_keys=[16,17,18,19,20,27,33,34,35,36,37,38,39,40,44,91,92,93,112,113,114,115,116,117,118,119,120,121,122,123,144,145]};InputWaiter.prototype.get=function(){return document.getElementById("input-text").value},InputWaiter.prototype.set=function(a){document.getElementById("input-text").value=a,window.dispatchEvent(this.manager.statechange)},InputWaiter.prototype.set_input_info=function(a,b){var c=a.toString().length;c=c<2?2:c;var d=Utils.pad(a.toString(),c," ").replace(/ /g," "),e=Utils.pad(b.toString(),c," ").replace(/ /g," ");document.getElementById("input-info").innerHTML="length: "+d+"
                                                                                                                                                                                      lines: "+e},InputWaiter.prototype.input_change=function(a){this.manager.highlighter.remove_highlights(),this.app.progress=0;var b=this.get(),c=b.count("\n")+1;this.set_input_info(b.length,c),this.bad_keys.indexOf(a.keyCode)<0&&window.dispatchEvent(this.manager.statechange)},InputWaiter.prototype.input_dragover=function(a){return"move"!==a.dataTransfer.effectAllowed&&(a.stopPropagation(),a.preventDefault(),void a.target.classList.add("dropping-file"))},InputWaiter.prototype.input_dragleave=function(a){a.stopPropagation(),a.preventDefault(),a.target.classList.remove("dropping-file")},InputWaiter.prototype.input_drop=function(a){if("move"===a.dataTransfer.effectAllowed)return!1;a.stopPropagation(),a.preventDefault();var b=a.target,c=a.dataTransfer.files[0],d=a.dataTransfer.getData("Text"),e=new FileReader,f="",g=0,h=20480,i=function(){f.length>1e5&&this.app.auto_bake_&&(this.manager.controls.set_auto_bake(!1),this.app.alert("Turned off Auto Bake as the input is large","warning",5e3)),this.set(f);var a=this.app.get_recipe_config();a[0]&&"From Hex"===a[0].op||(a.unshift({op:"From Hex",args:["Space"]}),this.app.set_recipe_config(a)),b.classList.remove("loading_file")}.bind(this),j=function(){if(g>=c.size)return void i();b.value="Processing... "+Math.round(g/c.size*100)+"%";var a=c.slice(g,g+h);e.readAsArrayBuffer(a)};e.onload=function(a){var b=new Uint8Array(e.result);f+=Utils.to_hex_fast(b),g+=h,j()},b.classList.remove("dropping-file"),c?(b.classList.add("loading_file"),j()):d&&this.set(d)},InputWaiter.prototype.clear_io_click=function(){this.manager.highlighter.remove_highlights(),document.getElementById("input-text").value="",document.getElementById("output-text").value="",document.getElementById("input-info").innerHTML="",document.getElementById("output-info").innerHTML="",document.getElementById("input-selection-info").innerHTML="",document.getElementById("output-selection-info").innerHTML="",window.dispatchEvent(this.manager.statechange)};var Manager=function(a){this.app=a,this.appstart=new CustomEvent("appstart",{bubbles:!0}),this.operationadd=new CustomEvent("operationadd",{bubbles:!0}),this.operationremove=new CustomEvent("operationremove",{bubbles:!0}),this.oplistcreate=new CustomEvent("oplistcreate",{bubbles:!0}),this.statechange=new CustomEvent("statechange",{bubbles:!0}),this.window=new WindowWaiter(this.app),this.controls=new ControlsWaiter(this.app,this),this.recipe=new RecipeWaiter(this.app,this),this.ops=new OperationsWaiter(this.app,this),this.input=new InputWaiter(this.app,this),this.output=new OutputWaiter(this.app,this),this.options=new OptionsWaiter(this.app),this.highlighter=new HighlighterWaiter(this.app),this.seasonal=new SeasonalWaiter(this.app,this),this.dynamic_handlers={},this.initialise_event_listeners()};Manager.prototype.setup=function(){this.recipe.initialise_operation_drag_n_drop(),this.controls.auto_bake_change(),this.seasonal.load()},Manager.prototype.initialise_event_listeners=function(){window.addEventListener("resize",this.window.window_resize.bind(this.window)),window.addEventListener("blur",this.window.window_blur.bind(this.window)),window.addEventListener("focus",this.window.window_focus.bind(this.window)),window.addEventListener("statechange",this.app.state_change.bind(this.app)),window.addEventListener("popstate",this.app.pop_state.bind(this.app)),document.getElementById("bake").addEventListener("click",this.controls.bake_click.bind(this.controls)),document.getElementById("auto-bake").addEventListener("change",this.controls.auto_bake_change.bind(this.controls)),document.getElementById("step").addEventListener("click",this.controls.step_click.bind(this.controls)),document.getElementById("clr-recipe").addEventListener("click",this.controls.clear_recipe_click.bind(this.controls)),document.getElementById("clr-breaks").addEventListener("click",this.controls.clear_breaks_click.bind(this.controls)),document.getElementById("save").addEventListener("click",this.controls.save_click.bind(this.controls)),document.getElementById("save-button").addEventListener("click",this.controls.save_button_click.bind(this.controls)),document.getElementById("save-link-recipe-checkbox").addEventListener("change",this.controls.slr_check_change.bind(this.controls)),document.getElementById("save-link-input-checkbox").addEventListener("change",this.controls.sli_check_change.bind(this.controls)),document.getElementById("load").addEventListener("click",this.controls.load_click.bind(this.controls)),document.getElementById("load-delete-button").addEventListener("click",this.controls.load_delete_click.bind(this.controls)),document.getElementById("load-name").addEventListener("change",this.controls.load_name_change.bind(this.controls)),document.getElementById("load-button").addEventListener("click",this.controls.load_button_click.bind(this.controls)),this.add_multi_event_listener("#save-text","keyup paste",this.controls.save_text_change,this.controls),this.add_multi_event_listener("#search","keyup paste search",this.ops.search_operations,this.ops),this.add_dynamic_listener(".op_list li.operation","dblclick",this.ops.operation_dblclick,this.ops),document.getElementById("edit-favourites").addEventListener("click",this.ops.edit_favourites_click.bind(this.ops)),document.getElementById("save-favourites").addEventListener("click",this.ops.save_favourites_click.bind(this.ops)),document.getElementById("reset-favourites").addEventListener("click",this.ops.reset_favourites_click.bind(this.ops)),this.add_dynamic_listener(".op_list .op-icon","mouseover",this.ops.op_icon_mouseover,this.ops),this.add_dynamic_listener(".op_list .op-icon","mouseleave",this.ops.op_icon_mouseleave,this.ops),this.add_dynamic_listener(".op_list","oplistcreate",this.ops.op_list_create,this.ops),this.add_dynamic_listener("li.operation","operationadd",this.recipe.op_add.bind(this.recipe)),this.add_dynamic_listener(".arg","keyup",this.recipe.ing_change,this.recipe),this.add_dynamic_listener(".arg","change",this.recipe.ing_change,this.recipe),this.add_dynamic_listener(".disable-icon","click",this.recipe.disable_click,this.recipe),this.add_dynamic_listener(".breakpoint","click",this.recipe.breakpoint_click,this.recipe),this.add_dynamic_listener("#rec_list li.operation","dblclick",this.recipe.operation_dblclick,this.recipe),this.add_dynamic_listener("#rec_list li.operation > div","dblclick",this.recipe.operation_child_dblclick,this.recipe),this.add_dynamic_listener("#rec_list .input-group .dropdown-menu a","click",this.recipe.dropdown_toggle_click,this.recipe),this.add_dynamic_listener("#rec_list","operationremove",this.recipe.op_remove.bind(this.recipe)),this.add_multi_event_listener("#input-text","keyup paste",this.input.input_change,this.input),document.getElementById("reset-layout").addEventListener("click",this.app.reset_layout.bind(this.app)),document.getElementById("clr-io").addEventListener("click",this.input.clear_io_click.bind(this.input)),document.getElementById("input-text").addEventListener("dragover",this.input.input_dragover.bind(this.input)),document.getElementById("input-text").addEventListener("dragleave",this.input.input_dragleave.bind(this.input)),document.getElementById("input-text").addEventListener("drop",this.input.input_drop.bind(this.input)),document.getElementById("input-text").addEventListener("scroll",this.highlighter.input_scroll.bind(this.highlighter)),document.getElementById("input-text").addEventListener("mouseup",this.highlighter.input_mouseup.bind(this.highlighter)),document.getElementById("input-text").addEventListener("mousemove",this.highlighter.input_mousemove.bind(this.highlighter)),this.add_multi_event_listener("#input-text","mousedown dblclick select",this.highlighter.input_mousedown,this.highlighter),document.getElementById("save-to-file").addEventListener("click",this.output.save_click.bind(this.output)),document.getElementById("switch").addEventListener("click",this.output.switch_click.bind(this.output)),document.getElementById("undo-switch").addEventListener("click",this.output.undo_switch_click.bind(this.output)),document.getElementById("maximise-output").addEventListener("click",this.output.maximise_output_click.bind(this.output)),document.getElementById("output-text").addEventListener("scroll",this.highlighter.output_scroll.bind(this.highlighter)),document.getElementById("output-text").addEventListener("mouseup",this.highlighter.output_mouseup.bind(this.highlighter)),document.getElementById("output-text").addEventListener("mousemove",this.highlighter.output_mousemove.bind(this.highlighter)),document.getElementById("output-html").addEventListener("mouseup",this.highlighter.output_html_mouseup.bind(this.highlighter)),document.getElementById("output-html").addEventListener("mousemove",this.highlighter.output_html_mousemove.bind(this.highlighter)),this.add_multi_event_listener("#output-text","mousedown dblclick select",this.highlighter.output_mousedown,this.highlighter),this.add_multi_event_listener("#output-html","mousedown dblclick select",this.highlighter.output_html_mousedown,this.highlighter),document.getElementById("options").addEventListener("click",this.options.options_click.bind(this.options)),document.getElementById("reset-options").addEventListener("click",this.options.reset_options_click.bind(this.options)),$(document).on("switchChange.bootstrapSwitch",".option-item input:checkbox",this.options.switch_change.bind(this.options)),$(document).on("switchChange.bootstrapSwitch",".option-item input:checkbox",this.options.set_word_wrap.bind(this.options)),this.add_dynamic_listener(".option-item input[type=number]","keyup",this.options.number_change,this.options),this.add_dynamic_listener(".option-item input[type=number]","change",this.options.number_change,this.options),this.add_dynamic_listener(".option-item select","change",this.options.select_change,this.options),document.getElementById("alert-close").addEventListener("click",this.app.alert_close_click.bind(this.app))},Manager.prototype.add_listeners=function(a,b,c,d){d=d||this,[].forEach.call(document.querySelectorAll(a),function(a){a.addEventListener(b,c.bind(d))})},Manager.prototype.add_multi_event_listener=function(a,b,c,d){for(var e=b.split(" "),f=0;f-1&&(this.manager.recipe.add_operation(b[c].innerHTML),this.app.auto_bake()))),13===a.keyCode)a.preventDefault();else if(40===a.keyCode)a.preventDefault(),b=document.querySelectorAll("#search-results li"),b.length&&(c=this.get_selected_op(b),c>-1&&b[c].classList.remove("selected-op"),c===b.length-1&&(c=-1),b[c+1].classList.add("selected-op"));else if(38===a.keyCode)a.preventDefault(),b=document.querySelectorAll("#search-results li"),b.length&&(c=this.get_selected_op(b),c>-1&&b[c].classList.remove("selected-op"),0===c&&(c=b.length),b[c-1].classList.add("selected-op"));else{for(var d=document.getElementById("search-results"),e=a.target,f=e.value;d.firstChild;)$(d.firstChild).popover("destroy"),d.removeChild(d.firstChild);if($("#categories .in").collapse("hide"),f){for(var g=this.filter_operations(f,!0),h="",i=0;i=0||h>=0){var i=new HTMLOperation(e,this.app.operations[e],this.app,this.manager);b&&i.highlight_search_string(a,g,h),g<0?c.push(i):d.push(i)}}return d.concat(c)},OperationsWaiter.prototype.get_selected_op=function(a){for(var b=0;blength: "+e+"
                                                                                                                                                                                      lines: "+f,document.getElementById("input-selection-info").innerHTML="",document.getElementById("output-selection-info").innerHTML=""},OutputWaiter.prototype.adjust_width=function(){var a=document.getElementById("output"),b=document.getElementById("save-to-file"),c=document.getElementById("switch"),d=document.getElementById("undo-switch"),e=document.getElementById("maximise-output");a.clientWidth<680?(b.childNodes[1].nodeValue="",c.childNodes[1].nodeValue="",d.childNodes[1].nodeValue="",e.childNodes[1].nodeValue=""):(b.childNodes[1].nodeValue=" Save to file",c.childNodes[1].nodeValue=" Move output to input",d.childNodes[1].nodeValue=" Undo",e.childNodes[1].nodeValue="Maximise"===e.getAttribute("title")?" Max":" Restore")},OutputWaiter.prototype.save_click=function(){var a=Utils.to_base64(this.app.dish_str),b=window.prompt("Please enter a filename:","download.dat");if(b){var c=document.createElement("a");c.setAttribute("href","data:application/octet-stream;base64;charset=utf-8,"+a),c.setAttribute("download",b),c.style.display="none",document.body.appendChild(c),c.click(),c.remove()}},OutputWaiter.prototype.switch_click=function(){this.switch_orig_data=this.manager.input.get(),document.getElementById("undo-switch").disabled=!1,this.app.set_input(this.app.dish_str)},OutputWaiter.prototype.undo_switch_click=function(){this.app.set_input(this.switch_orig_data),document.getElementById("undo-switch").disabled=!0},OutputWaiter.prototype.maximise_output_click=function(a){var b="maximise-output"===a.target.id?a.target:a.target.parentNode;"Maximise"===b.getAttribute("title")?(this.app.column_splitter.collapse(0),this.app.column_splitter.collapse(1),this.app.io_splitter.collapse(0),b.setAttribute("title","Restore"),b.innerHTML=" Restore",this.adjust_width()):(b.setAttribute("title","Maximise"),b.innerHTML=" Max",this.app.reset_layout())};var RecipeWaiter=function(a,b){this.app=a,this.manager=b,this.remove_intent=!1};RecipeWaiter.prototype.initialise_operation_drag_n_drop=function(){var a=document.getElementById("rec_list");Sortable.create(a,{group:"recipe",sort:!0,animation:0,delay:0,filter:".arg-input,.arg",setData:function(a,b){a.setData("Text",b.querySelector(".arg-title").textContent)},onEnd:function(a){this.remove_intent&&(a.item.remove(),a.target.dispatchEvent(this.manager.operationremove))}.bind(this)}),Sortable.utils.on(a,"dragover",function(){this.remove_intent=!1}.bind(this)),Sortable.utils.on(a,"dragleave",function(){this.remove_intent=!0,this.app.progress=0}.bind(this)),Sortable.utils.on(a,"touchend",function(b){var c=b.changedTouches[0],d=document.elementFromPoint(c.clientX,c.clientY);this.remove_intent=!a.contains(d)}.bind(this)),document.querySelector("#categories a").addEventListener("dragover",this.fav_dragover.bind(this)),document.querySelector("#categories a").addEventListener("dragleave",this.fav_dragleave.bind(this)),document.querySelector("#categories a").addEventListener("drop",this.fav_drop.bind(this))},RecipeWaiter.prototype.create_sortable_seed_list=function(a){Sortable.create(a,{group:{name:"recipe",pull:"clone",put:!1},sort:!1,setData:function(a,b){a.setData("Text",b.textContent)},onStart:function(a){$(a.item).popover("destroy"),a.item.setAttribute("data-toggle","popover-disabled")},onEnd:this.op_sort_end.bind(this)})},RecipeWaiter.prototype.op_sort_end=function(a){return this.remove_intent?void("rec_list"===a.item.parentNode.id&&a.item.remove()):($(a.clone).popover(),$(a.clone).children("[data-toggle=popover]").popover(),void("rec_list"===a.item.parentNode.id&&(this.build_recipe_operation(a.item),a.item.dispatchEvent(this.manager.operationadd))))},RecipeWaiter.prototype.fav_dragover=function(a){return"move"===a.dataTransfer.effectAllowed&&(a.stopPropagation(),a.preventDefault(),void(a.target.className&&a.target.className.indexOf("category-title")>-1?a.target.classList.add("favourites-hover"):a.target.parentNode.className&&a.target.parentNode.className.indexOf("category-title")>-1?a.target.parentNode.classList.add("favourites-hover"):a.target.parentNode.parentNode.className&&a.target.parentNode.parentNode.className.indexOf("category-title")>-1&&a.target.parentNode.parentNode.classList.add("favourites-hover")))},RecipeWaiter.prototype.fav_dragleave=function(a){a.stopPropagation(),a.preventDefault(),document.querySelector("#categories a").classList.remove("favourites-hover")},RecipeWaiter.prototype.fav_drop=function(a){a.stopPropagation(),a.preventDefault(),a.target.classList.remove("favourites-hover");var b=a.dataTransfer.getData("Text");this.app.add_favourite(b)},RecipeWaiter.prototype.ing_change=function(){window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.disable_click=function(a){var b=a.target;"false"===b.getAttribute("disabled")?(b.setAttribute("disabled","true"),b.classList.add("disable-icon-selected"),b.parentNode.parentNode.classList.add("disabled")):(b.setAttribute("disabled","false"),b.classList.remove("disable-icon-selected"),b.parentNode.parentNode.classList.remove("disabled")),this.app.progress=0,window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.breakpoint_click=function(a){var b=a.target;"false"===b.getAttribute("break")?(b.setAttribute("break","true"),b.classList.add("breakpoint-selected")):(b.setAttribute("break","false"),b.classList.remove("breakpoint-selected")),window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.operation_dblclick=function(a){a.target.remove(),window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.operation_child_dblclick=function(a){a.target.parentNode.remove(),window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.get_config=function(){for(var a,b,c,d,e,f=[],g=document.querySelectorAll("#rec_list li.operation"),h=0;h",this.ing_change()},RecipeWaiter.prototype.op_add=function(a){window.dispatchEvent(this.manager.statechange)},RecipeWaiter.prototype.op_remove=function(a){window.dispatchEvent(this.manager.statechange)};var SeasonalWaiter=function(a,b){this.app=a,this.manager=b};SeasonalWaiter.prototype.load=function(){var a=new Date;11===a.getMonth()&&a.getDate()>12&&(this.app.options.snow=!1,this.create_snow_option(),$(document).on("switchChange.bootstrapSwitch",".option-item input:checkbox[option='snow']",this.let_it_snow.bind(this)),window.addEventListener("resize",this.let_it_snow.bind(this)),this.manager.add_listeners(".btn","click",this.shake_off_snow,this),25===a.getDate()&&this.let_it_snow()),this.kkeys=[],window.addEventListener("keydown",this.konami_code_listener.bind(this))},SeasonalWaiter.prototype.insert_spider_icons=function(){var a="iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB3UlEQVQ4y2NgGJaAmYGBgVnf0o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ALWuuYWWy+W3OteXa4jwceQX6+BKG6J1/8+2VCNkm2222WabbbbZZpttttlmm22rt38DCdA0vq3bcAkAAAAASUVORK5CYII="; -document.querySelector("link[rel=icon]").setAttribute("href","data:image/png;base64,"+a),document.querySelector("#bake img").setAttribute("src","data:image/png;base64,"+b),document.querySelector(".about-img-left").setAttribute("src","data:image/png;base64,"+c)},SeasonalWaiter.prototype.insert_spider_text=function(){document.title=document.title.replace(/Cyber/g,"Spider"),SeasonalWaiter.tree_walk(document.body,function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Cyber/g,"Spider"))},!0),SeasonalWaiter.tree_walk(document.getElementById("bake-group"),function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Bake/g,"Spin"))},!0),document.querySelector("#recipe .title").innerHTML="Web"},SeasonalWaiter.prototype.create_snow_option=function(){var a=document.getElementById("options-body"),b=document.createElement("div");b.className="option-item",b.innerHTML=" Let it snow",a.appendChild(b),this.manager.options.load()},SeasonalWaiter.prototype.let_it_snow=function(){if($(document).snowfall("clear"),this.app.options.snow){var a={},b=navigator.userAgent.match(/Firefox\/(\d\d?)/);a=b&&parseInt(b[1],10)<30?{flakeCount:10,flakeColor:"#fff",flakePosition:"absolute",minSize:1,maxSize:2,minSpeed:1,maxSpeed:5,round:!1,shadow:!1,collection:!1,collectionHeight:20,deviceorientation:!0}:{flakeCount:35,flakeColor:"#fff",flakePosition:"absolute",minSize:5,maxSize:8,minSpeed:1,maxSpeed:5,round:!0,shadow:!0,collection:".btn",collectionHeight:20,deviceorientation:!0},$(document).snowfall(a)}},SeasonalWaiter.prototype.shake_off_snow=function(a){for(var b=a.target,c=b.getBoundingClientRect(),d=document.querySelectorAll("canvas.snowfall-canvas"),e=null,f=function(){h.clearRect(0,0,e.width,e.height),$(this).fadeIn()},g=0;g6e4&&this.app.silent_bake()};var main=function(){var a=["To Base64","From Base64","To Hex","From Hex","To Hexdump","From Hexdump","URL Decode","Regular expression","Entropy","Fork"],b={update_url:!0,show_highlighter:!0,treat_as_utf8:!0,word_wrap:!0,show_errors:!0,error_timeout:4e3,auto_bake_threshold:200,attempt_highlight:!0,snow:!1};document.removeEventListener("DOMContentLoaded",main,!1),window.app=new HTMLApp(Categories,OperationConfig,a,b),window.app.setup()};window.console=console||{log:function(){},error:function(){}},window.compile_time=moment.tz("Tue Jan 31 2017 14:02:48","ddd MMM D YYYY HH:mm:ss","UTC").valueOf(),window.compile_message="",document.addEventListener("DOMContentLoaded",main,!1); \ No newline at end of file +document.querySelector("link[rel=icon]").setAttribute("href","data:image/png;base64,"+a),document.querySelector("#bake img").setAttribute("src","data:image/png;base64,"+b),document.querySelector(".about-img-left").setAttribute("src","data:image/png;base64,"+c)},SeasonalWaiter.prototype.insert_spider_text=function(){document.title=document.title.replace(/Cyber/g,"Spider"),SeasonalWaiter.tree_walk(document.body,function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Cyber/g,"Spider"))},!0),SeasonalWaiter.tree_walk(document.getElementById("bake-group"),function(a){3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/Bake/g,"Spin"))},!0),document.querySelector("#recipe .title").innerHTML="Web"},SeasonalWaiter.prototype.create_snow_option=function(){var a=document.getElementById("options-body"),b=document.createElement("div");b.className="option-item",b.innerHTML=" Let it snow",a.appendChild(b),this.manager.options.load()},SeasonalWaiter.prototype.let_it_snow=function(){if($(document).snowfall("clear"),this.app.options.snow){var a={},b=navigator.userAgent.match(/Firefox\/(\d\d?)/);a=b&&parseInt(b[1],10)<30?{flakeCount:10,flakeColor:"#fff",flakePosition:"absolute",minSize:1,maxSize:2,minSpeed:1,maxSpeed:5,round:!1,shadow:!1,collection:!1,collectionHeight:20,deviceorientation:!0}:{flakeCount:35,flakeColor:"#fff",flakePosition:"absolute",minSize:5,maxSize:8,minSpeed:1,maxSpeed:5,round:!0,shadow:!0,collection:".btn",collectionHeight:20,deviceorientation:!0},$(document).snowfall(a)}},SeasonalWaiter.prototype.shake_off_snow=function(a){for(var b=a.target,c=b.getBoundingClientRect(),d=document.querySelectorAll("canvas.snowfall-canvas"),e=null,f=function(){h.clearRect(0,0,e.width,e.height),$(this).fadeIn()},g=0;g6e4&&this.app.silent_bake()};var main=function(){var a=["To Base64","From Base64","To Hex","From Hex","To Hexdump","From Hexdump","URL Decode","Regular expression","Entropy","Fork"],b={update_url:!0,show_highlighter:!0,treat_as_utf8:!0,word_wrap:!0,show_errors:!0,error_timeout:4e3,auto_bake_threshold:200,attempt_highlight:!0,snow:!1};document.removeEventListener("DOMContentLoaded",main,!1),window.app=new HTMLApp(Categories,OperationConfig,a,b),window.app.setup()};window.console=console||{log:function(){},error:function(){}},window.compile_time=moment.tz("Tue Jan 31 2017 16:09:09","ddd MMM D YYYY HH:mm:ss","UTC").valueOf(),window.compile_message="",document.addEventListener("DOMContentLoaded",main,!1); \ No newline at end of file diff --git a/build/prod/styles.css b/build/prod/styles.css index d8b5520d..dd2801e2 100755 --- a/build/prod/styles.css +++ b/build/prod/styles.css @@ -65,4 +65,4 @@ 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. -*/.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.clo,.opn,.pun{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.kwd,.tag,.typ{font-weight:700}.str{color:#060}.kwd{color:#006}.com{color:#600;font-style:italic}.typ{color:#404}.lit{color:#044}.clo,.opn,.pun{color:#440}.tag{color:#006}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}#content-wrapper{top:0;left:0;width:100%;height:100%}#banner{height:30px;width:100%;text-align:center;line-height:30px}#wrapper{top:30px;bottom:0;width:100%}div#operations,div#recipe{width:50%;height:100%}div#input,div#output{width:100%;height:50%}.title{padding:10px;height:43px}.textarea-wrapper{top:43px;bottom:0;width:100%;overflow:hidden}#output-html,textarea{width:100%;height:100%;border:none;padding:3px;-moz-padding-start:3px;-moz-padding-end:3px}#input-text,#output-html,#output-text{position:relative;border-width:0;margin:0;resize:none;background-color:transparent;white-space:pre-wrap;word-wrap:break-word}#output-html{display:none;overflow-y:auto;-moz-padding-start:1px}.split{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;overflow:auto;position:relative}.gutter.gutter-horizontal,.split.split-horizontal{height:100%;float:left}#input-highlighter,#output-highlighter{position:absolute;left:0;top:0;width:100%;height:100%;padding:3px;margin:0;overflow:hidden;letter-spacing:normal;white-space:pre-wrap;word-wrap:break-word;color:#fff;background-color:transparent;border:none}#op_list,#rec_list,.op_list{margin:0;padding:0;list-style-type:none}#op_list,#rec_list{position:absolute;top:43px;bottom:0;width:100%}.io-btn-group,.io-info{margin-top:-4px;float:right}#rec_list{bottom:120px;overflow:auto}.operation{cursor:pointer;padding:10px;list-style-type:none;position:relative}#controls{position:absolute;width:100%;height:120px;bottom:0;padding:10px}.io-info{margin-right:20px;height:30px;text-align:right;line-height:10px}.arg-group,.inline-args input[type=checkbox]{margin-top:10px}#input-info{line-height:15px}.arg-group{display:table;width:100%}.arg-group-text{display:block}.inline-args{float:left;width:auto;margin-right:30px;height:34px}.inline-args input[type=number]{width:100px}.arg-input{display:table-cell;width:100%;padding:6px 12px}.short-string{width:150px}select{display:block}.arg[disabled]{cursor:not-allowed;opacity:1}textarea.arg{width:100%;min-height:50px;height:70px;margin-top:5px;border:1px solid #ddd;resize:vertical}.arg-label{display:table-cell;width:1px;padding-right:10px;font-weight:400;white-space:pre}.title,optgroup{font-weight:700}.editable-option{position:relative;display:inline-block}.editable-option-input{position:absolute;top:1px;left:1px;width:calc(100% - 20px);height:calc(100% - 2px)!important;border:none!important}#operational-controls{width:65%;float:left;text-align:center}#bake-group{display:table;width:100%}#bake{display:table-cell;width:100%;border-top-right-radius:0;border-bottom-right-radius:0}#auto-bake-label{display:table-cell;padding:1px;line-height:1.35;width:60px;border-top-left-radius:0;border-bottom-left-radius:0;border-left:1px solid #5cb85c}#auto-bake-label:hover{border-left-color:#398439}#auto-bake-label div{font-size:10px;padding:2px}#extra-controls{float:right;width:35%;padding-left:10px}.op-icon{float:right;margin-left:10px;margin-top:3px}.recip-icons{position:absolute;top:13px;right:10px;height:16px}.recip-icon{margin-right:10px;vertical-align:baseline;float:right}.disable-icon{width:16px;height:16px;margin-top:-1px;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAACfElEQVQ4y6WTPWgTYRjHf8nlfVvuoDVIP4Yuki4WHKoUqggFRUTsUEGkVG2hmCq6OnTwIxYHB+eijZOKdLNDW1pKKyGigh8dBHUJElxyBgx3vEnukvdyDrUhRXDxGR+e/+/583xEwjDkfyIGwNVTzURm4tYAMA6MAoN/0tvAMrA48uL+l2bx4w0iYRjSuHKC6OnTZLqHk8CcaZq9bW1tSCkBqNVq+L5PpVIpAHdGfr5LN9bXiT7Z2nGgteb1/qFkLBJZ6OjowHEc8vk8pVIJgHg8TldXF52dnb2u6y5s7R/iuF5JSyAKkLl4eyAMwznLsrBtm1wu99Z13amk+BFJih8R13WXANrb27EsizAM5zIXbw+wC9Baj0spe5VSFAqFt4ZhXJ6ufXuK55E5cDKVSCTGenp6yGazKKWQUvZqrcebgCAIRqWUOI6DEOLR1K8POapVMgfPpoC7u2LLspYcx0FKSRAEo60OBg3DwPd9Jr5vPqWvj8zh83vEwL2J75vnfN/HMAy01oPNNQZBQBAEO1OvVsl0D/8lTuZfpYDd7gRBQKuD7XK5jGmarB679PIv8deVFJUKq8cuTZqmSblcRmu93QpYVkohhMCyrLE94n2/UlSrbJy5kRBCXBNCoJRCa73cClh0XbfgeR6WZZHNZunv719KvnmeYnWVVxdmJ2Ox2DMhxFHP83Bdt6C1XgR2LvHzQDvvb84npZQL8Xgc0zSJRqN7br7RaFCpVCiVStRqtZmhh9fTh754TQdMr82nPc+bsW27UCwWUUpRr9ep1+sopSgWi9i2XfA8b2Z6bT6ttabp4GMi0uz0aXbhn890+MFM85mO5MIdwP/Eb1pMUCdctYRzAAAAAElFTkSuQmCC) no-repeat}.disable-icon-selected{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACFUlEQVR4XqWTP0tbURjGn9zY3mjBwsUhBQtS6XKxiNypIGZJ6SKYUYdaKWg7OrrE3pYO+Qit3dpFuuQO6lI7Z4nESQdjlJbkJh0MksSb3Jvk9H0gjZFu9YWH83LO7zn/3nNCSincJobAeP1sEDBFi6J50UyPy4l2RNuioz756Ts0tt1OB4jH2a52Ne2HGh9PwrJm2EcxZx/HyPRYMDgB2u02/N3d1c7w8BZMM1ptNJBPp3GwsUExB/s4RoYsPf0JOkFgdoH34YkJ/D48xC/HyTTOzl5ayWSIktwxqlVo0SjIkKWnP0Hg+4swjGitVMJFNpu5o+svptfXv6DZBDIZezoWS3Db3A0ZsvRcH8H354dGR9EoFHA3EvlorqycwvOAXM4G8Pav+f7YmEOGLD1gsIzl54+V+vBK/Yw9ZAv1LQW1FrdFSnKVfQTK5liPUfRI9I8ArqiPjLAF9vcHVybyzlpasgcZeq7voNXKNSsV3DMMXB4fp/8xLyzYuLri2DIZsvQM3sFOzXURiUR4zsQNcyrFleFVKpNyP2/IkKVnsArbF65bbkqplJSJZrl5x5qbs7G3h3artSyV+arr+lMyZOnpP2Wp6ZFos3R+vvUgCGDNzgKalkA4rECIr07662J2i0X4nrfJJ33jJT6Zmvpcr9XWCicn5WI+j7rrAmKgmLOPY2TI0sPgb8TBZOi/PpN1qnDr7/wH3jxgB/FKIXkAAAAASUVORK5CYII=) no-repeat}.breakpoint{float:right;width:14px;height:14px;background-color:#eee;border:1px solid #aaa}.breakpoint-selected{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAXVBMVEXIUkvzUVHzTEzzn5785eXrbW24BgbzWVnze3vzVVXzY2Pyion509PzbW3zXV1UMxj0l5f1srKbRTRgOxzJDg796ur74ODfIyP5zs6LLx3pNTXYGxuxdkVZNhn////sCC1eAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAABWSURBVBjTnc+7EoAgDERRTOQVxMEZFAf//z8FjAUFDbfb060QU2FwxngimxnCea3bjegSgz+0tguAfBgIy64QGfZQdg91dgAtqUZgnfz6IacYVWvu2AvR4wNAv0nxrAAAAABJRU5ErkJggg==) -2px -2px no-repeat #eee}.banner-right{float:right;margin-right:10px}#banner img{margin-bottom:2px;margin-left:8px}.category-title{display:block;padding:10px}.category{margin:0!important;border-radius:0!important;border:none}#search{border-radius:0;border:none}.loading_file{background:url(data:image/gif;base64,R0lGODlhPAA8APcAAAAAAAEBAQICAgMDAwQEBAUFBQYGBgcHBwgICAkJCQoKCgsLCwwMDA0NDQ4ODg8PDxAQEBERERISEhMTExQUFBUVFRYWFhcXFxgYGBkZGRoaGhsbGxwcHB0dHR4eHh8fHyAgICEhISIiIiMjIyQkJCUlJSYmJicnJygoKCkpKSoqKisrKywsLC0tLS4uLi8vLzAwMDExMTIyMjMzMzQ0NDU1NTY2Njc3Nzg4ODk5OTo6Ojs7Ozw8PD09PT4+Pj8/P0BAQEFBQUJCQkNDQ0REREVFRUZGRkdHR0hISElJSUpKSktLS0xMTE1NTU5OTk9PT1BQUFFRUVJSUlNTU1RUVFVVVVZWVldXV1hYWFlZWVpaWltbW1xcXF1dXV5eXl9fX2BgYGFhYWJiYmNjY2RkZGVlZWZmZmdnZ2hoaGlpaWpqamtra2xsbG1tbW5ubm9vb3BwcHFxcXJycnNzc3R0dHV1dXZ2dnd3d3h4eHl5eXp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ps7otHkeC6c+joId1Gqa6ceXPzCKMzb57d0X7n2JeT59Rf/HLSw9p7F290QAAh+QQhCAD/ACwCAAQAFgAvAAAI/gD/CRxIsKBAUkUOGVxYUE0CAAVwMGRoiwOAiww+TTToisJFiIo2GlTxEYO/jd1OEtzRAUa7fAztIUGSxF7BffwmfhsyoycTcyIJwtLRc8YOWUEHjhNSlAi3pAO7EZkxRBVUgtE+XbvKtaC7ciq5bspzZ0/XXXHMqO3D9ZFatXfaXVWF5u0dru0stUGz52nXYbi6Ch7MkF/Yq/z2lRIFq2u/UJkiN76aTFPkTKKAQo226bKoclf9iYqsKTDXfrRIBSPMurVrfuXAuRPczRkzZ/q4yrPNjFm0wyLL9e4d7R5XacOldWUHLZo04En90YPuWnA8eYL3nStXTh31iem4IXOfF3q7eHZc1Yk3R54ru3Pn1hXMl3tjv3swCa47h256QAA7) center center no-repeat #f5f5f5}#alert{position:fixed;width:30%;margin:30px auto;top:10px;left:0;right:0;z-index:2000;display:none}#alert a{text-decoration:underline}.option-item .bootstrap-switch{margin:15px 10px}.option-item button{margin:10px}.option-item input[type=number]{margin:15px 10px;width:80px;height:28px;padding:3px 10px;vertical-align:middle}.option-item select{margin:10px;display:inline-block}button img,span.btn img{margin-right:3px;margin-bottom:1px}#edit-favourites{float:right;margin-top:-5px}#edit-favourites-list{margin:10px}.about-img-left{float:left;margin:10px 20px 20px 0}.about-img-right{float:right;margin:10px 0 20px 20px}.save-link-options{float:right}.save-link-options input{margin-left:10px}#save-footer{border-top:none;margin-top:0}a:focus,button{outline:0;-moz-outline-style:none}.btn-default{border-color:#ddd}.btn-default:focus{background-color:#fff;border-color:#adadad}.btn-default:active,.btn-default:hover{background-color:#ebebeb;border-color:#adadad}.alert,.btn,.btn-lg,.dropdown-menu,.form-control,.modal-content,.nav-tabs>li>a,.popover,.tooltip-inner{border-radius:0!important}input[type=search]{-webkit-appearance:searchfield;box-shadow:none}input[type=search]::-webkit-search-cancel-button{-webkit-appearance:searchfield-cancel-button}.modal{overflow-y:auto}.form-control{background-color:transparent}code{border:0;white-space:pre-wrap}.bootstrap-switch,.bootstrap-switch-container,.bootstrap-switch-handle-off,.bootstrap-switch-handle-on,.bootstrap-switch-label,pre{border-radius:0!important}#banner,.title{border-bottom:1px solid #ddd}blockquote{font-size:inherit}.panel-body:after,.panel-body:before{content:""}.sortable-ghost{opacity:.6}.colorpicker-element{float:left;margin-right:15px}.colorpicker-color,.colorpicker-color div{height:100px}.word-wrap{white-space:pre!important;word-wrap:normal!important;overflow-x:scroll!important}.clearfix{height:0}.blur{color:transparent!important;text-shadow:rgba(0,0,0,.95) 0 0 10px!important}.no-select{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.konami{-ms-transform:rotate(180deg);-webkit-transform:rotate(180deg);transform:rotate(180deg);-moz-transform:rotate(180deg)}.hl1,.hlyellow{background-color:#fff000}.hl2,.hlblue{background-color:#95dfff}.hl3,.hlred{background-color:#ffb6b6}.hl4,.hlorange{background-color:#fcf8e3}.hl5,.hlgreen{background-color:#8de768}.title{color:#424242;background-color:#fafafa}.gutter{background-color:#eee;background-repeat:no-repeat;background-position:50%}.gutter.gutter-horizontal{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAAeCAYAAAAGos/EAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAlSURBVChTYzxz5sx/BiBgAhEgwPju3TtUEZZ79+6BGcNcDQMDACWJMFs4hNOSAAAAAElFTkSuQmCC);cursor:ew-resize}.gutter.gutter-vertical{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAACCAYAAABPJGxCAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACHDwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKL2lDQ1BJQ0MgUHJvZmlsZQAASMedlndUVNcWh8+9d3qhzTDS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vaR7L+9n3J9/sOkh+mHhI6lH5Y+VHtf9qPdj64jlyJlR19G+J0FPHoyxxp7/lP7Th/H8p+Sn5ROqE42TZpOnp9ynbj5b/Wz8eerz+emCn6V/rn6h++K7Xxx/6ZtZNTP+kv9y4dfiV/Kvjrxe9rp71n/28ZvkN/NzhW/l3x59x3jX+z7s/cR85gfsh4qPeh+7Pnl/eriQvLDwG/eE8/s3BCkeAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAI0lEQVQYV2M8c+bMfwYgUFJSAlEM9+7dA9O05jOBSboDBgYAtPcYZ1oUA30AAAAASUVORK5CYII=);cursor:ns-resize}.operation{border:1px solid #999;border-top-width:0}.op_list .operation{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1}#rec_list .operation{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.arg-input,select{height:34px;border:1px solid #ddd;background-color:#fff;color:#424242}#controls{border-top:1px solid #ddd;background-color:#fafafa}.textarea-wrapper div,.textarea-wrapper textarea{font-family:Consolas,monospace;font-size:inherit}.io-info{font-weight:400;font-size:8pt}.arg-title,.category-title{font-weight:700}.arg-input{font-size:15px;line-height:1.428571429}select{padding:6px 8px}.arg[disabled]{background-color:#eee}textarea.arg{color:#424242}.break{color:#b94a48!important;background-color:#f2dede!important;border-color:#eed3d7!important}.category-title{background-color:#fafafa;border-bottom:1px solid #eee}.category-title[aria-expanded=true],.category-title[href='#catFavourites']{border-bottom-color:#ddd}.category-title.collapsed{border-bottom-color:#eee}.category-title:hover{color:#3a87ad}#search{border-bottom:1px solid #e3e3e3}.dropping-file{border:5px dashed #3a87ad!important}.selected-op{color:#c09853!important;background-color:#fcf8e3!important;border-color:#fbeed5!important}.option-item input[type=number]{font-size:14px;line-height:1.428571429;color:#555;background-color:#fff;border:1px solid #ccc}.favourites-hover{color:#468847;background-color:#dff0d8;border:2px dashed #468847!important;padding:8px 8px 9px}#edit-favourites-list{border:1px solid #bce8f1}#edit-favourites-list .operation{border-left:none;border-right:none}#edit-favourites-list .operation:last-child{border-bottom:none}.subtext{font-style:italic;font-size:13px;color:#999}#save-footer{border-bottom:1px solid #e5e5e5}.flow-control-op{color:#396f3a!important;background-color:#c7e4ba!important;border-color:#b3dba2!important}.flow-control-op.break{color:#94312f!important;background-color:#eabfbf!important;border-color:#e2aeb5!important}#support-modal textarea{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif}#load-text,#save-text{font-family:Consolas,monospace}button.dropdown-toggle{background-color:#f4f4f4}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-track{background-color:#fafafa}::-webkit-scrollbar-thumb{background-color:#ccc}::-webkit-scrollbar-thumb:hover{background-color:#bbb}::-webkit-scrollbar-corner{background-color:#fafafa}.disabled{color:#999!important;background-color:#dfdfdf!important;border-color:#cdcdcd!important}.grey{color:#333;background-color:#f5f5f5;border-color:#ddd}.dark-blue{color:#fff;background-color:#428bca;border-color:#428bca}.red{color:#b94a48;background-color:#f2dede;border-color:#eed3d7}.amber{color:#c09853;background-color:#fcf8e3;border-color:#fbeed5}.green{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.blue{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1} \ No newline at end of file +*/.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.clo,.opn,.pun{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.kwd,.tag,.typ{font-weight:700}.str{color:#060}.kwd{color:#006}.com{color:#600;font-style:italic}.typ{color:#404}.lit{color:#044}.clo,.opn,.pun{color:#440}.tag{color:#006}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}#content-wrapper{top:0;left:0;width:100%;height:100%}#banner{height:30px;width:100%;text-align:center;line-height:30px}#wrapper{top:30px;bottom:0;width:100%}div#operations,div#recipe{width:50%;height:100%}div#input,div#output{width:100%;height:50%}.title{padding:10px;height:43px}.textarea-wrapper{top:43px;bottom:0;width:100%;overflow:hidden}#output-html,textarea{width:100%;height:100%;border:none;padding:3px;-moz-padding-start:3px;-moz-padding-end:3px}#input-text,#output-html,#output-text{position:relative;border-width:0;margin:0;resize:none;background-color:transparent;white-space:pre-wrap;word-wrap:break-word}#output-html{display:none;overflow-y:auto;-moz-padding-start:1px}.split{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;overflow:auto;position:relative}.gutter.gutter-horizontal,.split.split-horizontal{height:100%;float:left}#input-highlighter,#output-highlighter{position:absolute;left:0;top:0;width:100%;height:100%;padding:3px;margin:0;overflow:hidden;letter-spacing:normal;white-space:pre-wrap;word-wrap:break-word;color:#fff;background-color:transparent;border:none}#op_list,#rec_list,.op_list{margin:0;padding:0;list-style-type:none}#op_list,#rec_list{position:absolute;top:43px;bottom:0;width:100%}.io-btn-group,.io-info{margin-top:-4px;float:right}#rec_list{bottom:120px;overflow:auto}.operation{cursor:pointer;padding:10px;list-style-type:none;position:relative}#controls{position:absolute;width:100%;height:120px;bottom:0;padding:10px}.io-info{margin-right:20px;height:30px;text-align:right;line-height:10px}.arg-group,.inline-args input[type=checkbox]{margin-top:10px}#input-info{line-height:15px}.arg-group{display:table;width:100%}.arg-group-text{display:block}.inline-args{float:left;width:auto;margin-right:30px;height:34px}.inline-args input[type=number]{width:100px}.arg-input{display:table-cell;width:100%;padding:6px 12px}.short-string{width:150px}select{display:block}.arg[disabled]{cursor:not-allowed;opacity:1}textarea.arg{width:100%;min-height:50px;height:70px;margin-top:5px;border:1px solid #ddd;resize:vertical}.arg-label{display:table-cell;width:1px;padding-right:10px;font-weight:400;white-space:pre}.title,optgroup{font-weight:700}.editable-option{position:relative;display:inline-block}.editable-option-input{position:absolute;top:1px;left:1px;width:calc(100% - 20px);height:calc(100% - 2px)!important;border:none!important}#operational-controls{width:65%;float:left;text-align:center}#bake-group{display:table;width:100%}#bake{display:table-cell;width:100%;border-top-right-radius:0;border-bottom-right-radius:0}#auto-bake-label{display:table-cell;padding:1px;line-height:1.35;width:60px;border-top-left-radius:0;border-bottom-left-radius:0;border-left:1px solid #5cb85c}#auto-bake-label:hover{border-left-color:#398439}#auto-bake-label div{font-size:10px;padding:2px}#extra-controls{float:right;width:35%;padding-left:10px}.op-icon{float:right;margin-left:10px;margin-top:3px}.recip-icons{position:absolute;top:13px;right:10px;height:16px}.recip-icon{margin-right:10px;vertical-align:baseline;float:right}.disable-icon{width:16px;height:16px;margin-top:-1px;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAACfElEQVQ4y6WTPWgTYRjHf8nlfVvuoDVIP4Yuki4WHKoUqggFRUTsUEGkVG2hmCq6OnTwIxYHB+eijZOKdLNDW1pKKyGigh8dBHUJElxyBgx3vEnukvdyDrUhRXDxGR+e/+/583xEwjDkfyIGwNVTzURm4tYAMA6MAoN/0tvAMrA48uL+l2bx4w0iYRjSuHKC6OnTZLqHk8CcaZq9bW1tSCkBqNVq+L5PpVIpAHdGfr5LN9bXiT7Z2nGgteb1/qFkLBJZ6OjowHEc8vk8pVIJgHg8TldXF52dnb2u6y5s7R/iuF5JSyAKkLl4eyAMwznLsrBtm1wu99Z13amk+BFJih8R13WXANrb27EsizAM5zIXbw+wC9Baj0spe5VSFAqFt4ZhXJ6ufXuK55E5cDKVSCTGenp6yGazKKWQUvZqrcebgCAIRqWUOI6DEOLR1K8POapVMgfPpoC7u2LLspYcx0FKSRAEo60OBg3DwPd9Jr5vPqWvj8zh83vEwL2J75vnfN/HMAy01oPNNQZBQBAEO1OvVsl0D/8lTuZfpYDd7gRBQKuD7XK5jGmarB679PIv8deVFJUKq8cuTZqmSblcRmu93QpYVkohhMCy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) no-repeat}.breakpoint{float:right;width:14px;height:14px;background-color:#eee;border:1px solid #aaa}.breakpoint-selected{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAXVBMVEXIUkvzUVHzTEzzn5785eXrbW24BgbzWVnze3vzVVXzY2Pyion509PzbW3zXV1UMxj0l5f1srKbRTRgOxzJDg796ur74ODfIyP5zs6LLx3pNTXYGxuxdkVZNhn////sCC1eAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAABWSURBVBjTnc+7EoAgDERRTOQVxMEZFAf//z8FjAUFDbfb060QU2FwxngimxnCea3bjegSgz+0tguAfBgIy64QGfZQdg91dgAtqUZgnfz6IacYVWvu2AvR4wNAv0nxrAAAAABJRU5ErkJggg==) -2px -2px no-repeat #eee}.banner-right{float:right;margin-right:10px}#banner img{margin-bottom:2px;margin-left:8px}.category-title{display:block;padding:10px}.category{margin:0!important;border-radius:0!important;border:none}#search{border-radius:0;border:none}.loading_file{background:url(data:image/gif;base64,R0lGODlhPAA8APcAAAAAAAEBAQICAgMDAwQEBAUFBQYGBgcHBwgICAkJCQoKCgsLCwwMDA0NDQ4ODg8PDxAQEBERERISEhMTExQUFBUVFRYWFhcXFxgYGBkZGRoaGhsbGxwcHB0dHR4eHh8fHyAgICEhISIiIiMjIyQkJCUlJSYmJicnJygoKCkpKSoqKisrKywsLC0tLS4uLi8vLzAwMDExMTIyMjMzMzQ0NDU1NTY2Njc3Nzg4ODk5OTo6Ojs7Ozw8PD09PT4+Pj8/P0BAQEFBQUJCQkNDQ0REREVFRUZGRkdHR0hISElJSUpKSktLS0xMTE1NTU5OTk9PT1BQUFFRUVJSUlNTU1RUVFVVVVZWVldXV1hYWFlZWVpaWltbW1xcXF1dXV5eXl9fX2BgYGFhYWJiYmNjY2RkZGVlZWZmZmdnZ2hoaGlpaWpqamtra2xsbG1tbW5ubm9vb3BwcHFxcXJycnNzc3R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iz3bSjGWe2zek1487SuYYWDRvCfPps7otHkeC6c+joId1Gqa6ceXPzCKMzb57d0X7n2JeT59Rf/HLSw9p7F290QAAh+QQhCAD/ACwCAAQAFgAvAAAI/gD/CRxIsKBAUkUOGVxYUE0CAAVwMGRoiwOAiww+TTToisJFiIo2GlTxEYO/jd1OEtzRAUa7fAztIUGSxF7BffwmfhsyoycTcyIJwtLRc8YOWUEHjhNSlAi3pAO7EZkxRBVUgtE+XbvKtaC7ciq5bspzZ0/XXXHMqO3D9ZFatXfaXVWF5u0dru0stUGz52nXYbi6Ch7MkF/Yq/z2lRIFq2u/UJkiN76aTFPkTKKAQo226bKoclf9iYqsKTDXfrRIBSPMurVrfuXAuRPczRkzZ/q4yrPNjFm0wyLL9e4d7R5XacOldWUHLZo04En90YPuWnA8eYL3nStXTh31iem4IXOfF3q7eHZc1Yk3R54ru3Pn1hXMl3tjv3swCa47h256QAA7) center center no-repeat #f5f5f5}#alert{position:fixed;width:30%;margin:30px auto;top:10px;left:0;right:0;z-index:2000;display:none}#alert a{text-decoration:underline}.option-item .bootstrap-switch{margin:15px 10px}.option-item button{margin:10px}.option-item input[type=number]{margin:15px 10px;width:80px;height:28px;padding:3px 10px;vertical-align:middle}.option-item select{margin:10px;display:inline-block}button img,span.btn img{margin-right:3px;margin-bottom:1px}#edit-favourites{float:right;margin-top:-5px}#edit-favourites-list{margin:10px}.about-img-left{float:left;margin:10px 20px 20px 0}.about-img-right{float:right;margin:10px 0 20px 20px}.save-link-options{float:right}.save-link-options input{margin-left:10px}#save-footer{border-top:none;margin-top:0}a:focus,button{outline:0;-moz-outline-style:none}.btn-default{border-color:#ddd}.btn-default:focus{background-color:#fff;border-color:#adadad}.btn-default:active,.btn-default:hover{background-color:#ebebeb;border-color:#adadad}.alert,.btn,.btn-lg,.dropdown-menu,.form-control,.modal-content,.nav-tabs>li>a,.popover,.tooltip-inner{border-radius:0!important}input[type=search]{-webkit-appearance:searchfield;box-shadow:none}input[type=search]::-webkit-search-cancel-button{-webkit-appearance:searchfield-cancel-button}.modal{overflow-y:auto}.form-control{background-color:transparent}code{border:0;white-space:pre-wrap}.bootstrap-switch,.bootstrap-switch-container,.bootstrap-switch-handle-off,.bootstrap-switch-handle-on,.bootstrap-switch-label,pre{border-radius:0!important}#banner,.title{border-bottom:1px solid #ddd}blockquote{font-size:inherit}blockquote a{cursor:pointer}.panel-body:after,.panel-body:before{content:""}.sortable-ghost{opacity:.6}.colorpicker-element{float:left;margin-right:15px}.colorpicker-color,.colorpicker-color div{height:100px}.word-wrap{white-space:pre!important;word-wrap:normal!important;overflow-x:scroll!important}.clearfix{height:0}.blur{color:transparent!important;text-shadow:rgba(0,0,0,.95) 0 0 10px!important}.no-select{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.konami{-ms-transform:rotate(180deg);-webkit-transform:rotate(180deg);transform:rotate(180deg);-moz-transform:rotate(180deg)}.hl1,.hlyellow{background-color:#fff000}.hl2,.hlblue{background-color:#95dfff}.hl3,.hlred{background-color:#ffb6b6}.hl4,.hlorange{background-color:#fcf8e3}.hl5,.hlgreen{background-color:#8de768}.title{color:#424242;background-color:#fafafa}.gutter{background-color:#eee;background-repeat:no-repeat;background-position:50%}.gutter.gutter-horizontal{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAAeCAYAAAAGos/EAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAlSURBVChTYzxz5sx/BiBgAhEgwPju3TtUEZZ79+6BGcNcDQMDACWJMFs4hNOSAAAAAElFTkSuQmCC);cursor:ew-resize}.gutter.gutter-vertical{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAACCAYAAABPJGxCAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACHDwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKL2lDQ1B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DywfODjoMXrjleuvyba/b1++svDMwFDJ0dzhyeOQu++7kvaR7L+9n3J9/sOkh+mHhI6lH5Y+VHtf9qPdj64jlyJlR19G+J0FPHoyxxp7/lP7Th/H8p+Sn5ROqE42TZpOnp9ynbj5b/Wz8eerz+emCn6V/rn6h++K7Xxx/6ZtZNTP+kv9y4dfiV/Kvjrxe9rp71n/28ZvkN/NzhW/l3x59x3jX+z7s/cR85gfsh4qPeh+7Pnl/eriQvLDwG/eE8/s3BCkeAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAI0lEQVQYV2M8c+bMfwYgUFJSAlEM9+7dA9O05jOBSboDBgYAtPcYZ1oUA30AAAAASUVORK5CYII=);cursor:ns-resize}.operation{border:1px solid #999;border-top-width:0}.op_list .operation{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1}#rec_list .operation{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.arg-input,select{height:34px;border:1px solid #ddd;background-color:#fff;color:#424242}#controls{border-top:1px solid #ddd;background-color:#fafafa}.textarea-wrapper div,.textarea-wrapper textarea{font-family:Consolas,monospace;font-size:inherit}.io-info{font-weight:400;font-size:8pt}.arg-title,.category-title{font-weight:700}.arg-input{font-size:15px;line-height:1.428571429}select{padding:6px 8px}.arg[disabled]{background-color:#eee}textarea.arg{color:#424242}.break{color:#b94a48!important;background-color:#f2dede!important;border-color:#eed3d7!important}.category-title{background-color:#fafafa;border-bottom:1px solid #eee}.category-title[aria-expanded=true],.category-title[href='#catFavourites']{border-bottom-color:#ddd}.category-title.collapsed{border-bottom-color:#eee}.category-title:hover{color:#3a87ad}#search{border-bottom:1px solid #e3e3e3}.dropping-file{border:5px dashed #3a87ad!important}.selected-op{color:#c09853!important;background-color:#fcf8e3!important;border-color:#fbeed5!important}.option-item input[type=number]{font-size:14px;line-height:1.428571429;color:#555;background-color:#fff;border:1px solid #ccc}.favourites-hover{color:#468847;background-color:#dff0d8;border:2px dashed #468847!important;padding:8px 8px 9px}#edit-favourites-list{border:1px solid #bce8f1}#edit-favourites-list .operation{border-left:none;border-right:none}#edit-favourites-list .operation:last-child{border-bottom:none}.subtext{font-style:italic;font-size:13px;color:#999}#save-footer{border-bottom:1px solid #e5e5e5}.flow-control-op{color:#396f3a!important;background-color:#c7e4ba!important;border-color:#b3dba2!important}.flow-control-op.break{color:#94312f!important;background-color:#eabfbf!important;border-color:#e2aeb5!important}#support-modal textarea{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif}#load-text,#save-text{font-family:Consolas,monospace}button.dropdown-toggle{background-color:#f4f4f4}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-track{background-color:#fafafa}::-webkit-scrollbar-thumb{background-color:#ccc}::-webkit-scrollbar-thumb:hover{background-color:#bbb}::-webkit-scrollbar-corner{background-color:#fafafa}.disabled{color:#999!important;background-color:#dfdfdf!important;border-color:#cdcdcd!important}.grey{color:#333;background-color:#f5f5f5;border-color:#ddd}.dark-blue{color:#fff;background-color:#428bca;border-color:#428bca}.red{color:#b94a48;background-color:#f2dede;border-color:#eed3d7}.amber{color:#c09853;background-color:#fcf8e3;border-color:#fbeed5}.green{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.blue{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1} \ No newline at end of file diff --git a/src/css/structure/overrides.css b/src/css/structure/overrides.css index e33c1abb..818ff04a 100755 --- a/src/css/structure/overrides.css +++ b/src/css/structure/overrides.css @@ -64,6 +64,10 @@ blockquote { font-size: inherit; } +blockquote a { + cursor: pointer; +} + optgroup { font-weight: bold; } diff --git a/src/static/stats.txt b/src/static/stats.txt index c76e2a01..211ff731 100644 --- a/src/static/stats.txt +++ b/src/static/stats.txt @@ -1,5 +1,5 @@ -210 source files -114832 lines +211 source files +114836 lines 4.3M size 141 JavaScript source files From e3c977934b882b63b41a7dbcffa77f7ad7f96613 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Tue, 31 Jan 2017 18:24:56 +0000 Subject: [PATCH 24/24] Variable names changed from underscore to CamelCase. Eslint rules updated. #64 --- Gruntfile.js | 66 +- build/prod/cyberchef.htm | 26 +- build/prod/index.html | 2 +- build/prod/scripts.js | 22 +- build/prod/styles.css | 2 +- src/css/structure/layout.css | 10 +- src/css/themes/classic.css | 4 +- src/html/index.html | 8 +- src/js/.eslintrc.json | 3 + src/js/config/OperationConfig.js | 1316 ++++++++++++------------ src/js/core/Chef.js | 52 +- src/js/core/Dish.js | 44 +- src/js/core/FlowControl.js | 96 +- src/js/core/Ingredient.js | 32 +- src/js/core/Operation.js | 104 +- src/js/core/Recipe.js | 126 +-- src/js/core/Utils.js | 378 +++---- src/js/operations/Base.js | 4 +- src/js/operations/Base64.js | 116 +-- src/js/operations/BitwiseOp.js | 112 +- src/js/operations/ByteRepr.js | 120 +-- src/js/operations/CharEnc.js | 16 +- src/js/operations/Checksum.js | 44 +- src/js/operations/Cipher.js | 140 +-- src/js/operations/Code.js | 84 +- src/js/operations/Compress.js | 78 +- src/js/operations/Convert.js | 50 +- src/js/operations/DateTime.js | 26 +- src/js/operations/Endian.js | 30 +- src/js/operations/Entropy.js | 50 +- src/js/operations/Extract.js | 134 +-- src/js/operations/FileType.js | 38 +- src/js/operations/HTML.js | 62 +- src/js/operations/HTTP.js | 12 +- src/js/operations/Hash.js | 128 +-- src/js/operations/Hexdump.js | 56 +- src/js/operations/IP.js | 426 ++++---- src/js/operations/JS.js | 44 +- src/js/operations/MAC.js | 46 +- src/js/operations/OS.js | 14 +- src/js/operations/PublicKey.js | 202 ++-- src/js/operations/Punycode.js | 4 +- src/js/operations/QuotedPrintable.js | 14 +- src/js/operations/Rotate.js | 80 +- src/js/operations/SeqUtils.js | 38 +- src/js/operations/StrUtils.js | 138 +-- src/js/operations/Tidy.js | 58 +- src/js/operations/URL.js | 26 +- src/js/operations/UUID.js | 2 +- src/js/operations/Unicode.js | 6 +- src/js/views/html/ControlsWaiter.js | 235 ++--- src/js/views/html/HTMLApp.js | 332 +++--- src/js/views/html/HTMLCategory.js | 20 +- src/js/views/html/HTMLIngredient.js | 74 +- src/js/views/html/HTMLOperation.js | 40 +- src/js/views/html/HighlighterWaiter.js | 176 ++-- src/js/views/html/InputWaiter.js | 58 +- src/js/views/html/Manager.js | 188 ++-- src/js/views/html/OperationsWaiter.js | 148 +-- src/js/views/html/OptionsWaiter.js | 16 +- src/js/views/html/OutputWaiter.js | 118 +-- src/js/views/html/RecipeWaiter.js | 144 +-- src/js/views/html/SeasonalWaiter.js | 58 +- src/js/views/html/WindowWaiter.js | 18 +- src/js/views/html/main.js | 28 +- src/static/stats.txt | 6 +- 66 files changed, 3176 insertions(+), 3172 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 92eefb1f..5ec73d08 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -7,12 +7,12 @@ module.exports = function(grunt) { // Tasks grunt.registerTask("dev", "A persistent task which creates a development build whenever source files are modified.", - ["clean:dev", "concat:css", "concat:js", "copy:html_dev", "copy:static_dev", "chmod:build", "watch"]); + ["clean:dev", "concat:css", "concat:js", "copy:htmlDev", "copy:staticDev", "chmod:build", "watch"]); grunt.registerTask("prod", "Creates a production-ready build. Use the --msg flag to add a compile message.", - ["eslint", "exec:stats", "clean", "jsdoc", "concat", "copy:html_dev", "copy:html_prod", "copy:html_inline", - "copy:static_dev", "copy:static_prod", "cssmin", "uglify:prod", "inline", "htmlmin", "chmod"]); + ["eslint", "exec:stats", "clean", "jsdoc", "concat", "copy:htmlDev", "copy:htmlProd", "copy:htmlInline", + "copy:staticDev", "copy:staticProd", "cssmin", "uglify:prod", "inline", "htmlmin", "chmod"]); grunt.registerTask("docs", "Compiles documentation in the /docs directory.", @@ -20,15 +20,15 @@ module.exports = function(grunt) { grunt.registerTask("stats", "Provides statistics about the code base such as how many lines there are as well as details of file sizes before and after compression.", - ["concat:js", "uglify:prod", "exec:stats", "exec:repo_size", "exec:display_stats"]); + ["concat:js", "uglify:prod", "exec:stats", "exec:repoSize", "exec:displayStats"]); grunt.registerTask("release", "Prepares and deploys a production version of CyberChef to the gh-pages branch.", - ["copy:gh_pages", "exec:deploy_gh_pages"]); + ["copy:ghPages", "exec:deployGhPages"]); grunt.registerTask("default", "Lints the code base and shows stats", - ["eslint", "exec:stats", "exec:display_stats"]); + ["eslint", "exec:stats", "exec:displayStats"]); grunt.registerTask("doc", "docs"); grunt.registerTask("lint", "eslint"); @@ -50,7 +50,7 @@ module.exports = function(grunt) { // JS includes - var js_files = [ + var jsFiles = [ // Third party framework libraries "src/js/lib/jquery-2.1.1.js", "src/js/lib/bootstrap-3.3.6.js", @@ -179,10 +179,10 @@ module.exports = function(grunt) { * limitations under the License.\n\ */\n'; - var template_options = { + var templateOptions = { data: { - compile_msg: grunt.option("compile-msg") || grunt.option("msg") || "", - codebase_stats: grunt.file.read("src/static/stats.txt").split("\n").join("
                                                                                                                                                                                      ") + compileMsg: grunt.option("compile-msg") || grunt.option("msg") || "", + codebaseStats: grunt.file.read("src/static/stats.txt").split("\n").join("
                                                                                                                                                                                      ") } }; @@ -220,7 +220,7 @@ module.exports = function(grunt) { }, concat: { options: { - process: template_options + process: templateOptions }, css: { options: { @@ -242,43 +242,43 @@ module.exports = function(grunt) { options: { banner: '"use strict";\n' }, - src: js_files, + src: jsFiles, dest: "build/dev/scripts.js" } }, copy: { - html_dev: { + htmlDev: { options: { process: function(content, srcpath) { - return grunt.template.process(content, template_options); + return grunt.template.process(content, templateOptions); } }, src: "src/html/index.html", dest: "build/dev/index.html" }, - html_prod: { + htmlProd: { options: { process: function(content, srcpath) { - return grunt.template.process(content, template_options); + return grunt.template.process(content, templateOptions); } }, src: "src/html/index.html", dest: "build/prod/index.html" }, - html_inline: { + htmlInline: { options: { process: function(content, srcpath) { // TODO: Do all this in Jade content = content.replace( 'Download CyberChef', 'Compile time: ' + grunt.template.today("dd/mm/yyyy HH:MM:ss") + " UTC"); - return grunt.template.process(content, template_options); + return grunt.template.process(content, templateOptions); } }, src: "src/html/index.html", dest: "build/prod/cyberchef.htm" }, - static_dev: { + staticDev: { files: [ { expand: true, @@ -293,7 +293,7 @@ module.exports = function(grunt) { } ] }, - static_prod: { + staticProd: { files: [ { expand: true, @@ -308,13 +308,13 @@ module.exports = function(grunt) { } ] }, - gh_pages: { + ghPages: { options: { process: function(content, srcpath) { // Add Google Analytics code to index.html content = content.replace("", grunt.file.read("src/static/ga.html") + ""); - return grunt.template.process(content, template_options); + return grunt.template.process(content, templateOptions); } }, src: "build/prod/index.html", @@ -331,12 +331,12 @@ module.exports = function(grunt) { ASCIIOnly: true, beautify: { beautify: false, - inline_script: true, - ascii_only: true, - screw_ie8: true + inline_script: true, // eslint-disable-line camelcase + ascii_only: true, // eslint-disable-line camelcase + screw_ie8: true // eslint-disable-line camelcase }, compress: { - screw_ie8: true + screw_ie8: true // eslint-disable-line camelcase }, banner: banner }, @@ -408,7 +408,7 @@ module.exports = function(grunt) { } }, exec: { - repo_size: { + repoSize: { command: [ "git ls-files | wc -l | xargs printf '\n%b\ttracked files\n'", "du -hs | egrep -o '^[^\t]*' | xargs printf '%b\trepository size\n'" @@ -443,13 +443,13 @@ module.exports = function(grunt) { ].join(" >> src/static/stats.txt;") + " >> src/static/stats.txt;", stderr: false }, - display_stats: { + displayStats: { command: "cat src/static/stats.txt" }, - clean_git: { + cleanGit: { command: "git gc --prune=now --aggressive" }, - deploy_gh_pages: { + deployGhPages: { command: [ "git add build/prod/index.html -v", "COMMIT_HASH=$(git rev-parse HEAD)", @@ -471,15 +471,15 @@ module.exports = function(grunt) { }, html: { files: "src/html/**/*.html", - tasks: ["copy:html_dev", "chmod:build"] + tasks: ["copy:htmlDev", "chmod:build"] }, static: { files: ["src/static/**/*", "src/static/**/.*"], - tasks: ["copy:static_dev", "chmod:build"] + tasks: ["copy:staticDev", "chmod:build"] }, grunt: { files: "Gruntfile.js", - tasks: ["clean:dev", "concat:css", "concat:js", "copy:html_dev", "copy:static_dev", "chmod:build"] + tasks: ["clean:dev", "concat:css", "concat:js", "copy:htmlDev", "copy:staticDev", "chmod:build"] } }, }); diff --git a/build/prod/cyberchef.htm b/build/prod/cyberchef.htm index d590b2c2..ade09941 100755 --- a/build/prod/cyberchef.htm +++ b/build/prod/cyberchef.htm @@ -85,11 +85,11 @@ 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. -*/.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.clo,.opn,.pun{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.kwd,.tag,.typ{font-weight:700}.str{color:#060}.kwd{color:#006}.com{color:#600;font-style:italic}.typ{color:#404}.lit{color:#044}.clo,.opn,.pun{color:#440}.tag{color:#006}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}#content-wrapper{top:0;left:0;width:100%;height:100%}#banner{height:30px;width:100%;text-align:center;line-height:30px}#wrapper{top:30px;bottom:0;width:100%}div#operations,div#recipe{width:50%;height:100%}div#input,div#output{width:100%;height:50%}.title{padding:10px;height:43px}.textarea-wrapper{top:43px;bottom:0;width:100%;overflow:hidden}#output-html,textarea{width:100%;height:100%;border:none;padding:3px;-moz-padding-start:3px;-moz-padding-end:3px}#input-text,#output-html,#output-text{position:relative;border-width:0;margin:0;resize:none;background-color:transparent;white-space:pre-wrap;word-wrap:break-word}#output-html{display:none;overflow-y:auto;-moz-padding-start:1px}.split{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;overflow:auto;position:relative}.gutter.gutter-horizontal,.split.split-horizontal{height:100%;float:left}#input-highlighter,#output-highlighter{position:absolute;left:0;top:0;width:100%;height:100%;padding:3px;margin:0;overflow:hidden;letter-spacing:normal;white-space:pre-wrap;word-wrap:break-word;color:#fff;background-color:transparent;border:none}#op_list,#rec_list,.op_list{margin:0;padding:0;list-style-type:none}#op_list,#rec_list{position:absolute;top:43px;bottom:0;width:100%}.io-btn-group,.io-info{margin-top:-4px;float:right}#rec_list{bottom:120px;overflow:auto}.operation{cursor:pointer;padding:10px;list-style-type:none;position:relative}#controls{position:absolute;width:100%;height:120px;bottom:0;padding:10px}.io-info{margin-right:20px;height:30px;text-align:right;line-height:10px}.arg-group,.inline-args input[type=checkbox]{margin-top:10px}#input-info{line-height:15px}.arg-group{display:table;width:100%}.arg-group-text{display:block}.inline-args{float:left;width:auto;margin-right:30px;height:34px}.inline-args input[type=number]{width:100px}.arg-input{display:table-cell;width:100%;padding:6px 12px}.short-string{width:150px}select{display:block}.arg[disabled]{cursor:not-allowed;opacity:1}textarea.arg{width:100%;min-height:50px;height:70px;margin-top:5px;border:1px solid #ddd;resize:vertical}.arg-label{display:table-cell;width:1px;padding-right:10px;font-weight:400;white-space:pre}.title,optgroup{font-weight:700}.editable-option{position:relative;display:inline-block}.editable-option-input{position:absolute;top:1px;left:1px;width:calc(100% - 20px);height:calc(100% - 2px)!important;border:none!important}#operational-controls{width:65%;float:left;text-align:center}#bake-group{display:table;width:100%}#bake{display:table-cell;width:100%;border-top-right-radius:0;border-bottom-right-radius:0}#auto-bake-label{display:table-cell;padding:1px;line-height:1.35;width:60px;border-top-left-radius:0;border-bottom-left-radius:0;border-left:1px solid #5cb85c}#auto-bake-label:hover{border-left-color:#398439}#auto-bake-label div{font-size:10px;padding:2px}#extra-controls{float:right;width:35%;padding-left:10px}.op-icon{float:right;margin-left:10px;margin-top:3px}.recip-icons{position:absolute;top:13px;right:10px;height:16px}.recip-icon{margin-right:10px;vertical-align:baseline;float:right}.disable-icon{width:16px;height:16px;margin-top:-1px;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAACfElEQ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CSincJobAeP1sEDBFi6J50UyPy4l2RNuioz756Ts0tt1OB4jH2a52Ne2HGh9PwrJm2EcxZx/HyPRYMDgB2u02/N3d1c7w8BZMM1ptNJBPp3GwsUExB/s4RoYsPf0JOkFgdoH34YkJ/D48xC/HyTTOzl5ayWSIktwxqlVo0SjIkKWnP0Hg+4swjGitVMJFNpu5o+svptfXv6DZBDIZezoWS3Db3A0ZsvRcH8H354dGR9EoFHA3EvlorqycwvOAXM4G8Pav+f7YmEOGLD1gsIzl54+V+vBK/Yw9ZAv1LQW1FrdFSnKVfQTK5liPUfRI9I8ArqiPjLAF9vcHVybyzlpasgcZeq7voNXKNSsV3DMMXB4fp/8xLyzYuLri2DIZsvQM3sFOzXURiUR4zsQNcyrFleFVKpNyP2/IkKVnsArbF65bbkqplJSJZrl5x5qbs7G3h3artSyV+arr+lMyZOnpP2Wp6ZFos3R+vvUgCGDNzgKalkA4rECIr07662J2i0X4nrfJJ33jJT6Zmvpcr9XWCicn5WI+j7rrAmKgmLOPY2TI0sPgb8TBZOi/PpN1qnDr7/wH3jxgB/FKIXkAAAAASUVORK5CYII=) no-repeat}.breakpoint{float:right;width:14px;height:14px;background-color:#eee;border:1px solid #aaa}.breakpoint-selected{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAXVBMVEXIUkvzUVHzTEzzn5785eXrbW24BgbzWVnze3vzVVXzY2Pyion509PzbW3zXV1UMxj0l5f1srKbRTRgOxzJDg796ur74ODfIyP5zs6LLx3pNTXYGxuxdkVZNhn////sCC1eAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAABWSURBVBjTnc+7EoAgDERRTOQVxMEZFAf//z8FjAUFDbfb060QU2FwxngimxnCea3bjegSgz+0tguAfBgIy64QGfZQdg91dgAtqUZgnfz6IacYVWvu2AvR4wNAv0nxrAAAAABJRU5ErkJggg==) -2px -2px no-repeat #eee}.banner-right{float:right;margin-right:10px}#banner img{margin-bottom:2px;margin-left:8px}.category-title{display:block;padding:10px}.category{margin:0!important;border-radius:0!important;border:none}#search{border-radius:0;border:none}.loading_file{background:url(data:image/gif;base64,R0lGODlhPAA8APcAAAAAAAEBAQICAgMDAwQEBAUFBQYGBgcHBwgICAkJCQoKCgsLCwwMDA0NDQ4ODg8PDxAQEBERERISEhMTExQUFBUVFRYWFhcXFxgYGBkZGRoaGhsbGxwcHB0dHR4eHh8fHyAgICEhISIiIiMjIyQkJCUlJSYmJicnJygoKCkpKSoqKisrKywsLC0tLS4uLi8vLzAwMDExMTIyMjMzMzQ0NDU1NTY2Njc3Nzg4ODk5OTo6Ojs7Ozw8PD09PT4+Pj8/P0BAQEFBQUJCQkNDQ0REREVFRUZGRkdHR0hISElJSUpKSktLS0xMTE1NTU5OTk9PT1BQUFFRUVJSUlNTU1RUVFVVVVZWVldXV1hYWFlZWVpaWltbW1xcXF1dXV5eXl9fX2BgYGFhYWJiYmNjY2RkZGVlZWZmZmdnZ2hoaGlpaWpqamtra2xsbG1tbW5ubm9vb3BwcHFxcXJycnNzc3R0dHV1dXZ2dnd3d3h4eHl5eXp6ent7e3x8fH19fX5+fn9/f4CAgIGBgYKCgoODg4SEhIWFhYaGhoeHh4iIiImJiYqKiouLi4yMjI2NjY6Ojo+Pj5CQkJGRkZKSkpOTk5SUlJWVlZaWlpeXl5iYmJmZmZqampubm5ycnJ2dnZ6enp+fn6CgoKGhoaKioqOjo6SkpKWlpaampqenp6ioqKmpqaqqqqurq6ysrK2tra6urq+vr7CwsLGxsbKysrOzs7S0tLW1tba2tre3t7i4uLm5ubq6uru7u7y8vL29vb6+vr+/v8DAwMHBwcLCwsPDw8TExMXFxcbGxsfHx8jIyMnJycrKysvLy8zMzM3Nzc7Ozs/Pz9DQ0NHR0dLS0tPT09TU1NXV1dbW1tfX19jY2NnZ2dra2tvb29zc3N3d3d7e3t/f3+Dg4OHh4eLi4uPj4+Tk5OXl5ebm5ufn5+jo6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hXMl3tjv3swCa47h256QAA7) center center no-repeat #f5f5f5}#alert{position:fixed;width:30%;margin:30px auto;top:10px;left:0;right:0;z-index:2000;display:none}#alert a{text-decoration:underline}.option-item .bootstrap-switch{margin:15px 10px}.option-item button{margin:10px}.option-item input[type=number]{margin:15px 10px;width:80px;height:28px;padding:3px 10px;vertical-align:middle}.option-item select{margin:10px;display:inline-block}button img,span.btn img{margin-right:3px;margin-bottom:1px}#edit-favourites{float:right;margin-top:-5px}#edit-favourites-list{margin:10px}.about-img-left{float:left;margin:10px 20px 20px 0}.about-img-right{float:right;margin:10px 0 20px 20px}.save-link-options{float:right}.save-link-options input{margin-left:10px}#save-footer{border-top:none;margin-top:0}a:focus,button{outline:0;-moz-outline-style:none}.btn-default{border-color:#ddd}.btn-default:focus{background-color:#fff;border-color:#adadad}.btn-default:active,.btn-default:hover{background-color:#ebebeb;border-color:#adadad}.alert,.btn,.btn-lg,.dropdown-menu,.form-control,.modal-content,.nav-tabs>li>a,.popover,.tooltip-inner{border-radius:0!important}input[type=search]{-webkit-appearance:searchfield;box-shadow:none}input[type=search]::-webkit-search-cancel-button{-webkit-appearance:searchfield-cancel-button}.modal{overflow-y:auto}.form-control{background-color:transparent}code{border:0;white-space:pre-wrap}.bootstrap-switch,.bootstrap-switch-container,.bootstrap-switch-handle-off,.bootstrap-switch-handle-on,.bootstrap-switch-label,pre{border-radius:0!important}#banner,.title{border-bottom:1px solid #ddd}blockquote{font-size:inherit}blockquote a{cursor:pointer}.panel-body:after,.panel-body:before{content:""}.sortable-ghost{opacity:.6}.colorpicker-element{float:left;margin-right:15px}.colorpicker-color,.colorpicker-color div{height:100px}.word-wrap{white-space:pre!important;word-wrap:normal!important;overflow-x:scroll!important}.clearfix{height:0}.blur{color:transparent!important;text-shadow:rgba(0,0,0,.95) 0 0 10px!important}.no-select{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.konami{-ms-transform:rotate(180deg);-webkit-transform:rotate(180deg);transform:rotate(180deg);-moz-transform:rotate(180deg)}.hl1,.hlyellow{background-color:#fff000}.hl2,.hlblue{background-color:#95dfff}.hl3,.hlred{background-color:#ffb6b6}.hl4,.hlorange{background-color:#fcf8e3}.hl5,.hlgreen{background-color:#8de768}.title{color:#424242;background-color:#fafafa}.gutter{background-color:#eee;background-repeat:no-repeat;background-position:50%}.gutter.gutter-horizontal{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAAeCAYAAAAGos/EAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAlSURBVChTYzxz5sx/BiBgAhEgwPju3TtUEZZ79+6BGcNcDQMDACWJMFs4hNOSAAAAAElFTkSuQmCC);cursor:ew-resize}.gutter.gutter-vertical{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAACCAYAAABPJGxCAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACHDwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKL2lDQ1BJQ0MgUHJvZmlsZQAASMedlndUVNcWh8+9d3qhzTDSGXqTLjCA9C4gHQRRGGYGGMoAwwxNbIioQEQREQFFkKCAAaOhSKyIYiEoqGAPSBBQYjCKqKhkRtZKfHl57+Xl98e939pn73P32XuftS4AJE8fLi8FlgIgmSfgB3o401eFR9Cx/QAGeIABpgAwWempvkHuwUAkLzcXerrICfyL3gwBSPy+ZejpT6eD/0/SrFS+AADIX8TmbE46S8T5Ik7KFKSK7TMipsYkihlGiZkvSlDEcmKOW+Sln30W2VHM7GQeW8TinFPZyWwx94h4e4aQI2LER8QFGVxOpohvi1gzSZjMFfFbcWwyh5kOAIoktgs4rHgRm4iYxA8OdBHxcgBwpLgvOOYLFnCyBOJDuaSkZvO5cfECui5Lj25qbc2ge3IykzgCgaE/k5XI5LPpLinJqUxeNgCLZ/4sGXFt6aIiW5paW1oamhmZflGo/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Ju0vWkzfG9+QzqUvia9U0AV/Uz1CXWFW4WjGfYZVRlvM0MzT2ZJZ/Gy+rL1s3dkT+S453y9DrWOta47Vy13c+7oeqf1tRugDTEbujdqbMzfOL7JY9PRzYTNiZt/yDPJK817vSVsS1e+cv6m/LGtHlubCyQK+AXD22y31WxHbedu799hvmP/jk+F7MJrRSZF5UUfilnF174y/ariq4WdsTv7SyxLDu7C7OLtGtrtsPtoqXRpTunYHt897WX0ssKy13uj9l4tX1Zes4+wT7hvpMKnonO/5v5d+z9UxlfeqXKuaq1Wqt5RPXeAfWDwoOPBlhrlmqKa94e4h+7WetS212nXlR/GHM44/LQ+tL73a8bXjQ0KDUUNH4/wjowcDTza02jV2Nik1FTSDDcLm6eORR67+Y3rN50thi21rbTWouPguPD4s2+jvx064X2i+yTjZMt3Wt9Vt1HaCtuh9uz2mY74jpHO8M6BUytOdXfZdrV9b/T9kdNqp6vOyJ4pOUs4m3924VzOudnzqeenL8RdGOuO6n5wcdXF2z0BPf2XvC9duex++WKvU++5K3ZXTl+1uXrqGuNax3XL6+19Fn1tP1j80NZv2d9+w+pG503rm10DywfODjoMXrjleuvyba/b1++svDMwFDJ0dzhyeOQu++7kvaR7L+9n3J9/sOkh+mHhI6lH5Y+VHtf9qPdj64jlyJlR19G+J0FPHoyxxp7/lP7Th/H8p+Sn5ROqE42TZpOnp9ynbj5b/Wz8eerz+emCn6V/rn6h++K7Xxx/6ZtZNTP+kv9y4dfiV/Kvjrxe9rp71n/28ZvkN/NzhW/l3x59x3jX+z7s/cR85gfsh4qPeh+7Pnl/eriQvLDwG/eE8/s3BCkeAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAI0lEQVQYV2M8c+bMfwYgUFJSAlEM9+7dA9O05jOBSboDBgYAtPcYZ1oUA30AAAAASUVORK5CYII=);cursor:ns-resize}.operation{border:1px solid #999;border-top-width:0}.op_list .operation{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1}#rec_list .operation{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.arg-input,select{height:34px;border:1px solid #ddd;background-color:#fff;color:#424242}#controls{border-top:1px solid #ddd;background-color:#fafafa}.textarea-wrapper div,.textarea-wrapper textarea{font-family:Consolas,monospace;font-size:inherit}.io-info{font-weight:400;font-size:8pt}.arg-title,.category-title{font-weight:700}.arg-input{font-size:15px;line-height:1.428571429}select{padding:6px 8px}.arg[disabled]{background-color:#eee}textarea.arg{color:#424242}.break{color:#b94a48!important;background-color:#f2dede!important;border-color:#eed3d7!important}.category-title{background-color:#fafafa;border-bottom:1px solid #eee}.category-title[aria-expanded=true],.category-title[href='#catFavourites']{border-bottom-color:#ddd}.category-title.collapsed{border-bottom-color:#eee}.category-title:hover{color:#3a87ad}#search{border-bottom:1px solid #e3e3e3}.dropping-file{border:5px dashed #3a87ad!important}.selected-op{color:#c09853!important;background-color:#fcf8e3!important;border-color:#fbeed5!important}.option-item input[type=number]{font-size:14px;line-height:1.428571429;color:#555;background-color:#fff;border:1px solid #ccc}.favourites-hover{color:#468847;background-color:#dff0d8;border:2px dashed #468847!important;padding:8px 8px 9px}#edit-favourites-list{border:1px solid #bce8f1}#edit-favourites-list .operation{border-left:none;border-right:none}#edit-favourites-list .operation:last-child{border-bottom:none}.subtext{font-style:italic;font-size:13px;color:#999}#save-footer{border-bottom:1px solid #e5e5e5}.flow-control-op{color:#396f3a!important;background-color:#c7e4ba!important;border-color:#b3dba2!important}.flow-control-op.break{color:#94312f!important;background-color:#eabfbf!important;border-color:#e2aeb5!important}#support-modal textarea{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif}#load-text,#save-text{font-family:Consolas,monospace}button.dropdown-toggle{background-color:#f4f4f4}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-track{background-color:#fafafa}::-webkit-scrollbar-thumb{background-color:#ccc}::-webkit-scrollbar-thumb:hover{background-color:#bbb}::-webkit-scrollbar-corner{background-color:#fafafa}.disabled{color:#999!important;background-color:#dfdfdf!important;border-color:#cdcdcd!important}.grey{color:#333;background-color:#f5f5f5;border-color:#ddd}.dark-blue{color:#fff;background-color:#428bca;border-color:#428bca}.red{color:#b94a48;background-color:#f2dede;border-color:#eed3d7}.amber{color:#c09853;background-color:#fcf8e3;border-color:#fbeed5}.green{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.blue{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1} Edit
                                                                                                                                                                                      Operations
                                                                                                                                                                                        Recipe
                                                                                                                                                                                          Input
                                                                                                                                                                                          Output
                                                                                                                                                                                          Operations
                                                                                                                                                                                            Recipe
                                                                                                                                                                                              Input
                                                                                                                                                                                              Output
                                                                                                                                                                                              \ No newline at end of file +Ob.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value>=1&&c.value<=255)return new Ob(c.value);throw new a("FORG0001")},g("unsignedByte",Ob),Pb.prototype=new ub,Pb.prototype.builtInKind=j.NORMALIZEDSTRING_DT,Pb.cast=function(a){return new Pb(Ac(a))},g("normalizedString",Pb),Qb.prototype=new Pb,Qb.prototype.builtInKind=j.TOKEN_DT,Qb.cast=function(a){return new Qb(Ac(a))},g("token",Qb),Rb.prototype=new Qb,Rb.prototype.builtInKind=j.NAME_DT,Rb.cast=function(a){return new Rb(Ac(a))},g("Name",Rb),Sb.prototype=new Rb,Sb.prototype.builtInKind=j.NCNAME_DT,Sb.cast=function(a){return new Sb(Ac(a))},g("NCName",Sb),Tb.prototype=new Sb,Tb.prototype.builtInKind=j.ENTITY_DT,Tb.cast=function(a){return new Tb(Ac(a))},g("ENTITY",Tb),Ub.prototype=new Sb,Ub.prototype.builtInKind=j.ID_DT,Ub.cast=function(a){return new Ub(Ac(a))},g("ID",Ub),Vb.prototype=new Sb,Vb.prototype.builtInKind=j.IDREF_DT,Vb.cast=function(a){return new Vb(Ac(a))},g("IDREF",Vb),Wb.prototype=new Qb,Wb.prototype.builtInKind=j.LANGUAGE_DT,Wb.cast=function(a){return new Wb(Ac(a))},g("language",Wb),Xb.prototype=new Qb,Xb.prototype.builtInKind=j.NMTOKEN_DT,Xb.cast=function(a){return new Xb(Ac(a))},g("NMTOKEN",Xb),Zb.prototype=new Yb,$b.prototype=new Zb,_b.prototype=new Zb,ac.prototype=new Zb,bc.prototype=new Zb,cc.prototype=new Zb,dc.prototype=new Zb,$c["hexBinary-equal"]=function(a,b){return new Xa(a.valueOf()==b.valueOf())},$c["base64Binary-equal"]=function(a,b){return new Xa(a.valueOf()==b.valueOf())},$c["boolean-equal"]=function(a,b){return new Xa(a.valueOf()==b.valueOf())},$c["boolean-less-than"]=function(a,b){return new Xa(a.valueOf()b.valueOf())},$c["yearMonthDuration-less-than"]=function(a,b){return new Xa(lc(a)lc(b))},$c["dayTimeDuration-less-than"]=function(a,b){return new Xa(jc(a)jc(b))},$c["duration-equal"]=function(a,b){return new Xa(a.negative==b.negative&&lc(a)==lc(b)&&jc(a)==jc(b))},$c["dateTime-equal"]=function(a,b){return gc(a,b,"eq")},$c["dateTime-less-than"]=function(a,b){return gc(a,b,"lt")},$c["dateTime-greater-than"]=function(a,b){return gc(a,b,"gt")},$c["date-equal"]=function(a,b){return fc(a,b,"eq")},$c["date-less-than"]=function(a,b){return fc(a,b,"lt")},$c["date-greater-than"]=function(a,b){return fc(a,b,"gt")},$c["time-equal"]=function(a,b){return ec(a,b,"eq")},$c["time-less-than"]=function(a,b){return ec(a,b,"lt")},$c["time-greater-than"]=function(a,b){return ec(a,b,"gt")},$c["gYearMonth-equal"]=function(a,b){return gc(new _a(a.year,a.month,Za(a.year,a.month),0,0,0,null==a.timezone?this.timezone:a.timezone),new _a(b.year,b.month,Za(b.year,b.month),0,0,0,null==b.timezone?this.timezone:b.timezone),"eq")},$c["gYear-equal"]=function(a,b){return gc(new _a(a.year,1,1,0,0,0,null==a.timezone?this.timezone:a.timezone),new _a(b.year,1,1,0,0,0,null==b.timezone?this.timezone:b.timezone),"eq")},$c["gMonthDay-equal"]=function(a,b){return gc(new _a(1972,a.month,a.day,0,0,0,null==a.timezone?this.timezone:a.timezone),new _a(1972,b.month,b.day,0,0,0,null==b.timezone?this.timezone:b.timezone),"eq")},$c["gMonth-equal"]=function(a,b){return gc(new _a(1972,a.month,Za(1972,b.month),0,0,0,null==a.timezone?this.timezone:a.timezone),new _a(1972,b.month,Za(1972,b.month),0,0,0,null==b.timezone?this.timezone:b.timezone),"eq")},$c["gDay-equal"]=function(a,b){return gc(new _a(1972,12,a.day,0,0,0,null==a.timezone?this.timezone:a.timezone),new _a(1972,12,b.day,0,0,0,null==b.timezone?this.timezone:b.timezone),"eq")},$c["add-yearMonthDurations"]=function(a,b){return mc(lc(a)+lc(b))},$c["subtract-yearMonthDurations"]=function(a,b){return mc(lc(a)-lc(b))},$c["multiply-yearMonthDuration"]=function(a,b){return mc(lc(a)*b)},$c["divide-yearMonthDuration"]=function(a,b){return mc(lc(a)/b)},$c["divide-yearMonthDuration-by-yearMonthDuration"]=function(a,b){return new fb(lc(a)/lc(b))},$c["add-dayTimeDurations"]=function(a,b){return kc(jc(a)+jc(b))},$c["subtract-dayTimeDurations"]=function(a,b){return kc(jc(a)-jc(b))},$c["multiply-dayTimeDuration"]=function(a,b){return kc(jc(a)*b)},$c["divide-dayTimeDuration"]=function(a,b){return kc(jc(a)/b)},$c["divide-dayTimeDuration-by-dayTimeDuration"]=function(a,b){return new fb(jc(a)/jc(b))},$c["subtract-dateTimes"]=function(a,b){return kc(oc(a)-oc(b))},$c["subtract-dates"]=function(a,b){return kc(oc(a)-oc(b))},$c["subtract-times"]=function(a,b){return kc(nc(a)-nc(b))},$c["add-yearMonthDuration-to-dateTime"]=function(a,b){return hc(a,b,"+")},$c["add-dayTimeDuration-to-dateTime"]=function(a,b){return ic(a,b,"+")},$c["subtract-yearMonthDuration-from-dateTime"]=function(a,b){return hc(a,b,"-")},$c["subtract-dayTimeDuration-from-dateTime"]=function(a,b){return ic(a,b,"-")},$c["add-yearMonthDuration-to-date"]=function(a,b){return hc(a,b,"+")},$c["add-dayTimeDuration-to-date"]=function(a,b){return ic(a,b,"+")},$c["subtract-yearMonthDuration-from-date"]=function(a,b){return hc(a,b,"-")},$c["subtract-dayTimeDuration-from-date"]=function(a,b){return ic(a,b,"-")},$c["add-dayTimeDuration-to-time"]=function(a,b){var c=new vb(a.hours,a.minutes,a.seconds,a.timezone);return c.hours+=b.hours,c.minutes+=b.minutes,c.seconds+=b.seconds,wb(c)},$c["subtract-dayTimeDuration-from-time"]=function(a,b){var c=new vb(a.hours,a.minutes,a.seconds,a.timezone);return c.hours-=b.hours,c.minutes-=b.minutes,c.seconds-=b.seconds,wb(c)},$c["is-same-node"]=function(a,b){return new Xa(this.DOMAdapter.isSameNode(a,b))},$c["node-before"]=function(a,b){return new Xa(!!(4&this.DOMAdapter.compareDocumentPosition(a,b)))},$c["node-after"]=function(a,b){return new Xa(!!(2&this.DOMAdapter.compareDocumentPosition(a,b)))},$c["numeric-add"]=function(a,b){var c=a.valueOf(),d=b.valueOf(),e=Gc.pow(10,pc(c,d));return qc(a,b,(c*e+d*e)/e)},$c["numeric-subtract"]=function(a,b){var c=a.valueOf(),d=b.valueOf(),e=Gc.pow(10,pc(c,d));return qc(a,b,(c*e-d*e)/e)},$c["numeric-multiply"]=function(a,b){var c=a.valueOf(),d=b.valueOf(),e=Gc.pow(10,pc(c,d));return qc(a,b,c*e*(d*e)/(e*e))},$c["numeric-divide"]=function(a,b){var c=a.valueOf(),d=b.valueOf(),e=Gc.pow(10,pc(c,d));return qc(a,b,a*e/(b*e))},$c["numeric-integer-divide"]=function(a,b){var c=a/b;return new Cb(Gc.floor(c)+(c<0))},$c["numeric-mod"]=function(a,b){var c=a.valueOf(),d=b.valueOf(),e=Gc.pow(10,pc(c,d));return qc(a,b,c*e%(d*e)/e)},$c["numeric-unary-plus"]=function(a){return a},$c["numeric-unary-minus"]=function(a){return a.value*=-1,a},$c["numeric-equal"]=function(a,b){return new Xa(a.valueOf()==b.valueOf())},$c["numeric-less-than"]=function(a,b){return new Xa(a.valueOf()b.valueOf())},$c["QName-equal"]=function(a,b){return new Xa(a.localName==b.localName&&a.namespaceURI==b.namespaceURI)},$c.concatenate=function(a,b){return a.concat(b)},$c.union=function(b,c){for(var d,e=[],f=0,g=b.length;fh?g.pop():(g.push(f[i]),h++):"."!=f[i]&&g.push(f[i]);".."!=f[--i]&&"."!=f[i]||g.push(""),d.path=g.join("/")}return d}),f("true",[],function(){return new Xa(!0)}),f("false",[],function(){return new Xa(!1)}),f("not",[[Yb,"*"]],function(a){return new Xa(!uc(a,this))}),f("position",[],function(){return new Cb(this.position)}),f("last",[],function(){return new Cb(this.size)}),f("current-dateTime",[],function(){return this.dateTime}),f("current-date",[],function(){return Ya.cast(this.dateTime)}),f("current-time",[],function(){return vb.cast(this.dateTime)}),f("implicit-timezone",[],function(){return this.timezone}),f("default-collation",[],function(){return new ub(this.staticContext.defaultCollationName)}),f("static-base-uri",[],function(){return Va.cast(new ub(this.staticContext.baseURI||""))}),f("years-from-duration",[[hb,"?"]],function(a){return rc(a,"year")}),f("months-from-duration",[[hb,"?"]],function(a){return rc(a,"month")}),f("days-from-duration",[[hb,"?"]],function(a){return rc(a,"day")}),f("hours-from-duration",[[hb,"?"]],function(a){return rc(a,"hours")}),f("minutes-from-duration",[[hb,"?"]],function(a){return rc(a,"minutes")}),f("seconds-from-duration",[[hb,"?"]],function(a){return rc(a,"seconds")}),f("year-from-dateTime",[[_a,"?"]],function(a){return sc(a,"year")}),f("month-from-dateTime",[[_a,"?"]],function(a){return sc(a,"month")}),f("day-from-dateTime",[[_a,"?"]],function(a){return sc(a,"day")}),f("hours-from-dateTime",[[_a,"?"]],function(a){return sc(a,"hours")}),f("minutes-from-dateTime",[[_a,"?"]],function(a){return sc(a,"minutes")}),f("seconds-from-dateTime",[[_a,"?"]],function(a){return sc(a,"seconds")}),f("timezone-from-dateTime",[[_a,"?"]],function(a){return sc(a,"timezone")}),f("year-from-date",[[Ya,"?"]],function(a){return sc(a,"year")}),f("month-from-date",[[Ya,"?"]],function(a){return sc(a,"month")}),f("day-from-date",[[Ya,"?"]],function(a){return sc(a,"day")}),f("timezone-from-date",[[Ya,"?"]],function(a){return sc(a,"timezone")}),f("hours-from-time",[[vb,"?"]],function(a){return sc(a,"hours")}),f("minutes-from-time",[[vb,"?"]],function(a){return sc(a,"minutes")}),f("seconds-from-time",[[vb,"?"]],function(a){return sc(a,"seconds")}),f("timezone-from-time",[[vb,"?"]],function(a){return sc(a,"timezone")}),f("adjust-dateTime-to-timezone",[[_a,"?"],[Ab,"?",!0]],function(a,b){return tc(a,arguments.length>1&&null!=b?arguments.length>1?b:this.timezone:null)});f("adjust-date-to-timezone",[[Ya,"?"],[Ab,"?",!0]],function(a,b){return tc(a,arguments.length>1&&null!=b?arguments.length>1?b:this.timezone:null)});f("adjust-time-to-timezone",[[vb,"?"],[Ab,"?",!0]],function(a,b){return tc(a,arguments.length>1&&null!=b?arguments.length>1?b:this.timezone:null)}),f("name",[[Zb,"?",!0]],function(b){if(arguments.length){if(null==b)return new ub("")}else{if(!this.DOMAdapter.isNode(this.item))throw new a("XPTY0004");b=this.item}var c=Xc["node-name"].call(this,b);return new ub(null==c?"":c.toString())}),f("local-name",[[Zb,"?",!0]],function(b){if(arguments.length){if(null==b)return new ub("")}else{if(!this.DOMAdapter.isNode(this.item))throw new a("XPTY0004");b=this.item}return new ub(this.DOMAdapter.getProperty(b,"localName")||"")}),f("namespace-uri",[[Zb,"?",!0]],function(b){if(arguments.length){if(null==b)return Va.cast(new ub(""))}else{if(!this.DOMAdapter.isNode(this.item))throw new a("XPTY0004");b=this.item}return Va.cast(new ub(this.DOMAdapter.getProperty(b,"namespaceURI")||""))}),f("number",[[Ta,"?",!0]],function(b){if(!arguments.length){if(!this.item)throw new a("XPDY0002");b=vc([this.item],this)[0]}var c=new gb(Kc);if(null!=b)try{c=gb.cast(b)}catch(a){}return c}),f("lang",[[ub,"?"],[Zb,"",!0]],function(b,c){if(arguments.length<2){if(!this.DOMAdapter.isNode(this.item))throw new a("XPTY0004");c=this.item}var d=this.DOMAdapter.getProperty;2==d(c,"nodeType")&&(c=d(c,"ownerElement"));for(var e;c;c=d(c,"parentNode"))if(e=d(c,"attributes"))for(var f=0,g=e.length;f1?b.valueOf():0;if(c<0){var d=new Cb(Gc.pow(10,-c)),e=Gc.round($c["numeric-divide"].call(this,a,d)),f=new Cb(e);return nDecimal=Gc.abs($c["numeric-subtract"].call(this,f,$c["numeric-divide"].call(this,a,d))),$c["numeric-multiply"].call(this,$c["numeric-add"].call(this,f,new fb(.5==nDecimal&&e%2?-1:0)),d)}var d=new Cb(Gc.pow(10,c)),e=Gc.round($c["numeric-multiply"].call(this,a,d)),f=new Cb(e);return nDecimal=Gc.abs($c["numeric-subtract"].call(this,f,$c["numeric-multiply"].call(this,a,d))),$c["numeric-divide"].call(this,$c["numeric-add"].call(this,f,new fb(.5==nDecimal&&e%2?-1:0)),d)}),f("resolve-QName",[[ub,"?"],[bc]],function(b,c){if(null==b)return null;var d=b.valueOf(),e=d.match(Bd);if(!e)throw new a("FOCA0002");var f=e[1]||null,g=e[2],h=this.DOMAdapter.lookupNamespaceURI(c,f);if(null!=f&&!h)throw new a("FONS0004");return new tb(f,g,h||null)}),f("QName",[[ub,"?"],[ub]],function(b,c){var d=c.valueOf(),e=d.match(Bd);if(!e)throw new a("FOCA0002");return new tb(e[1]||null,e[2]||null,null==b?"":b.valueOf())}),f("prefix-from-QName",[[tb,"?"]],function(a){return null!=a&&a.prefix?new Sb(a.prefix):null}),f("local-name-from-QName",[[tb,"?"]],function(a){return null==a?null:new Sb(a.localName)}),f("namespace-uri-from-QName",[[tb,"?"]],function(a){return null==a?null:Va.cast(new ub(a.namespaceURI||""))}),f("namespace-uri-for-prefix",[[ub,"?"],[bc]],function(a,b){var c=null==a?"":a.valueOf(),d=this.DOMAdapter.lookupNamespaceURI(b,c||null);return null==d?null:Va.cast(new ub(d))}),f("in-scope-prefixes",[[bc]],function(a){throw"Function 'in-scope-prefixes' not implemented"}),f("boolean",[[Yb,"*"]],function(a){return new Xa(uc(a,this))}),f("index-of",[[Ta,"*"],[Ta],[ub,"",!0]],function(a,b,c){if(!a.length||null==b)return[];var d=b;d instanceof xb&&(d=ub.cast(d));for(var e,f=[],g=0,h=a.length;g1)throw"Collation parameter in function 'distinct-values' is not implemented";if(!a.length)return null;for(var c,d=[],e=0,f=a.length;ed&&(e=d+1);for(var f=[],g=0;gc)return a;for(var e=[],f=0;f2?Gc.round(c):a.length-d+1;return a.slice(d-1,d-1+e)}),f("unordered",[[Yb,"*"]],function(a){return a}),f("zero-or-one",[[Yb,"*"]],function(b){if(b.length>1)throw new a("FORG0003");return b}),f("one-or-more",[[Yb,"*"]],function(b){if(!b.length)throw new a("FORG0004");return b}),f("exactly-one",[[Yb,"*"]],function(b){if(1!=b.length)throw new a("FORG0005");return b}),f("deep-equal",[[Yb,"*"],[Yb,"*"],[ub,"",!0]],function(a,b,c){throw"Function 'deep-equal' not implemented"}),f("count",[[Yb,"*"]],function(a){return new Cb(a.length)}),f("avg",[[Ta,"*"]],function(b){if(!b.length)return null;try{var c=b[0];c instanceof xb&&(c=gb.cast(c));for(var d,e=1,f=b.length;e1?c:new gb(0);try{var d=b[0];d instanceof xb&&(d=gb.cast(d));for(var e,f=1,g=b.length;f2&&(f=d.valueOf()),e=f==Sc+"/collation/codepoint"?Gd:this.staticContext.getCollation(f),!e)throw new a("FOCH0002");return new Cb(e.compare(b.valueOf(),c.valueOf()))}),f("codepoint-equal",[[ub,"?"],[ub,"?"]],function(a,b){return null==a||null==b?null:new Xa(a.valueOf()==b.valueOf())}),f("concat",null,function(){if(arguments.length<2)throw new a("XPST0017");for(var b,c=[],d=0,e=arguments.length;d2?e+Gc.round(c):d.length;return new ub(f>e?d.substring(e,f):"")}),f("string-length",[[ub,"?",!0]],function(b){if(!arguments.length){if(!this.item)throw new a("XPDY0002");b=ub.cast(vc([this.item],this)[0])}return new Cb(null==b?0:b.valueOf().length)}),f("normalize-space",[[ub,"?",!0]],function(b){if(!arguments.length){if(!this.item)throw new a("XPDY0002");b=ub.cast(vc([this.item],this)[0])}return new ub(null==b?"":Pc(b).replace(/\s\s+/g," "))}),f("normalize-unicode",[[ub,"?"],[ub,"",!0]],function(a,b){throw"Function 'normalize-unicode' not implemented"}),f("upper-case",[[ub,"?"]],function(a){return new ub(null==a?"":a.valueOf().toUpperCase())}),f("lower-case",[[ub,"?"]],function(a){return new ub(null==a?"":a.valueOf().toLowerCase())}),f("translate",[[ub,"?"],[ub],[ub]],function(a,b,c){if(null==a)return new ub("");for(var d,e=a.valueOf().split(""),f=b.valueOf().split(""),g=c.valueOf().split(""),h=g.length,i=[],j=0,k=e.length;j126)&&(c[d]=window.encodeURIComponent(c[d]));return new ub(c.join(""))}),f("contains",[[ub,"?"],[ub,"?"],[ub,"",!0]],function(a,b,c){if(arguments.length>2)throw"Collation parameter in function 'contains' is not implemented";return new Xa((null==a?"":a.valueOf()).indexOf(null==b?"":b.valueOf())>=0)}),f("starts-with",[[ub,"?"],[ub,"?"],[ub,"",!0]],function(a,b,c){if(arguments.length>2)throw"Collation parameter in function 'starts-with' is not implemented";return new Xa(0==(null==a?"":a.valueOf()).indexOf(null==b?"":b.valueOf()))}),f("ends-with",[[ub,"?"],[ub,"?"],[ub,"",!0]],function(a,b,c){if(arguments.length>2)throw"Collation parameter in function 'ends-with' is not implemented";var d=null==a?"":a.valueOf(),e=null==b?"":b.valueOf();return new Xa(d.indexOf(e)==d.length-e.length)}),f("substring-before",[[ub,"?"],[ub,"?"],[ub,"",!0]],function(a,b,c){if(arguments.length>2)throw"Collation parameter in function 'substring-before' is not implemented";var d,e=null==a?"":a.valueOf(),f=null==b?"":b.valueOf();return new ub((d=e.indexOf(f))>=0?e.substring(0,d):"")}),f("substring-after",[[ub,"?"],[ub,"?"],[ub,"",!0]],function(a,b,c){if(arguments.length>2)throw"Collation parameter in function 'substring-after' is not implemented";var d,e=null==a?"":a.valueOf(),f=null==b?"":b.valueOf();return new ub((d=e.indexOf(f))>=0?e.substring(d+f.length):"")}),f("matches",[[ub,"?"],[ub],[ub,"",!0]],function(a,b,c){var d=null==a?"":a.valueOf(),e=xc(b.valueOf(),arguments.length>2?c.valueOf():"");return new Xa(e.test(d))}),f("replace",[[ub,"?"],[ub],[ub],[ub,"",!0]],function(a,b,c,d){var e=null==a?"":a.valueOf(),f=xc(b.valueOf(),arguments.length>3?d.valueOf():"");return new Xa(e.replace(f,c.valueOf()))}),f("tokenize",[[ub,"?"],[ub],[ub,"",!0]],function(a,b,c){for(var d=null==a?"":a.valueOf(),e=xc(b.valueOf(),arguments.length>2?c.valueOf():""),f=[],g=0,h=d.split(e),i=h.length;gb?1:-1},yc.prototype=new c;var Hd=new e;yc.prototype.getProperty=function(a,b){if(b in a)return a[b];if("baseURI"==b){for(var c,d="",e=Hd.getFunction("{http://www.w3.org/2005/xpath-functions}resolve-uri"),f=Hd.getDataType("{http://www.w3.org/2001/XMLSchema}string"),g=a;g;g=g.parentNode)1==g.nodeType&&(c=g.getAttribute("xml:base"))&&(d=e(new f(c),new f(d)).toString());return d}if("textContent"==b){var h=[];return function(a){for(var b,c=0;b=a.childNodes[c];c++)3==b.nodeType||4==b.nodeType?h.push(b.data):1==b.nodeType&&b.firstChild&&arguments.callee(b)}(a),h.join("")}},yc.prototype.compareDocumentPosition=function(a,b){if("compareDocumentPosition"in a)return a.compareDocumentPosition(b);if(b==a)return 0;var c,d,e,f,g,h=null,i=null;if(2==a.nodeType&&(h=a,a=this.getProperty(h,"ownerElement")),2==b.nodeType&&(i=b,b=this.getProperty(i,"ownerElement")),h&&i&&a&&a==b)for(f=0,c=this.getProperty(a,"attributes"),g=c.length;fMath.round(a.width/50))&&(e=Math.round(a.width/50)),(!f||f>Math.round(a.width/50))&&(f=Math.round(a.height/50));var h=a.getContext("2d"),i=.08*a.width,j=.03*a.width,k=.08*a.height,l=.15*a.height,m=a.height-k-l,n=a.width-i-j,o=k+m,p=k;h.font=g+"px Arial",h.lineWidth="1.0",h.strokeStyle="#444",CanvasComponents.draw_line(h,i,o,n+i,o),CanvasComponents.draw_line(h,i,o,i,p);var q=.003*n,r=(n-q*b.length)/b.length,s=i+q,t=Math.max.apply(Math,b);h.fillStyle="green";for(var u=0;u=b.length)for(var u=0;u<=b.length;u++)h.fillText(u,s,o+.3*l),s+=r+q;else for(var u=0;u<=e;u++){var w=Math.ceil(b.length/e*u);s=n/e*u+i,h.fillText(w,s,o+.3*l)}h.textAlign="right";var x;if(f>=t)for(var u=0;u<=t;u++)x=o-u/t*m+g/3,h.fillText(u,.8*i,x);else for(var u=0;u<=f;u++){var w=Math.ceil(t/f*u);x=o-w/t*m+g/3,h.fillText(w,.8*i,x)}if(c&&(h.textAlign="center",h.fillText(c,n/2+i,o+.8*l)),d){h.save();var y=.3*i,z=m/2+k;h.translate(y,z),h.rotate(-Math.PI/2),h.textAlign="center",h.fillText(d,0,0),h.restore()}},draw_scale_bar:function(a,b,c,d){var e=a.getContext("2d"),f=.01*a.width,g=.01*a.width,h=.1*a.height,i=.3*a.height,j=a.height-h-i,k=a.width-f-g,l=b/c;e.strokeRect(f,h,k,j);var m=e.createLinearGradient(f,0,k+f,0);m.addColorStop(0,"green"),m.addColorStop(.5,"gold"),m.addColorStop(1,"red"),e.fillStyle=m,e.fillRect(f,h,k*l,j);var n,o,p,q;e.fillStyle="black",e.textAlign="center",e.font="13px Arial";for(var r=0;r=.9*c?(e.textAlign="right",n=p):d[r].max<=.1*c?e.textAlign="left":n+=(p-n)/2,o=h+j+.8*i,e.fillText(d[r].label,n,o)}},Utils={chr:function(a){return String.fromCharCode(a)},ord:function(a){return a.charCodeAt(0)},padLeft:function(a,b,c){c=c||"0";var d=c.length-(b-a.length);return d=d<0?0:d,a.lengthb&&(a=a.slice(0,b-c.length)+c),a},hex:function(a,b){return a="string"==typeof a?Utils.ord(a):a,b=b||2,Utils.pad(a.toString(16),b)},bin:function(a,b){return a="string"==typeof a?Utils.ord(a):a,b=b||8,Utils.pad(a.toString(2),b)},printable:function(a,b){window&&window.app&&!window.app.options.treatAsUtf8&&(a=Utils.byteArrayToChars(Utils.strToByteArray(a)));var c=/[\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-\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,d=/[\x09-\x10\x0D\u2028\u2029]/g;return a=a.replace(c,"."),b||(a=a.replace(d,".")),a},parseEscapedChars:function(a){return a.replace(/(\\)?\\([nrtbf]|x[\da-f]{2})/g,function(a,b,c){if("\\"===b)return"\\"+c;switch(c[0]){case"n":return"\n";case"r":return"\r";case"t":return"\t";case"b":return"\b";case"f":return"\f";case"x":return Utils.chr(parseInt(c.substr(1),16))}})},expandAlphRange:function(a){for(var b=[],c=0;c255)return Utils.strToUtf8ByteArray(a);return c},strToUtf8ByteArray:function(a){var b=CryptoJS.enc.Utf8.parse(a),c=Utils.wordArrayToByteArray(b);return a.length!==b.sigBytes&&(window.app.options.attemptHighlight=!1),c},strToCharcode:function(a){for(var b=new Array(a.length),c=a.length;c--;)b[c]=a.charCodeAt(c);return b},byteArrayToUtf8:function(a){try{for(var b=[],c=0;c>>2]|=a[c]<<24-c%4*8;var d=new CryptoJS.lib.WordArray.init(b,a.length),e=CryptoJS.enc.Utf8.stringify(d);return e.length!==d.sigBytes&&(window.app.options.attemptHighlight=!1),e}catch(b){return Utils.byteArrayToChars(a)}},byteArrayToChars:function(a){if(!a)return"";for(var b="",c=0;c>>2]>>>24-d%4*8&255);return c},UNIC_WIN1251_MAP:{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,14:14,15:15,16:16,17:17,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,28:28,29:29,30:30,31:31,32:32,33:33,34:34,35:35,36:36,37:37,38:38,39:39,40:40,41:41,42:42,43:43,44:44,45:45,46:46,47:47,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,58:58,59:59,60:60,61:61,62:62,63:63,64:64,65:65,66:66,67:67,68:68,69:69,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,82:82,83:83,84:84,85:85,86:86,87:87,88:88,89:89,90:90,91:91,92:92,93:93,94:94,95:95,96:96,97:97,98:98,99:99,100:100,101:101,102:102,103:103,104:104,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,125:125,126:126,127:127,1027:129,8225:135,1046:198,8222:132,1047:199,1168:165,1048:200,1113:154,1049:201,1045:197,1050:202,1028:170,160:160,1040:192,1051:203,164:164,166:166,167:167,169:169,171:171,172:172,173:173,174:174,1053:205,176:176,177:177,1114:156,181:181,182:182,183:183,8221:148,187:187,1029:189,1056:208,1057:209,1058:210,8364:136,1112:188,1115:158,1059:211,1060:212,1030:178,1061:213,1062:214,1063:215,1116:157,1064:216,1065:217,1031:175,1066:218,1067:219,1068:220,1069:221,1070:222,1032:163,8226:149,1071:223,1072:224,8482:153,1073:225,8240:137,1118:162,1074:226,1110:179,8230:133,1075:227,1033:138,1076:228,1077:229,8211:150,1078:230,1119:159,1079:231,1042:194,1080:232,1034:140,1025:168,1081:233,1082:234,8212:151,1083:235,1169:180,1084:236,1052:204,1085:237,1035:142,1086:238,1087:239,1088:240,1089:241,1090:242,1036:141,1041:193,1091:243,1092:244,8224:134,1093:245,8470:185,1094:246,1054:206,1095:247,1096:248,8249:139,1097:249,1098:250,1044:196,1099:251,1111:191,1055:207,1100:252,1038:161,8220:147,1101:253,8250:155,1102:254,8216:145,1103:255,1043:195,1105:184,1039:143,1026:128,1106:144,8218:130,1107:131,8217:146,1108:186,1109:190},WIN1251_UNIC_MAP:{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,14:14,15:15,16:16,17:17,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,28:28,29:29,30:30,31:31,32:32,33:33,34:34,35:35,36:36,37:37,38:38,39:39,40:40,41:41,42:42,43:43,44:44,45:45,46:46,47:47,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,58:58,59:59,60:60,61:61,62:62,63:63,64:64,65:65,66:66,67:67,68:68,69:69,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,82:82,83:83,84:84,85:85,86:86,87:87,88:88,89:89,90:90,91:91,92:92,93:93,94:94,95:95,96:96,97:97,98:98,99:99,100:100,101:101,102:102,103:103,104:104,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,125:125,126:126,127:127,160:160,164:164,166:166,167:167,169:169,171:171,172:172,173:173,174:174,176:176,177:177,181:181,182:182,183:183,187:187,168:1025,128:1026,129:1027,170:1028,189:1029,178:1030,175:1031,163:1032,138:1033,140:1034,142:1035,141:1036,161:1038,143:1039,192:1040,193:1041,194:1042,195:1043,196:1044,197:1045,198:1046,199:1047,200:1048,201:1049,202:1050,203:1051,204:1052,205:1053,206:1054,207:1055,208:1056,209:1057,210:1058,211:1059,212:1060,213:1061,214:1062,215:1063,216:1064,217:1065,218:1066,219:1067,220:1068,221:1069,222:1070,223:1071,224:1072,225:1073,226:1074,227:1075,228:1076,229:1077,230:1078,231:1079,232:1080,233:1081,234:1082,235:1083,236:1084,237:1085,238:1086,239:1087,240:1088,241:1089,242:1090,243:1091,244:1092,245:1093,246:1094,247:1095,248:1096,249:1097,250:1098,251:1099,252:1100,253:1101,254:1102,255:1103,184:1105,144:1106,131:1107,186:1108,190:1109,179:1110,191:1111,188:1112,154:1113,156:1114,158:1115,157:1116,162:1118,159:1119,165:1168,180:1169,150:8211,151:8212,145:8216,146:8217,130:8218,147:8220,148:8221,132:8222,134:8224,135:8225,149:8226,133:8230,137:8240,139:8249,155:8250,136:8364,185:8470,153:8482},unicodeToWin1251:function(a){for(var b=[],c=0;c>2,g=(3&c)<<4|d>>4,h=(15&d)<<2|e>>6,i=63&e,isNaN(d)?h=i=64:isNaN(e)&&(i=64),j+=b.charAt(f)+b.charAt(g)+b.charAt(h)+b.charAt(i);return j},fromBase64:function(a,b,c,d){if(c=c||"string",!a)return"string"===c?"":[];b=b?Utils.expandAlphRange(b).join(""):"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",void 0===d&&(d=!0);var e,f,g,h,i,j,k,l=[],m=0;if(d){var n=new RegExp("[^"+b.replace(/[\[\]\\\-^$]/g,"\\$&")+"]","g");a=a.replace(n,"")}for(;m>4,f=(15&i)<<4|j>>2,g=(3&j)<<6|k,l.push(e),64!==j&&l.push(f),64!==k&&l.push(g);return"string"===c?Utils.byteArrayToUtf8(l):l},toHex:function(a,b,c){if(!a)return"";b="string"==typeof b?b:" ",c=c||2;for(var d="",e=0;e>>4).toString(16)),b.push((15&a[c]).toString(16));return b.join("")},fromHex:function(a,b,c){if(b=b||(a.indexOf(" ")>=0?"Space":"None"),c=c||2,"None"!==b){var d=Utils.regexRep[b];a=a.replace(d,"")}for(var e=[],f=0;f]*>.*<\/(script|style)>/gim,"")),a.replace(/<[^>\n]+>/g,"")},escapeHtml:function(a){return a.replace(/>>3]|=parseInt(a.substr(d,2),16)<<24-d%8*4;return new CryptoJS.lib.WordArray.init(c,b/2)};var Base={DEFAULT_RADIX:36,runTo:function(a,b){if(!a)throw"Error: Input must be a number";var c=b[0]||Base.DEFAULT_RADIX;if(c<2||c>36)throw"Error: Radix argument must be between 2 and 36";return a.toString(c)},runFrom:function(a,b){var c=b[0]||Base.DEFAULT_RADIX;if(c<2||c>36)throw"Error: Radix argument must be between 2 and 36";return parseInt(a.replace(/\s/g,""),c)}},Base64={ALPHABET:"A-Za-z0-9+/=",ALPHABET_OPTIONS:[{name:"Standard: A-Za-z0-9+/=",value:"A-Za-z0-9+/="},{name:"URL safe: 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: 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+/="}],runTo:function(a,b){var c=b[0]||Base64.ALPHABET;return Utils.toBase64(a,c)},REMOVE_NON_ALPH_CHARS:!0,runFrom:function(a,b){var c=b[0]||Base64.ALPHABET,d=b[1];return Utils.fromBase64(a,c,"byteArray",d)},BASE32_ALPHABET:"A-Z2-7=",runTo32:function(a,b){if(!a)return"";for(var c,d,e,f,g,h,i,j,k,l,m,n,o,p=b[0]?Utils.expandAlphRange(b[0]).join(""):"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",q="",r=0;r>3,i=(7&c)<<2|d>>6,j=d>>1&31,k=(1&d)<<4|e>>4,l=(15&e)<<1|f>>7,m=f>>2&63,n=(3&f)<<3|g>>5,o=31&g,isNaN(d)?j=k=l=m=n=o=32:isNaN(e)?l=m=n=o=32:isNaN(f)?m=n=o=32:isNaN(g)&&(o=32),q+=p.charAt(h)+p.charAt(i)+p.charAt(j)+p.charAt(k)+p.charAt(l)+p.charAt(m)+p.charAt(n)+p.charAt(o);return q},runFrom32:function(a,b){if(!a)return[];var c,d,e,f,g,h,i,j,k,l,m,n,o,p=b[0]?Utils.expandAlphRange(b[0]).join(""):"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",q=b[0],r=[],s=0;if(q){var t=new RegExp("[^"+p.replace(/[\]\\\-^]/g,"\\$&")+"]","g");a=a.replace(t,"")}for(;s>2,d=(3&i)<<6|j<<1|k>>4,e=(15&k)<<4|l>>1,f=(1&l)<<7|m<<2|n>>3,g=(7&n)<<5|o,r.push(c),(i&!0||32!==j)&&r.push(d),(k&!0||32!==l)&&r.push(e),(l&!0||32!==m)&&r.push(f),(n&!0||32!==o)&&r.push(g);return r},SHOW_IN_BINARY:!1,OFFSETS_SHOW_VARIABLE:!0,runOffsets:function(a,b){var c=b[0]||Base64.ALPHABET,d=b[1],e=Utils.toBase64(a,c),f=Utils.toBase64([0].concat(a),c),g=Utils.toBase64([0,0].concat(a),c),h=e.indexOf("="),i=f.indexOf("="),j=g.indexOf("="),k=" \ No newline at end of file diff --git a/build/prod/index.html b/build/prod/index.html index 824ff968..3909d7d5 100755 --- a/build/prod/index.html +++ b/build/prod/index.html @@ -18,4 +18,4 @@ See the License for the specific language governing permissions and limitations under the License. --> -CyberChef Edit
                                                                                                                                                                                              Operations
                                                                                                                                                                                                Recipe
                                                                                                                                                                                                  Input
                                                                                                                                                                                                  Output
                                                                                                                                                                                                  \ No newline at end of file +CyberChef Edit
                                                                                                                                                                                                  Operations
                                                                                                                                                                                                    Recipe
                                                                                                                                                                                                      Input
                                                                                                                                                                                                      Output
                                                                                                                                                                                                      \ No newline at end of file diff --git a/build/prod/scripts.js b/build/prod/scripts.js index 29232a45..1923acc1 100755 --- a/build/prod/scripts.js +++ b/build/prod/scripts.js @@ -278,14 +278,14 @@ function(a){"function"==typeof define&&define.amd?define(a):"undefined"!=typeof */ function(){function a(a){this.code=a,this.message=Vc[a]}function b(b){var c=b.match(/\$?(?:(?![0-9-])(?:\w[\w.-]*|\*):)?(?![0-9-])(?:\w[\w.-]*|\*)|\(:|:\)|\/\/|\.\.|::|\d+(?:\.\d*)?(?:[eE][+-]?\d+)?|\.\d+(?:[eE][+-]?\d+)?|"[^"]*(?:""[^"]*)*"|'[^']*(?:''[^']*)*'|<<|>>|[!<>]=|(?![0-9-])[\w-]+:\*|\s+|./g);if(c){for(var d=0,e=0,f=c.length;e0)}function e(){this.dataTypes={},this.documents={},this.functions={},this.collations={},this.collections={}}function f(a,b,c){Xc[a]=c,Yc[a]=b}function g(a,b){Zc[a]=b}function h(c,d){var e=new b(c),f=l(e,d);if(!e.eof())throw new a("XPST0003");if(!f)throw new a("XPST0003");this.internalExpression=f}function i(){}function j(){}function k(){this.items=[]}function l(b,c){var d;if(!b.eof()&&(d=m(b,c))){var e=new k;for(e.items.push(d);","==b.peek();){if(b.next(),b.eof()||!(d=m(b,c)))throw new a("XPST0003");e.items.push(d)}return e}}function m(a,b){if(!a.eof())return s(a,b)||o(a,b)||u(a,b)||K(a,b)}function n(){this.bindings=[],this.returnExpr=null}function o(b,c){if("for"==b.peek()&&"$"==b.peek(1).substr(0,1)){b.next();var d,e=new n;do e.bindings.push(q(b,c));while(","==b.peek()&&b.next());if("return"!=b.peek())throw new a("XPST0003");if(b.next(),b.eof()||!(d=m(b,c)))throw new a("XPST0003");return e.returnExpr=d,e}}function p(a,b,c,d){this.prefix=a,this.localName=b,this.namespaceURI=c,this.inExpr=d}function q(b,c){var d=b.peek().substr(1).match(id);if(!d)throw new a("XPST0003");if("*"==d[1]||"*"==d[2])throw new a("XPST0003");if(b.next(),"in"!=b.peek())throw new a("XPST0003");b.next();var e;if(b.eof()||!(e=m(b,c)))throw new a("XPST0003");return new p(d[1]||null,d[2],d[1]?c.getURIForPrefix(d[1]):null,e)}function r(a,b,c){this.condExpr=a,this.thenExpr=b,this.elseExpr=c}function s(b,c){var d,e,f;if("if"==b.peek()&&"("==b.peek(1)){if(b.next(2),b.eof()||!(d=l(b,c)))throw new a("XPST0003");if(")"!=b.peek())throw new a("XPST0003");if(b.next(),"then"!=b.peek())throw new a("XPST0003");if(b.next(),b.eof()||!(e=m(b,c)))throw new a("XPST0003");if("else"!=b.peek())throw new a("XPST0003");if(b.next(),b.eof()||!(f=m(b,c)))throw new a("XPST0003");return new r(d,e,f)}}function t(a){this.quantifier=a,this.bindings=[],this.satisfiesExpr=null}function u(b,c){var d=b.peek();if(("some"==d||"every"==d)&&"$"==b.peek(1).substr(0,1)){b.next();var e,f=new t(d);do f.bindings.push(w(b,c));while(","==b.peek()&&b.next());if("satisfies"!=b.peek())throw new a("XPST0003");if(b.next(),b.eof()||!(e=m(b,c)))throw new a("XPST0003");return f.satisfiesExpr=e,f}}function v(a,b,c,d){this.prefix=a,this.localName=b,this.namespaceURI=c,this.inExpr=d}function w(b,c){var d=b.peek().substr(1).match(id);if(!d)throw new a("XPST0003");if("*"==d[1]||"*"==d[2])throw new a("XPST0003");if(b.next(),"in"!=b.peek())throw new a("XPST0003");b.next();var e;if(b.eof()||!(e=m(b,c)))throw new a("XPST0003");return new v(d[1]||null,d[2],d[1]?c.getURIForPrefix(d[1]):null,e)}function x(a,b,c){this.left=a,this.right=b,this.operator=c}function y(b,c){var d,e;if(!b.eof()&&(d=ya(b,c))){if(!(b.peek()in cd))return d;var f=b.peek();if(b.next(),b.eof()||!(e=ya(b,c)))throw new a("XPST0003");return new x(d,e,f)}}function z(a,b){var c=vc(a.left.evaluate(b),b);if(!c.length)return new Xa(!1);var d=vc(a.right.evaluate(b),b);if(!d.length)return new Xa(!1);for(var e,f,g=!1,h=0,i=c.length;hj)throw new a("XPST0017");if(i1)throw new a("XPTY0004")}else if("+"==d){if(e<1)throw new a("XPTY0004")}else if("*"!=d&&1!=e)throw new a("XPTY0004")}function va(a){this.left=a,this.items=[]}function wa(b,c){var d,e;if(!b.eof()&&(d=Ca(b,c))){if("intersect"!=(e=b.peek())&&"except"!=e)return d;for(var f=new va(d);"intersect"==(e=b.peek())||"except"==e;){if(b.next(),b.eof()||!(d=Ca(b,c)))throw new a("XPST0003");f.items.push([e,d])}return f}}function xa(a,b){this.left=a,this.right=b}function ya(b,c){var d,e;if(!b.eof()&&(d=D(b,c))){if("to"!=b.peek())return d;if(b.next(),b.eof()||!(e=D(b,c)))throw new a("XPST0003");return new xa(d,e)}}function za(a){this.left=a,this.items=[]}function Aa(b,c){var d,e;if(!b.eof()&&(d=wa(b,c))){if("|"!=(e=b.peek())&&"union"!=e)return d;for(var f=new za(d);"|"==(e=b.peek())||"union"==e;){if(b.next(),b.eof()||!(d=wa(b,c)))throw new a("XPST0003");f.items.push(d)}return f}}function Ba(a,b){this.expression=a,this.type=b}function Ca(b,c){var d,e;if(!b.eof()&&(d=Ea(b,c))){if("instance"!=b.peek()||"of"!=b.peek(1))return d;if(b.next(2),b.eof()||!(e=Oa(b,c)))throw new a("XPST0003");return new Ba(d,e)}}function Da(a,b){this.expression=a,this.type=b}function Ea(b,c){var d,e;if(!b.eof()&&(d=Ga(b,c))){if("treat"!=b.peek()||"as"!=b.peek(1))return d;if(b.next(2),b.eof()||!(e=Oa(b,c)))throw new a("XPST0003");return new Da(d,e)}}function Fa(a,b){this.expression=a,this.type=b}function Ga(b,c){var d,e;if(!b.eof()&&(d=Ia(b,c))){if("castable"!=b.peek()||"as"!=b.peek(1))return d;if(b.next(2),b.eof()||!(e=Qa(b,c)))throw new a("XPST0003");return new Fa(d,e)}}function Ha(a,b){this.expression=a,this.type=b}function Ia(b,c){var d,e;if(!b.eof()&&(d=H(b,c))){if("cast"!=b.peek()||"as"!=b.peek(1))return d;if(b.next(2),b.eof()||!(e=Qa(b,c)))throw new a("XPST0003");return new Ha(d,e)}}function Ja(a,b,c){this.prefix=a,this.localName=b,this.namespaceURI=c}function Ka(b,c){var d=b.peek().match(id);if(d){if("*"==d[1]||"*"==d[2])throw new a("XPST0003");return b.next(),new Ja(d[1]||null,d[2],d[1]?c.getURIForPrefix(d[1]):null)}}function La(a){this.test=a}function Ma(b,c){if(!b.eof()){var d;if("item"==b.peek()&&"("==b.peek(1)){if(b.next(2),")"!=b.peek())throw new a("XPST0003");return b.next(),new La}return(d=Z(b,c))?new La(d):(d=Ka(b,c))?new La(d):void 0}}function Na(a,b){this.itemType=a||null,this.occurence=b||null}function Oa(b,c){if(!b.eof()){if("empty-sequence"==b.peek()&&"("==b.peek(1)){if(b.next(2),")"!=b.peek())throw new a("XPST0003");return b.next(),new Na}var d,e;return!b.eof()&&(d=Ma(b,c))?(e=b.peek(),"?"==e||"*"==e||"+"==e?b.next():e=null,new Na(d,e)):void 0}}function Pa(a,b){this.itemType=a||null,this.occurence=b||null}function Qa(a,b){var c,d;if(!a.eof()&&(c=Ka(a,b)))return d=a.peek(),"?"==d?a.next():d=null,new Pa(c,d)}function Ra(){}function Sa(){}function Ta(){}function Ua(a){return a instanceof lb||a instanceof gb||a instanceof fb}function Va(a,b,c,d,e){this.scheme=a,this.authority=b,this.path=c,this.query=d,this.fragment=e}function Wa(a){this.value=a}function Xa(a){this.value=a}function Ya(a,b,c,d,e){this.year=a,this.month=b,this.day=c,this.timezone=d,this.negative=e}function Za(a,b){return 2==b&&(a%400==0||a%100!=0&&a%4==0)?29:pd[b-1]}function $a(a,b){if(!b){var c=Za(a.year,a.month);if(a.day>c)for(;a.day>c;)a.month+=1,a.month>12&&(a.year+=1,0==a.year&&(a.year=1),a.month=1),a.day-=c,c=Za(a.year,a.month);else if(a.day<1)for(;a.day<1;)a.month-=1,a.month<1&&(a.year-=1,0==a.year&&(a.year=-1),a.month=12),c=Za(a.year,a.month),a.day+=c}return a.month>12?(a.year+=~~(a.month/12),0==a.year&&(a.year=1),a.month=a.month%12):a.month<1&&(a.year+=~~(a.month/12)-1,0==a.year&&(a.year=-1),a.month=a.month%12+12),a}function _a(a,b,c,d,e,f,g,h){this.year=a,this.month=b,this.day=c,this.hours=d,this.minutes=e,this.seconds=f,this.timezone=g,this.negative=h}function ab(a,b){var c=Ac(a);return arguments.length<2&&(b=2),(c.length0?"+":"-")+ab(Gc.abs(~~(b/60)))+":"+ab(Gc.abs(b%60)):"Z"}function cb(a){return(a.negative?"-":"")+ab(a.year,4)+"-"+ab(a.month)+"-"+ab(a.day)}function db(a){var b=Ac(a.seconds).split(".");return ab(a.hours)+":"+ab(a.minutes)+":"+ab(b[0])+(b.length>1?"."+b[1]:"")}function eb(a){return $a(wb(a))}function fb(a){this.value=a}function gb(a){this.value=a}function hb(a,b,c,d,e,f,g){this.year=a,this.month=b,this.day=c,this.hours=d,this.minutes=e,this.seconds=f,this.negative=g}function ib(a){return(a.year?a.year+"Y":"")+(a.month?a.month+"M":"")}function jb(a){return(a.day?a.day+"D":"")+(a.hours||a.minutes||a.seconds?"T"+(a.hours?a.hours+"H":"")+(a.minutes?a.minutes+"M":"")+(a.seconds?a.seconds+"S":""):"")}function kb(a){return zb(Bb(a))}function lb(a){this.value=a}function mb(a,b){this.day=a,this.timezone=b}function nb(a,b){this.month=a,this.timezone=b}function ob(a,b,c){this.month=a,this.day=b,this.timezone=c}function pb(a,b){this.year=a,this.timezone=b}function qb(a,b,c){this.year=a,this.month=b,this.timezone=c}function rb(a){this.value=a}function sb(){}function tb(a,b,c){this.prefix=a,this.localName=b,this.namespaceURI=c}function ub(a){this.value=a}function vb(a,b,c,d){this.hours=a,this.minutes=b,this.seconds=c,this.timezone=d}function wb(a){return(a.seconds>=60||a.seconds<0)&&(a.minutes+=~~(a.seconds/60)-(a.seconds<0&&a.seconds%60?1:0),a.seconds=a.seconds%60+(a.seconds<0&&a.seconds%60?60:0)),(a.minutes>=60||a.minutes<0)&&(a.hours+=~~(a.minutes/60)-(a.minutes<0&&a.minutes%60?1:0),a.minutes=a.minutes%60+(a.minutes<0&&a.minutes%60?60:0)),(a.hours>=24||a.hours<0)&&(a instanceof _a&&(a.day+=~~(a.hours/24)-(a.hours<0&&a.hours%24?1:0)),a.hours=a.hours%24+(a.hours<0&&a.hours%24?24:0)),a}function xb(a){this.value=a}function yb(a,b,c){hb.call(this,a,b,0,0,0,0,c)}function zb(a){return a.month>=12&&(a.year+=~~(a.month/12),a.month%=12),a}function Ab(a,b,c,d,e){hb.call(this,0,0,a,b,c,d,e)}function Bb(a){return a.seconds>=60&&(a.minutes+=~~(a.seconds/60),a.seconds%=60),a.minutes>=60&&(a.hours+=~~(a.minutes/60),a.minutes%=60),a.hours>=24&&(a.day+=~~(a.hours/24),a.hours%=24),a}function Cb(a){this.value=a}function Db(a){this.value=a}function Eb(a){this.value=a}function Fb(a){this.value=a}function Gb(a){this.value=a}function Hb(a){this.value=a}function Ib(a){this.value=a}function Jb(a){this.value=a}function Kb(a){this.value=a}function Lb(a){this.value=a}function Mb(a){this.value=a}function Nb(a){this.value=a}function Ob(a){this.value=a}function Pb(a){this.value=a}function Qb(a){this.value=a}function Rb(a){this.value=a}function Sb(a){this.value=a}function Tb(a){this.value=a}function Ub(a){this.value=a}function Vb(a){this.value=a}function Wb(a){this.value=a}function Xb(a){this.value=a}function Yb(){}function Zb(){}function $b(){}function _b(){}function ac(){}function bc(){}function cc(){}function dc(){}function ec(a,b,c){var d=nc(a),e=nc(b);return new Xa("lt"==c?de:d==e)}function fc(a,b,c){return gc(_a.cast(a),_a.cast(b),c)}function gc(a,b,c){var d=new Ab(0,0,0,0),e=tc(a,d).toString(),f=tc(b,d).toString();return new Xa("lt"==c?ef:e==f)}function hc(a,b,c){var d;a instanceof Ya?d=new Ya(a.year,a.month,a.day,a.timezone,a.negative):a instanceof _a&&(d=new _a(a.year,a.month,a.day,a.hours,a.minutes,a.seconds,a.timezone,a.negative)),d.year=d.year+b.year*("-"==c?-1:1),d.month=d.month+b.month*("-"==c?-1:1),$a(d,!0);var e=Za(d.year,d.month);return d.day>e&&(d.day=e),d}function ic(a,b,c){var d;if(a instanceof Ya){var e=60*(60*b.hours+b.minutes)+b.seconds;d=new Ya(a.year,a.month,a.day,a.timezone,a.negative),d.day=d.day+b.day*("-"==c?-1:1)-1*(e&&"-"==c),$a(d)}else a instanceof _a&&(d=new _a(a.year,a.month,a.day,a.hours,a.minutes,a.seconds,a.timezone,a.negative),d.seconds=d.seconds+b.seconds*("-"==c?-1:1),d.minutes=d.minutes+b.minutes*("-"==c?-1:1),d.hours=d.hours+b.hours*("-"==c?-1:1),d.day=d.day+b.day*("-"==c?-1:1),eb(d));return d}function jc(a){return(60*(60*(24*a.day+a.hours)+a.minutes)+a.seconds)*(a.negative?-1:1)}function kc(a){var b=(a=Gc.round(a))<0,c=~~((a=Gc.abs(a))/86400),d=~~((a-=3600*c*24)/3600),e=~~((a-=3600*d)/60),f=a-=60*e;return new Ab(c,d,e,f,b)}function lc(a){return(12*a.year+a.month)*(a.negative?-1:1)}function mc(a){var b=(a=Gc.round(a))<0,c=~~((a=Gc.abs(a))/12),d=a-=12*c;return new yb(c,d,b)}function nc(a){return a.seconds+60*(a.minutes-(null!=a.timezone?a.timezone%60:0)+60*(a.hours-(null!=a.timezone?~~(a.timezone/60):0)))}function oc(a){var b=new Ec((a.negative?-1:1)*a.year,a.month,a.day,0,0,0,0);return a instanceof _a&&(b.setHours(a.hours),b.setMinutes(a.minutes),b.setSeconds(a.seconds)),null!=a.timezone&&b.setMinutes(b.getMinutes()-a.timezone),b.getTime()/1e3}function pc(a,b){if(Ic(a)||Gc.abs(a)==Lc||Ic(b)||Gc.abs(b)==Lc)return 0;var c=Ac(a).match(jd),d=Ac(b).match(jd),e=Gc.max(1,(c[2]||c[3]||"").length+(c[5]||0)*("+"==c[4]?-1:1),(d[2]||d[3]||"").length+(d[5]||0)*("+"==d[4]?-1:1));return e+(e%2?0:1)}function qc(a,b,c){return new(a instanceof Cb&&b instanceof Cb&&c==Gc.round(c)?Cb:fb)(c)}function rc(a,b){if(null==a)return null;var c=a[b]*(a.negative?-1:1);return"seconds"==b?new fb(c):new Cb(c)}function sc(a,b){if(null==a)return null;if("timezone"==b){var c=a.timezone;return null==c?null:new Ab(0,Gc.abs(~~(c/60)),Gc.abs(c%60),0,c<0)}var d=a[b];return a instanceof Ya||"hours"==b&&24==d&&(d=0),a instanceof vb||(d*=a.negative?-1:1),"seconds"==b?new fb(d):new Cb(d)}function tc(a,b){if(null==a)return null;var c;if(c=a instanceof Ya?new Ya(a.year,a.month,a.day,a.timezone,a.negative):a instanceof vb?new vb(a.hours,a.minutes,a.seconds,a.timezone,a.negative):new _a(a.year,a.month,a.day,a.hours,a.minutes,a.seconds,a.timezone,a.negative),null==b)c.timezone=null;else{var d=jc(b)/60;if(null!=a.timezone){var e=d-a.timezone;a instanceof Ya?e<0&&c.day--:(c.minutes+=e%60,c.hours+=~~(e/60)),eb(c)}c.timezone=d}return c}function uc(b,c){if(!b.length)return!1;var d=b[0];if(c.DOMAdapter.isNode(d))return!0;if(1==b.length){if(d instanceof Xa)return d.value.valueOf();if(d instanceof ub)return!!d.valueOf().length;if(Ua(d))return!(Ic(d.valueOf())||0==d.valueOf());throw new a("FORG0006")}throw new a("FORG0006")}function vc(a,b){for(var c,d,e=[],f=0,g=a.length;f=0,j=c.indexOf("x")>=0;if(i||j){c=c.replace(/[sx]/g,"");for(var k,l=[],m=/\s/,n=0,o=b.length,p=!1,q="";n0},b.prototype.eof=function(){return this.index>=this.length},c.prototype.isNode=function(a){return a&&!!a.nodeType},c.prototype.getProperty=function(a,b){return a[b]},c.prototype.isSameNode=function(a,b){return a==b},c.prototype.compareDocumentPosition=function(a,b){return a.compareDocumentPosition(b)},c.prototype.lookupNamespaceURI=function(a,b){return a.lookupNamespaceURI(b)},c.prototype.getElementById=function(a,b){return a.getElementById(b)},c.prototype.getElementsByTagNameNS=function(a,b,c){return a.getElementsByTagNameNS(b,c)},d.prototype.item=null,d.prototype.position=0,d.prototype.size=0,d.prototype.scope=null,d.prototype.stack=null,d.prototype.dateTime=null,d.prototype.timezone=null,d.prototype.staticContext=null,d.prototype.pushVariable=function(a,b){this.stack.hasOwnProperty(a)||(this.stack[a]=[]),this.stack[a].push(this.scope[a]),this.scope[a]=b},d.prototype.popVariable=function(a){this.stack.hasOwnProperty(a)&&(this.scope[a]=this.stack[a].pop(),this.stack[a].length||(delete this.stack[a],"undefined"==typeof this.scope[a]&&delete this.scope[a]))},e.prototype.baseURI=null,e.prototype.dataTypes=null,e.prototype.documents=null,e.prototype.functions=null,e.prototype.defaultFunctionNamespace=null,e.prototype.collations=null,e.prototype.defaultCollationName=Sc+"/collation/codepoint",e.prototype.collections=null,e.prototype.namespaceResolver=null,e.prototype.defaultElementNamespace=null;var Wc=/^(?:\{([^\}]+)\})?(.+)$/;e.prototype.setDataType=function(a,b){var c=a.match(Wc);c&&c[1]!=Rc&&(this.dataTypes[a]=b)},e.prototype.getDataType=function(a){var b=a.match(Wc);if(b)return b[1]==Rc?Zc[b[2]]:this.dataTypes[a]},e.prototype.setDocument=function(a,b){this.documents[a]=b},e.prototype.getDocument=function(a){return this.documents[a]},e.prototype.setFunction=function(a,b){var c=a.match(Wc);c&&c[1]!=Sc&&(this.functions[a]=b)},e.prototype.getFunction=function(a){var b=a.match(Wc);if(b)return b[1]==Sc?Xc[b[2]]:this.functions[a]},e.prototype.setCollation=function(a,b){this.collations[a]=b},e.prototype.getCollation=function(a){return this.collations[a]},e.prototype.setCollection=function(a,b){this.collections[a]=b},e.prototype.getCollection=function(a){return this.collections[a]},e.prototype.getURIForPrefix=function(b){var c,d=this.namespaceResolver,e=d&&d.lookupNamespaceURI?d.lookupNamespaceURI:d;if(e instanceof Fc&&(c=e.call(d,b)))return c;if("fn"==b)return Sc;if("xs"==b)return Rc;if("xml"==b)return Uc;if("xmlns"==b)return Tc;throw new a("XPST0081")},e.js2xs=function(a){return a="boolean"==typeof a?new Xa(a):"number"==typeof a?Ic(a)||!Jc(a)?new gb(a):ja(Ac(a)):new ub(Ac(a))},e.xs2js=function(a){return a=a instanceof Xa?a.valueOf():Ua(a)?a.valueOf():a.toString()};var Xc={},Yc={},Zc={},$c={};h.prototype.internalExpression=null,h.prototype.evaluate=function(a){return this.internalExpression.evaluate(a)},i.prototype.equals=function(a,b){throw"Not implemented"},i.prototype.compare=function(a,b){throw"Not implemented"},j.ANYSIMPLETYPE_DT=1,j.STRING_DT=2,j.BOOLEAN_DT=3,j.DECIMAL_DT=4,j.FLOAT_DT=5,j.DOUBLE_DT=6,j.DURATION_DT=7,j.DATETIME_DT=8,j.TIME_DT=9,j.DATE_DT=10,j.GYEARMONTH_DT=11,j.GYEAR_DT=12,j.GMONTHDAY_DT=13,j.GDAY_DT=14,j.GMONTH_DT=15,j.HEXBINARY_DT=16,j.BASE64BINARY_DT=17,j.ANYURI_DT=18,j.QNAME_DT=19,j.NOTATION_DT=20,j.NORMALIZEDSTRING_DT=21,j.TOKEN_DT=22,j.LANGUAGE_DT=23,j.NMTOKEN_DT=24,j.NAME_DT=25,j.NCNAME_DT=26,j.ID_DT=27,j.IDREF_DT=28,j.ENTITY_DT=29,j.INTEGER_DT=30,j.NONPOSITIVEINTEGER_DT=31,j.NEGATIVEINTEGER_DT=32,j.LONG_DT=33,j.INT_DT=34,j.SHORT_DT=35,j.BYTE_DT=36,j.NONNEGATIVEINTEGER_DT=37,j.UNSIGNEDLONG_DT=38,j.UNSIGNEDINT_DT=39,j.UNSIGNEDSHORT_DT=40,j.UNSIGNEDBYTE_DT=41,j.POSITIVEINTEGER_DT=42,j.LISTOFUNION_DT=43,j.LIST_DT=44,j.UNAVAILABLE_DT=45,j.DATETIMESTAMP_DT=46,j.DAYMONTHDURATION_DT=47,j.DAYTIMEDURATION_DT=48,j.PRECISIONDECIMAL_DT=49,j.ANYATOMICTYPE_DT=50,j.ANYTYPE_DT=51,j.XT_YEARMONTHDURATION_DT=-1,j.XT_UNTYPEDATOMIC_DT=-2,k.prototype.items=null,k.prototype.evaluate=function(a){for(var b=[],c=0,d=this.items.length;c":"gt","<":"lt",">=":"ge","<=":"le"},ad={};ad.eq=function(b,c,d){var e="";if(Ua(b))Ua(c)&&(e="numeric-equal");else if(b instanceof Xa)c instanceof Xa&&(e="boolean-equal");else if(b instanceof ub){if(c instanceof ub)return $c["numeric-equal"].call(d,Xc.compare.call(d,b,c),new Cb(0))}else b instanceof Ya?c instanceof Ya&&(e="date-equal"):b instanceof vb?c instanceof vb&&(e="time-equal"):b instanceof _a?c instanceof _a&&(e="dateTime-equal"):b instanceof hb?c instanceof hb&&(e="duration-equal"):b instanceof qb?c instanceof qb&&(e="gYearMonth-equal"):b instanceof pb?c instanceof pb&&(e="gYear-equal"):b instanceof ob?c instanceof ob&&(e="gMonthDay-equal"):b instanceof nb?c instanceof nb&&(e="gMonth-equal"):b instanceof mb?c instanceof mb&&(e="gDay-equal"):b instanceof tb?c instanceof tb&&(e="QName-equal"):b instanceof rb?c instanceof rb&&(e="hexBinary-equal"):b instanceof Wa&&c instanceof Wa&&(e="base64Binary-equal");if(e)return $c[e].call(d,b,c);throw new a("XPTY0004")},ad.ne=function(a,b,c){return new Xa(!ad.eq(a,b,c).valueOf())},ad.gt=function(b,c,d){var e="";if(Ua(b))Ua(c)&&(e="numeric-greater-than");else if(b instanceof Xa)c instanceof Xa&&(e="boolean-greater-than");else if(b instanceof ub){if(c instanceof ub)return $c["numeric-greater-than"].call(d,Xc.compare.call(d,b,c),new Cb(0))}else b instanceof Ya?c instanceof Ya&&(e="date-greater-than"):b instanceof vb?c instanceof vb&&(e="time-greater-than"):b instanceof _a?c instanceof _a&&(e="dateTime-greater-than"):b instanceof yb?c instanceof yb&&(e="yearMonthDuration-greater-than"):b instanceof Ab&&c instanceof Ab&&(e="dayTimeDuration-greater-than"); if(e)return $c[e].call(d,b,c);throw new a("XPTY0004")},ad.lt=function(b,c,d){var e="";if(Ua(b))Ua(c)&&(e="numeric-less-than");else if(b instanceof Xa)c instanceof Xa&&(e="boolean-less-than");else if(b instanceof ub){if(c instanceof ub)return $c["numeric-less-than"].call(d,Xc.compare.call(d,b,c),new Cb(0))}else b instanceof Ya?c instanceof Ya&&(e="date-less-than"):b instanceof vb?c instanceof vb&&(e="time-less-than"):b instanceof _a?c instanceof _a&&(e="dateTime-less-than"):b instanceof yb?c instanceof yb&&(e="yearMonthDuration-less-than"):b instanceof Ab&&c instanceof Ab&&(e="dayTimeDuration-less-than");if(e)return $c[e].call(d,b,c);throw new a("XPTY0004")},ad.ge=function(b,c,d){var e="";if(Ua(b))Ua(c)&&(e="numeric-less-than");else if(b instanceof Xa)c instanceof Xa&&(e="boolean-less-than");else if(b instanceof ub){if(c instanceof ub)return $c["numeric-greater-than"].call(d,Xc.compare.call(d,b,c),new Cb(-1))}else b instanceof Ya?c instanceof Ya&&(e="date-less-than"):b instanceof vb?c instanceof vb&&(e="time-less-than"):b instanceof _a?c instanceof _a&&(e="dateTime-less-than"):b instanceof yb?c instanceof yb&&(e="yearMonthDuration-less-than"):b instanceof Ab&&c instanceof Ab&&(e="dayTimeDuration-less-than");if(e)return new Xa(!$c[e].call(d,b,c).valueOf());throw new a("XPTY0004")},ad.le=function(b,c,d){var e="";if(Ua(b))Ua(c)&&(e="numeric-greater-than");else if(b instanceof Xa)c instanceof Xa&&(e="boolean-greater-than");else if(b instanceof ub){if(c instanceof ub)return $c["numeric-less-than"].call(d,Xc.compare.call(d,b,c),new Cb(1))}else b instanceof Ya?c instanceof Ya&&(e="date-greater-than"):b instanceof vb?c instanceof vb&&(e="time-greater-than"):b instanceof _a?c instanceof _a&&(e="dateTime-greater-than"):b instanceof yb?c instanceof yb&&(e="yearMonthDuration-greater-than"):b instanceof Ab&&c instanceof Ab&&(e="dayTimeDuration-greater-than");if(e)return new Xa(!$c[e].call(d,b,c).valueOf());throw new a("XPTY0004")};var bd={};bd.is=function(a,b,c){return $c["is-same-node"].call(c,a,b)},bd[">>"]=function(a,b,c){return $c["node-after"].call(c,a,b)},bd["<<"]=function(a,b,c){return $c["node-before"].call(c,a,b)};var cd={"=":z,"!=":z,"<":z,"<=":z,">":z,">=":z,eq:A,ne:A,lt:A,le:A,gt:A,ge:A,is:B,">>":B,"<<":B};C.prototype.left=null,C.prototype.items=null;var dd={};dd["+"]=function(b,c,d){var e="",f=!1;if(Ua(b)?Ua(c)&&(e="numeric-add"):b instanceof Ya?c instanceof yb?e="add-yearMonthDuration-to-date":c instanceof Ab&&(e="add-dayTimeDuration-to-date"):b instanceof yb?c instanceof Ya?(e="add-yearMonthDuration-to-date",f=!0):c instanceof _a?(e="add-yearMonthDuration-to-dateTime",f=!0):c instanceof yb&&(e="add-yearMonthDurations"):b instanceof Ab?c instanceof Ya?(e="add-dayTimeDuration-to-date",f=!0):c instanceof vb?(e="add-dayTimeDuration-to-time",f=!0):c instanceof _a?(e="add-dayTimeDuration-to-dateTime",f=!0):c instanceof Ab&&(e="add-dayTimeDurations"):b instanceof vb?c instanceof Ab&&(e="add-dayTimeDuration-to-time"):b instanceof _a&&(c instanceof yb?e="add-yearMonthDuration-to-dateTime":c instanceof Ab&&(e="add-dayTimeDuration-to-dateTime")),e)return $c[e].call(d,f?c:b,f?b:c);throw new a("XPTY0004")},dd["-"]=function(b,c,d){var e="";if(Ua(b)?Ua(c)&&(e="numeric-subtract"):b instanceof Ya?c instanceof Ya?e="subtract-dates":c instanceof yb?e="subtract-yearMonthDuration-from-date":c instanceof Ab&&(e="subtract-dayTimeDuration-from-date"):b instanceof vb?c instanceof vb?e="subtract-times":c instanceof Ab&&(e="subtract-dayTimeDuration-from-time"):b instanceof _a?c instanceof _a?e="subtract-dateTimes":c instanceof yb?e="subtract-yearMonthDuration-from-dateTime":c instanceof Ab&&(e="subtract-dayTimeDuration-from-dateTime"):b instanceof yb?c instanceof yb&&(e="subtract-yearMonthDurations"):b instanceof Ab&&c instanceof Ab&&(e="subtract-dayTimeDurations"),e)return $c[e].call(d,b,c);throw new a("XPTY0004")},C.prototype.evaluate=function(a){var b=vc(this.left.evaluate(a),a);if(!b.length)return[];ua(a,b,"?");var c=b[0];c instanceof xb&&(c=gb.cast(c));for(var d,e,f=0,g=this.items.length;f1)return[new Xa(!1)];if(!c.length)return[new Xa("?"==e)];try{d.cast(vc(c,b)[0])}catch(b){if("XPST0051"==b.code)throw b;if("XPST0017"==b.code)throw new a("XPST0080");return[new Xa(!1)]}return[new Xa(!0)]},Ha.prototype.expression=null,Ha.prototype.type=null,Ha.prototype.evaluate=function(a){var b=this.expression.evaluate(a);return ua(a,b,this.type.occurence),b.length?[this.type.itemType.cast(vc(b,a)[0],a)]:[]},Ja.prototype.prefix=null,Ja.prototype.localName=null,Ja.prototype.namespaceURI=null,Ja.prototype.test=function(b,c){var d=(this.namespaceURI?"{"+this.namespaceURI+"}":"")+this.localName,e=this.namespaceURI==Rc?Zc[this.localName]:c.staticContext.getDataType(d);if(e)return b instanceof e;throw new a("XPST0051")},Ja.prototype.cast=function(b,c){var d=(this.namespaceURI?"{"+this.namespaceURI+"}":"")+this.localName,e=this.namespaceURI==Rc?Zc[this.localName]:c.staticContext.getDataType(d);if(e)return e.cast(b);throw new a("XPST0051")},La.prototype.test=null,Na.prototype.itemType=null,Na.prototype.occurence=null,Pa.prototype.itemType=null,Pa.prototype.occurence=null,Ra.prototype.builtInKind=j.ANYTYPE_DT,Sa.prototype=new Ra,Sa.prototype.builtInKind=j.ANYSIMPLETYPE_DT,Sa.prototype.primitiveKind=null,Sa.PRIMITIVE_ANYURI="anyURI",Sa.PRIMITIVE_BASE64BINARY="base64Binary",Sa.PRIMITIVE_BOOLEAN="boolean",Sa.PRIMITIVE_DATE="date",Sa.PRIMITIVE_DATETIME="dateTime",Sa.PRIMITIVE_DECIMAL="decimal",Sa.PRIMITIVE_DOUBLE="double",Sa.PRIMITIVE_DURATION="duration",Sa.PRIMITIVE_FLOAT="float",Sa.PRIMITIVE_GDAY="gDay",Sa.PRIMITIVE_GMONTH="gMonth",Sa.PRIMITIVE_GMONTHDAY="gMonthDay",Sa.PRIMITIVE_GYEAR="gYear",Sa.PRIMITIVE_GYEARMONTH="gYearMonth",Sa.PRIMITIVE_HEXBINARY="hexBinary",Sa.PRIMITIVE_NOTATION="NOTATION",Sa.PRIMITIVE_QNAME="QName",Sa.PRIMITIVE_STRING="string",Sa.PRIMITIVE_TIME="time",Ta.prototype=new Sa,Ta.prototype.builtInKind=j.ANYATOMICTYPE_DT,Ta.cast=function(b){throw new a("XPST0017")},g("anyAtomicType",Ta),Va.prototype=new Ta,Va.prototype.builtInKind=j.ANYURI_DT,Va.prototype.primitiveKind=Sa.PRIMITIVE_ANYURI,Va.prototype.scheme=null,Va.prototype.authority=null,Va.prototype.path=null,Va.prototype.query=null,Va.prototype.fragment=null,Va.prototype.toString=function(){return(this.scheme?this.scheme+":":"")+(this.authority?"//"+this.authority:"")+(this.path?this.path:"")+(this.query?"?"+this.query:"")+(this.fragment?"#"+this.fragment:"")};var ld=/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;Va.cast=function(b){if(b instanceof Va)return b;if(b instanceof ub||b instanceof xb){var c;if(c=Pc(b).match(ld))return new Va(c[2],c[4],c[5],c[7],c[9]);throw new a("FORG0001")}throw new a("XPTY0004")},g("anyURI",Va),Wa.prototype=new Ta,Wa.prototype.builtInKind=j.BASE64BINARY_DT,Wa.prototype.primitiveKind=Sa.PRIMITIVE_BASE64BINARY,Wa.prototype.value=null,Wa.prototype.valueOf=function(){return this.value},Wa.prototype.toString=function(){return this.value};var md=/^((([A-Za-z0-9+\/]\s*){4})*(([A-Za-z0-9+\/]\s*){3}[A-Za-z0-9+\/]|([A-Za-z0-9+\/]\s*){2}[AEIMQUYcgkosw048]\s*=|[A-Za-z0-9+\/]\s*[AQgw]\s*=\s*=))?$/;Wa.cast=function(b){if(b instanceof Wa)return b;if(b instanceof ub||b instanceof xb){var c=Pc(b).match(md);if(c)return new Wa(c[0]);throw new a("FORG0001")}if(b instanceof rb){for(var c=b.valueOf().match(/.{2}/g),d=[],e=0,f=c.length;e=-0x8000000000000000)return new Fb(c.value);throw new a("FORG0001")},g("long",Fb),Gb.prototype=new Fb,Gb.prototype.builtInKind=j.INT_DT,Gb.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value<=2147483647&&c.value>=-2147483648)return new Gb(c.value);throw new a("FORG0001")},g("int",Gb),Hb.prototype=new Gb,Hb.prototype.builtInKind=j.SHORT_DT,Hb.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value<=32767&&c.value>=-32768)return new Hb(c.value);throw new a("FORG0001")},g("short",Hb),Ib.prototype=new Hb,Ib.prototype.builtInKind=j.BYTE_DT,Ib.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value<=127&&c.value>=-128)return new Ib(c.value);throw new a("FORG0001")},g("byte",Ib),Jb.prototype=new Cb,Jb.prototype.builtInKind=j.NONNEGATIVEINTEGER_DT,Jb.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value>=0)return new Jb(c.value);throw new a("FORG0001")},g("nonNegativeInteger",Jb),Kb.prototype=new Jb,Kb.prototype.builtInKind=j.POSITIVEINTEGER_DT,Kb.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value>=1)return new Kb(c.value);throw new a("FORG0001")},g("positiveInteger",Kb),Lb.prototype=new Jb,Lb.prototype.builtInKind=j.UNSIGNEDLONG_DT,Lb.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value>=1&&c.value<=0x10000000000000000)return new Lb(c.value);throw new a("FORG0001")},g("unsignedLong",Lb),Mb.prototype=new Jb,Mb.prototype.builtInKind=j.UNSIGNEDINT_DT,Mb.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value>=1&&c.value<=4294967295)return new Mb(c.value);throw new a("FORG0001")},g("unsignedInt",Mb),Nb.prototype=new Mb,Nb.prototype.builtInKind=j.UNSIGNEDSHORT_DT,Nb.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value>=1&&c.value<=65535)return new Nb(c.value);throw new a("FORG0001")},g("unsignedShort",Nb),Ob.prototype=new Nb,Ob.prototype.builtInKind=j.UNSIGNEDBYTE_DT, -Ob.cast=function(b){var c;try{c=Cb.cast(b)}catch(a){throw a}if(c.value>=1&&c.value<=255)return new Ob(c.value);throw new a("FORG0001")},g("unsignedByte",Ob),Pb.prototype=new ub,Pb.prototype.builtInKind=j.NORMALIZEDSTRING_DT,Pb.cast=function(a){return new Pb(Ac(a))},g("normalizedString",Pb),Qb.prototype=new Pb,Qb.prototype.builtInKind=j.TOKEN_DT,Qb.cast=function(a){return new Qb(Ac(a))},g("token",Qb),Rb.prototype=new Qb,Rb.prototype.builtInKind=j.NAME_DT,Rb.cast=function(a){return new Rb(Ac(a))},g("Name",Rb),Sb.prototype=new Rb,Sb.prototype.builtInKind=j.NCNAME_DT,Sb.cast=function(a){return new Sb(Ac(a))},g("NCName",Sb),Tb.prototype=new Sb,Tb.prototype.builtInKind=j.ENTITY_DT,Tb.cast=function(a){return new Tb(Ac(a))},g("ENTITY",Tb),Ub.prototype=new Sb,Ub.prototype.builtInKind=j.ID_DT,Ub.cast=function(a){return new Ub(Ac(a))},g("ID",Ub),Vb.prototype=new Sb,Vb.prototype.builtInKind=j.IDREF_DT,Vb.cast=function(a){return new Vb(Ac(a))},g("IDREF",Vb),Wb.prototype=new Qb,Wb.prototype.builtInKind=j.LANGUAGE_DT,Wb.cast=function(a){return new Wb(Ac(a))},g("language",Wb),Xb.prototype=new Qb,Xb.prototype.builtInKind=j.NMTOKEN_DT,Xb.cast=function(a){return new Xb(Ac(a))},g("NMTOKEN",Xb),Zb.prototype=new Yb,$b.prototype=new Zb,_b.prototype=new Zb,ac.prototype=new Zb,bc.prototype=new Zb,cc.prototype=new Zb,dc.prototype=new Zb,$c["hexBinary-equal"]=function(a,b){return new Xa(a.valueOf()==b.valueOf())},$c["base64Binary-equal"]=function(a,b){return new Xa(a.valueOf()==b.valueOf())},$c["boolean-equal"]=function(a,b){return new Xa(a.valueOf()==b.valueOf())},$c["boolean-less-than"]=function(a,b){return new Xa(a.valueOf()b.valueOf())},$c["yearMonthDuration-less-than"]=function(a,b){return new Xa(lc(a)lc(b))},$c["dayTimeDuration-less-than"]=function(a,b){return new Xa(jc(a)jc(b))},$c["duration-equal"]=function(a,b){return new Xa(a.negative==b.negative&&lc(a)==lc(b)&&jc(a)==jc(b))},$c["dateTime-equal"]=function(a,b){return gc(a,b,"eq")},$c["dateTime-less-than"]=function(a,b){return gc(a,b,"lt")},$c["dateTime-greater-than"]=function(a,b){return gc(a,b,"gt")},$c["date-equal"]=function(a,b){return fc(a,b,"eq")},$c["date-less-than"]=function(a,b){return fc(a,b,"lt")},$c["date-greater-than"]=function(a,b){return fc(a,b,"gt")},$c["time-equal"]=function(a,b){return ec(a,b,"eq")},$c["time-less-than"]=function(a,b){return ec(a,b,"lt")},$c["time-greater-than"]=function(a,b){return ec(a,b,"gt")},$c["gYearMonth-equal"]=function(a,b){return gc(new _a(a.year,a.month,Za(a.year,a.month),0,0,0,null==a.timezone?this.timezone:a.timezone),new _a(b.year,b.month,Za(b.year,b.month),0,0,0,null==b.timezone?this.timezone:b.timezone),"eq")},$c["gYear-equal"]=function(a,b){return gc(new _a(a.year,1,1,0,0,0,null==a.timezone?this.timezone:a.timezone),new _a(b.year,1,1,0,0,0,null==b.timezone?this.timezone:b.timezone),"eq")},$c["gMonthDay-equal"]=function(a,b){return gc(new _a(1972,a.month,a.day,0,0,0,null==a.timezone?this.timezone:a.timezone),new _a(1972,b.month,b.day,0,0,0,null==b.timezone?this.timezone:b.timezone),"eq")},$c["gMonth-equal"]=function(a,b){return gc(new _a(1972,a.month,Za(1972,b.month),0,0,0,null==a.timezone?this.timezone:a.timezone),new _a(1972,b.month,Za(1972,b.month),0,0,0,null==b.timezone?this.timezone:b.timezone),"eq")},$c["gDay-equal"]=function(a,b){return gc(new _a(1972,12,a.day,0,0,0,null==a.timezone?this.timezone:a.timezone),new _a(1972,12,b.day,0,0,0,null==b.timezone?this.timezone:b.timezone),"eq")},$c["add-yearMonthDurations"]=function(a,b){return mc(lc(a)+lc(b))},$c["subtract-yearMonthDurations"]=function(a,b){return mc(lc(a)-lc(b))},$c["multiply-yearMonthDuration"]=function(a,b){return mc(lc(a)*b)},$c["divide-yearMonthDuration"]=function(a,b){return mc(lc(a)/b)},$c["divide-yearMonthDuration-by-yearMonthDuration"]=function(a,b){return new fb(lc(a)/lc(b))},$c["add-dayTimeDurations"]=function(a,b){return kc(jc(a)+jc(b))},$c["subtract-dayTimeDurations"]=function(a,b){return kc(jc(a)-jc(b))},$c["multiply-dayTimeDuration"]=function(a,b){return kc(jc(a)*b)},$c["divide-dayTimeDuration"]=function(a,b){return kc(jc(a)/b)},$c["divide-dayTimeDuration-by-dayTimeDuration"]=function(a,b){return new fb(jc(a)/jc(b))},$c["subtract-dateTimes"]=function(a,b){return kc(oc(a)-oc(b))},$c["subtract-dates"]=function(a,b){return kc(oc(a)-oc(b))},$c["subtract-times"]=function(a,b){return kc(nc(a)-nc(b))},$c["add-yearMonthDuration-to-dateTime"]=function(a,b){return hc(a,b,"+")},$c["add-dayTimeDuration-to-dateTime"]=function(a,b){return ic(a,b,"+")},$c["subtract-yearMonthDuration-from-dateTime"]=function(a,b){return hc(a,b,"-")},$c["subtract-dayTimeDuration-from-dateTime"]=function(a,b){return ic(a,b,"-")},$c["add-yearMonthDuration-to-date"]=function(a,b){return hc(a,b,"+")},$c["add-dayTimeDuration-to-date"]=function(a,b){return ic(a,b,"+")},$c["subtract-yearMonthDuration-from-date"]=function(a,b){return hc(a,b,"-")},$c["subtract-dayTimeDuration-from-date"]=function(a,b){return ic(a,b,"-")},$c["add-dayTimeDuration-to-time"]=function(a,b){var c=new vb(a.hours,a.minutes,a.seconds,a.timezone);return c.hours+=b.hours,c.minutes+=b.minutes,c.seconds+=b.seconds,wb(c)},$c["subtract-dayTimeDuration-from-time"]=function(a,b){var c=new vb(a.hours,a.minutes,a.seconds,a.timezone);return c.hours-=b.hours,c.minutes-=b.minutes,c.seconds-=b.seconds,wb(c)},$c["is-same-node"]=function(a,b){return new Xa(this.DOMAdapter.isSameNode(a,b))},$c["node-before"]=function(a,b){return new Xa(!!(4&this.DOMAdapter.compareDocumentPosition(a,b)))},$c["node-after"]=function(a,b){return new Xa(!!(2&this.DOMAdapter.compareDocumentPosition(a,b)))},$c["numeric-add"]=function(a,b){var c=a.valueOf(),d=b.valueOf(),e=Gc.pow(10,pc(c,d));return qc(a,b,(c*e+d*e)/e)},$c["numeric-subtract"]=function(a,b){var c=a.valueOf(),d=b.valueOf(),e=Gc.pow(10,pc(c,d));return qc(a,b,(c*e-d*e)/e)},$c["numeric-multiply"]=function(a,b){var c=a.valueOf(),d=b.valueOf(),e=Gc.pow(10,pc(c,d));return qc(a,b,c*e*(d*e)/(e*e))},$c["numeric-divide"]=function(a,b){var c=a.valueOf(),d=b.valueOf(),e=Gc.pow(10,pc(c,d));return qc(a,b,a*e/(b*e))},$c["numeric-integer-divide"]=function(a,b){var c=a/b;return new Cb(Gc.floor(c)+(c<0))},$c["numeric-mod"]=function(a,b){var c=a.valueOf(),d=b.valueOf(),e=Gc.pow(10,pc(c,d));return qc(a,b,c*e%(d*e)/e)},$c["numeric-unary-plus"]=function(a){return a},$c["numeric-unary-minus"]=function(a){return a.value*=-1,a},$c["numeric-equal"]=function(a,b){return new Xa(a.valueOf()==b.valueOf())},$c["numeric-less-than"]=function(a,b){return new Xa(a.valueOf()b.valueOf())},$c["QName-equal"]=function(a,b){return new Xa(a.localName==b.localName&&a.namespaceURI==b.namespaceURI)},$c.concatenate=function(a,b){return a.concat(b)},$c.union=function(b,c){for(var d,e=[],f=0,g=b.length;fh?g.pop():(g.push(f[i]),h++):"."!=f[i]&&g.push(f[i]);".."!=f[--i]&&"."!=f[i]||g.push(""),d.path=g.join("/")}return d}),f("true",[],function(){return new Xa(!0)}),f("false",[],function(){return new Xa(!1)}),f("not",[[Yb,"*"]],function(a){return new Xa(!uc(a,this))}),f("position",[],function(){return new Cb(this.position)}),f("last",[],function(){return new Cb(this.size)}),f("current-dateTime",[],function(){return this.dateTime}),f("current-date",[],function(){return Ya.cast(this.dateTime)}),f("current-time",[],function(){return vb.cast(this.dateTime)}),f("implicit-timezone",[],function(){return this.timezone}),f("default-collation",[],function(){return new ub(this.staticContext.defaultCollationName)}),f("static-base-uri",[],function(){return Va.cast(new ub(this.staticContext.baseURI||""))}),f("years-from-duration",[[hb,"?"]],function(a){return rc(a,"year")}),f("months-from-duration",[[hb,"?"]],function(a){return rc(a,"month")}),f("days-from-duration",[[hb,"?"]],function(a){return rc(a,"day")}),f("hours-from-duration",[[hb,"?"]],function(a){return rc(a,"hours")}),f("minutes-from-duration",[[hb,"?"]],function(a){return rc(a,"minutes")}),f("seconds-from-duration",[[hb,"?"]],function(a){return rc(a,"seconds")}),f("year-from-dateTime",[[_a,"?"]],function(a){return sc(a,"year")}),f("month-from-dateTime",[[_a,"?"]],function(a){return sc(a,"month")}),f("day-from-dateTime",[[_a,"?"]],function(a){return sc(a,"day")}),f("hours-from-dateTime",[[_a,"?"]],function(a){return sc(a,"hours")}),f("minutes-from-dateTime",[[_a,"?"]],function(a){return sc(a,"minutes")}),f("seconds-from-dateTime",[[_a,"?"]],function(a){return sc(a,"seconds")}),f("timezone-from-dateTime",[[_a,"?"]],function(a){return sc(a,"timezone")}),f("year-from-date",[[Ya,"?"]],function(a){return sc(a,"year")}),f("month-from-date",[[Ya,"?"]],function(a){return sc(a,"month")}),f("day-from-date",[[Ya,"?"]],function(a){return sc(a,"day")}),f("timezone-from-date",[[Ya,"?"]],function(a){return sc(a,"timezone")}),f("hours-from-time",[[vb,"?"]],function(a){return sc(a,"hours")}),f("minutes-from-time",[[vb,"?"]],function(a){return sc(a,"minutes")}),f("seconds-from-time",[[vb,"?"]],function(a){return sc(a,"seconds")}),f("timezone-from-time",[[vb,"?"]],function(a){return sc(a,"timezone")}),f("adjust-dateTime-to-timezone",[[_a,"?"],[Ab,"?",!0]],function(a,b){return tc(a,arguments.length>1&&null!=b?arguments.length>1?b:this.timezone:null)});f("adjust-date-to-timezone",[[Ya,"?"],[Ab,"?",!0]],function(a,b){return tc(a,arguments.length>1&&null!=b?arguments.length>1?b:this.timezone:null)});f("adjust-time-to-timezone",[[vb,"?"],[Ab,"?",!0]],function(a,b){return tc(a,arguments.length>1&&null!=b?arguments.length>1?b:this.timezone:null)}),f("name",[[Zb,"?",!0]],function(b){if(arguments.length){if(null==b)return new ub("")}else{if(!this.DOMAdapter.isNode(this.item))throw new a("XPTY0004");b=this.item}var c=Xc["node-name"].call(this,b);return new ub(null==c?"":c.toString())}),f("local-name",[[Zb,"?",!0]],function(b){if(arguments.length){if(null==b)return new ub("")}else{if(!this.DOMAdapter.isNode(this.item))throw new a("XPTY0004");b=this.item}return new ub(this.DOMAdapter.getProperty(b,"localName")||"")}),f("namespace-uri",[[Zb,"?",!0]],function(b){if(arguments.length){if(null==b)return Va.cast(new ub(""))}else{if(!this.DOMAdapter.isNode(this.item))throw new a("XPTY0004");b=this.item}return Va.cast(new ub(this.DOMAdapter.getProperty(b,"namespaceURI")||""))}),f("number",[[Ta,"?",!0]],function(b){if(!arguments.length){if(!this.item)throw new a("XPDY0002");b=vc([this.item],this)[0]}var c=new gb(Kc);if(null!=b)try{c=gb.cast(b)}catch(a){}return c}),f("lang",[[ub,"?"],[Zb,"",!0]],function(b,c){if(arguments.length<2){if(!this.DOMAdapter.isNode(this.item))throw new a("XPTY0004");c=this.item}var d=this.DOMAdapter.getProperty;2==d(c,"nodeType")&&(c=d(c,"ownerElement"));for(var e;c;c=d(c,"parentNode"))if(e=d(c,"attributes"))for(var f=0,g=e.length;f1?b.valueOf():0;if(c<0){var d=new Cb(Gc.pow(10,-c)),e=Gc.round($c["numeric-divide"].call(this,a,d)),f=new Cb(e);return nDecimal=Gc.abs($c["numeric-subtract"].call(this,f,$c["numeric-divide"].call(this,a,d))),$c["numeric-multiply"].call(this,$c["numeric-add"].call(this,f,new fb(.5==nDecimal&&e%2?-1:0)),d)}var d=new Cb(Gc.pow(10,c)),e=Gc.round($c["numeric-multiply"].call(this,a,d)),f=new Cb(e);return nDecimal=Gc.abs($c["numeric-subtract"].call(this,f,$c["numeric-multiply"].call(this,a,d))),$c["numeric-divide"].call(this,$c["numeric-add"].call(this,f,new fb(.5==nDecimal&&e%2?-1:0)),d)}),f("resolve-QName",[[ub,"?"],[bc]],function(b,c){if(null==b)return null;var d=b.valueOf(),e=d.match(Bd);if(!e)throw new a("FOCA0002");var f=e[1]||null,g=e[2],h=this.DOMAdapter.lookupNamespaceURI(c,f);if(null!=f&&!h)throw new a("FONS0004");return new tb(f,g,h||null)}),f("QName",[[ub,"?"],[ub]],function(b,c){var d=c.valueOf(),e=d.match(Bd);if(!e)throw new a("FOCA0002");return new tb(e[1]||null,e[2]||null,null==b?"":b.valueOf())}),f("prefix-from-QName",[[tb,"?"]],function(a){return null!=a&&a.prefix?new Sb(a.prefix):null}),f("local-name-from-QName",[[tb,"?"]],function(a){return null==a?null:new Sb(a.localName)}),f("namespace-uri-from-QName",[[tb,"?"]],function(a){return null==a?null:Va.cast(new ub(a.namespaceURI||""))}),f("namespace-uri-for-prefix",[[ub,"?"],[bc]],function(a,b){var c=null==a?"":a.valueOf(),d=this.DOMAdapter.lookupNamespaceURI(b,c||null);return null==d?null:Va.cast(new ub(d))}),f("in-scope-prefixes",[[bc]],function(a){throw"Function 'in-scope-prefixes' not implemented"}),f("boolean",[[Yb,"*"]],function(a){return new Xa(uc(a,this))}),f("index-of",[[Ta,"*"],[Ta],[ub,"",!0]],function(a,b,c){if(!a.length||null==b)return[];var d=b;d instanceof xb&&(d=ub.cast(d));for(var e,f=[],g=0,h=a.length;g1)throw"Collation parameter in function 'distinct-values' is not implemented";if(!a.length)return null;for(var c,d=[],e=0,f=a.length;ed&&(e=d+1);for(var f=[],g=0;gc)return a;for(var e=[],f=0;f2?Gc.round(c):a.length-d+1;return a.slice(d-1,d-1+e)}),f("unordered",[[Yb,"*"]],function(a){return a}),f("zero-or-one",[[Yb,"*"]],function(b){if(b.length>1)throw new a("FORG0003");return b}),f("one-or-more",[[Yb,"*"]],function(b){if(!b.length)throw new a("FORG0004");return b}),f("exactly-one",[[Yb,"*"]],function(b){if(1!=b.length)throw new a("FORG0005");return b}),f("deep-equal",[[Yb,"*"],[Yb,"*"],[ub,"",!0]],function(a,b,c){throw"Function 'deep-equal' not implemented"}),f("count",[[Yb,"*"]],function(a){return new Cb(a.length)}),f("avg",[[Ta,"*"]],function(b){if(!b.length)return null;try{var c=b[0];c instanceof xb&&(c=gb.cast(c));for(var d,e=1,f=b.length;e1?c:new gb(0);try{var d=b[0];d instanceof xb&&(d=gb.cast(d));for(var e,f=1,g=b.length;f2&&(f=d.valueOf()),e=f==Sc+"/collation/codepoint"?Gd:this.staticContext.getCollation(f),!e)throw new a("FOCH0002");return new Cb(e.compare(b.valueOf(),c.valueOf()))}),f("codepoint-equal",[[ub,"?"],[ub,"?"]],function(a,b){return null==a||null==b?null:new Xa(a.valueOf()==b.valueOf())}),f("concat",null,function(){if(arguments.length<2)throw new a("XPST0017");for(var b,c=[],d=0,e=arguments.length;d2?e+Gc.round(c):d.length;return new ub(f>e?d.substring(e,f):"")}),f("string-length",[[ub,"?",!0]],function(b){if(!arguments.length){if(!this.item)throw new a("XPDY0002");b=ub.cast(vc([this.item],this)[0])}return new Cb(null==b?0:b.valueOf().length)}),f("normalize-space",[[ub,"?",!0]],function(b){if(!arguments.length){if(!this.item)throw new a("XPDY0002");b=ub.cast(vc([this.item],this)[0])}return new ub(null==b?"":Pc(b).replace(/\s\s+/g," "))}),f("normalize-unicode",[[ub,"?"],[ub,"",!0]],function(a,b){throw"Function 'normalize-unicode' not implemented"}),f("upper-case",[[ub,"?"]],function(a){return new ub(null==a?"":a.valueOf().toUpperCase())}),f("lower-case",[[ub,"?"]],function(a){return new ub(null==a?"":a.valueOf().toLowerCase())}),f("translate",[[ub,"?"],[ub],[ub]],function(a,b,c){if(null==a)return new ub("");for(var d,e=a.valueOf().split(""),f=b.valueOf().split(""),g=c.valueOf().split(""),h=g.length,i=[],j=0,k=e.length;j126)&&(c[d]=window.encodeURIComponent(c[d]));return new ub(c.join(""))}),f("contains",[[ub,"?"],[ub,"?"],[ub,"",!0]],function(a,b,c){if(arguments.length>2)throw"Collation parameter in function 'contains' is not implemented";return new Xa((null==a?"":a.valueOf()).indexOf(null==b?"":b.valueOf())>=0)}),f("starts-with",[[ub,"?"],[ub,"?"],[ub,"",!0]],function(a,b,c){if(arguments.length>2)throw"Collation parameter in function 'starts-with' is not implemented";return new Xa(0==(null==a?"":a.valueOf()).indexOf(null==b?"":b.valueOf()))}),f("ends-with",[[ub,"?"],[ub,"?"],[ub,"",!0]],function(a,b,c){if(arguments.length>2)throw"Collation parameter in function 'ends-with' is not implemented";var d=null==a?"":a.valueOf(),e=null==b?"":b.valueOf();return new Xa(d.indexOf(e)==d.length-e.length)}),f("substring-before",[[ub,"?"],[ub,"?"],[ub,"",!0]],function(a,b,c){if(arguments.length>2)throw"Collation parameter in function 'substring-before' is not implemented";var d,e=null==a?"":a.valueOf(),f=null==b?"":b.valueOf();return new ub((d=e.indexOf(f))>=0?e.substring(0,d):"")}),f("substring-after",[[ub,"?"],[ub,"?"],[ub,"",!0]],function(a,b,c){if(arguments.length>2)throw"Collation parameter in function 'substring-after' is not implemented";var d,e=null==a?"":a.valueOf(),f=null==b?"":b.valueOf();return new ub((d=e.indexOf(f))>=0?e.substring(d+f.length):"")}),f("matches",[[ub,"?"],[ub],[ub,"",!0]],function(a,b,c){var d=null==a?"":a.valueOf(),e=xc(b.valueOf(),arguments.length>2?c.valueOf():"");return new Xa(e.test(d))}),f("replace",[[ub,"?"],[ub],[ub],[ub,"",!0]],function(a,b,c,d){var e=null==a?"":a.valueOf(),f=xc(b.valueOf(),arguments.length>3?d.valueOf():"");return new Xa(e.replace(f,c.valueOf()))}),f("tokenize",[[ub,"?"],[ub],[ub,"",!0]],function(a,b,c){for(var d=null==a?"":a.valueOf(),e=xc(b.valueOf(),arguments.length>2?c.valueOf():""),f=[],g=0,h=d.split(e),i=h.length;gb?1:-1},yc.prototype=new c;var Hd=new e;yc.prototype.getProperty=function(a,b){if(b in a)return a[b];if("baseURI"==b){for(var c,d="",e=Hd.getFunction("{http://www.w3.org/2005/xpath-functions}resolve-uri"),f=Hd.getDataType("{http://www.w3.org/2001/XMLSchema}string"),g=a;g;g=g.parentNode)1==g.nodeType&&(c=g.getAttribute("xml:base"))&&(d=e(new f(c),new f(d)).toString());return d}if("textContent"==b){var h=[];return function(a){for(var b,c=0;b=a.childNodes[c];c++)3==b.nodeType||4==b.nodeType?h.push(b.data):1==b.nodeType&&b.firstChild&&arguments.callee(b)}(a),h.join("")}},yc.prototype.compareDocumentPosition=function(a,b){if("compareDocumentPosition"in a)return a.compareDocumentPosition(b);if(b==a)return 0;var c,d,e,f,g,h=null,i=null;if(2==a.nodeType&&(h=a,a=this.getProperty(h,"ownerElement")),2==b.nodeType&&(i=b,b=this.getProperty(i,"ownerElement")),h&&i&&a&&a==b)for(f=0,c=this.getProperty(a,"attributes"),g=c.length;fMath.round(a.width/50))&&(e=Math.round(a.width/50)),(!f||f>Math.round(a.width/50))&&(f=Math.round(a.height/50));var h=a.getContext("2d"),i=.08*a.width,j=.03*a.width,k=.08*a.height,l=.15*a.height,m=a.height-k-l,n=a.width-i-j,o=k+m,p=k;h.font=g+"px Arial",h.lineWidth="1.0",h.strokeStyle="#444",CanvasComponents.draw_line(h,i,o,n+i,o),CanvasComponents.draw_line(h,i,o,i,p);var q=.003*n,r=(n-q*b.length)/b.length,s=i+q,t=Math.max.apply(Math,b);h.fillStyle="green";for(var u=0;u=b.length)for(var u=0;u<=b.length;u++)h.fillText(u,s,o+.3*l),s+=r+q;else for(var u=0;u<=e;u++){var w=Math.ceil(b.length/e*u);s=n/e*u+i,h.fillText(w,s,o+.3*l)}h.textAlign="right";var x;if(f>=t)for(var u=0;u<=t;u++)x=o-u/t*m+g/3,h.fillText(u,.8*i,x);else for(var u=0;u<=f;u++){var w=Math.ceil(t/f*u);x=o-w/t*m+g/3,h.fillText(w,.8*i,x)}if(c&&(h.textAlign="center",h.fillText(c,n/2+i,o+.8*l)),d){h.save();var y=.3*i,z=m/2+k;h.translate(y,z),h.rotate(-Math.PI/2),h.textAlign="center",h.fillText(d,0,0),h.restore()}},draw_scale_bar:function(a,b,c,d){var e=a.getContext("2d"),f=.01*a.width,g=.01*a.width,h=.1*a.height,i=.3*a.height,j=a.height-h-i,k=a.width-f-g,l=b/c;e.strokeRect(f,h,k,j);var m=e.createLinearGradient(f,0,k+f,0);m.addColorStop(0,"green"),m.addColorStop(.5,"gold"),m.addColorStop(1,"red"),e.fillStyle=m,e.fillRect(f,h,k*l,j);var n,o,p,q;e.fillStyle="black",e.textAlign="center",e.font="13px Arial";for(var r=0;r=.9*c?(e.textAlign="right",n=p):d[r].max<=.1*c?e.textAlign="left":n+=(p-n)/2,o=h+j+.8*i,e.fillText(d[r].label,n,o)}},Utils={chr:function(a){return String.fromCharCode(a)},ord:function(a){return a.charCodeAt(0)},pad_left:function(a,b,c){c=c||"0";var d=c.length-(b-a.length);return d=d<0?0:d,a.lengthb&&(a=a.slice(0,b-c.length)+c),a},hex:function(a,b){return a="string"==typeof a?Utils.ord(a):a,b=b||2,Utils.pad(a.toString(16),b)},bin:function(a,b){return a="string"==typeof a?Utils.ord(a):a,b=b||8,Utils.pad(a.toString(2),b)},printable:function(a,b){window&&window.app&&!window.app.options.treat_as_utf8&&(a=Utils.byte_array_to_chars(Utils.str_to_byte_array(a)));var c=/[\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-\u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8E-\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-\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,d=/[\x09-\x10\x0D\u2028\u2029]/g;return a=a.replace(c,"."),b||(a=a.replace(d,".")),a},parse_escaped_chars:function(a){return a.replace(/(\\)?\\([nrtbf]|x[\da-f]{2})/g,function(a,b,c){if("\\"===b)return"\\"+c;switch(c[0]){case"n":return"\n";case"r":return"\r";case"t":return"\t";case"b":return"\b";case"f":return"\f";case"x":return Utils.chr(parseInt(c.substr(1),16))}})},expand_alph_range:function(a){for(var b=[],c=0;c255)return Utils.str_to_utf8_byte_array(a);return c},str_to_utf8_byte_array:function(a){var b=CryptoJS.enc.Utf8.parse(a),c=Utils.word_array_to_byte_array(b);return a.length!==b.sigBytes&&(window.app.options.attempt_highlight=!1),c},str_to_charcode:function(a){for(var b=new Array(a.length),c=a.length;c--;)b[c]=a.charCodeAt(c);return b},byte_array_to_utf8:function(a){try{for(var b=[],c=0;c>>2]|=a[c]<<24-c%4*8;var d=new CryptoJS.lib.WordArray.init(b,a.length),e=CryptoJS.enc.Utf8.stringify(d);return e.length!==d.sigBytes&&(window.app.options.attempt_highlight=!1),e}catch(b){return Utils.byte_array_to_chars(a)}},byte_array_to_chars:function(a){if(!a)return"";for(var b="",c=0;c>>2]>>>24-d%4*8&255);return c},UNIC_WIN1251_MAP:{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,14:14,15:15,16:16,17:17,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,28:28,29:29,30:30,31:31,32:32,33:33,34:34,35:35,36:36,37:37,38:38,39:39,40:40,41:41,42:42,43:43,44:44,45:45,46:46,47:47,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,58:58,59:59,60:60,61:61,62:62,63:63,64:64,65:65,66:66,67:67,68:68,69:69,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,82:82,83:83,84:84,85:85,86:86,87:87,88:88,89:89,90:90,91:91,92:92,93:93,94:94,95:95,96:96,97:97,98:98,99:99,100:100,101:101,102:102,103:103,104:104,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,125:125,126:126,127:127,1027:129,8225:135,1046:198,8222:132,1047:199,1168:165,1048:200,1113:154,1049:201,1045:197,1050:202,1028:170,160:160,1040:192,1051:203,164:164,166:166,167:167,169:169,171:171,172:172,173:173,174:174,1053:205,176:176,177:177,1114:156,181:181,182:182,183:183,8221:148,187:187,1029:189,1056:208,1057:209,1058:210,8364:136,1112:188,1115:158,1059:211,1060:212,1030:178,1061:213,1062:214,1063:215,1116:157,1064:216,1065:217,1031:175,1066:218,1067:219,1068:220,1069:221,1070:222,1032:163,8226:149,1071:223,1072:224,8482:153,1073:225,8240:137,1118:162,1074:226,1110:179,8230:133,1075:227,1033:138,1076:228,1077:229,8211:150,1078:230,1119:159,1079:231,1042:194,1080:232,1034:140,1025:168,1081:233,1082:234,8212:151,1083:235,1169:180,1084:236,1052:204,1085:237,1035:142,1086:238,1087:239,1088:240,1089:241,1090:242,1036:141,1041:193,1091:243,1092:244,8224:134,1093:245,8470:185,1094:246,1054:206,1095:247,1096:248,8249:139,1097:249,1098:250,1044:196,1099:251,1111:191,1055:207,1100:252,1038:161,8220:147,1101:253,8250:155,1102:254,8216:145,1103:255,1043:195,1105:184,1039:143,1026:128,1106:144,8218:130,1107:131,8217:146,1108:186,1109:190},WIN1251_UNIC_MAP:{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,14:14,15:15,16:16,17:17,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,28:28,29:29,30:30,31:31,32:32,33:33,34:34,35:35,36:36,37:37,38:38,39:39,40:40,41:41,42:42,43:43,44:44,45:45,46:46,47:47,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,58:58,59:59,60:60,61:61,62:62,63:63,64:64,65:65,66:66,67:67,68:68,69:69,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,82:82,83:83,84:84,85:85,86:86,87:87,88:88,89:89,90:90,91:91,92:92,93:93,94:94,95:95,96:96,97:97,98:98,99:99,100:100,101:101,102:102,103:103,104:104,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,125:125,126:126,127:127,160:160,164:164,166:166,167:167,169:169,171:171,172:172,173:173,174:174,176:176,177:177,181:181,182:182,183:183,187:187,168:1025,128:1026,129:1027,170:1028,189:1029,178:1030,175:1031,163:1032,138:1033,140:1034,142:1035,141:1036,161:1038,143:1039,192:1040,193:1041,194:1042,195:1043,196:1044,197:1045,198:1046,199:1047,200:1048,201:1049,202:1050,203:1051,204:1052,205:1053,206:1054,207:1055,208:1056,209:1057,210:1058,211:1059,212:1060,213:1061,214:1062,215:1063,216:1064,217:1065,218:1066,219:1067,220:1068,221:1069,222:1070,223:1071,224:1072,225:1073,226:1074,227:1075,228:1076,229:1077,230:1078,231:1079,232:1080,233:1081,234:1082,235:1083,236:1084,237:1085,238:1086,239:1087,240:1088,241:1089,242:1090,243:1091,244:1092,245:1093,246:1094,247:1095,248:1096,249:1097,250:1098,251:1099,252:1100,253:1101,254:1102,255:1103,184:1105,144:1106,131:1107,186:1108,190:1109,179:1110,191:1111,188:1112,154:1113,156:1114,158:1115,157:1116,162:1118,159:1119,165:1168,180:1169,150:8211,151:8212,145:8216,146:8217,130:8218,147:8220,148:8221,132:8222,134:8224,135:8225,149:8226,133:8230,137:8240,139:8249,155:8250,136:8364,185:8470,153:8482},unicode_to_win1251:function(a){for(var b=[],c=0;c>2,g=(3&c)<<4|d>>4,h=(15&d)<<2|e>>6,i=63&e,isNaN(d)?h=i=64:isNaN(e)&&(i=64),j+=b.charAt(f)+b.charAt(g)+b.charAt(h)+b.charAt(i);return j},from_base64:function(a,b,c,d){if(c=c||"string",!a)return"string"===c?"":[];b=b?Utils.expand_alph_range(b).join(""):"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",void 0===d&&(d=!0);var e,f,g,h,i,j,k,l=[],m=0;if(d){var n=new RegExp("[^"+b.replace(/[\[\]\\\-^$]/g,"\\$&")+"]","g");a=a.replace(n,"")}for(;m>4,f=(15&i)<<4|j>>2,g=(3&j)<<6|k,l.push(e),64!==j&&l.push(f),64!==k&&l.push(g);return"string"===c?Utils.byte_array_to_utf8(l):l},to_hex:function(a,b,c){if(!a)return"";b="string"==typeof b?b:" ",c=c||2;for(var d="",e=0;e>>4).toString(16)),b.push((15&a[c]).toString(16));return b.join("")},from_hex:function(a,b,c){if(b=b||(a.indexOf(" ")>=0?"Space":"None"),c=c||2,"None"!==b){var d=Utils.regex_rep[b];a=a.replace(d,"")}for(var e=[],f=0;f]*>.*<\/(script|style)>/gim,"")),a.replace(/<[^>\n]+>/g,"")},escape_html:function(a){return a.replace(/>>3]|=parseInt(a.substr(d,2),16)<<24-d%8*4;return new CryptoJS.lib.WordArray.init(c,b/2)};var Base={DEFAULT_RADIX:36,run_to:function(a,b){if(!a)throw"Error: Input must be a number";var c=b[0]||Base.DEFAULT_RADIX;if(c<2||c>36)throw"Error: Radix argument must be between 2 and 36";return a.toString(c)},run_from:function(a,b){var c=b[0]||Base.DEFAULT_RADIX;if(c<2||c>36)throw"Error: Radix argument must be between 2 and 36";return parseInt(a.replace(/\s/g,""),c)}},Base64={ALPHABET:"A-Za-z0-9+/=",ALPHABET_OPTIONS:[{name:"Standard: A-Za-z0-9+/=",value:"A-Za-z0-9+/="},{name:"URL safe: 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: 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+/="}],run_to:function(a,b){var c=b[0]||Base64.ALPHABET;return Utils.to_base64(a,c)},REMOVE_NON_ALPH_CHARS:!0,run_from:function(a,b){var c=b[0]||Base64.ALPHABET,d=b[1];return Utils.from_base64(a,c,"byte_array",d)},BASE32_ALPHABET:"A-Z2-7=",run_to_32:function(a,b){if(!a)return"";for(var c,d,e,f,g,h,i,j,k,l,m,n,o,p=b[0]?Utils.expand_alph_range(b[0]).join(""):"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",q="",r=0;r>3,i=(7&c)<<2|d>>6,j=d>>1&31,k=(1&d)<<4|e>>4,l=(15&e)<<1|f>>7,m=f>>2&63,n=(3&f)<<3|g>>5,o=31&g,isNaN(d)?j=k=l=m=n=o=32:isNaN(e)?l=m=n=o=32:isNaN(f)?m=n=o=32:isNaN(g)&&(o=32),q+=p.charAt(h)+p.charAt(i)+p.charAt(j)+p.charAt(k)+p.charAt(l)+p.charAt(m)+p.charAt(n)+p.charAt(o);return q},run_from_32:function(a,b){if(!a)return[];var c,d,e,f,g,h,i,j,k,l,m,n,o,p=b[0]?Utils.expand_alph_range(b[0]).join(""):"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",q=b[0],r=[],s=0;if(q){var t=new RegExp("[^"+p.replace(/[\]\\\-^]/g,"\\$&")+"]","g");a=a.replace(t,"")}for(;s>2,d=(3&i)<<6|j<<1|k>>4,e=(15&k)<<4|l>>1,f=(1&l)<<7|m<<2|n>>3,g=(7&n)<<5|o,r.push(c),(i&!0||32!==j)&&r.push(d),(k&!0||32!==l)&&r.push(e),(l&!0||32!==m)&&r.push(f),(n&!0||32!==o)&&r.push(g);return r},SHOW_IN_BINARY:!1,OFFSETS_SHOW_VARIABLE:!0,run_offsets:function(a,b){var c=b[0]||Base64.ALPHABET,d=b[1],e=Utils.to_base64(a,c),f=Utils.to_base64([0].concat(a),c),g=Utils.to_base64([0,0].concat(a),c),h=e.indexOf("="),i=f.indexOf("="),j=g.indexOf("="),k="", - static_section = "", + staticSection = "", padding = ""; if (input.length < 1) { @@ -213,28 +213,28 @@ var Base64 = { // Highlight offset 0 if (len0 % 4 === 2) { - static_section = offset0.slice(0, -3); + staticSection = offset0.slice(0, -3); offset0 = "" + - static_section + "" + + Utils.escapeHtml(Utils.fromBase64(staticSection, alphabet).slice(0, -2)) + "'>" + + staticSection + "" + "" + offset0.substr(offset0.length - 3, 1) + "" + "" + offset0.substr(offset0.length - 2) + ""; } else if (len0 % 4 === 3) { - static_section = offset0.slice(0, -2); + staticSection = offset0.slice(0, -2); offset0 = "" + - static_section + "" + + Utils.escapeHtml(Utils.fromBase64(staticSection, alphabet).slice(0, -1)) + "'>" + + staticSection + "" + "" + offset0.substr(offset0.length - 2, 1) + "" + "" + offset0.substr(offset0.length - 1) + ""; } else { - static_section = offset0; + staticSection = offset0; offset0 = "" + - static_section + ""; + Utils.escapeHtml(Utils.fromBase64(staticSection, alphabet)) + "'>" + + staticSection + ""; } - if (!show_variable) { - offset0 = static_section; + if (!showVariable) { + offset0 = staticSection; } @@ -243,28 +243,28 @@ var Base64 = { "" + offset1.substr(1, 1) + ""; offset1 = offset1.substr(2); if (len1 % 4 === 2) { - static_section = offset1.slice(0, -3); + staticSection = offset1.slice(0, -3); offset1 = padding + "" + - static_section + "" + + Utils.escapeHtml(Utils.fromBase64("AA" + staticSection, alphabet).slice(1, -2)) + "'>" + + staticSection + "" + "" + offset1.substr(offset1.length - 3, 1) + "" + "" + offset1.substr(offset1.length - 2) + ""; } else if (len1 % 4 === 3) { - static_section = offset1.slice(0, -2); + staticSection = offset1.slice(0, -2); offset1 = padding + "" + - static_section + "" + + Utils.escapeHtml(Utils.fromBase64("AA" + staticSection, alphabet).slice(1, -1)) + "'>" + + staticSection + "" + "" + offset1.substr(offset1.length - 2, 1) + "" + "" + offset1.substr(offset1.length - 1) + ""; } else { - static_section = offset1; + staticSection = offset1; offset1 = padding + "" + - static_section + ""; + Utils.escapeHtml(Utils.fromBase64("AA" + staticSection, alphabet).slice(1)) + "'>" + + staticSection + ""; } - if (!show_variable) { - offset1 = static_section; + if (!showVariable) { + offset1 = staticSection; } // Highlight offset 2 @@ -272,31 +272,31 @@ var Base64 = { "" + offset2.substr(2, 1) + ""; offset2 = offset2.substr(3); if (len2 % 4 === 2) { - static_section = offset2.slice(0, -3); + staticSection = offset2.slice(0, -3); offset2 = padding + "" + - static_section + "" + + Utils.escapeHtml(Utils.fromBase64("AAA" + staticSection, alphabet).slice(2, -2)) + "'>" + + staticSection + "" + "" + offset2.substr(offset2.length - 3, 1) + "" + "" + offset2.substr(offset2.length - 2) + ""; } else if (len2 % 4 === 3) { - static_section = offset2.slice(0, -2); + staticSection = offset2.slice(0, -2); offset2 = padding + "" + - static_section + "" + + Utils.escapeHtml(Utils.fromBase64("AAA" + staticSection, alphabet).slice(2, -2)) + "'>" + + staticSection + "" + "" + offset2.substr(offset2.length - 2, 1) + "" + "" + offset2.substr(offset2.length - 1) + ""; } else { - static_section = offset2; + staticSection = offset2; offset2 = padding + "" + - static_section + ""; + Utils.escapeHtml(Utils.fromBase64("AAA" + staticSection, alphabet).slice(2)) + "'>" + + staticSection + ""; } - if (!show_variable) { - offset2 = static_section; + if (!showVariable) { + offset2 = staticSection; } - return (show_variable ? "Characters highlighted in green could change if the input is surrounded by more data." + + return (showVariable ? "Characters highlighted in green could change if the input is surrounded by more data." + "\nCharacters highlighted in red are for padding purposes only." + "\nUnhighlighted characters are static." + "\nHover over the static sections to see what they decode to on their own.\n" + @@ -317,7 +317,7 @@ var Base64 = { * @param {Object[]} args * @returns {Object[]} pos */ - highlight_to: function(pos, args) { + highlightTo: function(pos, args) { pos[0].start = Math.floor(pos[0].start / 3 * 4); pos[0].end = Math.ceil(pos[0].end / 3 * 4); return pos; @@ -332,7 +332,7 @@ var Base64 = { * @param {Object[]} args * @returns {Object[]} pos */ - highlight_from: function(pos, args) { + highlightFrom: function(pos, args) { pos[0].start = Math.ceil(pos[0].start / 4 * 3); pos[0].end = Math.floor(pos[0].end / 4 * 3); return pos; diff --git a/src/js/operations/BitwiseOp.js b/src/js/operations/BitwiseOp.js index 3f5d0fa9..95944733 100755 --- a/src/js/operations/BitwiseOp.js +++ b/src/js/operations/BitwiseOp.js @@ -15,14 +15,14 @@ var BitwiseOp = { * Runs bitwise operations across the input data. * * @private - * @param {byte_array} input - * @param {byte_array} key + * @param {byteArray} input + * @param {byteArray} key * @param {function} func - The bitwise calculation to carry out - * @param {boolean} null_preserving + * @param {boolean} nullPreserving * @param {string} scheme - * @returns {byte_array} + * @returns {byteArray} */ - _bit_op: function (input, key, func, null_preserving, scheme) { + _bitOp: function (input, key, func, nullPreserving, scheme) { if (!key || !key.length) key = [0]; var result = [], x = null, @@ -32,9 +32,9 @@ var BitwiseOp = { for (var i = 0; i < input.length; i++) { k = key[i % key.length]; o = input[i]; - x = null_preserving && (o === 0 || o === k) ? o : func(o, k); + x = nullPreserving && (o === 0 || o === k) ? o : func(o, k); result.push(x); - if (scheme !== "Standard" && !(null_preserving && (o === 0 || o === k))) { + if (scheme !== "Standard" && !(nullPreserving && (o === 0 || o === k))) { switch (scheme) { case "Input differential": key[i % key.length] = x; @@ -69,18 +69,18 @@ var BitwiseOp = { /** * XOR operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args - * @returns {byte_array} + * @returns {byteArray} */ - run_xor: function (input, args) { + runXor: function (input, args) { var key = Utils.format[args[0].option].parse(args[0].string || ""), scheme = args[1], - null_preserving = args[2]; + nullPreserving = args[2]; - key = Utils.word_array_to_byte_array(key); + key = Utils.wordArrayToByteArray(key); - return BitwiseOp._bit_op(input, key, BitwiseOp._xor, null_preserving, scheme); + return BitwiseOp._bitOp(input, key, BitwiseOp._xor, nullPreserving, scheme); }, @@ -113,42 +113,42 @@ var BitwiseOp = { /** * XOR Brute Force operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args * @returns {string} */ - run_xor_brute: function (input, args) { - var key_length = parseInt(args[0], 10), - sample_length = args[1], - sample_offset = args[2], - null_preserving = args[3], + runXorBrute: function (input, args) { + var keyLength = parseInt(args[0], 10), + sampleLength = args[1], + sampleOffset = args[2], + nullPreserving = args[3], differential = args[4], crib = args[5], - print_key = args[6], - output_hex = args[7], + printKey = args[6], + outputHex = args[7], regex; var output = "", result, - result_utf8; + resultUtf8; - input = input.slice(sample_offset, sample_offset + sample_length); + input = input.slice(sampleOffset, sampleOffset + sampleLength); if (crib !== "") { regex = new RegExp(crib, "im"); } - for (var key = 1, l = Math.pow(256, key_length); key < l; key++) { - result = BitwiseOp._bit_op(input, Utils.hex_to_byte_array(key.toString(16)), BitwiseOp._xor, null_preserving, differential); - result_utf8 = Utils.byte_array_to_utf8(result); - if (crib !== "" && result_utf8.search(regex) === -1) continue; - if (print_key) output += "Key = " + Utils.hex(key, (2*key_length)) + ": "; - if (output_hex) - output += Utils.byte_array_to_hex(result) + "\n"; + for (var key = 1, l = Math.pow(256, keyLength); key < l; key++) { + result = BitwiseOp._bitOp(input, Utils.hexToByteArray(key.toString(16)), BitwiseOp._xor, nullPreserving, differential); + resultUtf8 = Utils.byteArrayToUtf8(result); + if (crib !== "" && resultUtf8.search(regex) === -1) continue; + if (printKey) output += "Key = " + Utils.hex(key, (2*keyLength)) + ": "; + if (outputHex) + output += Utils.byteArrayToHex(result) + "\n"; else - output += Utils.printable(result_utf8, false) + "\n"; - if (print_key) output += "\n"; + output += Utils.printable(resultUtf8, false) + "\n"; + if (printKey) output += "\n"; } return output; }, @@ -157,72 +157,72 @@ var BitwiseOp = { /** * NOT operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args - * @returns {byte_array} + * @returns {byteArray} */ - run_not: function (input, args) { - return BitwiseOp._bit_op(input, null, BitwiseOp._not); + runNot: function (input, args) { + return BitwiseOp._bitOp(input, null, BitwiseOp._not); }, /** * AND operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args - * @returns {byte_array} + * @returns {byteArray} */ - run_and: function (input, args) { + runAnd: function (input, args) { var key = Utils.format[args[0].option].parse(args[0].string || ""); - key = Utils.word_array_to_byte_array(key); + key = Utils.wordArrayToByteArray(key); - return BitwiseOp._bit_op(input, key, BitwiseOp._and); + return BitwiseOp._bitOp(input, key, BitwiseOp._and); }, /** * OR operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args - * @returns {byte_array} + * @returns {byteArray} */ - run_or: function (input, args) { + runOr: function (input, args) { var key = Utils.format[args[0].option].parse(args[0].string || ""); - key = Utils.word_array_to_byte_array(key); + key = Utils.wordArrayToByteArray(key); - return BitwiseOp._bit_op(input, key, BitwiseOp._or); + return BitwiseOp._bitOp(input, key, BitwiseOp._or); }, /** * ADD operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args - * @returns {byte_array} + * @returns {byteArray} */ - run_add: function (input, args) { + runAdd: function (input, args) { var key = Utils.format[args[0].option].parse(args[0].string || ""); - key = Utils.word_array_to_byte_array(key); + key = Utils.wordArrayToByteArray(key); - return BitwiseOp._bit_op(input, key, BitwiseOp._add); + return BitwiseOp._bitOp(input, key, BitwiseOp._add); }, /** * SUB operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args - * @returns {byte_array} + * @returns {byteArray} */ - run_sub: function (input, args) { + runSub: function (input, args) { var key = Utils.format[args[0].option].parse(args[0].string || ""); - key = Utils.word_array_to_byte_array(key); + key = Utils.wordArrayToByteArray(key); - return BitwiseOp._bit_op(input, key, BitwiseOp._sub); + return BitwiseOp._bitOp(input, key, BitwiseOp._sub); }, diff --git a/src/js/operations/ByteRepr.js b/src/js/operations/ByteRepr.js index 87f11e48..2130409d 100755 --- a/src/js/operations/ByteRepr.js +++ b/src/js/operations/ByteRepr.js @@ -30,13 +30,13 @@ var ByteRepr = { /** * To Hex operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args * @returns {string} */ - run_to_hex: function(input, args) { - var delim = Utils.char_rep[args[0] || "Space"]; - return Utils.to_hex(input, delim, 2); + runToHex: function(input, args) { + var delim = Utils.charRep[args[0] || "Space"]; + return Utils.toHex(input, delim, 2); }, @@ -45,11 +45,11 @@ var ByteRepr = { * * @param {string} input * @param {Object[]} args - * @returns {byte_array} + * @returns {byteArray} */ - run_from_hex: function(input, args) { + runFromHex: function(input, args) { var delim = args[0] || "Space"; - return Utils.from_hex(input, delim, 2); + return Utils.fromHex(input, delim, 2); }, @@ -66,8 +66,8 @@ var ByteRepr = { * @param {Object[]} args * @returns {string} */ - run_to_charcode: function(input, args) { - var delim = Utils.char_rep[args[0] || "Space"], + runToCharcode: function(input, args) { + var delim = Utils.charRep[args[0] || "Space"], base = args[1], output = "", padding = 2, @@ -87,11 +87,11 @@ var ByteRepr = { else if (ordinal < 4294967296) padding = 8; else padding = 2; - if (padding > 2) app.options.attempt_highlight = false; + if (padding > 2) app.options.attemptHighlight = false; output += Utils.hex(ordinal, padding) + delim; } else { - app.options.attempt_highlight = false; + app.options.attemptHighlight = false; output += ordinal.toString(base) + delim; } } @@ -105,10 +105,10 @@ var ByteRepr = { * * @param {string} input * @param {Object[]} args - * @returns {byte_array} + * @returns {byteArray} */ - run_from_charcode: function(input, args) { - var delim = Utils.char_rep[args[0] || "Space"], + runFromCharcode: function(input, args) { + var delim = Utils.charRep[args[0] || "Space"], base = args[1], bites = input.split(delim), i = 0; @@ -118,7 +118,7 @@ var ByteRepr = { } if (base !== 16) { - app.options.attempt_highlight = false; + app.options.attemptHighlight = false; } // Split into groups of 2 if the whole string is concatenated and @@ -134,7 +134,7 @@ var ByteRepr = { for (i = 0; i < bites.length; i++) { latin1 += Utils.chr(parseInt(bites[i], base)); } - return Utils.str_to_byte_array(latin1); + return Utils.strToByteArray(latin1); }, @@ -147,8 +147,8 @@ var ByteRepr = { * @param {Object[]} args * @returns {Object[]} pos */ - highlight_to: function(pos, args) { - var delim = Utils.char_rep[args[0] || "Space"], + highlightTo: function(pos, args) { + var delim = Utils.charRep[args[0] || "Space"], len = delim === "\r\n" ? 1 : delim.length; pos[0].start = pos[0].start * (2 + len); @@ -172,8 +172,8 @@ var ByteRepr = { * @param {Object[]} args * @returns {Object[]} pos */ - highlight_from: function(pos, args) { - var delim = Utils.char_rep[args[0] || "Space"], + highlightFrom: function(pos, args) { + var delim = Utils.charRep[args[0] || "Space"], len = delim === "\r\n" ? 1 : delim.length, width = len + 2; @@ -194,12 +194,12 @@ var ByteRepr = { /** * To Decimal operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args * @returns {string} */ - run_to_decimal: function(input, args) { - var delim = Utils.char_rep[args[0]]; + runToDecimal: function(input, args) { + var delim = Utils.charRep[args[0]]; return input.join(delim); }, @@ -209,16 +209,16 @@ var ByteRepr = { * * @param {string} input * @param {Object[]} args - * @returns {byte_array} + * @returns {byteArray} */ - run_from_decimal: function(input, args) { - var delim = Utils.char_rep[args[0]]; - var byte_str = input.split(delim), output = []; - if (byte_str[byte_str.length-1] === "") - byte_str = byte_str.slice(0, byte_str.length-1); + runFromDecimal: function(input, args) { + var delim = Utils.charRep[args[0]]; + var byteStr = input.split(delim), output = []; + if (byteStr[byteStr.length-1] === "") + byteStr = byteStr.slice(0, byteStr.length-1); - for (var i = 0; i < byte_str.length; i++) { - output[i] = parseInt(byte_str[i], 10); + for (var i = 0; i < byteStr.length; i++) { + output[i] = parseInt(byteStr[i], 10); } return output; }, @@ -227,12 +227,12 @@ var ByteRepr = { /** * To Binary operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args * @returns {string} */ - run_to_binary: function(input, args) { - var delim = Utils.char_rep[args[0] || "Space"], + runToBinary: function(input, args) { + var delim = Utils.charRep[args[0] || "Space"], output = "", padding = 8; @@ -253,18 +253,18 @@ var ByteRepr = { * * @param {string} input * @param {Object[]} args - * @returns {byte_array} + * @returns {byteArray} */ - run_from_binary: function(input, args) { + runFromBinary: function(input, args) { if (args[0] !== "None") { - var delim_regex = Utils.regex_rep[args[0] || "Space"]; - input = input.replace(delim_regex, ""); + var delimRegex = Utils.regexRep[args[0] || "Space"]; + input = input.replace(delimRegex, ""); } var output = []; - var byte_len = 8; - for (var i = 0; i < input.length; i += byte_len) { - output.push(parseInt(input.substr(i, byte_len), 2)); + var byteLen = 8; + for (var i = 0; i < input.length; i += byteLen) { + output.push(parseInt(input.substr(i, byteLen), 2)); } return output; }, @@ -279,8 +279,8 @@ var ByteRepr = { * @param {Object[]} args * @returns {Object[]} pos */ - highlight_to_binary: function(pos, args) { - var delim = Utils.char_rep[args[0] || "Space"]; + highlightToBinary: function(pos, args) { + var delim = Utils.charRep[args[0] || "Space"]; pos[0].start = pos[0].start * (8 + delim.length); pos[0].end = pos[0].end * (8 + delim.length) - delim.length; return pos; @@ -296,8 +296,8 @@ var ByteRepr = { * @param {Object[]} args * @returns {Object[]} pos */ - highlight_from_binary: function(pos, args) { - var delim = Utils.char_rep[args[0] || "Space"]; + highlightFromBinary: function(pos, args) { + var delim = Utils.charRep[args[0] || "Space"]; pos[0].start = pos[0].start === 0 ? 0 : Math.floor(pos[0].start / (8 + delim.length)); pos[0].end = pos[0].end === 0 ? 0 : Math.ceil(pos[0].end / (8 + delim.length)); return pos; @@ -318,40 +318,40 @@ var ByteRepr = { /** * To Hex Content operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args * @returns {string} */ - run_to_hex_content: function(input, args) { + runToHexContent: function(input, args) { var convert = args[0]; var spaces = args[1]; if (convert === "All chars") { - var result = "|" + Utils.to_hex(input) + "|"; + var result = "|" + Utils.toHex(input) + "|"; if (!spaces) result = result.replace(/ /g, ""); return result; } var output = "", - in_hex = false, - convert_spaces = convert === "Only special chars including spaces", + inHex = false, + convertSpaces = convert === "Only special chars including spaces", b; for (var i = 0; i < input.length; i++) { b = input[i]; - if ((b === 32 && convert_spaces) || (b < 48 && b !== 32) || (b > 57 && b < 65) || (b > 90 && b < 97) || b > 122) { - if (!in_hex) { + if ((b === 32 && convertSpaces) || (b < 48 && b !== 32) || (b > 57 && b < 65) || (b > 90 && b < 97) || b > 122) { + if (!inHex) { output += "|"; - in_hex = true; + inHex = true; } else if (spaces) output += " "; - output += Utils.to_hex([b]); + output += Utils.toHex([b]); } else { - if (in_hex) { + if (inHex) { output += "|"; - in_hex = false; + inHex = false; } output += Utils.chr(input[i]); } } - if (in_hex) output += "|"; + if (inHex) output += "|"; return output; }, @@ -361,9 +361,9 @@ var ByteRepr = { * * @param {string} input * @param {Object[]} args - * @returns {byte_array} + * @returns {byteArray} */ - run_from_hex_content: function(input, args) { + runFromHexContent: function(input, args) { var regex = /\|([a-f\d ]{2,})\|/gi; var output = [], m, i = 0; while ((m = regex.exec(input))) { @@ -372,7 +372,7 @@ var ByteRepr = { output.push(Utils.ord(input[i++])); // Add match - var bytes = Utils.from_hex(m[1]); + var bytes = Utils.fromHex(m[1]); if (bytes) { for (var a = 0; a < bytes.length;) output.push(bytes[a++]); diff --git a/src/js/operations/CharEnc.js b/src/js/operations/CharEnc.js index 3dd31aab..72b5ea6f 100755 --- a/src/js/operations/CharEnc.js +++ b/src/js/operations/CharEnc.js @@ -25,21 +25,21 @@ var CharEnc = { * @returns {string} */ run: function(input, args) { - var input_format = args[0], - output_format = args[1]; + var inputFormat = args[0], + outputFormat = args[1]; - if (input_format === "Windows-1251") { - input = Utils.win1251_to_unicode(input); + if (inputFormat === "Windows-1251") { + input = Utils.win1251ToUnicode(input); input = CryptoJS.enc.Utf8.parse(input); } else { - input = Utils.format[input_format].parse(input); + input = Utils.format[inputFormat].parse(input); } - if (output_format === "Windows-1251") { + if (outputFormat === "Windows-1251") { input = CryptoJS.enc.Utf8.stringify(input); - return Utils.unicode_to_win1251(input); + return Utils.unicodeToWin1251(input); } else { - return Utils.format[output_format].stringify(input); + return Utils.format[outputFormat].stringify(input); } }, diff --git a/src/js/operations/Checksum.js b/src/js/operations/Checksum.js index 7f55cf4b..8e2a4b7e 100755 --- a/src/js/operations/Checksum.js +++ b/src/js/operations/Checksum.js @@ -12,11 +12,11 @@ var Checksum = { /** * Fletcher-8 Checksum operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args * @returns {string} */ - run_fletcher8: function(input, args) { + runFletcher8: function(input, args) { var a = 0, b = 0; @@ -32,11 +32,11 @@ var Checksum = { /** * Fletcher-16 Checksum operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args * @returns {string} */ - run_fletcher16: function(input, args) { + runFletcher16: function(input, args) { var a = 0, b = 0; @@ -52,11 +52,11 @@ var Checksum = { /** * Fletcher-32 Checksum operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args * @returns {string} */ - run_fletcher32: function(input, args) { + runFletcher32: function(input, args) { var a = 0, b = 0; @@ -72,11 +72,11 @@ var Checksum = { /** * Fletcher-64 Checksum operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args * @returns {string} */ - run_fletcher64: function(input, args) { + runFletcher64: function(input, args) { var a = 0, b = 0; @@ -92,11 +92,11 @@ var Checksum = { /** * Adler-32 Checksum operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args * @returns {string} */ - run_adler32: function(input, args) { + runAdler32: function(input, args) { var MOD_ADLER = 65521, a = 1, b = 0; @@ -116,16 +116,16 @@ var Checksum = { /** * CRC-32 Checksum operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args * @returns {string} */ - run_crc32: function(input, args) { - var crc_table = window.crc_table || (window.crc_table = Checksum._gen_crc_table()), + runCRC32: function(input, args) { + var crcTable = window.crcTable || (window.crcTable = Checksum._genCRCTable()), crc = 0 ^ (-1); for (var i = 0; i < input.length; i++) { - crc = (crc >>> 8) ^ crc_table[(crc ^ input[i]) & 0xff]; + crc = (crc >>> 8) ^ crcTable[(crc ^ input[i]) & 0xff]; } return Utils.hex((crc ^ (-1)) >>> 0); @@ -136,20 +136,20 @@ var Checksum = { * TCP/IP Checksum operation. * * @author GCHQ Contributor [1] - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args * @returns {string} * * @example * // returns '3f2c' - * Checksum.run_tcp_ip([0x45,0x00,0x00,0x87,0xa3,0x1b,0x40,0x00,0x40,0x06, + * Checksum.runTcpIp([0x45,0x00,0x00,0x87,0xa3,0x1b,0x40,0x00,0x40,0x06, * 0x00,0x00,0xac,0x11,0x00,0x04,0xac,0x11,0x00,0x03]) * * // returns 'a249' - * Checksum.run_tcp_ip([0x45,0x00,0x01,0x11,0x3f,0x74,0x40,0x00,0x40,0x06, + * Checksum.runTcpIp([0x45,0x00,0x01,0x11,0x3f,0x74,0x40,0x00,0x40,0x06, * 0x00,0x00,0xac,0x11,0x00,0x03,0xac,0x11,0x00,0x04]) */ - run_tcp_ip: function(input, args) { + runTCPIP: function(input, args) { var csum = 0; for (var i = 0; i < input.length; i++) { @@ -172,19 +172,19 @@ var Checksum = { * @private * @returns {array} */ - _gen_crc_table: function() { + _genCRCTable: function() { var c, - crc_table = []; + crcTable = []; for (var n = 0; n < 256; n++) { c = n; for (var k = 0; k < 8; k++) { c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); } - crc_table[n] = c; + crcTable[n] = c; } - return crc_table; + return crcTable; }, }; diff --git a/src/js/operations/Cipher.js b/src/js/operations/Cipher.js index 4f6d7316..d204d6cd 100755 --- a/src/js/operations/Cipher.js +++ b/src/js/operations/Cipher.js @@ -53,7 +53,7 @@ var Cipher = { * * @private * @param {function} algo - The CryptoJS algorithm to use - * @param {byte_array} input + * @param {byteArray} input * @param {function} args * @returns {string} */ @@ -63,8 +63,8 @@ var Cipher = { salt = Utils.format[args[2].option].parse(args[2].string || ""), mode = CryptoJS.mode[args[3]], padding = CryptoJS.pad[args[4]], - result_option = args[5].toLowerCase(), - output_format = args[6]; + resultOption = args[5].toLowerCase(), + outputFormat = args[6]; if (iv.sigBytes === 0) { // Use passphrase rather than key. Need to convert it to a string. @@ -79,13 +79,13 @@ var Cipher = { }); var result = ""; - if (result_option === "show all") { - result += "Key: " + encrypted.key.toString(Utils.format[output_format]); - result += "\nIV: " + encrypted.iv.toString(Utils.format[output_format]); - if (encrypted.salt) result += "\nSalt: " + encrypted.salt.toString(Utils.format[output_format]); - result += "\n\nCiphertext: " + encrypted.ciphertext.toString(Utils.format[output_format]); + if (resultOption === "show all") { + result += "Key: " + encrypted.key.toString(Utils.format[outputFormat]); + result += "\nIV: " + encrypted.iv.toString(Utils.format[outputFormat]); + if (encrypted.salt) result += "\nSalt: " + encrypted.salt.toString(Utils.format[outputFormat]); + result += "\n\nCiphertext: " + encrypted.ciphertext.toString(Utils.format[outputFormat]); } else { - result = encrypted[result_option].toString(Utils.format[output_format]); + result = encrypted[resultOption].toString(Utils.format[outputFormat]); } return result; @@ -97,7 +97,7 @@ var Cipher = { * * @private * @param {function} algo - The CryptoJS algorithm to use - * @param {byte_array} input + * @param {byteArray} input * @param {function} args * @returns {string} */ @@ -107,15 +107,15 @@ var Cipher = { salt = Utils.format[args[2].option].parse(args[2].string || ""), mode = CryptoJS.mode[args[3]], padding = CryptoJS.pad[args[4]], - input_format = args[5], - output_format = args[6]; + inputFormat = args[5], + outputFormat = args[6]; // The ZeroPadding option causes a crash when the input length is 0 if (!input.length) { return "No input"; } - var ciphertext = Utils.format[input_format].parse(input); + var ciphertext = Utils.format[inputFormat].parse(input); if (iv.sigBytes === 0) { // Use passphrase rather than key. Need to convert it to a string. @@ -133,7 +133,7 @@ var Cipher = { var result; try { - result = decrypted.toString(Utils.format[output_format]); + result = decrypted.toString(Utils.format[outputFormat]); } catch (err) { result = "Decrypt error: " + err.message; } @@ -149,7 +149,7 @@ var Cipher = { * @param {Object[]} args * @returns {string} */ - run_aes_enc: function (input, args) { + runAesEnc: function (input, args) { return Cipher._enc(CryptoJS.AES, input, args); }, @@ -161,7 +161,7 @@ var Cipher = { * @param {Object[]} args * @returns {string} */ - run_aes_dec: function (input, args) { + runAesDec: function (input, args) { return Cipher._dec(CryptoJS.AES, input, args); }, @@ -173,7 +173,7 @@ var Cipher = { * @param {Object[]} args * @returns {string} */ - run_des_enc: function (input, args) { + runDesEnc: function (input, args) { return Cipher._enc(CryptoJS.DES, input, args); }, @@ -185,7 +185,7 @@ var Cipher = { * @param {Object[]} args * @returns {string} */ - run_des_dec: function (input, args) { + runDesDec: function (input, args) { return Cipher._dec(CryptoJS.DES, input, args); }, @@ -197,7 +197,7 @@ var Cipher = { * @param {Object[]} args * @returns {string} */ - run_triple_des_enc: function (input, args) { + runTripleDesEnc: function (input, args) { return Cipher._enc(CryptoJS.TripleDES, input, args); }, @@ -209,7 +209,7 @@ var Cipher = { * @param {Object[]} args * @returns {string} */ - run_triple_des_dec: function (input, args) { + runTripleDesDec: function (input, args) { return Cipher._dec(CryptoJS.TripleDES, input, args); }, @@ -221,7 +221,7 @@ var Cipher = { * @param {Object[]} args * @returns {string} */ - run_rabbit_enc: function (input, args) { + runRabbitEnc: function (input, args) { return Cipher._enc(CryptoJS.Rabbit, input, args); }, @@ -233,7 +233,7 @@ var Cipher = { * @param {Object[]} args * @returns {string} */ - run_rabbit_dec: function (input, args) { + runRabbitDec: function (input, args) { return Cipher._dec(CryptoJS.Rabbit, input, args); }, @@ -256,20 +256,20 @@ var Cipher = { * @param {Object[]} args * @returns {string} */ - run_blowfish_enc: function (input, args) { + runBlowfishEnc: function (input, args) { var key = Utils.format[args[0].option].parse(args[0].string).toString(Utils.format.Latin1), mode = args[1], - output_format = args[2]; + outputFormat = args[2]; if (key.length === 0) return "Enter a key"; - var enc_hex = blowfish.encrypt(input, key, { + var encHex = blowfish.encrypt(input, key, { outputType: 1, cipherMode: Cipher.BLOWFISH_MODES.indexOf(mode) }), - enc = CryptoJS.enc.Hex.parse(enc_hex); + enc = CryptoJS.enc.Hex.parse(encHex); - return enc.toString(Utils.format[output_format]); + return enc.toString(Utils.format[outputFormat]); }, @@ -280,14 +280,14 @@ var Cipher = { * @param {Object[]} args * @returns {string} */ - run_blowfish_dec: function (input, args) { + runBlowfishDec: function (input, args) { var key = Utils.format[args[0].option].parse(args[0].string).toString(Utils.format.Latin1), mode = args[1], - input_format = args[2]; + inputFormat = args[2]; if (key.length === 0) return "Enter a key"; - input = Utils.format[input_format].parse(input); + input = Utils.format[inputFormat].parse(input); return blowfish.decrypt(input.toString(CryptoJS.enc.Base64), key, { outputType: 0, // This actually means inputType. The library is weird. @@ -314,16 +314,16 @@ var Cipher = { * @param {Object[]} args * @returns {string} */ - run_pbkdf2: function (input, args) { - var key_size = args[0] / 32, + runPbkdf2: function (input, args) { + var keySize = args[0] / 32, iterations = args[1], salt = CryptoJS.enc.Hex.parse(args[2] || ""), - input_format = args[3], - output_format = args[4], - passphrase = Utils.format[input_format].parse(input), - key = CryptoJS.PBKDF2(passphrase, salt, { keySize: key_size, iterations: iterations }); + inputFormat = args[3], + outputFormat = args[4], + passphrase = Utils.format[inputFormat].parse(input), + key = CryptoJS.PBKDF2(passphrase, salt, { keySize: keySize, iterations: iterations }); - return key.toString(Utils.format[output_format]); + return key.toString(Utils.format[outputFormat]); }, @@ -334,16 +334,16 @@ var Cipher = { * @param {Object[]} args * @returns {string} */ - run_evpkdf: function (input, args) { - var key_size = args[0] / 32, + runEvpkdf: function (input, args) { + var keySize = args[0] / 32, iterations = args[1], salt = CryptoJS.enc.Hex.parse(args[2] || ""), - input_format = args[3], - output_format = args[4], - passphrase = Utils.format[input_format].parse(input), - key = CryptoJS.EvpKDF(passphrase, salt, { keySize: key_size, iterations: iterations }); + inputFormat = args[3], + outputFormat = args[4], + passphrase = Utils.format[inputFormat].parse(input), + key = CryptoJS.EvpKDF(passphrase, salt, { keySize: keySize, iterations: iterations }); - return key.toString(Utils.format[output_format]); + return key.toString(Utils.format[outputFormat]); }, @@ -354,7 +354,7 @@ var Cipher = { * @param {Object[]} args * @returns {string} */ - run_rc4: function (input, args) { + runRc4: function (input, args) { var message = Utils.format[args[1]].parse(input), passphrase = Utils.format[args[0].option].parse(args[0].string), encrypted = CryptoJS.RC4.encrypt(message, passphrase); @@ -376,7 +376,7 @@ var Cipher = { * @param {Object[]} args * @returns {string} */ - run_rc4drop: function (input, args) { + runRc4drop: function (input, args) { var message = Utils.format[args[1]].parse(input), passphrase = Utils.format[args[0].option].parse(args[0].string), drop = args[3], @@ -394,13 +394,13 @@ var Cipher = { * @param {Object[]} args * @returns {string} */ - run_vigenere_enc: function (input, args) { + runVigenereEnc: function (input, args) { var alphabet = "abcdefghijklmnopqrstuvwxyz", key = args[0].toLowerCase(), output = "", fail = 0, - key_index, - msg_index, + keyIndex, + msgIndex, chr; if (!key) return "No key entered"; @@ -412,17 +412,17 @@ var Cipher = { // for chars not in alphabet chr = key[(i - fail) % key.length]; // Get the location in the vigenere square of the key char - key_index = alphabet.indexOf(chr); + keyIndex = alphabet.indexOf(chr); // Get the location in the vigenere square of the message char - msg_index = alphabet.indexOf(input[i]); + msgIndex = alphabet.indexOf(input[i]); // Get the encoded letter by finding the sum of indexes modulo 26 and finding // the letter corresponding to that - output += alphabet[(key_index + msg_index) % 26]; + output += alphabet[(keyIndex + msgIndex) % 26]; } else if (alphabet.indexOf(input[i].toLowerCase()) >= 0) { chr = key[(i - fail) % key.length].toLowerCase(); - key_index = alphabet.indexOf(chr); - msg_index = alphabet.indexOf(input[i].toLowerCase()); - output += alphabet[(key_index + msg_index) % 26].toUpperCase(); + keyIndex = alphabet.indexOf(chr); + msgIndex = alphabet.indexOf(input[i].toLowerCase()); + output += alphabet[(keyIndex + msgIndex) % 26].toUpperCase(); } else { output += input[i]; fail++; @@ -441,13 +441,13 @@ var Cipher = { * @param {Object[]} args * @returns {string} */ - run_vigenere_dec: function (input, args) { + runVigenereDec: function (input, args) { var alphabet = "abcdefghijklmnopqrstuvwxyz", key = args[0].toLowerCase(), output = "", fail = 0, - key_index, - msg_index, + keyIndex, + msgIndex, chr; if (!key) return "No key entered"; @@ -456,16 +456,16 @@ var Cipher = { for (var i = 0; i < input.length; i++) { if (alphabet.indexOf(input[i]) >= 0) { chr = key[(i - fail) % key.length]; - key_index = alphabet.indexOf(chr); - msg_index = alphabet.indexOf(input[i]); + keyIndex = alphabet.indexOf(chr); + msgIndex = alphabet.indexOf(input[i]); // Subtract indexes from each other, add 26 just in case the value is negative, // modulo to remove if neccessary - output += alphabet[(msg_index - key_index + alphabet.length ) % 26]; + output += alphabet[(msgIndex - keyIndex + alphabet.length ) % 26]; } else if (alphabet.indexOf(input[i].toLowerCase()) >= 0) { chr = key[(i - fail) % key.length].toLowerCase(); - key_index = alphabet.indexOf(chr); - msg_index = alphabet.indexOf(input[i].toLowerCase()); - output += alphabet[(msg_index + alphabet.length - key_index) % 26].toUpperCase(); + keyIndex = alphabet.indexOf(chr); + msgIndex = alphabet.indexOf(input[i].toLowerCase()); + output += alphabet[(msgIndex + alphabet.length - keyIndex) % 26].toUpperCase(); } else { output += input[i]; fail++; @@ -490,18 +490,18 @@ var Cipher = { /** * Substitute operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args - * @returns {byte_array} + * @returns {byteArray} */ - run_substitute: function (input, args) { - var plaintext = Utils.str_to_byte_array(Utils.expand_alph_range(args[0]).join()), - ciphertext = Utils.str_to_byte_array(Utils.expand_alph_range(args[1]).join()), + runSubstitute: function (input, args) { + var plaintext = Utils.strToByteArray(Utils.expandAlphRange(args[0]).join()), + ciphertext = Utils.strToByteArray(Utils.expandAlphRange(args[1]).join()), output = [], index = -1; if (plaintext.length !== ciphertext.length) { - output = Utils.str_to_byte_array("Warning: Plaintext and Ciphertext lengths differ\n\n"); + output = Utils.strToByteArray("Warning: Plaintext and Ciphertext lengths differ\n\n"); } for (var i = 0; i < input.length; i++) { diff --git a/src/js/operations/Code.js b/src/js/operations/Code.js index 3bea92a6..5213d950 100755 --- a/src/js/operations/Code.js +++ b/src/js/operations/Code.js @@ -29,10 +29,10 @@ var Code = { * @param {Object[]} args * @returns {html} */ - run_syntax_highlight: function(input, args) { + runSyntaxHighlight: function(input, args) { var language = args[0], - line_nums = args[1]; - return "" + prettyPrintOne(Utils.escape_html(input), language, line_nums) + ""; + lineNums = args[1]; + return "" + prettyPrintOne(Utils.escapeHtml(input), language, lineNums) + ""; }, @@ -49,9 +49,9 @@ var Code = { * @param {Object[]} args * @returns {string} */ - run_xml_beautify: function(input, args) { - var indent_str = args[0]; - return vkbeautify.xml(input, indent_str); + runXmlBeautify: function(input, args) { + var indentStr = args[0]; + return vkbeautify.xml(input, indentStr); }, @@ -62,10 +62,10 @@ var Code = { * @param {Object[]} args * @returns {string} */ - run_json_beautify: function(input, args) { - var indent_str = args[0]; + runJsonBeautify: function(input, args) { + var indentStr = args[0]; if (!input) return ""; - return vkbeautify.json(input, indent_str); + return vkbeautify.json(input, indentStr); }, @@ -76,9 +76,9 @@ var Code = { * @param {Object[]} args * @returns {string} */ - run_css_beautify: function(input, args) { - var indent_str = args[0]; - return vkbeautify.css(input, indent_str); + runCssBeautify: function(input, args) { + var indentStr = args[0]; + return vkbeautify.css(input, indentStr); }, @@ -89,9 +89,9 @@ var Code = { * @param {Object[]} args * @returns {string} */ - run_sql_beautify: function(input, args) { - var indent_str = args[0]; - return vkbeautify.sql(input, indent_str); + runSqlBeautify: function(input, args) { + var indentStr = args[0]; + return vkbeautify.sql(input, indentStr); }, @@ -108,9 +108,9 @@ var Code = { * @param {Object[]} args * @returns {string} */ - run_xml_minify: function(input, args) { - var preserve_comments = args[0]; - return vkbeautify.xmlmin(input, preserve_comments); + runXmlMinify: function(input, args) { + var preserveComments = args[0]; + return vkbeautify.xmlmin(input, preserveComments); }, @@ -121,7 +121,7 @@ var Code = { * @param {Object[]} args * @returns {string} */ - run_json_minify: function(input, args) { + runJsonMinify: function(input, args) { if (!input) return ""; return vkbeautify.jsonmin(input); }, @@ -134,9 +134,9 @@ var Code = { * @param {Object[]} args * @returns {string} */ - run_css_minify: function(input, args) { - var preserve_comments = args[0]; - return vkbeautify.cssmin(input, preserve_comments); + runCssMinify: function(input, args) { + var preserveComments = args[0]; + return vkbeautify.cssmin(input, preserveComments); }, @@ -147,7 +147,7 @@ var Code = { * @param {Object[]} args * @returns {string} */ - run_sql_minify: function(input, args) { + runSqlMinify: function(input, args) { return vkbeautify.sqlmin(input); }, @@ -175,48 +175,48 @@ var Code = { * @param {Object[]} args * @returns {string} */ - run_generic_beautify: function(input, args) { + runGenericBeautify: function(input, args) { var code = input, t = 0, - preserved_tokens = [], + preservedTokens = [], m; // Remove strings var sstrings = /'([^'\\]|\\.)*'/g; while ((m = sstrings.exec(code))) { - code = preserve_token(code, m, t++); + code = preserveToken(code, m, t++); sstrings.lastIndex = m.index; } var dstrings = /"([^"\\]|\\.)*"/g; while ((m = dstrings.exec(code))) { - code = preserve_token(code, m, t++); + code = preserveToken(code, m, t++); dstrings.lastIndex = m.index; } // Remove comments var scomments = /\/\/[^\n\r]*/g; while ((m = scomments.exec(code))) { - code = preserve_token(code, m, t++); + code = preserveToken(code, m, t++); scomments.lastIndex = m.index; } var mcomments = /\/\*[\s\S]*?\*\//gm; while ((m = mcomments.exec(code))) { - code = preserve_token(code, m, t++); + code = preserveToken(code, m, t++); mcomments.lastIndex = m.index; } var hcomments = /(^|\n)#[^\n\r#]+/g; while ((m = hcomments.exec(code))) { - code = preserve_token(code, m, t++); + code = preserveToken(code, m, t++); hcomments.lastIndex = m.index; } // Remove regexes var regexes = /\/.*?[^\\]\/[gim]{0,3}/gi; while ((m = regexes.exec(code))) { - code = preserve_token(code, m, t++); + code = preserveToken(code, m, t++); regexes.lastIndex = m.index; } @@ -287,19 +287,19 @@ var Code = { // Replace preserved tokens - var ptokens = /###preserved_token(\d+)###/g; + var ptokens = /###preservedToken(\d+)###/g; while ((m = ptokens.exec(code))) { var ti = parseInt(m[1], 10); - code = code.substring(0, m.index) + preserved_tokens[ti] + code.substring(m.index + m[0].length); + code = code.substring(0, m.index) + preservedTokens[ti] + code.substring(m.index + m[0].length); ptokens.lastIndex = m.index; } return code; - function preserve_token(str, match, t) { - preserved_tokens[t] = match[0]; + function preserveToken(str, match, t) { + preservedTokens[t] = match[0]; return str.substring(0, match.index) + - "###preserved_token" + t + "###" + + "###preservedToken" + t + "###" + str.substring(match.index + match[0].length); } }, @@ -325,7 +325,7 @@ var Code = { * @param {Object[]} args * @returns {string} */ - run_xpath:function(input, args) { + runXpath:function(input, args) { var query = args[0], delimiter = args[1]; @@ -344,7 +344,7 @@ var Code = { } var serializer = new XMLSerializer(); - var node_to_string = function(node) { + var nodeToString = function(node) { switch (node.nodeType) { case Node.ELEMENT_NODE: return serializer.serializeToString(node); case Node.ATTRIBUTE_NODE: return node.value; @@ -357,7 +357,7 @@ var Code = { return Object.keys(result).map(function(key) { return result[key]; }).slice(0, -1) // all values except last (length) - .map(node_to_string) + .map(nodeToString) .join(delimiter); }, @@ -382,7 +382,7 @@ var Code = { * @param {Object[]} args * @returns {string} */ - run_css_query: function(input, args) { + runCssQuery: function(input, args) { var query = args[0], delimiter = args[1]; @@ -400,7 +400,7 @@ var Code = { return "Invalid CSS Selector. Details:\n" + err.message; } - var node_to_string = function(node) { + var nodeToString = function(node) { switch (node.nodeType) { case Node.ELEMENT_NODE: return node.outerHTML; case Node.ATTRIBUTE_NODE: return node.value; @@ -415,7 +415,7 @@ var Code = { .map(function(_, i) { return result[i]; }) - .map(node_to_string) + .map(nodeToString) .join(delimiter); }, diff --git a/src/js/operations/Compress.js b/src/js/operations/Compress.js index 785f3633..b5a2e6a1 100755 --- a/src/js/operations/Compress.js +++ b/src/js/operations/Compress.js @@ -44,11 +44,11 @@ var Compress = { /** * Raw Deflate operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args - * @returns {byte_array} + * @returns {byteArray} */ - run_raw_deflate: function(input, args) { + runRawDeflate: function(input, args) { var deflate = new Zlib.RawDeflate(input, { compressionType: Compress.RAW_COMPRESSION_TYPE_LOOKUP[args[0]] }); @@ -81,20 +81,20 @@ var Compress = { * @default */ RAW_BUFFER_TYPE_LOOKUP: { - "Adaptive" : Zlib.RawInflate.BufferType.ADAPTIVE, - "Block" : Zlib.RawInflate.BufferType.BLOCK, + "Adaptive" : Zlib.RawInflate.BufferType.ADAPTIVE, + "Block" : Zlib.RawInflate.BufferType.BLOCK, }, /** * Raw Inflate operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args - * @returns {byte_array} + * @returns {byteArray} */ - run_raw_inflate: function(input, args) { + runRawInflate: function(input, args) { // Deal with character encoding issues - input = Utils.str_to_byte_array(Utils.byte_array_to_utf8(input)); + input = Utils.strToByteArray(Utils.byteArrayToUtf8(input)); var inflate = new Zlib.RawInflate(input, { index: args[0], bufferSize: args[1], @@ -140,11 +140,11 @@ var Compress = { /** * Zlib Deflate operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args - * @returns {byte_array} + * @returns {byteArray} */ - run_zlib_deflate: function(input, args) { + runZlibDeflate: function(input, args) { var deflate = new Zlib.Deflate(input, { compressionType: Compress.ZLIB_COMPRESSION_TYPE_LOOKUP[args[0]] }); @@ -164,13 +164,13 @@ var Compress = { /** * Zlib Inflate operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args - * @returns {byte_array} + * @returns {byteArray} */ - run_zlib_inflate: function(input, args) { + runZlibInflate: function(input, args) { // Deal with character encoding issues - input = Utils.str_to_byte_array(Utils.byte_array_to_utf8(input)); + input = Utils.strToByteArray(Utils.byteArrayToUtf8(input)); var inflate = new Zlib.Inflate(input, { index: args[0], bufferSize: args[1], @@ -191,11 +191,11 @@ var Compress = { /** * Gzip operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args - * @returns {byte_array} + * @returns {byteArray} */ - run_gzip: function(input, args) { + runGzip: function(input, args) { var filename = args[1], comment = args[2], options = { @@ -224,13 +224,13 @@ var Compress = { /** * Gunzip operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args - * @returns {byte_array} + * @returns {byteArray} */ - run_gunzip: function(input, args) { + runGunzip: function(input, args) { // Deal with character encoding issues - input = Utils.str_to_byte_array(Utils.byte_array_to_utf8(input)); + input = Utils.strToByteArray(Utils.byteArrayToUtf8(input)); var gunzip = new Zlib.Gunzip(input); return Array.prototype.slice.call(gunzip.decompress()); }, @@ -262,15 +262,15 @@ var Compress = { /** * Zip operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args - * @returns {byte_array} + * @returns {byteArray} */ - run_pkzip: function(input, args) { - var password = Utils.str_to_byte_array(args[2]), + runPkzip: function(input, args) { + var password = Utils.strToByteArray(args[2]), options = { - filename: Utils.str_to_byte_array(args[0]), - comment: Utils.str_to_byte_array(args[1]), + filename: Utils.strToByteArray(args[0]), + comment: Utils.strToByteArray(args[1]), compressionMethod: Compress.ZIP_COMPRESSION_METHOD_LOOKUP[args[3]], os: Compress.ZIP_OS_LOOKUP[args[4]], deflateOption: { @@ -295,13 +295,13 @@ var Compress = { /** * Unzip operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args * @returns {string} */ - run_pkunzip: function(input, args) { + runPkunzip: function(input, args) { var options = { - password: Utils.str_to_byte_array(args[0]), + password: Utils.strToByteArray(args[0]), verify: args[1] }, file = "", @@ -313,7 +313,7 @@ var Compress = { window.uzip = unzip; for (var i = 0; i < filenames.length; i++) { - file = Utils.byte_array_to_utf8(unzip.decompress(filenames[i])); + file = Utils.byteArrayToUtf8(unzip.decompress(filenames[i])); output += "
                                                                                                                                                                                                      " + "" + "
                                                                                                                                                                                                      " + "
                                                                                                                                                                                                      " + - Utils.escape_html(file) + "
                                                                                                                                                                                                      "; + Utils.escapeHtml(file) + ""; } return output + ""; @@ -332,17 +332,17 @@ var Compress = { /** * Bzip2 Decompress operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args * @returns {string} */ - run_bzip2_decompress: function(input, args) { + runBzip2Decompress: function(input, args) { var compressed = new Uint8Array(input), - bzip2_reader, + bzip2Reader, plain = ""; - bzip2_reader = bzip2.array(compressed); - plain = bzip2.simple(bzip2_reader); + bzip2Reader = bzip2.array(compressed); + plain = bzip2.simple(bzip2Reader); return plain; }, diff --git a/src/js/operations/Convert.js b/src/js/operations/Convert.js index 72e1a6e9..e10360ba 100755 --- a/src/js/operations/Convert.js +++ b/src/js/operations/Convert.js @@ -64,12 +64,12 @@ var Convert = { * @param {Object[]} args * @returns {number} */ - run_distance: function (input, args) { - var input_units = args[0], - output_units = args[1]; + runDistance: function (input, args) { + var inputUnits = args[0], + outputUnits = args[1]; - input = input * Convert.DISTANCE_FACTOR[input_units]; - return input / Convert.DISTANCE_FACTOR[output_units]; + input = input * Convert.DISTANCE_FACTOR[inputUnits]; + return input / Convert.DISTANCE_FACTOR[outputUnits]; // TODO Remove rounding errors (e.g. 1.000000000001) }, @@ -145,12 +145,12 @@ var Convert = { * @param {Object[]} args * @returns {number} */ - run_data_size: function (input, args) { - var input_units = args[0], - output_units = args[1]; + runDataSize: function (input, args) { + var inputUnits = args[0], + outputUnits = args[1]; - input = input * Convert.DATA_FACTOR[input_units]; - return input / Convert.DATA_FACTOR[output_units]; + input = input * Convert.DATA_FACTOR[inputUnits]; + return input / Convert.DATA_FACTOR[outputUnits]; }, @@ -225,12 +225,12 @@ var Convert = { * @param {Object[]} args * @returns {number} */ - run_area: function (input, args) { - var input_units = args[0], - output_units = args[1]; + runArea: function (input, args) { + var inputUnits = args[0], + outputUnits = args[1]; - input = input * Convert.AREA_FACTOR[input_units]; - return input / Convert.AREA_FACTOR[output_units]; + input = input * Convert.AREA_FACTOR[inputUnits]; + return input / Convert.AREA_FACTOR[outputUnits]; }, @@ -336,12 +336,12 @@ var Convert = { * @param {Object[]} args * @returns {number} */ - run_mass: function (input, args) { - var input_units = args[0], - output_units = args[1]; + runMass: function (input, args) { + var inputUnits = args[0], + outputUnits = args[1]; - input = input * Convert.MASS_FACTOR[input_units]; - return input / Convert.MASS_FACTOR[output_units]; + input = input * Convert.MASS_FACTOR[inputUnits]; + return input / Convert.MASS_FACTOR[outputUnits]; }, @@ -401,12 +401,12 @@ var Convert = { * @param {Object[]} args * @returns {number} */ - run_speed: function (input, args) { - var input_units = args[0], - output_units = args[1]; + runSpeed: function (input, args) { + var inputUnits = args[0], + outputUnits = args[1]; - input = input * Convert.SPEED_FACTOR[input_units]; - return input / Convert.SPEED_FACTOR[output_units]; + input = input * Convert.SPEED_FACTOR[inputUnits]; + return input / Convert.SPEED_FACTOR[outputUnits]; }, }; diff --git a/src/js/operations/DateTime.js b/src/js/operations/DateTime.js index f119978e..8e64f8f6 100755 --- a/src/js/operations/DateTime.js +++ b/src/js/operations/DateTime.js @@ -24,7 +24,7 @@ var DateTime = { * @param {Object[]} args * @returns {string} */ - run_from_unix_timestamp: function(input, args) { + runFromUnixTimestamp: function(input, args) { var units = args[0], d; @@ -55,7 +55,7 @@ var DateTime = { * @param {Object[]} args * @returns {number} */ - run_to_unix_timestamp: function(input, args) { + runToUnixTimestamp: function(input, args) { var units = args[0], d = moment(input); @@ -130,21 +130,21 @@ var DateTime = { * @param {Object[]} args * @returns {html} */ - run_translate_format: function(input, args) { - var input_format = args[1], - input_timezone = args[2], - output_format = args[3], - output_timezone = args[4], + runTranslateFormat: function(input, args) { + var inputFormat = args[1], + inputTimezone = args[2], + outputFormat = args[3], + outputTimezone = args[4], date; try { - date = moment.tz(input, input_format, input_timezone); + date = moment.tz(input, inputFormat, inputTimezone); if (!date || date.format() === "Invalid date") throw Error; } catch(err) { return "Invalid format.\n\n" + DateTime.FORMAT_EXAMPLES; } - return date.tz(output_timezone).format(output_format); + return date.tz(outputTimezone).format(outputFormat); }, @@ -155,14 +155,14 @@ var DateTime = { * @param {Object[]} args * @returns {html} */ - run_parse: function(input, args) { - var input_format = args[1], - input_timezone = args[2], + runParse: function(input, args) { + var inputFormat = args[1], + inputTimezone = args[2], date, output = ""; try { - date = moment.tz(input, input_format, input_timezone); + date = moment.tz(input, inputFormat, inputTimezone); if (!date || date.format() === "Invalid date") throw Error; } catch(err) { return "Invalid format.\n\n" + DateTime.FORMAT_EXAMPLES; diff --git a/src/js/operations/Endian.js b/src/js/operations/Endian.js index 13ce1ce6..c7cdf81d 100755 --- a/src/js/operations/Endian.js +++ b/src/js/operations/Endian.js @@ -32,39 +32,39 @@ var Endian = { * @param {Object[]} args * @returns {string} */ - run_swap_endianness: function(input, args) { - var data_format = args[0], - word_length = args[1], - pad_incomplete_words = args[2], + runSwapEndianness: function(input, args) { + var dataFormat = args[0], + wordLength = args[1], + padIncompleteWords = args[2], data = [], result = [], words = [], i = 0, j = 0; - if (word_length <= 0) { + if (wordLength <= 0) { return "Word length must be greater than 0"; } // Convert input to raw data based on specified data format - switch (data_format) { + switch (dataFormat) { case "Hex": - data = Utils.from_hex(input); + data = Utils.fromHex(input); break; case "Raw": - data = Utils.str_to_byte_array(input); + data = Utils.strToByteArray(input); break; default: data = input; } // Split up into words - for (i = 0; i < data.length; i += word_length) { - var word = data.slice(i, i + word_length); + for (i = 0; i < data.length; i += wordLength) { + var word = data.slice(i, i + wordLength); // Pad word if too short - if (pad_incomplete_words && word.length < word_length){ - for (j = word.length; j < word_length; j++) { + if (padIncompleteWords && word.length < wordLength){ + for (j = word.length; j < wordLength; j++) { word.push(0); } } @@ -81,11 +81,11 @@ var Endian = { } // Convert data back to specified data format - switch (data_format) { + switch (dataFormat) { case "Hex": - return Utils.to_hex(result); + return Utils.toHex(result); case "Raw": - return Utils.byte_array_to_utf8(result); + return Utils.byteArrayToUtf8(result); default: return result; } diff --git a/src/js/operations/Entropy.js b/src/js/operations/Entropy.js index cec9b3a1..8724c7c2 100755 --- a/src/js/operations/Entropy.js +++ b/src/js/operations/Entropy.js @@ -18,14 +18,14 @@ var Entropy = { /** * Entropy operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args * @returns {html} */ - run_entropy: function(input, args) { - var chunk_size = args[0], + runEntropy: function(input, args) { + var chunkSize = args[0], output = "", - entropy = Entropy._calc_entropy(input); + entropy = Entropy._calcEntropy(input); output += "Shannon entropy: " + entropy + "\n" + "

                                                                                                                                                                                                      \n" + @@ -35,14 +35,14 @@ var Entropy = { "The following results show the entropy of chunks of the input data. Chunks with particularly high entropy could suggest encrypted or compressed sections.\n\n" + "
                                                                                                                                                                                                      "; - var chunk_entropy = 0; - if (chunk_size !== 0) { - for (var i = 0; i < input.length; i += chunk_size) { - chunk_entropy = Entropy._calc_entropy(input.slice(i, i+chunk_size)); - output += "Bytes " + i + " to " + (i+chunk_size) + ": " + chunk_entropy + "\n"; + var chunkEntropy = 0; + if (chunkSize !== 0) { + for (var i = 0; i < input.length; i += chunkSize) { + chunkEntropy = Entropy._calcEntropy(input.slice(i, i+chunkSize)); + output += "Bytes " + i + " to " + (i+chunkSize) + ": " + chunkEntropy + "\n"; } } else { output += "Chunk size cannot be 0."; @@ -78,17 +78,17 @@ var Entropy = { /** * Frequency distribution operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args * @returns {html} */ - run_freq_distrib: function (input, args) { + runFreqDistrib: function (input, args) { if (!input.length) return "No data"; var distrib = new Array(256), percentages = new Array(256), len = input.length, - show_zeroes = args[0]; + showZeroes = args[0]; // Initialise distrib to 0 for (var i = 0; i < 256; i++) { @@ -115,19 +115,19 @@ var Entropy = { "\n\nByte Percentage\n" + ""; for (i = 0; i < 256; i++) { - if (distrib[i] || show_zeroes) { + if (distrib[i] || showZeroes) { output += " " + Utils.hex(i, 2) + " (" + - Utils.pad_right(percentages[i].toFixed(2).replace(".00", "") + "%)", 8) + + Utils.padRight(percentages[i].toFixed(2).replace(".00", "") + "%)", 8) + Array(Math.ceil(percentages[i])+1).join("|") + "\n"; } } @@ -140,13 +140,13 @@ var Entropy = { * Calculates the Shannon entropy for a given chunk of data. * * @private - * @param {byte_array} data + * @param {byteArray} data * @returns {number} */ - _calc_entropy: function(data) { + _calcEntropy: function(data) { var prob = [], uniques = data.unique(), - str = Utils.byte_array_to_chars(data); + str = Utils.byteArrayToChars(data); for (var i = 0; i < uniques.length; i++) { prob.push(str.count(Utils.chr(uniques[i])) / data.length); diff --git a/src/js/operations/Extract.js b/src/js/operations/Extract.js index 4af520bf..64390a3c 100755 --- a/src/js/operations/Extract.js +++ b/src/js/operations/Extract.js @@ -14,25 +14,25 @@ var Extract = { * * @private * @param {string} input - * @param {RegExp} search_regex - * @param {RegExp} remove_regex - A regular expression defining results to remove from the + * @param {RegExp} searchRegex + * @param {RegExp} removeRegex - A regular expression defining results to remove from the * final list - * @param {boolean} include_total - Whether or not to include the total number of results + * @param {boolean} includeTotal - Whether or not to include the total number of results * @returns {string} */ - _search: function(input, search_regex, remove_regex, include_total) { + _search: function(input, searchRegex, removeRegex, includeTotal) { var output = "", total = 0, match; - while ((match = search_regex.exec(input))) { - if (remove_regex && remove_regex.test(match[0])) + while ((match = searchRegex.exec(input))) { + if (removeRegex && removeRegex.test(match[0])) continue; total++; output += match[0] + "\n"; } - if (include_total) + if (includeTotal) output = "Total found: " + total + "\n\n" + output; return output; @@ -57,13 +57,13 @@ var Extract = { * @param {Object[]} args * @returns {string} */ - run_strings: function(input, args) { - var min_len = args[0] || Extract.MIN_STRING_LEN, - display_total = args[1], + runStrings: function(input, args) { + var minLen = args[0] || Extract.MIN_STRING_LEN, + displayTotal = args[1], strings = "[A-Z\\d/\\-:.,_$%'\"()<>= !\\[\\]{}@]", - regex = new RegExp(strings + "{" + min_len + ",}", "ig"); + regex = new RegExp(strings + "{" + minLen + ",}", "ig"); - return Extract._search(input, regex, null, display_total); + return Extract._search(input, regex, null, displayTotal); }, @@ -90,37 +90,37 @@ var Extract = { * @param {Object[]} args * @returns {string} */ - run_ip: function(input, args) { - var include_ipv4 = args[0], - include_ipv6 = args[1], - remove_local = args[2], - display_total = args[3], + runIp: function(input, args) { + var includeIpv4 = args[0], + includeIpv6 = args[1], + removeLocal = args[2], + displayTotal = args[3], ipv4 = "(?:(?:\\d|[01]?\\d\\d|2[0-4]\\d|25[0-5])\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d|\\d)(?:\\/\\d{1,2})?", ipv6 = "((?=.*::)(?!.*::.+::)(::)?([\\dA-F]{1,4}:(:|\\b)|){5}|([\\dA-F]{1,4}:){6})((([\\dA-F]{1,4}((?!\\3)::|:\\b|(?![\\dA-F])))|(?!\\2\\3)){2}|(((2[0-4]|1\\d|[1-9])?\\d|25[0-5])\\.?\\b){4})", ips = ""; - if (include_ipv4 && include_ipv6) { + if (includeIpv4 && includeIpv6) { ips = ipv4 + "|" + ipv6; - } else if (include_ipv4) { + } else if (includeIpv4) { ips = ipv4; - } else if (include_ipv6) { + } else if (includeIpv6) { ips = ipv6; } if (ips) { var regex = new RegExp(ips, "ig"); - if (remove_local) { + if (removeLocal) { var ten = "10\\..+", oneninetwo = "192\\.168\\..+", oneseventwo = "172\\.(?:1[6-9]|2\\d|3[01])\\..+", onetwoseven = "127\\..+", - remove_regex = new RegExp("^(?:" + ten + "|" + oneninetwo + + removeRegex = new RegExp("^(?:" + ten + "|" + oneninetwo + "|" + oneseventwo + "|" + onetwoseven + ")"); - return Extract._search(input, regex, remove_regex, display_total); + return Extract._search(input, regex, removeRegex, displayTotal); } else { - return Extract._search(input, regex, null, display_total); + return Extract._search(input, regex, null, displayTotal); } } else { return ""; @@ -135,11 +135,11 @@ var Extract = { * @param {Object[]} args * @returns {string} */ - run_email: function(input, args) { - var display_total = args[0], + runEmail: function(input, args) { + var displayTotal = args[0], regex = /\w[-.\w]*@[-\w]+(?:\.[-\w]+)*\.[A-Z]{2,4}/ig; - return Extract._search(input, regex, null, display_total); + return Extract._search(input, regex, null, displayTotal); }, @@ -150,11 +150,11 @@ var Extract = { * @param {Object[]} args * @returns {string} */ - run_mac: function(input, args) { - var display_total = args[0], + runMac: function(input, args) { + var displayTotal = args[0], regex = /[A-F\d]{2}(?:[:-][A-F\d]{2}){5}/ig; - return Extract._search(input, regex, null, display_total); + return Extract._search(input, regex, null, displayTotal); }, @@ -165,8 +165,8 @@ var Extract = { * @param {Object[]} args * @returns {string} */ - run_urls: function(input, args) { - var display_total = args[0], + runUrls: function(input, args) { + var displayTotal = args[0], protocol = "[A-Z]+://", hostname = "[-\\w]+(?:\\.\\w[-\\w]*)+", port = ":\\d+", @@ -175,7 +175,7 @@ var Extract = { path += "(?:[.!,?]+[^.!,?;\"'<>()\\[\\]{}\\s\\x7F-\\xFF]+)*"; var regex = new RegExp(protocol + hostname + "(?:" + port + ")?(?:" + path + ")?", "ig"); - return Extract._search(input, regex, null, display_total); + return Extract._search(input, regex, null, displayTotal); }, @@ -186,14 +186,14 @@ var Extract = { * @param {Object[]} args * @returns {string} */ - run_domains: function(input, args) { - var display_total = args[0], + runDomains: function(input, args) { + var displayTotal = args[0], protocol = "https?://", hostname = "[-\\w\\.]+", tld = "\\.(?:com|net|org|biz|info|co|uk|onion|int|mobi|name|edu|gov|mil|eu|ac|ae|af|de|ca|ch|cn|cy|es|gb|hk|il|in|io|tv|me|nl|no|nz|ro|ru|tr|us|az|ir|kz|uz|pk)+", regex = new RegExp("(?:" + protocol + ")?" + hostname + tld, "ig"); - return Extract._search(input, regex, null, display_total); + return Extract._search(input, regex, null, displayTotal); }, @@ -215,29 +215,29 @@ var Extract = { * @param {Object[]} args * @returns {string} */ - run_file_paths: function(input, args) { - var include_win_path = args[0], - include_unix_path = args[1], - display_total = args[2], - win_drive = "[A-Z]:\\\\", - win_name = "[A-Z\\d][A-Z\\d\\- '_\\(\\)]{0,61}", - win_ext = "[A-Z\\d]{1,6}", - win_path = win_drive + "(?:" + win_name + "\\\\?)*" + win_name + - "(?:\\." + win_ext + ")?", - unix_path = "(?:/[A-Z\\d.][A-Z\\d\\-.]{0,61})+", - file_paths = ""; + runFilePaths: function(input, args) { + var includeWinPath = args[0], + includeUnixPath = args[1], + displayTotal = args[2], + winDrive = "[A-Z]:\\\\", + winName = "[A-Z\\d][A-Z\\d\\- '_\\(\\)]{0,61}", + winExt = "[A-Z\\d]{1,6}", + winPath = winDrive + "(?:" + winName + "\\\\?)*" + winName + + "(?:\\." + winExt + ")?", + unixPath = "(?:/[A-Z\\d.][A-Z\\d\\-.]{0,61})+", + filePaths = ""; - if (include_win_path && include_unix_path) { - file_paths = win_path + "|" + unix_path; - } else if (include_win_path) { - file_paths = win_path; - } else if (include_unix_path) { - file_paths = unix_path; + if (includeWinPath && includeUnixPath) { + filePaths = winPath + "|" + unixPath; + } else if (includeWinPath) { + filePaths = winPath; + } else if (includeUnixPath) { + filePaths = unixPath; } - if (file_paths) { - var regex = new RegExp(file_paths, "ig"); - return Extract._search(input, regex, null, display_total); + if (filePaths) { + var regex = new RegExp(filePaths, "ig"); + return Extract._search(input, regex, null, displayTotal); } else { return ""; } @@ -251,14 +251,14 @@ var Extract = { * @param {Object[]} args * @returns {string} */ - run_dates: function(input, args) { - var display_total = args[0], + runDates: function(input, args) { + var displayTotal = args[0], date1 = "(?:19|20)\\d\\d[- /.](?:0[1-9]|1[012])[- /.](?:0[1-9]|[12][0-9]|3[01])", // yyyy-mm-dd date2 = "(?:0[1-9]|[12][0-9]|3[01])[- /.](?:0[1-9]|1[012])[- /.](?:19|20)\\d\\d", // dd/mm/yyyy date3 = "(?:0[1-9]|1[012])[- /.](?:0[1-9]|[12][0-9]|3[01])[- /.](?:19|20)\\d\\d", // mm/dd/yyyy regex = new RegExp(date1 + "|" + date2 + "|" + date3, "ig"); - return Extract._search(input, regex, null, display_total); + return Extract._search(input, regex, null, displayTotal); }, @@ -269,28 +269,28 @@ var Extract = { * @param {Object[]} args * @returns {string} */ - run_all_idents: function(input, args) { + runAllIdents: function(input, args) { var output = ""; output += "IP addresses\n"; - output += Extract.run_ip(input, [true, true, false]); + output += Extract.runIp(input, [true, true, false]); output += "\nEmail addresses\n"; - output += Extract.run_email(input, []); + output += Extract.runEmail(input, []); output += "\nMAC addresses\n"; - output += Extract.run_mac(input, []); + output += Extract.runMac(input, []); output += "\nURLs\n"; - output += Extract.run_urls(input, []); + output += Extract.runUrls(input, []); output += "\nDomain names\n"; - output += Extract.run_domains(input, []); + output += Extract.runDomains(input, []); output += "\nFile paths\n"; - output += Extract.run_file_paths(input, [true, true]); + output += Extract.runFilePaths(input, [true, true]); output += "\nDates\n"; - output += Extract.run_dates(input, []); + output += Extract.runDates(input, []); return output; }, diff --git a/src/js/operations/FileType.js b/src/js/operations/FileType.js index 6e2088f4..c265e418 100755 --- a/src/js/operations/FileType.js +++ b/src/js/operations/FileType.js @@ -12,12 +12,12 @@ var FileType = { /** * Detect File Type operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args * @returns {string} */ - run_detect: function(input, args) { - var type = FileType._magic_type(input); + runDetect: function(input, args) { + var type = FileType._magicType(input); if (!type) { return "Unknown file type. Have you tried checking the entropy of this data to determine whether it might be encrypted or compressed?"; @@ -43,26 +43,26 @@ var FileType = { /** * Scan for Embedded Files operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args * @returns {string} */ - run_scan_for_embedded_files: function(input, args) { + runScanForEmbeddedFiles: function(input, args) { var output = "Scanning data for 'magic bytes' which may indicate embedded files. The following results may be false positives and should not be treat as reliable. Any suffiently long file is likely to contain these magic bytes coincidentally.\n", type, - ignore_common = args[0], - common_exts = ["ico", "ttf", ""], - num_found = 0, - num_common_found = 0; + ignoreCommon = args[0], + commonExts = ["ico", "ttf", ""], + numFound = 0, + numCommonFound = 0; for (var i = 0; i < input.length; i++) { - type = FileType._magic_type(input.slice(i)); + type = FileType._magicType(input.slice(i)); if (type) { - if (ignore_common && common_exts.indexOf(type.ext) > -1) { - num_common_found++; + if (ignoreCommon && commonExts.indexOf(type.ext) > -1) { + numCommonFound++; continue; } - num_found++; + numFound++; output += "\nOffset " + i + " (0x" + Utils.hex(i) + "):\n" + " File extension: " + type.ext + "\n" + " MIME type: " + type.mime + "\n"; @@ -73,13 +73,13 @@ var FileType = { } } - if (num_found === 0) { + if (numFound === 0) { output += "\nNo embedded files were found."; } - if (num_common_found > 0) { - output += "\n\n" + num_common_found; - output += num_common_found === 1 ? + if (numCommonFound > 0) { + output += "\n\n" + numCommonFound; + output += numCommonFound === 1 ? " file type was detected that has a common byte sequence. This is likely to be a false positive." : " file types were detected that have common byte sequences. These are likely to be false positives."; output += " Run this operation with the 'Ignore common byte sequences' option unchecked to see details."; @@ -94,13 +94,13 @@ var FileType = { * extension and mime type. * * @private - * @param {byte_array} buf + * @param {byteArray} buf * @returns {Object} type * @returns {string} type.ext - File extension * @returns {string} type.mime - Mime type * @returns {string} [type.desc] - Description */ - _magic_type: function (buf) { + _magicType: function (buf) { if (!(buf && buf.length > 1)) { return null; } diff --git a/src/js/operations/HTML.js b/src/js/operations/HTML.js index 0cb7c2dc..c07d43f0 100755 --- a/src/js/operations/HTML.js +++ b/src/js/operations/HTML.js @@ -27,35 +27,35 @@ var HTML = { * @param {Object[]} args * @returns {string} */ - run_to_entity: function(input, args) { - var convert_all = args[0], + runToEntity: function(input, args) { + var convertAll = args[0], numeric = args[1] === "Numeric entities", hexa = args[1] === "Hex entities"; - var charcodes = Utils.str_to_charcode(input); + var charcodes = Utils.strToCharcode(input); var output = ""; for (var i = 0; i < charcodes.length; i++) { - if (convert_all && numeric) { + if (convertAll && numeric) { output += "&#" + charcodes[i] + ";"; - } else if (convert_all && hexa) { + } else if (convertAll && hexa) { output += "&#x" + Utils.hex(charcodes[i]) + ";"; - } else if (convert_all) { - output += HTML._byte_to_entity[charcodes[i]] || "&#" + charcodes[i] + ";"; + } else if (convertAll) { + output += HTML._byteToEntity[charcodes[i]] || "&#" + charcodes[i] + ";"; } else if (numeric) { - if (charcodes[i] > 255 || HTML._byte_to_entity.hasOwnProperty(charcodes[i])) { + if (charcodes[i] > 255 || HTML._byteToEntity.hasOwnProperty(charcodes[i])) { output += "&#" + charcodes[i] + ";"; } else { output += Utils.chr(charcodes[i]); } } else if (hexa) { - if (charcodes[i] > 255 || HTML._byte_to_entity.hasOwnProperty(charcodes[i])) { + if (charcodes[i] > 255 || HTML._byteToEntity.hasOwnProperty(charcodes[i])) { output += "&#x" + Utils.hex(charcodes[i]) + ";"; } else { output += Utils.chr(charcodes[i]); } } else { - output += HTML._byte_to_entity[charcodes[i]] || ( + output += HTML._byteToEntity[charcodes[i]] || ( charcodes[i] > 255 ? "&#" + charcodes[i] + ";" : Utils.chr(charcodes[i]) @@ -73,7 +73,7 @@ var HTML = { * @param {Object[]} args * @returns {string} */ - run_from_entity: function(input, args) { + runFromEntity: function(input, args) { var regex = /&(#?x?[a-zA-Z0-9]{1,8});/g, output = "", m, @@ -85,7 +85,7 @@ var HTML = { output += input[i++]; // Add match - var bite = HTML._entity_to_byte[m[1]]; + var bite = HTML._entityToByte[m[1]]; if (bite) { output += Utils.chr(bite); } else if (!bite && m[1][0] === "#" && m[1].length > 1 && /^#\d{1,5}$/.test(m[1])) { @@ -130,17 +130,17 @@ var HTML = { * @param {Object[]} args * @returns {string} */ - run_strip_tags: function(input, args) { - var remove_indentation = args[0], - remove_line_breaks = args[1]; + runStripTags: function(input, args) { + var removeIndentation = args[0], + removeLineBreaks = args[1]; - input = Utils.strip_html_tags(input); + input = Utils.stripHtmlTags(input); - if (remove_indentation) { + if (removeIndentation) { input = input.replace(/\n[ \f\t]+/g, "\n"); } - if (remove_line_breaks) { + if (removeLineBreaks) { input = input.replace(/^\s*\n/, "") // first line .replace(/(\n\s*){2,}/g, "\n"); // all others } @@ -156,7 +156,7 @@ var HTML = { * @param {Object[]} args * @returns {html} */ - run_parse_colour_code: function(input, args) { + runParseColourCode: function(input, args) { var m = null, r = 0, g = 0, b = 0, a = 1; @@ -177,7 +177,7 @@ var HTML = { var h_ = parseFloat(m[1]) / 360, s_ = parseFloat(m[2]) / 100, l_ = parseFloat(m[3]) / 100, - rgb_ = HTML._hsl_to_rgb(h_, s_, l_); + rgb_ = HTML._hslToRgb(h_, s_, l_); r = rgb_[0]; g = rgb_[1]; @@ -195,7 +195,7 @@ var HTML = { b = Math.round(255 * (1 - y_) * (1 - k_)); } - var hsl_ = HTML._rgb_to_hsl(r, g, b), + var hsl_ = HTML._rgbToHsl(r, g, b), h = Math.round(hsl_[0] * 360), s = Math.round(hsl_[1] * 100), l = Math.round(hsl_[2] * 100), @@ -210,9 +210,9 @@ var HTML = { k = k.toFixed(2); var hex = "#" + - Utils.pad_left(Math.round(r).toString(16), 2) + - Utils.pad_left(Math.round(g).toString(16), 2) + - Utils.pad_left(Math.round(b).toString(16), 2), + Utils.padLeft(Math.round(r).toString(16), 2) + + Utils.padLeft(Math.round(g).toString(16), 2) + + Utils.padLeft(Math.round(b).toString(16), 2), rgb = "rgb(" + r + ", " + g + ", " + b + ")", rgba = "rgba(" + r + ", " + g + ", " + b + ", " + a + ")", hsl = "hsl(" + h + ", " + s + "%, " + l + "%)", @@ -237,7 +237,7 @@ var HTML = { var color = e.color.toRGB();\ document.getElementById('input-text').value = 'rgba(' +\ color.r + ', ' + color.g + ', ' + color.b + ', ' + color.a + ')';\ - window.app.auto_bake();\ + window.app.autoBake();\ });\ "; }, @@ -246,7 +246,7 @@ var HTML = { /** * Converts an HSL color value to RGB. Conversion formula - * adapted from http://en.wikipedia.org/wiki/HSL_color_space. + * adapted from http://en.wikipedia.org/wiki/HSL_colorSpace. * Assumes h, s, and l are contained in the set [0, 1] and * returns r, g, and b in the set [0, 255]. * @@ -258,7 +258,7 @@ var HTML = { * @param {number} l - The lightness * @return {Array} The RGB representation */ - _hsl_to_rgb: function(h, s, l){ + _hslToRgb: function(h, s, l){ var r, g, b; if (s === 0){ @@ -286,7 +286,7 @@ var HTML = { /** * Converts an RGB color value to HSL. Conversion formula - * adapted from http://en.wikipedia.org/wiki/HSL_color_space. + * adapted from http://en.wikipedia.org/wiki/HSL_colorSpace. * Assumes r, g, and b are contained in the set [0, 255] and * returns h, s, and l in the set [0, 1]. * @@ -298,7 +298,7 @@ var HTML = { * @param {number} b - The blue color value * @return {Array} The HSL representation */ - _rgb_to_hsl: function(r, g, b) { + _rgbToHsl: function(r, g, b) { r /= 255; g /= 255; b /= 255; var max = Math.max(r, g, b), min = Math.min(r, g, b), @@ -327,7 +327,7 @@ var HTML = { * @private * @constant */ - _byte_to_entity: { + _byteToEntity: { 34 : """, 38 : "&", 39 : "'", @@ -591,7 +591,7 @@ var HTML = { * @private * @constant */ - _entity_to_byte : { + _entityToByte : { "quot" : 34, "amp" : 38, "apos" : 39, diff --git a/src/js/operations/HTTP.js b/src/js/operations/HTTP.js index 5b3dcf2d..23ab44e8 100755 --- a/src/js/operations/HTTP.js +++ b/src/js/operations/HTTP.js @@ -18,11 +18,11 @@ var HTTP = { * @param {Object[]} args * @returns {string} */ - run_strip_headers: function(input, args) { - var header_end = input.indexOf("\r\n\r\n") + - (header_end < 0) ? input.indexOf("\n\n") + 2 : header_end + 4; + runStripHeaders: function(input, args) { + var headerEnd = input.indexOf("\r\n\r\n") + + (headerEnd < 0) ? input.indexOf("\n\n") + 2 : headerEnd + 4; - return (header_end < 2) ? input : input.slice(header_end, input.length); + return (headerEnd < 2) ? input : input.slice(headerEnd, input.length); }, @@ -33,8 +33,8 @@ var HTTP = { * @param {Object[]} args * @returns {string} */ - run_parse_user_agent: function(input, args) { - var ua = UAS_parser.parse(input); + runParseUserAgent: function(input, args) { + var ua = UAS_parser.parse(input); // eslint-disable-line camelcase return "Type: " + ua.type + "\n" + "Family: " + ua.uaFamily + "\n" + diff --git a/src/js/operations/Hash.js b/src/js/operations/Hash.js index 49725bfd..2d43e3de 100755 --- a/src/js/operations/Hash.js +++ b/src/js/operations/Hash.js @@ -18,8 +18,8 @@ var Hash = { * @param {Object[]} args * @returns {string} */ - run_md2: function (input, args) { - return Utils.to_hex_fast(CryptoApi.hash("md2", input, {})); + runMD2: function (input, args) { + return Utils.toHexFast(CryptoApi.hash("md2", input, {})); }, @@ -30,8 +30,8 @@ var Hash = { * @param {Object[]} args * @returns {string} */ - run_md4: function (input, args) { - return Utils.to_hex_fast(CryptoApi.hash("md4", input, {})); + runMD4: function (input, args) { + return Utils.toHexFast(CryptoApi.hash("md4", input, {})); }, @@ -42,7 +42,7 @@ var Hash = { * @param {Object[]} args * @returns {string} */ - run_md5: function (input, args) { + runMD5: function (input, args) { input = CryptoJS.enc.Latin1.parse(input); // Cast to WordArray return CryptoJS.MD5(input).toString(CryptoJS.enc.Hex); }, @@ -55,8 +55,8 @@ var Hash = { * @param {Object[]} args * @returns {string} */ - run_sha0: function (input, args) { - return Utils.to_hex_fast(CryptoApi.hash("sha0", input, {})); + runSHA0: function (input, args) { + return Utils.toHexFast(CryptoApi.hash("sha0", input, {})); }, @@ -67,7 +67,7 @@ var Hash = { * @param {Object[]} args * @returns {string} */ - run_sha1: function (input, args) { + runSHA1: function (input, args) { input = CryptoJS.enc.Latin1.parse(input); return CryptoJS.SHA1(input).toString(CryptoJS.enc.Hex); }, @@ -80,7 +80,7 @@ var Hash = { * @param {Object[]} args * @returns {string} */ - run_sha224: function (input, args) { + runSHA224: function (input, args) { input = CryptoJS.enc.Latin1.parse(input); return CryptoJS.SHA224(input).toString(CryptoJS.enc.Hex); }, @@ -93,7 +93,7 @@ var Hash = { * @param {Object[]} args * @returns {string} */ - run_sha256: function (input, args) { + runSHA256: function (input, args) { input = CryptoJS.enc.Latin1.parse(input); return CryptoJS.SHA256(input).toString(CryptoJS.enc.Hex); }, @@ -106,7 +106,7 @@ var Hash = { * @param {Object[]} args * @returns {string} */ - run_sha384: function (input, args) { + runSHA384: function (input, args) { input = CryptoJS.enc.Latin1.parse(input); return CryptoJS.SHA384(input).toString(CryptoJS.enc.Hex); }, @@ -119,7 +119,7 @@ var Hash = { * @param {Object[]} args * @returns {string} */ - run_sha512: function (input, args) { + runSHA512: function (input, args) { input = CryptoJS.enc.Latin1.parse(input); return CryptoJS.SHA512(input).toString(CryptoJS.enc.Hex); }, @@ -138,11 +138,11 @@ var Hash = { * @param {Object[]} args * @returns {string} */ - run_sha3: function (input, args) { + runSHA3: function (input, args) { input = CryptoJS.enc.Latin1.parse(input); - var sha3_length = args[0], + var sha3Length = args[0], options = { - outputLength: parseInt(sha3_length, 10) + outputLength: parseInt(sha3Length, 10) }; return CryptoJS.SHA3(input, options).toString(CryptoJS.enc.Hex); }, @@ -155,7 +155,7 @@ var Hash = { * @param {Object[]} args * @returns {string} */ - run_ripemd160: function (input, args) { + runRIPEMD160: function (input, args) { input = CryptoJS.enc.Latin1.parse(input); return CryptoJS.RIPEMD160(input).toString(CryptoJS.enc.Hex); }, @@ -174,8 +174,8 @@ var Hash = { * @param {Object[]} args * @returns {string} */ - run_hmac: function (input, args) { - var hash_func = args[1]; + runHMAC: function (input, args) { + var hashFunc = args[1]; input = CryptoJS.enc.Latin1.parse(input); var execute = { "MD5": CryptoJS.HmacMD5(input, args[0]), @@ -187,7 +187,7 @@ var Hash = { "SHA3": CryptoJS.HmacSHA3(input, args[0]), "RIPEMD-160": CryptoJS.HmacRIPEMD160(input, args[0]), }; - return execute[hash_func].toString(CryptoJS.enc.Hex); + return execute[hashFunc].toString(CryptoJS.enc.Hex); }, @@ -198,29 +198,29 @@ var Hash = { * @param {Object[]} args * @returns {string} */ - run_all: function (input, args) { - var byte_array = Utils.str_to_byte_array(input), - output = "MD2: " + Hash.run_md2(input, []) + - "\nMD4: " + Hash.run_md4(input, []) + - "\nMD5: " + Hash.run_md5(input, []) + - "\nSHA0: " + Hash.run_sha0(input, []) + - "\nSHA1: " + Hash.run_sha1(input, []) + - "\nSHA2 224: " + Hash.run_sha224(input, []) + - "\nSHA2 256: " + Hash.run_sha256(input, []) + - "\nSHA2 384: " + Hash.run_sha384(input, []) + - "\nSHA2 512: " + Hash.run_sha512(input, []) + - "\nSHA3 224: " + Hash.run_sha3(input, ["224"]) + - "\nSHA3 256: " + Hash.run_sha3(input, ["256"]) + - "\nSHA3 384: " + Hash.run_sha3(input, ["384"]) + - "\nSHA3 512: " + Hash.run_sha3(input, ["512"]) + - "\nRIPEMD-160: " + Hash.run_ripemd160(input, []) + + runAll: function (input, args) { + var byteArray = Utils.strToByteArray(input), + output = "MD2: " + Hash.runMD2(input, []) + + "\nMD4: " + Hash.runMD4(input, []) + + "\nMD5: " + Hash.runMD5(input, []) + + "\nSHA0: " + Hash.runSHA0(input, []) + + "\nSHA1: " + Hash.runSHA1(input, []) + + "\nSHA2 224: " + Hash.runSHA224(input, []) + + "\nSHA2 256: " + Hash.runSHA256(input, []) + + "\nSHA2 384: " + Hash.runSHA384(input, []) + + "\nSHA2 512: " + Hash.runSHA512(input, []) + + "\nSHA3 224: " + Hash.runSHA3(input, ["224"]) + + "\nSHA3 256: " + Hash.runSHA3(input, ["256"]) + + "\nSHA3 384: " + Hash.runSHA3(input, ["384"]) + + "\nSHA3 512: " + Hash.runSHA3(input, ["512"]) + + "\nRIPEMD-160: " + Hash.runRIPEMD160(input, []) + "\n\nChecksums:" + - "\nFletcher-8: " + Checksum.run_fletcher8(byte_array, []) + - "\nFletcher-16: " + Checksum.run_fletcher16(byte_array, []) + - "\nFletcher-32: " + Checksum.run_fletcher32(byte_array, []) + - "\nFletcher-64: " + Checksum.run_fletcher64(byte_array, []) + - "\nAdler-32: " + Checksum.run_adler32(byte_array, []) + - "\nCRC-32: " + Checksum.run_crc32(byte_array, []); + "\nFletcher-8: " + Checksum.runFletcher8(byteArray, []) + + "\nFletcher-16: " + Checksum.runFletcher16(byteArray, []) + + "\nFletcher-32: " + Checksum.runFletcher32(byteArray, []) + + "\nFletcher-64: " + Checksum.runFletcher64(byteArray, []) + + "\nAdler-32: " + Checksum.runAdler32(byteArray, []) + + "\nCRC-32: " + Checksum.runCRC32(byteArray, []); return output; }, @@ -233,38 +233,38 @@ var Hash = { * @param {Object[]} args * @returns {string} */ - run_analyse: function(input, args) { + runAnalyse: function(input, args) { input = input.replace(/\s/g, ""); var output = "", - byte_length = input.length / 2, - bit_length = byte_length * 8, - possible_hash_functions = []; + byteLength = input.length / 2, + bitLength = byteLength * 8, + possibleHashFunctions = []; if (!/^[a-f0-9]+$/i.test(input)) { return "Invalid hash"; } output += "Hash length: " + input.length + "\n" + - "Byte length: " + byte_length + "\n" + - "Bit length: " + bit_length + "\n\n" + + "Byte length: " + byteLength + "\n" + + "Bit length: " + bitLength + "\n\n" + "Based on the length, this hash could have been generated by one of the following hashing functions:\n"; - switch (bit_length) { + switch (bitLength) { case 4: - possible_hash_functions = [ + possibleHashFunctions = [ "Fletcher-4", "Luhn algorithm", "Verhoeff algorithm", ]; break; case 8: - possible_hash_functions = [ + possibleHashFunctions = [ "Fletcher-8", ]; break; case 16: - possible_hash_functions = [ + possibleHashFunctions = [ "BSD checksum", "CRC-16", "SYSV checksum", @@ -272,21 +272,21 @@ var Hash = { ]; break; case 32: - possible_hash_functions = [ + possibleHashFunctions = [ "CRC-32", "Fletcher-32", "Adler-32", ]; break; case 64: - possible_hash_functions = [ + possibleHashFunctions = [ "CRC-64", "RIPEMD-64", "SipHash", ]; break; case 128: - possible_hash_functions = [ + possibleHashFunctions = [ "MD5", "MD4", "MD2", @@ -297,7 +297,7 @@ var Hash = { ]; break; case 160: - possible_hash_functions = [ + possibleHashFunctions = [ "SHA-1", "SHA-0", "FSB-160", @@ -308,13 +308,13 @@ var Hash = { ]; break; case 192: - possible_hash_functions = [ + possibleHashFunctions = [ "Tiger", "HAVAL-192", ]; break; case 224: - possible_hash_functions = [ + possibleHashFunctions = [ "SHA-224", "SHA3-224", "ECOH-224", @@ -323,7 +323,7 @@ var Hash = { ]; break; case 256: - possible_hash_functions = [ + possibleHashFunctions = [ "SHA-256", "SHA3-256", "BLAKE-256", @@ -338,12 +338,12 @@ var Hash = { ]; break; case 320: - possible_hash_functions = [ + possibleHashFunctions = [ "RIPEMD-320", ]; break; case 384: - possible_hash_functions = [ + possibleHashFunctions = [ "SHA-384", "SHA3-384", "ECOH-384", @@ -351,7 +351,7 @@ var Hash = { ]; break; case 512: - possible_hash_functions = [ + possibleHashFunctions = [ "SHA-512", "SHA3-512", "BLAKE-512", @@ -366,18 +366,18 @@ var Hash = { ]; break; case 1024: - possible_hash_functions = [ + possibleHashFunctions = [ "Fowler-Noll-Vo", ]; break; default: - possible_hash_functions = [ + possibleHashFunctions = [ "Unknown" ]; break; } - return output + possible_hash_functions.join("\n"); + return output + possibleHashFunctions.join("\n"); }, }; diff --git a/src/js/operations/Hexdump.js b/src/js/operations/Hexdump.js index a4153811..fba95414 100755 --- a/src/js/operations/Hexdump.js +++ b/src/js/operations/Hexdump.js @@ -30,14 +30,14 @@ var Hexdump = { /** * To Hexdump operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args * @returns {string} */ - run_to: function(input, args) { + runTo: function(input, args) { var length = args[0] || Hexdump.WIDTH; - var upper_case = args[1]; - var include_final_length = args[2]; + var upperCase = args[1]; + var includeFinalLength = args[2]; var output = "", padding = 2; for (var i = 0; i < input.length; i += length) { @@ -47,18 +47,18 @@ var Hexdump = { hexa += Utils.hex(buff[j], padding) + " "; } - var line_no = Utils.hex(i, 8); + var lineNo = Utils.hex(i, 8); - if (upper_case) { + if (upperCase) { hexa = hexa.toUpperCase(); - line_no = line_no.toUpperCase(); + lineNo = lineNo.toUpperCase(); } - output += line_no + " " + - Utils.pad_right(hexa, (length*(padding+1))) + - " |" + Utils.pad_right(Utils.printable(Utils.byte_array_to_chars(buff)), buff.length) + "|\n"; + output += lineNo + " " + + Utils.padRight(hexa, (length*(padding+1))) + + " |" + Utils.padRight(Utils.printable(Utils.byteArrayToChars(buff)), buff.length) + "|\n"; - if (include_final_length && i+buff.length === input.length) { + if (includeFinalLength && i+buff.length === input.length) { output += Utils.hex(i+buff.length, 8) + "\n"; } } @@ -72,15 +72,15 @@ var Hexdump = { * * @param {string} input * @param {Object[]} args - * @returns {byte_array} + * @returns {byteArray} */ - run_from: function(input, args) { + runFrom: function(input, args) { var output = [], regex = /^\s*(?:[\dA-F]{4,16}:?)?\s*((?:[\dA-F]{2}\s){1,8}(?:\s|[\dA-F]{2}-)(?:[\dA-F]{2}\s){1,8}|(?:[\dA-F]{2}\s|[\dA-F]{4}\s)+)/igm, block, line; while ((block = regex.exec(input))) { - line = Utils.from_hex(block[1].replace(/-/g, " ")); + line = Utils.fromHex(block[1].replace(/-/g, " ")); for (var i = 0; i < line.length; i++) { output.push(line[i]); } @@ -90,7 +90,7 @@ var Hexdump = { var w = (width - 13) / 4; // w should be the specified width of the hexdump and therefore a round number if (Math.floor(w) !== w || input.indexOf("\r") !== -1 || output.indexOf(13) !== -1) { - app.options.attempt_highlight = false; + app.options.attemptHighlight = false; } return output; }, @@ -105,7 +105,7 @@ var Hexdump = { * @param {Object[]} args * @returns {Object[]} pos */ - highlight_to: function(pos, args) { + highlightTo: function(pos, args) { // Calculate overall selection var w = args[0] || 16, width = 14 + (w*4), @@ -125,32 +125,32 @@ var Hexdump = { pos[0].end = line*width + 10 + offset*3 - 1; // Set up multiple selections for bytes - var start_line_num = Math.floor(pos[0].start / width); - var end_line_num = Math.floor(pos[0].end / width); + var startLineNum = Math.floor(pos[0].start / width); + var endLineNum = Math.floor(pos[0].end / width); - if (start_line_num === end_line_num) { + if (startLineNum === endLineNum) { pos.push(pos[0]); } else { start = pos[0].start; - end = (start_line_num+1) * width - w - 5; + end = (startLineNum+1) * width - w - 5; pos.push({ start: start, end: end }); while (end < pos[0].end) { - start_line_num++; - start = start_line_num * width + 10; - end = (start_line_num+1) * width - w - 5; + startLineNum++; + start = startLineNum * width + 10; + end = (startLineNum+1) * width - w - 5; if (end > pos[0].end) end = pos[0].end; pos.push({ start: start, end: end }); } } // Set up multiple selections for ASCII - var len = pos.length, line_num = 0; + var len = pos.length, lineNum = 0; start = 0; end = 0; for (var i = 1; i < len; i++) { - line_num = Math.floor(pos[i].start / width); - start = (((pos[i].start - (line_num * width)) - 10) / 3) + (width - w -2) + (line_num * width); - end = (((pos[i].end + 1 - (line_num * width)) - 10) / 3) + (width - w -2) + (line_num * width); + lineNum = Math.floor(pos[i].start / width); + start = (((pos[i].start - (lineNum * width)) - 10) / 3) + (width - w -2) + (lineNum * width); + end = (((pos[i].end + 1 - (lineNum * width)) - 10) / 3) + (width - w -2) + (lineNum * width); pos.push({ start: start, end: end }); } return pos; @@ -166,7 +166,7 @@ var Hexdump = { * @param {Object[]} args * @returns {Object[]} pos */ - highlight_from: function(pos, args) { + highlightFrom: function(pos, args) { var w = args[0] || 16; var width = 14 + (w*4); diff --git a/src/js/operations/IP.js b/src/js/operations/IP.js index 03155f84..122027b0 100755 --- a/src/js/operations/IP.js +++ b/src/js/operations/IP.js @@ -34,26 +34,26 @@ var IP = { * @param {Object[]} args * @returns {string} */ - run_parse_ip_range: function (input, args) { - var include_network_info = args[0], - enumerate_addresses = args[1], - allow_large_list = args[2]; + runParseIpRange: function (input, args) { + var includeNetworkInfo = args[0], + enumerateAddresses = args[1], + allowLargeList = args[2]; // Check what type of input we are looking at - var ipv4_cidr_regex = /^\s*((?:\d{1,3}\.){3}\d{1,3})\/(\d\d?)\s*$/, - ipv4_range_regex = /^\s*((?:\d{1,3}\.){3}\d{1,3})\s*-\s*((?:\d{1,3}\.){3}\d{1,3})\s*$/, - ipv6_cidr_regex = /^\s*(((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\4)::|:\b|(?![\dA-F])))|(?!\3\4)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4}))\/(\d\d?\d?)\s*$/i, - ipv6_range_regex = /^\s*(((?=.*::)(?!.*::[^-]+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\4)::|:\b|(?![\dA-F])))|(?!\3\4)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4}))\s*-\s*(((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\17)::|:\b|(?![\dA-F])))|(?!\16\17)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4}))\s*$/i, + var ipv4CidrRegex = /^\s*((?:\d{1,3}\.){3}\d{1,3})\/(\d\d?)\s*$/, + ipv4RangeRegex = /^\s*((?:\d{1,3}\.){3}\d{1,3})\s*-\s*((?:\d{1,3}\.){3}\d{1,3})\s*$/, + ipv6CidrRegex = /^\s*(((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\4)::|:\b|(?![\dA-F])))|(?!\3\4)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4}))\/(\d\d?\d?)\s*$/i, + ipv6RangeRegex = /^\s*(((?=.*::)(?!.*::[^-]+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\4)::|:\b|(?![\dA-F])))|(?!\3\4)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4}))\s*-\s*(((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\17)::|:\b|(?![\dA-F])))|(?!\16\17)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4}))\s*$/i, match; - if ((match = ipv4_cidr_regex.exec(input))) { - return IP._ipv4_cidr_range(match, include_network_info, enumerate_addresses, allow_large_list); - } else if ((match = ipv4_range_regex.exec(input))) { - return IP._ipv4_hyphenated_range(match, include_network_info, enumerate_addresses, allow_large_list); - } else if ((match = ipv6_cidr_regex.exec(input))) { - return IP._ipv6_cidr_range(match, include_network_info); - } else if ((match = ipv6_range_regex.exec(input))) { - return IP._ipv6_hyphenated_range(match, include_network_info); + if ((match = ipv4CidrRegex.exec(input))) { + return IP._ipv4CidrRange(match, includeNetworkInfo, enumerateAddresses, allowLargeList); + } else if ((match = ipv4RangeRegex.exec(input))) { + return IP._ipv4HyphenatedRange(match, includeNetworkInfo, enumerateAddresses, allowLargeList); + } else if ((match = ipv6CidrRegex.exec(input))) { + return IP._ipv6CidrRange(match, includeNetworkInfo); + } else if ((match = ipv6RangeRegex.exec(input))) { + return IP._ipv6HyphenatedRange(match, includeNetworkInfo); } else { return "Invalid input.\n\nEnter either a CIDR range (e.g. 10.0.0.0/24) or a hyphenated range (e.g. 10.0.0.0 - 10.0.1.0). IPv6 also supported."; } @@ -64,12 +64,12 @@ var IP = { * @constant * @default */ - IPv4_REGEX: /^\s*((?:\d{1,3}\.){3}\d{1,3})\s*$/, + IPV4_REGEX: /^\s*((?:\d{1,3}\.){3}\d{1,3})\s*$/, /** * @constant * @default */ - IPv6_REGEX: /^\s*(((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\4)::|:\b|(?![\dA-F])))|(?!\3\4)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4}))\s*$/i, + IPV6_REGEX: /^\s*(((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\4)::|:\b|(?![\dA-F])))|(?!\3\4)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4}))\s*$/i, /** * Parse IPv6 address operation. @@ -78,14 +78,14 @@ var IP = { * @param {Object[]} args * @returns {string} */ - run_parse_ipv6: function (input, args) { + runParseIpv6: function (input, args) { var match, output = ""; - if ((match = IP.IPv6_REGEX.exec(input))) { - var ipv6 = IP._str_to_ipv6(match[1]), - longhand = IP._ipv6_to_str(ipv6), - shorthand = IP._ipv6_to_str(ipv6, true); + if ((match = IP.IPV6_REGEX.exec(input))) { + var ipv6 = IP._strToIpv6(match[1]), + longhand = IP._ipv6ToStr(ipv6), + shorthand = IP._ipv6ToStr(ipv6, true); output += "Longhand: " + longhand + "\nShorthand: " + shorthand + "\n"; @@ -102,13 +102,13 @@ var IP = { ipv6[3] === 0 && ipv6[4] === 0 && ipv6[5] === 0xffff) { // IPv4-mapped IPv6 address output += "\nIPv4-mapped IPv6 address detected. IPv6 clients will be handled natively by default, and IPv4 clients appear as IPv6 clients at their IPv4-mapped IPv6 address."; - output += "\nMapped IPv4 address: " + IP._ipv4_to_str((ipv6[6] << 16) + ipv6[7]); + output += "\nMapped IPv4 address: " + IP._ipv4ToStr((ipv6[6] << 16) + ipv6[7]); output += "\nIPv4-mapped IPv6 addresses range: ::ffff:0:0/96"; } else if (ipv6[0] === 0 && ipv6[1] === 0 && ipv6[2] === 0 && ipv6[3] === 0 && ipv6[4] === 0xffff && ipv6[5] === 0) { // IPv4-translated address output += "\nIPv4-translated address detected. Used by Stateless IP/ICMP Translation (SIIT). See RFCs 6145 and 6052 for more details."; - output += "\nTranslated IPv4 address: " + IP._ipv4_to_str((ipv6[6] << 16) + ipv6[7]); + output += "\nTranslated IPv4 address: " + IP._ipv4ToStr((ipv6[6] << 16) + ipv6[7]); output += "\nIPv4-translated addresses range: ::ffff:0:0:0/96"; } else if (ipv6[0] === 0x100) { // Discard prefix per RFC 6666 @@ -118,50 +118,50 @@ var IP = { ipv6[3] === 0 && ipv6[4] === 0 && ipv6[5] === 0) { // IPv4/IPv6 translation per RFC 6052 output += "\n'Well-Known' prefix for IPv4/IPv6 translation detected. See RFC 6052 for more details."; - output += "\nTranslated IPv4 address: " + IP._ipv4_to_str((ipv6[6] << 16) + ipv6[7]); + output += "\nTranslated IPv4 address: " + IP._ipv4ToStr((ipv6[6] << 16) + ipv6[7]); output += "\n'Well-Known prefix range: 64:ff9b::/96"; } else if (ipv6[0] === 0x2001 && ipv6[1] === 0) { // Teredo tunneling output += "\nTeredo tunneling IPv6 address detected\n"; - var server_ipv4 = (ipv6[2] << 16) + ipv6[3], - udp_port = (~ipv6[5]) & 0xffff, - client_ipv4 = ~((ipv6[6] << 16) + ipv6[7]), - flag_cone = (ipv6[4] >>> 15) & 1, - flag_r = (ipv6[4] >>> 14) & 1, - flag_random1 = (ipv6[4] >>> 10) & 15, - flag_ug = (ipv6[4] >>> 8) & 3, - flag_random2 = ipv6[4] & 255; + var serverIpv4 = (ipv6[2] << 16) + ipv6[3], + udpPort = (~ipv6[5]) & 0xffff, + clientIpv4 = ~((ipv6[6] << 16) + ipv6[7]), + flagCone = (ipv6[4] >>> 15) & 1, + flagR = (ipv6[4] >>> 14) & 1, + flagRandom1 = (ipv6[4] >>> 10) & 15, + flagUg = (ipv6[4] >>> 8) & 3, + flagRandom2 = ipv6[4] & 255; - output += "\nServer IPv4 address: " + IP._ipv4_to_str(server_ipv4) + - "\nClient IPv4 address: " + IP._ipv4_to_str(client_ipv4) + - "\nClient UDP port: " + udp_port + + output += "\nServer IPv4 address: " + IP._ipv4ToStr(serverIpv4) + + "\nClient IPv4 address: " + IP._ipv4ToStr(clientIpv4) + + "\nClient UDP port: " + udpPort + "\nFlags:" + - "\n\tCone: " + flag_cone; + "\n\tCone: " + flagCone; - if (flag_cone) { + if (flagCone) { output += " (Client is behind a cone NAT)"; } else { output += " (Client is not behind a cone NAT)"; } - output += "\n\tR: " + flag_r; + output += "\n\tR: " + flagR; - if (flag_r) { + if (flagR) { output += " Error: This flag should be set to 0. See RFC 5991 and RFC 4380."; } - output += "\n\tRandom1: " + Utils.bin(flag_random1, 4) + - "\n\tUG: " + Utils.bin(flag_ug, 2); + output += "\n\tRandom1: " + Utils.bin(flagRandom1, 4) + + "\n\tUG: " + Utils.bin(flagUg, 2); - if (flag_ug) { + if (flagUg) { output += " Error: This flag should be set to 00. See RFC 4380."; } - output += "\n\tRandom2: " + Utils.bin(flag_random2, 8); + output += "\n\tRandom2: " + Utils.bin(flagRandom2, 8); - if (!flag_r && !flag_ug && flag_random1 && flag_random2) { + if (!flagR && !flagUg && flagRandom1 && flagRandom2) { output += "\n\nThis is a valid Teredo address which complies with RFC 4380 and RFC 5991."; - } else if (!flag_r && !flag_ug) { + } else if (!flagR && !flagUg) { output += "\n\nThis is a valid Teredo address which complies with RFC 4380, however it does not comply with RFC 5991 (Teredo Security Updates) as there are no randomised bits in the flag field."; } else { output += "\n\nThis is an invalid Teredo address."; @@ -187,15 +187,15 @@ var IP = { output += "\n6to4 transition IPv6 address detected. See RFC 3056 for more details." + "\n6to4 prefix range: 2002::/16"; - var v4_addr = IP._ipv4_to_str((ipv6[1] << 16) + ipv6[2]), - sla_id = ipv6[3], - interface_id_str = ipv6[4].toString(16) + ipv6[5].toString(16) + ipv6[6].toString(16) + ipv6[7].toString(16), - interface_id = new BigInteger(interface_id_str, 16); + var v4Addr = IP._ipv4ToStr((ipv6[1] << 16) + ipv6[2]), + slaId = ipv6[3], + interfaceIdStr = ipv6[4].toString(16) + ipv6[5].toString(16) + ipv6[6].toString(16) + ipv6[7].toString(16), + interfaceId = new BigInteger(interfaceIdStr, 16); - output += "\n\nEncapsulated IPv4 address: " + v4_addr + - "\nSLA ID: " + sla_id + - "\nInterface ID (base 16): " + interface_id_str + - "\nInterface ID (base 10): " + interface_id.toString(); + output += "\n\nEncapsulated IPv4 address: " + v4Addr + + "\nSLA ID: " + slaId + + "\nInterface ID (base 16): " + interfaceIdStr + + "\nInterface ID (base 10): " + interfaceId.toString(); } else if (ipv6[0] >= 0xfc00 && ipv6[0] <= 0xfdff) { // Unique local address output += "\nThis is a unique local address comparable to the IPv4 private addresses 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. See RFC 4193 for more details."; @@ -229,9 +229,9 @@ var IP = { * @param {Object[]} args * @returns {string} */ - run_change_ip_format: function(input, args) { - var in_format = args[0], - out_format = args[1], + runChangeIpFormat: function(input, args) { + var inFormat = args[0], + outFormat = args[1], lines = input.split("\n"), output = "", j = 0; @@ -239,54 +239,54 @@ var IP = { for (var i = 0; i < lines.length; i++) { if (lines[i] === "") continue; - var ba_ip = []; + var baIp = []; - if (in_format === out_format) { + if (inFormat === outFormat) { output += lines[i] + "\n"; continue; } // Convert to byte array IP from input format - switch (in_format) { + switch (inFormat) { case "Dotted Decimal": var octets = lines[i].split("."); for (j = 0; j < octets.length; j++) { - ba_ip.push(parseInt(octets[j], 10)); + baIp.push(parseInt(octets[j], 10)); } break; case "Decimal": var decimal = lines[i].toString(); - ba_ip.push(decimal >> 24 & 255); - ba_ip.push(decimal >> 16 & 255); - ba_ip.push(decimal >> 8 & 255); - ba_ip.push(decimal & 255); + baIp.push(decimal >> 24 & 255); + baIp.push(decimal >> 16 & 255); + baIp.push(decimal >> 8 & 255); + baIp.push(decimal & 255); break; case "Hex": - ba_ip = Utils.hex_to_byte_array(lines[i]); + baIp = Utils.hexToByteArray(lines[i]); break; default: throw "Unsupported input IP format"; } // Convert byte array IP to output format - switch (out_format) { + switch (outFormat) { case "Dotted Decimal": - var dd_ip = ""; - for (j = 0; j < ba_ip.length; j++) { - dd_ip += ba_ip[j] + "."; + var ddIp = ""; + for (j = 0; j < baIp.length; j++) { + ddIp += baIp[j] + "."; } - output += dd_ip.slice(0, dd_ip.length-1) + "\n"; + output += ddIp.slice(0, ddIp.length-1) + "\n"; break; case "Decimal": - var dec_ip = ((ba_ip[0] << 24) | (ba_ip[1] << 16) | (ba_ip[2] << 8) | ba_ip[3]) >>> 0; - output += dec_ip.toString() + "\n"; + var decIp = ((baIp[0] << 24) | (baIp[1] << 16) | (baIp[2] << 8) | baIp[3]) >>> 0; + output += decIp.toString() + "\n"; break; case "Hex": - var hex_ip = ""; - for (j = 0; j < ba_ip.length; j++) { - hex_ip += Utils.hex(ba_ip[j]); + var hexIp = ""; + for (j = 0; j < baIp.length; j++) { + hexIp += Utils.hex(baIp[j]); } - output += hex_ip + "\n"; + output += hexIp + "\n"; break; default: throw "Unsupported output IP format"; @@ -320,20 +320,20 @@ var IP = { * @param {Object[]} args * @returns {string} */ - run_group_ips: function(input, args) { - var delim = Utils.char_rep[args[0]], + runGroupIps: function(input, args) { + var delim = Utils.charRep[args[0]], cidr = args[1], - only_subnets = args[2], - ipv4_mask = cidr < 32 ? ~(0xFFFFFFFF >>> cidr) : 0xFFFFFFFF, - ipv6_mask = IP._gen_ipv6_mask(cidr), + onlySubnets = args[2], + ipv4Mask = cidr < 32 ? ~(0xFFFFFFFF >>> cidr) : 0xFFFFFFFF, + ipv6Mask = IP._genIpv6Mask(cidr), ips = input.split(delim), - ipv4_networks = {}, - ipv6_networks = {}, + ipv4Networks = {}, + ipv6Networks = {}, match = null, output = "", ip = null, network = null, - network_str = ""; + networkStr = ""; if (cidr < 0 || cidr > 127) { return "CIDR must be less than 32 for IPv4 or 128 for IPv6"; @@ -341,57 +341,57 @@ var IP = { // Parse all IPs and add to network dictionary for (var i = 0; i < ips.length; i++) { - if ((match = IP.IPv4_REGEX.exec(ips[i]))) { - ip = IP._str_to_ipv4(match[1]) >>> 0; - network = ip & ipv4_mask; + if ((match = IP.IPV4_REGEX.exec(ips[i]))) { + ip = IP._strToIpv4(match[1]) >>> 0; + network = ip & ipv4Mask; - if (ipv4_networks.hasOwnProperty(network)) { - ipv4_networks[network].push(ip); + if (ipv4Networks.hasOwnProperty(network)) { + ipv4Networks[network].push(ip); } else { - ipv4_networks[network] = [ip]; + ipv4Networks[network] = [ip]; } - } else if ((match = IP.IPv6_REGEX.exec(ips[i]))) { - ip = IP._str_to_ipv6(match[1]); + } else if ((match = IP.IPV6_REGEX.exec(ips[i]))) { + ip = IP._strToIpv6(match[1]); network = []; - network_str = ""; + networkStr = ""; for (var j = 0; j < 8; j++) { - network.push(ip[j] & ipv6_mask[j]); + network.push(ip[j] & ipv6Mask[j]); } - network_str = IP._ipv6_to_str(network, true); + networkStr = IP._ipv6ToStr(network, true); - if (ipv6_networks.hasOwnProperty(network_str)) { - ipv6_networks[network_str].push(ip); + if (ipv6Networks.hasOwnProperty(networkStr)) { + ipv6Networks[networkStr].push(ip); } else { - ipv6_networks[network_str] = [ip]; + ipv6Networks[networkStr] = [ip]; } } } // Sort IPv4 network dictionaries and print - for (network in ipv4_networks) { - ipv4_networks[network] = ipv4_networks[network].sort(); + for (network in ipv4Networks) { + ipv4Networks[network] = ipv4Networks[network].sort(); - output += IP._ipv4_to_str(network) + "/" + cidr + "\n"; + output += IP._ipv4ToStr(network) + "/" + cidr + "\n"; - if (!only_subnets) { - for (i = 0; i < ipv4_networks[network].length; i++) { - output += " " + IP._ipv4_to_str(ipv4_networks[network][i]) + "\n"; + if (!onlySubnets) { + for (i = 0; i < ipv4Networks[network].length; i++) { + output += " " + IP._ipv4ToStr(ipv4Networks[network][i]) + "\n"; } output += "\n"; } } // Sort IPv6 network dictionaries and print - for (network_str in ipv6_networks) { - //ipv6_networks[network_str] = ipv6_networks[network_str].sort(); TODO + for (networkStr in ipv6Networks) { + //ipv6Networks[networkStr] = ipv6Networks[networkStr].sort(); TODO - output += network_str + "/" + cidr + "\n"; + output += networkStr + "/" + cidr + "\n"; - if (!only_subnets) { - for (i = 0; i < ipv6_networks[network_str].length; i++) { - output += " " + IP._ipv6_to_str(ipv6_networks[network_str][i], true) + "\n"; + if (!onlySubnets) { + for (i = 0; i < ipv6Networks[networkStr].length; i++) { + output += " " + IP._ipv6ToStr(ipv6Networks[networkStr][i], true) + "\n"; } output += "\n"; } @@ -413,35 +413,35 @@ var IP = { * * @private * @param {RegExp} cidr - * @param {boolean} include_network_info - * @param {boolean} enumerate_addresses - * @param {boolean} allow_large_list + * @param {boolean} includeNetworkInfo + * @param {boolean} enumerateAddresses + * @param {boolean} allowLargeList * @returns {string} */ - _ipv4_cidr_range: function(cidr, include_network_info, enumerate_addresses, allow_large_list) { + _ipv4CidrRange: function(cidr, includeNetworkInfo, enumerateAddresses, allowLargeList) { var output = "", - network = IP._str_to_ipv4(cidr[1]), - cidr_range = parseInt(cidr[2], 10); + network = IP._strToIpv4(cidr[1]), + cidrRange = parseInt(cidr[2], 10); - if (cidr_range < 0 || cidr_range > 31) { + if (cidrRange < 0 || cidrRange > 31) { return "IPv4 CIDR must be less than 32"; } - var mask = ~(0xFFFFFFFF >>> cidr_range), + var mask = ~(0xFFFFFFFF >>> cidrRange), ip1 = network & mask, ip2 = ip1 | ~mask; - if (include_network_info) { - output += "Network: " + IP._ipv4_to_str(network) + "\n"; - output += "CIDR: " + cidr_range + "\n"; - output += "Mask: " + IP._ipv4_to_str(mask) + "\n"; - output += "Range: " + IP._ipv4_to_str(ip1) + " - " + IP._ipv4_to_str(ip2) + "\n"; + if (includeNetworkInfo) { + output += "Network: " + IP._ipv4ToStr(network) + "\n"; + output += "CIDR: " + cidrRange + "\n"; + output += "Mask: " + IP._ipv4ToStr(mask) + "\n"; + output += "Range: " + IP._ipv4ToStr(ip1) + " - " + IP._ipv4ToStr(ip2) + "\n"; output += "Total addresses in range: " + (((ip2 - ip1) >>> 0) + 1) + "\n\n"; } - if (enumerate_addresses) { - if (cidr_range >= 16 || allow_large_list) { - output += IP._generate_ipv4_range(ip1, ip2).join("\n"); + if (enumerateAddresses) { + if (cidrRange >= 16 || allowLargeList) { + output += IP._generateIpv4Range(ip1, ip2).join("\n"); } else { output += IP._LARGE_RANGE_ERROR; } @@ -455,42 +455,42 @@ var IP = { * * @private * @param {RegExp} cidr - * @param {boolean} include_network_info + * @param {boolean} includeNetworkInfo * @returns {string} */ - _ipv6_cidr_range: function(cidr, include_network_info) { + _ipv6CidrRange: function(cidr, includeNetworkInfo) { var output = "", - network = IP._str_to_ipv6(cidr[1]), - cidr_range = parseInt(cidr[cidr.length-1], 10); + network = IP._strToIpv6(cidr[1]), + cidrRange = parseInt(cidr[cidr.length-1], 10); - if (cidr_range < 0 || cidr_range > 127) { + if (cidrRange < 0 || cidrRange > 127) { return "IPv6 CIDR must be less than 128"; } - var mask = IP._gen_ipv6_mask(cidr_range), + var mask = IP._genIpv6Mask(cidrRange), ip1 = new Array(8), ip2 = new Array(8), - total_diff = "", + totalDiff = "", total = new Array(128); for (var i = 0; i < 8; i++) { ip1[i] = network[i] & mask[i]; ip2[i] = ip1[i] | (~mask[i] & 0x0000FFFF); - total_diff = (ip2[i] - ip1[i]).toString(2); + totalDiff = (ip2[i] - ip1[i]).toString(2); - if (total_diff !== "0") { - for (var n = 0; n < total_diff.length; n++) { - total[i*16 + 16-(total_diff.length-n)] = total_diff[n]; + if (totalDiff !== "0") { + for (var n = 0; n < totalDiff.length; n++) { + total[i*16 + 16-(totalDiff.length-n)] = totalDiff[n]; } } } - if (include_network_info) { - output += "Network: " + IP._ipv6_to_str(network) + "\n"; - output += "Shorthand: " + IP._ipv6_to_str(network, true) + "\n"; - output += "CIDR: " + cidr_range + "\n"; - output += "Mask: " + IP._ipv6_to_str(mask) + "\n"; - output += "Range: " + IP._ipv6_to_str(ip1) + " - " + IP._ipv6_to_str(ip2) + "\n"; + if (includeNetworkInfo) { + output += "Network: " + IP._ipv6ToStr(network) + "\n"; + output += "Shorthand: " + IP._ipv6ToStr(network, true) + "\n"; + output += "CIDR: " + cidrRange + "\n"; + output += "Mask: " + IP._ipv6ToStr(mask) + "\n"; + output += "Range: " + IP._ipv6ToStr(ip1) + " - " + IP._ipv6ToStr(ip2) + "\n"; output += "Total addresses in range: " + (parseInt(total.join(""), 2) + 1) + "\n\n"; } @@ -505,7 +505,7 @@ var IP = { * @param {number} cidr * @returns {number[]} */ - _gen_ipv6_mask: function(cidr) { + _genIpv6Mask: function(cidr) { var mask = new Array(8), shift; @@ -529,15 +529,15 @@ var IP = { * * @private * @param {RegExp} range - * @param {boolean} include_network_info - * @param {boolean} enumerate_addresses - * @param {boolean} allow_large_list + * @param {boolean} includeNetworkInfo + * @param {boolean} enumerateAddresses + * @param {boolean} allowLargeList * @returns {string} */ - _ipv4_hyphenated_range: function(range, include_network_info, enumerate_addresses, allow_large_list) { + _ipv4HyphenatedRange: function(range, includeNetworkInfo, enumerateAddresses, allowLargeList) { var output = "", - ip1 = IP._str_to_ipv4(range[1]), - ip2 = IP._str_to_ipv4(range[2]); + ip1 = IP._strToIpv4(range[1]), + ip2 = IP._strToIpv4(range[2]); // Calculate mask var diff = ip1 ^ ip2, @@ -552,23 +552,23 @@ var IP = { mask = ~mask >>> 0; var network = ip1 & mask, - sub_ip1 = network & mask, - sub_ip2 = sub_ip1 | ~mask; + subIp1 = network & mask, + subIp2 = subIp1 | ~mask; - if (include_network_info) { + if (includeNetworkInfo) { output += "Minimum subnet required to hold this range:\n"; - output += "\tNetwork: " + IP._ipv4_to_str(network) + "\n"; + output += "\tNetwork: " + IP._ipv4ToStr(network) + "\n"; output += "\tCIDR: " + cidr + "\n"; - output += "\tMask: " + IP._ipv4_to_str(mask) + "\n"; - output += "\tSubnet range: " + IP._ipv4_to_str(sub_ip1) + " - " + IP._ipv4_to_str(sub_ip2) + "\n"; - output += "\tTotal addresses in subnet: " + (((sub_ip2 - sub_ip1) >>> 0) + 1) + "\n\n"; - output += "Range: " + IP._ipv4_to_str(ip1) + " - " + IP._ipv4_to_str(ip2) + "\n"; + output += "\tMask: " + IP._ipv4ToStr(mask) + "\n"; + output += "\tSubnet range: " + IP._ipv4ToStr(subIp1) + " - " + IP._ipv4ToStr(subIp2) + "\n"; + output += "\tTotal addresses in subnet: " + (((subIp2 - subIp1) >>> 0) + 1) + "\n\n"; + output += "Range: " + IP._ipv4ToStr(ip1) + " - " + IP._ipv4ToStr(ip2) + "\n"; output += "Total addresses in range: " + (((ip2 - ip1) >>> 0) + 1) + "\n\n"; } - if (enumerate_addresses) { - if (((ip2 - ip1) >>> 0) <= 65536 || allow_large_list) { - output += IP._generate_ipv4_range(ip1, ip2).join("\n"); + if (enumerateAddresses) { + if (((ip2 - ip1) >>> 0) <= 65536 || allowLargeList) { + output += IP._generateIpv4Range(ip1, ip2).join("\n"); } else { output += IP._LARGE_RANGE_ERROR; } @@ -582,13 +582,13 @@ var IP = { * * @private * @param {RegExp} range - * @param {boolean} include_network_info + * @param {boolean} includeNetworkInfo * @returns {string} */ - _ipv6_hyphenated_range: function(range, include_network_info) { + _ipv6HyphenatedRange: function(range, includeNetworkInfo) { var output = "", - ip1 = IP._str_to_ipv6(range[1]), - ip2 = IP._str_to_ipv6(range[14]); + ip1 = IP._strToIpv6(range[1]), + ip2 = IP._strToIpv6(range[14]); var t = "", total = new Array(128); @@ -606,9 +606,9 @@ var IP = { } } - if (include_network_info) { - output += "Range: " + IP._ipv6_to_str(ip1) + " - " + IP._ipv6_to_str(ip2) + "\n"; - output += "Shorthand range: " + IP._ipv6_to_str(ip1, true) + " - " + IP._ipv6_to_str(ip2, true) + "\n"; + if (includeNetworkInfo) { + output += "Range: " + IP._ipv6ToStr(ip1) + " - " + IP._ipv6ToStr(ip2) + "\n"; + output += "Shorthand range: " + IP._ipv6ToStr(ip1, true) + " - " + IP._ipv6ToStr(ip2, true) + "\n"; output += "Total addresses in range: " + (parseInt(total.join(""), 2) + 1) + "\n\n"; } @@ -620,36 +620,36 @@ var IP = { * Converts an IPv4 address from string format to numerical format. * * @private - * @param {string} ip_str + * @param {string} ipStr * @returns {number} * * @example * // returns 168427520 - * IP._str_to_ipv4("10.10.0.0"); + * IP._strToIpv4("10.10.0.0"); */ - _str_to_ipv4: function (ip_str) { - var blocks = ip_str.split("."), - num_blocks = parse_blocks(blocks), + _strToIpv4: function (ipStr) { + var blocks = ipStr.split("."), + numBlocks = parseBlocks(blocks), result = 0; - result += num_blocks[0] << 24; - result += num_blocks[1] << 16; - result += num_blocks[2] << 8; - result += num_blocks[3]; + result += numBlocks[0] << 24; + result += numBlocks[1] << 16; + result += numBlocks[2] << 8; + result += numBlocks[3]; return result; - function parse_blocks(blocks) { + function parseBlocks(blocks) { if (blocks.length !== 4) throw "More than 4 blocks."; - var num_blocks = []; + var numBlocks = []; for (var i = 0; i < 4; i++) { - num_blocks[i] = parseInt(blocks[i], 10); - if (num_blocks[i] < 0 || num_blocks[i] > 255) + numBlocks[i] = parseInt(blocks[i], 10); + if (numBlocks[i] < 0 || numBlocks[i] > 255) throw "Block out of range."; } - return num_blocks; + return numBlocks; } }, @@ -658,18 +658,18 @@ var IP = { * Converts an IPv4 address from numerical format to string format. * * @private - * @param {number} ip_int + * @param {number} ipInt * @returns {string} * * @example * // returns "10.10.0.0" - * IP._ipv4_to_str(168427520); + * IP._ipv4ToStr(168427520); */ - _ipv4_to_str: function(ip_int) { - var blockA = (ip_int >> 24) & 255, - blockB = (ip_int >> 16) & 255, - blockC = (ip_int >> 8) & 255, - blockD = ip_int & 255; + _ipv4ToStr: function(ipInt) { + var blockA = (ipInt >> 24) & 255, + blockB = (ipInt >> 16) & 255, + blockC = (ipInt >> 8) & 255, + blockD = ipInt & 255; return blockA + "." + blockB + "." + blockC + "." + blockD; }, @@ -679,40 +679,40 @@ var IP = { * Converts an IPv6 address from string format to numerical array format. * * @private - * @param {string} ip_str + * @param {string} ipStr * @returns {number[]} * * @example * // returns [65280, 0, 0, 0, 0, 0, 4369, 8738] - * IP._str_to_ipv6("ff00::1111:2222"); + * IP._strToIpv6("ff00::1111:2222"); */ - _str_to_ipv6: function(ip_str) { - var blocks = ip_str.split(":"), - num_blocks = parse_blocks(blocks), + _strToIpv6: function(ipStr) { + var blocks = ipStr.split(":"), + numBlocks = parseBlocks(blocks), j = 0, ipv6 = new Array(8); for (var i = 0; i < 8; i++) { - if (isNaN(num_blocks[j])) { + if (isNaN(numBlocks[j])) { ipv6[i] = 0; - if (i === (8-num_blocks.slice(j).length)) j++; + if (i === (8-numBlocks.slice(j).length)) j++; } else { - ipv6[i] = num_blocks[j]; + ipv6[i] = numBlocks[j]; j++; } } return ipv6; - function parse_blocks(blocks) { + function parseBlocks(blocks) { if (blocks.length < 3 || blocks.length > 8) throw "Badly formatted IPv6 address."; - var num_blocks = []; + var numBlocks = []; for (var i = 0; i < blocks.length; i++) { - num_blocks[i] = parseInt(blocks[i], 16); - if (num_blocks[i] < 0 || num_blocks[i] > 65535) + numBlocks[i] = parseInt(blocks[i], 16); + if (numBlocks[i] < 0 || numBlocks[i] > 65535) throw "Block out of range."; } - return num_blocks; + return numBlocks; } }, @@ -727,12 +727,12 @@ var IP = { * * @example * // returns "ff00::1111:2222" - * IP._ipv6_to_str([65280, 0, 0, 0, 0, 0, 4369, 8738], true); + * IP._ipv6ToStr([65280, 0, 0, 0, 0, 0, 4369, 8738], true); * * // returns "ff00:0000:0000:0000:0000:0000:1111:2222" - * IP._ipv6_to_str([65280, 0, 0, 0, 0, 0, 4369, 8738], false); + * IP._ipv6ToStr([65280, 0, 0, 0, 0, 0, 4369, 8738], false); */ - _ipv6_to_str: function(ipv6, compact) { + _ipv6ToStr: function(ipv6, compact) { var output = "", i = 0; @@ -779,18 +779,18 @@ var IP = { * * @private * @param {number} ip - * @param {number} end_ip + * @param {number} endIp * @returns {string[]} * * @example * // returns ["0.0.0.1", "0.0.0.2", "0.0.0.3"] - * IP._generate_ipv4_range(1, 3); + * IP._generateIpv4Range(1, 3); */ - _generate_ipv4_range: function(ip, end_ip) { + _generateIpv4Range: function(ip, endIp) { var range = []; - if (end_ip >= ip) { - for (; ip <= end_ip; ip++) { - range.push(IP._ipv4_to_str(ip)); + if (endIp >= ip) { + for (; ip <= endIp; ip++) { + range.push(IP._ipv4ToStr(ip)); } } else { range[0] = "Second IP address smaller than first."; diff --git a/src/js/operations/JS.js b/src/js/operations/JS.js index 076c6321..0f109eee 100755 --- a/src/js/operations/JS.js +++ b/src/js/operations/JS.js @@ -44,19 +44,19 @@ var JS = { * @param {Object[]} args * @returns {string} */ - run_parse: function (input, args) { - var parse_loc = args[0], - parse_range = args[1], - parse_tokens = args[2], - parse_comment = args[3], - parse_tolerant = args[4], + runParse: function (input, args) { + var parseLoc = args[0], + parseRange = args[1], + parseTokens = args[2], + parseComment = args[3], + parseTolerant = args[4], result = {}, options = { - loc: parse_loc, - range: parse_range, - tokens: parse_tokens, - comment: parse_comment, - tolerant: parse_tolerant + loc: parseLoc, + range: parseRange, + tokens: parseTokens, + comment: parseComment, + tolerant: parseTolerant }; result = esprima.parse(input, options); @@ -92,11 +92,11 @@ var JS = { * @param {Object[]} args * @returns {string} */ - run_beautify: function(input, args) { - var beautify_indent = args[0] || JS.BEAUTIFY_INDENT, + runBeautify: function(input, args) { + var beautifyIndent = args[0] || JS.BEAUTIFY_INDENT, quotes = args[1].toLowerCase(), - beautify_semicolons = args[2], - beautify_comment = args[3], + beautifySemicolons = args[2], + beautifyComment = args[3], result = "", AST; @@ -110,12 +110,12 @@ var JS = { var options = { format: { indent: { - style: beautify_indent + style: beautifyIndent }, quotes: quotes, - semicolons: beautify_semicolons, + semicolons: beautifySemicolons, }, - comment: beautify_comment + comment: beautifyComment }; if (options.comment) @@ -137,13 +137,13 @@ var JS = { * @param {Object[]} args * @returns {string} */ - run_minify: function(input, args) { + runMinify: function(input, args) { var result = "", AST = esprima.parse(input), - optimised_AST = esmangle.optimize(AST, null), - mangled_AST = esmangle.mangle(optimised_AST); + optimisedAST = esmangle.optimize(AST, null), + mangledAST = esmangle.mangle(optimisedAST); - result = escodegen.generate(mangled_AST, { + result = escodegen.generate(mangledAST, { format: { renumber: true, hexadecimal: true, diff --git a/src/js/operations/MAC.js b/src/js/operations/MAC.js index 752304b3..8fdd0906 100755 --- a/src/js/operations/MAC.js +++ b/src/js/operations/MAC.js @@ -42,15 +42,15 @@ var MAC = { * @param {Object[]} args * @returns {string} */ - run_format: function(input, args) { + runFormat: function(input, args) { if (!input) return ""; - var output_case = args[0], - no_delim = args[1], - dash_delim = args[2], - colon_delim = args[3], - cisco_style = args[4], - output_list = [], + var outputCase = args[0], + noDelim = args[1], + dashDelim = args[2], + colonDelim = args[3], + ciscoStyle = args[4], + outputList = [], macs = input.toLowerCase().split(/[,\s\r\n]+/); macs.forEach(function(mac) { @@ -59,30 +59,30 @@ var MAC = { macColon = cleanMac.replace(/(.{2}(?=.))/g, "$1:"), macCisco = cleanMac.replace(/(.{4}(?=.))/g, "$1."); - if (output_case === "Lower only") { - if (no_delim) output_list.push(cleanMac); - if (dash_delim) output_list.push(macHyphen); - if (colon_delim) output_list.push(macColon); - if (cisco_style) output_list.push(macCisco); - } else if (output_case === "Upper only") { - if (no_delim) output_list.push(cleanMac.toUpperCase()); - if (dash_delim) output_list.push(macHyphen.toUpperCase()); - if (colon_delim) output_list.push(macColon.toUpperCase()); - if (cisco_style) output_list.push(macCisco.toUpperCase()); + if (outputCase === "Lower only") { + if (noDelim) outputList.push(cleanMac); + if (dashDelim) outputList.push(macHyphen); + if (colonDelim) outputList.push(macColon); + if (ciscoStyle) outputList.push(macCisco); + } else if (outputCase === "Upper only") { + if (noDelim) outputList.push(cleanMac.toUpperCase()); + if (dashDelim) outputList.push(macHyphen.toUpperCase()); + if (colonDelim) outputList.push(macColon.toUpperCase()); + if (ciscoStyle) outputList.push(macCisco.toUpperCase()); } else { - if (no_delim) output_list.push(cleanMac, cleanMac.toUpperCase()); - if (dash_delim) output_list.push(macHyphen, macHyphen.toUpperCase()); - if (colon_delim) output_list.push(macColon, macColon.toUpperCase()); - if (cisco_style) output_list.push(macCisco, macCisco.toUpperCase()); + if (noDelim) outputList.push(cleanMac, cleanMac.toUpperCase()); + if (dashDelim) outputList.push(macHyphen, macHyphen.toUpperCase()); + if (colonDelim) outputList.push(macColon, macColon.toUpperCase()); + if (ciscoStyle) outputList.push(macCisco, macCisco.toUpperCase()); } - output_list.push( + outputList.push( "" // Empty line to delimit groups ); }); // Return the data as a string - return output_list.join("\n"); + return outputList.join("\n"); }, }; diff --git a/src/js/operations/OS.js b/src/js/operations/OS.js index 48cedeb4..6b89627a 100755 --- a/src/js/operations/OS.js +++ b/src/js/operations/OS.js @@ -16,7 +16,7 @@ var OS = { * @param {Object[]} args * @returns {string} */ - run_parse_unix_perms: function(input, args) { + runParseUnixPerms: function(input, args) { var perms = { d : false, // directory sl : false, // symbolic link @@ -158,12 +158,12 @@ var OS = { return "Invalid input format.\nPlease enter the permissions in either octal (e.g. 755) or textual (e.g. drwxr-xr-x) format."; } - output += "Textual representation: " + OS._perms_to_str(perms); - output += "\nOctal representation: " + OS._perms_to_octal(perms); + output += "Textual representation: " + OS._permsToStr(perms); + output += "\nOctal representation: " + OS._permsToOctal(perms); // File type if (textual) { - output += "\nFile type: " + OS._ft_from_perms(perms); + output += "\nFile type: " + OS._ftFromPerms(perms); } // setuid, setgid @@ -201,7 +201,7 @@ var OS = { * @param {Object} perms * @returns {string} */ - _perms_to_str: function(perms) { + _permsToStr: function(perms) { var str = "", type = "-"; @@ -262,7 +262,7 @@ var OS = { * @param {Object} perms * @returns {string} */ - _perms_to_octal: function(perms) { + _permsToOctal: function(perms) { var d = 0, u = 0, g = 0, @@ -295,7 +295,7 @@ var OS = { * @param {Object} perms * @returns {string} */ - _ft_from_perms: function(perms) { + _ftFromPerms: function(perms) { if (perms.d) return "Directory"; if (perms.sl) return "Symbolic link"; if (perms.np) return "Named pipe"; diff --git a/src/js/operations/PublicKey.js b/src/js/operations/PublicKey.js index 96b13c27..d73ca286 100755 --- a/src/js/operations/PublicKey.js +++ b/src/js/operations/PublicKey.js @@ -24,15 +24,15 @@ var PublicKey = { * @param {Object[]} args * @returns {string} */ - run_parse_x509: function (input, args) { + runParseX509: function (input, args) { var cert = new X509(), - input_format = args[0]; + inputFormat = args[0]; if (!input.length) { return "No input"; } - switch (input_format) { + switch (inputFormat) { case "DER Hex": input = input.replace(/\s/g, ""); cert.hex = input; @@ -43,11 +43,11 @@ var PublicKey = { cert.pem = input; break; case "Base64": - cert.hex = Utils.to_hex(Utils.from_base64(input, null, "byte_array"), ""); + cert.hex = Utils.toHex(Utils.fromBase64(input, null, "byteArray"), ""); cert.pem = KJUR.asn1.ASN1Util.getPEMStringFromHex(cert.hex, "CERTIFICATE"); break; case "Raw": - cert.hex = Utils.to_hex(Utils.str_to_byte_array(input), ""); + cert.hex = Utils.toHex(Utils.strToByteArray(input), ""); cert.pem = KJUR.asn1.ASN1Util.getPEMStringFromHex(cert.hex, "CERTIFICATE"); break; default: @@ -58,108 +58,108 @@ var PublicKey = { sn = cert.getSerialNumberHex(), algorithm = KJUR.asn1.x509.OID.oid2name(KJUR.asn1.ASN1Util.oidHexToInt(ASN1HEX.getDecendantHexVByNthList(cert.hex, 0, [0, 2, 0]))), issuer = cert.getIssuerString(), - not_before = cert.getNotBefore(), - not_after = cert.getNotAfter(), + notBefore = cert.getNotBefore(), + notAfter = cert.getNotAfter(), subject = cert.getSubjectString(), - pk_algorithm = KJUR.asn1.x509.OID.oid2name(KJUR.asn1.ASN1Util.oidHexToInt(ASN1HEX.getDecendantHexVByNthList(cert.hex, 0, [0, 6, 0, 0]))), + pkAlgorithm = KJUR.asn1.x509.OID.oid2name(KJUR.asn1.ASN1Util.oidHexToInt(ASN1HEX.getDecendantHexVByNthList(cert.hex, 0, [0, 6, 0, 0]))), pk = X509.getPublicKeyFromCertPEM(cert.pem), - pk_fields = [], - pk_str = "", - cert_sig_alg = KJUR.asn1.x509.OID.oid2name(KJUR.asn1.ASN1Util.oidHexToInt(ASN1HEX.getDecendantHexVByNthList(cert.hex, 0, [1, 0]))), - cert_sig = ASN1HEX.getDecendantHexVByNthList(cert.hex, 0, [2]).substr(2), - sig_str = "", + pkFields = [], + pkStr = "", + certSigAlg = KJUR.asn1.x509.OID.oid2name(KJUR.asn1.ASN1Util.oidHexToInt(ASN1HEX.getDecendantHexVByNthList(cert.hex, 0, [1, 0]))), + certSig = ASN1HEX.getDecendantHexVByNthList(cert.hex, 0, [2]).substr(2), + sigStr = "", extensions = ASN1HEX.dump(ASN1HEX.getDecendantHexVByNthList(cert.hex, 0, [0, 7])); // Public Key fields if (pk.type === "EC") { // ECDSA - pk_fields.push({ + pkFields.push({ key: "Curve Name", value: pk.curveName }); - pk_fields.push({ + pkFields.push({ key: "Length", value: (((new BigInteger(pk.pubKeyHex, 16)).bitLength()-3) /2) + " bits" }); - pk_fields.push({ + pkFields.push({ key: "pub", - value: PublicKey._format_byte_str(pk.pubKeyHex, 16, 18) + value: PublicKey._formatByteStr(pk.pubKeyHex, 16, 18) }); } else if (pk.type === "DSA") { // DSA - pk_fields.push({ + pkFields.push({ key: "pub", - value: PublicKey._format_byte_str(pk.y.toString(16), 16, 18) + value: PublicKey._formatByteStr(pk.y.toString(16), 16, 18) }); - pk_fields.push({ + pkFields.push({ key: "P", - value: PublicKey._format_byte_str(pk.p.toString(16), 16, 18) + value: PublicKey._formatByteStr(pk.p.toString(16), 16, 18) }); - pk_fields.push({ + pkFields.push({ key: "Q", - value: PublicKey._format_byte_str(pk.q.toString(16), 16, 18) + value: PublicKey._formatByteStr(pk.q.toString(16), 16, 18) }); - pk_fields.push({ + pkFields.push({ key: "G", - value: PublicKey._format_byte_str(pk.g.toString(16), 16, 18) + value: PublicKey._formatByteStr(pk.g.toString(16), 16, 18) }); } else if (pk.e) { // RSA - pk_fields.push({ + pkFields.push({ key: "Length", value: pk.n.bitLength() + " bits" }); - pk_fields.push({ + pkFields.push({ key: "Modulus", - value: PublicKey._format_byte_str(pk.n.toString(16), 16, 18) + value: PublicKey._formatByteStr(pk.n.toString(16), 16, 18) }); - pk_fields.push({ + pkFields.push({ key: "Exponent", value: pk.e + " (0x" + pk.e.toString(16) + ")" }); } else { - pk_fields.push({ + pkFields.push({ key: "Error", value: "Unknown Public Key type" }); } // Signature fields - if (ASN1HEX.dump(cert_sig).indexOf("SEQUENCE") === 0) { // DSA or ECDSA - sig_str = " r: " + PublicKey._format_byte_str(ASN1HEX.getDecendantHexVByNthList(cert_sig, 0, [0]), 16, 18) + "\n" + - " s: " + PublicKey._format_byte_str(ASN1HEX.getDecendantHexVByNthList(cert_sig, 0, [1]), 16, 18) + "\n"; + if (ASN1HEX.dump(certSig).indexOf("SEQUENCE") === 0) { // DSA or ECDSA + sigStr = " r: " + PublicKey._formatByteStr(ASN1HEX.getDecendantHexVByNthList(certSig, 0, [0]), 16, 18) + "\n" + + " s: " + PublicKey._formatByteStr(ASN1HEX.getDecendantHexVByNthList(certSig, 0, [1]), 16, 18) + "\n"; } else { // RSA - sig_str = " Signature: " + PublicKey._format_byte_str(cert_sig, 16, 18) + "\n"; + sigStr = " Signature: " + PublicKey._formatByteStr(certSig, 16, 18) + "\n"; } // Format Public Key fields - for (var i = 0; i < pk_fields.length; i++) { - pk_str += " " + pk_fields[i].key + ":" + - Utils.pad_left( - pk_fields[i].value + "\n", - 18 - (pk_fields[i].key.length + 3) + pk_fields[i].value.length + 1, + for (var i = 0; i < pkFields.length; i++) { + pkStr += " " + pkFields[i].key + ":" + + Utils.padLeft( + pkFields[i].value + "\n", + 18 - (pkFields[i].key.length + 3) + pkFields[i].value.length + 1, " " ); } - var issuer_str = PublicKey._format_dn_str(issuer, 2), - nb_date = PublicKey._format_date(not_before), - na_date = PublicKey._format_date(not_after), - subject_str = PublicKey._format_dn_str(subject, 2); + var issuerStr = PublicKey._formatDnStr(issuer, 2), + nbDate = PublicKey._formatDate(notBefore), + naDate = PublicKey._formatDate(notAfter), + subjectStr = PublicKey._formatDnStr(subject, 2); var output = "Version: " + (parseInt(version, 16) + 1) + " (0x" + version + ")\n" + "Serial number: " + new BigInteger(sn, 16).toString() + " (0x" + sn + ")\n" + "Algorithm ID: " + algorithm + "\n" + "Validity\n" + - " Not Before: " + nb_date + " (dd-mm-yy hh:mm:ss) (" + not_before + ")\n" + - " Not After: " + na_date + " (dd-mm-yy hh:mm:ss) (" + not_after + ")\n" + + " Not Before: " + nbDate + " (dd-mm-yy hh:mm:ss) (" + notBefore + ")\n" + + " Not After: " + naDate + " (dd-mm-yy hh:mm:ss) (" + notAfter + ")\n" + "Issuer\n" + - issuer_str + + issuerStr + "Subject\n" + - subject_str + + subjectStr + "Public Key\n" + - " Algorithm: " + pk_algorithm + "\n" + - pk_str + + " Algorithm: " + pkAlgorithm + "\n" + + pkStr + "Certificate Signature\n" + - " Algorithm: " + cert_sig_alg + "\n" + - sig_str + + " Algorithm: " + certSigAlg + "\n" + + sigStr + "\nExtensions (parsed ASN.1)\n" + extensions; @@ -174,7 +174,7 @@ var PublicKey = { * @param {Object[]} args * @returns {string} */ - run_pem_to_hex: function(input, args) { + runPemToHex: function(input, args) { if (input.indexOf("-----BEGIN") < 0) { // Add header so that the KEYUTIL function works input = "-----BEGIN CERTIFICATE-----" + input; @@ -200,7 +200,7 @@ var PublicKey = { * @param {Object[]} args * @returns {string} */ - run_hex_to_pem: function(input, args) { + runHexToPem: function(input, args) { return KJUR.asn1.ASN1Util.getPEMStringFromHex(input.replace(/\s/g, ""), args[0]); }, @@ -212,7 +212,7 @@ var PublicKey = { * @param {Object[]} args * @returns {string} */ - run_hex_to_object_identifier: function(input, args) { + runHexToObjectIdentifier: function(input, args) { return KJUR.asn1.ASN1Util.oidHexToInt(input.replace(/\s/g, "")); }, @@ -224,7 +224,7 @@ var PublicKey = { * @param {Object[]} args * @returns {string} */ - run_object_identifier_to_hex: function(input, args) { + runObjectIdentifierToHex: function(input, args) { return KJUR.asn1.ASN1Util.oidIntToHex(input); }, @@ -242,11 +242,11 @@ var PublicKey = { * @param {Object[]} args * @returns {string} */ - run_parse_asn1_hex_string: function(input, args) { - var truncate_len = args[1], + runParseAsn1HexString: function(input, args) { + var truncateLen = args[1], index = args[0]; return ASN1HEX.dump(input.replace(/\s/g, ""), { - "ommit_long_octet": truncate_len + "ommitLongOctet": truncateLen }, index); }, @@ -255,14 +255,14 @@ var PublicKey = { * Formats Distinguished Name (DN) strings. * * @private - * @param {string} dn_str + * @param {string} dnStr * @param {number} indent * @returns {string} */ - _format_dn_str: function(dn_str, indent) { + _formatDnStr: function(dnStr, indent) { var output = "", - fields = dn_str.split(",/|"), - max_key_len = 0, + fields = dnStr.split(",/|"), + maxKeyLen = 0, key, value, str; @@ -272,7 +272,7 @@ var PublicKey = { key = fields[i].split("=")[0]; - max_key_len = key.length > max_key_len ? key.length : max_key_len; + maxKeyLen = key.length > maxKeyLen ? key.length : maxKeyLen; } for (i = 0; i < fields.length; i++) { @@ -280,9 +280,9 @@ var PublicKey = { key = fields[i].split("=")[0]; value = fields[i].split("=")[1]; - str = Utils.pad_right(key, max_key_len) + " = " + value + "\n"; + str = Utils.padRight(key, maxKeyLen) + " = " + value + "\n"; - output += Utils.pad_left(str, indent + str.length, " "); + output += Utils.padLeft(str, indent + str.length, " "); } return output; @@ -293,22 +293,22 @@ var PublicKey = { * Formats byte strings by adding line breaks and delimiters. * * @private - * @param {string} byte_str + * @param {string} byteStr * @param {number} length - Line width * @param {number} indent * @returns {string} */ - _format_byte_str: function(byte_str, length, indent) { - byte_str = Utils.to_hex(Utils.from_hex(byte_str), ":"); + _formatByteStr: function(byteStr, length, indent) { + byteStr = Utils.toHex(Utils.fromHex(byteStr), ":"); length = length * 3; var output = ""; - for (var i = 0; i < byte_str.length; i += length) { - var str = byte_str.slice(i, i + length) + "\n"; + for (var i = 0; i < byteStr.length; i += length) { + var str = byteStr.slice(i, i + length) + "\n"; if (i === 0) { output += str; } else { - output += Utils.pad_left(str, indent + str.length, " "); + output += Utils.padLeft(str, indent + str.length, " "); } } @@ -320,16 +320,16 @@ var PublicKey = { * Formats dates. * * @private - * @param {string} date_str + * @param {string} dateStr * @returns {string} */ - _format_date: function(date_str) { - return date_str[4] + date_str[5] + "/" + - date_str[2] + date_str[3] + "/" + - date_str[0] + date_str[1] + " " + - date_str[6] + date_str[7] + ":" + - date_str[8] + date_str[9] + ":" + - date_str[10] + date_str[11]; + _formatDate: function(dateStr) { + return dateStr[4] + dateStr[5] + "/" + + dateStr[2] + dateStr[3] + "/" + + dateStr[0] + dateStr[1] + " " + + dateStr[6] + dateStr[7] + ":" + + dateStr[8] + dateStr[9] + ":" + + dateStr[10] + dateStr[11]; }, }; @@ -388,9 +388,9 @@ X509.DN_ATTRHEX = { // "06032a864886f70d010104" : "md5withRSAEncryption", // "06032a864886f70d010105" : "SHA-1WithRSAEncryption", // "06032a8648ce380403" : "id-dsa-with-sha-1", - // "06032b06010505070302" : "id_kp_clientAuth", - // "06032b06010505070304" : "id_kp_securityemail", - "06032b06010505070201" : "id_certificatePolicies", + // "06032b06010505070302" : "idKpClientAuth", + // "06032b06010505070304" : "idKpSecurityemail", + "06032b06010505070201" : "idCertificatePolicies", "06036086480186f8420101" : "netscape-cert-type", "06036086480186f8420102" : "netscape-base-url", "06036086480186f8420103" : "netscape-revocation-url", @@ -867,25 +867,25 @@ X509.DN_ATTRHEX = { "06036086480186f8450107010101" : "Unknown Verisign policy qualifier", "06036086480186f8450107010102" : "Unknown Verisign policy qualifier", "0603678105" : "TCPA", - "060367810501" : "tcpa_specVersion", - "060367810502" : "tcpa_attribute", - "06036781050201" : "tcpa_at_tpmManufacturer", - "0603678105020a" : "tcpa_at_securityQualities", - "0603678105020b" : "tcpa_at_tpmProtectionProfile", - "0603678105020c" : "tcpa_at_tpmSecurityTarget", - "0603678105020d" : "tcpa_at_foundationProtectionProfile", - "0603678105020e" : "tcpa_at_foundationSecurityTarget", - "0603678105020f" : "tcpa_at_tpmIdLabel", - "06036781050202" : "tcpa_at_tpmModel", - "06036781050203" : "tcpa_at_tpmVersion", - "06036781050204" : "tcpa_at_platformManufacturer", - "06036781050205" : "tcpa_at_platformModel", - "06036781050206" : "tcpa_at_platformVersion", - "06036781050207" : "tcpa_at_componentManufacturer", - "06036781050208" : "tcpa_at_componentModel", - "06036781050209" : "tcpa_at_componentVersion", - "060367810503" : "tcpa_protocol", - "06036781050301" : "tcpa_prtt_tpmIdProtocol", + "060367810501" : "tcpaSpecVersion", + "060367810502" : "tcpaAttribute", + "06036781050201" : "tcpaAtTpmManufacturer", + "0603678105020a" : "tcpaAtSecurityQualities", + "0603678105020b" : "tcpaAtTpmProtectionProfile", + "0603678105020c" : "tcpaAtTpmSecurityTarget", + "0603678105020d" : "tcpaAtFoundationProtectionProfile", + "0603678105020e" : "tcpaAtFoundationSecurityTarget", + "0603678105020f" : "tcpaAtTpmIdLabel", + "06036781050202" : "tcpaAtTpmModel", + "06036781050203" : "tcpaAtTpmVersion", + "06036781050204" : "tcpaAtPlatformManufacturer", + "06036781050205" : "tcpaAtPlatformModel", + "06036781050206" : "tcpaAtPlatformVersion", + "06036781050207" : "tcpaAtComponentManufacturer", + "06036781050208" : "tcpaAtComponentModel", + "06036781050209" : "tcpaAtComponentVersion", + "060367810503" : "tcpaProtocol", + "06036781050301" : "tcpaPrttTpmIdProtocol", "0603672a00" : "contentType", "0603672a0000" : "PANData", "0603672a0001" : "PANToken", diff --git a/src/js/operations/Punycode.js b/src/js/operations/Punycode.js index cf58a8f1..edc1293a 100755 --- a/src/js/operations/Punycode.js +++ b/src/js/operations/Punycode.js @@ -24,7 +24,7 @@ var Punycode = { * @param {Object[]} args * @returns {string} */ - run_to_ascii: function(input, args) { + runToAscii: function(input, args) { var idn = args[0]; if (idn) { @@ -42,7 +42,7 @@ var Punycode = { * @param {Object[]} args * @returns {string} */ - run_to_unicode: function(input, args) { + runToUnicode: function(input, args) { var idn = args[0]; if (idn) { diff --git a/src/js/operations/QuotedPrintable.js b/src/js/operations/QuotedPrintable.js index 8dd9299e..7e3645e8 100755 --- a/src/js/operations/QuotedPrintable.js +++ b/src/js/operations/QuotedPrintable.js @@ -35,11 +35,11 @@ var QuotedPrintable = { /** * To Quoted Printable operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args * @returns {string} */ - run_to: function (input, args) { + runTo: function (input, args) { var mimeEncodedStr = QuotedPrintable.mimeEncode(input); // fix line breaks @@ -58,9 +58,9 @@ var QuotedPrintable = { * * @param {string} input * @param {Object[]} args - * @returns {byte_array} + * @returns {byteArray} */ - run_from: function (input, args) { + runFrom: function (input, args) { var str = input.replace(/\=(?:\r?\n|$)/g, ""); return QuotedPrintable.mimeDecode(str); }, @@ -70,7 +70,7 @@ var QuotedPrintable = { * Decodes mime-encoded data. * * @param {string} str - * @returns {byte_array} + * @returns {byteArray} */ mimeDecode: function(str) { var encodedBytesCount = (str.match(/\=[\da-fA-F]{2}/g) || []).length, @@ -96,7 +96,7 @@ var QuotedPrintable = { /** * Encodes mime data. * - * @param {byte_array} buffer + * @param {byteArray} buffer * @returns {string} */ mimeEncode: function(buffer) { @@ -130,7 +130,7 @@ var QuotedPrintable = { * * @private * @param {number} nr - * @param {byte_array[]} ranges + * @param {byteArray[]} ranges * @returns {bolean} */ _checkRanges: function(nr, ranges) { diff --git a/src/js/operations/Rotate.js b/src/js/operations/Rotate.js index 8b6edf54..4a423cae 100755 --- a/src/js/operations/Rotate.js +++ b/src/js/operations/Rotate.js @@ -26,10 +26,10 @@ var Rotate = { * Runs rotation operations across the input data. * * @private - * @param {byte_array} data + * @param {byteArray} data * @param {number} amount * @param {function} algo - The rotation operation to carry out - * @returns {byte_array} + * @returns {byteArray} */ _rot: function(data, amount, algo) { var result = []; @@ -47,13 +47,13 @@ var Rotate = { /** * Rotate right operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args - * @returns {byte_array} + * @returns {byteArray} */ - run_rotr: function(input, args) { + runRotr: function(input, args) { if (args[1]) { - return Rotate._rotr_whole(input, args[0]); + return Rotate._rotrWhole(input, args[0]); } else { return Rotate._rot(input, args[0], Rotate._rotr); } @@ -63,13 +63,13 @@ var Rotate = { /** * Rotate left operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args - * @returns {byte_array} + * @returns {byteArray} */ - run_rotl: function(input, args) { + runRotl: function(input, args) { if (args[1]) { - return Rotate._rotl_whole(input, args[0]); + return Rotate._rotlWhole(input, args[0]); } else { return Rotate._rot(input, args[0], Rotate._rotl); } @@ -95,16 +95,16 @@ var Rotate = { /** * ROT13 operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args - * @returns {byte_array} + * @returns {byteArray} */ - run_rot13: function(input, args) { + runRot13: function(input, args) { var amount = args[2], output = input, chr, - rot13_lowercase = args[0], - rot13_upperacse = args[1]; + rot13Lowercase = args[0], + rot13Upperacse = args[1]; if (amount) { if (amount < 0) { @@ -113,10 +113,10 @@ var Rotate = { for (var i = 0; i < input.length; i++) { chr = input[i]; - if (rot13_upperacse && chr >= 65 && chr <= 90) { // Upper case + if (rot13Upperacse && chr >= 65 && chr <= 90) { // Upper case chr = (chr - 65 + amount) % 26; output[i] = chr + 65; - } else if (rot13_lowercase && chr >= 97 && chr <= 122) { // Lower case + } else if (rot13Lowercase && chr >= 97 && chr <= 122) { // Lower case chr = (chr - 97 + amount) % 26; output[i] = chr + 97; } @@ -136,11 +136,11 @@ var Rotate = { * ROT47 operation. * * @author Matt C [matt@artemisbot.pw] - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args - * @returns {byte_array} + * @returns {byteArray} */ - run_rot47: function(input, args) { + runRot47: function(input, args) { var amount = args[0], output = input, chr; @@ -193,23 +193,23 @@ var Rotate = { * from the end of the array to the beginning. * * @private - * @param {byte_array} data + * @param {byteArray} data * @param {number} amount - * @returns {byte_array} + * @returns {byteArray} */ - _rotr_whole: function(data, amount) { - var carry_bits = 0, - new_byte, + _rotrWhole: function(data, amount) { + var carryBits = 0, + newByte, result = []; amount = amount % 8; for (var i = 0; i < data.length; i++) { - var old_byte = data[i] >>> 0; - new_byte = (old_byte >> amount) | carry_bits; - carry_bits = (old_byte & (Math.pow(2, amount)-1)) << (8-amount); - result.push(new_byte); + var oldByte = data[i] >>> 0; + newByte = (oldByte >> amount) | carryBits; + carryBits = (oldByte & (Math.pow(2, amount)-1)) << (8-amount); + result.push(newByte); } - result[0] |= carry_bits; + result[0] |= carryBits; return result; }, @@ -219,23 +219,23 @@ var Rotate = { * from the beginning of the array to the end. * * @private - * @param {byte_array} data + * @param {byteArray} data * @param {number} amount - * @returns {byte_array} + * @returns {byteArray} */ - _rotl_whole: function(data, amount) { - var carry_bits = 0, - new_byte, + _rotlWhole: function(data, amount) { + var carryBits = 0, + newByte, result = []; amount = amount % 8; for (var i = data.length-1; i >= 0; i--) { - var old_byte = data[i]; - new_byte = ((old_byte << amount) | carry_bits) & 0xFF; - carry_bits = (old_byte >> (8-amount)) & (Math.pow(2, amount)-1); - result[i] = (new_byte); + var oldByte = data[i]; + newByte = ((oldByte << amount) | carryBits) & 0xFF; + carryBits = (oldByte >> (8-amount)) & (Math.pow(2, amount)-1); + result[i] = (newByte); } - result[data.length-1] = result[data.length-1] | carry_bits; + result[data.length-1] = result[data.length-1] | carryBits; return result; }, diff --git a/src/js/operations/SeqUtils.js b/src/js/operations/SeqUtils.js index 40fc67f1..7100d5c5 100755 --- a/src/js/operations/SeqUtils.js +++ b/src/js/operations/SeqUtils.js @@ -32,21 +32,21 @@ var SeqUtils = { * @param {Object[]} args * @returns {string} */ - run_sort: function (input, args) { - var delim = Utils.char_rep[args[0]], - sort_reverse = args[1], + runSort: function (input, args) { + var delim = Utils.charRep[args[0]], + sortReverse = args[1], order = args[2], sorted = input.split(delim); if (order === "Alphabetical (case sensitive)") { sorted = sorted.sort(); } else if (order === "Alphabetical (case insensitive)") { - sorted = sorted.sort(SeqUtils._case_insensitive_sort); + sorted = sorted.sort(SeqUtils._caseInsensitiveSort); } else if (order === "IP address") { - sorted = sorted.sort(SeqUtils._ip_sort); + sorted = sorted.sort(SeqUtils._ipSort); } - if (sort_reverse) sorted.reverse(); + if (sortReverse) sorted.reverse(); return sorted.join(delim); }, @@ -58,8 +58,8 @@ var SeqUtils = { * @param {Object[]} args * @returns {string} */ - run_unique: function (input, args) { - var delim = Utils.char_rep[args[0]]; + runUnique: function (input, args) { + var delim = Utils.charRep[args[0]]; return input.split(delim).unique().join(delim); }, @@ -77,7 +77,7 @@ var SeqUtils = { * @param {Object[]} args * @returns {number} */ - run_count: function(input, args) { + runCount: function(input, args) { var search = args[0].string, type = args[0].option; @@ -91,7 +91,7 @@ var SeqUtils = { } } else if (search) { if (type.indexOf("Extended") === 0) { - search = Utils.parse_escaped_chars(search); + search = Utils.parseEscapedChars(search); } return input.count(search); } else { @@ -109,11 +109,11 @@ var SeqUtils = { /** * Reverse operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args - * @returns {byte_array} + * @returns {byteArray} */ - run_reverse: function (input, args) { + runReverse: function (input, args) { if (args[0] === "Line") { var lines = [], line = [], @@ -146,7 +146,7 @@ var SeqUtils = { * @param {Object[]} args * @returns {string} */ - run_add_line_numbers: function(input, args) { + runAddLineNumbers: function(input, args) { var lines = input.split("\n"), output = "", width = lines.length.toString().length; @@ -165,7 +165,7 @@ var SeqUtils = { * @param {Object[]} args * @returns {string} */ - run_remove_line_numbers: function(input, args) { + runRemoveLineNumbers: function(input, args) { return input.replace(/^[ \t]{0,5}\d+[\s:|\-,.)\]]/gm, ""); }, @@ -177,8 +177,8 @@ var SeqUtils = { * @param {Object[]} args * @returns {string} */ - run_expand_alph_range: function(input, args) { - return Utils.expand_alph_range(input).join(args[0]); + runExpandAlphRange: function(input, args) { + return Utils.expandAlphRange(input).join(args[0]); }, @@ -190,7 +190,7 @@ var SeqUtils = { * @param {string} b * @returns {number} */ - _case_insensitive_sort: function(a, b) { + _caseInsensitiveSort: function(a, b) { return a.toLowerCase().localeCompare(b.toLowerCase()); }, @@ -203,7 +203,7 @@ var SeqUtils = { * @param {string} b * @returns {number} */ - _ip_sort: function(a, b) { + _ipSort: function(a, b) { var a_ = a.split("."), b_ = b.split("."); diff --git a/src/js/operations/StrUtils.js b/src/js/operations/StrUtils.js index 8ba065b8..8f13e28a 100755 --- a/src/js/operations/StrUtils.js +++ b/src/js/operations/StrUtils.js @@ -97,30 +97,30 @@ var StrUtils = { * @param {Object[]} args * @returns {html} */ - run_regex: function(input, args) { - var user_regex = args[1], + runRegex: function(input, args) { + var userRegex = args[1], i = args[2], m = args[3], - display_total = args[4], - output_format = args[5], + displayTotal = args[4], + outputFormat = args[5], modifiers = "g"; if (i) modifiers += "i"; if (m) modifiers += "m"; - if (user_regex && user_regex !== "^" && user_regex !== "$") { + if (userRegex && userRegex !== "^" && userRegex !== "$") { try { - var regex = new RegExp(user_regex, modifiers); + var regex = new RegExp(userRegex, modifiers); - switch (output_format) { + switch (outputFormat) { case "Highlight matches": - return StrUtils._regex_highlight(input, regex, display_total); + return StrUtils._regexHighlight(input, regex, displayTotal); case "List matches": - return Utils.escape_html(StrUtils._regex_list(input, regex, display_total, true, false)); + return Utils.escapeHtml(StrUtils._regexList(input, regex, displayTotal, true, false)); case "List capture groups": - return Utils.escape_html(StrUtils._regex_list(input, regex, display_total, false, true)); + return Utils.escapeHtml(StrUtils._regexList(input, regex, displayTotal, false, true)); case "List matches with capture groups": - return Utils.escape_html(StrUtils._regex_list(input, regex, display_total, true, true)); + return Utils.escapeHtml(StrUtils._regexList(input, regex, displayTotal, true, true)); default: return "Error: Invalid output format"; } @@ -128,7 +128,7 @@ var StrUtils = { return "Invalid regex. Details: " + err.message; } } else { - return Utils.escape_html(input); + return Utils.escapeHtml(input); } }, @@ -146,7 +146,7 @@ var StrUtils = { * @param {Object[]} args * @returns {string} */ - run_upper: function (input, args) { + runUpper: function (input, args) { var scope = args[0]; switch (scope) { @@ -177,7 +177,7 @@ var StrUtils = { * @param {Object[]} args * @returns {string} */ - run_lower: function (input, args) { + runLower: function (input, args) { return input.toLowerCase(); }, @@ -210,7 +210,7 @@ var StrUtils = { * @param {Object[]} args * @returns {string} */ - run_find_replace: function(input, args) { + runFindReplace: function(input, args) { var find = args[0].string, type = args[0].option, replace = args[1], @@ -226,7 +226,7 @@ var StrUtils = { if (type === "Regex") { find = new RegExp(find, modifiers); } else if (type.indexOf("Extended") === 0) { - find = Utils.parse_escaped_chars(find); + find = Utils.parseEscapedChars(find); } return input.replace(find, replace, modifiers); @@ -254,12 +254,12 @@ var StrUtils = { * @param {Object[]} args * @returns {string} */ - run_split: function(input, args) { - var split_delim = args[0] || StrUtils.SPLIT_DELIM, - join_delim = Utils.char_rep[args[1]], - sections = input.split(split_delim); + runSplit: function(input, args) { + var splitDelim = args[0] || StrUtils.SPLIT_DELIM, + joinDelim = Utils.charRep[args[1]], + sections = input.split(splitDelim); - return sections.join(join_delim); + return sections.join(joinDelim); }, @@ -271,8 +271,8 @@ var StrUtils = { * @param {Object[]} args * @returns {string} */ - run_filter: function(input, args) { - var delim = Utils.char_rep[args[0]], + runFilter: function(input, args) { + var delim = Utils.charRep[args[0]], reverse = args[2]; try { @@ -281,11 +281,11 @@ var StrUtils = { return "Invalid regex. Details: " + err.message; } - var regex_filter = function(value) { + var regexFilter = function(value) { return reverse ^ regex.test(value); }; - return input.split(delim).filter(regex_filter).join(delim); + return input.split(delim).filter(regexFilter).join(delim); }, @@ -307,13 +307,13 @@ var StrUtils = { * @param {Object[]} args * @returns {html} */ - run_diff: function(input, args) { - var sample_delim = args[0], - diff_by = args[1], - show_added = args[2], - show_removed = args[3], - ignore_whitespace = args[4], - samples = input.split(sample_delim), + runDiff: function(input, args) { + var sampleDelim = args[0], + diffBy = args[1], + showAdded = args[2], + showRemoved = args[3], + ignoreWhitespace = args[4], + samples = input.split(sampleDelim), output = "", diff; @@ -321,19 +321,19 @@ var StrUtils = { return "Incorrect number of samples, perhaps you need to modify the sample delimiter or add more samples?"; } - switch (diff_by) { + switch (diffBy) { case "Character": diff = JsDiff.diffChars(samples[0], samples[1]); break; case "Word": - if (ignore_whitespace) { + if (ignoreWhitespace) { diff = JsDiff.diffWords(samples[0], samples[1]); } else { diff = JsDiff.diffWordsWithSpace(samples[0], samples[1]); } break; case "Line": - if (ignore_whitespace) { + if (ignoreWhitespace) { diff = JsDiff.diffTrimmedLines(samples[0], samples[1]); } else { diff = JsDiff.diffLines(samples[0], samples[1]); @@ -354,11 +354,11 @@ var StrUtils = { for (var i = 0; i < diff.length; i++) { if (diff[i].added) { - if (show_added) output += "" + Utils.escape_html(diff[i].value) + ""; + if (showAdded) output += "" + Utils.escapeHtml(diff[i].value) + ""; } else if (diff[i].removed) { - if (show_removed) output += "" + Utils.escape_html(diff[i].value) + ""; + if (showRemoved) output += "" + Utils.escapeHtml(diff[i].value) + ""; } else { - output += Utils.escape_html(diff[i].value); + output += Utils.escapeHtml(diff[i].value); } } @@ -379,14 +379,14 @@ var StrUtils = { * @param {Object[]} args * @returns {html} */ - run_offset_checker: function(input, args) { - var sample_delim = args[0], - samples = input.split(sample_delim), + runOffsetChecker: function(input, args) { + var sampleDelim = args[0], + samples = input.split(sampleDelim), outputs = [], i = 0, s = 0, match = false, - in_match = false, + inMatch = false, chr; if (!samples || samples.length < 2) { @@ -415,34 +415,34 @@ var StrUtils = { // Write output for each sample for (s = 0; s < samples.length; s++) { if (samples[s].length <= i) { - if (in_match) outputs[s] += ""; - if (s === samples.length - 1) in_match = false; + if (inMatch) outputs[s] += ""; + if (s === samples.length - 1) inMatch = false; continue; } - if (match && !in_match) { - outputs[s] += "" + Utils.escape_html(samples[s][i]); + if (match && !inMatch) { + outputs[s] += "" + Utils.escapeHtml(samples[s][i]); if (samples[s].length === i + 1) outputs[s] += ""; - if (s === samples.length - 1) in_match = true; - } else if (!match && in_match) { - outputs[s] += "" + Utils.escape_html(samples[s][i]); - if (s === samples.length - 1) in_match = false; + if (s === samples.length - 1) inMatch = true; + } else if (!match && inMatch) { + outputs[s] += "" + Utils.escapeHtml(samples[s][i]); + if (s === samples.length - 1) inMatch = false; } else { - outputs[s] += Utils.escape_html(samples[s][i]); - if (in_match && samples[s].length === i + 1) { + outputs[s] += Utils.escapeHtml(samples[s][i]); + if (inMatch && samples[s].length === i + 1) { outputs[s] += ""; - if (samples[s].length - 1 !== i) in_match = false; + if (samples[s].length - 1 !== i) inMatch = false; } } if (samples[0].length - 1 === i) { - if (in_match) outputs[s] += ""; - outputs[s] += Utils.escape_html(samples[s].substring(i + 1)); + if (inMatch) outputs[s] += ""; + outputs[s] += Utils.escapeHtml(samples[s].substring(i + 1)); } } } - return outputs.join(sample_delim); + return outputs.join(sampleDelim); }, @@ -453,8 +453,8 @@ var StrUtils = { * @param {Object[]} args * @returns {string} */ - run_parse_escaped_string: function(input, args) { - return Utils.parse_escaped_chars(input); + runParseEscapedString: function(input, args) { + return Utils.parseEscapedChars(input); }, @@ -464,10 +464,10 @@ var StrUtils = { * @private * @param {string} input * @param {RegExp} regex - * @param {boolean} display_total + * @param {boolean} displayTotal * @returns {string} */ - _regex_highlight: function(input, regex, display_total) { + _regexHighlight: function(input, regex, displayTotal) { var output = "", m, hl = 1, @@ -476,10 +476,10 @@ var StrUtils = { while ((m = regex.exec(input))) { // Add up to match - output += Utils.escape_html(input.slice(i, m.index)); + output += Utils.escapeHtml(input.slice(i, m.index)); // Add match with highlighting - output += "" + Utils.escape_html(m[0]) + ""; + output += "" + Utils.escapeHtml(m[0]) + ""; // Switch highlight hl = hl === 1 ? 2 : 1; @@ -489,9 +489,9 @@ var StrUtils = { } // Add all after final match - output += Utils.escape_html(input.slice(i, input.length)); + output += Utils.escapeHtml(input.slice(i, input.length)); - if (display_total) + if (displayTotal) output = "Total found: " + total + "\n\n" + output; return output; @@ -504,12 +504,12 @@ var StrUtils = { * @private * @param {string} input * @param {RegExp} regex - * @param {boolean} display_total + * @param {boolean} displayTotal * @param {boolean} matches - Display full match - * @param {boolean} capture_groups - Display each of the capture groups separately + * @param {boolean} captureGroups - Display each of the capture groups separately * @returns {string} */ - _regex_list: function(input, regex, display_total, matches, capture_groups) { + _regexList: function(input, regex, displayTotal, matches, captureGroups) { var output = "", total = 0, match; @@ -519,7 +519,7 @@ var StrUtils = { if (matches) { output += match[0] + "\n"; } - if (capture_groups) { + if (captureGroups) { for (var i = 1; i < match.length; i++) { if (matches) { output += " Group " + i + ": "; @@ -529,7 +529,7 @@ var StrUtils = { } } - if (display_total) + if (displayTotal) output = "Total found: " + total + "\n\n" + output; return output; diff --git a/src/js/operations/Tidy.js b/src/js/operations/Tidy.js index a06f722a..8b708c89 100755 --- a/src/js/operations/Tidy.js +++ b/src/js/operations/Tidy.js @@ -47,21 +47,21 @@ var Tidy = { * @param {Object[]} args * @returns {string} */ - run_remove_whitespace: function (input, args) { - var remove_spaces = args[0], - remove_cariage_returns = args[1], - remove_line_feeds = args[2], - remove_tabs = args[3], - remove_form_feeds = args[4], - remove_full_stops = args[5], + runRemoveWhitespace: function (input, args) { + var removeSpaces = args[0], + removeCariageReturns = args[1], + removeLineFeeds = args[2], + removeTabs = args[3], + removeFormFeeds = args[4], + removeFullStops = args[5], data = input; - if (remove_spaces) data = data.replace(/ /g, ""); - if (remove_cariage_returns) data = data.replace(/\r/g, ""); - if (remove_line_feeds) data = data.replace(/\n/g, ""); - if (remove_tabs) data = data.replace(/\t/g, ""); - if (remove_form_feeds) data = data.replace(/\f/g, ""); - if (remove_full_stops) data = data.replace(/\./g, ""); + if (removeSpaces) data = data.replace(/ /g, ""); + if (removeCariageReturns) data = data.replace(/\r/g, ""); + if (removeLineFeeds) data = data.replace(/\n/g, ""); + if (removeTabs) data = data.replace(/\t/g, ""); + if (removeFormFeeds) data = data.replace(/\f/g, ""); + if (removeFullStops) data = data.replace(/\./g, ""); return data; }, @@ -69,11 +69,11 @@ var Tidy = { /** * Remove null bytes operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args - * @returns {byte_array} + * @returns {byteArray} */ - run_remove_nulls: function (input, args) { + runRemoveNulls: function (input, args) { var output = []; for (var i = 0; i < input.length; i++) { if (input[i] !== 0) output.push(input[i]); @@ -101,19 +101,19 @@ var Tidy = { /** * Drop bytes operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args - * @returns {byte_array} + * @returns {byteArray} */ - run_drop_bytes: function(input, args) { + runDropBytes: function(input, args) { var start = args[0], length = args[1], - apply_to_each_line = args[2]; + applyToEachLine = args[2]; if (start < 0 || length < 0) throw "Error: Invalid value"; - if (!apply_to_each_line) + if (!applyToEachLine) return input.slice(0, start).concat(input.slice(start+length, input.length)); // Split input into lines @@ -153,19 +153,19 @@ var Tidy = { /** * Take bytes operation. * - * @param {byte_array} input + * @param {byteArray} input * @param {Object[]} args - * @returns {byte_array} + * @returns {byteArray} */ - run_take_bytes: function(input, args) { + runTakeBytes: function(input, args) { var start = args[0], length = args[1], - apply_to_each_line = args[2]; + applyToEachLine = args[2]; if (start < 0 || length < 0) throw "Error: Invalid value"; - if (!apply_to_each_line) + if (!applyToEachLine) return input.slice(start, start+length); // Split input into lines @@ -214,7 +214,7 @@ var Tidy = { * @param {Object[]} args * @returns {string} */ - run_pad: function(input, args) { + runPad: function(input, args) { var position = args[0], len = args[1], chr = args[2], @@ -224,11 +224,11 @@ var Tidy = { if (position === "Start") { for (i = 0; i < lines.length; i++) { - output += Utils.pad_left(lines[i], lines[i].length+len, chr) + "\n"; + output += Utils.padLeft(lines[i], lines[i].length+len, chr) + "\n"; } } else if (position === "End") { for (i = 0; i < lines.length; i++) { - output += Utils.pad_right(lines[i], lines[i].length+len, chr) + "\n"; + output += Utils.padRight(lines[i], lines[i].length+len, chr) + "\n"; } } diff --git a/src/js/operations/URL.js b/src/js/operations/URL.js index 6f0c69d1..4ed0f923 100755 --- a/src/js/operations/URL.js +++ b/src/js/operations/URL.js @@ -25,9 +25,9 @@ var URL_ = { * @param {Object[]} args * @returns {string} */ - run_to: function(input, args) { - var encode_all = args[0]; - return encode_all ? URL_._encode_all_chars(input) : encodeURI(input); + runTo: function(input, args) { + var encodeAll = args[0]; + return encodeAll ? URL_._encodeAllChars(input) : encodeURI(input); }, @@ -38,7 +38,7 @@ var URL_ = { * @param {Object[]} args * @returns {string} */ - run_from: function(input, args) { + runFrom: function(input, args) { var data = input.replace(/\+/g, "%20"); try { return decodeURIComponent(data); @@ -55,7 +55,7 @@ var URL_ = { * @param {Object[]} args * @returns {string} */ - run_parse: function(input, args) { + runParse: function(input, args) { var a = document.createElement("a"); // Overwrite base href which will be the current CyberChef URL to reduce confusion. @@ -85,15 +85,15 @@ var URL_ = { if (a.search && a.search !== window.location.search) { output += "Arguments:\n"; var args_ = (a.search.slice(1, a.search.length)).split("&"); - var split_args = [], padding = 0; + var splitArgs = [], padding = 0; for (var i = 0; i < args_.length; i++) { - split_args.push(args_[i].split("=")); - padding = (split_args[i][0].length > padding) ? split_args[i][0].length : padding; + splitArgs.push(args_[i].split("=")); + padding = (splitArgs[i][0].length > padding) ? splitArgs[i][0].length : padding; } - for (i = 0; i < split_args.length; i++) { - output += "\t" + Utils.pad_right(split_args[i][0], padding); - if (split_args[i].length > 1 && split_args[i][1].length) - output += " = " + split_args[i][1] + "\n"; + for (i = 0; i < splitArgs.length; i++) { + output += "\t" + Utils.padRight(splitArgs[i][0], padding); + if (splitArgs[i].length > 1 && splitArgs[i][1].length) + output += " = " + splitArgs[i][1] + "\n"; else output += "\n"; } } @@ -112,7 +112,7 @@ var URL_ = { * @param {string} str * @returns {string} */ - _encode_all_chars: function(str) { + _encodeAllChars: function(str) { //TODO Do this programatically return encodeURIComponent(str) .replace(/!/g, "%21") diff --git a/src/js/operations/UUID.js b/src/js/operations/UUID.js index c175f509..2248eb63 100755 --- a/src/js/operations/UUID.js +++ b/src/js/operations/UUID.js @@ -16,7 +16,7 @@ var UUID = { * @param {Object[]} args * @returns {string} */ - run_generate_v4: function(input, args) { + runGenerateV4: function(input, args) { if (typeof(window.crypto) !== "undefined" && typeof(window.crypto.getRandomValues) !== "undefined") { var buf = new Uint32Array(4), i = 0; diff --git a/src/js/operations/Unicode.js b/src/js/operations/Unicode.js index 6a850c0d..d93ed9e5 100755 --- a/src/js/operations/Unicode.js +++ b/src/js/operations/Unicode.js @@ -22,8 +22,8 @@ var Unicode = { * @param {Object[]} args * @returns {string} */ - run_unescape: function(input, args) { - var prefix = Unicode._prefix_to_regex[args[0]], + runUnescape: function(input, args) { + var prefix = Unicode._prefixToRegex[args[0]], regex = new RegExp(prefix+"([a-f\\d]{4,6})", "ig"), output = "", m, @@ -53,7 +53,7 @@ var Unicode = { * @private * @constant */ - _prefix_to_regex: { + _prefixToRegex: { "\\u": "\\\\u", "%u": "%u", "U+": "U\\+" diff --git a/src/js/views/html/ControlsWaiter.js b/src/js/views/html/ControlsWaiter.js index 6ddc08d1..aefa4292 100755 --- a/src/js/views/html/ControlsWaiter.js +++ b/src/js/views/html/ControlsWaiter.js @@ -19,15 +19,15 @@ var ControlsWaiter = function(app, manager) { * Adjusts the display properties of the control buttons so that they fit within the current width * without wrapping or overflowing. */ -ControlsWaiter.prototype.adjust_width = function() { - var controls = document.getElementById("controls"), - step = document.getElementById("step"), - clr_breaks = document.getElementById("clr-breaks"), - save_img = document.querySelector("#save img"), - load_img = document.querySelector("#load img"), - step_img = document.querySelector("#step img"), - clr_recip_img = document.querySelector("#clr-recipe img"), - clr_breaks_img = document.querySelector("#clr-breaks img"); +ControlsWaiter.prototype.adjustWidth = function() { + var controls = document.getElementById("controls"), + step = document.getElementById("step"), + clrBreaks = document.getElementById("clr-breaks"), + saveImg = document.querySelector("#save img"), + loadImg = document.querySelector("#load img"), + stepImg = document.querySelector("#step img"), + clrRecipImg = document.querySelector("#clr-recipe img"), + clrBreaksImg = document.querySelector("#clr-breaks img"); if (controls.clientWidth < 470) { step.childNodes[1].nodeValue = " Step"; @@ -36,23 +36,23 @@ ControlsWaiter.prototype.adjust_width = function() { } if (controls.clientWidth < 400) { - save_img.style.display = "none"; - load_img.style.display = "none"; - step_img.style.display = "none"; - clr_recip_img.style.display = "none"; - clr_breaks_img.style.display = "none"; + saveImg.style.display = "none"; + loadImg.style.display = "none"; + stepImg.style.display = "none"; + clrRecipImg.style.display = "none"; + clrBreaksImg.style.display = "none"; } else { - save_img.style.display = "inline"; - load_img.style.display = "inline"; - step_img.style.display = "inline"; - clr_recip_img.style.display = "inline"; - clr_breaks_img.style.display = "inline"; + saveImg.style.display = "inline"; + loadImg.style.display = "inline"; + stepImg.style.display = "inline"; + clrRecipImg.style.display = "inline"; + clrBreaksImg.style.display = "inline"; } if (controls.clientWidth < 330) { - clr_breaks.childNodes[1].nodeValue = " Clear breaks"; + clrBreaks.childNodes[1].nodeValue = " Clear breaks"; } else { - clr_breaks.childNodes[1].nodeValue = " Clear breakpoints"; + clrBreaks.childNodes[1].nodeValue = " Clear breakpoints"; } }; @@ -62,11 +62,11 @@ ControlsWaiter.prototype.adjust_width = function() { * * @param {boolean} value - The new value for Auto Bake. */ -ControlsWaiter.prototype.set_auto_bake = function(value) { - var auto_bake_checkbox = document.getElementById("auto-bake"); +ControlsWaiter.prototype.setAutoBake = function(value) { + var autoBakeCheckbox = document.getElementById("auto-bake"); - if (auto_bake_checkbox.checked !== value) { - auto_bake_checkbox.click(); + if (autoBakeCheckbox.checked !== value) { + autoBakeCheckbox.click(); } }; @@ -74,7 +74,7 @@ ControlsWaiter.prototype.set_auto_bake = function(value) { /** * Handler to trigger baking. */ -ControlsWaiter.prototype.bake_click = function() { +ControlsWaiter.prototype.bakeClick = function() { this.app.bake(); $("#output-text").selectRange(0); }; @@ -83,7 +83,7 @@ ControlsWaiter.prototype.bake_click = function() { /** * Handler for the 'Step through' command. Executes the next step of the recipe. */ -ControlsWaiter.prototype.step_click = function() { +ControlsWaiter.prototype.stepClick = function() { this.app.bake(true); $("#output-text").selectRange(0); }; @@ -92,18 +92,18 @@ ControlsWaiter.prototype.step_click = function() { /** * Handler for changes made to the Auto Bake checkbox. */ -ControlsWaiter.prototype.auto_bake_change = function() { - var auto_bake_label = document.getElementById("auto-bake-label"), - auto_bake_checkbox = document.getElementById("auto-bake"); +ControlsWaiter.prototype.autoBakeChange = function() { + var autoBakeLabel = document.getElementById("auto-bake-label"), + autoBakeCheckbox = document.getElementById("auto-bake"); - this.app.auto_bake_ = auto_bake_checkbox.checked; + this.app.autoBake_ = autoBakeCheckbox.checked; - if (auto_bake_checkbox.checked) { - auto_bake_label.classList.remove("btn-default"); - auto_bake_label.classList.add("btn-success"); + if (autoBakeCheckbox.checked) { + autoBakeLabel.classList.remove("btn-default"); + autoBakeLabel.classList.add("btn-success"); } else { - auto_bake_label.classList.remove("btn-success"); - auto_bake_label.classList.add("btn-default"); + autoBakeLabel.classList.remove("btn-success"); + autoBakeLabel.classList.add("btn-default"); } }; @@ -111,8 +111,8 @@ ControlsWaiter.prototype.auto_bake_change = function() { /** * Handler for the 'Clear recipe' command. Removes all operations from the recipe. */ -ControlsWaiter.prototype.clear_recipe_click = function() { - this.manager.recipe.clear_recipe(); +ControlsWaiter.prototype.clearRecipeClick = function() { + this.manager.recipe.clearRecipe(); }; @@ -120,8 +120,8 @@ ControlsWaiter.prototype.clear_recipe_click = function() { * Handler for the 'Clear breakpoints' command. Removes all breakpoints from operations in the * recipe. */ -ControlsWaiter.prototype.clear_breaks_click = function() { - var bps = document.querySelectorAll("#rec_list li.operation .breakpoint"); +ControlsWaiter.prototype.clearBreaksClick = function() { + var bps = document.querySelectorAll("#rec-list li.operation .breakpoint"); for (var i = 0; i < bps.length; i++) { bps[i].setAttribute("break", "false"); @@ -133,49 +133,49 @@ ControlsWaiter.prototype.clear_breaks_click = function() { /** * Populates the save disalog box with a URL incorporating the recipe and input. * - * @param {Object[]} [recipe_config] - The recipe configuration object array. + * @param {Object[]} [recipeConfig] - The recipe configuration object array. */ -ControlsWaiter.prototype.initialise_save_link = function(recipe_config) { - recipe_config = recipe_config || this.app.get_recipe_config(); +ControlsWaiter.prototype.initialiseSaveLink = function(recipeConfig) { + recipeConfig = recipeConfig || this.app.getRecipeConfig(); - var include_recipe = document.getElementById("save-link-recipe-checkbox").checked, - include_input = document.getElementById("save-link-input-checkbox").checked, - save_link_el = document.getElementById("save-link"), - save_link = this.generate_state_url(include_recipe, include_input, recipe_config); + var includeRecipe = document.getElementById("save-link-recipe-checkbox").checked, + includeInput = document.getElementById("save-link-input-checkbox").checked, + saveLinkEl = document.getElementById("save-link"), + saveLink = this.generateStateUrl(includeRecipe, includeInput, recipeConfig); - save_link_el.innerHTML = Utils.truncate(save_link, 120); - save_link_el.setAttribute("href", save_link); + saveLinkEl.innerHTML = Utils.truncate(saveLink, 120); + saveLinkEl.setAttribute("href", saveLink); }; /** * Generates a URL containing the current recipe and input state. * - * @param {boolean} include_recipe - Whether to include the recipe in the URL. - * @param {boolean} include_input - Whether to include the input in the URL. - * @param {Object[]} [recipe_config] - The recipe configuration object array. + * @param {boolean} includeRecipe - Whether to include the recipe in the URL. + * @param {boolean} includeInput - Whether to include the input in the URL. + * @param {Object[]} [recipeConfig] - The recipe configuration object array. * @returns {string} */ -ControlsWaiter.prototype.generate_state_url = function(include_recipe, include_input, recipe_config) { - recipe_config = recipe_config || this.app.get_recipe_config(); +ControlsWaiter.prototype.generateStateUrl = function(includeRecipe, includeInput, recipeConfig) { + recipeConfig = recipeConfig || this.app.getRecipeConfig(); var link = window.location.protocol + "//" + window.location.host + window.location.pathname, - recipe_str = JSON.stringify(recipe_config), - input_str = Utils.to_base64(this.app.get_input(), "A-Za-z0-9+/"); // B64 alphabet with no padding + recipeStr = JSON.stringify(recipeConfig), + inputStr = Utils.toBase64(this.app.getInput(), "A-Za-z0-9+/"); // B64 alphabet with no padding - include_recipe = include_recipe && (recipe_config.length > 0); - include_input = include_input && (input_str.length > 0) && (input_str.length < 8000); + includeRecipe = includeRecipe && (recipeConfig.length > 0); + includeInput = includeInput && (inputStr.length > 0) && (inputStr.length < 8000); - if (include_recipe) { - link += "?recipe=" + encodeURIComponent(recipe_str); + if (includeRecipe) { + link += "?recipe=" + encodeURIComponent(recipeStr); } - if (include_recipe && include_input) { - link += "&input=" + encodeURIComponent(input_str); - } else if (include_input) { - link += "?input=" + encodeURIComponent(input_str); + if (includeRecipe && includeInput) { + link += "&input=" + encodeURIComponent(inputStr); + } else if (includeInput) { + link += "?input=" + encodeURIComponent(inputStr); } return link; @@ -185,10 +185,10 @@ ControlsWaiter.prototype.generate_state_url = function(include_recipe, include_i /** * Handler for changes made to the save dialog text area. Re-initialises the save link. */ -ControlsWaiter.prototype.save_text_change = function() { +ControlsWaiter.prototype.saveTextChange = function() { try { - var recipe_config = JSON.parse(document.getElementById("save-text").value); - this.initialise_save_link(recipe_config); + var recipeConfig = JSON.parse(document.getElementById("save-text").value); + this.initialiseSaveLink(recipeConfig); } catch(err) {} }; @@ -196,12 +196,13 @@ ControlsWaiter.prototype.save_text_change = function() { /** * Handler for the 'Save' command. Pops up the save dialog box. */ -ControlsWaiter.prototype.save_click = function() { - var recipe_config = this.app.get_recipe_config(); - var recipe_str = JSON.stringify(recipe_config).replace(/},{/g, "},\n{"); - document.getElementById("save-text").value = recipe_str; +ControlsWaiter.prototype.saveClick = function() { + var recipeConfig = this.app.getRecipeConfig(), + recipeStr = JSON.stringify(recipeConfig).replace(/},{/g, "},\n{"); + + document.getElementById("save-text").value = recipeStr; - this.initialise_save_link(recipe_config); + this.initialiseSaveLink(recipeConfig); $("#save-modal").modal(); }; @@ -209,24 +210,24 @@ ControlsWaiter.prototype.save_click = function() { /** * Handler for the save link recipe checkbox change event. */ -ControlsWaiter.prototype.slr_check_change = function() { - this.initialise_save_link(); +ControlsWaiter.prototype.slrCheckChange = function() { + this.initialiseSaveLink(); }; /** * Handler for the save link input checkbox change event. */ -ControlsWaiter.prototype.sli_check_change = function() { - this.initialise_save_link(); +ControlsWaiter.prototype.sliCheckChange = function() { + this.initialiseSaveLink(); }; /** * Handler for the 'Load' command. Pops up the load dialog box. */ -ControlsWaiter.prototype.load_click = function() { - this.populate_load_recipes_list(); +ControlsWaiter.prototype.loadClick = function() { + this.populateLoadRecipesList(); $("#load-modal").modal(); }; @@ -234,88 +235,88 @@ ControlsWaiter.prototype.load_click = function() { /** * Saves the recipe specified in the save textarea to local storage. */ -ControlsWaiter.prototype.save_button_click = function() { - var recipe_name = document.getElementById("save-name").value, - recipe_str = document.getElementById("save-text").value; +ControlsWaiter.prototype.saveButtonClick = function() { + var recipeName = document.getElementById("save-name").value, + recipeStr = document.getElementById("save-text").value; - if (!recipe_name) { + if (!recipeName) { this.app.alert("Please enter a recipe name", "danger", 2000); return; } - var saved_recipes = localStorage.saved_recipes ? - JSON.parse(localStorage.saved_recipes) : [], - recipe_id = localStorage.recipe_id || 0; + var savedRecipes = localStorage.savedRecipes ? + JSON.parse(localStorage.savedRecipes) : [], + recipeId = localStorage.recipeId || 0; - saved_recipes.push({ - id: ++recipe_id, - name: recipe_name, - recipe: recipe_str + savedRecipes.push({ + id: ++recipeId, + name: recipeName, + recipe: recipeStr }); - localStorage.saved_recipes = JSON.stringify(saved_recipes); - localStorage.recipe_id = recipe_id; + localStorage.savedRecipes = JSON.stringify(savedRecipes); + localStorage.recipeId = recipeId; - this.app.alert("Recipe saved as \"" + recipe_name + "\".", "success", 2000); + this.app.alert("Recipe saved as \"" + recipeName + "\".", "success", 2000); }; /** * Populates the list of saved recipes in the load dialog box from local storage. */ -ControlsWaiter.prototype.populate_load_recipes_list = function() { - var load_name_el = document.getElementById("load-name"); +ControlsWaiter.prototype.populateLoadRecipesList = function() { + var loadNameEl = document.getElementById("load-name"); // Remove current recipes from select - var i = load_name_el.options.length; + var i = loadNameEl.options.length; while (i--) { - load_name_el.remove(i); + loadNameEl.remove(i); } // Add recipes to select - var saved_recipes = localStorage.saved_recipes ? - JSON.parse(localStorage.saved_recipes) : []; + var savedRecipes = localStorage.savedRecipes ? + JSON.parse(localStorage.savedRecipes) : []; - for (i = 0; i < saved_recipes.length; i++) { + for (i = 0; i < savedRecipes.length; i++) { var opt = document.createElement("option"); - opt.value = saved_recipes[i].id; - opt.innerHTML = saved_recipes[i].name; + opt.value = savedRecipes[i].id; + opt.innerHTML = savedRecipes[i].name; - load_name_el.appendChild(opt); + loadNameEl.appendChild(opt); } // Populate textarea with first recipe - document.getElementById("load-text").value = saved_recipes.length ? saved_recipes[0].recipe : ""; + document.getElementById("load-text").value = savedRecipes.length ? savedRecipes[0].recipe : ""; }; /** * Removes the currently selected recipe from local storage. */ -ControlsWaiter.prototype.load_delete_click = function() { +ControlsWaiter.prototype.loadDeleteClick = function() { var id = parseInt(document.getElementById("load-name").value, 10), - saved_recipes = localStorage.saved_recipes ? - JSON.parse(localStorage.saved_recipes) : []; + savedRecipes = localStorage.savedRecipes ? + JSON.parse(localStorage.savedRecipes) : []; - saved_recipes = saved_recipes.filter(function(r) { + savedRecipes = savedRecipes.filter(function(r) { return r.id !== id; }); - localStorage.saved_recipes = JSON.stringify(saved_recipes); - this.populate_load_recipes_list(); + localStorage.savedRecipes = JSON.stringify(savedRecipes); + this.populateLoadRecipesList(); }; /** * Displays the selected recipe in the load text box. */ -ControlsWaiter.prototype.load_name_change = function(e) { +ControlsWaiter.prototype.loadNameChange = function(e) { var el = e.target, - saved_recipes = localStorage.saved_recipes ? - JSON.parse(localStorage.saved_recipes) : [], + savedRecipes = localStorage.savedRecipes ? + JSON.parse(localStorage.savedRecipes) : [], id = parseInt(el.value, 10); - var recipe = saved_recipes.filter(function(r) { + var recipe = savedRecipes.filter(function(r) { return r.id === id; })[0]; @@ -326,12 +327,12 @@ ControlsWaiter.prototype.load_name_change = function(e) { /** * Loads the selected recipe and populates the Recipe with its operations. */ -ControlsWaiter.prototype.load_button_click = function() { +ControlsWaiter.prototype.loadButtonClick = function() { try { - var recipe_config = JSON.parse(document.getElementById("load-text").value); - this.app.set_recipe_config(recipe_config); + var recipeConfig = JSON.parse(document.getElementById("load-text").value); + this.app.setRecipeConfig(recipeConfig); - $("#rec_list [data-toggle=popover]").popover(); + $("#rec-list [data-toggle=popover]").popover(); } catch(e) { this.app.alert("Invalid recipe", "danger", 2000); } diff --git a/src/js/views/html/HTMLApp.js b/src/js/views/html/HTMLApp.js index 4440a88b..b4930da4 100755 --- a/src/js/views/html/HTMLApp.js +++ b/src/js/views/html/HTMLApp.js @@ -11,22 +11,22 @@ * @constructor * @param {CatConf[]} categories - The list of categories and operations to be populated. * @param {Object.} operations - The list of operation configuration objects. - * @param {String[]} default_favourites - A list of default favourite operations. + * @param {String[]} defaultFavourites - A list of default favourite operations. * @param {Object} options - Default setting for app options. */ -var HTMLApp = function(categories, operations, default_favourites, default_options) { +var HTMLApp = function(categories, operations, defaultFavourites, defaultOptions) { this.categories = categories; this.operations = operations; - this.dfavourites = default_favourites; - this.doptions = default_options; - this.options = Utils.extend({}, default_options); + this.dfavourites = defaultFavourites; + this.doptions = defaultOptions; + this.options = Utils.extend({}, defaultOptions); this.chef = new Chef(); this.manager = new Manager(this); - this.auto_bake_ = false; + this.autoBake_ = false; this.progress = 0; - this.ing_id = 0; + this.ingId = 0; window.chef = this.chef; }; @@ -39,13 +39,13 @@ var HTMLApp = function(categories, operations, default_favourites, default_optio */ HTMLApp.prototype.setup = function() { document.dispatchEvent(this.manager.appstart); - this.initialise_splitter(); - this.load_local_storage(); - this.populate_operations_list(); + this.initialiseSplitter(); + this.loadLocalStorage(); + this.populateOperationsList(); this.manager.setup(); - this.reset_layout(); - this.set_compile_message(); - this.load_URI_params(); + this.resetLayout(); + this.setCompileMessage(); + this.loadURIParams(); }; @@ -54,10 +54,10 @@ HTMLApp.prototype.setup = function() { * * @param {Error} err */ -HTMLApp.prototype.handle_error = function(err) { +HTMLApp.prototype.handleError = function(err) { console.error(err); - var msg = err.display_str || err.toString(); - this.alert(msg, "danger", this.options.error_timeout, !this.options.show_errors); + var msg = err.displayStr || err.toString(); + this.alert(msg, "danger", this.options.errorTimeout, !this.options.showErrors); }; @@ -72,32 +72,32 @@ HTMLApp.prototype.bake = function(step) { try { response = this.chef.bake( - this.get_input(), // The user's input - this.get_recipe_config(), // The configuration of the recipe + this.getInput(), // The user's input + this.getRecipeConfig(), // The configuration of the recipe this.options, // Options set by the user this.progress, // The current position in the recipe step // Whether or not to take one step or execute the whole recipe ); } catch (err) { - this.handle_error(err); + this.handleError(err); } if (!response) return; if (response.error) { - this.handle_error(response.error); + this.handleError(response.error); } this.options = response.options; - this.dish_str = response.type === "html" ? Utils.strip_html_tags(response.result, true) : response.result; + this.dishStr = response.type === "html" ? Utils.stripHtmlTags(response.result, true) : response.result; this.progress = response.progress; - this.manager.recipe.update_breakpoint_indicator(response.progress); + this.manager.recipe.updateBreakpointIndicator(response.progress); this.manager.output.set(response.result, response.type, response.duration); // If baking took too long, disable auto-bake - if (response.duration > this.options.auto_bake_threshold && this.auto_bake_) { - this.manager.controls.set_auto_bake(false); - this.alert("Baking took longer than " + this.options.auto_bake_threshold + + if (response.duration > this.options.autoBakeThreshold && this.autoBake_) { + this.manager.controls.setAutoBake(false); + this.alert("Baking took longer than " + this.options.autoBakeThreshold + "ms, Auto Bake has been disabled.", "warning", 5000); } }; @@ -106,8 +106,8 @@ HTMLApp.prototype.bake = function(step) { /** * Runs Auto Bake if it is set. */ -HTMLApp.prototype.auto_bake = function() { - if (this.auto_bake_) { +HTMLApp.prototype.autoBake = function() { + if (this.autoBake_) { this.bake(); } }; @@ -122,15 +122,15 @@ HTMLApp.prototype.auto_bake = function() { * * @returns {number} - The number of miliseconds it took to run the silent bake. */ -HTMLApp.prototype.silent_bake = function() { - var start_time = new Date().getTime(), - recipe_config = this.get_recipe_config(); +HTMLApp.prototype.silentBake = function() { + var startTime = new Date().getTime(), + recipeConfig = this.getRecipeConfig(); - if (this.auto_bake_) { - this.chef.silent_bake(recipe_config); + if (this.autoBake_) { + this.chef.silentBake(recipeConfig); } - return new Date().getTime() - start_time; + return new Date().getTime() - startTime; }; @@ -139,11 +139,11 @@ HTMLApp.prototype.silent_bake = function() { * * @returns {string} */ -HTMLApp.prototype.get_input = function() { +HTMLApp.prototype.getInput = function() { var input = this.manager.input.get(); // Save to session storage in case we need to restore it later - sessionStorage.setItem("input_length", input.length); + sessionStorage.setItem("inputLength", input.length); sessionStorage.setItem("input", input); return input; @@ -155,8 +155,8 @@ HTMLApp.prototype.get_input = function() { * * @param {string} input - The string to set the input to */ -HTMLApp.prototype.set_input = function(input) { - sessionStorage.setItem("input_length", input.length); +HTMLApp.prototype.setInput = function(input) { + sessionStorage.setItem("inputLength", input.length); sessionStorage.setItem("input", input); this.manager.input.set(input); }; @@ -168,32 +168,32 @@ HTMLApp.prototype.set_input = function(input) { * * @fires Manager#oplistcreate */ -HTMLApp.prototype.populate_operations_list = function() { +HTMLApp.prototype.populateOperationsList = function() { // Move edit button away before we overwrite it document.body.appendChild(document.getElementById("edit-favourites")); var html = ""; for (var i = 0; i < this.categories.length; i++) { - var cat_conf = this.categories[i], + var catConf = this.categories[i], selected = i === 0, - cat = new HTMLCategory(cat_conf.name, selected); + cat = new HTMLCategory(catConf.name, selected); - for (var j = 0; j < cat_conf.ops.length; j++) { - var op_name = cat_conf.ops[j], - op = new HTMLOperation(op_name, this.operations[op_name], this, this.manager); - cat.add_operation(op); + for (var j = 0; j < catConf.ops.length; j++) { + var opName = catConf.ops[j], + op = new HTMLOperation(opName, this.operations[opName], this, this.manager); + cat.addOperation(op); } - html += cat.to_html(); + html += cat.toHtml(); } document.getElementById("categories").innerHTML = html; - var op_lists = document.querySelectorAll("#categories .op_list"); + var opLists = document.querySelectorAll("#categories .op-list"); - for (i = 0; i < op_lists.length; i++) { - op_lists[i].dispatchEvent(this.manager.oplistcreate); + for (i = 0; i < opLists.length; i++) { + opLists[i].dispatchEvent(this.manager.oplistcreate); } // Add edit button to first category (Favourites) @@ -204,23 +204,23 @@ HTMLApp.prototype.populate_operations_list = function() { /** * Sets up the adjustable splitter to allow the user to resize areas of the page. */ -HTMLApp.prototype.initialise_splitter = function() { - this.column_splitter = Split(["#operations", "#recipe", "#IO"], { +HTMLApp.prototype.initialiseSplitter = function() { + this.columnSplitter = Split(["#operations", "#recipe", "#IO"], { sizes: [20, 30, 50], minSize: [240, 325, 440], gutterSize: 4, onDrag: function() { - this.manager.controls.adjust_width(); - this.manager.output.adjust_width(); + this.manager.controls.adjustWidth(); + this.manager.output.adjustWidth(); }.bind(this) }); - this.io_splitter = Split(["#input", "#output"], { + this.ioSplitter = Split(["#input", "#output"], { direction: "vertical", gutterSize: 4, }); - this.reset_layout(); + this.resetLayout(); }; @@ -228,16 +228,16 @@ HTMLApp.prototype.initialise_splitter = function() { * Loads the information previously saved to the HTML5 local storage object so that user options * and favourites can be restored. */ -HTMLApp.prototype.load_local_storage = function() { +HTMLApp.prototype.loadLocalStorage = function() { // Load options - var l_options; + var lOptions; if (localStorage.options !== undefined) { - l_options = JSON.parse(localStorage.options); + lOptions = JSON.parse(localStorage.options); } - this.manager.options.load(l_options); + this.manager.options.load(lOptions); // Load favourites - this.load_favourites(); + this.loadFavourites(); }; @@ -246,21 +246,21 @@ HTMLApp.prototype.load_local_storage = function() { * Favourites category with them. * If the user currently has no saved favourites, the defaults from the view constructor are used. */ -HTMLApp.prototype.load_favourites = function() { +HTMLApp.prototype.loadFavourites = function() { var favourites = localStorage.favourites && localStorage.favourites.length > 2 ? JSON.parse(localStorage.favourites) : this.dfavourites; - favourites = this.valid_favourites(favourites); - this.save_favourites(favourites); + favourites = this.validFavourites(favourites); + this.saveFavourites(favourites); - var fav_cat = this.categories.filter(function(c) { + var favCat = this.categories.filter(function(c) { return c.name === "Favourites"; })[0]; - if (fav_cat) { - fav_cat.ops = favourites; + if (favCat) { + favCat.ops = favourites; } else { this.categories.unshift({ name: "Favourites", @@ -277,17 +277,17 @@ HTMLApp.prototype.load_favourites = function() { * @param {string[]} favourites - A list of the user's favourite operations * @returns {string[]} A list of the valid favourites */ -HTMLApp.prototype.valid_favourites = function(favourites) { - var valid_favs = []; +HTMLApp.prototype.validFavourites = function(favourites) { + var validFavs = []; for (var i = 0; i < favourites.length; i++) { if (this.operations.hasOwnProperty(favourites[i])) { - valid_favs.push(favourites[i]); + validFavs.push(favourites[i]); } else { - this.alert("The operation \"" + Utils.escape_html(favourites[i]) + + this.alert("The operation \"" + Utils.escapeHtml(favourites[i]) + "\" is no longer available. It has been removed from your favourites.", "info"); } } - return valid_favs; + return validFavs; }; @@ -296,8 +296,8 @@ HTMLApp.prototype.valid_favourites = function(favourites) { * * @param {string[]} favourites - A list of the user's favourite operations */ -HTMLApp.prototype.save_favourites = function(favourites) { - localStorage.setItem("favourites", JSON.stringify(this.valid_favourites(favourites))); +HTMLApp.prototype.saveFavourites = function(favourites) { + localStorage.setItem("favourites", JSON.stringify(this.validFavourites(favourites))); }; @@ -305,11 +305,11 @@ HTMLApp.prototype.save_favourites = function(favourites) { * Resets favourite operations back to the default as specified in the view constructor and * refreshes the operation list. */ -HTMLApp.prototype.reset_favourites = function() { - this.save_favourites(this.dfavourites); - this.load_favourites(); - this.populate_operations_list(); - this.manager.recipe.initialise_operation_drag_n_drop(); +HTMLApp.prototype.resetFavourites = function() { + this.saveFavourites(this.dfavourites); + this.loadFavourites(); + this.populateOperationsList(); + this.manager.recipe.initialiseOperationDragNDrop(); }; @@ -318,7 +318,7 @@ HTMLApp.prototype.reset_favourites = function() { * * @param {string} name - The name of the operation */ -HTMLApp.prototype.add_favourite = function(name) { +HTMLApp.prototype.addFavourite = function(name) { var favourites = JSON.parse(localStorage.favourites); if (favourites.indexOf(name) >= 0) { @@ -327,19 +327,19 @@ HTMLApp.prototype.add_favourite = function(name) { } favourites.push(name); - this.save_favourites(favourites); - this.load_favourites(); - this.populate_operations_list(); - this.manager.recipe.initialise_operation_drag_n_drop(); + this.saveFavourites(favourites); + this.loadFavourites(); + this.populateOperationsList(); + this.manager.recipe.initialiseOperationDragNDrop(); }; /** * Checks for input and recipe in the URI parameters and loads them if present. */ -HTMLApp.prototype.load_URI_params = function() { +HTMLApp.prototype.loadURIParams = function() { // Load query string from URI - this.query_string = (function(a) { + this.queryString = (function(a) { if (a === "") return {}; var b = {}; for (var i = 0; i < a.length; i++) { @@ -354,46 +354,46 @@ HTMLApp.prototype.load_URI_params = function() { })(window.location.search.substr(1).split("&")); // Turn off auto-bake while loading - var auto_bake_val = this.auto_bake_; - this.auto_bake_ = false; + var autoBakeVal = this.autoBake_; + this.autoBake_ = false; // Read in recipe from query string - if (this.query_string.recipe) { + if (this.queryString.recipe) { try { - var recipe_config = JSON.parse(this.query_string.recipe); - this.set_recipe_config(recipe_config); + var recipeConfig = JSON.parse(this.queryString.recipe); + this.setRecipeConfig(recipeConfig); } catch(err) {} - } else if (this.query_string.op) { + } else if (this.queryString.op) { // If there's no recipe, look for single operations - this.manager.recipe.clear_recipe(); + this.manager.recipe.clearRecipe(); try { - this.manager.recipe.add_operation(this.query_string.op); + this.manager.recipe.addOperation(this.queryString.op); } catch(err) { // If no exact match, search for nearest match and add that - var matched_ops = this.manager.ops.filter_operations(this.query_string.op, false); - if (matched_ops.length) { - this.manager.recipe.add_operation(matched_ops[0].name); + var matchedOps = this.manager.ops.filterOperations(this.queryString.op, false); + if (matchedOps.length) { + this.manager.recipe.addOperation(matchedOps[0].name); } // Populate search with the string var search = document.getElementById("search"); - search.value = this.query_string.op; + search.value = this.queryString.op; search.dispatchEvent(new Event("search")); } } // Read in input data from query string - if (this.query_string.input) { + if (this.queryString.input) { try { - var input_data = Utils.from_base64(this.query_string.input); - this.set_input(input_data); + var inputData = Utils.fromBase64(this.queryString.input); + this.setInput(inputData); } catch(err) {} } // Restore auto-bake state - this.auto_bake_ = auto_bake_val; - this.auto_bake(); + this.autoBake_ = autoBakeVal; + this.autoBake(); }; @@ -402,8 +402,8 @@ HTMLApp.prototype.load_URI_params = function() { * * @returns {number} */ -HTMLApp.prototype.next_ing_id = function() { - return this.ing_id++; +HTMLApp.prototype.nextIngId = function() { + return this.ingId++; }; @@ -412,48 +412,48 @@ HTMLApp.prototype.next_ing_id = function() { * * @returns {Object[]} */ -HTMLApp.prototype.get_recipe_config = function() { - var recipe_config = this.manager.recipe.get_config(); - sessionStorage.setItem("recipe_config", JSON.stringify(recipe_config)); - return recipe_config; +HTMLApp.prototype.getRecipeConfig = function() { + var recipeConfig = this.manager.recipe.getConfig(); + sessionStorage.setItem("recipeConfig", JSON.stringify(recipeConfig)); + return recipeConfig; }; /** * Given a recipe configuration, sets the recipe to that configuration. * - * @param {Object[]} recipe_config - The recipe configuration + * @param {Object[]} recipeConfig - The recipe configuration */ -HTMLApp.prototype.set_recipe_config = function(recipe_config) { - sessionStorage.setItem("recipe_config", JSON.stringify(recipe_config)); - document.getElementById("rec_list").innerHTML = null; +HTMLApp.prototype.setRecipeConfig = function(recipeConfig) { + sessionStorage.setItem("recipeConfig", JSON.stringify(recipeConfig)); + document.getElementById("rec-list").innerHTML = null; - for (var i = 0; i < recipe_config.length; i++) { - var item = this.manager.recipe.add_operation(recipe_config[i].op); + for (var i = 0; i < recipeConfig.length; i++) { + var item = this.manager.recipe.addOperation(recipeConfig[i].op); // Populate arguments var args = item.querySelectorAll(".arg"); for (var j = 0; j < args.length; j++) { if (args[j].getAttribute("type") === "checkbox") { // checkbox - args[j].checked = recipe_config[i].args[j]; + args[j].checked = recipeConfig[i].args[j]; } else if (args[j].classList.contains("toggle-string")) { - // toggle_string - args[j].value = recipe_config[i].args[j].string; + // toggleString + args[j].value = recipeConfig[i].args[j].string; args[j].previousSibling.children[0].innerHTML = - Utils.escape_html(recipe_config[i].args[j].option) + + Utils.escapeHtml(recipeConfig[i].args[j].option) + " "; } else { // all others - args[j].value = recipe_config[i].args[j]; + args[j].value = recipeConfig[i].args[j]; } } // Set disabled and breakpoint - if (recipe_config[i].disabled) { + if (recipeConfig[i].disabled) { item.querySelector(".disable-icon").click(); } - if (recipe_config[i].breakpoint) { + if (recipeConfig[i].breakpoint) { item.querySelector(".breakpoint").click(); } @@ -465,31 +465,31 @@ HTMLApp.prototype.set_recipe_config = function(recipe_config) { /** * Resets the splitter positions to default. */ -HTMLApp.prototype.reset_layout = function() { - this.column_splitter.setSizes([20, 30, 50]); - this.io_splitter.setSizes([50, 50]); +HTMLApp.prototype.resetLayout = function() { + this.columnSplitter.setSizes([20, 30, 50]); + this.ioSplitter.setSizes([50, 50]); - this.manager.controls.adjust_width(); - this.manager.output.adjust_width(); + this.manager.controls.adjustWidth(); + this.manager.output.adjustWidth(); }; /** * Sets the compile message. */ -HTMLApp.prototype.set_compile_message = function() { +HTMLApp.prototype.setCompileMessage = function() { // Display time since last build and compile message var now = new Date(), - time_since_compile = Utils.fuzzy_time(now.getTime() - window.compile_time), - compile_info = "Last build: " + - time_since_compile.substr(0, 1).toUpperCase() + time_since_compile.substr(1) + " ago"; + timeSinceCompile = Utils.fuzzyTime(now.getTime() - window.compileTime), + compileInfo = "Last build: " + + timeSinceCompile.substr(0, 1).toUpperCase() + timeSinceCompile.substr(1) + " ago"; - if (window.compile_message !== "") { - compile_info += " - " + window.compile_message; + if (window.compileMessage !== "") { + compileInfo += " - " + window.compileMessage; } - compile_info += ""; - document.getElementById("notice").innerHTML = compile_info; + compileInfo += ""; + document.getElementById("notice").innerHTML = compileInfo; }; @@ -525,32 +525,32 @@ HTMLApp.prototype.alert = function(str, style, timeout, silent) { style = style || "danger"; timeout = timeout || 0; - var alert_el = document.getElementById("alert"), - alert_content = document.getElementById("alert-content"); + var alertEl = document.getElementById("alert"), + alertContent = document.getElementById("alert-content"); - alert_el.classList.remove("alert-danger"); - alert_el.classList.remove("alert-warning"); - alert_el.classList.remove("alert-info"); - alert_el.classList.remove("alert-success"); - alert_el.classList.add("alert-" + style); + alertEl.classList.remove("alert-danger"); + alertEl.classList.remove("alert-warning"); + alertEl.classList.remove("alert-info"); + alertEl.classList.remove("alert-success"); + alertEl.classList.add("alert-" + style); // If the box hasn't been closed, append to it rather than replacing - if (alert_el.style.display === "block") { - alert_content.innerHTML += + if (alertEl.style.display === "block") { + alertContent.innerHTML += "

                                                                                                                                                                                                      [" + time.toLocaleTimeString() + "] " + str; } else { - alert_content.innerHTML = + alertContent.innerHTML = "[" + time.toLocaleTimeString() + "] " + str; } // Stop the animation if it is in progress $("#alert").stop(); - alert_el.style.display = "block"; - alert_el.style.opacity = 1; + alertEl.style.display = "block"; + alertEl.style.opacity = 1; if (timeout > 0) { - clearTimeout(this.alert_timeout); - this.alert_timeout = setTimeout(function(){ + clearTimeout(this.alertTimeout); + this.alertTimeout = setTimeout(function(){ $("#alert").slideUp(100); }, timeout); } @@ -576,20 +576,20 @@ HTMLApp.prototype.confirm = function(title, body, callback, scope) { document.getElementById("confirm-body").innerHTML = body; document.getElementById("confirm-modal").style.display = "block"; - this.confirm_closed = false; + this.confirmClosed = false; $("#confirm-modal").modal() .one("show.bs.modal", function(e) { - this.confirm_closed = false; + this.confirmClosed = false; }.bind(this)) .one("click", "#confirm-yes", function() { - this.confirm_closed = true; + this.confirmClosed = true; callback.bind(scope)(true); $("#confirm-modal").modal("hide"); }.bind(this)) .one("hide.bs.modal", function(e) { - if (!this.confirm_closed) + if (!this.confirmClosed) callback.bind(scope)(false); - this.confirm_closed = true; + this.confirmClosed = true; }.bind(this)); }; @@ -598,7 +598,7 @@ HTMLApp.prototype.confirm = function(title, body, callback, scope) { * Handler for the alert close button click event. * Closes the alert box. */ -HTMLApp.prototype.alert_close_click = function() { +HTMLApp.prototype.alertCloseClick = function() { document.getElementById("alert").style.display = "none"; }; @@ -610,13 +610,13 @@ HTMLApp.prototype.alert_close_click = function() { * @listens Manager#statechange * @param {event} e */ -HTMLApp.prototype.state_change = function(e) { - this.auto_bake(); +HTMLApp.prototype.stateChange = function(e) { + this.autoBake(); // Update the current history state (not creating a new one) - if (this.options.update_url) { - this.last_state_url = this.manager.controls.generate_state_url(true, true); - window.history.replaceState({}, "CyberChef", this.last_state_url); + if (this.options.updateUrl) { + this.lastStateUrl = this.manager.controls.generateStateUrl(true, true); + window.history.replaceState({}, "CyberChef", this.lastStateUrl); } }; @@ -627,9 +627,9 @@ HTMLApp.prototype.state_change = function(e) { * * @param {event} e */ -HTMLApp.prototype.pop_state = function(e) { - if (window.location.href.split("#")[0] !== this.last_state_url) { - this.load_URI_params(); +HTMLApp.prototype.popState = function(e) { + if (window.location.href.split("#")[0] !== this.lastStateUrl) { + this.loadURIParams(); } }; @@ -637,11 +637,11 @@ HTMLApp.prototype.pop_state = function(e) { /** * Function to call an external API from this view. */ -HTMLApp.prototype.call_api = function(url, type, data, data_type, content_type) { +HTMLApp.prototype.callApi = function(url, type, data, dataType, contentType) { type = type || "POST"; data = data || {}; - data_type = data_type || undefined; - content_type = content_type || "application/json"; + dataType = dataType || undefined; + contentType = contentType || "application/json"; var response = null, success = false; @@ -651,8 +651,8 @@ HTMLApp.prototype.call_api = function(url, type, data, data_type, content_type) async: false, type: type, data: data, - dataType: data_type, - contentType: content_type, + dataType: dataType, + contentType: contentType, success: function(data) { success = true; response = data; diff --git a/src/js/views/html/HTMLCategory.js b/src/js/views/html/HTMLCategory.js index 83909d50..071d3b81 100755 --- a/src/js/views/html/HTMLCategory.js +++ b/src/js/views/html/HTMLCategory.js @@ -12,7 +12,7 @@ var HTMLCategory = function(name, selected) { this.name = name; this.selected = selected; - this.op_list = []; + this.opList = []; }; @@ -21,8 +21,8 @@ var HTMLCategory = function(name, selected) { * * @param {HTMLOperation} operation - The operation to add. */ -HTMLCategory.prototype.add_operation = function(operation) { - this.op_list.push(operation); +HTMLCategory.prototype.addOperation = function(operation) { + this.opList.push(operation); }; @@ -31,18 +31,18 @@ HTMLCategory.prototype.add_operation = function(operation) { * * @returns {string} */ -HTMLCategory.prototype.to_html = function() { - var cat_name = "cat" + this.name.replace(/[\s/-:_]/g, ""); +HTMLCategory.prototype.toHtml = function() { + var catName = "cat" + this.name.replace(/[\s/-:_]/g, ""); var html = "
                                                                                                                                                                                                      \ \ + data-parent='#categories' href='#" + catName + "'>\ " + this.name + "\ \ -
                                                                                                                                                                                                        "; +
                                                                                                                                                                                                          "; - for (var i = 0; i < this.op_list.length; i++) { - html += this.op_list[i].to_stub_html(); + for (var i = 0; i < this.opList.length; i++) { + html += this.opList[i].toStubHtml(); } html += "
                                                                                                                                                                                                      "; diff --git a/src/js/views/html/HTMLIngredient.js b/src/js/views/html/HTMLIngredient.js index 086a7089..909b16cd 100755 --- a/src/js/views/html/HTMLIngredient.js +++ b/src/js/views/html/HTMLIngredient.js @@ -18,11 +18,11 @@ var HTMLIngredient = function(config, app, manager) { this.type = config.type; this.value = config.value; this.disabled = config.disabled || false; - this.disable_args = config.disable_args || false; + this.disableArgs = config.disableArgs || false; this.placeholder = config.placeholder || false; this.target = config.target; - this.toggle_values = config.toggle_values; - this.id = "ing-" + this.app.next_ing_id(); + this.toggleValues = config.toggleValues; + this.id = "ing-" + this.app.nextIngId(); }; @@ -31,12 +31,12 @@ var HTMLIngredient = function(config, app, manager) { * * @returns {string} */ -HTMLIngredient.prototype.to_html = function() { +HTMLIngredient.prototype.toHtml = function() { var inline = (this.type === "boolean" || this.type === "number" || this.type === "option" || - this.type === "short_string" || - this.type === "binary_short_string"), + this.type === "shortString" || + this.type === "binaryShortString"), html = inline ? "" : "
                                                                                                                                                                                                       
                                                                                                                                                                                                      ", i, m; @@ -46,50 +46,50 @@ HTMLIngredient.prototype.to_html = function() { switch (this.type) { case "string": - case "binary_string": - case "byte_array": - html += ""; break; - case "short_string": - case "binary_short_string": + case "shortString": + case "binaryShortString": html += ""; break; - case "toggle_string": + case "toggleString": html += "
                                                                                                                                                                                                      \
                                                                                                                                                                                                      "; break; case "number": - html += ""; break; case "boolean": - html += ""; - if (this.disable_args) { - this.manager.add_dynamic_listener("#" + this.id, "click", this.toggle_disable_args, this); + if (this.disableArgs) { + this.manager.addDynamicListener("#" + this.id, "click", this.toggleDisableArgs, this); } break; case "option": - html += ""; break; - case "populate_option": - html += ""; - this.manager.add_dynamic_listener("#" + this.id, "change", this.populate_option_change, this); + this.manager.addDynamicListener("#" + this.id, "change", this.populateOptionChange, this); break; - case "editable_option": + case "editableOption": html += "
                                                                                                                                                                                                      "; html += ""; html += ""; html += "
                                                                                                                                                                                                      "; - this.manager.add_dynamic_listener("#sel-" + this.id, "change", this.editable_option_change, this); + this.manager.addDynamicListener("#sel-" + this.id, "change", this.editableOptionChange, this); break; case "text": - html += ""; @@ -153,18 +153,18 @@ HTMLIngredient.prototype.to_html = function() { /** * Handler for argument disable toggle. - * Toggles disabled state for all arguments in the disable_args list for this ingredient. + * Toggles disabled state for all arguments in the disableArgs list for this ingredient. * * @param {event} e */ -HTMLIngredient.prototype.toggle_disable_args = function(e) { +HTMLIngredient.prototype.toggleDisableArgs = function(e) { var el = e.target, op = el.parentNode.parentNode, args = op.querySelectorAll(".arg-group"), els; - for (var i = 0; i < this.disable_args.length; i++) { - els = args[this.disable_args[i]].querySelectorAll("input, select, button"); + for (var i = 0; i < this.disableArgs.length; i++) { + els = args[this.disableArgs[i]].querySelectorAll("input, select, button"); for (var j = 0; j < els.length; j++) { if (els[j].getAttribute("disabled")) { @@ -175,7 +175,7 @@ HTMLIngredient.prototype.toggle_disable_args = function(e) { } } - this.manager.recipe.ing_change(); + this.manager.recipe.ingChange(); }; @@ -185,14 +185,14 @@ HTMLIngredient.prototype.toggle_disable_args = function(e) { * * @param {event} e */ -HTMLIngredient.prototype.populate_option_change = function(e) { +HTMLIngredient.prototype.populateOptionChange = function(e) { var el = e.target, op = el.parentNode.parentNode, target = op.querySelectorAll(".arg-group")[this.target].querySelector("input, select, textarea"); target.value = el.childNodes[el.selectedIndex].getAttribute("populate-value"); - this.manager.recipe.ing_change(); + this.manager.recipe.ingChange(); }; @@ -202,11 +202,11 @@ HTMLIngredient.prototype.populate_option_change = function(e) { * * @param {event} e */ -HTMLIngredient.prototype.editable_option_change = function(e) { +HTMLIngredient.prototype.editableOptionChange = function(e) { var select = e.target, input = select.nextSibling; input.value = select.childNodes[select.selectedIndex].value; - this.manager.recipe.ing_change(); + this.manager.recipe.ingChange(); }; diff --git a/src/js/views/html/HTMLOperation.js b/src/js/views/html/HTMLOperation.js index 1bf9849d..48a33661 100755 --- a/src/js/views/html/HTMLOperation.js +++ b/src/js/views/html/HTMLOperation.js @@ -17,13 +17,13 @@ var HTMLOperation = function(name, config, app, manager) { this.name = name; this.description = config.description; - this.manual_bake = config.manual_bake || false; + this.manualBake = config.manualBake || false; this.config = config; - this.ing_list = []; + this.ingList = []; for (var i = 0; i < config.args.length; i++) { var ing = new HTMLIngredient(config.args[i], this.app, this.manager); - this.ing_list.push(ing); + this.ingList.push(ing); } }; @@ -43,7 +43,7 @@ HTMLOperation.REMOVE_ICON = "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABwkl * * @returns {string} */ -HTMLOperation.prototype.to_stub_html = function(remove_icon) { +HTMLOperation.prototype.toStubHtml = function(removeIcon) { var html = "
                                                                                                                                                                                                    • "; } @@ -73,11 +73,11 @@ HTMLOperation.prototype.to_stub_html = function(remove_icon) { * * @returns {string} */ -HTMLOperation.prototype.to_full_html = function() { +HTMLOperation.prototype.toFullHtml = function() { var html = "
                                                                                                                                                                                                      " + this.name + "
                                                                                                                                                                                                      "; - for (var i = 0; i < this.ing_list.length; i++) { - html += this.ing_list[i].to_html(); + for (var i = 0; i < this.ingList.length; i++) { + html += this.ingList[i].toHtml(); } html += "
                                                                                                                                                                                                      \ @@ -95,20 +95,20 @@ HTMLOperation.prototype.to_full_html = function() { /** * Highlights the searched string in the name and description of the operation. * - * @param {string} search_str - * @param {number} name_pos - The position of the search string in the operation name - * @param {number} desc_pos - The position of the search string in the operation description + * @param {string} searchStr + * @param {number} namePos - The position of the search string in the operation name + * @param {number} descPos - The position of the search string in the operation description */ -HTMLOperation.prototype.highlight_search_string = function(search_str, name_pos, desc_pos) { - if (name_pos >= 0) { - this.name = this.name.slice(0, name_pos) + "" + - this.name.slice(name_pos, name_pos + search_str.length) + "" + - this.name.slice(name_pos + search_str.length); +HTMLOperation.prototype.highlightSearchString = function(searchStr, namePos, descPos) { + if (namePos >= 0) { + this.name = this.name.slice(0, namePos) + "" + + this.name.slice(namePos, namePos + searchStr.length) + "" + + this.name.slice(namePos + searchStr.length); } - if (this.description && desc_pos >= 0) { - this.description = this.description.slice(0, desc_pos) + "" + - this.description.slice(desc_pos, desc_pos + search_str.length) + "" + - this.description.slice(desc_pos + search_str.length); + if (this.description && descPos >= 0) { + this.description = this.description.slice(0, descPos) + "" + + this.description.slice(descPos, descPos + searchStr.length) + "" + + this.description.slice(descPos + searchStr.length); } }; diff --git a/src/js/views/html/HighlighterWaiter.js b/src/js/views/html/HighlighterWaiter.js index 26cb46c0..506b8175 100755 --- a/src/js/views/html/HighlighterWaiter.js +++ b/src/js/views/html/HighlighterWaiter.js @@ -11,8 +11,8 @@ var HighlighterWaiter = function(app) { this.app = app; - this.mouse_button_down = false; - this.mouse_target = null; + this.mouseButtonDown = false; + this.mouseTarget = null; }; @@ -37,7 +37,7 @@ HighlighterWaiter.OUTPUT = 1; * @private * @returns {boolean} */ -HighlighterWaiter.prototype._is_selection_backwards = function() { +HighlighterWaiter.prototype._isSelectionBackwards = function() { var backwards = false, sel = window.getSelection(); @@ -60,7 +60,7 @@ HighlighterWaiter.prototype._is_selection_backwards = function() { * @param {number} offset - The offset since the last HTML element. * @returns {number} */ -HighlighterWaiter.prototype._get_output_html_offset = function(node, offset) { +HighlighterWaiter.prototype._getOutputHtmlOffset = function(node, offset) { var sel = window.getSelection(), range = document.createRange(); @@ -81,7 +81,7 @@ HighlighterWaiter.prototype._get_output_html_offset = function(node, offset) { * @returns {number} pos.start * @returns {number} pos.end */ -HighlighterWaiter.prototype._get_output_html_selection_offsets = function() { +HighlighterWaiter.prototype._getOutputHtmlSelectionOffsets = function() { var sel = window.getSelection(), range, start = 0, @@ -90,9 +90,9 @@ HighlighterWaiter.prototype._get_output_html_selection_offsets = function() { if (sel.rangeCount) { range = sel.getRangeAt(sel.rangeCount - 1); - backwards = this._is_selection_backwards(); - start = this._get_output_html_offset(range.startContainer, range.startOffset); - end = this._get_output_html_offset(range.endContainer, range.endOffset); + backwards = this._isSelectionBackwards(); + start = this._getOutputHtmlOffset(range.startContainer, range.startOffset); + end = this._getOutputHtmlOffset(range.endContainer, range.endOffset); sel.removeAllRanges(); sel.addRange(range); @@ -117,7 +117,7 @@ HighlighterWaiter.prototype._get_output_html_selection_offsets = function() { * * @param {event} e */ -HighlighterWaiter.prototype.input_scroll = function(e) { +HighlighterWaiter.prototype.inputScroll = function(e) { var el = e.target; document.getElementById("input-highlighter").scrollTop = el.scrollTop; document.getElementById("input-highlighter").scrollLeft = el.scrollLeft; @@ -130,7 +130,7 @@ HighlighterWaiter.prototype.input_scroll = function(e) { * * @param {event} e */ -HighlighterWaiter.prototype.output_scroll = function(e) { +HighlighterWaiter.prototype.outputScroll = function(e) { var el = e.target; document.getElementById("output-highlighter").scrollTop = el.scrollTop; document.getElementById("output-highlighter").scrollLeft = el.scrollLeft; @@ -143,18 +143,18 @@ HighlighterWaiter.prototype.output_scroll = function(e) { * * @param {event} e */ -HighlighterWaiter.prototype.input_mousedown = function(e) { - this.mouse_button_down = true; - this.mouse_target = HighlighterWaiter.INPUT; - this.remove_highlights(); +HighlighterWaiter.prototype.inputMousedown = function(e) { + this.mouseButtonDown = true; + this.mouseTarget = HighlighterWaiter.INPUT; + this.removeHighlights(); var el = e.target, start = el.selectionStart, end = el.selectionEnd; if (start !== 0 || end !== 0) { - document.getElementById("input-selection-info").innerHTML = this.selection_info(start, end); - this.highlight_output([{start: start, end: end}]); + document.getElementById("input-selection-info").innerHTML = this.selectionInfo(start, end); + this.highlightOutput([{start: start, end: end}]); } }; @@ -165,18 +165,18 @@ HighlighterWaiter.prototype.input_mousedown = function(e) { * * @param {event} e */ -HighlighterWaiter.prototype.output_mousedown = function(e) { - this.mouse_button_down = true; - this.mouse_target = HighlighterWaiter.OUTPUT; - this.remove_highlights(); +HighlighterWaiter.prototype.outputMousedown = function(e) { + this.mouseButtonDown = true; + this.mouseTarget = HighlighterWaiter.OUTPUT; + this.removeHighlights(); var el = e.target, start = el.selectionStart, end = el.selectionEnd; if (start !== 0 || end !== 0) { - document.getElementById("output-selection-info").innerHTML = this.selection_info(start, end); - this.highlight_input([{start: start, end: end}]); + document.getElementById("output-selection-info").innerHTML = this.selectionInfo(start, end); + this.highlightInput([{start: start, end: end}]); } }; @@ -187,13 +187,13 @@ HighlighterWaiter.prototype.output_mousedown = function(e) { * * @param {event} e */ -HighlighterWaiter.prototype.output_html_mousedown = function(e) { - this.mouse_button_down = true; - this.mouse_target = HighlighterWaiter.OUTPUT; +HighlighterWaiter.prototype.outputHtmlMousedown = function(e) { + this.mouseButtonDown = true; + this.mouseTarget = HighlighterWaiter.OUTPUT; - var sel = this._get_output_html_selection_offsets(); + var sel = this._getOutputHtmlSelectionOffsets(); if (sel.start !== 0 || sel.end !== 0) { - document.getElementById("output-selection-info").innerHTML = this.selection_info(sel.start, sel.end); + document.getElementById("output-selection-info").innerHTML = this.selectionInfo(sel.start, sel.end); } }; @@ -203,8 +203,8 @@ HighlighterWaiter.prototype.output_html_mousedown = function(e) { * * @param {event} e */ -HighlighterWaiter.prototype.input_mouseup = function(e) { - this.mouse_button_down = false; +HighlighterWaiter.prototype.inputMouseup = function(e) { + this.mouseButtonDown = false; }; @@ -213,8 +213,8 @@ HighlighterWaiter.prototype.input_mouseup = function(e) { * * @param {event} e */ -HighlighterWaiter.prototype.output_mouseup = function(e) { - this.mouse_button_down = false; +HighlighterWaiter.prototype.outputMouseup = function(e) { + this.mouseButtonDown = false; }; @@ -223,8 +223,8 @@ HighlighterWaiter.prototype.output_mouseup = function(e) { * * @param {event} e */ -HighlighterWaiter.prototype.output_html_mouseup = function(e) { - this.mouse_button_down = false; +HighlighterWaiter.prototype.outputHtmlMouseup = function(e) { + this.mouseButtonDown = false; }; @@ -234,11 +234,11 @@ HighlighterWaiter.prototype.output_html_mouseup = function(e) { * * @param {event} e */ -HighlighterWaiter.prototype.input_mousemove = function(e) { +HighlighterWaiter.prototype.inputMousemove = function(e) { // Check that the left mouse button is pressed - if (!this.mouse_button_down || + if (!this.mouseButtonDown || e.which !== 1 || - this.mouse_target !== HighlighterWaiter.INPUT) + this.mouseTarget !== HighlighterWaiter.INPUT) return; var el = e.target, @@ -246,8 +246,8 @@ HighlighterWaiter.prototype.input_mousemove = function(e) { end = el.selectionEnd; if (start !== 0 || end !== 0) { - document.getElementById("input-selection-info").innerHTML = this.selection_info(start, end); - this.highlight_output([{start: start, end: end}]); + document.getElementById("input-selection-info").innerHTML = this.selectionInfo(start, end); + this.highlightOutput([{start: start, end: end}]); } }; @@ -258,11 +258,11 @@ HighlighterWaiter.prototype.input_mousemove = function(e) { * * @param {event} e */ -HighlighterWaiter.prototype.output_mousemove = function(e) { +HighlighterWaiter.prototype.outputMousemove = function(e) { // Check that the left mouse button is pressed - if (!this.mouse_button_down || + if (!this.mouseButtonDown || e.which !== 1 || - this.mouse_target !== HighlighterWaiter.OUTPUT) + this.mouseTarget !== HighlighterWaiter.OUTPUT) return; var el = e.target, @@ -270,8 +270,8 @@ HighlighterWaiter.prototype.output_mousemove = function(e) { end = el.selectionEnd; if (start !== 0 || end !== 0) { - document.getElementById("output-selection-info").innerHTML = this.selection_info(start, end); - this.highlight_input([{start: start, end: end}]); + document.getElementById("output-selection-info").innerHTML = this.selectionInfo(start, end); + this.highlightInput([{start: start, end: end}]); } }; @@ -282,16 +282,16 @@ HighlighterWaiter.prototype.output_mousemove = function(e) { * * @param {event} e */ -HighlighterWaiter.prototype.output_html_mousemove = function(e) { +HighlighterWaiter.prototype.outputHtmlMousemove = function(e) { // Check that the left mouse button is pressed - if (!this.mouse_button_down || + if (!this.mouseButtonDown || e.which !== 1 || - this.mouse_target !== HighlighterWaiter.OUTPUT) + this.mouseTarget !== HighlighterWaiter.OUTPUT) return; - var sel = this._get_output_html_selection_offsets(); + var sel = this._getOutputHtmlSelectionOffsets(); if (sel.start !== 0 || sel.end !== 0) { - document.getElementById("output-selection-info").innerHTML = this.selection_info(sel.start, sel.end); + document.getElementById("output-selection-info").innerHTML = this.selectionInfo(sel.start, sel.end); } }; @@ -304,21 +304,21 @@ HighlighterWaiter.prototype.output_html_mousemove = function(e) { * @param {number} end - The end offset. * @returns {string} */ -HighlighterWaiter.prototype.selection_info = function(start, end) { +HighlighterWaiter.prototype.selectionInfo = function(start, end) { var width = end.toString().length; width = width < 2 ? 2 : width; - var start_str = Utils.pad(start.toString(), width, " ").replace(/ /g, " "), - end_str = Utils.pad(end.toString(), width, " ").replace(/ /g, " "), - len_str = Utils.pad((end-start).toString(), width, " ").replace(/ /g, " "); + var startStr = Utils.pad(start.toString(), width, " ").replace(/ /g, " "), + endStr = Utils.pad(end.toString(), width, " ").replace(/ /g, " "), + lenStr = Utils.pad((end-start).toString(), width, " ").replace(/ /g, " "); - return "start: " + start_str + "
                                                                                                                                                                                                      end: " + end_str + "
                                                                                                                                                                                                      length: " + len_str; + return "start: " + startStr + "
                                                                                                                                                                                                      end: " + endStr + "
                                                                                                                                                                                                      length: " + lenStr; }; /** * Removes highlighting and selection information. */ -HighlighterWaiter.prototype.remove_highlights = function() { +HighlighterWaiter.prototype.removeHighlights = function() { document.getElementById("input-highlighter").innerHTML = ""; document.getElementById("output-highlighter").innerHTML = ""; document.getElementById("input-selection-info").innerHTML = ""; @@ -335,25 +335,25 @@ HighlighterWaiter.prototype.remove_highlights = function() { * @returns {function} highlights[].b * @returns {Object[]} highlights[].args */ -HighlighterWaiter.prototype.generate_highlight_list = function() { - var recipe_config = this.app.get_recipe_config(), +HighlighterWaiter.prototype.generateHighlightList = function() { + var recipeConfig = this.app.getRecipeConfig(), highlights = []; - for (var i = 0; i < recipe_config.length; i++) { - if (recipe_config[i].disabled) continue; + for (var i = 0; i < recipeConfig.length; i++) { + if (recipeConfig[i].disabled) continue; // If any breakpoints are set, do not attempt to highlight - if (recipe_config[i].breakpoint) return false; + if (recipeConfig[i].breakpoint) return false; - var op = this.app.operations[recipe_config[i].op]; + var op = this.app.operations[recipeConfig[i].op]; // If any of the operations do not support highlighting, fail immediately. if (op.highlight === false || op.highlight === undefined) return false; highlights.push({ f: op.highlight, - b: op.highlight_reverse, - args: recipe_config[i].args + b: op.highlightReverse, + args: recipeConfig[i].args }); } @@ -372,10 +372,10 @@ HighlighterWaiter.prototype.generate_highlight_list = function() { * @param {number} pos.start - The start offset. * @param {number} pos.end - The end offset. */ -HighlighterWaiter.prototype.highlight_output = function(pos) { - var highlights = this.generate_highlight_list(); +HighlighterWaiter.prototype.highlightOutput = function(pos) { + var highlights = this.generateHighlightList(); - if (!highlights || !this.app.auto_bake_) { + if (!highlights || !this.app.autoBake_) { return false; } @@ -388,7 +388,7 @@ HighlighterWaiter.prototype.highlight_output = function(pos) { } } - document.getElementById("output-selection-info").innerHTML = this.selection_info(pos[0].start, pos[0].end); + document.getElementById("output-selection-info").innerHTML = this.selectionInfo(pos[0].start, pos[0].end); this.highlight( document.getElementById("output-text"), document.getElementById("output-highlighter"), @@ -407,10 +407,10 @@ HighlighterWaiter.prototype.highlight_output = function(pos) { * @param {number} pos.start - The start offset. * @param {number} pos.end - The end offset. */ -HighlighterWaiter.prototype.highlight_input = function(pos) { - var highlights = this.generate_highlight_list(); +HighlighterWaiter.prototype.highlightInput = function(pos) { + var highlights = this.generateHighlightList(); - if (!highlights || !this.app.auto_bake_) { + if (!highlights || !this.app.autoBake_) { return false; } @@ -423,7 +423,7 @@ HighlighterWaiter.prototype.highlight_input = function(pos) { } } - document.getElementById("input-selection-info").innerHTML = this.selection_info(pos[0].start, pos[0].end); + document.getElementById("input-selection-info").innerHTML = this.selectionInfo(pos[0].start, pos[0].end); this.highlight( document.getElementById("input-text"), document.getElementById("input-highlighter"), @@ -442,17 +442,17 @@ HighlighterWaiter.prototype.highlight_input = function(pos) { * @param {number} pos.end - The end offset. */ HighlighterWaiter.prototype.highlight = function(textarea, highlighter, pos) { - if (!this.app.options.show_highlighter) return false; - if (!this.app.options.attempt_highlight) return false; + if (!this.app.options.showHighlighter) return false; + if (!this.app.options.attemptHighlight) return false; // Check if there is a carriage return in the output dish as this will not // be displayed by the HTML textarea and will mess up highlighting offsets. - if (!this.app.dish_str || this.app.dish_str.indexOf("\r") >= 0) return false; + if (!this.app.dishStr || this.app.dishStr.indexOf("\r") >= 0) return false; - var start_placeholder = "[start_highlight]", - start_placeholder_regex = /\[start_highlight\]/g, - end_placeholder = "[end_highlight]", - end_placeholder_regex = /\[end_highlight\]/g, + var startPlaceholder = "[startHighlight]", + startPlaceholderRegex = /\[startHighlight\]/g, + endPlaceholder = "[endHighlight]", + endPlaceholderRegex = /\[endHighlight\]/g, text = textarea.value; // Put placeholders in position @@ -461,33 +461,33 @@ HighlighterWaiter.prototype.highlight = function(textarea, highlighter, pos) { if (pos.length === 1) { if (pos[0].end < pos[0].start) return; text = text.slice(0, pos[0].start) + - start_placeholder + text.slice(pos[0].start, pos[0].end) + end_placeholder + + startPlaceholder + text.slice(pos[0].start, pos[0].end) + endPlaceholder + text.slice(pos[0].end, text.length); } else { // O(n^2) - Can anyone improve this without overwriting placeholders? var result = "", - end_placed = true; + endPlaced = true; for (var i = 0; i < text.length; i++) { for (var j = 1; j < pos.length; j++) { if (pos[j].end < pos[j].start) continue; if (pos[j].start === i) { - result += start_placeholder; - end_placed = false; + result += startPlaceholder; + endPlaced = false; } if (pos[j].end === i) { - result += end_placeholder; - end_placed = true; + result += endPlaceholder; + endPlaced = true; } } result += text[i]; } - if (!end_placed) result += end_placeholder; + if (!endPlaced) result += endPlaceholder; text = result; } - var css_class = "hl1"; - //if (colour) css_class += "-"+colour; + var cssClass = "hl1"; + //if (colour) cssClass += "-"+colour; // Remove HTML tags text = text.replace(/&/g, "&") @@ -495,8 +495,8 @@ HighlighterWaiter.prototype.highlight = function(textarea, highlighter, pos) { .replace(/>/g, ">") .replace(/\n/g, " ") // Convert placeholders to tags - .replace(start_placeholder_regex, "") - .replace(end_placeholder_regex, "") + " "; + .replace(startPlaceholderRegex, "") + .replace(endPlaceholderRegex, "") + " "; // Adjust width to allow for scrollbars highlighter.style.width = textarea.clientWidth + "px"; diff --git a/src/js/views/html/InputWaiter.js b/src/js/views/html/InputWaiter.js index 73cfe792..6ffc498f 100755 --- a/src/js/views/html/InputWaiter.js +++ b/src/js/views/html/InputWaiter.js @@ -14,7 +14,7 @@ var InputWaiter = function(app, manager) { this.manager = manager; // Define keys that don't change the input so we don't have to autobake when they are pressed - this.bad_keys = [ + this.badKeys = [ 16, //Shift 17, //Ctrl 18, //Alt @@ -62,14 +62,14 @@ InputWaiter.prototype.set = function(input) { * @param {number} length - The length of the current input string * @param {number} lines - The number of the lines in the current input string */ -InputWaiter.prototype.set_input_info = function(length, lines) { +InputWaiter.prototype.setInputInfo = function(length, lines) { var width = length.toString().length; width = width < 2 ? 2 : width; - var length_str = Utils.pad(length.toString(), width, " ").replace(/ /g, " "); - var lines_str = Utils.pad(lines.toString(), width, " ").replace(/ /g, " "); + var lengthStr = Utils.pad(length.toString(), width, " ").replace(/ /g, " "); + var linesStr = Utils.pad(lines.toString(), width, " ").replace(/ /g, " "); - document.getElementById("input-info").innerHTML = "length: " + length_str + "
                                                                                                                                                                                                      lines: " + lines_str; + document.getElementById("input-info").innerHTML = "length: " + lengthStr + "
                                                                                                                                                                                                      lines: " + linesStr; }; @@ -81,21 +81,21 @@ InputWaiter.prototype.set_input_info = function(length, lines) { * * @fires Manager#statechange */ -InputWaiter.prototype.input_change = function(e) { +InputWaiter.prototype.inputChange = function(e) { // Remove highlighting from input and output panes as the offsets might be different now - this.manager.highlighter.remove_highlights(); + this.manager.highlighter.removeHighlights(); // Reset recipe progress as any previous processing will be redundant now this.app.progress = 0; // Update the input metadata info - var input_text = this.get(), - lines = input_text.count("\n") + 1; + var inputText = this.get(), + lines = inputText.count("\n") + 1; - this.set_input_info(input_text.length, lines); + this.setInputInfo(inputText.length, lines); - if (this.bad_keys.indexOf(e.keyCode) < 0) { + if (this.badKeys.indexOf(e.keyCode) < 0) { // Fire the statechange event as the input has been modified window.dispatchEvent(this.manager.statechange); } @@ -108,7 +108,7 @@ InputWaiter.prototype.input_change = function(e) { * * @param {event} e */ -InputWaiter.prototype.input_dragover = function(e) { +InputWaiter.prototype.inputDragover = function(e) { // This will be set if we're dragging an operation if (e.dataTransfer.effectAllowed === "move") return false; @@ -125,7 +125,7 @@ InputWaiter.prototype.input_dragover = function(e) { * * @param {event} e */ -InputWaiter.prototype.input_dragleave = function(e) { +InputWaiter.prototype.inputDragleave = function(e) { e.stopPropagation(); e.preventDefault(); e.target.classList.remove("dropping-file"); @@ -138,7 +138,7 @@ InputWaiter.prototype.input_dragleave = function(e) { * * @param {event} e */ -InputWaiter.prototype.input_drop = function(e) { +InputWaiter.prototype.inputDrop = function(e) { // This will be set if we're dragging an operation if (e.dataTransfer.effectAllowed === "move") return false; @@ -150,29 +150,29 @@ InputWaiter.prototype.input_drop = function(e) { file = e.dataTransfer.files[0], text = e.dataTransfer.getData("Text"), reader = new FileReader(), - input_charcode = "", + inputCharcode = "", offset = 0, CHUNK_SIZE = 20480; // 20KB - var set_input = function() { - if (input_charcode.length > 100000 && this.app.auto_bake_) { - this.manager.controls.set_auto_bake(false); + var setInput = function() { + if (inputCharcode.length > 100000 && this.app.autoBake_) { + this.manager.controls.setAutoBake(false); this.app.alert("Turned off Auto Bake as the input is large", "warning", 5000); } - this.set(input_charcode); - var recipe_config = this.app.get_recipe_config(); - if (!recipe_config[0] || recipe_config[0].op !== "From Hex") { - recipe_config.unshift({op:"From Hex", args:["Space"]}); - this.app.set_recipe_config(recipe_config); + this.set(inputCharcode); + var recipeConfig = this.app.getRecipeConfig(); + if (!recipeConfig[0] || recipeConfig[0].op !== "From Hex") { + recipeConfig.unshift({op:"From Hex", args:["Space"]}); + this.app.setRecipeConfig(recipeConfig); } - el.classList.remove("loading_file"); + el.classList.remove("loadingFile"); }.bind(this); var seek = function() { if (offset >= file.size) { - set_input(); + setInput(); return; } el.value = "Processing... " + Math.round(offset / file.size * 100) + "%"; @@ -182,7 +182,7 @@ InputWaiter.prototype.input_drop = function(e) { reader.onload = function(e) { var data = new Uint8Array(reader.result); - input_charcode += Utils.to_hex_fast(data); + inputCharcode += Utils.toHexFast(data); offset += CHUNK_SIZE; seek(); }; @@ -191,7 +191,7 @@ InputWaiter.prototype.input_drop = function(e) { el.classList.remove("dropping-file"); if (file) { - el.classList.add("loading_file"); + el.classList.add("loadingFile"); seek(); } else if (text) { this.set(text); @@ -205,8 +205,8 @@ InputWaiter.prototype.input_drop = function(e) { * * @fires Manager#statechange */ -InputWaiter.prototype.clear_io_click = function() { - this.manager.highlighter.remove_highlights(); +InputWaiter.prototype.clearIoClick = function() { + this.manager.highlighter.removeHighlights(); document.getElementById("input-text").value = ""; document.getElementById("output-text").value = ""; document.getElementById("input-info").innerHTML = ""; diff --git a/src/js/views/html/Manager.js b/src/js/views/html/Manager.js index b139a444..90a9b4cc 100755 --- a/src/js/views/html/Manager.js +++ b/src/js/views/html/Manager.js @@ -45,9 +45,9 @@ var Manager = function(app) { this.seasonal = new SeasonalWaiter(this.app, this); // Object to store dynamic handlers to fire on elements that may not exist yet - this.dynamic_handlers = {}; + this.dynamicHandlers = {}; - this.initialise_event_listeners(); + this.initialiseEventListeners(); }; @@ -55,8 +55,8 @@ var Manager = function(app) { * Sets up the various components and listeners. */ Manager.prototype.setup = function() { - this.recipe.initialise_operation_drag_n_drop(); - this.controls.auto_bake_change(); + this.recipe.initialiseOperationDragNDrop(); + this.controls.autoBakeChange(); this.seasonal.load(); }; @@ -64,87 +64,87 @@ Manager.prototype.setup = function() { /** * Main function to handle the creation of the event listeners. */ -Manager.prototype.initialise_event_listeners = function() { +Manager.prototype.initialiseEventListeners = function() { // Global - window.addEventListener("resize", this.window.window_resize.bind(this.window)); - window.addEventListener("blur", this.window.window_blur.bind(this.window)); - window.addEventListener("focus", this.window.window_focus.bind(this.window)); - window.addEventListener("statechange", this.app.state_change.bind(this.app)); - window.addEventListener("popstate", this.app.pop_state.bind(this.app)); + window.addEventListener("resize", this.window.windowResize.bind(this.window)); + window.addEventListener("blur", this.window.windowBlur.bind(this.window)); + window.addEventListener("focus", this.window.windowFocus.bind(this.window)); + window.addEventListener("statechange", this.app.stateChange.bind(this.app)); + window.addEventListener("popstate", this.app.popState.bind(this.app)); // Controls - document.getElementById("bake").addEventListener("click", this.controls.bake_click.bind(this.controls)); - document.getElementById("auto-bake").addEventListener("change", this.controls.auto_bake_change.bind(this.controls)); - document.getElementById("step").addEventListener("click", this.controls.step_click.bind(this.controls)); - document.getElementById("clr-recipe").addEventListener("click", this.controls.clear_recipe_click.bind(this.controls)); - document.getElementById("clr-breaks").addEventListener("click", this.controls.clear_breaks_click.bind(this.controls)); - document.getElementById("save").addEventListener("click", this.controls.save_click.bind(this.controls)); - document.getElementById("save-button").addEventListener("click", this.controls.save_button_click.bind(this.controls)); - document.getElementById("save-link-recipe-checkbox").addEventListener("change", this.controls.slr_check_change.bind(this.controls)); - document.getElementById("save-link-input-checkbox").addEventListener("change", this.controls.sli_check_change.bind(this.controls)); - document.getElementById("load").addEventListener("click", this.controls.load_click.bind(this.controls)); - document.getElementById("load-delete-button").addEventListener("click", this.controls.load_delete_click.bind(this.controls)); - document.getElementById("load-name").addEventListener("change", this.controls.load_name_change.bind(this.controls)); - document.getElementById("load-button").addEventListener("click", this.controls.load_button_click.bind(this.controls)); - this.add_multi_event_listener("#save-text", "keyup paste", this.controls.save_text_change, this.controls); + document.getElementById("bake").addEventListener("click", this.controls.bakeClick.bind(this.controls)); + document.getElementById("auto-bake").addEventListener("change", this.controls.autoBakeChange.bind(this.controls)); + document.getElementById("step").addEventListener("click", this.controls.stepClick.bind(this.controls)); + document.getElementById("clr-recipe").addEventListener("click", this.controls.clearRecipeClick.bind(this.controls)); + document.getElementById("clr-breaks").addEventListener("click", this.controls.clearBreaksClick.bind(this.controls)); + document.getElementById("save").addEventListener("click", this.controls.saveClick.bind(this.controls)); + document.getElementById("save-button").addEventListener("click", this.controls.saveButtonClick.bind(this.controls)); + document.getElementById("save-link-recipe-checkbox").addEventListener("change", this.controls.slrCheckChange.bind(this.controls)); + document.getElementById("save-link-input-checkbox").addEventListener("change", this.controls.sliCheckChange.bind(this.controls)); + document.getElementById("load").addEventListener("click", this.controls.loadClick.bind(this.controls)); + document.getElementById("load-delete-button").addEventListener("click", this.controls.loadDeleteClick.bind(this.controls)); + document.getElementById("load-name").addEventListener("change", this.controls.loadNameChange.bind(this.controls)); + document.getElementById("load-button").addEventListener("click", this.controls.loadButtonClick.bind(this.controls)); + this.addMultiEventListener("#save-text", "keyup paste", this.controls.saveTextChange, this.controls); // Operations - this.add_multi_event_listener("#search", "keyup paste search", this.ops.search_operations, this.ops); - this.add_dynamic_listener(".op_list li.operation", "dblclick", this.ops.operation_dblclick, this.ops); - document.getElementById("edit-favourites").addEventListener("click", this.ops.edit_favourites_click.bind(this.ops)); - document.getElementById("save-favourites").addEventListener("click", this.ops.save_favourites_click.bind(this.ops)); - document.getElementById("reset-favourites").addEventListener("click", this.ops.reset_favourites_click.bind(this.ops)); - this.add_dynamic_listener(".op_list .op-icon", "mouseover", this.ops.op_icon_mouseover, this.ops); - this.add_dynamic_listener(".op_list .op-icon", "mouseleave", this.ops.op_icon_mouseleave, this.ops); - this.add_dynamic_listener(".op_list", "oplistcreate", this.ops.op_list_create, this.ops); - this.add_dynamic_listener("li.operation", "operationadd", this.recipe.op_add.bind(this.recipe)); + this.addMultiEventListener("#search", "keyup paste search", this.ops.searchOperations, this.ops); + this.addDynamicListener(".op-list li.operation", "dblclick", this.ops.operationDblclick, this.ops); + document.getElementById("edit-favourites").addEventListener("click", this.ops.editFavouritesClick.bind(this.ops)); + document.getElementById("save-favourites").addEventListener("click", this.ops.saveFavouritesClick.bind(this.ops)); + document.getElementById("reset-favourites").addEventListener("click", this.ops.resetFavouritesClick.bind(this.ops)); + this.addDynamicListener(".op-list .op-icon", "mouseover", this.ops.opIconMouseover, this.ops); + this.addDynamicListener(".op-list .op-icon", "mouseleave", this.ops.opIconMouseleave, this.ops); + this.addDynamicListener(".op-list", "oplistcreate", this.ops.opListCreate, this.ops); + this.addDynamicListener("li.operation", "operationadd", this.recipe.opAdd.bind(this.recipe)); // Recipe - this.add_dynamic_listener(".arg", "keyup", this.recipe.ing_change, this.recipe); - this.add_dynamic_listener(".arg", "change", this.recipe.ing_change, this.recipe); - this.add_dynamic_listener(".disable-icon", "click", this.recipe.disable_click, this.recipe); - this.add_dynamic_listener(".breakpoint", "click", this.recipe.breakpoint_click, this.recipe); - this.add_dynamic_listener("#rec_list li.operation", "dblclick", this.recipe.operation_dblclick, this.recipe); - this.add_dynamic_listener("#rec_list li.operation > div", "dblclick", this.recipe.operation_child_dblclick, this.recipe); - this.add_dynamic_listener("#rec_list .input-group .dropdown-menu a", "click", this.recipe.dropdown_toggle_click, this.recipe); - this.add_dynamic_listener("#rec_list", "operationremove", this.recipe.op_remove.bind(this.recipe)); + this.addDynamicListener(".arg", "keyup", this.recipe.ingChange, this.recipe); + this.addDynamicListener(".arg", "change", this.recipe.ingChange, this.recipe); + this.addDynamicListener(".disable-icon", "click", this.recipe.disableClick, this.recipe); + this.addDynamicListener(".breakpoint", "click", this.recipe.breakpointClick, this.recipe); + this.addDynamicListener("#rec-list li.operation", "dblclick", this.recipe.operationDblclick, this.recipe); + this.addDynamicListener("#rec-list li.operation > div", "dblclick", this.recipe.operationChildDblclick, this.recipe); + this.addDynamicListener("#rec-list .input-group .dropdown-menu a", "click", this.recipe.dropdownToggleClick, this.recipe); + this.addDynamicListener("#rec-list", "operationremove", this.recipe.opRemove.bind(this.recipe)); // Input - this.add_multi_event_listener("#input-text", "keyup paste", this.input.input_change, this.input); - document.getElementById("reset-layout").addEventListener("click", this.app.reset_layout.bind(this.app)); - document.getElementById("clr-io").addEventListener("click", this.input.clear_io_click.bind(this.input)); - document.getElementById("input-text").addEventListener("dragover", this.input.input_dragover.bind(this.input)); - document.getElementById("input-text").addEventListener("dragleave", this.input.input_dragleave.bind(this.input)); - document.getElementById("input-text").addEventListener("drop", this.input.input_drop.bind(this.input)); - document.getElementById("input-text").addEventListener("scroll", this.highlighter.input_scroll.bind(this.highlighter)); - document.getElementById("input-text").addEventListener("mouseup", this.highlighter.input_mouseup.bind(this.highlighter)); - document.getElementById("input-text").addEventListener("mousemove", this.highlighter.input_mousemove.bind(this.highlighter)); - this.add_multi_event_listener("#input-text", "mousedown dblclick select", this.highlighter.input_mousedown, this.highlighter); + this.addMultiEventListener("#input-text", "keyup paste", this.input.inputChange, this.input); + document.getElementById("reset-layout").addEventListener("click", this.app.resetLayout.bind(this.app)); + document.getElementById("clr-io").addEventListener("click", this.input.clearIoClick.bind(this.input)); + document.getElementById("input-text").addEventListener("dragover", this.input.inputDragover.bind(this.input)); + document.getElementById("input-text").addEventListener("dragleave", this.input.inputDragleave.bind(this.input)); + document.getElementById("input-text").addEventListener("drop", this.input.inputDrop.bind(this.input)); + document.getElementById("input-text").addEventListener("scroll", this.highlighter.inputScroll.bind(this.highlighter)); + document.getElementById("input-text").addEventListener("mouseup", this.highlighter.inputMouseup.bind(this.highlighter)); + document.getElementById("input-text").addEventListener("mousemove", this.highlighter.inputMousemove.bind(this.highlighter)); + this.addMultiEventListener("#input-text", "mousedown dblclick select", this.highlighter.inputMousedown, this.highlighter); // Output - document.getElementById("save-to-file").addEventListener("click", this.output.save_click.bind(this.output)); - document.getElementById("switch").addEventListener("click", this.output.switch_click.bind(this.output)); - document.getElementById("undo-switch").addEventListener("click", this.output.undo_switch_click.bind(this.output)); - document.getElementById("maximise-output").addEventListener("click", this.output.maximise_output_click.bind(this.output)); - document.getElementById("output-text").addEventListener("scroll", this.highlighter.output_scroll.bind(this.highlighter)); - document.getElementById("output-text").addEventListener("mouseup", this.highlighter.output_mouseup.bind(this.highlighter)); - document.getElementById("output-text").addEventListener("mousemove", this.highlighter.output_mousemove.bind(this.highlighter)); - document.getElementById("output-html").addEventListener("mouseup", this.highlighter.output_html_mouseup.bind(this.highlighter)); - document.getElementById("output-html").addEventListener("mousemove", this.highlighter.output_html_mousemove.bind(this.highlighter)); - this.add_multi_event_listener("#output-text", "mousedown dblclick select", this.highlighter.output_mousedown, this.highlighter); - this.add_multi_event_listener("#output-html", "mousedown dblclick select", this.highlighter.output_html_mousedown, this.highlighter); + document.getElementById("save-to-file").addEventListener("click", this.output.saveClick.bind(this.output)); + document.getElementById("switch").addEventListener("click", this.output.switchClick.bind(this.output)); + document.getElementById("undo-switch").addEventListener("click", this.output.undoSwitchClick.bind(this.output)); + document.getElementById("maximise-output").addEventListener("click", this.output.maximiseOutputClick.bind(this.output)); + document.getElementById("output-text").addEventListener("scroll", this.highlighter.outputScroll.bind(this.highlighter)); + document.getElementById("output-text").addEventListener("mouseup", this.highlighter.outputMouseup.bind(this.highlighter)); + document.getElementById("output-text").addEventListener("mousemove", this.highlighter.outputMousemove.bind(this.highlighter)); + document.getElementById("output-html").addEventListener("mouseup", this.highlighter.outputHtmlMouseup.bind(this.highlighter)); + document.getElementById("output-html").addEventListener("mousemove", this.highlighter.outputHtmlMousemove.bind(this.highlighter)); + this.addMultiEventListener("#output-text", "mousedown dblclick select", this.highlighter.outputMousedown, this.highlighter); + this.addMultiEventListener("#output-html", "mousedown dblclick select", this.highlighter.outputHtmlMousedown, this.highlighter); // Options - document.getElementById("options").addEventListener("click", this.options.options_click.bind(this.options)); - document.getElementById("reset-options").addEventListener("click", this.options.reset_options_click.bind(this.options)); - $(document).on("switchChange.bootstrapSwitch", ".option-item input:checkbox", this.options.switch_change.bind(this.options)); - $(document).on("switchChange.bootstrapSwitch", ".option-item input:checkbox", this.options.set_word_wrap.bind(this.options)); - this.add_dynamic_listener(".option-item input[type=number]", "keyup", this.options.number_change, this.options); - this.add_dynamic_listener(".option-item input[type=number]", "change", this.options.number_change, this.options); - this.add_dynamic_listener(".option-item select", "change", this.options.select_change, this.options); + document.getElementById("options").addEventListener("click", this.options.optionsClick.bind(this.options)); + document.getElementById("reset-options").addEventListener("click", this.options.resetOptionsClick.bind(this.options)); + $(document).on("switchChange.bootstrapSwitch", ".option-item input:checkbox", this.options.switchChange.bind(this.options)); + $(document).on("switchChange.bootstrapSwitch", ".option-item input:checkbox", this.options.setWordWrap.bind(this.options)); + this.addDynamicListener(".option-item input[type=number]", "keyup", this.options.numberChange, this.options); + this.addDynamicListener(".option-item input[type=number]", "change", this.options.numberChange, this.options); + this.addDynamicListener(".option-item select", "change", this.options.selectChange, this.options); // Misc - document.getElementById("alert-close").addEventListener("click", this.app.alert_close_click.bind(this.app)); + document.getElementById("alert-close").addEventListener("click", this.app.alertCloseClick.bind(this.app)); }; @@ -152,19 +152,19 @@ Manager.prototype.initialise_event_listeners = function() { * Adds an event listener to each element in the specified group. * * @param {string} selector - A selector string for the element group to add the event to, see - * this.get_all() - * @param {string} event_type - The event to listen for + * this.getAll() + * @param {string} eventType - The event to listen for * @param {function} callback - The function to execute when the event is triggered * @param {Object} [scope=this] - The object to bind to the callback function * * @example * // Calls the clickable function whenever any element with the .clickable class is clicked - * this.add_listeners(".clickable", "click", this.clickable, this); + * this.addListeners(".clickable", "click", this.clickable, this); */ -Manager.prototype.add_listeners = function(selector, event_type, callback, scope) { +Manager.prototype.addListeners = function(selector, eventType, callback, scope) { scope = scope || this; [].forEach.call(document.querySelectorAll(selector), function(el) { - el.addEventListener(event_type, callback.bind(scope)); + el.addEventListener(eventType, callback.bind(scope)); }); }; @@ -173,17 +173,17 @@ Manager.prototype.add_listeners = function(selector, event_type, callback, scope * Adds multiple event listeners to the specified element. * * @param {string} selector - A selector string for the element to add the events to - * @param {string} event_types - A space-separated string of all the event types to listen for + * @param {string} eventTypes - A space-separated string of all the event types to listen for * @param {function} callback - The function to execute when the events are triggered * @param {Object} [scope=this] - The object to bind to the callback function * * @example * // Calls the search function whenever the the keyup, paste or search events are triggered on the * // search element - * this.add_multi_event_listener("search", "keyup paste search", this.search, this); + * this.addMultiEventListener("search", "keyup paste search", this.search, this); */ -Manager.prototype.add_multi_event_listener = function(selector, event_types, callback, scope) { - var evs = event_types.split(" "); +Manager.prototype.addMultiEventListener = function(selector, eventTypes, callback, scope) { + var evs = eventTypes.split(" "); for (var i = 0; i < evs.length; i++) { document.querySelector(selector).addEventListener(evs[i], callback.bind(scope)); } @@ -194,19 +194,19 @@ Manager.prototype.add_multi_event_listener = function(selector, event_types, cal * Adds multiple event listeners to each element in the specified group. * * @param {string} selector - A selector string for the element group to add the events to - * @param {string} event_types - A space-separated string of all the event types to listen for + * @param {string} eventTypes - A space-separated string of all the event types to listen for * @param {function} callback - The function to execute when the events are triggered * @param {Object} [scope=this] - The object to bind to the callback function * * @example * // Calls the save function whenever the the keyup or paste events are triggered on any element * // with the .saveable class - * this.add_multi_event_listener(".saveable", "keyup paste", this.save, this); + * this.addMultiEventListener(".saveable", "keyup paste", this.save, this); */ -Manager.prototype.add_multi_event_listeners = function(selector, event_types, callback, scope) { - var evs = event_types.split(" "); +Manager.prototype.addMultiEventListeners = function(selector, eventTypes, callback, scope) { + var evs = eventTypes.split(" "); for (var i = 0; i < evs.length; i++) { - this.add_listeners(selector, evs[i], callback, scope); + this.addListeners(selector, evs[i], callback, scope); } }; @@ -216,28 +216,28 @@ Manager.prototype.add_multi_event_listeners = function(selector, event_types, ca * may not exist in the DOM yet. * * @param {string} selector - A selector string for the element(s) to add the event to - * @param {string} event_type - The event(s) to listen for + * @param {string} eventType - The event(s) to listen for * @param {function} callback - The function to execute when the event(s) is/are triggered * @param {Object} [scope=this] - The object to bind to the callback function * * @example * // Pops up an alert whenever any button is clicked, even if it is added to the DOM after this * // listener is created - * this.add_dynamic_listener("button", "click", alert, this); + * this.addDynamicListener("button", "click", alert, this); */ -Manager.prototype.add_dynamic_listener = function(selector, event_type, callback, scope) { - var event_config = { +Manager.prototype.addDynamicListener = function(selector, eventType, callback, scope) { + var eventConfig = { selector: selector, callback: callback.bind(scope || this) }; - if (this.dynamic_handlers.hasOwnProperty(event_type)) { + if (this.dynamicHandlers.hasOwnProperty(eventType)) { // Listener already exists, add new handler to the appropriate list - this.dynamic_handlers[event_type].push(event_config); + this.dynamicHandlers[eventType].push(eventConfig); } else { - this.dynamic_handlers[event_type] = [event_config]; + this.dynamicHandlers[eventType] = [eventConfig]; // Set up listener for this new type - document.addEventListener(event_type, this.dynamic_listener_handler.bind(this)); + document.addEventListener(eventType, this.dynamicListenerHandler.bind(this)); } }; @@ -248,8 +248,8 @@ Manager.prototype.add_dynamic_listener = function(selector, event_type, callback * * @param {Event} e - The event to be handled */ -Manager.prototype.dynamic_listener_handler = function(e) { - var handlers = this.dynamic_handlers[e.type], +Manager.prototype.dynamicListenerHandler = function(e) { + var handlers = this.dynamicHandlers[e.type], matches = e.target.matches || e.target.webkitMatchesSelector || e.target.mozMatchesSelector || diff --git a/src/js/views/html/OperationsWaiter.js b/src/js/views/html/OperationsWaiter.js index 11d7aa7f..3b9b4e2d 100755 --- a/src/js/views/html/OperationsWaiter.js +++ b/src/js/views/html/OperationsWaiter.js @@ -16,7 +16,7 @@ var OperationsWaiter = function(app, manager) { this.manager = manager; this.options = {}; - this.remove_intent = false; + this.removeIntent = false; }; @@ -26,17 +26,17 @@ var OperationsWaiter = function(app, manager) { * * @param {event} e */ -OperationsWaiter.prototype.search_operations = function(e) { +OperationsWaiter.prototype.searchOperations = function(e) { var ops, selected; if (e.type === "search") { // Search e.preventDefault(); ops = document.querySelectorAll("#search-results li"); if (ops.length) { - selected = this.get_selected_op(ops); + selected = this.getSelectedOp(ops); if (selected > -1) { - this.manager.recipe.add_operation(ops[selected].innerHTML); - this.app.auto_bake(); + this.manager.recipe.addOperation(ops[selected].innerHTML); + this.app.autoBake(); } } } @@ -47,7 +47,7 @@ OperationsWaiter.prototype.search_operations = function(e) { e.preventDefault(); ops = document.querySelectorAll("#search-results li"); if (ops.length) { - selected = this.get_selected_op(ops); + selected = this.getSelectedOp(ops); if (selected > -1) { ops[selected].classList.remove("selected-op"); } @@ -58,7 +58,7 @@ OperationsWaiter.prototype.search_operations = function(e) { e.preventDefault(); ops = document.querySelectorAll("#search-results li"); if (ops.length) { - selected = this.get_selected_op(ops); + selected = this.getSelectedOp(ops); if (selected > -1) { ops[selected].classList.remove("selected-op"); } @@ -66,26 +66,26 @@ OperationsWaiter.prototype.search_operations = function(e) { ops[selected-1].classList.add("selected-op"); } } else { - var search_results_el = document.getElementById("search-results"), + var searchResultsEl = document.getElementById("search-results"), el = e.target, str = el.value; - while (search_results_el.firstChild) { - $(search_results_el.firstChild).popover("destroy"); - search_results_el.removeChild(search_results_el.firstChild); + while (searchResultsEl.firstChild) { + $(searchResultsEl.firstChild).popover("destroy"); + searchResultsEl.removeChild(searchResultsEl.firstChild); } $("#categories .in").collapse("hide"); if (str) { - var matched_ops = this.filter_operations(str, true), - matched_ops_html = ""; + var matchedOps = this.filterOperations(str, true), + matchedOpsHtml = ""; - for (var i = 0; i < matched_ops.length; i++) { - matched_ops_html += matched_ops[i].to_stub_html(); + for (var i = 0; i < matchedOps.length; i++) { + matchedOpsHtml += matchedOps[i].toStubHtml(); } - search_results_el.innerHTML = matched_ops_html; - search_results_el.dispatchEvent(this.manager.oplistcreate); + searchResultsEl.innerHTML = matchedOpsHtml; + searchResultsEl.dispatchEvent(this.manager.oplistcreate); } } }; @@ -94,37 +94,37 @@ OperationsWaiter.prototype.search_operations = function(e) { /** * Filters operations based on the search string and returns the matching ones. * - * @param {string} search_str + * @param {string} searchStr * @param {boolean} highlight - Whether or not to highlight the matching string in the operation * name and description * @returns {string[]} */ -OperationsWaiter.prototype.filter_operations = function(search_str, highlight) { - var matched_ops = [], - matched_descs = []; +OperationsWaiter.prototype.filterOperations = function(searchStr, highlight) { + var matchedOps = [], + matchedDescs = []; - search_str = search_str.toLowerCase(); + searchStr = searchStr.toLowerCase(); - for (var op_name in this.app.operations) { - var op = this.app.operations[op_name], - name_pos = op_name.toLowerCase().indexOf(search_str), - desc_pos = op.description.toLowerCase().indexOf(search_str); + for (var opName in this.app.operations) { + var op = this.app.operations[opName], + namePos = opName.toLowerCase().indexOf(searchStr), + descPos = op.description.toLowerCase().indexOf(searchStr); - if (name_pos >= 0 || desc_pos >= 0) { - var operation = new HTMLOperation(op_name, this.app.operations[op_name], this.app, this.manager); + if (namePos >= 0 || descPos >= 0) { + var operation = new HTMLOperation(opName, this.app.operations[opName], this.app, this.manager); if (highlight) { - operation.highlight_search_string(search_str, name_pos, desc_pos); + operation.highlightSearchString(searchStr, namePos, descPos); } - if (name_pos < 0) { - matched_ops.push(operation); + if (namePos < 0) { + matchedOps.push(operation); } else { - matched_descs.push(operation); + matchedDescs.push(operation); } } } - return matched_descs.concat(matched_ops); + return matchedDescs.concat(matchedOps); }; @@ -135,7 +135,7 @@ OperationsWaiter.prototype.filter_operations = function(search_str, highlight) { * @param {element[]} ops * @returns {number} */ -OperationsWaiter.prototype.get_selected_op = function(ops) { +OperationsWaiter.prototype.getSelectedOp = function(ops) { for (var i = 0; i < ops.length; i++) { if (ops[i].classList.contains("selected-op")) { return i; @@ -151,8 +151,8 @@ OperationsWaiter.prototype.get_selected_op = function(ops) { * @listens Manager#oplistcreate * @param {event} e */ -OperationsWaiter.prototype.op_list_create = function(e) { - this.manager.recipe.create_sortable_seed_list(e.target); +OperationsWaiter.prototype.opListCreate = function(e) { + this.manager.recipe.createSortableSeedList(e.target); $("[data-toggle=popover]").popover(); }; @@ -163,11 +163,11 @@ OperationsWaiter.prototype.op_list_create = function(e) { * * @param {event} e */ -OperationsWaiter.prototype.operation_dblclick = function(e) { +OperationsWaiter.prototype.operationDblclick = function(e) { var li = e.target; - this.manager.recipe.add_operation(li.textContent); - this.app.auto_bake(); + this.manager.recipe.addOperation(li.textContent); + this.app.autoBake(); }; @@ -177,46 +177,46 @@ OperationsWaiter.prototype.operation_dblclick = function(e) { * * @param {event} e */ -OperationsWaiter.prototype.edit_favourites_click = function(e) { +OperationsWaiter.prototype.editFavouritesClick = function(e) { e.preventDefault(); e.stopPropagation(); // Add favourites to modal - var fav_cat = this.app.categories.filter(function(c) { + var favCat = this.app.categories.filter(function(c) { return c.name === "Favourites"; })[0]; var html = ""; - for (var i = 0; i < fav_cat.ops.length; i++) { - var op_name = fav_cat.ops[i]; - var operation = new HTMLOperation(op_name, this.app.operations[op_name], this.app, this.manager); - html += operation.to_stub_html(true); + for (var i = 0; i < favCat.ops.length; i++) { + var opName = favCat.ops[i]; + var operation = new HTMLOperation(opName, this.app.operations[opName], this.app, this.manager); + html += operation.toStubHtml(true); } - var edit_favourites_list = document.getElementById("edit-favourites-list"); - edit_favourites_list.innerHTML = html; - this.remove_intent = false; + var editFavouritesList = document.getElementById("edit-favourites-list"); + editFavouritesList.innerHTML = html; + this.removeIntent = false; - var editable_list = Sortable.create(edit_favourites_list, { + var editableList = Sortable.create(editFavouritesList, { filter: ".remove-icon", onFilter: function (evt) { - var el = editable_list.closest(evt.item); + var el = editableList.closest(evt.item); if (el) { $(el).popover("destroy"); el.parentNode.removeChild(el); } }, onEnd: function(evt) { - if (this.remove_intent) evt.item.remove(); + if (this.removeIntent) evt.item.remove(); }.bind(this), }); - Sortable.utils.on(edit_favourites_list, "dragleave", function() { - this.remove_intent = true; + Sortable.utils.on(editFavouritesList, "dragleave", function() { + this.removeIntent = true; }.bind(this)); - Sortable.utils.on(edit_favourites_list, "dragover", function() { - this.remove_intent = false; + Sortable.utils.on(editFavouritesList, "dragover", function() { + this.removeIntent = false; }.bind(this)); $("#edit-favourites-list [data-toggle=popover]").popover(); @@ -228,18 +228,18 @@ OperationsWaiter.prototype.edit_favourites_click = function(e) { * Handler for save favourites click events. * Saves the selected favourites and reloads them. */ -OperationsWaiter.prototype.save_favourites_click = function() { - var favourites_list = [], +OperationsWaiter.prototype.saveFavouritesClick = function() { + var favouritesList = [], favs = document.querySelectorAll("#edit-favourites-list li"); for (var i = 0; i < favs.length; i++) { - favourites_list.push(favs[i].textContent); + favouritesList.push(favs[i].textContent); } - this.app.save_favourites(favourites_list); - this.app.load_favourites(); - this.app.populate_operations_list(); - this.manager.recipe.initialise_operation_drag_n_drop(); + this.app.saveFavourites(favouritesList); + this.app.loadFavourites(); + this.app.populateOperationsList(); + this.manager.recipe.initialiseOperationDragNDrop(); }; @@ -247,37 +247,37 @@ OperationsWaiter.prototype.save_favourites_click = function() { * Handler for reset favourites click events. * Resets favourites to their defaults. */ -OperationsWaiter.prototype.reset_favourites_click = function() { - this.app.reset_favourites(); +OperationsWaiter.prototype.resetFavouritesClick = function() { + this.app.resetFavourites(); }; /** - * Handler for op_icon mouseover events. + * Handler for opIcon mouseover events. * Hides any popovers already showing on the operation so that there aren't two at once. * * @param {event} e */ -OperationsWaiter.prototype.op_icon_mouseover = function(e) { - var op_el = e.target.parentNode; +OperationsWaiter.prototype.opIconMouseover = function(e) { + var opEl = e.target.parentNode; if (e.target.getAttribute("data-toggle") === "popover") { - $(op_el).popover("hide"); + $(opEl).popover("hide"); } }; /** - * Handler for op_icon mouseleave events. + * Handler for opIcon mouseleave events. * If this icon created a popover and we're moving back to the operation element, display the * operation popover again. * * @param {event} e */ -OperationsWaiter.prototype.op_icon_mouseleave = function(e) { - var op_el = e.target.parentNode, - to_el = e.toElement || e.relatedElement; +OperationsWaiter.prototype.opIconMouseleave = function(e) { + var opEl = e.target.parentNode, + toEl = e.toElement || e.relatedElement; - if (e.target.getAttribute("data-toggle") === "popover" && to_el === op_el) { - $(op_el).popover("show"); + if (e.target.getAttribute("data-toggle") === "popover" && toEl === opEl) { + $(opEl).popover("show"); } }; diff --git a/src/js/views/html/OptionsWaiter.js b/src/js/views/html/OptionsWaiter.js index 05d80185..3650fce5 100755 --- a/src/js/views/html/OptionsWaiter.js +++ b/src/js/views/html/OptionsWaiter.js @@ -52,7 +52,7 @@ OptionsWaiter.prototype.load = function(options) { * Handler for options click events. * Dispays the options pane. */ -OptionsWaiter.prototype.options_click = function() { +OptionsWaiter.prototype.optionsClick = function() { $("#options-modal").modal(); }; @@ -61,7 +61,7 @@ OptionsWaiter.prototype.options_click = function() { * Handler for reset options click events. * Resets options back to their default values. */ -OptionsWaiter.prototype.reset_options_click = function() { +OptionsWaiter.prototype.resetOptionsClick = function() { this.load(this.app.doptions); }; @@ -73,7 +73,7 @@ OptionsWaiter.prototype.reset_options_click = function() { * @param {event} e * @param {boolean} state */ -OptionsWaiter.prototype.switch_change = function(e, state) { +OptionsWaiter.prototype.switchChange = function(e, state) { var el = e.target, option = el.getAttribute("option"); @@ -88,7 +88,7 @@ OptionsWaiter.prototype.switch_change = function(e, state) { * * @param {event} e */ -OptionsWaiter.prototype.number_change = function(e) { +OptionsWaiter.prototype.numberChange = function(e) { var el = e.target, option = el.getAttribute("option"); @@ -103,7 +103,7 @@ OptionsWaiter.prototype.number_change = function(e) { * * @param {event} e */ -OptionsWaiter.prototype.select_change = function(e) { +OptionsWaiter.prototype.selectChange = function(e) { var el = e.target, option = el.getAttribute("option"); @@ -113,16 +113,16 @@ OptionsWaiter.prototype.select_change = function(e) { /** - * Sets or unsets word wrap on the input and output depending on the word_wrap option value. + * Sets or unsets word wrap on the input and output depending on the wordWrap option value. */ -OptionsWaiter.prototype.set_word_wrap = function() { +OptionsWaiter.prototype.setWordWrap = function() { document.getElementById("input-text").classList.remove("word-wrap"); document.getElementById("output-text").classList.remove("word-wrap"); document.getElementById("output-html").classList.remove("word-wrap"); document.getElementById("input-highlighter").classList.remove("word-wrap"); document.getElementById("output-highlighter").classList.remove("word-wrap"); - if (!this.app.options.word_wrap) { + if (!this.app.options.wordWrap) { document.getElementById("input-text").classList.add("word-wrap"); document.getElementById("output-text").classList.add("word-wrap"); document.getElementById("output-html").classList.add("word-wrap"); diff --git a/src/js/views/html/OutputWaiter.js b/src/js/views/html/OutputWaiter.js index 38f93708..b7bb3d74 100755 --- a/src/js/views/html/OutputWaiter.js +++ b/src/js/views/html/OutputWaiter.js @@ -28,47 +28,47 @@ OutputWaiter.prototype.get = function() { /** * Sets the output in the output textarea. * - * @param {string} data_str - The output string/HTML + * @param {string} dataStr - The output string/HTML * @param {string} type - The data type of the output * @param {number} duration - The length of time (ms) it took to generate the output */ -OutputWaiter.prototype.set = function(data_str, type, duration) { - var output_text = document.getElementById("output-text"), - output_html = document.getElementById("output-html"), - output_highlighter = document.getElementById("output-highlighter"), - input_highlighter = document.getElementById("input-highlighter"); +OutputWaiter.prototype.set = function(dataStr, type, duration) { + var outputText = document.getElementById("output-text"), + outputHtml = document.getElementById("output-html"), + outputHighlighter = document.getElementById("output-highlighter"), + inputHighlighter = document.getElementById("input-highlighter"); if (type === "html") { - output_text.style.display = "none"; - output_html.style.display = "block"; - output_highlighter.display = "none"; - input_highlighter.display = "none"; + outputText.style.display = "none"; + outputHtml.style.display = "block"; + outputHighlighter.display = "none"; + inputHighlighter.display = "none"; - output_text.value = ""; - output_html.innerHTML = data_str; + outputText.value = ""; + outputHtml.innerHTML = dataStr; // Execute script sections - var script_elements = output_html.querySelectorAll("script"); - for (var i = 0; i < script_elements.length; i++) { + var scriptElements = outputHtml.querySelectorAll("script"); + for (var i = 0; i < scriptElements.length; i++) { try { - eval(script_elements[i].innerHTML); // eslint-disable-line no-eval + eval(scriptElements[i].innerHTML); // eslint-disable-line no-eval } catch (err) { console.error(err); } } } else { - output_text.style.display = "block"; - output_html.style.display = "none"; - output_highlighter.display = "block"; - input_highlighter.display = "block"; + outputText.style.display = "block"; + outputHtml.style.display = "none"; + outputHighlighter.display = "block"; + inputHighlighter.display = "block"; - output_text.value = Utils.printable(data_str, true); - output_html.innerHTML = ""; + outputText.value = Utils.printable(dataStr, true); + outputHtml.innerHTML = ""; } - this.manager.highlighter.remove_highlights(); - var lines = data_str.count("\n") + 1; - this.set_output_info(data_str.length, lines, duration); + this.manager.highlighter.removeHighlights(); + var lines = dataStr.count("\n") + 1; + this.setOutputInfo(dataStr.length, lines, duration); }; @@ -79,17 +79,17 @@ OutputWaiter.prototype.set = function(data_str, type, duration) { * @param {number} lines - The number of the lines in the current output string * @param {number} duration - The length of time (ms) it took to generate the output */ -OutputWaiter.prototype.set_output_info = function(length, lines, duration) { +OutputWaiter.prototype.setOutputInfo = function(length, lines, duration) { var width = length.toString().length; width = width < 4 ? 4 : width; - var length_str = Utils.pad(length.toString(), width, " ").replace(/ /g, " "); - var lines_str = Utils.pad(lines.toString(), width, " ").replace(/ /g, " "); - var time_str = Utils.pad(duration.toString() + "ms", width, " ").replace(/ /g, " "); + var lengthStr = Utils.pad(length.toString(), width, " ").replace(/ /g, " "); + var linesStr = Utils.pad(lines.toString(), width, " ").replace(/ /g, " "); + var timeStr = Utils.pad(duration.toString() + "ms", width, " ").replace(/ /g, " "); - document.getElementById("output-info").innerHTML = "time: " + time_str + - "
                                                                                                                                                                                                      length: " + length_str + - "
                                                                                                                                                                                                      lines: " + lines_str; + document.getElementById("output-info").innerHTML = "time: " + timeStr + + "
                                                                                                                                                                                                      length: " + lengthStr + + "
                                                                                                                                                                                                      lines: " + linesStr; document.getElementById("input-selection-info").innerHTML = ""; document.getElementById("output-selection-info").innerHTML = ""; }; @@ -99,24 +99,24 @@ OutputWaiter.prototype.set_output_info = function(length, lines, duration) { * Adjusts the display properties of the output buttons so that they fit within the current width * without wrapping or overflowing. */ -OutputWaiter.prototype.adjust_width = function() { - var output = document.getElementById("output"), - save_to_file = document.getElementById("save-to-file"), - switch_io = document.getElementById("switch"), - undo_switch = document.getElementById("undo-switch"), - maximise_output = document.getElementById("maximise-output"); +OutputWaiter.prototype.adjustWidth = function() { + var output = document.getElementById("output"), + saveToFile = document.getElementById("save-to-file"), + switchIO = document.getElementById("switch"), + undoSwitch = document.getElementById("undo-switch"), + maximiseOutput = document.getElementById("maximise-output"); if (output.clientWidth < 680) { - save_to_file.childNodes[1].nodeValue = ""; - switch_io.childNodes[1].nodeValue = ""; - undo_switch.childNodes[1].nodeValue = ""; - maximise_output.childNodes[1].nodeValue = ""; + saveToFile.childNodes[1].nodeValue = ""; + switchIO.childNodes[1].nodeValue = ""; + undoSwitch.childNodes[1].nodeValue = ""; + maximiseOutput.childNodes[1].nodeValue = ""; } else { - save_to_file.childNodes[1].nodeValue = " Save to file"; - switch_io.childNodes[1].nodeValue = " Move output to input"; - undo_switch.childNodes[1].nodeValue = " Undo"; - maximise_output.childNodes[1].nodeValue = - maximise_output.getAttribute("title") === "Maximise" ? " Max" : " Restore"; + saveToFile.childNodes[1].nodeValue = " Save to file"; + switchIO.childNodes[1].nodeValue = " Move output to input"; + undoSwitch.childNodes[1].nodeValue = " Undo"; + maximiseOutput.childNodes[1].nodeValue = + maximiseOutput.getAttribute("title") === "Maximise" ? " Max" : " Restore"; } }; @@ -125,8 +125,8 @@ OutputWaiter.prototype.adjust_width = function() { * Handler for save click events. * Saves the current output to a file, downloaded as a URL octet stream. */ -OutputWaiter.prototype.save_click = function() { - var data = Utils.to_base64(this.app.dish_str), +OutputWaiter.prototype.saveClick = function() { + var data = Utils.toBase64(this.app.dishStr), filename = window.prompt("Please enter a filename:", "download.dat"); if (filename) { @@ -148,10 +148,10 @@ OutputWaiter.prototype.save_click = function() { * Handler for switch click events. * Moves the current output into the input textarea. */ -OutputWaiter.prototype.switch_click = function() { - this.switch_orig_data = this.manager.input.get(); +OutputWaiter.prototype.switchClick = function() { + this.switchOrigData = this.manager.input.get(); document.getElementById("undo-switch").disabled = false; - this.app.set_input(this.app.dish_str); + this.app.setInput(this.app.dishStr); }; @@ -159,8 +159,8 @@ OutputWaiter.prototype.switch_click = function() { * Handler for undo switch click events. * Removes the output from the input and replaces the input that was removed. */ -OutputWaiter.prototype.undo_switch_click = function() { - this.app.set_input(this.switch_orig_data); +OutputWaiter.prototype.undoSwitchClick = function() { + this.app.setInput(this.switchOrigData); document.getElementById("undo-switch").disabled = true; }; @@ -169,20 +169,20 @@ OutputWaiter.prototype.undo_switch_click = function() { * Handler for maximise output click events. * Resizes the output frame to be as large as possible, or restores it to its original size. */ -OutputWaiter.prototype.maximise_output_click = function(e) { +OutputWaiter.prototype.maximiseOutputClick = function(e) { var el = e.target.id === "maximise-output" ? e.target : e.target.parentNode; if (el.getAttribute("title") === "Maximise") { - this.app.column_splitter.collapse(0); - this.app.column_splitter.collapse(1); - this.app.io_splitter.collapse(0); + this.app.columnSplitter.collapse(0); + this.app.columnSplitter.collapse(1); + this.app.ioSplitter.collapse(0); el.setAttribute("title", "Restore"); el.innerHTML = " Restore"; - this.adjust_width(); + this.adjustWidth(); } else { el.setAttribute("title", "Maximise"); el.innerHTML = " Max"; - this.app.reset_layout(); + this.app.resetLayout(); } }; diff --git a/src/js/views/html/RecipeWaiter.js b/src/js/views/html/RecipeWaiter.js index 3d59c84e..1d259474 100755 --- a/src/js/views/html/RecipeWaiter.js +++ b/src/js/views/html/RecipeWaiter.js @@ -14,79 +14,79 @@ var RecipeWaiter = function(app, manager) { this.app = app; this.manager = manager; - this.remove_intent = false; + this.removeIntent = false; }; /** * Sets up the drag and drop capability for operations in the operations and recipe areas. */ -RecipeWaiter.prototype.initialise_operation_drag_n_drop = function() { - var rec_list = document.getElementById("rec_list"); +RecipeWaiter.prototype.initialiseOperationDragNDrop = function() { + var recList = document.getElementById("rec-list"); // Recipe list - Sortable.create(rec_list, { + Sortable.create(recList, { group: "recipe", sort: true, animation: 0, delay: 0, filter: ".arg-input,.arg", // Relies on commenting out a line in Sortable.js which calls evt.preventDefault() - setData: function(dataTransfer, drag_el) { - dataTransfer.setData("Text", drag_el.querySelector(".arg-title").textContent); + setData: function(dataTransfer, dragEl) { + dataTransfer.setData("Text", dragEl.querySelector(".arg-title").textContent); }, onEnd: function(evt) { - if (this.remove_intent) { + if (this.removeIntent) { evt.item.remove(); evt.target.dispatchEvent(this.manager.operationremove); } }.bind(this) }); - Sortable.utils.on(rec_list, "dragover", function() { - this.remove_intent = false; + Sortable.utils.on(recList, "dragover", function() { + this.removeIntent = false; }.bind(this)); - Sortable.utils.on(rec_list, "dragleave", function() { - this.remove_intent = true; + Sortable.utils.on(recList, "dragleave", function() { + this.removeIntent = true; this.app.progress = 0; }.bind(this)); - Sortable.utils.on(rec_list, "touchend", function(e) { + Sortable.utils.on(recList, "touchend", function(e) { var loc = e.changedTouches[0], target = document.elementFromPoint(loc.clientX, loc.clientY); - this.remove_intent = !rec_list.contains(target); + this.removeIntent = !recList.contains(target); }.bind(this)); // Favourites category - document.querySelector("#categories a").addEventListener("dragover", this.fav_dragover.bind(this)); - document.querySelector("#categories a").addEventListener("dragleave", this.fav_dragleave.bind(this)); - document.querySelector("#categories a").addEventListener("drop", this.fav_drop.bind(this)); + document.querySelector("#categories a").addEventListener("dragover", this.favDragover.bind(this)); + document.querySelector("#categories a").addEventListener("dragleave", this.favDragleave.bind(this)); + document.querySelector("#categories a").addEventListener("drop", this.favDrop.bind(this)); }; /** * Creates a drag-n-droppable seed list of operations. * - * @param {element} list_el - The list the initialise + * @param {element} listEl - The list the initialise */ -RecipeWaiter.prototype.create_sortable_seed_list = function(list_el) { - Sortable.create(list_el, { +RecipeWaiter.prototype.createSortableSeedList = function(listEl) { + Sortable.create(listEl, { group: { name: "recipe", pull: "clone", put: false }, sort: false, - setData: function(dataTransfer, drag_el) { - dataTransfer.setData("Text", drag_el.textContent); + setData: function(dataTransfer, dragEl) { + dataTransfer.setData("Text", dragEl.textContent); }, onStart: function(evt) { $(evt.item).popover("destroy"); evt.item.setAttribute("data-toggle", "popover-disabled"); }, - onEnd: this.op_sort_end.bind(this) + onEnd: this.opSortEnd.bind(this) }); }; @@ -99,9 +99,9 @@ RecipeWaiter.prototype.create_sortable_seed_list = function(list_el) { * @fires Manager#operationadd * @param {event} evt */ -RecipeWaiter.prototype.op_sort_end = function(evt) { - if (this.remove_intent) { - if (evt.item.parentNode.id === "rec_list") { +RecipeWaiter.prototype.opSortEnd = function(evt) { + if (this.removeIntent) { + if (evt.item.parentNode.id === "rec-list") { evt.item.remove(); } return; @@ -112,11 +112,11 @@ RecipeWaiter.prototype.op_sort_end = function(evt) { $(evt.clone).popover(); $(evt.clone).children("[data-toggle=popover]").popover(); - if (evt.item.parentNode.id !== "rec_list") { + if (evt.item.parentNode.id !== "rec-list") { return; } - this.build_recipe_operation(evt.item); + this.buildRecipeOperation(evt.item); evt.item.dispatchEvent(this.manager.operationadd); }; @@ -128,7 +128,7 @@ RecipeWaiter.prototype.op_sort_end = function(evt) { * * @param {event} e */ -RecipeWaiter.prototype.fav_dragover = function(e) { +RecipeWaiter.prototype.favDragover = function(e) { if (e.dataTransfer.effectAllowed !== "move") return false; @@ -153,7 +153,7 @@ RecipeWaiter.prototype.fav_dragover = function(e) { * * @param {event} e */ -RecipeWaiter.prototype.fav_dragleave = function(e) { +RecipeWaiter.prototype.favDragleave = function(e) { e.stopPropagation(); e.preventDefault(); document.querySelector("#categories a").classList.remove("favourites-hover"); @@ -166,13 +166,13 @@ RecipeWaiter.prototype.fav_dragleave = function(e) { * * @param {event} e */ -RecipeWaiter.prototype.fav_drop = function(e) { +RecipeWaiter.prototype.favDrop = function(e) { e.stopPropagation(); e.preventDefault(); e.target.classList.remove("favourites-hover"); - var op_name = e.dataTransfer.getData("Text"); - this.app.add_favourite(op_name); + var opName = e.dataTransfer.getData("Text"); + this.app.addFavourite(opName); }; @@ -181,7 +181,7 @@ RecipeWaiter.prototype.fav_drop = function(e) { * * @fires Manager#statechange */ -RecipeWaiter.prototype.ing_change = function() { +RecipeWaiter.prototype.ingChange = function() { window.dispatchEvent(this.manager.statechange); }; @@ -193,7 +193,7 @@ RecipeWaiter.prototype.ing_change = function() { * @fires Manager#statechange * @param {event} e */ -RecipeWaiter.prototype.disable_click = function(e) { +RecipeWaiter.prototype.disableClick = function(e) { var icon = e.target; if (icon.getAttribute("disabled") === "false") { @@ -218,7 +218,7 @@ RecipeWaiter.prototype.disable_click = function(e) { * @fires Manager#statechange * @param {event} e */ -RecipeWaiter.prototype.breakpoint_click = function(e) { +RecipeWaiter.prototype.breakpointClick = function(e) { var bp = e.target; if (bp.getAttribute("break") === "false") { @@ -240,7 +240,7 @@ RecipeWaiter.prototype.breakpoint_click = function(e) { * @fires Manager#statechange * @param {event} e */ -RecipeWaiter.prototype.operation_dblclick = function(e) { +RecipeWaiter.prototype.operationDblclick = function(e) { e.target.remove(); window.dispatchEvent(this.manager.statechange); }; @@ -253,7 +253,7 @@ RecipeWaiter.prototype.operation_dblclick = function(e) { * @fires Manager#statechange * @param {event} e */ -RecipeWaiter.prototype.operation_child_dblclick = function(e) { +RecipeWaiter.prototype.operationChildDblclick = function(e) { e.target.parentNode.remove(); window.dispatchEvent(this.manager.statechange); }; @@ -262,31 +262,31 @@ RecipeWaiter.prototype.operation_child_dblclick = function(e) { /** * Generates a configuration object to represent the current recipe. * - * @returns {recipe_config} + * @returns {recipeConfig} */ -RecipeWaiter.prototype.get_config = function() { - var config = [], ingredients, ing_list, disabled, bp, item, - operations = document.querySelectorAll("#rec_list li.operation"); +RecipeWaiter.prototype.getConfig = function() { + var config = [], ingredients, ingList, disabled, bp, item, + operations = document.querySelectorAll("#rec-list li.operation"); for (var i = 0; i < operations.length; i++) { ingredients = []; disabled = operations[i].querySelector(".disable-icon"); bp = operations[i].querySelector(".breakpoint"); - ing_list = operations[i].querySelectorAll(".arg"); + ingList = operations[i].querySelectorAll(".arg"); - for (var j = 0; j < ing_list.length; j++) { - if (ing_list[j].getAttribute("type") === "checkbox") { + for (var j = 0; j < ingList.length; j++) { + if (ingList[j].getAttribute("type") === "checkbox") { // checkbox - ingredients[j] = ing_list[j].checked; - } else if (ing_list[j].classList.contains("toggle-string")) { - // toggle_string + ingredients[j] = ingList[j].checked; + } else if (ingList[j].classList.contains("toggle-string")) { + // toggleString ingredients[j] = { - option: ing_list[j].previousSibling.children[0].textContent.slice(0, -1), - string: ing_list[j].value + option: ingList[j].previousSibling.children[0].textContent.slice(0, -1), + string: ingList[j].value }; } else { // all others - ingredients[j] = ing_list[j].value; + ingredients[j] = ingList[j].value; } } @@ -315,8 +315,8 @@ RecipeWaiter.prototype.get_config = function() { * * @param {number} position */ -RecipeWaiter.prototype.update_breakpoint_indicator = function(position) { - var operations = document.querySelectorAll("#rec_list li.operation"); +RecipeWaiter.prototype.updateBreakpointIndicator = function(position) { + var operations = document.querySelectorAll("#rec-list li.operation"); for (var i = 0; i < operations.length; i++) { if (i === position) { operations[i].classList.add("break"); @@ -333,19 +333,19 @@ RecipeWaiter.prototype.update_breakpoint_indicator = function(position) { * * @param {element} el - The operation stub element from the operations pane */ -RecipeWaiter.prototype.build_recipe_operation = function(el) { - var op_name = el.textContent; - var op = new HTMLOperation(op_name, this.app.operations[op_name], this.app, this.manager); - el.innerHTML = op.to_full_html(); +RecipeWaiter.prototype.buildRecipeOperation = function(el) { + var opName = el.textContent; + var op = new HTMLOperation(opName, this.app.operations[opName], this.app, this.manager); + el.innerHTML = op.toFullHtml(); - if (this.app.operations[op_name].flow_control) { + if (this.app.operations[opName].flowControl) { el.classList.add("flow-control-op"); } // Disable auto-bake if this is a manual op - this should be moved to the 'operationadd' // handler after event restructuring - if (op.manual_bake && this.app.auto_bake_) { - this.manager.controls.set_auto_bake(false); + if (op.manualBake && this.app.autoBake_) { + this.manager.controls.setAutoBake(false); this.app.alert("Auto-Bake is disabled by default when using this operation.", "info", 5000); } }; @@ -357,13 +357,13 @@ RecipeWaiter.prototype.build_recipe_operation = function(el) { * @param {string} name - The name of the operation to add * @returns {element} */ -RecipeWaiter.prototype.add_operation = function(name) { +RecipeWaiter.prototype.addOperation = function(name) { var item = document.createElement("li"); item.classList.add("operation"); item.innerHTML = name; - this.build_recipe_operation(item); - document.getElementById("rec_list").appendChild(item); + this.buildRecipeOperation(item); + document.getElementById("rec-list").appendChild(item); item.dispatchEvent(this.manager.operationadd); return item; @@ -375,27 +375,27 @@ RecipeWaiter.prototype.add_operation = function(name) { * * @fires Manager#operationremove */ -RecipeWaiter.prototype.clear_recipe = function() { - var rec_list = document.getElementById("rec_list"); - while (rec_list.firstChild) { - rec_list.removeChild(rec_list.firstChild); +RecipeWaiter.prototype.clearRecipe = function() { + var recList = document.getElementById("rec-list"); + while (recList.firstChild) { + recList.removeChild(recList.firstChild); } - rec_list.dispatchEvent(this.manager.operationremove); + recList.dispatchEvent(this.manager.operationremove); }; /** - * Handler for operation dropdown events from toggle_string arguments. + * Handler for operation dropdown events from toggleString arguments. * Sets the selected option as the name of the button. * * @param {event} e */ -RecipeWaiter.prototype.dropdown_toggle_click = function(e) { +RecipeWaiter.prototype.dropdownToggleClick = function(e) { var el = e.target, button = el.parentNode.parentNode.previousSibling; button.innerHTML = el.textContent + " "; - this.ing_change(); + this.ingChange(); }; @@ -406,7 +406,7 @@ RecipeWaiter.prototype.dropdown_toggle_click = function(e) { * @fires Manager#statechange * @param {event} e */ -RecipeWaiter.prototype.op_add = function(e) { +RecipeWaiter.prototype.opAdd = function(e) { window.dispatchEvent(this.manager.statechange); }; @@ -418,6 +418,6 @@ RecipeWaiter.prototype.op_add = function(e) { * @fires Manager#statechange * @param {event} e */ -RecipeWaiter.prototype.op_remove = function(e) { +RecipeWaiter.prototype.opRemove = function(e) { window.dispatchEvent(this.manager.statechange); }; diff --git a/src/js/views/html/SeasonalWaiter.js b/src/js/views/html/SeasonalWaiter.js index d480b521..a4e6cecf 100755 --- a/src/js/views/html/SeasonalWaiter.js +++ b/src/js/views/html/SeasonalWaiter.js @@ -24,22 +24,22 @@ SeasonalWaiter.prototype.load = function() { // Snowfall if (now.getMonth() === 11 && now.getDate() > 12) { // Dec 13 -> Dec 31 this.app.options.snow = false; - this.create_snow_option(); - $(document).on("switchChange.bootstrapSwitch", ".option-item input:checkbox[option='snow']", this.let_it_snow.bind(this)); - window.addEventListener("resize", this.let_it_snow.bind(this)); - this.manager.add_listeners(".btn", "click", this.shake_off_snow, this); - if (now.getDate() === 25) this.let_it_snow(); + this.createSnowOption(); + $(document).on("switchChange.bootstrapSwitch", ".option-item input:checkbox[option='snow']", this.letItSnow.bind(this)); + window.addEventListener("resize", this.letItSnow.bind(this)); + this.manager.addListeners(".btn", "click", this.shakeOffSnow, this); + if (now.getDate() === 25) this.letItSnow(); } // SpiderChef // if (now.getMonth() === 3 && now.getDate() === 1) { // Apr 1 - // this.insert_spider_icons(); - // this.insert_spider_text(); + // this.insertSpiderIcons(); + // this.insertSpiderText(); // } // Konami code this.kkeys = []; - window.addEventListener("keydown", this.konami_code_listener.bind(this)); + window.addEventListener("keydown", this.konamiCodeListener.bind(this)); }; @@ -47,7 +47,7 @@ SeasonalWaiter.prototype.load = function() { * Replaces chef icons with spider icons. * #spiderchef */ -SeasonalWaiter.prototype.insert_spider_icons = function() { +SeasonalWaiter.prototype.insertSpiderIcons = function() { var spider16 = "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB3UlEQVQ4y2NgGJaAmYGBgVnf0oKJgYGBobWtXamqqoYTn2I4CI+LTzM2NTulpKbu+vPHz2dV5RWlluZmi3j5+KqFJSSEzpw8uQPdAEYYIzo5Kfjrl28rWFlZzjAzMYuEBQao3Lh+g+HGvbsMzExMDN++fWf4/PXLBzY2tqYNK1f2+4eHM2xcuRLigsT09Igf3384MTExbf767etBI319jU8fPsi+//jx/72HDxh5uLkZ7ty7y/Dz1687Avz8n2UUFR3Z2NjOySoqfmdhYGBg+PbtuwI7O8e5H79+8X379t357PnzYo+ePP7y6cuXc9++f69nYGRsvf/w4XdtLS2R799/bBUWFHr57sP7Jbs3b/ZkzswvUP3165fZ7z9//r988WIVAyPDr8tXr576+u3bpb9//7YwMjKeV1dV41NWVGoVEhDgPH761DJREeHaz1+/lqlpafUx6+jrRfz4+fPy+w8fTu/fsf3uw7t3L39+//4cv7DwGQYGhpdPbt9m4BcRFlNWVJC4fuvWASszs4C379792Ldt2xZBUdEdDP5hYSqQGIjDGa965uYKCalpZQwMDAxhMTG9DAwMDLaurhIkJY7A8IgGBgYGBgd3Dz2yUpeFo6O4rasrA9T24ZRxAAMTwMpgEJwLAAAAAElFTkSuQmCC", spider32 = "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAACYVBMVEUAAAAcJSU2Pz85QkM9RUWEhIWMjI2MkJEcJSU2Pz85QkM9RUWWlpc9RUVXXl4cJSU2Pz85QkM8REU9RUVRWFh6ens9RUVCSkpNVFRdY2McJSU5QkM7REQ9RUVGTk5KUlJQVldcY2Rla2uTk5WampscJSVUWltZX2BrcHF1e3scJSUjLCw9RUVASEhFTU1HTk9bYWJeZGRma2xudHV1eHiZmZocJSUyOjpJUFFQVldSWlpTWVpXX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KBluz+OtMJiF31jHxqXBiAqAUj4WRxpADFM0DCFlv1khvX7Wol4vF4AIldVVxdZqlrIfiCYQPHDy6bAGv7nKYRVY6JewExZVAP+ey5Rv+Ba97aaUHMW5NauLmMZFkegBb/EP14d6NoS9QLWFSzWBmuZza8CQmSpXsAqmGtVy14VALWuuYWWy+W3OteXa4jwceQX6+BKG6J1/8+2VCNkm2222WabbbbZZpttttlmm22rt38DCdA0vq3bcAkAAAAASUVORK5CYII="; @@ -67,12 +67,12 @@ SeasonalWaiter.prototype.insert_spider_icons = function() { * Replaces all instances of the word "cyber" with "spider". * #spiderchef */ -SeasonalWaiter.prototype.insert_spider_text = function() { +SeasonalWaiter.prototype.insertSpiderText = function() { // Title document.title = document.title.replace(/Cyber/g, "Spider"); // Body - SeasonalWaiter.tree_walk(document.body, function(node) { + SeasonalWaiter.treeWalk(document.body, function(node) { // process only text nodes if (node.nodeType === 3) { node.nodeValue = node.nodeValue.replace(/Cyber/g, "Spider"); @@ -80,7 +80,7 @@ SeasonalWaiter.prototype.insert_spider_text = function() { }, true); // Bake button - SeasonalWaiter.tree_walk(document.getElementById("bake-group"), function(node) { + SeasonalWaiter.treeWalk(document.getElementById("bake-group"), function(node) { // process only text nodes if (node.nodeType === 3) { node.nodeValue = node.nodeValue.replace(/Bake/g, "Spin"); @@ -96,15 +96,15 @@ SeasonalWaiter.prototype.insert_spider_text = function() { * Adds an option to make it snow. * #letitsnow */ -SeasonalWaiter.prototype.create_snow_option = function() { - var options_body = document.getElementById("options-body"), - option_item = document.createElement("div"); +SeasonalWaiter.prototype.createSnowOption = function() { + var optionsBody = document.getElementById("options-body"), + optionItem = document.createElement("div"); - option_item.className = "option-item"; - option_item.innerHTML = + optionItem.className = "option-item"; + optionItem.innerHTML = "\ Let it snow"; - options_body.appendChild(option_item); + optionsBody.appendChild(optionItem); this.manager.options.load(); }; @@ -114,14 +114,14 @@ SeasonalWaiter.prototype.create_snow_option = function() { * Initialises a snowstorm. * #letitsnow */ -SeasonalWaiter.prototype.let_it_snow = function() { +SeasonalWaiter.prototype.letItSnow = function() { $(document).snowfall("clear"); if (!this.app.options.snow) return; var options = {}, - firefox_version = navigator.userAgent.match(/Firefox\/(\d\d?)/); + firefoxVersion = navigator.userAgent.match(/Firefox\/(\d\d?)/); - if (firefox_version && parseInt(firefox_version[1], 10) < 30) { + if (firefoxVersion && parseInt(firefoxVersion[1], 10) < 30) { // Firefox < 30 options = { flakeCount: 10, @@ -163,12 +163,12 @@ SeasonalWaiter.prototype.let_it_snow = function() { * When a button is clicked, shake the snow off that button. * #letitsnow */ -SeasonalWaiter.prototype.shake_off_snow = function(e) { +SeasonalWaiter.prototype.shakeOffSnow = function(e) { var el = e.target, rect = el.getBoundingClientRect(), canvases = document.querySelectorAll("canvas.snowfall-canvas"), canvas = null, - remove_func = function() { + removeFunc = function() { ctx.clearRect(0, 0, canvas.width, canvas.height); $(this).fadeIn(); }; @@ -178,7 +178,7 @@ SeasonalWaiter.prototype.shake_off_snow = function(e) { if (canvas.style.left === rect.left + "px" && canvas.style.top === (rect.top - 20) + "px") { var ctx = canvas.getContext("2d"); - $(canvas).fadeOut("slow", remove_func); + $(canvas).fadeOut("slow", removeFunc); break; } } @@ -190,7 +190,7 @@ SeasonalWaiter.prototype.shake_off_snow = function(e) { * sequence. * #konamicode */ -SeasonalWaiter.prototype.konami_code_listener = function(e) { +SeasonalWaiter.prototype.konamiCodeListener = function(e) { this.kkeys.push(e.keyCode); var konami = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65]; for (var i = 0; i < this.kkeys.length; i++) { @@ -212,20 +212,20 @@ SeasonalWaiter.prototype.konami_code_listener = function(e) { * @static * @param {element} parent - The DOM node to start from * @param {Function} fn - The callback function to operate on each node - * @param {booleam} all_nodes - Whether to operate on every node or not + * @param {booleam} allNodes - Whether to operate on every node or not */ -SeasonalWaiter.tree_walk = (function() { +SeasonalWaiter.treeWalk = (function() { // Create closure for constants var skipTags = { "SCRIPT": true, "IFRAME": true, "OBJECT": true, "EMBED": true, "STYLE": true, "LINK": true, "META": true }; - return function(parent, fn, all_nodes) { + return function(parent, fn, allNodes) { var node = parent.firstChild; while (node && node !== parent) { - if (all_nodes || node.nodeType === 1) { + if (allNodes || node.nodeType === 1) { if (fn(node) === false) { return(false); } diff --git a/src/js/views/html/WindowWaiter.js b/src/js/views/html/WindowWaiter.js index 3f905b62..6c3b427b 100755 --- a/src/js/views/html/WindowWaiter.js +++ b/src/js/views/html/WindowWaiter.js @@ -18,9 +18,9 @@ var WindowWaiter = function(app) { * Resets the layout of CyberChef's panes after 200ms (so that continuous resizing doesn't cause * continuous resetting). */ -WindowWaiter.prototype.window_resize = function() { - clearTimeout(this.reset_layout_timeout); - this.reset_layout_timeout = setTimeout(this.app.reset_layout.bind(this.app), 200); +WindowWaiter.prototype.windowResize = function() { + clearTimeout(this.resetLayoutTimeout); + this.resetLayoutTimeout = setTimeout(this.app.resetLayout.bind(this.app), 200); }; @@ -29,8 +29,8 @@ WindowWaiter.prototype.window_resize = function() { * Saves the current time so that we can calculate how long the window was unfocussed for when * focus is returned. */ -WindowWaiter.prototype.window_blur = function() { - this.window_blur_time = new Date().getTime(); +WindowWaiter.prototype.windowBlur = function() { + this.windowBlurTime = new Date().getTime(); }; @@ -44,9 +44,9 @@ WindowWaiter.prototype.window_blur = function() { * This will stop baking taking a long time when the CyberChef browser tab has been unfocused for * a long time and the browser has swapped out all its memory. */ -WindowWaiter.prototype.window_focus = function() { - var unfocused_time = new Date().getTime() - this.window_blur_time; - if (unfocused_time > 60000) { - this.app.silent_bake(); +WindowWaiter.prototype.windowFocus = function() { + var unfocusedTime = new Date().getTime() - this.windowBlurTime; + if (unfocusedTime > 60000) { + this.app.silentBake(); } }; diff --git a/src/js/views/html/main.js b/src/js/views/html/main.js index 71cbb7ad..dbe6e342 100755 --- a/src/js/views/html/main.js +++ b/src/js/views/html/main.js @@ -10,7 +10,7 @@ * Main function used to build the CyberChef web app. */ var main = function() { - var default_favourites = [ + var defaultFavourites = [ "To Base64", "From Base64", "To Hex", @@ -23,27 +23,27 @@ var main = function() { "Fork" ]; - var default_options = { - update_url : true, - show_highlighter : true, - treat_as_utf8 : true, - word_wrap : true, - show_errors : true, - error_timeout : 4000, - auto_bake_threshold : 200, - attempt_highlight : true, - snow : false, + var defaultOptions = { + updateUrl : true, + showHighlighter : true, + treatAsUtf8 : true, + wordWrap : true, + showErrors : true, + errorTimeout : 4000, + autoBakeThreshold : 200, + attemptHighlight : true, + snow : false, }; document.removeEventListener("DOMContentLoaded", main, false); - window.app = new HTMLApp(Categories, OperationConfig, default_favourites, default_options); + window.app = new HTMLApp(Categories, OperationConfig, defaultFavourites, defaultOptions); window.app.setup(); }; // Fix issues with browsers that don't support console.log() window.console = console || {log: function() {}, error: function() {}}; -window.compile_time = moment.tz("<%= grunt.template.today() %>", "ddd MMM D YYYY HH:mm:ss", "UTC").valueOf(); -window.compile_message = "<%= compile_msg %>"; +window.compileTime = moment.tz("<%= grunt.template.today() %>", "ddd MMM D YYYY HH:mm:ss", "UTC").valueOf(); +window.compileMessage = "<%= compileMsg %>"; document.addEventListener("DOMContentLoaded", main, false); diff --git a/src/static/stats.txt b/src/static/stats.txt index 211ff731..88c04a7d 100644 --- a/src/static/stats.txt +++ b/src/static/stats.txt @@ -1,9 +1,9 @@ 211 source files -114836 lines +114840 lines 4.3M size 141 JavaScript source files -105679 lines +105680 lines 3.7M size 83 third party JavaScript source files @@ -11,7 +11,7 @@ 3.0M size 58 first party JavaScript source files -19421 lines +19422 lines 732K size 3.4M uncompressed JavaScript size