Primitive logical block size detection
@param  {Number} [size=128]
@param  {Number} [step=128]
@param  {Number} [limit=8192]
@param  {Function} callback( err, blockSize )
@return {BlockDevice}
555057
function( size, step, limit, callback ) {

    var args = [].slice.call( arguments )
    callback = args.pop()

    if( this.fd == null )
      return callback.call( this, new Error( 'Invalid file descriptor' ) )

    limit = args.pop() || 0x2000
    step  = args.pop() || 0x80
    size  = args.pop() || 0x200

    var self = this

    var readBlock = function() {

      var block = Buffer.allocUnsafe( size )

      self.fs.read( self.fd, block, 0, size, 0, function( error, bytesRead ) {

        if( error != null ) {
          // EINVAL tells us that the block size
          // ain't just right (yet); everything
          // else is probably user error
          if( error.code !== 'EINVAL' )
            return callback.call( self, error )
          // Increase the blocksize by `step`
          size += step
          // Attempt next size read
          return readBlock()
        }

        // Check if bytes read correspond
        // to current block size
        if( size !== bytesRead ) {
          error = new Error( 'Size and bytes read mismatch: ' + size + ', ' + bytesRead )
          return callback.call( self, error )
        }

        // Check if the limit has been reached,
        // and terminate with error, if so
        if( size > limit ) {
          error = new Error( 'Reached limit of ' + limit + ' bytes' )
          return callback.call( self, error )
        }

        // We've successfully found the
        // smallest readable block size;
        // stop looking...
        self.blockSize = size
        callback.call( self, null, size )

      })

    }

    // Start reading blocks
    readBlock()

    return this

  }
482583
function() {
            if (stop) {
                return callback(new Error('cancelled'), currentOp / totalOps);
            }

            switch (state) {
                case 0:
                    // for (var i = 0; i < p; i++)...
                    Bi = i0 * 32 * r;

                    arraycopy(B, Bi, XY, 0, Yi);                       // ROMix - 1

                    state = 1;                                         // Move to ROMix 2
                    i1 = 0;

                    // Fall through

                case 1:

                    // Run up to 1000 steps of the first inner smix loop
                    var steps = N - i1;
                    if (steps > limit) { steps = limit; }
                    for (var i = 0; i < steps; i++) {                  // ROMix - 2
                        arraycopy(XY, 0, V, (i1 + i) * Yi, Yi)         // ROMix - 3
                        blockmix_salsa8(XY, Yi, r, x, _X);             // ROMix - 4
                    }

                    // for (var i = 0; i < N; i++)
                    i1 += steps;
                    currentOp += steps;

                    // Call the callback with the progress (optionally stopping us)
                    var percent10 = parseInt(1000 * currentOp / totalOps);
                    if (percent10 !== lastPercent10) {
                        stop = callback(null, currentOp / totalOps);
                        if (stop) { break; }
                        lastPercent10 = percent10;
                    }

                    if (i1 < N) {
                        break;
                    }

                    i1 = 0;                                          // Move to ROMix 6
                    state = 2;

                    // Fall through

                case 2:

                    // Run up to 1000 steps of the second inner smix loop
                    var steps = N - i1;
                    if (steps > limit) { steps = limit; }
                    for (var i = 0; i < steps; i++) {                // ROMix - 6
                        var offset = (2 * r - 1) * 16;               // ROMix - 7
                        var j = XY[offset] & (N - 1);
                        blockxor(V, j * Yi, XY, Yi);                 // ROMix - 8 (inner)
                        blockmix_salsa8(XY, Yi, r, x, _X);           // ROMix - 9 (outer)
                    }

                    // for (var i = 0; i < N; i++)...
                    i1 += steps;
                    currentOp += steps;

                    // Call the callback with the progress (optionally stopping us)
                    var percent10 = parseInt(1000 * currentOp / totalOps);
                    if (percent10 !== lastPercent10) {
                        stop = callback(null, currentOp / totalOps);
                        if (stop) { break; }
                        lastPercent10 = percent10;
                    }

                    if (i1 < N) {
                        break;
                    }

                    arraycopy(XY, 0, B, Bi, Yi);                     // ROMix - 10

                    // for (var i = 0; i < p; i++)...
                    i0++;
                    if (i0 < p) {
                        state = 0;
                        break;
                    }

                    b = [];
                    for (var i = 0; i < B.length; i++) {
                        b.push((B[i] >>  0) & 0xff);
                        b.push((B[i] >>  8) & 0xff);
                        b.push((B[i] >> 16) & 0xff);
                        b.push((B[i] >> 24) & 0xff);
                    }

                    var derivedKey = PBKDF2_HMAC_SHA256_OneIter(password, b, dkLen);

                    // Done; don't break (which would reschedule)
                    return callback(null, 1.0, derivedKey);
                }

                // Schedule the next steps
                nextTick(incrementalSMix);
            }
777722
function automagic(parentNode, childNode, options, callback) {
    Embedo.log('info', 'automagic', parentNode, childNode, options);
    options = options || {};
    callback = callback || function () {};

    if (!Embedo.utils.validateElement(parentNode) || !Embedo.utils.validateElement(childNode)) {
      return callback(new Error('HTMLElement does not exist in DOM.'));
    }

    Embedo.utils.watcher(
      options.id || Embedo.utils.uuid(),
      function () {
        var parent = {
          width: options.width || Embedo.utils.compute(parentNode, 'width'),
          height: options.height || Embedo.utils.compute(parentNode, 'height')
        };
        var child = {
          width: Embedo.utils.compute(childNode, 'width'),
          height: Embedo.utils.compute(childNode, 'height')
        };

        if (options.strict) {
          return callback(null, {
            width: parent.width,
            height: parent.height
          });
        }

        // Odd case when requested height is beyond limit of third party
        // Only apply when fixed width and heights are provided
        if (options.width && options.height) {
          var isOverflowing = child.width > parent.width || child.height > parent.height;

          if (options.width) {
            childNode.style.width = options.width + 'px';
          }

          if (options.height) {
            childNode.style.height = options.height + 'px';
          }

          if (isOverflowing) {
            var scale = Math.min(parent.width / child.width, parent.height / child.height);
            Embedo.utils.transform(childNode, 'scale(' + scale + ')');
          }
        }

        callback(null, {
          width: parent.width,
          height: parent.height
        });
      },
      500
    );
  }
208433
function( callback ) {

    var self = this

    // Close a previously opened handle
    if( this.fd != null ) {
      return this.close( function( error ) {
        if( error != null )
          return callback.call( self, error )
        self.open( callback )
      })
    }

    // Open a new fd handle
    debug( 'fs:open', this.mode, this.path )
    this.fs.open( this.path, this.mode, function( error, fd ) {

      if( error != null )
        return callback.call( self, error, fd )

      // Set file descriptor
      self.fd = fd

      // If no blockSize has been set, attempt to
      // detect it after opening the device
      if( self.blockSize == null || self.blockSize <= 0 ) {
        self.detectBlockSize( 0, 0, 0, function( error, blockSize ) {
          self.blockSize = blockSize || -1
          callback.call( self, error, self.fd )
        })
      } else {
        callback.call( self, error, fd )
      }

    })

    return this

  }
627431
function blockxor(S, Si, D, len) {
        for (var i = 0; i < len; i++) {
            D[i] ^= S[Si + i]
        }
    }
34307
function() {

            var step = this.step;

            return {
                x: -step,
                y: -step,
                width: 2 * step,
                height: 2 * step
            };
        }
189659
function processMaybeBlock(node, baseToken) {
            const firstToken = getFirstAndLastTokens(node).firstToken
            setOffsetToToken(
                firstToken,
                isLeftBrace(firstToken) ? 0 : 1,
                baseToken
            )
        }
651856
async function buildSrcCheckMinifiedSizeTask() {
	const stats = await fs.stat( './dist/Autolinker.min.js' );
	const sizeInKb = stats.size / 1000;
	const maxExpectedSizeInKb = 46;
	
	if( sizeInKb > maxExpectedSizeInKb ) {
		throw new Error( `
			Minified file size of ${sizeInKb.toFixed( 2 )}kb is greater than max 
			expected minified size of ${maxExpectedSizeInKb}kb
			
			This check is to make sure that a dependency is not accidentally 
			added which significantly inflates the size of Autolinker. If 
			additions to the codebase have been made though and a higher size 
			is expected, bump the 'maxExpectedSizeInKb' number in gulpfile.js
		`.trim().replace( /^\t*/gm, '' ) );
	}
}
454254
function callProcessor(eventType, data, callback) {
    var p = processors[eventType];
    // no processors
    if (p===undefined || p.length==0) {
      if (callback!==undefined) callback(data);
      return;
    }
    // now go through all processors
    var n = 0;
    var cbCalled = false;
    var cb = function(inData) {
      if (cbCalled) throw new Error("Internal error in "+eventType+" processor. Callback is called TWICE.");
      cbCalled = true;
      if (n < p.length) {
        cbCalled = false;
        p[n++](inData, cb);
      } else {
        if (callback!==undefined) callback(inData);
      }
    };
    cb(data);
  }
1149134
function(callback) {
      var asyncFunctions = [];

      for (var i = 0; i < numberOfRows; i++) {
        var rowsImagesPaths = imagesPaths.slice(i * numberOfColumns, i * numberOfColumns + numberOfColumns);
        var lineWidth = width;
        var lineHeight = height;
        var linePath = path.join(temporaryDirectoryPath, 'line-' + i);

        linesPaths.push(linePath);
        asyncFunctions.push(createLine(rowsImagesPaths, linePath, lineWidth, lineHeight, true, 100));
      }

      async.parallel(asyncFunctions, function(error, results) {
        if (error) return callback(error);

        results.forEach(function(line) {
          line.forEach(function(image) {
            if (image.image === path.join(temporaryDirectoryPath, 'transparent.png')) return;

            var spritePathChunks = path.parse(image.sprite).name.match(/-([0-9]+)$/);
            var lineIndex = (spritePathChunks && parseInt(spritePathChunks[1])) || 0;

            image.y = image.y + (lineIndex * height);
            image.sprite = destinationPath;
            images.push(image);
          });
        });

        callback();
      });
    }
347061
function processMaybeBlock (node, baseToken) {
    const firstToken = getFirstAndLastTokens(node).firstToken
    setOffset(firstToken, isLeftBrace(firstToken) ? 0 : 1, baseToken)
  }
426333
function(callback) {
		
		if(!this.ifLoad) {
			this.stack(this.pngToData, callback);
			return;
		}
		
		this.history.push('png decode');
		
		var that = this;
		
		var png = new this.png_node(this.data);
		png.decode(function (pixels) {
			
			that.width = png.width;
			that.height = png.height;
			that.data = pixels;
			that.bpp = 4;
			callback.call(that);
		});
		
		return;		
	}
248045
function length(callback) {
	        var self = this;
	        var promise = self.keys().then(function (keys) {
	            return keys.length;
	        });

	        executeCallback(promise, callback);
	        return promise;
	    }
677878
function (line, lineNum) {
            if (line.trim() === '') {
                return;
            }


            function logAnyDelimiterType(line) {
                blocks.forEach(function (blockDef, blockIdx) {
                    if (blockDef.start.test(line) === true) {
                        fileStartDelimiters.push([blockIdx, lineNum, line.trim()]);
                    }
                    if (blockDef.end.test(line) === true) {
                        fileEndDelimiters.push([blockIdx, lineNum, line.trim()]);
                    }
                });
            }

            logAnyDelimiterType(line);


            var startCount = fileStartDelimiters.length;
            var endCount = fileEndDelimiters.length;

            /**
             * Checks that amount of start/end blocks are equal.
             *
             * @param blockDef
             * @param blockIdx
             */
            var checkBlocksParity = function (blockDef, blockIdx) {
                var block = blockStats[blockIdx];

                /**
                 * 'if' for start block check
                 */
                if (blockDef.start.test(line) === true) {

                    block.lastStartLine = lineNum;

                    if (block.startCount > block.endCount) {
                        generateMessage({
                            pattern: line.trim(),
                            lineNum: block.lastStartLine,
                            caseNum: 1
                        });
                    }

                    block.startCount++;
                }


                /**
                 * 'if' for end block check
                 */
                if (blockDef.end.test(line) === true) {

                    block.lastEndLine = lineNum;

                    if (block.endCount >= block.startCount) {
                        generateMessage({
                            pattern: line.trim(),
                            lineNum: block.lastEndLine,
                            caseNum: 2
                        });
                    }

                    block.endCount++;
                }
            };


            /**
             * Checks if any two (or more) pairs of start/end
             * blocks are intersecting.
             *
             * @param blockDef
             * @param blockIdx
             */
            var checkBlocksIntersection = function (blockDef, blockIdx) {
                if (blockDef.start.test(line)) {
                    blocksStack.push([blockIdx, lineNum, line.trim()]);
                }

                if (blockDef.end.test(line) && typeof last(blocksStack) !== "undefined") {
                    if (last(blocksStack)[0] === blockIdx) {
                        blocksStack.pop();
                    } else {
                        generateMessage({
                            start: last(blocksStack)[2],
                            pattern: line.trim(),
                            lineNum: last(blocksStack)[1],
                            endLineNum: lineNum,
                            caseNum: 3
                        });
                    }
                } else if (startCount - endCount > 1) {
                    generateMessage({
                        start: last(blocksStack)[2],
                        pattern: line.trim(),
                        lineNum: last(blocksStack)[1],
                        endLineNum: lineNum,
                        caseNum: 3
                    });
                }
            };

            if (options.parityCheck === true) {
                blocks.forEach(checkBlocksParity);
            }

            if (options.intersectionCheck === true) {
                blocks.forEach(checkBlocksIntersection);
            }
        }
175045
function (data, callback) {
    if (typeof txDataQueue != "undefined" || txInProgress) {
      if (txDataQueue === undefined)
        txDataQueue = "";
      txDataQueue += data;
      return callback();
    } else {
      txDataQueue = data;
    }

    function writeChunk() {
      var chunk;
      var CHUNKSIZE = 20;
      if (txDataQueue.length <= CHUNKSIZE) {
        chunk = txDataQueue;
        txDataQueue = undefined;
      } else {
        chunk = txDataQueue.substr(0, CHUNKSIZE);
        txDataQueue = txDataQueue.substr(CHUNKSIZE);
      }
      txInProgress = true;
      console.log("BT> Sending " + JSON.stringify(chunk));
      try {
        winnus.write(chunk);
        setTimeout(function() {
          txInProgress = false;
          if (txDataQueue)
            writeChunk();
        }, 20);
      } catch (e) {
        console.log("BT> ERROR " + e);
        txDataQueue = undefined;
      }
    }
    writeChunk();
    return callback();
  }
767240
function(callback) {
    crypto.randomBytes(16, function(err, buffer) {
        if (err) {
            return callback(err);
        }

        return callback(null, buffer.toString('base64'));
    });
}
342339
function determineStepSize(min, max, unit, capacity) {
	var range = max - min;
	var interval = INTERVALS[unit];
	var milliseconds = interval.size;
	var steps = interval.steps;
	var i, ilen, factor;

	if (!steps) {
		return Math.ceil(range / (capacity * milliseconds));
	}

	for (i = 0, ilen = steps.length; i < ilen; ++i) {
		factor = steps[i];
		if (Math.ceil(range / (milliseconds * factor)) <= capacity) {
			break;
		}
	}

	return factor;
}