You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

1490 lines
43 KiB

  1. require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
  2. // Generated by CoffeeScript 1.7.1
  3. (function() {
  4. var characterGenerator, random;
  5. random = require('./random');
  6. characterGenerator = function(keyboardLayout, accuracy, checkInterval, text) {
  7. var currentIndex, shouldCorrect, typoIndex;
  8. currentIndex = -1;
  9. typoIndex = -1;
  10. shouldCorrect = false;
  11. return {
  12. next: function() {
  13. var result;
  14. if (currentIndex >= text.length - 1) {
  15. if (typoIndex !== -1) {
  16. shouldCorrect = true;
  17. } else {
  18. return null;
  19. }
  20. }
  21. if (!shouldCorrect) {
  22. currentIndex++;
  23. shouldCorrect = typoIndex !== -1 && currentIndex % checkInterval === 0;
  24. if (random.integerInRange(0, 100) > accuracy) {
  25. result = keyboardLayout.getAdjacentCharacter(text.charAt(currentIndex));
  26. if (result == null) {
  27. return text.charAt(currentIndex);
  28. }
  29. if (typoIndex === -1) {
  30. typoIndex = currentIndex;
  31. shouldCorrect = random.integerInRange(0, 1) === 1;
  32. }
  33. return result;
  34. } else {
  35. return text.charAt(currentIndex);
  36. }
  37. }
  38. if (currentIndex >= typoIndex) {
  39. currentIndex--;
  40. return '\b';
  41. }
  42. shouldCorrect = false;
  43. typoIndex = -1;
  44. return text.charAt(++currentIndex);
  45. }
  46. };
  47. };
  48. module.exports = characterGenerator;
  49. }).call(this);
  50. },{"./random":4}],2:[function(require,module,exports){
  51. // Generated by CoffeeScript 1.7.1
  52. (function() {
  53. var getAdjacentCharacter, isLowerCase, layout, random;
  54. random = require('./random');
  55. layout = [['`', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '='], ['', 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '[', ']', '\\'], ['', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ';', '\''], ['', 'Z', 'X', 'C', 'V', 'B', 'N', 'M', ',', '.', '/']];
  56. isLowerCase = function(character) {
  57. return character === character.toLowerCase();
  58. };
  59. getAdjacentCharacter = function(character) {
  60. var adjacentCharacter, adjacentCol, adjacentRow, col, randomNumber, row, _i, _j, _ref, _ref1;
  61. for (row = _i = 0, _ref = layout.length; _i < _ref; row = _i += 1) {
  62. for (col = _j = 0, _ref1 = layout[row].length; _j < _ref1; col = _j += 1) {
  63. if (layout[row][col].toLowerCase() !== character.toLowerCase()) {
  64. continue;
  65. }
  66. randomNumber = random.integerInRange(-1, 1);
  67. adjacentRow = row + randomNumber;
  68. if (adjacentRow >= layout.length || adjacentRow < 0) {
  69. adjacentRow += -2 * randomNumber;
  70. }
  71. if (col >= layout[adjacentRow].length) {
  72. col = layout[adjacentRow].length - 1;
  73. }
  74. if (randomNumber === 0) {
  75. randomNumber = [-1, 1][random.integerInRange(0, 1)];
  76. } else {
  77. randomNumber = random.integerInRange(-1, 1);
  78. }
  79. adjacentCol = col + randomNumber;
  80. if (adjacentCol >= layout[adjacentRow].length || adjacentCol < 0) {
  81. adjacentCol += -2 * randomNumber;
  82. }
  83. adjacentCharacter = layout[adjacentRow][adjacentCol];
  84. if (adjacentCharacter === '') {
  85. return getAdjacentCharacter(character);
  86. }
  87. if (isLowerCase(character)) {
  88. return adjacentCharacter.toLowerCase();
  89. }
  90. return adjacentCharacter;
  91. }
  92. }
  93. return null;
  94. };
  95. module.exports.getAdjacentCharacter = getAdjacentCharacter;
  96. }).call(this);
  97. },{"./random":4}],3:[function(require,module,exports){
  98. // Generated by CoffeeScript 1.7.1
  99. (function() {
  100. var PrioritySequence, Sequence, assert;
  101. assert = require('assert');
  102. Sequence = require('./sequence');
  103. PrioritySequence = (function() {
  104. function PrioritySequence(onWait) {
  105. this.onWait = onWait;
  106. this._sequences = [];
  107. this._waiting = true;
  108. if (typeof this.onWait === "function") {
  109. this.onWait();
  110. }
  111. }
  112. PrioritySequence.prototype._next = function() {
  113. var s, sequence, _i, _len, _ref;
  114. sequence = null;
  115. _ref = this._sequences;
  116. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  117. s = _ref[_i];
  118. if (s != null) {
  119. if (s.empty()) {
  120. continue;
  121. }
  122. sequence = s;
  123. break;
  124. }
  125. }
  126. if (sequence != null) {
  127. return sequence.next(this._next.bind(this));
  128. } else {
  129. this._sequences = [];
  130. this._waiting = true;
  131. return typeof this.onWait === "function" ? this.onWait() : void 0;
  132. }
  133. };
  134. PrioritySequence.prototype.then = function(priority, fn) {
  135. assert.ok(priority != null, 'The priority must be specified');
  136. assert.strictEqual(typeof priority, 'number', 'Priority must be a number');
  137. assert.strictEqual(~~priority, priority, 'Priority must be an integer');
  138. assert.ok(priority >= 0, 'Priority must be a positive integer');
  139. assert.ok(fn != null, 'The function must be specified');
  140. if (this._sequences[priority] == null) {
  141. this._sequences[priority] = new Sequence();
  142. }
  143. this._sequences[priority].add(fn);
  144. if (this._waiting) {
  145. this._waiting = false;
  146. return this._next();
  147. }
  148. };
  149. return PrioritySequence;
  150. })();
  151. module.exports = PrioritySequence;
  152. }).call(this);
  153. },{"./sequence":5,"assert":9}],4:[function(require,module,exports){
  154. // Generated by CoffeeScript 1.7.1
  155. (function() {
  156. var assert, integerInRange;
  157. assert = require('assert');
  158. integerInRange = function(min, max) {
  159. assert.ok(min != null, 'The minimum must be specified');
  160. assert.strictEqual(typeof min, 'number', 'Min must be a Number');
  161. assert.strictEqual(~~min, min, 'Min must be an integer');
  162. assert.ok(max != null, 'The maximum must be specified');
  163. assert.strictEqual(typeof max, 'number', 'Max must be a Number');
  164. assert.strictEqual(~~max, max, 'Max must be an integer');
  165. assert.strictEqual(min <= max, true, 'Min must be less than or equal to Max');
  166. if (min === max) {
  167. return min;
  168. }
  169. return Math.floor(Math.random() * (max - min + 1)) + min;
  170. };
  171. module.exports.integerInRange = integerInRange;
  172. }).call(this);
  173. },{"assert":9}],5:[function(require,module,exports){
  174. // Generated by CoffeeScript 1.7.1
  175. (function() {
  176. var Sequence, assert;
  177. assert = require('assert');
  178. Sequence = (function() {
  179. function Sequence() {
  180. this._queue = [];
  181. }
  182. Sequence.prototype.next = function(cb) {
  183. var fn;
  184. if (!this.empty()) {
  185. fn = this._queue.shift();
  186. return fn(cb);
  187. }
  188. };
  189. Sequence.prototype.add = function(fn) {
  190. assert.ok(fn != null, 'The function must be specified');
  191. return this._queue.push(fn);
  192. };
  193. Sequence.prototype.empty = function() {
  194. return this._queue.length === 0;
  195. };
  196. return Sequence;
  197. })();
  198. module.exports = Sequence;
  199. }).call(this);
  200. },{"assert":9}],6:[function(require,module,exports){
  201. (function (process){
  202. // Generated by CoffeeScript 1.7.1
  203. (function() {
  204. var PrioritySequence, Typewriter, assert, charactergenerator, random;
  205. assert = require('assert');
  206. PrioritySequence = require('./prioritysequence');
  207. random = require('./random');
  208. charactergenerator = require('./charactergenerator');
  209. Typewriter = (function() {
  210. function Typewriter() {
  211. this._prioritySequence = new PrioritySequence((function(_this) {
  212. return function() {
  213. return _this._sequenceLevel = 0;
  214. };
  215. })(this));
  216. }
  217. Typewriter.prototype.setTargetDomElement = function(targetDomElement) {
  218. assert.ok(targetDomElement instanceof Element, 'TargetDomElement must be an instance of Element');
  219. return this.targetDomElement = targetDomElement;
  220. };
  221. Typewriter.prototype.setAccuracy = function(accuracy) {
  222. assert.strictEqual(typeof accuracy, 'number', 'Accuracy must be a number');
  223. assert.ok(accuracy > 0 && accuracy <= 100, 'Accuracy must be greater than 0 and less than or equal to 100');
  224. return this.accuracy = accuracy;
  225. };
  226. Typewriter.prototype.setMinimumSpeed = function(minimumSpeed) {
  227. assert.strictEqual(typeof minimumSpeed, 'number', 'MinimumSpeed must be a number');
  228. assert.ok(minimumSpeed > 0, 'MinimumSpeed must be greater than 0');
  229. if ((this.maximumSpeed != null) && minimumSpeed > this.maximumSpeed) {
  230. return this.minimumSpeed = this.maximumSpeed;
  231. } else {
  232. return this.minimumSpeed = minimumSpeed;
  233. }
  234. };
  235. Typewriter.prototype.setMaximumSpeed = function(maximumSpeed) {
  236. assert.strictEqual(typeof maximumSpeed, 'number', 'MaximumSpeed must be a number');
  237. assert.ok(maximumSpeed > 0, 'MaximumSpeed must be greater than 0');
  238. if ((this.minimumSpeed != null) && this.minimumSpeed > maximumSpeed) {
  239. return this.maximumSpeed = minimumSpeed;
  240. } else {
  241. return this.maximumSpeed = maximumSpeed;
  242. }
  243. };
  244. Typewriter.prototype.setKeyboardLayout = function(keyboardLayout) {
  245. assert.strictEqual(typeof keyboardLayout.getAdjacentCharacter, 'function', 'KeyboardLayout must have an exported getAdjacentCharacter method');
  246. return this.keyboardLayout = keyboardLayout;
  247. };
  248. Typewriter.prototype._makeChainable = function(cb, fn) {
  249. var shadow;
  250. shadow = Object.create(this);
  251. shadow._sequenceLevel = this._sequenceLevel;
  252. this._prioritySequence.then(this._sequenceLevel, function(next) {
  253. return process.nextTick(function() {
  254. return fn(function() {
  255. if (cb != null) {
  256. cb.call(shadow);
  257. }
  258. return next();
  259. });
  260. });
  261. });
  262. if (cb != null) {
  263. this._sequenceLevel++;
  264. }
  265. if ((cb == null) || this.hasOwnProperty('_prioritySequence')) {
  266. return this;
  267. }
  268. };
  269. Typewriter.prototype.clear = function(cb) {
  270. return this._makeChainable(cb, (function(_this) {
  271. return function(done) {
  272. var child;
  273. while ((child = _this.targetDomElement.lastChild) != null) {
  274. _this.targetDomElement.removeChild(child);
  275. }
  276. return done();
  277. };
  278. })(this));
  279. };
  280. Typewriter.prototype.waitRange = function(millisMin, millisMax, cb) {
  281. return this._makeChainable(cb, (function(_this) {
  282. return function(done) {
  283. return setTimeout(done, random.integerInRange(millisMin, millisMax));
  284. };
  285. })(this));
  286. };
  287. Typewriter.prototype.wait = function(millis, cb) {
  288. return this.waitRange(millis, millis, cb);
  289. };
  290. Typewriter.prototype.put = function(text, cb) {
  291. return this._makeChainable(cb, (function(_this) {
  292. return function(done) {
  293. var child, element;
  294. element = document.createElement('div');
  295. element.innerHTML = text;
  296. while ((child = element.firstChild) != null) {
  297. _this.targetDomElement.appendChild(child);
  298. }
  299. return done();
  300. };
  301. })(this));
  302. };
  303. Typewriter.prototype["delete"] = function(cb) {
  304. return this._makeChainable(cb, (function(_this) {
  305. return function(done) {
  306. _this.targetDomElement.removeChild(_this.targetDomElement.lastChild);
  307. return done();
  308. };
  309. })(this));
  310. };
  311. Typewriter.prototype.type = function(text, cb) {
  312. var char, checkInterval, gen;
  313. checkInterval = (this.minimumSpeed + this.maximumSpeed) / 2;
  314. gen = charactergenerator(this.keyboardLayout, this.accuracy, checkInterval, text);
  315. while ((char = gen.next()) !== null) {
  316. if (char !== '\b') {
  317. this.put(char);
  318. } else {
  319. this["delete"]();
  320. }
  321. this.waitRange(~~(1000 / this.maximumSpeed), ~~(1000 / this.minimumSpeed));
  322. }
  323. return this.wait(0, cb);
  324. };
  325. return Typewriter;
  326. })();
  327. module.exports = Typewriter;
  328. }).call(this);
  329. }).call(this,require("FWaASH"))
  330. },{"./charactergenerator":1,"./prioritysequence":3,"./random":4,"FWaASH":13,"assert":9}],"OPj7T5":[function(require,module,exports){
  331. // Generated by CoffeeScript 1.7.1
  332. (function() {
  333. var Typewriter, TypewriterBuilder, assert;
  334. assert = require('assert');
  335. Typewriter = require('./typewriter');
  336. TypewriterBuilder = function(targetDomElement) {
  337. var typewriter;
  338. typewriter = new Typewriter();
  339. typewriter.setTargetDomElement(targetDomElement);
  340. return {
  341. withAccuracy: function(accuracy) {
  342. this.accuracy = accuracy;
  343. typewriter.setAccuracy(this.accuracy);
  344. return this;
  345. },
  346. withMinimumSpeed: function(minimumSpeed) {
  347. this.minimumSpeed = minimumSpeed;
  348. typewriter.setMinimumSpeed(this.minimumSpeed);
  349. return this;
  350. },
  351. withMaximumSpeed: function(maximumSpeed) {
  352. this.maximumSpeed = maximumSpeed;
  353. typewriter.setMaximumSpeed(this.maximumSpeed);
  354. return this;
  355. },
  356. withKeyboardLayout: function(keyboardLayout) {
  357. this.keyboardLayout = keyboardLayout;
  358. typewriter.setKeyboardLayout(this.keyboardLayout);
  359. return this;
  360. },
  361. build: function() {
  362. assert.ok(this.accuracy != null, 'Accuracy must be set');
  363. assert.ok(this.minimumSpeed != null, 'MinimumSpeed must be set');
  364. assert.ok(this.maximumSpeed != null, 'MaximumSpeed must be set');
  365. if (this.keyboardLayout == null) {
  366. typewriter.setKeyboardLayout(require('./defaultkeyboardlayout'));
  367. }
  368. return typewriter;
  369. }
  370. };
  371. };
  372. module.exports = TypewriterBuilder;
  373. }).call(this);
  374. },{"./defaultkeyboardlayout":2,"./typewriter":6,"assert":9}],"typewriter":[function(require,module,exports){
  375. module.exports=require('OPj7T5');
  376. },{}],9:[function(require,module,exports){
  377. // http://wiki.commonjs.org/wiki/Unit_Testing/1.0
  378. //
  379. // THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
  380. //
  381. // Originally from narwhal.js (http://narwhaljs.org)
  382. // Copyright (c) 2009 Thomas Robinson <280north.com>
  383. //
  384. // Permission is hereby granted, free of charge, to any person obtaining a copy
  385. // of this software and associated documentation files (the 'Software'), to
  386. // deal in the Software without restriction, including without limitation the
  387. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  388. // sell copies of the Software, and to permit persons to whom the Software is
  389. // furnished to do so, subject to the following conditions:
  390. //
  391. // The above copyright notice and this permission notice shall be included in
  392. // all copies or substantial portions of the Software.
  393. //
  394. // THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  395. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  396. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  397. // AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  398. // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  399. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  400. // when used in node, this will actually load the util module we depend on
  401. // versus loading the builtin util module as happens otherwise
  402. // this is a bug in node module loading as far as I am concerned
  403. var util = require('util/');
  404. var pSlice = Array.prototype.slice;
  405. var hasOwn = Object.prototype.hasOwnProperty;
  406. // 1. The assert module provides functions that throw
  407. // AssertionError's when particular conditions are not met. The
  408. // assert module must conform to the following interface.
  409. var assert = module.exports = ok;
  410. // 2. The AssertionError is defined in assert.
  411. // new assert.AssertionError({ message: message,
  412. // actual: actual,
  413. // expected: expected })
  414. assert.AssertionError = function AssertionError(options) {
  415. this.name = 'AssertionError';
  416. this.actual = options.actual;
  417. this.expected = options.expected;
  418. this.operator = options.operator;
  419. if (options.message) {
  420. this.message = options.message;
  421. this.generatedMessage = false;
  422. } else {
  423. this.message = getMessage(this);
  424. this.generatedMessage = true;
  425. }
  426. var stackStartFunction = options.stackStartFunction || fail;
  427. if (Error.captureStackTrace) {
  428. Error.captureStackTrace(this, stackStartFunction);
  429. }
  430. else {
  431. // non v8 browsers so we can have a stacktrace
  432. var err = new Error();
  433. if (err.stack) {
  434. var out = err.stack;
  435. // try to strip useless frames
  436. var fn_name = stackStartFunction.name;
  437. var idx = out.indexOf('\n' + fn_name);
  438. if (idx >= 0) {
  439. // once we have located the function frame
  440. // we need to strip out everything before it (and its line)
  441. var next_line = out.indexOf('\n', idx + 1);
  442. out = out.substring(next_line + 1);
  443. }
  444. this.stack = out;
  445. }
  446. }
  447. };
  448. // assert.AssertionError instanceof Error
  449. util.inherits(assert.AssertionError, Error);
  450. function replacer(key, value) {
  451. if (util.isUndefined(value)) {
  452. return '' + value;
  453. }
  454. if (util.isNumber(value) && (isNaN(value) || !isFinite(value))) {
  455. return value.toString();
  456. }
  457. if (util.isFunction(value) || util.isRegExp(value)) {
  458. return value.toString();
  459. }
  460. return value;
  461. }
  462. function truncate(s, n) {
  463. if (util.isString(s)) {
  464. return s.length < n ? s : s.slice(0, n);
  465. } else {
  466. return s;
  467. }
  468. }
  469. function getMessage(self) {
  470. return truncate(JSON.stringify(self.actual, replacer), 128) + ' ' +
  471. self.operator + ' ' +
  472. truncate(JSON.stringify(self.expected, replacer), 128);
  473. }
  474. // At present only the three keys mentioned above are used and
  475. // understood by the spec. Implementations or sub modules can pass
  476. // other keys to the AssertionError's constructor - they will be
  477. // ignored.
  478. // 3. All of the following functions must throw an AssertionError
  479. // when a corresponding condition is not met, with a message that
  480. // may be undefined if not provided. All assertion methods provide
  481. // both the actual and expected values to the assertion error for
  482. // display purposes.
  483. function fail(actual, expected, message, operator, stackStartFunction) {
  484. throw new assert.AssertionError({
  485. message: message,
  486. actual: actual,
  487. expected: expected,
  488. operator: operator,
  489. stackStartFunction: stackStartFunction
  490. });
  491. }
  492. // EXTENSION! allows for well behaved errors defined elsewhere.
  493. assert.fail = fail;
  494. // 4. Pure assertion tests whether a value is truthy, as determined
  495. // by !!guard.
  496. // assert.ok(guard, message_opt);
  497. // This statement is equivalent to assert.equal(true, !!guard,
  498. // message_opt);. To test strictly for the value true, use
  499. // assert.strictEqual(true, guard, message_opt);.
  500. function ok(value, message) {
  501. if (!value) fail(value, true, message, '==', assert.ok);
  502. }
  503. assert.ok = ok;
  504. // 5. The equality assertion tests shallow, coercive equality with
  505. // ==.
  506. // assert.equal(actual, expected, message_opt);
  507. assert.equal = function equal(actual, expected, message) {
  508. if (actual != expected) fail(actual, expected, message, '==', assert.equal);
  509. };
  510. // 6. The non-equality assertion tests for whether two objects are not equal
  511. // with != assert.notEqual(actual, expected, message_opt);
  512. assert.notEqual = function notEqual(actual, expected, message) {
  513. if (actual == expected) {
  514. fail(actual, expected, message, '!=', assert.notEqual);
  515. }
  516. };
  517. // 7. The equivalence assertion tests a deep equality relation.
  518. // assert.deepEqual(actual, expected, message_opt);
  519. assert.deepEqual = function deepEqual(actual, expected, message) {
  520. if (!_deepEqual(actual, expected)) {
  521. fail(actual, expected, message, 'deepEqual', assert.deepEqual);
  522. }
  523. };
  524. function _deepEqual(actual, expected) {
  525. // 7.1. All identical values are equivalent, as determined by ===.
  526. if (actual === expected) {
  527. return true;
  528. } else if (util.isBuffer(actual) && util.isBuffer(expected)) {
  529. if (actual.length != expected.length) return false;
  530. for (var i = 0; i < actual.length; i++) {
  531. if (actual[i] !== expected[i]) return false;
  532. }
  533. return true;
  534. // 7.2. If the expected value is a Date object, the actual value is
  535. // equivalent if it is also a Date object that refers to the same time.
  536. } else if (util.isDate(actual) && util.isDate(expected)) {
  537. return actual.getTime() === expected.getTime();
  538. // 7.3 If the expected value is a RegExp object, the actual value is
  539. // equivalent if it is also a RegExp object with the same source and
  540. // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
  541. } else if (util.isRegExp(actual) && util.isRegExp(expected)) {
  542. return actual.source === expected.source &&
  543. actual.global === expected.global &&
  544. actual.multiline === expected.multiline &&
  545. actual.lastIndex === expected.lastIndex &&
  546. actual.ignoreCase === expected.ignoreCase;
  547. // 7.4. Other pairs that do not both pass typeof value == 'object',
  548. // equivalence is determined by ==.
  549. } else if (!util.isObject(actual) && !util.isObject(expected)) {
  550. return actual == expected;
  551. // 7.5 For all other Object pairs, including Array objects, equivalence is
  552. // determined by having the same number of owned properties (as verified
  553. // with Object.prototype.hasOwnProperty.call), the same set of keys
  554. // (although not necessarily the same order), equivalent values for every
  555. // corresponding key, and an identical 'prototype' property. Note: this
  556. // accounts for both named and indexed properties on Arrays.
  557. } else {
  558. return objEquiv(actual, expected);
  559. }
  560. }
  561. function isArguments(object) {
  562. return Object.prototype.toString.call(object) == '[object Arguments]';
  563. }
  564. function objEquiv(a, b) {
  565. if (util.isNullOrUndefined(a) || util.isNullOrUndefined(b))
  566. return false;
  567. // an identical 'prototype' property.
  568. if (a.prototype !== b.prototype) return false;
  569. //~~~I've managed to break Object.keys through screwy arguments passing.
  570. // Converting to array solves the problem.
  571. if (isArguments(a)) {
  572. if (!isArguments(b)) {
  573. return false;
  574. }
  575. a = pSlice.call(a);
  576. b = pSlice.call(b);
  577. return _deepEqual(a, b);
  578. }
  579. try {
  580. var ka = objectKeys(a),
  581. kb = objectKeys(b),
  582. key, i;
  583. } catch (e) {//happens when one is a string literal and the other isn't
  584. return false;
  585. }
  586. // having the same number of owned properties (keys incorporates
  587. // hasOwnProperty)
  588. if (ka.length != kb.length)
  589. return false;
  590. //the same set of keys (although not necessarily the same order),
  591. ka.sort();
  592. kb.sort();
  593. //~~~cheap key test
  594. for (i = ka.length - 1; i >= 0; i--) {
  595. if (ka[i] != kb[i])
  596. return false;
  597. }
  598. //equivalent values for every corresponding key, and
  599. //~~~possibly expensive deep test
  600. for (i = ka.length - 1; i >= 0; i--) {
  601. key = ka[i];
  602. if (!_deepEqual(a[key], b[key])) return false;
  603. }
  604. return true;
  605. }
  606. // 8. The non-equivalence assertion tests for any deep inequality.
  607. // assert.notDeepEqual(actual, expected, message_opt);
  608. assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
  609. if (_deepEqual(actual, expected)) {
  610. fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);
  611. }
  612. };
  613. // 9. The strict equality assertion tests strict equality, as determined by ===.
  614. // assert.strictEqual(actual, expected, message_opt);
  615. assert.strictEqual = function strictEqual(actual, expected, message) {
  616. if (actual !== expected) {
  617. fail(actual, expected, message, '===', assert.strictEqual);
  618. }
  619. };
  620. // 10. The strict non-equality assertion tests for strict inequality, as
  621. // determined by !==. assert.notStrictEqual(actual, expected, message_opt);
  622. assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
  623. if (actual === expected) {
  624. fail(actual, expected, message, '!==', assert.notStrictEqual);
  625. }
  626. };
  627. function expectedException(actual, expected) {
  628. if (!actual || !expected) {
  629. return false;
  630. }
  631. if (Object.prototype.toString.call(expected) == '[object RegExp]') {
  632. return expected.test(actual);
  633. } else if (actual instanceof expected) {
  634. return true;
  635. } else if (expected.call({}, actual) === true) {
  636. return true;
  637. }
  638. return false;
  639. }
  640. function _throws(shouldThrow, block, expected, message) {
  641. var actual;
  642. if (util.isString(expected)) {
  643. message = expected;
  644. expected = null;
  645. }
  646. try {
  647. block();
  648. } catch (e) {
  649. actual = e;
  650. }
  651. message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
  652. (message ? ' ' + message : '.');
  653. if (shouldThrow && !actual) {
  654. fail(actual, expected, 'Missing expected exception' + message);
  655. }
  656. if (!shouldThrow && expectedException(actual, expected)) {
  657. fail(actual, expected, 'Got unwanted exception' + message);
  658. }
  659. if ((shouldThrow && actual && expected &&
  660. !expectedException(actual, expected)) || (!shouldThrow && actual)) {
  661. throw actual;
  662. }
  663. }
  664. // 11. Expected to throw an error:
  665. // assert.throws(block, Error_opt, message_opt);
  666. assert.throws = function(block, /*optional*/error, /*optional*/message) {
  667. _throws.apply(this, [true].concat(pSlice.call(arguments)));
  668. };
  669. // EXTENSION! This is annoying to write outside this module.
  670. assert.doesNotThrow = function(block, /*optional*/message) {
  671. _throws.apply(this, [false].concat(pSlice.call(arguments)));
  672. };
  673. assert.ifError = function(err) { if (err) {throw err;}};
  674. var objectKeys = Object.keys || function (obj) {
  675. var keys = [];
  676. for (var key in obj) {
  677. if (hasOwn.call(obj, key)) keys.push(key);
  678. }
  679. return keys;
  680. };
  681. },{"util/":11}],10:[function(require,module,exports){
  682. module.exports = function isBuffer(arg) {
  683. return arg && typeof arg === 'object'
  684. && typeof arg.copy === 'function'
  685. && typeof arg.fill === 'function'
  686. && typeof arg.readUInt8 === 'function';
  687. }
  688. },{}],11:[function(require,module,exports){
  689. (function (process,global){
  690. // Copyright Joyent, Inc. and other Node contributors.
  691. //
  692. // Permission is hereby granted, free of charge, to any person obtaining a
  693. // copy of this software and associated documentation files (the
  694. // "Software"), to deal in the Software without restriction, including
  695. // without limitation the rights to use, copy, modify, merge, publish,
  696. // distribute, sublicense, and/or sell copies of the Software, and to permit
  697. // persons to whom the Software is furnished to do so, subject to the
  698. // following conditions:
  699. //
  700. // The above copyright notice and this permission notice shall be included
  701. // in all copies or substantial portions of the Software.
  702. //
  703. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  704. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  705. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  706. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  707. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  708. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  709. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  710. var formatRegExp = /%[sdj%]/g;
  711. exports.format = function(f) {
  712. if (!isString(f)) {
  713. var objects = [];
  714. for (var i = 0; i < arguments.length; i++) {
  715. objects.push(inspect(arguments[i]));
  716. }
  717. return objects.join(' ');
  718. }
  719. var i = 1;
  720. var args = arguments;
  721. var len = args.length;
  722. var str = String(f).replace(formatRegExp, function(x) {
  723. if (x === '%%') return '%';
  724. if (i >= len) return x;
  725. switch (x) {
  726. case '%s': return String(args[i++]);
  727. case '%d': return Number(args[i++]);
  728. case '%j':
  729. try {
  730. return JSON.stringify(args[i++]);
  731. } catch (_) {
  732. return '[Circular]';
  733. }
  734. default:
  735. return x;
  736. }
  737. });
  738. for (var x = args[i]; i < len; x = args[++i]) {
  739. if (isNull(x) || !isObject(x)) {
  740. str += ' ' + x;
  741. } else {
  742. str += ' ' + inspect(x);
  743. }
  744. }
  745. return str;
  746. };
  747. // Mark that a method should not be used.
  748. // Returns a modified function which warns once by default.
  749. // If --no-deprecation is set, then it is a no-op.
  750. exports.deprecate = function(fn, msg) {
  751. // Allow for deprecating things in the process of starting up.
  752. if (isUndefined(global.process)) {
  753. return function() {
  754. return exports.deprecate(fn, msg).apply(this, arguments);
  755. };
  756. }
  757. if (process.noDeprecation === true) {
  758. return fn;
  759. }
  760. var warned = false;
  761. function deprecated() {
  762. if (!warned) {
  763. if (process.throwDeprecation) {
  764. throw new Error(msg);
  765. } else if (process.traceDeprecation) {
  766. console.trace(msg);
  767. } else {
  768. console.error(msg);
  769. }
  770. warned = true;
  771. }
  772. return fn.apply(this, arguments);
  773. }
  774. return deprecated;
  775. };
  776. var debugs = {};
  777. var debugEnviron;
  778. exports.debuglog = function(set) {
  779. if (isUndefined(debugEnviron))
  780. debugEnviron = process.env.NODE_DEBUG || '';
  781. set = set.toUpperCase();
  782. if (!debugs[set]) {
  783. if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
  784. var pid = process.pid;
  785. debugs[set] = function() {
  786. var msg = exports.format.apply(exports, arguments);
  787. console.error('%s %d: %s', set, pid, msg);
  788. };
  789. } else {
  790. debugs[set] = function() {};
  791. }
  792. }
  793. return debugs[set];
  794. };
  795. /**
  796. * Echos the value of a value. Trys to print the value out
  797. * in the best way possible given the different types.
  798. *
  799. * @param {Object} obj The object to print out.
  800. * @param {Object} opts Optional options object that alters the output.
  801. */
  802. /* legacy: obj, showHidden, depth, colors*/
  803. function inspect(obj, opts) {
  804. // default options
  805. var ctx = {
  806. seen: [],
  807. stylize: stylizeNoColor
  808. };
  809. // legacy...
  810. if (arguments.length >= 3) ctx.depth = arguments[2];
  811. if (arguments.length >= 4) ctx.colors = arguments[3];
  812. if (isBoolean(opts)) {
  813. // legacy...
  814. ctx.showHidden = opts;
  815. } else if (opts) {
  816. // got an "options" object
  817. exports._extend(ctx, opts);
  818. }
  819. // set default options
  820. if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
  821. if (isUndefined(ctx.depth)) ctx.depth = 2;
  822. if (isUndefined(ctx.colors)) ctx.colors = false;
  823. if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
  824. if (ctx.colors) ctx.stylize = stylizeWithColor;
  825. return formatValue(ctx, obj, ctx.depth);
  826. }
  827. exports.inspect = inspect;
  828. // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
  829. inspect.colors = {
  830. 'bold' : [1, 22],
  831. 'italic' : [3, 23],
  832. 'underline' : [4, 24],
  833. 'inverse' : [7, 27],
  834. 'white' : [37, 39],
  835. 'grey' : [90, 39],
  836. 'black' : [30, 39],
  837. 'blue' : [34, 39],
  838. 'cyan' : [36, 39],
  839. 'green' : [32, 39],
  840. 'magenta' : [35, 39],
  841. 'red' : [31, 39],
  842. 'yellow' : [33, 39]
  843. };
  844. // Don't use 'blue' not visible on cmd.exe
  845. inspect.styles = {
  846. 'special': 'cyan',
  847. 'number': 'yellow',
  848. 'boolean': 'yellow',
  849. 'undefined': 'grey',
  850. 'null': 'bold',
  851. 'string': 'green',
  852. 'date': 'magenta',
  853. // "name": intentionally not styling
  854. 'regexp': 'red'
  855. };
  856. function stylizeWithColor(str, styleType) {
  857. var style = inspect.styles[styleType];
  858. if (style) {
  859. return '\u001b[' + inspect.colors[style][0] + 'm' + str +
  860. '\u001b[' + inspect.colors[style][1] + 'm';
  861. } else {
  862. return str;
  863. }
  864. }
  865. function stylizeNoColor(str, styleType) {
  866. return str;
  867. }
  868. function arrayToHash(array) {
  869. var hash = {};
  870. array.forEach(function(val, idx) {
  871. hash[val] = true;
  872. });
  873. return hash;
  874. }
  875. function formatValue(ctx, value, recurseTimes) {
  876. // Provide a hook for user-specified inspect functions.
  877. // Check that value is an object with an inspect function on it
  878. if (ctx.customInspect &&
  879. value &&
  880. isFunction(value.inspect) &&
  881. // Filter out the util module, it's inspect function is special
  882. value.inspect !== exports.inspect &&
  883. // Also filter out any prototype objects using the circular check.
  884. !(value.constructor && value.constructor.prototype === value)) {
  885. var ret = value.inspect(recurseTimes, ctx);
  886. if (!isString(ret)) {
  887. ret = formatValue(ctx, ret, recurseTimes);
  888. }
  889. return ret;
  890. }
  891. // Primitive types cannot have properties
  892. var primitive = formatPrimitive(ctx, value);
  893. if (primitive) {
  894. return primitive;
  895. }
  896. // Look up the keys of the object.
  897. var keys = Object.keys(value);
  898. var visibleKeys = arrayToHash(keys);
  899. if (ctx.showHidden) {
  900. keys = Object.getOwnPropertyNames(value);
  901. }
  902. // IE doesn't make error fields non-enumerable
  903. // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
  904. if (isError(value)
  905. && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
  906. return formatError(value);
  907. }
  908. // Some type of object without properties can be shortcutted.
  909. if (keys.length === 0) {
  910. if (isFunction(value)) {
  911. var name = value.name ? ': ' + value.name : '';
  912. return ctx.stylize('[Function' + name + ']', 'special');
  913. }
  914. if (isRegExp(value)) {
  915. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  916. }
  917. if (isDate(value)) {
  918. return ctx.stylize(Date.prototype.toString.call(value), 'date');
  919. }
  920. if (isError(value)) {
  921. return formatError(value);
  922. }
  923. }
  924. var base = '', array = false, braces = ['{', '}'];
  925. // Make Array say that they are Array
  926. if (isArray(value)) {
  927. array = true;
  928. braces = ['[', ']'];
  929. }
  930. // Make functions say that they are functions
  931. if (isFunction(value)) {
  932. var n = value.name ? ': ' + value.name : '';
  933. base = ' [Function' + n + ']';
  934. }
  935. // Make RegExps say that they are RegExps
  936. if (isRegExp(value)) {
  937. base = ' ' + RegExp.prototype.toString.call(value);
  938. }
  939. // Make dates with properties first say the date
  940. if (isDate(value)) {
  941. base = ' ' + Date.prototype.toUTCString.call(value);
  942. }
  943. // Make error with message first say the error
  944. if (isError(value)) {
  945. base = ' ' + formatError(value);
  946. }
  947. if (keys.length === 0 && (!array || value.length == 0)) {
  948. return braces[0] + base + braces[1];
  949. }
  950. if (recurseTimes < 0) {
  951. if (isRegExp(value)) {
  952. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  953. } else {
  954. return ctx.stylize('[Object]', 'special');
  955. }
  956. }
  957. ctx.seen.push(value);
  958. var output;
  959. if (array) {
  960. output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
  961. } else {
  962. output = keys.map(function(key) {
  963. return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
  964. });
  965. }
  966. ctx.seen.pop();
  967. return reduceToSingleString(output, base, braces);
  968. }
  969. function formatPrimitive(ctx, value) {
  970. if (isUndefined(value))
  971. return ctx.stylize('undefined', 'undefined');
  972. if (isString(value)) {
  973. var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
  974. .replace(/'/g, "\\'")
  975. .replace(/\\"/g, '"') + '\'';
  976. return ctx.stylize(simple, 'string');
  977. }
  978. if (isNumber(value))
  979. return ctx.stylize('' + value, 'number');
  980. if (isBoolean(value))
  981. return ctx.stylize('' + value, 'boolean');
  982. // For some reason typeof null is "object", so special case here.
  983. if (isNull(value))
  984. return ctx.stylize('null', 'null');
  985. }
  986. function formatError(value) {
  987. return '[' + Error.prototype.toString.call(value) + ']';
  988. }
  989. function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
  990. var output = [];
  991. for (var i = 0, l = value.length; i < l; ++i) {
  992. if (hasOwnProperty(value, String(i))) {
  993. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  994. String(i), true));
  995. } else {
  996. output.push('');
  997. }
  998. }
  999. keys.forEach(function(key) {
  1000. if (!key.match(/^\d+$/)) {
  1001. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  1002. key, true));
  1003. }
  1004. });
  1005. return output;
  1006. }
  1007. function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
  1008. var name, str, desc;
  1009. desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
  1010. if (desc.get) {
  1011. if (desc.set) {
  1012. str = ctx.stylize('[Getter/Setter]', 'special');
  1013. } else {
  1014. str = ctx.stylize('[Getter]', 'special');
  1015. }
  1016. } else {
  1017. if (desc.set) {
  1018. str = ctx.stylize('[Setter]', 'special');
  1019. }
  1020. }
  1021. if (!hasOwnProperty(visibleKeys, key)) {
  1022. name = '[' + key + ']';
  1023. }
  1024. if (!str) {
  1025. if (ctx.seen.indexOf(desc.value) < 0) {
  1026. if (isNull(recurseTimes)) {
  1027. str = formatValue(ctx, desc.value, null);
  1028. } else {
  1029. str = formatValue(ctx, desc.value, recurseTimes - 1);
  1030. }
  1031. if (str.indexOf('\n') > -1) {
  1032. if (array) {
  1033. str = str.split('\n').map(function(line) {
  1034. return ' ' + line;
  1035. }).join('\n').substr(2);
  1036. } else {
  1037. str = '\n' + str.split('\n').map(function(line) {
  1038. return ' ' + line;
  1039. }).join('\n');
  1040. }
  1041. }
  1042. } else {
  1043. str = ctx.stylize('[Circular]', 'special');
  1044. }
  1045. }
  1046. if (isUndefined(name)) {
  1047. if (array && key.match(/^\d+$/)) {
  1048. return str;
  1049. }
  1050. name = JSON.stringify('' + key);
  1051. if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
  1052. name = name.substr(1, name.length - 2);
  1053. name = ctx.stylize(name, 'name');
  1054. } else {
  1055. name = name.replace(/'/g, "\\'")
  1056. .replace(/\\"/g, '"')
  1057. .replace(/(^"|"$)/g, "'");
  1058. name = ctx.stylize(name, 'string');
  1059. }
  1060. }
  1061. return name + ': ' + str;
  1062. }
  1063. function reduceToSingleString(output, base, braces) {
  1064. var numLinesEst = 0;
  1065. var length = output.reduce(function(prev, cur) {
  1066. numLinesEst++;
  1067. if (cur.indexOf('\n') >= 0) numLinesEst++;
  1068. return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
  1069. }, 0);
  1070. if (length > 60) {
  1071. return braces[0] +
  1072. (base === '' ? '' : base + '\n ') +
  1073. ' ' +
  1074. output.join(',\n ') +
  1075. ' ' +
  1076. braces[1];
  1077. }
  1078. return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
  1079. }
  1080. // NOTE: These type checking functions intentionally don't use `instanceof`
  1081. // because it is fragile and can be easily faked with `Object.create()`.
  1082. function isArray(ar) {
  1083. return Array.isArray(ar);
  1084. }
  1085. exports.isArray = isArray;
  1086. function isBoolean(arg) {
  1087. return typeof arg === 'boolean';
  1088. }
  1089. exports.isBoolean = isBoolean;
  1090. function isNull(arg) {
  1091. return arg === null;
  1092. }
  1093. exports.isNull = isNull;
  1094. function isNullOrUndefined(arg) {
  1095. return arg == null;
  1096. }
  1097. exports.isNullOrUndefined = isNullOrUndefined;
  1098. function isNumber(arg) {
  1099. return typeof arg === 'number';
  1100. }
  1101. exports.isNumber = isNumber;
  1102. function isString(arg) {
  1103. return typeof arg === 'string';
  1104. }
  1105. exports.isString = isString;
  1106. function isSymbol(arg) {
  1107. return typeof arg === 'symbol';
  1108. }
  1109. exports.isSymbol = isSymbol;
  1110. function isUndefined(arg) {
  1111. return arg === void 0;
  1112. }
  1113. exports.isUndefined = isUndefined;
  1114. function isRegExp(re) {
  1115. return isObject(re) && objectToString(re) === '[object RegExp]';
  1116. }
  1117. exports.isRegExp = isRegExp;
  1118. function isObject(arg) {
  1119. return typeof arg === 'object' && arg !== null;
  1120. }
  1121. exports.isObject = isObject;
  1122. function isDate(d) {
  1123. return isObject(d) && objectToString(d) === '[object Date]';
  1124. }
  1125. exports.isDate = isDate;
  1126. function isError(e) {
  1127. return isObject(e) &&
  1128. (objectToString(e) === '[object Error]' || e instanceof Error);
  1129. }
  1130. exports.isError = isError;
  1131. function isFunction(arg) {
  1132. return typeof arg === 'function';
  1133. }
  1134. exports.isFunction = isFunction;
  1135. function isPrimitive(arg) {
  1136. return arg === null ||
  1137. typeof arg === 'boolean' ||
  1138. typeof arg === 'number' ||
  1139. typeof arg === 'string' ||
  1140. typeof arg === 'symbol' || // ES6 symbol
  1141. typeof arg === 'undefined';
  1142. }
  1143. exports.isPrimitive = isPrimitive;
  1144. exports.isBuffer = require('./support/isBuffer');
  1145. function objectToString(o) {
  1146. return Object.prototype.toString.call(o);
  1147. }
  1148. function pad(n) {
  1149. return n < 10 ? '0' + n.toString(10) : n.toString(10);
  1150. }
  1151. var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
  1152. 'Oct', 'Nov', 'Dec'];
  1153. // 26 Feb 16:19:34
  1154. function timestamp() {
  1155. var d = new Date();
  1156. var time = [pad(d.getHours()),
  1157. pad(d.getMinutes()),
  1158. pad(d.getSeconds())].join(':');
  1159. return [d.getDate(), months[d.getMonth()], time].join(' ');
  1160. }
  1161. // log is just a thin wrapper to console.log that prepends a timestamp
  1162. exports.log = function() {
  1163. console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
  1164. };
  1165. /**
  1166. * Inherit the prototype methods from one constructor into another.
  1167. *
  1168. * The Function.prototype.inherits from lang.js rewritten as a standalone
  1169. * function (not on Function.prototype). NOTE: If this file is to be loaded
  1170. * during bootstrapping this function needs to be rewritten using some native
  1171. * functions as prototype setup using normal JavaScript does not work as
  1172. * expected during bootstrapping (see mirror.js in r114903).
  1173. *
  1174. * @param {function} ctor Constructor function which needs to inherit the
  1175. * prototype.
  1176. * @param {function} superCtor Constructor function to inherit prototype from.
  1177. */
  1178. exports.inherits = require('inherits');
  1179. exports._extend = function(origin, add) {
  1180. // Don't do anything if add isn't an object
  1181. if (!add || !isObject(add)) return origin;
  1182. var keys = Object.keys(add);
  1183. var i = keys.length;
  1184. while (i--) {
  1185. origin[keys[i]] = add[keys[i]];
  1186. }
  1187. return origin;
  1188. };
  1189. function hasOwnProperty(obj, prop) {
  1190. return Object.prototype.hasOwnProperty.call(obj, prop);
  1191. }
  1192. }).call(this,require("FWaASH"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  1193. },{"./support/isBuffer":10,"FWaASH":13,"inherits":12}],12:[function(require,module,exports){
  1194. if (typeof Object.create === 'function') {
  1195. // implementation from standard node.js 'util' module
  1196. module.exports = function inherits(ctor, superCtor) {
  1197. ctor.super_ = superCtor
  1198. ctor.prototype = Object.create(superCtor.prototype, {
  1199. constructor: {
  1200. value: ctor,
  1201. enumerable: false,
  1202. writable: true,
  1203. configurable: true
  1204. }
  1205. });
  1206. };
  1207. } else {
  1208. // old school shim for old browsers
  1209. module.exports = function inherits(ctor, superCtor) {
  1210. ctor.super_ = superCtor
  1211. var TempCtor = function () {}
  1212. TempCtor.prototype = superCtor.prototype
  1213. ctor.prototype = new TempCtor()
  1214. ctor.prototype.constructor = ctor
  1215. }
  1216. }
  1217. },{}],13:[function(require,module,exports){
  1218. // shim for using process in browser
  1219. var process = module.exports = {};
  1220. process.nextTick = (function () {
  1221. var canSetImmediate = typeof window !== 'undefined'
  1222. && window.setImmediate;
  1223. var canPost = typeof window !== 'undefined'
  1224. && window.postMessage && window.addEventListener
  1225. ;
  1226. if (canSetImmediate) {
  1227. return function (f) { return window.setImmediate(f) };
  1228. }
  1229. if (canPost) {
  1230. var queue = [];
  1231. window.addEventListener('message', function (ev) {
  1232. var source = ev.source;
  1233. if ((source === window || source === null) && ev.data === 'process-tick') {
  1234. ev.stopPropagation();
  1235. if (queue.length > 0) {
  1236. var fn = queue.shift();
  1237. fn();
  1238. }
  1239. }
  1240. }, true);
  1241. return function nextTick(fn) {
  1242. queue.push(fn);
  1243. window.postMessage('process-tick', '*');
  1244. };
  1245. }
  1246. return function nextTick(fn) {
  1247. setTimeout(fn, 0);
  1248. };
  1249. })();
  1250. process.title = 'browser';
  1251. process.browser = true;
  1252. process.env = {};
  1253. process.argv = [];
  1254. function noop() {}
  1255. process.on = noop;
  1256. process.addListener = noop;
  1257. process.once = noop;
  1258. process.off = noop;
  1259. process.removeListener = noop;
  1260. process.removeAllListeners = noop;
  1261. process.emit = noop;
  1262. process.binding = function (name) {
  1263. throw new Error('process.binding is not supported');
  1264. }
  1265. // TODO(shtylman)
  1266. process.cwd = function () { return '/' };
  1267. process.chdir = function (dir) {
  1268. throw new Error('process.chdir is not supported');
  1269. };
  1270. },{}]},{},[])