diff2html 2.12.1 → 2.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,6 +8,7 @@
8
8
  [![npm](https://img.shields.io/npm/v/diff2html.svg)](https://www.npmjs.com/package/diff2html)
9
9
  [![Dependency Status](https://david-dm.org/rtfpessoa/diff2html.svg)](https://david-dm.org/rtfpessoa/diff2html)
10
10
  [![devDependency Status](https://david-dm.org/rtfpessoa/diff2html/dev-status.svg)](https://david-dm.org/rtfpessoa/diff2html#info=devDependencies)
11
+ [![cdnjs](https://img.shields.io/cdnjs/v/diff2html)](https://cdnjs.com/libraries/diff2html)
11
12
 
12
13
  [![node](https://img.shields.io/node/v/diff2html.svg)]()
13
14
  [![npm](https://img.shields.io/npm/l/diff2html.svg)]()
package/dist/diff2html.js CHANGED
@@ -4664,9 +4664,9 @@ process.umask = function() { return 0; };
4664
4664
  lineClass += ' d2h-code-side-emptyplaceholder';
4665
4665
  contentClass += ' d2h-code-side-emptyplaceholder';
4666
4666
  type += ' d2h-emptyplaceholder';
4667
- }
4668
-
4669
- if (!prefix) {
4667
+ prefix = ' ';
4668
+ lineWithoutPrefix = ' ';
4669
+ } else if (!prefix) {
4670
4670
  var lineWithPrefix = printerUtils.separatePrefix(isCombined, content);
4671
4671
  prefix = lineWithPrefix.prefix;
4672
4672
  lineWithoutPrefix = lineWithPrefix.line;
@@ -1 +1 @@
1
- !function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){return o(e[i][1][r]||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}({1:[function(require,module,exports){},{}],2:[function(require,module,exports){var global,factory;global=this,factory=function(exports){"use strict";function Diff(){}function buildValues(diff,components,newString,oldString,useLongestToken){for(var componentPos=0,componentLen=components.length,newPos=0,oldPos=0;componentPos<componentLen;componentPos++){var component=components[componentPos];if(component.removed){if(component.value=diff.join(oldString.slice(oldPos,oldPos+component.count)),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=diff.join(value)}else component.value=diff.join(newString.slice(newPos,newPos+component.count));newPos+=component.count,component.added||(oldPos+=component.count)}}var lastComponent=components[componentLen-1];return 1<componentLen&&"string"==typeof lastComponent.value&&(lastComponent.added||lastComponent.removed)&&diff.equals("",lastComponent.value)&&(components[componentLen-2].value+=lastComponent.value,components.pop()),components}Diff.prototype={diff:function(oldString,newString,argument_2){var options=2<arguments.length&&void 0!==argument_2?argument_2:{},callback=options.callback;"function"==typeof options&&(callback=options,options={}),this.options=options;var self=this;function done(value){return callback?(setTimeout(function(){callback(void 0,value)},0),!0):value}oldString=this.castInput(oldString),newString=this.castInput(newString),oldString=this.removeEmpty(this.tokenize(oldString));var newLen=(newString=this.removeEmpty(this.tokenize(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&&oldLen<=oldPos+1)return done([{value:this.join(newString),count:newString.length}]);function execEditLength(){for(var diagonalPath=-1*editLength;diagonalPath<=editLength;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<newLen,canRemove=removePath&&0<=_oldPos&&_oldPos<oldLen;if(canAdd||canRemove){if(!canAdd||canRemove&&addPath.newPos<removePath.newPos?(basePath={newPos:(path=removePath).newPos,components:path.components.slice(0)},self.pushComponent(basePath.components,void 0,!0)):((basePath=addPath).newPos++,self.pushComponent(basePath.components,!0,void 0)),_oldPos=self.extractCommon(basePath,newString,oldString,diagonalPath),basePath.newPos+1>=newLen&&oldLen<=_oldPos+1)return done(buildValues(self,basePath.components,newString,oldString,self.useLongestToken));bestPath[diagonalPath]=basePath}else bestPath[diagonalPath]=void 0}var path;editLength++}if(callback)!function exec(){setTimeout(function(){if(maxEditLength<editLength)return callback();execEditLength()||exec()},0)}();else for(;editLength<=maxEditLength;){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;newPos+1<newLen&&oldPos+1<oldLen&&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 this.options.comparator?this.options.comparator(left,right):left===right||this.options.ignoreCase&&left.toLowerCase()===right.toLowerCase()},removeEmpty:function(array){for(var ret=[],i=0;i<array.length;i++)array[i]&&ret.push(array[i]);return ret},castInput:function(value){return value},tokenize:function(value){return value.split("")},join:function(chars){return chars.join("")}};var characterDiff=new Diff;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}var extendedWordChars=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,reWhitespace=/\S/,wordDiff=new Diff;wordDiff.equals=function(left,right){return this.options.ignoreCase&&(left=left.toLowerCase(),right=right.toLowerCase()),left===right||this.options.ignoreWhitespace&&!reWhitespace.test(left)&&!reWhitespace.test(right)},wordDiff.tokenize=function(value){for(var tokens=value.split(/(\s+|[()[\]{}'"]|\b)/),i=0;i<tokens.length-1;i++)!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 lineDiff=new Diff;function diffLines(oldStr,newStr,callback){return lineDiff.diff(oldStr,newStr,callback)}lineDiff.tokenize=function(value){var retLines=[],linesAndNewlines=value.split(/(\n|\r\n)/);linesAndNewlines[linesAndNewlines.length-1]||linesAndNewlines.pop();for(var i=0;i<linesAndNewlines.length;i++){var line=linesAndNewlines[i];i%2&&!this.options.newlineIsToken?retLines[retLines.length-1]+=line:(this.options.ignoreWhitespace&&(line=line.trim()),retLines.push(line))}return retLines};var sentenceDiff=new Diff;sentenceDiff.tokenize=function(value){return value.split(/(\S.+?[.!?])(?=\s+|$)/)};var cssDiff=new Diff;function _typeof(obj){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj})(obj)}function _toConsumableArray(arr){return function(arr){if(Array.isArray(arr)){for(var i=0,arr2=new Array(arr.length);i<arr.length;i++)arr2[i]=arr[i];return arr2}}(arr)||function(iter){if(Symbol.iterator in Object(iter)||"[object Arguments]"===Object.prototype.toString.call(iter))return Array.from(iter)}(arr)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}cssDiff.tokenize=function(value){return value.split(/([{}:;,]|\s+)/)};var objectPrototypeToString=Object.prototype.toString,jsonDiff=new Diff;function canonicalize(obj,stack,replacementStack,replacer,key){var i,canonicalizedObj;for(stack=stack||[],replacementStack=replacementStack||[],replacer&&(obj=replacer(key,obj)),i=0;i<stack.length;i+=1)if(stack[i]===obj)return replacementStack[i];if("[object Array]"===objectPrototypeToString.call(obj)){for(stack.push(obj),canonicalizedObj=new Array(obj.length),replacementStack.push(canonicalizedObj),i=0;i<obj.length;i+=1)canonicalizedObj[i]=canonicalize(obj[i],stack,replacementStack,replacer,key);return stack.pop(),replacementStack.pop(),canonicalizedObj}if(obj&&obj.toJSON&&(obj=obj.toJSON()),"object"===_typeof(obj)&&null!==obj){stack.push(obj),canonicalizedObj={},replacementStack.push(canonicalizedObj);var _key,sortedKeys=[];for(_key in obj)obj.hasOwnProperty(_key)&&sortedKeys.push(_key);for(sortedKeys.sort(),i=0;i<sortedKeys.length;i+=1)canonicalizedObj[_key=sortedKeys[i]]=canonicalize(obj[_key],stack,replacementStack,replacer,_key);stack.pop(),replacementStack.pop()}else canonicalizedObj=obj;return canonicalizedObj}jsonDiff.useLongestToken=!0,jsonDiff.tokenize=lineDiff.tokenize,jsonDiff.castInput=function(value){var _this$options=this.options,undefinedReplacement=_this$options.undefinedReplacement,_this$options$stringi=_this$options.stringifyReplacer,stringifyReplacer=void 0===_this$options$stringi?function(k,v){return void 0===v?undefinedReplacement:v}:_this$options$stringi;return"string"==typeof value?value:JSON.stringify(canonicalize(value,null,null,stringifyReplacer),stringifyReplacer," ")},jsonDiff.equals=function(left,right){return Diff.prototype.equals.call(jsonDiff,left.replace(/,([\r\n])/g,"$1"),right.replace(/,([\r\n])/g,"$1"))};var arrayDiff=new Diff;function parsePatch(uniDiff){var options=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},diffstr=uniDiff.split(/\r\n|[\n\v\f\r\x85]/),delimiters=uniDiff.match(/\r\n|[\n\v\f\r\x85]/g)||[],list=[],i=0;function parseIndex(){var index={};for(list.push(index);i<diffstr.length;){var line=diffstr[i];if(/^(\-\-\-|\+\+\+|@@)\s/.test(line))break;var header=/^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line);header&&(index.index=header[1]),i++}for(parseFileHeader(index),parseFileHeader(index),index.hunks=[];i<diffstr.length;){var _line=diffstr[i];if(/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line))break;if(/^@@/.test(_line))index.hunks.push(parseHunk());else{if(_line&&options.strict)throw new Error("Unknown line "+(i+1)+" "+JSON.stringify(_line));i++}}}function parseFileHeader(index){var fileHeader=/^(---|\+\+\+)\s+(.*)$/.exec(diffstr[i]);if(fileHeader){var keyPrefix="---"===fileHeader[1]?"old":"new",data=fileHeader[2].split("\t",2),fileName=data[0].replace(/\\\\/g,"\\");/^".*"$/.test(fileName)&&(fileName=fileName.substr(1,fileName.length-2)),index[keyPrefix+"FileName"]=fileName,index[keyPrefix+"Header"]=(data[1]||"").trim(),i++}}function parseHunk(){for(var chunkHeaderIndex=i,chunkHeader=diffstr[i++].split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/),hunk={oldStart:+chunkHeader[1],oldLines:+chunkHeader[2]||1,newStart:+chunkHeader[3],newLines:+chunkHeader[4]||1,lines:[],linedelimiters:[]},addCount=0,removeCount=0;i<diffstr.length&&!(0===diffstr[i].indexOf("--- ")&&i+2<diffstr.length&&0===diffstr[i+1].indexOf("+++ ")&&0===diffstr[i+2].indexOf("@@"));i++){var operation=0==diffstr[i].length&&i!=diffstr.length-1?" ":diffstr[i][0];if("+"!==operation&&"-"!==operation&&" "!==operation&&"\\"!==operation)break;hunk.lines.push(diffstr[i]),hunk.linedelimiters.push(delimiters[i]||"\n"),"+"===operation?addCount++:"-"===operation?removeCount++:" "===operation&&(addCount++,removeCount++)}if(addCount||1!==hunk.newLines||(hunk.newLines=0),removeCount||1!==hunk.oldLines||(hunk.oldLines=0),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}for(;i<diffstr.length;)parseIndex();return list}function distanceIterator(start,minLine,maxLine){var wantForward=!0,backwardExhausted=!1,forwardExhausted=!1,localOffset=1;return function iterator(){if(wantForward&&!forwardExhausted){if(backwardExhausted?localOffset++:wantForward=!1,start+localOffset<=maxLine)return localOffset;forwardExhausted=!0}if(!backwardExhausted)return forwardExhausted||(wantForward=!0),minLine<=start-localOffset?-localOffset++:(backwardExhausted=!0,iterator())}}function applyPatch(source,uniDiff){var options=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if("string"==typeof uniDiff&&(uniDiff=parsePatch(uniDiff)),Array.isArray(uniDiff)){if(1<uniDiff.length)throw new Error("applyPatch only works with a single input.");uniDiff=uniDiff[0]}var removeEOFNL,addEOFNL,lines=source.split(/\r\n|[\n\v\f\r\x85]/),delimiters=source.match(/\r\n|[\n\v\f\r\x85]/g)||[],hunks=uniDiff.hunks,compareLine=options.compareLine||function(lineNumber,line,operation,patchContent){return line===patchContent},errorCount=0,fuzzFactor=options.fuzzFactor||0,minLine=0,offset=0;function hunkFits(hunk,toPos){for(var j=0;j<hunk.lines.length;j++){var line=hunk.lines[j],operation=0<line.length?line[0]:" ",content=0<line.length?line.substr(1):line;if(" "===operation||"-"===operation){if(!compareLine(toPos+1,lines[toPos],operation,content)&&fuzzFactor<++errorCount)return!1;toPos++}}return!0}for(var i=0;i<hunks.length;i++){for(var hunk=hunks[i],maxLine=lines.length-hunk.oldLines,localOffset=0,toPos=offset+hunk.oldStart-1,iterator=distanceIterator(toPos,minLine,maxLine);void 0!==localOffset;localOffset=iterator())if(hunkFits(hunk,toPos+localOffset)){hunk.offset=offset+=localOffset;break}if(void 0===localOffset)return!1;minLine=hunk.offset+hunk.oldStart+hunk.oldLines}for(var diffOffset=0,_i=0;_i<hunks.length;_i++){var _hunk=hunks[_i],_toPos=_hunk.oldStart+_hunk.offset+diffOffset-1;diffOffset+=_hunk.newLines-_hunk.oldLines,_toPos<0&&(_toPos=0);for(var j=0;j<_hunk.lines.length;j++){var line=_hunk.lines[j],operation=0<line.length?line[0]:" ",content=0<line.length?line.substr(1):line,delimiter=_hunk.linedelimiters[j];if(" "===operation)_toPos++;else if("-"===operation)lines.splice(_toPos,1),delimiters.splice(_toPos,1);else if("+"===operation)lines.splice(_toPos,0,content),delimiters.splice(_toPos,0,delimiter),_toPos++;else if("\\"===operation){var previousOperation=_hunk.lines[j-1]?_hunk.lines[j-1][0]:null;"+"===previousOperation?removeEOFNL=!0:"-"===previousOperation&&(addEOFNL=!0)}}}if(removeEOFNL)for(;!lines[lines.length-1];)lines.pop(),delimiters.pop();else addEOFNL&&(lines.push(""),delimiters.push("\n"));for(var _k=0;_k<lines.length-1;_k++)lines[_k]=lines[_k]+delimiters[_k];return lines.join("")}function structuredPatch(oldFileName,newFileName,oldStr,newStr,oldHeader,newHeader,options){void 0===(options=options||{}).context&&(options.context=4);var diff=diffLines(oldStr,newStr,options);function contextLines(lines){return lines.map(function(entry){return" "+entry})}diff.push({value:"",lines:[]});for(var hunks=[],oldRangeStart=0,newRangeStart=0,curRange=[],oldLine=1,newLine=1,_loop=function(i){var current=diff[i],lines=current.lines||current.value.replace(/\n$/,"").split("\n");if(current.lines=lines,current.added||current.removed){var _curRange;if(!oldRangeStart){var prev=diff[i-1];oldRangeStart=oldLine,newRangeStart=newLine,prev&&(curRange=0<options.context?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){var _curRange2;(_curRange2=curRange).push.apply(_curRange2,_toConsumableArray(contextLines(lines)))}else{var _curRange3,contextSize=Math.min(lines.length,options.context);(_curRange3=curRange).push.apply(_curRange3,_toConsumableArray(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){var oldEOFNewline=/\n$/.test(oldStr),newEOFNewline=/\n$/.test(newStr),noNlBeforeAdds=0==lines.length&&curRange.length>hunk.oldLines;!oldEOFNewline&&noNlBeforeAdds&&curRange.splice(hunk.oldLines,0,"\"),(oldEOFNewline||noNlBeforeAdds)&&newEOFNewline||curRange.push("\")}hunks.push(hunk),newRangeStart=oldRangeStart=0,curRange=[]}oldLine+=lines.length,newLine+=lines.length}},i=0;i<diff.length;i++)_loop(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),ret=[];oldFileName==newFileName&&ret.push("Index: "+oldFileName),ret.push("==================================================================="),ret.push("--- "+diff.oldFileName+(void 0===diff.oldHeader?"":"\t"+diff.oldHeader)),ret.push("+++ "+diff.newFileName+(void 0===diff.newHeader?"":"\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 arrayStartsWith(array,start){if(start.length>array.length)return!1;for(var i=0;i<start.length;i++)if(start[i]!==array[i])return!1;return!0}function calcLineCount(hunk){var _calcOldNewLineCount=function calcOldNewLineCount(lines){var oldLines=0;var newLines=0;lines.forEach(function(line){if("string"!=typeof line){var myCount=calcOldNewLineCount(line.mine),theirCount=calcOldNewLineCount(line.theirs);void 0!==oldLines&&(myCount.oldLines===theirCount.oldLines?oldLines+=myCount.oldLines:oldLines=void 0),void 0!==newLines&&(myCount.newLines===theirCount.newLines?newLines+=myCount.newLines:newLines=void 0)}else void 0===newLines||"+"!==line[0]&&" "!==line[0]||newLines++,void 0===oldLines||"-"!==line[0]&&" "!==line[0]||oldLines++});return{oldLines:oldLines,newLines:newLines}}(hunk.lines),oldLines=_calcOldNewLineCount.oldLines,newLines=_calcOldNewLineCount.newLines;void 0!==oldLines?hunk.oldLines=oldLines:delete hunk.oldLines,void 0!==newLines?hunk.newLines=newLines:delete hunk.newLines}function loadPatch(param,base){if("string"!=typeof param)return param;if(/^@@/m.test(param)||/^Index:/m.test(param))return parsePatch(param)[0];if(!base)throw new Error("Must provide a base reference or pass in a patch");return structuredPatch(void 0,void 0,base,param)}function fileNameChanged(patch){return patch.newFileName&&patch.newFileName!==patch.oldFileName}function selectField(index,mine,theirs){return mine===theirs?mine:(index.conflict=!0,{mine:mine,theirs:theirs})}function hunkBefore(test,check){return test.oldStart<check.oldStart&&test.oldStart+test.oldLines<check.oldStart}function cloneHunk(hunk,offset){return{oldStart:hunk.oldStart,oldLines:hunk.oldLines,newStart:hunk.newStart+offset,newLines:hunk.newLines,lines:hunk.lines}}function mergeLines(hunk,mineOffset,mineLines,theirOffset,theirLines){var mine={offset:mineOffset,lines:mineLines,index:0},their={offset:theirOffset,lines:theirLines,index:0};for(insertLeading(hunk,mine,their),insertLeading(hunk,their,mine);mine.index<mine.lines.length&&their.index<their.lines.length;){var mineCurrent=mine.lines[mine.index],theirCurrent=their.lines[their.index];if("-"!==mineCurrent[0]&&"+"!==mineCurrent[0]||"-"!==theirCurrent[0]&&"+"!==theirCurrent[0])if("+"===mineCurrent[0]&&" "===theirCurrent[0]){var _hunk$lines;(_hunk$lines=hunk.lines).push.apply(_hunk$lines,_toConsumableArray(collectChange(mine)))}else if("+"===theirCurrent[0]&&" "===mineCurrent[0]){var _hunk$lines2;(_hunk$lines2=hunk.lines).push.apply(_hunk$lines2,_toConsumableArray(collectChange(their)))}else"-"===mineCurrent[0]&&" "===theirCurrent[0]?removal(hunk,mine,their):"-"===theirCurrent[0]&&" "===mineCurrent[0]?removal(hunk,their,mine,!0):mineCurrent===theirCurrent?(hunk.lines.push(mineCurrent),mine.index++,their.index++):conflict(hunk,collectChange(mine),collectChange(their));else mutualChange(hunk,mine,their)}insertTrailing(hunk,mine),insertTrailing(hunk,their),calcLineCount(hunk)}function mutualChange(hunk,mine,their){var myChanges=collectChange(mine),theirChanges=collectChange(their);if(allRemoves(myChanges)&&allRemoves(theirChanges)){var _hunk$lines3,_hunk$lines4;if(arrayStartsWith(myChanges,theirChanges)&&skipRemoveSuperset(their,myChanges,myChanges.length-theirChanges.length))return void(_hunk$lines3=hunk.lines).push.apply(_hunk$lines3,_toConsumableArray(myChanges));if(arrayStartsWith(theirChanges,myChanges)&&skipRemoveSuperset(mine,theirChanges,theirChanges.length-myChanges.length))return void(_hunk$lines4=hunk.lines).push.apply(_hunk$lines4,_toConsumableArray(theirChanges))}else if(function(a,b){return a.length===b.length&&arrayStartsWith(a,b)}(myChanges,theirChanges)){var _hunk$lines5;return void(_hunk$lines5=hunk.lines).push.apply(_hunk$lines5,_toConsumableArray(myChanges))}conflict(hunk,myChanges,theirChanges)}function removal(hunk,mine,their,swap){var _hunk$lines6,myChanges=collectChange(mine),theirChanges=function(state,matchChanges){var changes=[],merged=[],matchIndex=0,contextChanges=!1,conflicted=!1;for(;matchIndex<matchChanges.length&&state.index<state.lines.length;){var change=state.lines[state.index],match=matchChanges[matchIndex];if("+"===match[0])break;if(contextChanges=contextChanges||" "!==change[0],merged.push(match),matchIndex++,"+"===change[0])for(conflicted=!0;"+"===change[0];)changes.push(change),change=state.lines[++state.index];match.substr(1)===change.substr(1)?(changes.push(change),state.index++):conflicted=!0}"+"===(matchChanges[matchIndex]||"")[0]&&contextChanges&&(conflicted=!0);if(conflicted)return changes;for(;matchIndex<matchChanges.length;)merged.push(matchChanges[matchIndex++]);return{merged:merged,changes:changes}}(their,myChanges);theirChanges.merged?(_hunk$lines6=hunk.lines).push.apply(_hunk$lines6,_toConsumableArray(theirChanges.merged)):conflict(hunk,swap?theirChanges:myChanges,swap?myChanges:theirChanges)}function conflict(hunk,mine,their){hunk.conflict=!0,hunk.lines.push({conflict:!0,mine:mine,theirs:their})}function insertLeading(hunk,insert,their){for(;insert.offset<their.offset&&insert.index<insert.lines.length;){var line=insert.lines[insert.index++];hunk.lines.push(line),insert.offset++}}function insertTrailing(hunk,insert){for(;insert.index<insert.lines.length;){var line=insert.lines[insert.index++];hunk.lines.push(line)}}function collectChange(state){for(var ret=[],operation=state.lines[state.index][0];state.index<state.lines.length;){var line=state.lines[state.index];if("-"===operation&&"+"===line[0]&&(operation="+"),operation!==line[0])break;ret.push(line),state.index++}return ret}function allRemoves(changes){return changes.reduce(function(prev,change){return prev&&"-"===change[0]},!0)}function skipRemoveSuperset(state,removeChanges,delta){for(var i=0;i<delta;i++){var changeContent=removeChanges[removeChanges.length-delta+i].substr(1);if(state.lines[state.index+i]!==" "+changeContent)return!1}return state.index+=delta,!0}function escapeHTML(s){var n=s;return n=(n=(n=(n=n.replace(/&/g,"&amp;")).replace(/</g,"&lt;")).replace(/>/g,"&gt;")).replace(/"/g,"&quot;")}arrayDiff.tokenize=function(value){return value.slice()},arrayDiff.join=arrayDiff.removeEmpty=function(value){return value},exports.Diff=Diff,exports.diffChars=function(oldStr,newStr,options){return characterDiff.diff(oldStr,newStr,options)},exports.diffWords=function(oldStr,newStr,options){return options=generateOptions(options,{ignoreWhitespace:!0}),wordDiff.diff(oldStr,newStr,options)},exports.diffWordsWithSpace=function(oldStr,newStr,options){return wordDiff.diff(oldStr,newStr,options)},exports.diffLines=diffLines,exports.diffTrimmedLines=function(oldStr,newStr,callback){var options=generateOptions(callback,{ignoreWhitespace:!0});return lineDiff.diff(oldStr,newStr,options)},exports.diffSentences=function(oldStr,newStr,callback){return sentenceDiff.diff(oldStr,newStr,callback)},exports.diffCss=function(oldStr,newStr,callback){return cssDiff.diff(oldStr,newStr,callback)},exports.diffJson=function(oldObj,newObj,options){return jsonDiff.diff(oldObj,newObj,options)},exports.diffArrays=function(oldArr,newArr,callback){return arrayDiff.diff(oldArr,newArr,callback)},exports.structuredPatch=structuredPatch,exports.createTwoFilesPatch=createTwoFilesPatch,exports.createPatch=function(fileName,oldStr,newStr,oldHeader,newHeader,options){return createTwoFilesPatch(fileName,fileName,oldStr,newStr,oldHeader,newHeader,options)},exports.applyPatch=applyPatch,exports.applyPatches=function(uniDiff,options){"string"==typeof uniDiff&&(uniDiff=parsePatch(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,function(err){if(err)return options.complete(err);processIndex()})})}()},exports.parsePatch=parsePatch,exports.merge=function(mine,theirs,base){mine=loadPatch(mine,base),theirs=loadPatch(theirs,base);var ret={};(mine.index||theirs.index)&&(ret.index=mine.index||theirs.index),(mine.newFileName||theirs.newFileName)&&(fileNameChanged(mine)?fileNameChanged(theirs)?(ret.oldFileName=selectField(ret,mine.oldFileName,theirs.oldFileName),ret.newFileName=selectField(ret,mine.newFileName,theirs.newFileName),ret.oldHeader=selectField(ret,mine.oldHeader,theirs.oldHeader),ret.newHeader=selectField(ret,mine.newHeader,theirs.newHeader)):(ret.oldFileName=mine.oldFileName,ret.newFileName=mine.newFileName,ret.oldHeader=mine.oldHeader,ret.newHeader=mine.newHeader):(ret.oldFileName=theirs.oldFileName||mine.oldFileName,ret.newFileName=theirs.newFileName||mine.newFileName,ret.oldHeader=theirs.oldHeader||mine.oldHeader,ret.newHeader=theirs.newHeader||mine.newHeader)),ret.hunks=[];for(var mineIndex=0,theirsIndex=0,mineOffset=0,theirsOffset=0;mineIndex<mine.hunks.length||theirsIndex<theirs.hunks.length;){var mineCurrent=mine.hunks[mineIndex]||{oldStart:1/0},theirsCurrent=theirs.hunks[theirsIndex]||{oldStart:1/0};if(hunkBefore(mineCurrent,theirsCurrent))ret.hunks.push(cloneHunk(mineCurrent,mineOffset)),mineIndex++,theirsOffset+=mineCurrent.newLines-mineCurrent.oldLines;else if(hunkBefore(theirsCurrent,mineCurrent))ret.hunks.push(cloneHunk(theirsCurrent,theirsOffset)),theirsIndex++,mineOffset+=theirsCurrent.newLines-theirsCurrent.oldLines;else{var mergedHunk={oldStart:Math.min(mineCurrent.oldStart,theirsCurrent.oldStart),oldLines:0,newStart:Math.min(mineCurrent.newStart+mineOffset,theirsCurrent.oldStart+theirsOffset),newLines:0,lines:[]};mergeLines(mergedHunk,mineCurrent.oldStart,mineCurrent.lines,theirsCurrent.oldStart,theirsCurrent.lines),theirsIndex++,mineIndex++,ret.hunks.push(mergedHunk)}}return ret},exports.convertChangesToDMP=function(changes){for(var change,operation,ret=[],i=0;i<changes.length;i++)operation=(change=changes[i]).added?1:change.removed?-1:0,ret.push([operation,change.value]);return ret},exports.convertChangesToXML=function(changes){for(var ret=[],i=0;i<changes.length;i++){var change=changes[i];change.added?ret.push("<ins>"):change.removed&&ret.push("<del>"),ret.push(escapeHTML(change.value)),change.added?ret.push("</ins>"):change.removed&&ret.push("</del>")}return ret.join("")},exports.canonicalize=canonicalize,Object.defineProperty(exports,"__esModule",{value:!0})},"object"==typeof exports&&void 0!==module?factory(exports):"function"==typeof define&&define.amd?define(["exports"],factory):factory((global=global||self).Diff={})},{}],3:[function(require,module,exports){!function(Hogan){var rIsWhitespace=/\S/,rQuot=/\"/g,rNewline=/\n/g,rCr=/\r/g,rSlash=/\\/g,rLineSep=/\u2028/,rParagraphSep=/\u2029/;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;i<l;i++)if(text.charAt(index+i)!=tag.charAt(i))return!1;return!0}Hogan.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},Hogan.scan=function(text,delimiters){var len=text.length,state=0,tagType=null,tag=null,buf="",tokens=[],seenTag=!1,i=0,lineStart=0,otag="{{",ctag="}}";function addBuf(){0<buf.length&&(tokens.push({tag:"_t",text:new String(buf)}),buf="")}function filterLine(haveSeenTag,noNewLine){if(addBuf(),haveSeenTag&&function(){for(var isAllWhitespace=!0,j=lineStart;j<tokens.length;j++)if(!(isAllWhitespace=Hogan.tags[tokens[j].tag]<Hogan.tags._v||"_t"==tokens[j].tag&&null===tokens[j].text.match(rIsWhitespace)))return!1;return isAllWhitespace}())for(var next,j=lineStart;j<tokens.length;j++)tokens[j].text&&((next=tokens[j+1])&&">"==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}for(delimiters&&(delimiters=delimiters.split(" "),otag=delimiters[0],ctag=delimiters[1]),i=0;i<len;i++)0==state?tagChange(otag,text,i)?(--i,addBuf(),state=1):"\n"==text.charAt(i)?filterLine(seenTag):buf+=text.charAt(i):1==state?(i+=otag.length-1,state="="==(tagType=(tag=Hogan.tags[text.charAt(i+1)])?text.charAt(i+1):"_v")?(i=changeDelimiters(text,i),0):(tag&&i++,2),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=0,"{"==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};function isOpener(token,tags){for(var i=0,l=tags.length;i<l;i++)if(tags[i].o==token.n)return token.tag="#",!0}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!0}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: "+function(obj){var items=[];for(var key in obj)items.push('"'+esc(key)+'": function(c,p,t,i) {'+obj[key]+"}");return"{ "+items.join(",")+" }"}(codeObj.subs)}Hogan.stringify=function(codeObj,text,options){return"{code: function (c,p,i) { "+Hogan.wrapMain(codeObj.code)+" },"+stringifyPartials(codeObj)+"}"};var serialNo=0;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 sym="<"+(context.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+");"}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;i<l;i++)(func=Hogan.codegen[nodelist[i].tag])&&func(nodelist[i],context);return context},Hogan.parse=function(tokens,text,options){return function buildTree(tokens,kind,stack,customTags){var tail,instructions=[],opener=null,token=null;for(tail=stack[stack.length-1];0<tokens.length;){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(0<stack.length)throw new Error("missing closing tag: "+stack.pop().n);return instructions}(tokens,0,[],(options=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}}(void 0!==exports?exports:Hogan)},{}],4:[function(require,module,exports){var Hogan=require("./compiler");Hogan.Template=require("./template").Template,Hogan.template=Hogan.Template,module.exports=Hogan},{"./compiler":3,"./template":5}],5:[function(require,module,exports){!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}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(context,partials,indent){return""},v:function(str){return str=coerceToString(str),hChars.test(str)?str.replace(rAmp,"&amp;").replace(rLt,"&lt;").replace(rGt,"&gt;").replace(rApos,"&#39;").replace(rQuot,"&quot;"):str},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){for(key in partials.stackText||(partials.stackText={}),partial.subs)partials.stackText[key]||(partials.stackText[key]=void 0!==this.activeSub&&partials.stackText[this.activeSub]?partials.stackText[this.activeSub]:this.text);template=function(instance,subs,partials,stackSubs,stackPartials,stackText){function PartialTemplate(){}function Substitutions(){}var key;Substitutions.prototype=(PartialTemplate.prototype=instance).subs;var partial=new PartialTemplate;for(key in partial.subs=new Substitutions,partial.subsText={},partial.buf="",stackSubs=stackSubs||{},partial.stackSubs=stackSubs,partial.subsText=stackText,subs)stackSubs[key]||(stackSubs[key]=subs[key]);for(key in stackSubs)partial.subs[key]=stackSubs[key];for(key in stackPartials=stackPartials||{},partial.stackPartials=stackPartials,partials)stackPartials[key]||(stackPartials[key]=partials[key]);for(key in stackPartials)partial.partials[key]=stackPartials[key];return partial}(template,partial.subs,partial.partials,this.stackSubs,this.stackPartials,partials.stackText)}return this.partials[symbol].instance=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))for(var i=0;i<tail.length;i++)context.push(tail[i]),section(context,partials,this),context.pop();else section(context,partials,this)},s:function(val,ctx,partials,inverted,start,end,tags){var pass;return(!isArray(val)||0!==val.length)&&("function"==typeof val&&(val=this.ms(val,ctx,partials,inverted,start,end,tags)),pass=!!val,!inverted&&pass&&ctx&&ctx.push("object"==typeof val?val:ctx[ctx.length-1]),pass)},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++)val=void 0!==(found=findInScope(names[i],val,doModelGet))?(cx=val,found):"";return!(returnFound&&!val)&&(returnFound||"function"!=typeof val||(ctx.push(cx),val=this.mv(val,ctx,partials),ctx.pop()),val)},f:function(key,ctx,partials,returnFound){for(var val=!1,found=!1,doModelGet=this.options.modelGet,i=ctx.length-1;0<=i;i--)if(void 0!==(val=findInScope(key,ctx[i],doModelGet))){found=!0;break}return found?(returnFound||"function"!=typeof val||(val=this.mv(val,ctx,partials)),val):!returnFound&&""},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||(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,rGt=/>/g,rApos=/\'/g,rQuot=/\"/g,hChars=/[&<>\"\']/;function coerceToString(val){return String(null==val?"":val)}var isArray=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)}}(void 0!==exports?exports:{})},{}],6:[function(require,module,exports){function merge_recursive(base,extend){if("object"!==typeOf(base))return extend;for(var key in extend)"object"===typeOf(base[key])&&"object"===typeOf(extend[key])?base[key]=merge_recursive(base[key],extend[key]):base[key]=extend[key];return base}function merge(clone,recursive,argv){var result=argv[0],size=argv.length;!clone&&"object"===typeOf(result)||(result={});for(var index=0;index<size;++index){var item=argv[index];if("object"===typeOf(item))for(var key in item)if("__proto__"!==key){var sitem=clone?Public.clone(item[key]):item[key];result[key]=recursive?merge_recursive(result[key],sitem):sitem}}return result}function typeOf(input){return{}.toString.call(input).slice(8,-1).toLowerCase()}var isNode,Public;isNode="object"==typeof module&&module&&"object"==typeof module.exports&&module.exports,(Public=function(clone){return merge(!0===clone,!1,arguments)}).recursive=function(clone){return merge(!0===clone,!0,arguments)},Public.clone=function(input){var index,size,output=input,type=typeOf(input);if("array"===type)for(output=[],size=input.length,index=0;index<size;++index)output[index]=Public.clone(input[index]);else if("object"===type)for(index in output={},input)output[index]=Public.clone(input[index]);return output},isNode?module.exports=Public:window.merge=Public},{}],7:[function(require,module,exports){(function(process){function normalizeArray(parts,allowAboveRoot){for(var up=0,i=parts.length-1;0<=i;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--;)parts.unshift("..");return parts}function filter(xs,f){if(xs.filter)return xs.filter(f);for(var res=[],i=0;i<xs.length;i++)f(xs[i],i,xs)&&res.push(xs[i]);return res}exports.resolve=function(){for(var resolvedPath="",resolvedAbsolute=!1,i=arguments.length-1;-1<=i&&!resolvedAbsolute;i--){var path=0<=i?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(resolvedAbsolute?"/":"")+(resolvedPath=normalizeArray(filter(resolvedPath.split("/"),function(p){return!!p}),!resolvedAbsolute).join("/"))||"."},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("/"))||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,index){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<arr.length&&""===arr[start];start++);for(var end=arr.length-1;0<=end&&""===arr[end];end--);return end<start?[]: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;i<length;i++)if(fromParts[i]!==toParts[i]){samePartsLength=i;break}var outputParts=[];for(i=samePartsLength;i<fromParts.length;i++)outputParts.push("..");return(outputParts=outputParts.concat(toParts.slice(samePartsLength))).join("/")},exports.sep="/",exports.delimiter=":",exports.dirname=function(path){if("string"!=typeof path&&(path+=""),0===path.length)return".";for(var code=path.charCodeAt(0),hasRoot=47===code,end=-1,matchedSlash=!0,i=path.length-1;1<=i;--i)if(47===(code=path.charCodeAt(i))){if(!matchedSlash){end=i;break}}else matchedSlash=!1;return-1===end?hasRoot?"/":".":hasRoot&&1===end?"/":path.slice(0,end)},exports.basename=function(path,ext){var f=function(path){"string"!=typeof path&&(path+="");var i,start=0,end=-1,matchedSlash=!0;for(i=path.length-1;0<=i;--i)if(47===path.charCodeAt(i)){if(!matchedSlash){start=i+1;break}}else-1===end&&(matchedSlash=!1,end=i+1);return-1===end?"":path.slice(start,end)}(path);return ext&&f.substr(-1*ext.length)===ext&&(f=f.substr(0,f.length-ext.length)),f},exports.extname=function(path){"string"!=typeof path&&(path+="");for(var startDot=-1,startPart=0,end=-1,matchedSlash=!0,preDotState=0,i=path.length-1;0<=i;--i){var code=path.charCodeAt(i);if(47===code){if(matchedSlash)continue;startPart=i+1;break}-1===end&&(matchedSlash=!1,end=i+1),46===code?-1===startDot?startDot=i:1!==preDotState&&(preDotState=1):-1!==startDot&&(preDotState=-1)}return-1===startDot||-1===end||0===preDotState||1===preDotState&&startDot===end-1&&startDot===startPart+1?"":path.slice(startDot,end)};var substr="b"==="ab".substr(-1)?function(str,start,len){return str.substr(start,len)}:function(str,start,len){return start<0&&(start=str.length+start),str.substr(start,len)}}).call(this,require("_process"))},{_process:8}],8:[function(require,module,exports){var cachedSetTimeout,cachedClearTimeout,process=module.exports={};function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(fun){if(cachedSetTimeout===setTimeout)return setTimeout(fun,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(fun,0);try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}!function(){try{cachedSetTimeout="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e){cachedSetTimeout=defaultSetTimout}try{cachedClearTimeout="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e){cachedClearTimeout=defaultClearTimeout}}();var currentQueue,queue=[],draining=!1,queueIndex=-1;function cleanUpNextTick(){draining&&currentQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var timeout=runTimeout(cleanUpNextTick);draining=!0;for(var len=queue.length;len;){for(currentQueue=queue,queue=[];++queueIndex<len;)currentQueue&&currentQueue[queueIndex].run();queueIndex=-1,len=queue.length}currentQueue=null,draining=!1,function(marker){if(cachedClearTimeout===clearTimeout)return clearTimeout(marker);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(marker);try{cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}(timeout)}}function Item(fun,array){this.fun=fun,this.array=array}function noop(){}process.nextTick=function(fun){var args=new Array(arguments.length-1);if(1<arguments.length)for(var i=1;i<arguments.length;i++)args[i-1]=arguments[i];queue.push(new Item(fun,args)),1!==queue.length||draining||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.prependListener=noop,process.prependOnceListener=noop,process.listeners=function(name){return[]},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}},{}],9:[function(require,module,exports){function DiffParser(){}function getExtension(filename,language){var nameSplit=filename.split(".");return 1<nameSplit.length?nameSplit[nameSplit.length-1]:language}function _getFilename(linePrefix,line,extraPrefix){var filename,prefixes=["a/","b/","i/","w/","c/","o/"];extraPrefix&&prefixes.push(extraPrefix);var values=(linePrefix?new RegExp("^"+linePrefix+' "?(.+?)"?$'):new RegExp('^"?(.+?)"?$')).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)),filename=filename.replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [-+]\d{4}.*$/,"")}return filename}var utils,LINE_TYPE;utils=require("./utils.js").Utils,DiffParser.prototype.LINE_TYPE=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.generateDiffJson=function(diffInput,configuration){var possibleOldName,possibleNewName,config=configuration||{},files=[],currentFile=null,currentBlock=null,oldLine=null,oldLine2=null,newLine=null;function saveBlock(){currentBlock&&(currentFile.blocks.push(currentBlock),currentBlock=null)}function saveFile(){currentFile&&(currentFile.oldName||(currentFile.oldName=possibleOldName),currentFile.newName||(currentFile.newName=possibleNewName),currentFile.newName&&(files.push(currentFile),currentFile=null)),possibleNewName=possibleOldName=void 0}function startFile(){saveBlock(),saveFile(),currentFile={blocks:[],deletedLines:0,addedLines:0}}function startBlock(line){var values;saveBlock(),(values=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(line))?(currentFile.isCombined=!1,oldLine=values[1],newLine=values[2]):(values=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(line))?(currentFile.isCombined=!0,oldLine=values[1],oldLine2=values[2],newLine=values[3]):(utils.startsWith(line,"@@")&&console.error("Failed to parse lines, starting in 0!"),newLine=oldLine=0,currentFile.isCombined=!1),(currentBlock={lines:[]}).oldStartLine=oldLine,currentBlock.oldStartLine2=oldLine2,currentBlock.newStartLine=newLine,currentBlock.header=line}var diffLines=diffInput.replace(/\/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})?/,binaryFiles=/^Binary files (.*) and (.*) differ/,binaryDiff=/^GIT binary patch/,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,lineIndex){if(line&&!utils.startsWith(line,"*")){var values,prevLine=diffLines[lineIndex-1],nxtLine=diffLines[lineIndex+1],afterNxtLine=diffLines[lineIndex+2];if(utils.startsWith(line,"diff"))return startFile(),(values=/^diff --git "?(.+)"? "?(.+)"?/.exec(line))&&(possibleOldName=_getFilename(null,values[1],config.dstPrefix),possibleNewName=_getFilename(null,values[2],config.srcPrefix)),void(currentFile.isGitDiff=!0);if((!currentFile||!currentFile.isGitDiff&&currentFile&&utils.startsWith(line,"--- ")&&utils.startsWith(nxtLine,"+++ ")&&utils.startsWith(afterNxtLine,"@@"))&&startFile(),utils.startsWith(line,"--- ")&&utils.startsWith(nxtLine,"+++ ")||utils.startsWith(line,"+++ ")&&utils.startsWith(prevLine,"--- ")){if(currentFile&&!currentFile.oldName&&utils.startsWith(line,"--- ")&&(values=function(line,cfg){return _getFilename("---",line,cfg.srcPrefix)}(line,config)))return currentFile.oldName=values,void(currentFile.language=getExtension(currentFile.oldName,currentFile.language));if(currentFile&&!currentFile.newName&&utils.startsWith(line,"+++ ")&&(values=function(line,cfg){return _getFilename("\\+\\+\\+",line,cfg.dstPrefix)}(line,config)))return currentFile.newName=values,void(currentFile.language=getExtension(currentFile.newName,currentFile.language))}if(currentFile&&utils.startsWith(line,"@@")||currentFile.isGitDiff&&currentFile&&currentFile.oldName&&currentFile.newName&&!currentBlock)startBlock(line);else if(currentBlock&&(utils.startsWith(line,"+")||utils.startsWith(line,"-")||utils.startsWith(line," ")))!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++):utils.startsWith(line,delLinePrefixes)?(currentFile.deletedLines++,currentLine.type=LINE_TYPE.DELETES,currentLine.oldNumber=oldLine++,currentLine.newNumber=null):(currentLine.type=LINE_TYPE.CONTEXT,currentLine.oldNumber=oldLine++,currentLine.newNumber=newLine++),currentBlock.lines.push(currentLine)}(line);else{var doesNotExistHunkHeader=!function(line,lineIdx){for(var idx=lineIdx;idx<diffLines.length-3;){if(utils.startsWith(line,"diff"))return!1;if(utils.startsWith(diffLines[idx],"--- ")&&utils.startsWith(diffLines[idx+1],"+++ ")&&utils.startsWith(diffLines[idx+2],"@@"))return!0;idx++}return!1}(line,lineIndex);(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))?(doesNotExistHunkHeader&&(currentFile.oldName=values[1]),currentFile.isCopy=!0):(values=copyTo.exec(line))?(doesNotExistHunkHeader&&(currentFile.newName=values[1]),currentFile.isCopy=!0):(values=renameFrom.exec(line))?(doesNotExistHunkHeader&&(currentFile.oldName=values[1]),currentFile.isRename=!0):(values=renameTo.exec(line))?(doesNotExistHunkHeader&&(currentFile.newName=values[1]),currentFile.isRename=!0):(values=binaryFiles.exec(line))?(currentFile.isBinary=!0,currentFile.oldName=_getFilename(null,values[1],config.srcPrefix),currentFile.newName=_getFilename(null,values[2],config.dstPrefix),startBlock("Binary file")):(values=binaryDiff.exec(line))?(currentFile.isBinary=!0,startBlock(line)):(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)}}}),saveBlock(),saveFile(),files},module.exports.DiffParser=new DiffParser},{"./utils.js":19}],10:[function(require,module,exports){(function(global){!function(){var diffParser=require("./diff-parser.js").DiffParser,htmlPrinter=require("./html-printer.js").HtmlPrinter,utils=require("./utils.js").Utils;function Diff2Html(){}var defaultConfig={inputFormat:"diff",outputFormat:"line-by-line",showFiles:!1,diffStyle:"word",matching:"none",matchWordsThreshold:.25,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200,maxLineLengthHighlight:1e4,templates:{},rawTemplates:{},renderNothingWhenEmpty:!1};Diff2Html.prototype.getJsonFromDiff=function(diffInput,config){var cfg=utils.safeConfig(config,defaultConfig);return diffParser.generateDiffJson(diffInput,cfg)},Diff2Html.prototype.getPrettyHtml=function(diffInput,config){var cfg=utils.safeConfig(config,defaultConfig),diffJson=diffInput;cfg.inputFormat&&"diff"!==cfg.inputFormat||(diffJson=diffParser.generateDiffJson(diffInput,cfg));var fileList="";!0===cfg.showFiles&&(fileList=htmlPrinter.generateFileListSummary(diffJson,cfg));return fileList+("side-by-side"===cfg.outputFormat?htmlPrinter.generateSideBySideJsonHtml(diffJson,cfg):htmlPrinter.generateLineByLineJsonHtml(diffJson,cfg))},Diff2Html.prototype.getPrettyHtmlFromDiff=function(diffInput,config){var cfg=utils.safeConfig(config,defaultConfig);return cfg.inputFormat="diff",cfg.outputFormat="line-by-line",this.getPrettyHtml(diffInput,cfg)},Diff2Html.prototype.getPrettyHtmlFromJson=function(diffJson,config){var cfg=utils.safeConfig(config,defaultConfig);return cfg.inputFormat="json",cfg.outputFormat="line-by-line",this.getPrettyHtml(diffJson,cfg)},Diff2Html.prototype.getPrettySideBySideHtmlFromDiff=function(diffInput,config){var cfg=utils.safeConfig(config,defaultConfig);return cfg.inputFormat="diff",cfg.outputFormat="side-by-side",this.getPrettyHtml(diffInput,cfg)},Diff2Html.prototype.getPrettySideBySideHtmlFromJson=function(diffJson,config){var cfg=utils.safeConfig(config,defaultConfig);return cfg.inputFormat="json",cfg.outputFormat="side-by-side",this.getPrettyHtml(diffJson,cfg)};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":9,"./html-printer.js":13,"./utils.js":19}],11:[function(require,module,exports){function FileListPrinter(config){this.config=config;var HoganJsUtils=require("./hoganjs-utils.js").HoganJsUtils;hoganUtils=new HoganJsUtils(config)}var hoganUtils,printerUtils;printerUtils=require("./printer-utils.js").PrinterUtils,FileListPrinter.prototype.generateFileList=function(diffFiles){var lineTemplate=hoganUtils.template("file-summary","line"),files=diffFiles.map(function(file){var fileTypeName=printerUtils.getFileTypeIcon(file),iconTemplate=hoganUtils.template("icon",fileTypeName);return lineTemplate.render({fileHtmlId:printerUtils.getHtmlId(file),oldName:file.oldName,newName:file.newName,fileName:printerUtils.getDiffName(file),deletedLines:"-"+file.deletedLines,addedLines:"+"+file.addedLines},{fileIcon:iconTemplate})}).join("\n");return hoganUtils.render("file-summary","wrapper",{filesNumber:diffFiles.length,files:files})},module.exports.FileListPrinter=FileListPrinter},{"./hoganjs-utils.js":12,"./printer-utils.js":15}],12:[function(require,module,exports){(function(__dirname){function HoganJsUtils(configuration){this.config=configuration||{},extraTemplates=this.config.templates||{};var rawTemplates=this.config.rawTemplates||{};for(var templateName in rawTemplates)rawTemplates.hasOwnProperty(templateName)&&(extraTemplates[templateName]||(extraTemplates[templateName]=this.compile(rawTemplates[templateName])))}var extraTemplates,fs,path,hogan,hoganTemplates;fs=require("fs"),path=require("path"),hogan=require("hogan.js"),hoganTemplates=require("./templates/diff2html-templates.js"),HoganJsUtils.prototype.render=function(namespace,view,params){var template=this.template(namespace,view);return template?template.render(params):null},HoganJsUtils.prototype.template=function(namespace,view){var templateKey=this._templateKey(namespace,view);return this._getTemplate(templateKey)},HoganJsUtils.prototype._getTemplate=function(templateKey){var template;return this.config.noCache||(template=this._readFromCache(templateKey)),template=template||this._loadTemplate(templateKey)},HoganJsUtils.prototype._loadTemplate=function(templateKey){var template;try{if(fs.readFileSync){var templatesPath=path.resolve(__dirname,"templates"),templatePath=path.join(templatesPath,templateKey),templateContent=fs.readFileSync(templatePath+".mustache","utf8");template=hogan.compile(templateContent),hoganTemplates[templateKey]=template}}catch(e){console.error("Failed to read (template: "+templateKey+") from fs: "+e.message)}return template},HoganJsUtils.prototype._readFromCache=function(templateKey){return extraTemplates[templateKey]||hoganTemplates[templateKey]},HoganJsUtils.prototype._templateKey=function(namespace,view){return namespace+"-"+view},HoganJsUtils.prototype.compile=function(templateStr){return hogan.compile(templateStr)},module.exports.HoganJsUtils=HoganJsUtils}).call(this,"/src")},{"./templates/diff2html-templates.js":18,fs:1,"hogan.js":4,path:7}],13:[function(require,module,exports){function HtmlPrinter(){}var LineByLinePrinter,SideBySidePrinter,FileListPrinter;LineByLinePrinter=require("./line-by-line-printer.js").LineByLinePrinter,SideBySidePrinter=require("./side-by-side-printer.js").SideBySidePrinter,FileListPrinter=require("./file-list-printer.js").FileListPrinter,HtmlPrinter.prototype.generateLineByLineJsonHtml=function(diffFiles,config){return new LineByLinePrinter(config).generateLineByLineJsonHtml(diffFiles)},HtmlPrinter.prototype.generateSideBySideJsonHtml=function(diffFiles,config){return new SideBySidePrinter(config).generateSideBySideJsonHtml(diffFiles)},HtmlPrinter.prototype.generateFileListSummary=function(diffJson,config){return new FileListPrinter(config).generateFileList(diffJson)},module.exports.HtmlPrinter=new HtmlPrinter},{"./file-list-printer.js":11,"./line-by-line-printer.js":14,"./side-by-side-printer.js":17}],14:[function(require,module,exports){!function(){var hoganUtils,diffParser=require("./diff-parser.js").DiffParser,printerUtils=require("./printer-utils.js").PrinterUtils,utils=require("./utils.js").Utils,Rematch=require("./rematch.js").Rematch;function LineByLinePrinter(config){this.config=config;var HoganJsUtils=require("./hoganjs-utils.js").HoganJsUtils;hoganUtils=new HoganJsUtils(config)}LineByLinePrinter.prototype.makeFileDiffHtml=function(file,diffs){if(this.config.renderNothingWhenEmpty&&file.blocks&&!file.blocks.length)return"";var fileDiffTemplate=hoganUtils.template("line-by-line","file-diff"),filePathTemplate=hoganUtils.template("generic","file-path"),fileIconTemplate=hoganUtils.template("icon","file"),fileTagTemplate=hoganUtils.template("tag",printerUtils.getFileTypeIcon(file));return fileDiffTemplate.render({file:file,fileHtmlId:printerUtils.getHtmlId(file),diffs:diffs,filePath:filePathTemplate.render({fileDiffName:printerUtils.getDiffName(file)},{fileIcon:fileIconTemplate,fileTag:fileTagTemplate})})},LineByLinePrinter.prototype.makeLineByLineHtmlWrapper=function(content){return hoganUtils.render("generic","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("generic","column-line-number",{diffParser:diffParser,blockHeader:utils.escape(block.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"})},LineByLinePrinter.prototype._generateFileHtml=function(file){var that=this;return file.blocks.map(function(block){var lines=that.makeColumnLineNumberHtml(block),oldLines=[],newLines=[];function processChangeBlock(){var matches,insertType,deleteType,comparisons=oldLines.length*newLines.length,maxLineSizeInBlock=Math.max.apply(null,[0].concat(oldLines.concat(newLines).map(function(elem){return elem.content.length}))),doMatching=comparisons<that.config.matchingMaxComparisons&&maxLineSizeInBlock<that.config.maxLineSizeInBlockForComparison&&("lines"===that.config.matching||"words"===that.config.matching);deleteType=doMatching?(matches=matcher(oldLines,newLines),insertType=diffParser.LINE_TYPE.INSERT_CHANGES,diffParser.LINE_TYPE.DELETE_CHANGES):(matches=[[oldLines,newLines]],insertType=diffParser.LINE_TYPE.INSERTS,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;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(file.isCombined,deleteType,oldLine.oldNumber,oldLine.newNumber,diff.first.line,diff.first.prefix),processedNewLines+=that.makeLineHtml(file.isCombined,insertType,newLine.oldNumber,newLine.newNumber,diff.second.line,diff.second.prefix)}lines+=processedOldLines+processedNewLines,lines+=that._processLines(file.isCombined,oldLines.slice(common),newLines.slice(common))}),oldLines=[],newLines=[]}for(var i=0;i<block.lines.length;i++){var line=block.lines[i],escapedLine=utils.escape(line.content);line.type!==diffParser.LINE_TYPE.INSERTS&&(0<newLines.length||line.type!==diffParser.LINE_TYPE.DELETES&&0<oldLines.length)&&processChangeBlock(),line.type===diffParser.LINE_TYPE.CONTEXT?lines+=that.makeLineHtml(file.isCombined,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(file.isCombined,line.type,line.oldNumber,line.newNumber,escapedLine)}return processChangeBlock(),lines}).join("\n")},LineByLinePrinter.prototype._processLines=function(isCombined,oldLines,newLines){for(var lines="",i=0;i<oldLines.length;i++){var oldLine=oldLines[i],oldEscapedLine=utils.escape(oldLine.content);lines+=this.makeLineHtml(isCombined,oldLine.type,oldLine.oldNumber,oldLine.newNumber,oldEscapedLine)}for(var j=0;j<newLines.length;j++){var newLine=newLines[j],newEscapedLine=utils.escape(newLine.content);lines+=this.makeLineHtml(isCombined,newLine.type,newLine.oldNumber,newLine.newNumber,newEscapedLine)}return lines},LineByLinePrinter.prototype.makeLineHtml=function(isCombined,type,oldNumber,newNumber,content,possiblePrefix){var lineNumberTemplate=hoganUtils.render("line-by-line","numbers",{oldNumber:utils.valueOrEmpty(oldNumber),newNumber:utils.valueOrEmpty(newNumber)}),lineWithoutPrefix=content,prefix=possiblePrefix;if(!prefix){var lineWithPrefix=printerUtils.separatePrefix(isCombined,content);prefix=lineWithPrefix.prefix,lineWithoutPrefix=lineWithPrefix.line}return" "===prefix&&(prefix="&nbsp;"),hoganUtils.render("generic","line",{type:type,lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line",prefix:prefix,content:lineWithoutPrefix,lineNumber:lineNumberTemplate})},LineByLinePrinter.prototype._generateEmptyDiff=function(){return hoganUtils.render("generic","empty-diff",{contentClass:"d2h-code-line",diffParser:diffParser})},module.exports.LineByLinePrinter=LineByLinePrinter}()},{"./diff-parser.js":9,"./hoganjs-utils.js":12,"./printer-utils.js":15,"./rematch.js":16,"./utils.js":19}],15:[function(require,module,exports){function PrinterUtils(){}function unifyPath(path){return path?path.replace("\\","/"):path}function isDevNullName(name){return-1!==name.indexOf("dev/null")}var jsDiff,utils,Rematch;jsDiff=require("diff"),utils=require("./utils.js").Utils,Rematch=require("./rematch.js").Rematch,PrinterUtils.prototype.separatePrefix=function(isCombined,line){var prefix,lineWithoutPrefix;return lineWithoutPrefix=isCombined?(prefix=line.substring(0,2),line.substring(2)):(prefix=line.substring(0,1),line.substring(1)),{prefix:prefix,line:lineWithoutPrefix}},PrinterUtils.prototype.getHtmlId=function(file){return"d2h-"+function(text){var i,len,hash=0;for(i=0,len=text.length;i<len;i++)hash=(hash<<5)-hash+text.charCodeAt(i),hash|=0;return hash}(this.getDiffName(file)).toString().slice(-6)},PrinterUtils.prototype.getDiffName=function(file){var oldFilename=unifyPath(file.oldName),newFilename=unifyPath(file.newName);if(!oldFilename||!newFilename||oldFilename===newFilename||isDevNullName(oldFilename)||isDevNullName(newFilename))return newFilename&&!isDevNullName(newFilename)?newFilename:oldFilename||"unknown/file/path";for(var prefixPaths=[],suffixPaths=[],oldFilenameParts=oldFilename.split("/"),newFilenameParts=newFilename.split("/"),i=0,j=oldFilenameParts.length-1,k=newFilenameParts.length-1;i<j&&i<k&&oldFilenameParts[i]===newFilenameParts[i];)prefixPaths.push(newFilenameParts[i]),i+=1;for(;i<j&&i<k&&oldFilenameParts[j]===newFilenameParts[k];)suffixPaths.unshift(newFilenameParts[k]),j-=1,k-=1;var finalPrefix=prefixPaths.join("/"),finalSuffix=suffixPaths.join("/"),oldRemainingPath=oldFilenameParts.slice(i,j+1).join("/"),newRemainingPath=newFilenameParts.slice(i,k+1).join("/");return finalPrefix.length&&finalSuffix.length?finalPrefix+"/{"+oldRemainingPath+" → "+newRemainingPath+"}/"+finalSuffix:finalPrefix.length?finalPrefix+"/{"+oldRemainingPath+" → "+newRemainingPath+"}":finalSuffix.length?"{"+oldRemainingPath+" → "+newRemainingPath+"}/"+finalSuffix:oldFilename+" → "+newFilename},PrinterUtils.prototype.getFileTypeIcon=function(file){var templateName="file-changed";return file.isRename?templateName="file-renamed":file.isCopy?templateName="file-renamed":file.isNew?templateName="file-added":file.isDeleted?templateName="file-deleted":file.newName!==file.oldName&&(templateName="file-renamed"),templateName},PrinterUtils.prototype.diffHighlight=function(diffLine1,diffLine2,config){var linePrefix1,linePrefix2,unprefixedLine1,unprefixedLine2,diff,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),unprefixedLine1.length>config.maxLineLengthHighlight||unprefixedLine2.length>config.maxLineLengthHighlight)return{first:{prefix:linePrefix1,line:utils.escape(unprefixedLine1)},second:{prefix:linePrefix2,line:utils.escape(unprefixedLine2)}};diff="char"===config.diffStyle?jsDiff.diffChars(unprefixedLine1,unprefixedLine2):jsDiff.diffWordsWithSpace(unprefixedLine1,unprefixedLine2);var highlightedLine="",changedWords=[];if("word"===config.diffStyle&&"words"===config.matching){var treshold=.25;void 0!==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});matcher(diff.filter(function(element){return element.added}),removed).forEach(function(chunk){1===chunk[0].length&&1===chunk[1].length&&Rematch.distance(chunk[0][0].value,chunk[1][0].value)<treshold&&(changedWords.push(chunk[0][0]),changedWords.push(chunk[1][0]))})}return diff.forEach(function(part){var addClass=-1<changedWords.indexOf(part)?' 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:function(line){return line.replace(/(<ins[^>]*>((.|\n)*?)<\/ins>)/g,"")}(highlightedLine)},second:{prefix:linePrefix2,line:function(line){return line.replace(/(<del[^>]*>((.|\n)*?)<\/del>)/g,"")}(highlightedLine)}}},module.exports.PrinterUtils=new PrinterUtils},{"./rematch.js":16,"./utils.js":19,diff:2}],16:[function(require,module,exports){function levenshtein(a,b){if(0===a.length)return b.length;if(0===b.length)return a.length;var i,j,matrix=[];for(i=0;i<=b.length;i++)matrix[i]=[i];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++)b.charAt(i-1)===a.charAt(j-1)?matrix[i][j]=matrix[i-1][j-1]:matrix[i][j]=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={}).levenshtein=levenshtein,Rematch.distance=function(x,y){return levenshtein(x=x.trim(),y=y.trim())/(x.length+y.length)},Rematch.rematch=function(distanceFunction){return function group(a,b,level,cache){void 0===cache&&(cache={});var bm=function(a,b,cache){for(var bestMatch,bestMatchDist=1/0,i=0;i<a.length;++i)for(var j=0;j<b.length;++j){var md,cacheKey=JSON.stringify([a[i],b[j]]);cache.hasOwnProperty(cacheKey)?md=cache[cacheKey]:(md=distanceFunction(a[i],b[j]),cache[cacheKey]=md),md<bestMatchDist&&(bestMatch={indexA:i,indexB:j,score:bestMatchDist=md})}return bestMatch}(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(0<bm.indexA||0<bm.indexB)&&(result=group1.concat(result)),(a.length>tailA||b.length>tailB)&&(result=result.concat(group2)),result}},module.exports.Rematch=Rematch},{}],17:[function(require,module,exports){function SideBySidePrinter(config){this.config=config;var HoganJsUtils=require("./hoganjs-utils.js").HoganJsUtils;hoganUtils=new HoganJsUtils(config)}var hoganUtils,diffParser,printerUtils,utils,Rematch,matcher;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){var fileDiffTemplate=hoganUtils.template("side-by-side","file-diff"),filePathTemplate=hoganUtils.template("generic","file-path"),fileIconTemplate=hoganUtils.template("icon","file"),fileTagTemplate=hoganUtils.template("tag",printerUtils.getFileTypeIcon(file));return fileDiffTemplate.render({file:file,fileHtmlId:printerUtils.getHtmlId(file),diffs:diffs,filePath:filePathTemplate.render({fileDiffName:printerUtils.getDiffName(file)},{fileIcon:fileIconTemplate,fileTag:fileTagTemplate})})},SideBySidePrinter.prototype.generateSideBySideJsonHtml=function(diffFiles){var that=this,content=diffFiles.map(function(file){var diffs;return diffs=file.blocks.length?that.generateSideBySideFileHtml(file):that.generateEmptyDiff(),that.makeDiffHtml(file,diffs)}).join("\n");return hoganUtils.render("generic","wrapper",{content:content})},SideBySidePrinter.prototype.makeSideHtml=function(blockHeader){return hoganUtils.render("generic","column-line-number",{diffParser:diffParser,blockHeader:utils.escape(blockHeader),lineClass:"d2h-code-side-linenumber",contentClass:"d2h-code-side-line"})},SideBySidePrinter.prototype.generateSideBySideFileHtml=function(file){var that=this,fileHtml={left:"",right:""};return file.blocks.forEach(function(block){fileHtml.left+=that.makeSideHtml(block.header),fileHtml.right+=that.makeSideHtml("");var oldLines=[],newLines=[];function processChangeBlock(){var matches,insertType,deleteType,comparisons=oldLines.length*newLines.length,maxLineSizeInBlock=Math.max.apply(null,oldLines.concat(newLines).map(function(elem){return elem.length})),doMatching=comparisons<that.config.matchingMaxComparisons&&maxLineSizeInBlock<that.config.maxLineSizeInBlockForComparison&&("lines"===that.config.matching||"words"===that.config.matching);deleteType=doMatching?(matches=matcher(oldLines,newLines),insertType=diffParser.LINE_TYPE.INSERT_CHANGES,diffParser.LINE_TYPE.DELETE_CHANGES):(matches=[[oldLines,newLines]],insertType=diffParser.LINE_TYPE.INSERTS,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;j<common;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(file.isCombined,deleteType,oldLine.oldNumber,diff.first.line,diff.first.prefix),fileHtml.right+=that.generateSingleLineHtml(file.isCombined,insertType,newLine.newNumber,diff.second.line,diff.second.prefix)}if(common<max){var oldSlice=oldLines.slice(common),newSlice=newLines.slice(common),tmpHtml=that.processLines(file.isCombined,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],prefix=line.content[0],escapedLine=utils.escape(line.content.substr(1));line.type!==diffParser.LINE_TYPE.INSERTS&&(0<newLines.length||line.type!==diffParser.LINE_TYPE.DELETES&&0<oldLines.length)&&processChangeBlock(),line.type===diffParser.LINE_TYPE.CONTEXT?(fileHtml.left+=that.generateSingleLineHtml(file.isCombined,line.type,line.oldNumber,escapedLine,prefix),fileHtml.right+=that.generateSingleLineHtml(file.isCombined,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(file.isCombined,diffParser.LINE_TYPE.CONTEXT,"","",""),fileHtml.right+=that.generateSingleLineHtml(file.isCombined,line.type,line.newNumber,escapedLine,prefix))}processChangeBlock()}),fileHtml},SideBySidePrinter.prototype.processLines=function(isCombined,oldLines,newLines){for(var fileHtml={left:"",right:""},maxLinesNumber=Math.max(oldLines.length,newLines.length),i=0;i<maxLinesNumber;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+=this.generateSingleLineHtml(isCombined,oldLine.type,oldLine.oldNumber,oldContent,oldPrefix),fileHtml.right+=this.generateSingleLineHtml(isCombined,newLine.type,newLine.newNumber,newContent,newPrefix)):oldLine?(fileHtml.left+=this.generateSingleLineHtml(isCombined,oldLine.type,oldLine.oldNumber,oldContent,oldPrefix),fileHtml.right+=this.generateSingleLineHtml(isCombined,diffParser.LINE_TYPE.CONTEXT,"","","")):newLine?(fileHtml.left+=this.generateSingleLineHtml(isCombined,diffParser.LINE_TYPE.CONTEXT,"","",""),fileHtml.right+=this.generateSingleLineHtml(isCombined,newLine.type,newLine.newNumber,newContent,newPrefix)):console.error("How did it get here?")}return fileHtml},SideBySidePrinter.prototype.generateSingleLineHtml=function(isCombined,type,number,content,possiblePrefix){var lineWithoutPrefix=content,prefix=possiblePrefix,lineClass="d2h-code-side-linenumber",contentClass="d2h-code-side-line";if(number||content||(lineClass+=" d2h-code-side-emptyplaceholder",contentClass+=" d2h-code-side-emptyplaceholder",type+=" d2h-emptyplaceholder"),!prefix){var lineWithPrefix=printerUtils.separatePrefix(isCombined,content);prefix=lineWithPrefix.prefix,lineWithoutPrefix=lineWithPrefix.line}return" "===prefix&&(prefix="&nbsp;"),hoganUtils.render("generic","line",{type:type,lineClass:lineClass,contentClass:contentClass,prefix:prefix,content:lineWithoutPrefix,lineNumber:number})},SideBySidePrinter.prototype.generateEmptyDiff=function(){var fileHtml={right:""};return fileHtml.left=hoganUtils.render("generic","empty-diff",{contentClass:"d2h-code-side-line",diffParser:diffParser}),fileHtml},module.exports.SideBySidePrinter=SideBySidePrinter},{"./diff-parser.js":9,"./hoganjs-utils.js":12,"./printer-utils.js":15,"./rematch.js":16,"./utils.js":19}],18:[function(require,module,exports){(function(global){!function(){global.browserTemplates||(global.browserTemplates={});var Hogan=require("hogan.js");global.browserTemplates["file-summary-line"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('<li class="d2h-file-list-line">'),t.b("\n"+i),t.b(' <span class="d2h-file-name-wrapper">'),t.b("\n"+i),t.b(t.rp("<fileIcon0",c,p," ")),t.b(' <a href="#'),t.b(t.v(t.f("fileHtmlId",c,p,0))),t.b('" class="d2h-file-name">'),t.b(t.v(t.f("fileName",c,p,0))),t.b("</a>"),t.b("\n"+i),t.b(' <span class="d2h-file-stats">'),t.b("\n"+i),t.b(' <span class="d2h-lines-added">'),t.b(t.v(t.f("addedLines",c,p,0))),t.b("</span>"),t.b("\n"+i),t.b(' <span class="d2h-lines-deleted">'),t.b(t.v(t.f("deletedLines",c,p,0))),t.b("</span>"),t.b("\n"+i),t.b(" </span>"),t.b("\n"+i),t.b(" </span>"),t.b("\n"+i),t.b("</li>"),t.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}}},subs:{}}),global.browserTemplates["file-summary-wrapper"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('<div class="d2h-file-list-wrapper">'),t.b("\n"+i),t.b(' <div class="d2h-file-list-header">'),t.b("\n"+i),t.b(' <span class="d2h-file-list-title">Files changed ('),t.b(t.v(t.f("filesNumber",c,p,0))),t.b(")</span>"),t.b("\n"+i),t.b(' <a class="d2h-file-switch d2h-hide">hide</a>'),t.b("\n"+i),t.b(' <a class="d2h-file-switch d2h-show">show</a>'),t.b("\n"+i),t.b(" </div>"),t.b("\n"+i),t.b(' <ol class="d2h-file-list">'),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("files",c,p,0))),t.b("\n"+i),t.b(" </ol>"),t.b("\n"+i),t.b("</div>"),t.fl()},partials:{},subs:{}}),global.browserTemplates["generic-column-line-number"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b("<tr>"),t.b("\n"+i),t.b(' <td class="'),t.b(t.v(t.f("lineClass",c,p,0))),t.b(" "),t.b(t.v(t.d("diffParser.LINE_TYPE.INFO",c,p,0))),t.b('"></td>'),t.b("\n"+i),t.b(' <td class="'),t.b(t.v(t.d("diffParser.LINE_TYPE.INFO",c,p,0))),t.b('">'),t.b("\n"+i),t.b(' <div class="'),t.b(t.v(t.f("contentClass",c,p,0))),t.b(" "),t.b(t.v(t.d("diffParser.LINE_TYPE.INFO",c,p,0))),t.b('">'),t.b(t.t(t.f("blockHeader",c,p,0))),t.b("</div>"),t.b("\n"+i),t.b(" </td>"),t.b("\n"+i),t.b("</tr>"),t.fl()},partials:{},subs:{}}),global.browserTemplates["generic-empty-diff"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b("<tr>"),t.b("\n"+i),t.b(' <td class="'),t.b(t.v(t.d("diffParser.LINE_TYPE.INFO",c,p,0))),t.b('">'),t.b("\n"+i),t.b(' <div class="'),t.b(t.v(t.f("contentClass",c,p,0))),t.b(" "),t.b(t.v(t.d("diffParser.LINE_TYPE.INFO",c,p,0))),t.b('">'),t.b("\n"+i),t.b(" File without changes"),t.b("\n"+i),t.b(" </div>"),t.b("\n"+i),t.b(" </td>"),t.b("\n"+i),t.b("</tr>"),t.fl()},partials:{},subs:{}}),global.browserTemplates["generic-file-path"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('<span class="d2h-file-name-wrapper">'),t.b("\n"+i),t.b(t.rp("<fileIcon0",c,p," ")),t.b(' <span class="d2h-file-name">'),t.b(t.v(t.f("fileDiffName",c,p,0))),t.b("</span>"),t.b("\n"+i),t.b(t.rp("<fileTag1",c,p," ")),t.b("</span>"),t.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}},"<fileTag1":{name:"fileTag",partials:{},subs:{}}},subs:{}}),global.browserTemplates["generic-line"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b("<tr>"),t.b("\n"+i),t.b(' <td class="'),t.b(t.v(t.f("lineClass",c,p,0))),t.b(" "),t.b(t.v(t.f("type",c,p,0))),t.b('">'),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("lineNumber",c,p,0))),t.b("\n"+i),t.b(" </td>"),t.b("\n"+i),t.b(' <td class="'),t.b(t.v(t.f("type",c,p,0))),t.b('">'),t.b("\n"+i),t.b(' <div class="'),t.b(t.v(t.f("contentClass",c,p,0))),t.b(" "),t.b(t.v(t.f("type",c,p,0))),t.b('">'),t.b("\n"+i),t.s(t.f("prefix",c,p,1),c,p,0,171,247,"{{ }}")&&(t.rs(c,p,function(c,p,t){t.b(' <span class="d2h-code-line-prefix">'),t.b(t.t(t.f("prefix",c,p,0))),t.b("</span>"),t.b("\n"+i)}),c.pop()),t.s(t.f("content",c,p,1),c,p,0,279,353,"{{ }}")&&(t.rs(c,p,function(c,p,t){t.b(' <span class="d2h-code-line-ctn">'),t.b(t.t(t.f("content",c,p,0))),t.b("</span>"),t.b("\n"+i)}),c.pop()),t.b(" </div>"),t.b("\n"+i),t.b(" </td>"),t.b("\n"+i),t.b("</tr>"),t.fl()},partials:{},subs:{}}),global.browserTemplates["generic-wrapper"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('<div class="d2h-wrapper">'),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("content",c,p,0))),t.b("\n"+i),t.b("</div>"),t.fl()},partials:{},subs:{}}),global.browserTemplates["icon-file-added"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('<svg aria-hidden="true" class="d2h-icon d2h-added" height="16" title="added" version="1.1" viewBox="0 0 14 16"'),t.b("\n"+i),t.b(' width="14">'),t.b("\n"+i),t.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM6 9H3V7h3V4h2v3h3v2H8v3H6V9z"></path>'),t.b("\n"+i),t.b("</svg>"),t.fl()},partials:{},subs:{}}),global.browserTemplates["icon-file-changed"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('<svg aria-hidden="true" class="d2h-icon d2h-changed" height="16" title="modified" version="1.1"'),t.b("\n"+i),t.b(' viewBox="0 0 14 16" width="14">'),t.b("\n"+i),t.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM4 8c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3-3-1.34-3-3z"></path>'),t.b("\n"+i),t.b("</svg>"),t.fl()},partials:{},subs:{}}),global.browserTemplates["icon-file-deleted"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('<svg aria-hidden="true" class="d2h-icon d2h-deleted" height="16" title="removed" version="1.1"'),t.b("\n"+i),t.b(' viewBox="0 0 14 16" width="14">'),t.b("\n"+i),t.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM11 9H3V7h8v2z"></path>'),t.b("\n"+i),t.b("</svg>"),t.fl()},partials:{},subs:{}}),global.browserTemplates["icon-file-renamed"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('<svg aria-hidden="true" class="d2h-icon d2h-moved" height="16" title="renamed" version="1.1"'),t.b("\n"+i),t.b(' viewBox="0 0 14 16" width="14">'),t.b("\n"+i),t.b(' <path d="M6 9H3V7h3V4l5 4-5 4V9z m8-7v12c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h12c0.55 0 1 0.45 1 1z m-1 0H1v12h12V2z"></path>'),t.b("\n"+i),t.b("</svg>"),t.fl()},partials:{},subs:{}}),global.browserTemplates["icon-file"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('<svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">'),t.b("\n"+i),t.b(' <path d="M6 5H2v-1h4v1zM2 8h7v-1H2v1z m0 2h7v-1H2v1z m0 2h7v-1H2v1z m10-7.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h7.5l3.5 3.5z m-1 0.5L8 2H1v12h10V5z"></path>'),t.b("\n"+i),t.b("</svg>"),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('<div id="'),t.b(t.v(t.f("fileHtmlId",c,p,0))),t.b('" class="d2h-file-wrapper" data-lang="'),t.b(t.v(t.d("file.language",c,p,0))),t.b('">'),t.b("\n"+i),t.b(' <div class="d2h-file-header">'),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("filePath",c,p,0))),t.b("\n"+i),t.b(" </div>"),t.b("\n"+i),t.b(' <div class="d2h-file-diff">'),t.b("\n"+i),t.b(' <div class="d2h-code-wrapper">'),t.b("\n"+i),t.b(' <table class="d2h-diff-table">'),t.b("\n"+i),t.b(' <tbody class="d2h-diff-tbody">'),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("diffs",c,p,0))),t.b("\n"+i),t.b(" </tbody>"),t.b("\n"+i),t.b(" </table>"),t.b("\n"+i),t.b(" </div>"),t.b("\n"+i),t.b(" </div>"),t.b("\n"+i),t.b("</div>"),t.fl()},partials:{},subs:{}}),global.browserTemplates["line-by-line-numbers"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('<div class="line-num1">'),t.b(t.v(t.f("oldNumber",c,p,0))),t.b("</div>"),t.b("\n"+i),t.b('<div class="line-num2">'),t.b(t.v(t.f("newNumber",c,p,0))),t.b("</div>"),t.fl()},partials:{},subs:{}}),global.browserTemplates["side-by-side-file-diff"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('<div id="'),t.b(t.v(t.f("fileHtmlId",c,p,0))),t.b('" class="d2h-file-wrapper" data-lang="'),t.b(t.v(t.d("file.language",c,p,0))),t.b('">'),t.b("\n"+i),t.b(' <div class="d2h-file-header">'),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("filePath",c,p,0))),t.b("\n"+i),t.b(" </div>"),t.b("\n"+i),t.b(' <div class="d2h-files-diff">'),t.b("\n"+i),t.b(' <div class="d2h-file-side-diff">'),t.b("\n"+i),t.b(' <div class="d2h-code-wrapper">'),t.b("\n"+i),t.b(' <table class="d2h-diff-table">'),t.b("\n"+i),t.b(' <tbody class="d2h-diff-tbody">'),t.b("\n"+i),t.b(" "),t.b(t.t(t.d("diffs.left",c,p,0))),t.b("\n"+i),t.b(" </tbody>"),t.b("\n"+i),t.b(" </table>"),t.b("\n"+i),t.b(" </div>"),t.b("\n"+i),t.b(" </div>"),t.b("\n"+i),t.b(' <div class="d2h-file-side-diff">'),t.b("\n"+i),t.b(' <div class="d2h-code-wrapper">'),t.b("\n"+i),t.b(' <table class="d2h-diff-table">'),t.b("\n"+i),t.b(' <tbody class="d2h-diff-tbody">'),t.b("\n"+i),t.b(" "),t.b(t.t(t.d("diffs.right",c,p,0))),t.b("\n"+i),t.b(" </tbody>"),t.b("\n"+i),t.b(" </table>"),t.b("\n"+i),t.b(" </div>"),t.b("\n"+i),t.b(" </div>"),t.b("\n"+i),t.b(" </div>"),t.b("\n"+i),t.b("</div>"),t.fl()},partials:{},subs:{}}),global.browserTemplates["tag-file-added"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('<span class="d2h-tag d2h-added d2h-added-tag">ADDED</span>'),t.fl()},partials:{},subs:{}}),global.browserTemplates["tag-file-changed"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('<span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span>'),t.fl()},partials:{},subs:{}}),global.browserTemplates["tag-file-deleted"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('<span class="d2h-tag d2h-deleted d2h-deleted-tag">DELETED</span>'),t.fl()},partials:{},subs:{}}),global.browserTemplates["tag-file-renamed"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('<span class="d2h-tag d2h-moved d2h-moved-tag">RENAMED</span>'),t.fl()},partials:{},subs:{}}),module.exports=global.browserTemplates}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"hogan.js":4}],19:[function(require,module,exports){function Utils(){}var merge;merge=require("merge"),Utils.prototype.escape=function(str){return str.slice(0).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\//g,"&#x2F;")},Utils.prototype.startsWith=function(str,start){if("object"!=typeof start)return str&&0===str.indexOf(start);var result=!1;return start.forEach(function(s){0===str.indexOf(s)&&(result=!0)}),result},Utils.prototype.valueOrEmpty=function(value){return value||""},Utils.prototype.safeConfig=function(cfg,defaultConfig){return merge.recursive(!0,defaultConfig,cfg)},module.exports.Utils=new Utils},{merge:6}]},{},[10]);
1
+ !function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){return o(e[i][1][r]||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}({1:[function(require,module,exports){},{}],2:[function(require,module,exports){var global,factory;global=this,factory=function(exports){"use strict";function Diff(){}function buildValues(diff,components,newString,oldString,useLongestToken){for(var componentPos=0,componentLen=components.length,newPos=0,oldPos=0;componentPos<componentLen;componentPos++){var component=components[componentPos];if(component.removed){if(component.value=diff.join(oldString.slice(oldPos,oldPos+component.count)),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=diff.join(value)}else component.value=diff.join(newString.slice(newPos,newPos+component.count));newPos+=component.count,component.added||(oldPos+=component.count)}}var lastComponent=components[componentLen-1];return 1<componentLen&&"string"==typeof lastComponent.value&&(lastComponent.added||lastComponent.removed)&&diff.equals("",lastComponent.value)&&(components[componentLen-2].value+=lastComponent.value,components.pop()),components}Diff.prototype={diff:function(oldString,newString,argument_2){var options=2<arguments.length&&void 0!==argument_2?argument_2:{},callback=options.callback;"function"==typeof options&&(callback=options,options={}),this.options=options;var self=this;function done(value){return callback?(setTimeout(function(){callback(void 0,value)},0),!0):value}oldString=this.castInput(oldString),newString=this.castInput(newString),oldString=this.removeEmpty(this.tokenize(oldString));var newLen=(newString=this.removeEmpty(this.tokenize(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&&oldLen<=oldPos+1)return done([{value:this.join(newString),count:newString.length}]);function execEditLength(){for(var diagonalPath=-1*editLength;diagonalPath<=editLength;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<newLen,canRemove=removePath&&0<=_oldPos&&_oldPos<oldLen;if(canAdd||canRemove){if(!canAdd||canRemove&&addPath.newPos<removePath.newPos?(basePath={newPos:(path=removePath).newPos,components:path.components.slice(0)},self.pushComponent(basePath.components,void 0,!0)):((basePath=addPath).newPos++,self.pushComponent(basePath.components,!0,void 0)),_oldPos=self.extractCommon(basePath,newString,oldString,diagonalPath),basePath.newPos+1>=newLen&&oldLen<=_oldPos+1)return done(buildValues(self,basePath.components,newString,oldString,self.useLongestToken));bestPath[diagonalPath]=basePath}else bestPath[diagonalPath]=void 0}var path;editLength++}if(callback)!function exec(){setTimeout(function(){if(maxEditLength<editLength)return callback();execEditLength()||exec()},0)}();else for(;editLength<=maxEditLength;){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;newPos+1<newLen&&oldPos+1<oldLen&&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 this.options.comparator?this.options.comparator(left,right):left===right||this.options.ignoreCase&&left.toLowerCase()===right.toLowerCase()},removeEmpty:function(array){for(var ret=[],i=0;i<array.length;i++)array[i]&&ret.push(array[i]);return ret},castInput:function(value){return value},tokenize:function(value){return value.split("")},join:function(chars){return chars.join("")}};var characterDiff=new Diff;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}var extendedWordChars=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,reWhitespace=/\S/,wordDiff=new Diff;wordDiff.equals=function(left,right){return this.options.ignoreCase&&(left=left.toLowerCase(),right=right.toLowerCase()),left===right||this.options.ignoreWhitespace&&!reWhitespace.test(left)&&!reWhitespace.test(right)},wordDiff.tokenize=function(value){for(var tokens=value.split(/(\s+|[()[\]{}'"]|\b)/),i=0;i<tokens.length-1;i++)!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 lineDiff=new Diff;function diffLines(oldStr,newStr,callback){return lineDiff.diff(oldStr,newStr,callback)}lineDiff.tokenize=function(value){var retLines=[],linesAndNewlines=value.split(/(\n|\r\n)/);linesAndNewlines[linesAndNewlines.length-1]||linesAndNewlines.pop();for(var i=0;i<linesAndNewlines.length;i++){var line=linesAndNewlines[i];i%2&&!this.options.newlineIsToken?retLines[retLines.length-1]+=line:(this.options.ignoreWhitespace&&(line=line.trim()),retLines.push(line))}return retLines};var sentenceDiff=new Diff;sentenceDiff.tokenize=function(value){return value.split(/(\S.+?[.!?])(?=\s+|$)/)};var cssDiff=new Diff;function _typeof(obj){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj})(obj)}function _toConsumableArray(arr){return function(arr){if(Array.isArray(arr)){for(var i=0,arr2=new Array(arr.length);i<arr.length;i++)arr2[i]=arr[i];return arr2}}(arr)||function(iter){if(Symbol.iterator in Object(iter)||"[object Arguments]"===Object.prototype.toString.call(iter))return Array.from(iter)}(arr)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}cssDiff.tokenize=function(value){return value.split(/([{}:;,]|\s+)/)};var objectPrototypeToString=Object.prototype.toString,jsonDiff=new Diff;function canonicalize(obj,stack,replacementStack,replacer,key){var i,canonicalizedObj;for(stack=stack||[],replacementStack=replacementStack||[],replacer&&(obj=replacer(key,obj)),i=0;i<stack.length;i+=1)if(stack[i]===obj)return replacementStack[i];if("[object Array]"===objectPrototypeToString.call(obj)){for(stack.push(obj),canonicalizedObj=new Array(obj.length),replacementStack.push(canonicalizedObj),i=0;i<obj.length;i+=1)canonicalizedObj[i]=canonicalize(obj[i],stack,replacementStack,replacer,key);return stack.pop(),replacementStack.pop(),canonicalizedObj}if(obj&&obj.toJSON&&(obj=obj.toJSON()),"object"===_typeof(obj)&&null!==obj){stack.push(obj),canonicalizedObj={},replacementStack.push(canonicalizedObj);var _key,sortedKeys=[];for(_key in obj)obj.hasOwnProperty(_key)&&sortedKeys.push(_key);for(sortedKeys.sort(),i=0;i<sortedKeys.length;i+=1)canonicalizedObj[_key=sortedKeys[i]]=canonicalize(obj[_key],stack,replacementStack,replacer,_key);stack.pop(),replacementStack.pop()}else canonicalizedObj=obj;return canonicalizedObj}jsonDiff.useLongestToken=!0,jsonDiff.tokenize=lineDiff.tokenize,jsonDiff.castInput=function(value){var _this$options=this.options,undefinedReplacement=_this$options.undefinedReplacement,_this$options$stringi=_this$options.stringifyReplacer,stringifyReplacer=void 0===_this$options$stringi?function(k,v){return void 0===v?undefinedReplacement:v}:_this$options$stringi;return"string"==typeof value?value:JSON.stringify(canonicalize(value,null,null,stringifyReplacer),stringifyReplacer," ")},jsonDiff.equals=function(left,right){return Diff.prototype.equals.call(jsonDiff,left.replace(/,([\r\n])/g,"$1"),right.replace(/,([\r\n])/g,"$1"))};var arrayDiff=new Diff;function parsePatch(uniDiff){var options=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},diffstr=uniDiff.split(/\r\n|[\n\v\f\r\x85]/),delimiters=uniDiff.match(/\r\n|[\n\v\f\r\x85]/g)||[],list=[],i=0;function parseIndex(){var index={};for(list.push(index);i<diffstr.length;){var line=diffstr[i];if(/^(\-\-\-|\+\+\+|@@)\s/.test(line))break;var header=/^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line);header&&(index.index=header[1]),i++}for(parseFileHeader(index),parseFileHeader(index),index.hunks=[];i<diffstr.length;){var _line=diffstr[i];if(/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line))break;if(/^@@/.test(_line))index.hunks.push(parseHunk());else{if(_line&&options.strict)throw new Error("Unknown line "+(i+1)+" "+JSON.stringify(_line));i++}}}function parseFileHeader(index){var fileHeader=/^(---|\+\+\+)\s+(.*)$/.exec(diffstr[i]);if(fileHeader){var keyPrefix="---"===fileHeader[1]?"old":"new",data=fileHeader[2].split("\t",2),fileName=data[0].replace(/\\\\/g,"\\");/^".*"$/.test(fileName)&&(fileName=fileName.substr(1,fileName.length-2)),index[keyPrefix+"FileName"]=fileName,index[keyPrefix+"Header"]=(data[1]||"").trim(),i++}}function parseHunk(){for(var chunkHeaderIndex=i,chunkHeader=diffstr[i++].split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/),hunk={oldStart:+chunkHeader[1],oldLines:+chunkHeader[2]||1,newStart:+chunkHeader[3],newLines:+chunkHeader[4]||1,lines:[],linedelimiters:[]},addCount=0,removeCount=0;i<diffstr.length&&!(0===diffstr[i].indexOf("--- ")&&i+2<diffstr.length&&0===diffstr[i+1].indexOf("+++ ")&&0===diffstr[i+2].indexOf("@@"));i++){var operation=0==diffstr[i].length&&i!=diffstr.length-1?" ":diffstr[i][0];if("+"!==operation&&"-"!==operation&&" "!==operation&&"\\"!==operation)break;hunk.lines.push(diffstr[i]),hunk.linedelimiters.push(delimiters[i]||"\n"),"+"===operation?addCount++:"-"===operation?removeCount++:" "===operation&&(addCount++,removeCount++)}if(addCount||1!==hunk.newLines||(hunk.newLines=0),removeCount||1!==hunk.oldLines||(hunk.oldLines=0),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}for(;i<diffstr.length;)parseIndex();return list}function distanceIterator(start,minLine,maxLine){var wantForward=!0,backwardExhausted=!1,forwardExhausted=!1,localOffset=1;return function iterator(){if(wantForward&&!forwardExhausted){if(backwardExhausted?localOffset++:wantForward=!1,start+localOffset<=maxLine)return localOffset;forwardExhausted=!0}if(!backwardExhausted)return forwardExhausted||(wantForward=!0),minLine<=start-localOffset?-localOffset++:(backwardExhausted=!0,iterator())}}function applyPatch(source,uniDiff){var options=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if("string"==typeof uniDiff&&(uniDiff=parsePatch(uniDiff)),Array.isArray(uniDiff)){if(1<uniDiff.length)throw new Error("applyPatch only works with a single input.");uniDiff=uniDiff[0]}var removeEOFNL,addEOFNL,lines=source.split(/\r\n|[\n\v\f\r\x85]/),delimiters=source.match(/\r\n|[\n\v\f\r\x85]/g)||[],hunks=uniDiff.hunks,compareLine=options.compareLine||function(lineNumber,line,operation,patchContent){return line===patchContent},errorCount=0,fuzzFactor=options.fuzzFactor||0,minLine=0,offset=0;function hunkFits(hunk,toPos){for(var j=0;j<hunk.lines.length;j++){var line=hunk.lines[j],operation=0<line.length?line[0]:" ",content=0<line.length?line.substr(1):line;if(" "===operation||"-"===operation){if(!compareLine(toPos+1,lines[toPos],operation,content)&&fuzzFactor<++errorCount)return!1;toPos++}}return!0}for(var i=0;i<hunks.length;i++){for(var hunk=hunks[i],maxLine=lines.length-hunk.oldLines,localOffset=0,toPos=offset+hunk.oldStart-1,iterator=distanceIterator(toPos,minLine,maxLine);void 0!==localOffset;localOffset=iterator())if(hunkFits(hunk,toPos+localOffset)){hunk.offset=offset+=localOffset;break}if(void 0===localOffset)return!1;minLine=hunk.offset+hunk.oldStart+hunk.oldLines}for(var diffOffset=0,_i=0;_i<hunks.length;_i++){var _hunk=hunks[_i],_toPos=_hunk.oldStart+_hunk.offset+diffOffset-1;diffOffset+=_hunk.newLines-_hunk.oldLines,_toPos<0&&(_toPos=0);for(var j=0;j<_hunk.lines.length;j++){var line=_hunk.lines[j],operation=0<line.length?line[0]:" ",content=0<line.length?line.substr(1):line,delimiter=_hunk.linedelimiters[j];if(" "===operation)_toPos++;else if("-"===operation)lines.splice(_toPos,1),delimiters.splice(_toPos,1);else if("+"===operation)lines.splice(_toPos,0,content),delimiters.splice(_toPos,0,delimiter),_toPos++;else if("\\"===operation){var previousOperation=_hunk.lines[j-1]?_hunk.lines[j-1][0]:null;"+"===previousOperation?removeEOFNL=!0:"-"===previousOperation&&(addEOFNL=!0)}}}if(removeEOFNL)for(;!lines[lines.length-1];)lines.pop(),delimiters.pop();else addEOFNL&&(lines.push(""),delimiters.push("\n"));for(var _k=0;_k<lines.length-1;_k++)lines[_k]=lines[_k]+delimiters[_k];return lines.join("")}function structuredPatch(oldFileName,newFileName,oldStr,newStr,oldHeader,newHeader,options){void 0===(options=options||{}).context&&(options.context=4);var diff=diffLines(oldStr,newStr,options);function contextLines(lines){return lines.map(function(entry){return" "+entry})}diff.push({value:"",lines:[]});for(var hunks=[],oldRangeStart=0,newRangeStart=0,curRange=[],oldLine=1,newLine=1,_loop=function(i){var current=diff[i],lines=current.lines||current.value.replace(/\n$/,"").split("\n");if(current.lines=lines,current.added||current.removed){var _curRange;if(!oldRangeStart){var prev=diff[i-1];oldRangeStart=oldLine,newRangeStart=newLine,prev&&(curRange=0<options.context?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){var _curRange2;(_curRange2=curRange).push.apply(_curRange2,_toConsumableArray(contextLines(lines)))}else{var _curRange3,contextSize=Math.min(lines.length,options.context);(_curRange3=curRange).push.apply(_curRange3,_toConsumableArray(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){var oldEOFNewline=/\n$/.test(oldStr),newEOFNewline=/\n$/.test(newStr),noNlBeforeAdds=0==lines.length&&curRange.length>hunk.oldLines;!oldEOFNewline&&noNlBeforeAdds&&curRange.splice(hunk.oldLines,0,"\"),(oldEOFNewline||noNlBeforeAdds)&&newEOFNewline||curRange.push("\")}hunks.push(hunk),newRangeStart=oldRangeStart=0,curRange=[]}oldLine+=lines.length,newLine+=lines.length}},i=0;i<diff.length;i++)_loop(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),ret=[];oldFileName==newFileName&&ret.push("Index: "+oldFileName),ret.push("==================================================================="),ret.push("--- "+diff.oldFileName+(void 0===diff.oldHeader?"":"\t"+diff.oldHeader)),ret.push("+++ "+diff.newFileName+(void 0===diff.newHeader?"":"\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 arrayStartsWith(array,start){if(start.length>array.length)return!1;for(var i=0;i<start.length;i++)if(start[i]!==array[i])return!1;return!0}function calcLineCount(hunk){var _calcOldNewLineCount=function calcOldNewLineCount(lines){var oldLines=0;var newLines=0;lines.forEach(function(line){if("string"!=typeof line){var myCount=calcOldNewLineCount(line.mine),theirCount=calcOldNewLineCount(line.theirs);void 0!==oldLines&&(myCount.oldLines===theirCount.oldLines?oldLines+=myCount.oldLines:oldLines=void 0),void 0!==newLines&&(myCount.newLines===theirCount.newLines?newLines+=myCount.newLines:newLines=void 0)}else void 0===newLines||"+"!==line[0]&&" "!==line[0]||newLines++,void 0===oldLines||"-"!==line[0]&&" "!==line[0]||oldLines++});return{oldLines:oldLines,newLines:newLines}}(hunk.lines),oldLines=_calcOldNewLineCount.oldLines,newLines=_calcOldNewLineCount.newLines;void 0!==oldLines?hunk.oldLines=oldLines:delete hunk.oldLines,void 0!==newLines?hunk.newLines=newLines:delete hunk.newLines}function loadPatch(param,base){if("string"!=typeof param)return param;if(/^@@/m.test(param)||/^Index:/m.test(param))return parsePatch(param)[0];if(!base)throw new Error("Must provide a base reference or pass in a patch");return structuredPatch(void 0,void 0,base,param)}function fileNameChanged(patch){return patch.newFileName&&patch.newFileName!==patch.oldFileName}function selectField(index,mine,theirs){return mine===theirs?mine:(index.conflict=!0,{mine:mine,theirs:theirs})}function hunkBefore(test,check){return test.oldStart<check.oldStart&&test.oldStart+test.oldLines<check.oldStart}function cloneHunk(hunk,offset){return{oldStart:hunk.oldStart,oldLines:hunk.oldLines,newStart:hunk.newStart+offset,newLines:hunk.newLines,lines:hunk.lines}}function mergeLines(hunk,mineOffset,mineLines,theirOffset,theirLines){var mine={offset:mineOffset,lines:mineLines,index:0},their={offset:theirOffset,lines:theirLines,index:0};for(insertLeading(hunk,mine,their),insertLeading(hunk,their,mine);mine.index<mine.lines.length&&their.index<their.lines.length;){var mineCurrent=mine.lines[mine.index],theirCurrent=their.lines[their.index];if("-"!==mineCurrent[0]&&"+"!==mineCurrent[0]||"-"!==theirCurrent[0]&&"+"!==theirCurrent[0])if("+"===mineCurrent[0]&&" "===theirCurrent[0]){var _hunk$lines;(_hunk$lines=hunk.lines).push.apply(_hunk$lines,_toConsumableArray(collectChange(mine)))}else if("+"===theirCurrent[0]&&" "===mineCurrent[0]){var _hunk$lines2;(_hunk$lines2=hunk.lines).push.apply(_hunk$lines2,_toConsumableArray(collectChange(their)))}else"-"===mineCurrent[0]&&" "===theirCurrent[0]?removal(hunk,mine,their):"-"===theirCurrent[0]&&" "===mineCurrent[0]?removal(hunk,their,mine,!0):mineCurrent===theirCurrent?(hunk.lines.push(mineCurrent),mine.index++,their.index++):conflict(hunk,collectChange(mine),collectChange(their));else mutualChange(hunk,mine,their)}insertTrailing(hunk,mine),insertTrailing(hunk,their),calcLineCount(hunk)}function mutualChange(hunk,mine,their){var myChanges=collectChange(mine),theirChanges=collectChange(their);if(allRemoves(myChanges)&&allRemoves(theirChanges)){var _hunk$lines3,_hunk$lines4;if(arrayStartsWith(myChanges,theirChanges)&&skipRemoveSuperset(their,myChanges,myChanges.length-theirChanges.length))return void(_hunk$lines3=hunk.lines).push.apply(_hunk$lines3,_toConsumableArray(myChanges));if(arrayStartsWith(theirChanges,myChanges)&&skipRemoveSuperset(mine,theirChanges,theirChanges.length-myChanges.length))return void(_hunk$lines4=hunk.lines).push.apply(_hunk$lines4,_toConsumableArray(theirChanges))}else if(function(a,b){return a.length===b.length&&arrayStartsWith(a,b)}(myChanges,theirChanges)){var _hunk$lines5;return void(_hunk$lines5=hunk.lines).push.apply(_hunk$lines5,_toConsumableArray(myChanges))}conflict(hunk,myChanges,theirChanges)}function removal(hunk,mine,their,swap){var _hunk$lines6,myChanges=collectChange(mine),theirChanges=function(state,matchChanges){var changes=[],merged=[],matchIndex=0,contextChanges=!1,conflicted=!1;for(;matchIndex<matchChanges.length&&state.index<state.lines.length;){var change=state.lines[state.index],match=matchChanges[matchIndex];if("+"===match[0])break;if(contextChanges=contextChanges||" "!==change[0],merged.push(match),matchIndex++,"+"===change[0])for(conflicted=!0;"+"===change[0];)changes.push(change),change=state.lines[++state.index];match.substr(1)===change.substr(1)?(changes.push(change),state.index++):conflicted=!0}"+"===(matchChanges[matchIndex]||"")[0]&&contextChanges&&(conflicted=!0);if(conflicted)return changes;for(;matchIndex<matchChanges.length;)merged.push(matchChanges[matchIndex++]);return{merged:merged,changes:changes}}(their,myChanges);theirChanges.merged?(_hunk$lines6=hunk.lines).push.apply(_hunk$lines6,_toConsumableArray(theirChanges.merged)):conflict(hunk,swap?theirChanges:myChanges,swap?myChanges:theirChanges)}function conflict(hunk,mine,their){hunk.conflict=!0,hunk.lines.push({conflict:!0,mine:mine,theirs:their})}function insertLeading(hunk,insert,their){for(;insert.offset<their.offset&&insert.index<insert.lines.length;){var line=insert.lines[insert.index++];hunk.lines.push(line),insert.offset++}}function insertTrailing(hunk,insert){for(;insert.index<insert.lines.length;){var line=insert.lines[insert.index++];hunk.lines.push(line)}}function collectChange(state){for(var ret=[],operation=state.lines[state.index][0];state.index<state.lines.length;){var line=state.lines[state.index];if("-"===operation&&"+"===line[0]&&(operation="+"),operation!==line[0])break;ret.push(line),state.index++}return ret}function allRemoves(changes){return changes.reduce(function(prev,change){return prev&&"-"===change[0]},!0)}function skipRemoveSuperset(state,removeChanges,delta){for(var i=0;i<delta;i++){var changeContent=removeChanges[removeChanges.length-delta+i].substr(1);if(state.lines[state.index+i]!==" "+changeContent)return!1}return state.index+=delta,!0}function escapeHTML(s){var n=s;return n=(n=(n=(n=n.replace(/&/g,"&amp;")).replace(/</g,"&lt;")).replace(/>/g,"&gt;")).replace(/"/g,"&quot;")}arrayDiff.tokenize=function(value){return value.slice()},arrayDiff.join=arrayDiff.removeEmpty=function(value){return value},exports.Diff=Diff,exports.diffChars=function(oldStr,newStr,options){return characterDiff.diff(oldStr,newStr,options)},exports.diffWords=function(oldStr,newStr,options){return options=generateOptions(options,{ignoreWhitespace:!0}),wordDiff.diff(oldStr,newStr,options)},exports.diffWordsWithSpace=function(oldStr,newStr,options){return wordDiff.diff(oldStr,newStr,options)},exports.diffLines=diffLines,exports.diffTrimmedLines=function(oldStr,newStr,callback){var options=generateOptions(callback,{ignoreWhitespace:!0});return lineDiff.diff(oldStr,newStr,options)},exports.diffSentences=function(oldStr,newStr,callback){return sentenceDiff.diff(oldStr,newStr,callback)},exports.diffCss=function(oldStr,newStr,callback){return cssDiff.diff(oldStr,newStr,callback)},exports.diffJson=function(oldObj,newObj,options){return jsonDiff.diff(oldObj,newObj,options)},exports.diffArrays=function(oldArr,newArr,callback){return arrayDiff.diff(oldArr,newArr,callback)},exports.structuredPatch=structuredPatch,exports.createTwoFilesPatch=createTwoFilesPatch,exports.createPatch=function(fileName,oldStr,newStr,oldHeader,newHeader,options){return createTwoFilesPatch(fileName,fileName,oldStr,newStr,oldHeader,newHeader,options)},exports.applyPatch=applyPatch,exports.applyPatches=function(uniDiff,options){"string"==typeof uniDiff&&(uniDiff=parsePatch(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,function(err){if(err)return options.complete(err);processIndex()})})}()},exports.parsePatch=parsePatch,exports.merge=function(mine,theirs,base){mine=loadPatch(mine,base),theirs=loadPatch(theirs,base);var ret={};(mine.index||theirs.index)&&(ret.index=mine.index||theirs.index),(mine.newFileName||theirs.newFileName)&&(fileNameChanged(mine)?fileNameChanged(theirs)?(ret.oldFileName=selectField(ret,mine.oldFileName,theirs.oldFileName),ret.newFileName=selectField(ret,mine.newFileName,theirs.newFileName),ret.oldHeader=selectField(ret,mine.oldHeader,theirs.oldHeader),ret.newHeader=selectField(ret,mine.newHeader,theirs.newHeader)):(ret.oldFileName=mine.oldFileName,ret.newFileName=mine.newFileName,ret.oldHeader=mine.oldHeader,ret.newHeader=mine.newHeader):(ret.oldFileName=theirs.oldFileName||mine.oldFileName,ret.newFileName=theirs.newFileName||mine.newFileName,ret.oldHeader=theirs.oldHeader||mine.oldHeader,ret.newHeader=theirs.newHeader||mine.newHeader)),ret.hunks=[];for(var mineIndex=0,theirsIndex=0,mineOffset=0,theirsOffset=0;mineIndex<mine.hunks.length||theirsIndex<theirs.hunks.length;){var mineCurrent=mine.hunks[mineIndex]||{oldStart:1/0},theirsCurrent=theirs.hunks[theirsIndex]||{oldStart:1/0};if(hunkBefore(mineCurrent,theirsCurrent))ret.hunks.push(cloneHunk(mineCurrent,mineOffset)),mineIndex++,theirsOffset+=mineCurrent.newLines-mineCurrent.oldLines;else if(hunkBefore(theirsCurrent,mineCurrent))ret.hunks.push(cloneHunk(theirsCurrent,theirsOffset)),theirsIndex++,mineOffset+=theirsCurrent.newLines-theirsCurrent.oldLines;else{var mergedHunk={oldStart:Math.min(mineCurrent.oldStart,theirsCurrent.oldStart),oldLines:0,newStart:Math.min(mineCurrent.newStart+mineOffset,theirsCurrent.oldStart+theirsOffset),newLines:0,lines:[]};mergeLines(mergedHunk,mineCurrent.oldStart,mineCurrent.lines,theirsCurrent.oldStart,theirsCurrent.lines),theirsIndex++,mineIndex++,ret.hunks.push(mergedHunk)}}return ret},exports.convertChangesToDMP=function(changes){for(var change,operation,ret=[],i=0;i<changes.length;i++)operation=(change=changes[i]).added?1:change.removed?-1:0,ret.push([operation,change.value]);return ret},exports.convertChangesToXML=function(changes){for(var ret=[],i=0;i<changes.length;i++){var change=changes[i];change.added?ret.push("<ins>"):change.removed&&ret.push("<del>"),ret.push(escapeHTML(change.value)),change.added?ret.push("</ins>"):change.removed&&ret.push("</del>")}return ret.join("")},exports.canonicalize=canonicalize,Object.defineProperty(exports,"__esModule",{value:!0})},"object"==typeof exports&&void 0!==module?factory(exports):"function"==typeof define&&define.amd?define(["exports"],factory):factory((global=global||self).Diff={})},{}],3:[function(require,module,exports){!function(Hogan){var rIsWhitespace=/\S/,rQuot=/\"/g,rNewline=/\n/g,rCr=/\r/g,rSlash=/\\/g,rLineSep=/\u2028/,rParagraphSep=/\u2029/;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;i<l;i++)if(text.charAt(index+i)!=tag.charAt(i))return!1;return!0}Hogan.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},Hogan.scan=function(text,delimiters){var len=text.length,state=0,tagType=null,tag=null,buf="",tokens=[],seenTag=!1,i=0,lineStart=0,otag="{{",ctag="}}";function addBuf(){0<buf.length&&(tokens.push({tag:"_t",text:new String(buf)}),buf="")}function filterLine(haveSeenTag,noNewLine){if(addBuf(),haveSeenTag&&function(){for(var isAllWhitespace=!0,j=lineStart;j<tokens.length;j++)if(!(isAllWhitespace=Hogan.tags[tokens[j].tag]<Hogan.tags._v||"_t"==tokens[j].tag&&null===tokens[j].text.match(rIsWhitespace)))return!1;return isAllWhitespace}())for(var next,j=lineStart;j<tokens.length;j++)tokens[j].text&&((next=tokens[j+1])&&">"==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}for(delimiters&&(delimiters=delimiters.split(" "),otag=delimiters[0],ctag=delimiters[1]),i=0;i<len;i++)0==state?tagChange(otag,text,i)?(--i,addBuf(),state=1):"\n"==text.charAt(i)?filterLine(seenTag):buf+=text.charAt(i):1==state?(i+=otag.length-1,state="="==(tagType=(tag=Hogan.tags[text.charAt(i+1)])?text.charAt(i+1):"_v")?(i=changeDelimiters(text,i),0):(tag&&i++,2),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=0,"{"==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};function isOpener(token,tags){for(var i=0,l=tags.length;i<l;i++)if(tags[i].o==token.n)return token.tag="#",!0}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!0}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: "+function(obj){var items=[];for(var key in obj)items.push('"'+esc(key)+'": function(c,p,t,i) {'+obj[key]+"}");return"{ "+items.join(",")+" }"}(codeObj.subs)}Hogan.stringify=function(codeObj,text,options){return"{code: function (c,p,i) { "+Hogan.wrapMain(codeObj.code)+" },"+stringifyPartials(codeObj)+"}"};var serialNo=0;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 sym="<"+(context.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+");"}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;i<l;i++)(func=Hogan.codegen[nodelist[i].tag])&&func(nodelist[i],context);return context},Hogan.parse=function(tokens,text,options){return function buildTree(tokens,kind,stack,customTags){var tail,instructions=[],opener=null,token=null;for(tail=stack[stack.length-1];0<tokens.length;){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(0<stack.length)throw new Error("missing closing tag: "+stack.pop().n);return instructions}(tokens,0,[],(options=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}}(void 0!==exports?exports:Hogan)},{}],4:[function(require,module,exports){var Hogan=require("./compiler");Hogan.Template=require("./template").Template,Hogan.template=Hogan.Template,module.exports=Hogan},{"./compiler":3,"./template":5}],5:[function(require,module,exports){!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}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(context,partials,indent){return""},v:function(str){return str=coerceToString(str),hChars.test(str)?str.replace(rAmp,"&amp;").replace(rLt,"&lt;").replace(rGt,"&gt;").replace(rApos,"&#39;").replace(rQuot,"&quot;"):str},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){for(key in partials.stackText||(partials.stackText={}),partial.subs)partials.stackText[key]||(partials.stackText[key]=void 0!==this.activeSub&&partials.stackText[this.activeSub]?partials.stackText[this.activeSub]:this.text);template=function(instance,subs,partials,stackSubs,stackPartials,stackText){function PartialTemplate(){}function Substitutions(){}var key;Substitutions.prototype=(PartialTemplate.prototype=instance).subs;var partial=new PartialTemplate;for(key in partial.subs=new Substitutions,partial.subsText={},partial.buf="",stackSubs=stackSubs||{},partial.stackSubs=stackSubs,partial.subsText=stackText,subs)stackSubs[key]||(stackSubs[key]=subs[key]);for(key in stackSubs)partial.subs[key]=stackSubs[key];for(key in stackPartials=stackPartials||{},partial.stackPartials=stackPartials,partials)stackPartials[key]||(stackPartials[key]=partials[key]);for(key in stackPartials)partial.partials[key]=stackPartials[key];return partial}(template,partial.subs,partial.partials,this.stackSubs,this.stackPartials,partials.stackText)}return this.partials[symbol].instance=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))for(var i=0;i<tail.length;i++)context.push(tail[i]),section(context,partials,this),context.pop();else section(context,partials,this)},s:function(val,ctx,partials,inverted,start,end,tags){var pass;return(!isArray(val)||0!==val.length)&&("function"==typeof val&&(val=this.ms(val,ctx,partials,inverted,start,end,tags)),pass=!!val,!inverted&&pass&&ctx&&ctx.push("object"==typeof val?val:ctx[ctx.length-1]),pass)},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++)val=void 0!==(found=findInScope(names[i],val,doModelGet))?(cx=val,found):"";return!(returnFound&&!val)&&(returnFound||"function"!=typeof val||(ctx.push(cx),val=this.mv(val,ctx,partials),ctx.pop()),val)},f:function(key,ctx,partials,returnFound){for(var val=!1,found=!1,doModelGet=this.options.modelGet,i=ctx.length-1;0<=i;i--)if(void 0!==(val=findInScope(key,ctx[i],doModelGet))){found=!0;break}return found?(returnFound||"function"!=typeof val||(val=this.mv(val,ctx,partials)),val):!returnFound&&""},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||(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,rGt=/>/g,rApos=/\'/g,rQuot=/\"/g,hChars=/[&<>\"\']/;function coerceToString(val){return String(null==val?"":val)}var isArray=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)}}(void 0!==exports?exports:{})},{}],6:[function(require,module,exports){function merge_recursive(base,extend){if("object"!==typeOf(base))return extend;for(var key in extend)"object"===typeOf(base[key])&&"object"===typeOf(extend[key])?base[key]=merge_recursive(base[key],extend[key]):base[key]=extend[key];return base}function merge(clone,recursive,argv){var result=argv[0],size=argv.length;!clone&&"object"===typeOf(result)||(result={});for(var index=0;index<size;++index){var item=argv[index];if("object"===typeOf(item))for(var key in item)if("__proto__"!==key){var sitem=clone?Public.clone(item[key]):item[key];result[key]=recursive?merge_recursive(result[key],sitem):sitem}}return result}function typeOf(input){return{}.toString.call(input).slice(8,-1).toLowerCase()}var isNode,Public;isNode="object"==typeof module&&module&&"object"==typeof module.exports&&module.exports,(Public=function(clone){return merge(!0===clone,!1,arguments)}).recursive=function(clone){return merge(!0===clone,!0,arguments)},Public.clone=function(input){var index,size,output=input,type=typeOf(input);if("array"===type)for(output=[],size=input.length,index=0;index<size;++index)output[index]=Public.clone(input[index]);else if("object"===type)for(index in output={},input)output[index]=Public.clone(input[index]);return output},isNode?module.exports=Public:window.merge=Public},{}],7:[function(require,module,exports){(function(process){function normalizeArray(parts,allowAboveRoot){for(var up=0,i=parts.length-1;0<=i;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--;)parts.unshift("..");return parts}function filter(xs,f){if(xs.filter)return xs.filter(f);for(var res=[],i=0;i<xs.length;i++)f(xs[i],i,xs)&&res.push(xs[i]);return res}exports.resolve=function(){for(var resolvedPath="",resolvedAbsolute=!1,i=arguments.length-1;-1<=i&&!resolvedAbsolute;i--){var path=0<=i?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(resolvedAbsolute?"/":"")+(resolvedPath=normalizeArray(filter(resolvedPath.split("/"),function(p){return!!p}),!resolvedAbsolute).join("/"))||"."},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("/"))||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,index){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<arr.length&&""===arr[start];start++);for(var end=arr.length-1;0<=end&&""===arr[end];end--);return end<start?[]: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;i<length;i++)if(fromParts[i]!==toParts[i]){samePartsLength=i;break}var outputParts=[];for(i=samePartsLength;i<fromParts.length;i++)outputParts.push("..");return(outputParts=outputParts.concat(toParts.slice(samePartsLength))).join("/")},exports.sep="/",exports.delimiter=":",exports.dirname=function(path){if("string"!=typeof path&&(path+=""),0===path.length)return".";for(var code=path.charCodeAt(0),hasRoot=47===code,end=-1,matchedSlash=!0,i=path.length-1;1<=i;--i)if(47===(code=path.charCodeAt(i))){if(!matchedSlash){end=i;break}}else matchedSlash=!1;return-1===end?hasRoot?"/":".":hasRoot&&1===end?"/":path.slice(0,end)},exports.basename=function(path,ext){var f=function(path){"string"!=typeof path&&(path+="");var i,start=0,end=-1,matchedSlash=!0;for(i=path.length-1;0<=i;--i)if(47===path.charCodeAt(i)){if(!matchedSlash){start=i+1;break}}else-1===end&&(matchedSlash=!1,end=i+1);return-1===end?"":path.slice(start,end)}(path);return ext&&f.substr(-1*ext.length)===ext&&(f=f.substr(0,f.length-ext.length)),f},exports.extname=function(path){"string"!=typeof path&&(path+="");for(var startDot=-1,startPart=0,end=-1,matchedSlash=!0,preDotState=0,i=path.length-1;0<=i;--i){var code=path.charCodeAt(i);if(47===code){if(matchedSlash)continue;startPart=i+1;break}-1===end&&(matchedSlash=!1,end=i+1),46===code?-1===startDot?startDot=i:1!==preDotState&&(preDotState=1):-1!==startDot&&(preDotState=-1)}return-1===startDot||-1===end||0===preDotState||1===preDotState&&startDot===end-1&&startDot===startPart+1?"":path.slice(startDot,end)};var substr="b"==="ab".substr(-1)?function(str,start,len){return str.substr(start,len)}:function(str,start,len){return start<0&&(start=str.length+start),str.substr(start,len)}}).call(this,require("_process"))},{_process:8}],8:[function(require,module,exports){var cachedSetTimeout,cachedClearTimeout,process=module.exports={};function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(fun){if(cachedSetTimeout===setTimeout)return setTimeout(fun,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(fun,0);try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}!function(){try{cachedSetTimeout="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e){cachedSetTimeout=defaultSetTimout}try{cachedClearTimeout="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e){cachedClearTimeout=defaultClearTimeout}}();var currentQueue,queue=[],draining=!1,queueIndex=-1;function cleanUpNextTick(){draining&&currentQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var timeout=runTimeout(cleanUpNextTick);draining=!0;for(var len=queue.length;len;){for(currentQueue=queue,queue=[];++queueIndex<len;)currentQueue&&currentQueue[queueIndex].run();queueIndex=-1,len=queue.length}currentQueue=null,draining=!1,function(marker){if(cachedClearTimeout===clearTimeout)return clearTimeout(marker);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(marker);try{cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}(timeout)}}function Item(fun,array){this.fun=fun,this.array=array}function noop(){}process.nextTick=function(fun){var args=new Array(arguments.length-1);if(1<arguments.length)for(var i=1;i<arguments.length;i++)args[i-1]=arguments[i];queue.push(new Item(fun,args)),1!==queue.length||draining||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.prependListener=noop,process.prependOnceListener=noop,process.listeners=function(name){return[]},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}},{}],9:[function(require,module,exports){function DiffParser(){}function getExtension(filename,language){var nameSplit=filename.split(".");return 1<nameSplit.length?nameSplit[nameSplit.length-1]:language}function _getFilename(linePrefix,line,extraPrefix){var filename,prefixes=["a/","b/","i/","w/","c/","o/"];extraPrefix&&prefixes.push(extraPrefix);var values=(linePrefix?new RegExp("^"+linePrefix+' "?(.+?)"?$'):new RegExp('^"?(.+?)"?$')).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)),filename=filename.replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [-+]\d{4}.*$/,"")}return filename}var utils,LINE_TYPE;utils=require("./utils.js").Utils,DiffParser.prototype.LINE_TYPE=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.generateDiffJson=function(diffInput,configuration){var possibleOldName,possibleNewName,config=configuration||{},files=[],currentFile=null,currentBlock=null,oldLine=null,oldLine2=null,newLine=null;function saveBlock(){currentBlock&&(currentFile.blocks.push(currentBlock),currentBlock=null)}function saveFile(){currentFile&&(currentFile.oldName||(currentFile.oldName=possibleOldName),currentFile.newName||(currentFile.newName=possibleNewName),currentFile.newName&&(files.push(currentFile),currentFile=null)),possibleNewName=possibleOldName=void 0}function startFile(){saveBlock(),saveFile(),currentFile={blocks:[],deletedLines:0,addedLines:0}}function startBlock(line){var values;saveBlock(),(values=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(line))?(currentFile.isCombined=!1,oldLine=values[1],newLine=values[2]):(values=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(line))?(currentFile.isCombined=!0,oldLine=values[1],oldLine2=values[2],newLine=values[3]):(utils.startsWith(line,"@@")&&console.error("Failed to parse lines, starting in 0!"),newLine=oldLine=0,currentFile.isCombined=!1),(currentBlock={lines:[]}).oldStartLine=oldLine,currentBlock.oldStartLine2=oldLine2,currentBlock.newStartLine=newLine,currentBlock.header=line}var diffLines=diffInput.replace(/\/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})?/,binaryFiles=/^Binary files (.*) and (.*) differ/,binaryDiff=/^GIT binary patch/,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,lineIndex){if(line&&!utils.startsWith(line,"*")){var values,prevLine=diffLines[lineIndex-1],nxtLine=diffLines[lineIndex+1],afterNxtLine=diffLines[lineIndex+2];if(utils.startsWith(line,"diff"))return startFile(),(values=/^diff --git "?(.+)"? "?(.+)"?/.exec(line))&&(possibleOldName=_getFilename(null,values[1],config.dstPrefix),possibleNewName=_getFilename(null,values[2],config.srcPrefix)),void(currentFile.isGitDiff=!0);if((!currentFile||!currentFile.isGitDiff&&currentFile&&utils.startsWith(line,"--- ")&&utils.startsWith(nxtLine,"+++ ")&&utils.startsWith(afterNxtLine,"@@"))&&startFile(),utils.startsWith(line,"--- ")&&utils.startsWith(nxtLine,"+++ ")||utils.startsWith(line,"+++ ")&&utils.startsWith(prevLine,"--- ")){if(currentFile&&!currentFile.oldName&&utils.startsWith(line,"--- ")&&(values=function(line,cfg){return _getFilename("---",line,cfg.srcPrefix)}(line,config)))return currentFile.oldName=values,void(currentFile.language=getExtension(currentFile.oldName,currentFile.language));if(currentFile&&!currentFile.newName&&utils.startsWith(line,"+++ ")&&(values=function(line,cfg){return _getFilename("\\+\\+\\+",line,cfg.dstPrefix)}(line,config)))return currentFile.newName=values,void(currentFile.language=getExtension(currentFile.newName,currentFile.language))}if(currentFile&&utils.startsWith(line,"@@")||currentFile.isGitDiff&&currentFile&&currentFile.oldName&&currentFile.newName&&!currentBlock)startBlock(line);else if(currentBlock&&(utils.startsWith(line,"+")||utils.startsWith(line,"-")||utils.startsWith(line," ")))!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++):utils.startsWith(line,delLinePrefixes)?(currentFile.deletedLines++,currentLine.type=LINE_TYPE.DELETES,currentLine.oldNumber=oldLine++,currentLine.newNumber=null):(currentLine.type=LINE_TYPE.CONTEXT,currentLine.oldNumber=oldLine++,currentLine.newNumber=newLine++),currentBlock.lines.push(currentLine)}(line);else{var doesNotExistHunkHeader=!function(line,lineIdx){for(var idx=lineIdx;idx<diffLines.length-3;){if(utils.startsWith(line,"diff"))return!1;if(utils.startsWith(diffLines[idx],"--- ")&&utils.startsWith(diffLines[idx+1],"+++ ")&&utils.startsWith(diffLines[idx+2],"@@"))return!0;idx++}return!1}(line,lineIndex);(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))?(doesNotExistHunkHeader&&(currentFile.oldName=values[1]),currentFile.isCopy=!0):(values=copyTo.exec(line))?(doesNotExistHunkHeader&&(currentFile.newName=values[1]),currentFile.isCopy=!0):(values=renameFrom.exec(line))?(doesNotExistHunkHeader&&(currentFile.oldName=values[1]),currentFile.isRename=!0):(values=renameTo.exec(line))?(doesNotExistHunkHeader&&(currentFile.newName=values[1]),currentFile.isRename=!0):(values=binaryFiles.exec(line))?(currentFile.isBinary=!0,currentFile.oldName=_getFilename(null,values[1],config.srcPrefix),currentFile.newName=_getFilename(null,values[2],config.dstPrefix),startBlock("Binary file")):(values=binaryDiff.exec(line))?(currentFile.isBinary=!0,startBlock(line)):(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)}}}),saveBlock(),saveFile(),files},module.exports.DiffParser=new DiffParser},{"./utils.js":19}],10:[function(require,module,exports){(function(global){!function(){var diffParser=require("./diff-parser.js").DiffParser,htmlPrinter=require("./html-printer.js").HtmlPrinter,utils=require("./utils.js").Utils;function Diff2Html(){}var defaultConfig={inputFormat:"diff",outputFormat:"line-by-line",showFiles:!1,diffStyle:"word",matching:"none",matchWordsThreshold:.25,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200,maxLineLengthHighlight:1e4,templates:{},rawTemplates:{},renderNothingWhenEmpty:!1};Diff2Html.prototype.getJsonFromDiff=function(diffInput,config){var cfg=utils.safeConfig(config,defaultConfig);return diffParser.generateDiffJson(diffInput,cfg)},Diff2Html.prototype.getPrettyHtml=function(diffInput,config){var cfg=utils.safeConfig(config,defaultConfig),diffJson=diffInput;cfg.inputFormat&&"diff"!==cfg.inputFormat||(diffJson=diffParser.generateDiffJson(diffInput,cfg));var fileList="";!0===cfg.showFiles&&(fileList=htmlPrinter.generateFileListSummary(diffJson,cfg));return fileList+("side-by-side"===cfg.outputFormat?htmlPrinter.generateSideBySideJsonHtml(diffJson,cfg):htmlPrinter.generateLineByLineJsonHtml(diffJson,cfg))},Diff2Html.prototype.getPrettyHtmlFromDiff=function(diffInput,config){var cfg=utils.safeConfig(config,defaultConfig);return cfg.inputFormat="diff",cfg.outputFormat="line-by-line",this.getPrettyHtml(diffInput,cfg)},Diff2Html.prototype.getPrettyHtmlFromJson=function(diffJson,config){var cfg=utils.safeConfig(config,defaultConfig);return cfg.inputFormat="json",cfg.outputFormat="line-by-line",this.getPrettyHtml(diffJson,cfg)},Diff2Html.prototype.getPrettySideBySideHtmlFromDiff=function(diffInput,config){var cfg=utils.safeConfig(config,defaultConfig);return cfg.inputFormat="diff",cfg.outputFormat="side-by-side",this.getPrettyHtml(diffInput,cfg)},Diff2Html.prototype.getPrettySideBySideHtmlFromJson=function(diffJson,config){var cfg=utils.safeConfig(config,defaultConfig);return cfg.inputFormat="json",cfg.outputFormat="side-by-side",this.getPrettyHtml(diffJson,cfg)};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":9,"./html-printer.js":13,"./utils.js":19}],11:[function(require,module,exports){function FileListPrinter(config){this.config=config;var HoganJsUtils=require("./hoganjs-utils.js").HoganJsUtils;hoganUtils=new HoganJsUtils(config)}var hoganUtils,printerUtils;printerUtils=require("./printer-utils.js").PrinterUtils,FileListPrinter.prototype.generateFileList=function(diffFiles){var lineTemplate=hoganUtils.template("file-summary","line"),files=diffFiles.map(function(file){var fileTypeName=printerUtils.getFileTypeIcon(file),iconTemplate=hoganUtils.template("icon",fileTypeName);return lineTemplate.render({fileHtmlId:printerUtils.getHtmlId(file),oldName:file.oldName,newName:file.newName,fileName:printerUtils.getDiffName(file),deletedLines:"-"+file.deletedLines,addedLines:"+"+file.addedLines},{fileIcon:iconTemplate})}).join("\n");return hoganUtils.render("file-summary","wrapper",{filesNumber:diffFiles.length,files:files})},module.exports.FileListPrinter=FileListPrinter},{"./hoganjs-utils.js":12,"./printer-utils.js":15}],12:[function(require,module,exports){(function(__dirname){function HoganJsUtils(configuration){this.config=configuration||{},extraTemplates=this.config.templates||{};var rawTemplates=this.config.rawTemplates||{};for(var templateName in rawTemplates)rawTemplates.hasOwnProperty(templateName)&&(extraTemplates[templateName]||(extraTemplates[templateName]=this.compile(rawTemplates[templateName])))}var extraTemplates,fs,path,hogan,hoganTemplates;fs=require("fs"),path=require("path"),hogan=require("hogan.js"),hoganTemplates=require("./templates/diff2html-templates.js"),HoganJsUtils.prototype.render=function(namespace,view,params){var template=this.template(namespace,view);return template?template.render(params):null},HoganJsUtils.prototype.template=function(namespace,view){var templateKey=this._templateKey(namespace,view);return this._getTemplate(templateKey)},HoganJsUtils.prototype._getTemplate=function(templateKey){var template;return this.config.noCache||(template=this._readFromCache(templateKey)),template=template||this._loadTemplate(templateKey)},HoganJsUtils.prototype._loadTemplate=function(templateKey){var template;try{if(fs.readFileSync){var templatesPath=path.resolve(__dirname,"templates"),templatePath=path.join(templatesPath,templateKey),templateContent=fs.readFileSync(templatePath+".mustache","utf8");template=hogan.compile(templateContent),hoganTemplates[templateKey]=template}}catch(e){console.error("Failed to read (template: "+templateKey+") from fs: "+e.message)}return template},HoganJsUtils.prototype._readFromCache=function(templateKey){return extraTemplates[templateKey]||hoganTemplates[templateKey]},HoganJsUtils.prototype._templateKey=function(namespace,view){return namespace+"-"+view},HoganJsUtils.prototype.compile=function(templateStr){return hogan.compile(templateStr)},module.exports.HoganJsUtils=HoganJsUtils}).call(this,"/src")},{"./templates/diff2html-templates.js":18,fs:1,"hogan.js":4,path:7}],13:[function(require,module,exports){function HtmlPrinter(){}var LineByLinePrinter,SideBySidePrinter,FileListPrinter;LineByLinePrinter=require("./line-by-line-printer.js").LineByLinePrinter,SideBySidePrinter=require("./side-by-side-printer.js").SideBySidePrinter,FileListPrinter=require("./file-list-printer.js").FileListPrinter,HtmlPrinter.prototype.generateLineByLineJsonHtml=function(diffFiles,config){return new LineByLinePrinter(config).generateLineByLineJsonHtml(diffFiles)},HtmlPrinter.prototype.generateSideBySideJsonHtml=function(diffFiles,config){return new SideBySidePrinter(config).generateSideBySideJsonHtml(diffFiles)},HtmlPrinter.prototype.generateFileListSummary=function(diffJson,config){return new FileListPrinter(config).generateFileList(diffJson)},module.exports.HtmlPrinter=new HtmlPrinter},{"./file-list-printer.js":11,"./line-by-line-printer.js":14,"./side-by-side-printer.js":17}],14:[function(require,module,exports){!function(){var hoganUtils,diffParser=require("./diff-parser.js").DiffParser,printerUtils=require("./printer-utils.js").PrinterUtils,utils=require("./utils.js").Utils,Rematch=require("./rematch.js").Rematch;function LineByLinePrinter(config){this.config=config;var HoganJsUtils=require("./hoganjs-utils.js").HoganJsUtils;hoganUtils=new HoganJsUtils(config)}LineByLinePrinter.prototype.makeFileDiffHtml=function(file,diffs){if(this.config.renderNothingWhenEmpty&&file.blocks&&!file.blocks.length)return"";var fileDiffTemplate=hoganUtils.template("line-by-line","file-diff"),filePathTemplate=hoganUtils.template("generic","file-path"),fileIconTemplate=hoganUtils.template("icon","file"),fileTagTemplate=hoganUtils.template("tag",printerUtils.getFileTypeIcon(file));return fileDiffTemplate.render({file:file,fileHtmlId:printerUtils.getHtmlId(file),diffs:diffs,filePath:filePathTemplate.render({fileDiffName:printerUtils.getDiffName(file)},{fileIcon:fileIconTemplate,fileTag:fileTagTemplate})})},LineByLinePrinter.prototype.makeLineByLineHtmlWrapper=function(content){return hoganUtils.render("generic","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("generic","column-line-number",{diffParser:diffParser,blockHeader:utils.escape(block.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"})},LineByLinePrinter.prototype._generateFileHtml=function(file){var that=this;return file.blocks.map(function(block){var lines=that.makeColumnLineNumberHtml(block),oldLines=[],newLines=[];function processChangeBlock(){var matches,insertType,deleteType,comparisons=oldLines.length*newLines.length,maxLineSizeInBlock=Math.max.apply(null,[0].concat(oldLines.concat(newLines).map(function(elem){return elem.content.length}))),doMatching=comparisons<that.config.matchingMaxComparisons&&maxLineSizeInBlock<that.config.maxLineSizeInBlockForComparison&&("lines"===that.config.matching||"words"===that.config.matching);deleteType=doMatching?(matches=matcher(oldLines,newLines),insertType=diffParser.LINE_TYPE.INSERT_CHANGES,diffParser.LINE_TYPE.DELETE_CHANGES):(matches=[[oldLines,newLines]],insertType=diffParser.LINE_TYPE.INSERTS,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;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(file.isCombined,deleteType,oldLine.oldNumber,oldLine.newNumber,diff.first.line,diff.first.prefix),processedNewLines+=that.makeLineHtml(file.isCombined,insertType,newLine.oldNumber,newLine.newNumber,diff.second.line,diff.second.prefix)}lines+=processedOldLines+processedNewLines,lines+=that._processLines(file.isCombined,oldLines.slice(common),newLines.slice(common))}),oldLines=[],newLines=[]}for(var i=0;i<block.lines.length;i++){var line=block.lines[i],escapedLine=utils.escape(line.content);line.type!==diffParser.LINE_TYPE.INSERTS&&(0<newLines.length||line.type!==diffParser.LINE_TYPE.DELETES&&0<oldLines.length)&&processChangeBlock(),line.type===diffParser.LINE_TYPE.CONTEXT?lines+=that.makeLineHtml(file.isCombined,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(file.isCombined,line.type,line.oldNumber,line.newNumber,escapedLine)}return processChangeBlock(),lines}).join("\n")},LineByLinePrinter.prototype._processLines=function(isCombined,oldLines,newLines){for(var lines="",i=0;i<oldLines.length;i++){var oldLine=oldLines[i],oldEscapedLine=utils.escape(oldLine.content);lines+=this.makeLineHtml(isCombined,oldLine.type,oldLine.oldNumber,oldLine.newNumber,oldEscapedLine)}for(var j=0;j<newLines.length;j++){var newLine=newLines[j],newEscapedLine=utils.escape(newLine.content);lines+=this.makeLineHtml(isCombined,newLine.type,newLine.oldNumber,newLine.newNumber,newEscapedLine)}return lines},LineByLinePrinter.prototype.makeLineHtml=function(isCombined,type,oldNumber,newNumber,content,possiblePrefix){var lineNumberTemplate=hoganUtils.render("line-by-line","numbers",{oldNumber:utils.valueOrEmpty(oldNumber),newNumber:utils.valueOrEmpty(newNumber)}),lineWithoutPrefix=content,prefix=possiblePrefix;if(!prefix){var lineWithPrefix=printerUtils.separatePrefix(isCombined,content);prefix=lineWithPrefix.prefix,lineWithoutPrefix=lineWithPrefix.line}return" "===prefix&&(prefix="&nbsp;"),hoganUtils.render("generic","line",{type:type,lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line",prefix:prefix,content:lineWithoutPrefix,lineNumber:lineNumberTemplate})},LineByLinePrinter.prototype._generateEmptyDiff=function(){return hoganUtils.render("generic","empty-diff",{contentClass:"d2h-code-line",diffParser:diffParser})},module.exports.LineByLinePrinter=LineByLinePrinter}()},{"./diff-parser.js":9,"./hoganjs-utils.js":12,"./printer-utils.js":15,"./rematch.js":16,"./utils.js":19}],15:[function(require,module,exports){function PrinterUtils(){}function unifyPath(path){return path?path.replace("\\","/"):path}function isDevNullName(name){return-1!==name.indexOf("dev/null")}var jsDiff,utils,Rematch;jsDiff=require("diff"),utils=require("./utils.js").Utils,Rematch=require("./rematch.js").Rematch,PrinterUtils.prototype.separatePrefix=function(isCombined,line){var prefix,lineWithoutPrefix;return lineWithoutPrefix=isCombined?(prefix=line.substring(0,2),line.substring(2)):(prefix=line.substring(0,1),line.substring(1)),{prefix:prefix,line:lineWithoutPrefix}},PrinterUtils.prototype.getHtmlId=function(file){return"d2h-"+function(text){var i,len,hash=0;for(i=0,len=text.length;i<len;i++)hash=(hash<<5)-hash+text.charCodeAt(i),hash|=0;return hash}(this.getDiffName(file)).toString().slice(-6)},PrinterUtils.prototype.getDiffName=function(file){var oldFilename=unifyPath(file.oldName),newFilename=unifyPath(file.newName);if(!oldFilename||!newFilename||oldFilename===newFilename||isDevNullName(oldFilename)||isDevNullName(newFilename))return newFilename&&!isDevNullName(newFilename)?newFilename:oldFilename||"unknown/file/path";for(var prefixPaths=[],suffixPaths=[],oldFilenameParts=oldFilename.split("/"),newFilenameParts=newFilename.split("/"),i=0,j=oldFilenameParts.length-1,k=newFilenameParts.length-1;i<j&&i<k&&oldFilenameParts[i]===newFilenameParts[i];)prefixPaths.push(newFilenameParts[i]),i+=1;for(;i<j&&i<k&&oldFilenameParts[j]===newFilenameParts[k];)suffixPaths.unshift(newFilenameParts[k]),j-=1,k-=1;var finalPrefix=prefixPaths.join("/"),finalSuffix=suffixPaths.join("/"),oldRemainingPath=oldFilenameParts.slice(i,j+1).join("/"),newRemainingPath=newFilenameParts.slice(i,k+1).join("/");return finalPrefix.length&&finalSuffix.length?finalPrefix+"/{"+oldRemainingPath+" → "+newRemainingPath+"}/"+finalSuffix:finalPrefix.length?finalPrefix+"/{"+oldRemainingPath+" → "+newRemainingPath+"}":finalSuffix.length?"{"+oldRemainingPath+" → "+newRemainingPath+"}/"+finalSuffix:oldFilename+" → "+newFilename},PrinterUtils.prototype.getFileTypeIcon=function(file){var templateName="file-changed";return file.isRename?templateName="file-renamed":file.isCopy?templateName="file-renamed":file.isNew?templateName="file-added":file.isDeleted?templateName="file-deleted":file.newName!==file.oldName&&(templateName="file-renamed"),templateName},PrinterUtils.prototype.diffHighlight=function(diffLine1,diffLine2,config){var linePrefix1,linePrefix2,unprefixedLine1,unprefixedLine2,diff,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),unprefixedLine1.length>config.maxLineLengthHighlight||unprefixedLine2.length>config.maxLineLengthHighlight)return{first:{prefix:linePrefix1,line:utils.escape(unprefixedLine1)},second:{prefix:linePrefix2,line:utils.escape(unprefixedLine2)}};diff="char"===config.diffStyle?jsDiff.diffChars(unprefixedLine1,unprefixedLine2):jsDiff.diffWordsWithSpace(unprefixedLine1,unprefixedLine2);var highlightedLine="",changedWords=[];if("word"===config.diffStyle&&"words"===config.matching){var treshold=.25;void 0!==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});matcher(diff.filter(function(element){return element.added}),removed).forEach(function(chunk){1===chunk[0].length&&1===chunk[1].length&&Rematch.distance(chunk[0][0].value,chunk[1][0].value)<treshold&&(changedWords.push(chunk[0][0]),changedWords.push(chunk[1][0]))})}return diff.forEach(function(part){var addClass=-1<changedWords.indexOf(part)?' 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:function(line){return line.replace(/(<ins[^>]*>((.|\n)*?)<\/ins>)/g,"")}(highlightedLine)},second:{prefix:linePrefix2,line:function(line){return line.replace(/(<del[^>]*>((.|\n)*?)<\/del>)/g,"")}(highlightedLine)}}},module.exports.PrinterUtils=new PrinterUtils},{"./rematch.js":16,"./utils.js":19,diff:2}],16:[function(require,module,exports){function levenshtein(a,b){if(0===a.length)return b.length;if(0===b.length)return a.length;var i,j,matrix=[];for(i=0;i<=b.length;i++)matrix[i]=[i];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++)b.charAt(i-1)===a.charAt(j-1)?matrix[i][j]=matrix[i-1][j-1]:matrix[i][j]=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={}).levenshtein=levenshtein,Rematch.distance=function(x,y){return levenshtein(x=x.trim(),y=y.trim())/(x.length+y.length)},Rematch.rematch=function(distanceFunction){return function group(a,b,level,cache){void 0===cache&&(cache={});var bm=function(a,b,cache){for(var bestMatch,bestMatchDist=1/0,i=0;i<a.length;++i)for(var j=0;j<b.length;++j){var md,cacheKey=JSON.stringify([a[i],b[j]]);cache.hasOwnProperty(cacheKey)?md=cache[cacheKey]:(md=distanceFunction(a[i],b[j]),cache[cacheKey]=md),md<bestMatchDist&&(bestMatch={indexA:i,indexB:j,score:bestMatchDist=md})}return bestMatch}(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(0<bm.indexA||0<bm.indexB)&&(result=group1.concat(result)),(a.length>tailA||b.length>tailB)&&(result=result.concat(group2)),result}},module.exports.Rematch=Rematch},{}],17:[function(require,module,exports){function SideBySidePrinter(config){this.config=config;var HoganJsUtils=require("./hoganjs-utils.js").HoganJsUtils;hoganUtils=new HoganJsUtils(config)}var hoganUtils,diffParser,printerUtils,utils,Rematch,matcher;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){var fileDiffTemplate=hoganUtils.template("side-by-side","file-diff"),filePathTemplate=hoganUtils.template("generic","file-path"),fileIconTemplate=hoganUtils.template("icon","file"),fileTagTemplate=hoganUtils.template("tag",printerUtils.getFileTypeIcon(file));return fileDiffTemplate.render({file:file,fileHtmlId:printerUtils.getHtmlId(file),diffs:diffs,filePath:filePathTemplate.render({fileDiffName:printerUtils.getDiffName(file)},{fileIcon:fileIconTemplate,fileTag:fileTagTemplate})})},SideBySidePrinter.prototype.generateSideBySideJsonHtml=function(diffFiles){var that=this,content=diffFiles.map(function(file){var diffs;return diffs=file.blocks.length?that.generateSideBySideFileHtml(file):that.generateEmptyDiff(),that.makeDiffHtml(file,diffs)}).join("\n");return hoganUtils.render("generic","wrapper",{content:content})},SideBySidePrinter.prototype.makeSideHtml=function(blockHeader){return hoganUtils.render("generic","column-line-number",{diffParser:diffParser,blockHeader:utils.escape(blockHeader),lineClass:"d2h-code-side-linenumber",contentClass:"d2h-code-side-line"})},SideBySidePrinter.prototype.generateSideBySideFileHtml=function(file){var that=this,fileHtml={left:"",right:""};return file.blocks.forEach(function(block){fileHtml.left+=that.makeSideHtml(block.header),fileHtml.right+=that.makeSideHtml("");var oldLines=[],newLines=[];function processChangeBlock(){var matches,insertType,deleteType,comparisons=oldLines.length*newLines.length,maxLineSizeInBlock=Math.max.apply(null,oldLines.concat(newLines).map(function(elem){return elem.length})),doMatching=comparisons<that.config.matchingMaxComparisons&&maxLineSizeInBlock<that.config.maxLineSizeInBlockForComparison&&("lines"===that.config.matching||"words"===that.config.matching);deleteType=doMatching?(matches=matcher(oldLines,newLines),insertType=diffParser.LINE_TYPE.INSERT_CHANGES,diffParser.LINE_TYPE.DELETE_CHANGES):(matches=[[oldLines,newLines]],insertType=diffParser.LINE_TYPE.INSERTS,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;j<common;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(file.isCombined,deleteType,oldLine.oldNumber,diff.first.line,diff.first.prefix),fileHtml.right+=that.generateSingleLineHtml(file.isCombined,insertType,newLine.newNumber,diff.second.line,diff.second.prefix)}if(common<max){var oldSlice=oldLines.slice(common),newSlice=newLines.slice(common),tmpHtml=that.processLines(file.isCombined,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],prefix=line.content[0],escapedLine=utils.escape(line.content.substr(1));line.type!==diffParser.LINE_TYPE.INSERTS&&(0<newLines.length||line.type!==diffParser.LINE_TYPE.DELETES&&0<oldLines.length)&&processChangeBlock(),line.type===diffParser.LINE_TYPE.CONTEXT?(fileHtml.left+=that.generateSingleLineHtml(file.isCombined,line.type,line.oldNumber,escapedLine,prefix),fileHtml.right+=that.generateSingleLineHtml(file.isCombined,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(file.isCombined,diffParser.LINE_TYPE.CONTEXT,"","",""),fileHtml.right+=that.generateSingleLineHtml(file.isCombined,line.type,line.newNumber,escapedLine,prefix))}processChangeBlock()}),fileHtml},SideBySidePrinter.prototype.processLines=function(isCombined,oldLines,newLines){for(var fileHtml={left:"",right:""},maxLinesNumber=Math.max(oldLines.length,newLines.length),i=0;i<maxLinesNumber;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+=this.generateSingleLineHtml(isCombined,oldLine.type,oldLine.oldNumber,oldContent,oldPrefix),fileHtml.right+=this.generateSingleLineHtml(isCombined,newLine.type,newLine.newNumber,newContent,newPrefix)):oldLine?(fileHtml.left+=this.generateSingleLineHtml(isCombined,oldLine.type,oldLine.oldNumber,oldContent,oldPrefix),fileHtml.right+=this.generateSingleLineHtml(isCombined,diffParser.LINE_TYPE.CONTEXT,"","","")):newLine?(fileHtml.left+=this.generateSingleLineHtml(isCombined,diffParser.LINE_TYPE.CONTEXT,"","",""),fileHtml.right+=this.generateSingleLineHtml(isCombined,newLine.type,newLine.newNumber,newContent,newPrefix)):console.error("How did it get here?")}return fileHtml},SideBySidePrinter.prototype.generateSingleLineHtml=function(isCombined,type,number,content,possiblePrefix){var lineWithoutPrefix=content,prefix=possiblePrefix,lineClass="d2h-code-side-linenumber",contentClass="d2h-code-side-line";if(number||content){if(!prefix){var lineWithPrefix=printerUtils.separatePrefix(isCombined,content);prefix=lineWithPrefix.prefix,lineWithoutPrefix=lineWithPrefix.line}}else lineClass+=" d2h-code-side-emptyplaceholder",contentClass+=" d2h-code-side-emptyplaceholder",type+=" d2h-emptyplaceholder",lineWithoutPrefix=prefix="&nbsp;";return" "===prefix&&(prefix="&nbsp;"),hoganUtils.render("generic","line",{type:type,lineClass:lineClass,contentClass:contentClass,prefix:prefix,content:lineWithoutPrefix,lineNumber:number})},SideBySidePrinter.prototype.generateEmptyDiff=function(){var fileHtml={right:""};return fileHtml.left=hoganUtils.render("generic","empty-diff",{contentClass:"d2h-code-side-line",diffParser:diffParser}),fileHtml},module.exports.SideBySidePrinter=SideBySidePrinter},{"./diff-parser.js":9,"./hoganjs-utils.js":12,"./printer-utils.js":15,"./rematch.js":16,"./utils.js":19}],18:[function(require,module,exports){(function(global){!function(){global.browserTemplates||(global.browserTemplates={});var Hogan=require("hogan.js");global.browserTemplates["file-summary-line"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('<li class="d2h-file-list-line">'),t.b("\n"+i),t.b(' <span class="d2h-file-name-wrapper">'),t.b("\n"+i),t.b(t.rp("<fileIcon0",c,p," ")),t.b(' <a href="#'),t.b(t.v(t.f("fileHtmlId",c,p,0))),t.b('" class="d2h-file-name">'),t.b(t.v(t.f("fileName",c,p,0))),t.b("</a>"),t.b("\n"+i),t.b(' <span class="d2h-file-stats">'),t.b("\n"+i),t.b(' <span class="d2h-lines-added">'),t.b(t.v(t.f("addedLines",c,p,0))),t.b("</span>"),t.b("\n"+i),t.b(' <span class="d2h-lines-deleted">'),t.b(t.v(t.f("deletedLines",c,p,0))),t.b("</span>"),t.b("\n"+i),t.b(" </span>"),t.b("\n"+i),t.b(" </span>"),t.b("\n"+i),t.b("</li>"),t.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}}},subs:{}}),global.browserTemplates["file-summary-wrapper"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('<div class="d2h-file-list-wrapper">'),t.b("\n"+i),t.b(' <div class="d2h-file-list-header">'),t.b("\n"+i),t.b(' <span class="d2h-file-list-title">Files changed ('),t.b(t.v(t.f("filesNumber",c,p,0))),t.b(")</span>"),t.b("\n"+i),t.b(' <a class="d2h-file-switch d2h-hide">hide</a>'),t.b("\n"+i),t.b(' <a class="d2h-file-switch d2h-show">show</a>'),t.b("\n"+i),t.b(" </div>"),t.b("\n"+i),t.b(' <ol class="d2h-file-list">'),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("files",c,p,0))),t.b("\n"+i),t.b(" </ol>"),t.b("\n"+i),t.b("</div>"),t.fl()},partials:{},subs:{}}),global.browserTemplates["generic-column-line-number"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b("<tr>"),t.b("\n"+i),t.b(' <td class="'),t.b(t.v(t.f("lineClass",c,p,0))),t.b(" "),t.b(t.v(t.d("diffParser.LINE_TYPE.INFO",c,p,0))),t.b('"></td>'),t.b("\n"+i),t.b(' <td class="'),t.b(t.v(t.d("diffParser.LINE_TYPE.INFO",c,p,0))),t.b('">'),t.b("\n"+i),t.b(' <div class="'),t.b(t.v(t.f("contentClass",c,p,0))),t.b(" "),t.b(t.v(t.d("diffParser.LINE_TYPE.INFO",c,p,0))),t.b('">'),t.b(t.t(t.f("blockHeader",c,p,0))),t.b("</div>"),t.b("\n"+i),t.b(" </td>"),t.b("\n"+i),t.b("</tr>"),t.fl()},partials:{},subs:{}}),global.browserTemplates["generic-empty-diff"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b("<tr>"),t.b("\n"+i),t.b(' <td class="'),t.b(t.v(t.d("diffParser.LINE_TYPE.INFO",c,p,0))),t.b('">'),t.b("\n"+i),t.b(' <div class="'),t.b(t.v(t.f("contentClass",c,p,0))),t.b(" "),t.b(t.v(t.d("diffParser.LINE_TYPE.INFO",c,p,0))),t.b('">'),t.b("\n"+i),t.b(" File without changes"),t.b("\n"+i),t.b(" </div>"),t.b("\n"+i),t.b(" </td>"),t.b("\n"+i),t.b("</tr>"),t.fl()},partials:{},subs:{}}),global.browserTemplates["generic-file-path"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('<span class="d2h-file-name-wrapper">'),t.b("\n"+i),t.b(t.rp("<fileIcon0",c,p," ")),t.b(' <span class="d2h-file-name">'),t.b(t.v(t.f("fileDiffName",c,p,0))),t.b("</span>"),t.b("\n"+i),t.b(t.rp("<fileTag1",c,p," ")),t.b("</span>"),t.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}},"<fileTag1":{name:"fileTag",partials:{},subs:{}}},subs:{}}),global.browserTemplates["generic-line"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b("<tr>"),t.b("\n"+i),t.b(' <td class="'),t.b(t.v(t.f("lineClass",c,p,0))),t.b(" "),t.b(t.v(t.f("type",c,p,0))),t.b('">'),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("lineNumber",c,p,0))),t.b("\n"+i),t.b(" </td>"),t.b("\n"+i),t.b(' <td class="'),t.b(t.v(t.f("type",c,p,0))),t.b('">'),t.b("\n"+i),t.b(' <div class="'),t.b(t.v(t.f("contentClass",c,p,0))),t.b(" "),t.b(t.v(t.f("type",c,p,0))),t.b('">'),t.b("\n"+i),t.s(t.f("prefix",c,p,1),c,p,0,171,247,"{{ }}")&&(t.rs(c,p,function(c,p,t){t.b(' <span class="d2h-code-line-prefix">'),t.b(t.t(t.f("prefix",c,p,0))),t.b("</span>"),t.b("\n"+i)}),c.pop()),t.s(t.f("content",c,p,1),c,p,0,279,353,"{{ }}")&&(t.rs(c,p,function(c,p,t){t.b(' <span class="d2h-code-line-ctn">'),t.b(t.t(t.f("content",c,p,0))),t.b("</span>"),t.b("\n"+i)}),c.pop()),t.b(" </div>"),t.b("\n"+i),t.b(" </td>"),t.b("\n"+i),t.b("</tr>"),t.fl()},partials:{},subs:{}}),global.browserTemplates["generic-wrapper"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('<div class="d2h-wrapper">'),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("content",c,p,0))),t.b("\n"+i),t.b("</div>"),t.fl()},partials:{},subs:{}}),global.browserTemplates["icon-file-added"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('<svg aria-hidden="true" class="d2h-icon d2h-added" height="16" title="added" version="1.1" viewBox="0 0 14 16"'),t.b("\n"+i),t.b(' width="14">'),t.b("\n"+i),t.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM6 9H3V7h3V4h2v3h3v2H8v3H6V9z"></path>'),t.b("\n"+i),t.b("</svg>"),t.fl()},partials:{},subs:{}}),global.browserTemplates["icon-file-changed"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('<svg aria-hidden="true" class="d2h-icon d2h-changed" height="16" title="modified" version="1.1"'),t.b("\n"+i),t.b(' viewBox="0 0 14 16" width="14">'),t.b("\n"+i),t.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM4 8c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3-3-1.34-3-3z"></path>'),t.b("\n"+i),t.b("</svg>"),t.fl()},partials:{},subs:{}}),global.browserTemplates["icon-file-deleted"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('<svg aria-hidden="true" class="d2h-icon d2h-deleted" height="16" title="removed" version="1.1"'),t.b("\n"+i),t.b(' viewBox="0 0 14 16" width="14">'),t.b("\n"+i),t.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM11 9H3V7h8v2z"></path>'),t.b("\n"+i),t.b("</svg>"),t.fl()},partials:{},subs:{}}),global.browserTemplates["icon-file-renamed"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('<svg aria-hidden="true" class="d2h-icon d2h-moved" height="16" title="renamed" version="1.1"'),t.b("\n"+i),t.b(' viewBox="0 0 14 16" width="14">'),t.b("\n"+i),t.b(' <path d="M6 9H3V7h3V4l5 4-5 4V9z m8-7v12c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h12c0.55 0 1 0.45 1 1z m-1 0H1v12h12V2z"></path>'),t.b("\n"+i),t.b("</svg>"),t.fl()},partials:{},subs:{}}),global.browserTemplates["icon-file"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('<svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">'),t.b("\n"+i),t.b(' <path d="M6 5H2v-1h4v1zM2 8h7v-1H2v1z m0 2h7v-1H2v1z m0 2h7v-1H2v1z m10-7.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h7.5l3.5 3.5z m-1 0.5L8 2H1v12h10V5z"></path>'),t.b("\n"+i),t.b("</svg>"),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('<div id="'),t.b(t.v(t.f("fileHtmlId",c,p,0))),t.b('" class="d2h-file-wrapper" data-lang="'),t.b(t.v(t.d("file.language",c,p,0))),t.b('">'),t.b("\n"+i),t.b(' <div class="d2h-file-header">'),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("filePath",c,p,0))),t.b("\n"+i),t.b(" </div>"),t.b("\n"+i),t.b(' <div class="d2h-file-diff">'),t.b("\n"+i),t.b(' <div class="d2h-code-wrapper">'),t.b("\n"+i),t.b(' <table class="d2h-diff-table">'),t.b("\n"+i),t.b(' <tbody class="d2h-diff-tbody">'),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("diffs",c,p,0))),t.b("\n"+i),t.b(" </tbody>"),t.b("\n"+i),t.b(" </table>"),t.b("\n"+i),t.b(" </div>"),t.b("\n"+i),t.b(" </div>"),t.b("\n"+i),t.b("</div>"),t.fl()},partials:{},subs:{}}),global.browserTemplates["line-by-line-numbers"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('<div class="line-num1">'),t.b(t.v(t.f("oldNumber",c,p,0))),t.b("</div>"),t.b("\n"+i),t.b('<div class="line-num2">'),t.b(t.v(t.f("newNumber",c,p,0))),t.b("</div>"),t.fl()},partials:{},subs:{}}),global.browserTemplates["side-by-side-file-diff"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('<div id="'),t.b(t.v(t.f("fileHtmlId",c,p,0))),t.b('" class="d2h-file-wrapper" data-lang="'),t.b(t.v(t.d("file.language",c,p,0))),t.b('">'),t.b("\n"+i),t.b(' <div class="d2h-file-header">'),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("filePath",c,p,0))),t.b("\n"+i),t.b(" </div>"),t.b("\n"+i),t.b(' <div class="d2h-files-diff">'),t.b("\n"+i),t.b(' <div class="d2h-file-side-diff">'),t.b("\n"+i),t.b(' <div class="d2h-code-wrapper">'),t.b("\n"+i),t.b(' <table class="d2h-diff-table">'),t.b("\n"+i),t.b(' <tbody class="d2h-diff-tbody">'),t.b("\n"+i),t.b(" "),t.b(t.t(t.d("diffs.left",c,p,0))),t.b("\n"+i),t.b(" </tbody>"),t.b("\n"+i),t.b(" </table>"),t.b("\n"+i),t.b(" </div>"),t.b("\n"+i),t.b(" </div>"),t.b("\n"+i),t.b(' <div class="d2h-file-side-diff">'),t.b("\n"+i),t.b(' <div class="d2h-code-wrapper">'),t.b("\n"+i),t.b(' <table class="d2h-diff-table">'),t.b("\n"+i),t.b(' <tbody class="d2h-diff-tbody">'),t.b("\n"+i),t.b(" "),t.b(t.t(t.d("diffs.right",c,p,0))),t.b("\n"+i),t.b(" </tbody>"),t.b("\n"+i),t.b(" </table>"),t.b("\n"+i),t.b(" </div>"),t.b("\n"+i),t.b(" </div>"),t.b("\n"+i),t.b(" </div>"),t.b("\n"+i),t.b("</div>"),t.fl()},partials:{},subs:{}}),global.browserTemplates["tag-file-added"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('<span class="d2h-tag d2h-added d2h-added-tag">ADDED</span>'),t.fl()},partials:{},subs:{}}),global.browserTemplates["tag-file-changed"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('<span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span>'),t.fl()},partials:{},subs:{}}),global.browserTemplates["tag-file-deleted"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('<span class="d2h-tag d2h-deleted d2h-deleted-tag">DELETED</span>'),t.fl()},partials:{},subs:{}}),global.browserTemplates["tag-file-renamed"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('<span class="d2h-tag d2h-moved d2h-moved-tag">RENAMED</span>'),t.fl()},partials:{},subs:{}}),module.exports=global.browserTemplates}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"hogan.js":4}],19:[function(require,module,exports){function Utils(){}var merge;merge=require("merge"),Utils.prototype.escape=function(str){return str.slice(0).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\//g,"&#x2F;")},Utils.prototype.startsWith=function(str,start){if("object"!=typeof start)return str&&0===str.indexOf(start);var result=!1;return start.forEach(function(s){0===str.indexOf(s)&&(result=!0)}),result},Utils.prototype.valueOrEmpty=function(value){return value||""},Utils.prototype.safeConfig=function(cfg,defaultConfig){return merge.recursive(!0,defaultConfig,cfg)},module.exports.Utils=new Utils},{merge:6}]},{},[10]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diff2html",
3
- "version": "2.12.1",
3
+ "version": "2.12.2",
4
4
  "homepage": "https://diff2html.xyz",
5
5
  "description": "Fast Diff to colorized HTML",
6
6
  "keywords": [
@@ -236,9 +236,9 @@
236
236
  lineClass += ' d2h-code-side-emptyplaceholder';
237
237
  contentClass += ' d2h-code-side-emptyplaceholder';
238
238
  type += ' d2h-emptyplaceholder';
239
- }
240
-
241
- if (!prefix) {
239
+ prefix = '&nbsp;';
240
+ lineWithoutPrefix = '&nbsp;';
241
+ } else if (!prefix) {
242
242
  var lineWithPrefix = printerUtils.separatePrefix(isCombined, content);
243
243
  prefix = lineWithPrefix.prefix;
244
244
  lineWithoutPrefix = lineWithPrefix.line;