happo 2.8.1 → 2.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/happo/public/026c001beac0620bb23a.worker.js +50 -0
- data/lib/happo/public/05ad45a945afc6882286.worker.js +56 -0
- data/lib/happo/public/0dd329b74ed90a207896.worker.js +56 -0
- data/lib/happo/public/174b944ab9e9053c766d.worker.js +56 -0
- data/lib/happo/public/196b75660e2791fda25a.worker.js +56 -0
- data/lib/happo/public/1d5c0eb9c479f44f0ec2.worker.js +56 -0
- data/lib/happo/public/1d6c41b4828b191ae315.worker.js +56 -0
- data/lib/happo/public/212269d558f1f8b1bc63.worker.js +56 -0
- data/lib/happo/public/25426637d793045ccb77.worker.js +56 -0
- data/lib/happo/public/28537ac53e64479763ba.worker.js +56 -0
- data/lib/happo/public/30e3af0e8f974da2885c.worker.js +56 -0
- data/lib/happo/public/32fc2a09f98d30cb2a06.worker.js +56 -0
- data/lib/happo/public/33c43f9f1296a6c3b236.worker.js +56 -0
- data/lib/happo/public/3a6592504d8ee1810017.worker.js +56 -0
- data/lib/happo/public/3a8bedd3121a2cdacb6d.worker.js +56 -0
- data/lib/happo/public/3d9ed68ca315896c8ec7.worker.js +56 -0
- data/lib/happo/public/3da88471c60703398f95.worker.js +56 -0
- data/lib/happo/public/40c1aadf458bda245630.worker.js +1 -0
- data/lib/happo/public/41749e1ff9db63f87a1e.worker.js +56 -0
- data/lib/happo/public/42bc2c20d61979a23a2f.worker.js +56 -0
- data/lib/happo/public/447f3bfe79be8a67b9cc.worker.js +56 -0
- data/lib/happo/public/4580dd75ba5a064f4366.worker.js +56 -0
- data/lib/happo/public/4975b25fe791d85e9827.worker.js +56 -0
- data/lib/happo/public/4b23fa5d7875a8fba618.worker.js +56 -0
- data/lib/happo/public/4ecbb720788698ce7a9b.worker.js +56 -0
- data/lib/happo/public/4ef2e26b666b08b7411a.worker.js +56 -0
- data/lib/happo/public/51ac7ca571ae07cd9d7a.worker.js +56 -0
- data/lib/happo/public/531d99f56a3343cee5f8.worker.js +56 -0
- data/lib/happo/public/53e6a60c2cf0558157a7.worker.js +56 -0
- data/lib/happo/public/55d488167040d5350534.worker.js +56 -0
- data/lib/happo/public/588f7a6b784ef2b87932.worker.js +56 -0
- data/lib/happo/public/59d03b8990473ae492e0.worker.js +56 -0
- data/lib/happo/public/5aded6f9af816e819a2b.worker.js +56 -0
- data/lib/happo/public/5e6771e4a41f597c26a9.worker.js +56 -0
- data/lib/happo/public/61e924aed1761ec05ca0.worker.js +56 -0
- data/lib/happo/public/65e7608bb10d0f2250d1.worker.js +56 -0
- data/lib/happo/public/6a71a1273a0cf4065e1e.worker.js +56 -0
- data/lib/happo/public/727ca4589d56ddcb9c7f.worker.js +56 -0
- data/lib/happo/public/769883a4d5abfa7384d4.worker.js +56 -0
- data/lib/happo/public/78fea81d29830297df57.worker.js +56 -0
- data/lib/happo/public/7bf45d52cf57b1949851.worker.js +56 -0
- data/lib/happo/public/7d4a4086de8530abe101.worker.js +56 -0
- data/lib/happo/public/7e330bc3ee246ab39910.worker.js +56 -0
- data/lib/happo/public/84f3a66517b77798456d.worker.js +56 -0
- data/lib/happo/public/856dbe98c40d8f4bd452.worker.js +56 -0
- data/lib/happo/public/90a4b81e4d7c2da63973.worker.js +56 -0
- data/lib/happo/public/92dd03e7cbe827a2df45.worker.js +56 -0
- data/lib/happo/public/94976fe48214f2bc68d6.worker.js +56 -0
- data/lib/happo/public/95f3e6e7eec59c0af3e5.worker.js +56 -0
- data/lib/happo/public/96c4c2f5df8175649a67.worker.js +56 -0
- data/lib/happo/public/973a6ae106ac4e664858.worker.js +56 -0
- data/lib/happo/public/989e9ba236891bdfcf46.worker.js +56 -0
- data/lib/happo/public/HappoApp.bundle.js +1 -2
- data/lib/happo/public/a50e9af74a422839a15c.worker.js +56 -0
- data/lib/happo/public/ad4fdfa82741585ce164.worker.js +56 -0
- data/lib/happo/public/ae0622a81101951ac112.worker.js +56 -0
- data/lib/happo/public/ae223678cdbfac88d9be.worker.js +56 -0
- data/lib/happo/public/b441a6c1393a5d39b5ff.worker.js +56 -0
- data/lib/happo/public/b4c84506199d5745d950.worker.js +56 -0
- data/lib/happo/public/b5176c936b696653a407.worker.js +56 -0
- data/lib/happo/public/b86b963a72892d8f0fd1.worker.js +56 -0
- data/lib/happo/public/ba50214d2b6ac001493b.worker.js +56 -0
- data/lib/happo/public/bb6413d1cea030ba7a1e.worker.js +56 -0
- data/lib/happo/public/bc084ad60fb7dbbe0818.worker.js +56 -0
- data/lib/happo/public/c15e6b44ae496af6af9b.worker.js +56 -0
- data/lib/happo/public/c4393394848f5242932e.worker.js +56 -0
- data/lib/happo/public/c60ceaff7849b394e27a.worker.js +56 -0
- data/lib/happo/public/c67c76de1e4def5019d5.worker.js +56 -0
- data/lib/happo/public/c7969739b50b79043b86.worker.js +56 -0
- data/lib/happo/public/cc82d7609935eb1d2738.worker.js +56 -0
- data/lib/happo/public/d135dda9b0318be75e3c.worker.js +56 -0
- data/lib/happo/public/d2aded5d63912f5b7e1b.worker.js +56 -0
- data/lib/happo/public/d2be644581f8f67b207d.worker.js +56 -0
- data/lib/happo/public/d6e037d3891cfb95fbca.worker.js +50 -0
- data/lib/happo/public/d7440908d264133044bb.worker.js +56 -0
- data/lib/happo/public/da071c51e9a641ed805c.worker.js +56 -0
- data/lib/happo/public/dbe8eef9555ef0d43469.worker.js +56 -0
- data/lib/happo/public/e1cbbfd7a3d705049eb0.worker.js +56 -0
- data/lib/happo/public/e3882591e6710cf03ed4.worker.js +56 -0
- data/lib/happo/public/e414c768d66b9bcf86bb.worker.js +56 -0
- data/lib/happo/public/e85bc4bb461158f5561d.worker.js +56 -0
- data/lib/happo/public/ed6256235d0a2b11aaf6.worker.js +56 -0
- data/lib/happo/public/edcc84bf4483670ba23e.worker.js +56 -0
- data/lib/happo/public/f3d33d482a4326121c45.worker.js +56 -0
- data/lib/happo/public/f67e23a954230ea878be.worker.js +56 -0
- data/lib/happo/public/f800c3a1d9200926bde6.worker.js +56 -0
- data/lib/happo/public/f8954fa2849952175e2c.worker.js +56 -0
- data/lib/happo/public/fde5a206ff86c3d7ab10.worker.js +56 -0
- data/lib/happo/public/globe-current.png +0 -0
- data/lib/happo/public/globe-previous.png +0 -0
- data/lib/happo/server.rb +7 -0
- data/lib/happo/version.rb +1 -1
- metadata +91 -3
- data/lib/happo/public/happo-logo.svg +0 -1
@@ -0,0 +1,56 @@
|
|
1
|
+
/******/ (function(modules) { // webpackBootstrap
|
2
|
+
/******/ // The module cache
|
3
|
+
/******/ var installedModules = {};
|
4
|
+
|
5
|
+
/******/ // The require function
|
6
|
+
/******/ function __webpack_require__(moduleId) {
|
7
|
+
|
8
|
+
/******/ // Check if module is in cache
|
9
|
+
/******/ if(installedModules[moduleId])
|
10
|
+
/******/ return installedModules[moduleId].exports;
|
11
|
+
|
12
|
+
/******/ // Create a new module (and put it into the cache)
|
13
|
+
/******/ var module = installedModules[moduleId] = {
|
14
|
+
/******/ exports: {},
|
15
|
+
/******/ id: moduleId,
|
16
|
+
/******/ loaded: false
|
17
|
+
/******/ };
|
18
|
+
|
19
|
+
/******/ // Execute the module function
|
20
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
21
|
+
|
22
|
+
/******/ // Flag the module as loaded
|
23
|
+
/******/ module.loaded = true;
|
24
|
+
|
25
|
+
/******/ // Return the exports of the module
|
26
|
+
/******/ return module.exports;
|
27
|
+
/******/ }
|
28
|
+
|
29
|
+
|
30
|
+
/******/ // expose the modules object (__webpack_modules__)
|
31
|
+
/******/ __webpack_require__.m = modules;
|
32
|
+
|
33
|
+
/******/ // expose the module cache
|
34
|
+
/******/ __webpack_require__.c = installedModules;
|
35
|
+
|
36
|
+
/******/ // __webpack_public_path__
|
37
|
+
/******/ __webpack_require__.p = "";
|
38
|
+
|
39
|
+
/******/ // Load entry module and return exports
|
40
|
+
/******/ return __webpack_require__(0);
|
41
|
+
/******/ })
|
42
|
+
/************************************************************************/
|
43
|
+
/******/ ([
|
44
|
+
/* 0 */
|
45
|
+
/***/ function(module, exports, __webpack_require__) {
|
46
|
+
|
47
|
+
eval("'use strict';\n\nvar _alignArrays = __webpack_require__(1);\n\nvar _alignArrays2 = _interopRequireDefault(_alignArrays);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction imageTo2DArray(_ref, paddingRight) {\n var data = _ref.data;\n var width = _ref.width;\n var height = _ref.height;\n\n // The imageData is a 1D array. Each element in the array corresponds to a\n // decimal value that represents one of the RGBA channels for that pixel.\n var rowSize = width * 4;\n\n var newData = [];\n for (var row = 0; row < height; row++) {\n var pixelsInRow = new Uint8ClampedArray(rowSize + paddingRight * 4);\n for (var location = 0; location < rowSize; location++) {\n pixelsInRow[location] = data[row * rowSize + location];\n }\n newData.push(pixelsInRow);\n }\n return newData;\n}\n\nfunction align(_ref2) {\n var previousImageData = _ref2.previousImageData;\n var currentImageData = _ref2.currentImageData;\n var maxWidth = _ref2.maxWidth;\n\n var hashedPreviousData = previousImageData.map(JSON.stringify);\n self.postMessage({ progress: 40 });\n var hashedCurrentData = currentImageData.map(JSON.stringify);\n self.postMessage({ progress: 60 });\n\n (0, _alignArrays2.default)(hashedPreviousData, hashedCurrentData);\n\n var transparentLine = new Uint8ClampedArray(maxWidth * 4);\n\n hashedPreviousData.forEach(function (hashedLine, i) {\n if (hashedLine === '+') {\n previousImageData.splice(i, 0, transparentLine);\n }\n });\n\n hashedCurrentData.forEach(function (hashedLine, i) {\n if (hashedLine === '+') {\n currentImageData.splice(i, 0, transparentLine);\n }\n });\n}\n\n/**\n * Takes two 2d images, computes the diff between the two, and injects pixels to\n * both in order to:\n * a) make both images the same height\n * b) properly visualize differences\n *\n * Please note that this method MUTATES data.\n *\n * @param {Array} previousData\n * @param {Array} currentData\n */\nfunction computeAndInjectDiffs(_ref3) {\n var previousData = _ref3.previousData;\n var currentData = _ref3.currentData;\n\n var maxWidth = Math.max(previousData.width, currentData.width);\n\n var previousImageData = imageTo2DArray(previousData, maxWidth - previousData.width);\n\n var currentImageData = imageTo2DArray(currentData, maxWidth - currentData.width);\n\n self.postMessage({ progress: 20 });\n\n align({\n previousImageData: previousImageData,\n currentImageData: currentImageData,\n maxWidth: maxWidth\n });\n\n self.postMessage({ progress: 85 });\n\n return {\n currentData: {\n data: currentImageData,\n height: currentImageData.length,\n width: maxWidth\n },\n previousData: {\n data: previousImageData,\n height: previousImageData.length,\n width: maxWidth\n }\n };\n}\n\nself.addEventListener('message', function (_ref4) {\n var _ref4$data = _ref4.data;\n var previousData = _ref4$data.previousData;\n var currentData = _ref4$data.currentData;\n\n var result = computeAndInjectDiffs({ previousData: previousData, currentData: currentData });\n self.postMessage(result);\n self.close();\n});//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvd29ya2Vycy9Db21wdXRlQW5kSW5qZWN0RGlmZnNXb3JrZXIuanM/ZGRiNSJdLCJuYW1lcyI6WyJpbWFnZVRvMkRBcnJheSIsInBhZGRpbmdSaWdodCIsImRhdGEiLCJ3aWR0aCIsImhlaWdodCIsInJvd1NpemUiLCJuZXdEYXRhIiwicm93IiwicGl4ZWxzSW5Sb3ciLCJVaW50OENsYW1wZWRBcnJheSIsImxvY2F0aW9uIiwicHVzaCIsImFsaWduIiwicHJldmlvdXNJbWFnZURhdGEiLCJjdXJyZW50SW1hZ2VEYXRhIiwibWF4V2lkdGgiLCJoYXNoZWRQcmV2aW91c0RhdGEiLCJtYXAiLCJKU09OIiwic3RyaW5naWZ5Iiwic2VsZiIsInBvc3RNZXNzYWdlIiwicHJvZ3Jlc3MiLCJoYXNoZWRDdXJyZW50RGF0YSIsInRyYW5zcGFyZW50TGluZSIsImZvckVhY2giLCJoYXNoZWRMaW5lIiwiaSIsInNwbGljZSIsImNvbXB1dGVBbmRJbmplY3REaWZmcyIsInByZXZpb3VzRGF0YSIsImN1cnJlbnREYXRhIiwiTWF0aCIsIm1heCIsImxlbmd0a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wgY3VycmVudERhdGEgfSk7XG4gIHNlbGYucG9zdE1lc3NhZ2UocmVzdWx0KTtcbiAgc2VsZi5jbG9zZSgpO1xufSk7XG5cblxuXG4vKiogV0VCUEFDSyBGT09URVIgKipcbiAqKiAuL2pzL3NyYy93b3JrZXJzL0NvbXB1dGVBbmRJbmplY3REaWZmc1dvcmtlci5qc1xuICoqLyJdLCJzb3VyY2VSb290IjoiIn0=");
|
48
|
+
|
49
|
+
/***/ },
|
50
|
+
/* 1 */
|
51
|
+
/***/ function(module, exports) {
|
52
|
+
|
53
|
+
eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = alignArrays;\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nvar MOVEMENT = {\n none: 0,\n diagonal: 1,\n vertical: 2,\n horizontal: 3\n};\n\nfunction initMatrix(height, width) {\n var rows = new Array(height);\n for (var i = 0; i < rows.length; i++) {\n rows[i] = new Int32Array(width);\n }\n return rows;\n}\n\nfunction longestCommonSubsequence(a, b) {\n // adapted from\n // http://algorithms.tutorialhorizon.com/dynamic-programming-longest-common-subsequence/\n var aLength = a.length;\n var bLength = b.length;\n var memo = initMatrix(aLength + 1, bLength + 1);\n var solution = initMatrix(aLength + 1, bLength + 1);\n\n // Loop and find the solution\n for (var i = 1; i <= aLength; i++) {\n for (var j = 1; j <= bLength; j++) {\n if (a[i - 1] === b[j - 1]) {\n // diagonal\n memo[i][j] = memo[i - 1][j - 1] + 1;\n solution[i][j] = MOVEMENT.diagonal;\n } else {\n memo[i][j] = Math.max(memo[i - 1][j], memo[i][j - 1]);\n if (memo[i][j] === memo[i - 1][j]) {\n solution[i][j] = MOVEMENT.vertical;\n } else {\n solution[i][j] = MOVEMENT.horizontal;\n }\n }\n }\n }\n if (memo[aLength][bLength] === 0) {\n // No soltuion found\n return null;\n }\n return solution;\n}\n\nfunction placeholders(count) {\n var result = new Array(count);\n for (var i = 0; i < count; i++) {\n result[i] = '+';\n }\n return result;\n}\n/**\n * Apply an lcs solution to arrays. Note that this will MUTATE the arrays,\n * injecting \"+\" where gaps are needed.\n *\n * @param {Array<Array>} solution as computed by `longestCommonSubsequence`\n * @param {Array} a\n * @param {Array} b\n */\nfunction applySolution(solution, a, b) {\n var movement = solution[a.length][b.length];\n var ai = a.length;\n var bi = b.length;\n var changes = 0;\n\n function applyChange() {\n if (changes < 0) {\n b.splice.apply(b, [bi, 0].concat(_toConsumableArray(placeholders(Math.abs(changes)))));\n } else if (changes > 0) {\n a.splice.apply(a, [ai, 0].concat(_toConsumableArray(placeholders(changes))));\n }\n changes = 0;\n }\n\n while (movement !== MOVEMENT.none) {\n if (movement === MOVEMENT.diagonal) {\n applyChange();\n ai--;\n bi--;\n } else if (movement === MOVEMENT.horizontal) {\n bi--;\n changes++;\n } else if (movement === MOVEMENT.vertical) {\n ai--;\n changes--;\n }\n movement = solution[ai][bi];\n }\n if (ai - bi !== 0) {\n b.splice.apply(b, [0, 0].concat(_toConsumableArray(placeholders(bi))));\n a.splice.apply(a, [0, 0].concat(_toConsumableArray(placeholders(ai))));\n }\n}\n\n/**\n * To be called for arrays that share nothing in common.\n *\n * Note that this will MUTATE the arrays,\n *\n * @param {Array} a\n * @param {Array} b\n */\nfunction applyPadding(a, b) {\n var aLength = a.length;\n var bLength = b.length;\n var shorterArray = aLength > bLength ? b : a;\n shorterArray.push.apply(shorterArray, _toConsumableArray(placeholders(Math.abs(aLength - bLength))));\n}\n/**\n * Computes the longest common subsequence of two arrays, then uses that\n * solution to inject gaps into the arrays, making them align on common\n * subsequences.\n *\n * @param {Array} a\n * @param {Array} b\n */\nfunction alignArrays(a, b) {\n var lcsSolution = longestCommonSubsequence(a, b);\n if (lcsSolution) {\n applySolution(lcsSolution, a, b);\n } else {\n applyPadding(a, b);\n }\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2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1vbiBzdWJzZXF1ZW5jZSBvZiB0d28gYXJyYXlzLCB0aGVuIHVzZXMgdGhhdFxuICogc29sdXRpb24gdG8gaW5qZWN0IGdhcHMgaW50byB0aGUgYXJyYXlzLCBtYWtpbmcgdGhlbSBhbGlnbiBvbiBjb21tb25cbiAqIHN1YnNlcXVlbmNlcy5cbiAqXG4gKiBAcGFyYW0ge0FycmF5fSBhXG4gKiBAcGFyYW0ge0FycmF5fSBiXG4gKi9cbmV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIGFsaWduQXJyYXlzKGEsIGIpIHtcbiAgY29uc3QgbGNzU29sdXRpb24gPSBsb25nZXN0Q29tbW9uU3Vic2VxdWVuY2UoYSwgYik7XG4gIGlmIChsY3NTb2x1dGlvbikge1xuICAgIGFwcGx5U29sdXRpb24obGNzU29sdXRpb24sIGEsIGIpO1xuICB9IGVsc2Uge1xuICAgIGFwcGx5UGFkZGluZyhhLCBiKTtcbiAgfVxufVxuXG5cblxuLyoqIFdFQlBBQ0sgRk9PVEVSICoqXG4gKiogLi9qcy9zcmMvYWxpZ25BcnJheXMuanNcbiAqKi8iXSwic291cmNlUm9vdCI6IiJ9");
|
54
|
+
|
55
|
+
/***/ }
|
56
|
+
/******/ ]);
|
@@ -0,0 +1,56 @@
|
|
1
|
+
/******/ (function(modules) { // webpackBootstrap
|
2
|
+
/******/ // The module cache
|
3
|
+
/******/ var installedModules = {};
|
4
|
+
|
5
|
+
/******/ // The require function
|
6
|
+
/******/ function __webpack_require__(moduleId) {
|
7
|
+
|
8
|
+
/******/ // Check if module is in cache
|
9
|
+
/******/ if(installedModules[moduleId])
|
10
|
+
/******/ return installedModules[moduleId].exports;
|
11
|
+
|
12
|
+
/******/ // Create a new module (and put it into the cache)
|
13
|
+
/******/ var module = installedModules[moduleId] = {
|
14
|
+
/******/ exports: {},
|
15
|
+
/******/ id: moduleId,
|
16
|
+
/******/ loaded: false
|
17
|
+
/******/ };
|
18
|
+
|
19
|
+
/******/ // Execute the module function
|
20
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
21
|
+
|
22
|
+
/******/ // Flag the module as loaded
|
23
|
+
/******/ module.loaded = true;
|
24
|
+
|
25
|
+
/******/ // Return the exports of the module
|
26
|
+
/******/ return module.exports;
|
27
|
+
/******/ }
|
28
|
+
|
29
|
+
|
30
|
+
/******/ // expose the modules object (__webpack_modules__)
|
31
|
+
/******/ __webpack_require__.m = modules;
|
32
|
+
|
33
|
+
/******/ // expose the module cache
|
34
|
+
/******/ __webpack_require__.c = installedModules;
|
35
|
+
|
36
|
+
/******/ // __webpack_public_path__
|
37
|
+
/******/ __webpack_require__.p = "";
|
38
|
+
|
39
|
+
/******/ // Load entry module and return exports
|
40
|
+
/******/ return __webpack_require__(0);
|
41
|
+
/******/ })
|
42
|
+
/************************************************************************/
|
43
|
+
/******/ ([
|
44
|
+
/* 0 */
|
45
|
+
/***/ function(module, exports, __webpack_require__) {
|
46
|
+
|
47
|
+
eval("'use strict';\n\nvar _alignArrays = __webpack_require__(1);\n\nvar _alignArrays2 = _interopRequireDefault(_alignArrays);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction imageTo2DArray(_ref, paddingRight) {\n var data = _ref.data;\n var width = _ref.width;\n var height = _ref.height;\n\n // The imageData is a 1D array. Each element in the array corresponds to a\n // decimal value that represents one of the RGBA channels for that pixel.\n var rowSize = width * 4;\n\n var newData = [];\n for (var row = 0; row < height; row++) {\n var pixelsInRow = new Uint8ClampedArray(rowSize + paddingRight * 4);\n for (var location = 0; location < rowSize; location++) {\n pixelsInRow[location] = data[row * rowSize + location];\n }\n newData.push(pixelsInRow);\n }\n return newData;\n}\n\nfunction align(_ref2) {\n var previousImageData = _ref2.previousImageData;\n var currentImageData = _ref2.currentImageData;\n var maxWidth = _ref2.maxWidth;\n\n var hashedPreviousData = previousImageData.map(JSON.stringify);\n self.postMessage({ progress: 40 });\n var hashedCurrentData = currentImageData.map(JSON.stringify);\n self.postMessage({ progress: 60 });\n\n (0, _alignArrays2.default)(hashedPreviousData, hashedCurrentData);\n\n var transparentLine = new Uint8ClampedArray(maxWidth * 4);\n\n hashedPreviousData.forEach(function (hashedLine, i) {\n if (hashedLine === '+') {\n previousImageData.splice(i, 0, transparentLine);\n }\n });\n\n hashedCurrentData.forEach(function (hashedLine, i) {\n if (hashedLine === '+') {\n currentImageData.splice(i, 0, transparentLine);\n }\n });\n}\n\n/**\n * Takes two 2d images, computes the diff between the two, and injects pixels to\n * both in order to:\n * a) make both images the same height\n * b) properly visualize differences\n *\n * Please note that this method MUTATES data.\n *\n * @param {Array} previousData\n * @param {Array} currentData\n */\nfunction computeAndInjectDiffs(_ref3) {\n var previousData = _ref3.previousData;\n var currentData = _ref3.currentData;\n\n var maxWidth = Math.max(previousData.width, currentData.width);\n\n var previousImageData = imageTo2DArray(previousData, maxWidth - previousData.width);\n\n var currentImageData = imageTo2DArray(currentData, maxWidth - currentData.width);\n\n self.postMessage({ progress: 20 });\n\n align({\n previousImageData: previousImageData,\n currentImageData: currentImageData,\n maxWidth: maxWidth\n });\n\n self.postMessage({ progress: 85 });\n\n return {\n currentData: {\n data: currentImageData,\n height: currentImageData.length,\n width: maxWidth\n },\n previousData: {\n data: previousImageData,\n height: previousImageData.length,\n width: maxWidth\n }\n };\n}\n\nself.addEventListener('message', function (_ref4) {\n var _ref4$data = _ref4.data;\n var previousData = _ref4$data.previousData;\n var currentData = _ref4$data.currentData;\n\n var result = computeAndInjectDiffs({ previousData: previousData, currentData: currentData });\n self.postMessage(result);\n self.close();\n});//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvd29ya2Vycy9Db21wdXRlQW5kSW5qZWN0RGlmZnNXb3JrZXIuanM/ZGRiNSJdLCJuYW1lcyI6WyJpbWFnZVRvMkRBcnJheSIsInBhZGRpbmdSaWdodCIsImRhdGEiLCJ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XRhOiBjdXJyZW50SW1hZ2VEYXRhLFxuICAgICAgaGVpZ2h0OiBjdXJyZW50SW1hZ2VEYXRhLmxlbmd0aCxcbiAgICAgIHdpZHRoOiBtYXhXaWR0aCxcbiAgICB9LFxuICAgIHByZXZpb3VzRGF0YToge1xuICAgICAgZGF0YTogcHJldmlvdXNJbWFnZURhdGEsXG4gICAgICBoZWlnaHQ6IHByZXZpb3VzSW1hZ2VEYXRhLmxlbmd0aCxcbiAgICAgIHdpZHRoOiBtYXhXaWR0aCxcbiAgICB9LFxuICB9O1xufVxuXG5zZWxmLmFkZEV2ZW50TGlzdGVuZXIoJ21lc3NhZ2UnLCAoeyBkYXRhOiB7IHByZXZpb3VzRGF0YSwgY3VycmVudERhdGEgfSB9KSA9PiB7XG4gIGNvbnN0IHJlc3VsdCA9IGNvbXB1dGVBbmRJbmplY3REaWZmcyh7IHByZXZpb3VzRGF0YSwgY3VycmVudERhdGEgfSk7XG4gIHNlbGYucG9zdE1lc3NhZ2UocmVzdWx0KTtcbiAgc2VsZi5jbG9zZSgpO1xufSk7XG5cblxuXG4vKiogV0VCUEFDSyBGT09URVIgKipcbiAqKiAuL2pzL3NyYy93b3JrZXJzL0NvbXB1dGVBbmRJbmplY3REaWZmc1dvcmtlci5qc1xuICoqLyJdLCJzb3VyY2VSb290IjoiIn0=");
|
48
|
+
|
49
|
+
/***/ },
|
50
|
+
/* 1 */
|
51
|
+
/***/ function(module, exports) {
|
52
|
+
|
53
|
+
eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = alignArrays;\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nvar MOVEMENT = {\n none: 0,\n diagonal: 1,\n vertical: 2,\n horizontal: 3\n};\n\nfunction initMatrix(height, width) {\n var rows = new Array(height);\n for (var i = 0; i < rows.length; i++) {\n rows[i] = new Int32Array(width);\n }\n return rows;\n}\n\nfunction longestCommonSubsequence(a, b) {\n // adapted from\n // http://algorithms.tutorialhorizon.com/dynamic-programming-longest-common-subsequence/\n var aLength = a.length;\n var bLength = b.length;\n var memo = initMatrix(aLength + 1, bLength + 1);\n var solution = initMatrix(aLength + 1, bLength + 1);\n\n // Loop and find the solution\n for (var i = 1; i <= aLength; i++) {\n for (var j = 1; j <= bLength; j++) {\n if (a[i - 1] === b[j - 1]) {\n // diagonal\n memo[i][j] = memo[i - 1][j - 1] + 1;\n solution[i][j] = MOVEMENT.diagonal;\n } else {\n memo[i][j] = Math.max(memo[i - 1][j], memo[i][j - 1]);\n if (memo[i][j] === memo[i - 1][j]) {\n solution[i][j] = MOVEMENT.vertical;\n } else {\n solution[i][j] = MOVEMENT.horizontal;\n }\n }\n }\n }\n console.log(memo);\n return solution;\n}\n\nfunction placeholders(count) {\n var result = new Array(count);\n for (var i = 0; i < count; i++) {\n result[i] = '+';\n }\n return result;\n}\n/**\n * Apply an lcs solution to arrays. Note that this will MUTATE the arrays,\n * injecting \"+\" where gaps are needed.\n *\n * @param {Array<Array>} solution as computed by `longestCommonSubsequence`\n * @param {Array} a\n * @param {Array} b\n */\nfunction applySolution(solution, a, b) {\n var movement = solution[a.length][b.length];\n var ai = a.length;\n var bi = b.length;\n\n while (movement !== MOVEMENT.none) {\n if (movement === MOVEMENT.diagonal) {\n var diffI = ai - bi;\n console.log(ai, bi, diffI);\n if (diffI < 0) {\n b.splice.apply(b, [bi, 0].concat(_toConsumableArray(placeholders(Math.abs(diffI)))));\n } else if (diffI > 0) {\n a.splice.apply(a, [ai, 0].concat(_toConsumableArray(placeholders(Math.abs(diffI)))));\n }\n ai--;\n bi--;\n } else if (movement === MOVEMENT.horizontal) {\n bi--;\n } else if (movement === MOVEMENT.vertical) {\n ai--;\n }\n movement = solution[ai][bi];\n }\n}\n\n/**\n * Computes the longest common subsequence of two arrays, then uses that\n * solution to inject gaps into the arrays, making them align on common\n * subsequences.\n *\n * @param {Array} a\n * @param {Array} b\n */\nfunction alignArrays(a, b) {\n var lcsSolution = longestCommonSubsequence(a, b);\n applySolution(lcsSolution, a, b);\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvYWxpZ25BcnJheXMuanM/MDFiNyJdLCJuYW1lcyI6WyJhbGlnbkFycmF5cyIsIk1PVkVNRU5UIiwibm9uZSIsImRpYWdvbmFsIiwidmVydGljYWwiLCJob3Jpem9udGFsIiwiaW5pdE1hdHJpeCIsImhlaWdodCIsIndpZHRoIiwicm93cyIsIkFycmF5IiwiaSIsImxlbmd0aCIsIkludDMyQXJyYXkiLCJsb25nZXN0Q29tbW9uU3Vic2VxdWVuY2UiLCJhIiwiYiIsImFMZW5ndGgiLCJiTGVuZ3RoIiwibWVtbyIsInNvbHV0aW9uIiwiaiIsIk1hdGgiLCJtYXgiLCJjb25zb2xlIiwibG9nIiwicGxhY2Vob2xkZXJzIiwiY291bnQiLCJyZXN1bHQiLCJhcHBseVNvbHV0aW9uIiwibW92ZW1lbnQiLCJhaSIsImJpIiwiZGlmZkkiLCJzcGxpY2UiLCJhYnMiLCJsY3NTb2x1dGlvbiJdLCJtYXBwaW5ncyI6Ijs7Ozs7a0JBNEZ3QkEsVzs7OztBQTVGeEIsSUFBTUMsV0FBVztBQUNmQyxRQUFNLENBRFM7QUFFZkMsWUFBVSxDQUZLO0FBR2ZDLFlBQVUsQ0FISztBQUlmQyxjQUFZO0FBSkcsQ0FBakI7O0FBT0EsU0FBU0MsVUFBVCxDQUFvQkMsTUFBcEIsRUFBNEJDLEtBQTVCLEVBQW1DO0FBQ2pDLE1BQU1DLE9BQU8sSUFBSUMsS0FBSixDQUFVSCxNQUFWLENBQWI7QUFDQSxPQUFLLElBQUlJLElBQUksQ0FBYixFQUFnQkEsSUFBSUYsS0FBS0csTUFBekIsRUFBaUNELEdBQWpDLEVBQXNDO0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uLyoqIFdFQlBBQ0sgRk9PVEVSICoqXG4gKiogLi9qcy9zcmMvYWxpZ25BcnJheXMuanNcbiAqKi8iXSwic291cmNlUm9vdCI6IiJ9");
|
54
|
+
|
55
|
+
/***/ }
|
56
|
+
/******/ ]);
|
@@ -0,0 +1,56 @@
|
|
1
|
+
/******/ (function(modules) { // webpackBootstrap
|
2
|
+
/******/ // The module cache
|
3
|
+
/******/ var installedModules = {};
|
4
|
+
|
5
|
+
/******/ // The require function
|
6
|
+
/******/ function __webpack_require__(moduleId) {
|
7
|
+
|
8
|
+
/******/ // Check if module is in cache
|
9
|
+
/******/ if(installedModules[moduleId])
|
10
|
+
/******/ return installedModules[moduleId].exports;
|
11
|
+
|
12
|
+
/******/ // Create a new module (and put it into the cache)
|
13
|
+
/******/ var module = installedModules[moduleId] = {
|
14
|
+
/******/ exports: {},
|
15
|
+
/******/ id: moduleId,
|
16
|
+
/******/ loaded: false
|
17
|
+
/******/ };
|
18
|
+
|
19
|
+
/******/ // Execute the module function
|
20
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
21
|
+
|
22
|
+
/******/ // Flag the module as loaded
|
23
|
+
/******/ module.loaded = true;
|
24
|
+
|
25
|
+
/******/ // Return the exports of the module
|
26
|
+
/******/ return module.exports;
|
27
|
+
/******/ }
|
28
|
+
|
29
|
+
|
30
|
+
/******/ // expose the modules object (__webpack_modules__)
|
31
|
+
/******/ __webpack_require__.m = modules;
|
32
|
+
|
33
|
+
/******/ // expose the module cache
|
34
|
+
/******/ __webpack_require__.c = installedModules;
|
35
|
+
|
36
|
+
/******/ // __webpack_public_path__
|
37
|
+
/******/ __webpack_require__.p = "";
|
38
|
+
|
39
|
+
/******/ // Load entry module and return exports
|
40
|
+
/******/ return __webpack_require__(0);
|
41
|
+
/******/ })
|
42
|
+
/************************************************************************/
|
43
|
+
/******/ ([
|
44
|
+
/* 0 */
|
45
|
+
/***/ function(module, exports, __webpack_require__) {
|
46
|
+
|
47
|
+
eval("'use strict';\n\nvar _alignArrays = __webpack_require__(1);\n\nvar _alignArrays2 = _interopRequireDefault(_alignArrays);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction imageTo2DArray(_ref, paddingRight) {\n var data = _ref.data;\n var width = _ref.width;\n var height = _ref.height;\n\n // The imageData is a 1D array. Each element in the array corresponds to a\n // decimal value that represents one of the RGBA channels for that pixel.\n var rowSize = width * 4;\n\n var newData = [];\n for (var row = 0; row < height; row++) {\n var pixelsInRow = new Uint8ClampedArray(rowSize + paddingRight * 4);\n for (var location = 0; location < rowSize; location++) {\n pixelsInRow[location] = data[row * rowSize + location];\n }\n newData.push(pixelsInRow);\n }\n return newData;\n}\n\nfunction align(_ref2) {\n var previousImageData = _ref2.previousImageData;\n var currentImageData = _ref2.currentImageData;\n var maxWidth = _ref2.maxWidth;\n\n var hashedPreviousData = previousImageData.map(JSON.stringify);\n self.postMessage({ progress: 40 });\n var hashedCurrentData = currentImageData.map(JSON.stringify);\n self.postMessage({ progress: 60 });\n\n (0, _alignArrays2.default)(hashedPreviousData, hashedCurrentData);\n\n var transparentLine = new Uint8ClampedArray(maxWidth * 4);\n\n hashedPreviousData.forEach(function (hashedLine, i) {\n if (hashedLine === '+') {\n previousImageData.splice(i, 0, transparentLine);\n }\n });\n\n hashedCurrentData.forEach(function (hashedLine, i) {\n if (hashedLine === '+') {\n currentImageData.splice(i, 0, transparentLine);\n }\n });\n}\n\n/**\n * Takes two 2d images, computes the diff between the two, and injects pixels to\n * both in order to:\n * a) make both images the same height\n * b) properly visualize differences\n *\n * Please note that this method MUTATES data.\n *\n * @param {Array} previousData\n * @param {Array} currentData\n */\nfunction computeAndInjectDiffs(_ref3) {\n var previousData = _ref3.previousData;\n var currentData = _ref3.currentData;\n\n var maxWidth = Math.max(previousData.width, currentData.width);\n\n var previousImageData = imageTo2DArray(previousData, maxWidth - previousData.width);\n\n var currentImageData = imageTo2DArray(currentData, maxWidth - currentData.width);\n\n self.postMessage({ progress: 20 });\n\n align({\n previousImageData: previousImageData,\n currentImageData: currentImageData,\n maxWidth: maxWidth\n });\n\n self.postMessage({ progress: 85 });\n\n return {\n currentData: {\n data: currentImageData,\n height: currentImageData.length,\n width: maxWidth\n },\n previousData: {\n data: previousImageData,\n height: previousImageData.length,\n width: maxWidth\n }\n };\n}\n\nself.addEventListener('message', function (_ref4) {\n var _ref4$data = _ref4.data;\n var previousData = _ref4$data.previousData;\n var currentData = _ref4$data.currentData;\n\n var result = computeAndInjectDiffs({ previousData: previousData, currentData: currentData });\n self.postMessage(result);\n self.close();\n});//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvd29ya2Vycy9Db21wdXRlQW5kSW5qZWN0RGlmZnNXb3JrZXIuanM/ZGRiNSJdLCJuYW1lcyI6WyJpbWFnZVRvMkRBcnJheSIsInBhZGRpbmdSaWdodCIsImRhdGEiLCJ3aWR0aCIsImhlaWdodCIsInJvd1NpemUiLCJuZXdEYXRhIiwicm93IiwicGl4ZWxzSW5Sb3ciLCJVaW50OENsYW1wZWRBcnJheSIsImxvY2F0aW9uIiwicHVzaCIsImFsaWduIiwicHJldmlvdXNJbWFnZURhdGEiLCJjdXJyZW50SW1hZ2VEYXRhIiwibWF4V2lkdGgiLCJoYXNoZWRQcmV2aW91c0RhdGEiLCJtYXAiLCJKU09OIiwic3RyaW5naWZ5Iiwic2VsZiIsInBvc3RNZXNzYWdlIiwicHJvZ3Jlc3MiLCJoYXNoZWRDdXJyZW50RGF0YSIsInRyYW5zcGFyZW50TGluZSIsImZvckVhY2giLCJoYXNoZWRMaW5lIiwiaSIsInNwbGljZSIsImNvbXB1dGVBbmRJbmplY3REaWZmcyIsInByZXZpb3VzRGF0YSIsImN1cnJlbnREYXRhIiwiTWF0aCIsIm1heCIsImxlbmd0aCIsImFkZEV2ZW50TGlzdGVuZXIiLCJyZXN1bHQi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c3NhZ2UocmVzdWx0KTtcbiAgc2VsZi5jbG9zZSgpO1xufSk7XG5cblxuXG4vKiogV0VCUEFDSyBGT09URVIgKipcbiAqKiAuL2pzL3NyYy93b3JrZXJzL0NvbXB1dGVBbmRJbmplY3REaWZmc1dvcmtlci5qc1xuICoqLyJdLCJzb3VyY2VSb290IjoiIn0=");
|
48
|
+
|
49
|
+
/***/ },
|
50
|
+
/* 1 */
|
51
|
+
/***/ function(module, exports) {
|
52
|
+
|
53
|
+
eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = alignArrays;\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nvar MOVEMENT = {\n none: 0,\n diagonal: 1,\n vertical: 2,\n horizontal: 3\n};\n\nfunction initMatrix(height, width) {\n var rows = new Array(height);\n for (var i = 0; i < rows.length; i++) {\n rows[i] = new Int32Array(width);\n }\n return rows;\n}\n\nfunction longestCommonSubsequence(a, b) {\n // adapted from\n // http://algorithms.tutorialhorizon.com/dynamic-programming-longest-common-subsequence/\n var aLength = a.length;\n var bLength = b.length;\n var memo = initMatrix(aLength + 1, bLength + 1);\n var solution = initMatrix(aLength + 1, bLength + 1);\n\n // Loop and find the solution\n for (var i = 1; i <= aLength; i++) {\n for (var j = 1; j <= bLength; j++) {\n if (a[i - 1] === b[j - 1]) {\n // diagonal\n memo[i][j] = memo[i - 1][j - 1] + 1;\n solution[i][j] = MOVEMENT.diagonal;\n } else {\n memo[i][j] = Math.max(memo[i - 1][j], memo[i][j - 1]);\n if (memo[i][j] === memo[i - 1][j]) {\n solution[i][j] = MOVEMENT.vertical;\n } else {\n solution[i][j] = MOVEMENT.horizontal;\n }\n }\n }\n }\n if (memo[aLength][bLength] === 0) {\n // No soltuion found\n return null;\n }\n return solution;\n}\n\nfunction placeholders(count) {\n var result = new Array(count);\n for (var i = 0; i < count; i++) {\n result[i] = '+';\n }\n return result;\n}\n/**\n * Apply an lcs solution to arrays. Note that this will MUTATE the arrays,\n * injecting \"+\" where gaps are needed.\n *\n * @param {Array<Array>} solution as computed by `longestCommonSubsequence`\n * @param {Array} a\n * @param {Array} b\n */\nfunction applySolution(solution, a, b) {\n var movement = solution[a.length][b.length];\n var ai = a.length;\n var bi = b.length;\n var changes = 0;\n\n function applyChange() {\n if (changes < 0) {\n b.splice.apply(b, [bi, 0].concat(_toConsumableArray(placeholders(Math.abs(changes)))));\n } else if (changes > 0) {\n a.splice.apply(a, [ai, 0].concat(_toConsumableArray(placeholders(changes))));\n }\n changes = 0;\n }\n\n while (movement !== MOVEMENT.none) {\n if (movement === MOVEMENT.diagonal) {\n applyChange();\n ai--;\n bi--;\n } else if (movement === MOVEMENT.horizontal) {\n bi--;\n changes++;\n } else if (movement === MOVEMENT.vertical) {\n ai--;\n changes--;\n }\n movement = solution[ai][bi];\n }\n changes = ai - bi;\n ai = 0;\n bi = 0;\n applyChange();\n}\n\n/**\n * To be called for arrays that share nothing in common.\n *\n * Note that this will MUTATE the arrays,\n *\n * @param {Array} a\n * @param {Array} b\n */\nfunction applyPadding(a, b) {\n var aLength = a.length;\n var bLength = b.length;\n var shorterArray = aLength > bLength ? b : a;\n shorterArray.push.apply(shorterArray, _toConsumableArray(placeholders(Math.abs(aLength - bLength))));\n}\n/**\n * Computes the longest common subsequence of two arrays, then uses that\n * solution to inject gaps into the arrays, making them align on common\n * subsequences.\n *\n * @param {Array} a\n * @param {Array} b\n */\nfunction alignArrays(a, b) {\n var lcsSolution = longestCommonSubsequence(a, b);\n if (lcsSolution) {\n applySolution(lcsSolution, a, b);\n } else {\n applyPadding(a, b);\n }\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvYWxpZ25BcnJheXMuanM/MDFiNyJdLCJuYW1lcyI6WyJhbGl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zdENvbW1vblN1YnNlcXVlbmNlKGEsIGIpO1xuICBpZiAobGNzU29sdXRpb24pIHtcbiAgICBhcHBseVNvbHV0aW9uKGxjc1NvbHV0aW9uLCBhLCBiKTtcbiAgfSBlbHNlIHtcbiAgICBhcHBseVBhZGRpbmcoYSwgYik7XG4gIH1cbn1cblxuXG5cbi8qKiBXRUJQQUNLIEZPT1RFUiAqKlxuICoqIC4vanMvc3JjL2FsaWduQXJyYXlzLmpzXG4gKiovIl0sInNvdXJjZVJvb3QiOiIifQ==");
|
54
|
+
|
55
|
+
/***/ }
|
56
|
+
/******/ ]);
|
@@ -0,0 +1,56 @@
|
|
1
|
+
/******/ (function(modules) { // webpackBootstrap
|
2
|
+
/******/ // The module cache
|
3
|
+
/******/ var installedModules = {};
|
4
|
+
|
5
|
+
/******/ // The require function
|
6
|
+
/******/ function __webpack_require__(moduleId) {
|
7
|
+
|
8
|
+
/******/ // Check if module is in cache
|
9
|
+
/******/ if(installedModules[moduleId])
|
10
|
+
/******/ return installedModules[moduleId].exports;
|
11
|
+
|
12
|
+
/******/ // Create a new module (and put it into the cache)
|
13
|
+
/******/ var module = installedModules[moduleId] = {
|
14
|
+
/******/ exports: {},
|
15
|
+
/******/ id: moduleId,
|
16
|
+
/******/ loaded: false
|
17
|
+
/******/ };
|
18
|
+
|
19
|
+
/******/ // Execute the module function
|
20
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
21
|
+
|
22
|
+
/******/ // Flag the module as loaded
|
23
|
+
/******/ module.loaded = true;
|
24
|
+
|
25
|
+
/******/ // Return the exports of the module
|
26
|
+
/******/ return module.exports;
|
27
|
+
/******/ }
|
28
|
+
|
29
|
+
|
30
|
+
/******/ // expose the modules object (__webpack_modules__)
|
31
|
+
/******/ __webpack_require__.m = modules;
|
32
|
+
|
33
|
+
/******/ // expose the module cache
|
34
|
+
/******/ __webpack_require__.c = installedModules;
|
35
|
+
|
36
|
+
/******/ // __webpack_public_path__
|
37
|
+
/******/ __webpack_require__.p = "";
|
38
|
+
|
39
|
+
/******/ // Load entry module and return exports
|
40
|
+
/******/ return __webpack_require__(0);
|
41
|
+
/******/ })
|
42
|
+
/************************************************************************/
|
43
|
+
/******/ ([
|
44
|
+
/* 0 */
|
45
|
+
/***/ function(module, exports, __webpack_require__) {
|
46
|
+
|
47
|
+
eval("'use strict';\n\nvar _alignArrays = __webpack_require__(1);\n\nvar _alignArrays2 = _interopRequireDefault(_alignArrays);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction imageTo2DArray(_ref, paddingRight) {\n var data = _ref.data;\n var width = _ref.width;\n var height = _ref.height;\n\n // The imageData is a 1D array. Each element in the array corresponds to a\n // decimal value that represents one of the RGBA channels for that pixel.\n var rowSize = width * 4;\n\n var newData = [];\n for (var row = 0; row < height; row++) {\n var pixelsInRow = new Uint8ClampedArray(rowSize + paddingRight * 4);\n for (var location = 0; location < rowSize; location++) {\n pixelsInRow[location] = data[row * rowSize + location];\n }\n newData.push(pixelsInRow);\n }\n return newData;\n}\n\nfunction align(_ref2) {\n var previousImageData = _ref2.previousImageData;\n var currentImageData = _ref2.currentImageData;\n var maxWidth = _ref2.maxWidth;\n\n var hashedPreviousData = previousImageData.map(JSON.stringify);\n self.postMessage({ progress: 40 });\n var hashedCurrentData = currentImageData.map(JSON.stringify);\n self.postMessage({ progress: 60 });\n\n (0, _alignArrays2.default)(hashedPreviousData, hashedCurrentData);\n\n var transparentLine = new Uint8ClampedArray(maxWidth * 4);\n\n hashedPreviousData.forEach(function (hashedLine, i) {\n if (hashedLine === '+') {\n previousImageData.splice(i, 0, transparentLine);\n }\n });\n\n hashedCurrentData.forEach(function (hashedLine, i) {\n if (hashedLine === '+') {\n currentImageData.splice(i, 0, transparentLine);\n }\n });\n}\n\n/**\n * Takes two 2d images, computes the diff between the two, and injects pixels to\n * both in order to:\n * a) make both images the same height\n * b) properly visualize differences\n *\n * Please note that this method MUTATES data.\n *\n * @param {Array} previousData\n * @param {Array} currentData\n */\nfunction computeAndInjectDiffs(_ref3) {\n var previousData = _ref3.previousData;\n var currentData = _ref3.currentData;\n\n var maxWidth = Math.max(previousData.width, currentData.width);\n\n var previousImageData = imageTo2DArray(previousData, maxWidth - previousData.width);\n\n var currentImageData = imageTo2DArray(currentData, maxWidth - currentData.width);\n\n self.postMessage({ progress: 20 });\n\n align({\n previousImageData: previousImageData,\n currentImageData: currentImageData,\n maxWidth: maxWidth\n });\n\n self.postMessage({ progress: 85 });\n\n return {\n currentData: {\n data: currentImageData,\n height: currentImageData.length,\n width: maxWidth\n },\n previousData: {\n data: previousImageData,\n height: previousImageData.length,\n width: maxWidth\n }\n };\n}\n\nself.addEventListener('message', function (_ref4) {\n var _ref4$data = _ref4.data;\n var previousData = _ref4$data.previousData;\n var currentData = _ref4$data.currentData;\n\n var result = computeAndInjectDiffs({ previousData: previousData, currentData: currentData });\n self.postMessage(result);\n self.close();\n});//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvd29ya2Vycy9Db21wdXRlQW5kSW5qZWN0RGlmZnNXb3JrZXIuanM/ZGRiNSJdLCJuYW1lcyI6WyJpbWFnZVRvMkRBcnJheSIsInBhZGRpbmdSaWdodCIsImRhdGEiLCJ3aWR0aCIsImhlaWdodCIsInJvd1NpemUiLCJuZXdEYXRhIiwicm93IiwicGl4ZWxzSW5Sb3ciLCJVaW50OENsYW1wZWRBcnJheSIsImxvY2F0aW9uIiwicHVzaCIsImFsaWduIiwicHJldmlvdXNJbWFnZURhdGEiLCJjdXJyZW50SW1hZ2VEYXRhIiwibWF4V2lkdGgiLCJoYXNoZWRQcmV2aW91c0RhdGEiLCJtYXAiLCJKU09OIiwic3RyaW5naWZ5Iiwic2VsZiIsInBvc3RNZXNzYWdlIiwicHJvZ3Jlc3MiLCJoYXNoZWRDdXJyZW50RGF0YSIsInRyYW5zcGFyZW50T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hZ2UnLCAoeyBkYXRhOiB7IHByZXZpb3VzRGF0YSwgY3VycmVudERhdGEgfSB9KSA9PiB7XG4gIGNvbnN0IHJlc3VsdCA9IGNvbXB1dGVBbmRJbmplY3REaWZmcyh7IHByZXZpb3VzRGF0YSwgY3VycmVudERhdGEgfSk7XG4gIHNlbGYucG9zdE1lc3NhZ2UocmVzdWx0KTtcbiAgc2VsZi5jbG9zZSgpO1xufSk7XG5cblxuXG4vKiogV0VCUEFDSyBGT09URVIgKipcbiAqKiAuL2pzL3NyYy93b3JrZXJzL0NvbXB1dGVBbmRJbmplY3REaWZmc1dvcmtlci5qc1xuICoqLyJdLCJzb3VyY2VSb290IjoiIn0=");
|
48
|
+
|
49
|
+
/***/ },
|
50
|
+
/* 1 */
|
51
|
+
/***/ function(module, exports) {
|
52
|
+
|
53
|
+
eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = alignArrays;\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nvar MOVEMENT = {\n none: 0,\n diagonal: 1,\n vertical: 2,\n horizontal: 3\n};\n\nfunction initMatrix(height, width) {\n var rows = new Array(height);\n for (var i = 0; i < rows.length; i++) {\n rows[i] = new Int32Array(width);\n }\n return rows;\n}\n\nfunction longestCommonSubsequence(a, b) {\n // adapted from\n // http://algorithms.tutorialhorizon.com/dynamic-programming-longest-common-subsequence/\n var aLength = a.length;\n var bLength = b.length;\n var memo = initMatrix(aLength + 1, bLength + 1);\n var solution = initMatrix(aLength + 1, bLength + 1);\n\n // Loop and find the solution\n for (var i = 1; i <= aLength; i++) {\n for (var j = 1; j <= bLength; j++) {\n if (a[i - 1] === b[j - 1]) {\n // diagonal\n memo[i][j] = memo[i - 1][j - 1] + 1;\n solution[i][j] = MOVEMENT.diagonal;\n } else {\n memo[i][j] = Math.max(memo[i - 1][j], memo[i][j - 1]);\n if (memo[i][j] === memo[i - 1][j]) {\n solution[i][j] = MOVEMENT.vertical;\n } else {\n solution[i][j] = MOVEMENT.horizontal;\n }\n }\n }\n }\n if (memo[aLength][bLength] === 0) {\n // No solution found\n return null;\n }\n return solution;\n}\n\nfunction placeholders(count) {\n var result = new Array(count);\n for (var i = 0; i < count; i++) {\n result[i] = '+';\n }\n return result;\n}\n/**\n * Apply an lcs solution to arrays. Note that this will MUTATE the arrays,\n * injecting \"+\" where gaps are needed.\n *\n * @param {Array<Array>} solution as computed by `longestCommonSubsequence`\n * @param {Array} a\n * @param {Array} b\n */\nfunction applySolution(solution, a, b) {\n var movement = solution[a.length][b.length];\n var ai = a.length;\n var bi = b.length;\n var changes = 0;\n\n while (movement !== MOVEMENT.none) {\n if (movement === MOVEMENT.diagonal) {\n if (changes < 0) {\n b.splice.apply(b, [bi, 0].concat(_toConsumableArray(placeholders(Math.abs(changes)))));\n } else if (changes > 0) {\n a.splice.apply(a, [ai, 0].concat(_toConsumableArray(placeholders(changes))));\n }\n ai--;\n bi--;\n changes = 0;\n } else if (movement === MOVEMENT.horizontal) {\n bi--;\n changes++;\n } else if (movement === MOVEMENT.vertical) {\n ai--;\n changes--;\n }\n movement = solution[ai][bi];\n }\n}\n\n/**\n * To be called for arrays that share nothing in common.\n *\n * Note that this will MUTATE the arrays,\n *\n * @param {Array} a\n * @param {Array} b\n */\nfunction applyPadding(a, b) {\n var aLength = a.length;\n var bLength = b.length;\n var shorterArray = aLength > bLength ? b : a;\n shorterArray.push.apply(shorterArray, _toConsumableArray(placeholders(Math.abs(aLength - bLength))));\n}\n/**\n * Computes the longest common subsequence of two arrays, then uses that\n * solution to inject gaps into the arrays, making them align on common\n * subsequences.\n *\n * @param {Array} a\n * @param {Array} b\n */\nfunction alignArrays(a, b) {\n var lcsSolution = longestCommonSubsequence(a, b);\n if (lcsSolution) {\n applySolution(lcsSolution, a, b);\n }\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2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|
@@ -0,0 +1,56 @@
|
|
1
|
+
/******/ (function(modules) { // webpackBootstrap
|
2
|
+
/******/ // The module cache
|
3
|
+
/******/ var installedModules = {};
|
4
|
+
|
5
|
+
/******/ // The require function
|
6
|
+
/******/ function __webpack_require__(moduleId) {
|
7
|
+
|
8
|
+
/******/ // Check if module is in cache
|
9
|
+
/******/ if(installedModules[moduleId])
|
10
|
+
/******/ return installedModules[moduleId].exports;
|
11
|
+
|
12
|
+
/******/ // Create a new module (and put it into the cache)
|
13
|
+
/******/ var module = installedModules[moduleId] = {
|
14
|
+
/******/ exports: {},
|
15
|
+
/******/ id: moduleId,
|
16
|
+
/******/ loaded: false
|
17
|
+
/******/ };
|
18
|
+
|
19
|
+
/******/ // Execute the module function
|
20
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
21
|
+
|
22
|
+
/******/ // Flag the module as loaded
|
23
|
+
/******/ module.loaded = true;
|
24
|
+
|
25
|
+
/******/ // Return the exports of the module
|
26
|
+
/******/ return module.exports;
|
27
|
+
/******/ }
|
28
|
+
|
29
|
+
|
30
|
+
/******/ // expose the modules object (__webpack_modules__)
|
31
|
+
/******/ __webpack_require__.m = modules;
|
32
|
+
|
33
|
+
/******/ // expose the module cache
|
34
|
+
/******/ __webpack_require__.c = installedModules;
|
35
|
+
|
36
|
+
/******/ // __webpack_public_path__
|
37
|
+
/******/ __webpack_require__.p = "";
|
38
|
+
|
39
|
+
/******/ // Load entry module and return exports
|
40
|
+
/******/ return __webpack_require__(0);
|
41
|
+
/******/ })
|
42
|
+
/************************************************************************/
|
43
|
+
/******/ ([
|
44
|
+
/* 0 */
|
45
|
+
/***/ function(module, exports, __webpack_require__) {
|
46
|
+
|
47
|
+
eval("'use strict';\n\nvar _alignArrays = __webpack_require__(1);\n\nvar _alignArrays2 = _interopRequireDefault(_alignArrays);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction imageTo2DArray(_ref, paddingRight) {\n var data = _ref.data;\n var width = _ref.width;\n var height = _ref.height;\n\n // The imageData is a 1D array. Each element in the array corresponds to a\n // decimal value that represents one of the RGBA channels for that pixel.\n var rowSize = width * 4;\n\n var newData = [];\n for (var row = 0; row < height; row++) {\n var pixelsInRow = new Uint8ClampedArray(rowSize + paddingRight * 4);\n for (var location = 0; location < rowSize; location++) {\n pixelsInRow[location] = data[row * rowSize + location];\n }\n newData.push(pixelsInRow);\n }\n return newData;\n}\n\nfunction align(_ref2) {\n var previousImageData = _ref2.previousImageData;\n var currentImageData = _ref2.currentImageData;\n var maxWidth = _ref2.maxWidth;\n\n var hashedPreviousData = previousImageData.map(JSON.stringify);\n self.postMessage({ progress: 40 });\n var hashedCurrentData = currentImageData.map(JSON.stringify);\n self.postMessage({ progress: 60 });\n\n (0, _alignArrays2.default)(hashedPreviousData, hashedCurrentData);\n\n var transparentLine = new Uint8ClampedArray(maxWidth * 4);\n\n hashedPreviousData.forEach(function (hashedLine, i) {\n if (hashedLine === '+') {\n previousImageData.splice(i, 0, transparentLine);\n }\n });\n\n hashedCurrentData.forEach(function (hashedLine, i) {\n if (hashedLine === '+') {\n currentImageData.splice(i, 0, transparentLine);\n }\n });\n}\n\n/**\n * Takes two 2d images, computes the diff between the two, and injects pixels to\n * both in order to:\n * a) make both images the same height\n * b) properly visualize differences\n *\n * Please note that this method MUTATES data.\n *\n * @param {Array} previousData\n * @param {Array} currentData\n */\nfunction computeAndInjectDiffs(_ref3) {\n var previousData = _ref3.previousData;\n var currentData = _ref3.currentData;\n\n var maxWidth = Math.max(previousData.width, currentData.width);\n\n var previousImageData = imageTo2DArray(previousData, maxWidth - previousData.width);\n\n var currentImageData = imageTo2DArray(currentData, maxWidth - currentData.width);\n\n self.postMessage({ progress: 20 });\n\n align({\n previousImageData: previousImageData,\n currentImageData: currentImageData,\n maxWidth: maxWidth\n });\n\n self.postMessage({ progress: 85 });\n\n return {\n currentData: {\n data: currentImageData,\n height: currentImageData.length,\n width: maxWidth\n },\n previousData: {\n data: previousImageData,\n height: previousImageData.length,\n width: maxWidth\n }\n };\n}\n\nself.addEventListener('message', function (_ref4) {\n var _ref4$data = _ref4.data;\n var previousData = _ref4$data.previousData;\n var currentData = _ref4$data.currentData;\n\n var result = computeAndInjectDiffs({ previousData: previousData, currentData: currentData });\n self.postMessage(result);\n self.close();\n});//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvd29ya2Vycy9Db21wdXRlQW5kSW5qZWN0RGlmZnNXb3JrZXIuanM/ZGRiNSJdLCJuYW1lcyI6WyJpbWFnZVRvMkRBcnJheSIsInBhZGRpbmdSaWdodCIsImRhdGEiLCJ3aWR0aCIsImhlaWdodCIsInJvd1NpemUiLCJuZXdEYXRhIiwicm93IiwicGl4ZWxzSW5Sb3ciLCJVaW50OENsYW1wZWRBcnJheSIsImxvY2F0aW9uIiwicHVzaCIsImFsaWduIiwicHJldmlvdXNJbWFnZURhdGEiLCJjdXJyZW50SW1hZ2VEYXRhIiwibWF4V2lkdGgiLCJoYXNoZWRQcmV2aW91c0RhdGEiLCJtYXAiLCJKU09OIiwic3RyaW5naWZ5Iiwic2VsZiIsInBvc3RNZXNzYWdlIiwicHJvZ3Jlc3MiLCJoYXNoZWRDdXJyZW50RGF0YSIsInRyYW5zcGFyZW50TGluZSIsImZvckVhY2giLCJoYXNoZWRMaW5lIiwiaSIsInNwbGljZSIsImNvbXB1dGVBbmRJbmplY3REaWZmcyIsInByZXZpb3VzRGF0YSIsImN1cnJlbnREYXRhIiwiTWF0aCIsIm1heCIsImxlbmd0aCIsImFkZEV2ZW50TGlzdGVuZXIiLCJyZXN1bHQiLCJjbG9zZSJdLCJtYXBwaW5ncyI6Ijs7QUFBQTs7Ozs7O0FBRUEsU0FBU0EsY0FBVCxPQUFpREMsWUFBakQsRUFBK0Q7QUFBQSxNQUFyQ0MsSUFBcUMsUUFBckNBLElBQXFDO0FB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1dvcmtlci5qc1xuICoqLyJdLCJzb3VyY2VSb290IjoiIn0=");
|
48
|
+
|
49
|
+
/***/ },
|
50
|
+
/* 1 */
|
51
|
+
/***/ function(module, exports) {
|
52
|
+
|
53
|
+
eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = alignArrays;\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nvar MOVEMENT = {\n none: 0,\n diagonal: 1,\n vertical: 2,\n horizontal: 3\n};\n\nfunction initMatrix(height, width) {\n var rows = new Array(height);\n for (var i = 0; i < rows.length; i++) {\n rows[i] = new Int32Array(width);\n }\n return rows;\n}\n\nfunction longestCommonSubsequence(a, b) {\n // adapted from\n // http://algorithms.tutorialhorizon.com/dynamic-programming-longest-common-subsequence/\n var aLength = a.length;\n var bLength = b.length;\n var memo = initMatrix(aLength + 1, bLength + 1);\n var solution = initMatrix(aLength + 1, bLength + 1);\n\n // Loop and find the solution\n for (var i = 1; i <= aLength; i++) {\n for (var j = 1; j <= bLength; j++) {\n if (a[i - 1] === b[j - 1]) {\n // diagonal\n memo[i][j] = memo[i - 1][j - 1] + 1;\n solution[i][j] = MOVEMENT.diagonal;\n } else {\n memo[i][j] = Math.max(memo[i - 1][j], memo[i][j - 1]);\n if (memo[i][j] === memo[i - 1][j]) {\n solution[i][j] = MOVEMENT.vertical;\n } else {\n solution[i][j] = MOVEMENT.horizontal;\n }\n }\n }\n }\n if (memo[aLength][bLength] === 0) {\n // No soltuion found\n return null;\n }\n return solution;\n}\n\nfunction placeholders(count) {\n var result = new Array(count);\n for (var i = 0; i < count; i++) {\n result[i] = '+';\n }\n return result;\n}\n/**\n * Apply an lcs solution to arrays. Note that this will MUTATE the arrays,\n * injecting \"+\" where gaps are needed.\n *\n * @param {Array<Array>} solution as computed by `longestCommonSubsequence`\n * @param {Array} a\n * @param {Array} b\n */\nfunction applySolution(solution, a, b) {\n var movement = solution[a.length][b.length];\n var ai = a.length;\n var bi = b.length;\n var changes = 0;\n\n function applyChange() {\n if (changes < 0) {\n b.splice.apply(b, [bi, 0].concat(_toConsumableArray(placeholders(Math.abs(changes)))));\n } else if (changes > 0) {\n a.splice.apply(a, [ai, 0].concat(_toConsumableArray(placeholders(changes))));\n }\n changes = 0;\n }\n\n while (movement !== MOVEMENT.none) {\n if (movement === MOVEMENT.diagonal) {\n applyChange();\n ai--;\n bi--;\n } else if (movement === MOVEMENT.horizontal) {\n bi--;\n changes++;\n } else if (movement === MOVEMENT.vertical) {\n ai--;\n changes--;\n }\n movement = solution[ai][bi];\n }\n applyChange();\n}\n\n/**\n * To be called for arrays that share nothing in common.\n *\n * Note that this will MUTATE the arrays,\n *\n * @param {Array} a\n * @param {Array} b\n */\nfunction applyPadding(a, b) {\n var aLength = a.length;\n var bLength = b.length;\n var shorterArray = aLength > bLength ? b : a;\n shorterArray.push.apply(shorterArray, _toConsumableArray(placeholders(Math.abs(aLength - bLength))));\n}\n/**\n * Computes the longest common subsequence of two arrays, then uses that\n * solution to inject gaps into the arrays, making them align on common\n * subsequences.\n *\n * @param {Array} a\n * @param {Array} b\n */\nfunction alignArrays(a, b) {\n var lcsSolution = longestCommonSubsequence(a, b);\n if (lcsSolution) {\n applySolution(lcsSolution, a, b);\n } else {\n applyPadding(a, b);\n }\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvYWxpZ25BcnJheXMuanM/MDFiNyJdLCJuYW1lcyI6WyJhbGlnbkFycmF5cyIsIk1PVkVNRU5UIiwibm9uZSIsImRpYWdvbmFsIiwidmVydGljYWwiLCJob3Jpem9udGFsIiwiaW5pdE1hdHJpeCIsImhlaWdodCIsIndpZHRoIiwicm93cyIsIkFycmF5IiwiaSIsImxlbmd0aCIsIkludDMyQXJyYXkiLCJ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|
+
|
55
|
+
/***/ }
|
56
|
+
/******/ ]);
|
@@ -0,0 +1,56 @@
|
|
1
|
+
/******/ (function(modules) { // webpackBootstrap
|
2
|
+
/******/ // The module cache
|
3
|
+
/******/ var installedModules = {};
|
4
|
+
|
5
|
+
/******/ // The require function
|
6
|
+
/******/ function __webpack_require__(moduleId) {
|
7
|
+
|
8
|
+
/******/ // Check if module is in cache
|
9
|
+
/******/ if(installedModules[moduleId])
|
10
|
+
/******/ return installedModules[moduleId].exports;
|
11
|
+
|
12
|
+
/******/ // Create a new module (and put it into the cache)
|
13
|
+
/******/ var module = installedModules[moduleId] = {
|
14
|
+
/******/ exports: {},
|
15
|
+
/******/ id: moduleId,
|
16
|
+
/******/ loaded: false
|
17
|
+
/******/ };
|
18
|
+
|
19
|
+
/******/ // Execute the module function
|
20
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
21
|
+
|
22
|
+
/******/ // Flag the module as loaded
|
23
|
+
/******/ module.loaded = true;
|
24
|
+
|
25
|
+
/******/ // Return the exports of the module
|
26
|
+
/******/ return module.exports;
|
27
|
+
/******/ }
|
28
|
+
|
29
|
+
|
30
|
+
/******/ // expose the modules object (__webpack_modules__)
|
31
|
+
/******/ __webpack_require__.m = modules;
|
32
|
+
|
33
|
+
/******/ // expose the module cache
|
34
|
+
/******/ __webpack_require__.c = installedModules;
|
35
|
+
|
36
|
+
/******/ // __webpack_public_path__
|
37
|
+
/******/ __webpack_require__.p = "";
|
38
|
+
|
39
|
+
/******/ // Load entry module and return exports
|
40
|
+
/******/ return __webpack_require__(0);
|
41
|
+
/******/ })
|
42
|
+
/************************************************************************/
|
43
|
+
/******/ ([
|
44
|
+
/* 0 */
|
45
|
+
/***/ function(module, exports, __webpack_require__) {
|
46
|
+
|
47
|
+
eval("'use strict';\n\nvar _alignArrays = __webpack_require__(1);\n\nvar _alignArrays2 = _interopRequireDefault(_alignArrays);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction imageTo2DArray(_ref, paddingRight) {\n var data = _ref.data;\n var width = _ref.width;\n var height = _ref.height;\n\n // The imageData is a 1D array. Each element in the array corresponds to a\n // decimal value that represents one of the RGBA channels for that pixel.\n var rowSize = width * 4;\n\n var newData = [];\n for (var row = 0; row < height; row++) {\n var pixelsInRow = new Uint8ClampedArray(rowSize + paddingRight * 4);\n for (var location = 0; location < rowSize; location++) {\n pixelsInRow[location] = data[row * rowSize + location];\n }\n newData.push(pixelsInRow);\n }\n return newData;\n}\n\nfunction align(_ref2) {\n var previousImageData = _ref2.previousImageData;\n var currentImageData = _ref2.currentImageData;\n var maxWidth = _ref2.maxWidth;\n\n var hashedPreviousData = previousImageData.map(JSON.stringify);\n self.postMessage({ progress: 40 });\n var hashedCurrentData = currentImageData.map(JSON.stringify);\n self.postMessage({ progress: 60 });\n\n (0, _alignArrays2.default)(hashedPreviousData, hashedCurrentData);\n\n var transparentLine = new Uint8ClampedArray(maxWidth * 4);\n\n hashedPreviousData.forEach(function (hashedLine, i) {\n if (hashedLine === '+') {\n previousImageData.splice(i, 0, transparentLine);\n }\n });\n\n hashedCurrentData.forEach(function (hashedLine, i) {\n if (hashedLine === '+') {\n currentImageData.splice(i, 0, transparentLine);\n }\n });\n}\n\n/**\n * Takes two 2d images, computes the diff between the two, and injects pixels to\n * both in order to:\n * a) make both images the same height\n * b) properly visualize differences\n *\n * Please note that this method MUTATES data.\n *\n * @param {Array} previousData\n * @param {Array} currentData\n */\nfunction computeAndInjectDiffs(_ref3) {\n var previousData = _ref3.previousData;\n var currentData = _ref3.currentData;\n\n var maxWidth = Math.max(previousData.width, currentData.width);\n\n var previousImageData = imageTo2DArray(previousData, maxWidth - previousData.width);\n\n var currentImageData = imageTo2DArray(currentData, maxWidth - currentData.width);\n\n self.postMessage({ progress: 20 });\n\n align({\n previousImageData: previousImageData,\n currentImageData: currentImageData,\n maxWidth: maxWidth\n });\n\n self.postMessage({ progress: 85 });\n\n return {\n currentData: {\n data: currentImageData,\n height: currentImageData.length,\n width: maxWidth\n },\n previousData: {\n data: previousImageData,\n height: previousImageData.length,\n width: maxWidth\n }\n };\n}\n\nself.addEventListener('message', function (_ref4) {\n var _ref4$data = _ref4.data;\n var previousData = _ref4$data.previousData;\n var currentData = _ref4$data.currentData;\n\n var result = computeAndInjectDiffs({ previousData: previousData, currentData: currentData });\n self.postMessage(result);\n self.close();\n});//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvd29ya2Vycy9Db21wdXRlQW5kSW5qZWN0RGlmZnNXb3JrZXIuanM/ZGRiNSJdLCJuYW1lcyI6WyJpbWFnZVRvMkRBcnJheSIsInBhZGRpbmdSaWdodCIsImRhdGEiLCJ3aWR0aCIsImhlaWdodCIsInJvd1NpemUiLCJuZXdEYXRhIiwicm93IiwicGl4ZWxzSW5Sb3ciLCJVaW50OENsYW1wZWRBcnJheSIsImxvY2F0aW9uIiwicHVzaCIsImFsaWduIiwicHJldmlvdXNJbWFnZURhdGEiLCJjdXJyZW50SW1hZ2VEYXRhIiwibWF4V2lkdGgiLCJoYXNoZWRQcmV2aW91c0RhdGEiLCJtYXAiLCJKU09OIiwic3RyaW5naWZ5Iiwic2VsZiIsInBvc3RNZXNzYWdlIiwicHJvZ3Jlc3MiLCJoYXNoZWRDdXJyZW50RGF0YSIsInRyYW5zcGFyZW50TGluZSIsImZvckVhY2giLCJoYXNoZWRMaW5lIiwiaSIsInNwbGljZSIsImNvbXB1dGVBbmRJbmplY3REaWZmcyIsInByZXZpb3VzRGF0YSIsImN1cnJlbnREYXRhIiwiTWF0aCIsIm1heCIsImxlbmd0aCIsImFkZEV2ZW50TGlzdGVuZXIiLCJyZXN1bHQiLCJjbG9zZSJdLCJtYXBwaW5ncyI6Ijs7QUFBQTs7Ozs7O0FBRUEsU0FBU0EsY0FBVCxPQUFpREMsWUFBakQsRUFBK0Q7QUFBQSxNQ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3JrZXJzL0NvbXB1dGVBbmRJbmplY3REaWZmc1dvcmtlci5qc1xuICoqLyJdLCJzb3VyY2VSb290IjoiIn0=");
|
48
|
+
|
49
|
+
/***/ },
|
50
|
+
/* 1 */
|
51
|
+
/***/ function(module, exports) {
|
52
|
+
|
53
|
+
eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = alignArrays;\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nvar MOVEMENT = {\n none: 0,\n diagonal: 1,\n vertical: 2,\n horizontal: 3\n};\n\nfunction initMatrix(height, width) {\n var rows = new Array(height);\n for (var i = 0; i < rows.length; i++) {\n rows[i] = new Int32Array(width);\n }\n return rows;\n}\n\nfunction longestCommonSubsequence(a, b) {\n // adapted from\n // http://algorithms.tutorialhorizon.com/dynamic-programming-longest-common-subsequence/\n var aLength = a.length;\n var bLength = b.length;\n var memo = initMatrix(aLength + 1, bLength + 1);\n var solution = initMatrix(aLength + 1, bLength + 1);\n\n // Loop and find the solution\n for (var i = 1; i <= aLength; i++) {\n for (var j = 1; j <= bLength; j++) {\n if (a[i - 1] === b[j - 1]) {\n // diagonal\n memo[i][j] = memo[i - 1][j - 1] + 1;\n solution[i][j] = MOVEMENT.diagonal;\n } else {\n memo[i][j] = Math.max(memo[i - 1][j], memo[i][j - 1]);\n if (memo[i][j] === memo[i - 1][j]) {\n solution[i][j] = MOVEMENT.vertical;\n } else {\n solution[i][j] = MOVEMENT.horizontal;\n }\n }\n }\n }\n console.log(memo);\n return solution;\n}\n\nfunction placeholders(count) {\n var result = new Array(count);\n for (var i = 0; i < count; i++) {\n result[i] = '+';\n }\n return result;\n}\n/**\n * Apply an lcs solution to arrays. Note that this will MUTATE the arrays,\n * injecting \"+\" where gaps are needed.\n *\n * @param {Array<Array>} solution as computed by `longestCommonSubsequence`\n * @param {Array} a\n * @param {Array} b\n */\nfunction applySolution(solution, a, b) {\n var movement = solution[a.length][b.length];\n var ai = a.length;\n var bi = b.length;\n\n var changes = 0;\n\n while (movement !== MOVEMENT.none) {\n if (movement === MOVEMENT.diagonal) {\n console.log(changes);\n if (changes < 0) {\n b.splice.apply(b, [bi, 0].concat(_toConsumableArray(placeholders(Math.abs(changes)))));\n } else if (changes > 0) {\n a.splice.apply(a, [ai, 0].concat(_toConsumableArray(placeholders(Math.abs(changes)))));\n }\n ai--;\n bi--;\n } else if (movement === MOVEMENT.horizontal) {\n bi--;\n changes++;\n } else if (movement === MOVEMENT.vertical) {\n ai--;\n changes--;\n }\n movement = solution[ai][bi];\n }\n}\n\n/**\n * Computes the longest common subsequence of two arrays, then uses that\n * solution to inject gaps into the arrays, making them align on common\n * subsequences.\n *\n * @param {Array} a\n * @param {Array} b\n */\nfunction alignArrays(a, b) {\n var lcsSolution = longestCommonSubsequence(a, b);\n applySolution(lcsSolution, a, b);\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvYWxpZ25BcnJheXMuanM/MDFiNyJdLCJuYW1lcyI6WyJhbGlnbkFycmF5cyIsIk1PVkVNRU5UIiwibm9uZSIsImRpYWdvbmFsIiwidmVydGljYWwiLCJob3Jpem9udGFsIiwiaW5pdE1hdHJpeCIsImhlaWdodCIsIndpZHRoIiwicm93cyIsIkFycmF5IiwiaSIsImxlbmd0aCIsIkludDMyQXJyYXkiLCJsb25nZXN0Q29tbW9uU3Vic2VxdWVuY2UiLCJhIiwiYiIsImFMZW5ndGgiLCJiTGVuZ3RoIiwibWVtbyIsInNvbHV0aW9uIiwiaiIsIk1hdGgiLCJtYXgiLCJjb25zb2xlIiwibG9nIiwicGxhY2Vob2xkZXJzIiwiY291bnQiLCJyZXN1bHQiLCJhcHBseVNvbHV0aW9uIiwibW92ZW1lbnQiLCJhaSIsImJpIiwiY2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RlcyB0aGUgbG9uZ2VzdCBjb21tb24gc3Vic2VxdWVuY2Ugb2YgdHdvIGFycmF5cywgdGhlbiB1c2VzIHRoYXRcbiAqIHNvbHV0aW9uIHRvIGluamVjdCBnYXBzIGludG8gdGhlIGFycmF5cywgbWFraW5nIHRoZW0gYWxpZ24gb24gY29tbW9uXG4gKiBzdWJzZXF1ZW5jZXMuXG4gKlxuICogQHBhcmFtIHtBcnJheX0gYVxuICogQHBhcmFtIHtBcnJheX0gYlxuICovXG5leHBvcnQgZGVmYXVsdCBmdW5jdGlvbiBhbGlnbkFycmF5cyhhLCBiKSB7XG4gIGNvbnN0IGxjc1NvbHV0aW9uID0gbG9uZ2VzdENvbW1vblN1YnNlcXVlbmNlKGEsIGIpO1xuICBhcHBseVNvbHV0aW9uKGxjc1NvbHV0aW9uLCBhLCBiKTtcbn1cblxuXG5cbi8qKiBXRUJQQUNLIEZPT1RFUiAqKlxuICoqIC4vanMvc3JjL2FsaWduQXJyYXlzLmpzXG4gKiovIl0sInNvdXJjZVJvb3QiOiIifQ==");
|
54
|
+
|
55
|
+
/***/ }
|
56
|
+
/******/ ]);
|
@@ -0,0 +1,56 @@
|
|
1
|
+
/******/ (function(modules) { // webpackBootstrap
|
2
|
+
/******/ // The module cache
|
3
|
+
/******/ var installedModules = {};
|
4
|
+
|
5
|
+
/******/ // The require function
|
6
|
+
/******/ function __webpack_require__(moduleId) {
|
7
|
+
|
8
|
+
/******/ // Check if module is in cache
|
9
|
+
/******/ if(installedModules[moduleId])
|
10
|
+
/******/ return installedModules[moduleId].exports;
|
11
|
+
|
12
|
+
/******/ // Create a new module (and put it into the cache)
|
13
|
+
/******/ var module = installedModules[moduleId] = {
|
14
|
+
/******/ exports: {},
|
15
|
+
/******/ id: moduleId,
|
16
|
+
/******/ loaded: false
|
17
|
+
/******/ };
|
18
|
+
|
19
|
+
/******/ // Execute the module function
|
20
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
21
|
+
|
22
|
+
/******/ // Flag the module as loaded
|
23
|
+
/******/ module.loaded = true;
|
24
|
+
|
25
|
+
/******/ // Return the exports of the module
|
26
|
+
/******/ return module.exports;
|
27
|
+
/******/ }
|
28
|
+
|
29
|
+
|
30
|
+
/******/ // expose the modules object (__webpack_modules__)
|
31
|
+
/******/ __webpack_require__.m = modules;
|
32
|
+
|
33
|
+
/******/ // expose the module cache
|
34
|
+
/******/ __webpack_require__.c = installedModules;
|
35
|
+
|
36
|
+
/******/ // __webpack_public_path__
|
37
|
+
/******/ __webpack_require__.p = "";
|
38
|
+
|
39
|
+
/******/ // Load entry module and return exports
|
40
|
+
/******/ return __webpack_require__(0);
|
41
|
+
/******/ })
|
42
|
+
/************************************************************************/
|
43
|
+
/******/ ([
|
44
|
+
/* 0 */
|
45
|
+
/***/ function(module, exports, __webpack_require__) {
|
46
|
+
|
47
|
+
eval("'use strict';\n\nvar _adiff = __webpack_require__(1);\n\nvar _adiff2 = _interopRequireDefault(_adiff);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction imageTo2DArray(_ref, paddingRight) {\n var data = _ref.data;\n var width = _ref.width;\n var height = _ref.height;\n\n // The imageData is a 1D array. Each element in the array corresponds to a\n // decimal value that represents one of the RGBA channels for that pixel.\n var rowSize = width * 4;\n\n var newData = [];\n for (var row = 0; row < height; row++) {\n var pixelsInRow = new Uint8ClampedArray(rowSize + paddingRight * 4);\n for (var location = 0; location < rowSize; location++) {\n pixelsInRow[location] = data[row * rowSize + location];\n }\n newData.push(pixelsInRow);\n }\n return newData;\n}\n\nfunction align(_ref2) {\n var previousImageData = _ref2.previousImageData;\n var currentImageData = _ref2.currentImageData;\n\n var hashedPreviousData = previousImageData.map(JSON.stringify);\n self.postMessage({ progress: 40 });\n var hashedCurrentData = currentImageData.map(JSON.stringify);\n self.postMessage({ progress: 60 });\n\n alignArrays(hashedPreviousData, hashedCurrentData);\n}\n\n/**\n * Takes two 2d images, computes the diff between the two, and injects pixels to\n * both in order to:\n * a) make both images the same height\n * b) properly visualize differences\n *\n * Please note that this method MUTATES data.\n *\n * @param {Array} previousData\n * @param {Array} currentData\n */\nfunction computeAndInjectDiffs(_ref3) {\n var previousData = _ref3.previousData;\n var currentData = _ref3.currentData;\n\n var maxWidth = Math.max(previousData.width, currentData.width);\n\n var transparentLine = new Uint8ClampedArray(maxWidth * 4);\n\n var previousImageData = imageTo2DArray(previousData, maxWidth - previousData.width);\n\n var currentImageData = imageTo2DArray(currentData, maxWidth - currentData.width);\n\n self.postMessage({ progress: 20 });\n\n var adiffResults = getAdiffResults({\n previousData: previousData,\n currentData: currentData,\n previousImageData: previousImageData,\n currentImageData: currentImageData\n });\n\n self.postMessage({ progress: 85 });\n\n // iterate and apply changes to previous data\n adiffResults.forEach(function (instruction) {\n var atIndex = instruction[0];\n var deletedItems = instruction[1];\n var addedItems = instruction.length - 2;\n\n for (var y = 0; y < Math.max(deletedItems, addedItems); y++) {\n if (y < deletedItems) {\n // ignore, we just keep the old line\n } else {\n previousImageData.splice(atIndex + y, 0, transparentLine);\n }\n }\n });\n self.postMessage({ progress: 95 });\n\n // iterate backwards and apply changes to current data\n for (var i = adiffResults.length - 1; i >= 0; i--) {\n var instruction = adiffResults[i];\n var atIndex = instruction[0];\n var deletedItems = instruction[1];\n var addedItems = instruction.length - 2;\n\n for (var y = 0; y < Math.max(deletedItems, addedItems); y++) {\n if (y < addedItems) {\n // ignore, we just keep the old line\n } else {\n currentImageData.splice(atIndex + y, 0, transparentLine);\n }\n }\n }\n self.postMessage({ progress: 98 });\n\n return {\n currentData: {\n data: currentImageData,\n height: currentImageData.length,\n width: maxWidth\n },\n previousData: {\n data: previousImageData,\n height: previousImageData.length,\n width: maxWidth\n }\n };\n}\n\nself.addEventListener('message', function (_ref4) {\n var _ref4$data = _ref4.data;\n var previousData = _ref4$data.previousData;\n var currentData = _ref4$data.currentData;\n\n var result = computeAndInjectDiffs({ previousData: previousData, currentData: currentData });\n self.postMessage(result);\n self.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WFnZURhdGEuc3BsaWNlKGF0SW5kZXggKyB5LCAwLCB0cmFuc3BhcmVudExpbmUpO1xuICAgICAgfVxuICAgIH1cbiAgfVxuICBzZWxmLnBvc3RNZXNzYWdlKHsgcHJvZ3Jlc3M6IDk4IH0pO1xuXG4gIHJldHVybiB7XG4gICAgY3VycmVudERhdGE6IHtcbiAgICAgIGRhdGE6IGN1cnJlbnRJbWFnZURhdGEsXG4gICAgICBoZWlnaHQ6IGN1cnJlbnRJbWFnZURhdGEubGVuZ3RoLFxuICAgICAgd2lkdGg6IG1heFdpZHRoLFxuICAgIH0sXG4gICAgcHJldmlvdXNEYXRhOiB7XG4gICAgICBkYXRhOiBwcmV2aW91c0ltYWdlRGF0YSxcbiAgICAgIGhlaWdodDogcHJldmlvdXNJbWFnZURhdGEubGVuZ3RoLFxuICAgICAgd2lkdGg6IG1heFdpZHRoLFxuICAgIH0sXG4gIH07XG59XG5cbnNlbGYuYWRkRXZlbnRMaXN0ZW5lcignbWVzc2FnZScsICh7IGRhdGE6IHsgcHJldmlvdXNEYXRhLCBjdXJyZW50RGF0YSB9IH0pID0+IHtcbiAgY29uc3QgcmVzdWx0ID0gY29tcHV0ZUFuZEluamVjdERpZmZzKHsgcHJldmlvdXNEYXRhLCBjdXJyZW50RGF0YSB9KTtcbiAgc2VsZi5wb3N0TWVzc2FnZShyZXN1bHQpO1xuICBzZWxmLmNsb3NlKCk7XG59KTtcblxuXG5cbi8qKiBXRUJQQUNLIEZPT1RFUiAqKlxuICoqIC4vanMvc3JjL3dvcmtlcnMvQ29tcHV0ZUFuZEluamVjdERpZmZzV29ya2VyLmpzXG4gKiovIl0sInNvdXJjZVJvb3QiOiIifQ==");
|
48
|
+
|
49
|
+
/***/ },
|
50
|
+
/* 1 */
|
51
|
+
/***/ function(module, exports) {
|
52
|
+
|
53
|
+
eval("function head (a) {\n return a[0]\n}\n\nfunction last (a) {\n return a[a.length - 1]\n}\n\nfunction tail(a) {\n return a.slice(1)\n}\n\nfunction retreat (e) {\n return e.pop()\n}\n\nfunction hasLength (e) {\n return e.length\n}\n\nfunction any(ary, test) {\n for(var i=0;i<ary.length;i++)\n if(test(ary[i]))\n return true\n return false\n}\n\nfunction score (a) {\n return a.reduce(function (s, a) {\n return s + a.length + a[1] + 1\n }, 0)\n}\n\nfunction best (a, b) {\n return score(a) <= score(b) ? a : b\n}\n\n\nvar _rules // set at the bottom \n\n// note, naive implementation. will break on circular objects.\n\nfunction _equal(a, b) {\n if(a && !b) return false\n if(Array.isArray(a))\n if(a.length != b.length) return false\n if(a && 'object' == typeof a) {\n for(var i in a)\n if(!_equal(a[i], b[i])) return false\n for(var i in b)\n if(!_equal(a[i], b[i])) return false\n return true\n }\n return a == b\n}\n\nfunction getArgs(args) {\n return args.length == 1 ? args[0] : [].slice.call(args)\n}\n\n// return the index of the element not like the others, or -1\nfunction oddElement(ary, cmp) {\n var c\n function guess(a) {\n var odd = -1\n c = 0\n for (var i = a; i < ary.length; i ++) {\n if(!cmp(ary[a], ary[i])) {\n odd = i, c++\n }\n }\n return c > 1 ? -1 : odd\n }\n //assume that it is the first element.\n var g = guess(0)\n if(-1 != g) return g\n //0 was the odd one, then all the other elements are equal\n //else there more than one different element\n guess(1)\n return c == 0 ? 0 : -1\n}\nvar exports = module.exports = function (deps, exports) {\n var equal = (deps && deps.equal) || _equal\n exports = exports || {} \n exports.lcs = \n function lcs() {\n var cache = {}\n var args = getArgs(arguments)\n var a = args[0], b = args[1]\n\n function key (a,b){\n return a.length + ':' + b.length\n }\n\n //find length that matches at the head\n\n if(args.length > 2) {\n //if called with multiple sequences\n //recurse, since lcs(a, b, c, d) == lcs(lcs(a,b), lcs(c,d))\n args.push(lcs(args.shift(), args.shift()))\n return lcs(args)\n }\n \n //this would be improved by truncating input first\n //and not returning an lcs as an intermediate step.\n //untill that is a performance problem.\n\n var start = 0, end = 0\n for(var i = 0; i < a.length && i < b.length \n && equal(a[i], b[i])\n ; i ++\n )\n start = i + 1\n\n if(a.length === start)\n return a.slice()\n\n for(var i = 0; i < a.length - start && i < b.length - start\n && equal(a[a.length - 1 - i], b[b.length - 1 - i])\n ; i ++\n )\n end = i\n\n function recurse (a, b) {\n if(!a.length || !b.length) return []\n //avoid exponential time by caching the results\n if(cache[key(a, b)]) return cache[key(a, b)]\n\n if(equal(a[0], b[0]))\n return [head(a)].concat(recurse(tail(a), tail(b)))\n else { \n var _a = recurse(tail(a), b)\n var _b = recurse(a, tail(b))\n return cache[key(a,b)] = _a.length > _b.length ? _a : _b \n }\n }\n \n var middleA = a.slice(start, a.length - end)\n var middleB = b.slice(start, b.length - end)\n\n return (\n a.slice(0, start).concat(\n recurse(middleA, middleB)\n ).concat(a.slice(a.length - end))\n )\n }\n\n // given n sequences, calc the lcs, and then chunk strings into stable and unstable sections.\n // unstable chunks are passed to build\n exports.chunk =\n function (q, build) {\n var q = q.map(function (e) { return e.slice() })\n var lcs = exports.lcs.apply(null, q)\n var all = [lcs].concat(q)\n\n function matchLcs (e) {\n if(e.length && !lcs.length || !e.length && lcs.length)\n return false //incase the last item is null\n return equal(last(e), last(lcs)) || ((e.length + lcs.length) === 0)\n }\n\n while(any(q, hasLength)) {\n //if each element is at the lcs then this chunk is stable.\n while(q.every(matchLcs) && q.every(hasLength))\n all.forEach(retreat)\n //collect the changes in each array upto the next match with the lcs\n var c = false\n var unstable = q.map(function (e) {\n var change = []\n while(!matchLcs(e)) {\n change.unshift(retreat(e))\n c = true\n }\n return change\n })\n if(c) build(q[0].length, unstable)\n }\n }\n\n //calculate a diff this is only updates\n exports.optimisticDiff =\n function (a, b) {\n var M = Math.max(a.length, b.length)\n var m = Math.min(a.length, b.length)\n var patch = []\n for(var i = 0; i < M; i++)\n if(a[i] !== b[i]) {\n var cur = [i,0], deletes = 0\n while(a[i] !== b[i] && i < m) {\n cur[1] = ++deletes\n cur.push(b[i++])\n }\n //the rest are deletes or inserts\n if(i >= m) {\n //the rest are deletes\n if(a.length > b.length)\n cur[1] += a.length - b.length\n //the rest are inserts\n else if(a.length < b.length)\n cur = cur.concat(b.slice(a.length))\n }\n patch.push(cur)\n }\n\n return patch\n }\n\n exports.diff =\n function (a, b) {\n var optimistic = exports.optimisticDiff(a, b)\n var changes = []\n exports.chunk([a, b], function (index, unstable) {\n var del = unstable.shift().length\n var insert = unstable.shift()\n changes.push([index, del].concat(insert))\n })\n return best(optimistic, changes)\n }\n\n exports.patch = function (a, changes, mutate) {\n if(mutate !== true) a = a.slice(a)//copy a\n changes.forEach(function (change) {\n [].splice.apply(a, change)\n })\n return a\n }\n\n // http://en.wikipedia.org/wiki/Concestor\n // me, concestor, you...\n exports.merge = function () {\n var args = getArgs(arguments)\n var patch = exports.diff3(args)\n return exports.patch(args[0], patch)\n }\n\n exports.diff3 = function () {\n var args = getArgs(arguments)\n var r = []\n exports.chunk(args, function (index, unstable) {\n var mine = unstable[0]\n var insert = resolve(unstable)\n if(equal(mine, insert)) return \n r.push([index, mine.length].concat(insert)) \n })\n return r\n }\n exports.oddOneOut =\n function oddOneOut (changes) {\n changes = changes.slice()\n //put the concestor first\n changes.unshift(changes.splice(1,1)[0])\n var i = oddElement(changes, equal)\n if(i == 0) // concestor was different, 'false conflict'\n return changes[1]\n if (~i)\n return changes[i] \n }\n exports.insertMergeOverDelete = \n //i've implemented this as a seperate rule,\n //because I had second thoughts about this.\n function insertMergeOverDelete (changes) {\n changes = changes.slice()\n changes.splice(1,1)// remove concestor\n \n //if there is only one non empty change thats okay.\n //else full confilct\n for (var i = 0, nonempty; i < changes.length; i++)\n if(changes[i].length) \n if(!nonempty) nonempty = changes[i]\n else return // full conflict\n return nonempty\n }\n\n var rules = (deps && deps.rules) || [exports.oddOneOut, exports.insertMergeOverDelete]\n\n function resolve (changes) {\n var l = rules.length\n for (var i in rules) { // first\n \n var c = rules[i] && rules[i](changes)\n if(c) return c\n }\n changes.splice(1,1) // remove concestor\n //returning the conflicts as an object is a really bad idea,\n // because == will not detect they are the same. and conflicts build.\n // better to use\n // '<<<<<<<<<<<<<'\n // of course, i wrote this before i started on snob, so i didn't know that then.\n /*var conflict = ['>>>>>>>>>>>>>>>>']\n while(changes.length)\n conflict = conflict.concat(changes.shift()).concat('============')\n conflict.pop()\n conflict.push ('<<<<<<<<<<<<<<<')\n changes.unshift ('>>>>>>>>>>>>>>>')\n return conflict*/\n //nah, better is just to use an equal can handle objects\n return {'?': changes}\n }\n return exports\n}\nexports(null, exports)\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9+L2FkaWZmL2luZGV4LmpzPzA0ZDYiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBLGNBQWMsYUFBYTtBQUMzQjtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSxHQUFHO0FBQ0g7O0FBRUE7QUFDQTtBQUNBOzs7QUFHQTs7QUFFQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsbUJBQW1CLGdCQUFnQjtBQUNuQztBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLHlCO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QU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id0IGtub3cgdGhhdCB0aGVuLlxuICAgIC8qdmFyIGNvbmZsaWN0ID0gWyc+Pj4+Pj4+Pj4+Pj4+Pj4+J11cbiAgICB3aGlsZShjaGFuZ2VzLmxlbmd0aClcbiAgICAgIGNvbmZsaWN0ID0gY29uZmxpY3QuY29uY2F0KGNoYW5nZXMuc2hpZnQoKSkuY29uY2F0KCc9PT09PT09PT09PT0nKVxuICAgIGNvbmZsaWN0LnBvcCgpXG4gICAgY29uZmxpY3QucHVzaCAgICAgICAgICAoJzw8PDw8PDw8PDw8PDw8PCcpXG4gICAgY2hhbmdlcy51bnNoaWZ0ICAgICAgICgnPj4+Pj4+Pj4+Pj4+Pj4+JylcbiAgICByZXR1cm4gY29uZmxpY3QqL1xuICAgIC8vbmFoLCBiZXR0ZXIgaXMganVzdCB0byB1c2UgYW4gZXF1YWwgY2FuIGhhbmRsZSBvYmplY3RzXG4gICAgcmV0dXJuIHsnPyc6IGNoYW5nZXN9XG4gIH1cbiAgcmV0dXJuIGV4cG9ydHNcbn1cbmV4cG9ydHMobnVsbCwgZXhwb3J0cylcblxuXG5cbi8qKioqKioqKioqKioqKioqKlxuICoqIFdFQlBBQ0sgRk9PVEVSXG4gKiogLi9+L2FkaWZmL2luZGV4LmpzXG4gKiogbW9kdWxlIGlkID0gMVxuICoqIG1vZHVsZSBjaHVua3MgPSAwXG4gKiovIl0sInNvdXJjZVJvb3QiOiIifQ==");
|
54
|
+
|
55
|
+
/***/ }
|
56
|
+
/******/ ]);
|
@@ -0,0 +1,56 @@
|
|
1
|
+
/******/ (function(modules) { // webpackBootstrap
|
2
|
+
/******/ // The module cache
|
3
|
+
/******/ var installedModules = {};
|
4
|
+
|
5
|
+
/******/ // The require function
|
6
|
+
/******/ function __webpack_require__(moduleId) {
|
7
|
+
|
8
|
+
/******/ // Check if module is in cache
|
9
|
+
/******/ if(installedModules[moduleId])
|
10
|
+
/******/ return installedModules[moduleId].exports;
|
11
|
+
|
12
|
+
/******/ // Create a new module (and put it into the cache)
|
13
|
+
/******/ var module = installedModules[moduleId] = {
|
14
|
+
/******/ exports: {},
|
15
|
+
/******/ id: moduleId,
|
16
|
+
/******/ loaded: false
|
17
|
+
/******/ };
|
18
|
+
|
19
|
+
/******/ // Execute the module function
|
20
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
21
|
+
|
22
|
+
/******/ // Flag the module as loaded
|
23
|
+
/******/ module.loaded = true;
|
24
|
+
|
25
|
+
/******/ // Return the exports of the module
|
26
|
+
/******/ return module.exports;
|
27
|
+
/******/ }
|
28
|
+
|
29
|
+
|
30
|
+
/******/ // expose the modules object (__webpack_modules__)
|
31
|
+
/******/ __webpack_require__.m = modules;
|
32
|
+
|
33
|
+
/******/ // expose the module cache
|
34
|
+
/******/ __webpack_require__.c = installedModules;
|
35
|
+
|
36
|
+
/******/ // __webpack_public_path__
|
37
|
+
/******/ __webpack_require__.p = "";
|
38
|
+
|
39
|
+
/******/ // Load entry module and return exports
|
40
|
+
/******/ return __webpack_require__(0);
|
41
|
+
/******/ })
|
42
|
+
/************************************************************************/
|
43
|
+
/******/ ([
|
44
|
+
/* 0 */
|
45
|
+
/***/ function(module, exports, __webpack_require__) {
|
46
|
+
|
47
|
+
eval("'use strict';\n\nvar _alignArrays = __webpack_require__(1);\n\nvar _alignArrays2 = _interopRequireDefault(_alignArrays);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction imageTo2DArray(_ref, paddingRight) {\n var data = _ref.data;\n var width = _ref.width;\n var height = _ref.height;\n\n // The imageData is a 1D array. Each element in the array corresponds to a\n // decimal value that represents one of the RGBA channels for that pixel.\n var rowSize = width * 4;\n\n var newData = [];\n for (var row = 0; row < height; row++) {\n var pixelsInRow = new Uint8ClampedArray(rowSize + paddingRight * 4);\n for (var location = 0; location < rowSize; location++) {\n pixelsInRow[location] = data[row * rowSize + location];\n }\n newData.push(pixelsInRow);\n }\n return newData;\n}\n\nfunction align(_ref2) {\n var previousImageData = _ref2.previousImageData;\n var currentImageData = _ref2.currentImageData;\n var maxWidth = _ref2.maxWidth;\n\n var hashedPreviousData = previousImageData.map(JSON.stringify);\n self.postMessage({ progress: 40 });\n var hashedCurrentData = currentImageData.map(JSON.stringify);\n self.postMessage({ progress: 60 });\n\n (0, _alignArrays2.default)(hashedPreviousData, hashedCurrentData);\n\n var transparentLine = new Uint8ClampedArray(maxWidth * 4);\n\n hashedPreviousData.forEach(function (hashedLine, i) {\n if (hashedLine === '+') {\n previousImageData.splice(i, 0, transparentLine);\n }\n });\n\n hashedCurrentData.forEach(function (hashedLine, i) {\n if (hashedLine === '+') {\n currentImageData.splice(i, 0, transparentLine);\n }\n });\n}\n\n/**\n * Takes two 2d images, computes the diff between the two, and injects pixels to\n * both in order to:\n * a) make both images the same height\n * b) properly visualize differences\n *\n * Please note that this method MUTATES data.\n *\n * @param {Array} previousData\n * @param {Array} currentData\n */\nfunction computeAndInjectDiffs(_ref3) {\n var previousData = _ref3.previousData;\n var currentData = _ref3.currentData;\n\n var maxWidth = Math.max(previousData.width, currentData.width);\n\n var previousImageData = imageTo2DArray(previousData, maxWidth - previousData.width);\n\n var currentImageData = imageTo2DArray(currentData, maxWidth - currentData.width);\n\n self.postMessage({ progress: 20 });\n\n align({\n previousImageData: previousImageData,\n currentImageData: currentImageData,\n maxWidth: maxWidth\n });\n\n self.postMessage({ progress: 85 });\n\n return {\n currentData: {\n data: currentImageData,\n height: currentImageData.length,\n width: maxWidth\n },\n previousData: {\n data: previousImageData,\n height: previousImageData.length,\n width: maxWidth\n }\n };\n}\n\nself.addEventListener('message', function (_ref4) {\n var _ref4$data = _ref4.data;\n var previousData = _ref4$data.previousData;\n var currentData = _ref4$data.currentData;\n\n var result = computeAndInjectDiffs({ previousData: previousData, currentData: currentData });\n self.postMessage(result);\n self.close();\n});//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi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iAgICBtYXhXaWR0aCxcbiAgfSk7XG5cbiAgc2VsZi5wb3N0TWVzc2FnZSh7IHByb2dyZXNzOiA4NSB9KTtcblxuICByZXR1cm4ge1xuICAgIGN1cnJlbnREYXRhOiB7XG4gICAgICBkYXRhOiBjdXJyZW50SW1hZ2VEYXRhLFxuICAgICAgaGVpZ2h0OiBjdXJyZW50SW1hZ2VEYXRhLmxlbmd0aCxcbiAgICAgIHdpZHRoOiBtYXhXaWR0aCxcbiAgICB9LFxuICAgIHByZXZpb3VzRGF0YToge1xuICAgICAgZGF0YTogcHJldmlvdXNJbWFnZURhdGEsXG4gICAgICBoZWlnaHQ6IHByZXZpb3VzSW1hZ2VEYXRhLmxlbmd0aCxcbiAgICAgIHdpZHRoOiBtYXhXaWR0aCxcbiAgICB9LFxuICB9O1xufVxuXG5zZWxmLmFkZEV2ZW50TGlzdGVuZXIoJ21lc3NhZ2UnLCAoeyBkYXRhOiB7IHByZXZpb3VzRGF0YSwgY3VycmVudERhdGEgfSB9KSA9PiB7XG4gIGNvbnN0IHJlc3VsdCA9IGNvbXB1dGVBbmRJbmplY3REaWZmcyh7IHByZXZpb3VzRGF0YSwgY3VycmVudERhdGEgfSk7XG4gIHNlbGYucG9zdE1lc3NhZ2UocmVzdWx0KTtcbiAgc2VsZi5jbG9zZSgpO1xufSk7XG5cblxuXG4vKiogV0VCUEFDSyBGT09URVIgKipcbiAqKiAuL2pzL3NyYy93b3JrZXJzL0NvbXB1dGVBbmRJbmplY3REaWZmc1dvcmtlci5qc1xuICoqLyJdLCJzb3VyY2VSb290IjoiIn0=");
|
48
|
+
|
49
|
+
/***/ },
|
50
|
+
/* 1 */
|
51
|
+
/***/ function(module, exports) {
|
52
|
+
|
53
|
+
eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = alignArrays;\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nvar MOVEMENT = {\n none: 0,\n diagonal: 1,\n vertical: 2,\n horizontal: 3\n};\n\nfunction initMatrix(height, width) {\n var rows = new Array(height);\n for (var i = 0; i < rows.length; i++) {\n rows[i] = new Int32Array(width);\n }\n return rows;\n}\n\nfunction longestCommonSubsequence(a, b) {\n // adapted from\n // http://algorithms.tutorialhorizon.com/dynamic-programming-longest-common-subsequence/\n var aLength = a.length;\n var bLength = b.length;\n var memo = initMatrix(aLength + 1, bLength + 1);\n var solution = initMatrix(aLength + 1, bLength + 1);\n\n // Loop and find the solution\n for (var i = 1; i <= aLength; i++) {\n for (var j = 1; j <= bLength; j++) {\n if (a[i - 1] === b[j - 1]) {\n // diagonal\n memo[i][j] = memo[i - 1][j - 1] + 1;\n solution[i][j] = MOVEMENT.diagonal;\n } else {\n memo[i][j] = Math.max(memo[i - 1][j], memo[i][j - 1]);\n if (memo[i][j] === memo[i - 1][j]) {\n solution[i][j] = MOVEMENT.vertical;\n } else {\n solution[i][j] = MOVEMENT.horizontal;\n }\n }\n }\n }\n if (memo[aLength][bLength] === 0) {\n // No soltuion found\n return null;\n }\n return solution;\n}\n\nfunction placeholders(count) {\n console.log(count);\n var result = new Array(count);\n for (var i = 0; i < count; i++) {\n result[i] = '+';\n }\n return result;\n}\n/**\n * Apply an lcs solution to arrays. Note that this will MUTATE the arrays,\n * injecting \"+\" where gaps are needed.\n *\n * @param {Array<Array>} solution as computed by `longestCommonSubsequence`\n * @param {Array} a\n * @param {Array} b\n */\nfunction applySolution(solution, a, b) {\n var movement = solution[a.length][b.length];\n var ai = a.length;\n var bi = b.length;\n\n var changes = 0;\n\n while (movement !== MOVEMENT.none) {\n if (movement === MOVEMENT.diagonal) {\n if (changes < 0) {\n b.splice.apply(b, [bi, 0].concat(_toConsumableArray(placeholders(Math.abs(changes)))));\n } else if (changes > 0) {\n a.splice.apply(a, [ai, 0].concat(_toConsumableArray(placeholders(changes))));\n }\n ai--;\n bi--;\n changes = 0;\n } else if (movement === MOVEMENT.horizontal) {\n bi--;\n changes++;\n } else if (movement === MOVEMENT.vertical) {\n ai--;\n changes--;\n }\n movement = solution[ai][bi];\n }\n}\n\n/**\n * To be called for arrays that share nothing in common.\n *\n * Note that this will MUTATE the arrays,\n *\n * @param {Array} a\n * @param {Array} b\n */\nfunction applyPadding(a, b) {\n var aLength = a.length;\n var bLength = b.length;\n var shorterArray = aLength > bLength ? b : a;\n shorterArray.push.apply(shorterArray, _toConsumableArray(placeholders(Math.abs(aLength - bLength))));\n}\n/**\n * Computes the longest common subsequence of two arrays, then uses that\n * solution to inject gaps into the arrays, making them align on common\n * subsequences.\n *\n * @param {Array} a\n * @param {Array} b\n */\nfunction alignArrays(a, b) {\n var lcsSolution = longestCommonSubsequence(a, b);\n if (lcsSolution) {\n applySolution(lcsSolution, a, b);\n } else {\n applyPadding(a, b);\n }\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvYWxpZ25BcnJheXMuanM/MDFiNyJdLCJuYW1lcyI6WyJhbGlnbkFycmF5cyIsIk1PVkVNRU5UIiwibm9uZSIsImRpYWdvbmFsIiwidmVydGljYWwiLCJob3Jpem9udGFsIiwiaW5pdE1hdHJpeCIsImhlaWdodCIsIndpZHRoIiwicm93cyIsIkFycmF5IiwiaSIsImxlbmd0aCIsIkludDMyQXJyYXkiLCJsb25nZXN0Q29tbW9uU3Vic2VxdWVuY2UiLCJhIiwiYiIsImFMZW5ndGgiLCJiTGVuZ3RoIiwibWVtbyIsInNvbHV0aW9uIiwiaiIsIk1hdGgiLCJtYXgiLCJwbGFjZWhvbGRlcnMiLCJjb3VudCIsImNvbnNvbGUiLCJsb2ciLCJyZXN1bHQiLCJhcHBseVNvbHV0aW9uIiwibW92ZW1lbnQiLCJhaSIsImJpIiwiY2hhbmdlcyIsInNwbGljZSIsImFicyIsImFwcGx5UGFkZGluZyIs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