/*
  MIT License http://www.opensource.org/licenses/mit-license.php
  Author Tobias Koppers @sokra
*/

/*
 * Tine 2.0
 *
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 * @copyright   Copyright (c) 2017 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 *
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 * @copyright   Copyright (c) 2017-2025 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 *
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 * @copyright   Copyright (c) 2025 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 *
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Cornelius Weiß <c.weiss@metaways.de>
 * @copyright   Copyright (c) 2017 Metaways Infosystems GmbH (http://www.metaways.de)
 *
 */

/*
 * Tine 2.0
 *
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Stefanie Stamer <s.stamer@metaways.de>
 * @copyright   Copyright (c) 2017 Metaways Infosystems GmbH (http://www.metaways.de)
 *
 */

/*
 * Tine 2.0
 *
 * @package     Tine
 * @subpackage  Tinebase
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 * @copyright   Copyright (c) 2007-2010 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 *
 * @package     Tine
 * @subpackage  Tinebase
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 * @copyright   Copyright (c) 2007-2024 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 * 
 * @package     Tine
 * @subpackage  Tinebase
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 * @copyright   Copyright (c) 2007-2025 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * tine-groupware
 *
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 * @copyright   Copyright (c) 2024 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * tine-groupware
 *
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 * @copyright   Copyright (c) 2024-2025 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
export const apply = Ext.apply;
export const applyIf = Ext.applyIf;
export const id = Ext.id;
export const extend = Ext.extend;
export const override = Ext.override;
export const namespace = Ext.namespace;
export const urlEncode = Ext.urlEncode;
export const urlDecode = Ext.urlDecode;
export const urlAppend = Ext.urlAppend;
export const toArray = Ext.toArray;
export const isIterable = Ext.isIterable;
export const each = Ext.each;
export const iterate = Ext.iterate;
// export const getDom = Ext.getDom;
// export const getBody = Ext.getBody;
// export const removeNode = Ext.removeNode;
export const isEmpty = Ext.isEmpty;
export const isArray = Ext.isArray;
export const isDate = Ext.isDate;
export const isObject = Ext.isObject;
export const isPrimitive = Ext.isPrimitive;
export const isFunction = Ext.isFunction;
export const isNumber = Ext.isNumber;
export const isString = Ext.isString;
export const isBoolean = Ext.isBoolean;
export const isElement = Ext.isElement;
export const isDefined = Ext.isDefined;
export const escapeRe = Ext.escapeRe;
export const ns = Ext.ns;
*/

/* 
 * Tine 2.0
 * 
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 * @copyright   Copyright (c) 2007-2024 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/* . */

/* .Expression */

/* .HTMLProxy */

/* .createFromRoleTypes */

/* .getEventRoleAttendee */

/* .getEventRoleConfigsOfAttendee */

/* .getFromEvent */

/* .getLists */

/* .getRole */

/* .getRoleTypesKey */

/* .getType */

/* .getTypes */

/* Built-in method references for those with the same name as other `lodash` methods. */

/* Built-in method references that are verified to be native. */

/* Expression */

/* HTMLProxy */

/* Node.js helper references. */

/* USERABORT */

/* ["default"] */

/* ["default"].create */

/* ["default"].generateUID */

/* ["default"].genericFields.concat */

/* ["default"].getCombinedStatus.apply */

/* ["default"].getEventRef */

/* ["default"].locals */

/* ["default"].warn */

/* asset import */

/* binding */

/* createFromEventTypes */

/* createFromRoleTypes */

/* default */

/* default.getEventRef */

/* default.locals */

/* default.setFromJson */

/* existingEventRoleConfig */

/* getEventRoleAttendee */

/* getEventTypeCapableContactsMap */

/* getFromEvent */

/* getLists */

/* getRole */

/* getRoles */

/* harmony default export */

/* harmony export */

/* harmony import */

/* iPadOS pre v13 */

/* import() */

/* import() | Tinebase/js/dompurify */

/* import() | Tinebase/js/email-addresses */

/* import() | Tinebase/js/marked */

/* istanbul ignore else */

/* istanbul ignore file */

/* istanbul ignore if  */

/* istanbul ignore next  */

/* module decorator */

/* opts */

/* private */

/* provided dependency */

/* require.ensure | Tinebase/js/linkify */

/* unused harmony default export */

/* unused harmony export mergeActions */

/* unused harmony exports getCapableContacts, getEventTypeConfigs */

/* { event_types: ...}*/

/*!
 * Ext JS Library 3.1.1
 * Copyright(c) 2006-2010 Ext JS, LLC
 * licensing@extjs.com
 * http://www.extjs.com/license
 */

/*#__PURE__*/

/**
     * <p>Extends one class to create a subclass and optionally overrides members with the passed literal. This method
     * also adds the function "override()" to the subclass that can be used to override members of the class.</p>
     * For example, to create a subclass of Ext GridPanel:
     * <pre><code>
    MyGridPanel = Ext.extend(Ext.grid.GridPanel, {
    constructor: function(config) {
    //      Create configuration for this Grid.
    var store = new Ext.data.Store({...});
    var colModel = new Ext.grid.ColumnModel({...});
    //      Create a new config object containing our computed properties
    //      *plus* whatever was in the config parameter.
    config = Ext.apply({
        store: store,
        colModel: colModel
    }, config);
     MyGridPanel.superclass.constructor.call(this, config);
    //      Your postprocessing here
    },
    yourMethod: function() {
    // etc.
    }
    });
    </code></pre>
     *
     * <p>This function also supports a 3-argument call in which the subclass's constructor is
     * passed as an argument. In this form, the parameters are as follows:</p>
     * <div class="mdetail-params"><ul>
     * <li><code>subclass</code> : Function <div class="sub-desc">The subclass constructor.</div></li>
     * <li><code>superclass</code> : Function <div class="sub-desc">The constructor of class being extended</div></li>
     * <li><code>overrides</code> : Object <div class="sub-desc">A literal with members which are copied into the subclass's
     * prototype, and are therefore shared among all instances of the new class.</div></li>
     * </ul></div>
     *
     * @param {Function} superclass The constructor of class being extended.
     * @param {Object} overrides <p>A literal with members which are copied into the subclass's
     * prototype, and are therefore shared between all instances of the new class.</p>
     * <p>This may contain a special member named <tt><b>constructor</b></tt>. This is used
     * to define the constructor of the new class, and is returned. If this property is
     * <i>not</i> specified, a constructor is generated and returned which just calls the
     * superclass's constructor passing on its parameters.</p>
     * <p><b>It is essential that you call the superclass constructor in any provided constructor. See example code.</b></p>
     * @return {Function} The subclass constructor from the <code>overrides</code> parameter, or a generated one if not provided.
     */

/**
     * <p>Removes this element from the document, removes all DOM event listeners, and deletes the cache reference.
     * All DOM event listeners are removed from this element. If {@link Ext#enableNestedListenerRemoval} is
     * <code>true</code>, then DOM event listeners are also removed from all child nodes. The body node
     * will be ignored if passed in.</p>
     * @param {HTMLElement} node The node to remove
     */

/**
     * <p>Returns true if the passed value is empty.</p>
     * <p>The value is deemed to be empty if it is<div class="mdetail-params"><ul>
     * <li>null</li>
     * <li>undefined</li>
     * <li>an empty array</li>
     * <li>a zero length string (Unless the <tt>allowBlank</tt> parameter is <tt>true</tt>)</li>
     * </ul></div>
     * @param {Mixed} value The value to test
     * @param {Boolean} allowBlank (optional) true to allow empty strings (defaults to false)
     * @return {Boolean}
     */

/**
     * <p>Utility method for returning a default value if the passed value is empty.</p>
     * <p>The value is deemed to be empty if it is<div class="mdetail-params"><ul>
     * <li>null</li>
     * <li>undefined</li>
     * <li>an empty array</li>
     * <li>a zero length string (Unless the <tt>allowBlank</tt> parameter is <tt>true</tt>)</li>
     * </ul></div>
     * @param {Mixed} value The value to test
     * @param {Mixed} defaultValue The value to return if the original value is empty
     * @param {Boolean} allowBlank (optional) true to allow zero length strings to qualify as non-empty (defaults to false)
     * @return {Mixed} value, if non-empty, else defaultValue
     */

/**
     * <p>Zips N sets together.</p>
     * <pre><code>
    // Example 1:
    Ext.zip([1,2,3],[4,5,6]); // [[1,4],[2,5],[3,6]]
    // Example 2:
    Ext.zip(
    [ "+", "-", "+"],
    [  12,  10,  22],
    [  43,  15,  96],
    function(a, b, c){
    return "$" + a + "" + b + "." + c
    }
    ); // ["$+12.43", "$-10.15", "$+22.96"]
     * </code></pre>
     * @param {Arrays|NodeLists} arr This argument may be repeated. Array(s) to contribute values.
     * @param {Function} zipper (optional) The last item in the argument list. This will drive how the items are zipped together.
     * @return {Array} The zipped set.
     */

/**
     * Adds a list of functions to the prototype of an existing class, overwriting any existing methods with the same name.
     * Usage:<pre><code>
    Ext.override(MyClass, {
    newMethod1: function(){
    // etc.
    },
    newMethod2: function(foo){
    // etc.
    }
    });
    </code></pre>
     * @param {Object} origclass The class to override
     * @param {Object} overrides The list of functions to add to origClass.  This should be specified as an object literal
     * containing one or more methods.
     * @method override
     */

/**
     * After any data loads, the raw JSON data is available for further custom processing.  If no data is
     * loaded or there is a load exception this property will be undefined.
     * @type Object
     */

/**
     * Appends content to the query string of a URL, handling logic for whether to place
     * a question mark or ampersand.
     * @param {String} url The URL to append to.
     * @param {String} s The content to append to the URL.
     * @return (String) The resulting URL
     */

/**
     * Applies event listeners to elements by selectors when the document is ready.
     * The event name is specified with an <tt>&#64;</tt> suffix.
     * <pre><code>
    Ext.addBehaviors({
    // add a listener for click on all anchors in element with id foo
    '#foo a&#64;click' : function(e, t){
    // do something
    },
     // add the same listener to multiple selectors (separated by comma BEFORE the &#64;)
    '#foo a, #bar span.some-class&#64;mouseover' : function(){
    // do something
    }
    });
     * </code></pre> 
     * @param {Object} obj The list of behaviors to apply
     */

/**
     * Attempts to destroy and then remove a set of named properties of the passed object.
     * @param {Object} o The object (most likely a Component) who's properties you wish to destroy.
     * @param {Mixed} arg1 The name of the property to destroy and remove from the object.
     * @param {Mixed} etc... More property names to destroy and remove.
     */

/**
     * Attempts to destroy any objects passed to it by removing all event listeners, removing them from the
     * DOM (if applicable) and calling their destroy functions (if available).  This method is primarily
     * intended for arguments of type {@link Ext.Element} and {@link Ext.Component}, but any subclass of
     * {@link Ext.util.Observable} can be passed in.  Any number of elements and/or components can be
     * passed into this function in a single call as separate arguments.
     * @param {Mixed} arg1 An {@link Ext.Element}, {@link Ext.Component}, or an Array of either of these to destroy
     * @param {Mixed} arg2 (optional)
     * @param {Mixed} etc... (optional)
     */

/**
     * By default, Ext intelligently decides whether floating elements should be shimmed. If you are using flash,
     * you may want to set this to true.
     * @type Boolean
     */

/**
     * Calculates the mean of the Array
     * @param {Array} arr The Array to calculate the mean value of.
     * @return {Number} The mean.
     */

/**
     * Calculates the sum of the Array
     * @param {Array} arr The Array to calculate the sum value of.
     * @return {Number} The sum.
     */

/**
     * Converts any iterable (numeric indices and a length property) into a true array
     * Don't use this on strings. IE doesn't support "abc"[0] which this implementation depends on.
     * For strings, use this instead: "abc".match(/./g) => [a,b,c];
     * @param {Iterable} the iterable object to be turned into a true Array.
     * @return (Array) array
     */

/**
     * Copies a set of named properties fom the source object to the destination object.
     * <p>example:<pre><code>
    ImageComponent = Ext.extend(Ext.BoxComponent, {
    initComponent: function() {
    this.autoEl = { tag: 'img' };
    MyComponent.superclass.initComponent.apply(this, arguments);
    this.initialBox = Ext.copyTo({}, this.initialConfig, 'x,y,width,height');
    }
    });
     * </code></pre> 
     * @param {Object} The destination object.
     * @param {Object} The source object.
     * @param {Array/String} Either an Array of property names, or a comma-delimited list
     * of property names to copy.
     * @return {Object} The modified object.
    */

/**
     * Copies all the properties of config to obj if they don't already exist.
     * @param {Object} obj The receiver of the properties
     * @param {Object} config The source of the properties
     * @return {Object} returns obj
     */

/**
     * Creates a copy of the passed Array with falsy values removed.
     * @param {Array/NodeList} arr The Array from which to remove falsy values.
     * @return {Array} The new, compressed Array.
     */

/**
     * Creates a copy of the passed Array, filtered to contain only unique values.
     * @param {Array} arr The Array to filter
     * @return {Array} The new Array containing unique values.
     */

/**
     * Creates namespaces to be used for scoping variables and classes so that they are not global.
     * Specifying the last node of a namespace implicitly creates all other nodes. Usage:
     * <pre><code>
    Ext.namespace('Company', 'Company.data');
    Ext.namespace('Company.data'); // equivalent and preferable to above syntax
    Company.Widget = function() { ... }
    Company.data.CustomStore = function(config) { ... }
    </code></pre>
     * @param {String} namespace1
     * @param {String} namespace2
     * @param {String} etc
     * @return {Object} The namespace object. (If multiple arguments are passed, this will be the last namespace created)
     * @method namespace
     */

/**
     * EXPERIMENTAL - True to cascade listener removal to child elements when an element is removed.
     * Currently not optimized for performance.
     * @type Boolean
     */

/**
     * Escapes the passed string for use in a regular expression
     * @param {String} str
     * @return {String}
     */

/**
     * Generates unique ids. If the element already has an id, it is unchanged
     * @param {Mixed} el (optional) The element to generate an id for
     * @param {String} prefix (optional) Id prefix (defaults "ext-gen")
     * @return {String} The generated Id.
     */

/**
     * Indicates whether to use native browser parsing for JSON methods.
     * This option is ignored if the browser does not support native JSON methods.
     * <b>Note: Native JSON methods will not work with objects that have functions.
     * Also, property names must be quoted, otherwise the data will not parse.</b> (Defaults to false)
     * @type Boolean
     */

/**
     * Invokes a method on each item in an Array.
     * <pre><code>
    // Example:
    Ext.invoke(Ext.query("p"), "getAttribute", "id");
    // [el1.getAttribute("id"), el2.getAttribute("id"), ..., elN.getAttribute("id")]
     * </code></pre>
     * @param {Array|NodeList} arr The Array of items to invoke the method on.
     * @param {String} methodName The method name to invoke.
     * @param {Anything} ... Arguments to send into the method invocation.
     * @return {Array} The results of invoking the method on each item in the array.
     */

/**
     * Iterates an array calling the supplied function.
     * @param {Array/NodeList/Mixed} array The array to be iterated. If this
     * argument is not really an array, the supplied function is called once.
     * @param {Function} fn The function to be called with each item. If the
     * supplied function returns false, iteration stops and this method returns
     * the current <code>index</code>. This function is called with
     * the following arguments:
     * <div class="mdetail-params"><ul>
     * <li><code>item</code> : <i>Mixed</i>
     * <div class="sub-desc">The item at the current <code>index</code>
     * in the passed <code>array</code></div></li>
     * <li><code>index</code> : <i>Number</i>
     * <div class="sub-desc">The current index within the array</div></li>
     * <li><code>allItems</code> : <i>Array</i>
     * <div class="sub-desc">The <code>array</code> passed as the first
     * argument to <code>Ext.each</code>.</div></li>
     * </ul></div>
     * @param {Object} scope The scope (<code>this</code> reference) in which the specified function is executed.
     * Defaults to the <code>item</code> at the current <code>index</code>
     * within the passed <code>array</code>.
     * @return See description for the fn parameter.
     */

/**
     * Iterates either the elements in an array, or each of the properties in an object.
     * <b>Note</b>: If you are only iterating arrays, it is better to call {@link #each}.
     * @param {Object/Array} object The object or array to be iterated
     * @param {Function} fn The function to be called for each iteration.
     * The iteration will stop if the supplied function returns false, or
     * all array elements / object properties have been covered. The signature
     * varies depending on the type of object being interated:
     * <div class="mdetail-params"><ul>
     * <li>Arrays : <tt>(Object item, Number index, Array allItems)</tt>
     * <div class="sub-desc">
     * When iterating an array, the supplied function is called with each item.</div></li>
     * <li>Objects : <tt>(String key, Object value, Object)</tt>
     * <div class="sub-desc">
     * When iterating an object, the supplied function is called with each key-value pair in
     * the object, and the iterated object</div></li>
     * </ul></div>
     * @param {Object} scope The scope (<code>this</code> reference) in which the specified function is executed. Defaults to
     * the <code>object</code> being iterated.
     */

/**
     * Partitions the set into two sets: a true set and a false set.
     * Example: 
     * Example2: 
     * <pre><code>
    // Example 1:
    Ext.partition([true, false, true, true, false]); // [[true, true, true], [false, false]]
    // Example 2:
    Ext.partition(
    Ext.query("p"),
    function(val){
    return val.className == "class1"
    }
    );
    // true are those paragraph elements with a className of "class1",
    // false set are those that do not have that className.
     * </code></pre>
     * @param {Array|NodeList} arr The array to partition
     * @param {Function} truth (optional) a function to determine truth.  If this is omitted the element
     *                   itself must be able to be evaluated for its truthfulness.
     * @return {Array} [true<Array>,false<Array>]
     */

/**
     * Plucks the value of a property from each item in the Array
     * <pre><code>
    // Example:
    Ext.pluck(Ext.query("p"), "className"); // [el1.className, el2.className, ..., elN.className]
     * </code></pre>
     * @param {Array|NodeList} arr The Array of items to pluck the value from.
     * @param {String} prop The property name to pluck from each element.
     * @return {Array} The value from each item in the Array.
     */

/**
     * Recursively flattens into 1-d Array. Injects Arrays inline.
     * @param {Array} arr The array to flatten
     * @return {Array} The new, flattened array.
     */

/**
     * Removes a DOM node from the document.
     */

/**
     * Return the dom node for the passed String (id), dom node, or Ext.Element.
     * Optional 'strict' flag is needed for IE since it can return 'name' and
     * 'id' elements by using getElementById.
     * Here are some examples:
     * <pre><code>
    // gets dom node based on id
    var elDom = Ext.getDom('elId');
    // gets dom node based on the dom node
    var elDom1 = Ext.getDom(elDom);
    // If we don&#39;t know if we are working with an
    // Ext.Element or a dom node use Ext.getDom
    function(el){
    var dom = Ext.getDom(el);
    // do something with the dom node
    }
     * </code></pre>
     * <b>Note</b>: the dom node to be found actually needs to exist (be rendered, etc)
     * when this method is called to be successful.
     * @param {Mixed} el
     * @return HTMLElement
     */

/**
     * Returns the current HTML document object as an {@link Ext.Element}.
     * @return Ext.Element The document
     */

/**
     * Returns the current document body as an {@link Ext.Element}.
     * @return Ext.Element The document body
     */

/**
     * Returns the maximum value in the Array
     * @param {Array|NodeList} arr The Array from which to select the maximum value.
     * @param {Function} comp (optional) a function to perform the comparision which determines maximization.
     *                   If omitted the ">" operator will be used. Note: gt = 1; eq = 0; lt = -1
     * @return {Object} The maximum value in the Array.
     */

/**
     * Returns the minimum value in the Array.
     * @param {Array|NodeList} arr The Array from which to select the minimum value.
     * @param {Function} comp (optional) a function to perform the comparision which determines minimization.
     *                   If omitted the "<" operator will be used. Note: gt = 1; eq = 0; lt = -1
     * @return {Object} The minimum value in the Array.
     */

/**
     * Returns the type of object that is passed in. If the object passed in is null or undefined it
     * return false otherwise it returns one of the following values:<div class="mdetail-params"><ul>
     * <li><b>string</b>: If the object passed is a string</li>
     * <li><b>number</b>: If the object passed is a number</li>
     * <li><b>boolean</b>: If the object passed is a boolean value</li>
     * <li><b>date</b>: If the object passed is a Date object</li>
     * <li><b>function</b>: If the object passed is a function reference</li>
     * <li><b>object</b>: If the object passed is an object</li>
     * <li><b>array</b>: If the object passed is an array</li>
     * <li><b>regexp</b>: If the object passed is a regular expression</li>
     * <li><b>element</b>: If the object passed is a DOM Element</li>
     * <li><b>nodelist</b>: If the object passed is a DOM NodeList</li>
     * <li><b>textnode</b>: If the object passed is a DOM text node and contains something other than whitespace</li>
     * <li><b>whitespace</b>: If the object passed is a DOM text node and contains only whitespace</li>
     * </ul></div>
     * @param {Mixed} object
     * @return {String}
     */

/**
     * Returns true if the passed object is a JavaScript date object, otherwise false.
     * @param {Object} object The object to test
     * @return {Boolean}
     */

/**
     * Returns true if the passed value is a JavaScript 'primitive', a string, number or boolean.
     * @param {Mixed} value The value to test
     * @return {Boolean}
     */

/**
     * Returns true if the passed value is a JavaScript Function, otherwise false.
     * @param {Mixed} value The value to test
     * @return {Boolean}
     */

/**
     * Returns true if the passed value is a JavaScript Object, otherwise false.
     * @param {Mixed} value The value to test
     * @return {Boolean}
     */

/**
     * Returns true if the passed value is a JavaScript array, otherwise false.
     * @param {Mixed} value The value to test
     * @return {Boolean}
     */

/**
     * Returns true if the passed value is a boolean.
     * @param {Mixed} value The value to test
     * @return {Boolean}
     */

/**
     * Returns true if the passed value is a number. Returns false for non-finite numbers.
     * @param {Mixed} value The value to test
     * @return {Boolean}
     */

/**
     * Returns true if the passed value is a string.
     * @param {Mixed} value The value to test
     * @return {Boolean}
     */

/**
     * Returns true if the passed value is an HTMLElement
     * @param {Mixed} value The value to test
     * @return {Boolean}
     */

/**
     * Returns true if the passed value is not undefined.
     * @param {Mixed} value The value to test
     * @return {Boolean}
     */

/**
     * Takes an encoded URL and and converts it to an object. Example: <pre><code>
    Ext.urlDecode("foo=1&bar=2"); // returns {foo: "1", bar: "2"}
    Ext.urlDecode("foo=1&bar=2&bar=3&bar=4", false); // returns {foo: "1", bar: ["2", "3", "4"]}
    </code></pre>
     * @param {String} string
     * @param {Boolean} overwrite (optional) Items of the same name will overwrite previous values instead of creating an an array (Defaults to false).
     * @return {Object} A literal with members
     */

/**
     * Takes an object and converts it to an encoded URL. e.g. Ext.urlEncode({foo: 1, bar: 2}); would return "foo=1&bar=2".  Optionally, property values can be arrays, instead of keys and the resulting string that's returned will contain a name/value pair for each array value.
     * @param {Object} o
     * @param {String} pre (optional) A prefix to add to the url encoded string
     * @return {String}
     */

/**
     * The {@link Ext.data.Store} to which this Record belongs.
     * @property store
     * @type {Ext.data.Store}
     */

/**
     * This is shorthand reference to {@link Ext.ComponentMgr#get}.
     * Looks up an existing {@link Ext.Component Component} by {@link Ext.Component#id id}
     * @param {String} id The component {@link Ext.Component#id id}
     * @return Ext.Component The Component, <tt>undefined</tt> if not found, or <tt>null</tt> if a
     * Class was found.
    */

/**
     * True if the browser is in strict (standards-compliant) mode, as opposed to quirks mode
     * @type Boolean
     */

/**
     * True if the detected browser is Chrome.
     * @type Boolean
     */

/**
     * True if the detected browser is Internet Explorer 6.x.
     * @type Boolean
     */

/**
     * True if the detected browser is Internet Explorer 7.x.
     * @type Boolean
     */

/**
     * True if the detected browser is Internet Explorer 8.x.
     * @type Boolean
     */

/**
     * True if the detected browser is Internet Explorer running in non-strict mode.
     * @type Boolean
     */

/**
     * True if the detected browser is Internet Explorer.
     * @type Boolean
     */

/**
     * True if the detected browser is Opera.
     * @type Boolean
     */

/**
     * True if the detected browser is Safari 2.x.
     * @type Boolean
     */

/**
     * True if the detected browser is Safari 3.x.
     * @type Boolean
     */

/**
     * True if the detected browser is Safari 4.x.
     * @type Boolean
     */

/**
     * True if the detected browser is Safari.
     * @type Boolean
     */

/**
     * True if the detected browser uses WebKit.
     * @type Boolean
     */

/**
     * True if the detected browser uses a Gecko 1.9+ layout engine (e.g. Firefox 3.x).
     * @type Boolean
     */

/**
     * True if the detected browser uses a pre-Gecko 1.9 layout engine (e.g. Firefox 2.x).
     * @type Boolean
     */

/**
     * True if the detected browser uses the Gecko layout engine (e.g. Mozilla, Firefox).
     * @type Boolean
     */

/**
     * True if the detected platform is Adobe Air.
     * @type Boolean
     */

/**
     * True if the detected platform is Linux.
     * @type Boolean
     */

/**
     * True if the detected platform is Mac OS.
     * @type Boolean
     */

/**
     * True if the detected platform is Windows.
     * @type Boolean
     */

/**
     * True if the page is running over SSL
     * @type Boolean
     */

/**
     * True if the {@link Ext.Fx} Class is available
     * @type Boolean
     * @property enableFx
     */

/**
     * True to automatically purge event listeners during garbageCollection (defaults to false).
     * @type Boolean
     */

/**
     * True to automatically uncache orphaned Ext.Elements periodically (defaults to true)
     * @type Boolean
     */

/**
     * True when the document is fully initialized and ready for action
     * @type Boolean
     */

/**
     * URL to a 1x1 transparent gif image used by Ext to create inline icons with CSS background images. 
     * In older versions of IE, this defaults to "http://extjs.com/s.gif" and you should change this to a URL on your server.
     * For other browsers it uses an inline data URL.
     * @type String
     */

/**
     * URL to a blank file used by Ext when in secure mode for iframe src and onReady src to prevent
     * the IE insecure content warning (<tt>'about:blank'</tt>, except for IE in secure mode, which is <tt>'javascript:""'</tt>).
     * @type String
     */

/**
     * Utility method for getting the width of the browser scrollbar. This can differ depending on
     * operating system settings, such as the theme or font size.
     * @param {Boolean} force (optional) true to force a recalculation of the value.
     * @return {Number} The width of the scrollbar.
     */

/**
     * Utility method for validating that a value is numeric, returning the specified default value if it is not.
     * @param {Mixed} value Should be a number, but any type will be handled appropriately
     * @param {Number} defaultValue The value to return if the original value is non-numeric
     * @return {Number} Value, if numeric, else defaultValue
     */

/**
    * A reusable empty function
    * @property
    * @type Function
    */

/**
    * MixedCollection has a generic way to fetch keys if you implement getKey.  The default implementation
    * simply returns <b><code>item.id</code></b> but you can provide your own implementation
    * to return a different value as in the following examples:<pre><code>
  // normal way
  var mc = new Ext.util.MixedCollection();
  mc.add(someEl.dom.id, someEl);
  mc.add(otherEl.dom.id, otherEl);
  //and so on
  // using getKey
  var mc = new Ext.util.MixedCollection();
  mc.getKey = function(el){
  return el.dom.id;
  };
  mc.add(someEl);
  mc.add(otherEl);
  // or via the constructor
  var mc = new Ext.util.MixedCollection(false, function(el){
  return el.dom.id;
  });
  mc.add(someEl);
  mc.add(otherEl);
   * </code></pre>
   * @param {Object} item The item for which to find the key.
   * @return {Object} The key for the passed item.
   */

/**
   *
   * @param {Collection} members
   */

/**
   *
   * @param {String} part
   */

/**
   * <p><b>Only present if this Record was created by an {@link Ext.data.ArrayReader ArrayReader} or a {@link Ext.data.JsonReader JsonReader}</b>.</p>
   * <p>The Array or object which was the source of the data for this Record.</p>
   * @property json
   * @type {Array|Object}
   */

/**
   * <p><b>Only present if this Record was created by an {@link Ext.data.XmlReader XmlReader}</b>.</p>
   * <p>The XML element which was the source of the data for this Record.</p>
   * @property node
   * @type {XMLElement}
   */

/**
   * <p><b>This property is stored in the Record definition's <u>prototype</u></b></p>
   * A MixedCollection containing the defined {@link Ext.data.Field Field}s for this Record.  Read-only.
   * @property fields
   * @type Ext.util.MixedCollection
   */

/**
   * <p>Fires the specified event with the passed parameters (minus the event name).</p>
   * <p>An event may be set to bubble up an Observable parent hierarchy (See {@link Ext.Component#getBubbleTarget})
   * by calling {@link #enableBubble}.</p>
   * @param {String} eventName The name of the event to fire.
   * @param {Object...} args Variable number of parameters are passed to handlers.
   * @return {Boolean} returns false if any of the handlers return false otherwise it returns true.
   */

/**
   * <p>Marks this <b>Record</b> as <code>{@link #dirty}</code>.  This method
   * is used interally when adding <code>{@link #phantom}</code> records to a
   * {@link Ext.data.Store#writer writer enabled store}.</p>
   * <br><p>Marking a record <code>{@link #dirty}</code> causes the phantom to
   * be returned by {@link Ext.data.Store#getModifiedRecords} where it will
   * have a create action composed for it during {@link Ext.data.Store#save store save}
   * operations.</p>
   */

/**
   * <tt>true</tt> when the record does not yet exist in a server-side database (see
   * {@link #markDirty}).  Any record which has a real database pk set as its id property
   * is NOT a phantom -- it's real.
   * @property phantom
   * @type {Boolean}
   */

/**
   * @cfg {Array/Object} data
   */

/**
   * @cfg {Array/Object} fields
   * <p>Either an Array of {@link Ext.data.Field Field} definition objects (which
   * will be passed to {@link Ext.data.Record#create}, or a {@link Ext.data.Record Record}
   * constructor created from {@link Ext.data.Record#create}.</p>
   */

/**
   * @cfg {Array} filters
   */

/**
   * @cfg {Boolean} allowBlank
   * (Optional) Used for validating a {@link Ext.data.Record record}, defaults to <tt>true</tt>.
   * An empty value here will cause {@link Ext.data.Record}.{@link Ext.data.Record#isValid isValid}
   * to evaluate to <tt>false</tt>.
   */

/**
   * @cfg {Boolean} allowFunctions Specify <tt>true</tt> if the {@link #addAll}
   * function should add function references to the collection. Defaults to
   * <tt>false</tt>.
   */

/**
   * @cfg {Boolean} success
   */

/**
   * @cfg {Ext.data.Record/Ext.data.Record[]} records related to the Request action
   */

/**
   * @cfg {Function} convert
   * (Optional) A function which converts the value provided by the Reader into an object that will be stored
   * in the Record. It is passed the following parameters:<div class="mdetail-params"><ul>
   * <li><b>v</b> : Mixed<div class="sub-desc">The data value as read by the Reader, if undefined will use
   * the configured <tt>{@link Ext.data.Field#defaultValue defaultValue}</tt>.</div></li>
   * <li><b>rec</b> : Mixed<div class="sub-desc">The data object containing the row as read by the Reader.
   * Depending on the Reader type, this could be an Array ({@link Ext.data.ArrayReader ArrayReader}), an object
   *  ({@link Ext.data.JsonReader JsonReader}), or an XML element ({@link Ext.data.XMLReader XMLReader}).</div></li>
   * </ul></div>
   * <pre><code>
  // example of convert function
  function fullName(v, record){
  return record.name.last + ', ' + record.name.first;
  }
  function location(v, record){
  return !record.city ? '' : (record.city + ', ' + record.state);
  }
  var Dude = Ext.data.Record.create([
  {name: 'fullname',  convert: fullName},
  {name: 'firstname', mapping: 'name.first'},
  {name: 'lastname',  mapping: 'name.last'},
  {name: 'city', defaultValue: 'homeless'},
  'state',
  {name: 'location',  convert: location}
  ]);
  // create the data store
  var store = new Ext.data.Store({
  reader: new Ext.data.JsonReader(
      {
          idProperty: 'key',
          root: 'daRoot',
          totalProperty: 'total'
      },
      Dude  // recordType
  )
  });
  var myData = [
  { key: 1,
    name: { first: 'Fat',    last:  'Albert' }
    // notice no city, state provided in data object
  },
  { key: 2,
    name: { first: 'Barney', last:  'Rubble' },
    city: 'Bedrock', state: 'Stoneridge'
  },
  { key: 3,
    name: { first: 'Cliff',  last:  'Claven' },
    city: 'Boston',  state: 'MA'
  }
  ];
   * </code></pre>
   */

/**
   * @cfg {Function} sortType
   * (Optional) A function which converts a Field's value to a comparable value in order to ensure
   * correct sort ordering. Predefined functions are provided in {@link Ext.data.SortTypes}. A custom
   * sort example:<pre><code>
  // current sort     after sort we want
  // +-+------+          +-+------+
  // |1|First |          |1|First |
  // |2|Last  |          |3|Second|
  // |3|Second|          |2|Last  |
  // +-+------+          +-+------+
  sortType: function(value) {
  switch (value.toLowerCase()) // native toLowerCase():
  {
    case 'first': return 1;
    case 'second': return 2;
    default: return 3;
  }
  }
   * </code></pre>
   */

/**
   * @cfg {Mixed} defaultValue
   * (Optional) The default value used <b>when a Record is being created by a {@link Ext.data.Reader Reader}</b>
   * when the item referenced by the <tt>{@link Ext.data.Field#mapping mapping}</tt> does not exist in the data
   * object (i.e. undefined). (defaults to "")
   */

/**
   * @cfg {Object} listeners (optional) <p>A config object containing one or more event handlers to be added to this
   * object during initialization.  This should be a valid listeners config object as specified in the
   * {@link #addListener} example for attaching multiple handlers at once.</p>
   * <br><p><b><u>DOM events from ExtJs {@link Ext.Component Components}</u></b></p>
   * <br><p>While <i>some</i> ExtJs Component classes export selected DOM events (e.g. "click", "mouseover" etc), this
   * is usually only done when extra value can be added. For example the {@link Ext.DataView DataView}'s
   * <b><code>{@link Ext.DataView#click click}</code></b> event passing the node clicked on. To access DOM
   * events directly from a Component's HTMLElement, listeners must be added to the <i>{@link Ext.Component#getEl Element}</i> after the Component
   * has been rendered. A plugin can simplify this step:<pre><code>
  // Plugin is configured with a listeners config object.
  // The Component is appended to the argument list of all handler functions.
  Ext.DomObserver = Ext.extend(Object, {
  constructor: function(config) {
      this.listeners = config.listeners ? config.listeners : config;
  },
   // Component passes itself into plugin&#39;s init method
  init: function(c) {
      var p, l = this.listeners;
      for (p in l) {
          if (Ext.isFunction(l[p])) {
              l[p] = this.createHandler(l[p], c);
          } else {
              l[p].fn = this.createHandler(l[p].fn, c);
          }
      }
       // Add the listeners to the Element immediately following the render call
      c.render = c.render.{@link Function#createSequence createSequence}(function() {
          var e = c.getEl();
          if (e) {
              e.on(l);
          }
      });
  },
   createHandler: function(fn, c) {
      return function(e) {
          fn.call(this, e, c);
      };
  }
  });
  var combo = new Ext.form.ComboBox({
   // Collapse combo when its element is clicked on
  plugins: [ new Ext.DomObserver({
      click: function(evt, comp) {
          comp.collapse();
      }
  })],
  store: myStore,
  typeAhead: true,
  mode: 'local',
  triggerAction: 'all'
  });
   * </code></pre></p>
   */

/**
   * @cfg {Object} raw The raw response returned from server-code
   */

/**
   * @cfg {String/Number} mapping
   * <p>(Optional) A path expression for use by the {@link Ext.data.DataReader} implementation
   * that is creating the {@link Ext.data.Record Record} to extract the Field value from the data object.
   * If the path expression is the same as the field name, the mapping may be omitted.</p>
   * <p>The form of the mapping expression depends on the Reader being used.</p>
   * <div class="mdetail-params"><ul>
   * <li>{@link Ext.data.JsonReader}<div class="sub-desc">The mapping is a string containing the javascript
   * expression to reference the data from an element of the data item's {@link Ext.data.JsonReader#root root} Array. Defaults to the field name.</div></li>
   * <li>{@link Ext.data.XmlReader}<div class="sub-desc">The mapping is an {@link Ext.DomQuery} path to the data
   * item relative to the DOM element that represents the {@link Ext.data.XmlReader#record record}. Defaults to the field name.</div></li>
   * <li>{@link Ext.data.ArrayReader}<div class="sub-desc">The mapping is a number indicating the Array index
   * of the field's value. Defaults to the field specification's Array position.</div></li>
   * </ul></div>
   * <p>If a more complex value extraction strategy is required, then configure the Field with a {@link #convert}
   * function. This is passed the whole row object, and may interrogate it in whatever way is necessary in order to
   * return the desired data.</p>
   */

/**
   * @cfg {String|Function} group
   */

/**
   * @cfg {String} action {@link Ext.data.Api#actions}
   */

/**
   * @cfg {String} appName
   * internal/untranslated app name (required)
   */

/**
   * @cfg {String} containerName
   * untranslated container name
   */

/**
   * @cfg {String} containerProperty
   * name of the container property
   */

/**
   * @cfg {String} dateFormat
   * (Optional) A format string for the {@link Date#parseDate parseDate} function, or "timestamp" if the
   * value provided by the Reader is a UNIX timestamp, or "time" if the value provided by the Reader is a
   * javascript millisecond timestamp.
   */

/**
   * @cfg {String} grantsPath
   * path (see _.get() to find grants
   */

/**
   * @cfg {String} idProperty
   * property of the id of the record
   */

/**
   * @cfg {String} idProperty [id] Name of the property within a row object
   * that contains a record identifier value.  Defaults to <tt>id</tt>
   */

/**
   * @cfg {String} message
   */

/**
   * @cfg {String} messageProperty [undefined] Optional name of a property within a server-response that represents a user-feedback message.
   */

/**
   * @cfg {String} modelName
   * name of the model/record  (required)
   */

/**
   * @cfg {String} name
   * The name by which the field is referenced within the Record. This is referenced by, for example,
   * the <tt>dataIndex</tt> property in column definition objects passed to {@link Ext.grid.ColumnModel}.
   * <p>Note: In the simplest case, if no properties other than <tt>name</tt> are required, a field
   * definition may consist of just a String for the field name.</p>
   */

/**
   * @cfg {String} recordName
   * untranslated record/item name
   */

/**
   * @cfg {String} recordName
   * untranslated records/items (plural) name
   */

/**
   * @cfg {String} root [undefined] <b>Required</b>.  The name of the property
   * which contains the Array of row objects.  Defaults to <tt>undefined</tt>.
   * An exception will be thrown if the root property is undefined. The data
   * packet value for this property should be an empty array to clear the data
   * or show no data.
   */

/**
   * @cfg {String} sortDir
   * (Optional) Initial direction to sort (<tt>"ASC"</tt> or  <tt>"DESC"</tt>).  Defaults to
   * <tt>"ASC"</tt>.
   */

/**
   * @cfg {String} successProperty [success] Name of the property from which to
   * retrieve the success attribute. Defaults to <tt>success</tt>.  See
   * {@link Ext.data.DataProxy}.{@link Ext.data.DataProxy#exception exception}
   * for additional information.
   */

/**
   * @cfg {String} titleProperty
   * property of the title attibute, used in generic getTitle function  (required)
   */

/**
   * @cfg {String} totalProperty [total] Name of the property from which to
   * retrieve the total number of records in the dataset. This is only needed
   * if the whole dataset is not passed in one go, but is being paged from
   * the remote server.  Defaults to <tt>total</tt>.
   */

/**
   * @cfg {String} type
   * (Optional) The data type for conversion to displayable value if <tt>{@link Ext.data.Field#convert convert}</tt>
   * has not been specified. Possible values are
   * <div class="mdetail-params"><ul>
   * <li>auto (Default, implies no conversion)</li>
   * <li>string</li>
   * <li>int</li>
   * <li>float</li>
   * <li>boolean</li>
   * <li>date</li></ul></div>
   */

/**
   * @cfg {Tine.CrewScheduling.EventMembersGrid} membersGrid
   */

/**
   * @cfg {Tine.Tinebase.data.RecordStore} csMembersStore
   */

/**
   * @cfg {Tine.Tinebase.data.RecordStore} csRolesStore
   */

/**
   * @cfg {string} containerName
   * untranslated name of container (plural)
   */

/**
   * @cfg: {bool} copyNoAppendTitle
   * don't append "(copy)" string to title when record is copied
   */

/**
   * @event add
   * Fires when an item is added to the collection.
   * @param {Number} index The index at which the item was added.
   * @param {Object} o The item added.
   * @param {String} key The key associated with the added item.
   */

/**
   * @event clear
   * Fires when the collection is cleared.
   */

/**
   * @event remove
   * Fires when an item is removed from the collection.
   * @param {Object} o The item being removed.
   * @param {String} key (optional) The key associated with the removed item.
   */

/**
   * @event replace
   * Fires when an item is replaced in the collection.
   * @param {String} key he key associated with the new added.
   * @param {Object} old The item being replaced.
   * @param {Object} new The new item.
   */

/**
   * @ignore
   * TODO This isn't used anywhere??  Don't we want to use this where possible instead of complex #createAccessor?
   */

/**
   * @ignore
   */

/**
   * @param key
   * @param {Object} o The item to add.
   * @param suppressEvent
   */

/**
   * @private
   * @param {String} property Property to sort by ('key', 'value', or 'index')
   * @param {String} dir (optional) Direction to sort 'ASC' or 'DESC'. Defaults to 'ASC'.
   * @param {Function} fn (optional) Comparison function that defines the sort order.
   * Defaults to sorting by numeric value.
   */

/**
   * @property {Array} filterCells
   */

/**
   * @property {Array} selectedTokens
   */

/**
   * @property {AttendeeValidation}
   */

/**
   * @property {Ext.Button} buttonApply
   */

/**
   * @property {Ext.Button} buttonCancel
   */

/**
   * @property {Ext.DataView} dataView
   */

/**
   * @property {Ext.ux.form.PeriodPicker} periodPicker
   */

/**
   * @property {Function} debouncedUpdateMemberCounts
   */

/**
   * @property {String[]} rolesVisible (stateful)
   */

/**
   * @property {Tine.CrewScheduling.EventMembersGrid} membersGrid
   */

/**
   * @property {Tine.CrewScheduling.MemberSelectionPanel} memberSelectionPanel
   */

/**
   * @property {Tine.CrewScheduling.MemberToken} memberToken
   */

/**
   * @property {Tine.Tinebase.Application} app
   */

/**
   * @property {Tine.Tinebase.data.RecordStore} csGroupsStore
   */

/**
   * @property {Tine.Tinebase.data.RecordStore} csMembersStore
   */

/**
   * @property {Tine.Tinebase.data.RecordStore} csPollsStore
   */

/**
   * @property {Tine.Tinebase.data.RecordStore} csPositionsStore
   */

/**
   * @property {Tine.Tinebase.data.RecordStore} csRolesStore
   */

/**
   * @property {Tine.Tinebase.data.RecordStore} eventStore
   */

/**
   * Abstract method created in extension's buildExtractors impl.
   */

/**
   * Abstract method overridden in DataReader extensions such as {@link Ext.data.JsonReader} and {@link Ext.data.XmlReader}
   */

/**
   * Abstract method, overridden in DataReader extensions such as {@link Ext.data.JsonReader} and {@link Ext.data.XmlReader}
   */

/**
   * Adds all elements of an Array or an Object to the collection.
   * @param {Object/Array} objs An Object containing properties which will be added
   * to the collection, or an Array of values, each of which are added to the collection.
   * Functions references will be added to the collection if <code>{@link #allowFunctions}</code>
   * has been set to <tt>true</tt>.
   * @param suppressEvent
   */

/**
   * Adds an item to the collection. Fires the {@link #add} event when complete.
   * @param {String} key <p>The key to associate with the item, or the new item.</p>
   * <p>If a {@link #getKey} implementation was specified for this MixedCollection,
   * or if the key of the stored items is in a property called <tt><b>id</b></tt>,
   * the MixedCollection will be able to <i>derive</i> the key for the new item.
   * In this case just pass the new item in this parameter.</p>
   * @param {Object} o The item to add.
   * @param suppressEvent
   * @return {Object} The item added.
   */

/**
   * Adds the specified events to the list of events which this Observable may fire.
   * @param {Object|String} o Either an object with event names as properties with a value of <code>true</code>
   * or the first event name string if multiple event names are being passed as separate parameters.
   * @param {string} Optional. Event name if multiple event names are being passed as separate parameters.
   * Usage:<pre><code>
  this.addEvents('storeloaded', 'storecleared');
  </code></pre>
   */

/**
   * Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens.  Each
   * token must be unique, and must increment in the format {0}, {1}, etc.  Example usage:
   * <pre><code>
  var cls = 'my-class', text = 'Some text';
  var s = String.format('&lt;div class="{0}">{1}&lt;/div>', cls, text);
  // s now contains the string: '&lt;div class="my-class">Some text&lt;/div>'
   * </code></pre>
   * @param {String} string The tokenized string to be formatted
   * @param {String} value1 The value to replace token {0}
   * @param {String} value2 Etc...
   * @return {String} The formatted string
   * @static
   */

/**
   * An object hash representing the data for this Record. Every field name in the Record definition
   * is represented by a property of that name in this object. Note that unless you specified a field
   * with {@link Ext.data.Field#name name} "id" in the Record definition, this will <b>not</b> contain
   * an <tt>id</tt> property.
   * @property data
   * @type {Object}
   */

/**
   * Appends an event handler to this object.
   * @param {String}   eventName The name of the event to listen for.
   * @param {Function} handler The method the event invokes.
   * @param {Object}   scope (optional) The scope (<code><b>this</b></code> reference) in which the handler function is executed.
   * <b>If omitted, defaults to the object which fired the event.</b>
   * @param {Object}   options (optional) An object containing handler configuration.
   * properties. This may contain any of the following properties:<ul>
   * <li><b>scope</b> : Object<div class="sub-desc">The scope (<code><b>this</b></code> reference) in which the handler function is executed.
   * <b>If omitted, defaults to the object which fired the event.</b></div></li>
   * <li><b>delay</b> : Number<div class="sub-desc">The number of milliseconds to delay the invocation of the handler after the event fires.</div></li>
   * <li><b>single</b> : Boolean<div class="sub-desc">True to add a handler to handle just the next firing of the event, and then remove itself.</div></li>
   * <li><b>buffer</b> : Number<div class="sub-desc">Causes the handler to be scheduled to run in an {@link Ext.util.DelayedTask} delayed
   * by the specified number of milliseconds. If the event fires again within that time, the original
   * handler is <em>not</em> invoked, but the new handler is scheduled in its place.</div></li>
   * <li><b>target</b> : Observable<div class="sub-desc">Only call the handler if the event was fired on the target Observable, <i>not</i>
   * if the event was bubbled up from a child Observable.</div></li>
   * </ul><br>
   * <p>
   * <b>Combining Options</b><br>
   * Using the options argument, it is possible to combine different types of listeners:<br>
   * <br>
   * A delayed, one-time listener.
   * <pre><code>
  myDataView.on('click', this.onClick, this, {
  single: true,
  delay: 100
  });</code></pre>
   * <p>
   * <b>Attaching multiple handlers in 1 call</b><br>
   * The method also allows for a single argument to be passed which is a config object containing properties
   * which specify multiple handlers.
   * <p>
   * <pre><code>
  myGridPanel.on({
  'click' : {
  fn: this.onClick,
  scope: this,
  delay: 100
  },
  'mouseover' : {
  fn: this.onMouseOver,
  scope: this
  },
  'mouseout' : {
  fn: this.onMouseOut,
  scope: this
  }
  });</code></pre>
  * <p>
  * Or a shorthand syntax:<br>
  * <pre><code>
  myGridPanel.on({
  'click' : this.onClick,
  'mouseover' : this.onMouseOver,
  'mouseout' : this.onMouseOut,
  scope: this
  });</code></pre>
   */

/**
   * Begin an edit. While in edit mode, no events (e.g.. the <code>update</code> event)
   * are relayed to the containing store.
   * See also: <code>{@link #endEdit}</code> and <code>{@link #cancelEdit}</code>.
   */

/**
   * By default returns <tt>false</tt> if any {@link Ext.data.Field field} within the
   * record configured with <tt>{@link Ext.data.Field#allowBlank} = false</tt> returns
   * <tt>true</tt> from an {@link Ext}.{@link Ext#isEmpty isempty} test.
   * @return {Boolean}
   */

/**
   * Calls this function after the number of millseconds specified, optionally in a specific scope. Example usage:
   * <pre><code>
  var sayHi = function(name){
  alert('Hi, ' + name);
  }
  // executes immediately:
  sayHi('Fred');
  // executes after 2 seconds:
  sayHi.defer(2000, this, ['Fred']);
  // this syntax is sometimes useful for deferring
  // execution of an anonymous function:
  (function(){
  alert('Anonymous');
  }).defer(100);
  </code></pre>
   * @param {Number} millis The number of milliseconds for the setTimeout call (if less than or equal to 0 the function is executed immediately)
   * @param {Object} scope (optional) The scope (<code><b>this</b></code> reference) in which the function is executed.
   * <b>If omitted, defaults to the browser window.</b>
   * @param {Array} args (optional) Overrides arguments for the call. (Defaults to the arguments passed by the caller)
   * @param {Boolean/Number} appendArgs (optional) if True args are appended to call args instead of overriding,
   * if a number the args are inserted at the specified position
   * @return {Number} The timeout id that can be used with clearTimeout
   */

/**
   * Cancel the last queued timeout
   */

/**
   * Cancels all changes made in the current edit operation.
   */

/**
   * Cancels any pending timeout and queues a new one
   * @param {Number} delay The milliseconds to delay
   * @param {Function} newFn (optional) Overrides function passed to constructor
   * @param {Object} newScope (optional) Overrides scope passed to constructor. Remember that if no scope
   * is specified, <code>this</code> will refer to the browser window.
   * @param {Array} newArgs (optional) Overrides args passed to constructor
   */

/**
   * Case insensitive string
   * @param {Mixed} s The value being converted
   * @return {String} The comparison value
   */

/**
   * Checks to see if this object has any listeners for a specified event
   * @param {String} eventName The name of the event to check for
   * @return {Boolean} True if the event is being listened for, else false
   */

/**
   * Checks whether or not the current number is within a desired range.  If the number is already within the
   * range it is returned, otherwise the min or max value is returned depending on which side of the range is
   * exceeded.  Note that this method returns the constrained value but does not change the current number.
   * @param {Number} min The minimum number in the range
   * @param {Number} max The maximum number in the range
   * @return {Number} The constrained value if outside the range, otherwise the current value
   */

/**
   * Checks whether or not the specified object exists in the array.
   * @param {Object} o The object to check for
   * @param {Number} from (Optional) The index at which to begin the search
   * @return {Number} The index of o in the array (or -1 if it is not found)
   */

/**
   * Confirm application restart
   *
   * @param Boolean closewindow
   */

/**
   * Create a combined function call sequence of the original function + the passed function.
   * The resulting function returns the results of the original function.
   * The passed fcn is called with the parameters of the original function. Example usage:
   * <pre><code>
  var sayHi = function(name){
  alert('Hi, ' + name);
  }
  sayHi('Fred'); // alerts "Hi, Fred"
  var sayGoodbye = sayHi.createSequence(function(name){
  alert('Bye, ' + name);
  });
  sayGoodbye('Fred'); // both alerts show
  </code></pre>
   * @param {Function} fcn The function to sequence
   * @param {Object} scope (optional) The scope (<code><b>this</b></code> reference) in which the passed function is executed.
   * <b>If omitted, defaults to the scope in which the original function is called or the browser window.</b>
   * @return {Function} The new function
   */

/**
   * Create a data block containing Ext.data.Records from a JSON object.
   * @param {Object} o An object which contains an Array of row objects in the property specified
   * in the config as 'root, and optionally a property, specified in the config as 'totalProperty'
   * which contains the total size of the dataset.
   * @return {Object} data A data block which is used by an Ext.data.Store object as
   * a cache of Ext.data.Records.
   */

/**
   * Creates a copy (clone) of this Record.
   * @param {String} id (optional) A new Record id, defaults to the id
   * of the record being copied. See {@link #id}.
   * To generate a phantom record with a new id use:
   var rec = record.copy(); // clone the record
   Ext.data.Record.id(rec); // automatically generate a unique sequential id
   *
   * @return {Record}
   */

/**
   * Creates a delegate (callback) that sets the scope to obj.
   * Call directly on any function. Example: <code>this.myFunction.createDelegate(this, [arg1, arg2])</code>
   * Will create a function that is automatically scoped to obj so that the <tt>this</tt> variable inside the
   * callback points to obj. Example usage:
   * <pre><code>
  var sayHi = function(name){
  // Note this use of "this.text" here.  This function expects to
  // execute within a scope that contains a text property.  In this
  // example, the "this" variable is pointing to the btn object that
  // was passed in createDelegate below.
  alert('Hi, ' + name + '. You clicked the "' + this.text + '" button.');
  }
  var btn = new Ext.Button({
  text: 'Say Hi',
  renderTo: Ext.getBody()
  });
  // This callback will execute in the scope of the
  // button instance. Clicking the button alerts
  // "Hi, Fred. You clicked the "Say Hi" button."
  btn.on('click', sayHi.createDelegate(btn, ['Fred']));
  </code></pre>
   * @param {Object} scope (optional) The scope (<code><b>this</b></code> reference) in which the function is executed.
   * <b>If omitted, defaults to the browser window.</b>
   * @param {Array} args (optional) Overrides arguments for the call. (Defaults to the arguments passed by the caller)
   * @param {Boolean/Number} appendArgs (optional) if True args are appended to call args instead of overriding,
   * if a number the args are inserted at the specified position
   * @return {Function} The new function
   */

/**
   * Creates a shallow copy of this collection
   * @return {MixedCollection}
   */

/**
   * Creates namespaces to be used for scoping variables and classes so that they are not global.
   * Specifying the last node of a namespace implicitly creates all other nodes. Usage:
   * <pre><code>
  Ext.namespace('Company', 'Company.data');
  Ext.namespace('Company.data'); // equivalent and preferable to above syntax
  Company.Widget = function() { ... }
  Company.data.CustomStore = function(config) { ... }
  </code></pre>
   * @param {String} namespace1
   * @param {String} namespace2
   * @param {String} etc
   * @return {Object} The namespace object. (If multiple arguments are passed, this will be the last namespace created)
   * @method ns
   */

/**
   * Date sorting
   * @param {Mixed} s The value being converted
   * @return {Number} The comparison value
   */

/**
   * Decode a json response from server.
   * @param {String} action [Ext.data.Api.actions.create|read|update|destroy]
   * @param {Object} response
   * TODO: refactor code between JsonReader#readRecords, #readResponse into 1 method.
   * there's ugly duplication going on due to maintaining backwards compat. with 2.0.  It's time to do this.
   */

/**
   * Default sort that does nothing
   * @param {Mixed} s The value being converted
   * @return {Mixed} The comparison value
   */

/**
   * End an edit. If any data was modified, the containing store is notified
   * (ie, the store's <code>update</code> event will fire).
   */

/**
   * Escapes the passed string for ' and \
   * @param {String} string The string to escape
   * @return {String} The escaped string
   * @static
   */

/**
   * Executes the specified function once for every item in the collection, passing the following arguments:
   * <div class="mdetail-params"><ul>
   * <li><b>item</b> : Mixed<p class="sub-desc">The collection item</p></li>
   * <li><b>index</b> : Number<p class="sub-desc">The item's index</p></li>
   * <li><b>length</b> : Number<p class="sub-desc">The total number of items in the collection</p></li>
   * </ul></div>
   * The function should return a boolean value. Returning false from the function will stop the iteration.
   * @param {Function} fn The function to execute for each item.
   * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the function is executed. Defaults to the current item in the iteration.
   */

/**
   * Executes the specified function once for every key in the collection, passing each
   * key, and its associated item as the first two parameters.
   * @param {Function} fn The function to execute for each item.
   * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the function is executed. Defaults to the browser window.
   */

/**
   * Filter by a function. Returns a <i>new</i> collection that has been filtered.
   * The passed function will be called with each object in the collection.
   * If the function returns true, the value is included otherwise it is filtered.
   * @param {Function} fn The function to be called, it will receive the args o (the object), k (the key)
   * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the function is executed. Defaults to this MixedCollection.
   * @return {MixedCollection} The new filtered collection
   */

/**
   * Filter the <i>objects</i> in this collection by a specific property.
   * Returns a new collection that has been filtered.
   * @param {String} property A property on your objects
   * @param {String/RegExp} value Either string that the property values
   * should start with or a RegExp to test against the property
   * @param {Boolean} anyMatch (optional) True to match any part of the string, not just the beginning
   * @param {Boolean} caseSensitive (optional) True for case sensitive comparison (defaults to False).
   * @return {MixedCollection} The new filtered collection
   */

/**
   * Find the index of the first matching object in this collection by a function.
   * If the function returns <i>true</i> it is considered a match.
   * @param {Function} fn The function to be called, it will receive the args o (the object), k (the key).
   * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the function is executed. Defaults to this MixedCollection.
   * @param {Number} start (optional) The index to start searching at (defaults to 0).
   * @return {Number} The matched index or -1
   */

/**
   * Finds the index of the first matching object in this collection by a specific property/value.
   * @param {String} property The name of a property on your objects.
   * @param {String/RegExp} value A string that the property values
   * should start with or a RegExp to test against the property.
   * @param {Number} start (optional) The index to start searching at (defaults to 0).
   * @param {Boolean} anyMatch (optional) True to match any part of the string, not just the beginning.
   * @param {Boolean} caseSensitive (optional) True for case sensitive comparison.
   * @return {Number} The matched index or -1
   */

/**
   * Float sorting
   * @param {Mixed} s The value being converted
   * @return {Float} The comparison value
   */

/**
   * Get the value of the {@link Ext.data.Field#name named field}.
   * @param {String} name The {@link Ext.data.Field#name name of the field} to get the value of.
   * @return {Object} The value of the field.
   */

/**
   * Get the value of the {@link Field#name named field}.
   * @param {String} name The {@link Field#name name of the field} to get the value of.
   * @return {Object} The value of the field.
   */

/**
   * Get translated application title of the calendar application
   *
   * @return {String}
   */

/**
   * Gets a hash of only the fields that have been modified since this Record was created or commited.
   * @return Object
   */

/**
   * HTML-encodes a string twice
   * @param {String} value
   * @return {String}
   */

/**
   * Inserts an item at the specified index in the collection. Fires the {@link #add} event when complete.
   * @param {Number} index The index to insert the item at.
   * @param {String} key The key to associate with the new item, or the item itself.
   * @param {Object} o (optional) If the second parameter was a key, the new item.
   * @return {Object} The item inserted.
   */

/**
   * Integer sorting
   * @param {Mixed} s The value being converted
   * @return {Number} The comparison value
   */

/**
   * Math.trunc polyfill
   *
   * https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc
   *
   * @param x
   * @return {*}
   */

/**
   * Pads the left side of a string with a specified character.  This is especially useful
   * for normalizing number and date strings.  Example usage:
   * <pre><code>
  var s = String.leftPad('123', 5, '0');
  // s now contains the string: '00123'
   * </code></pre>
   * @param {String} string The original string
   * @param {Number} size The total length of the output string
   * @param {String} char (optional) The character with which to pad the original string (defaults to empty string " ")
   * @return {String} The padded string
   * @static
   */

/**
   * Readonly flag - true if this Record has been modified.
   * @type Boolean
   */

/**
   * Remove an item from a specified index in the collection. Fires the {@link #remove} event when complete.
   * @param {Number} index The index within the collection of the item to remove.
   * @return {Object} The item removed or false if no item was removed.
   */

/**
   * Remove an item from the collection.
   * @param {Object} o The item to remove.
   * @return {Object} The item removed or false if no item was removed.
   */

/**
   * Removed an item associated with the passed key fom the collection.
   * @param {String} key The key of the item to remove.
   * @return {Object} The item removed or false if no item was removed.
   */

/**
   * Removes all items from the collection.  Fires the {@link #clear} event when complete.
   */

/**
   * Removes all listeners for this object
   */

/**
   * Removes an event handler.
   * @param {String}   eventName The type of event the handler was associated with.
   * @param {Function} handler   The handler to remove. <b>This must be a reference to the function passed into the {@link #addListener} call.</b>
   * @param {Object}   scope     (optional) The scope originally specified for the handler.
   */

/**
   * Removes the specified object from the array.  If the object is not found nothing happens.
   * @param {Object} o The object to remove
   * @return {Array} this array
   */

/**
   * Renders a float or integer as percent
   *
   * @param {Number} v The number to format.
   * @see Ext.util.Format.number
   *
   * @return {String} The formatted number.
   */

/**
   * Replaces an item in the collection. Fires the {@link #replace} event when complete.
   * @param {String} key <p>The key associated with the item to replace, or the replacement item.</p>
   * <p>If you supplied a {@link #getKey} implementation for this MixedCollection, or if the key
   * of your stored items is in a property called <tt><b>id</b></tt>, then the MixedCollection
   * will be able to <i>derive</i> the key of the replacement item. If you want to replace an item
   * with one having the same key value, then just pass the replacement item in this parameter.</p>
   * @param o {Object} o (optional) If the first parameter passed was a key, the item to associate
   * with that key.
   * @return {Object}  The new item.
   */

/**
   * Resume firing events. (see {@link #suspendEvents})
   * If events were suspended using the <tt><b>queueSuspended</b></tt> parameter, then all
   * events fired during event suspension will be sent to any listeners now.
   */

/**
   * Returns <tt>true</tt> if the passed field name has been <code>{@link #modified}</code>
   * since the load or last commit.
   * @param {String} fieldName {@link Ext.data.Field.{@link Ext.data.Field#name}
   * @return {Boolean}
   */

/**
   * Returns a range of items in this collection
   * @param {Number} startIndex (optional) The starting index. Defaults to 0.
   * @param {Number} endIndex (optional) The ending index. Defaults to the last item.
   * @return {Array} An array of items
   */

/**
   * Returns a username or groupname with according icon in front
   */

/**
   * Returns account type icon
   *
   * @return String
   */

/**
   * Returns dropdown hint icon for editor grid columns with comboboxes
   *
   * @return String
   */

/**
   * Returns emails from string or recipient token
   * @param emails
   */

/**
   * Returns index within the collection of the passed Object.
   * @param {Object} o The item to find the index of.
   * @return {Number} index of the item. Returns -1 if not found.
   */

/**
   * Returns index within the collection of the passed key.
   * @param {String} key The key to find the index of.
   * @return {Number} index of the key.
   */

/**
   * Returns localised date and time string
   *
   * @param {mixed} $_iso8601
   * @param metadata
   * @see date
   * @return {String} localised date and time
   */

/**
   * Returns localised date string
   *
   * @param {mixed} date
   * @param metadata
   * @param formatArray
   * @see Ext.util.Format.date
   * @return {String} localised date
   */

/**
   * Returns localised number string with two digits if no format is given
   *
   * @param {Number} v The number to format.
   * @param {String} format The way you would like to format this text.
   * @see Ext.util.Format.number
   *
   * @return {String} The formatted number.
   */

/**
   * Returns localised time string
   *
   * @param {mixed} date
   * @param metadata
   * @see Ext.util.Format.date
   * @return {String} localised time
   */

/**
   * Returns prettyfied minutes
   *
   * @param  {Number} minutes
   * @param  format -> {0} will be replaced by Hours, {1} with minutes
   * @param  {String} leadingZeros add leading zeros for given item {i|H}
   * @return {String}
   */

/**
   * Returns prettyfied seconds
   *
   * @param  {Number} seconds
   * @return {String}
   */

/**
   * Returns rendered containers
   *
   * @TODO show qtip with grants
   *
   * @param {mixed} container
   * @return {String}
   */

/**
   * Returns rendered relations
   *
   * @param {mixed} container
   * @return {String}
   *
   * TODO use/invent renderer registry to show more information on relations
   */

/**
   * Returns rendered tags for grids
   *
   * @param {mixed} tags
   * @return {String} tags as colored squares with qtips
   *
   * TODO add style for tag divs
   */

/**
   * Returns the first item in the collection which elicits a true return value from the
   * passed selection function.
   * @param {Function} fn The selection function to execute for each item.
   * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the function is executed. Defaults to the browser window.
   * @return {Object} The first item in the collection which returned true from the selection function.
   */

/**
   * Returns the first item in the collection.
   * @return {Object} the first item in the collection..
   */

/**
   * Returns the formated username
   *
   * @param {object} account object
   * @return {string} formated user display name
   */

/**
   * Returns the item associated with the passed key OR index.
   * Key has priority over index.  This is the equivalent
   * of calling {@link #key} first, then if nothing matched calling {@link #itemAt}.
   * @param {String/Number} key The key or index of the item.
   * @return {Object} If the item is found, returns the item.  If the item was not found, returns <tt>undefined</tt>.
   * If an item was found, but is a Class, returns <tt>null</tt>.
   */

/**
   * Returns the item associated with the passed key.
   * @param {String/Number} key The key of the item.
   * @return {Object} The item associated with the passed key.
   */

/**
   * Returns the item at the specified index.
   * @param {Number} index The index of the item.
   * @return {Object} The item at the specified index.
   */

/**
   * Returns the last item in the collection.
   * @return {Object} the last item in the collection..
   */

/**
   * Returns the number of items in the collection.
   * @return {Number} the number of items in the collection.
   */

/**
   * Returns true if the collection contains the passed Object as a key.
   * @param {String} key The key to look for in the collection.
   * @return {Boolean} True if the collection contains the Object as a key.
   */

/**
   * Returns true if the collection contains the passed Object as an item.
   * @param {Object} o  The Object to look for in the collection.
   * @return {Boolean} True if the collection contains the Object as an item.
   */

/**
   * Returns true if the supplied data-hash <b>looks</b> and quacks like data.  Checks to see if it has a key
   * corresponding to idProperty defined in your DataReader config containing non-empty pk.
   * @param {Object} data
   * @return {Boolean}
   */

/**
   * Set the value of the {@link Field#name named field}.
   * @param {String} name The {@link Field#name name of the field} to get the value of.
   * @return {Object} this.
   */

/**
   * Set the {@link Ext.data.Field#name named field} to the specified value.  For example:
   * <pre><code>
  // record has a field named 'firstname'
  var Employee = Record.{@link #create}([
  {name: 'firstname'},
  ...
  ]);
  // update the 2nd record in the store:
  var rec = myStore.{@link Ext.data.Store#getAt getAt}(1);
  // set the value (shows dirty flag):
  rec.set('firstname', 'Betty');
  // commit the change (removes dirty flag):
  rec.{@link #commit}();
  // update the record in the store, bypass setting dirty flag,
  // and do not store the change in the {@link Ext.data.Store#getModifiedRecords modified records}
  rec.{@link #data}['firstname'] = 'Wilma'; // updates record, but not the view
  rec.{@link #commit}(); // updates the view
   * </code></pre>
   * <b>Notes</b>:<div class="mdetail-params"><ul>
   * <li>If the store has a writer and <code>autoSave=true</code>, each set()
   * will execute an XHR to the server.</li>
   * <li>Use <code>{@link #beginEdit}</code> to prevent the store's <code>update</code>
   * event firing while using set().</li>
   * <li>Use <code>{@link #endEdit}</code> to have the store's <code>update</code>
   * event fire.</li>
   * </ul></div>
   * @param {String} name The {@link Ext.data.Field#name name of the field} to set.
   * @param {String/Object/Array} value The value to set the field to.
   * @return {Object} this.
   */

/**
   * Sorts this collection by <b>item</b> value with the passed comparison function.
   * @param {String} direction (optional) 'ASC' or 'DESC'. Defaults to 'ASC'.
   * @param {Function} fn (optional) Comparison function that defines the sort order.
   * Defaults to sorting by numeric value.
   */

/**
   * Sorts this collection by <b>key</b>s.
   * @param {String} direction (optional) 'ASC' or 'DESC'. Defaults to 'ASC'.
   * @param {Function} fn (optional) Comparison function that defines the sort order.
   * Defaults to sorting by case insensitive string.
   */

/**
   * Strips all HTML tags to sort on text only
   * @param {Mixed} s The value being converted
   * @return {String} The comparison value
   */

/**
   * Strips all HTML tags to sort on text only - Case insensitive
   * @param {Mixed} s The value being converted
   * @return {String} The comparison value
   */

/**
   * Suspend the firing of all events. (see {@link #resumeEvents})
   * @param {Boolean} queueSuspended Pass as true to queue up suspended events to be fired
   * after the {@link #resumeEvents} call instead of discarding all suspended events;
   */

/**
   * The regular expression used to strip tags
   * @type {RegExp}
   * @property
   */

/**
   * The unique ID of the Record {@link #Record as specified at construction time}.
   * @property id
   * @type {Object}
   */

/**
   * The version of the framework
   * @type String
   */

/**
   * This DataReader's configured metadata as passed to the constructor.
   * @type Mixed
   * @property meta
   */

/**
   * This JsonReader's metadata as passed to the constructor, or as passed in
   * the last data packet's <b><tt>metaData</tt></b> property.
   * @type Mixed
   * @property meta
   */

/**
   * This method is only used by a DataProxy which has retrieved data from a remote server.
   * @param {Object} response The XHR object which contains the JSON data in its responseText.
   * @return {Object} data A data block which is used by an Ext.data.Store object as
   * a cache of Ext.data.Records.
   */

/**
   * This object contains a key and value storing the original values of all modified
   * fields or is null if no fields have been modified.
   * @property modified
   * @type {Object}
   */

/**
   * Used for un-phantoming a record after a successful database insert.  Sets the records pk along with new data from server.
   * You <b>must</b> return at least the database pk using the idProperty defined in your DataReader configuration.  The incoming
   * data from server will be merged with the data in the local record.
   * In addition, you <b>must</b> return record-data from the server in the same order received.
   * Will perform a commit as well, un-marking dirty-fields.  Store's "update" event will be suppressed.
   * @param {Record/Record[]} record The phantom record to be realized.
   * @param {Object/Object[]} data The new record data to apply.  Must include the primary-key from database defined in idProperty field.
   */

/**
   * Used for updating a non-phantom or "real" record's data with fresh data from server after remote-save.
   * If returning data from multiple-records after a batch-update, you <b>must</b> return record-data from the server in
   * the same order received.  Will perform a commit as well, un-marking dirty-fields.  Store's "update" event will be
   * suppressed as the record receives fresh new data-hash
   * @param {Record/Record[]} rs
   * @param {Object/Object[]} data
   */

/**
   * Usually called by the {@link Ext.data.Store} which owns the Record.
   * Commits all changes made to the Record since either creation, or the last commit operation.
   * <p>Developers should subscribe to the {@link Ext.data.Store#update} event
   * to have their code notified of commit operations.</p>
   * @param {Boolean} silent (optional) True to skip notification of the owning
   * store of the change (defaults to false)
   */

/**
   * Usually called by the {@link Ext.data.Store} which owns the Record.
   * Rejects all changes made to the Record since either creation, or the last commit operation.
   * Modified fields are reverted to their original values.
   * <p>Developers should subscribe to the {@link Ext.data.Store#update} event
   * to have their code notified of reject operations.</p>
   * @param {Boolean} silent (optional) True to skip notification of the owning
   * store of the change (defaults to false)
   */

/**
   * apply Ext.encode as toString functino to given object
   *
   * @param {mixed} o
   */

/**
   * assert that given object is comparable
   *
   * @param {mixed} o
   * @param {bool} clone
   * @return {mixed} o
   */

/**
   * build signature from user_type, user_id and role of given attendee
   *
   * @param {Array} attendee
   * @return {String}
   */

/**
   * check if user has right to view/manage this application/resource
   *
   * @param   {String}      right (view, admin, manage)
   * @param   {String}      application
   * @param   {String}      resource (for example roles, accounts, ...)
   * @returns {Boolean}
   */

/**
   * check valid email domain (if email domain is set in config)
   *
   * @param {String} email
   */

/**
   * check whether given value can be interpreted as true
   *
   * @param {String|Integer|Boolean} value
   * @return {Boolean}
   */

/**
   * check whether object is empty (has no property)
   *
   * @param {Object} obj
   * @return {Boolean}
   */

/**
   * chek if events have exiting attendee w.o, crewscheduling_roles and suggest to assign if possible
   */

/**
   * clone function
   *
   * @param {Object/Array} o Object or array to clone
   * @return {Object/Array} Deep clone of an object or an array
   */

/**
   * color renderer
   *
   * @param color
   */

/**
   * converts data to String
   * 
   * @return {String}
   */

/**
   * currency renderer
   *
   * @param currency
   */

/**
   * default duration for new events
   */

/**
   * default filter
   * @type {string}
   */

/**
   * find contacts by email string
   *
   * return recipients token
   *
   * @param addresses
   */

/**
   * find record from target
   *
   * @param target
   */

/**
   * foreign record renderer
   *
   * @param record
   * @param metadata
   *
   * TODO use title fn? allow to configure displayed field(s)?
   */

/**
   * format byte values
   * @param {String} value
   * @param {String} forceUnit
   * @param {Integer} decimals
   * @param {Boolean} useDecimalValues
   */

/**
   * get attendee validation regarding existing event role configs for given event and attendee
   *
   * NOTE: if the event has no event role config for the given role and a role is given, validation is done
   *       regarding upstream config of this role
   *
   * @param {Calendar.Attendee} attendee
   * @param {Calendar.Event} event
   * @param {CrewScheduling.SchedulingRole} [role] validate for given role only
   * @return {Promise<{isValid: boolean, messages: String[]}>}
   */

/**
   * get possible usages (<eventId>:<roleId>) for given member and event
   *
   * NOTE: depends on member props from computeCSMembersCapabilities
   *
   * @param member
   * @param event
   * @returns {Promise<unknown[]|*[]>}
   */

/**
   * getMessage
   * @return {String}
   */

/**
   * getName
   * @return {String}
   */

/**
   * i18n renderer
   *
   * NOTE: needs to be bound to i18n object!
   *
   * renderer: Tine.Tinebase.common.i18nRenderer.createDelegate(this.app.i18n)
   * @param original
   */

/**
   * is this event a recuring base event?
   *
   * @return {Boolean}
   */

/**
   * is this event a recuring exception?
   *
   * @return {Boolean}
   */

/**
   * is this event an recuring event instance?
   *
   * @return {Boolean}
   */

/**
   * linkify text
   *
   * @param {String} text
   * @param {Ext.Element|Function} cb
   */

/**
   * load csGroupsStore with all related groups:
   * - all groups from all cs.role
   * - all groups from all calendar.eventType
   *
   * @returns {Promise}
   */

/**
   * load csMembersStore with all contacts which are member in one of the csGroups
   * @TODO add freetime search periods
   *
   * @returns {Promise}
   */

/**
   * load csRolesStore with all CrewScheduling roles
   *
   * @returns {Promise}
   */

/**
   * load eventStore with all events:
   * - fitting in current period
   * - exclude private events
   * - having a as CS requirement (direct eRCs or vis eventTypes) @TODO have a corresponding filter on server side
   * - additional filters
   *
   * @returns {Promise}
   */

/**
   * markdown renderer - fulltext, special type
   * @param {String} v The string to format.
   * @param {Object} metaData Grid metadata object
   * @param {Object} record Grid record
   * @return {String} The formatted string.
   */

/**
   * reload client
   *
   * @param {Object} options
   *      {Boolean} keepRegistry
   *      {Boolean} clearCache
   *      {Boolean} redirectAlways
   *      {String} redirectUrl
   */

/**
   * render single tag
   *
   * @param {Tine.Tinebase.Model.Tag} tag
   */

/**
   * renders bytes for filesize
   * @param {Integer} value
   * @param {Object} metadata
   * @param {Tine.Tinebase.data.Record} record
   * @param {Integer} decimals
   * @param {Boolean} useDecimalValues
   * @return {String}
   */

/**
   * return yes or no in the selected language for a boolean value
   *
   * @param {string} value
   * @return {string}
   */

/**
   * returns all possible eventRoleConfigs respecting constraints from (other) roles which are already taken by this or other attendee
   *
   * NOTE: validates regarding roleConfigs only (_not_ site, freebusy etc.)
   *
   * NOTE: does not check if all/multiple/combinations of the returned configs are also possible at once
   *       but it checks constrains regarding attendee.crewscheduling_roles (CrewScheduling.AttendeeRole[]) of given attendee
   *       to implement a multiselect you have to recheck possible eventRolecConfigs after each (de)selection with adopted attendee
   *
   * RETHIK: we shouldn't come out with zero ERc's this should be prevented by validation
   *
   * @param {Calendar.Attender} attendee
   * @param {Calendar.Event} event
   * @param {CrewScheduling.SchedulingRole} role
   * @returns {Promise<CrewScheduling.EventRoleConfig[]>}
   */

/**
   * returns attendee of given role
   * 
   * @param {Calendar.Attendee[]} attendee
   * @param {CrewScheduling.SchedulingRole} role
   * @returns {Calendar.Attendee[]}
   */

/**
   * returns attender record of current account if exists, else false
   */

/**
   * returns canonical path part
   * @returns {string}
   */

/**
   * returns dialog
   */

/**
   * returns displaycontainer with orignialcontainer as fallback
   *
   * @return {Array}
   */

/**
   * returns extracted, type-cast rows of data.  Iterates to call #extractValues for each row
   * @param {Object[]/Object} data-root from server response
   * @param {Boolean} returnRecords [false] Set true to return instances of Ext.data.Record
   * @private
   */

/**
   * returns random integer number
   * @param {Integer} min
   * @param {Integer} max
   * @return {Integer}
   */

/**
   * returns store of attender objects
   *
   * @param  {Array} attendeeData
   * @return {Ext.data.Store}
   */

/**
   * returns the id of the record
   */

/**
   * returns the php class name of the record itself or by the application(name) and model(name)
   * @param {mixed} app       the application instance or the application name or the record class
   * @param {mixed} model     the model name
   * @return {String} php class name
   */

/**
   * returns title of this record
   * 
   * @return {String}
   */

/**
   * returns true if given record obsoletes this one
   * 
   * - returns false if record has no modlog properties to make 
   *   handling of updated records work in the grid panel
   * @see 0009464: user grid does not refresh after ctx menu action
   * 
   * @param {Record} record
   * @return {Boolean}
   */

/**
   * returns view row class
   */

/**
   * set grouping
   *
   * @param {Stirng|Function} group
   * @param {Array} fixedGroups
   */

/**
   * sets the id of the record
   *
   * @param {String} id
   */

/**
   * sets the id of the record
   */

/**
   * simple html to text conversion
   *
   * @param html
   * @returns {String}
   */

/**
   * sorts account/user objects
   *
   * @param {Object|String} user_id
   * @return {String}
   */

/**
   * sorts records
   *
   * @param {Object} record
   * @return {String}
   */

/**
   * template fn called when record is instanciated
   */

/**
   * toJson
   * @return {String}
   */

/**
   * type-casts a single row of raw-data from server
   * @param {Object} data
   * @param {Array} items
   * @param {Integer} len
   * @private
   */

/**
   * update complete record with data from given record
   *
   * @param record
   */

/**
   * validate attendee regarding event site
   *
   * @param {Calendar.Attendee} attendee
   * @param {Calendar.Event} event
   * @returns {Promise<{isValid: boolean, messages: String[]}>}
   */

/**
   * validate attendee regarding his favorite days
   *
   * @param {Calendar.Attendee} attendee
   * @param {Calendar.Event} event
   * @returns {Promise<{isValid: boolean, messages: String[]}>}
   */

/**
   * validate attendee regarding his freeBusy state
   * @NOTE we use attendee.busyIds for the moment which is computed by computeCSMembersCapabilities and not yet unit-testable
   *
   * Long version
   *  - attendee.fbInfo is computed by AttendeeProxy as HTML as of searchAttendee!
   *  - an existing event attendee does not have it!
   *  - we don't have conflicts in the demo data! -> have someone like "Birgit Belegt" with an 10 YRS meeting?
   *  - Tine.Calendar.FreeBusyInfo -> fbInfo zu einem Event und was da mit den gesuchten Teilnehmern los ist
   *  - attendee.fbInfo bricht es dann wieder auf einen user herunter und hat eine zeile (<br> sepaiert) pro fbEvent)
   *  - in den Zeilen stehen als attribute auch die eventid's und der status drinnen...
   *  - das parsen wir in der dienstplanung wieder raus und speicher attendee.busyIds (eventId's)
   *
   * @param {Calendar.Attendee} attendee
   * @param {Calendar.Event} event
   * @returns {Promise<{isValid: boolean, messages: String[]}>}
   */

/**
   * validate attendee regarding his poll reply
   * @NOTE we use attendee.pollReplies for the moment which is computed by computeCSMembersCapabilities and not yet unit-testable
   *
   * @param {Calendar.Attendee} attendee
   * @param {Calendar.Event} event
   * @param {CrewScheduling.SchedulingRole} role
   * @returns {Promise<{isValid: boolean, messages: String[]}>}
   */

/**
   * validate attendee role-capabilities with one eventRoleConfig
   * 
   * @NOTE to validate role-capabilities regarding existing attendee with his assigned roles/types combinations use something else ;-)
   * 
   * existing attendee has n role->type[] records (attendee.get('crewscheduling_roles') otherwise it's a "member" from memberSelectionPanel
   *
   * @param attendee {Calendar.Attendee}
   * @param {Calendar.Event} event
   * @param eventRoleConfig {CrewScheduling.EventRoleConfig|CrewScheduling.AttendeeRole}
   * @returns {Promise<void>}
   */

/**
   * validate basics
   *
   * @param {Calendar.Attendee} attendee
   * @param {Calendar.Event} event
   * @param {CrewScheduling.SchedulingRole} role
   * @returns {Promise<{isValid: boolean, messages: String[]}>}
   */

/**
   * validate if given attendee is capable for given role and eventType
   * 
   * @param {Calendar.Attendee} attendee
   * @param {CrewScheduling.SchedulingRole} role
   * @param {Calendar.EventType} eventType
   * @returns {Promise<{isValid: boolean, messages: String[]}>}
   */

/**
   * validates given role-types config
   *
   * @NOTE attendee roles are not evaluated, you need to pass them if you want to validate them
   * 
   * @param {Calendar.Attendee} attendee
   * @param {CrewScheduling.SchedulingRole} role
   * @param {Calendar.EventType[]} eventTypes
   * @param {Object} configOverrides [configOverrides] optional
   * @returns {Promise<{isValid: boolean, messages: String[]}>, invalidTypes: {typeValidation: {isValid: boolean, messages: String[]}>}, eventType: Calendar.EventType}}
   */

/**
  * Creates a callback that passes arguments[0], arguments[1], arguments[2], ...
  * Call directly on any function. Example: <code>myFunction.createCallback(arg1, arg2)</code>
  * Will create a function that is bound to those 2 args. <b>If a specific scope is required in the
  * callback, use {@link #createDelegate} instead.</b> The function returned by createCallback always
  * executes in the window scope.
  * <p>This method is required when you want to pass arguments to a callback function.  If no arguments
  * are needed, you can simply pass a reference to the function as a callback (e.g., callback: myFn).
  * However, if you tried to pass a function with arguments (e.g., callback: myFn(arg1, arg2)) the function
  * would simply execute immediately when the code is parsed. Example usage:
  * <pre><code>
  var sayHi = function(name){
  alert('Hi, ' + name);
  }
  // clicking the button alerts "Hi, Fred"
  new Ext.Button({
  text: 'Say Hi',
  renderTo: Ext.getBody(),
  handler: sayHi.createCallback('Fred')
  });
  </code></pre>
  * @return {Function} The new function
  */

/**
  * Creates an interceptor function. The passed function is called before the original one. If it returns false,
  * the original one is not called. The resulting function returns the results of the original function.
  * The passed function is called with the parameters of the original function. Example usage:
  * <pre><code>
  var sayHi = function(name){
  alert('Hi, ' + name);
  }
  sayHi('Fred'); // alerts "Hi, Fred"
  // create a new function that validates input without
  // directly modifying the original function:
  var sayHiToFriend = sayHi.createInterceptor(function(name){
  return name == 'Brian';
  });
  sayHiToFriend('Fred');  // no alert
  sayHiToFriend('Brian'); // alerts "Hi, Brian"
  </code></pre>
  * @param {Function} fcn The function to call before the original
  * @param {Object} scope (optional) The scope (<code><b>this</b></code> reference) in which the passed function is executed.
  * <b>If omitted, defaults to the scope in which the original function is called or the browser window.</b>
  * @return {Function} The new function
  */

/**
 * @class Array
 */

/**
 * @class DataReader.Error
 * @extends Ext.Error
 * General error class for DataReader
 */

/**
 * @class Event
 * @extends Record
 * Event record definition
 */

/**
 * @class Ext
 * Ext core utilities and functions.
 * @singleton
 */

/**
 * @class Ext
 */

/**
 * @class Ext.Error
 * @extends Error
 * <p>A base error class. Future implementations are intended to provide more
 * robust error handling throughout the framework (<b>in the debug build only</b>)
 * to check for common errors and problems. The messages issued by this class
 * will aid error checking. Error checks will be automatically removed in the
 * production build so that performance is not negatively impacted.</p>
 * <p>Some sample messages currently implemented:</p><pre>
"DataProxy attempted to execute an API-action but found an undefined
url / function. Please review your Proxy url/api-configuration."
 * </pre><pre>
"Could not locate your "root" property in your server response.
Please review your JsonReader config to ensure the config-property
"root" matches the property your server-response.  See the JsonReader
docs for additional assistance."
 * </pre>
 * <p>An example of the code used for generating error messages:</p><pre><code>
try {
    generateError({
        foo: 'bar'
    });
}
catch (e) {
    console.error(e);
}
function generateError(data) {
    throw new Ext.Error('foo-error', data);
}
 * </code></pre>
 * @param {String} message
 */

/**
 * @class Ext.data.Response
 * A generic response class to normalize response-handling internally to the framework.
 */

/**
 * @class Ext.data.SortTypes
 * @singleton
 * Defines the default sorting (casting?) comparison functions used when sorting data.
 */

/**
 * @class Function
 * These functions are available on every Function object (any JavaScript function).
 */

/**
 * @class JsonReader.Error
 * Error class for JsonReader
 */

/**
 * @class Number
 */

/**
 * @class String
 * These functions are available as static methods on the JavaScript String object.
 */

/**
 * @class String
 * These functions are available on every String object.
 */

/**
 * @namespace   Tine.CrewScheduling
 * @class       Tine.CrewScheduling.Application
 * @extends     Tine.Tinebase.Application
 */

/**
 * @namespace   Tine.CrewScheduling
 * @class       Tine.CrewScheduling.EventMembersGrid
 * @extends     Ext.grid.GridPanel
 *
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 */

/**
 * @namespace   Tine.CrewScheduling
 * @class       Tine.CrewScheduling.ExportDialog
 * @extends     Tine.widgets.dialog.ExportDialog
 */

/**
 * @namespace   Tine.CrewScheduling
 * @class       Tine.CrewScheduling.MainScreen
 * @extends     Ext.Panel
 *
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 */

/**
 * @namespace   Tine.CrewScheduling
 * @class       Tine.CrewScheduling.MemberSelectionDialog
 * @extends     Ext.Panel
 *
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 */

/**
 * @namespace   Tine.CrewScheduling
 * @class       Tine.CrewScheduling.MemberSelectionPanel
 * @extends     Ext.Panel
 *
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 */

/**
 * @namespace   Tine.CrewScheduling
 * @class       Tine.CrewScheduling.MemberToken
 * @extends     Ext.Template
 *
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 */

/**
 * @namespace Tine.Tinebase.data
 * @class     Record
 * @extends   Ext.data.Record
 * 
 * Baseclass of Tine 2.0 models
 */

/**
 * @param arry<id> ids optional, return all if not st
 * @returns {Promise<void>}
 */

/**
 * @type {Array}
 *
 * modlog Fields
 */

/**
 * @type {Array}
 * generic Record fields
 */

/**
 * A close relative of [`retry`]{@link module:ControlFlow.retry}.  This method
 * wraps a task and makes it retryable, rather than immediately calling it
 * with retries.
 *
 * @name retryable
 * @static
 * @memberOf module:ControlFlow
 * @method
 * @see [async.retry]{@link module:ControlFlow.retry}
 * @category Control Flow
 * @param {Object|number} [opts = {times: 5, interval: 0}| 5] - optional
 * options, exactly the same as from `retry`, except for a `opts.arity` that
 * is the arity of the `task` function, defaulting to `task.length`
 * @param {AsyncFunction} task - the asynchronous function to wrap.
 * This function will be passed any arguments passed to the returned wrapper.
 * Invoked with (...args, callback).
 * @returns {AsyncFunction} The wrapped function, which when invoked, will
 * retry on an error, based on the parameters specified in `opts`.
 * This function will accept the same parameters as `task`.
 * @example
 *
 * async.auto({
 *     dep1: async.retryable(3, getFromFlakyService),
 *     process: ["dep1", async.retryable(3, function (results, cb) {
 *         maybeProcessData(results.dep1, cb);
 *     })]
 * }, callback);
 */

/**
 * A dependency-injected version of the [async.auto]{@link module:ControlFlow.auto} function. Dependent
 * tasks are specified as parameters to the function, after the usual callback
 * parameter, with the parameter names matching the names of the tasks it
 * depends on. This can provide even more readable task graphs which can be
 * easier to maintain.
 *
 * If a final callback is specified, the task results are similarly injected,
 * specified as named parameters after the initial error parameter.
 *
 * The autoInject function is purely syntactic sugar and its semantics are
 * otherwise equivalent to [async.auto]{@link module:ControlFlow.auto}.
 *
 * @name autoInject
 * @static
 * @memberOf module:ControlFlow
 * @method
 * @see [async.auto]{@link module:ControlFlow.auto}
 * @category Control Flow
 * @param {Object} tasks - An object, each of whose properties is an {@link AsyncFunction} of
 * the form 'func([dependencies...], callback). The object's key of a property
 * serves as the name of the task defined by that property, i.e. can be used
 * when specifying requirements for other tasks.
 * * The `callback` parameter is a `callback(err, result)` which must be called
 *   when finished, passing an `error` (which can be `null`) and the result of
 *   the function's execution. The remaining parameters name other tasks on
 *   which the task is dependent, and the results from those tasks are the
 *   arguments of those parameters.
 * @param {Function} [callback] - An optional callback which is called when all
 * the tasks have been completed. It receives the `err` argument if any `tasks`
 * pass an error to their callback, and a `results` object with any completed
 * task results, similar to `auto`.
 * @returns {Promise} a promise, if no callback is passed
 * @example
 *
 * //  The example from `auto` can be rewritten as follows:
 * async.autoInject({
 *     get_data: function(callback) {
 *         // async code to get some data
 *         callback(null, 'data', 'converted to array');
 *     },
 *     make_folder: function(callback) {
 *         // async code to create a directory to store a file in
 *         // this is run at the same time as getting the data
 *         callback(null, 'folder');
 *     },
 *     write_file: function(get_data, make_folder, callback) {
 *         // once there is some data and the directory exists,
 *         // write the data to a file in the directory
 *         callback(null, 'filename');
 *     },
 *     email_link: function(write_file, callback) {
 *         // once the file is written let's email a link to it...
 *         // write_file contains the filename returned by write_file.
 *         callback(null, {'file':write_file, 'email':'user@example.com'});
 *     }
 * }, function(err, results) {
 *     console.log('err = ', err);
 *     console.log('email_link = ', results.email_link);
 * });
 *
 * // If you are using a JS minifier that mangles parameter names, `autoInject`
 * // will not work with plain functions, since the parameter names will be
 * // collapsed to a single letter identifier.  To work around this, you can
 * // explicitly specify the names of the parameters your task function needs
 * // in an array, similar to Angular.js dependency injection.
 *
 * // This still has an advantage over plain `auto`, since the results a task
 * // depends on are still spread into arguments.
 * async.autoInject({
 *     //...
 *     write_file: ['get_data', 'make_folder', function(get_data, make_folder, callback) {
 *         callback(null, 'filename');
 *     }],
 *     email_link: ['write_file', function(write_file, callback) {
 *         callback(null, {'file':write_file, 'email':'user@example.com'});
 *     }]
 *     //...
 * }, function(err, results) {
 *     console.log('err = ', err);
 *     console.log('email_link = ', results.email_link);
 * });
 */

/**
 * A faster alternative to `Function#apply`, this function invokes `func`
 * with the `this` binding of `thisArg` and the arguments of `args`.
 *
 * @private
 * @param {Function} func The function to invoke.
 * @param {*} thisArg The `this` binding of `func`.
 * @param {Array} args The arguments to invoke `func` with.
 * @returns {*} Returns the result of `func`.
 */

/**
 * A helper function that wraps an array or an object of functions with `reflect`.
 *
 * @name reflectAll
 * @static
 * @memberOf module:Utils
 * @method
 * @see [async.reflect]{@link module:Utils.reflect}
 * @category Util
 * @param {Array|Object|Iterable} tasks - The collection of
 * [async functions]{@link AsyncFunction} to wrap in `async.reflect`.
 * @returns {Array} Returns an array of async functions, each wrapped in
 * `async.reflect`
 * @example
 *
 * let tasks = [
 *     function(callback) {
 *         setTimeout(function() {
 *             callback(null, 'one');
 *         }, 200);
 *     },
 *     function(callback) {
 *         // do some more stuff but error ...
 *         callback(new Error('bad stuff happened'));
 *     },
 *     function(callback) {
 *         setTimeout(function() {
 *             callback(null, 'two');
 *         }, 100);
 *     }
 * ];
 *
 * async.parallel(async.reflectAll(tasks),
 * // optional callback
 * function(err, results) {
 *     // values
 *     // results[0].value = 'one'
 *     // results[1].error = Error('bad stuff happened')
 *     // results[2].value = 'two'
 * });
 *
 * // an example using an object instead of an array
 * let tasks = {
 *     one: function(callback) {
 *         setTimeout(function() {
 *             callback(null, 'one');
 *         }, 200);
 *     },
 *     two: function(callback) {
 *         callback('two');
 *     },
 *     three: function(callback) {
 *         setTimeout(function() {
 *             callback(null, 'three');
 *         }, 100);
 *     }
 * };
 *
 * async.parallel(async.reflectAll(tasks),
 * // optional callback
 * function(err, results) {
 *     // values
 *     // results.one.value = 'one'
 *     // results.two.error = 'two'
 *     // results.three.value = 'three'
 * });
 */

/**
 * A queue of tasks for the worker function to complete.
 * @typedef {Iterable} QueueObject
 * @memberOf module:ControlFlow
 * @property {Function} length - a function returning the number of items
 * waiting to be processed. Invoke with `queue.length()`.
 * @property {boolean} started - a boolean indicating whether or not any
 * items have been pushed and processed by the queue.
 * @property {Function} running - a function returning the number of items
 * currently being processed. Invoke with `queue.running()`.
 * @property {Function} workersList - a function returning the array of items
 * currently being processed. Invoke with `queue.workersList()`.
 * @property {Function} idle - a function returning false if there are items
 * waiting or being processed, or true if not. Invoke with `queue.idle()`.
 * @property {number} concurrency - an integer for determining how many `worker`
 * functions should be run in parallel. This property can be changed after a
 * `queue` is created to alter the concurrency on-the-fly.
 * @property {number} payload - an integer that specifies how many items are
 * passed to the worker function at a time. only applies if this is a
 * [cargo]{@link module:ControlFlow.cargo} object
 * @property {AsyncFunction} push - add a new task to the `queue`. Calls `callback`
 * once the `worker` has finished processing the task. Instead of a single task,
 * a `tasks` array can be submitted. The respective callback is used for every
 * task in the list. Invoke with `queue.push(task, [callback])`,
 * @property {AsyncFunction} unshift - add a new task to the front of the `queue`.
 * Invoke with `queue.unshift(task, [callback])`.
 * @property {AsyncFunction} pushAsync - the same as `q.push`, except this returns
 * a promise that rejects if an error occurs.
 * @property {AsyncFunction} unshiftAsync - the same as `q.unshift`, except this returns
 * a promise that rejects if an error occurs.
 * @property {Function} remove - remove items from the queue that match a test
 * function.  The test function will be passed an object with a `data` property,
 * and a `priority` property, if this is a
 * [priorityQueue]{@link module:ControlFlow.priorityQueue} object.
 * Invoked with `queue.remove(testFn)`, where `testFn` is of the form
 * `function ({data, priority}) {}` and returns a Boolean.
 * @property {Function} saturated - a function that sets a callback that is
 * called when the number of running workers hits the `concurrency` limit, and
 * further tasks will be queued.  If the callback is omitted, `q.saturated()`
 * returns a promise for the next occurrence.
 * @property {Function} unsaturated - a function that sets a callback that is
 * called when the number of running workers is less than the `concurrency` &
 * `buffer` limits, and further tasks will not be queued. If the callback is
 * omitted, `q.unsaturated()` returns a promise for the next occurrence.
 * @property {number} buffer - A minimum threshold buffer in order to say that
 * the `queue` is `unsaturated`.
 * @property {Function} empty - a function that sets a callback that is called
 * when the last item from the `queue` is given to a `worker`. If the callback
 * is omitted, `q.empty()` returns a promise for the next occurrence.
 * @property {Function} drain - a function that sets a callback that is called
 * when the last item from the `queue` has returned from the `worker`. If the
 * callback is omitted, `q.drain()` returns a promise for the next occurrence.
 * @property {Function} error - a function that sets a callback that is called
 * when a task errors. Has the signature `function(error, task)`. If the
 * callback is omitted, `error()` returns a promise that rejects on the next
 * error.
 * @property {boolean} paused - a boolean for determining whether the queue is
 * in a paused state.
 * @property {Function} pause - a function that pauses the processing of tasks
 * until `resume()` is called. Invoke with `queue.pause()`.
 * @property {Function} resume - a function that resumes the processing of
 * queued tasks when the queue is paused. Invoke with `queue.resume()`.
 * @property {Function} kill - a function that removes the `drain` callback and
 * empties remaining tasks from the queue forcing it to go idle. No more tasks
 * should be pushed to the queue after calling this function. Invoke with `queue.kill()`.
 *
 * @example
 * const q = async.queue(worker, 2)
 * q.push(item1)
 * q.push(item2)
 * q.push(item3)
 * // queues are iterable, spread into an array to inspect
 * const items = [...q] // [item1, item2, item3]
 * // or use for of
 * for (let item of q) {
 *     console.log(item)
 * }
 *
 * q.drain(() => {
 *     console.log('all done')
 * })
 * // or
 * await q.drain()
 */

/**
 * A relative of [`map`]{@link module:Collections.map}, designed for use with objects.
 *
 * Produces a new Object by mapping each value of `obj` through the `iteratee`
 * function. The `iteratee` is called each `value` and `key` from `obj` and a
 * callback for when it has finished processing. Each of these callbacks takes
 * two arguments: an `error`, and the transformed item from `obj`. If `iteratee`
 * passes an error to its callback, the main `callback` (for the `mapValues`
 * function) is immediately called with the error.
 *
 * Note, the order of the keys in the result is not guaranteed.  The keys will
 * be roughly in the order they complete, (but this is very engine-specific)
 *
 * @name mapValues
 * @static
 * @memberOf module:Collections
 * @method
 * @category Collection
 * @param {Object} obj - A collection to iterate over.
 * @param {AsyncFunction} iteratee - A function to apply to each value and key
 * in `coll`.
 * The iteratee should complete with the transformed value as its result.
 * Invoked with (value, key, callback).
 * @param {Function} [callback] - A callback which is called when all `iteratee`
 * functions have finished, or an error occurs. `result` is a new object consisting
 * of each key from `obj`, with each transformed value on the right-hand side.
 * Invoked with (err, result).
 * @returns {Promise} a promise, if no callback is passed
 * @example
 *
 * // file1.txt is a file that is 1000 bytes in size
 * // file2.txt is a file that is 2000 bytes in size
 * // file3.txt is a file that is 3000 bytes in size
 * // file4.txt does not exist
 *
 * const fileMap = {
 *     f1: 'file1.txt',
 *     f2: 'file2.txt',
 *     f3: 'file3.txt'
 * };
 *
 * const withMissingFileMap = {
 *     f1: 'file1.txt',
 *     f2: 'file2.txt',
 *     f3: 'file4.txt'
 * };
 *
 * // asynchronous function that returns the file size in bytes
 * function getFileSizeInBytes(file, key, callback) {
 *     fs.stat(file, function(err, stat) {
 *         if (err) {
 *             return callback(err);
 *         }
 *         callback(null, stat.size);
 *     });
 * }
 *
 * // Using callbacks
 * async.mapValues(fileMap, getFileSizeInBytes, function(err, result) {
 *     if (err) {
 *         console.log(err);
 *     } else {
 *         console.log(result);
 *         // result is now a map of file size in bytes for each file, e.g.
 *         // {
 *         //     f1: 1000,
 *         //     f2: 2000,
 *         //     f3: 3000
 *         // }
 *     }
 * });
 *
 * // Error handling
 * async.mapValues(withMissingFileMap, getFileSizeInBytes, function(err, result) {
 *     if (err) {
 *         console.log(err);
 *         // [ Error: ENOENT: no such file or directory ]
 *     } else {
 *         console.log(result);
 *     }
 * });
 *
 * // Using Promises
 * async.mapValues(fileMap, getFileSizeInBytes)
 * .then( result => {
 *     console.log(result);
 *     // result is now a map of file size in bytes for each file, e.g.
 *     // {
 *     //     f1: 1000,
 *     //     f2: 2000,
 *     //     f3: 3000
 *     // }
 * }).catch (err => {
 *     console.log(err);
 * });
 *
 * // Error Handling
 * async.mapValues(withMissingFileMap, getFileSizeInBytes)
 * .then( result => {
 *     console.log(result);
 * }).catch (err => {
 *     console.log(err);
 *     // [ Error: ENOENT: no such file or directory ]
 * });
 *
 * // Using async/await
 * async () => {
 *     try {
 *         let result = await async.mapValues(fileMap, getFileSizeInBytes);
 *         console.log(result);
 *         // result is now a map of file size in bytes for each file, e.g.
 *         // {
 *         //     f1: 1000,
 *         //     f2: 2000,
 *         //     f3: 3000
 *         // }
 *     }
 *     catch (err) {
 *         console.log(err);
 *     }
 * }
 *
 * // Error Handling
 * async () => {
 *     try {
 *         let result = await async.mapValues(withMissingFileMap, getFileSizeInBytes);
 *         console.log(result);
 *     }
 *     catch (err) {
 *         console.log(err);
 *         // [ Error: ENOENT: no such file or directory ]
 *     }
 * }
 *
 */

/**
 * A relative of `reduce`.  Takes an Object or Array, and iterates over each
 * element in parallel, each step potentially mutating an `accumulator` value.
 * The type of the accumulator defaults to the type of collection passed in.
 *
 * @name transform
 * @static
 * @memberOf module:Collections
 * @method
 * @category Collection
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {*} [accumulator] - The initial state of the transform.  If omitted,
 * it will default to an empty Object or Array, depending on the type of `coll`
 * @param {AsyncFunction} iteratee - A function applied to each item in the
 * collection that potentially modifies the accumulator.
 * Invoked with (accumulator, item, key, callback).
 * @param {Function} [callback] - A callback which is called after all the
 * `iteratee` functions have finished. Result is the transformed accumulator.
 * Invoked with (err, result).
 * @returns {Promise} a promise, if no callback provided
 * @example
 *
 * // file1.txt is a file that is 1000 bytes in size
 * // file2.txt is a file that is 2000 bytes in size
 * // file3.txt is a file that is 3000 bytes in size
 *
 * // helper function that returns human-readable size format from bytes
 * function formatBytes(bytes, decimals = 2) {
 *   // implementation not included for brevity
 *   return humanReadbleFilesize;
 * }
 *
 * const fileList = ['file1.txt','file2.txt','file3.txt'];
 *
 * // asynchronous function that returns the file size, transformed to human-readable format
 * // e.g. 1024 bytes = 1KB, 1234 bytes = 1.21 KB, 1048576 bytes = 1MB, etc.
 * function transformFileSize(acc, value, key, callback) {
 *     fs.stat(value, function(err, stat) {
 *         if (err) {
 *             return callback(err);
 *         }
 *         acc[key] = formatBytes(stat.size);
 *         callback(null);
 *     });
 * }
 *
 * // Using callbacks
 * async.transform(fileList, transformFileSize, function(err, result) {
 *     if(err) {
 *         console.log(err);
 *     } else {
 *         console.log(result);
 *         // [ '1000 Bytes', '1.95 KB', '2.93 KB' ]
 *     }
 * });
 *
 * // Using Promises
 * async.transform(fileList, transformFileSize)
 * .then(result => {
 *     console.log(result);
 *     // [ '1000 Bytes', '1.95 KB', '2.93 KB' ]
 * }).catch(err => {
 *     console.log(err);
 * });
 *
 * // Using async/await
 * (async () => {
 *     try {
 *         let result = await async.transform(fileList, transformFileSize);
 *         console.log(result);
 *         // [ '1000 Bytes', '1.95 KB', '2.93 KB' ]
 *     }
 *     catch (err) {
 *         console.log(err);
 *     }
 * })();
 *
 * @example
 *
 * // file1.txt is a file that is 1000 bytes in size
 * // file2.txt is a file that is 2000 bytes in size
 * // file3.txt is a file that is 3000 bytes in size
 *
 * // helper function that returns human-readable size format from bytes
 * function formatBytes(bytes, decimals = 2) {
 *   // implementation not included for brevity
 *   return humanReadbleFilesize;
 * }
 *
 * const fileMap = { f1: 'file1.txt', f2: 'file2.txt', f3: 'file3.txt' };
 *
 * // asynchronous function that returns the file size, transformed to human-readable format
 * // e.g. 1024 bytes = 1KB, 1234 bytes = 1.21 KB, 1048576 bytes = 1MB, etc.
 * function transformFileSize(acc, value, key, callback) {
 *     fs.stat(value, function(err, stat) {
 *         if (err) {
 *             return callback(err);
 *         }
 *         acc[key] = formatBytes(stat.size);
 *         callback(null);
 *     });
 * }
 *
 * // Using callbacks
 * async.transform(fileMap, transformFileSize, function(err, result) {
 *     if(err) {
 *         console.log(err);
 *     } else {
 *         console.log(result);
 *         // { f1: '1000 Bytes', f2: '1.95 KB', f3: '2.93 KB' }
 *     }
 * });
 *
 * // Using Promises
 * async.transform(fileMap, transformFileSize)
 * .then(result => {
 *     console.log(result);
 *     // { f1: '1000 Bytes', f2: '1.95 KB', f3: '2.93 KB' }
 * }).catch(err => {
 *     console.log(err);
 * });
 *
 * // Using async/await
 * async () => {
 *     try {
 *         let result = await async.transform(fileMap, transformFileSize);
 *         console.log(result);
 *         // { f1: '1000 Bytes', f2: '1.95 KB', f3: '2.93 KB' }
 *     }
 *     catch (err) {
 *         console.log(err);
 *     }
 * }
 *
 */

/**
 * A specialized version of `_.filter` for arrays without support for
 * iteratee shorthands.
 *
 * @private
 * @param {Array} [array] The array to iterate over.
 * @param {Function} predicate The function invoked per iteration.
 * @returns {Array} Returns the new filtered array.
 */

/**
 * A specialized version of `_.forEach` for arrays without support for
 * iteratee shorthands.
 *
 * @private
 * @param {Array} [array] The array to iterate over.
 * @param {Function} iteratee The function invoked per iteration.
 * @returns {Array} Returns `array`.
 */

/**
 * A specialized version of `_.map` for arrays without support for iteratee
 * shorthands.
 *
 * @private
 * @param {Array} [array] The array to iterate over.
 * @param {Function} iteratee The function invoked per iteration.
 * @returns {Array} Returns the new mapped array.
 */

/**
 * A specialized version of `_.memoize` which clears the memoized function's
 * cache when it exceeds `MAX_MEMOIZE_SIZE`.
 *
 * @private
 * @param {Function} func The function to have its output memoized.
 * @returns {Function} Returns the new memoized function.
 */

/**
 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
 *
 * @private
 * @param {*} value The value to query.
 * @returns {string} Returns the raw `toStringTag`.
 */

/**
 * A specialized version of `baseRest` which flattens the rest array.
 *
 * @private
 * @param {Function} func The function to apply a rest parameter to.
 * @returns {Function} Returns the new function.
 */

/**
 * A specialized version of `baseRest` which transforms the rest array.
 *
 * @private
 * @param {Function} func The function to apply a rest parameter to.
 * @param {number} [start=func.length-1] The start position of the rest parameter.
 * @param {Function} transform The rest array transform.
 * @returns {Function} Returns the new function.
 */

/**
 * An "async function" in the context of Async is an asynchronous function with
 * a variable number of parameters, with the final parameter being a callback.
 * (`function (arg1, arg2, ..., callback) {}`)
 * The final callback is of the form `callback(err, results...)`, which must be
 * called once the function is completed.  The callback should be called with a
 * Error as its first argument to signal that an error occurred.
 * Otherwise, if no error occurred, it should be called with `null` as the first
 * argument, and any additional `result` arguments that may apply, to signal
 * successful completion.
 * The callback must be called exactly once, ideally on a later tick of the
 * JavaScript event loop.
 *
 * This type of function is also referred to as a "Node-style async function",
 * or a "continuation passing-style function" (CPS). Most of the methods of this
 * library are themselves CPS/Node-style async functions, or functions that
 * return CPS/Node-style async functions.
 *
 * Wherever we accept a Node-style async function, we also directly accept an
 * [ES2017 `async` function]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function}.
 * In this case, the `async` function will not be passed a final callback
 * argument, and any thrown error will be used as the `err` argument of the
 * implicit callback, and the return value will be used as the `result` value.
 * (i.e. a `rejected` of the returned Promise becomes the `err` callback
 * argument, and a `resolved` value becomes the `result`.)
 *
 * Note, due to JavaScript limitations, we can only detect native `async`
 * functions and not transpilied implementations.
 * Your environment must have `async`/`await` support for this to work.
 * (e.g. Node > v7.6, or a recent version of a modern browser).
 * If you are using `async` functions through a transpiler (e.g. Babel), you
 * must still wrap the function with [asyncify]{@link module:Utils.asyncify},
 * because the `async function` will be compiled to an ordinary function that
 * returns a promise.
 *
 * @typedef {Function} AsyncFunction
 * @static
 */

/**
 * Appends an event handler to this object (shorthand for {@link #addListener}.)
 * @param {String}   eventName     The type of event to listen for
 * @param {Function} handler       The method the event invokes
 * @param {Object}   scope         (optional) The scope (<code><b>this</b></code> reference) in which the handler function is executed.
 * <b>If omitted, defaults to the object which fired the event.</b>
 * @param {Object}   options       (optional) An object containing handler configuration.
 * @method
 */

/**
 * Appends the elements of `values` to `array`.
 *
 * @private
 * @param {Array} array The array to modify.
 * @param {Array} values The values to append.
 * @returns {Array} Returns `array`.
 */

/**
 * Applies `iteratee` to each item in `coll`, concatenating the results. Returns
 * the concatenated list. The `iteratee`s are called in parallel, and the
 * results are concatenated as they return. The results array will be returned in
 * the original order of `coll` passed to the `iteratee` function.
 *
 * @name concat
 * @static
 * @memberOf module:Collections
 * @method
 * @category Collection
 * @alias flatMap
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`,
 * which should use an array as its result. Invoked with (item, callback).
 * @param {Function} [callback] - A callback which is called after all the
 * `iteratee` functions have finished, or an error occurs. Results is an array
 * containing the concatenated results of the `iteratee` function. Invoked with
 * (err, results).
 * @returns A Promise, if no callback is passed
 * @example
 *
 * // dir1 is a directory that contains file1.txt, file2.txt
 * // dir2 is a directory that contains file3.txt, file4.txt
 * // dir3 is a directory that contains file5.txt
 * // dir4 does not exist
 *
 * let directoryList = ['dir1','dir2','dir3'];
 * let withMissingDirectoryList = ['dir1','dir2','dir3', 'dir4'];
 *
 * // Using callbacks
 * async.concat(directoryList, fs.readdir, function(err, results) {
 *    if (err) {
 *        console.log(err);
 *    } else {
 *        console.log(results);
 *        // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
 *    }
 * });
 *
 * // Error Handling
 * async.concat(withMissingDirectoryList, fs.readdir, function(err, results) {
 *    if (err) {
 *        console.log(err);
 *        // [ Error: ENOENT: no such file or directory ]
 *        // since dir4 does not exist
 *    } else {
 *        console.log(results);
 *    }
 * });
 *
 * // Using Promises
 * async.concat(directoryList, fs.readdir)
 * .then(results => {
 *     console.log(results);
 *     // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
 * }).catch(err => {
 *      console.log(err);
 * });
 *
 * // Error Handling
 * async.concat(withMissingDirectoryList, fs.readdir)
 * .then(results => {
 *     console.log(results);
 * }).catch(err => {
 *     console.log(err);
 *     // [ Error: ENOENT: no such file or directory ]
 *     // since dir4 does not exist
 * });
 *
 * // Using async/await
 * async () => {
 *     try {
 *         let results = await async.concat(directoryList, fs.readdir);
 *         console.log(results);
 *         // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
 *     } catch (err) {
 *         console.log(err);
 *     }
 * }
 *
 * // Error Handling
 * async () => {
 *     try {
 *         let results = await async.concat(withMissingDirectoryList, fs.readdir);
 *         console.log(results);
 *     } catch (err) {
 *         console.log(err);
 *         // [ Error: ENOENT: no such file or directory ]
 *         // since dir4 does not exist
 *     }
 * }
 *
 */

/**
 * Applies the function `iteratee` to each item in `coll`, in parallel.
 * The `iteratee` is called with an item from the list, and a callback for when
 * it has finished. If the `iteratee` passes an error to its `callback`, the
 * main `callback` (for the `each` function) is immediately called with the
 * error.
 *
 * Note, that since this function applies `iteratee` to each item in parallel,
 * there is no guarantee that the iteratee functions will complete in order.
 *
 * @name each
 * @static
 * @memberOf module:Collections
 * @method
 * @alias forEach
 * @category Collection
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {AsyncFunction} iteratee - An async function to apply to
 * each item in `coll`. Invoked with (item, callback).
 * The array index is not passed to the iteratee.
 * If you need the index, use `eachOf`.
 * @param {Function} [callback] - A callback which is called when all
 * `iteratee` functions have finished, or an error occurs. Invoked with (err).
 * @returns {Promise} a promise, if a callback is omitted
 * @example
 *
 * // dir1 is a directory that contains file1.txt, file2.txt
 * // dir2 is a directory that contains file3.txt, file4.txt
 * // dir3 is a directory that contains file5.txt
 * // dir4 does not exist
 *
 * const fileList = [ 'dir1/file2.txt', 'dir2/file3.txt', 'dir/file5.txt'];
 * const withMissingFileList = ['dir1/file1.txt', 'dir4/file2.txt'];
 *
 * // asynchronous function that deletes a file
 * const deleteFile = function(file, callback) {
 *     fs.unlink(file, callback);
 * };
 *
 * // Using callbacks
 * async.each(fileList, deleteFile, function(err) {
 *     if( err ) {
 *         console.log(err);
 *     } else {
 *         console.log('All files have been deleted successfully');
 *     }
 * });
 *
 * // Error Handling
 * async.each(withMissingFileList, deleteFile, function(err){
 *     console.log(err);
 *     // [ Error: ENOENT: no such file or directory ]
 *     // since dir4/file2.txt does not exist
 *     // dir1/file1.txt could have been deleted
 * });
 *
 * // Using Promises
 * async.each(fileList, deleteFile)
 * .then( () => {
 *     console.log('All files have been deleted successfully');
 * }).catch( err => {
 *     console.log(err);
 * });
 *
 * // Error Handling
 * async.each(fileList, deleteFile)
 * .then( () => {
 *     console.log('All files have been deleted successfully');
 * }).catch( err => {
 *     console.log(err);
 *     // [ Error: ENOENT: no such file or directory ]
 *     // since dir4/file2.txt does not exist
 *     // dir1/file1.txt could have been deleted
 * });
 *
 * // Using async/await
 * async () => {
 *     try {
 *         await async.each(files, deleteFile);
 *     }
 *     catch (err) {
 *         console.log(err);
 *     }
 * }
 *
 * // Error Handling
 * async () => {
 *     try {
 *         await async.each(withMissingFileList, deleteFile);
 *     }
 *     catch (err) {
 *         console.log(err);
 *         // [ Error: ENOENT: no such file or directory ]
 *         // since dir4/file2.txt does not exist
 *         // dir1/file1.txt could have been deleted
 *     }
 * }
 *
 */

/**
 * Applies the provided arguments to each function in the array, calling
 * `callback` after all functions have completed. If you only provide the first
 * argument, `fns`, then it will return a function which lets you pass in the
 * arguments as if it were a single function call. If more arguments are
 * provided, `callback` is required while `args` is still optional. The results
 * for each of the applied async functions are passed to the final callback
 * as an array.
 *
 * @name applyEach
 * @static
 * @memberOf module:ControlFlow
 * @method
 * @category Control Flow
 * @param {Array|Iterable|AsyncIterable|Object} fns - A collection of {@link AsyncFunction}s
 * to all call with the same arguments
 * @param {...*} [args] - any number of separate arguments to pass to the
 * function.
 * @param {Function} [callback] - the final argument should be the callback,
 * called when all functions have completed processing.
 * @returns {AsyncFunction} - Returns a function that takes no args other than
 * an optional callback, that is the result of applying the `args` to each
 * of the functions.
 * @example
 *
 * const appliedFn = async.applyEach([enableSearch, updateSchema], 'bucket')
 *
 * appliedFn((err, results) => {
 *     // results[0] is the results for `enableSearch`
 *     // results[1] is the results for `updateSchema`
 * });
 *
 * // partial application example:
 * async.each(
 *     buckets,
 *     async (bucket) => async.applyEach([enableSearch, updateSchema], bucket)(),
 *     callback
 * );
 */

/**
 * Assigns `value` to `key` of `object` if the existing value is not equivalent
 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
 * for equality comparisons.
 *
 * @private
 * @param {Object} object The object to modify.
 * @param {string} key The key of the property to assign.
 * @param {*} value The value to assign.
 */

/**
 * Attempts to get a successful response from `task` no more than `times` times
 * before returning an error. If the task is successful, the `callback` will be
 * passed the result of the successful task. If all attempts fail, the callback
 * will be passed the error and result (if any) of the final attempt.
 *
 * @name retry
 * @static
 * @memberOf module:ControlFlow
 * @method
 * @category Control Flow
 * @see [async.retryable]{@link module:ControlFlow.retryable}
 * @param {Object|number} [opts = {times: 5, interval: 0}| 5] - Can be either an
 * object with `times` and `interval` or a number.
 * * `times` - The number of attempts to make before giving up.  The default
 *   is `5`.
 * * `interval` - The time to wait between retries, in milliseconds.  The
 *   default is `0`. The interval may also be specified as a function of the
 *   retry count (see example).
 * * `errorFilter` - An optional synchronous function that is invoked on
 *   erroneous result. If it returns `true` the retry attempts will continue;
 *   if the function returns `false` the retry flow is aborted with the current
 *   attempt's error and result being returned to the final callback.
 *   Invoked with (err).
 * * If `opts` is a number, the number specifies the number of times to retry,
 *   with the default interval of `0`.
 * @param {AsyncFunction} task - An async function to retry.
 * Invoked with (callback).
 * @param {Function} [callback] - An optional callback which is called when the
 * task has succeeded, or after the final failed attempt. It receives the `err`
 * and `result` arguments of the last attempt at completing the `task`. Invoked
 * with (err, results).
 * @returns {Promise} a promise if no callback provided
 *
 * @example
 *
 * // The `retry` function can be used as a stand-alone control flow by passing
 * // a callback, as shown below:
 *
 * // try calling apiMethod 3 times
 * async.retry(3, apiMethod, function(err, result) {
 *     // do something with the result
 * });
 *
 * // try calling apiMethod 3 times, waiting 200 ms between each retry
 * async.retry({times: 3, interval: 200}, apiMethod, function(err, result) {
 *     // do something with the result
 * });
 *
 * // try calling apiMethod 10 times with exponential backoff
 * // (i.e. intervals of 100, 200, 400, 800, 1600, ... milliseconds)
 * async.retry({
 *   times: 10,
 *   interval: function(retryCount) {
 *     return 50 * Math.pow(2, retryCount);
 *   }
 * }, apiMethod, function(err, result) {
 *     // do something with the result
 * });
 *
 * // try calling apiMethod the default 5 times no delay between each retry
 * async.retry(apiMethod, function(err, result) {
 *     // do something with the result
 * });
 *
 * // try calling apiMethod only when error condition satisfies, all other
 * // errors will abort the retry control flow and return to final callback
 * async.retry({
 *   errorFilter: function(err) {
 *     return err.message === 'Temporary error'; // only retry on a specific error
 *   }
 * }, apiMethod, function(err, result) {
 *     // do something with the result
 * });
 *
 * // to retry individual methods that are not as reliable within other
 * // control flow functions, use the `retryable` wrapper:
 * async.auto({
 *     users: api.getUsers.bind(api),
 *     payments: async.retryable(3, api.getPayments.bind(api))
 * }, function(err, results) {
 *     // do something with the results
 * });
 *
 */

/**
 * Caches the results of an async function. When creating a hash to store
 * function results against, the callback is omitted from the hash and an
 * optional hash function can be used.
 *
 * **Note: if the async function errs, the result will not be cached and
 * subsequent calls will call the wrapped function.**
 *
 * If no hash function is specified, the first argument is used as a hash key,
 * which may work reasonably if it is a string or a data type that converts to a
 * distinct string. Note that objects and arrays will not behave reasonably.
 * Neither will cases where the other arguments are significant. In such cases,
 * specify your own hash function.
 *
 * The cache of results is exposed as the `memo` property of the function
 * returned by `memoize`.
 *
 * @name memoize
 * @static
 * @memberOf module:Utils
 * @method
 * @category Util
 * @param {AsyncFunction} fn - The async function to proxy and cache results from.
 * @param {Function} hasher - An optional function for generating a custom hash
 * for storing results. It has all the arguments applied to it apart from the
 * callback, and must be synchronous.
 * @returns {AsyncFunction} a memoized version of `fn`
 * @example
 *
 * var slow_fn = function(name, callback) {
 *     // do something
 *     callback(null, result);
 * };
 * var fn = async.memoize(slow_fn);
 *
 * // fn can now be used as if it were slow_fn
 * fn('some name', function() {
 *     // callback
 * });
 */

/**
 * Calls `callback` on a later loop around the event loop. In Node.js this just
 * calls `process.nextTick`.  In the browser it will use `setImmediate` if
 * available, otherwise `setTimeout(callback, 0)`, which means other higher
 * priority events may precede the execution of `callback`.
 *
 * This is used internally for browser-compatibility purposes.
 *
 * @name nextTick
 * @static
 * @memberOf module:Utils
 * @method
 * @see [async.setImmediate]{@link module:Utils.setImmediate}
 * @category Util
 * @param {Function} callback - The function to call on a later loop around
 * the event loop. Invoked with (args...).
 * @param {...*} args... - any number of additional arguments to pass to the
 * callback on the next tick.
 * @example
 *
 * var call_order = [];
 * async.nextTick(function() {
 *     call_order.push('two');
 *     // call_order now equals ['one','two']
 * });
 * call_order.push('one');
 *
 * async.setImmediate(function (a, b, c) {
 *     // a, b, and c equal 1, 2, and 3
 * }, 1, 2, 3);
 */

/**
 * Calls the `iteratee` function `n` times, and accumulates results in the same
 * manner you would use with [map]{@link module:Collections.map}.
 *
 * @name times
 * @static
 * @memberOf module:ControlFlow
 * @method
 * @see [async.map]{@link module:Collections.map}
 * @category Control Flow
 * @param {number} n - The number of times to run the function.
 * @param {AsyncFunction} iteratee - The async function to call `n` times.
 * Invoked with the iteration index and a callback: (n, next).
 * @param {Function} callback - see {@link module:Collections.map}.
 * @returns {Promise} a promise, if no callback is provided
 * @example
 *
 * // Pretend this is some complicated async factory
 * var createUser = function(id, callback) {
 *     callback(null, {
 *         id: 'user' + id
 *     });
 * };
 *
 * // generate 5 users
 * async.times(5, function(n, next) {
 *     createUser(n, function(err, user) {
 *         next(err, user);
 *     });
 * }, function(err, users) {
 *     // we should now have 5 users
 * });
 */

/**
 * Calls the asynchronous function `fn` with a callback parameter that allows it
 * to call itself again, in series, indefinitely.

 * If an error is passed to the callback then `errback` is called with the
 * error, and execution stops, otherwise it will never be called.
 *
 * @name forever
 * @static
 * @memberOf module:ControlFlow
 * @method
 * @category Control Flow
 * @param {AsyncFunction} fn - an async function to call repeatedly.
 * Invoked with (next).
 * @param {Function} [errback] - when `fn` passes an error to it's callback,
 * this function will be called, and execution stops. Invoked with (err).
 * @returns {Promise} a promise that rejects if an error occurs and an errback
 * is not passed
 * @example
 *
 * async.forever(
 *     function(next) {
 *         // next is suitable for passing to things that need a callback(err [, whatever]);
 *         // it will result in this function being called again.
 *     },
 *     function(err) {
 *         // if next is called with a value in its first parameter, it will appear
 *         // in here as 'err', and execution will stop.
 *     }
 * );
 */

/**
 * Casts `value` to a path array if it's not one.
 *
 * @private
 * @param {*} value The value to inspect.
 * @param {Object} [object] The object to query keys on.
 * @returns {Array} Returns the cast property path array.
 */

/**
 * Checks if `func` has its source masked.
 *
 * @private
 * @param {Function} func The function to check.
 * @returns {boolean} Returns `true` if `func` is masked, else `false`.
 */

/**
 * Checks if `value` is a flattenable `arguments` object or array.
 *
 * @private
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
 */

/**
 * Checks if `value` is a plain object, that is, an object created by the
 * `Object` constructor or one with a `[[Prototype]]` of `null`.
 *
 * @static
 * @memberOf _
 * @since 0.8.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
 * @example
 *
 * function Foo() {
 *   this.a = 1;
 * }
 *
 * _.isPlainObject(new Foo);
 * // => false
 *
 * _.isPlainObject([1, 2, 3]);
 * // => false
 *
 * _.isPlainObject({ 'x': 0, 'y': 0 });
 * // => true
 *
 * _.isPlainObject(Object.create(null));
 * // => true
 */

/**
 * Checks if `value` is a property name and not a property path.
 *
 * @private
 * @param {*} value The value to check.
 * @param {Object} [object] The object to query keys on.
 * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
 */

/**
 * Checks if `value` is a valid array-like index.
 *
 * @private
 * @param {*} value The value to check.
 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
 */

/**
 * Checks if `value` is a valid array-like length.
 *
 * **Note:** This method is loosely based on
 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
 * @example
 *
 * _.isLength(3);
 * // => true
 *
 * _.isLength(Number.MIN_VALUE);
 * // => false
 *
 * _.isLength(Infinity);
 * // => false
 *
 * _.isLength('3');
 * // => false
 */

/**
 * Checks if `value` is array-like. A value is considered array-like if it's
 * not a function and has a `value.length` that's an integer greater than or
 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
 * @example
 *
 * _.isArrayLike([1, 2, 3]);
 * // => true
 *
 * _.isArrayLike(document.body.children);
 * // => true
 *
 * _.isArrayLike('abc');
 * // => true
 *
 * _.isArrayLike(_.noop);
 * // => false
 */

/**
 * Checks if `value` is classified as a `Function` object.
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a function, else `false`.
 * @example
 *
 * _.isFunction(_);
 * // => true
 *
 * _.isFunction(/abc/);
 * // => false
 */

/**
 * Checks if `value` is classified as a `Symbol` primitive or object.
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
 * @example
 *
 * _.isSymbol(Symbol.iterator);
 * // => true
 *
 * _.isSymbol('abc');
 * // => false
 */

/**
 * Checks if `value` is classified as an `Array` object.
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is an array, else `false`.
 * @example
 *
 * _.isArray([1, 2, 3]);
 * // => true
 *
 * _.isArray(document.body.children);
 * // => false
 *
 * _.isArray('abc');
 * // => false
 *
 * _.isArray(_.noop);
 * // => false
 */

/**
 * Checks if `value` is likely a prototype object.
 *
 * @private
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
 */

/**
 * Checks if `value` is object-like. A value is object-like if it's not `null`
 * and has a `typeof` result of "object".
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
 * @example
 *
 * _.isObjectLike({});
 * // => true
 *
 * _.isObjectLike([1, 2, 3]);
 * // => true
 *
 * _.isObjectLike(_.noop);
 * // => false
 *
 * _.isObjectLike(null);
 * // => false
 */

/**
 * Checks if `value` is suitable for use as unique object key.
 *
 * @private
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
 */

/**
 * Checks if `value` is the
 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
 * @example
 *
 * _.isObject({});
 * // => true
 *
 * _.isObject([1, 2, 3]);
 * // => true
 *
 * _.isObject(_.noop);
 * // => true
 *
 * _.isObject(null);
 * // => false
 */

/**
 * Checks if a hash value for `key` exists.
 *
 * @private
 * @name has
 * @memberOf Hash
 * @param {string} key The key of the entry to check.
 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
 */

/**
 * Checks if a list cache value for `key` exists.
 *
 * @private
 * @name has
 * @memberOf ListCache
 * @param {string} key The key of the entry to check.
 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
 */

/**
 * Checks if a map value for `key` exists.
 *
 * @private
 * @name has
 * @memberOf MapCache
 * @param {string} key The key of the entry to check.
 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
 */

/**
 * Checks if a stack value for `key` exists.
 *
 * @private
 * @name has
 * @memberOf Stack
 * @param {string} key The key of the entry to check.
 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
 */

/**
 * Converts `func` to its source code.
 *
 * @private
 * @param {Function} func The function to convert.
 * @returns {string} Returns the source code.
 */

/**
 * Converts `value` to a string key if it's not a string or symbol.
 *
 * @private
 * @param {*} value The value to inspect.
 * @returns {string|symbol} Returns the key.
 */

/**
 * Converts `value` to a string using `Object.prototype.toString`.
 *
 * @private
 * @param {*} value The value to convert.
 * @returns {string} Returns the converted string.
 */

/**
 * Converts `value` to a string. An empty string is returned for `null`
 * and `undefined` values. The sign of `-0` is preserved.
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to convert.
 * @returns {string} Returns the converted string.
 * @example
 *
 * _.toString(null);
 * // => ''
 *
 * _.toString(-0);
 * // => '-0'
 *
 * _.toString([1, 2, 3]);
 * // => '1,2,3'
 */

/**
 * Copies all the properties of config to obj.
 * @param {Object} obj The receiver of the properties
 * @param {Object} config The source of the properties
 * @param {Object} defaults A different object that will also be applied for default values
 * @return {Object} returns obj
 * @member Ext apply
 */

/**
 * Copies own and inherited symbols of `source` to `object`.
 *
 * @private
 * @param {Object} source The object to copy symbols from.
 * @param {Object} [object={}] The object to copy symbols to.
 * @returns {Object} Returns `object`.
 */

/**
 * Copies own symbols of `source` to `object`.
 *
 * @private
 * @param {Object} source The object to copy symbols from.
 * @param {Object} [object={}] The object to copy symbols to.
 * @returns {Object} Returns `object`.
 */

/**
 * Copies properties of `source` to `object`.
 *
 * @private
 * @param {Object} source The object to copy properties from.
 * @param {Array} props The property identifiers to copy.
 * @param {Object} [object={}] The object to copy properties to.
 * @param {Function} [customizer] The function to customize copied values.
 * @returns {Object} Returns `object`.
 */

/**
 * Copies the values of `source` to `array`.
 *
 * @private
 * @param {Array} source The array to copy values from.
 * @param {Array} [array=[]] The array to copy values to.
 * @returns {Array} Returns `array`.
 */

/**
 * Creates a `cargoQueue` object with the specified payload. Tasks added to the
 * cargoQueue will be processed together (up to the `payload` limit) in `concurrency` parallel workers.
 * If the all `workers` are in progress, the task is queued until one becomes available. Once
 * a `worker` has completed some tasks, each callback of those tasks is
 * called. Check out [these](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) [animations](https://camo.githubusercontent.com/f4810e00e1c5f5f8addbe3e9f49064fd5d102699/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130312f38346339323036362d356632392d313165322d383134662d3964336430323431336266642e676966)
 * for how `cargo` and `queue` work.
 *
 * While [`queue`]{@link module:ControlFlow.queue} passes only one task to one of a group of workers
 * at a time, and [`cargo`]{@link module:ControlFlow.cargo} passes an array of tasks to a single worker,
 * the cargoQueue passes an array of tasks to multiple parallel workers.
 *
 * @name cargoQueue
 * @static
 * @memberOf module:ControlFlow
 * @method
 * @see [async.queue]{@link module:ControlFlow.queue}
 * @see [async.cargo]{@link module:ControlFLow.cargo}
 * @category Control Flow
 * @param {AsyncFunction} worker - An asynchronous function for processing an array
 * of queued tasks. Invoked with `(tasks, callback)`.
 * @param {number} [concurrency=1] - An `integer` for determining how many
 * `worker` functions should be run in parallel.  If omitted, the concurrency
 * defaults to `1`.  If the concurrency is `0`, an error is thrown.
 * @param {number} [payload=Infinity] - An optional `integer` for determining
 * how many tasks should be processed per round; if omitted, the default is
 * unlimited.
 * @returns {module:ControlFlow.QueueObject} A cargoQueue object to manage the tasks. Callbacks can
 * attached as certain properties to listen for specific events during the
 * lifecycle of the cargoQueue and inner queue.
 * @example
 *
 * // create a cargoQueue object with payload 2 and concurrency 2
 * var cargoQueue = async.cargoQueue(function(tasks, callback) {
 *     for (var i=0; i<tasks.length; i++) {
 *         console.log('hello ' + tasks[i].name);
 *     }
 *     callback();
 * }, 2, 2);
 *
 * // add some items
 * cargoQueue.push({name: 'foo'}, function(err) {
 *     console.log('finished processing foo');
 * });
 * cargoQueue.push({name: 'bar'}, function(err) {
 *     console.log('finished processing bar');
 * });
 * cargoQueue.push({name: 'baz'}, function(err) {
 *     console.log('finished processing baz');
 * });
 * cargoQueue.push({name: 'boo'}, function(err) {
 *     console.log('finished processing boo');
 * });
 */

/**
 * Creates a `cargo` object with the specified payload. Tasks added to the
 * cargo will be processed altogether (up to the `payload` limit). If the
 * `worker` is in progress, the task is queued until it becomes available. Once
 * the `worker` has completed some tasks, each callback of those tasks is
 * called. Check out [these](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) [animations](https://camo.githubusercontent.com/f4810e00e1c5f5f8addbe3e9f49064fd5d102699/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130312f38346339323036362d356632392d313165322d383134662d3964336430323431336266642e676966)
 * for how `cargo` and `queue` work.
 *
 * While [`queue`]{@link module:ControlFlow.queue} passes only one task to one of a group of workers
 * at a time, cargo passes an array of tasks to a single worker, repeating
 * when the worker is finished.
 *
 * @name cargo
 * @static
 * @memberOf module:ControlFlow
 * @method
 * @see [async.queue]{@link module:ControlFlow.queue}
 * @category Control Flow
 * @param {AsyncFunction} worker - An asynchronous function for processing an array
 * of queued tasks. Invoked with `(tasks, callback)`.
 * @param {number} [payload=Infinity] - An optional `integer` for determining
 * how many tasks should be processed per round; if omitted, the default is
 * unlimited.
 * @returns {module:ControlFlow.QueueObject} A cargo object to manage the tasks. Callbacks can
 * attached as certain properties to listen for specific events during the
 * lifecycle of the cargo and inner queue.
 * @example
 *
 * // create a cargo object with payload 2
 * var cargo = async.cargo(function(tasks, callback) {
 *     for (var i=0; i<tasks.length; i++) {
 *         console.log('hello ' + tasks[i].name);
 *     }
 *     callback();
 * }, 2);
 *
 * // add some items
 * cargo.push({name: 'foo'}, function(err) {
 *     console.log('finished processing foo');
 * });
 * cargo.push({name: 'bar'}, function(err) {
 *     console.log('finished processing bar');
 * });
 * await cargo.push({name: 'baz'});
 * console.log('finished processing baz');
 */

/**
 * Creates a `queue` object with the specified `concurrency`. Tasks added to the
 * `queue` are processed in parallel (up to the `concurrency` limit). If all
 * `worker`s are in progress, the task is queued until one becomes available.
 * Once a `worker` completes a `task`, that `task`'s callback is called.
 *
 * @name queue
 * @static
 * @memberOf module:ControlFlow
 * @method
 * @category Control Flow
 * @param {AsyncFunction} worker - An async function for processing a queued task.
 * If you want to handle errors from an individual task, pass a callback to
 * `q.push()`. Invoked with (task, callback).
 * @param {number} [concurrency=1] - An `integer` for determining how many
 * `worker` functions should be run in parallel.  If omitted, the concurrency
 * defaults to `1`.  If the concurrency is `0`, an error is thrown.
 * @returns {module:ControlFlow.QueueObject} A queue object to manage the tasks. Callbacks can be
 * attached as certain properties to listen for specific events during the
 * lifecycle of the queue.
 * @example
 *
 * // create a queue object with concurrency 2
 * var q = async.queue(function(task, callback) {
 *     console.log('hello ' + task.name);
 *     callback();
 * }, 2);
 *
 * // assign a callback
 * q.drain(function() {
 *     console.log('all items have been processed');
 * });
 * // or await the end
 * await q.drain()
 *
 * // assign an error callback
 * q.error(function(err, task) {
 *     console.error('task experienced an error');
 * });
 *
 * // add some items to the queue
 * q.push({name: 'foo'}, function(err) {
 *     console.log('finished processing foo');
 * });
 * // callback is optional
 * q.push({name: 'bar'});
 *
 * // add some items to the queue (batch-wise)
 * q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function(err) {
 *     console.log('finished processing item');
 * });
 *
 * // add some items to the front of the queue
 * q.unshift({name: 'bar'}, function (err) {
 *     console.log('finished processing bar');
 * });
 */

/**
 * Creates a clone of  `buffer`.
 *
 * @private
 * @param {Buffer} buffer The buffer to clone.
 * @param {boolean} [isDeep] Specify a deep clone.
 * @returns {Buffer} Returns the cloned buffer.
 */

/**
 * Creates a clone of `arrayBuffer`.
 *
 * @private
 * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
 * @returns {ArrayBuffer} Returns the cloned array buffer.
 */

/**
 * Creates a clone of `dataView`.
 *
 * @private
 * @param {Object} dataView The data view to clone.
 * @param {boolean} [isDeep] Specify a deep clone.
 * @returns {Object} Returns the cloned data view.
 */

/**
 * Creates a clone of `regexp`.
 *
 * @private
 * @param {Object} regexp The regexp to clone.
 * @returns {Object} Returns the cloned regexp.
 */

/**
 * Creates a clone of `typedArray`.
 *
 * @private
 * @param {Object} typedArray The typed array to clone.
 * @param {boolean} [isDeep] Specify a deep clone.
 * @returns {Object} Returns the cloned typed array.
 */

/**
 * Creates a clone of the `symbol` object.
 *
 * @private
 * @param {Object} symbol The symbol object to clone.
 * @returns {Object} Returns the cloned symbol object.
 */

/**
 * Creates a continuation function with some arguments already applied.
 *
 * Useful as a shorthand when combined with other control flow functions. Any
 * arguments passed to the returned function are added to the arguments
 * originally passed to apply.
 *
 * @name apply
 * @static
 * @memberOf module:Utils
 * @method
 * @category Util
 * @param {Function} fn - The function you want to eventually apply all
 * arguments to. Invokes with (arguments...).
 * @param {...*} arguments... - Any number of arguments to automatically apply
 * when the continuation is called.
 * @returns {Function} the partially-applied function
 * @example
 *
 * // using apply
 * async.parallel([
 *     async.apply(fs.writeFile, 'testfile1', 'test1'),
 *     async.apply(fs.writeFile, 'testfile2', 'test2')
 * ]);
 *
 *
 * // the same process without using apply
 * async.parallel([
 *     function(callback) {
 *         fs.writeFile('testfile1', 'test1', callback);
 *     },
 *     function(callback) {
 *         fs.writeFile('testfile2', 'test2', callback);
 *     }
 * ]);
 *
 * // It's possible to pass any number of additional arguments when calling the
 * // continuation:
 *
 * node> var fn = async.apply(sys.puts, 'one');
 * node> fn('two', 'three');
 * one
 * two
 * three
 */

/**
 * Creates a function that memoizes the result of `func`. If `resolver` is
 * provided, it determines the cache key for storing the result based on the
 * arguments provided to the memoized function. By default, the first argument
 * provided to the memoized function is used as the map cache key. The `func`
 * is invoked with the `this` binding of the memoized function.
 *
 * **Note:** The cache is exposed as the `cache` property on the memoized
 * function. Its creation may be customized by replacing the `_.memoize.Cache`
 * constructor with one whose instances implement the
 * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
 * method interface of `clear`, `delete`, `get`, `has`, and `set`.
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Function
 * @param {Function} func The function to have its output memoized.
 * @param {Function} [resolver] The function to resolve the cache key.
 * @returns {Function} Returns the new memoized function.
 * @example
 *
 * var object = { 'a': 1, 'b': 2 };
 * var other = { 'c': 3, 'd': 4 };
 *
 * var values = _.memoize(_.values);
 * values(object);
 * // => [1, 2]
 *
 * values(other);
 * // => [3, 4]
 *
 * object.a = 2;
 * values(object);
 * // => [1, 2]
 *
 * // Modify the result cache.
 * values.cache.set(object, ['a', 'b']);
 * values(object);
 * // => ['a', 'b']
 *
 * // Replace `_.memoize.Cache`.
 * _.memoize.Cache = WeakMap;
 */

/**
 * Creates a function that returns `value`.
 *
 * @static
 * @memberOf _
 * @since 2.4.0
 * @category Util
 * @param {*} value The value to return from the new function.
 * @returns {Function} Returns the new constant function.
 * @example
 *
 * var objects = _.times(2, _.constant({ 'a': 1 }));
 *
 * console.log(objects);
 * // => [{ 'a': 1 }, { 'a': 1 }]
 *
 * console.log(objects[0] === objects[1]);
 * // => true
 */

/**
 * Creates a function that'll short out and invoke `identity` instead
 * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
 * milliseconds.
 *
 * @private
 * @param {Function} func The function to restrict.
 * @returns {Function} Returns the new shortable function.
 */

/**
 * Creates a function which is a composition of the passed asynchronous
 * functions. Each function consumes the return value of the function that
 * follows. Composing functions `f()`, `g()`, and `h()` would produce the result
 * of `f(g(h()))`, only this version uses callbacks to obtain the return values.
 *
 * If the last argument to the composed function is not a function, a promise
 * is returned when you call it.
 *
 * Each function is executed with the `this` binding of the composed function.
 *
 * @name compose
 * @static
 * @memberOf module:ControlFlow
 * @method
 * @category Control Flow
 * @param {...AsyncFunction} functions - the asynchronous functions to compose
 * @returns {Function} an asynchronous function that is the composed
 * asynchronous `functions`
 * @example
 *
 * function add1(n, callback) {
 *     setTimeout(function () {
 *         callback(null, n + 1);
 *     }, 10);
 * }
 *
 * function mul3(n, callback) {
 *     setTimeout(function () {
 *         callback(null, n * 3);
 *     }, 10);
 * }
 *
 * var add1mul3 = async.compose(mul3, add1);
 * add1mul3(4, function (err, result) {
 *     // result now equals 15
 * });
 */

/**
 * Creates a hash object.
 *
 * @private
 * @constructor
 * @param {Array} [entries] The key-value pairs to cache.
 */

/**
 * Creates a map cache object to store key-value pairs.
 *
 * @private
 * @constructor
 * @param {Array} [entries] The key-value pairs to cache.
 */

/**
 * Creates a stack cache object to store key-value pairs.
 *
 * @private
 * @constructor
 * @param {Array} [entries] The key-value pairs to cache.
 */

/**
 * Creates a unary function that invokes `func` with its argument transformed.
 *
 * @private
 * @param {Function} func The function to wrap.
 * @param {Function} transform The argument transform.
 * @returns {Function} Returns the new function.
 */

/**
 * Creates an array of own and inherited enumerable property names and
 * symbols of `object`.
 *
 * @private
 * @param {Object} object The object to query.
 * @returns {Array} Returns the array of property names and symbols.
 */

/**
 * Creates an array of own enumerable property names and symbols of `object`.
 *
 * @private
 * @param {Object} object The object to query.
 * @returns {Array} Returns the array of property names and symbols.
 */

/**
 * Creates an array of the enumerable property names of the array-like `value`.
 *
 * @private
 * @param {*} value The value to query.
 * @param {boolean} inherited Specify returning inherited property names.
 * @returns {Array} Returns the array of property names.
 */

/**
 * Creates an array of the own and inherited enumerable property names of `object`.
 *
 * **Note:** Non-object values are coerced to objects.
 *
 * @static
 * @memberOf _
 * @since 3.0.0
 * @category Object
 * @param {Object} object The object to query.
 * @returns {Array} Returns the array of property names.
 * @example
 *
 * function Foo() {
 *   this.a = 1;
 *   this.b = 2;
 * }
 *
 * Foo.prototype.c = 3;
 *
 * _.keysIn(new Foo);
 * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
 */

/**
 * Creates an array of the own enumerable property names of `object`.
 *
 * **Note:** Non-object values are coerced to objects. See the
 * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
 * for more details.
 *
 * @static
 * @since 0.1.0
 * @memberOf _
 * @category Object
 * @param {Object} object The object to query.
 * @returns {Array} Returns the array of property names.
 * @example
 *
 * function Foo() {
 *   this.a = 1;
 *   this.b = 2;
 * }
 *
 * Foo.prototype.c = 3;
 *
 * _.keys(new Foo);
 * // => ['a', 'b'] (iteration order is not guaranteed)
 *
 * _.keys('hi');
 * // => ['0', '1']
 */

/**
 * Creates an list cache object.
 *
 * @private
 * @constructor
 * @param {Array} [entries] The key-value pairs to cache.
 */

/**
 * Determines the best order for running the {@link AsyncFunction}s in `tasks`, based on
 * their requirements. Each function can optionally depend on other functions
 * being completed first, and each function is run as soon as its requirements
 * are satisfied.
 *
 * If any of the {@link AsyncFunction}s pass an error to their callback, the `auto` sequence
 * will stop. Further tasks will not execute (so any other functions depending
 * on it will not run), and the main `callback` is immediately called with the
 * error.
 *
 * {@link AsyncFunction}s also receive an object containing the results of functions which
 * have completed so far as the first argument, if they have dependencies. If a
 * task function has no dependencies, it will only be passed a callback.
 *
 * @name auto
 * @static
 * @memberOf module:ControlFlow
 * @method
 * @category Control Flow
 * @param {Object} tasks - An object. Each of its properties is either a
 * function or an array of requirements, with the {@link AsyncFunction} itself the last item
 * in the array. The object's key of a property serves as the name of the task
 * defined by that property, i.e. can be used when specifying requirements for
 * other tasks. The function receives one or two arguments:
 * * a `results` object, containing the results of the previously executed
 *   functions, only passed if the task has any dependencies,
 * * a `callback(err, result)` function, which must be called when finished,
 *   passing an `error` (which can be `null`) and the result of the function's
 *   execution.
 * @param {number} [concurrency=Infinity] - An optional `integer` for
 * determining the maximum number of tasks that can be run in parallel. By
 * default, as many as possible.
 * @param {Function} [callback] - An optional callback which is called when all
 * the tasks have been completed. It receives the `err` argument if any `tasks`
 * pass an error to their callback. Results are always returned; however, if an
 * error occurs, no further `tasks` will be performed, and the results object
 * will only contain partial results. Invoked with (err, results).
 * @returns {Promise} a promise, if a callback is not passed
 * @example
 *
 * //Using Callbacks
 * async.auto({
 *     get_data: function(callback) {
 *         // async code to get some data
 *         callback(null, 'data', 'converted to array');
 *     },
 *     make_folder: function(callback) {
 *         // async code to create a directory to store a file in
 *         // this is run at the same time as getting the data
 *         callback(null, 'folder');
 *     },
 *     write_file: ['get_data', 'make_folder', function(results, callback) {
 *         // once there is some data and the directory exists,
 *         // write the data to a file in the directory
 *         callback(null, 'filename');
 *     }],
 *     email_link: ['write_file', function(results, callback) {
 *         // once the file is written let's email a link to it...
 *         callback(null, {'file':results.write_file, 'email':'user@example.com'});
 *     }]
 * }, function(err, results) {
 *     if (err) {
 *         console.log('err = ', err);
 *     }
 *     console.log('results = ', results);
 *     // results = {
 *     //     get_data: ['data', 'converted to array']
 *     //     make_folder; 'folder',
 *     //     write_file: 'filename'
 *     //     email_link: { file: 'filename', email: 'user@example.com' }
 *     // }
 * });
 *
 * //Using Promises
 * async.auto({
 *     get_data: function(callback) {
 *         console.log('in get_data');
 *         // async code to get some data
 *         callback(null, 'data', 'converted to array');
 *     },
 *     make_folder: function(callback) {
 *         console.log('in make_folder');
 *         // async code to create a directory to store a file in
 *         // this is run at the same time as getting the data
 *         callback(null, 'folder');
 *     },
 *     write_file: ['get_data', 'make_folder', function(results, callback) {
 *         // once there is some data and the directory exists,
 *         // write the data to a file in the directory
 *         callback(null, 'filename');
 *     }],
 *     email_link: ['write_file', function(results, callback) {
 *         // once the file is written let's email a link to it...
 *         callback(null, {'file':results.write_file, 'email':'user@example.com'});
 *     }]
 * }).then(results => {
 *     console.log('results = ', results);
 *     // results = {
 *     //     get_data: ['data', 'converted to array']
 *     //     make_folder; 'folder',
 *     //     write_file: 'filename'
 *     //     email_link: { file: 'filename', email: 'user@example.com' }
 *     // }
 * }).catch(err => {
 *     console.log('err = ', err);
 * });
 *
 * //Using async/await
 * async () => {
 *     try {
 *         let results = await async.auto({
 *             get_data: function(callback) {
 *                 // async code to get some data
 *                 callback(null, 'data', 'converted to array');
 *             },
 *             make_folder: function(callback) {
 *                 // async code to create a directory to store a file in
 *                 // this is run at the same time as getting the data
 *                 callback(null, 'folder');
 *             },
 *             write_file: ['get_data', 'make_folder', function(results, callback) {
 *                 // once there is some data and the directory exists,
 *                 // write the data to a file in the directory
 *                 callback(null, 'filename');
 *             }],
 *             email_link: ['write_file', function(results, callback) {
 *                 // once the file is written let's email a link to it...
 *                 callback(null, {'file':results.write_file, 'email':'user@example.com'});
 *             }]
 *         });
 *         console.log('results = ', results);
 *         // results = {
 *         //     get_data: ['data', 'converted to array']
 *         //     make_folder; 'folder',
 *         //     write_file: 'filename'
 *         //     email_link: { file: 'filename', email: 'user@example.com' }
 *         // }
 *     }
 *     catch (err) {
 *         console.log(err);
 *     }
 * }
 *
 */

/**
 * Flattens `array` a single level deep.
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Array
 * @param {Array} array The array to flatten.
 * @returns {Array} Returns the new flattened array.
 * @example
 *
 * _.flatten([1, [2, [3, [4]], 5]]);
 * // => [1, 2, [3, [4]], 5]
 */

/**
 * Generate a constructor for a specific Record layout.
 * 
 * @param {Array} def see {@link Ext.data.Record#create}
 * @param {Object} meta information see {@link Record}
 * 
 * <br>usage:<br>
<b>IMPORTANT: the ngettext comments are required for the translation system!</b>
<pre><code>
var TopicRecord = Record.create([
    {name: 'summary', mapping: 'topic_title'},
    {name: 'details', mapping: 'username'}
], {
    appName: 'Tasks',
    modelName: 'Task',
    idProperty: 'id',
    titleProperty: 'summary',
    // ngettext('Task', 'Tasks', n);
    recordName: 'Task',
    recordsName: 'Tasks',
    containerProperty: 'container_id',
    // ngettext('to do list', 'to do lists', n);
    containerName: 'to do list',
    containesrName: 'to do lists'
});
</code></pre>
 * @static
 */

/**
 * Generate a constructor for a specific Record layout.
 * @param {Array} o An Array of <b>{@link Ext.data.Field Field}</b> definition objects.
 * The constructor generated by this method may be used to create new Record instances. The data
 * object must contain properties named after the {@link Ext.data.Field field}
 * <b><tt>{@link Ext.data.Field#name}s</tt></b>.  Example usage:<pre><code>
// create a Record constructor from a description of the fields
var TopicRecord = Record.create([ // creates a subclass of Record
    {{@link Ext.data.Field#name name}: 'title', {@link Ext.data.Field#mapping mapping}: 'topic_title'},
    {name: 'author', mapping: 'username', allowBlank: false},
    {name: 'totalPosts', mapping: 'topic_replies', type: 'int'},
    {name: 'lastPost', mapping: 'post_time', type: 'date'},
    {name: 'lastPoster', mapping: 'user2'},
    {name: 'excerpt', mapping: 'post_text', allowBlank: false},
    // In the simplest case, if no properties other than <tt>name</tt> are required,
    // a field definition may consist of just a String for the field name.
    'signature'
]);

// create Record instance
var myNewRecord = new TopicRecord(
    {
        title: 'Do my job please',
        author: 'noobie',
        totalPosts: 1,
        lastPost: new Date(),
        lastPoster: 'Animal',
        excerpt: 'No way dude!',
        signature: ''
    },
    id // optionally specify the id of the record otherwise {@link #Record.id one is auto-assigned}
);
myStore.{@link Ext.data.Store#add add}(myNewRecord);
</code></pre>
 * @method create
 * @return {function} A constructor which is used to create new Records according
 * to the definition. The constructor has the same signature as {@link #Record}.
 * @static
 */

/**
 * Generates a sequential id. This method is typically called when a record is {@link #create}d
 * and {@link #Record no id has been specified}. The returned id takes the form:
 * <tt>&#123;PREFIX}-&#123;AUTO_ID}</tt>.<div class="mdetail-params"><ul>
 * <li><b><tt>PREFIX</tt></b> : String<p class="sub-desc"><tt>Record.PREFIX</tt>
 * (defaults to <tt>'ext-record'</tt>)</p></li>
 * <li><b><tt>AUTO_ID</tt></b> : String<p class="sub-desc"><tt>Record.AUTO_ID</tt>
 * (defaults to <tt>1</tt> initially)</p></li>
 * </ul></div>
 * @param {Record} rec The record being created.  The record does not exist, it's a {@link #phantom}.
 * @return {String} auto-generated string id, <tt>"ext-record-i++'</tt>;
 */

/**
 * Gets the data for `map`.
 *
 * @private
 * @param {Object} map The map to query.
 * @param {string} key The reference key.
 * @returns {*} Returns the map data.
 */

/**
 * Gets the hash value for `key`.
 *
 * @private
 * @name get
 * @memberOf Hash
 * @param {string} key The key of the value to get.
 * @returns {*} Returns the entry value.
 */

/**
 * Gets the index at which the `key` is found in `array` of key-value pairs.
 *
 * @private
 * @param {Array} array The array to inspect.
 * @param {*} key The key to search for.
 * @returns {number} Returns the index of the matched value, else `-1`.
 */

/**
 * Gets the last element of `array`.
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Array
 * @param {Array} array The array to query.
 * @returns {*} Returns the last element of `array`.
 * @example
 *
 * _.last([1, 2, 3]);
 * // => 3
 */

/**
 * Gets the list cache value for `key`.
 *
 * @private
 * @name get
 * @memberOf ListCache
 * @param {string} key The key of the value to get.
 * @returns {*} Returns the entry value.
 */

/**
 * Gets the map value for `key`.
 *
 * @private
 * @name get
 * @memberOf MapCache
 * @param {string} key The key of the value to get.
 * @returns {*} Returns the entry value.
 */

/**
 * Gets the native function at `key` of `object`.
 *
 * @private
 * @param {Object} object The object to query.
 * @param {string} key The key of the method to get.
 * @returns {*} Returns the function if it's native, else `undefined`.
 */

/**
 * Gets the parent value at `path` of `object`.
 *
 * @private
 * @param {Object} object The object to query.
 * @param {Array} path The path to get the parent value of.
 * @returns {*} Returns the parent value.
 */

/**
 * Gets the stack value for `key`.
 *
 * @private
 * @name get
 * @memberOf Stack
 * @param {string} key The key of the value to get.
 * @returns {*} Returns the entry value.
 */

/**
 * Gets the value at `key` of `object`.
 *
 * @private
 * @param {Object} [object] The object to query.
 * @param {string} key The key of the property to get.
 * @returns {*} Returns the property value.
 */

/**
 * Initializes an array clone.
 *
 * @private
 * @param {Array} array The array to clone.
 * @returns {Array} Returns the initialized clone.
 */

/**
 * Initializes an object clone based on its `toStringTag`.
 *
 * **Note:** This function only supports cloning values with tags of
 * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
 *
 * @private
 * @param {Object} object The object to clone.
 * @param {string} tag The `toStringTag` of the object to clone.
 * @param {boolean} [isDeep] Specify a deep clone.
 * @returns {Object} Returns the initialized clone.
 */

/**
 * Initializes an object clone.
 *
 * @private
 * @param {Object} object The object to clone.
 * @returns {Object} Returns the initialized clone.
 */

/**
 * It runs each task in series but stops whenever any of the functions were
 * successful. If one of the tasks were successful, the `callback` will be
 * passed the result of the successful task. If all tasks fail, the callback
 * will be passed the error and result (if any) of the final attempt.
 *
 * @name tryEach
 * @static
 * @memberOf module:ControlFlow
 * @method
 * @category Control Flow
 * @param {Array|Iterable|AsyncIterable|Object} tasks - A collection containing functions to
 * run, each function is passed a `callback(err, result)` it must call on
 * completion with an error `err` (which can be `null`) and an optional `result`
 * value.
 * @param {Function} [callback] - An optional callback which is called when one
 * of the tasks has succeeded, or all have failed. It receives the `err` and
 * `result` arguments of the last attempt at completing the `task`. Invoked with
 * (err, results).
 * @returns {Promise} a promise, if no callback is passed
 * @example
 * async.tryEach([
 *     function getDataFromFirstWebsite(callback) {
 *         // Try getting the data from the first website
 *         callback(err, data);
 *     },
 *     function getDataFromSecondWebsite(callback) {
 *         // First website failed,
 *         // Try getting the data from the backup website
 *         callback(err, data);
 *     }
 * ],
 * // optional callback
 * function(err, results) {
 *     Now do something with the data.
 * });
 *
 */

/**
 * Like ['doWhilst']{@link module:ControlFlow.doWhilst}, except the `test` is inverted. Note the
 * argument ordering differs from `until`.
 *
 * @name doUntil
 * @static
 * @memberOf module:ControlFlow
 * @method
 * @see [async.doWhilst]{@link module:ControlFlow.doWhilst}
 * @category Control Flow
 * @param {AsyncFunction} iteratee - An async function which is called each time
 * `test` fails. Invoked with (callback).
 * @param {AsyncFunction} test - asynchronous truth test to perform after each
 * execution of `iteratee`. Invoked with (...args, callback), where `...args` are the
 * non-error args from the previous callback of `iteratee`
 * @param {Function} [callback] - A callback which is called after the test
 * function has passed and repeated execution of `iteratee` has stopped. `callback`
 * will be passed an error and any arguments passed to the final `iteratee`'s
 * callback. Invoked with (err, [results]);
 * @returns {Promise} a promise, if no callback is passed
 */

/**
 * Like [`each`]{@link module:Collections.each}, except that it passes the key (or index) as the second argument
 * to the iteratee.
 *
 * @name eachOf
 * @static
 * @memberOf module:Collections
 * @method
 * @alias forEachOf
 * @category Collection
 * @see [async.each]{@link module:Collections.each}
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {AsyncFunction} iteratee - A function to apply to each
 * item in `coll`.
 * The `key` is the item's key, or index in the case of an array.
 * Invoked with (item, key, callback).
 * @param {Function} [callback] - A callback which is called when all
 * `iteratee` functions have finished, or an error occurs. Invoked with (err).
 * @returns {Promise} a promise, if a callback is omitted
 * @example
 *
 * // dev.json is a file containing a valid json object config for dev environment
 * // dev.json is a file containing a valid json object config for test environment
 * // prod.json is a file containing a valid json object config for prod environment
 * // invalid.json is a file with a malformed json object
 *
 * let configs = {}; //global variable
 * let validConfigFileMap = {dev: 'dev.json', test: 'test.json', prod: 'prod.json'};
 * let invalidConfigFileMap = {dev: 'dev.json', test: 'test.json', invalid: 'invalid.json'};
 *
 * // asynchronous function that reads a json file and parses the contents as json object
 * function parseFile(file, key, callback) {
 *     fs.readFile(file, "utf8", function(err, data) {
 *         if (err) return calback(err);
 *         try {
 *             configs[key] = JSON.parse(data);
 *         } catch (e) {
 *             return callback(e);
 *         }
 *         callback();
 *     });
 * }
 *
 * // Using callbacks
 * async.forEachOf(validConfigFileMap, parseFile, function (err) {
 *     if (err) {
 *         console.error(err);
 *     } else {
 *         console.log(configs);
 *         // configs is now a map of JSON data, e.g.
 *         // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json}
 *     }
 * });
 *
 * //Error handing
 * async.forEachOf(invalidConfigFileMap, parseFile, function (err) {
 *     if (err) {
 *         console.error(err);
 *         // JSON parse error exception
 *     } else {
 *         console.log(configs);
 *     }
 * });
 *
 * // Using Promises
 * async.forEachOf(validConfigFileMap, parseFile)
 * .then( () => {
 *     console.log(configs);
 *     // configs is now a map of JSON data, e.g.
 *     // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json}
 * }).catch( err => {
 *     console.error(err);
 * });
 *
 * //Error handing
 * async.forEachOf(invalidConfigFileMap, parseFile)
 * .then( () => {
 *     console.log(configs);
 * }).catch( err => {
 *     console.error(err);
 *     // JSON parse error exception
 * });
 *
 * // Using async/await
 * async () => {
 *     try {
 *         let result = await async.forEachOf(validConfigFileMap, parseFile);
 *         console.log(configs);
 *         // configs is now a map of JSON data, e.g.
 *         // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json}
 *     }
 *     catch (err) {
 *         console.log(err);
 *     }
 * }
 *
 * //Error handing
 * async () => {
 *     try {
 *         let result = await async.forEachOf(invalidConfigFileMap, parseFile);
 *         console.log(configs);
 *     }
 *     catch (err) {
 *         console.log(err);
 *         // JSON parse error exception
 *     }
 * }
 *
 */

/**
 * Logs the result of an [`async` function]{@link AsyncFunction} to the
 * `console` using `console.dir` to display the properties of the resulting object.
 * Only works in Node.js or in browsers that support `console.dir` and
 * `console.error` (such as FF and Chrome).
 * If multiple arguments are returned from the async function,
 * `console.dir` is called on each argument in order.
 *
 * @name dir
 * @static
 * @memberOf module:Utils
 * @method
 * @category Util
 * @param {AsyncFunction} function - The function you want to eventually apply
 * all arguments to.
 * @param {...*} arguments... - Any number of arguments to apply to the function.
 * @example
 *
 * // in a module
 * var hello = function(name, callback) {
 *     setTimeout(function() {
 *         callback(null, {hello: name});
 *     }, 1000);
 * };
 *
 * // in the node repl
 * node> async.dir(hello, 'world');
 * {hello: 'world'}
 */

/**
 * Logs the result of an `async` function to the `console`. Only works in
 * Node.js or in browsers that support `console.log` and `console.error` (such
 * as FF and Chrome). If multiple arguments are returned from the async
 * function, `console.log` is called on each argument in order.
 *
 * @name log
 * @static
 * @memberOf module:Utils
 * @method
 * @category Util
 * @param {AsyncFunction} function - The function you want to eventually apply
 * all arguments to.
 * @param {...*} arguments... - Any number of arguments to apply to the function.
 * @example
 *
 * // in a module
 * var hello = function(name, callback) {
 *     setTimeout(function() {
 *         callback(null, 'hello ' + name);
 *     }, 1000);
 * };
 *
 * // in the node repl
 * node> async.log(hello, 'world');
 * 'hello world'
 */

/**
 * Namespace alloted for extensions to the framework.
 * @property ux
 * @type Object
 */

/**
 * Performs a
 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
 * comparison between two values to determine if they are equivalent.
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to compare.
 * @param {*} other The other value to compare.
 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
 * @example
 *
 * var object = { 'a': 1 };
 * var other = { 'a': 1 };
 *
 * _.eq(object, object);
 * // => true
 *
 * _.eq(object, other);
 * // => false
 *
 * _.eq('a', 'a');
 * // => true
 *
 * _.eq('a', Object('a'));
 * // => false
 *
 * _.eq(NaN, NaN);
 * // => true
 */

/**
 * Produces a new collection of values by mapping each value in `coll` through
 * the `iteratee` function. The `iteratee` is called with an item from `coll`
 * and a callback for when it has finished processing. Each of these callbacks
 * takes 2 arguments: an `error`, and the transformed item from `coll`. If
 * `iteratee` passes an error to its callback, the main `callback` (for the
 * `map` function) is immediately called with the error.
 *
 * Note, that since this function applies the `iteratee` to each item in
 * parallel, there is no guarantee that the `iteratee` functions will complete
 * in order. However, the results array will be in the same order as the
 * original `coll`.
 *
 * If `map` is passed an Object, the results will be an Array.  The results
 * will roughly be in the order of the original Objects' keys (but this can
 * vary across JavaScript engines).
 *
 * @name map
 * @static
 * @memberOf module:Collections
 * @method
 * @category Collection
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {AsyncFunction} iteratee - An async function to apply to each item in
 * `coll`.
 * The iteratee should complete with the transformed item.
 * Invoked with (item, callback).
 * @param {Function} [callback] - A callback which is called when all `iteratee`
 * functions have finished, or an error occurs. Results is an Array of the
 * transformed items from the `coll`. Invoked with (err, results).
 * @returns {Promise} a promise, if no callback is passed
 * @example
 *
 * // file1.txt is a file that is 1000 bytes in size
 * // file2.txt is a file that is 2000 bytes in size
 * // file3.txt is a file that is 3000 bytes in size
 * // file4.txt does not exist
 *
 * const fileList = ['file1.txt','file2.txt','file3.txt'];
 * const withMissingFileList = ['file1.txt','file2.txt','file4.txt'];
 *
 * // asynchronous function that returns the file size in bytes
 * function getFileSizeInBytes(file, callback) {
 *     fs.stat(file, function(err, stat) {
 *         if (err) {
 *             return callback(err);
 *         }
 *         callback(null, stat.size);
 *     });
 * }
 *
 * // Using callbacks
 * async.map(fileList, getFileSizeInBytes, function(err, results) {
 *     if (err) {
 *         console.log(err);
 *     } else {
 *         console.log(results);
 *         // results is now an array of the file size in bytes for each file, e.g.
 *         // [ 1000, 2000, 3000]
 *     }
 * });
 *
 * // Error Handling
 * async.map(withMissingFileList, getFileSizeInBytes, function(err, results) {
 *     if (err) {
 *         console.log(err);
 *         // [ Error: ENOENT: no such file or directory ]
 *     } else {
 *         console.log(results);
 *     }
 * });
 *
 * // Using Promises
 * async.map(fileList, getFileSizeInBytes)
 * .then( results => {
 *     console.log(results);
 *     // results is now an array of the file size in bytes for each file, e.g.
 *     // [ 1000, 2000, 3000]
 * }).catch( err => {
 *     console.log(err);
 * });
 *
 * // Error Handling
 * async.map(withMissingFileList, getFileSizeInBytes)
 * .then( results => {
 *     console.log(results);
 * }).catch( err => {
 *     console.log(err);
 *     // [ Error: ENOENT: no such file or directory ]
 * });
 *
 * // Using async/await
 * async () => {
 *     try {
 *         let results = await async.map(fileList, getFileSizeInBytes);
 *         console.log(results);
 *         // results is now an array of the file size in bytes for each file, e.g.
 *         // [ 1000, 2000, 3000]
 *     }
 *     catch (err) {
 *         console.log(err);
 *     }
 * }
 *
 * // Error Handling
 * async () => {
 *     try {
 *         let results = await async.map(withMissingFileList, getFileSizeInBytes);
 *         console.log(results);
 *     }
 *     catch (err) {
 *         console.log(err);
 *         // [ Error: ENOENT: no such file or directory ]
 *     }
 * }
 *
 */

/**
 * Reduces `coll` into a single value using an async `iteratee` to return each
 * successive step. `memo` is the initial state of the reduction. This function
 * only operates in series.
 *
 * For performance reasons, it may make sense to split a call to this function
 * into a parallel map, and then use the normal `Array.prototype.reduce` on the
 * results. This function is for situations where each step in the reduction
 * needs to be async; if you can get the data before reducing it, then it's
 * probably a good idea to do so.
 *
 * @name reduce
 * @static
 * @memberOf module:Collections
 * @method
 * @alias inject
 * @alias foldl
 * @category Collection
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {*} memo - The initial state of the reduction.
 * @param {AsyncFunction} iteratee - A function applied to each item in the
 * array to produce the next step in the reduction.
 * The `iteratee` should complete with the next state of the reduction.
 * If the iteratee completes with an error, the reduction is stopped and the
 * main `callback` is immediately called with the error.
 * Invoked with (memo, item, callback).
 * @param {Function} [callback] - A callback which is called after all the
 * `iteratee` functions have finished. Result is the reduced value. Invoked with
 * (err, result).
 * @returns {Promise} a promise, if no callback is passed
 * @example
 *
 * // file1.txt is a file that is 1000 bytes in size
 * // file2.txt is a file that is 2000 bytes in size
 * // file3.txt is a file that is 3000 bytes in size
 * // file4.txt does not exist
 *
 * const fileList = ['file1.txt','file2.txt','file3.txt'];
 * const withMissingFileList = ['file1.txt','file2.txt','file3.txt', 'file4.txt'];
 *
 * // asynchronous function that computes the file size in bytes
 * // file size is added to the memoized value, then returned
 * function getFileSizeInBytes(memo, file, callback) {
 *     fs.stat(file, function(err, stat) {
 *         if (err) {
 *             return callback(err);
 *         }
 *         callback(null, memo + stat.size);
 *     });
 * }
 *
 * // Using callbacks
 * async.reduce(fileList, 0, getFileSizeInBytes, function(err, result) {
 *     if (err) {
 *         console.log(err);
 *     } else {
 *         console.log(result);
 *         // 6000
 *         // which is the sum of the file sizes of the three files
 *     }
 * });
 *
 * // Error Handling
 * async.reduce(withMissingFileList, 0, getFileSizeInBytes, function(err, result) {
 *     if (err) {
 *         console.log(err);
 *         // [ Error: ENOENT: no such file or directory ]
 *     } else {
 *         console.log(result);
 *     }
 * });
 *
 * // Using Promises
 * async.reduce(fileList, 0, getFileSizeInBytes)
 * .then( result => {
 *     console.log(result);
 *     // 6000
 *     // which is the sum of the file sizes of the three files
 * }).catch( err => {
 *     console.log(err);
 * });
 *
 * // Error Handling
 * async.reduce(withMissingFileList, 0, getFileSizeInBytes)
 * .then( result => {
 *     console.log(result);
 * }).catch( err => {
 *     console.log(err);
 *     // [ Error: ENOENT: no such file or directory ]
 * });
 *
 * // Using async/await
 * async () => {
 *     try {
 *         let result = await async.reduce(fileList, 0, getFileSizeInBytes);
 *         console.log(result);
 *         // 6000
 *         // which is the sum of the file sizes of the three files
 *     }
 *     catch (err) {
 *         console.log(err);
 *     }
 * }
 *
 * // Error Handling
 * async () => {
 *     try {
 *         let result = await async.reduce(withMissingFileList, 0, getFileSizeInBytes);
 *         console.log(result);
 *     }
 *     catch (err) {
 *         console.log(err);
 *         // [ Error: ENOENT: no such file or directory ]
 *     }
 * }
 *
 */

/**
 * Removes <b>all</b> added captures from the Observable.
 * @param {Observable} o The Observable to release
 * @static
 */

/**
 * Removes `key` and its value from the hash.
 *
 * @private
 * @name delete
 * @memberOf Hash
 * @param {Object} hash The hash to modify.
 * @param {string} key The key of the value to remove.
 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
 */

/**
 * Removes `key` and its value from the list cache.
 *
 * @private
 * @name delete
 * @memberOf ListCache
 * @param {string} key The key of the value to remove.
 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
 */

/**
 * Removes `key` and its value from the map.
 *
 * @private
 * @name delete
 * @memberOf MapCache
 * @param {string} key The key of the value to remove.
 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
 */

/**
 * Removes `key` and its value from the stack.
 *
 * @private
 * @name delete
 * @memberOf Stack
 * @param {string} key The key of the value to remove.
 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
 */

/**
 * Removes all key-value entries from the hash.
 *
 * @private
 * @name clear
 * @memberOf Hash
 */

/**
 * Removes all key-value entries from the list cache.
 *
 * @private
 * @name clear
 * @memberOf ListCache
 */

/**
 * Removes all key-value entries from the map.
 *
 * @private
 * @name clear
 * @memberOf MapCache
 */

/**
 * Removes all key-value entries from the stack.
 *
 * @private
 * @name clear
 * @memberOf Stack
 */

/**
 * Removes an event handler (shorthand for {@link #removeListener}.)
 * @param {String}   eventName     The type of event the handler was associated with.
 * @param {Function} handler       The handler to remove. <b>This must be a reference to the function passed into the {@link #addListener} call.</b>
 * @param {Object}   scope         (optional) The scope originally specified for the handler.
 * @method
 */

/**
 * Repeatedly call `iteratee` until `test` returns `true`. Calls `callback` when
 * stopped, or an error occurs. `callback` will be passed an error and any
 * arguments passed to the final `iteratee`'s callback.
 *
 * The inverse of [whilst]{@link module:ControlFlow.whilst}.
 *
 * @name until
 * @static
 * @memberOf module:ControlFlow
 * @method
 * @see [async.whilst]{@link module:ControlFlow.whilst}
 * @category Control Flow
 * @param {AsyncFunction} test - asynchronous truth test to perform before each
 * execution of `iteratee`. Invoked with (callback).
 * @param {AsyncFunction} iteratee - An async function which is called each time
 * `test` fails. Invoked with (callback).
 * @param {Function} [callback] - A callback which is called after the test
 * function has passed and repeated execution of `iteratee` has stopped. `callback`
 * will be passed an error and any arguments passed to the final `iteratee`'s
 * callback. Invoked with (err, [results]);
 * @returns {Promise} a promise, if a callback is not passed
 *
 * @example
 * const results = []
 * let finished = false
 * async.until(function test(cb) {
 *     cb(null, finished)
 * }, function iter(next) {
 *     fetchPage(url, (err, body) => {
 *         if (err) return next(err)
 *         results = results.concat(body.objects)
 *         finished = !!body.next
 *         next(err)
 *     })
 * }, function done (err) {
 *     // all pages have been fetched
 * })
 */

/**
 * Repeatedly call `iteratee`, while `test` returns `true`. Calls `callback` when
 * stopped, or an error occurs.
 *
 * @name whilst
 * @static
 * @memberOf module:ControlFlow
 * @method
 * @category Control Flow
 * @param {AsyncFunction} test - asynchronous truth test to perform before each
 * execution of `iteratee`. Invoked with ().
 * @param {AsyncFunction} iteratee - An async function which is called each time
 * `test` passes. Invoked with (callback).
 * @param {Function} [callback] - A callback which is called after the test
 * function has failed and repeated execution of `iteratee` has stopped. `callback`
 * will be passed an error and any arguments passed to the final `iteratee`'s
 * callback. Invoked with (err, [results]);
 * @returns {Promise} a promise, if no callback is passed
 * @example
 *
 * var count = 0;
 * async.whilst(
 *     function test(cb) { cb(null, count < 5); },
 *     function iter(callback) {
 *         count++;
 *         setTimeout(function() {
 *             callback(null, count);
 *         }, 1000);
 *     },
 *     function (err, n) {
 *         // 5 seconds have passed, n = 5
 *     }
 * );
 */

/**
 * Returns `true` if at least one element in the `coll` satisfies an async test.
 * If any iteratee call returns `true`, the main `callback` is immediately
 * called.
 *
 * @name some
 * @static
 * @memberOf module:Collections
 * @method
 * @alias any
 * @category Collection
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {AsyncFunction} iteratee - An async truth test to apply to each item
 * in the collections in parallel.
 * The iteratee should complete with a boolean `result` value.
 * Invoked with (item, callback).
 * @param {Function} [callback] - A callback which is called as soon as any
 * iteratee returns `true`, or after all the iteratee functions have finished.
 * Result will be either `true` or `false` depending on the values of the async
 * tests. Invoked with (err, result).
 * @returns {Promise} a promise, if no callback provided
 * @example
 *
 * // dir1 is a directory that contains file1.txt, file2.txt
 * // dir2 is a directory that contains file3.txt, file4.txt
 * // dir3 is a directory that contains file5.txt
 * // dir4 does not exist
 *
 * // asynchronous function that checks if a file exists
 * function fileExists(file, callback) {
 *    fs.access(file, fs.constants.F_OK, (err) => {
 *        callback(null, !err);
 *    });
 * }
 *
 * // Using callbacks
 * async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists,
 *    function(err, result) {
 *        console.log(result);
 *        // true
 *        // result is true since some file in the list exists
 *    }
 *);
 *
 * async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists,
 *    function(err, result) {
 *        console.log(result);
 *        // false
 *        // result is false since none of the files exists
 *    }
 *);
 *
 * // Using Promises
 * async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists)
 * .then( result => {
 *     console.log(result);
 *     // true
 *     // result is true since some file in the list exists
 * }).catch( err => {
 *     console.log(err);
 * });
 *
 * async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists)
 * .then( result => {
 *     console.log(result);
 *     // false
 *     // result is false since none of the files exists
 * }).catch( err => {
 *     console.log(err);
 * });
 *
 * // Using async/await
 * async () => {
 *     try {
 *         let result = await async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists);
 *         console.log(result);
 *         // true
 *         // result is true since some file in the list exists
 *     }
 *     catch (err) {
 *         console.log(err);
 *     }
 * }
 *
 * async () => {
 *     try {
 *         let result = await async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists);
 *         console.log(result);
 *         // false
 *         // result is false since none of the files exists
 *     }
 *     catch (err) {
 *         console.log(err);
 *     }
 * }
 *
 */

/**
 * Returns `true` if every element in `coll` satisfies an async test. If any
 * iteratee call returns `false`, the main `callback` is immediately called.
 *
 * @name every
 * @static
 * @memberOf module:Collections
 * @method
 * @alias all
 * @category Collection
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {AsyncFunction} iteratee - An async truth test to apply to each item
 * in the collection in parallel.
 * The iteratee must complete with a boolean result value.
 * Invoked with (item, callback).
 * @param {Function} [callback] - A callback which is called after all the
 * `iteratee` functions have finished. Result will be either `true` or `false`
 * depending on the values of the async tests. Invoked with (err, result).
 * @returns {Promise} a promise, if no callback provided
 * @example
 *
 * // dir1 is a directory that contains file1.txt, file2.txt
 * // dir2 is a directory that contains file3.txt, file4.txt
 * // dir3 is a directory that contains file5.txt
 * // dir4 does not exist
 *
 * const fileList = ['dir1/file1.txt','dir2/file3.txt','dir3/file5.txt'];
 * const withMissingFileList = ['file1.txt','file2.txt','file4.txt'];
 *
 * // asynchronous function that checks if a file exists
 * function fileExists(file, callback) {
 *    fs.access(file, fs.constants.F_OK, (err) => {
 *        callback(null, !err);
 *    });
 * }
 *
 * // Using callbacks
 * async.every(fileList, fileExists, function(err, result) {
 *     console.log(result);
 *     // true
 *     // result is true since every file exists
 * });
 *
 * async.every(withMissingFileList, fileExists, function(err, result) {
 *     console.log(result);
 *     // false
 *     // result is false since NOT every file exists
 * });
 *
 * // Using Promises
 * async.every(fileList, fileExists)
 * .then( result => {
 *     console.log(result);
 *     // true
 *     // result is true since every file exists
 * }).catch( err => {
 *     console.log(err);
 * });
 *
 * async.every(withMissingFileList, fileExists)
 * .then( result => {
 *     console.log(result);
 *     // false
 *     // result is false since NOT every file exists
 * }).catch( err => {
 *     console.log(err);
 * });
 *
 * // Using async/await
 * async () => {
 *     try {
 *         let result = await async.every(fileList, fileExists);
 *         console.log(result);
 *         // true
 *         // result is true since every file exists
 *     }
 *     catch (err) {
 *         console.log(err);
 *     }
 * }
 *
 * async () => {
 *     try {
 *         let result = await async.every(withMissingFileList, fileExists);
 *         console.log(result);
 *         // false
 *         // result is false since NOT every file exists
 *     }
 *     catch (err) {
 *         console.log(err);
 *     }
 * }
 *
 */

/**
 * Returns a function that when called, calls-back with the values provided.
 * Useful as the first function in a [`waterfall`]{@link module:ControlFlow.waterfall}, or for plugging values in to
 * [`auto`]{@link module:ControlFlow.auto}.
 *
 * @name constant
 * @static
 * @memberOf module:Utils
 * @method
 * @category Util
 * @param {...*} arguments... - Any number of arguments to automatically invoke
 * callback with.
 * @returns {AsyncFunction} Returns a function that when invoked, automatically
 * invokes the callback with the previous given arguments.
 * @example
 *
 * async.waterfall([
 *     async.constant(42),
 *     function (value, next) {
 *         // value === 42
 *     },
 *     //...
 * ], callback);
 *
 * async.waterfall([
 *     async.constant(filename, "utf8"),
 *     fs.readFile,
 *     function (fileData, next) {
 *         //...
 *     }
 *     //...
 * ], callback);
 *
 * async.auto({
 *     hostname: async.constant("https://server.net/"),
 *     port: findFreePort,
 *     launchServer: ["hostname", "port", function (options, cb) {
 *         startServer(options, cb);
 *     }],
 *     //...
 * }, callback);
 */

/**
 * Returns a new array of all the values in `coll` which pass an async truth
 * test. This operation is performed in parallel, but the results array will be
 * in the same order as the original.
 *
 * @name filter
 * @static
 * @memberOf module:Collections
 * @method
 * @alias select
 * @category Collection
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {Function} iteratee - A truth test to apply to each item in `coll`.
 * The `iteratee` is passed a `callback(err, truthValue)`, which must be called
 * with a boolean argument once it has completed. Invoked with (item, callback).
 * @param {Function} [callback] - A callback which is called after all the
 * `iteratee` functions have finished. Invoked with (err, results).
 * @returns {Promise} a promise, if no callback provided
 * @example
 *
 * // dir1 is a directory that contains file1.txt, file2.txt
 * // dir2 is a directory that contains file3.txt, file4.txt
 * // dir3 is a directory that contains file5.txt
 *
 * const files = ['dir1/file1.txt','dir2/file3.txt','dir3/file6.txt'];
 *
 * // asynchronous function that checks if a file exists
 * function fileExists(file, callback) {
 *    fs.access(file, fs.constants.F_OK, (err) => {
 *        callback(null, !err);
 *    });
 * }
 *
 * // Using callbacks
 * async.filter(files, fileExists, function(err, results) {
 *    if(err) {
 *        console.log(err);
 *    } else {
 *        console.log(results);
 *        // [ 'dir1/file1.txt', 'dir2/file3.txt' ]
 *        // results is now an array of the existing files
 *    }
 * });
 *
 * // Using Promises
 * async.filter(files, fileExists)
 * .then(results => {
 *     console.log(results);
 *     // [ 'dir1/file1.txt', 'dir2/file3.txt' ]
 *     // results is now an array of the existing files
 * }).catch(err => {
 *     console.log(err);
 * });
 *
 * // Using async/await
 * async () => {
 *     try {
 *         let results = await async.filter(files, fileExists);
 *         console.log(results);
 *         // [ 'dir1/file1.txt', 'dir2/file3.txt' ]
 *         // results is now an array of the existing files
 *     }
 *     catch (err) {
 *         console.log(err);
 *     }
 * }
 *
 */

/**
 * Returns a new object, where each value corresponds to an array of items, from
 * `coll`, that returned the corresponding key. That is, the keys of the object
 * correspond to the values passed to the `iteratee` callback.
 *
 * Note: Since this function applies the `iteratee` to each item in parallel,
 * there is no guarantee that the `iteratee` functions will complete in order.
 * However, the values for each key in the `result` will be in the same order as
 * the original `coll`. For Objects, the values will roughly be in the order of
 * the original Objects' keys (but this can vary across JavaScript engines).
 *
 * @name groupBy
 * @static
 * @memberOf module:Collections
 * @method
 * @category Collection
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {AsyncFunction} iteratee - An async function to apply to each item in
 * `coll`.
 * The iteratee should complete with a `key` to group the value under.
 * Invoked with (value, callback).
 * @param {Function} [callback] - A callback which is called when all `iteratee`
 * functions have finished, or an error occurs. Result is an `Object` whoses
 * properties are arrays of values which returned the corresponding key.
 * @returns {Promise} a promise, if no callback is passed
 * @example
 *
 * // dir1 is a directory that contains file1.txt, file2.txt
 * // dir2 is a directory that contains file3.txt, file4.txt
 * // dir3 is a directory that contains file5.txt
 * // dir4 does not exist
 *
 * const files = ['dir1/file1.txt','dir2','dir4']
 *
 * // asynchronous function that detects file type as none, file, or directory
 * function detectFile(file, callback) {
 *     fs.stat(file, function(err, stat) {
 *         if (err) {
 *             return callback(null, 'none');
 *         }
 *         callback(null, stat.isDirectory() ? 'directory' : 'file');
 *     });
 * }
 *
 * //Using callbacks
 * async.groupBy(files, detectFile, function(err, result) {
 *     if(err) {
 *         console.log(err);
 *     } else {
 *	       console.log(result);
 *         // {
 *         //     file: [ 'dir1/file1.txt' ],
 *         //     none: [ 'dir4' ],
 *         //     directory: [ 'dir2']
 *         // }
 *         // result is object containing the files grouped by type
 *     }
 * });
 *
 * // Using Promises
 * async.groupBy(files, detectFile)
 * .then( result => {
 *     console.log(result);
 *     // {
 *     //     file: [ 'dir1/file1.txt' ],
 *     //     none: [ 'dir4' ],
 *     //     directory: [ 'dir2']
 *     // }
 *     // result is object containing the files grouped by type
 * }).catch( err => {
 *     console.log(err);
 * });
 *
 * // Using async/await
 * async () => {
 *     try {
 *         let result = await async.groupBy(files, detectFile);
 *         console.log(result);
 *         // {
 *         //     file: [ 'dir1/file1.txt' ],
 *         //     none: [ 'dir4' ],
 *         //     directory: [ 'dir2']
 *         // }
 *         // result is object containing the files grouped by type
 *     }
 *     catch (err) {
 *         console.log(err);
 *     }
 * }
 *
 */

/**
 * Returns the first value in `coll` that passes an async truth test. The
 * `iteratee` is applied in parallel, meaning the first iteratee to return
 * `true` will fire the detect `callback` with that result. That means the
 * result might not be the first item in the original `coll` (in terms of order)
 * that passes the test.

 * If order within the original `coll` is important, then look at
 * [`detectSeries`]{@link module:Collections.detectSeries}.
 *
 * @name detect
 * @static
 * @memberOf module:Collections
 * @method
 * @alias find
 * @category Collections
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
 * The iteratee must complete with a boolean value as its result.
 * Invoked with (item, callback).
 * @param {Function} [callback] - A callback which is called as soon as any
 * iteratee returns `true`, or after all the `iteratee` functions have finished.
 * Result will be the first item in the array that passes the truth test
 * (iteratee) or the value `undefined` if none passed. Invoked with
 * (err, result).
 * @returns {Promise} a promise, if a callback is omitted
 * @example
 *
 * // dir1 is a directory that contains file1.txt, file2.txt
 * // dir2 is a directory that contains file3.txt, file4.txt
 * // dir3 is a directory that contains file5.txt
 *
 * // asynchronous function that checks if a file exists
 * function fileExists(file, callback) {
 *    fs.access(file, fs.constants.F_OK, (err) => {
 *        callback(null, !err);
 *    });
 * }
 *
 * async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists,
 *    function(err, result) {
 *        console.log(result);
 *        // dir1/file1.txt
 *        // result now equals the first file in the list that exists
 *    }
 *);
 *
 * // Using Promises
 * async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists)
 * .then(result => {
 *     console.log(result);
 *     // dir1/file1.txt
 *     // result now equals the first file in the list that exists
 * }).catch(err => {
 *     console.log(err);
 * });
 *
 * // Using async/await
 * async () => {
 *     try {
 *         let result = await async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists);
 *         console.log(result);
 *         // dir1/file1.txt
 *         // result now equals the file in the list that exists
 *     }
 *     catch (err) {
 *         console.log(err);
 *     }
 * }
 *
 */

/**
 * Run the `tasks` collection of functions in parallel, without waiting until
 * the previous function has completed. If any of the functions pass an error to
 * its callback, the main `callback` is immediately called with the value of the
 * error. Once the `tasks` have completed, the results are passed to the final
 * `callback` as an array.
 *
 * **Note:** `parallel` is about kicking-off I/O tasks in parallel, not about
 * parallel execution of code.  If your tasks do not use any timers or perform
 * any I/O, they will actually be executed in series.  Any synchronous setup
 * sections for each task will happen one after the other.  JavaScript remains
 * single-threaded.
 *
 * **Hint:** Use [`reflect`]{@link module:Utils.reflect} to continue the
 * execution of other tasks when a task fails.
 *
 * It is also possible to use an object instead of an array. Each property will
 * be run as a function and the results will be passed to the final `callback`
 * as an object instead of an array. This can be a more readable way of handling
 * results from {@link async.parallel}.
 *
 * @name parallel
 * @static
 * @memberOf module:ControlFlow
 * @method
 * @category Control Flow
 * @param {Array|Iterable|AsyncIterable|Object} tasks - A collection of
 * [async functions]{@link AsyncFunction} to run.
 * Each async function can complete with any number of optional `result` values.
 * @param {Function} [callback] - An optional callback to run once all the
 * functions have completed successfully. This function gets a results array
 * (or object) containing all the result arguments passed to the task callbacks.
 * Invoked with (err, results).
 * @returns {Promise} a promise, if a callback is not passed
 *
 * @example
 *
 * //Using Callbacks
 * async.parallel([
 *     function(callback) {
 *         setTimeout(function() {
 *             callback(null, 'one');
 *         }, 200);
 *     },
 *     function(callback) {
 *         setTimeout(function() {
 *             callback(null, 'two');
 *         }, 100);
 *     }
 * ], function(err, results) {
 *     console.log(results);
 *     // results is equal to ['one','two'] even though
 *     // the second function had a shorter timeout.
 * });
 *
 * // an example using an object instead of an array
 * async.parallel({
 *     one: function(callback) {
 *         setTimeout(function() {
 *             callback(null, 1);
 *         }, 200);
 *     },
 *     two: function(callback) {
 *         setTimeout(function() {
 *             callback(null, 2);
 *         }, 100);
 *     }
 * }, function(err, results) {
 *     console.log(results);
 *     // results is equal to: { one: 1, two: 2 }
 * });
 *
 * //Using Promises
 * async.parallel([
 *     function(callback) {
 *         setTimeout(function() {
 *             callback(null, 'one');
 *         }, 200);
 *     },
 *     function(callback) {
 *         setTimeout(function() {
 *             callback(null, 'two');
 *         }, 100);
 *     }
 * ]).then(results => {
 *     console.log(results);
 *     // results is equal to ['one','two'] even though
 *     // the second function had a shorter timeout.
 * }).catch(err => {
 *     console.log(err);
 * });
 *
 * // an example using an object instead of an array
 * async.parallel({
 *     one: function(callback) {
 *         setTimeout(function() {
 *             callback(null, 1);
 *         }, 200);
 *     },
 *     two: function(callback) {
 *         setTimeout(function() {
 *             callback(null, 2);
 *         }, 100);
 *     }
 * }).then(results => {
 *     console.log(results);
 *     // results is equal to: { one: 1, two: 2 }
 * }).catch(err => {
 *     console.log(err);
 * });
 *
 * //Using async/await
 * async () => {
 *     try {
 *         let results = await async.parallel([
 *             function(callback) {
 *                 setTimeout(function() {
 *                     callback(null, 'one');
 *                 }, 200);
 *             },
 *             function(callback) {
 *                 setTimeout(function() {
 *                     callback(null, 'two');
 *                 }, 100);
 *             }
 *         ]);
 *         console.log(results);
 *         // results is equal to ['one','two'] even though
 *         // the second function had a shorter timeout.
 *     }
 *     catch (err) {
 *         console.log(err);
 *     }
 * }
 *
 * // an example using an object instead of an array
 * async () => {
 *     try {
 *         let results = await async.parallel({
 *             one: function(callback) {
 *                 setTimeout(function() {
 *                     callback(null, 1);
 *                 }, 200);
 *             },
 *            two: function(callback) {
 *                 setTimeout(function() {
 *                     callback(null, 2);
 *                 }, 100);
 *            }
 *         });
 *         console.log(results);
 *         // results is equal to: { one: 1, two: 2 }
 *     }
 *     catch (err) {
 *         console.log(err);
 *     }
 * }
 *
 */

/**
 * Run the functions in the `tasks` collection in series, each one running once
 * the previous function has completed. If any functions in the series pass an
 * error to its callback, no more functions are run, and `callback` is
 * immediately called with the value of the error. Otherwise, `callback`
 * receives an array of results when `tasks` have completed.
 *
 * It is also possible to use an object instead of an array. Each property will
 * be run as a function, and the results will be passed to the final `callback`
 * as an object instead of an array. This can be a more readable way of handling
 *  results from {@link async.series}.
 *
 * **Note** that while many implementations preserve the order of object
 * properties, the [ECMAScript Language Specification](http://www.ecma-international.org/ecma-262/5.1/#sec-8.6)
 * explicitly states that
 *
 * > The mechanics and order of enumerating the properties is not specified.
 *
 * So if you rely on the order in which your series of functions are executed,
 * and want this to work on all platforms, consider using an array.
 *
 * @name series
 * @static
 * @memberOf module:ControlFlow
 * @method
 * @category Control Flow
 * @param {Array|Iterable|AsyncIterable|Object} tasks - A collection containing
 * [async functions]{@link AsyncFunction} to run in series.
 * Each function can complete with any number of optional `result` values.
 * @param {Function} [callback] - An optional callback to run once all the
 * functions have completed. This function gets a results array (or object)
 * containing all the result arguments passed to the `task` callbacks. Invoked
 * with (err, result).
 * @return {Promise} a promise, if no callback is passed
 * @example
 *
 * //Using Callbacks
 * async.series([
 *     function(callback) {
 *         setTimeout(function() {
 *             // do some async task
 *             callback(null, 'one');
 *         }, 200);
 *     },
 *     function(callback) {
 *         setTimeout(function() {
 *             // then do another async task
 *             callback(null, 'two');
 *         }, 100);
 *     }
 * ], function(err, results) {
 *     console.log(results);
 *     // results is equal to ['one','two']
 * });
 *
 * // an example using objects instead of arrays
 * async.series({
 *     one: function(callback) {
 *         setTimeout(function() {
 *             // do some async task
 *             callback(null, 1);
 *         }, 200);
 *     },
 *     two: function(callback) {
 *         setTimeout(function() {
 *             // then do another async task
 *             callback(null, 2);
 *         }, 100);
 *     }
 * }, function(err, results) {
 *     console.log(results);
 *     // results is equal to: { one: 1, two: 2 }
 * });
 *
 * //Using Promises
 * async.series([
 *     function(callback) {
 *         setTimeout(function() {
 *             callback(null, 'one');
 *         }, 200);
 *     },
 *     function(callback) {
 *         setTimeout(function() {
 *             callback(null, 'two');
 *         }, 100);
 *     }
 * ]).then(results => {
 *     console.log(results);
 *     // results is equal to ['one','two']
 * }).catch(err => {
 *     console.log(err);
 * });
 *
 * // an example using an object instead of an array
 * async.series({
 *     one: function(callback) {
 *         setTimeout(function() {
 *             // do some async task
 *             callback(null, 1);
 *         }, 200);
 *     },
 *     two: function(callback) {
 *         setTimeout(function() {
 *             // then do another async task
 *             callback(null, 2);
 *         }, 100);
 *     }
 * }).then(results => {
 *     console.log(results);
 *     // results is equal to: { one: 1, two: 2 }
 * }).catch(err => {
 *     console.log(err);
 * });
 *
 * //Using async/await
 * async () => {
 *     try {
 *         let results = await async.series([
 *             function(callback) {
 *                 setTimeout(function() {
 *                     // do some async task
 *                     callback(null, 'one');
 *                 }, 200);
 *             },
 *             function(callback) {
 *                 setTimeout(function() {
 *                     // then do another async task
 *                     callback(null, 'two');
 *                 }, 100);
 *             }
 *         ]);
 *         console.log(results);
 *         // results is equal to ['one','two']
 *     }
 *     catch (err) {
 *         console.log(err);
 *     }
 * }
 *
 * // an example using an object instead of an array
 * async () => {
 *     try {
 *         let results = await async.parallel({
 *             one: function(callback) {
 *                 setTimeout(function() {
 *                     // do some async task
 *                     callback(null, 1);
 *                 }, 200);
 *             },
 *            two: function(callback) {
 *                 setTimeout(function() {
 *                     // then do another async task
 *                     callback(null, 2);
 *                 }, 100);
 *            }
 *         });
 *         console.log(results);
 *         // results is equal to: { one: 1, two: 2 }
 *     }
 *     catch (err) {
 *         console.log(err);
 *     }
 * }
 *
 */

/**
 * Runs the `tasks` array of functions in parallel, without waiting until the
 * previous function has completed. Once any of the `tasks` complete or pass an
 * error to its callback, the main `callback` is immediately called. It's
 * equivalent to `Promise.race()`.
 *
 * @name race
 * @static
 * @memberOf module:ControlFlow
 * @method
 * @category Control Flow
 * @param {Array} tasks - An array containing [async functions]{@link AsyncFunction}
 * to run. Each function can complete with an optional `result` value.
 * @param {Function} callback - A callback to run once any of the functions have
 * completed. This function gets an error or result from the first function that
 * completed. Invoked with (err, result).
 * @returns {Promise} a promise, if a callback is omitted
 * @example
 *
 * async.race([
 *     function(callback) {
 *         setTimeout(function() {
 *             callback(null, 'one');
 *         }, 200);
 *     },
 *     function(callback) {
 *         setTimeout(function() {
 *             callback(null, 'two');
 *         }, 100);
 *     }
 * ],
 * // main callback
 * function(err, result) {
 *     // the result will be equal to 'two' as it finishes earlier
 * });
 */

/**
 * Runs the `tasks` array of functions in series, each passing their results to
 * the next in the array. However, if any of the `tasks` pass an error to their
 * own callback, the next function is not executed, and the main `callback` is
 * immediately called with the error.
 *
 * @name waterfall
 * @static
 * @memberOf module:ControlFlow
 * @method
 * @category Control Flow
 * @param {Array} tasks - An array of [async functions]{@link AsyncFunction}
 * to run.
 * Each function should complete with any number of `result` values.
 * The `result` values will be passed as arguments, in order, to the next task.
 * @param {Function} [callback] - An optional callback to run once all the
 * functions have completed. This will be passed the results of the last task's
 * callback. Invoked with (err, [results]).
 * @returns {Promise} a promise, if a callback is omitted
 * @example
 *
 * async.waterfall([
 *     function(callback) {
 *         callback(null, 'one', 'two');
 *     },
 *     function(arg1, arg2, callback) {
 *         // arg1 now equals 'one' and arg2 now equals 'two'
 *         callback(null, 'three');
 *     },
 *     function(arg1, callback) {
 *         // arg1 now equals 'three'
 *         callback(null, 'done');
 *     }
 * ], function (err, result) {
 *     // result now equals 'done'
 * });
 *
 * // Or, with named functions:
 * async.waterfall([
 *     myFirstFunction,
 *     mySecondFunction,
 *     myLastFunction,
 * ], function (err, result) {
 *     // result now equals 'done'
 * });
 * function myFirstFunction(callback) {
 *     callback(null, 'one', 'two');
 * }
 * function mySecondFunction(arg1, arg2, callback) {
 *     // arg1 now equals 'one' and arg2 now equals 'two'
 *     callback(null, 'three');
 * }
 * function myLastFunction(arg1, callback) {
 *     // arg1 now equals 'three'
 *     callback(null, 'done');
 * }
 */

/**
 * Same as [`reduce`]{@link module:Collections.reduce}, only operates on `array` in reverse order.
 *
 * @name reduceRight
 * @static
 * @memberOf module:Collections
 * @method
 * @see [async.reduce]{@link module:Collections.reduce}
 * @alias foldr
 * @category Collection
 * @param {Array} array - A collection to iterate over.
 * @param {*} memo - The initial state of the reduction.
 * @param {AsyncFunction} iteratee - A function applied to each item in the
 * array to produce the next step in the reduction.
 * The `iteratee` should complete with the next state of the reduction.
 * If the iteratee completes with an error, the reduction is stopped and the
 * main `callback` is immediately called with the error.
 * Invoked with (memo, item, callback).
 * @param {Function} [callback] - A callback which is called after all the
 * `iteratee` functions have finished. Result is the reduced value. Invoked with
 * (err, result).
 * @returns {Promise} a promise, if no callback is passed
 */

/**
 * Sets a time limit on an asynchronous function. If the function does not call
 * its callback within the specified milliseconds, it will be called with a
 * timeout error. The code property for the error object will be `'ETIMEDOUT'`.
 *
 * @name timeout
 * @static
 * @memberOf module:Utils
 * @method
 * @category Util
 * @param {AsyncFunction} asyncFn - The async function to limit in time.
 * @param {number} milliseconds - The specified time limit.
 * @param {*} [info] - Any variable you want attached (`string`, `object`, etc)
 * to timeout Error for more information..
 * @returns {AsyncFunction} Returns a wrapped function that can be used with any
 * of the control flow functions.
 * Invoke this function with the same parameters as you would `asyncFunc`.
 * @example
 *
 * function myFunction(foo, callback) {
 *     doAsyncTask(foo, function(err, data) {
 *         // handle errors
 *         if (err) return callback(err);
 *
 *         // do some stuff ...
 *
 *         // return processed data
 *         return callback(null, data);
 *     });
 * }
 *
 * var wrapped = async.timeout(myFunction, 1000);
 *
 * // call `wrapped` as you would `myFunction`
 * wrapped({ bar: 'bar' }, function(err, data) {
 *     // if `myFunction` takes < 1000 ms to execute, `err`
 *     // and `data` will have their expected values
 *
 *     // else `err` will be an Error with the code 'ETIMEDOUT'
 * });
 */

/**
 * Sets the `toString` method of `func` to return `string`.
 *
 * @private
 * @param {Function} func The function to modify.
 * @param {Function} string The `toString` result.
 * @returns {Function} Returns `func`.
 */

/**
 * Sets the hash `key` to `value`.
 *
 * @private
 * @name set
 * @memberOf Hash
 * @param {string} key The key of the value to set.
 * @param {*} value The value to set.
 * @returns {Object} Returns the hash instance.
 */

/**
 * Sets the list cache `key` to `value`.
 *
 * @private
 * @name set
 * @memberOf ListCache
 * @param {string} key The key of the value to set.
 * @param {*} value The value to set.
 * @returns {Object} Returns the list cache instance.
 */

/**
 * Sets the map `key` to `value`.
 *
 * @private
 * @name set
 * @memberOf MapCache
 * @param {string} key The key of the value to set.
 * @param {*} value The value to set.
 * @returns {Object} Returns the map cache instance.
 */

/**
 * Sets the stack `key` to `value`.
 *
 * @private
 * @name set
 * @memberOf Stack
 * @param {string} key The key of the value to set.
 * @param {*} value The value to set.
 * @returns {Object} Returns the stack cache instance.
 */

/**
 * Sorts a list by the results of running each `coll` value through an async
 * `iteratee`.
 *
 * @name sortBy
 * @static
 * @memberOf module:Collections
 * @method
 * @category Collection
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {AsyncFunction} iteratee - An async function to apply to each item in
 * `coll`.
 * The iteratee should complete with a value to use as the sort criteria as
 * its `result`.
 * Invoked with (item, callback).
 * @param {Function} callback - A callback which is called after all the
 * `iteratee` functions have finished, or an error occurs. Results is the items
 * from the original `coll` sorted by the values returned by the `iteratee`
 * calls. Invoked with (err, results).
 * @returns {Promise} a promise, if no callback passed
 * @example
 *
 * // bigfile.txt is a file that is 251100 bytes in size
 * // mediumfile.txt is a file that is 11000 bytes in size
 * // smallfile.txt is a file that is 121 bytes in size
 *
 * // asynchronous function that returns the file size in bytes
 * function getFileSizeInBytes(file, callback) {
 *     fs.stat(file, function(err, stat) {
 *         if (err) {
 *             return callback(err);
 *         }
 *         callback(null, stat.size);
 *     });
 * }
 *
 * // Using callbacks
 * async.sortBy(['mediumfile.txt','smallfile.txt','bigfile.txt'], getFileSizeInBytes,
 *     function(err, results) {
 *         if (err) {
 *             console.log(err);
 *         } else {
 *             console.log(results);
 *             // results is now the original array of files sorted by
 *             // file size (ascending by default), e.g.
 *             // [ 'smallfile.txt', 'mediumfile.txt', 'bigfile.txt']
 *         }
 *     }
 * );
 *
 * // By modifying the callback parameter the
 * // sorting order can be influenced:
 *
 * // ascending order
 * async.sortBy(['mediumfile.txt','smallfile.txt','bigfile.txt'], function(file, callback) {
 *     getFileSizeInBytes(file, function(getFileSizeErr, fileSize) {
 *         if (getFileSizeErr) return callback(getFileSizeErr);
 *         callback(null, fileSize);
 *     });
 * }, function(err, results) {
 *         if (err) {
 *             console.log(err);
 *         } else {
 *             console.log(results);
 *             // results is now the original array of files sorted by
 *             // file size (ascending by default), e.g.
 *             // [ 'smallfile.txt', 'mediumfile.txt', 'bigfile.txt']
 *         }
 *     }
 * );
 *
 * // descending order
 * async.sortBy(['bigfile.txt','mediumfile.txt','smallfile.txt'], function(file, callback) {
 *     getFileSizeInBytes(file, function(getFileSizeErr, fileSize) {
 *         if (getFileSizeErr) {
 *             return callback(getFileSizeErr);
 *         }
 *         callback(null, fileSize * -1);
 *     });
 * }, function(err, results) {
 *         if (err) {
 *             console.log(err);
 *         } else {
 *             console.log(results);
 *             // results is now the original array of files sorted by
 *             // file size (ascending by default), e.g.
 *             // [ 'bigfile.txt', 'mediumfile.txt', 'smallfile.txt']
 *         }
 *     }
 * );
 *
 * // Error handling
 * async.sortBy(['mediumfile.txt','smallfile.txt','missingfile.txt'], getFileSizeInBytes,
 *     function(err, results) {
 *         if (err) {
 *             console.log(err);
 *             // [ Error: ENOENT: no such file or directory ]
 *         } else {
 *             console.log(results);
 *         }
 *     }
 * );
 *
 * // Using Promises
 * async.sortBy(['mediumfile.txt','smallfile.txt','bigfile.txt'], getFileSizeInBytes)
 * .then( results => {
 *     console.log(results);
 *     // results is now the original array of files sorted by
 *     // file size (ascending by default), e.g.
 *     // [ 'smallfile.txt', 'mediumfile.txt', 'bigfile.txt']
 * }).catch( err => {
 *     console.log(err);
 * });
 *
 * // Error handling
 * async.sortBy(['mediumfile.txt','smallfile.txt','missingfile.txt'], getFileSizeInBytes)
 * .then( results => {
 *     console.log(results);
 * }).catch( err => {
 *     console.log(err);
 *     // [ Error: ENOENT: no such file or directory ]
 * });
 *
 * // Using async/await
 * (async () => {
 *     try {
 *         let results = await async.sortBy(['bigfile.txt','mediumfile.txt','smallfile.txt'], getFileSizeInBytes);
 *         console.log(results);
 *         // results is now the original array of files sorted by
 *         // file size (ascending by default), e.g.
 *         // [ 'smallfile.txt', 'mediumfile.txt', 'bigfile.txt']
 *     }
 *     catch (err) {
 *         console.log(err);
 *     }
 * })();
 *
 * // Error handling
 * async () => {
 *     try {
 *         let results = await async.sortBy(['missingfile.txt','mediumfile.txt','smallfile.txt'], getFileSizeInBytes);
 *         console.log(results);
 *     }
 *     catch (err) {
 *         console.log(err);
 *         // [ Error: ENOENT: no such file or directory ]
 *     }
 * }
 *
 */

/**
 * Take a sync function and make it async, passing its return value to a
 * callback. This is useful for plugging sync functions into a waterfall,
 * series, or other async functions. Any arguments passed to the generated
 * function will be passed to the wrapped function (except for the final
 * callback argument). Errors thrown will be passed to the callback.
 *
 * If the function passed to `asyncify` returns a Promise, that promises's
 * resolved/rejected state will be used to call the callback, rather than simply
 * the synchronous return value.
 *
 * This also means you can asyncify ES2017 `async` functions.
 *
 * @name asyncify
 * @static
 * @memberOf module:Utils
 * @method
 * @alias wrapSync
 * @category Util
 * @param {Function} func - The synchronous function, or Promise-returning
 * function to convert to an {@link AsyncFunction}.
 * @returns {AsyncFunction} An asynchronous wrapper of the `func`. To be
 * invoked with `(args..., callback)`.
 * @example
 *
 * // passing a regular synchronous function
 * async.waterfall([
 *     async.apply(fs.readFile, filename, "utf8"),
 *     async.asyncify(JSON.parse),
 *     function (data, next) {
 *         // data is the result of parsing the text.
 *         // If there was a parsing error, it would have been caught.
 *     }
 * ], callback);
 *
 * // passing a function returning a promise
 * async.waterfall([
 *     async.apply(fs.readFile, filename, "utf8"),
 *     async.asyncify(function (contents) {
 *         return db.model.create(contents);
 *     }),
 *     function (model, next) {
 *         // `model` is the instantiated model object.
 *         // If there was an error, this function would be skipped.
 *     }
 * ], callback);
 *
 * // es2017 example, though `asyncify` is not needed if your JS environment
 * // supports async functions out of the box
 * var q = async.queue(async.asyncify(async function(file) {
 *     var intermediateStep = await processFile(file);
 *     return await somePromise(intermediateStep)
 * }));
 *
 * q.push(files);
 */

/**
 * The base implementation of `_.assignIn` without support for multiple sources
 * or `customizer` functions.
 *
 * @private
 * @param {Object} object The destination object.
 * @param {Object} source The source object.
 * @returns {Object} Returns `object`.
 */

/**
 * The base implementation of `_.assign` without support for multiple sources
 * or `customizer` functions.
 *
 * @private
 * @param {Object} object The destination object.
 * @param {Object} source The source object.
 * @returns {Object} Returns `object`.
 */

/**
 * The base implementation of `_.clone` and `_.cloneDeep` which tracks
 * traversed objects.
 *
 * @private
 * @param {*} value The value to clone.
 * @param {boolean} bitmask The bitmask flags.
 *  1 - Deep clone
 *  2 - Flatten inherited properties
 *  4 - Clone symbols
 * @param {Function} [customizer] The function to customize cloning.
 * @param {string} [key] The key of `value`.
 * @param {Object} [object] The parent object of `value`.
 * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
 * @returns {*} Returns the cloned value.
 */

/**
 * The base implementation of `_.flatten` with support for restricting flattening.
 *
 * @private
 * @param {Array} array The array to flatten.
 * @param {number} depth The maximum recursion depth.
 * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
 * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
 * @param {Array} [result=[]] The initial result value.
 * @returns {Array} Returns the new flattened array.
 */

/**
 * The base implementation of `_.get` without support for default values.
 *
 * @private
 * @param {Object} object The object to query.
 * @param {Array|string} path The path of the property to get.
 * @returns {*} Returns the resolved value.
 */

/**
 * The base implementation of `_.isArguments`.
 *
 * @private
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
 */

/**
 * The base implementation of `_.isMap` without Node.js optimizations.
 *
 * @private
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a map, else `false`.
 */

/**
 * The base implementation of `_.isNative` without bad shim checks.
 *
 * @private
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a native function,
 *  else `false`.
 */

/**
 * The base implementation of `_.isSet` without Node.js optimizations.
 *
 * @private
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a set, else `false`.
 */

/**
 * The base implementation of `_.isTypedArray` without Node.js optimizations.
 *
 * @private
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
 */

/**
 * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
 *
 * @private
 * @param {Object} object The object to query.
 * @returns {Array} Returns the array of property names.
 */

/**
 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
 *
 * @private
 * @param {Object} object The object to query.
 * @returns {Array} Returns the array of property names.
 */

/**
 * The base implementation of `_.slice` without an iteratee call guard.
 *
 * @private
 * @param {Array} array The array to slice.
 * @param {number} [start=0] The start position.
 * @param {number} [end=array.length] The end position.
 * @returns {Array} Returns the slice of `array`.
 */

/**
 * The base implementation of `_.times` without support for iteratee shorthands
 * or max array length checks.
 *
 * @private
 * @param {number} n The number of times to invoke `iteratee`.
 * @param {Function} iteratee The function invoked per iteration.
 * @returns {Array} Returns the array of results.
 */

/**
 * The base implementation of `_.toString` which doesn't convert nullish
 * values to empty strings.
 *
 * @private
 * @param {*} value The value to process.
 * @returns {string} Returns the string.
 */

/**
 * The base implementation of `_.unary` without support for storing metadata.
 *
 * @private
 * @param {Function} func The function to cap arguments for.
 * @returns {Function} Returns the new capped function.
 */

/**
 * The base implementation of `_.unset`.
 *
 * @private
 * @param {Object} object The object to modify.
 * @param {Array|string} path The property path to unset.
 * @returns {boolean} Returns `true` if the property is deleted, else `false`.
 */

/**
 * The base implementation of `assignValue` and `assignMergeValue` without
 * value checks.
 *
 * @private
 * @param {Object} object The object to modify.
 * @param {string} key The key of the property to assign.
 * @param {*} value The value to assign.
 */

/**
 * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
 * `keysFunc` and `symbolsFunc` to get the enumerable property names and
 * symbols of `object`.
 *
 * @private
 * @param {Object} object The object to query.
 * @param {Function} keysFunc The function to get the keys of `object`.
 * @param {Function} symbolsFunc The function to get the symbols of `object`.
 * @returns {Array} Returns the array of property names and symbols.
 */

/**
 * The base implementation of `getTag` without fallbacks for buggy environments.
 *
 * @private
 * @param {*} value The value to query.
 * @returns {string} Returns the `toStringTag`.
 */

/**
 * The base implementation of `setToString` without support for hot loop shorting.
 *
 * @private
 * @param {Function} func The function to modify.
 * @param {Function} string The `toString` result.
 * @returns {Function} Returns `func`.
 */

/**
 * The opposite of [`filter`]{@link module:Collections.filter}. Removes values that pass an `async` truth test.
 *
 * @name reject
 * @static
 * @memberOf module:Collections
 * @method
 * @see [async.filter]{@link module:Collections.filter}
 * @category Collection
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {Function} iteratee - An async truth test to apply to each item in
 * `coll`.
 * The should complete with a boolean value as its `result`.
 * Invoked with (item, callback).
 * @param {Function} [callback] - A callback which is called after all the
 * `iteratee` functions have finished. Invoked with (err, results).
 * @returns {Promise} a promise, if no callback is passed
 * @example
 *
 * // dir1 is a directory that contains file1.txt, file2.txt
 * // dir2 is a directory that contains file3.txt, file4.txt
 * // dir3 is a directory that contains file5.txt
 *
 * const fileList = ['dir1/file1.txt','dir2/file3.txt','dir3/file6.txt'];
 *
 * // asynchronous function that checks if a file exists
 * function fileExists(file, callback) {
 *    fs.access(file, fs.constants.F_OK, (err) => {
 *        callback(null, !err);
 *    });
 * }
 *
 * // Using callbacks
 * async.reject(fileList, fileExists, function(err, results) {
 *    // [ 'dir3/file6.txt' ]
 *    // results now equals an array of the non-existing files
 * });
 *
 * // Using Promises
 * async.reject(fileList, fileExists)
 * .then( results => {
 *     console.log(results);
 *     // [ 'dir3/file6.txt' ]
 *     // results now equals an array of the non-existing files
 * }).catch( err => {
 *     console.log(err);
 * });
 *
 * // Using async/await
 * async () => {
 *     try {
 *         let results = await async.reject(fileList, fileExists);
 *         console.log(results);
 *         // [ 'dir3/file6.txt' ]
 *         // results now equals an array of the non-existing files
 *     }
 *     catch (err) {
 *         console.log(err);
 *     }
 * }
 *
 */

/**
 * The post-check version of [`whilst`]{@link module:ControlFlow.whilst}. To reflect the difference in
 * the order of operations, the arguments `test` and `iteratee` are switched.
 *
 * `doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript.
 *
 * @name doWhilst
 * @static
 * @memberOf module:ControlFlow
 * @method
 * @see [async.whilst]{@link module:ControlFlow.whilst}
 * @category Control Flow
 * @param {AsyncFunction} iteratee - A function which is called each time `test`
 * passes. Invoked with (callback).
 * @param {AsyncFunction} test - asynchronous truth test to perform after each
 * execution of `iteratee`. Invoked with (...args, callback), where `...args` are the
 * non-error args from the previous callback of `iteratee`.
 * @param {Function} [callback] - A callback which is called after the test
 * function has failed and repeated execution of `iteratee` has stopped.
 * `callback` will be passed an error and any arguments passed to the final
 * `iteratee`'s callback. Invoked with (err, [results]);
 * @returns {Promise} a promise, if no callback is passed
 */

/**
 * The same as [`applyEach`]{@link module:ControlFlow.applyEach} but runs only a single async operation at a time.
 *
 * @name applyEachSeries
 * @static
 * @memberOf module:ControlFlow
 * @method
 * @see [async.applyEach]{@link module:ControlFlow.applyEach}
 * @category Control Flow
 * @param {Array|Iterable|AsyncIterable|Object} fns - A collection of {@link AsyncFunction}s to all
 * call with the same arguments
 * @param {...*} [args] - any number of separate arguments to pass to the
 * function.
 * @param {Function} [callback] - the final argument should be the callback,
 * called when all functions have completed processing.
 * @returns {AsyncFunction} - A function, that when called, is the result of
 * appling the `args` to the list of functions.  It takes no args, other than
 * a callback.
 */

/**
 * The same as [`concat`]{@link module:Collections.concat} but runs a maximum of `limit` async operations at a time.
 *
 * @name concatLimit
 * @static
 * @memberOf module:Collections
 * @method
 * @see [async.concat]{@link module:Collections.concat}
 * @category Collection
 * @alias flatMapLimit
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {number} limit - The maximum number of async operations at a time.
 * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`,
 * which should use an array as its result. Invoked with (item, callback).
 * @param {Function} [callback] - A callback which is called after all the
 * `iteratee` functions have finished, or an error occurs. Results is an array
 * containing the concatenated results of the `iteratee` function. Invoked with
 * (err, results).
 * @returns A Promise, if no callback is passed
 */

/**
 * The same as [`concat`]{@link module:Collections.concat} but runs only a single async operation at a time.
 *
 * @name concatSeries
 * @static
 * @memberOf module:Collections
 * @method
 * @see [async.concat]{@link module:Collections.concat}
 * @category Collection
 * @alias flatMapSeries
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`.
 * The iteratee should complete with an array an array of results.
 * Invoked with (item, callback).
 * @param {Function} [callback] - A callback which is called after all the
 * `iteratee` functions have finished, or an error occurs. Results is an array
 * containing the concatenated results of the `iteratee` function. Invoked with
 * (err, results).
 * @returns A Promise, if no callback is passed
 */

/**
 * The same as [`detect`]{@link module:Collections.detect} but runs a maximum of `limit` async operations at a
 * time.
 *
 * @name detectLimit
 * @static
 * @memberOf module:Collections
 * @method
 * @see [async.detect]{@link module:Collections.detect}
 * @alias findLimit
 * @category Collections
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {number} limit - The maximum number of async operations at a time.
 * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
 * The iteratee must complete with a boolean value as its result.
 * Invoked with (item, callback).
 * @param {Function} [callback] - A callback which is called as soon as any
 * iteratee returns `true`, or after all the `iteratee` functions have finished.
 * Result will be the first item in the array that passes the truth test
 * (iteratee) or the value `undefined` if none passed. Invoked with
 * (err, result).
 * @returns {Promise} a promise, if a callback is omitted
 */

/**
 * The same as [`detect`]{@link module:Collections.detect} but runs only a single async operation at a time.
 *
 * @name detectSeries
 * @static
 * @memberOf module:Collections
 * @method
 * @see [async.detect]{@link module:Collections.detect}
 * @alias findSeries
 * @category Collections
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
 * The iteratee must complete with a boolean value as its result.
 * Invoked with (item, callback).
 * @param {Function} [callback] - A callback which is called as soon as any
 * iteratee returns `true`, or after all the `iteratee` functions have finished.
 * Result will be the first item in the array that passes the truth test
 * (iteratee) or the value `undefined` if none passed. Invoked with
 * (err, result).
 * @returns {Promise} a promise, if a callback is omitted
 */

/**
 * The same as [`eachOf`]{@link module:Collections.eachOf} but runs a maximum of `limit` async operations at a
 * time.
 *
 * @name eachOfLimit
 * @static
 * @memberOf module:Collections
 * @method
 * @see [async.eachOf]{@link module:Collections.eachOf}
 * @alias forEachOfLimit
 * @category Collection
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {number} limit - The maximum number of async operations at a time.
 * @param {AsyncFunction} iteratee - An async function to apply to each
 * item in `coll`. The `key` is the item's key, or index in the case of an
 * array.
 * Invoked with (item, key, callback).
 * @param {Function} [callback] - A callback which is called when all
 * `iteratee` functions have finished, or an error occurs. Invoked with (err).
 * @returns {Promise} a promise, if a callback is omitted
 */

/**
 * The same as [`eachOf`]{@link module:Collections.eachOf} but runs only a single async operation at a time.
 *
 * @name eachOfSeries
 * @static
 * @memberOf module:Collections
 * @method
 * @see [async.eachOf]{@link module:Collections.eachOf}
 * @alias forEachOfSeries
 * @category Collection
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {AsyncFunction} iteratee - An async function to apply to each item in
 * `coll`.
 * Invoked with (item, key, callback).
 * @param {Function} [callback] - A callback which is called when all `iteratee`
 * functions have finished, or an error occurs. Invoked with (err).
 * @returns {Promise} a promise, if a callback is omitted
 */

/**
 * The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time.
 *
 * @name eachLimit
 * @static
 * @memberOf module:Collections
 * @method
 * @see [async.each]{@link module:Collections.each}
 * @alias forEachLimit
 * @category Collection
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {number} limit - The maximum number of async operations at a time.
 * @param {AsyncFunction} iteratee - An async function to apply to each item in
 * `coll`.
 * The array index is not passed to the iteratee.
 * If you need the index, use `eachOfLimit`.
 * Invoked with (item, callback).
 * @param {Function} [callback] - A callback which is called when all
 * `iteratee` functions have finished, or an error occurs. Invoked with (err).
 * @returns {Promise} a promise, if a callback is omitted
 */

/**
 * The same as [`each`]{@link module:Collections.each} but runs only a single async operation at a time.
 *
 * Note, that unlike [`each`]{@link module:Collections.each}, this function applies iteratee to each item
 * in series and therefore the iteratee functions will complete in order.

 * @name eachSeries
 * @static
 * @memberOf module:Collections
 * @method
 * @see [async.each]{@link module:Collections.each}
 * @alias forEachSeries
 * @category Collection
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {AsyncFunction} iteratee - An async function to apply to each
 * item in `coll`.
 * The array index is not passed to the iteratee.
 * If you need the index, use `eachOfSeries`.
 * Invoked with (item, callback).
 * @param {Function} [callback] - A callback which is called when all
 * `iteratee` functions have finished, or an error occurs. Invoked with (err).
 * @returns {Promise} a promise, if a callback is omitted
 */

/**
 * The same as [`every`]{@link module:Collections.every} but runs a maximum of `limit` async operations at a time.
 *
 * @name everyLimit
 * @static
 * @memberOf module:Collections
 * @method
 * @see [async.every]{@link module:Collections.every}
 * @alias allLimit
 * @category Collection
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {number} limit - The maximum number of async operations at a time.
 * @param {AsyncFunction} iteratee - An async truth test to apply to each item
 * in the collection in parallel.
 * The iteratee must complete with a boolean result value.
 * Invoked with (item, callback).
 * @param {Function} [callback] - A callback which is called after all the
 * `iteratee` functions have finished. Result will be either `true` or `false`
 * depending on the values of the async tests. Invoked with (err, result).
 * @returns {Promise} a promise, if no callback provided
 */

/**
 * The same as [`every`]{@link module:Collections.every} but runs only a single async operation at a time.
 *
 * @name everySeries
 * @static
 * @memberOf module:Collections
 * @method
 * @see [async.every]{@link module:Collections.every}
 * @alias allSeries
 * @category Collection
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {AsyncFunction} iteratee - An async truth test to apply to each item
 * in the collection in series.
 * The iteratee must complete with a boolean result value.
 * Invoked with (item, callback).
 * @param {Function} [callback] - A callback which is called after all the
 * `iteratee` functions have finished. Result will be either `true` or `false`
 * depending on the values of the async tests. Invoked with (err, result).
 * @returns {Promise} a promise, if no callback provided
 */

/**
 * The same as [`filter`]{@link module:Collections.filter} but runs a maximum of `limit` async operations at a
 * time.
 *
 * @name filterLimit
 * @static
 * @memberOf module:Collections
 * @method
 * @see [async.filter]{@link module:Collections.filter}
 * @alias selectLimit
 * @category Collection
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {number} limit - The maximum number of async operations at a time.
 * @param {Function} iteratee - A truth test to apply to each item in `coll`.
 * The `iteratee` is passed a `callback(err, truthValue)`, which must be called
 * with a boolean argument once it has completed. Invoked with (item, callback).
 * @param {Function} [callback] - A callback which is called after all the
 * `iteratee` functions have finished. Invoked with (err, results).
 * @returns {Promise} a promise, if no callback provided
 */

/**
 * The same as [`filter`]{@link module:Collections.filter} but runs only a single async operation at a time.
 *
 * @name filterSeries
 * @static
 * @memberOf module:Collections
 * @method
 * @see [async.filter]{@link module:Collections.filter}
 * @alias selectSeries
 * @category Collection
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {Function} iteratee - A truth test to apply to each item in `coll`.
 * The `iteratee` is passed a `callback(err, truthValue)`, which must be called
 * with a boolean argument once it has completed. Invoked with (item, callback).
 * @param {Function} [callback] - A callback which is called after all the
 * `iteratee` functions have finished. Invoked with (err, results)
 * @returns {Promise} a promise, if no callback provided
 */

/**
 * The same as [`groupBy`]{@link module:Collections.groupBy} but runs a maximum of `limit` async operations at a time.
 *
 * @name groupByLimit
 * @static
 * @memberOf module:Collections
 * @method
 * @see [async.groupBy]{@link module:Collections.groupBy}
 * @category Collection
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {number} limit - The maximum number of async operations at a time.
 * @param {AsyncFunction} iteratee - An async function to apply to each item in
 * `coll`.
 * The iteratee should complete with a `key` to group the value under.
 * Invoked with (value, callback).
 * @param {Function} [callback] - A callback which is called when all `iteratee`
 * functions have finished, or an error occurs. Result is an `Object` whoses
 * properties are arrays of values which returned the corresponding key.
 * @returns {Promise} a promise, if no callback is passed
 */

/**
 * The same as [`groupBy`]{@link module:Collections.groupBy} but runs only a single async operation at a time.
 *
 * @name groupBySeries
 * @static
 * @memberOf module:Collections
 * @method
 * @see [async.groupBy]{@link module:Collections.groupBy}
 * @category Collection
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {AsyncFunction} iteratee - An async function to apply to each item in
 * `coll`.
 * The iteratee should complete with a `key` to group the value under.
 * Invoked with (value, callback).
 * @param {Function} [callback] - A callback which is called when all `iteratee`
 * functions have finished, or an error occurs. Result is an `Object` whose
 * properties are arrays of values which returned the corresponding key.
 * @returns {Promise} a promise, if no callback is passed
 */

/**
 * The same as [`mapValues`]{@link module:Collections.mapValues} but runs a maximum of `limit` async operations at a
 * time.
 *
 * @name mapValuesLimit
 * @static
 * @memberOf module:Collections
 * @method
 * @see [async.mapValues]{@link module:Collections.mapValues}
 * @category Collection
 * @param {Object} obj - A collection to iterate over.
 * @param {number} limit - The maximum number of async operations at a time.
 * @param {AsyncFunction} iteratee - A function to apply to each value and key
 * in `coll`.
 * The iteratee should complete with the transformed value as its result.
 * Invoked with (value, key, callback).
 * @param {Function} [callback] - A callback which is called when all `iteratee`
 * functions have finished, or an error occurs. `result` is a new object consisting
 * of each key from `obj`, with each transformed value on the right-hand side.
 * Invoked with (err, result).
 * @returns {Promise} a promise, if no callback is passed
 */

/**
 * The same as [`mapValues`]{@link module:Collections.mapValues} but runs only a single async operation at a time.
 *
 * @name mapValuesSeries
 * @static
 * @memberOf module:Collections
 * @method
 * @see [async.mapValues]{@link module:Collections.mapValues}
 * @category Collection
 * @param {Object} obj - A collection to iterate over.
 * @param {AsyncFunction} iteratee - A function to apply to each value and key
 * in `coll`.
 * The iteratee should complete with the transformed value as its result.
 * Invoked with (value, key, callback).
 * @param {Function} [callback] - A callback which is called when all `iteratee`
 * functions have finished, or an error occurs. `result` is a new object consisting
 * of each key from `obj`, with each transformed value on the right-hand side.
 * Invoked with (err, result).
 * @returns {Promise} a promise, if no callback is passed
 */

/**
 * The same as [`map`]{@link module:Collections.map} but runs a maximum of `limit` async operations at a time.
 *
 * @name mapLimit
 * @static
 * @memberOf module:Collections
 * @method
 * @see [async.map]{@link module:Collections.map}
 * @category Collection
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {number} limit - The maximum number of async operations at a time.
 * @param {AsyncFunction} iteratee - An async function to apply to each item in
 * `coll`.
 * The iteratee should complete with the transformed item.
 * Invoked with (item, callback).
 * @param {Function} [callback] - A callback which is called when all `iteratee`
 * functions have finished, or an error occurs. Results is an array of the
 * transformed items from the `coll`. Invoked with (err, results).
 * @returns {Promise} a promise, if no callback is passed
 */

/**
 * The same as [`map`]{@link module:Collections.map} but runs only a single async operation at a time.
 *
 * @name mapSeries
 * @static
 * @memberOf module:Collections
 * @method
 * @see [async.map]{@link module:Collections.map}
 * @category Collection
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {AsyncFunction} iteratee - An async function to apply to each item in
 * `coll`.
 * The iteratee should complete with the transformed item.
 * Invoked with (item, callback).
 * @param {Function} [callback] - A callback which is called when all `iteratee`
 * functions have finished, or an error occurs. Results is an array of the
 * transformed items from the `coll`. Invoked with (err, results).
 * @returns {Promise} a promise, if no callback is passed
 */

/**
 * The same as [`parallel`]{@link module:ControlFlow.parallel} but runs a maximum of `limit` async operations at a
 * time.
 *
 * @name parallelLimit
 * @static
 * @memberOf module:ControlFlow
 * @method
 * @see [async.parallel]{@link module:ControlFlow.parallel}
 * @category Control Flow
 * @param {Array|Iterable|AsyncIterable|Object} tasks - A collection of
 * [async functions]{@link AsyncFunction} to run.
 * Each async function can complete with any number of optional `result` values.
 * @param {number} limit - The maximum number of async operations at a time.
 * @param {Function} [callback] - An optional callback to run once all the
 * functions have completed successfully. This function gets a results array
 * (or object) containing all the result arguments passed to the task callbacks.
 * Invoked with (err, results).
 * @returns {Promise} a promise, if a callback is not passed
 */

/**
 * The same as [`reject`]{@link module:Collections.reject} but runs a maximum of `limit` async operations at a
 * time.
 *
 * @name rejectLimit
 * @static
 * @memberOf module:Collections
 * @method
 * @see [async.reject]{@link module:Collections.reject}
 * @category Collection
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {number} limit - The maximum number of async operations at a time.
 * @param {Function} iteratee - An async truth test to apply to each item in
 * `coll`.
 * The should complete with a boolean value as its `result`.
 * Invoked with (item, callback).
 * @param {Function} [callback] - A callback which is called after all the
 * `iteratee` functions have finished. Invoked with (err, results).
 * @returns {Promise} a promise, if no callback is passed
 */

/**
 * The same as [`reject`]{@link module:Collections.reject} but runs only a single async operation at a time.
 *
 * @name rejectSeries
 * @static
 * @memberOf module:Collections
 * @method
 * @see [async.reject]{@link module:Collections.reject}
 * @category Collection
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {Function} iteratee - An async truth test to apply to each item in
 * `coll`.
 * The should complete with a boolean value as its `result`.
 * Invoked with (item, callback).
 * @param {Function} [callback] - A callback which is called after all the
 * `iteratee` functions have finished. Invoked with (err, results).
 * @returns {Promise} a promise, if no callback is passed
 */

/**
 * The same as [`some`]{@link module:Collections.some} but runs a maximum of `limit` async operations at a time.
 *
 * @name someLimit
 * @static
 * @memberOf module:Collections
 * @method
 * @see [async.some]{@link module:Collections.some}
 * @alias anyLimit
 * @category Collection
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {number} limit - The maximum number of async operations at a time.
 * @param {AsyncFunction} iteratee - An async truth test to apply to each item
 * in the collections in parallel.
 * The iteratee should complete with a boolean `result` value.
 * Invoked with (item, callback).
 * @param {Function} [callback] - A callback which is called as soon as any
 * iteratee returns `true`, or after all the iteratee functions have finished.
 * Result will be either `true` or `false` depending on the values of the async
 * tests. Invoked with (err, result).
 * @returns {Promise} a promise, if no callback provided
 */

/**
 * The same as [`some`]{@link module:Collections.some} but runs only a single async operation at a time.
 *
 * @name someSeries
 * @static
 * @memberOf module:Collections
 * @method
 * @see [async.some]{@link module:Collections.some}
 * @alias anySeries
 * @category Collection
 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
 * @param {AsyncFunction} iteratee - An async truth test to apply to each item
 * in the collections in series.
 * The iteratee should complete with a boolean `result` value.
 * Invoked with (item, callback).
 * @param {Function} [callback] - A callback which is called as soon as any
 * iteratee returns `true`, or after all the iteratee functions have finished.
 * Result will be either `true` or `false` depending on the values of the async
 * tests. Invoked with (err, result).
 * @returns {Promise} a promise, if no callback provided
 */

/**
 * The same as [async.queue]{@link module:ControlFlow.queue} only tasks are assigned a priority and
 * completed in ascending priority order.
 *
 * @name priorityQueue
 * @static
 * @memberOf module:ControlFlow
 * @method
 * @see [async.queue]{@link module:ControlFlow.queue}
 * @category Control Flow
 * @param {AsyncFunction} worker - An async function for processing a queued task.
 * If you want to handle errors from an individual task, pass a callback to
 * `q.push()`.
 * Invoked with (task, callback).
 * @param {number} concurrency - An `integer` for determining how many `worker`
 * functions should be run in parallel.  If omitted, the concurrency defaults to
 * `1`.  If the concurrency is `0`, an error is thrown.
 * @returns {module:ControlFlow.QueueObject} A priorityQueue object to manage the tasks. There are three
 * differences between `queue` and `priorityQueue` objects:
 * * `push(task, priority, [callback])` - `priority` should be a number. If an
 *   array of `tasks` is given, all tasks will be assigned the same priority.
 * * `pushAsync(task, priority, [callback])` - the same as `priorityQueue.push`,
 *   except this returns a promise that rejects if an error occurs.
 * * The `unshift` and `unshiftAsync` methods were removed.
 */

/**
 * The same as [times]{@link module:ControlFlow.times} but runs a maximum of `limit` async operations at a
 * time.
 *
 * @name timesLimit
 * @static
 * @memberOf module:ControlFlow
 * @method
 * @see [async.times]{@link module:ControlFlow.times}
 * @category Control Flow
 * @param {number} count - The number of times to run the function.
 * @param {number} limit - The maximum number of async operations at a time.
 * @param {AsyncFunction} iteratee - The async function to call `n` times.
 * Invoked with the iteration index and a callback: (n, next).
 * @param {Function} callback - see [async.map]{@link module:Collections.map}.
 * @returns {Promise} a promise, if no callback is provided
 */

/**
 * The same as [times]{@link module:ControlFlow.times} but runs only a single async operation at a time.
 *
 * @name timesSeries
 * @static
 * @memberOf module:ControlFlow
 * @method
 * @see [async.times]{@link module:ControlFlow.times}
 * @category Control Flow
 * @param {number} n - The number of times to run the function.
 * @param {AsyncFunction} iteratee - The async function to call `n` times.
 * Invoked with the iteration index and a callback: (n, next).
 * @param {Function} callback - see {@link module:Collections.map}.
 * @returns {Promise} a promise, if no callback is provided
 */

/**
 * This function is like
 * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
 * except that it includes inherited enumerable properties.
 *
 * @private
 * @param {Object} object The object to query.
 * @returns {Array} Returns the array of property names.
 */

/**
 * This method calls {@link #item item()}.
 * Returns the item associated with the passed key OR index. Key has priority
 * over index.  This is the equivalent of calling {@link #key} first, then if
 * nothing matched calling {@link #itemAt}.
 * @param {String/Number} key The key or index of the item.
 * @return {Object} If the item is found, returns the item.  If the item was
 * not found, returns <tt>undefined</tt>. If an item was found, but is a Class,
 * returns <tt>null</tt>.
 */

/**
 * This method is like `_.clone` except that it recursively clones `value`.
 *
 * @static
 * @memberOf _
 * @since 1.0.0
 * @category Lang
 * @param {*} value The value to recursively clone.
 * @returns {*} Returns the deep cloned value.
 * @see _.clone
 * @example
 *
 * var objects = [{ 'a': 1 }, { 'b': 2 }];
 *
 * var deep = _.cloneDeep(objects);
 * console.log(deep[0] === objects[0]);
 * // => false
 */

/**
 * This method returns `false`.
 *
 * @static
 * @memberOf _
 * @since 4.13.0
 * @category Util
 * @returns {boolean} Returns `false`.
 * @example
 *
 * _.times(2, _.stubFalse);
 * // => [false, false]
 */

/**
 * This method returns a new empty array.
 *
 * @static
 * @memberOf _
 * @since 4.13.0
 * @category Util
 * @returns {Array} Returns the new empty array.
 * @example
 *
 * var arrays = _.times(2, _.stubArray);
 *
 * console.log(arrays);
 * // => [[], []]
 *
 * console.log(arrays[0] === arrays[1]);
 * // => false
 */

/**
 * This method returns the first argument it receives.
 *
 * @static
 * @since 0.1.0
 * @memberOf _
 * @category Util
 * @param {*} value Any value.
 * @returns {*} Returns `value`.
 * @example
 *
 * var object = { 'a': 1 };
 *
 * console.log(_.identity(object) === object);
 * // => true
 */

/**
 * Trims whitespace from either end of a string, leaving spaces within the string intact.  Example:
 * <pre><code>
var s = '  foo bar  ';
alert('-' + s + '-');         //alerts "- foo bar -"
alert('-' + s.trim() + '-');  //alerts "-foo bar-"
</code></pre>
 * @return {String} The trimmed string
 */

/**
 * Undoes a [memoize]{@link module:Utils.memoize}d function, reverting it to the original,
 * unmemoized form. Handy for testing.
 *
 * @name unmemoize
 * @static
 * @memberOf module:Utils
 * @method
 * @see [async.memoize]{@link module:Utils.memoize}
 * @category Util
 * @param {AsyncFunction} fn - the memoized function
 * @returns {AsyncFunction} a function that calls the original unmemoized function
 */

/**
 * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
 * objects.
 *
 * @private
 * @param {*} value The value to inspect.
 * @param {string} key The key of the property to inspect.
 * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
 */

/**
 * Used to match `RegExp`
 * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
 */

/**
 * Used to resolve the
 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
 * of values.
 */

/**
 * Utility function that allows you to easily switch a string between two alternating values.  The passed value
 * is compared to the current string, and if they are equal, the other value that was passed in is returned.  If
 * they are already different, the first value passed in is returned.  Note that this method returns the new value
 * but does not change the current string.
 * <pre><code>
// alternate sort directions
sort = sort.toggle('ASC', 'DESC');

// instead of conditional logic:
sort = (sort == 'ASC' ? 'DESC' : 'ASC');
</code></pre>
 * @param {String} value The value to compare to the current string
 * @param {String} other The new value to use if the string already equals the first value passed in
 * @return {String} The new value
 */

/**
 * Version of the compose function that is more natural to read. Each function
 * consumes the return value of the previous function. It is the equivalent of
 * [compose]{@link module:ControlFlow.compose} with the arguments reversed.
 *
 * Each function is executed with the `this` binding of the composed function.
 *
 * @name seq
 * @static
 * @memberOf module:ControlFlow
 * @method
 * @see [async.compose]{@link module:ControlFlow.compose}
 * @category Control Flow
 * @param {...AsyncFunction} functions - the asynchronous functions to compose
 * @returns {Function} a function that composes the `functions` in order
 * @example
 *
 * // Requires lodash (or underscore), express3 and dresende's orm2.
 * // Part of an app, that fetches cats of the logged user.
 * // This example uses `seq` function to avoid overnesting and error
 * // handling clutter.
 * app.get('/cats', function(request, response) {
 *     var User = request.models.User;
 *     async.seq(
 *         User.get.bind(User),  // 'User.get' has signature (id, callback(err, data))
 *         function(user, fn) {
 *             user.getCats(fn);      // 'getCats' has signature (callback(err, data))
 *         }
 *     )(req.session.user_id, function (err, cats) {
 *         if (err) {
 *             console.error(err);
 *             response.json({ status: 'error', message: err.message });
 *         } else {
 *             response.json({ status: 'ok', message: 'Cats found', data: cats });
 *         }
 *     });
 * });
 */

/**
 * Wrap an async function and ensure it calls its callback on a later tick of
 * the event loop.  If the function already calls its callback on a next tick,
 * no extra deferral is added. This is useful for preventing stack overflows
 * (`RangeError: Maximum call stack size exceeded`) and generally keeping
 * [Zalgo](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony)
 * contained. ES2017 `async` functions are returned as-is -- they are immune
 * to Zalgo's corrupting influences, as they always resolve on a later tick.
 *
 * @name ensureAsync
 * @static
 * @memberOf module:Utils
 * @method
 * @category Util
 * @param {AsyncFunction} fn - an async function, one that expects a node-style
 * callback as its last argument.
 * @returns {AsyncFunction} Returns a wrapped function with the exact same call
 * signature as the function passed in.
 * @example
 *
 * function sometimesAsync(arg, callback) {
 *     if (cache[arg]) {
 *         return callback(null, cache[arg]); // this would be synchronous!!
 *     } else {
 *         doSomeIO(arg, callback); // this IO would be asynchronous
 *     }
 * }
 *
 * // this has a risk of stack overflows if many results are cached in a row
 * async.mapSeries(args, sometimesAsync, done);
 *
 * // this will defer sometimesAsync's callback if necessary,
 * // preventing stack overflows
 * async.mapSeries(args, async.ensureAsync(sometimesAsync), done);
 */

/**
 * Wraps the async function in another function that always completes with a
 * result object, even when it errors.
 *
 * The result object has either the property `error` or `value`.
 *
 * @name reflect
 * @static
 * @memberOf module:Utils
 * @method
 * @category Util
 * @param {AsyncFunction} fn - The async function you want to wrap
 * @returns {Function} - A function that always passes null to it's callback as
 * the error. The second argument to the callback will be an `object` with
 * either an `error` or a `value` property.
 * @example
 *
 * async.parallel([
 *     async.reflect(function(callback) {
 *         // do some stuff ...
 *         callback(null, 'one');
 *     }),
 *     async.reflect(function(callback) {
 *         // do some more stuff but error ...
 *         callback('bad stuff happened');
 *     }),
 *     async.reflect(function(callback) {
 *         // do some more stuff ...
 *         callback(null, 'two');
 *     })
 * ],
 * // optional callback
 * function(err, results) {
 *     // values
 *     // results[0].value = 'one'
 *     // results[1].error = 'bad stuff happened'
 *     // results[2].value = 'two'
 * });
 */

/**
 * auto fill event site if resource of type room having a SITE relation is added
 * // @TODO remove on EBHH #1690 cleanup
 */

/**
 * create record from json string
 *
 * @param {String} json
 * @param {Record} recordClass
 * @returns {Record}
 */

/**
 * get attendee validation with config
 */

/**
 * get combined status
 *
 * @param {CrewScheduling.PollReply[]} pollReplies
 * @returns {string}
 */

/**
 * get default data for a new event
 *
 * @return {Object} default data
 * @static
 */

/**
 * get eventRoleConfigs of given attendee grouped by given and all other roles
 *
 * @param {Calendar.Attender} attendee
 * @param {CrewScheduling.EventRoleConfig[]}
 * @param {CrewScheduling.SchedulingRole} [role]
 * @returns {Promise<{givenRoleAttERCs: CrewScheduling.EventRoleConfig[], otherRolesAttERCs: CrewScheduling.EventRoleConfig[]}>}
 */

/**
 * get event_ref from event
 *
 * NOTE: poll replies could reference to recur event instances before they get saved.
 * *     as recur_id are unique per container only we prefix by base_event_it which makes ref unique
 *
 * @param event
 * @returns {string|*}
 */

/**
 * returns SchedulingRoles optionally filtered by list of given roleIds
 * 
 * @param {String[]} [ids] optional, list of roleIds returns all if not st
 * @returns {Promise<CrewScheduling.SchedulingRole[]>}
 */

/**
 * returns a clone of given record (in current window context)
 *
 * @param {Record} record
 * @return {Record}
 */

/**
 * returns the field
 *
 * @param {Object} fieldDefinition
 * @return {Object}
 */

/**
 * type mapping
 * @type {Object}
 */

/**
 Returns the number of milliseconds between this date and date
 @param {Date} date (optional) Defaults to now
 @return {Number} The diff in milliseconds
 @member Date getElapsed
 */

/** Built-in value references. */

/** Detect free variable `exports`. */

/** Detect free variable `global` from Node.js. */

/** Detect free variable `self`. */

/** Error message constants. */

/** IDEA
          const capabilities = new AttendeeCapability(member);
          member.possibleUsages = async.reduce(await capabilities.getRoles(), [], (accu, role) => {
              return _.concat(accu, this.attendeeValidation.validate(event, attendee, role) ? `${event.id}:${role.id}`: []);
          });
          */

/** Used as references for various `Number` constants. */

/** Used as the maximum memoize cache size. */

/** Used as the size to enable large array optimizations. */

/** Used for built-in method references. */

/** Used to check objects for own properties. */

/** Used to compose bitmasks for cloning. */

/** Used to convert symbols to primitives and strings. */

/** Used to detect hot functions by number of calls within a span of milliseconds. */

/** Used to detect methods masquerading as native. */

/** Used to detect overreaching core-js shims. */

/** Used to detect unsigned integer values. */

/** Used to match `RegExp` flags from their coerced string values. */

/** Used to match property names within property paths. */

/** Used to resolve the decompiled source of functions. */

/** Used to stand-in for `undefined` hash values. */

/** `Object#toString` result references. */

/** private **/

/***/

/*, callback*/

/*, {
         xtype: 'checkbox',
         boxLabel: this.app.i18n._('Send export via E-Mail to all corresponding group members'),
         name: 'sendEmail'
      }*/

/*defaultOperator: 'in',*/

/*global Ext, Tine*/

/*global Ext, Tine, Locale*/

//

//                             i have no idea why i commited here, maybe just because of the id?

//                             let's solve it better the next time!

//             createFromEventTypes,

//             getFromEvent

//             me.eventTypesByPosition = eventTypesByPosition;

//             mergeActions,

//         .then(_.bind(function(eventTypesByPosition) {

//         me = this;

//         statics: {

//         this.

//         this.app = Tine.Tinebase.appMgr.get('CrewScheduling');

//         }

//         }, me));

//       for focus to work (e.g. iOS dosn't show keyborad)

//       this computation is necessary for memberTokens anyway so we can use it to reduce amount of validations

//      e.g. deleting a role might change the complete situation an all recent calculation

//     Ext.ns('Tine.CrewScheduling.Model');

//     Tine.CrewScheduling.Model.EventRoleConfigMixin = {

//     datetime: null,

//     event: null,

//     height: 300,

//     initComponent: function () {

//     return Tine.ChurchEdition.celebrantConstraintsProvider.getEventTypesByPosition()

//     var _ = window.lodash,

//     xtype: 'CrewScheduling-Poll-ParticipantsField',

//     }

//  4: all other attendee: existingERCs(of role).length && eRCs(of role).any(SRSA === `must`)

// #1465 don't memoize if an error occurred

// #endif

// #extractData into DataReader base, since the implementations are almost identical for JsonReader, XmlReader

// #if process.env.NODE_ENV !== 'unittest'

// ' background: linear-gradient(rgba({colorR}, {colorG}, {colorB}, 1), rgba(255,0,0,0));',

// ' border-color: {color};'

// - after each eventStore load capabilities needs to be recalculated

// - need to deal with dismissChanges?

// -> applies to existing records (on server). we don't have a concept for new (phantom) records yet!

// 1: current/given attendee: givenRoleAttERCs.any(SRSA === `must_not`)

// 2025-01-15 - cweiss - NOTE: we can't commit here as we would loose __meta modified

// 2: current/given attendee: otherRolesAttERCs.any(ORSA !== `yes`)

// 3: all other attendee: existingERCs(of role).any(SRSA === `must`)

// 5: current/given attendee: givenRoleAttERCs.length && eRCs(of role).any(SRSA === `must_not`)

// 6: current/given attendee: otherRolesAttERCs.length && eRCs(of role).any(ORSA !== `yes`)

// <-- That's what it's all about

// <-- There's implementation of ugly bit, setting the raw record-data.

// <-- copy phantom-id -> _phid, so we can remap in Store#onCreateRecords

// <-- true to return [Ext.data.Record]

// @NOTE multislect picker fires select on single record select and on multi changes

// @TODO enable if user has at least createPollGrant for one schedulingRole

// @TODO evaluate inputFilters. inputFilters run on server when the key ist set in the data whereas validators always run

// @TODO fill all if shortcut action is fallout otherwise just one at a time

// @TODO recheck on open and ask user for add/deletes?

// @TODO rethink how to validate existing attendee

// @TODO we don't need to reload groups & members, but freetime

// @TODO!

// @TODO: Calendar.getEvent does ot resolve event_types (at least for recur instances which are not yet saved (fakeid...))

// @TODO: set panel to readonly if user has no grants!

// @TODO: use grants model and set all grants to true for new records

// @see http://www.stucox.com/blog/you-cant-detect-a-touchscreen/

// @see https://github.com/ericmorand/twing/issues/332

// @see https://github.com/tine20/tine20/issues/6236

// @see https://stackoverflow.com/questions/17989777/detect-if-ios-is-using-webapp/40932301#40932301

// @todo how can we move that to the server?

// A bit ugly this, too bad the Record's raw data couldn't be saved in a common property named "raw" or something.

// A temporary value used to identify if the loop should be broken.

// Add methods to `Hash`.

// Add methods to `ListCache`.

// Add methods to `MapCache`.

// Add methods to `Stack`.

// Add properties assigned by `RegExp#exec`.

// Append our div, do our calculation and then remove it

// Avoid trying to start too many processing operations. This can occur

// Binary min-heap implementation used for priority queue.

// CONCATENATED MODULE: ../../CrewScheduling/js/Calendar/AttendeeGridPanelPlugin.js

// CONCATENATED MODULE: ../../CrewScheduling/js/Calendar/EventCSPanel.js

// CONCATENATED MODULE: ../../CrewScheduling/js/CrewScheduling.js

// CONCATENATED MODULE: ../../CrewScheduling/js/MainScreen.js

// CONCATENATED MODULE: ../../CrewScheduling/js/Model/PollParticipant.js

// CONCATENATED MODULE: ../../CrewScheduling/js/Poll/GridDialog.js

// CONCATENATED MODULE: ../../CrewScheduling/js/Poll/Participant/PollRepliesField.js

// CONCATENATED MODULE: ../../CrewScheduling/js/Poll/ParticipantsField.js

// CONCATENATED MODULE: ../../CrewScheduling/js/Poll/SchedulingRoleField.js

// CONCATENATED MODULE: ./util/markdown.js

// Check for circular references and return its corresponding clone.

// ESM COMPAT FLAG

// EXPORTS

// EXTERNAL MODULE: ../../CrewScheduling/js/Calendar/Model/Attendee.js

// EXTERNAL MODULE: ../../CrewScheduling/js/Calendar/Model/Event.js

// EXTERNAL MODULE: ../../CrewScheduling/js/Calendar/Model/eventType.js

// EXTERNAL MODULE: ../../CrewScheduling/js/Model/PollReply.js

// EXTERNAL MODULE: ../../CrewScheduling/js/Model/schedulingRole.js

// EXTERNAL MODULE: ../../library/ExtJS/src/util/Format.js

// EXTERNAL MODULE: ./node_modules/lodash/lodash.js

// EXTERNAL MODULE: ./node_modules/omit-deep-lodash/lib/index.js

// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js

// EXTERNAL MODULE: ./twingEnv.es6.js

// Exit early for strings to avoid a performance hit in some environments.

// Exports

// Expose `MapCache`.

// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.

// For old IE

// Had to add Check for XmlReader, #isData returns true if root is an Xml-object.  Want to check in order to re-factor

// IE returns elements with the 'name' and 'id' attribute.

// If rs is NOT an array but data IS, see if data contains just 1 record.  If so extract it and carry on.

// If url is already wrapped in quotes, remove them

// Implementation is stable, i.e. push time is considered for equal priorities

// Iterate to stop any buffered/delayed events

// Kahn's algorithm

// Legacy `process.binding('util')` for Node.js < 10.

// Module

// NOTE (from Ext docs): The default value used when a Record is being created by a Reader when the item referenced by the mapping does not exist in the data object (i.e. undefined). (defaults to "")

// NOTE value is outdated here

// NOTE we need to compute ourseve and can't use AttendeeCapability as we woun't have messages otherwise

// NOTE we recalculate all stuff here as merging is really complicated

// NOTE: Date.parseDate is an ext augmentation, should not be necessary for our ISO date format

// NOTE: Server can't handle this properly, see {tine20/vendor/zendframework/zendframework1/library/Zend/Filter/Input.php:998}

// NOTE: dynamic call - maybe someone want's to wrap the renderer

// NOTE: ext can't cope with spaces in id's (which get clss)

// NOTE: for existingAttendee, eventRoleConfig might be a roleType from his crewscheduling_roles -> in this case take the eRC from event

// NOTE: for transistent events id is not part of data but we need the transistent id e.g. for freeBusy info

// NOTE: gets overwritten with Record.getDefaultData (see below) for autogenerated models in appStarter

// NOTE: in case record is already loaded

// NOTE: member is capable if he's capable for one of the types

// NOTE: service stats need to be recomputed for a event after each attendee change in the event

// NOTE: some browsers require user interaction (like click events)

// NOTE: this alters existing records

// NOTE: this field default is meant for doctrine on server

// NOTE: ui config overwrites db config

// NOTE: we can't handle if user deletes all configs...

// NOTE: we can't use export / import syntax as es6 modules require strict mode and this code can't cope with it

// NOTE: we come here if attendee is capable for at least role/type combination

// NOTE: we don't bind store but wait for OK btn to start search as

// NOTE: we need to original focus to prevent screll out of view

// NOTE: we need to throttle here to avoid ui glitches

// NOTE: we need to work with the members from memberStore to have the computed stuff

// NOTE: without wrapping we end up in a layout loop

// Need to add 2 to ensure we leave enough space

// Node.js 0.10 has enumerable non-index properties on buffers.

// Override push to accept second parameter representing priority

// PhantomJS 2 has enumerable non-index properties on typed arrays.

// Recursively convert values (susceptible to call stack limits).

// Recursively flatten arrays (susceptible to call stack limits).

// Recursively populate clone (susceptible to call stack limits).

// Remove unshift functions

// Safari 9 has enumerable `arguments.length` in strict mode.

// See #1064, #1293

// See https://drafts.csswg.org/css-values-3/#urls

// Should url be wrapped?

// Simple doubly linked list (https://en.wikipedia.org/wiki/Doubly_linked_list) implementation

// Skip index properties.

// Special case to return head of iframe instead of iframe itself

// Start with a normal queue

// TODO return Ext.data.Response instance instead.  @see #readResponse

// TODO: Let exception-handler choose to commit or not rather than blindly rs.commit() here.

// TODO: create field registry, add fields here

// The use of `Object#toString` avoids issues with the `typeof` operator

// This will throw an exception if access to iframe is blocked

// Tine.Calendar.EventContextAttendeesItem = Ext.extend(Ext.menu.Item, {

// Tine.widgets.form.FieldManager.register('CrewScheduling', 'Poll', 'participants', {

// Try to read the message from Ext.Error.lang

// Use `util.types` for Node.js 10+.

// _('GENDER_Calendar')

// _('No Access') - we need this string in other apps if relation is not shown e.g. record_removed_reason

// a generic version of eachOf which can handle array, object, and iterator cases.

// add pre defined type

// add them back

// aliases

// align height to max number of attendee

// all role configs from event of role

// allow editing of roles

// allow overwriting date pattern in model

// alt -> prefer calendarOwner in intelligent mode

// android chrome

// arg: this vue crashes multipicker (using beforeselect)

// attendee _not_ member from csMemberStore!

// attendee from other eventMemberCell

// attendee is no mc yet :-(

// autofill event_types of role

// backward compatibility to store.js

// bind store

// block comment

// blow up if no successProperty

// call drain immediately if there are no tasks

// can't take an eRC twice ;-)

// change from ftb

// check if event_types allow to merge

// check if we can add this type into an existing config (same_role_same_attendee: Behavior if this role is also required from other event types)

// checks for null and undefined

// concurrency is optional, shift the args.

// conditionally promisify a function.

// console.error(participant.contact_id.n_fileas, poll_reply.event_ref, poll.data.scheduling_role.name, poll_reply.status)

// console.log(otherRolesAttERCs)

// const

// const capableContactIds = capableContactsMap[capableContactsMap.hasOwnProperty(eventTypeId) ? eventTypeId : null]

// const capableContactsMap = await csRole.getEventTypeCapableContactsMap(role)

// const eventTypeId = (isObject(eventType) ? eventType.id : eventType) || null

// const eventTypes =await async.map(roleTypes.event_types, async (type) => { return isString(type) ? (await getType(type)) : type})

// const keyFieldDef = Tine.Tinebase.widgets.keyfield.getDefinitionFromMC(this.constructor, this.titleProperty);

// contactid.eventid.roleid.reply

// contents only if days are limited

// contents only if partners

// convert hidden cols into implicit selection (to avoid data reloads)

// copy arguments first

// create method call params

// dataIndex: 'dtstart',

// deal with it

// default format by locale and with two decimals

// default type is auto

// define once

// define these as fixed properties, so people get useful errors when updating

// deprecated

// do not allow to set roles for new attendee for now as we don't support searching for users

// do we need to merge attendee?

// don't polute global namspace if no one else did

// due to cross-origin restrictions

// e.g. history panel

// each safe for removal

// eachOf implementation optimized for array-likes

// either no site set

// event is no mc yet :-(

// event type of event changes

// expand lists

// filter selection panel

// finally compute possible member cells (eventId:roleId)

// find connected wkdays as segments

// find container by selection or use defaultContainer by registry

// find record from dataset

// find record from deeplink

// flatten CrewScheduling.RequiredGroups

// for Object prototype breakers

// for async generators

// for prototype!

// for queue support.

// from MDN, handle object having an `hasOwnProperty` prop

// generate html

// get contacts for required roles

// get default data from fields config

// get stats of all services with fillingProbability > 0 of given event

// give browser some time to clear registry

// give dom time to update view

// grant helper fields

// handle spinner

// handle token selection

// header: 'Events',

// here to prevent dependency on Date.js

// hide events user has no readGrant (e.g. freebusy only)

// http://connalle.blogspot.com/2013/10/topological-sortingkahn-algorithm.html

// https://en.wikipedia.org/wiki/Topological_sorting#Kahn.27s_algorithm

// ical common fields

// ical common fields with multiple appearance

// if (!validation.isValid) console.error(validation)

// if default data is empty, it will be resolved to an array

// if dtstart is out of current period, take start of current period

// if member already attends to event -> take her

// if no id, call the auto id method

// if recordType defined make sure extraction functions are defined

// if result is Promise object

// if var app is a record class, the getMeta method is called

// if we are currently firing this event, don't disturb the listener loop

// import AttendeeCapability from './Model/AttendeeCapability';

// import a list of modules into the list

// in Safari 9 which returns 'object' for typed arrays and other constructors.

// in cs model does not belong to app so let's adopt it here instead of rewrite the generic code

// inline comment

// inpired by a similar function in mootools library

// instantiate response object

// internal

// istanbul ignore if

// istanbul ignore next

// lazy init

// lazy init tempalte

// let lists = []

// loadEventTypesByPosition: function() {

// make args available, in function below

// map to numeric Date:format('w')

// map: member -> csRoles, days, favorites

// mask invalid cells

// maybe later... eventRoleConfigs.length !== 1,

// member from memberSelectionPanel

// named sortTypes are supported, here we look them up

// needed for action updater / save and close in edit dialog

// ngettext('Calendar', 'Calendars', n); gettext('Calendars');

// ngettext('Event', 'Events', n); gettext('Events');

// no "this" reference for friendly out of scope calls

// no dependencies

// no dependencies, use the function as-is

// non async event listener returned false

// non objects are treated as ids and -> No Information

// normalize

// not a regex

// note: we're too late after MultiOptionsDialog, grid has cloned data of attendeeRole from picker.getValue

// one of['me', 'intelligent', 'calendarOwner', 'filteredAttendee', 'none']

// only return a promise if a callback is omitted

// or site is one of the selected

// otherwise add new roleConfig

// php for [className, functionName]

// prebuilt conversion function for this field, instead of

// prefer ACCEPTED

// prevent scrollTop

// private

// private function a store will createSequence upon

// protected.  Extensions place their error-strings here.

// re run validation

// re run validations

// recalculate config as removing event_types changes the complete situation

// recompute capabilities of all members regarding event

// reconfigure columns

// record.commit();

// recordClass: this.recordClass,

// recurse

// redirect only after logout (redirectAlways == false) - we can't wait for the browser here...

// relations

// reload mainscreen to make sure registry gets updated

// reload registry/mainscreen - registry problem?

// remove 'virtual' cols

// remove callback param

// remove css image flicker

// reset roles if type is not appropriate

// return data from filterPanel only

// return the list of modules as css string

// roleAttendees = _.map(_.filter(attendees, attendee => { return _.filter(attendee.crewscheduling_roles, { role: { id: role.id } }).length }), function (roleAttendee) {

// sanitize containerProperty label

// save roles for next newAttendee record

// scheduleable interface fields

// scheduleable interface fields with multiple appearance

// search for matching individuals if roles are set

// select column

// select row

// set attendee role

// set default sortType for strings and dates

// setup timer and call original function

// shift -> change intelligent <-> me

// show edited attendee in dialog

// simple cache for applying multiple behaviors to same selector does query multiple times

// some old browsers...

// sort by wkStart

// support array as roots

// support container records

// support grid renderers

// support records

// supress arrow

// switch to run as app has no view right

// switching every time we're reading a value

// take all data from fetched Event and merge attendee

// take defaults from role if type specific roleConfig is not set

// the else clause below will detect !this.isData and throw exception.

// this.filterPanel.init(this.membersGrid)

// this.store.remoteSort = false

// to adjust the next and last properties. We implement only the minimal functionality

// try {

// unbind store from view

// unique to Safari 2

// upstream config otherwise

// use 'interna' Ext we create and export here

// used for queues. This implementation assumes that the node provided by the user can be modified

// validate if the attendee is capable for one of the configured eventRoleConfigs

// vs Tine.Calendar.Model.Attender.getAttendeeStore.getSignature

// vs eventRoleConfig.getRoleTypesKey

// we do a strict check to return the element with only the id attribute

// we don't care about the error, let the global error handler

// we need some fieldDef to get filter working

// we need some fieldDef to get grouping store working

// weird...rs is an array but data isn't??  recurse but just send in the whole data object.

// weird...rs is an array but data isn't??  recurse but just send in the whole invalid data object.

// when callbacks resolve synchronously (#1267).

// with given roles

// without arguments the php class name of the this is returned

// work on fresh event to prevent concurrency conflicts

// works on IE10/11 and Surface

// } catch (e) { /* e.g. jest */ }

// });

// },

// }, Tine.widgets.form.FieldManager.CATEGORY_EDITDIALOG);

//TODO: return html element and get the format ?

//cm.config.filter((col) => { return !col.hidden });

//console.log('done nextCb')

//console.log('got value', value)

//console.log('iterateeCallback')

//console.log('replenish awaiting')

//console.log('replenish')

//rs.commit();

//{ name: 'attach' },

//{ name: 'contact' },

//{ name: 'exrule' },

//{ name: 'rdate' },

//{ name: 'related' },

//{ name: 'resources' },

//{ name: 'rstatus' },

//{label: i18n._('Created by'),                                                        field: 'created_by',         valueType: 'user'},

//{label: i18n._('Last Modified by'),                                                  field: 'last_modified_by',   valueType: 'user'},
