/* automatically generated by JSCoverage - do not edit */
if (typeof _$jscoverage === 'undefined') _$jscoverage = {};
if (! _$jscoverage['browserify/lib/watch.js']) {
  _$jscoverage['browserify/lib/watch.js'] = [];
  _$jscoverage['browserify/lib/watch.js'][1] = 0;
  _$jscoverage['browserify/lib/watch.js'][2] = 0;
  _$jscoverage['browserify/lib/watch.js'][3] = 0;
  _$jscoverage['browserify/lib/watch.js'][5] = 0;
  _$jscoverage['browserify/lib/watch.js'][6] = 0;
  _$jscoverage['browserify/lib/watch.js'][7] = 0;
  _$jscoverage['browserify/lib/watch.js'][10] = 0;
  _$jscoverage['browserify/lib/watch.js'][12] = 0;
  _$jscoverage['browserify/lib/watch.js'][14] = 0;
  _$jscoverage['browserify/lib/watch.js'][16] = 0;
  _$jscoverage['browserify/lib/watch.js'][17] = 0;
  _$jscoverage['browserify/lib/watch.js'][19] = 0;
  _$jscoverage['browserify/lib/watch.js'][20] = 0;
  _$jscoverage['browserify/lib/watch.js'][23] = 0;
  _$jscoverage['browserify/lib/watch.js'][26] = 0;
  _$jscoverage['browserify/lib/watch.js'][27] = 0;
  _$jscoverage['browserify/lib/watch.js'][28] = 0;
  _$jscoverage['browserify/lib/watch.js'][29] = 0;
  _$jscoverage['browserify/lib/watch.js'][30] = 0;
  _$jscoverage['browserify/lib/watch.js'][32] = 0;
  _$jscoverage['browserify/lib/watch.js'][33] = 0;
  _$jscoverage['browserify/lib/watch.js'][35] = 0;
  _$jscoverage['browserify/lib/watch.js'][36] = 0;
  _$jscoverage['browserify/lib/watch.js'][38] = 0;
  _$jscoverage['browserify/lib/watch.js'][39] = 0;
  _$jscoverage['browserify/lib/watch.js'][42] = 0;
  _$jscoverage['browserify/lib/watch.js'][43] = 0;
  _$jscoverage['browserify/lib/watch.js'][47] = 0;
  _$jscoverage['browserify/lib/watch.js'][48] = 0;
  _$jscoverage['browserify/lib/watch.js'][49] = 0;
  _$jscoverage['browserify/lib/watch.js'][51] = 0;
  _$jscoverage['browserify/lib/watch.js'][52] = 0;
  _$jscoverage['browserify/lib/watch.js'][54] = 0;
  _$jscoverage['browserify/lib/watch.js'][55] = 0;
  _$jscoverage['browserify/lib/watch.js'][58] = 0;
  _$jscoverage['browserify/lib/watch.js'][60] = 0;
  _$jscoverage['browserify/lib/watch.js'][61] = 0;
  _$jscoverage['browserify/lib/watch.js'][63] = 0;
  _$jscoverage['browserify/lib/watch.js'][64] = 0;
  _$jscoverage['browserify/lib/watch.js'][65] = 0;
  _$jscoverage['browserify/lib/watch.js'][66] = 0;
  _$jscoverage['browserify/lib/watch.js'][71] = 0;
  _$jscoverage['browserify/lib/watch.js'][72] = 0;
  _$jscoverage['browserify/lib/watch.js'][74] = 0;
}
_$jscoverage['browserify/lib/watch.js'][1]++;
var fs = require("fs");
_$jscoverage['browserify/lib/watch.js'][2]++;
var path = require("path");
_$jscoverage['browserify/lib/watch.js'][3]++;
var exists = fs.exists || path.exists;
_$jscoverage['browserify/lib/watch.js'][5]++;
module.exports = (function (w, opts) {
  _$jscoverage['browserify/lib/watch.js'][6]++;
  if (! w.watches) {
    _$jscoverage['browserify/lib/watch.js'][6]++;
    w.watches = [];
  }
  _$jscoverage['browserify/lib/watch.js'][7]++;
  w.register(reg.bind(null, w, opts));
});
_$jscoverage['browserify/lib/watch.js'][10]++;
function reg(w, opts, body, file) {
  _$jscoverage['browserify/lib/watch.js'][12]++;
  if (w.watches[file]) {
    _$jscoverage['browserify/lib/watch.js'][12]++;
    return body;
  }
  _$jscoverage['browserify/lib/watch.js'][14]++;
  var type = w.files[file]? "files": "entries";
  _$jscoverage['browserify/lib/watch.js'][16]++;
  var watch = (function () {
  _$jscoverage['browserify/lib/watch.js'][17]++;
  if (w.files[file] && w.files[file].synthetic) {
    _$jscoverage['browserify/lib/watch.js'][17]++;
    return;
  }
  _$jscoverage['browserify/lib/watch.js'][19]++;
  if (typeof opts === "object") {
    _$jscoverage['browserify/lib/watch.js'][20]++;
    w.watches[file] = fs.watch(file, opts, watcher);
  }
  else {
    _$jscoverage['browserify/lib/watch.js'][23]++;
    w.watches[file] = fs.watch(file, watcher);
  }
});
  _$jscoverage['browserify/lib/watch.js'][26]++;
  var pending = null;
  _$jscoverage['browserify/lib/watch.js'][27]++;
  var bundle = (function () {
  _$jscoverage['browserify/lib/watch.js'][28]++;
  if (pending) {
    _$jscoverage['browserify/lib/watch.js'][28]++;
    return;
  }
  _$jscoverage['browserify/lib/watch.js'][29]++;
  pending = setTimeout((function () {
  _$jscoverage['browserify/lib/watch.js'][30]++;
  pending = null;
  _$jscoverage['browserify/lib/watch.js'][32]++;
  if (w[type][file]) {
    _$jscoverage['browserify/lib/watch.js'][33]++;
    w.reload(file);
  }
  else {
    _$jscoverage['browserify/lib/watch.js'][35]++;
    if (type === "entries") {
      _$jscoverage['browserify/lib/watch.js'][36]++;
      w.addEntry(file);
    }
    else {
      _$jscoverage['browserify/lib/watch.js'][38]++;
      if (type === "files") {
        _$jscoverage['browserify/lib/watch.js'][39]++;
        w.require(file);
      }
    }
  }
  _$jscoverage['browserify/lib/watch.js'][42]++;
  w._cache = null;
  _$jscoverage['browserify/lib/watch.js'][43]++;
  w.emit("bundle");
}), 100);
});
  _$jscoverage['browserify/lib/watch.js'][47]++;
  var watcher = (function (event, filename) {
  _$jscoverage['browserify/lib/watch.js'][48]++;
  exists(file, (function (ex) {
  _$jscoverage['browserify/lib/watch.js'][49]++;
  if (! ex) {
    _$jscoverage['browserify/lib/watch.js'][51]++;
    if (w.files[file]) {
      _$jscoverage['browserify/lib/watch.js'][52]++;
      delete w.files[file];
    }
    else {
      _$jscoverage['browserify/lib/watch.js'][54]++;
      if (w.entries[file] !== undefined) {
        _$jscoverage['browserify/lib/watch.js'][55]++;
        w.appends.splice(w.entries[file], 1);
      }
    }
    _$jscoverage['browserify/lib/watch.js'][58]++;
    w._cache = null;
  }
  else {
    _$jscoverage['browserify/lib/watch.js'][60]++;
    if (event === "change") {
      _$jscoverage['browserify/lib/watch.js'][61]++;
      bundle();
    }
    else {
      _$jscoverage['browserify/lib/watch.js'][63]++;
      if (event === "rename") {
        _$jscoverage['browserify/lib/watch.js'][64]++;
        w.watches[file].close();
        _$jscoverage['browserify/lib/watch.js'][65]++;
        process.nextTick(watch);
        _$jscoverage['browserify/lib/watch.js'][66]++;
        bundle();
      }
    }
  }
}));
});
  _$jscoverage['browserify/lib/watch.js'][71]++;
  w.watches[file] = true;
  _$jscoverage['browserify/lib/watch.js'][72]++;
  process.nextTick(watch);
  _$jscoverage['browserify/lib/watch.js'][74]++;
  return body;
}
_$jscoverage['browserify/lib/watch.js'].source = ["var fs = require('fs');","var path = require('path');","var exists = fs.exists || path.exists;","","module.exports = function (w, opts) { ","    if (!w.watches) w.watches = [];","    w.register(reg.bind(null, w, opts));","};","","function reg (w, opts, body, file) {","    // if already being watched","    if (w.watches[file]) return body;","    ","    var type = w.files[file] ? 'files' : 'entries';","    ","    var watch = function () {","        if (w.files[file] &amp;&amp; w.files[file].synthetic) return;","        ","        if (typeof opts === 'object') {","            w.watches[file] = fs.watch(file, opts, watcher);","        }","        else {","            w.watches[file] = fs.watch(file, watcher);","        }","    };","    var pending = null;","    var bundle = function () {","        if (pending) return;","        pending = setTimeout(function () {","            pending = null;","            // modified","            if (w[type][file]) {","                w.reload(file);","            }","            else if (type === 'entries') {","                w.addEntry(file);","            }","            else if (type === 'files') {","                w.require(file);","            }","            ","            w._cache = null;","            w.emit('bundle');","        }, 100);","    };","    ","    var watcher = function (event, filename) {","        exists(file, function (ex) {","            if (!ex) {","                // deleted","                if (w.files[file]) {","                    delete w.files[file];","                }","                else if (w.entries[file] !== undefined) {","                    w.appends.splice(w.entries[file], 1);","                }","                ","                w._cache = null;","            }","            else if (event === 'change') {","                bundle();","            }","            else if (event === 'rename') {","                w.watches[file].close();","                process.nextTick(watch);","                bundle();","            }","        });","    };","    ","    w.watches[file] = true;","    process.nextTick(watch);","    ","    return body;","}"];
