");t.b("\n" + i);t.b(" | ");t.b("\n" + i);t.b(" ");t.b(t.v(t.f("oldNumber",c,p,0)));t.b(" ");t.b("\n" + i);t.b(" ");t.b(t.v(t.f("newNumber",c,p,0)));t.b(" ");t.b("\n" + i);t.b(" | ");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" ");t.b("\n" + i);if(t.s(t.f("prefix",c,p,1),c,p,0,253,329,"{{ }}")){t.rs(c,p,function(c,p,t){t.b(" ");t.b(t.t(t.f("prefix",c,p,0)));t.b("");t.b("\n" + i);});c.pop();}if(t.s(t.f("content",c,p,1),c,p,0,361,435,"{{ }}")){t.rs(c,p,function(c,p,t){t.b(" ");t.b(t.t(t.f("content",c,p,0)));t.b("");t.b("\n" + i);});c.pop();}t.b(" ");t.b("\n" + i);t.b(" | ");t.b("\n" + i);t.b("
");return t.fl(); },partials: {}, subs: { }});
+global.browserTemplates["line-by-line-wrapper"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("\n | \n \n ',output+=runtime.suppressValue((lineno=3,colno=77,runtime.callWrap(runtime.memberLookup(runtime.contextOrFrameLookup(context,frame,"utils"),"escape"),'utils["escape"]',context,[runtime.memberLookup(runtime.contextOrFrameLookup(context,frame,"block"),"header")])),env.opts.autoescape),output+=" \n | \n
\n",parentTemplate?parentTemplate.rootRenderFunc(env,context,frame,runtime,cb):cb(null,output)}catch(e){cb(runtime.handleError(e,lineno,colno))}}return{root:root}}()}(),function(){(window.nunjucksPrecompiled=window.nunjucksPrecompiled||{})["line-by-line/empty-diff.html"]=function(){function root(env,context,frame,runtime,cb){var lineno=null,colno=null,output="";try{var parentTemplate=null;output+='\n | \n ',output+=runtime.suppressValue(env.getFilter("safe").call(context,(lineno=2,colno=50,runtime.callWrap(runtime.memberLookup(runtime.contextOrFrameLookup(context,frame,"utils"),"valueOrEmpty"),'utils["valueOrEmp"]',context,[runtime.contextOrFrameLookup(context,frame,"oldNumber")]))),env.opts.autoescape),output+=' \n ',output+=runtime.suppressValue(env.getFilter("safe").call(context,(lineno=3,colno=50,runtime.callWrap(runtime.memberLookup(runtime.contextOrFrameLookup(context,frame,"utils"),"valueOrEmpty"),'utils["valueOrEmp"]',context,[runtime.contextOrFrameLookup(context,frame,"newNumber")]))),env.opts.autoescape),output+=' \n | \n \n ',runtime.contextOrFrameLookup(context,frame,"prefix")&&(output+='\n ',output+=runtime.suppressValue(env.getFilter("safe").call(context,(lineno=8,colno=89,runtime.callWrap(runtime.memberLookup(runtime.contextOrFrameLookup(context,frame,"utils"),"convertWhiteSpaceToNonBreakingSpace"),'utils["convertWhi"]',context,[runtime.contextOrFrameLookup(context,frame,"prefix")]))),env.opts.autoescape),output+="\n "),runtime.contextOrFrameLookup(context,frame,"content")&&(output+='',output+=runtime.suppressValue(env.getFilter("safe").call(context,(lineno=11,colno=86,runtime.callWrap(runtime.memberLookup(runtime.contextOrFrameLookup(context,frame,"utils"),"convertWhiteSpaceToNonBreakingSpace"),'utils["convertWhi"]',context,[runtime.contextOrFrameLookup(context,frame,"content")]))),env.opts.autoescape),output+=""),output+="\n \n | \n
\n",parentTemplate?parentTemplate.rootRenderFunc(env,context,frame,runtime,cb):cb(null,output)}catch(e){cb(runtime.handleError(e,lineno,colno))}}return{root:root}}()}(),function(){(window.nunjucksPrecompiled=window.nunjucksPrecompiled||{})["line-by-line/wrapper.html"]=function(){function root(env,context,frame,runtime,cb){var lineno=null,colno=null,output="";try{var parentTemplate=null;output+='\n ',output+=runtime.suppressValue(runtime.contextOrFrameLookup(context,frame,"content"),env.opts.autoescape),output+="\n
\n",parentTemplate?parentTemplate.rootRenderFunc(env,context,frame,runtime,cb):cb(null,output)}catch(e){cb(runtime.handleError(e,lineno,colno))}}return{root:root}}()}();
\ No newline at end of file
+!function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o"),t.b("\n"+i),t.b(' | '),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(' '),t.b(t.t(t.f("blockHeader",c,p,0))),t.b(" "),t.b("\n"+i),t.b(" | "),t.b("\n"+i),t.b(""),t.fl()},partials:{},subs:{}}),global.browserTemplates["line-by-line-empty-diff"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b(""),t.b("\n"+i),t.b(' | '),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(" File without changes"),t.b("\n"+i),t.b(" "),t.b("\n"+i),t.b(" | "),t.b("\n"+i),t.b("
"),t.fl()},partials:{},subs:{}}),global.browserTemplates["line-by-line-file-diff"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b(''),t.b("\n"+i),t.b(' "),t.b("\n"+i),t.b('
'),t.b("\n"+i),t.b('
'),t.b("\n"+i),t.b('
'),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("diffs",c,p,0))),t.b("\n"+i),t.b(" "),t.b("\n"+i),t.b("
"),t.b("\n"+i),t.b("
"),t.b("\n"+i),t.b("
"),t.b("\n"+i),t.b("
"),t.fl()},partials:{},subs:{}}),global.browserTemplates["line-by-line-line"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b(""),t.b("\n"+i),t.b(' | '),t.b("\n"+i),t.b(' '),t.b(t.v(t.f("oldNumber",c,p,0))),t.b(" "),t.b("\n"+i),t.b(' '),t.b(t.v(t.f("newNumber",c,p,0))),t.b(" "),t.b("\n"+i),t.b(" | "),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.s(t.f("prefix",c,p,1),c,p,0,253,329,"{{ }}")&&(t.rs(c,p,function(c,p,t){t.b(' '),t.b(t.t(t.f("prefix",c,p,0))),t.b(""),t.b("\n"+i)}),c.pop()),t.s(t.f("content",c,p,1),c,p,0,361,435,"{{ }}")&&(t.rs(c,p,function(c,p,t){t.b(' '),t.b(t.t(t.f("content",c,p,0))),t.b(""),t.b("\n"+i)}),c.pop()),t.b(" "),t.b("\n"+i),t.b(" | "),t.b("\n"+i),t.b("
"),t.fl()},partials:{},subs:{}}),global.browserTemplates["line-by-line-wrapper"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b(''),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("content",c,p,0))),t.b("\n"+i),t.b("
"),t.fl()},partials:{},subs:{}}),module.exports=global.browserTemplates}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1]);
\ No newline at end of file
diff --git a/dist/diff2html-ui.js b/dist/diff2html-ui.js
index 93478d5..6676915 100644
--- a/dist/diff2html-ui.js
+++ b/dist/diff2html-ui.js
@@ -1,189 +1,143 @@
-/******/ (function(modules) { // webpackBootstrap
-/******/ // The module cache
-/******/ var installedModules = {};
+(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);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 1) {
- return nameSplit[nameSplit.length - 1];
- }
-
- return language;
- }
-
- function getSrcFilename(line, cfg) {
- var prefixes = ["a/", "i/", "w/", "c/", "o/"];
-
- if (cfg.srcPrefix) prefixes.push(cfg.srcPrefix);
-
- return _getFilename('---', line, prefixes);
- }
-
- function getDstFilename(line, cfg) {
- var prefixes = ["b/", "i/", "w/", "c/", "o/"];
-
- if (cfg.dstPrefix) prefixes.push(cfg.dstPrefix);
-
- return _getFilename('\\+\\+\\+', line, prefixes);
- }
-
- function _getFilename(linePrefix, line, prefixes) {
- var FilenameRegExp = new RegExp('^' + linePrefix + ' "?(.+?)"?$');
-
- var filename;
- var values = FilenameRegExp.exec(line);
- if (values && values[1]) {
- filename = values[1];
- var matchingPrefixes = prefixes.filter(function(p) {
- return filename.indexOf(p) === 0;
- });
-
- if (matchingPrefixes[0]) filename = filename.slice(matchingPrefixes[0].length); // remove prefix if exists
- }
-
- return filename;
- }
-
- module.exports.DiffParser = new DiffParser();
-
- })();
-
-
-/***/ },
-/* 2 */
-/***/ function(module, exports) {
-
- /*
- *
- * Utils (utils.js)
- * Author: rtfpessoa
- *
- */
-
- (function() {
-
- function Utils() {
- }
-
- Utils.prototype.convertWhiteSpaceToNonBreakingSpace = function(str) {
- return str.slice(0).replace(/ /g, ' ');
- };
-
- Utils.prototype.escape = function(str) {
- return str.slice(0)
- .replace(/&/g, '&')
- .replace(//g, '>')
- .replace(/\t/g, ' ');
- };
-
- Utils.prototype.startsWith = function(str, start) {
- if (typeof start === 'object') {
- var result = false;
- start.forEach(function(s) {
- if (str.indexOf(s) === 0) {
- result = true;
- }
- });
-
- return result;
- }
+(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);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o');
+ } else if (change.removed) {
+ ret.push('');
+ }
+
+ ret.push(escapeHTML(change.value));
+
+ if (change.added) {
+ ret.push('');
+ } else if (change.removed) {
+ ret.push('');
+ }
+ }
+ return ret.join('');
+}
+
+function escapeHTML(s) {
+ var n = s;
+ n = n.replace(/&/g, '&');
+ n = n.replace(//g, '>');
+ n = n.replace(/"/g, '"');
+
+ return n;
+}
+
+
+},{}],4:[function(require,module,exports){
+/*istanbul ignore start*/'use strict';
+
+exports.__esModule = true;
+exports.default = /*istanbul ignore end*/Diff;
+function Diff() {}
+
+Diff.prototype = { /*istanbul ignore start*/
+ /*istanbul ignore end*/diff: function diff(oldString, newString) {
+ /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
+
+ var callback = options.callback;
+ if (typeof options === 'function') {
+ callback = options;
+ options = {};
+ }
+ this.options = options;
+
+ var self = this;
+
+ function done(value) {
+ if (callback) {
+ setTimeout(function () {
+ callback(undefined, value);
+ }, 0);
+ return true;
+ } else {
+ return value;
+ }
+ }
+
+ // Allow subclasses to massage the input prior to running
+ oldString = this.castInput(oldString);
+ newString = this.castInput(newString);
+
+ oldString = this.removeEmpty(this.tokenize(oldString));
+ newString = this.removeEmpty(this.tokenize(newString));
+
+ var newLen = newString.length,
+ oldLen = oldString.length;
+ var editLength = 1;
+ var maxEditLength = newLen + oldLen;
+ var bestPath = [{ newPos: -1, components: [] }];
+
+ // Seed editLength = 0, i.e. the content starts with the same values
+ var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
+ if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
+ // Identity per the equality and tokenizer
+ return done([{ value: newString.join(''), count: newString.length }]);
+ }
+
+ // Main worker method. checks all permutations of a given edit length for acceptance.
+ function execEditLength() {
+ for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
+ var basePath = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
+ var addPath = bestPath[diagonalPath - 1],
+ removePath = bestPath[diagonalPath + 1],
+ _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
+ if (addPath) {
+ // No one else is going to attempt to use this value, clear it
+ bestPath[diagonalPath - 1] = undefined;
+ }
+
+ var canAdd = addPath && addPath.newPos + 1 < newLen,
+ canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
+ if (!canAdd && !canRemove) {
+ // If this path is a terminal then prune
+ bestPath[diagonalPath] = undefined;
+ continue;
+ }
+
+ // Select the diagonal that we want to branch from. We select the prior
+ // path whose position in the new string is the farthest from the origin
+ // and does not pass the bounds of the diff graph
+ if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
+ basePath = clonePath(removePath);
+ self.pushComponent(basePath.components, undefined, true);
+ } else {
+ basePath = addPath; // No need to clone, we've pulled it from the list
+ basePath.newPos++;
+ self.pushComponent(basePath.components, true, undefined);
+ }
+
+ _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath);
+
+ // If we have hit the end of both strings, then we are done
+ if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
+ return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
+ } else {
+ // Otherwise track this path as a potential candidate and continue.
+ bestPath[diagonalPath] = basePath;
+ }
+ }
+
+ editLength++;
+ }
+
+ // Performs the length of edit iteration. Is a bit fugly as this has to support the
+ // sync and async mode which is never fun. Loops over execEditLength until a value
+ // is produced.
+ if (callback) {
+ (function exec() {
+ setTimeout(function () {
+ // This should not happen, but we want to be safe.
+ /* istanbul ignore next */
+ if (editLength > maxEditLength) {
+ return callback();
+ }
+
+ if (!execEditLength()) {
+ exec();
+ }
+ }, 0);
+ })();
+ } else {
+ while (editLength <= maxEditLength) {
+ var ret = execEditLength();
+ if (ret) {
+ return ret;
+ }
+ }
+ }
+ },
+ /*istanbul ignore start*/ /*istanbul ignore end*/pushComponent: function pushComponent(components, added, removed) {
+ var last = components[components.length - 1];
+ if (last && last.added === added && last.removed === removed) {
+ // We need to clone here as the component clone operation is just
+ // as shallow array clone
+ components[components.length - 1] = { count: last.count + 1, added: added, removed: removed };
+ } else {
+ components.push({ count: 1, added: added, removed: removed });
+ }
+ },
+ /*istanbul ignore start*/ /*istanbul ignore end*/extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
+ var newLen = newString.length,
+ oldLen = oldString.length,
+ newPos = basePath.newPos,
+ oldPos = newPos - diagonalPath,
+ commonCount = 0;
+ while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
+ newPos++;
+ oldPos++;
+ commonCount++;
+ }
+
+ if (commonCount) {
+ basePath.components.push({ count: commonCount });
+ }
+
+ basePath.newPos = newPos;
+ return oldPos;
+ },
+ /*istanbul ignore start*/ /*istanbul ignore end*/equals: function equals(left, right) {
+ return left === right;
+ },
+ /*istanbul ignore start*/ /*istanbul ignore end*/removeEmpty: function removeEmpty(array) {
+ var ret = [];
+ for (var i = 0; i < array.length; i++) {
+ if (array[i]) {
+ ret.push(array[i]);
+ }
+ }
+ return ret;
+ },
+ /*istanbul ignore start*/ /*istanbul ignore end*/castInput: function castInput(value) {
+ return value;
+ },
+ /*istanbul ignore start*/ /*istanbul ignore end*/tokenize: function tokenize(value) {
+ return value.split('');
+ }
+};
+
+function buildValues(diff, components, newString, oldString, useLongestToken) {
+ var componentPos = 0,
+ componentLen = components.length,
+ newPos = 0,
+ oldPos = 0;
+
+ for (; componentPos < componentLen; componentPos++) {
+ var component = components[componentPos];
+ if (!component.removed) {
+ if (!component.added && useLongestToken) {
+ var value = newString.slice(newPos, newPos + component.count);
+ value = value.map(function (value, i) {
+ var oldValue = oldString[oldPos + i];
+ return oldValue.length > value.length ? oldValue : value;
+ });
+
+ component.value = value.join('');
+ } else {
+ component.value = newString.slice(newPos, newPos + component.count).join('');
+ }
+ newPos += component.count;
+
+ // Common case
+ if (!component.added) {
+ oldPos += component.count;
+ }
+ } else {
+ component.value = oldString.slice(oldPos, oldPos + component.count).join('');
+ oldPos += component.count;
+
+ // Reverse add and remove so removes are output first to match common convention
+ // The diffing algorithm is tied to add then remove output and this is the simplest
+ // route to get the desired output with minimal overhead.
+ if (componentPos && components[componentPos - 1].added) {
+ var tmp = components[componentPos - 1];
+ components[componentPos - 1] = components[componentPos];
+ components[componentPos] = tmp;
+ }
+ }
+ }
+
+ // Special case handle for when one terminal is ignored. For this case we merge the
+ // terminal into the prior string and drop the change.
+ var lastComponent = components[componentLen - 1];
+ if (componentLen > 1 && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
+ components[componentLen - 2].value += lastComponent.value;
+ components.pop();
+ }
+
+ return components;
+}
+
+function clonePath(path) {
+ return { newPos: path.newPos, components: path.components.slice(0) };
+}
+
+
+},{}],5:[function(require,module,exports){
+/*istanbul ignore start*/'use strict';
+
+exports.__esModule = true;
+exports.characterDiff = undefined;
+exports. /*istanbul ignore end*/diffChars = diffChars;
+
+var /*istanbul ignore start*/_base = require('./base') /*istanbul ignore end*/;
+
+/*istanbul ignore start*/
+var _base2 = _interopRequireDefault(_base);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+/*istanbul ignore end*/var characterDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/characterDiff = new /*istanbul ignore start*/_base2.default() /*istanbul ignore end*/;
+function diffChars(oldStr, newStr, callback) {
+ return characterDiff.diff(oldStr, newStr, callback);
+}
+
+
+},{"./base":4}],6:[function(require,module,exports){
+/*istanbul ignore start*/'use strict';
+
+exports.__esModule = true;
+exports.cssDiff = undefined;
+exports. /*istanbul ignore end*/diffCss = diffCss;
+
+var /*istanbul ignore start*/_base = require('./base') /*istanbul ignore end*/;
+
+/*istanbul ignore start*/
+var _base2 = _interopRequireDefault(_base);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+/*istanbul ignore end*/var cssDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/cssDiff = new /*istanbul ignore start*/_base2.default() /*istanbul ignore end*/;
+cssDiff.tokenize = function (value) {
+ return value.split(/([{}:;,]|\s+)/);
+};
+
+function diffCss(oldStr, newStr, callback) {
+ return cssDiff.diff(oldStr, newStr, callback);
+}
+
+
+},{"./base":4}],7:[function(require,module,exports){
+/*istanbul ignore start*/'use strict';
+
+exports.__esModule = true;
+exports.jsonDiff = undefined;
+
+var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
+
+exports. /*istanbul ignore end*/diffJson = diffJson;
+/*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = canonicalize;
+
+var /*istanbul ignore start*/_base = require('./base') /*istanbul ignore end*/;
+
+/*istanbul ignore start*/
+var _base2 = _interopRequireDefault(_base);
+
+/*istanbul ignore end*/
+var /*istanbul ignore start*/_line = require('./line') /*istanbul ignore end*/;
+
+/*istanbul ignore start*/
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+/*istanbul ignore end*/
+
+var objectPrototypeToString = Object.prototype.toString;
+
+var jsonDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/jsonDiff = new /*istanbul ignore start*/_base2.default() /*istanbul ignore end*/;
+// Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
+// dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
+jsonDiff.useLongestToken = true;
+
+jsonDiff.tokenize = /*istanbul ignore start*/_line.lineDiff. /*istanbul ignore end*/tokenize;
+jsonDiff.castInput = function (value) {
+ return typeof value === 'string' ? value : JSON.stringify(canonicalize(value), undefined, ' ');
+};
+jsonDiff.equals = function (left, right) {
+ return (/*istanbul ignore start*/_base2.default. /*istanbul ignore end*/prototype.equals(left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'))
+ );
+};
- return str.indexOf(start) === 0;
- };
+function diffJson(oldObj, newObj, callback) {
+ return jsonDiff.diff(oldObj, newObj, callback);
+}
+
+// This function handles the presence of circular references by bailing out when encountering an
+// object that is already on the "stack" of items being processed.
+function canonicalize(obj, stack, replacementStack) {
+ stack = stack || [];
+ replacementStack = replacementStack || [];
- Utils.prototype.valueOrEmpty = function(value) {
- return value ? value : '';
- };
+ var i = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
+
+ for (i = 0; i < stack.length; i += 1) {
+ if (stack[i] === obj) {
+ return replacementStack[i];
+ }
+ }
+
+ var canonicalizedObj = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
+
+ if ('[object Array]' === objectPrototypeToString.call(obj)) {
+ stack.push(obj);
+ canonicalizedObj = new Array(obj.length);
+ replacementStack.push(canonicalizedObj);
+ for (i = 0; i < obj.length; i += 1) {
+ canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack);
+ }
+ stack.pop();
+ replacementStack.pop();
+ return canonicalizedObj;
+ }
+
+ if (obj && obj.toJSON) {
+ obj = obj.toJSON();
+ }
+
+ if ( /*istanbul ignore start*/(typeof /*istanbul ignore end*/obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && obj !== null) {
+ stack.push(obj);
+ canonicalizedObj = {};
+ replacementStack.push(canonicalizedObj);
+ var sortedKeys = [],
+ key = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
+ for (key in obj) {
+ /* istanbul ignore else */
+ if (obj.hasOwnProperty(key)) {
+ sortedKeys.push(key);
+ }
+ }
+ sortedKeys.sort();
+ for (i = 0; i < sortedKeys.length; i += 1) {
+ key = sortedKeys[i];
+ canonicalizedObj[key] = canonicalize(obj[key], stack, replacementStack);
+ }
+ stack.pop();
+ replacementStack.pop();
+ } else {
+ canonicalizedObj = obj;
+ }
+ return canonicalizedObj;
+}
+
+
+},{"./base":4,"./line":8}],8:[function(require,module,exports){
+/*istanbul ignore start*/'use strict';
+
+exports.__esModule = true;
+exports.lineDiff = undefined;
+exports. /*istanbul ignore end*/diffLines = diffLines;
+/*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = diffTrimmedLines;
+
+var /*istanbul ignore start*/_base = require('./base') /*istanbul ignore end*/;
+
+/*istanbul ignore start*/
+var _base2 = _interopRequireDefault(_base);
+
+/*istanbul ignore end*/
+var /*istanbul ignore start*/_params = require('../util/params') /*istanbul ignore end*/;
+
+/*istanbul ignore start*/
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+/*istanbul ignore end*/var lineDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/lineDiff = new /*istanbul ignore start*/_base2.default() /*istanbul ignore end*/;
+lineDiff.tokenize = function (value) {
+ var retLines = [],
+ linesAndNewlines = value.split(/(\n|\r\n)/);
+
+ // Ignore the final empty token that occurs if the string ends with a new line
+ if (!linesAndNewlines[linesAndNewlines.length - 1]) {
+ linesAndNewlines.pop();
+ }
+
+ // Merge the content and line separators into single tokens
+ for (var i = 0; i < linesAndNewlines.length; i++) {
+ var line = linesAndNewlines[i];
+
+ if (i % 2 && !this.options.newlineIsToken) {
+ retLines[retLines.length - 1] += line;
+ } else {
+ if (this.options.ignoreWhitespace) {
+ line = line.trim();
+ }
+ retLines.push(line);
+ }
+ }
+
+ return retLines;
+};
+
+function diffLines(oldStr, newStr, callback) {
+ return lineDiff.diff(oldStr, newStr, callback);
+}
+function diffTrimmedLines(oldStr, newStr, callback) {
+ var options = /*istanbul ignore start*/(0, _params.generateOptions) /*istanbul ignore end*/(callback, { ignoreWhitespace: true });
+ return lineDiff.diff(oldStr, newStr, options);
+}
+
+
+},{"../util/params":16,"./base":4}],9:[function(require,module,exports){
+/*istanbul ignore start*/'use strict';
+
+exports.__esModule = true;
+exports.sentenceDiff = undefined;
+exports. /*istanbul ignore end*/diffSentences = diffSentences;
+
+var /*istanbul ignore start*/_base = require('./base') /*istanbul ignore end*/;
+
+/*istanbul ignore start*/
+var _base2 = _interopRequireDefault(_base);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+/*istanbul ignore end*/var sentenceDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/sentenceDiff = new /*istanbul ignore start*/_base2.default() /*istanbul ignore end*/;
+sentenceDiff.tokenize = function (value) {
+ return value.split(/(\S.+?[.!?])(?=\s+|$)/);
+};
+
+function diffSentences(oldStr, newStr, callback) {
+ return sentenceDiff.diff(oldStr, newStr, callback);
+}
+
+
+},{"./base":4}],10:[function(require,module,exports){
+/*istanbul ignore start*/'use strict';
+
+exports.__esModule = true;
+exports.wordDiff = undefined;
+exports. /*istanbul ignore end*/diffWords = diffWords;
+/*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = diffWordsWithSpace;
- module.exports.Utils = new Utils();
+var /*istanbul ignore start*/_base = require('./base') /*istanbul ignore end*/;
- })();
+/*istanbul ignore start*/
+var _base2 = _interopRequireDefault(_base);
+/*istanbul ignore end*/
+var /*istanbul ignore start*/_params = require('../util/params') /*istanbul ignore end*/;
-/***/ },
-/* 3 */
-/***/ function(module, exports, __webpack_require__) {
+/*istanbul ignore start*/
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- /*
- *
- * FileListPrinter (file-list-printer.js)
- * Author: nmatpt
- *
- */
+/*istanbul ignore end*/
- (function() {
+// Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode
+//
+// Ranges and exceptions:
+// Latin-1 Supplement, 0080–00FF
+// - U+00D7 × Multiplication sign
+// - U+00F7 ÷ Division sign
+// Latin Extended-A, 0100–017F
+// Latin Extended-B, 0180–024F
+// IPA Extensions, 0250–02AF
+// Spacing Modifier Letters, 02B0–02FF
+// - U+02C7 ˇ ˇ Caron
+// - U+02D8 ˘ ˘ Breve
+// - U+02D9 ˙ ˙ Dot Above
+// - U+02DA ˚ ˚ Ring Above
+// - U+02DB ˛ ˛ Ogonek
+// - U+02DC ˜ ˜ Small Tilde
+// - U+02DD ˝ ˝ Double Acute Accent
+// Latin Extended Additional, 1E00–1EFF
+var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/;
+
+var reWhitespace = /\S/;
+
+var wordDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/wordDiff = new /*istanbul ignore start*/_base2.default() /*istanbul ignore end*/;
+wordDiff.equals = function (left, right) {
+ return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right);
+};
+wordDiff.tokenize = function (value) {
+ var tokens = value.split(/(\s+|\b)/);
+
+ // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set.
+ for (var i = 0; i < tokens.length - 1; i++) {
+ // If we have an empty string in the next field and we have only word chars before and after, merge
+ if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) {
+ tokens[i] += tokens[i + 2];
+ tokens.splice(i + 1, 2);
+ i--;
+ }
+ }
+
+ return tokens;
+};
- var printerUtils = __webpack_require__(4).PrinterUtils;
+function diffWords(oldStr, newStr, callback) {
+ var options = /*istanbul ignore start*/(0, _params.generateOptions) /*istanbul ignore end*/(callback, { ignoreWhitespace: true });
+ return wordDiff.diff(oldStr, newStr, options);
+}
+function diffWordsWithSpace(oldStr, newStr, callback) {
+ return wordDiff.diff(oldStr, newStr, callback);
+}
- function FileListPrinter() {
- }
- FileListPrinter.prototype.generateFileList = function(diffFiles) {
- return '\n' +
- ' \n' +
- '
\n' +
-
- diffFiles.map(function(file) {
- return ' \n' +
- ' | \n' +
- ' +' + file.addedLines + '\n' +
- ' | \n' +
- ' \n' +
- ' -' + file.deletedLines + '\n' +
- ' | \n' +
- ' \n' +
- ' ' +
- ' ' + printerUtils.getDiffName(file) +
- ' \n' +
- ' | \n' +
- '
\n';
- }).join('\n') +
- '
\n';
- };
-
- module.exports.FileListPrinter = new FileListPrinter();
-
- })();
-
-
-/***/ },
-/* 4 */
-/***/ function(module, exports, __webpack_require__) {
-
- /*
- *
- * PrinterUtils (printer-utils.js)
- * Author: rtfpessoa
- *
- */
-
- (function() {
-
- var jsDiff = __webpack_require__(5);
- var utils = __webpack_require__(2).Utils;
- var Rematch = __webpack_require__(20).Rematch;
-
- function PrinterUtils() {
- }
-
- PrinterUtils.prototype.getHtmlId = function(file) {
- var hashCode = function(text) {
- var i, chr, len;
- var hash = 0;
-
- if (text.length === 0) {
- return hash;
- }
-
- for (i = 0, len = text.length; i < len; i++) {
- chr = text.charCodeAt(i);
- hash = ((hash << 5) - hash) + chr;
- hash |= 0; // Convert to 32bit integer
- }
-
- return hash;
- };
-
- return 'd2h-' + hashCode(this.getDiffName(file)).toString().slice(-6);
- };
-
- PrinterUtils.prototype.getDiffName = function(file) {
- var oldFilename = file.oldName;
- var newFilename = file.newName;
-
- if (oldFilename && newFilename && oldFilename !== newFilename
- && !isDevNullName(oldFilename) && !isDevNullName(newFilename)) {
- return oldFilename + ' -> ' + newFilename;
- } else if (newFilename && !isDevNullName(newFilename)) {
- return newFilename;
- } else if (oldFilename) {
- return oldFilename;
- }
-
- return 'Unknown filename';
- };
-
- PrinterUtils.prototype.diffHighlight = function(diffLine1, diffLine2, config) {
- var linePrefix1, linePrefix2, unprefixedLine1, unprefixedLine2;
-
- var prefixSize = 1;
-
- if (config.isCombined) {
- prefixSize = 2;
- }
-
- linePrefix1 = diffLine1.substr(0, prefixSize);
- linePrefix2 = diffLine2.substr(0, prefixSize);
- unprefixedLine1 = diffLine1.substr(prefixSize);
- unprefixedLine2 = diffLine2.substr(prefixSize);
-
- var diff;
- if (config.charByChar) {
- diff = jsDiff.diffChars(unprefixedLine1, unprefixedLine2);
- } else {
- diff = jsDiff.diffWordsWithSpace(unprefixedLine1, unprefixedLine2);
- }
-
- var highlightedLine = '';
-
- var changedWords = [];
- if (!config.charByChar && config.matching === 'words') {
- var treshold = 0.25;
-
- if (typeof (config.matchWordsThreshold) !== 'undefined') {
- treshold = config.matchWordsThreshold;
- }
+},{"../util/params":16,"./base":4}],11:[function(require,module,exports){
+/*istanbul ignore start*/'use strict';
- var matcher = Rematch.rematch(function(a, b) {
- var amod = a.value;
- var bmod = b.value;
-
- return Rematch.distance(amod, bmod);
- });
-
- var removed = diff.filter(function isRemoved(element) {
- return element.removed;
- });
-
- var added = diff.filter(function isAdded(element) {
- return element.added;
- });
-
- var chunks = matcher(added, removed);
- chunks.forEach(function(chunk) {
- if (chunk[0].length === 1 && chunk[1].length === 1) {
- var dist = Rematch.distance(chunk[0][0].value, chunk[1][0].value);
- if (dist < treshold) {
- changedWords.push(chunk[0][0]);
- changedWords.push(chunk[1][0]);
- }
- }
- });
- }
-
- diff.forEach(function(part) {
- var addClass = changedWords.indexOf(part) > -1 ? ' class="d2h-change"' : '';
- var elemType = part.added ? 'ins' : part.removed ? 'del' : null;
- var escapedValue = utils.escape(part.value);
-
- if (elemType !== null) {
- highlightedLine += '<' + elemType + addClass + '>' + escapedValue + '' + elemType + '>';
- } else {
- highlightedLine += escapedValue;
- }
- });
-
- return {
- first: {
- prefix: linePrefix1,
- line: removeIns(highlightedLine)
- },
- second: {
- prefix: linePrefix2,
- line: removeDel(highlightedLine)
- }
- };
- };
-
- function isDevNullName(name) {
- return name.indexOf('dev/null') !== -1;
- }
-
- function removeIns(line) {
- return line.replace(/(]*>((.|\n)*?)<\/ins>)/g, '');
- }
-
- function removeDel(line) {
- return line.replace(/(]*>((.|\n)*?)<\/del>)/g, '');
- }
-
- module.exports.PrinterUtils = new PrinterUtils();
-
- })();
-
-
-/***/ },
-/* 5 */
-/***/ function(module, exports, __webpack_require__) {
-
- /*istanbul ignore start*/'use strict';
-
- exports.__esModule = true;
- exports.canonicalize = exports.convertChangesToXML = exports.convertChangesToDMP = exports.parsePatch = exports.applyPatches = exports.applyPatch = exports.createPatch = exports.createTwoFilesPatch = exports.structuredPatch = exports.diffJson = exports.diffCss = exports.diffSentences = exports.diffTrimmedLines = exports.diffLines = exports.diffWordsWithSpace = exports.diffWords = exports.diffChars = exports.Diff = undefined;
- /*istanbul ignore end*/
- var /*istanbul ignore start*/_base = __webpack_require__(6) /*istanbul ignore end*/;
-
- /*istanbul ignore start*/
- var _base2 = _interopRequireDefault(_base);
-
- /*istanbul ignore end*/
- var /*istanbul ignore start*/_character = __webpack_require__(7) /*istanbul ignore end*/;
-
- var /*istanbul ignore start*/_word = __webpack_require__(8) /*istanbul ignore end*/;
-
- var /*istanbul ignore start*/_line = __webpack_require__(10) /*istanbul ignore end*/;
-
- var /*istanbul ignore start*/_sentence = __webpack_require__(11) /*istanbul ignore end*/;
-
- var /*istanbul ignore start*/_css = __webpack_require__(12) /*istanbul ignore end*/;
-
- var /*istanbul ignore start*/_json = __webpack_require__(13) /*istanbul ignore end*/;
-
- var /*istanbul ignore start*/_apply = __webpack_require__(14) /*istanbul ignore end*/;
-
- var /*istanbul ignore start*/_parse = __webpack_require__(15) /*istanbul ignore end*/;
-
- var /*istanbul ignore start*/_create = __webpack_require__(17) /*istanbul ignore end*/;
-
- var /*istanbul ignore start*/_dmp = __webpack_require__(18) /*istanbul ignore end*/;
-
- var /*istanbul ignore start*/_xml = __webpack_require__(19) /*istanbul ignore end*/;
-
- /*istanbul ignore start*/
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- /* See LICENSE file for terms of use */
-
- /*
- * Text diff implementation.
- *
- * This library supports the following APIS:
- * JsDiff.diffChars: Character by character diff
- * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace
- * JsDiff.diffLines: Line based diff
- *
- * JsDiff.diffCss: Diff targeted at CSS content
- *
- * These methods are based on the implementation proposed in
- * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986).
- * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927
- */
- exports. /*istanbul ignore end*/Diff = _base2.default;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffChars = _character.diffChars;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWords = _word.diffWords;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = _word.diffWordsWithSpace;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffLines = _line.diffLines;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = _line.diffTrimmedLines;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffSentences = _sentence.diffSentences;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffCss = _css.diffCss;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffJson = _json.diffJson;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/structuredPatch = _create.structuredPatch;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = _create.createTwoFilesPatch;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = _create.createPatch;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatch = _apply.applyPatch;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = _apply.applyPatches;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/parsePatch = _parse.parsePatch;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToDMP = _dmp.convertChangesToDMP;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToXML = _xml.convertChangesToXML;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = _json.canonicalize;
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQWdCQTs7Ozs7O0FBQ0E7O0FBQ0E7O0FBQ0E7O0FBQ0E7O0FBRUE7O0FBQ0E7O0FBRUE7O0FBQ0E7O0FBQ0E7O0FBRUE7O0FBQ0E7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztnQ0FHRTt5REFFQTt5REFDQTt5REFDQTt5REFDQTt5REFDQTt5REFDQTt5REFFQTt5REFDQTt5REFFQTt5REFDQTt5REFDQTt5REFDQTt5REFDQTt5REFDQTt5REFDQTt5REFDQTt5REFDQSIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8qIFNlZSBMSUNFTlNFIGZpbGUgZm9yIHRlcm1zIG9mIHVzZSAqL1xuXG4vKlxuICogVGV4dCBkaWZmIGltcGxlbWVudGF0aW9uLlxuICpcbiAqIFRoaXMgbGlicmFyeSBzdXBwb3J0cy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1wb3J0IHthcHBseVBhdGNoLCBhcHBseVBhdGNoZXN9IGZyb20gJy4vcGF0Y2gvYXBwbHknO1xuaW1wb3J0IHtwYXJzZVBhdGNofSBmcm9tICcuL3BhdGNoL3BhcnNlJztcbmltcG9ydCB7c3RydWN0dXJlZFBhdGNoLCBjcmVhdGVUd29GaWxlc1BhdGNoLCBjcmVhdGVQYXRjaH0gZnJvbSAnLi9wYXRjaC9jcmVhdGUnO1xuXG5pbXBvcnQge2NvbnZlcnRDaGFuZ2VzVG9ETVB9IGZyb20gJy4vY29udmVydC9kbXAnO1xuaW1wb3J0IHtjb252ZXJ0Q2hhbmdlc1RvWE1MfSBmcm9tICcuL2NvbnZlcnQveG1sJztcblxuZXhwb3J0IHtcbiAgRGlmZixcblxuICBkaWZmQ2hhcnMsXG4gIGRpZmZXb3JkcyxcbiAgZGlmZldvcmRzV2l0aFNwYWNlLFxuICBkaWZmTGluZXMsXG4gIGRpZmZUcmltbWVkTGluZXMsXG4gIGRpZmZTZW50ZW5jZXMsXG5cbiAgZGlmZkNzcyxcbiAgZGlmZkpzb24sXG5cbiAgc3RydWN0dXJlZFBhdGNoLFxuICBjcmVhdGVUd29GaWxlc1BhdGNoLFxuICBjcmVhdGVQYXRjaCxcbiAgYXBwbHlQYXRjaCxcbiAgYXBwbHlQYXRjaGVzLFxuICBwYXJzZVBhdGNoLFxuICBjb252ZXJ0Q2hhbmdlc1RvRE1QLFxuICBjb252ZXJ0Q2hhbmdlc1RvWE1MLFxuICBjYW5vbmljYWxpemVcbn07XG4iXX0=
-
-
-/***/ },
-/* 6 */
-/***/ function(module, exports) {
-
- /*istanbul ignore start*/'use strict';
-
- exports.__esModule = true;
- exports.default = /*istanbul ignore end*/Diff;
- function Diff() {}
-
- Diff.prototype = { /*istanbul ignore start*/
- /*istanbul ignore end*/diff: function diff(oldString, newString) {
- /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
-
- var callback = options.callback;
- if (typeof options === 'function') {
- callback = options;
- options = {};
- }
- this.options = options;
-
- var self = this;
-
- function done(value) {
- if (callback) {
- setTimeout(function () {
- callback(undefined, value);
- }, 0);
- return true;
- } else {
- return value;
- }
- }
-
- // Allow subclasses to massage the input prior to running
- oldString = this.castInput(oldString);
- newString = this.castInput(newString);
-
- oldString = this.removeEmpty(this.tokenize(oldString));
- newString = this.removeEmpty(this.tokenize(newString));
-
- var newLen = newString.length,
- oldLen = oldString.length;
- var editLength = 1;
- var maxEditLength = newLen + oldLen;
- var bestPath = [{ newPos: -1, components: [] }];
-
- // Seed editLength = 0, i.e. the content starts with the same values
- var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
- if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
- // Identity per the equality and tokenizer
- return done([{ value: newString.join(''), count: newString.length }]);
- }
-
- // Main worker method. checks all permutations of a given edit length for acceptance.
- function execEditLength() {
- for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
- var basePath = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
- var addPath = bestPath[diagonalPath - 1],
- removePath = bestPath[diagonalPath + 1],
- _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
- if (addPath) {
- // No one else is going to attempt to use this value, clear it
- bestPath[diagonalPath - 1] = undefined;
- }
-
- var canAdd = addPath && addPath.newPos + 1 < newLen,
- canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
- if (!canAdd && !canRemove) {
- // If this path is a terminal then prune
- bestPath[diagonalPath] = undefined;
- continue;
- }
-
- // Select the diagonal that we want to branch from. We select the prior
- // path whose position in the new string is the farthest from the origin
- // and does not pass the bounds of the diff graph
- if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
- basePath = clonePath(removePath);
- self.pushComponent(basePath.components, undefined, true);
- } else {
- basePath = addPath; // No need to clone, we've pulled it from the list
- basePath.newPos++;
- self.pushComponent(basePath.components, true, undefined);
- }
-
- _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath);
-
- // If we have hit the end of both strings, then we are done
- if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
- return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
- } else {
- // Otherwise track this path as a potential candidate and continue.
- bestPath[diagonalPath] = basePath;
- }
- }
-
- editLength++;
- }
-
- // Performs the length of edit iteration. Is a bit fugly as this has to support the
- // sync and async mode which is never fun. Loops over execEditLength until a value
- // is produced.
- if (callback) {
- (function exec() {
- setTimeout(function () {
- // This should not happen, but we want to be safe.
- /* istanbul ignore next */
- if (editLength > maxEditLength) {
- return callback();
- }
-
- if (!execEditLength()) {
- exec();
- }
- }, 0);
- })();
- } else {
- while (editLength <= maxEditLength) {
- var ret = execEditLength();
- if (ret) {
- return ret;
- }
- }
- }
- },
- /*istanbul ignore start*/ /*istanbul ignore end*/pushComponent: function pushComponent(components, added, removed) {
- var last = components[components.length - 1];
- if (last && last.added === added && last.removed === removed) {
- // We need to clone here as the component clone operation is just
- // as shallow array clone
- components[components.length - 1] = { count: last.count + 1, added: added, removed: removed };
- } else {
- components.push({ count: 1, added: added, removed: removed });
- }
- },
- /*istanbul ignore start*/ /*istanbul ignore end*/extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
- var newLen = newString.length,
- oldLen = oldString.length,
- newPos = basePath.newPos,
- oldPos = newPos - diagonalPath,
- commonCount = 0;
- while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
- newPos++;
- oldPos++;
- commonCount++;
- }
-
- if (commonCount) {
- basePath.components.push({ count: commonCount });
- }
-
- basePath.newPos = newPos;
- return oldPos;
- },
- /*istanbul ignore start*/ /*istanbul ignore end*/equals: function equals(left, right) {
- return left === right;
- },
- /*istanbul ignore start*/ /*istanbul ignore end*/removeEmpty: function removeEmpty(array) {
- var ret = [];
- for (var i = 0; i < array.length; i++) {
- if (array[i]) {
- ret.push(array[i]);
- }
- }
- return ret;
- },
- /*istanbul ignore start*/ /*istanbul ignore end*/castInput: function castInput(value) {
- return value;
- },
- /*istanbul ignore start*/ /*istanbul ignore end*/tokenize: function tokenize(value) {
- return value.split('');
- }
- };
-
- function buildValues(diff, components, newString, oldString, useLongestToken) {
- var componentPos = 0,
- componentLen = components.length,
- newPos = 0,
- oldPos = 0;
-
- for (; componentPos < componentLen; componentPos++) {
- var component = components[componentPos];
- if (!component.removed) {
- if (!component.added && useLongestToken) {
- var value = newString.slice(newPos, newPos + component.count);
- value = value.map(function (value, i) {
- var oldValue = oldString[oldPos + i];
- return oldValue.length > value.length ? oldValue : value;
- });
-
- component.value = value.join('');
- } else {
- component.value = newString.slice(newPos, newPos + component.count).join('');
- }
- newPos += component.count;
-
- // Common case
- if (!component.added) {
- oldPos += component.count;
- }
- } else {
- component.value = oldString.slice(oldPos, oldPos + component.count).join('');
- oldPos += component.count;
-
- // Reverse add and remove so removes are output first to match common convention
- // The diffing algorithm is tied to add then remove output and this is the simplest
- // route to get the desired output with minimal overhead.
- if (componentPos && components[componentPos - 1].added) {
- var tmp = components[componentPos - 1];
- components[componentPos - 1] = components[componentPos];
- components[componentPos] = tmp;
- }
- }
- }
-
- // Special case handle for when one terminal is ignored. For this case we merge the
- // terminal into the prior string and drop the change.
- var lastComponent = components[componentLen - 1];
- if (componentLen > 1 && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
- components[componentLen - 2].value += lastComponent.value;
- components.pop();
- }
-
- return components;
- }
-
- function clonePath(path) {
- return { newPos: path.newPos, components: path.components.slice(0) };
- }
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2Jhc2UuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O3lDQUF3QjtBQUFULFNBQVMsSUFBVCxHQUFnQixFQUFoQjs7QUFFZixLQUFLLFNBQUwsR0FBaUI7eUJBQ2Ysb0JBQUssV0FBVyx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XRoLm5ld1BvcywgY29tcG9uZW50czogcGF0aC5jb21wb25lbnRzLnNsaWNlKDApIH07XG59XG4iXX0=
-
-
-/***/ },
-/* 7 */
-/***/ function(module, exports, __webpack_require__) {
-
- /*istanbul ignore start*/'use strict';
-
- exports.__esModule = true;
- exports.characterDiff = undefined;
- exports. /*istanbul ignore end*/diffChars = diffChars;
-
- var /*istanbul ignore start*/_base = __webpack_require__(6) /*istanbul ignore end*/;
-
- /*istanbul ignore start*/
- var _base2 = _interopRequireDefault(_base);
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- /*istanbul ignore end*/var characterDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/characterDiff = new /*istanbul ignore start*/_base2.default() /*istanbul ignore end*/;
- function diffChars(oldStr, newStr, callback) {
- return characterDiff.diff(oldStr, newStr, callback);
- }
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2NoYXJhY3Rlci5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O2dDQUdnQjs7QUFIaEI7Ozs7Ozs7dUJBRU8sSUFBTSx5RkFBZ0IscUVBQWhCO0FBQ04sU0FBUyxTQUFULENBQW1CLE1BQW5CLEVBQTJCLE1BQTNCLEVBQW1DLFFBQW5DLEVBQTZDO0FBQUUsU0FBTyxjQUFjLElBQWQsQ0FBbUIsTUFBbkIsRUFBMkIsTUFBM0IsRUFBbUMsUUFBbkMsQ0FBUCxDQUFGO0NBQTdDIiwiZmlsZSI6ImNoYXJhY3Rlci5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBEaWZmIGZyb20gJy4vYmFzZSc7XG5cbmV4cG9ydCBjb25zdCBjaGFyYWN0ZXJEaWZmID0gbmV3IERpZmYoKTtcbmV4cG9ydCBmdW5jdGlvbiBkaWZmQ2hhcnMob2xkU3RyLCBuZXdTdHIsIGNhbGxiYWNrKSB7IHJldHVybiBjaGFyYWN0ZXJEaWZmLmRpZmYob2xkU3RyLCBuZXdTdHIsIGNhbGxiYWNrKTsgfVxuIl19
-
-
-/***/ },
-/* 8 */
-/***/ function(module, exports, __webpack_require__) {
-
- /*istanbul ignore start*/'use strict';
-
- exports.__esModule = true;
- exports.wordDiff = undefined;
- exports. /*istanbul ignore end*/diffWords = diffWords;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = diffWordsWithSpace;
-
- var /*istanbul ignore start*/_base = __webpack_require__(6) /*istanbul ignore end*/;
-
- /*istanbul ignore start*/
- var _base2 = _interopRequireDefault(_base);
-
- /*istanbul ignore end*/
- var /*istanbul ignore start*/_params = __webpack_require__(9) /*istanbul ignore end*/;
-
- /*istanbul ignore start*/
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- /*istanbul ignore end*/
-
- // Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode
- //
- // Ranges and exceptions:
- // Latin-1 Supplement, 0080–00FF
- // - U+00D7 × Multiplication sign
- // - U+00F7 ÷ Division sign
- // Latin Extended-A, 0100–017F
- // Latin Extended-B, 0180–024F
- // IPA Extensions, 0250–02AF
- // Spacing Modifier Letters, 02B0–02FF
- // - U+02C7 ˇ ˇ Caron
- // - U+02D8 ˘ ˘ Breve
- // - U+02D9 ˙ ˙ Dot Above
- // - U+02DA ˚ ˚ Ring Above
- // - U+02DB ˛ ˛ Ogonek
- // - U+02DC ˜ ˜ Small Tilde
- // - U+02DD ˝ ˝ Double Acute Accent
- // Latin Extended Additional, 1E00–1EFF
- var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/;
-
- var reWhitespace = /\S/;
-
- var wordDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/wordDiff = new /*istanbul ignore start*/_base2.default() /*istanbul ignore end*/;
- wordDiff.equals = function (left, right) {
- return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right);
- };
- wordDiff.tokenize = function (value) {
- var tokens = value.split(/(\s+|\b)/);
-
- // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set.
- for (var i = 0; i < tokens.length - 1; i++) {
- // If we have an empty string in the next field and we have only word chars before and after, merge
- if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) {
- tokens[i] += tokens[i + 2];
- tokens.splice(i + 1, 2);
- i--;
- }
- }
-
- return tokens;
- };
-
- function diffWords(oldStr, newStr, callback) {
- var options = /*istanbul ignore start*/(0, _params.generateOptions) /*istanbul ignore end*/(callback, { ignoreWhitespace: true });
- return wordDiff.diff(oldStr, newStr, options);
- }
- function diffWordsWithSpace(oldStr, newStr, callback) {
- return wordDiff.diff(oldStr, newStr, callback);
- }
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL3dvcmQuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztnQ0ErQ2dCO3lEQUlBOztBQW5EaEI7Ozs7OztBQUNBOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBb0JBLElBQU0sb0JBQW9CLCtEQUFwQjs7QUFFTixJQUFNLGVBQWUsSUFBZjs7QUFFQyxJQUFNLCtFQUFXLHFFQUFYO0FBQ2IsU0FBUyxNQUFULEdBQWtCLFVBQVMsSUFBVCxFQUFlLEtBQWYsRUFBc0I7QUFDdEMsU0FBTyxTQUFTLEtBQVQsSUFBbUIsS0FBSyxPQUFMLENBQWEsZ0JBQWIsSUFBaUMsQ0FBQyxhQUFhLElBQWIsQ0FBa0IsSUFBbEIsQ0FBRCxJQUE0QixDQUFDLGFBQWEsSUFBYixDQUFrQixLQUFsQixDQUFELENBRGpEO0NBQXRCO0FBR2xCLFNBQVMsUUFBVCxHQUFvQixVQUFTLEtBQVQsRUFBZ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0b2tlbnNbaSArIDJdKSkge1xuICAgICAgdG9rZW5zW2ldICs9IHRva2Vuc1tpICsgMl07XG4gICAgICB0b2tlbnMuc3BsaWNlKGkgKyAxLCAyKTtcbiAgICAgIGktLTtcbiAgICB9XG4gIH1cblxuICByZXR1cm4gdG9rZW5zO1xufTtcblxuZXhwb3J0IGZ1bmN0aW9uIGRpZmZXb3JkcyhvbGRTdHIsIG5ld1N0ciwgY2FsbGJhY2spIHtcbiAgbGV0IG9wdGlvbnMgPSBnZW5lcmF0ZU9wdGlvbnMoY2FsbGJhY2ssIHtpZ25vcmVXaGl0ZXNwYWNlOiB0cnVlfSk7XG4gIHJldHVybiB3b3JkRGlmZi5kaWZmKG9sZFN0ciwgbmV3U3RyLCBvcHRpb25zKTtcbn1cbmV4cG9ydCBmdW5jdGlvbiBkaWZmV29yZHNXaXRoU3BhY2Uob2xkU3RyLCBuZXdTdHIsIGNhbGxiYWNrKSB7XG4gIHJldHVybiB3b3JkRGlmZi5kaWZmKG9sZFN0ciwgbmV3U3RyLCBjYWxsYmFjayk7XG59XG4iXX0=
-
-
-/***/ },
-/* 9 */
-/***/ function(module, exports) {
-
- /*istanbul ignore start*/'use strict';
-
- exports.__esModule = true;
- exports. /*istanbul ignore end*/generateOptions = generateOptions;
- function generateOptions(options, defaults) {
- if (typeof options === 'function') {
- defaults.callback = options;
- } else if (options) {
- for (var name in options) {
- /* istanbul ignore else */
- if (options.hasOwnProperty(name)) {
- defaults[name] = options[name];
- }
- }
- }
- return defaults;
- }
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL3BhcmFtcy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Z0NBQWdCO0FBQVQsU0FBUyxlQUFULENBQXlCLE9BQXpCLEVBQWtDLFFBQWxDLEVBQTRDO0FBQ2pELE1BQUksT0FBTyxPQUFQLEtBQW1CLFVBQW5CLEVBQStCO0FBQ2pDLGFBQVMsUUFBVCxHQUFvQixPQUFwQixDQURpQztHQUFuQyxNQUVPLElBQUksT0FBSixFQUFhO0FBQ2xCLFNBQUssSUFBSSxJQUFKLElBQVksT0FBakIsRUFBMEI7O0FBRXhCLFVBQUksUUFBUSxjQUFSLENBQXVCLElBQXZCLENBQUosRUFBa0M7QUFDaEMsaUJBQVMsSUFBVCxJQUFpQixRQUFRLElBQVIsQ0FBakIsQ0FEZ0M7T0FBbEM7S0FGRjtHQURLO0FBUVAsU0FBTyxRQUFQLENBWGlEO0NBQTVDIiwiZmlsZSI6InBhcmFtcy5qcyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBmdW5jdGlvbiBnZW5lcmF0ZU9wdGlvbnMob3B0aW9ucywgZGVmYXVsdHMpIHtcbiAgaWYgKHR5cGVvZiBvcHRpb25zID09PSAnZnVuY3Rpb24nKSB7XG4gICAgZGVmYXVsdHMuY2FsbGJhY2sgPSBvcHRpb25zO1xuICB9IGVsc2UgaWYgKG9wdGlvbnMpIHtcbiAgICBmb3IgKGxldCBuYW1lIGluIG9wdGlvbnMpIHtcbiAgICAgIC8qIGlzdGFuYnVsIGlnbm9yZSBlbHNlICovXG4gICAgICBpZiAob3B0aW9ucy5oYXNPd25Qcm9wZXJ0eShuYW1lKSkge1xuICAgICAgICBkZWZhdWx0c1tuYW1lXSA9IG9wdGlvbnNbbmFtZV07XG4gICAgICB9XG4gICAgfVxuICB9XG4gIHJldHVybiBkZWZhdWx0cztcbn1cbiJdfQ==
-
-
-/***/ },
-/* 10 */
-/***/ function(module, exports, __webpack_require__) {
-
- /*istanbul ignore start*/'use strict';
-
- exports.__esModule = true;
- exports.lineDiff = undefined;
- exports. /*istanbul ignore end*/diffLines = diffLines;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = diffTrimmedLines;
-
- var /*istanbul ignore start*/_base = __webpack_require__(6) /*istanbul ignore end*/;
-
- /*istanbul ignore start*/
- var _base2 = _interopRequireDefault(_base);
-
- /*istanbul ignore end*/
- var /*istanbul ignore start*/_params = __webpack_require__(9) /*istanbul ignore end*/;
-
- /*istanbul ignore start*/
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- /*istanbul ignore end*/var lineDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/lineDiff = new /*istanbul ignore start*/_base2.default() /*istanbul ignore end*/;
- lineDiff.tokenize = function (value) {
- var retLines = [],
- linesAndNewlines = value.split(/(\n|\r\n)/);
-
- // Ignore the final empty token that occurs if the string ends with a new line
- if (!linesAndNewlines[linesAndNewlines.length - 1]) {
- linesAndNewlines.pop();
- }
-
- // Merge the content and line separators into single tokens
- for (var i = 0; i < linesAndNewlines.length; i++) {
- var line = linesAndNewlines[i];
-
- if (i % 2 && !this.options.newlineIsToken) {
- retLines[retLines.length - 1] += line;
- } else {
- if (this.options.ignoreWhitespace) {
- line = line.trim();
- }
- retLines.push(line);
- }
- }
-
- return retLines;
- };
-
- function diffLines(oldStr, newStr, callback) {
- return lineDiff.diff(oldStr, newStr, callback);
- }
- function diffTrimmedLines(oldStr, newStr, callback) {
- var options = /*istanbul ignore start*/(0, _params.generateOptions) /*istanbul ignore end*/(callback, { ignoreWhitespace: true });
- return lineDiff.diff(oldStr, newStr, options);
- }
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2xpbmUuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztnQ0E4QmdCO3lEQUNBOztBQS9CaEI7Ozs7OztBQUNBOzs7Ozt1QkFFTyxJQUFNLCtFQUFXLHFFQUFYO0FBQ2IsU0FBUyxRQUFULEdBQW9CLFVBQVMsS0FBVCxFQUFnQjtBQUNsQyxNQUFJLFdBQVcsRUFBWDtNQUNBLG1CQUFtQixNQUFNLEtBQU4sQ0FBWSxXQUFaLENBQW5COzs7QUFGOEIsTUFLOUIsQ0FBQyxpQkFBa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H1cbiAgfVxuXG4gIHJldHVybiByZXRMaW5lcztcbn07XG5cbmV4cG9ydCBmdW5jdGlvbiBkaWZmTGluZXMob2xkU3RyLCBuZXdTdHIsIGNhbGxiYWNrKSB7IHJldHVybiBsaW5lRGlmZi5kaWZmKG9sZFN0ciwgbmV3U3RyLCBjYWxsYmFjayk7IH1cbmV4cG9ydCBmdW5jdGlvbiBkaWZmVHJpbW1lZExpbmVzKG9sZFN0ciwgbmV3U3RyLCBjYWxsYmFjaykge1xuICBsZXQgb3B0aW9ucyA9IGdlbmVyYXRlT3B0aW9ucyhjYWxsYmFjaywge2lnbm9yZVdoaXRlc3BhY2U6IHRydWV9KTtcbiAgcmV0dXJuIGxpbmVEaWZmLmRpZmYob2xkU3RyLCBuZXdTdHIsIG9wdGlvbnMpO1xufVxuIl19
-
-
-/***/ },
-/* 11 */
-/***/ function(module, exports, __webpack_require__) {
-
- /*istanbul ignore start*/'use strict';
-
- exports.__esModule = true;
- exports.sentenceDiff = undefined;
- exports. /*istanbul ignore end*/diffSentences = diffSentences;
-
- var /*istanbul ignore start*/_base = __webpack_require__(6) /*istanbul ignore end*/;
-
- /*istanbul ignore start*/
- var _base2 = _interopRequireDefault(_base);
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- /*istanbul ignore end*/var sentenceDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/sentenceDiff = new /*istanbul ignore start*/_base2.default() /*istanbul ignore end*/;
- sentenceDiff.tokenize = function (value) {
- return value.split(/(\S.+?[.!?])(?=\s+|$)/);
- };
-
- function diffSentences(oldStr, newStr, callback) {
- return sentenceDiff.diff(oldStr, newStr, callback);
- }
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL3NlbnRlbmNlLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Z0NBUWdCOztBQVJoQjs7Ozs7Ozt1QkFHTyxJQUFNLHVGQUFlLHFFQUFmO0FBQ2IsYUFBYSxRQUFiLEdBQXdCLFVBQVMsS0FBVCxFQUFnQjtBQUN0QyxTQUFPLE1BQU0sS0FBTixDQUFZLHVCQUFaLENBQVAsQ0FEc0M7Q0FBaEI7O0FBSWpCLFNBQVMsYUFBVCxDQUF1QixNQUF2QixFQUErQixNQUEvQixFQUF1QyxRQUF2QyxFQUFpRDtBQUFFLFNBQU8sYUFBYSxJQUFiLENBQWtCLE1BQWxCLEVBQTBCLE1BQTFCLEVBQWtDLFFBQWxDLENBQVAsQ0FBRjtDQUFqRCIsImZpbGUiOiJzZW50ZW5jZS5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBEaWZmIGZyb20gJy4vYmFzZSc7XG5cblxuZXhwb3J0IGNvbnN0IHNlbnRlbmNlRGlmZiA9IG5ldyBEaWZmKCk7XG5zZW50ZW5jZURpZmYudG9rZW5pemUgPSBmdW5jdGlvbih2YWx1ZSkge1xuICByZXR1cm4gdmFsdWUuc3BsaXQoLyhcXFMuKz9bLiE/XSkoPz1cXHMrfCQpLyk7XG59O1xuXG5leHBvcnQgZnVuY3Rpb24gZGlmZlNlbnRlbmNlcyhvbGRTdHIsIG5ld1N0ciwgY2FsbGJhY2spIHsgcmV0dXJuIHNlbnRlbmNlRGlmZi5kaWZmKG9sZFN0ciwgbmV3U3RyLCBjYWxsYmFjayk7IH1cbiJdfQ==
-
-
-/***/ },
-/* 12 */
-/***/ function(module, exports, __webpack_require__) {
-
- /*istanbul ignore start*/'use strict';
-
- exports.__esModule = true;
- exports.cssDiff = undefined;
- exports. /*istanbul ignore end*/diffCss = diffCss;
-
- var /*istanbul ignore start*/_base = __webpack_require__(6) /*istanbul ignore end*/;
-
- /*istanbul ignore start*/
- var _base2 = _interopRequireDefault(_base);
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- /*istanbul ignore end*/var cssDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/cssDiff = new /*istanbul ignore start*/_base2.default() /*istanbul ignore end*/;
- cssDiff.tokenize = function (value) {
- return value.split(/([{}:;,]|\s+)/);
- };
-
- function diffCss(oldStr, newStr, callback) {
- return cssDiff.diff(oldStr, newStr, callback);
- }
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2Nzcy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O2dDQU9nQjs7QUFQaEI7Ozs7Ozs7dUJBRU8sSUFBTSw2RUFBVSxxRUFBVjtBQUNiLFFBQVEsUUFBUixHQUFtQixVQUFTLEtBQVQsRUFBZ0I7QUFDakMsU0FBTyxNQUFNLEtBQU4sQ0FBWSxlQUFaLENBQVAsQ0FEaUM7Q0FBaEI7O0FBSVosU0FBUyxPQUFULENBQWlCLE1BQWpCLEVBQXlCLE1BQXpCLEVBQWlDLFFBQWpDLEVBQTJDO0FBQUUsU0FBTyxRQUFRLElBQVIsQ0FBYSxNQUFiLEVBQXFCLE1BQXJCLEVBQTZCLFFBQTdCLENBQVAsQ0FBRjtDQUEzQyIsImZpbGUiOiJjc3MuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgRGlmZiBmcm9tICcuL2Jhc2UnO1xuXG5leHBvcnQgY29uc3QgY3NzRGlmZiA9IG5ldyBEaWZmKCk7XG5jc3NEaWZmLnRva2VuaXplID0gZnVuY3Rpb24odmFsdWUpIHtcbiAgcmV0dXJuIHZhbHVlLnNwbGl0KC8oW3t9OjssXXxcXHMrKS8pO1xufTtcblxuZXhwb3J0IGZ1bmN0aW9uIGRpZmZDc3Mob2xkU3RyLCBuZXdTdHIsIGNhbGxiYWNrKSB7IHJldHVybiBjc3NEaWZmLmRpZmYob2xkU3RyLCBuZXdTdHIsIGNhbGxiYWNrKTsgfVxuIl19
-
-
-/***/ },
-/* 13 */
-/***/ function(module, exports, __webpack_require__) {
-
- /*istanbul ignore start*/'use strict';
-
- exports.__esModule = true;
- exports.jsonDiff = undefined;
-
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
-
- exports. /*istanbul ignore end*/diffJson = diffJson;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = canonicalize;
-
- var /*istanbul ignore start*/_base = __webpack_require__(6) /*istanbul ignore end*/;
-
- /*istanbul ignore start*/
- var _base2 = _interopRequireDefault(_base);
-
- /*istanbul ignore end*/
- var /*istanbul ignore start*/_line = __webpack_require__(10) /*istanbul ignore end*/;
-
- /*istanbul ignore start*/
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- /*istanbul ignore end*/
-
- var objectPrototypeToString = Object.prototype.toString;
-
- var jsonDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/jsonDiff = new /*istanbul ignore start*/_base2.default() /*istanbul ignore end*/;
- // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
- // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
- jsonDiff.useLongestToken = true;
-
- jsonDiff.tokenize = /*istanbul ignore start*/_line.lineDiff. /*istanbul ignore end*/tokenize;
- jsonDiff.castInput = function (value) {
- return typeof value === 'string' ? value : JSON.stringify(canonicalize(value), undefined, ' ');
- };
- jsonDiff.equals = function (left, right) {
- return (/*istanbul ignore start*/_base2.default. /*istanbul ignore end*/prototype.equals(left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'))
- );
- };
-
- function diffJson(oldObj, newObj, callback) {
- return jsonDiff.diff(oldObj, newObj, callback);
- }
-
- // This function handles the presence of circular references by bailing out when encountering an
- // object that is already on the "stack" of items being processed.
- function canonicalize(obj, stack, replacementStack) {
- stack = stack || [];
- replacementStack = replacementStack || [];
-
- var i = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
-
- for (i = 0; i < stack.length; i += 1) {
- if (stack[i] === obj) {
- return replacementStack[i];
- }
- }
-
- var canonicalizedObj = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
-
- if ('[object Array]' === objectPrototypeToString.call(obj)) {
- stack.push(obj);
- canonicalizedObj = new Array(obj.length);
- replacementStack.push(canonicalizedObj);
- for (i = 0; i < obj.length; i += 1) {
- canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack);
- }
- stack.pop();
- replacementStack.pop();
- return canonicalizedObj;
- }
-
- if (obj && obj.toJSON) {
- obj = obj.toJSON();
- }
-
- if ( /*istanbul ignore start*/(typeof /*istanbul ignore end*/obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && obj !== null) {
- stack.push(obj);
- canonicalizedObj = {};
- replacementStack.push(canonicalizedObj);
- var sortedKeys = [],
- key = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
- for (key in obj) {
- /* istanbul ignore else */
- if (obj.hasOwnProperty(key)) {
- sortedKeys.push(key);
- }
- }
- sortedKeys.sort();
- for (i = 0; i < sortedKeys.length; i += 1) {
- key = sortedKeys[i];
- canonicalizedObj[key] = canonicalize(obj[key], stack, replacementStack);
- }
- stack.pop();
- replacementStack.pop();
- } else {
- canonicalizedObj = obj;
- }
- return canonicalizedObj;
- }
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2pzb24uanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7OztnQ0FtQmdCO3lEQUtBOztBQXhCaEI7Ozs7OztBQUNBOzs7Ozs7O0FBRUEsSUFBTSwwQkFBMEIsT0FBTyxTQUFQLENBQWlCLFFBQWpCOztBQUd6QixJQUFNLCtFQUFXLHFFQUFYOzs7QUFHYixTQUFTLGVBQVQsR0FBMkIsSUFBM0I7O0FBRUEsU0FBUyxRQUFULEdBQW9CLGdFQUFTLFFBQVQ7QUFDcEIsU0FBUyxTQUF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sgaSArPSAxKSB7XG4gICAgICBrZXkgPSBzb3J0ZWRLZXlzW2ldO1xuICAgICAgY2Fub25pY2FsaXplZE9ialtrZXldID0gY2Fub25pY2FsaXplKG9ialtrZXldLCBzdGFjaywgcmVwbGFjZW1lbnRTdGFjayk7XG4gICAgfVxuICAgIHN0YWNrLnBvcCgpO1xuICAgIHJlcGxhY2VtZW50U3RhY2sucG9wKCk7XG4gIH0gZWxzZSB7XG4gICAgY2Fub25pY2FsaXplZE9iaiA9IG9iajtcbiAgfVxuICByZXR1cm4gY2Fub25pY2FsaXplZE9iajtcbn1cbiJdfQ==
-
-
-/***/ },
-/* 14 */
-/***/ function(module, exports, __webpack_require__) {
-
- /*istanbul ignore start*/'use strict';
-
- exports.__esModule = true;
- exports. /*istanbul ignore end*/applyPatch = applyPatch;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = applyPatches;
-
- var /*istanbul ignore start*/_parse = __webpack_require__(15) /*istanbul ignore end*/;
-
- var /*istanbul ignore start*/_distanceIterator = __webpack_require__(16) /*istanbul ignore end*/;
-
- /*istanbul ignore start*/
- var _distanceIterator2 = _interopRequireDefault(_distanceIterator);
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- /*istanbul ignore end*/function applyPatch(source, uniDiff) {
- /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
-
- if (typeof uniDiff === 'string') {
- uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);
- }
-
- if (Array.isArray(uniDiff)) {
- if (uniDiff.length > 1) {
- throw new Error('applyPatch only works with a single input.');
- }
-
- uniDiff = uniDiff[0];
- }
-
- // Apply the diff to the input
- var lines = source.split('\n'),
- hunks = uniDiff.hunks,
- compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) /*istanbul ignore start*/{
- return (/*istanbul ignore end*/line === patchContent
- );
- },
- errorCount = 0,
- fuzzFactor = options.fuzzFactor || 0,
- minLine = 0,
- offset = 0,
- removeEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/,
- addEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
-
- /**
- * Checks if the hunk exactly fits on the provided location
- */
- function hunkFits(hunk, toPos) {
- for (var j = 0; j < hunk.lines.length; j++) {
- var line = hunk.lines[j],
- operation = line[0],
- content = line.substr(1);
-
- if (operation === ' ' || operation === '-') {
- // Context sanity check
- if (!compareLine(toPos + 1, lines[toPos], operation, content)) {
- errorCount++;
-
- if (errorCount > fuzzFactor) {
- return false;
- }
- }
- toPos++;
- }
- }
-
- return true;
- }
-
- // Search best fit offsets for each hunk based on the previous ones
- for (var i = 0; i < hunks.length; i++) {
- var hunk = hunks[i],
- maxLine = lines.length - hunk.oldLines,
- localOffset = 0,
- toPos = offset + hunk.oldStart - 1;
-
- var iterator = /*istanbul ignore start*/(0, _distanceIterator2.default) /*istanbul ignore end*/(toPos, minLine, maxLine);
-
- for (; localOffset !== undefined; localOffset = iterator()) {
- if (hunkFits(hunk, toPos + localOffset)) {
- hunk.offset = offset += localOffset;
- break;
- }
- }
-
- if (localOffset === undefined) {
- return false;
- }
-
- // Set lower text limit to end of the current hunk, so next ones don't try
- // to fit over already patched text
- minLine = hunk.offset + hunk.oldStart + hunk.oldLines;
- }
-
- // Apply patch hunks
- for (var _i = 0; _i < hunks.length; _i++) {
- var _hunk = hunks[_i],
- _toPos = _hunk.offset + _hunk.newStart - 1;
-
- for (var j = 0; j < _hunk.lines.length; j++) {
- var line = _hunk.lines[j],
- operation = line[0],
- content = line.substr(1);
-
- if (operation === ' ') {
- _toPos++;
- } else if (operation === '-') {
- lines.splice(_toPos, 1);
- /* istanbul ignore else */
- } else if (operation === '+') {
- lines.splice(_toPos, 0, content);
- _toPos++;
- } else if (operation === '\\') {
- var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null;
- if (previousOperation === '+') {
- removeEOFNL = true;
- } else if (previousOperation === '-') {
- addEOFNL = true;
- }
- }
- }
- }
-
- // Handle EOFNL insertion/removal
- if (removeEOFNL) {
- while (!lines[lines.length - 1]) {
- lines.pop();
- }
- } else if (addEOFNL) {
- lines.push('');
- }
- return lines.join('\n');
- }
-
- // Wrapper that supports multiple file patches via callbacks.
- function applyPatches(uniDiff, options) {
- if (typeof uniDiff === 'string') {
- uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);
- }
-
- var currentIndex = 0;
- function processIndex() {
- var index = uniDiff[currentIndex++];
- if (!index) {
- return options.complete();
- }
-
- options.loadFile(index, function (err, data) {
- if (err) {
- return options.complete(err);
- }
-
- var updatedContent = applyPatch(data, index, options);
- options.patched(index, updatedContent);
-
- setTimeout(processIndex, 0);
- });
- }
- processIndex();
- }
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9hcHBseS5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Z0NBR2dCO3lEQXFIQTs7QUF4SGhCOztBQUNBOzs7Ozs7O3VCQUVPLFNBQVMsVUFBVCxDQUFvQixNQUFwQixFQUE0QixPQUE1QixFQUFtRDtzREFBZCxnRUFBVSxrQkFBSTs7QUFDeEQsTUFBSSxPQUFPLE9BQVAsS0FBbUIsUUFBbkIsRUFBNkI7QUFDL0IsY0FBVSx3RUFBVyxPQUFYLENBQVYsQ0FEK0I7R0FBakM7O0FBSUEsTUFBSSxNQUFNLE9BQU4sQ0FBYyxPQUFkLENBQUosRUFBNEI7QUFDMUIsUUFBSSxRQUFRLE1BQVIsR0FBaUIsQ0FBakIsRUFBb0I7QUFDdEIsWUFBTSxJQUFJLEtBQUosQ0FBVSw0Q0FBVixDQUFOLENBRHNCO0tBQXhCOztBQUlBLGNBQVUsUUFBUSxDQUFSLENBQVYsQ0FMMEI7R0FBNUI7OztBQUx3RCxNQWNwRCxRQUFRLE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JlbnRJbmRleCsrXTtcbiAgICBpZiAoIWluZGV4KSB7XG4gICAgICByZXR1cm4gb3B0aW9ucy5jb21wbGV0ZSgpO1xuICAgIH1cblxuICAgIG9wdGlvbnMubG9hZEZpbGUoaW5kZXgsIGZ1bmN0aW9uKGVyciwgZGF0YSkge1xuICAgICAgaWYgKGVycikge1xuICAgICAgICByZXR1cm4gb3B0aW9ucy5jb21wbGV0ZShlcnIpO1xuICAgICAgfVxuXG4gICAgICBsZXQgdXBkYXRlZENvbnRlbnQgPSBhcHBseVBhdGNoKGRhdGEsIGluZGV4LCBvcHRpb25zKTtcbiAgICAgIG9wdGlvbnMucGF0Y2hlZChpbmRleCwgdXBkYXRlZENvbnRlbnQpO1xuXG4gICAgICBzZXRUaW1lb3V0KHByb2Nlc3NJbmRleCwgMCk7XG4gICAgfSk7XG4gIH1cbiAgcHJvY2Vzc0luZGV4KCk7XG59XG4iXX0=
-
-
-/***/ },
-/* 15 */
-/***/ function(module, exports) {
-
- /*istanbul ignore start*/'use strict';
-
- exports.__esModule = true;
- exports. /*istanbul ignore end*/parsePatch = parsePatch;
- function parsePatch(uniDiff) {
- /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
-
- var diffstr = uniDiff.split('\n'),
- list = [],
- i = 0;
-
- function parseIndex() {
- var index = {};
- list.push(index);
-
- // Parse diff metadata
- while (i < diffstr.length) {
- var line = diffstr[i];
-
- // File header found, end parsing diff metadata
- if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) {
- break;
- }
-
- // Diff index
- var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line);
- if (header) {
- index.index = header[1];
- }
-
- i++;
- }
-
- // Parse file headers if they are defined. Unified diff requires them, but
- // there's no technical issues to have an isolated hunk without file header
- parseFileHeader(index);
- parseFileHeader(index);
-
- // Parse hunks
- index.hunks = [];
-
- while (i < diffstr.length) {
- var _line = diffstr[i];
-
- if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) {
- break;
- } else if (/^@@/.test(_line)) {
- index.hunks.push(parseHunk());
- } else if (_line && options.strict) {
- // Ignore unexpected content unless in strict mode
- throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line));
- } else {
- i++;
- }
- }
- }
-
- // Parses the --- and +++ headers, if none are found, no lines
- // are consumed.
- function parseFileHeader(index) {
- var fileHeader = /^(\-\-\-|\+\+\+)\s+(\S*)\s?(.*?)\s*$/.exec(diffstr[i]);
- if (fileHeader) {
- var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new';
- index[keyPrefix + 'FileName'] = fileHeader[2];
- index[keyPrefix + 'Header'] = fileHeader[3];
-
- i++;
- }
- }
-
- // Parses a hunk
- // This assumes that we are at the start of a hunk.
- function parseHunk() {
- var chunkHeaderIndex = i,
- chunkHeaderLine = diffstr[i++],
- chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
-
- var hunk = {
- oldStart: +chunkHeader[1],
- oldLines: +chunkHeader[2] || 1,
- newStart: +chunkHeader[3],
- newLines: +chunkHeader[4] || 1,
- lines: []
- };
-
- var addCount = 0,
- removeCount = 0;
- for (; i < diffstr.length; i++) {
- var operation = diffstr[i][0];
-
- if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') {
- hunk.lines.push(diffstr[i]);
-
- if (operation === '+') {
- addCount++;
- } else if (operation === '-') {
- removeCount++;
- } else if (operation === ' ') {
- addCount++;
- removeCount++;
- }
- } else {
- break;
- }
- }
-
- // Handle the empty block count case
- if (!addCount && hunk.newLines === 1) {
- hunk.newLines = 0;
- }
- if (!removeCount && hunk.oldLines === 1) {
- hunk.oldLines = 0;
- }
-
- // Perform optional sanity checking
- if (options.strict) {
- if (addCount !== hunk.newLines) {
- throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
- }
- if (removeCount !== hunk.oldLines) {
- throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
- }
- }
-
- return hunk;
- }
-
- while (i < diffstr.length) {
- parseIndex();
- }
-
- return list;
- }
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9wYXJzZS5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Z0NBQWdCO0FBQVQsU0FBUyxVQUFULENBQW9CLE9BQXBCLEVBQTJDO3NEQUFkLGdFQUFVLGtCQUFJOztBQUNoRCxNQUFJLFVBQVUsUUFBUSxLQUFSLENBQWMsSUFBZCxDQUFWO01BQ0EsT0FBTyxFQUFQO01BQ0EsSUFBSSxDQUFKLENBSDRDOztBQUtoRCxXQUFTLFVBQVQsR0FBc0I7QUFDcEIsUUFBSSxRQUFRLEVBQVIsQ0FEZ0I7QUFFcEIsU0FBSyxJQUFMLENBQVUsS0FBVjs7O0FBRm9CLFdBS2IsSUFBSSxRQUFRLE1BQVIsRUFBZ0I7QUFDekIsVUFBSSxPQUFPLFFBQVEsQ0FBUixDQUFQOzs7QUFEcUIsVUFJckIsd0JBQXdCLElBQXhCLENBQTZCLElBQTdCLENBQUosRUFBd0M7QUFDdEMsY0FEc0M7T0FBeEM7OztBQUp5QixVQVNyQixTQUFTLDJDQUE2QyxJQUE3QyxDQUFrRCxJQUFsRCxDQUFULENBVHFCO0FBVXpCLFVBQUksTUFBSixFQUFZO0FBQ1YsY0FBTSxLQUFOLEdBQWMsT0FBTyxDQUFQLENBQWQsQ0FEVTtPQUFaOztBQUlBLFVBZHlCO0tBQTNCOzs7O0FBTG9CLG1CQXdCcEIsQ0FBZ0IsS0FBaEIsRUF4Qm9CO0FBeUJwQixvQkFBZ0IsS0FBaEI7OztBQXpCb0IsU0E0QnBCLENBQU0sS0FBTixHQUFjLEVBQWQsQ0E1Qm9COztBQThCcEIsV0FBTyxJQUFJLFFBQVEsTUFBUixFQUFnQjtBQUN6QixVQUFJLFFBQU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xcZCspKT8gXFwrKFxcZCspKD86LChcXGQrKSk/IEBALyk7XG5cbiAgICBsZXQgaHVuayA9IHtcbiAgICAgIG9sZFN0YXJ0OiArY2h1bmtIZWFkZXJbMV0sXG4gICAgICBvbGRMaW5lczogK2NodW5rSGVhZGVyWzJdIHx8IDEsXG4gICAgICBuZXdTdGFydDogK2NodW5rSGVhZGVyWzNdLFxuICAgICAgbmV3TGluZXM6ICtjaHVua0hlYWRlcls0XSB8fCAxLFxuICAgICAgbGluZXM6IFtdXG4gICAgfTtcblxuICAgIGxldCBhZGRDb3VudCA9IDAsXG4gICAgICAgIHJlbW92ZUNvdW50ID0gMDtcbiAgICBmb3IgKDsgaSA8IGRpZmZzdHIubGVuZ3RoOyBpKyspIHtcbiAgICAgIGxldCBvcGVyYXRpb24gPSBkaWZmc3RyW2ldWzBdO1xuXG4gICAgICBpZiAob3BlcmF0aW9uID09PSAnKycgfHwgb3BlcmF0aW9uID09PSAnLScgfHwgb3BlcmF0aW9uID09PSAnICcgfHwgb3BlcmF0aW9uID09PSAnXFxcXCcpIHtcbiAgICAgICAgaHVuay5saW5lcy5wdXNoKGRpZmZzdHJbaV0pO1xuXG4gICAgICAgIGlmIChvcGVyYXRpb24gPT09ICcrJykge1xuICAgICAgICAgIGFkZENvdW50Kys7XG4gICAgICAgIH0gZWxzZSBpZiAob3BlcmF0aW9uID09PSAnLScpIHtcbiAgICAgICAgICByZW1vdmVDb3VudCsrO1xuICAgICAgICB9IGVsc2UgaWYgKG9wZXJhdGlvbiA9PT0gJyAnKSB7XG4gICAgICAgICAgYWRkQ291bnQrKztcbiAgICAgICAgICByZW1vdmVDb3VudCsrO1xuICAgICAgICB9XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBicmVhaztcbiAgICAgIH1cbiAgICB9XG5cbiAgICAvLyBIYW5kbGUgdGhlIGVtcHR5IGJsb2NrIGNvdW50IGNhc2VcbiAgICBpZiAoIWFkZENvdW50ICYmIGh1bmsubmV3TGluZXMgPT09IDEpIHtcbiAgICAgIGh1bmsubmV3TGluZXMgPSAwO1xuICAgIH1cbiAgICBpZiAoIXJlbW92ZUNvdW50ICYmIGh1bmsub2xkTGluZXMgPT09IDEpIHtcbiAgICAgIGh1bmsub2xkTGluZXMgPSAwO1xuICAgIH1cblxuICAgIC8vIFBlcmZvcm0gb3B0aW9uYWwgc2FuaXR5IGNoZWNraW5nXG4gICAgaWYgKG9wdGlvbnMuc3RyaWN0KSB7XG4gICAgICBpZiAoYWRkQ291bnQgIT09IGh1bmsubmV3TGluZXMpIHtcbiAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdBZGRlZCBsaW5lIGNvdW50IGRpZCBub3QgbWF0Y2ggZm9yIGh1bmsgYXQgbGluZSAnICsgKGNodW5rSGVhZGVySW5kZXggKyAxKSk7XG4gICAgICB9XG4gICAgICBpZiAocmVtb3ZlQ291bnQgIT09IGh1bmsub2xkTGluZXMpIHtcbiAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdSZW1vdmVkIGxpbmUgY291bnQgZGlkIG5vdCBtYXRjaCBmb3IgaHVuayBhdCBsaW5lICcgKyAoY2h1bmtIZWFkZXJJbmRleCArIDEpKTtcbiAgICAgIH1cbiAgICB9XG5cbiAgICByZXR1cm4gaHVuaztcbiAgfVxuXG4gIHdoaWxlIChpIDwgZGlmZnN0ci5sZW5ndGgpIHtcbiAgICBwYXJzZUluZGV4KCk7XG4gIH1cblxuICByZXR1cm4gbGlzdDtcbn1cbiJdfQ==
-
-
-/***/ },
-/* 16 */
-/***/ function(module, exports) {
-
- /*istanbul ignore start*/"use strict";
-
- exports.__esModule = true;
-
- exports.default = /*istanbul ignore end*/function (start, minLine, maxLine) {
- var wantForward = true,
- backwardExhausted = false,
- forwardExhausted = false,
- localOffset = 1;
-
- return function iterator() {
- if (wantForward && !forwardExhausted) {
- if (backwardExhausted) {
- localOffset++;
- } else {
- wantForward = false;
- }
-
- // Check if trying to fit beyond text length, and if not, check it fits
- // after offset location (or desired location on first iteration)
- if (start + localOffset <= maxLine) {
- return localOffset;
- }
-
- forwardExhausted = true;
- }
-
- if (!backwardExhausted) {
- if (!forwardExhausted) {
- wantForward = true;
- }
-
- // Check if trying to fit before text beginning, and if not, check it fits
- // before offset location
- if (minLine <= start - localOffset) {
- return - localOffset++;
- }
-
- backwardExhausted = true;
- return iterator();
- }
-
- // We tried to fit hunk before text beginning and beyond text lenght, then
- // hunk can't fit on the text. Return undefined
- };
- };
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL2Rpc3RhbmNlLWl0ZXJhdG9yLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7eUNBR2UsVUFBUyxLQUFULEVBQWdCLE9BQWhCLEVBQXlCLE9BQXpCLEVBQWtDO0FBQy9DLE1BQUksY0FBYyxJQUFkO01BQ0Esb0JBQW9CLEtBQXBCO01BQ0EsbUJBQW1CLEtBQW5CO01BQ0EsY0FBYyxDQUFkLENBSjJDOztBQU0vQyxTQUFPLFNBQVMsUUFBVCxHQUFvQjtBQUN6QixRQUFJLGVBQWUsQ0FBQyxnQkFBRCxFQUFtQjtBQUNwQyxVQUFJLGlCQUFKLEVBQXVCO0FBQ3JCLHNCQURxQjtPQUF2QixNQUVPO0FBQ0wsc0JBQWMsS0FBZCxDQURLO09BRlA7Ozs7QUFEb0MsVUFTaEMsUUFBUSxXQUFSLElBQXVCLE9BQXZCLEVBQWdDO0FBQ2xDLGVBQU8sV0FBUCxDQURrQztPQUFwQzs7QUFJQSx5QkFBbUIsSUFBbkIsQ0Fib0M7S0FBdEM7O0FBZ0JBLFFBQUksQ0FBQyxpQkFBRCxFQUFvQjtBQUN0QixVQUFJLENBQUMsZ0JBQUQsRUFBbUI7QUFDckIsc0JBQWMsSUFBZCxDQURxQjtPQUF2Qjs7OztBQURzQixVQU9sQixXQUFXLFFBQVEsV0FBUixFQUFxQjtBQUNsQyxlQUFPLEVBQUMsY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c2lyZWQgbG9jYXRpb24gb24gZmlyc3QgaXRlcmF0aW9uKVxuICAgICAgaWYgKHN0YXJ0ICsgbG9jYWxPZmZzZXQgPD0gbWF4TGluZSkge1xuICAgICAgICByZXR1cm4gbG9jYWxPZmZzZXQ7XG4gICAgICB9XG5cbiAgICAgIGZvcndhcmRFeGhhdXN0ZWQgPSB0cnVlO1xuICAgIH1cblxuICAgIGlmICghYmFja3dhcmRFeGhhdXN0ZWQpIHtcbiAgICAgIGlmICghZm9yd2FyZEV4aGF1c3RlZCkge1xuICAgICAgICB3YW50Rm9yd2FyZCA9IHRydWU7XG4gICAgICB9XG5cbiAgICAgIC8vIENoZWNrIGlmIHRyeWluZyB0byBmaXQgYmVmb3JlIHRleHQgYmVnaW5uaW5nLCBhbmQgaWYgbm90LCBjaGVjayBpdCBmaXRzXG4gICAgICAvLyBiZWZvcmUgb2Zmc2V0IGxvY2F0aW9uXG4gICAgICBpZiAobWluTGluZSA8PSBzdGFydCAtIGxvY2FsT2Zmc2V0KSB7XG4gICAgICAgIHJldHVybiAtbG9jYWxPZmZzZXQrKztcbiAgICAgIH1cblxuICAgICAgYmFja3dhcmRFeGhhdXN0ZWQgPSB0cnVlO1xuICAgICAgcmV0dXJuIGl0ZXJhdG9yKCk7XG4gICAgfVxuXG4gICAgLy8gV2UgdHJpZWQgdG8gZml0IGh1bmsgYmVmb3JlIHRleHQgYmVnaW5uaW5nIGFuZCBiZXlvbmQgdGV4dCBsZW5naHQsIHRoZW5cbiAgICAvLyBodW5rIGNhbid0IGZpdCBvbiB0aGUgdGV4dC4gUmV0dXJuIHVuZGVmaW5lZFxuICB9O1xufVxuIl19
-
-
-/***/ },
-/* 17 */
-/***/ function(module, exports, __webpack_require__) {
-
- /*istanbul ignore start*/'use strict';
-
- exports.__esModule = true;
- exports. /*istanbul ignore end*/structuredPatch = structuredPatch;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = createTwoFilesPatch;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = createPatch;
-
- var /*istanbul ignore start*/_line = __webpack_require__(10) /*istanbul ignore end*/;
-
- /*istanbul ignore start*/
- function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
-
- /*istanbul ignore end*/function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
- if (!options) {
- options = { context: 4 };
- }
-
- var diff = /*istanbul ignore start*/(0, _line.diffLines) /*istanbul ignore end*/(oldStr, newStr);
- diff.push({ value: '', lines: [] }); // Append an empty value to make cleanup easier
-
- function contextLines(lines) {
- return lines.map(function (entry) {
- return ' ' + entry;
- });
- }
-
- var hunks = [];
- var oldRangeStart = 0,
- newRangeStart = 0,
- curRange = [],
- oldLine = 1,
- newLine = 1;
- /*istanbul ignore start*/
- var _loop = function _loop( /*istanbul ignore end*/i) {
- var current = diff[i],
- lines = current.lines || current.value.replace(/\n$/, '').split('\n');
- current.lines = lines;
-
- if (current.added || current.removed) {
- /*istanbul ignore start*/
- var _curRange;
-
- /*istanbul ignore end*/
- // If we have previous context, start with that
- if (!oldRangeStart) {
- var prev = diff[i - 1];
- oldRangeStart = oldLine;
- newRangeStart = newLine;
-
- if (prev) {
- curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];
- oldRangeStart -= curRange.length;
- newRangeStart -= curRange.length;
- }
- }
-
- // Output our changes
- /*istanbul ignore start*/(_curRange = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/lines.map(function (entry) {
- return (current.added ? '+' : '-') + entry;
- })));
-
- // Track the updated file position
- if (current.added) {
- newLine += lines.length;
- } else {
- oldLine += lines.length;
- }
- } else {
- // Identical context lines. Track line changes
- if (oldRangeStart) {
- // Close out any changes that have been output (or join overlapping)
- if (lines.length <= options.context * 2 && i < diff.length - 2) {
- /*istanbul ignore start*/
- var _curRange2;
-
- /*istanbul ignore end*/
- // Overlapping
- /*istanbul ignore start*/(_curRange2 = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange2 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/contextLines(lines)));
- } else {
- /*istanbul ignore start*/
- var _curRange3;
-
- /*istanbul ignore end*/
- // end the range and output
- var contextSize = Math.min(lines.length, options.context);
- /*istanbul ignore start*/(_curRange3 = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange3 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/contextLines(lines.slice(0, contextSize))));
-
- var hunk = {
- oldStart: oldRangeStart,
- oldLines: oldLine - oldRangeStart + contextSize,
- newStart: newRangeStart,
- newLines: newLine - newRangeStart + contextSize,
- lines: curRange
- };
- if (i >= diff.length - 2 && lines.length <= options.context) {
- // EOF is inside this hunk
- var oldEOFNewline = /\n$/.test(oldStr);
- var newEOFNewline = /\n$/.test(newStr);
- if (lines.length == 0 && !oldEOFNewline) {
- // special case: old has no eol and no trailing context; no-nl can end up before adds
- curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file');
- } else if (!oldEOFNewline || !newEOFNewline) {
- curRange.push('\\ No newline at end of file');
- }
- }
- hunks.push(hunk);
-
- oldRangeStart = 0;
- newRangeStart = 0;
- curRange = [];
- }
- }
- oldLine += lines.length;
- newLine += lines.length;
- }
- };
-
- for (var i = 0; i < diff.length; i++) {
- /*istanbul ignore start*/
- _loop( /*istanbul ignore end*/i);
- }
-
- return {
- oldFileName: oldFileName, newFileName: newFileName,
- oldHeader: oldHeader, newHeader: newHeader,
- hunks: hunks
- };
- }
-
- function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
- var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);
-
- var ret = [];
- if (oldFileName == newFileName) {
- ret.push('Index: ' + oldFileName);
- }
- ret.push('===================================================================');
- ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader));
- ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader));
-
- for (var i = 0; i < diff.hunks.length; i++) {
- var hunk = diff.hunks[i];
- ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@');
- ret.push.apply(ret, hunk.lines);
- }
-
- return ret.join('\n') + '\n';
- }
-
- function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
- return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);
- }
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9jcmVhdGUuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O2dDQUVnQjt5REE4RkE7eURBd0JBOztBQXhIaEI7Ozs7O3VCQUVPLFNBQVMsZUFBVCxDQUF5QixXQUF6QixFQUFzQyxXQUF0QyxFQUFtRCxNQUFuRCxFQUEyRCxNQUEzRCxFQUFtRSxTQUFuRSxFQUE4RSxTQUE5RSxFQUF5RixPQUF6RixFQUFrRztBQUN2RyxNQUFJLENBQUMsT0FBRCxFQUFVO0FBQ1osY0FBVSxFQUFFLFNBQVMsQ0FBVCxFQUFaLENBRFk7R0FBZDs7QUFJQSxNQUFNLE9BQU8sc0VBQVUsTUFBVixFQUFrQixNQUFsQixDQUFQLENBTGlHO0FBTXZHLE9BQUssSUFBTCxDQUFVLEVBQUMsT0FBTyxFQUFQLEVBQVcsT0FBTyxFQUFQLEVBQXRCOztBQU51RyxXQVE5RixZQUFULENBQXNCLEtBQXR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kID8gJysnIDogJy0nKSArIGVudHJ5O1xuICAgICAgfSkpO1xuXG4gICAgICAvLyBUcmFjayB0aGUgdXBkYXRlZCBmaWxlIHBvc2l0aW9uXG4gICAgICBpZiAoY3VycmVudC5hZGRlZCkge1xuICAgICAgICBuZXdMaW5lICs9IGxpbmVzLmxlbmd0aDtcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIG9sZExpbmUgKz0gbGluZXMubGVuZ3RoO1xuICAgICAgfVxuICAgIH0gZWxzZSB7XG4gICAgICAvLyBJZGVudGljYWwgY29udGV4dCBsaW5lcy4gVHJhY2sgbGluZSBjaGFuZ2VzXG4gICAgICBpZiAob2xkUmFuZ2VTdGFydCkge1xuICAgICAgICAvLyBDbG9zZSBvdXQgYW55IGNoYW5nZXMgdGhhdCBoYXZlIGJlZW4gb3V0cHV0IChvciBqb2luIG92ZXJsYXBwaW5nKVxuICAgICAgICBpZiAobGluZXMubGVuZ3RoIDw9IG9wdGlvbnMuY29udGV4dCAqIDIgJiYgaSA8IGRpZmYubGVuZ3RoIC0gMikge1xuICAgICAgICAgIC8vIE92ZXJsYXBwaW5nXG4gICAgICAgICAgY3VyUmFuZ2UucHVzaCguLi4gY29udGV4dExpbmVzKGxpbmVzKSk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgLy8gZW5kIHRoZSByYW5nZSBhbmQgb3V0cHV0XG4gICAgICAgICAgbGV0IGNvbnRleHRTaXplID0gTWF0aC5taW4obGluZXMubGVuZ3RoLCBvcHRpb25zLmNvbnRleHQpO1xuICAgICAgICAgIGN1clJhbmdlLnB1c2goLi4uIGNvbnRleHRMaW5lcyhsaW5lcy5zbGljZSgwLCBjb250ZXh0U2l6ZSkpKTtcblxuICAgICAgICAgIGxldCBodW5rID0ge1xuICAgICAgICAgICAgb2xkU3RhcnQ6IG9sZFJhbmdlU3RhcnQsXG4gICAgICAgICAgICBvbGRMaW5lczogKG9sZExpbmUgLSBvbGRSYW5nZVN0YXJ0ICsgY29udGV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dXNoKCcrKysgJyArIGRpZmYubmV3RmlsZU5hbWUgKyAodHlwZW9mIGRpZmYubmV3SGVhZGVyID09PSAndW5kZWZpbmVkJyA/ICcnIDogJ1xcdCcgKyBkaWZmLm5ld0hlYWRlcikpO1xuXG4gIGZvciAobGV0IGkgPSAwOyBpIDwgZGlmZi5odW5rcy5sZW5ndGg7IGkrKykge1xuICAgIGNvbnN0IGh1bmsgPSBkaWZmLmh1bmtzW2ldO1xuICAgIHJldC5wdXNoKFxuICAgICAgJ0BAIC0nICsgaHVuay5vbGRTdGFydCArICcsJyArIGh1bmsub2xkTGluZXNcbiAgICAgICsgJyArJyArIGh1bmsubmV3U3RhcnQgKyAnLCcgKyBodW5rLm5ld0xpbmVzXG4gICAgICArICcgQEAnXG4gICAgKTtcbiAgICByZXQucHVzaC5hcHBseShyZXQsIGh1bmsubGluZXMpO1xuICB9XG5cbiAgcmV0dXJuIHJldC5qb2luKCdcXG4nKSArICdcXG4nO1xufVxuXG5leHBvcnQgZnVuY3Rpb24gY3JlYXRlUGF0Y2goZmlsZU5hbWUsIG9sZFN0ciwgbmV3U3RyLCBvbGRIZWFkZXIsIG5ld0hlYWRlciwgb3B0aW9ucykge1xuICByZXR1cm4gY3JlYXRlVHdvRmlsZXNQYXRjaChmaWxlTmFtZSwgZmlsZU5hbWUsIG9sZFN0ciwgbmV3U3RyLCBvbGRIZWFkZXIsIG5ld0hlYWRlciwgb3B0aW9ucyk7XG59XG4iXX0=
-
-
-/***/ },
-/* 18 */
-/***/ function(module, exports) {
-
- /*istanbul ignore start*/"use strict";
-
- exports.__esModule = true;
- exports. /*istanbul ignore end*/convertChangesToDMP = convertChangesToDMP;
- // See: http://code.google.com/p/google-diff-match-patch/wiki/API
- function convertChangesToDMP(changes) {
- var ret = [],
- change = /*istanbul ignore start*/void 0 /*istanbul ignore end*/,
- operation = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
- for (var i = 0; i < changes.length; i++) {
- change = changes[i];
- if (change.added) {
- operation = 1;
- } else if (change.removed) {
- operation = -1;
- } else {
- operation = 0;
- }
-
- ret.push([operation, change.value]);
- }
- return ret;
- }
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb252ZXJ0L2RtcC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Z0NBQ2dCOztBQUFULFNBQVMsbUJBQVQsQ0FBNkIsT0FBN0IsRUFBc0M7QUFDM0MsTUFBSSxNQUFNLEVBQU47TUFDQSxnRUFESjtNQUVJLG1FQUZKLENBRDJDO0FBSTNDLE9BQUssSUFBSSxJQUFJLENBQUosRUFBTyxJQUFJLFFBQVEsTUFBUixFQUFnQixHQUFwQyxFQUF5QztBQUN2QyxhQUFTLFFBQVEsQ0FBUixDQUFULENBRHVDO0FBRXZDLFFBQUksT0FBTyxLQUFQLEVBQWM7QUFDaEIsa0JBQVksQ0FBWixDQURnQjtLQUFsQixNQUVPLElBQUksT0FBTyxPQUFQLEVBQWdCO0FBQ3pCLGtCQUFZLENBQUMsQ0FBRCxDQURhO0tBQXBCLE1BRUE7QUFDTCxrQkFBWSxDQUFaLENBREs7S0FGQTs7QUFNUCxRQUFJLElBQUosQ0FBUyxDQUFDLFNBQUQsRUFBWSxPQUFPLEtBQVAsQ0FBckIsRUFWdUM7R0FBekM7QUFZQSxTQUFPLEdBQVAsQ0FoQjJDO0NBQXRDIiwiZmlsZSI6ImRtcC5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8vIFNlZTogaHR0cDovL2NvZGUuZ29vZ2xlLmNvbS9wL2dvb2dsZS1kaWZmLW1hdGNoLXBhdGNoL3dpa2kvQVBJXG5leHBvcnQgZnVuY3Rpb24gY29udmVydENoYW5nZXNUb0RNUChjaGFuZ2VzKSB7XG4gIGxldCByZXQgPSBbXSxcbiAgICAgIGNoYW5nZSxcbiAgICAgIG9wZXJhdGlvbjtcbiAgZm9yIChsZXQgaSA9IDA7IGkgPCBjaGFuZ2VzLmxlbmd0aDsgaSsrKSB7XG4gICAgY2hhbmdlID0gY2hhbmdlc1tpXTtcbiAgICBpZiAoY2hhbmdlLmFkZGVkKSB7XG4gICAgICBvcGVyYXRpb24gPSAxO1xuICAgIH0gZWxzZSBpZiAoY2hhbmdlLnJlbW92ZWQpIHtcbiAgICAgIG9wZXJhdGlvbiA9IC0xO1xuICAgIH0gZWxzZSB7XG4gICAgICBvcGVyYXRpb24gPSAwO1xuICAgIH1cblxuICAgIHJldC5wdXNoKFtvcGVyYXRpb24sIGNoYW5nZS52YWx1ZV0pO1xuICB9XG4gIHJldHVybiByZXQ7XG59XG4iXX0=
-
-
-/***/ },
-/* 19 */
-/***/ function(module, exports) {
-
- /*istanbul ignore start*/'use strict';
-
- exports.__esModule = true;
- exports. /*istanbul ignore end*/convertChangesToXML = convertChangesToXML;
- function convertChangesToXML(changes) {
- var ret = [];
- for (var i = 0; i < changes.length; i++) {
- var change = changes[i];
- if (change.added) {
- ret.push('');
- } else if (change.removed) {
- ret.push('');
- }
-
- ret.push(escapeHTML(change.value));
-
- if (change.added) {
- ret.push('');
- } else if (change.removed) {
- ret.push('');
- }
- }
- return ret.join('');
- }
-
- function escapeHTML(s) {
- var n = s;
- n = n.replace(/&/g, '&');
- n = n.replace(//g, '>');
- n = n.replace(/"/g, '"');
-
- return n;
- }
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb252ZXJ0L3htbC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Z0NBQWdCO0FBQVQsU0FBUyxtQkFBVCxDQUE2QixPQUE3QixFQUFzQztBQUMzQyxNQUFJLE1BQU0sRUFBTixDQUR1QztBQUUzQyxPQUFLLElBQUksSUFBSSxDQUFKLEVBQU8sSUFBSSxRQUFRLE1BQVIsRUFBZ0IsR0FBcEMsRUFBeUM7QUFDdkMsUUFBSSxTQUFTLFFBQVEsQ0FBUix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IGNoYW5nZXMubGVuZ3RoOyBpKyspIHtcbiAgICBsZXQgY2hhbmdlID0gY2hhbmdlc1tpXTtcbiAgICBpZiAoY2hhbmdlLmFkZGVkKSB7XG4gICAgICByZXQucHVzaCgnPGlucz4nKTtcbiAgICB9IGVsc2UgaWYgKGNoYW5nZS5yZW1vdmVkKSB7XG4gICAgICByZXQucHVzaCgnPGRlbD4nKTtcbiAgICB9XG5cbiAgICByZXQucHVzaChlc2NhcGVIVE1MKGNoYW5nZS52YWx1ZSkpO1xuXG4gICAgaWYgKGNoYW5nZS5hZGRlZCkge1xuICAgICAgcmV0LnB1c2goJzwvaW5zPicpO1xuICAgIH0gZWxzZSBpZiAoY2hhbmdlLnJlbW92ZWQpIHtcbiAgICAgIHJldC5wdXNoKCc8L2RlbD4nKTtcbiAgICB9XG4gIH1cbiAgcmV0dXJuIHJldC5qb2luKCcnKTtcbn1cblxuZnVuY3Rpb24gZXNjYXBlSFRNTChzKSB7XG4gIGxldCBuID0gcztcbiAgbiA9IG4ucmVwbGFjZSgvJi9nLCAnJmFtcDsnKTtcbiAgbiA9IG4ucmVwbGFjZSgvPC9nLCAnJmx0OycpO1xuICBuID0gbi5yZXBsYWNlKC8+L2csICcmZ3Q7Jyk7XG4gIG4gPSBuLnJlcGxhY2UoL1wiL2csICcmcXVvdDsnKTtcblxuICByZXR1cm4gbjtcbn1cbiJdfQ==
-
-
-/***/ },
-/* 20 */
-/***/ function(module, exports) {
-
- /*
- *
- * Rematch (rematch.js)
- * Matching two sequences of objects by similarity
- * Author: W. Illmeyer, Nexxar GmbH
- *
- */
-
- (function() {
-
- var Rematch = {};
- Rematch.arrayToString = function arrayToString(a) {
- if (Object.prototype.toString.apply(a, []) === "[object Array]") {
- return "[" + a.map(arrayToString).join(", ") + "]";
- } else {
- return a;
- }
- };
-
- /*
- Copyright (c) 2011 Andrei Mackenzie
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
- documentation files (the "Software"), to deal in the Software without restriction, including without limitation
- the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
- and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
- THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
- function levenshtein(a, b) {
- if (a.length == 0) {
- return b.length;
- }
- if (b.length == 0) {
- return a.length;
- }
-
- var matrix = [];
-
- // Increment along the first column of each row
- var i;
- for (i = 0; i <= b.length; i++) {
- matrix[i] = [i];
- }
-
- // Increment each column in the first row
- var j;
- for (j = 0; j <= a.length; j++) {
- matrix[0][j] = j;
- }
-
- // Fill in the rest of the matrix
- for (i = 1; i <= b.length; i++) {
- for (j = 1; j <= a.length; j++) {
- if (b.charAt(i - 1) == a.charAt(j - 1)) {
- matrix[i][j] = matrix[i - 1][j - 1];
- } else {
- matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // Substitution
- Math.min(matrix[i][j - 1] + 1, // Insertion
- matrix[i - 1][j] + 1)); // Deletion
- }
- }
- }
-
- return matrix[b.length][a.length];
- }
-
- Rematch.levenshtein = levenshtein;
-
- Rematch.distance = function distance(x, y) {
- x = x.trim();
- y = y.trim();
- var lev = levenshtein(x, y);
- var score = lev / (x.length + y.length);
-
- return score;
- };
-
- Rematch.rematch = function rematch(distanceFunction) {
- function findBestMatch(a, b, cache) {
- var cachecount = 0;
-
- for (var key in cache) {
- cachecount++;
- }
-
- var bestMatchDist = Infinity;
- var bestMatch;
- for (var i = 0; i < a.length; ++i) {
- for (var j = 0; j < b.length; ++j) {
- var cacheKey = JSON.stringify([a[i], b[j]]);
- var md;
- if (cache.hasOwnProperty(cacheKey)) {
- md = cache[cacheKey];
- } else {
- md = distanceFunction(a[i], b[j]);
- cache[cacheKey] = md;
- }
- if (md < bestMatchDist) {
- bestMatchDist = md;
- bestMatch = {indexA: i, indexB: j, score: bestMatchDist};
- }
- }
- }
-
- return bestMatch;
- }
-
- function group(a, b, level, cache) {
- if (typeof (cache) === "undefined") {
- cache = {};
- }
-
- var bm = findBestMatch(a, b, cache);
-
- if (!level) {
- level = 0;
- }
-
- if (!bm || (a.length + b.length < 3)) {
- return [[a, b]];
- }
-
- var a1 = a.slice(0, bm.indexA);
- var b1 = b.slice(0, bm.indexB);
- var aMatch = [a[bm.indexA]];
- var bMatch = [b[bm.indexB]];
- var tailA = bm.indexA + 1;
- var tailB = bm.indexB + 1;
- var a2 = a.slice(tailA);
- var b2 = b.slice(tailB);
-
- var group1 = group(a1, b1, level + 1, cache);
- var groupMatch = group(aMatch, bMatch, level + 1, cache);
- var group2 = group(a2, b2, level + 1, cache);
- var result = groupMatch;
-
- if (bm.indexA > 0 || bm.indexB > 0) {
- result = group1.concat(result);
- }
-
- if (a.length > tailA || b.length > tailB) {
- result = result.concat(group2);
- }
-
- return result;
- }
-
- return group;
- };
-
- module.exports.Rematch = Rematch;
-
- })();
-
-
-/***/ },
-/* 21 */
-/***/ function(module, exports, __webpack_require__) {
-
- /*
- *
- * HtmlPrinter (html-printer.js)
- * Author: rtfpessoa
- *
- */
-
- (function() {
-
- var LineByLinePrinter = __webpack_require__(22).LineByLinePrinter;
- var SideBySidePrinter = __webpack_require__(39).SideBySidePrinter;
-
- function HtmlPrinter() {
- }
-
- HtmlPrinter.prototype.generateLineByLineJsonHtml = function(diffFiles, config) {
- var lineByLinePrinter = new LineByLinePrinter(config);
- return lineByLinePrinter.generateLineByLineJsonHtml(diffFiles);
- };
-
- HtmlPrinter.prototype.generateSideBySideJsonHtml = function(diffFiles, config) {
- var sideBySidePrinter = new SideBySidePrinter(config);
- return sideBySidePrinter.generateSideBySideJsonHtml(diffFiles);
- };
-
- module.exports.HtmlPrinter = new HtmlPrinter();
-
- })();
-
-
-/***/ },
-/* 22 */
-/***/ function(module, exports, __webpack_require__) {
-
- /*
- *
- * LineByLinePrinter (line-by-line-printer.js)
- * Author: rtfpessoa
- *
- */
-
- (function() {
-
- var diffParser = __webpack_require__(1).DiffParser;
- var printerUtils = __webpack_require__(4).PrinterUtils;
- var utils = __webpack_require__(2).Utils;
- var Rematch = __webpack_require__(20).Rematch;
-
- var nunjucksUtils = __webpack_require__(23).NunjucksUtils;
- var baseTemplatesPath = 'line-by-line';
-
- function LineByLinePrinter(config) {
- this.config = config;
- }
-
- LineByLinePrinter.prototype.makeFileDiffHtml = function(file, diffs) {
- return nunjucksUtils.render(baseTemplatesPath, 'file-diff.html', {'file': file, 'diffs': diffs});
- };
-
- LineByLinePrinter.prototype.makeLineByLineHtmlWrapper = function(content) {
- return nunjucksUtils.render(baseTemplatesPath, 'wrapper.html', {'content': content});
- };
-
- LineByLinePrinter.prototype.generateLineByLineJsonHtml = function(diffFiles) {
- var that = this;
- var htmlDiffs = diffFiles.map(function(file) {
- var diffs;
- if (file.blocks.length) {
- diffs = that._generateFileHtml(file);
- } else {
- diffs = that._generateEmptyDiff();
- }
- return that.makeFileDiffHtml(file, diffs);
- });
-
- return this.makeLineByLineHtmlWrapper(htmlDiffs.join('\n'));
- };
-
- var matcher = Rematch.rematch(function(a, b) {
- var amod = a.content.substr(1);
- var bmod = b.content.substr(1);
-
- return Rematch.distance(amod, bmod);
- });
-
- LineByLinePrinter.prototype.makeColumnLineNumberHtml = function(block) {
- return nunjucksUtils.render(baseTemplatesPath, 'column-line-number.html', {block: block});
- };
-
- LineByLinePrinter.prototype._generateFileHtml = function(file) {
- var that = this;
- return file.blocks.map(function(block) {
-
- var lines = that.makeColumnLineNumberHtml(block);
- var oldLines = [];
- var newLines = [];
-
- function processChangeBlock() {
- var matches;
- var insertType;
- var deleteType;
-
- var comparisons = oldLines.length * newLines.length;
- var maxComparisons = that.config.matchingMaxComparisons || 2500;
- var doMatching = comparisons < maxComparisons && (that.config.matching === 'lines' ||
- that.config.matching === 'words');
-
- if (doMatching) {
- matches = matcher(oldLines, newLines);
- insertType = diffParser.LINE_TYPE.INSERT_CHANGES;
- deleteType = diffParser.LINE_TYPE.DELETE_CHANGES;
- } else {
- matches = [[oldLines, newLines]];
- insertType = diffParser.LINE_TYPE.INSERTS;
- deleteType = diffParser.LINE_TYPE.DELETES;
- }
-
- matches.forEach(function(match) {
- oldLines = match[0];
- newLines = match[1];
-
- var processedOldLines = [];
- var processedNewLines = [];
-
- var common = Math.min(oldLines.length, newLines.length);
-
- var oldLine, newLine;
- for (var j = 0; j < common; j++) {
- oldLine = oldLines[j];
- newLine = newLines[j];
-
- that.config.isCombined = file.isCombined;
- var diff = printerUtils.diffHighlight(oldLine.content, newLine.content, that.config);
-
- processedOldLines +=
- that.makeLineHtml(deleteType, oldLine.oldNumber, oldLine.newNumber,
- diff.first.line, diff.first.prefix);
- processedNewLines +=
- that.makeLineHtml(insertType, newLine.oldNumber, newLine.newNumber,
- diff.second.line, diff.second.prefix);
- }
-
- lines += processedOldLines + processedNewLines;
- lines += that._processLines(oldLines.slice(common), newLines.slice(common));
- });
-
- oldLines = [];
- newLines = [];
- }
-
- for (var i = 0; i < block.lines.length; i++) {
- var line = block.lines[i];
- var escapedLine = utils.escape(line.content);
-
- if (line.type !== diffParser.LINE_TYPE.INSERTS &&
- (newLines.length > 0 || (line.type !== diffParser.LINE_TYPE.DELETES && oldLines.length > 0))) {
- processChangeBlock();
- }
-
- if (line.type === diffParser.LINE_TYPE.CONTEXT) {
- lines += that.makeLineHtml(line.type, line.oldNumber, line.newNumber, escapedLine);
- } else if (line.type === diffParser.LINE_TYPE.INSERTS && !oldLines.length) {
- lines += that.makeLineHtml(line.type, line.oldNumber, line.newNumber, escapedLine);
- } else if (line.type === diffParser.LINE_TYPE.DELETES) {
- oldLines.push(line);
- } else if (line.type === diffParser.LINE_TYPE.INSERTS && Boolean(oldLines.length)) {
- newLines.push(line);
- } else {
- console.error('Unknown state in html line-by-line generator');
- processChangeBlock();
- }
- }
-
- processChangeBlock();
-
- return lines;
- }).join('\n');
- };
-
- LineByLinePrinter.prototype._processLines = function(oldLines, newLines) {
- var lines = '';
-
- for (var i = 0; i < oldLines.length; i++) {
- var oldLine = oldLines[i];
- var oldEscapedLine = utils.escape(oldLine.content);
- lines += this.makeLineHtml(oldLine.type, oldLine.oldNumber, oldLine.newNumber, oldEscapedLine);
- }
-
- for (var j = 0; j < newLines.length; j++) {
- var newLine = newLines[j];
- var newEscapedLine = utils.escape(newLine.content);
- lines += this.makeLineHtml(newLine.type, newLine.oldNumber, newLine.newNumber, newEscapedLine);
- }
-
- return lines;
- };
-
- LineByLinePrinter.prototype.makeLineHtml = function(type, oldNumber, newNumber, content, prefix) {
- return nunjucksUtils.render(baseTemplatesPath, 'line.html',
- {
- type: type,
- oldNumber: oldNumber,
- newNumber: newNumber,
- prefix: prefix,
- content: content
- });
- };
-
- LineByLinePrinter.prototype._generateEmptyDiff = function() {
- return nunjucksUtils.render(baseTemplatesPath, 'empty-diff.html', {});
- };
-
- module.exports.LineByLinePrinter = LineByLinePrinter;
-
- })();
-
-
-/***/ },
-/* 23 */
-/***/ function(module, exports, __webpack_require__) {
-
- /* WEBPACK VAR INJECTION */(function(__dirname) {/*
- *
- * Utils (utils.js)
- * Author: rtfpessoa
- *
- */
-
- (function() {
-
- var path = __webpack_require__(24);
-
- var nunjucks = __webpack_require__(26);
- var templatesPath = path.resolve(__dirname, 'templates');
-
- var diffParser = __webpack_require__(1).DiffParser;
- var printerUtils = __webpack_require__(4).PrinterUtils;
- var utils = __webpack_require__(2).Utils;
-
- var nunjucksEnv = nunjucks.configure(templatesPath, {"autoescape": false})
- .addGlobal('printerUtils', printerUtils)
- .addGlobal('utils', utils)
- .addGlobal('diffParser', diffParser);
-
- function NunjucksUtils() {
- }
-
- NunjucksUtils.prototype.render = function(namespace, view, params) {
- var viewPath = path.join(namespace, view);
- return nunjucksEnv.render(viewPath, params);
- };
-
- module.exports.NunjucksUtils = new NunjucksUtils();
-
- })();
-
- /* WEBPACK VAR INJECTION */}.call(exports, "/"))
-
-/***/ },
-/* 24 */
-/***/ function(module, exports, __webpack_require__) {
-
- /* WEBPACK VAR INJECTION */(function(process) {// Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- // resolves . and .. elements in a path array with directory names there
- // must be no slashes, empty elements, or device names (c:\) in the array
- // (so also no leading and trailing slashes - it does not distinguish
- // relative and absolute paths)
- function normalizeArray(parts, allowAboveRoot) {
- // if the path tries to go above the root, `up` ends up > 0
- var up = 0;
- for (var i = parts.length - 1; i >= 0; i--) {
- var last = parts[i];
- if (last === '.') {
- parts.splice(i, 1);
- } else if (last === '..') {
- parts.splice(i, 1);
- up++;
- } else if (up) {
- parts.splice(i, 1);
- up--;
- }
- }
-
- // if the path is allowed to go above the root, restore leading ..s
- if (allowAboveRoot) {
- for (; up--; up) {
- parts.unshift('..');
- }
- }
-
- return parts;
- }
-
- // Split a filename into [root, dir, basename, ext], unix version
- // 'root' is just a slash, or nothing.
- var splitPathRe =
- /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
- var splitPath = function(filename) {
- return splitPathRe.exec(filename).slice(1);
- };
-
- // path.resolve([from ...], to)
- // posix version
- exports.resolve = function() {
- var resolvedPath = '',
- resolvedAbsolute = false;
-
- for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
- var path = (i >= 0) ? arguments[i] : process.cwd();
-
- // Skip empty and invalid entries
- if (typeof path !== 'string') {
- throw new TypeError('Arguments to path.resolve must be strings');
- } else if (!path) {
- continue;
- }
-
- resolvedPath = path + '/' + resolvedPath;
- resolvedAbsolute = path.charAt(0) === '/';
- }
-
- // At this point the path should be resolved to a full absolute path, but
- // handle relative paths to be safe (might happen when process.cwd() fails)
-
- // Normalize the path
- resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
- return !!p;
- }), !resolvedAbsolute).join('/');
-
- return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
- };
-
- // path.normalize(path)
- // posix version
- exports.normalize = function(path) {
- var isAbsolute = exports.isAbsolute(path),
- trailingSlash = substr(path, -1) === '/';
-
- // Normalize the path
- path = normalizeArray(filter(path.split('/'), function(p) {
- return !!p;
- }), !isAbsolute).join('/');
-
- if (!path && !isAbsolute) {
- path = '.';
- }
- if (path && trailingSlash) {
- path += '/';
- }
-
- return (isAbsolute ? '/' : '') + path;
- };
-
- // posix version
- exports.isAbsolute = function(path) {
- return path.charAt(0) === '/';
- };
-
- // posix version
- exports.join = function() {
- var paths = Array.prototype.slice.call(arguments, 0);
- return exports.normalize(filter(paths, function(p, index) {
- if (typeof p !== 'string') {
- throw new TypeError('Arguments to path.join must be strings');
- }
- return p;
- }).join('/'));
- };
-
-
- // path.relative(from, to)
- // posix version
- exports.relative = function(from, to) {
- from = exports.resolve(from).substr(1);
- to = exports.resolve(to).substr(1);
-
- function trim(arr) {
- var start = 0;
- for (; start < arr.length; start++) {
- if (arr[start] !== '') break;
- }
-
- var end = arr.length - 1;
- for (; end >= 0; end--) {
- if (arr[end] !== '') break;
- }
-
- if (start > end) return [];
- return arr.slice(start, end - start + 1);
- }
-
- var fromParts = trim(from.split('/'));
- var toParts = trim(to.split('/'));
-
- var length = Math.min(fromParts.length, toParts.length);
- var samePartsLength = length;
- for (var i = 0; i < length; i++) {
- if (fromParts[i] !== toParts[i]) {
- samePartsLength = i;
- break;
- }
- }
-
- var outputParts = [];
- for (var i = samePartsLength; i < fromParts.length; i++) {
- outputParts.push('..');
- }
-
- outputParts = outputParts.concat(toParts.slice(samePartsLength));
-
- return outputParts.join('/');
- };
-
- exports.sep = '/';
- exports.delimiter = ':';
-
- exports.dirname = function(path) {
- var result = splitPath(path),
- root = result[0],
- dir = result[1];
-
- if (!root && !dir) {
- // No dirname whatsoever
- return '.';
- }
-
- if (dir) {
- // It has a dirname, strip trailing slash
- dir = dir.substr(0, dir.length - 1);
- }
-
- return root + dir;
- };
-
-
- exports.basename = function(path, ext) {
- var f = splitPath(path)[2];
- // TODO: make this comparison case-insensitive on windows?
- if (ext && f.substr(-1 * ext.length) === ext) {
- f = f.substr(0, f.length - ext.length);
- }
- return f;
- };
-
-
- exports.extname = function(path) {
- return splitPath(path)[3];
- };
-
- function filter (xs, f) {
- if (xs.filter) return xs.filter(f);
- var res = [];
- for (var i = 0; i < xs.length; i++) {
- if (f(xs[i], i, xs)) res.push(xs[i]);
- }
- return res;
- }
-
- // String.prototype.substr - negative index don't work in IE8
- var substr = 'ab'.substr(-1) === 'b'
- ? function (str, start, len) { return str.substr(start, len) }
- : function (str, start, len) {
- if (start < 0) start = str.length + start;
- return str.substr(start, len);
- }
- ;
-
- /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(25)))
-
-/***/ },
-/* 25 */
-/***/ function(module, exports) {
-
- // shim for using process in browser
-
- var process = module.exports = {};
- var queue = [];
- var draining = false;
- var currentQueue;
- var queueIndex = -1;
-
- function cleanUpNextTick() {
- draining = false;
- if (currentQueue.length) {
- queue = currentQueue.concat(queue);
- } else {
- queueIndex = -1;
- }
- if (queue.length) {
- drainQueue();
- }
- }
-
- function drainQueue() {
- if (draining) {
- return;
- }
- var timeout = setTimeout(cleanUpNextTick);
- draining = true;
-
- var len = queue.length;
- while(len) {
- currentQueue = queue;
- queue = [];
- while (++queueIndex < len) {
- if (currentQueue) {
- currentQueue[queueIndex].run();
- }
- }
- queueIndex = -1;
- len = queue.length;
- }
- currentQueue = null;
- draining = false;
- clearTimeout(timeout);
- }
-
- process.nextTick = function (fun) {
- var args = new Array(arguments.length - 1);
- if (arguments.length > 1) {
- for (var i = 1; i < arguments.length; i++) {
- args[i - 1] = arguments[i];
- }
- }
- queue.push(new Item(fun, args));
- if (queue.length === 1 && !draining) {
- setTimeout(drainQueue, 0);
- }
- };
-
- // v8 likes predictible objects
- function Item(fun, array) {
- this.fun = fun;
- this.array = array;
- }
- Item.prototype.run = function () {
- this.fun.apply(null, this.array);
- };
- process.title = 'browser';
- process.browser = true;
- process.env = {};
- process.argv = [];
- process.version = ''; // empty string to avoid regexp issues
- process.versions = {};
-
- function noop() {}
-
- process.on = noop;
- process.addListener = noop;
- process.once = noop;
- process.off = noop;
- process.removeListener = noop;
- process.removeAllListeners = noop;
- process.emit = noop;
-
- process.binding = function (name) {
- throw new Error('process.binding is not supported');
- };
-
- process.cwd = function () { return '/' };
- process.chdir = function (dir) {
- throw new Error('process.chdir is not supported');
- };
- process.umask = function() { return 0; };
-
-
-/***/ },
-/* 26 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var lib = __webpack_require__(27);
- var env = __webpack_require__(28);
- var Loader = __webpack_require__(37);
- var loaders = __webpack_require__(32);
- var precompile = __webpack_require__(32);
-
- module.exports = {};
- module.exports.Environment = env.Environment;
- module.exports.Template = env.Template;
-
- module.exports.Loader = Loader;
- module.exports.FileSystemLoader = loaders.FileSystemLoader;
- module.exports.PrecompiledLoader = loaders.PrecompiledLoader;
- module.exports.WebLoader = loaders.WebLoader;
-
- module.exports.compiler = __webpack_require__(32);
- module.exports.parser = __webpack_require__(32);
- module.exports.lexer = __webpack_require__(32);
- module.exports.runtime = __webpack_require__(34);
- module.exports.lib = lib;
- module.exports.nodes = __webpack_require__(32);
-
- module.exports.installJinjaCompat = __webpack_require__(38);
-
- // A single instance of an environment, since this is so commonly used
-
- var e;
- module.exports.configure = function(templatesPath, opts) {
- opts = opts || {};
- if(lib.isObject(templatesPath)) {
- opts = templatesPath;
- templatesPath = null;
- }
-
- var TemplateLoader;
- if(loaders.FileSystemLoader) {
- TemplateLoader = new loaders.FileSystemLoader(templatesPath, {
- watch: opts.watch,
- noCache: opts.noCache
- });
- }
- else if(loaders.WebLoader) {
- TemplateLoader = new loaders.WebLoader(templatesPath, {
- useCache: opts.web && opts.web.useCache,
- async: opts.web && opts.web.async
- });
- }
-
- e = new env.Environment(TemplateLoader, opts);
-
- if(opts && opts.express) {
- e.express(opts.express);
- }
-
- return e;
- };
-
- module.exports.compile = function(src, env, path, eagerCompile) {
- if(!e) {
- module.exports.configure();
- }
- return new module.exports.Template(src, env, path, eagerCompile);
- };
-
- module.exports.render = function(name, ctx, cb) {
- if(!e) {
- module.exports.configure();
- }
-
- return e.render(name, ctx, cb);
- };
-
- module.exports.renderString = function(src, ctx, cb) {
- if(!e) {
- module.exports.configure();
- }
-
- return e.renderString(src, ctx, cb);
- };
-
- if(precompile) {
- module.exports.precompile = precompile.precompile;
- module.exports.precompileString = precompile.precompileString;
- }
-
-
-/***/ },
-/* 27 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- var ArrayProto = Array.prototype;
- var ObjProto = Object.prototype;
-
- var escapeMap = {
- '&': '&',
- '"': '"',
- '\'': ''',
- '<': '<',
- '>': '>'
- };
-
- var escapeRegex = /[&"'<>]/g;
-
- var lookupEscape = function(ch) {
- return escapeMap[ch];
- };
-
- var exports = module.exports = {};
-
- exports.prettifyError = function(path, withInternals, err) {
- // jshint -W022
- // http://jslinterrors.com/do-not-assign-to-the-exception-parameter
- if (!err.Update) {
- // not one of ours, cast it
- err = new exports.TemplateError(err);
- }
- err.Update(path);
-
- // Unless they marked the dev flag, show them a trace from here
- if (!withInternals) {
- var old = err;
- err = new Error(old.message);
- err.name = old.name;
- }
-
- return err;
- };
-
- exports.TemplateError = function(message, lineno, colno) {
- var err = this;
-
- if (message instanceof Error) { // for casting regular js errors
- err = message;
- message = message.name + ': ' + message.message;
-
- try {
- if(err.name = '') {}
- }
- catch(e) {
- // If we can't set the name of the error object in this
- // environment, don't use it
- err = this;
- }
- } else {
- if(Error.captureStackTrace) {
- Error.captureStackTrace(err);
- }
- }
-
- err.name = 'Template render error';
- err.message = message;
- err.lineno = lineno;
- err.colno = colno;
- err.firstUpdate = true;
-
- err.Update = function(path) {
- var message = '(' + (path || 'unknown path') + ')';
-
- // only show lineno + colno next to path of template
- // where error occurred
- if (this.firstUpdate) {
- if(this.lineno && this.colno) {
- message += ' [Line ' + this.lineno + ', Column ' + this.colno + ']';
- }
- else if(this.lineno) {
- message += ' [Line ' + this.lineno + ']';
- }
- }
-
- message += '\n ';
- if (this.firstUpdate) {
- message += ' ';
- }
-
- this.message = message + (this.message || '');
- this.firstUpdate = false;
- return this;
- };
-
- return err;
- };
-
- exports.TemplateError.prototype = Error.prototype;
-
- exports.escape = function(val) {
- return val.replace(escapeRegex, lookupEscape);
- };
-
- exports.isFunction = function(obj) {
- return ObjProto.toString.call(obj) === '[object Function]';
- };
-
- exports.isArray = Array.isArray || function(obj) {
- return ObjProto.toString.call(obj) === '[object Array]';
- };
-
- exports.isString = function(obj) {
- return ObjProto.toString.call(obj) === '[object String]';
- };
-
- exports.isObject = function(obj) {
- return ObjProto.toString.call(obj) === '[object Object]';
- };
-
- exports.groupBy = function(obj, val) {
- var result = {};
- var iterator = exports.isFunction(val) ? val : function(obj) { return obj[val]; };
- for(var i=0; i>> 0; // Hack to convert object.length to a UInt32
-
- fromIndex = +fromIndex || 0;
-
- if(Math.abs(fromIndex) === Infinity) {
- fromIndex = 0;
- }
-
- if(fromIndex < 0) {
- fromIndex += length;
- if (fromIndex < 0) {
- fromIndex = 0;
- }
- }
-
- for(;fromIndex < length; fromIndex++) {
- if (arr[fromIndex] === searchElement) {
- return fromIndex;
- }
- }
-
- return -1;
- };
-
- if(!Array.prototype.map) {
- Array.prototype.map = function() {
- throw new Error('map is unimplemented for this js engine');
- };
- }
-
- exports.keys = function(obj) {
- if(Object.prototype.keys) {
- return obj.keys();
- }
- else {
- var keys = [];
- for(var k in obj) {
- if(obj.hasOwnProperty(k)) {
- keys.push(k);
- }
- }
- return keys;
- }
- };
-
- exports.inOperator = function (key, arrOrObj) {
- if (exports.isArray(arrOrObj)) {
- return exports.indexOf(arrOrObj, key) !== -1;
- } else if (exports.isObject(arrOrObj)) {
- return key in arrOrObj;
- } else {
- throw new Error('Cannot use "in" operator to search for "'
- + key + '" in unexpected types.');
- }
- };
-
-
-/***/ },
-/* 28 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var path = __webpack_require__(24);
- var asap = __webpack_require__(29);
- var lib = __webpack_require__(27);
- var Obj = __webpack_require__(31);
- var compiler = __webpack_require__(32);
- var builtin_filters = __webpack_require__(33);
- var builtin_loaders = __webpack_require__(32);
- var runtime = __webpack_require__(34);
- var globals = __webpack_require__(35);
- var Frame = runtime.Frame;
- var Template;
-
- // Unconditionally load in this loader, even if no other ones are
- // included (possible in the slim browser build)
- builtin_loaders.PrecompiledLoader = __webpack_require__(36);
-
- // If the user is using the async API, *always* call it
- // asynchronously even if the template was synchronous.
- function callbackAsap(cb, err, res) {
- asap(function() { cb(err, res); });
- }
-
- var Environment = Obj.extend({
- init: function(loaders, opts) {
- // The dev flag determines the trace that'll be shown on errors.
- // If set to true, returns the full trace from the error point,
- // otherwise will return trace starting from Template.render
- // (the full trace from within nunjucks may confuse developers using
- // the library)
- // defaults to false
- opts = this.opts = opts || {};
- this.opts.dev = !!opts.dev;
-
- // The autoescape flag sets global autoescaping. If true,
- // every string variable will be escaped by default.
- // If false, strings can be manually escaped using the `escape` filter.
- // defaults to true
- this.opts.autoescape = opts.autoescape != null ? opts.autoescape : true;
-
- // If true, this will make the system throw errors if trying
- // to output a null or undefined value
- this.opts.throwOnUndefined = !!opts.throwOnUndefined;
- this.opts.trimBlocks = !!opts.trimBlocks;
- this.opts.lstripBlocks = !!opts.lstripBlocks;
-
- this.loaders = [];
-
- if(!loaders) {
- // The filesystem loader is only available server-side
- if(builtin_loaders.FileSystemLoader) {
- this.loaders = [new builtin_loaders.FileSystemLoader('views')];
- }
- else if(builtin_loaders.WebLoader) {
- this.loaders = [new builtin_loaders.WebLoader('/views')];
- }
- }
- else {
- this.loaders = lib.isArray(loaders) ? loaders : [loaders];
- }
-
- // It's easy to use precompiled templates: just include them
- // before you configure nunjucks and this will automatically
- // pick it up and use it
- if((true) && window.nunjucksPrecompiled) {
- this.loaders.unshift(
- new builtin_loaders.PrecompiledLoader(window.nunjucksPrecompiled)
- );
- }
-
- this.initCache();
-
- this.globals = globals();
- this.filters = {};
- this.asyncFilters = [];
- this.extensions = {};
- this.extensionsList = [];
-
- for(var name in builtin_filters) {
- this.addFilter(name, builtin_filters[name]);
- }
- },
-
- initCache: function() {
- // Caching and cache busting
- lib.each(this.loaders, function(loader) {
- loader.cache = {};
-
- if(typeof loader.on === 'function') {
- loader.on('update', function(template) {
- loader.cache[template] = null;
- });
- }
- });
- },
-
- addExtension: function(name, extension) {
- extension._name = name;
- this.extensions[name] = extension;
- this.extensionsList.push(extension);
- return this;
- },
-
- removeExtension: function(name) {
- var extension = this.getExtension(name);
- if (!extension) return;
-
- this.extensionsList = lib.without(this.extensionsList, extension);
- delete this.extensions[name];
- },
-
- getExtension: function(name) {
- return this.extensions[name];
- },
-
- hasExtension: function(name) {
- return !!this.extensions[name];
- },
-
- addGlobal: function(name, value) {
- this.globals[name] = value;
- return this;
- },
-
- getGlobal: function(name) {
- if(typeof this.globals[name] === 'undefined') {
- throw new Error('global not found: ' + name);
- }
- return this.globals[name];
- },
-
- addFilter: function(name, func, async) {
- var wrapped = func;
-
- if(async) {
- this.asyncFilters.push(name);
- }
- this.filters[name] = wrapped;
- return this;
- },
-
- getFilter: function(name) {
- if(!this.filters[name]) {
- throw new Error('filter not found: ' + name);
- }
- return this.filters[name];
- },
-
- resolveTemplate: function(loader, parentName, filename) {
- var isRelative = (loader.isRelative && parentName)? loader.isRelative(filename) : false;
- return (isRelative && loader.resolve)? loader.resolve(parentName, filename) : filename;
- },
-
- getTemplate: function(name, eagerCompile, parentName, ignoreMissing, cb) {
- var that = this;
- var tmpl = null;
- if(name && name.raw) {
- // this fixes autoescape for templates referenced in symbols
- name = name.raw;
- }
-
- if(lib.isFunction(parentName)) {
- cb = parentName;
- parentName = null;
- eagerCompile = eagerCompile || false;
- }
-
- if(lib.isFunction(eagerCompile)) {
- cb = eagerCompile;
- eagerCompile = false;
- }
-
- if (name instanceof Template) {
- tmpl = name;
- }
- else if(typeof name !== 'string') {
- throw new Error('template names must be a string: ' + name);
- }
- else {
- for (var i = 0; i < this.loaders.length; i++) {
- var _name = this.resolveTemplate(this.loaders[i], parentName, name);
- tmpl = this.loaders[i].cache[_name];
- if (tmpl) break;
- }
- }
-
- if(tmpl) {
- if(eagerCompile) {
- tmpl.compile();
- }
-
- if(cb) {
- cb(null, tmpl);
- }
- else {
- return tmpl;
- }
- } else {
- var syncResult;
- var _this = this;
-
- var createTemplate = function(err, info) {
- if(!info && !err) {
- if(!ignoreMissing) {
- err = new Error('template not found: ' + name);
- }
- }
-
- if (err) {
- if(cb) {
- cb(err);
- }
- else {
- throw err;
- }
- }
- else {
- var tmpl;
- if(info) {
- tmpl = new Template(info.src, _this,
- info.path, eagerCompile);
-
- if(!info.noCache) {
- info.loader.cache[name] = tmpl;
- }
- }
- else {
- tmpl = new Template('', _this,
- '', eagerCompile);
- }
-
- if(cb) {
- cb(null, tmpl);
- }
- else {
- syncResult = tmpl;
- }
- }
- };
-
- lib.asyncIter(this.loaders, function(loader, i, next, done) {
- function handle(err, src) {
- if(err) {
- done(err);
- }
- else if(src) {
- src.loader = loader;
- done(null, src);
- }
- else {
- next();
- }
- }
-
- // Resolve name relative to parentName
- name = that.resolveTemplate(loader, parentName, name);
-
- if(loader.async) {
- loader.getSource(name, handle);
- }
- else {
- handle(null, loader.getSource(name));
- }
- }, createTemplate);
-
- return syncResult;
- }
- },
-
- express: function(app) {
- var env = this;
-
- function NunjucksView(name, opts) {
- this.name = name;
- this.path = name;
- this.defaultEngine = opts.defaultEngine;
- this.ext = path.extname(name);
- if (!this.ext && !this.defaultEngine) throw new Error('No default engine was specified and no extension was provided.');
- if (!this.ext) this.name += (this.ext = ('.' !== this.defaultEngine[0] ? '.' : '') + this.defaultEngine);
- }
-
- NunjucksView.prototype.render = function(opts, cb) {
- env.render(this.name, opts, cb);
- };
-
- app.set('view', NunjucksView);
- return this;
- },
-
- render: function(name, ctx, cb) {
- if(lib.isFunction(ctx)) {
- cb = ctx;
- ctx = null;
- }
-
- // We support a synchronous API to make it easier to migrate
- // existing code to async. This works because if you don't do
- // anything async work, the whole thing is actually run
- // synchronously.
- var syncResult = null;
-
- this.getTemplate(name, function(err, tmpl) {
- if(err && cb) {
- callbackAsap(cb, err);
- }
- else if(err) {
- throw err;
- }
- else {
- syncResult = tmpl.render(ctx, cb);
- }
- });
-
- return syncResult;
- },
-
- renderString: function(src, ctx, opts, cb) {
- if(lib.isFunction(opts)) {
- cb = opts;
- opts = {};
- }
- opts = opts || {};
-
- var tmpl = new Template(src, this, opts.path);
- return tmpl.render(ctx, cb);
- }
- });
-
- var Context = Obj.extend({
- init: function(ctx, blocks, env) {
- // Has to be tied to an environment so we can tap into its globals.
- this.env = env || new Environment();
-
- // Make a duplicate of ctx
- this.ctx = {};
- for(var k in ctx) {
- if(ctx.hasOwnProperty(k)) {
- this.ctx[k] = ctx[k];
- }
- }
-
- this.blocks = {};
- this.exported = [];
-
- for(var name in blocks) {
- this.addBlock(name, blocks[name]);
- }
- },
-
- lookup: function(name) {
- // This is one of the most called functions, so optimize for
- // the typical case where the name isn't in the globals
- if(name in this.env.globals && !(name in this.ctx)) {
- return this.env.globals[name];
- }
- else {
- return this.ctx[name];
- }
- },
-
- setVariable: function(name, val) {
- this.ctx[name] = val;
- },
-
- getVariables: function() {
- return this.ctx;
- },
-
- addBlock: function(name, block) {
- this.blocks[name] = this.blocks[name] || [];
- this.blocks[name].push(block);
- return this;
- },
-
- getBlock: function(name) {
- if(!this.blocks[name]) {
- throw new Error('unknown block "' + name + '"');
- }
-
- return this.blocks[name][0];
- },
-
- getSuper: function(env, name, block, frame, runtime, cb) {
- var idx = lib.indexOf(this.blocks[name] || [], block);
- var blk = this.blocks[name][idx + 1];
- var context = this;
-
- if(idx === -1 || !blk) {
- throw new Error('no super block available for "' + name + '"');
- }
-
- blk(env, context, frame, runtime, cb);
- },
-
- addExport: function(name) {
- this.exported.push(name);
- },
-
- getExported: function() {
- var exported = {};
- for(var i=0; i capacity) {
- // Manually shift all values starting at the index back to the
- // beginning of the queue.
- for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) {
- queue[scan] = queue[scan + index];
- }
- queue.length -= index;
- index = 0;
- }
- }
- queue.length = 0;
- index = 0;
- flushing = false;
- }
-
- // `requestFlush` is implemented using a strategy based on data collected from
- // every available SauceLabs Selenium web driver worker at time of writing.
- // https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593
-
- // Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that
- // have WebKitMutationObserver but not un-prefixed MutationObserver.
- // Must use `global` instead of `window` to work in both frames and web
- // workers. `global` is a provision of Browserify, Mr, Mrs, or Mop.
- var BrowserMutationObserver = global.MutationObserver || global.WebKitMutationObserver;
-
- // MutationObservers are desirable because they have high priority and work
- // reliably everywhere they are implemented.
- // They are implemented in all modern browsers.
- //
- // - Android 4-4.3
- // - Chrome 26-34
- // - Firefox 14-29
- // - Internet Explorer 11
- // - iPad Safari 6-7.1
- // - iPhone Safari 7-7.1
- // - Safari 6-7
- if (typeof BrowserMutationObserver === "function") {
- requestFlush = makeRequestCallFromMutationObserver(flush);
-
- // MessageChannels are desirable because they give direct access to the HTML
- // task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera
- // 11-12, and in web workers in many engines.
- // Although message channels yield to any queued rendering and IO tasks, they
- // would be better than imposing the 4ms delay of timers.
- // However, they do not work reliably in Internet Explorer or Safari.
-
- // Internet Explorer 10 is the only browser that has setImmediate but does
- // not have MutationObservers.
- // Although setImmediate yields to the browser's renderer, it would be
- // preferrable to falling back to setTimeout since it does not have
- // the minimum 4ms penalty.
- // Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and
- // Desktop to a lesser extent) that renders both setImmediate and
- // MessageChannel useless for the purposes of ASAP.
- // https://github.com/kriskowal/q/issues/396
-
- // Timers are implemented universally.
- // We fall back to timers in workers in most engines, and in foreground
- // contexts in the following browsers.
- // However, note that even this simple case requires nuances to operate in a
- // broad spectrum of browsers.
- //
- // - Firefox 3-13
- // - Internet Explorer 6-9
- // - iPad Safari 4.3
- // - Lynx 2.8.7
- } else {
- requestFlush = makeRequestCallFromTimer(flush);
- }
-
- // `requestFlush` requests that the high priority event queue be flushed as
- // soon as possible.
- // This is useful to prevent an error thrown in a task from stalling the event
- // queue if the exception handled by Node.js’s
- // `process.on("uncaughtException")` or by a domain.
- rawAsap.requestFlush = requestFlush;
-
- // To request a high priority event, we induce a mutation observer by toggling
- // the text of a text node between "1" and "-1".
- function makeRequestCallFromMutationObserver(callback) {
- var toggle = 1;
- var observer = new BrowserMutationObserver(callback);
- var node = document.createTextNode("");
- observer.observe(node, {characterData: true});
- return function requestCall() {
- toggle = -toggle;
- node.data = toggle;
- };
- }
-
- // The message channel technique was discovered by Malte Ubl and was the
- // original foundation for this library.
- // http://www.nonblocking.io/2011/06/windownexttick.html
-
- // Safari 6.0.5 (at least) intermittently fails to create message ports on a
- // page's first load. Thankfully, this version of Safari supports
- // MutationObservers, so we don't need to fall back in that case.
-
- // function makeRequestCallFromMessageChannel(callback) {
- // var channel = new MessageChannel();
- // channel.port1.onmessage = callback;
- // return function requestCall() {
- // channel.port2.postMessage(0);
- // };
- // }
-
- // For reasons explained above, we are also unable to use `setImmediate`
- // under any circumstances.
- // Even if we were, there is another bug in Internet Explorer 10.
- // It is not sufficient to assign `setImmediate` to `requestFlush` because
- // `setImmediate` must be called *by name* and therefore must be wrapped in a
- // closure.
- // Never forget.
-
- // function makeRequestCallFromSetImmediate(callback) {
- // return function requestCall() {
- // setImmediate(callback);
- // };
- // }
-
- // Safari 6.0 has a problem where timers will get lost while the user is
- // scrolling. This problem does not impact ASAP because Safari 6.0 supports
- // mutation observers, so that implementation is used instead.
- // However, if we ever elect to use timers in Safari, the prevalent work-around
- // is to add a scroll event listener that calls for a flush.
-
- // `setTimeout` does not call the passed callback if the delay is less than
- // approximately 7 in web workers in Firefox 8 through 18, and sometimes not
- // even then.
-
- function makeRequestCallFromTimer(callback) {
- return function requestCall() {
- // We dispatch a timeout with a specified delay of 0 for engines that
- // can reliably accommodate that request. This will usually be snapped
- // to a 4 milisecond delay, but once we're flushing, there's no delay
- // between events.
- var timeoutHandle = setTimeout(handleTimer, 0);
- // However, since this timer gets frequently dropped in Firefox
- // workers, we enlist an interval handle that will try to fire
- // an event 20 times per second until it succeeds.
- var intervalHandle = setInterval(handleTimer, 50);
-
- function handleTimer() {
- // Whichever timer succeeds will cancel both timers and
- // execute the callback.
- clearTimeout(timeoutHandle);
- clearInterval(intervalHandle);
- callback();
- }
- };
- }
-
- // This is for `asap.js` only.
- // Its name will be periodically randomized to break any code that depends on
- // its existence.
- rawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer;
-
- // ASAP was originally a nextTick shim included in Q. This was factored out
- // into this ASAP package. It was later adapted to RSVP which made further
- // amendments. These decisions, particularly to marginalize MessageChannel and
- // to capture the MutationObserver implementation in a closure, were integrated
- // back into ASAP proper.
- // https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js
-
- /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
-
-/***/ },
-/* 31 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- // A simple class system, more documentation to come
-
- function extend(cls, name, props) {
- // This does that same thing as Object.create, but with support for IE8
- var F = function() {};
- F.prototype = cls.prototype;
- var prototype = new F();
-
- // jshint undef: false
- var fnTest = /xyz/.test(function(){ xyz; }) ? /\bparent\b/ : /.*/;
- props = props || {};
-
- for(var k in props) {
- var src = props[k];
- var parent = prototype[k];
-
- if(typeof parent === 'function' &&
- typeof src === 'function' &&
- fnTest.test(src)) {
- /*jshint -W083 */
- prototype[k] = (function (src, parent) {
- return function() {
- // Save the current parent method
- var tmp = this.parent;
-
- // Set parent to the previous method, call, and restore
- this.parent = parent;
- var res = src.apply(this, arguments);
- this.parent = tmp;
-
- return res;
- };
- })(src, parent);
- }
- else {
- prototype[k] = src;
- }
- }
-
- prototype.typename = name;
-
- var new_cls = function() {
- if(prototype.init) {
- prototype.init.apply(this, arguments);
- }
- };
-
- new_cls.prototype = prototype;
- new_cls.prototype.constructor = new_cls;
-
- new_cls.extend = function(name, props) {
- if(typeof name === 'object') {
- props = name;
- name = 'anonymous';
- }
- return extend(new_cls, name, props);
- };
-
- return new_cls;
- }
-
- module.exports = extend(Object, 'Object', {});
-
-
-/***/ },
-/* 32 */
-/***/ function(module, exports) {
-
-
-
-/***/ },
-/* 33 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var lib = __webpack_require__(27);
- var r = __webpack_require__(34);
-
- function normalize(value, defaultValue) {
- if(value === null || value === undefined || value === false) {
- return defaultValue;
- }
- return value;
- }
-
- var filters = {
- abs: function(n) {
- return Math.abs(n);
- },
-
- batch: function(arr, linecount, fill_with) {
- var i;
- var res = [];
- var tmp = [];
-
- for(i = 0; i < arr.length; i++) {
- if(i % linecount === 0 && tmp.length) {
- res.push(tmp);
- tmp = [];
- }
-
- tmp.push(arr[i]);
- }
-
- if(tmp.length) {
- if(fill_with) {
- for(i = tmp.length; i < linecount; i++) {
- tmp.push(fill_with);
- }
- }
-
- res.push(tmp);
- }
-
- return res;
- },
-
- capitalize: function(str) {
- str = normalize(str, '');
- var ret = str.toLowerCase();
- return r.copySafeness(str, ret.charAt(0).toUpperCase() + ret.slice(1));
- },
-
- center: function(str, width) {
- str = normalize(str, '');
- width = width || 80;
-
- if(str.length >= width) {
- return str;
- }
-
- var spaces = width - str.length;
- var pre = lib.repeat(' ', spaces/2 - spaces % 2);
- var post = lib.repeat(' ', spaces/2);
- return r.copySafeness(str, pre + str + post);
- },
-
- 'default': function(val, def, bool) {
- if(bool) {
- return val ? val : def;
- }
- else {
- return (val !== undefined) ? val : def;
- }
- },
-
- dictsort: function(val, case_sensitive, by) {
- if (!lib.isObject(val)) {
- throw new lib.TemplateError('dictsort filter: val must be an object');
- }
-
- var array = [];
- for (var k in val) {
- // deliberately include properties from the object's prototype
- array.push([k,val[k]]);
- }
-
- var si;
- if (by === undefined || by === 'key') {
- si = 0;
- } else if (by === 'value') {
- si = 1;
- } else {
- throw new lib.TemplateError(
- 'dictsort filter: You can only sort by either key or value');
- }
-
- array.sort(function(t1, t2) {
- var a = t1[si];
- var b = t2[si];
-
- if (!case_sensitive) {
- if (lib.isString(a)) {
- a = a.toUpperCase();
- }
- if (lib.isString(b)) {
- b = b.toUpperCase();
- }
- }
-
- return a > b ? 1 : (a === b ? 0 : -1);
- });
-
- return array;
- },
-
- dump: function(obj) {
- return JSON.stringify(obj);
- },
-
- escape: function(str) {
- if(typeof str === 'string') {
- return r.markSafe(lib.escape(str));
- }
- return str;
- },
-
- safe: function(str) {
- return r.markSafe(str);
- },
-
- first: function(arr) {
- return arr[0];
- },
-
- groupby: function(arr, attr) {
- return lib.groupBy(arr, attr);
- },
-
- indent: function(str, width, indentfirst) {
- str = normalize(str, '');
-
- if (str === '') return '';
-
- width = width || 4;
- var res = '';
- var lines = str.split('\n');
- var sp = lib.repeat(' ', width);
-
- for(var i=0; i .a.b.c.
- res = new_ + str.split('').join(new_) + new_;
- return r.copySafeness(str, res);
- }
-
- var nextIndex = str.indexOf(old);
- // if # of replacements to perform is 0, or the string to does
- // not contain the old value, return the string
- if(maxCount === 0 || nextIndex === -1){
- return str;
- }
-
- var pos = 0;
- var count = 0; // # of replacements made
-
- while(nextIndex > -1 && (maxCount === -1 || count < maxCount)){
- // Grab the next chunk of src string and add it with the
- // replacement, to the result
- res += str.substring(pos, nextIndex) + new_;
- // Increment our pointer in the src string
- pos = nextIndex + old.length;
- count++;
- // See if there are any more replacements to be made
- nextIndex = str.indexOf(old, pos);
- }
-
- // We've either reached the end, or done the max # of
- // replacements, tack on any remaining string
- if(pos < str.length) {
- res += str.substring(pos);
- }
-
- return r.copySafeness(originalStr, res);
- },
-
- reverse: function(val) {
- var arr;
- if(lib.isString(val)) {
- arr = filters.list(val);
- }
- else {
- // Copy it
- arr = lib.map(val, function(v) { return v; });
- }
-
- arr.reverse();
-
- if(lib.isString(val)) {
- return r.copySafeness(val, arr.join(''));
- }
- return arr;
- },
-
- round: function(val, precision, method) {
- precision = precision || 0;
- var factor = Math.pow(10, precision);
- var rounder;
-
- if(method === 'ceil') {
- rounder = Math.ceil;
- }
- else if(method === 'floor') {
- rounder = Math.floor;
- }
- else {
- rounder = Math.round;
- }
-
- return rounder(val * factor) / factor;
- },
-
- slice: function(arr, slices, fillWith) {
- var sliceLength = Math.floor(arr.length / slices);
- var extra = arr.length % slices;
- var offset = 0;
- var res = [];
-
- for(var i=0; i= extra) {
- slice.push(fillWith);
- }
- res.push(slice);
- }
-
- return res;
- },
-
- sum: function(arr, attr, start) {
- var sum = 0;
-
- if(typeof start === 'number'){
- sum += start;
- }
-
- if(attr) {
- arr = lib.map(arr, function(v) {
- return v[attr];
- });
- }
-
- for(var i = 0; i < arr.length; i++) {
- sum += arr[i];
- }
-
- return sum;
- },
-
- sort: r.makeMacro(['value', 'reverse', 'case_sensitive', 'attribute'], [], function(arr, reverse, caseSens, attr) {
- // Copy it
- arr = lib.map(arr, function(v) { return v; });
-
- arr.sort(function(a, b) {
- var x, y;
-
- if(attr) {
- x = a[attr];
- y = b[attr];
- }
- else {
- x = a;
- y = b;
- }
-
- if(!caseSens && lib.isString(x) && lib.isString(y)) {
- x = x.toLowerCase();
- y = y.toLowerCase();
- }
-
- if(x < y) {
- return reverse ? 1 : -1;
- }
- else if(x > y) {
- return reverse ? -1: 1;
- }
- else {
- return 0;
- }
- });
-
- return arr;
- }),
-
- string: function(obj) {
- return r.copySafeness(obj, obj);
- },
-
- striptags: function(input, preserve_linebreaks) {
- input = normalize(input, '');
- preserve_linebreaks = preserve_linebreaks || false;
- var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>|/gi;
- var trimmedInput = filters.trim(input.replace(tags, ''));
- var res = '';
- if (preserve_linebreaks) {
- res = trimmedInput
- .replace(/^ +| +$/gm, '') // remove leading and trailing spaces
- .replace(/ +/g, ' ') // squash adjacent spaces
- .replace(/(\r\n)/g, '\n') // normalize linebreaks (CRLF -> LF)
- .replace(/\n\n\n+/g, '\n\n'); // squash abnormal adjacent linebreaks
- } else {
- res = trimmedInput.replace(/\s+/gi, ' ');
- }
- return r.copySafeness(input, res);
- },
-
- title: function(str) {
- str = normalize(str, '');
- var words = str.split(' ');
- for(var i = 0; i < words.length; i++) {
- words[i] = filters.capitalize(words[i]);
- }
- return r.copySafeness(str, words.join(' '));
- },
-
- trim: function(str) {
- return r.copySafeness(str, str.replace(/^\s*|\s*$/g, ''));
- },
-
- truncate: function(input, length, killwords, end) {
- var orig = input;
- input = normalize(input, '');
- length = length || 255;
-
- if (input.length <= length)
- return input;
-
- if (killwords) {
- input = input.substring(0, length);
- } else {
- var idx = input.lastIndexOf(' ', length);
- if(idx === -1) {
- idx = length;
- }
-
- input = input.substring(0, idx);
- }
-
- input += (end !== undefined && end !== null) ? end : '...';
- return r.copySafeness(orig, input);
- },
-
- upper: function(str) {
- str = normalize(str, '');
- return str.toUpperCase();
- },
-
- urlencode: function(obj) {
- var enc = encodeURIComponent;
- if (lib.isString(obj)) {
- return enc(obj);
- } else {
- var parts;
- if (lib.isArray(obj)) {
- parts = obj.map(function(item) {
- return enc(item[0]) + '=' + enc(item[1]);
- });
- } else {
- parts = [];
- for (var k in obj) {
- if (obj.hasOwnProperty(k)) {
- parts.push(enc(k) + '=' + enc(obj[k]));
- }
- }
- }
- return parts.join('&');
- }
- },
-
- urlize: function(str, length, nofollow) {
- if (isNaN(length)) length = Infinity;
-
- var noFollowAttr = (nofollow === true ? ' rel="nofollow"' : '');
-
- // For the jinja regexp, see
- // https://github.com/mitsuhiko/jinja2/blob/f15b814dcba6aa12bc74d1f7d0c881d55f7126be/jinja2/utils.py#L20-L23
- var puncRE = /^(?:\(|<|<)?(.*?)(?:\.|,|\)|\n|>)?$/;
- // from http://blog.gerv.net/2011/05/html5_email_address_regexp/
- var emailRE = /^[\w.!#$%&'*+\-\/=?\^`{|}~]+@[a-z\d\-]+(\.[a-z\d\-]+)+$/i;
- var httpHttpsRE = /^https?:\/\/.*$/;
- var wwwRE = /^www\./;
- var tldRE = /\.(?:org|net|com)(?:\:|\/|$)/;
-
- var words = str.split(/(\s+)/).filter(function(word) {
- // If the word has no length, bail. This can happen for str with
- // trailing whitespace.
- return word && word.length;
- }).map(function(word) {
- var matches = word.match(puncRE);
- var possibleUrl = matches && matches[1] || word;
-
- // url that starts with http or https
- if (httpHttpsRE.test(possibleUrl))
- return '' + possibleUrl.substr(0, length) + '';
-
- // url that starts with www.
- if (wwwRE.test(possibleUrl))
- return '' + possibleUrl.substr(0, length) + '';
-
- // an email address of the form username@domain.tld
- if (emailRE.test(possibleUrl))
- return '' + possibleUrl + '';
-
- // url that ends in .com, .org or .net that is not an email address
- if (tldRE.test(possibleUrl))
- return '' + possibleUrl.substr(0, length) + '';
-
- return word;
-
- });
-
- return words.join('');
- },
-
- wordcount: function(str) {
- str = normalize(str, '');
- var words = (str) ? str.match(/\w+/g) : null;
- return (words) ? words.length : null;
- },
-
- 'float': function(val, def) {
- var res = parseFloat(val);
- return isNaN(res) ? def : res;
- },
-
- 'int': function(val, def) {
- var res = parseInt(val, 10);
- return isNaN(res) ? def : res;
- }
- };
-
- // Aliases
- filters.d = filters['default'];
- filters.e = filters.escape;
-
- module.exports = filters;
-
-
-/***/ },
-/* 34 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var lib = __webpack_require__(27);
- var Obj = __webpack_require__(31);
-
- // Frames keep track of scoping both at compile-time and run-time so
- // we know how to access variables. Block tags can introduce special
- // variables, for example.
- var Frame = Obj.extend({
- init: function(parent, isolateWrites) {
- this.variables = {};
- this.parent = parent;
- this.topLevel = false;
- // if this is true, writes (set) should never propagate upwards past
- // this frame to its parent (though reads may).
- this.isolateWrites = isolateWrites;
- },
-
- set: function(name, val, resolveUp) {
- // Allow variables with dots by automatically creating the
- // nested structure
- var parts = name.split('.');
- var obj = this.variables;
- var frame = this;
-
- if(resolveUp) {
- if((frame = this.resolve(parts[0], true))) {
- frame.set(name, val);
- return;
- }
- }
-
- for(var i=0; i argNames.length) {
- args = Array.prototype.slice.call(arguments, 0, argNames.length);
-
- // Positional arguments that should be passed in as
- // keyword arguments (essentially default values)
- var vals = Array.prototype.slice.call(arguments, args.length, argCount);
- for(i = 0; i < vals.length; i++) {
- if(i < kwargNames.length) {
- kwargs[kwargNames[i]] = vals[i];
- }
- }
-
- args.push(kwargs);
- }
- else if(argCount < argNames.length) {
- args = Array.prototype.slice.call(arguments, 0, argCount);
-
- for(i = argCount; i < argNames.length; i++) {
- var arg = argNames[i];
-
- // Keyword arguments that should be passed as
- // positional arguments, i.e. the caller explicitly
- // used the name of a positional arg
- args.push(kwargs[arg]);
- delete kwargs[arg];
- }
-
- args.push(kwargs);
- }
- else {
- args = arguments;
- }
-
- return func.apply(this, args);
- };
- }
-
- function makeKeywordArgs(obj) {
- obj.__keywords = true;
- return obj;
- }
-
- function getKeywordArgs(args) {
- var len = args.length;
- if(len) {
- var lastArg = args[len - 1];
- if(lastArg && lastArg.hasOwnProperty('__keywords')) {
- return lastArg;
- }
- }
- return {};
- }
-
- function numArgs(args) {
- var len = args.length;
- if(len === 0) {
- return 0;
- }
-
- var lastArg = args[len - 1];
- if(lastArg && lastArg.hasOwnProperty('__keywords')) {
- return len - 1;
- }
- else {
- return len;
- }
- }
-
- // A SafeString object indicates that the string should not be
- // autoescaped. This happens magically because autoescaping only
- // occurs on primitive string objects.
- function SafeString(val) {
- if(typeof val !== 'string') {
- return val;
- }
-
- this.val = val;
- this.length = val.length;
- }
-
- SafeString.prototype = Object.create(String.prototype, {
- length: { writable: true, configurable: true, value: 0 }
- });
- SafeString.prototype.valueOf = function() {
- return this.val;
- };
- SafeString.prototype.toString = function() {
- return this.val;
- };
-
- function copySafeness(dest, target) {
- if(dest instanceof SafeString) {
- return new SafeString(target);
- }
- return target.toString();
- }
-
- function markSafe(val) {
- var type = typeof val;
-
- if(type === 'string') {
- return new SafeString(val);
- }
- else if(type !== 'function') {
- return val;
- }
- else {
- return function() {
- var ret = val.apply(this, arguments);
-
- if(typeof ret === 'string') {
- return new SafeString(ret);
- }
-
- return ret;
- };
- }
- }
-
- function suppressValue(val, autoescape) {
- val = (val !== undefined && val !== null) ? val : '';
-
- if(autoescape && typeof val === 'string') {
- val = lib.escape(val);
- }
-
- return val;
- }
-
- function ensureDefined(val, lineno, colno) {
- if(val === null || val === undefined) {
- throw new lib.TemplateError(
- 'attempted to output null or undefined value',
- lineno + 1,
- colno + 1
- );
- }
- return val;
- }
-
- function memberLookup(obj, val) {
- obj = obj || {};
-
- if(typeof obj[val] === 'function') {
- return function() {
- return obj[val].apply(obj, arguments);
- };
- }
-
- return obj[val];
- }
-
- function callWrap(obj, name, context, args) {
- if(!obj) {
- throw new Error('Unable to call `' + name + '`, which is undefined or falsey');
- }
- else if(typeof obj !== 'function') {
- throw new Error('Unable to call `' + name + '`, which is not a function');
- }
-
- // jshint validthis: true
- return obj.apply(context, args);
- }
-
- function contextOrFrameLookup(context, frame, name) {
- var val = frame.lookup(name);
- return (val !== undefined && val !== null) ?
- val :
- context.lookup(name);
- }
-
- function handleError(error, lineno, colno) {
- if(error.lineno) {
- return error;
- }
- else {
- return new lib.TemplateError(error, lineno, colno);
- }
- }
-
- function asyncEach(arr, dimen, iter, cb) {
- if(lib.isArray(arr)) {
- var len = arr.length;
-
- lib.asyncIter(arr, function(item, i, next) {
- switch(dimen) {
- case 1: iter(item, i, len, next); break;
- case 2: iter(item[0], item[1], i, len, next); break;
- case 3: iter(item[0], item[1], item[2], i, len, next); break;
- default:
- item.push(i, next);
- iter.apply(this, item);
- }
- }, cb);
- }
- else {
- lib.asyncFor(arr, function(key, val, i, len, next) {
- iter(key, val, i, len, next);
- }, cb);
- }
- }
-
- function asyncAll(arr, dimen, func, cb) {
- var finished = 0;
- var len, i;
- var outputArr;
-
- function done(i, output) {
- finished++;
- outputArr[i] = output;
-
- if(finished === len) {
- cb(null, outputArr.join(''));
- }
- }
-
- if(lib.isArray(arr)) {
- len = arr.length;
- outputArr = new Array(len);
-
- if(len === 0) {
- cb(null, '');
- }
- else {
- for(i = 0; i < arr.length; i++) {
- var item = arr[i];
-
- switch(dimen) {
- case 1: func(item, i, len, done); break;
- case 2: func(item[0], item[1], i, len, done); break;
- case 3: func(item[0], item[1], item[2], i, len, done); break;
- default:
- item.push(i, done);
- // jshint validthis: true
- func.apply(this, item);
- }
- }
- }
- }
- else {
- var keys = lib.keys(arr);
- len = keys.length;
- outputArr = new Array(len);
-
- if(len === 0) {
- cb(null, '');
- }
- else {
- for(i = 0; i < keys.length; i++) {
- var k = keys[i];
- func(k, arr[k], i, len, done);
- }
- }
- }
- }
-
- module.exports = {
- Frame: Frame,
- makeMacro: makeMacro,
- makeKeywordArgs: makeKeywordArgs,
- numArgs: numArgs,
- suppressValue: suppressValue,
- ensureDefined: ensureDefined,
- memberLookup: memberLookup,
- contextOrFrameLookup: contextOrFrameLookup,
- callWrap: callWrap,
- handleError: handleError,
- isArray: lib.isArray,
- keys: lib.keys,
- SafeString: SafeString,
- copySafeness: copySafeness,
- markSafe: markSafe,
- asyncEach: asyncEach,
- asyncAll: asyncAll,
- inOperator: lib.inOperator
- };
-
-
-/***/ },
-/* 35 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- function cycler(items) {
- var index = -1;
-
- return {
- current: null,
- reset: function() {
- index = -1;
- this.current = null;
- },
-
- next: function() {
- index++;
- if(index >= items.length) {
- index = 0;
- }
-
- this.current = items[index];
- return this.current;
- },
- };
-
- }
-
- function joiner(sep) {
- sep = sep || ',';
- var first = true;
-
- return function() {
- var val = first ? '' : sep;
- first = false;
- return val;
- };
- }
-
- // Making this a function instead so it returns a new object
- // each time it's called. That way, if something like an environment
- // uses it, they will each have their own copy.
- function globals() {
- return {
- range: function(start, stop, step) {
- if(typeof stop === 'undefined') {
- stop = start;
- start = 0;
- step = 1;
- }
- else if(!step) {
- step = 1;
- }
-
- var arr = [];
- var i;
- if (step > 0) {
- for (i=start; istop; i+=step) {
- arr.push(i);
- }
- }
- return arr;
- },
-
- // lipsum: function(n, html, min, max) {
- // },
-
- cycler: function() {
- return cycler(Array.prototype.slice.call(arguments));
- },
-
- joiner: function(sep) {
- return joiner(sep);
- }
- };
- }
-
- module.exports = globals;
-
-
-/***/ },
-/* 36 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var Loader = __webpack_require__(37);
-
- var PrecompiledLoader = Loader.extend({
- init: function(compiledTemplates) {
- this.precompiled = compiledTemplates || {};
- },
-
- getSource: function(name) {
- if (this.precompiled[name]) {
- return {
- src: { type: 'code',
- obj: this.precompiled[name] },
- path: name
- };
- }
- return null;
- }
- });
-
- module.exports = PrecompiledLoader;
-
-
-/***/ },
-/* 37 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var path = __webpack_require__(24);
- var Obj = __webpack_require__(31);
- var lib = __webpack_require__(27);
-
- var Loader = Obj.extend({
- on: function(name, func) {
- this.listeners = this.listeners || {};
- this.listeners[name] = this.listeners[name] || [];
- this.listeners[name].push(func);
- },
-
- emit: function(name /*, arg1, arg2, ...*/) {
- var args = Array.prototype.slice.call(arguments, 1);
-
- if(this.listeners && this.listeners[name]) {
- lib.each(this.listeners[name], function(listener) {
- listener.apply(null, args);
- });
- }
- },
-
- resolve: function(from, to) {
- return path.resolve(path.dirname(from), to);
- },
-
- isRelative: function(filename) {
- return (filename.indexOf('./') === 0 || filename.indexOf('../') === 0);
- }
- });
-
- module.exports = Loader;
-
-
-/***/ },
-/* 38 */
-/***/ function(module, exports) {
-
- function installCompat() {
- 'use strict';
-
- // This must be called like `nunjucks.installCompat` so that `this`
- // references the nunjucks instance
- var runtime = this.runtime; // jshint ignore:line
- var lib = this.lib; // jshint ignore:line
-
- var orig_contextOrFrameLookup = runtime.contextOrFrameLookup;
- runtime.contextOrFrameLookup = function(context, frame, key) {
- var val = orig_contextOrFrameLookup.apply(this, arguments);
- if (val === undefined) {
- switch (key) {
- case 'True':
- return true;
- case 'False':
- return false;
- case 'None':
- return null;
- }
- }
-
- return val;
- };
-
- var orig_memberLookup = runtime.memberLookup;
- var ARRAY_MEMBERS = {
- pop: function(index) {
- if (index === undefined) {
- return this.pop();
- }
- if (index >= this.length || index < 0) {
- throw new Error('KeyError');
- }
- return this.splice(index, 1);
- },
- remove: function(element) {
- for (var i = 0; i < this.length; i++) {
- if (this[i] === element) {
- return this.splice(i, 1);
- }
- }
- throw new Error('ValueError');
- },
- count: function(element) {
- var count = 0;
- for (var i = 0; i < this.length; i++) {
- if (this[i] === element) {
- count++;
- }
- }
- return count;
- },
- index: function(element) {
- var i;
- if ((i = this.indexOf(element)) === -1) {
- throw new Error('ValueError');
- }
- return i;
- },
- find: function(element) {
- return this.indexOf(element);
- },
- insert: function(index, elem) {
- return this.splice(index, 0, elem);
- }
- };
- var OBJECT_MEMBERS = {
- items: function() {
- var ret = [];
- for(var k in this) {
- ret.push([k, this[k]]);
- }
- return ret;
- },
- values: function() {
- var ret = [];
- for(var k in this) {
- ret.push(this[k]);
- }
- return ret;
- },
- keys: function() {
- var ret = [];
- for(var k in this) {
- ret.push(k);
- }
- return ret;
- },
- get: function(key, def) {
- var output = this[key];
- if (output === undefined) {
- output = def;
- }
- return output;
- },
- has_key: function(key) {
- return this.hasOwnProperty(key);
- },
- pop: function(key, def) {
- var output = this[key];
- if (output === undefined && def !== undefined) {
- output = def;
- } else if (output === undefined) {
- throw new Error('KeyError');
- } else {
- delete this[key];
- }
- return output;
- },
- popitem: function() {
- for (var k in this) {
- // Return the first object pair.
- var val = this[k];
- delete this[k];
- return [k, val];
- }
- throw new Error('KeyError');
- },
- setdefault: function(key, def) {
- if (key in this) {
- return this[key];
- }
- if (def === undefined) {
- def = null;
- }
- return this[key] = def;
- },
- update: function(kwargs) {
- for (var k in kwargs) {
- this[k] = kwargs[k];
- }
- return null; // Always returns None
- }
- };
- OBJECT_MEMBERS.iteritems = OBJECT_MEMBERS.items;
- OBJECT_MEMBERS.itervalues = OBJECT_MEMBERS.values;
- OBJECT_MEMBERS.iterkeys = OBJECT_MEMBERS.keys;
- runtime.memberLookup = function(obj, val, autoescape) { // jshint ignore:line
- obj = obj || {};
-
- // If the object is an object, return any of the methods that Python would
- // otherwise provide.
- if (lib.isArray(obj) && ARRAY_MEMBERS.hasOwnProperty(val)) {
- return function() {return ARRAY_MEMBERS[val].apply(obj, arguments);};
- }
-
- if (lib.isObject(obj) && OBJECT_MEMBERS.hasOwnProperty(val)) {
- return function() {return OBJECT_MEMBERS[val].apply(obj, arguments);};
- }
-
- return orig_memberLookup.apply(this, arguments);
- };
- }
-
- module.exports = installCompat;
-
-
-/***/ },
-/* 39 */
-/***/ function(module, exports, __webpack_require__) {
-
- /*
- *
- * HtmlPrinter (html-printer.js)
- * Author: rtfpessoa
- *
- */
-
- (function() {
-
- var diffParser = __webpack_require__(1).DiffParser;
- var printerUtils = __webpack_require__(4).PrinterUtils;
- var utils = __webpack_require__(2).Utils;
- var Rematch = __webpack_require__(20).Rematch;
-
- var matcher = Rematch.rematch(function(a, b) {
- var amod = a.content.substr(1);
- var bmod = b.content.substr(1);
-
- return Rematch.distance(amod, bmod);
- });
-
- function SideBySidePrinter(config) {
- this.config = config;
- }
-
- SideBySidePrinter.prototype.makeDiffHtml = function(file, diffs) {
- return '\n' +
- ' \n' +
- '
\n' +
- '
\n' +
- '
\n' +
- '
\n' +
- ' \n' +
- ' ' + diffs.left +
- ' \n' +
- '
\n' +
- '
\n' +
- '
\n' +
- '
\n' +
- '
\n' +
- '
\n' +
- ' \n' +
- ' ' + diffs.right +
- ' \n' +
- '
\n' +
- '
\n' +
- '
\n' +
- '
\n' +
- '
\n';
- };
-
- SideBySidePrinter.prototype.generateSideBySideJsonHtml = function(diffFiles) {
- var that = this;
- return '\n' +
- diffFiles.map(function(file) {
-
- var diffs;
- if (file.blocks.length) {
- diffs = that.generateSideBySideFileHtml(file);
- } else {
- diffs = that.generateEmptyDiff();
- }
-
- return that.makeDiffHtml(file, diffs);
- }).join('\n') +
- '
\n';
- };
-
- SideBySidePrinter.prototype.makeSideHtml = function(blockHeader) {
- return '\n' +
- ' | \n' +
- ' \n' +
- ' ' + blockHeader + ' \n' +
- ' | \n' +
- '
\n';
- };
-
- SideBySidePrinter.prototype.generateSideBySideFileHtml = function(file) {
- var that = this;
- var fileHtml = {};
- fileHtml.left = '';
- fileHtml.right = '';
-
- file.blocks.forEach(function(block) {
-
- fileHtml.left += that.makeSideHtml(utils.escape(block.header));
- fileHtml.right += that.makeSideHtml('');
-
- var oldLines = [];
- var newLines = [];
-
- function processChangeBlock() {
- var matches;
- var insertType;
- var deleteType;
-
- var comparisons = oldLines.length * newLines.length;
- var maxComparisons = that.config.matchingMaxComparisons || 2500;
- var doMatching = comparisons < maxComparisons && (that.config.matching === 'lines' ||
- that.config.matching === 'words');
-
- if (doMatching) {
- matches = matcher(oldLines, newLines);
- insertType = diffParser.LINE_TYPE.INSERT_CHANGES;
- deleteType = diffParser.LINE_TYPE.DELETE_CHANGES;
- } else {
- matches = [[oldLines, newLines]];
- insertType = diffParser.LINE_TYPE.INSERTS;
- deleteType = diffParser.LINE_TYPE.DELETES;
- }
-
- matches.forEach(function(match) {
- oldLines = match[0];
- newLines = match[1];
-
- var common = Math.min(oldLines.length, newLines.length);
- var max = Math.max(oldLines.length, newLines.length);
-
- for (var j = 0; j < common; j++) {
- var oldLine = oldLines[j];
- var newLine = newLines[j];
-
- that.config.isCombined = file.isCombined;
-
- var diff = printerUtils.diffHighlight(oldLine.content, newLine.content, that.config);
-
- fileHtml.left +=
- that.generateSingleLineHtml(deleteType, oldLine.oldNumber,
- diff.first.line, diff.first.prefix);
- fileHtml.right +=
- that.generateSingleLineHtml(insertType, newLine.newNumber,
- diff.second.line, diff.second.prefix);
- }
-
- if (max > common) {
- var oldSlice = oldLines.slice(common);
- var newSlice = newLines.slice(common);
-
- var tmpHtml = that.processLines(oldSlice, newSlice);
- fileHtml.left += tmpHtml.left;
- fileHtml.right += tmpHtml.right;
- }
- });
-
- oldLines = [];
- newLines = [];
- }
-
- for (var i = 0; i < block.lines.length; i++) {
- var line = block.lines[i];
- var prefix = line.content[0];
- var escapedLine = utils.escape(line.content.substr(1));
-
- if (line.type !== diffParser.LINE_TYPE.INSERTS &&
- (newLines.length > 0 || (line.type !== diffParser.LINE_TYPE.DELETES && oldLines.length > 0))) {
- processChangeBlock();
- }
-
- if (line.type === diffParser.LINE_TYPE.CONTEXT) {
- fileHtml.left += that.generateSingleLineHtml(line.type, line.oldNumber, escapedLine, prefix);
- fileHtml.right += that.generateSingleLineHtml(line.type, line.newNumber, escapedLine, prefix);
- } else if (line.type === diffParser.LINE_TYPE.INSERTS && !oldLines.length) {
- fileHtml.left += that.generateSingleLineHtml(diffParser.LINE_TYPE.CONTEXT, '', '', '');
- fileHtml.right += that.generateSingleLineHtml(line.type, line.newNumber, escapedLine, prefix);
- } else if (line.type === diffParser.LINE_TYPE.DELETES) {
- oldLines.push(line);
- } else if (line.type === diffParser.LINE_TYPE.INSERTS && Boolean(oldLines.length)) {
- newLines.push(line);
- } else {
- console.error('unknown state in html side-by-side generator');
- processChangeBlock();
- }
- }
-
- processChangeBlock();
- });
-
- return fileHtml;
- };
-
- SideBySidePrinter.prototype.processLines = function(oldLines, newLines) {
- var that = this;
- var fileHtml = {};
- fileHtml.left = '';
- fileHtml.right = '';
-
- var maxLinesNumber = Math.max(oldLines.length, newLines.length);
- for (var i = 0; i < maxLinesNumber; i++) {
- var oldLine = oldLines[i];
- var newLine = newLines[i];
- var oldContent;
- var newContent;
- var oldPrefix;
- var newPrefix;
-
- if (oldLine) {
- oldContent = utils.escape(oldLine.content.substr(1));
- oldPrefix = oldLine.content[0];
- }
-
- if (newLine) {
- newContent = utils.escape(newLine.content.substr(1));
- newPrefix = newLine.content[0];
- }
-
- if (oldLine && newLine) {
- fileHtml.left += that.generateSingleLineHtml(oldLine.type, oldLine.oldNumber, oldContent, oldPrefix);
- fileHtml.right += that.generateSingleLineHtml(newLine.type, newLine.newNumber, newContent, newPrefix);
- } else if (oldLine) {
- fileHtml.left += that.generateSingleLineHtml(oldLine.type, oldLine.oldNumber, oldContent, oldPrefix);
- fileHtml.right += that.generateSingleLineHtml(diffParser.LINE_TYPE.CONTEXT, '', '', '');
- } else if (newLine) {
- fileHtml.left += that.generateSingleLineHtml(diffParser.LINE_TYPE.CONTEXT, '', '', '');
- fileHtml.right += that.generateSingleLineHtml(newLine.type, newLine.newNumber, newContent, newPrefix);
- } else {
- console.error('How did it get here?');
- }
- }
-
- return fileHtml;
- };
-
- SideBySidePrinter.prototype.makeSingleLineHtml = function(type, number, htmlContent, htmlPrefix) {
- return '\n' +
- ' | ' + number + ' | \n' +
- ' ' +
- ' ' + htmlPrefix + htmlContent + ' ' +
- ' | \n' +
- '
\n';
- };
-
- SideBySidePrinter.prototype.generateSingleLineHtml = function(type, number, content, prefix) {
- var htmlPrefix = '';
- if (prefix) {
- htmlPrefix = '' + prefix + '';
- }
-
- var htmlContent = '';
- if (content) {
- htmlContent = '' + content + '';
- }
-
- return this.makeSingleLineHtml(type, number, htmlContent, htmlPrefix);
- };
-
- SideBySidePrinter.prototype.generateEmptyDiff = function() {
- var fileHtml = {};
- fileHtml.right = '';
-
- fileHtml.left = '\n' +
- ' | ' +
- ' ' +
- 'File without changes' +
- ' ' +
- ' | \n' +
- '
\n';
-
- return fileHtml;
- };
-
- module.exports.SideBySidePrinter = SideBySidePrinter;
-
- })();
-
-
-/***/ }
-/******/ ]);
\ No newline at end of file
+exports.__esModule = true;
+exports.canonicalize = exports.convertChangesToXML = exports.convertChangesToDMP = exports.parsePatch = exports.applyPatches = exports.applyPatch = exports.createPatch = exports.createTwoFilesPatch = exports.structuredPatch = exports.diffJson = exports.diffCss = exports.diffSentences = exports.diffTrimmedLines = exports.diffLines = exports.diffWordsWithSpace = exports.diffWords = exports.diffChars = exports.Diff = undefined;
+/*istanbul ignore end*/
+var /*istanbul ignore start*/_base = require('./diff/base') /*istanbul ignore end*/;
+
+/*istanbul ignore start*/
+var _base2 = _interopRequireDefault(_base);
+
+/*istanbul ignore end*/
+var /*istanbul ignore start*/_character = require('./diff/character') /*istanbul ignore end*/;
+
+var /*istanbul ignore start*/_word = require('./diff/word') /*istanbul ignore end*/;
+
+var /*istanbul ignore start*/_line = require('./diff/line') /*istanbul ignore end*/;
+
+var /*istanbul ignore start*/_sentence = require('./diff/sentence') /*istanbul ignore end*/;
+
+var /*istanbul ignore start*/_css = require('./diff/css') /*istanbul ignore end*/;
+
+var /*istanbul ignore start*/_json = require('./diff/json') /*istanbul ignore end*/;
+
+var /*istanbul ignore start*/_apply = require('./patch/apply') /*istanbul ignore end*/;
+
+var /*istanbul ignore start*/_parse = require('./patch/parse') /*istanbul ignore end*/;
+
+var /*istanbul ignore start*/_create = require('./patch/create') /*istanbul ignore end*/;
+
+var /*istanbul ignore start*/_dmp = require('./convert/dmp') /*istanbul ignore end*/;
+
+var /*istanbul ignore start*/_xml = require('./convert/xml') /*istanbul ignore end*/;
+
+/*istanbul ignore start*/
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+/* See LICENSE file for terms of use */
+
+/*
+ * Text diff implementation.
+ *
+ * This library supports the following APIS:
+ * JsDiff.diffChars: Character by character diff
+ * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace
+ * JsDiff.diffLines: Line based diff
+ *
+ * JsDiff.diffCss: Diff targeted at CSS content
+ *
+ * These methods are based on the implementation proposed in
+ * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986).
+ * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927
+ */
+exports. /*istanbul ignore end*/Diff = _base2.default;
+/*istanbul ignore start*/exports. /*istanbul ignore end*/diffChars = _character.diffChars;
+/*istanbul ignore start*/exports. /*istanbul ignore end*/diffWords = _word.diffWords;
+/*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = _word.diffWordsWithSpace;
+/*istanbul ignore start*/exports. /*istanbul ignore end*/diffLines = _line.diffLines;
+/*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = _line.diffTrimmedLines;
+/*istanbul ignore start*/exports. /*istanbul ignore end*/diffSentences = _sentence.diffSentences;
+/*istanbul ignore start*/exports. /*istanbul ignore end*/diffCss = _css.diffCss;
+/*istanbul ignore start*/exports. /*istanbul ignore end*/diffJson = _json.diffJson;
+/*istanbul ignore start*/exports. /*istanbul ignore end*/structuredPatch = _create.structuredPatch;
+/*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = _create.createTwoFilesPatch;
+/*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = _create.createPatch;
+/*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatch = _apply.applyPatch;
+/*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = _apply.applyPatches;
+/*istanbul ignore start*/exports. /*istanbul ignore end*/parsePatch = _parse.parsePatch;
+/*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToDMP = _dmp.convertChangesToDMP;
+/*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToXML = _xml.convertChangesToXML;
+/*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = _json.canonicalize;
+
+
+},{"./convert/dmp":2,"./convert/xml":3,"./diff/base":4,"./diff/character":5,"./diff/css":6,"./diff/json":7,"./diff/line":8,"./diff/sentence":9,"./diff/word":10,"./patch/apply":12,"./patch/create":13,"./patch/parse":14}],12:[function(require,module,exports){
+/*istanbul ignore start*/'use strict';
+
+exports.__esModule = true;
+exports. /*istanbul ignore end*/applyPatch = applyPatch;
+/*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = applyPatches;
+
+var /*istanbul ignore start*/_parse = require('./parse') /*istanbul ignore end*/;
+
+var /*istanbul ignore start*/_distanceIterator = require('../util/distance-iterator') /*istanbul ignore end*/;
+
+/*istanbul ignore start*/
+var _distanceIterator2 = _interopRequireDefault(_distanceIterator);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+/*istanbul ignore end*/function applyPatch(source, uniDiff) {
+ /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
+
+ if (typeof uniDiff === 'string') {
+ uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);
+ }
+
+ if (Array.isArray(uniDiff)) {
+ if (uniDiff.length > 1) {
+ throw new Error('applyPatch only works with a single input.');
+ }
+
+ uniDiff = uniDiff[0];
+ }
+
+ // Apply the diff to the input
+ var lines = source.split('\n'),
+ hunks = uniDiff.hunks,
+ compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) /*istanbul ignore start*/{
+ return (/*istanbul ignore end*/line === patchContent
+ );
+ },
+ errorCount = 0,
+ fuzzFactor = options.fuzzFactor || 0,
+ minLine = 0,
+ offset = 0,
+ removeEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/,
+ addEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
+
+ /**
+ * Checks if the hunk exactly fits on the provided location
+ */
+ function hunkFits(hunk, toPos) {
+ for (var j = 0; j < hunk.lines.length; j++) {
+ var line = hunk.lines[j],
+ operation = line[0],
+ content = line.substr(1);
+
+ if (operation === ' ' || operation === '-') {
+ // Context sanity check
+ if (!compareLine(toPos + 1, lines[toPos], operation, content)) {
+ errorCount++;
+
+ if (errorCount > fuzzFactor) {
+ return false;
+ }
+ }
+ toPos++;
+ }
+ }
+
+ return true;
+ }
+
+ // Search best fit offsets for each hunk based on the previous ones
+ for (var i = 0; i < hunks.length; i++) {
+ var hunk = hunks[i],
+ maxLine = lines.length - hunk.oldLines,
+ localOffset = 0,
+ toPos = offset + hunk.oldStart - 1;
+
+ var iterator = /*istanbul ignore start*/(0, _distanceIterator2.default) /*istanbul ignore end*/(toPos, minLine, maxLine);
+
+ for (; localOffset !== undefined; localOffset = iterator()) {
+ if (hunkFits(hunk, toPos + localOffset)) {
+ hunk.offset = offset += localOffset;
+ break;
+ }
+ }
+
+ if (localOffset === undefined) {
+ return false;
+ }
+
+ // Set lower text limit to end of the current hunk, so next ones don't try
+ // to fit over already patched text
+ minLine = hunk.offset + hunk.oldStart + hunk.oldLines;
+ }
+
+ // Apply patch hunks
+ for (var _i = 0; _i < hunks.length; _i++) {
+ var _hunk = hunks[_i],
+ _toPos = _hunk.offset + _hunk.newStart - 1;
+
+ for (var j = 0; j < _hunk.lines.length; j++) {
+ var line = _hunk.lines[j],
+ operation = line[0],
+ content = line.substr(1);
+
+ if (operation === ' ') {
+ _toPos++;
+ } else if (operation === '-') {
+ lines.splice(_toPos, 1);
+ /* istanbul ignore else */
+ } else if (operation === '+') {
+ lines.splice(_toPos, 0, content);
+ _toPos++;
+ } else if (operation === '\\') {
+ var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null;
+ if (previousOperation === '+') {
+ removeEOFNL = true;
+ } else if (previousOperation === '-') {
+ addEOFNL = true;
+ }
+ }
+ }
+ }
+
+ // Handle EOFNL insertion/removal
+ if (removeEOFNL) {
+ while (!lines[lines.length - 1]) {
+ lines.pop();
+ }
+ } else if (addEOFNL) {
+ lines.push('');
+ }
+ return lines.join('\n');
+}
+
+// Wrapper that supports multiple file patches via callbacks.
+function applyPatches(uniDiff, options) {
+ if (typeof uniDiff === 'string') {
+ uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);
+ }
+
+ var currentIndex = 0;
+ function processIndex() {
+ var index = uniDiff[currentIndex++];
+ if (!index) {
+ return options.complete();
+ }
+
+ options.loadFile(index, function (err, data) {
+ if (err) {
+ return options.complete(err);
+ }
+
+ var updatedContent = applyPatch(data, index, options);
+ options.patched(index, updatedContent);
+
+ setTimeout(processIndex, 0);
+ });
+ }
+ processIndex();
+}
+
+
+},{"../util/distance-iterator":15,"./parse":14}],13:[function(require,module,exports){
+/*istanbul ignore start*/'use strict';
+
+exports.__esModule = true;
+exports. /*istanbul ignore end*/structuredPatch = structuredPatch;
+/*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = createTwoFilesPatch;
+/*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = createPatch;
+
+var /*istanbul ignore start*/_line = require('../diff/line') /*istanbul ignore end*/;
+
+/*istanbul ignore start*/
+function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
+
+/*istanbul ignore end*/function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
+ if (!options) {
+ options = { context: 4 };
+ }
+
+ var diff = /*istanbul ignore start*/(0, _line.diffLines) /*istanbul ignore end*/(oldStr, newStr);
+ diff.push({ value: '', lines: [] }); // Append an empty value to make cleanup easier
+
+ function contextLines(lines) {
+ return lines.map(function (entry) {
+ return ' ' + entry;
+ });
+ }
+
+ var hunks = [];
+ var oldRangeStart = 0,
+ newRangeStart = 0,
+ curRange = [],
+ oldLine = 1,
+ newLine = 1;
+ /*istanbul ignore start*/
+ var _loop = function _loop( /*istanbul ignore end*/i) {
+ var current = diff[i],
+ lines = current.lines || current.value.replace(/\n$/, '').split('\n');
+ current.lines = lines;
+
+ if (current.added || current.removed) {
+ /*istanbul ignore start*/
+ var _curRange;
+
+ /*istanbul ignore end*/
+ // If we have previous context, start with that
+ if (!oldRangeStart) {
+ var prev = diff[i - 1];
+ oldRangeStart = oldLine;
+ newRangeStart = newLine;
+
+ if (prev) {
+ curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];
+ oldRangeStart -= curRange.length;
+ newRangeStart -= curRange.length;
+ }
+ }
+
+ // Output our changes
+ /*istanbul ignore start*/(_curRange = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/lines.map(function (entry) {
+ return (current.added ? '+' : '-') + entry;
+ })));
+
+ // Track the updated file position
+ if (current.added) {
+ newLine += lines.length;
+ } else {
+ oldLine += lines.length;
+ }
+ } else {
+ // Identical context lines. Track line changes
+ if (oldRangeStart) {
+ // Close out any changes that have been output (or join overlapping)
+ if (lines.length <= options.context * 2 && i < diff.length - 2) {
+ /*istanbul ignore start*/
+ var _curRange2;
+
+ /*istanbul ignore end*/
+ // Overlapping
+ /*istanbul ignore start*/(_curRange2 = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange2 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/contextLines(lines)));
+ } else {
+ /*istanbul ignore start*/
+ var _curRange3;
+
+ /*istanbul ignore end*/
+ // end the range and output
+ var contextSize = Math.min(lines.length, options.context);
+ /*istanbul ignore start*/(_curRange3 = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange3 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/contextLines(lines.slice(0, contextSize))));
+
+ var hunk = {
+ oldStart: oldRangeStart,
+ oldLines: oldLine - oldRangeStart + contextSize,
+ newStart: newRangeStart,
+ newLines: newLine - newRangeStart + contextSize,
+ lines: curRange
+ };
+ if (i >= diff.length - 2 && lines.length <= options.context) {
+ // EOF is inside this hunk
+ var oldEOFNewline = /\n$/.test(oldStr);
+ var newEOFNewline = /\n$/.test(newStr);
+ if (lines.length == 0 && !oldEOFNewline) {
+ // special case: old has no eol and no trailing context; no-nl can end up before adds
+ curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file');
+ } else if (!oldEOFNewline || !newEOFNewline) {
+ curRange.push('\\ No newline at end of file');
+ }
+ }
+ hunks.push(hunk);
+
+ oldRangeStart = 0;
+ newRangeStart = 0;
+ curRange = [];
+ }
+ }
+ oldLine += lines.length;
+ newLine += lines.length;
+ }
+ };
+
+ for (var i = 0; i < diff.length; i++) {
+ /*istanbul ignore start*/
+ _loop( /*istanbul ignore end*/i);
+ }
+
+ return {
+ oldFileName: oldFileName, newFileName: newFileName,
+ oldHeader: oldHeader, newHeader: newHeader,
+ hunks: hunks
+ };
+}
+
+function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
+ var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);
+
+ var ret = [];
+ if (oldFileName == newFileName) {
+ ret.push('Index: ' + oldFileName);
+ }
+ ret.push('===================================================================');
+ ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader));
+ ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader));
+
+ for (var i = 0; i < diff.hunks.length; i++) {
+ var hunk = diff.hunks[i];
+ ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@');
+ ret.push.apply(ret, hunk.lines);
+ }
+
+ return ret.join('\n') + '\n';
+}
+
+function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
+ return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);
+}
+
+
+},{"../diff/line":8}],14:[function(require,module,exports){
+/*istanbul ignore start*/'use strict';
+
+exports.__esModule = true;
+exports. /*istanbul ignore end*/parsePatch = parsePatch;
+function parsePatch(uniDiff) {
+ /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
+
+ var diffstr = uniDiff.split('\n'),
+ list = [],
+ i = 0;
+
+ function parseIndex() {
+ var index = {};
+ list.push(index);
+
+ // Parse diff metadata
+ while (i < diffstr.length) {
+ var line = diffstr[i];
+
+ // File header found, end parsing diff metadata
+ if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) {
+ break;
+ }
+
+ // Diff index
+ var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line);
+ if (header) {
+ index.index = header[1];
+ }
+
+ i++;
+ }
+
+ // Parse file headers if they are defined. Unified diff requires them, but
+ // there's no technical issues to have an isolated hunk without file header
+ parseFileHeader(index);
+ parseFileHeader(index);
+
+ // Parse hunks
+ index.hunks = [];
+
+ while (i < diffstr.length) {
+ var _line = diffstr[i];
+
+ if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) {
+ break;
+ } else if (/^@@/.test(_line)) {
+ index.hunks.push(parseHunk());
+ } else if (_line && options.strict) {
+ // Ignore unexpected content unless in strict mode
+ throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line));
+ } else {
+ i++;
+ }
+ }
+ }
+
+ // Parses the --- and +++ headers, if none are found, no lines
+ // are consumed.
+ function parseFileHeader(index) {
+ var fileHeader = /^(\-\-\-|\+\+\+)\s+(\S*)\s?(.*?)\s*$/.exec(diffstr[i]);
+ if (fileHeader) {
+ var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new';
+ index[keyPrefix + 'FileName'] = fileHeader[2];
+ index[keyPrefix + 'Header'] = fileHeader[3];
+
+ i++;
+ }
+ }
+
+ // Parses a hunk
+ // This assumes that we are at the start of a hunk.
+ function parseHunk() {
+ var chunkHeaderIndex = i,
+ chunkHeaderLine = diffstr[i++],
+ chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
+
+ var hunk = {
+ oldStart: +chunkHeader[1],
+ oldLines: +chunkHeader[2] || 1,
+ newStart: +chunkHeader[3],
+ newLines: +chunkHeader[4] || 1,
+ lines: []
+ };
+
+ var addCount = 0,
+ removeCount = 0;
+ for (; i < diffstr.length; i++) {
+ var operation = diffstr[i][0];
+
+ if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') {
+ hunk.lines.push(diffstr[i]);
+
+ if (operation === '+') {
+ addCount++;
+ } else if (operation === '-') {
+ removeCount++;
+ } else if (operation === ' ') {
+ addCount++;
+ removeCount++;
+ }
+ } else {
+ break;
+ }
+ }
+
+ // Handle the empty block count case
+ if (!addCount && hunk.newLines === 1) {
+ hunk.newLines = 0;
+ }
+ if (!removeCount && hunk.oldLines === 1) {
+ hunk.oldLines = 0;
+ }
+
+ // Perform optional sanity checking
+ if (options.strict) {
+ if (addCount !== hunk.newLines) {
+ throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
+ }
+ if (removeCount !== hunk.oldLines) {
+ throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
+ }
+ }
+
+ return hunk;
+ }
+
+ while (i < diffstr.length) {
+ parseIndex();
+ }
+
+ return list;
+}
+
+
+},{}],15:[function(require,module,exports){
+/*istanbul ignore start*/"use strict";
+
+exports.__esModule = true;
+
+exports.default = /*istanbul ignore end*/function (start, minLine, maxLine) {
+ var wantForward = true,
+ backwardExhausted = false,
+ forwardExhausted = false,
+ localOffset = 1;
+
+ return function iterator() {
+ if (wantForward && !forwardExhausted) {
+ if (backwardExhausted) {
+ localOffset++;
+ } else {
+ wantForward = false;
+ }
+
+ // Check if trying to fit beyond text length, and if not, check it fits
+ // after offset location (or desired location on first iteration)
+ if (start + localOffset <= maxLine) {
+ return localOffset;
+ }
+
+ forwardExhausted = true;
+ }
+
+ if (!backwardExhausted) {
+ if (!forwardExhausted) {
+ wantForward = true;
+ }
+
+ // Check if trying to fit before text beginning, and if not, check it fits
+ // before offset location
+ if (minLine <= start - localOffset) {
+ return - localOffset++;
+ }
+
+ backwardExhausted = true;
+ return iterator();
+ }
+
+ // We tried to fit hunk before text beginning and beyond text lenght, then
+ // hunk can't fit on the text. Return undefined
+ };
+};
+
+
+},{}],16:[function(require,module,exports){
+/*istanbul ignore start*/'use strict';
+
+exports.__esModule = true;
+exports. /*istanbul ignore end*/generateOptions = generateOptions;
+function generateOptions(options, defaults) {
+ if (typeof options === 'function') {
+ defaults.callback = options;
+ } else if (options) {
+ for (var name in options) {
+ /* istanbul ignore else */
+ if (options.hasOwnProperty(name)) {
+ defaults[name] = options[name];
+ }
+ }
+ }
+ return defaults;
+}
+
+
+},{}],17:[function(require,module,exports){
+/*
+ * Copyright 2011 Twitter, Inc.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+(function (Hogan) {
+ // Setup regex assignments
+ // remove whitespace according to Mustache spec
+ var rIsWhitespace = /\S/,
+ rQuot = /\"/g,
+ rNewline = /\n/g,
+ rCr = /\r/g,
+ rSlash = /\\/g,
+ rLineSep = /\u2028/,
+ rParagraphSep = /\u2029/;
+
+ Hogan.tags = {
+ '#': 1, '^': 2, '<': 3, '$': 4,
+ '/': 5, '!': 6, '>': 7, '=': 8, '_v': 9,
+ '{': 10, '&': 11, '_t': 12
+ };
+
+ Hogan.scan = function scan(text, delimiters) {
+ var len = text.length,
+ IN_TEXT = 0,
+ IN_TAG_TYPE = 1,
+ IN_TAG = 2,
+ state = IN_TEXT,
+ tagType = null,
+ tag = null,
+ buf = '',
+ tokens = [],
+ seenTag = false,
+ i = 0,
+ lineStart = 0,
+ otag = '{{',
+ ctag = '}}';
+
+ function addBuf() {
+ if (buf.length > 0) {
+ tokens.push({tag: '_t', text: new String(buf)});
+ buf = '';
+ }
+ }
+
+ function lineIsWhitespace() {
+ var isAllWhitespace = true;
+ for (var j = lineStart; j < tokens.length; j++) {
+ isAllWhitespace =
+ (Hogan.tags[tokens[j].tag] < Hogan.tags['_v']) ||
+ (tokens[j].tag == '_t' && tokens[j].text.match(rIsWhitespace) === null);
+ if (!isAllWhitespace) {
+ return false;
+ }
+ }
+
+ return isAllWhitespace;
+ }
+
+ function filterLine(haveSeenTag, noNewLine) {
+ addBuf();
+
+ if (haveSeenTag && lineIsWhitespace()) {
+ for (var j = lineStart, next; j < tokens.length; j++) {
+ if (tokens[j].text) {
+ if ((next = tokens[j+1]) && next.tag == '>') {
+ // set indent to token value
+ next.indent = tokens[j].text.toString()
+ }
+ tokens.splice(j, 1);
+ }
+ }
+ } else if (!noNewLine) {
+ tokens.push({tag:'\n'});
+ }
+
+ seenTag = false;
+ lineStart = tokens.length;
+ }
+
+ function changeDelimiters(text, index) {
+ var close = '=' + ctag,
+ closeIndex = text.indexOf(close, index),
+ delimiters = trim(
+ text.substring(text.indexOf('=', index) + 1, closeIndex)
+ ).split(' ');
+
+ otag = delimiters[0];
+ ctag = delimiters[delimiters.length - 1];
+
+ return closeIndex + close.length - 1;
+ }
+
+ if (delimiters) {
+ delimiters = delimiters.split(' ');
+ otag = delimiters[0];
+ ctag = delimiters[1];
+ }
+
+ for (i = 0; i < len; i++) {
+ if (state == IN_TEXT) {
+ if (tagChange(otag, text, i)) {
+ --i;
+ addBuf();
+ state = IN_TAG_TYPE;
+ } else {
+ if (text.charAt(i) == '\n') {
+ filterLine(seenTag);
+ } else {
+ buf += text.charAt(i);
+ }
+ }
+ } else if (state == IN_TAG_TYPE) {
+ i += otag.length - 1;
+ tag = Hogan.tags[text.charAt(i + 1)];
+ tagType = tag ? text.charAt(i + 1) : '_v';
+ if (tagType == '=') {
+ i = changeDelimiters(text, i);
+ state = IN_TEXT;
+ } else {
+ if (tag) {
+ i++;
+ }
+ state = IN_TAG;
+ }
+ seenTag = i;
+ } else {
+ if (tagChange(ctag, text, i)) {
+ tokens.push({tag: tagType, n: trim(buf), otag: otag, ctag: ctag,
+ i: (tagType == '/') ? seenTag - otag.length : i + ctag.length});
+ buf = '';
+ i += ctag.length - 1;
+ state = IN_TEXT;
+ if (tagType == '{') {
+ if (ctag == '}}') {
+ i++;
+ } else {
+ cleanTripleStache(tokens[tokens.length - 1]);
+ }
+ }
+ } else {
+ buf += text.charAt(i);
+ }
+ }
+ }
+
+ filterLine(seenTag, true);
+
+ return tokens;
+ }
+
+ function cleanTripleStache(token) {
+ if (token.n.substr(token.n.length - 1) === '}') {
+ token.n = token.n.substring(0, token.n.length - 1);
+ }
+ }
+
+ function trim(s) {
+ if (s.trim) {
+ return s.trim();
+ }
+
+ return s.replace(/^\s*|\s*$/g, '');
+ }
+
+ function tagChange(tag, text, index) {
+ if (text.charAt(index) != tag.charAt(0)) {
+ return false;
+ }
+
+ for (var i = 1, l = tag.length; i < l; i++) {
+ if (text.charAt(index + i) != tag.charAt(i)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ // the tags allowed inside super templates
+ var allowedInSuper = {'_t': true, '\n': true, '$': true, '/': true};
+
+ function buildTree(tokens, kind, stack, customTags) {
+ var instructions = [],
+ opener = null,
+ tail = null,
+ token = null;
+
+ tail = stack[stack.length - 1];
+
+ while (tokens.length > 0) {
+ token = tokens.shift();
+
+ if (tail && tail.tag == '<' && !(token.tag in allowedInSuper)) {
+ throw new Error('Illegal content in < super tag.');
+ }
+
+ if (Hogan.tags[token.tag] <= Hogan.tags['$'] || isOpener(token, customTags)) {
+ stack.push(token);
+ token.nodes = buildTree(tokens, token.tag, stack, customTags);
+ } else if (token.tag == '/') {
+ if (stack.length === 0) {
+ throw new Error('Closing tag without opener: /' + token.n);
+ }
+ opener = stack.pop();
+ if (token.n != opener.n && !isCloser(token.n, opener.n, customTags)) {
+ throw new Error('Nesting error: ' + opener.n + ' vs. ' + token.n);
+ }
+ opener.end = token.i;
+ return instructions;
+ } else if (token.tag == '\n') {
+ token.last = (tokens.length == 0) || (tokens[0].tag == '\n');
+ }
+
+ instructions.push(token);
+ }
+
+ if (stack.length > 0) {
+ throw new Error('missing closing tag: ' + stack.pop().n);
+ }
+
+ return instructions;
+ }
+
+ function isOpener(token, tags) {
+ for (var i = 0, l = tags.length; i < l; i++) {
+ if (tags[i].o == token.n) {
+ token.tag = '#';
+ return true;
+ }
+ }
+ }
+
+ function isCloser(close, open, tags) {
+ for (var i = 0, l = tags.length; i < l; i++) {
+ if (tags[i].c == close && tags[i].o == open) {
+ return true;
+ }
+ }
+ }
+
+ function stringifySubstitutions(obj) {
+ var items = [];
+ for (var key in obj) {
+ items.push('"' + esc(key) + '": function(c,p,t,i) {' + obj[key] + '}');
+ }
+ return "{ " + items.join(",") + " }";
+ }
+
+ function stringifyPartials(codeObj) {
+ var partials = [];
+ for (var key in codeObj.partials) {
+ partials.push('"' + esc(key) + '":{name:"' + esc(codeObj.partials[key].name) + '", ' + stringifyPartials(codeObj.partials[key]) + "}");
+ }
+ return "partials: {" + partials.join(",") + "}, subs: " + stringifySubstitutions(codeObj.subs);
+ }
+
+ Hogan.stringify = function(codeObj, text, options) {
+ return "{code: function (c,p,i) { " + Hogan.wrapMain(codeObj.code) + " }," + stringifyPartials(codeObj) + "}";
+ }
+
+ var serialNo = 0;
+ Hogan.generate = function(tree, text, options) {
+ serialNo = 0;
+ var context = { code: '', subs: {}, partials: {} };
+ Hogan.walk(tree, context);
+
+ if (options.asString) {
+ return this.stringify(context, text, options);
+ }
+
+ return this.makeTemplate(context, text, options);
+ }
+
+ Hogan.wrapMain = function(code) {
+ return 'var t=this;t.b(i=i||"");' + code + 'return t.fl();';
+ }
+
+ Hogan.template = Hogan.Template;
+
+ Hogan.makeTemplate = function(codeObj, text, options) {
+ var template = this.makePartials(codeObj);
+ template.code = new Function('c', 'p', 'i', this.wrapMain(codeObj.code));
+ return new this.template(template, text, this, options);
+ }
+
+ Hogan.makePartials = function(codeObj) {
+ var key, template = {subs: {}, partials: codeObj.partials, name: codeObj.name};
+ for (key in template.partials) {
+ template.partials[key] = this.makePartials(template.partials[key]);
+ }
+ for (key in codeObj.subs) {
+ template.subs[key] = new Function('c', 'p', 't', 'i', codeObj.subs[key]);
+ }
+ return template;
+ }
+
+ function esc(s) {
+ return s.replace(rSlash, '\\\\')
+ .replace(rQuot, '\\\"')
+ .replace(rNewline, '\\n')
+ .replace(rCr, '\\r')
+ .replace(rLineSep, '\\u2028')
+ .replace(rParagraphSep, '\\u2029');
+ }
+
+ function chooseMethod(s) {
+ return (~s.indexOf('.')) ? 'd' : 'f';
+ }
+
+ function createPartial(node, context) {
+ var prefix = "<" + (context.prefix || "");
+ var sym = prefix + node.n + serialNo++;
+ context.partials[sym] = {name: node.n, partials: {}};
+ context.code += 't.b(t.rp("' + esc(sym) + '",c,p,"' + (node.indent || '') + '"));';
+ return sym;
+ }
+
+ Hogan.codegen = {
+ '#': function(node, context) {
+ context.code += 'if(t.s(t.' + chooseMethod(node.n) + '("' + esc(node.n) + '",c,p,1),' +
+ 'c,p,0,' + node.i + ',' + node.end + ',"' + node.otag + " " + node.ctag + '")){' +
+ 't.rs(c,p,' + 'function(c,p,t){';
+ Hogan.walk(node.nodes, context);
+ context.code += '});c.pop();}';
+ },
+
+ '^': function(node, context) {
+ context.code += 'if(!t.s(t.' + chooseMethod(node.n) + '("' + esc(node.n) + '",c,p,1),c,p,1,0,0,"")){';
+ Hogan.walk(node.nodes, context);
+ context.code += '};';
+ },
+
+ '>': createPartial,
+ '<': function(node, context) {
+ var ctx = {partials: {}, code: '', subs: {}, inPartial: true};
+ Hogan.walk(node.nodes, ctx);
+ var template = context.partials[createPartial(node, context)];
+ template.subs = ctx.subs;
+ template.partials = ctx.partials;
+ },
+
+ '$': function(node, context) {
+ var ctx = {subs: {}, code: '', partials: context.partials, prefix: node.n};
+ Hogan.walk(node.nodes, ctx);
+ context.subs[node.n] = ctx.code;
+ if (!context.inPartial) {
+ context.code += 't.sub("' + esc(node.n) + '",c,p,i);';
+ }
+ },
+
+ '\n': function(node, context) {
+ context.code += write('"\\n"' + (node.last ? '' : ' + i'));
+ },
+
+ '_v': function(node, context) {
+ context.code += 't.b(t.v(t.' + chooseMethod(node.n) + '("' + esc(node.n) + '",c,p,0)));';
+ },
+
+ '_t': function(node, context) {
+ context.code += write('"' + esc(node.text) + '"');
+ },
+
+ '{': tripleStache,
+
+ '&': tripleStache
+ }
+
+ function tripleStache(node, context) {
+ context.code += 't.b(t.t(t.' + chooseMethod(node.n) + '("' + esc(node.n) + '",c,p,0)));';
+ }
+
+ function write(s) {
+ return 't.b(' + s + ');';
+ }
+
+ Hogan.walk = function(nodelist, context) {
+ var func;
+ for (var i = 0, l = nodelist.length; i < l; i++) {
+ func = Hogan.codegen[nodelist[i].tag];
+ func && func(nodelist[i], context);
+ }
+ return context;
+ }
+
+ Hogan.parse = function(tokens, text, options) {
+ options = options || {};
+ return buildTree(tokens, '', [], options.sectionTags || []);
+ }
+
+ Hogan.cache = {};
+
+ Hogan.cacheKey = function(text, options) {
+ return [text, !!options.asString, !!options.disableLambda, options.delimiters, !!options.modelGet].join('||');
+ }
+
+ Hogan.compile = function(text, options) {
+ options = options || {};
+ var key = Hogan.cacheKey(text, options);
+ var template = this.cache[key];
+
+ if (template) {
+ var partials = template.partials;
+ for (var name in partials) {
+ delete partials[name].instance;
+ }
+ return template;
+ }
+
+ template = this.generate(this.parse(this.scan(text, options.delimiters), text, options), text, options);
+ return this.cache[key] = template;
+ }
+})(typeof exports !== 'undefined' ? exports : Hogan);
+
+},{}],18:[function(require,module,exports){
+/*
+ * Copyright 2011 Twitter, Inc.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// This file is for use with Node.js. See dist/ for browser files.
+
+var Hogan = require('./compiler');
+Hogan.Template = require('./template').Template;
+Hogan.template = Hogan.Template;
+module.exports = Hogan;
+
+},{"./compiler":17,"./template":19}],19:[function(require,module,exports){
+/*
+ * Copyright 2011 Twitter, Inc.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var Hogan = {};
+
+(function (Hogan) {
+ Hogan.Template = function (codeObj, text, compiler, options) {
+ codeObj = codeObj || {};
+ this.r = codeObj.code || this.r;
+ this.c = compiler;
+ this.options = options || {};
+ this.text = text || '';
+ this.partials = codeObj.partials || {};
+ this.subs = codeObj.subs || {};
+ this.buf = '';
+ }
+
+ Hogan.Template.prototype = {
+ // render: replaced by generated code.
+ r: function (context, partials, indent) { return ''; },
+
+ // variable escaping
+ v: hoganEscape,
+
+ // triple stache
+ t: coerceToString,
+
+ render: function render(context, partials, indent) {
+ return this.ri([context], partials || {}, indent);
+ },
+
+ // render internal -- a hook for overrides that catches partials too
+ ri: function (context, partials, indent) {
+ return this.r(context, partials, indent);
+ },
+
+ // ensurePartial
+ ep: function(symbol, partials) {
+ var partial = this.partials[symbol];
+
+ // check to see that if we've instantiated this partial before
+ var template = partials[partial.name];
+ if (partial.instance && partial.base == template) {
+ return partial.instance;
+ }
+
+ if (typeof template == 'string') {
+ if (!this.c) {
+ throw new Error("No compiler available.");
+ }
+ template = this.c.compile(template, this.options);
+ }
+
+ if (!template) {
+ return null;
+ }
+
+ // We use this to check whether the partials dictionary has changed
+ this.partials[symbol].base = template;
+
+ if (partial.subs) {
+ // Make sure we consider parent template now
+ if (!partials.stackText) partials.stackText = {};
+ for (key in partial.subs) {
+ if (!partials.stackText[key]) {
+ partials.stackText[key] = (this.activeSub !== undefined && partials.stackText[this.activeSub]) ? partials.stackText[this.activeSub] : this.text;
+ }
+ }
+ template = createSpecializedPartial(template, partial.subs, partial.partials,
+ this.stackSubs, this.stackPartials, partials.stackText);
+ }
+ this.partials[symbol].instance = template;
+
+ return template;
+ },
+
+ // tries to find a partial in the current scope and render it
+ rp: function(symbol, context, partials, indent) {
+ var partial = this.ep(symbol, partials);
+ if (!partial) {
+ return '';
+ }
+
+ return partial.ri(context, partials, indent);
+ },
+
+ // render a section
+ rs: function(context, partials, section) {
+ var tail = context[context.length - 1];
+
+ if (!isArray(tail)) {
+ section(context, partials, this);
+ return;
+ }
+
+ for (var i = 0; i < tail.length; i++) {
+ context.push(tail[i]);
+ section(context, partials, this);
+ context.pop();
+ }
+ },
+
+ // maybe start a section
+ s: function(val, ctx, partials, inverted, start, end, tags) {
+ var pass;
+
+ if (isArray(val) && val.length === 0) {
+ return false;
+ }
+
+ if (typeof val == 'function') {
+ val = this.ms(val, ctx, partials, inverted, start, end, tags);
+ }
+
+ pass = !!val;
+
+ if (!inverted && pass && ctx) {
+ ctx.push((typeof val == 'object') ? val : ctx[ctx.length - 1]);
+ }
+
+ return pass;
+ },
+
+ // find values with dotted names
+ d: function(key, ctx, partials, returnFound) {
+ var found,
+ names = key.split('.'),
+ val = this.f(names[0], ctx, partials, returnFound),
+ doModelGet = this.options.modelGet,
+ cx = null;
+
+ if (key === '.' && isArray(ctx[ctx.length - 2])) {
+ val = ctx[ctx.length - 1];
+ } else {
+ for (var i = 1; i < names.length; i++) {
+ found = findInScope(names[i], val, doModelGet);
+ if (found !== undefined) {
+ cx = val;
+ val = found;
+ } else {
+ val = '';
+ }
+ }
+ }
+
+ if (returnFound && !val) {
+ return false;
+ }
+
+ if (!returnFound && typeof val == 'function') {
+ ctx.push(cx);
+ val = this.mv(val, ctx, partials);
+ ctx.pop();
+ }
+
+ return val;
+ },
+
+ // find values with normal names
+ f: function(key, ctx, partials, returnFound) {
+ var val = false,
+ v = null,
+ found = false,
+ doModelGet = this.options.modelGet;
+
+ for (var i = ctx.length - 1; i >= 0; i--) {
+ v = ctx[i];
+ val = findInScope(key, v, doModelGet);
+ if (val !== undefined) {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found) {
+ return (returnFound) ? false : "";
+ }
+
+ if (!returnFound && typeof val == 'function') {
+ val = this.mv(val, ctx, partials);
+ }
+
+ return val;
+ },
+
+ // higher order templates
+ ls: function(func, cx, partials, text, tags) {
+ var oldTags = this.options.delimiters;
+
+ this.options.delimiters = tags;
+ this.b(this.ct(coerceToString(func.call(cx, text)), cx, partials));
+ this.options.delimiters = oldTags;
+
+ return false;
+ },
+
+ // compile text
+ ct: function(text, cx, partials) {
+ if (this.options.disableLambda) {
+ throw new Error('Lambda features disabled.');
+ }
+ return this.c.compile(text, this.options).render(cx, partials);
+ },
+
+ // template result buffering
+ b: function(s) { this.buf += s; },
+
+ fl: function() { var r = this.buf; this.buf = ''; return r; },
+
+ // method replace section
+ ms: function(func, ctx, partials, inverted, start, end, tags) {
+ var textSource,
+ cx = ctx[ctx.length - 1],
+ result = func.call(cx);
+
+ if (typeof result == 'function') {
+ if (inverted) {
+ return true;
+ } else {
+ textSource = (this.activeSub && this.subsText && this.subsText[this.activeSub]) ? this.subsText[this.activeSub] : this.text;
+ return this.ls(result, cx, partials, textSource.substring(start, end), tags);
+ }
+ }
+
+ return result;
+ },
+
+ // method replace variable
+ mv: function(func, ctx, partials) {
+ var cx = ctx[ctx.length - 1];
+ var result = func.call(cx);
+
+ if (typeof result == 'function') {
+ return this.ct(coerceToString(result.call(cx)), cx, partials);
+ }
+
+ return result;
+ },
+
+ sub: function(name, context, partials, indent) {
+ var f = this.subs[name];
+ if (f) {
+ this.activeSub = name;
+ f(context, partials, this, indent);
+ this.activeSub = false;
+ }
+ }
+
+ };
+
+ //Find a key in an object
+ function findInScope(key, scope, doModelGet) {
+ var val;
+
+ if (scope && typeof scope == 'object') {
+
+ if (scope[key] !== undefined) {
+ val = scope[key];
+
+ // try lookup with get for backbone or similar model data
+ } else if (doModelGet && scope.get && typeof scope.get == 'function') {
+ val = scope.get(key);
+ }
+ }
+
+ return val;
+ }
+
+ function createSpecializedPartial(instance, subs, partials, stackSubs, stackPartials, stackText) {
+ function PartialTemplate() {};
+ PartialTemplate.prototype = instance;
+ function Substitutions() {};
+ Substitutions.prototype = instance.subs;
+ var key;
+ var partial = new PartialTemplate();
+ partial.subs = new Substitutions();
+ partial.subsText = {}; //hehe. substext.
+ partial.buf = '';
+
+ stackSubs = stackSubs || {};
+ partial.stackSubs = stackSubs;
+ partial.subsText = stackText;
+ for (key in subs) {
+ if (!stackSubs[key]) stackSubs[key] = subs[key];
+ }
+ for (key in stackSubs) {
+ partial.subs[key] = stackSubs[key];
+ }
+
+ stackPartials = stackPartials || {};
+ partial.stackPartials = stackPartials;
+ for (key in partials) {
+ if (!stackPartials[key]) stackPartials[key] = partials[key];
+ }
+ for (key in stackPartials) {
+ partial.partials[key] = stackPartials[key];
+ }
+
+ return partial;
+ }
+
+ var rAmp = /&/g,
+ rLt = //g,
+ rApos = /\'/g,
+ rQuot = /\"/g,
+ hChars = /[&<>\"\']/;
+
+ function coerceToString(val) {
+ return String((val === null || val === undefined) ? '' : val);
+ }
+
+ function hoganEscape(str) {
+ str = coerceToString(str);
+ return hChars.test(str) ?
+ str
+ .replace(rAmp, '&')
+ .replace(rLt, '<')
+ .replace(rGt, '>')
+ .replace(rApos, ''')
+ .replace(rQuot, '"') :
+ str;
+ }
+
+ var isArray = Array.isArray || function(a) {
+ return Object.prototype.toString.call(a) === '[object Array]';
+ };
+
+})(typeof exports !== 'undefined' ? exports : Hogan);
+
+},{}],20:[function(require,module,exports){
+(function (process){
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+// resolves . and .. elements in a path array with directory names there
+// must be no slashes, empty elements, or device names (c:\) in the array
+// (so also no leading and trailing slashes - it does not distinguish
+// relative and absolute paths)
+function normalizeArray(parts, allowAboveRoot) {
+ // if the path tries to go above the root, `up` ends up > 0
+ var up = 0;
+ for (var i = parts.length - 1; i >= 0; i--) {
+ var last = parts[i];
+ if (last === '.') {
+ parts.splice(i, 1);
+ } else if (last === '..') {
+ parts.splice(i, 1);
+ up++;
+ } else if (up) {
+ parts.splice(i, 1);
+ up--;
+ }
+ }
+
+ // if the path is allowed to go above the root, restore leading ..s
+ if (allowAboveRoot) {
+ for (; up--; up) {
+ parts.unshift('..');
+ }
+ }
+
+ return parts;
+}
+
+// Split a filename into [root, dir, basename, ext], unix version
+// 'root' is just a slash, or nothing.
+var splitPathRe =
+ /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
+var splitPath = function(filename) {
+ return splitPathRe.exec(filename).slice(1);
+};
+
+// path.resolve([from ...], to)
+// posix version
+exports.resolve = function() {
+ var resolvedPath = '',
+ resolvedAbsolute = false;
+
+ for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
+ var path = (i >= 0) ? arguments[i] : process.cwd();
+
+ // Skip empty and invalid entries
+ if (typeof path !== 'string') {
+ throw new TypeError('Arguments to path.resolve must be strings');
+ } else if (!path) {
+ continue;
+ }
+
+ resolvedPath = path + '/' + resolvedPath;
+ resolvedAbsolute = path.charAt(0) === '/';
+ }
+
+ // At this point the path should be resolved to a full absolute path, but
+ // handle relative paths to be safe (might happen when process.cwd() fails)
+
+ // Normalize the path
+ resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
+ return !!p;
+ }), !resolvedAbsolute).join('/');
+
+ return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
+};
+
+// path.normalize(path)
+// posix version
+exports.normalize = function(path) {
+ var isAbsolute = exports.isAbsolute(path),
+ trailingSlash = substr(path, -1) === '/';
+
+ // Normalize the path
+ path = normalizeArray(filter(path.split('/'), function(p) {
+ return !!p;
+ }), !isAbsolute).join('/');
+
+ if (!path && !isAbsolute) {
+ path = '.';
+ }
+ if (path && trailingSlash) {
+ path += '/';
+ }
+
+ return (isAbsolute ? '/' : '') + path;
+};
+
+// posix version
+exports.isAbsolute = function(path) {
+ return path.charAt(0) === '/';
+};
+
+// posix version
+exports.join = function() {
+ var paths = Array.prototype.slice.call(arguments, 0);
+ return exports.normalize(filter(paths, function(p, index) {
+ if (typeof p !== 'string') {
+ throw new TypeError('Arguments to path.join must be strings');
+ }
+ return p;
+ }).join('/'));
+};
+
+
+// path.relative(from, to)
+// posix version
+exports.relative = function(from, to) {
+ from = exports.resolve(from).substr(1);
+ to = exports.resolve(to).substr(1);
+
+ function trim(arr) {
+ var start = 0;
+ for (; start < arr.length; start++) {
+ if (arr[start] !== '') break;
+ }
+
+ var end = arr.length - 1;
+ for (; end >= 0; end--) {
+ if (arr[end] !== '') break;
+ }
+
+ if (start > end) return [];
+ return arr.slice(start, end - start + 1);
+ }
+
+ var fromParts = trim(from.split('/'));
+ var toParts = trim(to.split('/'));
+
+ var length = Math.min(fromParts.length, toParts.length);
+ var samePartsLength = length;
+ for (var i = 0; i < length; i++) {
+ if (fromParts[i] !== toParts[i]) {
+ samePartsLength = i;
+ break;
+ }
+ }
+
+ var outputParts = [];
+ for (var i = samePartsLength; i < fromParts.length; i++) {
+ outputParts.push('..');
+ }
+
+ outputParts = outputParts.concat(toParts.slice(samePartsLength));
+
+ return outputParts.join('/');
+};
+
+exports.sep = '/';
+exports.delimiter = ':';
+
+exports.dirname = function(path) {
+ var result = splitPath(path),
+ root = result[0],
+ dir = result[1];
+
+ if (!root && !dir) {
+ // No dirname whatsoever
+ return '.';
+ }
+
+ if (dir) {
+ // It has a dirname, strip trailing slash
+ dir = dir.substr(0, dir.length - 1);
+ }
+
+ return root + dir;
+};
+
+
+exports.basename = function(path, ext) {
+ var f = splitPath(path)[2];
+ // TODO: make this comparison case-insensitive on windows?
+ if (ext && f.substr(-1 * ext.length) === ext) {
+ f = f.substr(0, f.length - ext.length);
+ }
+ return f;
+};
+
+
+exports.extname = function(path) {
+ return splitPath(path)[3];
+};
+
+function filter (xs, f) {
+ if (xs.filter) return xs.filter(f);
+ var res = [];
+ for (var i = 0; i < xs.length; i++) {
+ if (f(xs[i], i, xs)) res.push(xs[i]);
+ }
+ return res;
+}
+
+// String.prototype.substr - negative index don't work in IE8
+var substr = 'ab'.substr(-1) === 'b'
+ ? function (str, start, len) { return str.substr(start, len) }
+ : function (str, start, len) {
+ if (start < 0) start = str.length + start;
+ return str.substr(start, len);
+ }
+;
+
+}).call(this,require('_process'))
+},{"_process":21}],21:[function(require,module,exports){
+// shim for using process in browser
+
+var process = module.exports = {};
+var queue = [];
+var draining = false;
+var currentQueue;
+var queueIndex = -1;
+
+function cleanUpNextTick() {
+ draining = false;
+ if (currentQueue.length) {
+ queue = currentQueue.concat(queue);
+ } else {
+ queueIndex = -1;
+ }
+ if (queue.length) {
+ drainQueue();
+ }
+}
+
+function drainQueue() {
+ if (draining) {
+ return;
+ }
+ var timeout = setTimeout(cleanUpNextTick);
+ draining = true;
+
+ var len = queue.length;
+ while(len) {
+ currentQueue = queue;
+ queue = [];
+ while (++queueIndex < len) {
+ if (currentQueue) {
+ currentQueue[queueIndex].run();
+ }
+ }
+ queueIndex = -1;
+ len = queue.length;
+ }
+ currentQueue = null;
+ draining = false;
+ clearTimeout(timeout);
+}
+
+process.nextTick = function (fun) {
+ var args = new Array(arguments.length - 1);
+ if (arguments.length > 1) {
+ for (var i = 1; i < arguments.length; i++) {
+ args[i - 1] = arguments[i];
+ }
+ }
+ queue.push(new Item(fun, args));
+ if (queue.length === 1 && !draining) {
+ setTimeout(drainQueue, 0);
+ }
+};
+
+// v8 likes predictible objects
+function Item(fun, array) {
+ this.fun = fun;
+ this.array = array;
+}
+Item.prototype.run = function () {
+ this.fun.apply(null, this.array);
+};
+process.title = 'browser';
+process.browser = true;
+process.env = {};
+process.argv = [];
+process.version = ''; // empty string to avoid regexp issues
+process.versions = {};
+
+function noop() {}
+
+process.on = noop;
+process.addListener = noop;
+process.once = noop;
+process.off = noop;
+process.removeListener = noop;
+process.removeAllListeners = noop;
+process.emit = noop;
+
+process.binding = function (name) {
+ throw new Error('process.binding is not supported');
+};
+
+process.cwd = function () { return '/' };
+process.chdir = function (dir) {
+ throw new Error('process.chdir is not supported');
+};
+process.umask = function() { return 0; };
+
+},{}],22:[function(require,module,exports){
+/*
+ *
+ * Diff Parser (diff-parser.js)
+ * Author: rtfpessoa
+ *
+ */
+
+(function() {
+
+ var utils = require('./utils.js').Utils;
+
+ var LINE_TYPE = {
+ INSERTS: 'd2h-ins',
+ DELETES: 'd2h-del',
+ INSERT_CHANGES: 'd2h-ins d2h-change',
+ DELETE_CHANGES: 'd2h-del d2h-change',
+ CONTEXT: 'd2h-cntx',
+ INFO: 'd2h-info'
+ };
+
+ function DiffParser() {
+ }
+
+ DiffParser.prototype.LINE_TYPE = LINE_TYPE;
+
+ DiffParser.prototype.generateDiffJson = function(diffInput, config) {
+ var files = [];
+ var currentFile = null;
+ var currentBlock = null;
+ var oldLine = null;
+ var newLine = null;
+
+ var saveBlock = function() {
+
+ /* Add previous block(if exists) before start a new file */
+ if (currentBlock) {
+ currentFile.blocks.push(currentBlock);
+ currentBlock = null;
+ }
+ };
+
+ var saveFile = function() {
+
+ /*
+ * Add previous file(if exists) before start a new one
+ * if it has name (to avoid binary files errors)
+ */
+ if (currentFile && currentFile.newName) {
+ files.push(currentFile);
+ currentFile = null;
+ }
+ };
+
+ var startFile = function() {
+ saveBlock();
+ saveFile();
+
+ /* Create file structure */
+ currentFile = {};
+ currentFile.blocks = [];
+ currentFile.deletedLines = 0;
+ currentFile.addedLines = 0;
+ };
+
+ var startBlock = function(line) {
+ saveBlock();
+
+ var values;
+
+ if (values = /^@@ -(\d+),\d+ \+(\d+),\d+ @@.*/.exec(line)) {
+ currentFile.isCombined = false;
+ } else if (values = /^@@@ -(\d+),\d+ -\d+,\d+ \+(\d+),\d+ @@@.*/.exec(line)) {
+ currentFile.isCombined = true;
+ } else {
+ values = [0, 0];
+ currentFile.isCombined = false;
+ }
+
+ oldLine = values[1];
+ newLine = values[2];
+
+ /* Create block metadata */
+ currentBlock = {};
+ currentBlock.lines = [];
+ currentBlock.oldStartLine = oldLine;
+ currentBlock.newStartLine = newLine;
+ currentBlock.header = line;
+ };
+
+ var createLine = function(line) {
+ var currentLine = {};
+ currentLine.content = line;
+
+ var newLinePrefixes = !currentFile.isCombined ? ['+'] : ['+', ' +'];
+ var delLinePrefixes = !currentFile.isCombined ? ['-'] : ['-', ' -'];
+
+ /* Fill the line data */
+ if (utils.startsWith(line, newLinePrefixes)) {
+ currentFile.addedLines++;
+
+ currentLine.type = LINE_TYPE.INSERTS;
+ currentLine.oldNumber = null;
+ currentLine.newNumber = newLine++;
+
+ currentBlock.lines.push(currentLine);
+
+ } else if (utils.startsWith(line, delLinePrefixes)) {
+ currentFile.deletedLines++;
+
+ currentLine.type = LINE_TYPE.DELETES;
+ currentLine.oldNumber = oldLine++;
+ currentLine.newNumber = null;
+
+ currentBlock.lines.push(currentLine);
+
+ } else {
+ currentLine.type = LINE_TYPE.CONTEXT;
+ currentLine.oldNumber = oldLine++;
+ currentLine.newNumber = newLine++;
+
+ currentBlock.lines.push(currentLine);
+ }
+ };
+
+ var diffLines =
+ diffInput.replace(/\\ No newline at end of file/g, '')
+ .replace(/\r\n?/g, '\n')
+ .split('\n');
+
+ /* Diff */
+ var oldMode = /^old mode (\d{6})/;
+ var newMode = /^new mode (\d{6})/;
+ var deletedFileMode = /^deleted file mode (\d{6})/;
+ var newFileMode = /^new file mode (\d{6})/;
+
+ var copyFrom = /^copy from "?(.+)"?/;
+ var copyTo = /^copy to "?(.+)"?/;
+
+ var renameFrom = /^rename from "?(.+)"?/;
+ var renameTo = /^rename to "?(.+)"?/;
+
+ var similarityIndex = /^similarity index (\d+)%/;
+ var dissimilarityIndex = /^dissimilarity index (\d+)%/;
+ var index = /^index ([0-9a-z]+)\.\.([0-9a-z]+)\s*(\d{6})?/;
+
+ /* Combined Diff */
+ var combinedIndex = /^index ([0-9a-z]+),([0-9a-z]+)\.\.([0-9a-z]+)/;
+ var combinedMode = /^mode (\d{6}),(\d{6})\.\.(\d{6})/;
+ var combinedNewFile = /^new file mode (\d{6})/;
+ var combinedDeletedFile = /^deleted file mode (\d{6}),(\d{6})/;
+
+ diffLines.forEach(function(line) {
+ // Unmerged paths, and possibly other non-diffable files
+ // https://github.com/scottgonzalez/pretty-diff/issues/11
+ // Also, remove some useless lines
+ if (!line || utils.startsWith(line, '*')) {
+ return;
+ }
+
+ var values = [];
+ if (utils.startsWith(line, 'diff')) {
+ startFile();
+ } else if (currentFile && !currentFile.oldName && (values = getSrcFilename(line, config))) {
+ currentFile.oldName = values;
+ currentFile.language = getExtension(currentFile.oldName, currentFile.language);
+ } else if (currentFile && !currentFile.newName && (values = getDstFilename(line, config))) {
+ currentFile.newName = values;
+ currentFile.language = getExtension(currentFile.newName, currentFile.language);
+ } else if (currentFile && utils.startsWith(line, '@@')) {
+ startBlock(line);
+ } else if ((values = oldMode.exec(line))) {
+ currentFile.oldMode = values[1];
+ } else if ((values = newMode.exec(line))) {
+ currentFile.newMode = values[1];
+ } else if ((values = deletedFileMode.exec(line))) {
+ currentFile.deletedFileMode = values[1];
+ currentFile.isDeleted = true;
+ } else if ((values = newFileMode.exec(line))) {
+ currentFile.newFileMode = values[1];
+ currentFile.isNew = true;
+ } else if ((values = copyFrom.exec(line))) {
+ currentFile.oldName = values[1];
+ currentFile.isCopy = true;
+ } else if ((values = copyTo.exec(line))) {
+ currentFile.newName = values[1];
+ currentFile.isCopy = true;
+ } else if ((values = renameFrom.exec(line))) {
+ currentFile.oldName = values[1];
+ currentFile.isRename = true;
+ } else if ((values = renameTo.exec(line))) {
+ currentFile.newName = values[1];
+ currentFile.isRename = true;
+ } else if ((values = similarityIndex.exec(line))) {
+ currentFile.unchangedPercentage = values[1];
+ } else if ((values = dissimilarityIndex.exec(line))) {
+ currentFile.changedPercentage = values[1];
+ } else if ((values = index.exec(line))) {
+ currentFile.checksumBefore = values[1];
+ currentFile.checksumAfter = values[2];
+ values[3] && (currentFile.mode = values[3]);
+ } else if ((values = combinedIndex.exec(line))) {
+ currentFile.checksumBefore = [values[2], values[3]];
+ currentFile.checksumAfter = values[1];
+ } else if ((values = combinedMode.exec(line))) {
+ currentFile.oldMode = [values[2], values[3]];
+ currentFile.newMode = values[1];
+ } else if ((values = combinedNewFile.exec(line))) {
+ currentFile.newFileMode = values[1];
+ currentFile.isNew = true;
+ } else if ((values = combinedDeletedFile.exec(line))) {
+ currentFile.deletedFileMode = values[1];
+ currentFile.isDeleted = true;
+ } else if (currentBlock) {
+ createLine(line);
+ }
+ });
+
+ saveBlock();
+ saveFile();
+
+ return files;
+ };
+
+ function getExtension(filename, language) {
+ var nameSplit = filename.split('.');
+ if (nameSplit.length > 1) {
+ return nameSplit[nameSplit.length - 1];
+ }
+
+ return language;
+ }
+
+ function getSrcFilename(line, cfg) {
+ var prefixes = ["a/", "i/", "w/", "c/", "o/"];
+
+ if (cfg.srcPrefix) {
+ prefixes.push(cfg.srcPrefix);
+ }
+
+ return _getFilename('---', line, prefixes);
+ }
+
+ function getDstFilename(line, cfg) {
+ var prefixes = ["b/", "i/", "w/", "c/", "o/"];
+
+ if (cfg.dstPrefix) {
+ prefixes.push(cfg.dstPrefix);
+ }
+
+ return _getFilename('\\+\\+\\+', line, prefixes);
+ }
+
+ function _getFilename(linePrefix, line, prefixes) {
+ var FilenameRegExp = new RegExp('^' + linePrefix + ' "?(.+?)"?$');
+
+ var filename;
+ var values = FilenameRegExp.exec(line);
+ if (values && values[1]) {
+ filename = values[1];
+ var matchingPrefixes = prefixes.filter(function(p) {
+ return filename.indexOf(p) === 0;
+ });
+
+ if (matchingPrefixes[0]) {
+ // Remove prefix if exists
+ filename = filename.slice(matchingPrefixes[0].length);
+ }
+ }
+
+ return filename;
+ }
+
+ module.exports.DiffParser = new DiffParser();
+
+})();
+
+},{"./utils.js":32}],23:[function(require,module,exports){
+(function (global){
+/*
+ *
+ * Diff to HTML (diff2html.js)
+ * Author: rtfpessoa
+ *
+ */
+
+(function() {
+
+ var diffParser = require('./diff-parser.js').DiffParser;
+ var fileLister = require('./file-list-printer.js').FileListPrinter;
+ var htmlPrinter = require('./html-printer.js').HtmlPrinter;
+
+ function Diff2Html() {
+ }
+
+ /*
+ * Line diff type configuration
+ var config = {
+ 'wordByWord': true, // (default)
+ // OR
+ 'charByChar': true
+ };
+ */
+
+ /*
+ * Generates json object from string diff input
+ */
+ Diff2Html.prototype.getJsonFromDiff = function(diffInput, config) {
+ var configOrEmpty = config || {};
+ return diffParser.generateDiffJson(diffInput, configOrEmpty);
+ };
+
+ /*
+ * Generates the html diff. The config parameter configures the output/input formats and other options
+ */
+ Diff2Html.prototype.getPrettyHtml = function(diffInput, config) {
+ var configOrEmpty = config || {};
+
+ var diffJson = diffInput;
+ if (!configOrEmpty.inputFormat || configOrEmpty.inputFormat === 'diff') {
+ diffJson = diffParser.generateDiffJson(diffInput, configOrEmpty);
+ }
+
+ var fileList = '';
+ if (configOrEmpty.showFiles === true) {
+ fileList = fileLister.generateFileList(diffJson, configOrEmpty);
+ }
+
+ var diffOutput = '';
+ if (configOrEmpty.outputFormat === 'side-by-side') {
+ diffOutput = htmlPrinter.generateSideBySideJsonHtml(diffJson, configOrEmpty);
+ } else {
+ diffOutput = htmlPrinter.generateLineByLineJsonHtml(diffJson, configOrEmpty);
+ }
+
+ return fileList + diffOutput;
+ };
+
+
+ /*
+ * Deprecated methods - The following methods exist only to maintain compatibility with previous versions
+ */
+
+ /*
+ * Generates pretty html from string diff input
+ */
+ Diff2Html.prototype.getPrettyHtmlFromDiff = function(diffInput, config) {
+ var configOrEmpty = config || {};
+ configOrEmpty.inputFormat = 'diff';
+ configOrEmpty.outputFormat = 'line-by-line';
+ return this.getPrettyHtml(diffInput, configOrEmpty);
+ };
+
+ /*
+ * Generates pretty html from a json object
+ */
+ Diff2Html.prototype.getPrettyHtmlFromJson = function(diffJson, config) {
+ var configOrEmpty = config || {};
+ configOrEmpty.inputFormat = 'json';
+ configOrEmpty.outputFormat = 'line-by-line';
+ return this.getPrettyHtml(diffJson, configOrEmpty);
+ };
+
+ /*
+ * Generates pretty side by side html from string diff input
+ */
+ Diff2Html.prototype.getPrettySideBySideHtmlFromDiff = function(diffInput, config) {
+ var configOrEmpty = config || {};
+ configOrEmpty.inputFormat = 'diff';
+ configOrEmpty.outputFormat = 'side-by-side';
+ return this.getPrettyHtml(diffInput, configOrEmpty);
+ };
+
+ /*
+ * Generates pretty side by side html from a json object
+ */
+ Diff2Html.prototype.getPrettySideBySideHtmlFromJson = function(diffJson, config) {
+ var configOrEmpty = config || {};
+ configOrEmpty.inputFormat = 'json';
+ configOrEmpty.outputFormat = 'side-by-side';
+ return this.getPrettyHtml(diffJson, configOrEmpty);
+ };
+
+ var diffObject = new Diff2Html();
+ module.exports.Diff2Html = diffObject;
+
+ // Expose diff2html in the browser
+ global.Diff2Html = diffObject;
+
+})();
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"./diff-parser.js":22,"./file-list-printer.js":24,"./html-printer.js":26}],24:[function(require,module,exports){
+/*
+ *
+ * FileListPrinter (file-list-printer.js)
+ * Author: nmatpt
+ *
+ */
+
+(function() {
+
+ var printerUtils = require('./printer-utils.js').PrinterUtils;
+
+ function FileListPrinter() {
+ }
+
+ FileListPrinter.prototype.generateFileList = function(diffFiles) {
+ return '\n' +
+ ' \n' +
+ '
\n' +
+
+ diffFiles.map(function(file) {
+ return ' \n' +
+ ' | \n' +
+ ' +' + file.addedLines + '\n' +
+ ' | \n' +
+ ' \n' +
+ ' -' + file.deletedLines + '\n' +
+ ' | \n' +
+ ' \n' +
+ ' ' +
+ ' ' + printerUtils.getDiffName(file) +
+ ' \n' +
+ ' | \n' +
+ '
\n';
+ }).join('\n') +
+ '
\n';
+ };
+
+ module.exports.FileListPrinter = new FileListPrinter();
+
+})();
+
+},{"./printer-utils.js":28}],25:[function(require,module,exports){
+(function (global,__dirname){
+/*
+ *
+ * Utils (hoganjs-utils.js)
+ * Author: rtfpessoa
+ *
+ */
+
+(function() {
+
+ var fs = require('fs');
+ var path = require('path');
+
+ var hogan = require('hogan.js');
+
+ var hoganTemplates;
+
+ var templatesPath = path.resolve(__dirname, 'templates');
+ var templatesCache = {};
+
+ function HoganJsUtils() {
+ try {
+ hoganTemplates = require('./templates/diff2html-templates.js');
+ } catch (_ignore) {
+ hoganTemplates = {};
+ }
+ }
+
+ HoganJsUtils.prototype.render = function(namespace, view, params) {
+ var templateKey = this._templateKey(namespace, view);
+
+ var template = this._getTemplate(templateKey);
+ if (template) {
+ return template.render(params);
+ }
+
+ return null;
+ };
+
+ HoganJsUtils.prototype._getTemplate = function(templateKey) {
+ var template = this._readFromCache(templateKey);
+
+ if (!template) {
+ template = this._loadTemplate(templateKey);
+ }
+
+ return template;
+ };
+
+ HoganJsUtils.prototype._loadTemplate = function(templateKey) {
+ var template;
+ if (fs.readFileSync) {
+ var templatePath = path.join(templatesPath, templateKey);
+ var templateContent = fs.readFileSync(templatePath + '.mustache', 'utf8');
+ template = hogan.compile(templateContent);
+ templatesCache[templateKey] = template;
+ }
+
+ return template;
+ };
+
+ HoganJsUtils.prototype._readFromCache = function(templateKey) {
+ return global.browserTemplates && global.browserTemplates[templateKey] ||
+ hoganTemplates[templateKey] ||
+ templatesCache[templateKey];
+ };
+
+ HoganJsUtils.prototype._templateKey = function(namespace, view) {
+ return namespace + '-' + view;
+ };
+
+ module.exports.HoganJsUtils = new HoganJsUtils();
+
+})();
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},"/src")
+},{"./templates/diff2html-templates.js":31,"fs":1,"hogan.js":18,"path":20}],26:[function(require,module,exports){
+/*
+ *
+ * HtmlPrinter (html-printer.js)
+ * Author: rtfpessoa
+ *
+ */
+
+(function() {
+
+ var LineByLinePrinter = require('./line-by-line-printer.js').LineByLinePrinter;
+ var SideBySidePrinter = require('./side-by-side-printer.js').SideBySidePrinter;
+
+ function HtmlPrinter() {
+ }
+
+ HtmlPrinter.prototype.generateLineByLineJsonHtml = function(diffFiles, config) {
+ var lineByLinePrinter = new LineByLinePrinter(config);
+ return lineByLinePrinter.generateLineByLineJsonHtml(diffFiles);
+ };
+
+ HtmlPrinter.prototype.generateSideBySideJsonHtml = function(diffFiles, config) {
+ var sideBySidePrinter = new SideBySidePrinter(config);
+ return sideBySidePrinter.generateSideBySideJsonHtml(diffFiles);
+ };
+
+ module.exports.HtmlPrinter = new HtmlPrinter();
+
+})();
+
+},{"./line-by-line-printer.js":27,"./side-by-side-printer.js":30}],27:[function(require,module,exports){
+/*
+ *
+ * LineByLinePrinter (line-by-line-printer.js)
+ * Author: rtfpessoa
+ *
+ */
+
+(function() {
+
+ var diffParser = require('./diff-parser.js').DiffParser;
+ var printerUtils = require('./printer-utils.js').PrinterUtils;
+ var utils = require('./utils.js').Utils;
+ var Rematch = require('./rematch.js').Rematch;
+
+ var hoganUtils = require('./hoganjs-utils.js').HoganJsUtils;
+ var baseTemplatesPath = 'line-by-line';
+
+ function LineByLinePrinter(config) {
+ this.config = config;
+ }
+
+ LineByLinePrinter.prototype.makeFileDiffHtml = function(file, diffs) {
+ return hoganUtils.render(baseTemplatesPath, 'file-diff', {
+ file: file,
+ fileDiffName: printerUtils.getDiffName(file),
+ fileHtmlId: printerUtils.getHtmlId(file),
+ diffs: diffs
+ });
+ };
+
+ LineByLinePrinter.prototype.makeLineByLineHtmlWrapper = function(content) {
+ return hoganUtils.render(baseTemplatesPath, 'wrapper', {'content': content});
+ };
+
+ LineByLinePrinter.prototype.generateLineByLineJsonHtml = function(diffFiles) {
+ var that = this;
+ var htmlDiffs = diffFiles.map(function(file) {
+ var diffs;
+ if (file.blocks.length) {
+ diffs = that._generateFileHtml(file);
+ } else {
+ diffs = that._generateEmptyDiff();
+ }
+ return that.makeFileDiffHtml(file, diffs);
+ });
+
+ return this.makeLineByLineHtmlWrapper(htmlDiffs.join('\n'));
+ };
+
+ var matcher = Rematch.rematch(function(a, b) {
+ var amod = a.content.substr(1);
+ var bmod = b.content.substr(1);
+
+ return Rematch.distance(amod, bmod);
+ });
+
+ LineByLinePrinter.prototype.makeColumnLineNumberHtml = function(block) {
+ return hoganUtils.render(baseTemplatesPath, 'column-line-number', {
+ diffParser: diffParser,
+ block: utils.escape(block.header)
+ });
+ };
+
+ LineByLinePrinter.prototype._generateFileHtml = function(file) {
+ var that = this;
+ return file.blocks.map(function(block) {
+
+ var lines = that.makeColumnLineNumberHtml(block);
+ var oldLines = [];
+ var newLines = [];
+
+ function processChangeBlock() {
+ var matches;
+ var insertType;
+ var deleteType;
+
+ var comparisons = oldLines.length * newLines.length;
+ var maxComparisons = that.config.matchingMaxComparisons || 2500;
+ var doMatching = comparisons < maxComparisons && (that.config.matching === 'lines' ||
+ that.config.matching === 'words');
+
+ if (doMatching) {
+ matches = matcher(oldLines, newLines);
+ insertType = diffParser.LINE_TYPE.INSERT_CHANGES;
+ deleteType = diffParser.LINE_TYPE.DELETE_CHANGES;
+ } else {
+ matches = [[oldLines, newLines]];
+ insertType = diffParser.LINE_TYPE.INSERTS;
+ deleteType = diffParser.LINE_TYPE.DELETES;
+ }
+
+ matches.forEach(function(match) {
+ oldLines = match[0];
+ newLines = match[1];
+
+ var processedOldLines = [];
+ var processedNewLines = [];
+
+ var common = Math.min(oldLines.length, newLines.length);
+
+ var oldLine, newLine;
+ for (var j = 0; j < common; j++) {
+ oldLine = oldLines[j];
+ newLine = newLines[j];
+
+ that.config.isCombined = file.isCombined;
+ var diff = printerUtils.diffHighlight(oldLine.content, newLine.content, that.config);
+
+ processedOldLines +=
+ that.makeLineHtml(deleteType, oldLine.oldNumber, oldLine.newNumber,
+ diff.first.line, diff.first.prefix);
+ processedNewLines +=
+ that.makeLineHtml(insertType, newLine.oldNumber, newLine.newNumber,
+ diff.second.line, diff.second.prefix);
+ }
+
+ lines += processedOldLines + processedNewLines;
+ lines += that._processLines(oldLines.slice(common), newLines.slice(common));
+ });
+
+ oldLines = [];
+ newLines = [];
+ }
+
+ for (var i = 0; i < block.lines.length; i++) {
+ var line = block.lines[i];
+ var escapedLine = utils.escape(line.content);
+
+ if (line.type !== diffParser.LINE_TYPE.INSERTS &&
+ (newLines.length > 0 || (line.type !== diffParser.LINE_TYPE.DELETES && oldLines.length > 0))) {
+ processChangeBlock();
+ }
+
+ if (line.type === diffParser.LINE_TYPE.CONTEXT) {
+ lines += that.makeLineHtml(line.type, line.oldNumber, line.newNumber, escapedLine);
+ } else if (line.type === diffParser.LINE_TYPE.INSERTS && !oldLines.length) {
+ lines += that.makeLineHtml(line.type, line.oldNumber, line.newNumber, escapedLine);
+ } else if (line.type === diffParser.LINE_TYPE.DELETES) {
+ oldLines.push(line);
+ } else if (line.type === diffParser.LINE_TYPE.INSERTS && Boolean(oldLines.length)) {
+ newLines.push(line);
+ } else {
+ console.error('Unknown state in html line-by-line generator');
+ processChangeBlock();
+ }
+ }
+
+ processChangeBlock();
+
+ return lines;
+ }).join('\n');
+ };
+
+ LineByLinePrinter.prototype._processLines = function(oldLines, newLines) {
+ var lines = '';
+
+ for (var i = 0; i < oldLines.length; i++) {
+ var oldLine = oldLines[i];
+ var oldEscapedLine = utils.escape(oldLine.content);
+ lines += this.makeLineHtml(oldLine.type, oldLine.oldNumber, oldLine.newNumber, oldEscapedLine);
+ }
+
+ for (var j = 0; j < newLines.length; j++) {
+ var newLine = newLines[j];
+ var newEscapedLine = utils.escape(newLine.content);
+ lines += this.makeLineHtml(newLine.type, newLine.oldNumber, newLine.newNumber, newEscapedLine);
+ }
+
+ return lines;
+ };
+
+ LineByLinePrinter.prototype.makeLineHtml = function(type, oldNumber, newNumber, content, prefix) {
+ return hoganUtils.render(baseTemplatesPath, 'line',
+ {
+ type: type,
+ oldNumber: utils.valueOrEmpty(oldNumber),
+ newNumber: utils.valueOrEmpty(newNumber),
+ prefix: prefix && utils.convertWhiteSpaceToNonBreakingSpace(prefix),
+ content: content && utils.convertWhiteSpaceToNonBreakingSpace(content)
+ });
+ };
+
+ LineByLinePrinter.prototype._generateEmptyDiff = function() {
+ return hoganUtils.render(baseTemplatesPath, 'empty-diff', {
+ diffParser: diffParser
+ });
+ };
+
+ module.exports.LineByLinePrinter = LineByLinePrinter;
+
+})();
+
+},{"./diff-parser.js":22,"./hoganjs-utils.js":25,"./printer-utils.js":28,"./rematch.js":29,"./utils.js":32}],28:[function(require,module,exports){
+/*
+ *
+ * PrinterUtils (printer-utils.js)
+ * Author: rtfpessoa
+ *
+ */
+
+(function() {
+
+ var jsDiff = require('diff');
+ var utils = require('./utils.js').Utils;
+ var Rematch = require('./rematch.js').Rematch;
+
+ function PrinterUtils() {
+ }
+
+ PrinterUtils.prototype.getHtmlId = function(file) {
+ var hashCode = function(text) {
+ var i, chr, len;
+ var hash = 0;
+
+ if (text.length === 0) {
+ return hash;
+ }
+
+ for (i = 0, len = text.length; i < len; i++) {
+ chr = text.charCodeAt(i);
+ hash = ((hash << 5) - hash) + chr;
+ hash |= 0; // Convert to 32bit integer
+ }
+
+ return hash;
+ };
+
+ return 'd2h-' + hashCode(this.getDiffName(file)).toString().slice(-6);
+ };
+
+ PrinterUtils.prototype.getDiffName = function(file) {
+ var oldFilename = file.oldName;
+ var newFilename = file.newName;
+
+ if (oldFilename && newFilename && oldFilename !== newFilename &&
+ !isDevNullName(oldFilename) && !isDevNullName(newFilename)) {
+ return oldFilename + ' -> ' + newFilename;
+ } else if (newFilename && !isDevNullName(newFilename)) {
+ return newFilename;
+ } else if (oldFilename) {
+ return oldFilename;
+ }
+
+ return 'Unknown filename';
+ };
+
+ PrinterUtils.prototype.diffHighlight = function(diffLine1, diffLine2, config) {
+ var linePrefix1, linePrefix2, unprefixedLine1, unprefixedLine2;
+
+ var prefixSize = 1;
+
+ if (config.isCombined) {
+ prefixSize = 2;
+ }
+
+ linePrefix1 = diffLine1.substr(0, prefixSize);
+ linePrefix2 = diffLine2.substr(0, prefixSize);
+ unprefixedLine1 = diffLine1.substr(prefixSize);
+ unprefixedLine2 = diffLine2.substr(prefixSize);
+
+ var diff;
+ if (config.charByChar) {
+ diff = jsDiff.diffChars(unprefixedLine1, unprefixedLine2);
+ } else {
+ diff = jsDiff.diffWordsWithSpace(unprefixedLine1, unprefixedLine2);
+ }
+
+ var highlightedLine = '';
+
+ var changedWords = [];
+ if (!config.charByChar && config.matching === 'words') {
+ var treshold = 0.25;
+
+ if (typeof (config.matchWordsThreshold) !== 'undefined') {
+ treshold = config.matchWordsThreshold;
+ }
+
+ var matcher = Rematch.rematch(function(a, b) {
+ var amod = a.value;
+ var bmod = b.value;
+
+ return Rematch.distance(amod, bmod);
+ });
+
+ var removed = diff.filter(function isRemoved(element) {
+ return element.removed;
+ });
+
+ var added = diff.filter(function isAdded(element) {
+ return element.added;
+ });
+
+ var chunks = matcher(added, removed);
+ chunks.forEach(function(chunk) {
+ if (chunk[0].length === 1 && chunk[1].length === 1) {
+ var dist = Rematch.distance(chunk[0][0].value, chunk[1][0].value);
+ if (dist < treshold) {
+ changedWords.push(chunk[0][0]);
+ changedWords.push(chunk[1][0]);
+ }
+ }
+ });
+ }
+
+ diff.forEach(function(part) {
+ var addClass = changedWords.indexOf(part) > -1 ? ' class="d2h-change"' : '';
+ var elemType = part.added ? 'ins' : part.removed ? 'del' : null;
+ var escapedValue = utils.escape(part.value);
+
+ if (elemType !== null) {
+ highlightedLine += '<' + elemType + addClass + '>' + escapedValue + '' + elemType + '>';
+ } else {
+ highlightedLine += escapedValue;
+ }
+ });
+
+ return {
+ first: {
+ prefix: linePrefix1,
+ line: removeIns(highlightedLine)
+ },
+ second: {
+ prefix: linePrefix2,
+ line: removeDel(highlightedLine)
+ }
+ };
+ };
+
+ function isDevNullName(name) {
+ return name.indexOf('dev/null') !== -1;
+ }
+
+ function removeIns(line) {
+ return line.replace(/(]*>((.|\n)*?)<\/ins>)/g, '');
+ }
+
+ function removeDel(line) {
+ return line.replace(/(]*>((.|\n)*?)<\/del>)/g, '');
+ }
+
+ module.exports.PrinterUtils = new PrinterUtils();
+
+})();
+
+},{"./rematch.js":29,"./utils.js":32,"diff":11}],29:[function(require,module,exports){
+/*
+ *
+ * Rematch (rematch.js)
+ * Matching two sequences of objects by similarity
+ * Author: W. Illmeyer, Nexxar GmbH
+ *
+ */
+
+(function() {
+
+ var Rematch = {};
+ Rematch.arrayToString = function arrayToString(a) {
+ if (Object.prototype.toString.apply(a, []) === "[object Array]") {
+ return "[" + a.map(arrayToString).join(", ") + "]";
+ } else {
+ return a;
+ }
+ };
+
+ /*
+ Copyright (c) 2011 Andrei Mackenzie
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
+ documentation files (the "Software"), to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
+ THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+ function levenshtein(a, b) {
+ if (a.length == 0) {
+ return b.length;
+ }
+ if (b.length == 0) {
+ return a.length;
+ }
+
+ var matrix = [];
+
+ // Increment along the first column of each row
+ var i;
+ for (i = 0; i <= b.length; i++) {
+ matrix[i] = [i];
+ }
+
+ // Increment each column in the first row
+ var j;
+ for (j = 0; j <= a.length; j++) {
+ matrix[0][j] = j;
+ }
+
+ // Fill in the rest of the matrix
+ for (i = 1; i <= b.length; i++) {
+ for (j = 1; j <= a.length; j++) {
+ if (b.charAt(i - 1) == a.charAt(j - 1)) {
+ matrix[i][j] = matrix[i - 1][j - 1];
+ } else {
+ matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // Substitution
+ Math.min(matrix[i][j - 1] + 1, // Insertion
+ matrix[i - 1][j] + 1)); // Deletion
+ }
+ }
+ }
+
+ return matrix[b.length][a.length];
+ }
+
+ Rematch.levenshtein = levenshtein;
+
+ Rematch.distance = function distance(x, y) {
+ x = x.trim();
+ y = y.trim();
+ var lev = levenshtein(x, y);
+ var score = lev / (x.length + y.length);
+
+ return score;
+ };
+
+ Rematch.rematch = function rematch(distanceFunction) {
+ function findBestMatch(a, b, cache) {
+ var cachecount = 0;
+
+ for (var key in cache) {
+ cachecount++;
+ }
+
+ var bestMatchDist = Infinity;
+ var bestMatch;
+ for (var i = 0; i < a.length; ++i) {
+ for (var j = 0; j < b.length; ++j) {
+ var cacheKey = JSON.stringify([a[i], b[j]]);
+ var md;
+ if (cache.hasOwnProperty(cacheKey)) {
+ md = cache[cacheKey];
+ } else {
+ md = distanceFunction(a[i], b[j]);
+ cache[cacheKey] = md;
+ }
+ if (md < bestMatchDist) {
+ bestMatchDist = md;
+ bestMatch = {indexA: i, indexB: j, score: bestMatchDist};
+ }
+ }
+ }
+
+ return bestMatch;
+ }
+
+ function group(a, b, level, cache) {
+ if (typeof (cache) === "undefined") {
+ cache = {};
+ }
+
+ var bm = findBestMatch(a, b, cache);
+
+ if (!level) {
+ level = 0;
+ }
+
+ if (!bm || (a.length + b.length < 3)) {
+ return [[a, b]];
+ }
+
+ var a1 = a.slice(0, bm.indexA);
+ var b1 = b.slice(0, bm.indexB);
+ var aMatch = [a[bm.indexA]];
+ var bMatch = [b[bm.indexB]];
+ var tailA = bm.indexA + 1;
+ var tailB = bm.indexB + 1;
+ var a2 = a.slice(tailA);
+ var b2 = b.slice(tailB);
+
+ var group1 = group(a1, b1, level + 1, cache);
+ var groupMatch = group(aMatch, bMatch, level + 1, cache);
+ var group2 = group(a2, b2, level + 1, cache);
+ var result = groupMatch;
+
+ if (bm.indexA > 0 || bm.indexB > 0) {
+ result = group1.concat(result);
+ }
+
+ if (a.length > tailA || b.length > tailB) {
+ result = result.concat(group2);
+ }
+
+ return result;
+ }
+
+ return group;
+ };
+
+ module.exports.Rematch = Rematch;
+
+})();
+
+},{}],30:[function(require,module,exports){
+/*
+ *
+ * HtmlPrinter (html-printer.js)
+ * Author: rtfpessoa
+ *
+ */
+
+(function() {
+
+ var diffParser = require('./diff-parser.js').DiffParser;
+ var printerUtils = require('./printer-utils.js').PrinterUtils;
+ var utils = require('./utils.js').Utils;
+ var Rematch = require('./rematch.js').Rematch;
+
+ var matcher = Rematch.rematch(function(a, b) {
+ var amod = a.content.substr(1);
+ var bmod = b.content.substr(1);
+
+ return Rematch.distance(amod, bmod);
+ });
+
+ function SideBySidePrinter(config) {
+ this.config = config;
+ }
+
+ SideBySidePrinter.prototype.makeDiffHtml = function(file, diffs) {
+ return '\n' +
+ ' \n' +
+ '
\n' +
+ '
\n' +
+ '
\n' +
+ '
\n' +
+ ' \n' +
+ ' ' + diffs.left +
+ ' \n' +
+ '
\n' +
+ '
\n' +
+ '
\n' +
+ '
\n' +
+ '
\n' +
+ '
\n' +
+ ' \n' +
+ ' ' + diffs.right +
+ ' \n' +
+ '
\n' +
+ '
\n' +
+ '
\n' +
+ '
\n' +
+ '
\n';
+ };
+
+ SideBySidePrinter.prototype.generateSideBySideJsonHtml = function(diffFiles) {
+ var that = this;
+ return '\n' +
+ diffFiles.map(function(file) {
+
+ var diffs;
+ if (file.blocks.length) {
+ diffs = that.generateSideBySideFileHtml(file);
+ } else {
+ diffs = that.generateEmptyDiff();
+ }
+
+ return that.makeDiffHtml(file, diffs);
+ }).join('\n') +
+ '
\n';
+ };
+
+ SideBySidePrinter.prototype.makeSideHtml = function(blockHeader) {
+ return '\n' +
+ ' | \n' +
+ ' \n' +
+ ' ' + blockHeader + ' \n' +
+ ' | \n' +
+ '
\n';
+ };
+
+ SideBySidePrinter.prototype.generateSideBySideFileHtml = function(file) {
+ var that = this;
+ var fileHtml = {};
+ fileHtml.left = '';
+ fileHtml.right = '';
+
+ file.blocks.forEach(function(block) {
+
+ fileHtml.left += that.makeSideHtml(utils.escape(block.header));
+ fileHtml.right += that.makeSideHtml('');
+
+ var oldLines = [];
+ var newLines = [];
+
+ function processChangeBlock() {
+ var matches;
+ var insertType;
+ var deleteType;
+
+ var comparisons = oldLines.length * newLines.length;
+ var maxComparisons = that.config.matchingMaxComparisons || 2500;
+ var doMatching = comparisons < maxComparisons && (that.config.matching === 'lines' ||
+ that.config.matching === 'words');
+
+ if (doMatching) {
+ matches = matcher(oldLines, newLines);
+ insertType = diffParser.LINE_TYPE.INSERT_CHANGES;
+ deleteType = diffParser.LINE_TYPE.DELETE_CHANGES;
+ } else {
+ matches = [[oldLines, newLines]];
+ insertType = diffParser.LINE_TYPE.INSERTS;
+ deleteType = diffParser.LINE_TYPE.DELETES;
+ }
+
+ matches.forEach(function(match) {
+ oldLines = match[0];
+ newLines = match[1];
+
+ var common = Math.min(oldLines.length, newLines.length);
+ var max = Math.max(oldLines.length, newLines.length);
+
+ for (var j = 0; j < common; j++) {
+ var oldLine = oldLines[j];
+ var newLine = newLines[j];
+
+ that.config.isCombined = file.isCombined;
+
+ var diff = printerUtils.diffHighlight(oldLine.content, newLine.content, that.config);
+
+ fileHtml.left +=
+ that.generateSingleLineHtml(deleteType, oldLine.oldNumber,
+ diff.first.line, diff.first.prefix);
+ fileHtml.right +=
+ that.generateSingleLineHtml(insertType, newLine.newNumber,
+ diff.second.line, diff.second.prefix);
+ }
+
+ if (max > common) {
+ var oldSlice = oldLines.slice(common);
+ var newSlice = newLines.slice(common);
+
+ var tmpHtml = that.processLines(oldSlice, newSlice);
+ fileHtml.left += tmpHtml.left;
+ fileHtml.right += tmpHtml.right;
+ }
+ });
+
+ oldLines = [];
+ newLines = [];
+ }
+
+ for (var i = 0; i < block.lines.length; i++) {
+ var line = block.lines[i];
+ var prefix = line.content[0];
+ var escapedLine = utils.escape(line.content.substr(1));
+
+ if (line.type !== diffParser.LINE_TYPE.INSERTS &&
+ (newLines.length > 0 || (line.type !== diffParser.LINE_TYPE.DELETES && oldLines.length > 0))) {
+ processChangeBlock();
+ }
+
+ if (line.type === diffParser.LINE_TYPE.CONTEXT) {
+ fileHtml.left += that.generateSingleLineHtml(line.type, line.oldNumber, escapedLine, prefix);
+ fileHtml.right += that.generateSingleLineHtml(line.type, line.newNumber, escapedLine, prefix);
+ } else if (line.type === diffParser.LINE_TYPE.INSERTS && !oldLines.length) {
+ fileHtml.left += that.generateSingleLineHtml(diffParser.LINE_TYPE.CONTEXT, '', '', '');
+ fileHtml.right += that.generateSingleLineHtml(line.type, line.newNumber, escapedLine, prefix);
+ } else if (line.type === diffParser.LINE_TYPE.DELETES) {
+ oldLines.push(line);
+ } else if (line.type === diffParser.LINE_TYPE.INSERTS && Boolean(oldLines.length)) {
+ newLines.push(line);
+ } else {
+ console.error('unknown state in html side-by-side generator');
+ processChangeBlock();
+ }
+ }
+
+ processChangeBlock();
+ });
+
+ return fileHtml;
+ };
+
+ SideBySidePrinter.prototype.processLines = function(oldLines, newLines) {
+ var that = this;
+ var fileHtml = {};
+ fileHtml.left = '';
+ fileHtml.right = '';
+
+ var maxLinesNumber = Math.max(oldLines.length, newLines.length);
+ for (var i = 0; i < maxLinesNumber; i++) {
+ var oldLine = oldLines[i];
+ var newLine = newLines[i];
+ var oldContent;
+ var newContent;
+ var oldPrefix;
+ var newPrefix;
+
+ if (oldLine) {
+ oldContent = utils.escape(oldLine.content.substr(1));
+ oldPrefix = oldLine.content[0];
+ }
+
+ if (newLine) {
+ newContent = utils.escape(newLine.content.substr(1));
+ newPrefix = newLine.content[0];
+ }
+
+ if (oldLine && newLine) {
+ fileHtml.left += that.generateSingleLineHtml(oldLine.type, oldLine.oldNumber, oldContent, oldPrefix);
+ fileHtml.right += that.generateSingleLineHtml(newLine.type, newLine.newNumber, newContent, newPrefix);
+ } else if (oldLine) {
+ fileHtml.left += that.generateSingleLineHtml(oldLine.type, oldLine.oldNumber, oldContent, oldPrefix);
+ fileHtml.right += that.generateSingleLineHtml(diffParser.LINE_TYPE.CONTEXT, '', '', '');
+ } else if (newLine) {
+ fileHtml.left += that.generateSingleLineHtml(diffParser.LINE_TYPE.CONTEXT, '', '', '');
+ fileHtml.right += that.generateSingleLineHtml(newLine.type, newLine.newNumber, newContent, newPrefix);
+ } else {
+ console.error('How did it get here?');
+ }
+ }
+
+ return fileHtml;
+ };
+
+ SideBySidePrinter.prototype.makeSingleLineHtml = function(type, number, htmlContent, htmlPrefix) {
+ return '\n' +
+ ' | ' + number + ' | \n' +
+ ' ' +
+ ' ' + htmlPrefix + htmlContent + ' ' +
+ ' | \n' +
+ '
\n';
+ };
+
+ SideBySidePrinter.prototype.generateSingleLineHtml = function(type, number, content, prefix) {
+ var htmlPrefix = '';
+ if (prefix) {
+ htmlPrefix = '' + prefix + '';
+ }
+
+ var htmlContent = '';
+ if (content) {
+ htmlContent = '' + content + '';
+ }
+
+ return this.makeSingleLineHtml(type, number, htmlContent, htmlPrefix);
+ };
+
+ SideBySidePrinter.prototype.generateEmptyDiff = function() {
+ var fileHtml = {};
+ fileHtml.right = '';
+
+ fileHtml.left = '\n' +
+ ' | ' +
+ ' ' +
+ 'File without changes' +
+ ' ' +
+ ' | \n' +
+ '
\n';
+
+ return fileHtml;
+ };
+
+ module.exports.SideBySidePrinter = SideBySidePrinter;
+
+})();
+
+},{"./diff-parser.js":22,"./printer-utils.js":28,"./rematch.js":29,"./utils.js":32}],31:[function(require,module,exports){
+(function (global){
+(function() {
+if (!!!global.browserTemplates) global.browserTemplates = {};
+global.browserTemplates["line-by-line-column-line-number"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("");t.b("\n" + i);t.b(" | ");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" ");t.b(t.t(t.f("blockHeader",c,p,0)));t.b(" ");t.b("\n" + i);t.b(" | ");t.b("\n" + i);t.b("
");return t.fl(); },partials: {}, subs: { }});
+global.browserTemplates["line-by-line-empty-diff"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("");t.b("\n" + i);t.b(" | ");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" File without changes");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" | ");t.b("\n" + i);t.b("
");return t.fl(); },partials: {}, subs: { }});
+global.browserTemplates["line-by-line-file-diff"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" ");t.b(t.t(t.f("diffs",c,p,0)));t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");t.b("\n" + i);t.b("
");return t.fl(); },partials: {}, subs: { }});
+global.browserTemplates["line-by-line-line"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("");t.b("\n" + i);t.b(" | ");t.b("\n" + i);t.b(" ");t.b(t.v(t.f("oldNumber",c,p,0)));t.b(" ");t.b("\n" + i);t.b(" ");t.b(t.v(t.f("newNumber",c,p,0)));t.b(" ");t.b("\n" + i);t.b(" | ");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" ");t.b("\n" + i);if(t.s(t.f("prefix",c,p,1),c,p,0,253,329,"{{ }}")){t.rs(c,p,function(c,p,t){t.b(" ");t.b(t.t(t.f("prefix",c,p,0)));t.b("");t.b("\n" + i);});c.pop();}if(t.s(t.f("content",c,p,1),c,p,0,361,435,"{{ }}")){t.rs(c,p,function(c,p,t){t.b(" ");t.b(t.t(t.f("content",c,p,0)));t.b("");t.b("\n" + i);});c.pop();}t.b(" ");t.b("\n" + i);t.b(" | ");t.b("\n" + i);t.b("
");return t.fl(); },partials: {}, subs: { }});
+global.browserTemplates["line-by-line-wrapper"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("");t.b("\n" + i);t.b(" ");t.b(t.t(t.f("content",c,p,0)));t.b("\n" + i);t.b("
");return t.fl(); },partials: {}, subs: { }});
+module.exports = global.browserTemplates;
+})();
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{}],32:[function(require,module,exports){
+/*
+ *
+ * Utils (utils.js)
+ * Author: rtfpessoa
+ *
+ */
+
+(function() {
+
+ function Utils() {
+ }
+
+ Utils.prototype.convertWhiteSpaceToNonBreakingSpace = function(str) {
+ return str.slice(0).replace(/ /g, ' ');
+ };
+
+ Utils.prototype.escape = function(str) {
+ return str.slice(0)
+ .replace(/&/g, '&')
+ .replace(//g, '>')
+ .replace(/\t/g, ' ');
+ };
+
+ Utils.prototype.startsWith = function(str, start) {
+ if (typeof start === 'object') {
+ var result = false;
+ start.forEach(function(s) {
+ if (str.indexOf(s) === 0) {
+ result = true;
+ }
+ });
+
+ return result;
+ }
+
+ return str.indexOf(start) === 0;
+ };
+
+ Utils.prototype.valueOrEmpty = function(value) {
+ return value ? value : '';
+ };
+
+ module.exports.Utils = new Utils();
+
+})();
+
+},{}]},{},[23]);
diff --git a/dist/diff2html.min.js b/dist/diff2html.min.js
index b2f746a..7541f65 100644
--- a/dist/diff2html.min.js
+++ b/dist/diff2html.min.js
@@ -1,3 +1,5 @@
-!function(modules){function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={exports:{},id:moduleId,loaded:!1};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.loaded=!0,module.exports}var installedModules={};return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.p="",__webpack_require__(0)}([function(module,exports,__webpack_require__){(function(global){!function(){function Diff2Html(){}var diffParser=__webpack_require__(1).DiffParser,fileLister=__webpack_require__(3).FileListPrinter,htmlPrinter=__webpack_require__(21).HtmlPrinter;Diff2Html.prototype.getJsonFromDiff=function(diffInput,config){var configOrEmpty=config||{};return diffParser.generateDiffJson(diffInput,configOrEmpty)},Diff2Html.prototype.getPrettyHtml=function(diffInput,config){var configOrEmpty=config||{},diffJson=diffInput;configOrEmpty.inputFormat&&"diff"!==configOrEmpty.inputFormat||(diffJson=diffParser.generateDiffJson(diffInput,configOrEmpty));var fileList="";configOrEmpty.showFiles===!0&&(fileList=fileLister.generateFileList(diffJson,configOrEmpty));var diffOutput="";return diffOutput="side-by-side"===configOrEmpty.outputFormat?htmlPrinter.generateSideBySideJsonHtml(diffJson,configOrEmpty):htmlPrinter.generateLineByLineJsonHtml(diffJson,configOrEmpty),fileList+diffOutput},Diff2Html.prototype.getPrettyHtmlFromDiff=function(diffInput,config){var configOrEmpty=config||{};return configOrEmpty.inputFormat="diff",configOrEmpty.outputFormat="line-by-line",this.getPrettyHtml(diffInput,configOrEmpty)},Diff2Html.prototype.getPrettyHtmlFromJson=function(diffJson,config){var configOrEmpty=config||{};return configOrEmpty.inputFormat="json",configOrEmpty.outputFormat="line-by-line",this.getPrettyHtml(diffJson,configOrEmpty)},Diff2Html.prototype.getPrettySideBySideHtmlFromDiff=function(diffInput,config){var configOrEmpty=config||{};return configOrEmpty.inputFormat="diff",configOrEmpty.outputFormat="side-by-side",this.getPrettyHtml(diffInput,configOrEmpty)},Diff2Html.prototype.getPrettySideBySideHtmlFromJson=function(diffJson,config){var configOrEmpty=config||{};return configOrEmpty.inputFormat="json",configOrEmpty.outputFormat="side-by-side",this.getPrettyHtml(diffJson,configOrEmpty)};var diffObject=new Diff2Html;module.exports.Diff2Html=diffObject,global.Diff2Html=diffObject}()}).call(exports,function(){return this}())},function(module,exports,__webpack_require__){!function(){function DiffParser(){}function getExtension(filename,language){var nameSplit=filename.split(".");return nameSplit.length>1?nameSplit[nameSplit.length-1]:language}function getSrcFilename(line,cfg){var prefixes=["a/","i/","w/","c/","o/"];return cfg.srcPrefix&&prefixes.push(cfg.srcPrefix),_getFilename("---",line,prefixes)}function getDstFilename(line,cfg){var prefixes=["b/","i/","w/","c/","o/"];return cfg.dstPrefix&&prefixes.push(cfg.dstPrefix),_getFilename("\\+\\+\\+",line,prefixes)}function _getFilename(linePrefix,line,prefixes){var filename,FilenameRegExp=new RegExp("^"+linePrefix+' "?(.+?)"?$'),values=FilenameRegExp.exec(line);if(values&&values[1]){filename=values[1];var matchingPrefixes=prefixes.filter(function(p){return 0===filename.indexOf(p)});matchingPrefixes[0]&&(filename=filename.slice(matchingPrefixes[0].length))}return filename}var utils=__webpack_require__(2).Utils,LINE_TYPE={INSERTS:"d2h-ins",DELETES:"d2h-del",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change",CONTEXT:"d2h-cntx",INFO:"d2h-info"};DiffParser.prototype.LINE_TYPE=LINE_TYPE,DiffParser.prototype.generateDiffJson=function(diffInput,config){var files=[],currentFile=null,currentBlock=null,oldLine=null,newLine=null,saveBlock=function(){currentBlock&&(currentFile.blocks.push(currentBlock),currentBlock=null)},saveFile=function(){currentFile&¤tFile.newName&&(files.push(currentFile),currentFile=null)},startFile=function(){saveBlock(),saveFile(),currentFile={},currentFile.blocks=[],currentFile.deletedLines=0,currentFile.addedLines=0},startBlock=function(line){saveBlock();var values;(values=/^@@ -(\d+),\d+ \+(\d+),\d+ @@.*/.exec(line))?currentFile.isCombined=!1:(values=/^@@@ -(\d+),\d+ -\d+,\d+ \+(\d+),\d+ @@@.*/.exec(line))?currentFile.isCombined=!0:(values=[0,0],currentFile.isCombined=!1),oldLine=values[1],newLine=values[2],currentBlock={},currentBlock.lines=[],currentBlock.oldStartLine=oldLine,currentBlock.newStartLine=newLine,currentBlock.header=line},createLine=function(line){var currentLine={};currentLine.content=line;var newLinePrefixes=currentFile.isCombined?["+"," +"]:["+"],delLinePrefixes=currentFile.isCombined?["-"," -"]:["-"];utils.startsWith(line,newLinePrefixes)?(currentFile.addedLines++,currentLine.type=LINE_TYPE.INSERTS,currentLine.oldNumber=null,currentLine.newNumber=newLine++,currentBlock.lines.push(currentLine)):utils.startsWith(line,delLinePrefixes)?(currentFile.deletedLines++,currentLine.type=LINE_TYPE.DELETES,currentLine.oldNumber=oldLine++,currentLine.newNumber=null,currentBlock.lines.push(currentLine)):(currentLine.type=LINE_TYPE.CONTEXT,currentLine.oldNumber=oldLine++,currentLine.newNumber=newLine++,currentBlock.lines.push(currentLine))},diffLines=diffInput.replace(/\\ No newline at end of file/g,"").replace(/\r\n?/g,"\n").split("\n"),oldMode=/^old mode (\d{6})/,newMode=/^new mode (\d{6})/,deletedFileMode=/^deleted file mode (\d{6})/,newFileMode=/^new file mode (\d{6})/,copyFrom=/^copy from "?(.+?)"?/,copyTo=/^copy to "?(.+?)"?/,renameFrom=/^rename from "?(.+?)"?/,renameTo=/^rename to "?(.+?)"?/,similarityIndex=/^similarity index (\d+)%/,dissimilarityIndex=/^dissimilarity index (\d+)%/,index=/^index ([0-9a-z]+)..([0-9a-z]+) (\d{6})?/,combinedIndex=/^index ([0-9a-z]+),([0-9a-z]+)..([0-9a-z]+)/,combinedMode=/^mode (\d{6}),(\d{6})..(\d{6})/,combinedNewFile=/^new file mode (\d{6})/,combinedDeletedFile=/^deleted file mode (\d{6}),(\d{6})/;return diffLines.forEach(function(line){if(line&&!utils.startsWith(line,"*")){var values=[];utils.startsWith(line,"diff")?startFile():currentFile&&!currentFile.oldName&&(values=getSrcFilename(line,config))?(currentFile.oldName=values,currentFile.language=getExtension(currentFile.oldName,currentFile.language)):currentFile&&!currentFile.newName&&(values=getDstFilename(line,config))?(currentFile.newName=values,currentFile.language=getExtension(currentFile.newName,currentFile.language)):currentFile&&utils.startsWith(line,"@@")?startBlock(line):(values=oldMode.exec(line))?currentFile.oldMode=values[1]:(values=newMode.exec(line))?currentFile.newMode=values[1]:(values=deletedFileMode.exec(line))?currentFile.deletedFileMode=values[1]:(values=newFileMode.exec(line))?currentFile.newFileMode=values[1]:(values=copyFrom.exec(line))?(currentFile.oldName=values[1],currentFile.isCopy=!0):(values=copyTo.exec(line))?(currentFile.newName=values[1],currentFile.isCopy=!0):(values=renameFrom.exec(line))?(currentFile.oldName=values[1],currentFile.isRename=!0):(values=renameTo.exec(line))?(currentFile.newName=values[1],currentFile.isRename=!0):(values=similarityIndex.exec(line))?currentFile.unchangedPercentage=values[1]:(values=dissimilarityIndex.exec(line))?currentFile.changedPercentage=values[1]:(values=index.exec(line))?(currentFile.checksumBefore=values[1],currentFile.checksumAfter=values[2],values[2]&&(currentFile.mode=values[3])):(values=combinedIndex.exec(line))?(currentFile.checksumBefore=[values[2],values[3]],currentFile.checksumAfter=values[1]):(values=combinedMode.exec(line))?(currentFile.oldMode=[values[2],values[3]],currentFile.newMode=values[1]):(values=combinedNewFile.exec(line))?currentFile.newFileMode=values[1]:(values=combinedDeletedFile.exec(line))?currentFile.deletedFileMode=values[1]:currentBlock&&createLine(line)}}),saveBlock(),saveFile(),files},module.exports.DiffParser=new DiffParser}()},function(module){!function(){function Utils(){}Utils.prototype.convertWhiteSpaceToNonBreakingSpace=function(str){return str.slice(0).replace(/ /g," ")},Utils.prototype.escape=function(str){return str.slice(0).replace(/&/g,"&").replace(//g,">").replace(/\t/g," ")},Utils.prototype.startsWith=function(str,start){if("object"==typeof start){var result=!1;return start.forEach(function(s){0===str.indexOf(s)&&(result=!0)}),result}return 0===str.indexOf(start)},Utils.prototype.valueOrEmpty=function(value){return value?value:""},module.exports.Utils=new Utils}()},function(module,exports,__webpack_require__){!function(){function FileListPrinter(){}var printerUtils=__webpack_require__(4).PrinterUtils;FileListPrinter.prototype.generateFileList=function(diffFiles){return'\n"},module.exports.FileListPrinter=new FileListPrinter}()},function(module,exports,__webpack_require__){!function(){function PrinterUtils(){}function isDevNullName(name){return-1!==name.indexOf("dev/null")}function removeIns(line){return line.replace(/(]*>((.|\n)*?)<\/ins>)/g,"")}function removeDel(line){return line.replace(/(]*>((.|\n)*?)<\/del>)/g,"")}var jsDiff=__webpack_require__(5),utils=__webpack_require__(2).Utils,Rematch=__webpack_require__(20).Rematch;PrinterUtils.prototype.getHtmlId=function(file){var hashCode=function(text){var i,chr,len,hash=0;if(0===text.length)return hash;for(i=0,len=text.length;len>i;i++)chr=text.charCodeAt(i),hash=(hash<<5)-hash+chr,hash|=0;return hash};return"d2h-"+hashCode(this.getDiffName(file)).toString().slice(-6)},PrinterUtils.prototype.getDiffName=function(file){var oldFilename=file.oldName,newFilename=file.newName;return oldFilename&&newFilename&&oldFilename!==newFilename&&!isDevNullName(oldFilename)&&!isDevNullName(newFilename)?oldFilename+" -> "+newFilename:newFilename&&!isDevNullName(newFilename)?newFilename:oldFilename?oldFilename:"Unknown filename"},PrinterUtils.prototype.diffHighlight=function(diffLine1,diffLine2,config){var linePrefix1,linePrefix2,unprefixedLine1,unprefixedLine2,prefixSize=1;config.isCombined&&(prefixSize=2),linePrefix1=diffLine1.substr(0,prefixSize),linePrefix2=diffLine2.substr(0,prefixSize),unprefixedLine1=diffLine1.substr(prefixSize),unprefixedLine2=diffLine2.substr(prefixSize);var diff;diff=config.charByChar?jsDiff.diffChars(unprefixedLine1,unprefixedLine2):jsDiff.diffWordsWithSpace(unprefixedLine1,unprefixedLine2);var highlightedLine="",changedWords=[];if(!config.charByChar&&"words"===config.matching){var treshold=.25;"undefined"!=typeof config.matchWordsThreshold&&(treshold=config.matchWordsThreshold);var matcher=Rematch.rematch(function(a,b){var amod=a.value,bmod=b.value;return Rematch.distance(amod,bmod)}),removed=diff.filter(function(element){return element.removed}),added=diff.filter(function(element){return element.added}),chunks=matcher(added,removed);chunks.forEach(function(chunk){if(1===chunk[0].length&&1===chunk[1].length){var dist=Rematch.distance(chunk[0][0].value,chunk[1][0].value);treshold>dist&&(changedWords.push(chunk[0][0]),changedWords.push(chunk[1][0]))}})}return diff.forEach(function(part){var addClass=changedWords.indexOf(part)>-1?' class="d2h-change"':"",elemType=part.added?"ins":part.removed?"del":null,escapedValue=utils.escape(part.value);highlightedLine+=null!==elemType?"<"+elemType+addClass+">"+escapedValue+""+elemType+">":escapedValue}),{first:{prefix:linePrefix1,line:removeIns(highlightedLine)},second:{prefix:linePrefix2,line:removeDel(highlightedLine)}}},module.exports.PrinterUtils=new PrinterUtils}()},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}exports.__esModule=!0,exports.canonicalize=exports.convertChangesToXML=exports.convertChangesToDMP=exports.parsePatch=exports.applyPatches=exports.applyPatch=exports.createPatch=exports.createTwoFilesPatch=exports.structuredPatch=exports.diffJson=exports.diffCss=exports.diffSentences=exports.diffTrimmedLines=exports.diffLines=exports.diffWordsWithSpace=exports.diffWords=exports.diffChars=exports.Diff=void 0;var _base=__webpack_require__(6),_base2=_interopRequireDefault(_base),_character=__webpack_require__(7),_word=__webpack_require__(8),_line=__webpack_require__(10),_sentence=__webpack_require__(11),_css=__webpack_require__(12),_json=__webpack_require__(13),_apply=__webpack_require__(14),_parse=__webpack_require__(15),_create=__webpack_require__(17),_dmp=__webpack_require__(18),_xml=__webpack_require__(19);exports.Diff=_base2["default"],exports.diffChars=_character.diffChars,exports.diffWords=_word.diffWords,exports.diffWordsWithSpace=_word.diffWordsWithSpace,exports.diffLines=_line.diffLines,exports.diffTrimmedLines=_line.diffTrimmedLines,exports.diffSentences=_sentence.diffSentences,exports.diffCss=_css.diffCss,exports.diffJson=_json.diffJson,exports.structuredPatch=_create.structuredPatch,exports.createTwoFilesPatch=_create.createTwoFilesPatch,exports.createPatch=_create.createPatch,exports.applyPatch=_apply.applyPatch,exports.applyPatches=_apply.applyPatches,exports.parsePatch=_parse.parsePatch,exports.convertChangesToDMP=_dmp.convertChangesToDMP,exports.convertChangesToXML=_xml.convertChangesToXML,exports.canonicalize=_json.canonicalize},function(module,exports){"use strict";function Diff(){}function buildValues(diff,components,newString,oldString,useLongestToken){for(var componentPos=0,componentLen=components.length,newPos=0,oldPos=0;componentLen>componentPos;componentPos++){var component=components[componentPos];if(component.removed){if(component.value=oldString.slice(oldPos,oldPos+component.count).join(""),oldPos+=component.count,componentPos&&components[componentPos-1].added){var tmp=components[componentPos-1];components[componentPos-1]=components[componentPos],components[componentPos]=tmp}}else{if(!component.added&&useLongestToken){var value=newString.slice(newPos,newPos+component.count);value=value.map(function(value,i){var oldValue=oldString[oldPos+i];return oldValue.length>value.length?oldValue:value}),component.value=value.join("")}else component.value=newString.slice(newPos,newPos+component.count).join("");newPos+=component.count,component.added||(oldPos+=component.count)}}var lastComponent=components[componentLen-1];return componentLen>1&&(lastComponent.added||lastComponent.removed)&&diff.equals("",lastComponent.value)&&(components[componentLen-2].value+=lastComponent.value,components.pop()),components}function clonePath(path){return{newPos:path.newPos,components:path.components.slice(0)}}exports.__esModule=!0,exports["default"]=Diff,Diff.prototype={diff:function(oldString,newString){function done(value){return callback?(setTimeout(function(){callback(void 0,value)},0),!0):value}function execEditLength(){for(var diagonalPath=-1*editLength;editLength>=diagonalPath;diagonalPath+=2){var basePath=void 0,addPath=bestPath[diagonalPath-1],removePath=bestPath[diagonalPath+1],_oldPos=(removePath?removePath.newPos:0)-diagonalPath;addPath&&(bestPath[diagonalPath-1]=void 0);var canAdd=addPath&&addPath.newPos+1=0&&oldLen>_oldPos;if(canAdd||canRemove){if(!canAdd||canRemove&&addPath.newPos=newLen&&_oldPos+1>=oldLen)return done(buildValues(self,basePath.components,newString,oldString,self.useLongestToken));bestPath[diagonalPath]=basePath}else bestPath[diagonalPath]=void 0}editLength++}var options=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],callback=options.callback;"function"==typeof options&&(callback=options,options={}),this.options=options;var self=this;oldString=this.castInput(oldString),newString=this.castInput(newString),oldString=this.removeEmpty(this.tokenize(oldString)),newString=this.removeEmpty(this.tokenize(newString));var newLen=newString.length,oldLen=oldString.length,editLength=1,maxEditLength=newLen+oldLen,bestPath=[{newPos:-1,components:[]}],oldPos=this.extractCommon(bestPath[0],newString,oldString,0);if(bestPath[0].newPos+1>=newLen&&oldPos+1>=oldLen)return done([{value:newString.join(""),count:newString.length}]);if(callback)!function exec(){setTimeout(function(){return editLength>maxEditLength?callback():void(execEditLength()||exec())},0)}();else for(;maxEditLength>=editLength;){var ret=execEditLength();if(ret)return ret}},pushComponent:function(components,added,removed){var last=components[components.length-1];last&&last.added===added&&last.removed===removed?components[components.length-1]={count:last.count+1,added:added,removed:removed}:components.push({count:1,added:added,removed:removed})},extractCommon:function(basePath,newString,oldString,diagonalPath){for(var newLen=newString.length,oldLen=oldString.length,newPos=basePath.newPos,oldPos=newPos-diagonalPath,commonCount=0;newLen>newPos+1&&oldLen>oldPos+1&&this.equals(newString[newPos+1],oldString[oldPos+1]);)newPos++,oldPos++,commonCount++;return commonCount&&basePath.components.push({count:commonCount}),basePath.newPos=newPos,oldPos},equals:function(left,right){return left===right},removeEmpty:function(array){for(var ret=[],i=0;ifuzzFactor))return!1;toPos++}}return!0}var options=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if("string"==typeof uniDiff&&(uniDiff=_parse.parsePatch(uniDiff)),Array.isArray(uniDiff)){if(uniDiff.length>1)throw new Error("applyPatch only works with a single input.");uniDiff=uniDiff[0]}for(var lines=source.split("\n"),hunks=uniDiff.hunks,compareLine=options.compareLine||function(lineNumber,line,operation,patchContent){return line===patchContent},errorCount=0,fuzzFactor=options.fuzzFactor||0,minLine=0,offset=0,removeEOFNL=void 0,addEOFNL=void 0,i=0;i=start+localOffset)return localOffset;forwardExhausted=!0}return backwardExhausted?void 0:(forwardExhausted||(wantForward=!0),start-localOffset>=minLine?-localOffset++:(backwardExhausted=!0,iterator()))}}},function(module,exports,__webpack_require__){"use strict";function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i0?contextLines(prev.lines.slice(-options.context)):[],oldRangeStart-=curRange.length,newRangeStart-=curRange.length)}(_curRange=curRange).push.apply(_curRange,_toConsumableArray(lines.map(function(entry){return(current.added?"+":"-")+entry}))),current.added?newLine+=lines.length:oldLine+=lines.length}else{if(oldRangeStart)if(lines.length<=2*options.context&&i=diff.length-2&&lines.length<=options.context){var oldEOFNewline=/\n$/.test(oldStr),newEOFNewline=/\n$/.test(newStr);0!=lines.length||oldEOFNewline?oldEOFNewline&&newEOFNewline||curRange.push("\\ No newline at end of file"):curRange.splice(hunk.oldLines,0,"\\ No newline at end of file")}hunks.push(hunk),oldRangeStart=0,newRangeStart=0,curRange=[]}oldLine+=lines.length,newLine+=lines.length}},i=0;i"):change.removed&&ret.push(""),ret.push(escapeHTML(change.value)),change.added?ret.push(""):change.removed&&ret.push("")}return ret.join("")}function escapeHTML(s){var n=s;return n=n.replace(/&/g,"&"),n=n.replace(//g,">"),n=n.replace(/"/g,""")}exports.__esModule=!0,exports.convertChangesToXML=convertChangesToXML},function(module){!function(){function levenshtein(a,b){if(0==a.length)return b.length;if(0==b.length)return a.length;var i,matrix=[];for(i=0;i<=b.length;i++)matrix[i]=[i];var j;for(j=0;j<=a.length;j++)matrix[0][j]=j;for(i=1;i<=b.length;i++)for(j=1;j<=a.length;j++)matrix[i][j]=b.charAt(i-1)==a.charAt(j-1)?matrix[i-1][j-1]:Math.min(matrix[i-1][j-1]+1,Math.min(matrix[i][j-1]+1,matrix[i-1][j]+1));return matrix[b.length][a.length]}var Rematch={};Rematch.arrayToString=function arrayToString(a){return"[object Array]"===Object.prototype.toString.apply(a,[])?"["+a.map(arrayToString).join(", ")+"]":a},Rematch.levenshtein=levenshtein,Rematch.distance=function(x,y){x=x.trim(),y=y.trim();var lev=levenshtein(x,y),score=lev/(x.length+y.length);return score},Rematch.rematch=function(distanceFunction){function findBestMatch(a,b,cache){var cachecount=0;for(var key in cache)cachecount++;for(var bestMatch,bestMatchDist=1/0,i=0;imd&&(bestMatchDist=md,bestMatch={indexA:i,indexB:j,score:bestMatchDist})}return bestMatch}function group(a,b,level,cache){"undefined"==typeof cache&&(cache={});var bm=findBestMatch(a,b,cache);if(level||(level=0),!bm||a.length+b.length<3)return[[a,b]];var a1=a.slice(0,bm.indexA),b1=b.slice(0,bm.indexB),aMatch=[a[bm.indexA]],bMatch=[b[bm.indexB]],tailA=bm.indexA+1,tailB=bm.indexB+1,a2=a.slice(tailA),b2=b.slice(tailB),group1=group(a1,b1,level+1,cache),groupMatch=group(aMatch,bMatch,level+1,cache),group2=group(a2,b2,level+1,cache),result=groupMatch;return(bm.indexA>0||bm.indexB>0)&&(result=group1.concat(result)),(a.length>tailA||b.length>tailB)&&(result=result.concat(group2)),result}return group},module.exports.Rematch=Rematch}()},function(module,exports,__webpack_require__){!function(){function HtmlPrinter(){}var LineByLinePrinter=__webpack_require__(22).LineByLinePrinter,SideBySidePrinter=__webpack_require__(39).SideBySidePrinter;HtmlPrinter.prototype.generateLineByLineJsonHtml=function(diffFiles,config){var lineByLinePrinter=new LineByLinePrinter(config);return lineByLinePrinter.generateLineByLineJsonHtml(diffFiles)},HtmlPrinter.prototype.generateSideBySideJsonHtml=function(diffFiles,config){var sideBySidePrinter=new SideBySidePrinter(config);return sideBySidePrinter.generateSideBySideJsonHtml(diffFiles)},module.exports.HtmlPrinter=new HtmlPrinter}()},function(module,exports,__webpack_require__){!function(){function LineByLinePrinter(config){this.config=config}var diffParser=__webpack_require__(1).DiffParser,printerUtils=__webpack_require__(4).PrinterUtils,utils=__webpack_require__(2).Utils,Rematch=__webpack_require__(20).Rematch,nunjucksUtils=__webpack_require__(23).NunjucksUtils,baseTemplatesPath="line-by-line";LineByLinePrinter.prototype.makeFileDiffHtml=function(file,diffs){return nunjucksUtils.render(baseTemplatesPath,"file-diff.html",{file:file,diffs:diffs})},LineByLinePrinter.prototype.makeLineByLineHtmlWrapper=function(content){return nunjucksUtils.render(baseTemplatesPath,"wrapper.html",{content:content})},LineByLinePrinter.prototype.generateLineByLineJsonHtml=function(diffFiles){var that=this,htmlDiffs=diffFiles.map(function(file){var diffs;return diffs=file.blocks.length?that._generateFileHtml(file):that._generateEmptyDiff(),that.makeFileDiffHtml(file,diffs)});return this.makeLineByLineHtmlWrapper(htmlDiffs.join("\n"))};var matcher=Rematch.rematch(function(a,b){var amod=a.content.substr(1),bmod=b.content.substr(1);return Rematch.distance(amod,bmod)});LineByLinePrinter.prototype.makeColumnLineNumberHtml=function(block){return nunjucksUtils.render(baseTemplatesPath,"column-line-number.html",{block:block})},LineByLinePrinter.prototype._generateFileHtml=function(file){var that=this;return file.blocks.map(function(block){function processChangeBlock(){var matches,insertType,deleteType,comparisons=oldLines.length*newLines.length,maxComparisons=that.config.matchingMaxComparisons||2500,doMatching=maxComparisons>comparisons&&("lines"===that.config.matching||"words"===that.config.matching);doMatching?(matches=matcher(oldLines,newLines),insertType=diffParser.LINE_TYPE.INSERT_CHANGES,deleteType=diffParser.LINE_TYPE.DELETE_CHANGES):(matches=[[oldLines,newLines]],insertType=diffParser.LINE_TYPE.INSERTS,deleteType=diffParser.LINE_TYPE.DELETES),matches.forEach(function(match){oldLines=match[0],newLines=match[1];for(var oldLine,newLine,processedOldLines=[],processedNewLines=[],common=Math.min(oldLines.length,newLines.length),j=0;common>j;j++){oldLine=oldLines[j],newLine=newLines[j],that.config.isCombined=file.isCombined;var diff=printerUtils.diffHighlight(oldLine.content,newLine.content,that.config);processedOldLines+=that.makeLineHtml(deleteType,oldLine.oldNumber,oldLine.newNumber,diff.first.line,diff.first.prefix),processedNewLines+=that.makeLineHtml(insertType,newLine.oldNumber,newLine.newNumber,diff.second.line,diff.second.prefix)}lines+=processedOldLines+processedNewLines,lines+=that._processLines(oldLines.slice(common),newLines.slice(common))}),oldLines=[],newLines=[]}for(var lines=that.makeColumnLineNumberHtml(block),oldLines=[],newLines=[],i=0;i0||line.type!==diffParser.LINE_TYPE.DELETES&&oldLines.length>0)&&processChangeBlock(),line.type===diffParser.LINE_TYPE.CONTEXT?lines+=that.makeLineHtml(line.type,line.oldNumber,line.newNumber,escapedLine):line.type!==diffParser.LINE_TYPE.INSERTS||oldLines.length?line.type===diffParser.LINE_TYPE.DELETES?oldLines.push(line):line.type===diffParser.LINE_TYPE.INSERTS&&Boolean(oldLines.length)?newLines.push(line):(console.error("Unknown state in html line-by-line generator"),processChangeBlock()):lines+=that.makeLineHtml(line.type,line.oldNumber,line.newNumber,escapedLine)}return processChangeBlock(),lines}).join("\n")},LineByLinePrinter.prototype._processLines=function(oldLines,newLines){for(var lines="",i=0;i=0;i--){var last=parts[i];"."===last?parts.splice(i,1):".."===last?(parts.splice(i,1),up++):up&&(parts.splice(i,1),up--)}if(allowAboveRoot)for(;up--;up)parts.unshift("..");return parts}function filter(xs,f){if(xs.filter)return xs.filter(f);for(var res=[],i=0;i=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:process.cwd();if("string"!=typeof path)throw new TypeError("Arguments to path.resolve must be strings");path&&(resolvedPath=path+"/"+resolvedPath,resolvedAbsolute="/"===path.charAt(0))}return resolvedPath=normalizeArray(filter(resolvedPath.split("/"),function(p){return!!p}),!resolvedAbsolute).join("/"),(resolvedAbsolute?"/":"")+resolvedPath||"."},exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash="/"===substr(path,-1);return path=normalizeArray(filter(path.split("/"),function(p){return!!p}),!isAbsolute).join("/"),path||isAbsolute||(path="."),path&&trailingSlash&&(path+="/"),(isAbsolute?"/":"")+path},exports.isAbsolute=function(path){return"/"===path.charAt(0)},exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p){if("string"!=typeof p)throw new TypeError("Arguments to path.join must be strings");return p}).join("/"))},exports.relative=function(from,to){function trim(arr){for(var start=0;start=0&&""===arr[end];end--);return start>end?[]:arr.slice(start,end-start+1)}from=exports.resolve(from).substr(1),to=exports.resolve(to).substr(1);for(var fromParts=trim(from.split("/")),toParts=trim(to.split("/")),length=Math.min(fromParts.length,toParts.length),samePartsLength=length,i=0;length>i;i++)if(fromParts[i]!==toParts[i]){samePartsLength=i;break}for(var outputParts=[],i=samePartsLength;istart&&(start=str.length+start),str.substr(start,len)}}).call(exports,__webpack_require__(25))},function(module){function cleanUpNextTick(){draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue()}function drainQueue(){if(!draining){var timeout=setTimeout(cleanUpNextTick);draining=!0;for(var len=queue.length;len;){for(currentQueue=queue,queue=[];++queueIndex1)for(var i=1;i":">"},escapeRegex=/[&"'<>]/g,lookupEscape=function(ch){return escapeMap[ch]},exports=module.exports={};exports.prettifyError=function(path,withInternals,err){if(err.Update||(err=new exports.TemplateError(err)),err.Update(path),!withInternals){var old=err;err=new Error(old.message),err.name=old.name}return err},exports.TemplateError=function(message,lineno,colno){var err=this;if(message instanceof Error){err=message,message=message.name+": "+message.message;try{err.name=""}catch(e){err=this}}else Error.captureStackTrace&&Error.captureStackTrace(err);return err.name="Template render error",err.message=message,err.lineno=lineno,err.colno=colno,err.firstUpdate=!0,err.Update=function(path){var message="("+(path||"unknown path")+")";return this.firstUpdate&&(this.lineno&&this.colno?message+=" [Line "+this.lineno+", Column "+this.colno+"]":this.lineno&&(message+=" [Line "+this.lineno+"]")),message+="\n ",this.firstUpdate&&(message+=" "),this.message=message+(this.message||""),this.firstUpdate=!1,this},err},exports.TemplateError.prototype=Error.prototype,exports.escape=function(val){return val.replace(escapeRegex,lookupEscape)},exports.isFunction=function(obj){return"[object Function]"===ObjProto.toString.call(obj)},exports.isArray=Array.isArray||function(obj){return"[object Array]"===ObjProto.toString.call(obj)},exports.isString=function(obj){return"[object String]"===ObjProto.toString.call(obj)},exports.isObject=function(obj){return"[object Object]"===ObjProto.toString.call(obj)},exports.groupBy=function(obj,val){for(var result={},iterator=exports.isFunction(val)?val:function(obj){return obj[val]},i=0;ii;i++)str+=char_;return str},exports.each=function(obj,func,context){if(null!=obj)if(ArrayProto.each&&obj.each===ArrayProto.each)obj.forEach(func,context);else if(obj.length===+obj.length)for(var i=0,l=obj.length;l>i;i++)func.call(context,obj[i],i,obj)},exports.map=function(obj,func){var results=[];if(null==obj)return results;if(ArrayProto.map&&obj.map===ArrayProto.map)return obj.map(func);for(var i=0;ii?iter(k,obj[k],i,len,next):cb()}var keys=exports.keys(obj),len=keys.length,i=-1;next()},exports.indexOf=Array.prototype.indexOf?function(arr,searchElement,fromIndex){return Array.prototype.indexOf.call(arr,searchElement,fromIndex)}:function(arr,searchElement,fromIndex){var length=this.length>>>0;for(fromIndex=+fromIndex||0,Math.abs(fromIndex)===1/0&&(fromIndex=0),0>fromIndex&&(fromIndex+=length,0>fromIndex&&(fromIndex=0));length>fromIndex;fromIndex++)if(arr[fromIndex]===searchElement)return fromIndex;return-1},Array.prototype.map||(Array.prototype.map=function(){throw new Error("map is unimplemented for this js engine")}),exports.keys=function(obj){if(Object.prototype.keys)return obj.keys();var keys=[];for(var k in obj)obj.hasOwnProperty(k)&&keys.push(k);return keys},exports.inOperator=function(key,arrOrObj){if(exports.isArray(arrOrObj))return-1!==exports.indexOf(arrOrObj,key);if(exports.isObject(arrOrObj))return key in arrOrObj;throw new Error('Cannot use "in" operator to search for "'+key+'" in unexpected types.')}},function(module,exports,__webpack_require__){"use strict";function callbackAsap(cb,err,res){asap(function(){cb(err,res)})}var Template,path=__webpack_require__(24),asap=__webpack_require__(29),lib=__webpack_require__(27),Obj=__webpack_require__(31),compiler=__webpack_require__(32),builtin_filters=__webpack_require__(33),builtin_loaders=__webpack_require__(32),runtime=__webpack_require__(34),globals=__webpack_require__(35),Frame=runtime.Frame;builtin_loaders.PrecompiledLoader=__webpack_require__(36);var Environment=Obj.extend({init:function(loaders,opts){opts=this.opts=opts||{},this.opts.dev=!!opts.dev,this.opts.autoescape=null!=opts.autoescape?opts.autoescape:!0,this.opts.throwOnUndefined=!!opts.throwOnUndefined,this.opts.trimBlocks=!!opts.trimBlocks,this.opts.lstripBlocks=!!opts.lstripBlocks,this.loaders=[],loaders?this.loaders=lib.isArray(loaders)?loaders:[loaders]:builtin_loaders.FileSystemLoader?this.loaders=[new builtin_loaders.FileSystemLoader("views")]:builtin_loaders.WebLoader&&(this.loaders=[new builtin_loaders.WebLoader("/views")]),window.nunjucksPrecompiled&&this.loaders.unshift(new builtin_loaders.PrecompiledLoader(window.nunjucksPrecompiled)),this.initCache(),this.globals=globals(),this.filters={},this.asyncFilters=[],this.extensions={},this.extensionsList=[];for(var name in builtin_filters)this.addFilter(name,builtin_filters[name])},initCache:function(){lib.each(this.loaders,function(loader){loader.cache={},"function"==typeof loader.on&&loader.on("update",function(template){loader.cache[template]=null})})},addExtension:function(name,extension){return extension._name=name,this.extensions[name]=extension,this.extensionsList.push(extension),this},removeExtension:function(name){var extension=this.getExtension(name);extension&&(this.extensionsList=lib.without(this.extensionsList,extension),delete this.extensions[name])},getExtension:function(name){return this.extensions[name]},hasExtension:function(name){return!!this.extensions[name]},addGlobal:function(name,value){return this.globals[name]=value,this},getGlobal:function(name){if("undefined"==typeof this.globals[name])throw new Error("global not found: "+name);return this.globals[name]},addFilter:function(name,func,async){var wrapped=func;return async&&this.asyncFilters.push(name),this.filters[name]=wrapped,this},getFilter:function(name){if(!this.filters[name])throw new Error("filter not found: "+name);return this.filters[name]},resolveTemplate:function(loader,parentName,filename){var isRelative=loader.isRelative&&parentName?loader.isRelative(filename):!1;return isRelative&&loader.resolve?loader.resolve(parentName,filename):filename},getTemplate:function(name,eagerCompile,parentName,ignoreMissing,cb){var that=this,tmpl=null;if(name&&name.raw&&(name=name.raw),lib.isFunction(parentName)&&(cb=parentName,parentName=null,eagerCompile=eagerCompile||!1),lib.isFunction(eagerCompile)&&(cb=eagerCompile,eagerCompile=!1),name instanceof Template)tmpl=name;else{if("string"!=typeof name)throw new Error("template names must be a string: "+name);for(var i=0;icapacity){for(var scan=0,newLength=queue.length-index;newLength>scan;scan++)queue[scan]=queue[scan+index];queue.length-=index,index=0}}queue.length=0,index=0,flushing=!1}function makeRequestCallFromMutationObserver(callback){var toggle=1,observer=new BrowserMutationObserver(callback),node=document.createTextNode("");return observer.observe(node,{characterData:!0}),function(){toggle=-toggle,node.data=toggle}}function makeRequestCallFromTimer(callback){return function(){function handleTimer(){clearTimeout(timeoutHandle),clearInterval(intervalHandle),callback()}var timeoutHandle=setTimeout(handleTimer,0),intervalHandle=setInterval(handleTimer,50)}}module.exports=rawAsap;var requestFlush,queue=[],flushing=!1,index=0,capacity=1024,BrowserMutationObserver=global.MutationObserver||global.WebKitMutationObserver;requestFlush="function"==typeof BrowserMutationObserver?makeRequestCallFromMutationObserver(flush):makeRequestCallFromTimer(flush),rawAsap.requestFlush=requestFlush,rawAsap.makeRequestCallFromTimer=makeRequestCallFromTimer}).call(exports,function(){return this}())},function(module){"use strict";function extend(cls,name,props){var F=function(){};F.prototype=cls.prototype;var prototype=new F,fnTest=/xyz/.test(function(){xyz})?/\bparent\b/:/.*/;props=props||{};for(var k in props){var src=props[k],parent=prototype[k];prototype[k]="function"==typeof parent&&"function"==typeof src&&fnTest.test(src)?function(src,parent){return function(){var tmp=this.parent;this.parent=parent;var res=src.apply(this,arguments);return this.parent=tmp,res}}(src,parent):src}prototype.typename=name;var new_cls=function(){prototype.init&&prototype.init.apply(this,arguments)};return new_cls.prototype=prototype,new_cls.prototype.constructor=new_cls,new_cls.extend=function(name,props){return"object"==typeof name&&(props=name,name="anonymous"),extend(new_cls,name,props)},new_cls}module.exports=extend(Object,"Object",{})},function(){},function(module,exports,__webpack_require__){"use strict";function normalize(value,defaultValue){return null===value||void 0===value||value===!1?defaultValue:value}var lib=__webpack_require__(27),r=__webpack_require__(34),filters={abs:function(n){return Math.abs(n)},batch:function(arr,linecount,fill_with){var i,res=[],tmp=[];for(i=0;ii;i++)tmp.push(fill_with);res.push(tmp)}return res},capitalize:function(str){str=normalize(str,"");var ret=str.toLowerCase();return r.copySafeness(str,ret.charAt(0).toUpperCase()+ret.slice(1))},center:function(str,width){if(str=normalize(str,""),width=width||80,str.length>=width)return str;var spaces=width-str.length,pre=lib.repeat(" ",spaces/2-spaces%2),post=lib.repeat(" ",spaces/2);return r.copySafeness(str,pre+str+post)},"default":function(val,def,bool){return bool?val?val:def:void 0!==val?val:def},dictsort:function(val,case_sensitive,by){if(!lib.isObject(val))throw new lib.TemplateError("dictsort filter: val must be an object");var array=[];for(var k in val)array.push([k,val[k]]);var si;if(void 0===by||"key"===by)si=0;else{if("value"!==by)throw new lib.TemplateError("dictsort filter: You can only sort by either key or value");si=1}return array.sort(function(t1,t2){var a=t1[si],b=t2[si];return case_sensitive||(lib.isString(a)&&(a=a.toUpperCase()),
-lib.isString(b)&&(b=b.toUpperCase())),a>b?1:a===b?0:-1}),array},dump:function(obj){return JSON.stringify(obj)},escape:function(str){return"string"==typeof str?r.markSafe(lib.escape(str)):str},safe:function(str){return r.markSafe(str)},first:function(arr){return arr[0]},groupby:function(arr,attr){return lib.groupBy(arr,attr)},indent:function(str,width,indentfirst){if(str=normalize(str,""),""===str)return"";width=width||4;for(var res="",lines=str.split("\n"),sp=lib.repeat(" ",width),i=0;i-1&&(-1===maxCount||maxCount>count);)res+=str.substring(pos,nextIndex)+new_,pos=nextIndex+old.length,count++,nextIndex=str.indexOf(old,pos);return posi;i++){var start=offset+i*sliceLength;extra>i&&offset++;var end=offset+(i+1)*sliceLength,slice=arr.slice(start,end);fillWith&&i>=extra&&slice.push(fillWith),res.push(slice)}return res},sum:function(arr,attr,start){var sum=0;"number"==typeof start&&(sum+=start),attr&&(arr=lib.map(arr,function(v){return v[attr]}));for(var i=0;ix?reverse?1:-1:x>y?reverse?-1:1:0}),arr}),string:function(obj){return r.copySafeness(obj,obj)},striptags:function(input,preserve_linebreaks){input=normalize(input,""),preserve_linebreaks=preserve_linebreaks||!1;var tags=/<\/?([a-z][a-z0-9]*)\b[^>]*>|/gi,trimmedInput=filters.trim(input.replace(tags,"")),res="";return res=preserve_linebreaks?trimmedInput.replace(/^ +| +$/gm,"").replace(/ +/g," ").replace(/(\r\n)/g,"\n").replace(/\n\n\n+/g,"\n\n"):trimmedInput.replace(/\s+/gi," "),r.copySafeness(input,res)},title:function(str){str=normalize(str,"");for(var words=str.split(" "),i=0;i"+possibleUrl.substr(0,length)+"":wwwRE.test(possibleUrl)?'"+possibleUrl.substr(0,length)+"":emailRE.test(possibleUrl)?''+possibleUrl+"":tldRE.test(possibleUrl)?'"+possibleUrl.substr(0,length)+"":word});return words.join("")},wordcount:function(str){str=normalize(str,"");var words=str?str.match(/\w+/g):null;return words?words.length:null},"float":function(val,def){var res=parseFloat(val);return isNaN(res)?def:res},"int":function(val,def){var res=parseInt(val,10);return isNaN(res)?def:res}};filters.d=filters["default"],filters.e=filters.escape,module.exports=filters},function(module,exports,__webpack_require__){"use strict";function makeMacro(argNames,kwargNames,func){return function(){var args,i,argCount=numArgs(arguments),kwargs=getKeywordArgs(arguments);if(argCount>argNames.length){args=Array.prototype.slice.call(arguments,0,argNames.length);var vals=Array.prototype.slice.call(arguments,args.length,argCount);for(i=0;i=items.length&&(index=0),this.current=items[index],this.current}}}function joiner(sep){sep=sep||",";var first=!0;return function(){var val=first?"":sep;return first=!1,val}}function globals(){return{range:function(start,stop,step){"undefined"==typeof stop?(stop=start,start=0,step=1):step||(step=1);var i,arr=[];if(step>0)for(i=start;stop>i;i+=step)arr.push(i);else for(i=start;i>stop;i+=step)arr.push(i);return arr},cycler:function(){return cycler(Array.prototype.slice.call(arguments))},joiner:function(sep){return joiner(sep)}}}module.exports=globals},function(module,exports,__webpack_require__){"use strict";var Loader=__webpack_require__(37),PrecompiledLoader=Loader.extend({init:function(compiledTemplates){this.precompiled=compiledTemplates||{}},getSource:function(name){return this.precompiled[name]?{src:{type:"code",obj:this.precompiled[name]},path:name}:null}});module.exports=PrecompiledLoader},function(module,exports,__webpack_require__){"use strict";var path=__webpack_require__(24),Obj=__webpack_require__(31),lib=__webpack_require__(27),Loader=Obj.extend({on:function(name,func){this.listeners=this.listeners||{},this.listeners[name]=this.listeners[name]||[],this.listeners[name].push(func)},emit:function(name){var args=Array.prototype.slice.call(arguments,1);this.listeners&&this.listeners[name]&&lib.each(this.listeners[name],function(listener){listener.apply(null,args)})},resolve:function(from,to){return path.resolve(path.dirname(from),to)},isRelative:function(filename){return 0===filename.indexOf("./")||0===filename.indexOf("../")}});module.exports=Loader},function(module){function installCompat(){"use strict";var runtime=this.runtime,lib=this.lib,orig_contextOrFrameLookup=runtime.contextOrFrameLookup;runtime.contextOrFrameLookup=function(context,frame,key){var val=orig_contextOrFrameLookup.apply(this,arguments);if(void 0===val)switch(key){case"True":return!0;case"False":return!1;case"None":return null}return val};var orig_memberLookup=runtime.memberLookup,ARRAY_MEMBERS={pop:function(index){if(void 0===index)return this.pop();if(index>=this.length||0>index)throw new Error("KeyError");return this.splice(index,1)},remove:function(element){for(var i=0;i\n \n \n \n"},SideBySidePrinter.prototype.generateSideBySideJsonHtml=function(diffFiles){var that=this;return'\n'+diffFiles.map(function(file){var diffs;return diffs=file.blocks.length?that.generateSideBySideFileHtml(file):that.generateEmptyDiff(),that.makeDiffHtml(file,diffs)}).join("\n")+"
\n"},SideBySidePrinter.prototype.makeSideHtml=function(blockHeader){return'\n | \n \n '+blockHeader+" \n | \n
\n"},SideBySidePrinter.prototype.generateSideBySideFileHtml=function(file){var that=this,fileHtml={};return fileHtml.left="",fileHtml.right="",file.blocks.forEach(function(block){function processChangeBlock(){var matches,insertType,deleteType,comparisons=oldLines.length*newLines.length,maxComparisons=that.config.matchingMaxComparisons||2500,doMatching=maxComparisons>comparisons&&("lines"===that.config.matching||"words"===that.config.matching);doMatching?(matches=matcher(oldLines,newLines),insertType=diffParser.LINE_TYPE.INSERT_CHANGES,deleteType=diffParser.LINE_TYPE.DELETE_CHANGES):(matches=[[oldLines,newLines]],insertType=diffParser.LINE_TYPE.INSERTS,deleteType=diffParser.LINE_TYPE.DELETES),matches.forEach(function(match){oldLines=match[0],newLines=match[1];for(var common=Math.min(oldLines.length,newLines.length),max=Math.max(oldLines.length,newLines.length),j=0;common>j;j++){var oldLine=oldLines[j],newLine=newLines[j];that.config.isCombined=file.isCombined;var diff=printerUtils.diffHighlight(oldLine.content,newLine.content,that.config);fileHtml.left+=that.generateSingleLineHtml(deleteType,oldLine.oldNumber,diff.first.line,diff.first.prefix),fileHtml.right+=that.generateSingleLineHtml(insertType,newLine.newNumber,diff.second.line,diff.second.prefix)}if(max>common){var oldSlice=oldLines.slice(common),newSlice=newLines.slice(common),tmpHtml=that.processLines(oldSlice,newSlice);fileHtml.left+=tmpHtml.left,fileHtml.right+=tmpHtml.right}}),oldLines=[],newLines=[]}fileHtml.left+=that.makeSideHtml(utils.escape(block.header)),fileHtml.right+=that.makeSideHtml("");for(var oldLines=[],newLines=[],i=0;i0||line.type!==diffParser.LINE_TYPE.DELETES&&oldLines.length>0)&&processChangeBlock(),line.type===diffParser.LINE_TYPE.CONTEXT?(fileHtml.left+=that.generateSingleLineHtml(line.type,line.oldNumber,escapedLine,prefix),fileHtml.right+=that.generateSingleLineHtml(line.type,line.newNumber,escapedLine,prefix)):line.type!==diffParser.LINE_TYPE.INSERTS||oldLines.length?line.type===diffParser.LINE_TYPE.DELETES?oldLines.push(line):line.type===diffParser.LINE_TYPE.INSERTS&&Boolean(oldLines.length)?newLines.push(line):(console.error("unknown state in html side-by-side generator"),processChangeBlock()):(fileHtml.left+=that.generateSingleLineHtml(diffParser.LINE_TYPE.CONTEXT,"","",""),fileHtml.right+=that.generateSingleLineHtml(line.type,line.newNumber,escapedLine,prefix))}processChangeBlock()}),fileHtml},SideBySidePrinter.prototype.processLines=function(oldLines,newLines){var that=this,fileHtml={};fileHtml.left="",fileHtml.right="";for(var maxLinesNumber=Math.max(oldLines.length,newLines.length),i=0;maxLinesNumber>i;i++){var oldContent,newContent,oldPrefix,newPrefix,oldLine=oldLines[i],newLine=newLines[i];oldLine&&(oldContent=utils.escape(oldLine.content.substr(1)),oldPrefix=oldLine.content[0]),newLine&&(newContent=utils.escape(newLine.content.substr(1)),newPrefix=newLine.content[0]),oldLine&&newLine?(fileHtml.left+=that.generateSingleLineHtml(oldLine.type,oldLine.oldNumber,oldContent,oldPrefix),fileHtml.right+=that.generateSingleLineHtml(newLine.type,newLine.newNumber,newContent,newPrefix)):oldLine?(fileHtml.left+=that.generateSingleLineHtml(oldLine.type,oldLine.oldNumber,oldContent,oldPrefix),fileHtml.right+=that.generateSingleLineHtml(diffParser.LINE_TYPE.CONTEXT,"","","")):newLine?(fileHtml.left+=that.generateSingleLineHtml(diffParser.LINE_TYPE.CONTEXT,"","",""),fileHtml.right+=that.generateSingleLineHtml(newLine.type,newLine.newNumber,newContent,newPrefix)):console.error("How did it get here?")}return fileHtml},SideBySidePrinter.prototype.makeSingleLineHtml=function(type,number,htmlContent,htmlPrefix){return'\n | '+number+' | \n '+htmlPrefix+htmlContent+" | \n
\n"},SideBySidePrinter.prototype.generateSingleLineHtml=function(type,number,content,prefix){var htmlPrefix="";prefix&&(htmlPrefix=''+prefix+"");var htmlContent="";return content&&(htmlContent=''+content+""),this.makeSingleLineHtml(type,number,htmlContent,htmlPrefix)},SideBySidePrinter.prototype.generateEmptyDiff=function(){var fileHtml={};return fileHtml.right="",fileHtml.left='\n | File without changes | \n
\n',fileHtml},module.exports.SideBySidePrinter=SideBySidePrinter}()}]);
\ No newline at end of file
+!function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o"):change.removed&&ret.push(""),ret.push(escapeHTML(change.value)),change.added?ret.push(""):change.removed&&ret.push("")}return ret.join("")}function escapeHTML(s){var n=s;return n=n.replace(/&/g,"&"),n=n.replace(//g,">"),n=n.replace(/"/g,""")}exports.__esModule=!0,exports.convertChangesToXML=convertChangesToXML},{}],4:[function(require,module,exports){"use strict";function Diff(){}function buildValues(diff,components,newString,oldString,useLongestToken){for(var componentPos=0,componentLen=components.length,newPos=0,oldPos=0;componentLen>componentPos;componentPos++){var component=components[componentPos];if(component.removed){if(component.value=oldString.slice(oldPos,oldPos+component.count).join(""),oldPos+=component.count,componentPos&&components[componentPos-1].added){var tmp=components[componentPos-1];components[componentPos-1]=components[componentPos],components[componentPos]=tmp}}else{if(!component.added&&useLongestToken){var value=newString.slice(newPos,newPos+component.count);value=value.map(function(value,i){var oldValue=oldString[oldPos+i];return oldValue.length>value.length?oldValue:value}),component.value=value.join("")}else component.value=newString.slice(newPos,newPos+component.count).join("");newPos+=component.count,component.added||(oldPos+=component.count)}}var lastComponent=components[componentLen-1];return componentLen>1&&(lastComponent.added||lastComponent.removed)&&diff.equals("",lastComponent.value)&&(components[componentLen-2].value+=lastComponent.value,components.pop()),components}function clonePath(path){return{newPos:path.newPos,components:path.components.slice(0)}}exports.__esModule=!0,exports["default"]=Diff,Diff.prototype={diff:function(oldString,newString){function done(value){return callback?(setTimeout(function(){callback(void 0,value)},0),!0):value}function execEditLength(){for(var diagonalPath=-1*editLength;editLength>=diagonalPath;diagonalPath+=2){var basePath=void 0,addPath=bestPath[diagonalPath-1],removePath=bestPath[diagonalPath+1],_oldPos=(removePath?removePath.newPos:0)-diagonalPath;addPath&&(bestPath[diagonalPath-1]=void 0);var canAdd=addPath&&addPath.newPos+1=0&&oldLen>_oldPos;if(canAdd||canRemove){if(!canAdd||canRemove&&addPath.newPos=newLen&&_oldPos+1>=oldLen)return done(buildValues(self,basePath.components,newString,oldString,self.useLongestToken));bestPath[diagonalPath]=basePath}else bestPath[diagonalPath]=void 0}editLength++}var options=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],callback=options.callback;"function"==typeof options&&(callback=options,options={}),this.options=options;var self=this;oldString=this.castInput(oldString),newString=this.castInput(newString),oldString=this.removeEmpty(this.tokenize(oldString)),newString=this.removeEmpty(this.tokenize(newString));var newLen=newString.length,oldLen=oldString.length,editLength=1,maxEditLength=newLen+oldLen,bestPath=[{newPos:-1,components:[]}],oldPos=this.extractCommon(bestPath[0],newString,oldString,0);if(bestPath[0].newPos+1>=newLen&&oldPos+1>=oldLen)return done([{value:newString.join(""),count:newString.length}]);if(callback)!function exec(){setTimeout(function(){return editLength>maxEditLength?callback():void(execEditLength()||exec())},0)}();else for(;maxEditLength>=editLength;){var ret=execEditLength();if(ret)return ret}},pushComponent:function(components,added,removed){var last=components[components.length-1];last&&last.added===added&&last.removed===removed?components[components.length-1]={count:last.count+1,added:added,removed:removed}:components.push({count:1,added:added,removed:removed})},extractCommon:function(basePath,newString,oldString,diagonalPath){for(var newLen=newString.length,oldLen=oldString.length,newPos=basePath.newPos,oldPos=newPos-diagonalPath,commonCount=0;newLen>newPos+1&&oldLen>oldPos+1&&this.equals(newString[newPos+1],oldString[oldPos+1]);)newPos++,oldPos++,commonCount++;return commonCount&&basePath.components.push({count:commonCount}),basePath.newPos=newPos,oldPos},equals:function(left,right){return left===right},removeEmpty:function(array){for(var ret=[],i=0;ifuzzFactor))return!1;toPos++}}return!0}var options=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if("string"==typeof uniDiff&&(uniDiff=_parse.parsePatch(uniDiff)),Array.isArray(uniDiff)){if(uniDiff.length>1)throw new Error("applyPatch only works with a single input.");uniDiff=uniDiff[0]}for(var lines=source.split("\n"),hunks=uniDiff.hunks,compareLine=options.compareLine||function(lineNumber,line,operation,patchContent){return line===patchContent},errorCount=0,fuzzFactor=options.fuzzFactor||0,minLine=0,offset=0,removeEOFNL=void 0,addEOFNL=void 0,i=0;i0?contextLines(prev.lines.slice(-options.context)):[],oldRangeStart-=curRange.length,newRangeStart-=curRange.length)}(_curRange=curRange).push.apply(_curRange,_toConsumableArray(lines.map(function(entry){return(current.added?"+":"-")+entry}))),current.added?newLine+=lines.length:oldLine+=lines.length}else{if(oldRangeStart)if(lines.length<=2*options.context&&i=diff.length-2&&lines.length<=options.context){var oldEOFNewline=/\n$/.test(oldStr),newEOFNewline=/\n$/.test(newStr);0!=lines.length||oldEOFNewline?oldEOFNewline&&newEOFNewline||curRange.push("\\ No newline at end of file"):curRange.splice(hunk.oldLines,0,"\\ No newline at end of file")}hunks.push(hunk),oldRangeStart=0,newRangeStart=0,curRange=[]}oldLine+=lines.length,newLine+=lines.length}},i=0;i=start+localOffset)return localOffset;forwardExhausted=!0}return backwardExhausted?void 0:(forwardExhausted||(wantForward=!0),start-localOffset>=minLine?-localOffset++:(backwardExhausted=!0,iterator()))}}},{}],16:[function(require,module,exports){"use strict";function generateOptions(options,defaults){if("function"==typeof options)defaults.callback=options;else if(options)for(var name in options)options.hasOwnProperty(name)&&(defaults[name]=options[name]);return defaults}exports.__esModule=!0,exports.generateOptions=generateOptions},{}],17:[function(require,module,exports){!function(Hogan){function cleanTripleStache(token){"}"===token.n.substr(token.n.length-1)&&(token.n=token.n.substring(0,token.n.length-1))}function trim(s){return s.trim?s.trim():s.replace(/^\s*|\s*$/g,"")}function tagChange(tag,text,index){if(text.charAt(index)!=tag.charAt(0))return!1;for(var i=1,l=tag.length;l>i;i++)if(text.charAt(index+i)!=tag.charAt(i))return!1;return!0}function buildTree(tokens,kind,stack,customTags){var instructions=[],opener=null,tail=null,token=null;for(tail=stack[stack.length-1];tokens.length>0;){if(token=tokens.shift(),tail&&"<"==tail.tag&&!(token.tag in allowedInSuper))throw new Error("Illegal content in < super tag.");if(Hogan.tags[token.tag]<=Hogan.tags.$||isOpener(token,customTags))stack.push(token),token.nodes=buildTree(tokens,token.tag,stack,customTags);else{if("/"==token.tag){if(0===stack.length)throw new Error("Closing tag without opener: /"+token.n);if(opener=stack.pop(),token.n!=opener.n&&!isCloser(token.n,opener.n,customTags))throw new Error("Nesting error: "+opener.n+" vs. "+token.n);return opener.end=token.i,instructions}"\n"==token.tag&&(token.last=0==tokens.length||"\n"==tokens[0].tag)}instructions.push(token)}if(stack.length>0)throw new Error("missing closing tag: "+stack.pop().n);return instructions}function isOpener(token,tags){for(var i=0,l=tags.length;l>i;i++)if(tags[i].o==token.n)return token.tag="#",!0}function isCloser(close,open,tags){for(var i=0,l=tags.length;l>i;i++)if(tags[i].c==close&&tags[i].o==open)return!0}function stringifySubstitutions(obj){var items=[];for(var key in obj)items.push('"'+esc(key)+'": function(c,p,t,i) {'+obj[key]+"}");return"{ "+items.join(",")+" }"}function stringifyPartials(codeObj){var partials=[];for(var key in codeObj.partials)partials.push('"'+esc(key)+'":{name:"'+esc(codeObj.partials[key].name)+'", '+stringifyPartials(codeObj.partials[key])+"}");return"partials: {"+partials.join(",")+"}, subs: "+stringifySubstitutions(codeObj.subs)}function esc(s){return s.replace(rSlash,"\\\\").replace(rQuot,'\\"').replace(rNewline,"\\n").replace(rCr,"\\r").replace(rLineSep,"\\u2028").replace(rParagraphSep,"\\u2029")}function chooseMethod(s){return~s.indexOf(".")?"d":"f"}function createPartial(node,context){var prefix="<"+(context.prefix||""),sym=prefix+node.n+serialNo++;return context.partials[sym]={name:node.n,partials:{}},context.code+='t.b(t.rp("'+esc(sym)+'",c,p,"'+(node.indent||"")+'"));',sym}function tripleStache(node,context){context.code+="t.b(t.t(t."+chooseMethod(node.n)+'("'+esc(node.n)+'",c,p,0)));'}function write(s){return"t.b("+s+");"}var rIsWhitespace=/\S/,rQuot=/\"/g,rNewline=/\n/g,rCr=/\r/g,rSlash=/\\/g,rLineSep=/\u2028/,rParagraphSep=/\u2029/;Hogan.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},Hogan.scan=function(text,delimiters){function addBuf(){buf.length>0&&(tokens.push({tag:"_t",text:new String(buf)}),buf="")}function lineIsWhitespace(){for(var isAllWhitespace=!0,j=lineStart;j"==next.tag&&(next.indent=tokens[j].text.toString()),tokens.splice(j,1));else noNewLine||tokens.push({tag:"\n"});seenTag=!1,lineStart=tokens.length}function changeDelimiters(text,index){var close="="+ctag,closeIndex=text.indexOf(close,index),delimiters=trim(text.substring(text.indexOf("=",index)+1,closeIndex)).split(" ");return otag=delimiters[0],ctag=delimiters[delimiters.length-1],closeIndex+close.length-1}var len=text.length,IN_TEXT=0,IN_TAG_TYPE=1,IN_TAG=2,state=IN_TEXT,tagType=null,tag=null,buf="",tokens=[],seenTag=!1,i=0,lineStart=0,otag="{{",ctag="}}";for(delimiters&&(delimiters=delimiters.split(" "),otag=delimiters[0],ctag=delimiters[1]),i=0;len>i;i++)state==IN_TEXT?tagChange(otag,text,i)?(--i,addBuf(),state=IN_TAG_TYPE):"\n"==text.charAt(i)?filterLine(seenTag):buf+=text.charAt(i):state==IN_TAG_TYPE?(i+=otag.length-1,tag=Hogan.tags[text.charAt(i+1)],tagType=tag?text.charAt(i+1):"_v","="==tagType?(i=changeDelimiters(text,i),state=IN_TEXT):(tag&&i++,state=IN_TAG),seenTag=i):tagChange(ctag,text,i)?(tokens.push({tag:tagType,n:trim(buf),otag:otag,ctag:ctag,i:"/"==tagType?seenTag-otag.length:i+ctag.length}),buf="",i+=ctag.length-1,state=IN_TEXT,"{"==tagType&&("}}"==ctag?i++:cleanTripleStache(tokens[tokens.length-1]))):buf+=text.charAt(i);return filterLine(seenTag,!0),tokens};var allowedInSuper={_t:!0,"\n":!0,$:!0,"/":!0};Hogan.stringify=function(codeObj){return"{code: function (c,p,i) { "+Hogan.wrapMain(codeObj.code)+" },"+stringifyPartials(codeObj)+"}"};var serialNo=0;Hogan.generate=function(tree,text,options){serialNo=0;var context={code:"",subs:{},partials:{}};return Hogan.walk(tree,context),options.asString?this.stringify(context,text,options):this.makeTemplate(context,text,options)},Hogan.wrapMain=function(code){return'var t=this;t.b(i=i||"");'+code+"return t.fl();"},Hogan.template=Hogan.Template,Hogan.makeTemplate=function(codeObj,text,options){var template=this.makePartials(codeObj);return template.code=new Function("c","p","i",this.wrapMain(codeObj.code)),new this.template(template,text,this,options)},Hogan.makePartials=function(codeObj){var key,template={subs:{},partials:codeObj.partials,name:codeObj.name};for(key in template.partials)template.partials[key]=this.makePartials(template.partials[key]);for(key in codeObj.subs)template.subs[key]=new Function("c","p","t","i",codeObj.subs[key]);return template},Hogan.codegen={"#":function(node,context){context.code+="if(t.s(t."+chooseMethod(node.n)+'("'+esc(node.n)+'",c,p,1),c,p,0,'+node.i+","+node.end+',"'+node.otag+" "+node.ctag+'")){t.rs(c,p,function(c,p,t){',Hogan.walk(node.nodes,context),context.code+="});c.pop();}"},"^":function(node,context){context.code+="if(!t.s(t."+chooseMethod(node.n)+'("'+esc(node.n)+'",c,p,1),c,p,1,0,0,"")){',Hogan.walk(node.nodes,context),context.code+="};"},">":createPartial,"<":function(node,context){var ctx={partials:{},code:"",subs:{},inPartial:!0};Hogan.walk(node.nodes,ctx);var template=context.partials[createPartial(node,context)];template.subs=ctx.subs,template.partials=ctx.partials},$:function(node,context){var ctx={subs:{},code:"",partials:context.partials,prefix:node.n};Hogan.walk(node.nodes,ctx),context.subs[node.n]=ctx.code,context.inPartial||(context.code+='t.sub("'+esc(node.n)+'",c,p,i);')},"\n":function(node,context){context.code+=write('"\\n"'+(node.last?"":" + i"))},_v:function(node,context){context.code+="t.b(t.v(t."+chooseMethod(node.n)+'("'+esc(node.n)+'",c,p,0)));'},_t:function(node,context){context.code+=write('"'+esc(node.text)+'"')},"{":tripleStache,"&":tripleStache},Hogan.walk=function(nodelist,context){for(var func,i=0,l=nodelist.length;l>i;i++)func=Hogan.codegen[nodelist[i].tag],func&&func(nodelist[i],context);return context},Hogan.parse=function(tokens,text,options){return options=options||{},buildTree(tokens,"",[],options.sectionTags||[])},Hogan.cache={},Hogan.cacheKey=function(text,options){return[text,!!options.asString,!!options.disableLambda,options.delimiters,!!options.modelGet].join("||")},Hogan.compile=function(text,options){options=options||{};var key=Hogan.cacheKey(text,options),template=this.cache[key];if(template){var partials=template.partials;for(var name in partials)delete partials[name].instance;return template}return template=this.generate(this.parse(this.scan(text,options.delimiters),text,options),text,options),this.cache[key]=template}}("undefined"!=typeof exports?exports:Hogan)},{}],18:[function(require,module){var Hogan=require("./compiler");Hogan.Template=require("./template").Template,Hogan.template=Hogan.Template,module.exports=Hogan},{"./compiler":17,"./template":19}],19:[function(require,module,exports){var Hogan={};!function(Hogan){function findInScope(key,scope,doModelGet){var val;return scope&&"object"==typeof scope&&(void 0!==scope[key]?val=scope[key]:doModelGet&&scope.get&&"function"==typeof scope.get&&(val=scope.get(key))),val}function createSpecializedPartial(instance,subs,partials,stackSubs,stackPartials,stackText){function PartialTemplate(){}function Substitutions(){}PartialTemplate.prototype=instance,Substitutions.prototype=instance.subs;var key,partial=new PartialTemplate;partial.subs=new Substitutions,partial.subsText={},partial.buf="",stackSubs=stackSubs||{},partial.stackSubs=stackSubs,partial.subsText=stackText;for(key in subs)stackSubs[key]||(stackSubs[key]=subs[key]);for(key in stackSubs)partial.subs[key]=stackSubs[key];stackPartials=stackPartials||{},partial.stackPartials=stackPartials;for(key in partials)stackPartials[key]||(stackPartials[key]=partials[key]);for(key in stackPartials)partial.partials[key]=stackPartials[key];return partial}function coerceToString(val){return String(null===val||void 0===val?"":val)}function hoganEscape(str){return str=coerceToString(str),hChars.test(str)?str.replace(rAmp,"&").replace(rLt,"<").replace(rGt,">").replace(rApos,"'").replace(rQuot,"""):str}Hogan.Template=function(codeObj,text,compiler,options){codeObj=codeObj||{},this.r=codeObj.code||this.r,this.c=compiler,this.options=options||{},this.text=text||"",this.partials=codeObj.partials||{},this.subs=codeObj.subs||{},this.buf=""},Hogan.Template.prototype={r:function(){return""},v:hoganEscape,t:coerceToString,render:function(context,partials,indent){return this.ri([context],partials||{},indent)},ri:function(context,partials,indent){return this.r(context,partials,indent)},ep:function(symbol,partials){var partial=this.partials[symbol],template=partials[partial.name];if(partial.instance&&partial.base==template)return partial.instance;
+
+if("string"==typeof template){if(!this.c)throw new Error("No compiler available.");template=this.c.compile(template,this.options)}if(!template)return null;if(this.partials[symbol].base=template,partial.subs){partials.stackText||(partials.stackText={});for(key in partial.subs)partials.stackText[key]||(partials.stackText[key]=void 0!==this.activeSub&&partials.stackText[this.activeSub]?partials.stackText[this.activeSub]:this.text);template=createSpecializedPartial(template,partial.subs,partial.partials,this.stackSubs,this.stackPartials,partials.stackText)}return this.partials[symbol].instance=template,template},rp:function(symbol,context,partials,indent){var partial=this.ep(symbol,partials);return partial?partial.ri(context,partials,indent):""},rs:function(context,partials,section){var tail=context[context.length-1];if(!isArray(tail))return void section(context,partials,this);for(var i=0;i=0;i--)if(v=ctx[i],val=findInScope(key,v,doModelGet),void 0!==val){found=!0;break}return found?(returnFound||"function"!=typeof val||(val=this.mv(val,ctx,partials)),val):returnFound?!1:""},ls:function(func,cx,partials,text,tags){var oldTags=this.options.delimiters;return this.options.delimiters=tags,this.b(this.ct(coerceToString(func.call(cx,text)),cx,partials)),this.options.delimiters=oldTags,!1},ct:function(text,cx,partials){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(text,this.options).render(cx,partials)},b:function(s){this.buf+=s},fl:function(){var r=this.buf;return this.buf="",r},ms:function(func,ctx,partials,inverted,start,end,tags){var textSource,cx=ctx[ctx.length-1],result=func.call(cx);return"function"==typeof result?inverted?!0:(textSource=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(result,cx,partials,textSource.substring(start,end),tags)):result},mv:function(func,ctx,partials){var cx=ctx[ctx.length-1],result=func.call(cx);return"function"==typeof result?this.ct(coerceToString(result.call(cx)),cx,partials):result},sub:function(name,context,partials,indent){var f=this.subs[name];f&&(this.activeSub=name,f(context,partials,this,indent),this.activeSub=!1)}};var rAmp=/&/g,rLt=//g,rApos=/\'/g,rQuot=/\"/g,hChars=/[&<>\"\']/,isArray=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)}}("undefined"!=typeof exports?exports:Hogan)},{}],20:[function(require,module,exports){(function(process){function normalizeArray(parts,allowAboveRoot){for(var up=0,i=parts.length-1;i>=0;i--){var last=parts[i];"."===last?parts.splice(i,1):".."===last?(parts.splice(i,1),up++):up&&(parts.splice(i,1),up--)}if(allowAboveRoot)for(;up--;up)parts.unshift("..");return parts}function filter(xs,f){if(xs.filter)return xs.filter(f);for(var res=[],i=0;i=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:process.cwd();if("string"!=typeof path)throw new TypeError("Arguments to path.resolve must be strings");path&&(resolvedPath=path+"/"+resolvedPath,resolvedAbsolute="/"===path.charAt(0))}return resolvedPath=normalizeArray(filter(resolvedPath.split("/"),function(p){return!!p}),!resolvedAbsolute).join("/"),(resolvedAbsolute?"/":"")+resolvedPath||"."},exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash="/"===substr(path,-1);return path=normalizeArray(filter(path.split("/"),function(p){return!!p}),!isAbsolute).join("/"),path||isAbsolute||(path="."),path&&trailingSlash&&(path+="/"),(isAbsolute?"/":"")+path},exports.isAbsolute=function(path){return"/"===path.charAt(0)},exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p){if("string"!=typeof p)throw new TypeError("Arguments to path.join must be strings");return p}).join("/"))},exports.relative=function(from,to){function trim(arr){for(var start=0;start=0&&""===arr[end];end--);return start>end?[]:arr.slice(start,end-start+1)}from=exports.resolve(from).substr(1),to=exports.resolve(to).substr(1);for(var fromParts=trim(from.split("/")),toParts=trim(to.split("/")),length=Math.min(fromParts.length,toParts.length),samePartsLength=length,i=0;length>i;i++)if(fromParts[i]!==toParts[i]){samePartsLength=i;break}for(var outputParts=[],i=samePartsLength;istart&&(start=str.length+start),str.substr(start,len)}}).call(this,require("_process"))},{_process:21}],21:[function(require,module){function cleanUpNextTick(){draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue()}function drainQueue(){if(!draining){var timeout=setTimeout(cleanUpNextTick);draining=!0;for(var len=queue.length;len;){for(currentQueue=queue,queue=[];++queueIndex1)for(var i=1;i1?nameSplit[nameSplit.length-1]:language}function getSrcFilename(line,cfg){var prefixes=["a/","i/","w/","c/","o/"];return cfg.srcPrefix&&prefixes.push(cfg.srcPrefix),_getFilename("---",line,prefixes)}function getDstFilename(line,cfg){var prefixes=["b/","i/","w/","c/","o/"];return cfg.dstPrefix&&prefixes.push(cfg.dstPrefix),_getFilename("\\+\\+\\+",line,prefixes)}function _getFilename(linePrefix,line,prefixes){var filename,FilenameRegExp=new RegExp("^"+linePrefix+' "?(.+?)"?$'),values=FilenameRegExp.exec(line);if(values&&values[1]){filename=values[1];var matchingPrefixes=prefixes.filter(function(p){return 0===filename.indexOf(p)});matchingPrefixes[0]&&(filename=filename.slice(matchingPrefixes[0].length))}return filename}var utils=require("./utils.js").Utils,LINE_TYPE={INSERTS:"d2h-ins",DELETES:"d2h-del",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change",CONTEXT:"d2h-cntx",INFO:"d2h-info"};DiffParser.prototype.LINE_TYPE=LINE_TYPE,DiffParser.prototype.generateDiffJson=function(diffInput,config){var files=[],currentFile=null,currentBlock=null,oldLine=null,newLine=null,saveBlock=function(){currentBlock&&(currentFile.blocks.push(currentBlock),currentBlock=null)},saveFile=function(){currentFile&¤tFile.newName&&(files.push(currentFile),currentFile=null)},startFile=function(){saveBlock(),saveFile(),currentFile={},currentFile.blocks=[],currentFile.deletedLines=0,currentFile.addedLines=0},startBlock=function(line){saveBlock();var values;(values=/^@@ -(\d+),\d+ \+(\d+),\d+ @@.*/.exec(line))?currentFile.isCombined=!1:(values=/^@@@ -(\d+),\d+ -\d+,\d+ \+(\d+),\d+ @@@.*/.exec(line))?currentFile.isCombined=!0:(values=[0,0],currentFile.isCombined=!1),oldLine=values[1],newLine=values[2],currentBlock={},currentBlock.lines=[],currentBlock.oldStartLine=oldLine,currentBlock.newStartLine=newLine,currentBlock.header=line},createLine=function(line){var currentLine={};currentLine.content=line;var newLinePrefixes=currentFile.isCombined?["+"," +"]:["+"],delLinePrefixes=currentFile.isCombined?["-"," -"]:["-"];utils.startsWith(line,newLinePrefixes)?(currentFile.addedLines++,currentLine.type=LINE_TYPE.INSERTS,currentLine.oldNumber=null,currentLine.newNumber=newLine++,currentBlock.lines.push(currentLine)):utils.startsWith(line,delLinePrefixes)?(currentFile.deletedLines++,currentLine.type=LINE_TYPE.DELETES,currentLine.oldNumber=oldLine++,currentLine.newNumber=null,currentBlock.lines.push(currentLine)):(currentLine.type=LINE_TYPE.CONTEXT,currentLine.oldNumber=oldLine++,currentLine.newNumber=newLine++,currentBlock.lines.push(currentLine))},diffLines=diffInput.replace(/\\ No newline at end of file/g,"").replace(/\r\n?/g,"\n").split("\n"),oldMode=/^old mode (\d{6})/,newMode=/^new mode (\d{6})/,deletedFileMode=/^deleted file mode (\d{6})/,newFileMode=/^new file mode (\d{6})/,copyFrom=/^copy from "?(.+)"?/,copyTo=/^copy to "?(.+)"?/,renameFrom=/^rename from "?(.+)"?/,renameTo=/^rename to "?(.+)"?/,similarityIndex=/^similarity index (\d+)%/,dissimilarityIndex=/^dissimilarity index (\d+)%/,index=/^index ([0-9a-z]+)\.\.([0-9a-z]+)\s*(\d{6})?/,combinedIndex=/^index ([0-9a-z]+),([0-9a-z]+)\.\.([0-9a-z]+)/,combinedMode=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,combinedNewFile=/^new file mode (\d{6})/,combinedDeletedFile=/^deleted file mode (\d{6}),(\d{6})/;return diffLines.forEach(function(line){if(line&&!utils.startsWith(line,"*")){var values=[];utils.startsWith(line,"diff")?startFile():currentFile&&!currentFile.oldName&&(values=getSrcFilename(line,config))?(currentFile.oldName=values,currentFile.language=getExtension(currentFile.oldName,currentFile.language)):currentFile&&!currentFile.newName&&(values=getDstFilename(line,config))?(currentFile.newName=values,currentFile.language=getExtension(currentFile.newName,currentFile.language)):currentFile&&utils.startsWith(line,"@@")?startBlock(line):(values=oldMode.exec(line))?currentFile.oldMode=values[1]:(values=newMode.exec(line))?currentFile.newMode=values[1]:(values=deletedFileMode.exec(line))?(currentFile.deletedFileMode=values[1],currentFile.isDeleted=!0):(values=newFileMode.exec(line))?(currentFile.newFileMode=values[1],currentFile.isNew=!0):(values=copyFrom.exec(line))?(currentFile.oldName=values[1],currentFile.isCopy=!0):(values=copyTo.exec(line))?(currentFile.newName=values[1],currentFile.isCopy=!0):(values=renameFrom.exec(line))?(currentFile.oldName=values[1],currentFile.isRename=!0):(values=renameTo.exec(line))?(currentFile.newName=values[1],currentFile.isRename=!0):(values=similarityIndex.exec(line))?currentFile.unchangedPercentage=values[1]:(values=dissimilarityIndex.exec(line))?currentFile.changedPercentage=values[1]:(values=index.exec(line))?(currentFile.checksumBefore=values[1],currentFile.checksumAfter=values[2],values[3]&&(currentFile.mode=values[3])):(values=combinedIndex.exec(line))?(currentFile.checksumBefore=[values[2],values[3]],currentFile.checksumAfter=values[1]):(values=combinedMode.exec(line))?(currentFile.oldMode=[values[2],values[3]],currentFile.newMode=values[1]):(values=combinedNewFile.exec(line))?(currentFile.newFileMode=values[1],currentFile.isNew=!0):(values=combinedDeletedFile.exec(line))?(currentFile.deletedFileMode=values[1],currentFile.isDeleted=!0):currentBlock&&createLine(line)}}),saveBlock(),saveFile(),files},module.exports.DiffParser=new DiffParser}()},{"./utils.js":32}],23:[function(require,module){(function(global){!function(){function Diff2Html(){}var diffParser=require("./diff-parser.js").DiffParser,fileLister=require("./file-list-printer.js").FileListPrinter,htmlPrinter=require("./html-printer.js").HtmlPrinter;Diff2Html.prototype.getJsonFromDiff=function(diffInput,config){var configOrEmpty=config||{};return diffParser.generateDiffJson(diffInput,configOrEmpty)},Diff2Html.prototype.getPrettyHtml=function(diffInput,config){var configOrEmpty=config||{},diffJson=diffInput;configOrEmpty.inputFormat&&"diff"!==configOrEmpty.inputFormat||(diffJson=diffParser.generateDiffJson(diffInput,configOrEmpty));var fileList="";configOrEmpty.showFiles===!0&&(fileList=fileLister.generateFileList(diffJson,configOrEmpty));var diffOutput="";return diffOutput="side-by-side"===configOrEmpty.outputFormat?htmlPrinter.generateSideBySideJsonHtml(diffJson,configOrEmpty):htmlPrinter.generateLineByLineJsonHtml(diffJson,configOrEmpty),fileList+diffOutput},Diff2Html.prototype.getPrettyHtmlFromDiff=function(diffInput,config){var configOrEmpty=config||{};return configOrEmpty.inputFormat="diff",configOrEmpty.outputFormat="line-by-line",this.getPrettyHtml(diffInput,configOrEmpty)},Diff2Html.prototype.getPrettyHtmlFromJson=function(diffJson,config){var configOrEmpty=config||{};return configOrEmpty.inputFormat="json",configOrEmpty.outputFormat="line-by-line",this.getPrettyHtml(diffJson,configOrEmpty)},Diff2Html.prototype.getPrettySideBySideHtmlFromDiff=function(diffInput,config){var configOrEmpty=config||{};return configOrEmpty.inputFormat="diff",configOrEmpty.outputFormat="side-by-side",this.getPrettyHtml(diffInput,configOrEmpty)},Diff2Html.prototype.getPrettySideBySideHtmlFromJson=function(diffJson,config){var configOrEmpty=config||{};return configOrEmpty.inputFormat="json",configOrEmpty.outputFormat="side-by-side",this.getPrettyHtml(diffJson,configOrEmpty)};var diffObject=new Diff2Html;module.exports.Diff2Html=diffObject,global.Diff2Html=diffObject}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./diff-parser.js":22,"./file-list-printer.js":24,"./html-printer.js":26}],24:[function(require,module){!function(){function FileListPrinter(){}var printerUtils=require("./printer-utils.js").PrinterUtils;FileListPrinter.prototype.generateFileList=function(diffFiles){return'\n"},module.exports.FileListPrinter=new FileListPrinter}()},{"./printer-utils.js":28}],25:[function(require,module){(function(global,__dirname){!function(){function HoganJsUtils(){try{hoganTemplates=require("./templates/diff2html-templates.js")}catch(_ignore){hoganTemplates={}}}var hoganTemplates,fs=require("fs"),path=require("path"),hogan=require("hogan.js"),templatesPath=path.resolve(__dirname,"templates"),templatesCache={};HoganJsUtils.prototype.render=function(namespace,view,params){var templateKey=this._templateKey(namespace,view),template=this._getTemplate(templateKey);return template?template.render(params):null},HoganJsUtils.prototype._getTemplate=function(templateKey){var template=this._readFromCache(templateKey);return template||(template=this._loadTemplate(templateKey)),template},HoganJsUtils.prototype._loadTemplate=function(templateKey){var template;if(fs.readFileSync){var templatePath=path.join(templatesPath,templateKey),templateContent=fs.readFileSync(templatePath+".mustache","utf8");template=hogan.compile(templateContent),templatesCache[templateKey]=template}return template},HoganJsUtils.prototype._readFromCache=function(templateKey){return global.browserTemplates&&global.browserTemplates[templateKey]||hoganTemplates[templateKey]||templatesCache[templateKey]},HoganJsUtils.prototype._templateKey=function(namespace,view){return namespace+"-"+view},module.exports.HoganJsUtils=new HoganJsUtils}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},"/src")},{"./templates/diff2html-templates.js":31,fs:1,"hogan.js":18,path:20}],26:[function(require,module){!function(){function HtmlPrinter(){}var LineByLinePrinter=require("./line-by-line-printer.js").LineByLinePrinter,SideBySidePrinter=require("./side-by-side-printer.js").SideBySidePrinter;HtmlPrinter.prototype.generateLineByLineJsonHtml=function(diffFiles,config){var lineByLinePrinter=new LineByLinePrinter(config);return lineByLinePrinter.generateLineByLineJsonHtml(diffFiles)},HtmlPrinter.prototype.generateSideBySideJsonHtml=function(diffFiles,config){var sideBySidePrinter=new SideBySidePrinter(config);return sideBySidePrinter.generateSideBySideJsonHtml(diffFiles)},module.exports.HtmlPrinter=new HtmlPrinter}()},{"./line-by-line-printer.js":27,"./side-by-side-printer.js":30}],27:[function(require,module){!function(){function LineByLinePrinter(config){this.config=config}var diffParser=require("./diff-parser.js").DiffParser,printerUtils=require("./printer-utils.js").PrinterUtils,utils=require("./utils.js").Utils,Rematch=require("./rematch.js").Rematch,hoganUtils=require("./hoganjs-utils.js").HoganJsUtils,baseTemplatesPath="line-by-line";LineByLinePrinter.prototype.makeFileDiffHtml=function(file,diffs){return hoganUtils.render(baseTemplatesPath,"file-diff",{file:file,fileDiffName:printerUtils.getDiffName(file),fileHtmlId:printerUtils.getHtmlId(file),diffs:diffs})},LineByLinePrinter.prototype.makeLineByLineHtmlWrapper=function(content){return hoganUtils.render(baseTemplatesPath,"wrapper",{content:content})},LineByLinePrinter.prototype.generateLineByLineJsonHtml=function(diffFiles){var that=this,htmlDiffs=diffFiles.map(function(file){var diffs;return diffs=file.blocks.length?that._generateFileHtml(file):that._generateEmptyDiff(),that.makeFileDiffHtml(file,diffs)});return this.makeLineByLineHtmlWrapper(htmlDiffs.join("\n"))};var matcher=Rematch.rematch(function(a,b){var amod=a.content.substr(1),bmod=b.content.substr(1);return Rematch.distance(amod,bmod)});LineByLinePrinter.prototype.makeColumnLineNumberHtml=function(block){return hoganUtils.render(baseTemplatesPath,"column-line-number",{diffParser:diffParser,block:utils.escape(block.header)})},LineByLinePrinter.prototype._generateFileHtml=function(file){var that=this;return file.blocks.map(function(block){function processChangeBlock(){var matches,insertType,deleteType,comparisons=oldLines.length*newLines.length,maxComparisons=that.config.matchingMaxComparisons||2500,doMatching=maxComparisons>comparisons&&("lines"===that.config.matching||"words"===that.config.matching);doMatching?(matches=matcher(oldLines,newLines),insertType=diffParser.LINE_TYPE.INSERT_CHANGES,deleteType=diffParser.LINE_TYPE.DELETE_CHANGES):(matches=[[oldLines,newLines]],insertType=diffParser.LINE_TYPE.INSERTS,deleteType=diffParser.LINE_TYPE.DELETES),matches.forEach(function(match){oldLines=match[0],newLines=match[1];for(var oldLine,newLine,processedOldLines=[],processedNewLines=[],common=Math.min(oldLines.length,newLines.length),j=0;common>j;j++){oldLine=oldLines[j],newLine=newLines[j],that.config.isCombined=file.isCombined;var diff=printerUtils.diffHighlight(oldLine.content,newLine.content,that.config);processedOldLines+=that.makeLineHtml(deleteType,oldLine.oldNumber,oldLine.newNumber,diff.first.line,diff.first.prefix),processedNewLines+=that.makeLineHtml(insertType,newLine.oldNumber,newLine.newNumber,diff.second.line,diff.second.prefix)}lines+=processedOldLines+processedNewLines,lines+=that._processLines(oldLines.slice(common),newLines.slice(common))}),oldLines=[],newLines=[]}for(var lines=that.makeColumnLineNumberHtml(block),oldLines=[],newLines=[],i=0;i0||line.type!==diffParser.LINE_TYPE.DELETES&&oldLines.length>0)&&processChangeBlock(),line.type===diffParser.LINE_TYPE.CONTEXT?lines+=that.makeLineHtml(line.type,line.oldNumber,line.newNumber,escapedLine):line.type!==diffParser.LINE_TYPE.INSERTS||oldLines.length?line.type===diffParser.LINE_TYPE.DELETES?oldLines.push(line):line.type===diffParser.LINE_TYPE.INSERTS&&Boolean(oldLines.length)?newLines.push(line):(console.error("Unknown state in html line-by-line generator"),processChangeBlock()):lines+=that.makeLineHtml(line.type,line.oldNumber,line.newNumber,escapedLine)}return processChangeBlock(),lines}).join("\n")},LineByLinePrinter.prototype._processLines=function(oldLines,newLines){for(var lines="",i=0;i]*>((.|\n)*?)<\/ins>)/g,"")}function removeDel(line){return line.replace(/(]*>((.|\n)*?)<\/del>)/g,"")}var jsDiff=require("diff"),utils=require("./utils.js").Utils,Rematch=require("./rematch.js").Rematch;PrinterUtils.prototype.getHtmlId=function(file){var hashCode=function(text){var i,chr,len,hash=0;if(0===text.length)return hash;for(i=0,len=text.length;len>i;i++)chr=text.charCodeAt(i),hash=(hash<<5)-hash+chr,hash|=0;return hash};return"d2h-"+hashCode(this.getDiffName(file)).toString().slice(-6)},PrinterUtils.prototype.getDiffName=function(file){var oldFilename=file.oldName,newFilename=file.newName;return oldFilename&&newFilename&&oldFilename!==newFilename&&!isDevNullName(oldFilename)&&!isDevNullName(newFilename)?oldFilename+" -> "+newFilename:newFilename&&!isDevNullName(newFilename)?newFilename:oldFilename?oldFilename:"Unknown filename"},PrinterUtils.prototype.diffHighlight=function(diffLine1,diffLine2,config){var linePrefix1,linePrefix2,unprefixedLine1,unprefixedLine2,prefixSize=1;config.isCombined&&(prefixSize=2),linePrefix1=diffLine1.substr(0,prefixSize),linePrefix2=diffLine2.substr(0,prefixSize),unprefixedLine1=diffLine1.substr(prefixSize),unprefixedLine2=diffLine2.substr(prefixSize);var diff;diff=config.charByChar?jsDiff.diffChars(unprefixedLine1,unprefixedLine2):jsDiff.diffWordsWithSpace(unprefixedLine1,unprefixedLine2);var highlightedLine="",changedWords=[];if(!config.charByChar&&"words"===config.matching){var treshold=.25;"undefined"!=typeof config.matchWordsThreshold&&(treshold=config.matchWordsThreshold);var matcher=Rematch.rematch(function(a,b){var amod=a.value,bmod=b.value;return Rematch.distance(amod,bmod)}),removed=diff.filter(function(element){return element.removed}),added=diff.filter(function(element){return element.added}),chunks=matcher(added,removed);chunks.forEach(function(chunk){if(1===chunk[0].length&&1===chunk[1].length){var dist=Rematch.distance(chunk[0][0].value,chunk[1][0].value);treshold>dist&&(changedWords.push(chunk[0][0]),changedWords.push(chunk[1][0]))}})}return diff.forEach(function(part){var addClass=changedWords.indexOf(part)>-1?' class="d2h-change"':"",elemType=part.added?"ins":part.removed?"del":null,escapedValue=utils.escape(part.value);highlightedLine+=null!==elemType?"<"+elemType+addClass+">"+escapedValue+""+elemType+">":escapedValue}),{first:{prefix:linePrefix1,line:removeIns(highlightedLine)},second:{prefix:linePrefix2,line:removeDel(highlightedLine)}}},module.exports.PrinterUtils=new PrinterUtils}()},{"./rematch.js":29,"./utils.js":32,diff:11}],29:[function(require,module){!function(){function levenshtein(a,b){if(0==a.length)return b.length;if(0==b.length)return a.length;var i,matrix=[];for(i=0;i<=b.length;i++)matrix[i]=[i];var j;for(j=0;j<=a.length;j++)matrix[0][j]=j;for(i=1;i<=b.length;i++)for(j=1;j<=a.length;j++)matrix[i][j]=b.charAt(i-1)==a.charAt(j-1)?matrix[i-1][j-1]:Math.min(matrix[i-1][j-1]+1,Math.min(matrix[i][j-1]+1,matrix[i-1][j]+1));return matrix[b.length][a.length]}var Rematch={};Rematch.arrayToString=function arrayToString(a){return"[object Array]"===Object.prototype.toString.apply(a,[])?"["+a.map(arrayToString).join(", ")+"]":a},Rematch.levenshtein=levenshtein,Rematch.distance=function(x,y){x=x.trim(),y=y.trim();var lev=levenshtein(x,y),score=lev/(x.length+y.length);return score},Rematch.rematch=function(distanceFunction){function findBestMatch(a,b,cache){var cachecount=0;for(var key in cache)cachecount++;for(var bestMatch,bestMatchDist=1/0,i=0;imd&&(bestMatchDist=md,bestMatch={indexA:i,indexB:j,score:bestMatchDist})}return bestMatch}function group(a,b,level,cache){"undefined"==typeof cache&&(cache={});var bm=findBestMatch(a,b,cache);if(level||(level=0),!bm||a.length+b.length<3)return[[a,b]];var a1=a.slice(0,bm.indexA),b1=b.slice(0,bm.indexB),aMatch=[a[bm.indexA]],bMatch=[b[bm.indexB]],tailA=bm.indexA+1,tailB=bm.indexB+1,a2=a.slice(tailA),b2=b.slice(tailB),group1=group(a1,b1,level+1,cache),groupMatch=group(aMatch,bMatch,level+1,cache),group2=group(a2,b2,level+1,cache),result=groupMatch;return(bm.indexA>0||bm.indexB>0)&&(result=group1.concat(result)),(a.length>tailA||b.length>tailB)&&(result=result.concat(group2)),result}return group},module.exports.Rematch=Rematch}()},{}],30:[function(require,module){!function(){function SideBySidePrinter(config){this.config=config}var diffParser=require("./diff-parser.js").DiffParser,printerUtils=require("./printer-utils.js").PrinterUtils,utils=require("./utils.js").Utils,Rematch=require("./rematch.js").Rematch,matcher=Rematch.rematch(function(a,b){var amod=a.content.substr(1),bmod=b.content.substr(1);return Rematch.distance(amod,bmod)});SideBySidePrinter.prototype.makeDiffHtml=function(file,diffs){return'\n"},SideBySidePrinter.prototype.generateSideBySideJsonHtml=function(diffFiles){var that=this;return'\n'+diffFiles.map(function(file){var diffs;return diffs=file.blocks.length?that.generateSideBySideFileHtml(file):that.generateEmptyDiff(),that.makeDiffHtml(file,diffs)}).join("\n")+"
\n"},SideBySidePrinter.prototype.makeSideHtml=function(blockHeader){return'\n | \n \n '+blockHeader+" \n | \n
\n"},SideBySidePrinter.prototype.generateSideBySideFileHtml=function(file){var that=this,fileHtml={};return fileHtml.left="",fileHtml.right="",file.blocks.forEach(function(block){function processChangeBlock(){var matches,insertType,deleteType,comparisons=oldLines.length*newLines.length,maxComparisons=that.config.matchingMaxComparisons||2500,doMatching=maxComparisons>comparisons&&("lines"===that.config.matching||"words"===that.config.matching);doMatching?(matches=matcher(oldLines,newLines),insertType=diffParser.LINE_TYPE.INSERT_CHANGES,deleteType=diffParser.LINE_TYPE.DELETE_CHANGES):(matches=[[oldLines,newLines]],insertType=diffParser.LINE_TYPE.INSERTS,deleteType=diffParser.LINE_TYPE.DELETES),matches.forEach(function(match){oldLines=match[0],newLines=match[1];for(var common=Math.min(oldLines.length,newLines.length),max=Math.max(oldLines.length,newLines.length),j=0;common>j;j++){var oldLine=oldLines[j],newLine=newLines[j];that.config.isCombined=file.isCombined;var diff=printerUtils.diffHighlight(oldLine.content,newLine.content,that.config);fileHtml.left+=that.generateSingleLineHtml(deleteType,oldLine.oldNumber,diff.first.line,diff.first.prefix),fileHtml.right+=that.generateSingleLineHtml(insertType,newLine.newNumber,diff.second.line,diff.second.prefix)}if(max>common){var oldSlice=oldLines.slice(common),newSlice=newLines.slice(common),tmpHtml=that.processLines(oldSlice,newSlice);fileHtml.left+=tmpHtml.left,fileHtml.right+=tmpHtml.right}}),oldLines=[],newLines=[]}fileHtml.left+=that.makeSideHtml(utils.escape(block.header)),fileHtml.right+=that.makeSideHtml("");
+
+for(var oldLines=[],newLines=[],i=0;i0||line.type!==diffParser.LINE_TYPE.DELETES&&oldLines.length>0)&&processChangeBlock(),line.type===diffParser.LINE_TYPE.CONTEXT?(fileHtml.left+=that.generateSingleLineHtml(line.type,line.oldNumber,escapedLine,prefix),fileHtml.right+=that.generateSingleLineHtml(line.type,line.newNumber,escapedLine,prefix)):line.type!==diffParser.LINE_TYPE.INSERTS||oldLines.length?line.type===diffParser.LINE_TYPE.DELETES?oldLines.push(line):line.type===diffParser.LINE_TYPE.INSERTS&&Boolean(oldLines.length)?newLines.push(line):(console.error("unknown state in html side-by-side generator"),processChangeBlock()):(fileHtml.left+=that.generateSingleLineHtml(diffParser.LINE_TYPE.CONTEXT,"","",""),fileHtml.right+=that.generateSingleLineHtml(line.type,line.newNumber,escapedLine,prefix))}processChangeBlock()}),fileHtml},SideBySidePrinter.prototype.processLines=function(oldLines,newLines){var that=this,fileHtml={};fileHtml.left="",fileHtml.right="";for(var maxLinesNumber=Math.max(oldLines.length,newLines.length),i=0;maxLinesNumber>i;i++){var oldContent,newContent,oldPrefix,newPrefix,oldLine=oldLines[i],newLine=newLines[i];oldLine&&(oldContent=utils.escape(oldLine.content.substr(1)),oldPrefix=oldLine.content[0]),newLine&&(newContent=utils.escape(newLine.content.substr(1)),newPrefix=newLine.content[0]),oldLine&&newLine?(fileHtml.left+=that.generateSingleLineHtml(oldLine.type,oldLine.oldNumber,oldContent,oldPrefix),fileHtml.right+=that.generateSingleLineHtml(newLine.type,newLine.newNumber,newContent,newPrefix)):oldLine?(fileHtml.left+=that.generateSingleLineHtml(oldLine.type,oldLine.oldNumber,oldContent,oldPrefix),fileHtml.right+=that.generateSingleLineHtml(diffParser.LINE_TYPE.CONTEXT,"","","")):newLine?(fileHtml.left+=that.generateSingleLineHtml(diffParser.LINE_TYPE.CONTEXT,"","",""),fileHtml.right+=that.generateSingleLineHtml(newLine.type,newLine.newNumber,newContent,newPrefix)):console.error("How did it get here?")}return fileHtml},SideBySidePrinter.prototype.makeSingleLineHtml=function(type,number,htmlContent,htmlPrefix){return'\n | '+number+' | \n '+htmlPrefix+htmlContent+" | \n
\n"},SideBySidePrinter.prototype.generateSingleLineHtml=function(type,number,content,prefix){var htmlPrefix="";prefix&&(htmlPrefix=''+prefix+"");var htmlContent="";return content&&(htmlContent=''+content+""),this.makeSingleLineHtml(type,number,htmlContent,htmlPrefix)},SideBySidePrinter.prototype.generateEmptyDiff=function(){var fileHtml={};return fileHtml.right="",fileHtml.left='\n | File without changes | \n
\n',fileHtml},module.exports.SideBySidePrinter=SideBySidePrinter}()},{"./diff-parser.js":22,"./printer-utils.js":28,"./rematch.js":29,"./utils.js":32}],31:[function(require,module){(function(global){!function(){global.browserTemplates||(global.browserTemplates={}),global.browserTemplates["line-by-line-column-line-number"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b(""),t.b("\n"+i),t.b(' | '),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(' '),t.b(t.t(t.f("blockHeader",c,p,0))),t.b(" "),t.b("\n"+i),t.b(" | "),t.b("\n"+i),t.b("
"),t.fl()},partials:{},subs:{}}),global.browserTemplates["line-by-line-empty-diff"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b(""),t.b("\n"+i),t.b(' | '),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(" File without changes"),t.b("\n"+i),t.b(" "),t.b("\n"+i),t.b(" | "),t.b("\n"+i),t.b("
"),t.fl()},partials:{},subs:{}}),global.browserTemplates["line-by-line-file-diff"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b(''),t.b("\n"+i),t.b(' "),t.b("\n"+i),t.b('
'),t.b("\n"+i),t.b('
'),t.b("\n"+i),t.b('
'),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("diffs",c,p,0))),t.b("\n"+i),t.b(" "),t.b("\n"+i),t.b("
"),t.b("\n"+i),t.b("
"),t.b("\n"+i),t.b("
"),t.b("\n"+i),t.b("
"),t.fl()},partials:{},subs:{}}),global.browserTemplates["line-by-line-line"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b(""),t.b("\n"+i),t.b(' | '),t.b("\n"+i),t.b(' '),t.b(t.v(t.f("oldNumber",c,p,0))),t.b(" "),t.b("\n"+i),t.b(' '),t.b(t.v(t.f("newNumber",c,p,0))),t.b(" "),t.b("\n"+i),t.b(" | "),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.s(t.f("prefix",c,p,1),c,p,0,253,329,"{{ }}")&&(t.rs(c,p,function(c,p,t){t.b(' '),t.b(t.t(t.f("prefix",c,p,0))),t.b(""),t.b("\n"+i)}),c.pop()),t.s(t.f("content",c,p,1),c,p,0,361,435,"{{ }}")&&(t.rs(c,p,function(c,p,t){t.b(' '),t.b(t.t(t.f("content",c,p,0))),t.b(""),t.b("\n"+i)}),c.pop()),t.b(" "),t.b("\n"+i),t.b(" | "),t.b("\n"+i),t.b("
"),t.fl()},partials:{},subs:{}}),global.browserTemplates["line-by-line-wrapper"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b(''),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("content",c,p,0))),t.b("\n"+i),t.b("
"),t.fl()},partials:{},subs:{}}),module.exports=global.browserTemplates}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],32:[function(require,module){!function(){function Utils(){}Utils.prototype.convertWhiteSpaceToNonBreakingSpace=function(str){return str.slice(0).replace(/ /g," ")},Utils.prototype.escape=function(str){return str.slice(0).replace(/&/g,"&").replace(//g,">").replace(/\t/g," ")},Utils.prototype.startsWith=function(str,start){if("object"==typeof start){var result=!1;return start.forEach(function(s){0===str.indexOf(s)&&(result=!0)}),result}return 0===str.indexOf(start)},Utils.prototype.valueOrEmpty=function(value){return value?value:""},module.exports.Utils=new Utils}()},{}]},{},[23]);
\ No newline at end of file
diff --git a/package.json b/package.json
index 21825d0..39c6281 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "diff2html",
- "version": "2.0.0-beta10",
+ "version": "2.0.0-beta11",
"homepage": "http://rtfpessoa.github.io/diff2html/",
"description": "Fast Diff to colorized HTML",
"keywords": [
@@ -38,9 +38,9 @@
"scripts": {
"release": "./scripts/release.sh",
"templates": "./scripts/hulk.js --wrapper node --variable 'browserTemplates' ./src/templates/*.mustache > ./src/templates/diff2html-templates.js",
- "test": "istanbul cover _mocha --report lcovonly -- -u exports -R spec ./test/**/*",
+ "test": "istanbul cover -x '**/templates/**' -x 'rematch.js' _mocha -- -u exports -R spec ./test/**/*",
"style": "jscs src test",
- "codacy": "istanbul cover _mocha --report lcovonly -- -u exports -R spec ./test/**/* && cat ./coverage/lcov.info | codacy-coverage"
+ "codacy": "istanbul cover -x '**/templates/**' -x 'rematch.js' _mocha -- -u exports -R spec ./test/**/* && cat ./coverage/lcov.info | codacy-coverage"
},
"main": "./src/diff2html.js",
"browser": {