happo 2.8.0 → 2.8.1
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/05bf9fb3d7f0192e7194.worker.js +56 -0
- data/lib/happo/public/06bf22e3fa348f77a82f.worker.js +56 -0
- data/lib/happo/public/08ccdc92f4d8ed3cff76.worker.js +62 -0
- data/lib/happo/public/0b94c9757c981bfc9fd7.worker.js +62 -0
- data/lib/happo/public/0d036738a62c01299743.worker.js +56 -0
- data/lib/happo/public/{203272bf00c349325c60.worker.js → 0e32a5b5219342a9aa1e.worker.js} +1 -1
- data/lib/happo/public/105bb978b49beac37583.worker.js +62 -0
- data/lib/happo/public/1172b74983f510409e2d.worker.js +62 -0
- data/lib/happo/public/13d0677d081eefd8c8bb.worker.js +62 -0
- data/lib/happo/public/1635684653e1a1979bea.worker.js +56 -0
- data/lib/happo/public/{4f6b0faf1b43e93a1404.worker.js → 1bb6a3a6bba3c02df491.worker.js} +1 -1
- data/lib/happo/public/1c48c5a95c9c5331c65f.worker.js +56 -0
- data/lib/happo/public/{1a86029ce53b1aa81f68.worker.js → 1d1049629f51e72af69f.worker.js} +1 -1
- data/lib/happo/public/{423ba9f549f3829873e6.worker.js → 1fd046493403de128de1.worker.js} +1 -1
- data/lib/happo/public/20c34bdb9a226c485df8.worker.js +56 -0
- data/lib/happo/public/23686d1b2fc3f4f86d12.worker.js +56 -0
- data/lib/happo/public/238307cd4525e692bc79.worker.js +56 -0
- data/lib/happo/public/2c643331ceb20b73e255.worker.js +56 -0
- data/lib/happo/public/2db6b1d7219028bac961.worker.js +62 -0
- data/lib/happo/public/2fbe9cf56ab2c3ab9a4a.worker.js +62 -0
- data/lib/happo/public/30ee387dd21d6b20a927.worker.js +62 -0
- data/lib/happo/public/34c08770d9dc4981b2a2.worker.js +62 -0
- data/lib/happo/public/35d8e219a4200e27adf9.worker.js +62 -0
- data/lib/happo/public/360e0acb872760f43b07.worker.js +1 -1
- data/lib/happo/public/385cc56a00d991287244.worker.js +62 -0
- data/lib/happo/public/38e90e6329f74e2d681a.worker.js +56 -0
- data/lib/happo/public/3a1ce5368a835b999d55.worker.js +62 -0
- data/lib/happo/public/3a7567174ad2bd91c107.worker.js +56 -0
- data/lib/happo/public/3b63d7abc667a23e0a2b.worker.js +56 -0
- data/lib/happo/public/3bdf5dcbba8864a7dcae.worker.js +62 -0
- data/lib/happo/public/{463eb0ecadbb11365ca4.worker.js → 3ee7268990c5d4183ad1.worker.js} +1 -1
- data/lib/happo/public/41d90eebc5449581b92a.worker.js +56 -0
- data/lib/happo/public/46a8fcf803fae37aa259.worker.js +62 -0
- data/lib/happo/public/46ef1d4f416d92b92cab.worker.js +62 -0
- data/lib/happo/public/4960a52eba13a73eb069.worker.js +56 -0
- data/lib/happo/public/49c762dec74fb3e7c638.worker.js +62 -0
- data/lib/happo/public/507ef3ea49332d42f582.worker.js +62 -0
- data/lib/happo/public/511d7e03fd683c618a22.worker.js +56 -0
- data/lib/happo/public/527516eb649429b011f7.worker.js +68 -0
- data/lib/happo/public/52e42bbfa68714fd1b26.worker.js +62 -0
- data/lib/happo/public/53e970da89474270e914.worker.js +56 -0
- data/lib/happo/public/572846c1173405e57d7d.worker.js +62 -0
- data/lib/happo/public/578cb8199b43c9f746ec.worker.js +62 -0
- data/lib/happo/public/58ae755db5700fc141d3.worker.js +62 -0
- data/lib/happo/public/5b7ffa7e0cfb69ac4952.worker.js +56 -0
- data/lib/happo/public/{62c7585d1d23297b316f.worker.js → 5cbf9957eb776724a5b6.worker.js} +1 -1
- data/lib/happo/public/612cb8b078897547b091.worker.js +62 -0
- data/lib/happo/public/{9cdd6f0763fd866a5118.worker.js → 6368c448d11a203d506b.worker.js} +1 -1
- data/lib/happo/public/69d16a4997e4170af4ee.worker.js +1 -0
- data/lib/happo/public/69fdd0bf1915b19115d6.worker.js +62 -0
- data/lib/happo/public/74309d94f574207e4e79.worker.js +62 -0
- data/lib/happo/public/74882ef02b7b28391aac.worker.js +62 -0
- data/lib/happo/public/785285eac660735ef3e0.worker.js +56 -0
- data/lib/happo/public/{730c035f5c2b404ff225.worker.js → 7d7551366f97adda7b5b.worker.js} +2 -2
- data/lib/happo/public/7e53176d18c890a5424c.worker.js +56 -0
- data/lib/happo/public/{b20a32590dfe259f4fe3.worker.js → 818ac008a4a7d62aa55c.worker.js} +2 -2
- data/lib/happo/public/823340592678aeab5317.worker.js +56 -0
- data/lib/happo/public/8cc13e3a447ea341f962.worker.js +56 -0
- data/lib/happo/public/8d0d79f0c81652bfb3f1.worker.js +1 -0
- data/lib/happo/public/9037f52c590941a75440.worker.js +62 -0
- data/lib/happo/public/{9472102d9a6d2577f988.worker.js → 935b279f09cf3c4046ec.worker.js} +1 -1
- data/lib/happo/public/{4e685162de1d8a9b102d.worker.js → 945f54dcc60d8b7abc9d.worker.js} +1 -1
- data/lib/happo/public/{f81ed0eec7edfa2dfadb.worker.js → 94ff43f0e47ff2759712.worker.js} +1 -1
- data/lib/happo/public/95a6641585f90432e282.worker.js +1 -0
- data/lib/happo/public/95ae334beb5125d1b4ce.worker.js +62 -0
- data/lib/happo/public/95b52fcff8f5732b1902.worker.js +62 -0
- data/lib/happo/public/984f0e2d0e896c2f4048.worker.js +62 -0
- data/lib/happo/public/988f633191766eef664a.worker.js +56 -0
- data/lib/happo/public/99af2b663636fee65291.worker.js +62 -0
- data/lib/happo/public/9c8f5ee8dfa77750be8c.worker.js +62 -0
- data/lib/happo/public/9d57ea9c2af229a03119.worker.js +56 -0
- data/lib/happo/public/9d7be8cf3aadb0b77624.worker.js +62 -0
- data/lib/happo/public/9e6b804a33c6799809cf.worker.js +62 -0
- data/lib/happo/public/HappoApp.bundle.js.map +1 -0
- data/lib/happo/public/a3574ff725014ef26602.worker.js +56 -0
- data/lib/happo/public/a5564ec6a5def9e7a95a.worker.js +1 -0
- data/lib/happo/public/a59e639dbf2bc03792c2.worker.js +56 -0
- data/lib/happo/public/a6de7e3f4866c4d4af09.worker.js +62 -0
- data/lib/happo/public/a79d520c7469920c10a2.worker.js +62 -0
- data/lib/happo/public/a7da9c5111db811b9535.worker.js +62 -0
- data/lib/happo/public/a8d9429cf3dd094aa190.worker.js +62 -0
- data/lib/happo/public/ab952692e7c4df03d3b8.worker.js +56 -0
- data/lib/happo/public/{80009e8bc0ffd29d3390.worker.js → aca1442707a8e088ec9e.worker.js} +1 -1
- data/lib/happo/public/{28237f0668f12dfb456c.worker.js → adc1f6a613d0d2eda4b8.worker.js} +1 -7
- data/lib/happo/public/b2a65c76321af7bc6d89.worker.js +62 -0
- data/lib/happo/public/b2a81bbc8e6f0ddb3432.worker.js +62 -0
- data/lib/happo/public/{e247eaa7506f44b5b847.worker.js → b41bd9a6b659bfe3096f.worker.js} +2 -2
- data/lib/happo/public/b66da676446fdda1a58c.worker.js +56 -0
- data/lib/happo/public/c1dd7c953827ff9578f0.worker.js +68 -0
- data/lib/happo/public/{3818f1c91ce4d4d8b724.worker.js → c556b6ede3bbd230cebd.worker.js} +1 -1
- data/lib/happo/public/ca172f55a8f34b526853.worker.js +62 -0
- data/lib/happo/public/{830db6cc9c99c2e8e9c1.worker.js → cbc31c846bebca5538bf.worker.js} +1 -1
- data/lib/happo/public/ce2440f84aa6708e51d4.worker.js +56 -0
- data/lib/happo/public/d4d18f5ac12fd3309c03.worker.js +56 -0
- data/lib/happo/public/d5ec9230a58d0929fe2d.worker.js +62 -0
- data/lib/happo/public/d650ec5f5ee0203de80a.worker.js +1 -0
- data/lib/happo/public/d6dbbb2aeed75685efa1.worker.js +62 -0
- data/lib/happo/public/d7403b48b365a76148a2.worker.js +56 -0
- data/lib/happo/public/d75350c7043f58e46d0c.worker.js +62 -0
- data/lib/happo/public/d899e9318500e6115f21.worker.js +62 -0
- data/lib/happo/public/df0d03d918e87308e3e3.worker.js +62 -0
- data/lib/happo/public/e39e8636909998d394e8.worker.js +56 -0
- data/lib/happo/public/e5c91be22eaad28e7e82.worker.js +56 -0
- data/lib/happo/public/e65a11af21a63b0c66df.worker.js +62 -0
- data/lib/happo/public/e8d18bed99776d3eabfd.worker.js +62 -0
- data/lib/happo/public/f0a047027dca5832b680.worker.js +62 -0
- data/lib/happo/public/f18c5838c7ec92d4a291.worker.js +62 -0
- data/lib/happo/public/f1b8838f395f31ff14a0.worker.js +62 -0
- data/lib/happo/public/fb955bccd11761291311.worker.js +62 -0
- data/lib/happo/public/happo-logo.svg +1 -0
- data/lib/happo/uploader.rb +3 -1
- data/lib/happo/version.rb +1 -1
- metadata +111 -80
- data/lib/happo/public/0622a1eb2a5b4dab0d7d.worker.js +0 -62
- data/lib/happo/public/088cc9d4615d51d37661.worker.js +0 -68
- data/lib/happo/public/11b439cedd6aa6a01e71.worker.js +0 -68
- data/lib/happo/public/167f0a5b59a8c27815fe.worker.js +0 -62
- data/lib/happo/public/19f5f7403fb4a2ba42e2.worker.js +0 -62
- data/lib/happo/public/1b6803fbc7b07f61cba2.worker.js +0 -74
- data/lib/happo/public/1d3dc560f1f39393dafe.worker.js +0 -62
- data/lib/happo/public/25ad7a1e52bd424ca81d.worker.js +0 -62
- data/lib/happo/public/26d95a76207ba0fe6c25.worker.js +0 -74
- data/lib/happo/public/2a7a935f3b9526c6f7ab.worker.js +0 -74
- data/lib/happo/public/2c00cb8d0a2eb5dd4078.worker.js +0 -68
- data/lib/happo/public/2c71ddb5b15a755d4644.worker.js +0 -68
- data/lib/happo/public/32648d3dfb22995f4066.worker.js +0 -68
- data/lib/happo/public/3452650686a8096b2bb7.worker.js +0 -68
- data/lib/happo/public/346cefcc1572890455b8.worker.js +0 -68
- data/lib/happo/public/35bd63f58bb69ac267ea.worker.js +0 -68
- data/lib/happo/public/3cc2e649d9b6ff62f4ab.worker.js +0 -62
- data/lib/happo/public/3deccedc8fbb96bb1aa7.worker.js +0 -68
- data/lib/happo/public/3e672be26a7a8864a342.worker.js +0 -68
- data/lib/happo/public/41aa7471344a79ff98f2.worker.js +0 -68
- data/lib/happo/public/47c52ff0e060fedb841f.worker.js +0 -62
- data/lib/happo/public/4eea1b4008ed68e41f82.worker.js +0 -62
- data/lib/happo/public/589c2f9547d240ac8a57.worker.js +0 -68
- data/lib/happo/public/5a8c0588ca745d7904f7.worker.js +0 -68
- data/lib/happo/public/5b3cabd81f7d8688f7a5.worker.js +0 -62
- data/lib/happo/public/5f5c9f07cb5117c523a2.worker.js +0 -68
- data/lib/happo/public/5fb8c7066659ea1b57e2.worker.js +0 -62
- data/lib/happo/public/5fb962cc191a60b42af0.worker.js +0 -68
- data/lib/happo/public/62e676d31cbf8aaa9359.worker.js +0 -68
- data/lib/happo/public/65efcf6aee5e3ef33539.worker.js +0 -68
- data/lib/happo/public/693d4918a5dae465c134.worker.js +0 -68
- data/lib/happo/public/69d106b071dd31ad86de.worker.js +0 -68
- data/lib/happo/public/7609088c49b73ee2e3e1.worker.js +0 -68
- data/lib/happo/public/76161d401db5bb36980a.worker.js +0 -62
- data/lib/happo/public/7d9febb46b37ddffa2d5.worker.js +0 -62
- data/lib/happo/public/7f29af56bd0ea82d77d9.worker.js +0 -68
- data/lib/happo/public/85ad69599657de02d20d.worker.js +0 -68
- data/lib/happo/public/875e790f3e64476b3aa0.worker.js +0 -68
- data/lib/happo/public/8fa9a7b2a5f19075eedc.worker.js +0 -74
- data/lib/happo/public/906ce908877052838b8e.worker.js +0 -62
- data/lib/happo/public/9ac309ab34f48e7af07c.worker.js +0 -68
- data/lib/happo/public/aa7ae8013f9780eb8acb.worker.js +0 -68
- data/lib/happo/public/b25ebdd4e2d2dee8c7b1.worker.js +0 -68
- data/lib/happo/public/b7a49d603b1d50f535b2.worker.js +0 -68
- data/lib/happo/public/b8e667564ad96f5c77f4.worker.js +0 -68
- data/lib/happo/public/b913c562805ec9a01635.worker.js +0 -68
- data/lib/happo/public/bab832c7110d15a5f43b.worker.js +0 -62
- data/lib/happo/public/bfcf99c9b2bf3d58ec7f.worker.js +0 -62
- data/lib/happo/public/c0aeff8b32c9911c8547.worker.js +0 -68
- data/lib/happo/public/c3d7b17359c21ff82281.worker.js +0 -68
- data/lib/happo/public/c9f7adcce3de80eb759a.worker.js +0 -68
- data/lib/happo/public/d7b87aec5f1e4f2a7a5d.worker.js +0 -68
- data/lib/happo/public/db617ae6458966f4acae.worker.js +0 -68
- data/lib/happo/public/e92bb4e1e06843fa771e.worker.js +0 -62
- data/lib/happo/public/e9e2d97848e0059e15c5.worker.js +0 -62
- data/lib/happo/public/ea87c48552c960ed7a1c.worker.js +0 -74
- data/lib/happo/public/eb5aafba8d16a397517a.worker.js +0 -68
- data/lib/happo/public/edc218b655b9ef694b3e.worker.js +0 -74
- data/lib/happo/public/eea64a6efa0620a576d7.worker.js +0 -68
- data/lib/happo/public/f269a8e7ffca13e9366a.worker.js +0 -68
- data/lib/happo/public/fcd20ee3e5a10e8667bb.worker.js +0 -68
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f6c9d4bd5dd3b4c13623aefd31b0e44eb5667bd
|
4
|
+
data.tar.gz: 33eaf52012b3410c9f0be7163b7ba5cedab428a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61198c14b79ff9709c76decac7ca8aac49d89d489a5787210b15666945b3f539aecea92ca8af1f928d0eb2fe0c3581b99862212b19719c42210c5b55db00c8d4
|
7
|
+
data.tar.gz: 759e49006bdbafca900b0cccc18622ffff17aa6ff9142662584e15c4a8d2da100e537375f2f14d419237746da379111c64c85d009c019a831c5f5e6fef73384a
|
@@ -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 _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\n/**\n * Construct a line of pixels of a certain rgba color\n *\n * @param {Array} rgba\n * @param {Number} width\n * @return {Array}\n */\nfunction constructColoredLine(rgba, width) {\n var line = [];\n for (var i = 0; i < width; i++) {\n line.push(rgba);\n }\n return line;\n}\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 var getPixelAt = function getPixelAt(x, y) {\n var startIndex = y * rowSize + x * 4;\n return [data[startIndex], data[startIndex + 1], data[startIndex + 2], data[startIndex + 3]];\n };\n\n var newData = [];\n for (var row = 0; row < height; row++) {\n var pixelsInRow = [];\n for (var col = 0; col < width; col++) {\n pixelsInRow.push(getPixelAt(col, row));\n }\n for (var pad = 0; pad < paddingRight; pad++) {\n pixelsInRow.push([0, 0, 0, 0]);\n }\n newData.push(pixelsInRow);\n }\n return newData;\n}\n\nfunction flattenImageData(imageData) {\n var result = [];\n imageData.forEach(function (row) {\n row.forEach(function (pixel) {\n result.push.apply(result, _toConsumableArray(pixel));\n });\n });\n return Uint8ClampedArray.from(result);\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(_ref2) {\n var previousData = _ref2.previousData;\n var currentData = _ref2.currentData;\n\n var maxWidth = Math.max(previousData.width, currentData.width);\n\n var redLine = constructColoredLine([255, 0, 0, 255], maxWidth);\n var greenLine = constructColoredLine([0, 255, 0, 255], maxWidth);\n\n var start = performance.now();\n var previousImageData = imageTo2DArray(previousData, maxWidth - previousData.width);\n\n var currentImageData = imageTo2DArray(currentData, maxWidth - currentData.width);\n console.log('(internal) image creation took', performance.now() - start);\n\n start = performance.now();\n var adiffResults = _adiff2.default.diff(previousImageData.map(function (d) {\n return btoa(d);\n }), currentImageData.map(function (d) {\n return btoa(d);\n }));\n console.log('(internal) adiffing took', performance.now() - start);\n\n start = performance.now();\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 // add a green line to signal an addition\n previousImageData.splice(atIndex + y, 0, greenLine);\n }\n }\n });\n console.log('(internal) image prep took', performance.now() - start);\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 // add a red line to signal a deletion\n currentImageData.splice(atIndex + y, 0, redLine);\n }\n }\n }\n\n return {\n currentData: {\n data: flattenImageData(currentImageData),\n height: currentImageData.length,\n width: maxWidth\n },\n previousData: {\n data: flattenImageData(previousImageData),\n height: previousImageData.length,\n width: maxWidth\n }\n };\n}\n\nself.addEventListener('message', function (_ref3) {\n var _ref3$data = _ref3.data;\n var previousData = _ref3$data.previousData;\n var currentData = _ref3$data.currentData;\n\n var start = performance.now();\n var result = computeAndInjectDiffs({ previousData: previousData, currentData: currentData });\n console.log('(internal) ComputeAndInjectDiffsWorker took', performance.now() - start);\n self.postMessage(result);\n self.close();\n});//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvd29ya2Vycy9Db21wdXRlQW5kSW5qZWN0RGlmZnNXb3JrZXIuanM/ZGRiNSJdLCJuYW1lcyI6WyJjb25zdHJ1Y3RDb2xvcmVkTGluZSIsInJnYmEiLCJ3aWR0aCIsImxpbmUiLCJpIiwicHVzaCIsImltYWdlVG8yREFycmF5IiwicGFkZGluZ1JpZ2h0IiwiZGF0YSIsImhlaWdodCIsInJvd1NpemUiLCJnZXRQaXhlbEF0IiwieCIsInkiLCJzdGFydEluZGV4IiwibmV3RGF0YSIsInJvdyIsInBpeGVsc0luUm93IiwiY29sIiwicGFkIiwiZmxh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XNJbWFnZURhdGEpLFxuICAgICAgaGVpZ2h0OiBwcmV2aW91c0ltYWdlRGF0YS5sZW5ndGgsXG4gICAgICB3aWR0aDogbWF4V2lkdGgsXG4gICAgfSxcbiAgfTtcbn1cblxuc2VsZi5hZGRFdmVudExpc3RlbmVyKCdtZXNzYWdlJywgKHsgZGF0YTogeyBwcmV2aW91c0RhdGEsIGN1cnJlbnREYXRhIH0gfSkgPT4ge1xuICBjb25zdCBzdGFydCA9IHBlcmZvcm1hbmNlLm5vdygpO1xuICBjb25zdCByZXN1bHQgPSBjb21wdXRlQW5kSW5qZWN0RGlmZnMoeyBwcmV2aW91c0RhdGEsIGN1cnJlbnREYXRhIH0pO1xuICBjb25zb2xlLmxvZygnKGludGVybmFsKSBDb21wdXRlQW5kSW5qZWN0RGlmZnNXb3JrZXIgdG9vaycsIHBlcmZvcm1hbmNlLm5vdygpIC0gc3RhcnQpO1xuICBzZWxmLnBvc3RNZXNzYWdlKHJlc3VsdCk7XG4gIHNlbGYuY2xvc2UoKTtcbn0pO1xuXG5cblxuLyoqIFdFQlBBQ0sgRk9PVEVSICoqXG4gKiogLi9qcy9zcmMvd29ya2Vycy9Db21wdXRlQW5kSW5qZWN0RGlmZnNXb3JrZXIuanNcbiAqKi8iXSwic291cmNlUm9vdCI6IiJ9");
|
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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PT09PT09PT0nKVxuICAgIGNvbmZsaWN0LnBvcCgpXG4gICAgY29uZmxpY3QucHVzaCAgICAgICAgICAoJzw8PDw8PDw8PDw8PDw8PCcpXG4gICAgY2hhbmdlcy51bnNoaWZ0ICAgICAgICgnPj4+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 _adiff = __webpack_require__(1);\n\nvar _adiff2 = _interopRequireDefault(_adiff);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\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\n/**\n * Construct a line of pixels of a certain rgba color\n *\n * @param {Array} rgba\n * @param {Number} width\n * @return {Array}\n */\nfunction constructColoredLine(rgba, width) {\n var line = [];\n for (var i = 0; i < width; i++) {\n line.push(rgba);\n }\n return line;\n}\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 var getPixelAt = function getPixelAt(x, y) {\n var startIndex = y * rowSize + x * 4;\n return [data[startIndex], data[startIndex + 1], data[startIndex + 2], data[startIndex + 3]];\n };\n\n var newData = [];\n for (var row = 0; row < height; row++) {\n var pixelsInRow = [];\n for (var col = 0; col < width; col++) {\n pixelsInRow.push(getPixelAt(col, row));\n }\n for (var pad = 0; pad < paddingRight; pad++) {\n pixelsInRow.push([0, 0, 0, 0]);\n }\n newData.push(pixelsInRow);\n }\n return newData;\n}\n\nfunction flattenImageData(imageData) {\n var result = [];\n imageData.forEach(function (row) {\n row.forEach(function (pixel) {\n result.push.apply(result, _toConsumableArray(pixel));\n });\n });\n return Uint8ClampedArray.from(result);\n}\n\nvar start = void 0;\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(_ref2) {\n var previousData = _ref2.previousData;\n var currentData = _ref2.currentData;\n\n var maxWidth = Math.max(previousData.width, currentData.width);\n\n var redLine = constructColoredLine([255, 0, 0, 255], maxWidth);\n var greenLine = constructColoredLine([0, 255, 0, 255], maxWidth);\n\n start = performance.now();\n var previousImageData = imageTo2DArray(previousData, maxWidth - previousData.width);\n\n var currentImageData = imageTo2DArray(currentData, maxWidth - currentData.width);\n console.log('(internal) image creation took', performance.now() - start);\n\n var hashedPreviousImageData = previousImageData.map(function (d) {\n return btoa(d);\n });\n var hashedCurrentImageData = currentImageData.map(function (d) {\n return btoa(d);\n });\n start = performance.now();\n var adiffResults = _adiff2.default.diff(hashedPreviousImageData, hashedCurrentImageData);\n console.log('(internal) adiffing took', performance.now() - start);\n\n start = performance.now();\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 // add a green line to signal an addition\n previousImageData.splice(atIndex + y, 0, greenLine);\n }\n }\n });\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 // add a red line to signal a deletion\n currentImageData.splice(atIndex + y, 0, redLine);\n }\n }\n }\n console.log('(internal) image prep took', performance.now() - start);\n\n start = performance.now();\n return {\n currentData: {\n data: flattenImageData(currentImageData),\n height: currentImageData.length,\n width: maxWidth\n },\n previousData: {\n data: flattenImageData(previousImageData),\n height: previousImageData.length,\n width: maxWidth\n }\n };\n}\n\nself.addEventListener('message', function (_ref3) {\n var _ref3$data = _ref3.data;\n var previousData = _ref3$data.previousData;\n var currentData = _ref3$data.currentData;\n\n var result = computeAndInjectDiffs({ previousData: previousData, currentData: currentData });\n console.log('(internal) flattening took', performance.now() - start);\n self.postMessage(result);\n self.close();\n});//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvd29ya2Vycy9Db21wdXRlQW5kSW5qZWN0RGlmZnNXb3JrZXIuanM/ZGRiNSJdLCJuYW1lcyI6WyJjb25zdHJ1Y3RDb2xvcmVkTGluZSIsInJnYmEiLCJ3aWR0aCIsImxpbmUiLCJpIiwicHVzaCIsImltYWdlVG8yREFycmF5IiwicGFkZGluZ1JpZ2h0IiwiZGF0YSIsImhlaWdodCIsInJvd1NpemUiLCJnZXRQaXhlbEF0IiwieCIsInkiLCJzdGFydEluZGV4IiwibmV3RGF0YSIsInJvdyIsInBpeGVsc0luUm93IiwiY29sIiwicGFkIiwiZmxhdHRlbkltYWdlRGF0YSIsImltYWdlRGF0YSIsInJlc3VsdCIsImZvckVhY2giLCJwaXhlbCIsIlVpbnQ4Q2xhbXBlZEFycmF5IiwiZnJvbSIsInN0YXJ0IiwiY29tcHV0ZUFuZEluamVjdERpZmZzIiwicHJldmlvdXNEYXRhIiwiY3VycmVud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WdodDogY3VycmVudEltYWdlRGF0YS5sZW5ndGgsXG4gICAgICB3aWR0aDogbWF4V2lkdGgsXG4gICAgfSxcbiAgICBwcmV2aW91c0RhdGE6IHtcbiAgICAgIGRhdGE6IGZsYXR0ZW5JbWFnZURhdGEocHJldmlvdXNJbWFnZURhdGEpLFxuICAgICAgaGVpZ2h0OiBwcmV2aW91c0ltYWdlRGF0YS5sZW5ndGgsXG4gICAgICB3aWR0aDogbWF4V2lkdGgsXG4gICAgfSxcbiAgfTtcbn1cblxuc2VsZi5hZGRFdmVudExpc3RlbmVyKCdtZXNzYWdlJywgKHsgZGF0YTogeyBwcmV2aW91c0RhdGEsIGN1cnJlbnREYXRhIH0gfSkgPT4ge1xuICBjb25zdCByZXN1bHQgPSBjb21wdXRlQW5kSW5qZWN0RGlmZnMoeyBwcmV2aW91c0RhdGEsIGN1cnJlbnREYXRhIH0pO1xuICBjb25zb2xlLmxvZygnKGludGVybmFsKSBmbGF0dGVuaW5nIHRvb2snLCBwZXJmb3JtYW5jZS5ub3coKSAtIHN0YXJ0KTtcbiAgc2VsZi5wb3N0TWVzc2FnZShyZXN1bHQpO1xuICBzZWxmLmNsb3NlKCk7XG59KTtcblxuXG5cbi8qKiBXRUJQQUNLIEZPT1RFUiAqKlxuICoqIC4vanMvc3JjL3dvcmtlcnMvQ29tcHV0ZUFuZEluamVjdERpZmZzV29ya2VyLmpzXG4gKiovIl0sInNvdXJjZVJvb3QiOiIifQ==");
|
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+L2FkaWZmL2luZGV4LmpzPzA0ZDYiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBLGNBQWMsYUFBYTtBQUMzQjtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSxHQUFHO0FBQ0g7O0FBRUE7QUFDQTtBQUNBOzs7QUFHQTs7QUFFQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsbUJBQW1CLGdCQUFnQjtBQUNuQztBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLHlCO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBLGtCQUFrQjtBQUNsQjtBQUNBLE9BQU87QUFDUDtBQUNBOztBQUVBO0FBQ0E7O0FBRUEsa0JBQWtCO0FBQ2xCO0FBQ0EsT0FBTztBQUNQO0F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cbiAgICAgIGNvbmZsaWN0ID0gY29uZmxpY3QuY29uY2F0KGNoYW5nZXMuc2hpZnQoKSkuY29uY2F0KCc9PT09PT09PT09PT0nKVxuICAgIGNvbmZsaWN0LnBvcCgpXG4gICAgY29uZmxpY3QucHVzaCAgICAgICAgICAoJzw8PDw8PDw8PDw8PDw8PCcpXG4gICAgY2hhbmdlcy51bnNoaWZ0ICAgICAgICgnPj4+Pj4+Pj4+Pj4+Pj4+JylcbiAgICByZXR1cm4gY29uZmxpY3QqL1xuICAgIC8vbmFoLCBiZXR0ZXIgaXMganVzdCB0byB1c2UgYW4gZXF1YWwgY2FuIGhhbmRsZSBvYmplY3RzXG4gICAgcmV0dXJuIHsnPyc6IGNoYW5nZXN9XG4gIH1cbiAgcmV0dXJuIGV4cG9ydHNcbn1cbmV4cG9ydHMobnVsbCwgZXhwb3J0cylcblxuXG5cbi8qKioqKioqKioqKioqKioqKlxuICoqIFdFQlBBQ0sgRk9PVEVSXG4gKiogLi9+L2FkaWZmL2luZGV4LmpzXG4gKiogbW9kdWxlIGlkID0gMVxuICoqIG1vZHVsZSBjaHVua3MgPSAwXG4gKiovIl0sInNvdXJjZVJvb3QiOiIifQ==");
|
54
|
+
|
55
|
+
/***/ }
|
56
|
+
/******/ ]);
|
@@ -0,0 +1,62 @@
|
|
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 _getDiffPixel = __webpack_require__(1);\n\nvar _getDiffPixel2 = _interopRequireDefault(_getDiffPixel);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nself.addEventListener('message', function (_ref) {\n var _ref$data = _ref.data;\n var previous = _ref$data.previous;\n var current = _ref$data.current;\n\n var data = new Uint8ClampedArray(previous.length);\n\n console.log('max', previous.length);\n var i = void 0;\n for (i = 0; i < previous.length; i += 4) {\n var pixel = (0, _getDiffPixel2.default)(previous.slice(i, i + 4), current.slice(i, i + 4));\n data[i + 0] = pixel[0]; // r\n data[i + 1] = pixel[1]; // g\n data[i + 2] = pixel[2]; // b\n data[i + 3] = pixel[3]; // a\n }\n console.log('last', i);\n self.postMessage(data);\n self.close();\n});//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvd29ya2Vycy9Jb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gKipcbiAqKiAuL2pzL3NyYy93b3JrZXJzL0ltYWdlRGlmZldvcmtlci5qc1xuICoqLyJdLCJzb3VyY2VSb290IjoiIn0=");
|
48
|
+
|
49
|
+
/***/ },
|
50
|
+
/* 1 */
|
51
|
+
/***/ function(module, exports, __webpack_require__) {
|
52
|
+
|
53
|
+
eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = getDiffPixel;\n\nvar _euclideanDistance = __webpack_require__(2);\n\nvar _euclideanDistance2 = _interopRequireDefault(_euclideanDistance);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction getDiffPixel(previousPixel, currentPixel) {\n if (!previousPixel) {\n return currentPixel;\n }\n\n if (!currentPixel) {\n return previousPixel;\n }\n\n var diff = (0, _euclideanDistance2.default)(previousPixel, currentPixel);\n if (diff === 0) {\n return [currentPixel[0], currentPixel[1], currentPixel[2], 50];\n }\n\n if (diff < 0.2) {\n diff = 0.2;\n }\n return [255, 0, 0, 255 * diff]; // TODO don't use red here\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvZ2V0RGlmZlBpeGVsLmpzPzRiNjgiXSwibmFtZXMiOlsiZ2V0RGlmZlBpeGVsIiwicHJldmlvdXNQaXhlbCIsImN1cnJlbnRQaXhlbCIsImRpZmYiXSwibWFwcGluZ3MiOiI7Ozs7O2tCQUV3QkEsWTs7QUFGeEI7Ozs7OztBQUVlLFNBQVNBLFlBQVQsQ0FBc0JDLGFBQXRCLEVBQXFDQyxZQUFyQyxFQUFtRDtBQUNoRSxNQUFJLENBQUNELGFBQUwsRUFBb0I7QUFDbEIsV0FBT0MsWUFBUDtBQUNEOztBQUVELE1BQUksQ0FBQ0EsWUFBTCxFQUFtQjtBQUNqQixXQUFPRCxhQUFQO0FBQ0Q7O0FBRUQsTUFBSUUsT0FBTyxp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NSwgMCwgMCwgMjU1ICogZGlmZl07IC8vIFRPRE8gZG9uJ3QgdXNlIHJlZCBoZXJlXG59XG5cblxuXG4vKiogV0VCUEFDSyBGT09URVIgKipcbiAqKiAuL2pzL3NyYy9nZXREaWZmUGl4ZWwuanNcbiAqKi8iXSwic291cmNlUm9vdCI6IiJ9");
|
54
|
+
|
55
|
+
/***/ },
|
56
|
+
/* 2 */
|
57
|
+
/***/ function(module, exports) {
|
58
|
+
|
59
|
+
eval("\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = euclideanDistance;\n/**\n * Compute a score that represents the difference between 2 pixels\n *\n * This method simply takes the Euclidean distance between the RGBA channels\n * of 2 colors over the maximum possible Euclidean distance. This gives us a\n * percentage of how different the two colors are.\n *\n * Although it would be more perceptually accurate to calculate a proper\n * Delta E in Lab colorspace, we probably don't need perceptual accuracy for\n * this application, and it is nice to avoid the overhead of converting RGBA\n * to Lab.\n *\n * Returns a float number between 0 and 1 where 1 is completely different\n * and 0 is no difference\n */\nfunction euclideanDistance(rgba1, rgba2) {\n var distance = (rgba1[0] - rgba2[0]) * (rgba1[0] - rgba2[0]) + (rgba1[1] - rgba2[1]) * (rgba1[1] - rgba2[1]) + (rgba1[2] - rgba2[2]) * (rgba1[2] - rgba2[2]) + (rgba1[3] - rgba2[3]) * (rgba1[3] - rgba2[3]);\n\n return Math.sqrt(distance) / 4 / 255;\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvZXVjbGlkZWFuRGlzdGFuY2UuanM/ZDgzYiJdLCJuYW1lcyI6WyJldWNsaWRlYW5EaXN0YW5jZSIsInJnYmExIiwicmdiYTIiLCJkaXN0YW5jZSIsIk1hdGgiLCJzcXJ0Il0sIm1hcHBpbmdzIjoiOzs7OztrQkFld0JBLGlCO0FBZnhCOzs7Ozs7Ozs7Ozs7Ozs7QUFlZS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60
|
+
|
61
|
+
/***/ }
|
62
|
+
/******/ ]);
|
@@ -0,0 +1,62 @@
|
|
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\nvar _flattenImageData = __webpack_require__(2);\n\nvar _flattenImageData2 = _interopRequireDefault(_flattenImageData);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Construct a line of pixels of a certain rgba color\n *\n * @param {Array} rgba\n * @param {Number} width\n * @return {Array}\n */\nfunction constructColoredLine(rgba, width) {\n var line = [];\n for (var i = 0; i < width; i++) {\n line.push(rgba);\n }\n return line;\n}\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 var getPixelAt = function getPixelAt(x, y) {\n var startIndex = y * rowSize + x * 4;\n return [data[startIndex], data[startIndex + 1], data[startIndex + 2], data[startIndex + 3]];\n };\n\n var newData = [];\n for (var row = 0; row < height; row++) {\n var pixelsInRow = [];\n for (var col = 0; col < width; col++) {\n pixelsInRow.push(getPixelAt(col, row));\n }\n for (var pad = 0; pad < paddingRight; pad++) {\n pixelsInRow.push([0, 0, 0, 0]);\n }\n newData.push(pixelsInRow);\n }\n return newData;\n}\n\nfunction getAdiffResults(_ref2) {\n var previousData = _ref2.previousData;\n var currentData = _ref2.currentData;\n var previousImageData = _ref2.previousImageData;\n var currentImageData = _ref2.currentImageData;\n\n if (previousData.width !== currentData.width) {\n // we know that all rows will be different here, so we can take a shortcut\n var diff = [0, // diff starts at index 0\n previousData.height];\n diff.length = currentData.height + 2; // number of additions\n return [diff];\n }\n\n var hashedPreviousData = previousImageData.map(JSON.stringify);\n var hashedCurrentData = currentImageData.map(JSON.stringify);\n\n return _adiff2.default.diff(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 redLine = constructColoredLine([255, 0, 0, 255], maxWidth);\n var greenLine = constructColoredLine([0, 255, 0, 255], maxWidth);\n\n var previousImageData = imageTo2DArray(previousData, maxWidth - previousData.width);\n\n var currentImageData = imageTo2DArray(currentData, maxWidth - currentData.width);\n\n self.postMessage({ progress: 30 });\n\n var adiffResults = getAdiffResults({\n previousData: previousData,\n currentData: currentData,\n previousImageData: previousImageData,\n currentImageData: currentImageData\n });\n\n self.postMessage({ progress: 75 });\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 // add a green line to signal an addition\n previousImageData.splice(atIndex + y, 0, greenLine);\n }\n }\n });\n self.postMessage({ progress: 80 });\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 // add a red line to signal a deletion\n currentImageData.splice(atIndex + y, 0, redLine);\n }\n }\n }\n self.postMessage({ progress: 85 });\n\n return {\n currentData: {\n data: (0, _flattenImageData2.default)(currentImageData),\n height: currentImageData.length,\n width: maxWidth\n },\n previousData: {\n data: (0, _flattenImageData2.default)(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,eyJ2ZXJzaW9uIj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UFuZEluamVjdERpZmZzKHsgcHJldmlvdXNEYXRhLCBjdXJyZW50RGF0YSB9KTtcbiAgc2VsZi5wb3N0TWVzc2FnZShyZXN1bHQpO1xuICBzZWxmLmNsb3NlKCk7XG59KTtcblxuXG5cbi8qKiBXRUJQQUNLIEZPT1RFUiAqKlxuICoqIC4vanMvc3JjL3dvcmtlcnMvQ29tcHV0ZUFuZEluamVjdERpZmZzV29ya2VyLmpzXG4gKiovIl0sInNvdXJjZVJvb3QiOiIifQ==");
|
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+L2FkaWZmL2luZGV4LmpzPzA0ZDYiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBLGNBQWMsYUFBYTtBQUMzQjtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSxHQUFHO0FBQ0g7O0FBRUE7QUFDQTtBQUNBOzs7QUFHQTs7QUFFQTs7QUFFQTtBQUNBO0FBQ0E7Q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B2YXIgdW5zdGFibGUgPSBxLm1hcChmdW5jdGlvbiAoZSkge1xuICAgICAgICB2YXIgY2hhbmdlID0gW11cbiAgICAgICAgd2hpbGUoIW1hdGNoTGNzKGUpKSB7XG4gICAgICAgICAgY2hhbmdlLnVuc2hpZnQocmV0cmVhdChlKSlcbiAgICAgICAgICBjID0gdHJ1ZVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBjaGFuZ2VcbiAgICAgIH0pXG4gICAgICBpZihjKSBidWlsZChxWzBdLmxlbmd0aCwgdW5zdGFibGUpXG4gICAgfVxuICB9XG5cbiAgLy9jYWxjdWxhdGUgYSBkaWZmIHRoaXMgaXMgb25seSB1cGRhdGVzXG4gIGV4cG9ydHMub3B0aW1pc3RpY0RpZmYgPVxuICBmdW5jdGlvbiAoYSwgYikge1xuICAgIHZhciBNID0gTWF0aC5tYXgoYS5sZW5ndGgsIGIubGVuZ3RoKVxuICAgIHZhciBtID0gTWF0aC5taW4oYS5sZW5ndGgsIGIubGVuZ3RoKVxuICAgIHZhciBwYXRjaCA9IFtdXG4gICAgZm9yKHZhciBpID0gMDsgaSA8IE07IGkrKylcbiAgICAgIGlmKGFbaV0gIT09IGJbaV0pIHtcbiAgICAgICAgdmFyIGN1ciA9IFtpLDBdLCBkZWxldGVzID0gMFxuICAgICAgICB3aGlsZShhW2ldICE9PSBiW2ldICYmIGkgPCBtKSB7XG4gICAgICAgICAgY3VyWzFdID0gKytkZWxldGVzXG4gICAgICAgICAgY3VyLnB1c2goYltpKytdKVxuICAgICAgICB9XG4gICAgICAgIC8vdGhlIHJlc3QgYXJlIGRlbGV0ZXMgb3IgaW5zZXJ0c1xuICAgICAgICBpZihpID49IG0pIHtcbiAgICAgICAgICAvL3RoZSByZXN0IGFyZSBkZWxldGVzXG4gICAgICAgICAgaWYoYS5sZW5ndGggPiBiLmxlbmd0aClcbiAgICAgICAgICAgIGN1clsxXSArPSBhLmxlbmd0aCAtIGIubGVuZ3RoXG4gICAgICAgICAgLy90aG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k9PVEVSXG4gKiogLi9+L2FkaWZmL2luZGV4LmpzXG4gKiogbW9kdWxlIGlkID0gMVxuICoqIG1vZHVsZSBjaHVua3MgPSAwXG4gKiovIl0sInNvdXJjZVJvb3QiOiIifQ==");
|
54
|
+
|
55
|
+
/***/ },
|
56
|
+
/* 2 */
|
57
|
+
/***/ function(module, exports) {
|
58
|
+
|
59
|
+
eval("\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = flattenImageData;\n/**\n * @param {Array} imageData a 2d array\n * @return {Uint8ClampedArray}\n */\nfunction flattenImageData(imageData) {\n var width = imageData[0].length;\n var result = new Uint8ClampedArray(imageData.length * width * 4);\n imageData.forEach(function (row, y) {\n row.forEach(function (pixel, x) {\n var index = y * width * 4 + x * 4;\n result[index] = pixel[0];\n result[index + 1] = pixel[1];\n result[index + 2] = pixel[2];\n result[index + 3] = pixel[3];\n });\n });\n return result;\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvZmxhdHRlbkltYWdlRGF0YS5qcz8yZGRiIl0sIm5hbWVzIjpbImZsYXR0ZW5JbWFnZURhdGEiLCJpbWFnZURhdGEiLCJ3aWR0aCIsImxlbmd0aCIsInJlc3VsdCIsIlVpbnQ4Q2xhbXBlZEFycmF5IiwiZm9yRWFjaCIsInJvdyIsInkiLCJwaXhlbCIsIngiLCJpbmRleCJdLCJtYXBwaW5ncyI6Ijs7Ozs7a0JBSXdCQSxnQjtBQUp4Qjs7OztBQUllLFNBQVNBLGdCQUFULENBQTBCQyxTQUExQixFQUFxQztBQUNsRCxNQUFNQyxRQUFRRCxVQUFVLENBQVYsRUFBYUUsTUFBM0I7QUFDQSxNQUFNQyxTQUFTLElBQUlDLGlCQUFKLENBQXNCSixVQUFVRSxNQUFWLEdBQW1CRCxLQUFuQixHQUEyQixDQUFqRCxDQUFmO0FBQ0FELFlBQVV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KyAxXSA9IHBpeGVsWzFdO1xuICAgICAgcmVzdWx0W2luZGV4ICsgMl0gPSBwaXhlbFsyXTtcbiAgICAgIHJlc3VsdFtpbmRleCArIDNdID0gcGl4ZWxbM107XG4gICAgfSk7XG4gIH0pO1xuICByZXR1cm4gcmVzdWx0O1xufVxuXG5cblxuLyoqIFdFQlBBQ0sgRk9PVEVSICoqXG4gKiogLi9qcy9zcmMvZmxhdHRlbkltYWdlRGF0YS5qc1xuICoqLyJdLCJzb3VyY2VSb290IjoiIn0=");
|
60
|
+
|
61
|
+
/***/ }
|
62
|
+
/******/ ]);
|
@@ -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\n/**\n * Construct a line of pixels of a certain rgba color\n *\n * @param {Array} rgba\n * @param {Number} width\n * @return {Array}\n */\nfunction constructColoredLine(rgba, width) {\n var line = [];\n for (var i = 0; i < width; i++) {\n line.push(rgba);\n }\n return line;\n}\n\nfunction imageTo2DArray(_ref) {\n var imageData = _ref.imageData;\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 var getPixelAt = function getPixelAt(x, y) {\n if (x > width || y > height) {\n return undefined;\n }\n\n var startIndex = y * rowSize + x * 4;\n return [imageData[startIndex], imageData[startIndex + 1], imageData[startIndex + 2], imageData[startIndex + 3]];\n };\n\n var data = [];\n for (var row = 0; row < height; row++) {\n var pixelsInRow = [];\n for (var col = 0; col < width; col++) {\n pixelsInRow.push(getPixelAt(col, row));\n }\n data.push(pixelsInRow);\n }\n return data;\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(_ref2) {\n var previousData = _ref2.previousData;\n var currentData = _ref2.currentData;\n\n var maxWidth = Math.max(previousData[0].length, currentData[0].length);\n\n var redLine = constructColoredLine([255, 0, 0, 255], maxWidth);\n var greenLine = constructColoredLine([0, 255, 0, 255], maxWidth);\n\n var adiffResults = _adiff2.default.diff(previousData.map(function (d) {\n return btoa(d);\n }), currentData.map(function (d) {\n return btoa(d);\n }));\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 // add a green line to signal an addition\n previousData.splice(atIndex + y, 0, greenLine);\n }\n }\n });\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 // add a red line to signal a deletion\n currentData.splice(atIndex + y, 0, redLine);\n }\n }\n }\n}\n\nself.addEventListener('message', function (_ref3) {\n var _ref3$data = _ref3.data;\n var previousData = _ref3$data.previousData;\n var currentData = _ref3$data.currentData;\n\n computeAndInjectDiffs({ previousData: previousData, currentData: currentData });\n self.postMessage({ previousData: previousData, currentData: currentData });\n self.close();\n});//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvd29ya2Vycy9Db21wdXRlQW5kSW5qZWN0RGlmZnNXb3JrZXIuanM/ZGRiNSJdLCJuYW1lcyI6WyJjb25zdHJ1Y3RDb2xvcmVkTGluZSIsInJnYmEiLCJ3aWR0aCIsImxpbmUiLCJpIiwicHVzaCIsImltYWdlVG8yREFycmF5IiwiaW1hZ2VEYXRhIiwiaGVpZ2h0Iiwicm93U2l6ZSIsImdldFBpeGVsQXQiLCJ4IiwieSIsInVuZGVmaW5lZCIsInN0YXJ0SW5kZXgiLCJkYXRhIiwicm93IiwicGl4ZWxzSW5Sb3ciLCJjb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blxuICAgIGZvciAobGV0IHkgPSAwOyB5IDwgTWF0aC5tYXgoZGVsZXRlZEl0ZW1zLCBhZGRlZEl0ZW1zKTsgeSsrKSB7XG4gICAgICBpZiAoeSA8IGFkZGVkSXRlbXMpIHtcbiAgICAgICAgLy8gaWdub3JlLCB3ZSBqdXN0IGtlZXAgdGhlIG9sZCBsaW5lXG4gICAgICB9IGVsc2Uge1xuICAgICAgICAvLyBhZGQgYSByZWQgbGluZSB0byBzaWduYWwgYSBkZWxldGlvblxuICAgICAgICBjdXJyZW50RGF0YS5zcGxpY2UoYXRJbmRleCArIHksIDAsIHJlZExpbmUpO1xuICAgICAgfVxuICAgIH1cbiAgfVxufVxuXG5zZWxmLmFkZEV2ZW50TGlzdGVuZXIoJ21lc3NhZ2UnLCAoeyBkYXRhOiB7IHByZXZpb3VzRGF0YSwgY3VycmVudERhdGEgfSB9KSA9PiB7XG4gIGNvbXB1dGVBbmRJbmplY3REaWZmcyh7IHByZXZpb3VzRGF0YSwgY3VycmVudERhdGEgfSk7XG4gIHNlbGYucG9zdE1lc3NhZ2UoeyBwcmV2aW91c0RhdGEsIGN1cnJlbnREYXRhIH0pO1xuICBzZWxmLmNsb3NlKCk7XG59KTtcblxuXG5cbi8qKiBXRUJQQUNLIEZPT1RFUiAqKlxuICoqIC4vanMvc3JjL3dvcmtlcnMvQ29tcHV0ZUFuZEluamVjdERpZmZzV29ya2VyLmpzXG4gKiovIl0sInNvdXJjZVJvb3QiOiIifQ==");
|
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+L2FkaWZmL2luZGV4LmpzPzA0ZDYiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBLGNBQWMsYUFBYTtBQUMzQjtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSxHQUFHO0FBQ0g7O0FBRUE7QUFDQTtBQUNBOzs7QUFHQTs7QUFFQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsbUJBQW1CLGdCQUFnQjtBQUNuQztBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLHlCO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBLGtCQUFrQjtBQUNsQjtBQUNBLE9BQU87QUFDUDtBQUNBOztBQUVBO0FBQ0E7O0FBRUEsa0JBQWtCO0FBQ2xCO0FBQ0EsT0F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zLmxlbmd0aClcbiAgICAgIGNvbmZsaWN0ID0gY29uZmxpY3QuY29uY2F0KGNoYW5nZXMuc2hpZnQoKSkuY29uY2F0KCc9PT09PT09PT09PT0nKVxuICAgIGNvbmZsaWN0LnBvcCgpXG4gICAgY29uZmxpY3QucHVzaCAgICAgICAgICAoJzw8PDw8PDw8PDw8PDw8PCcpXG4gICAgY2hhbmdlcy51bnNoaWZ0ICAgICAgICgnPj4+Pj4+Pj4+Pj4+Pj4+JylcbiAgICByZXR1cm4gY29uZmxpY3QqL1xuICAgIC8vbmFoLCBiZXR0ZXIgaXMganVzdCB0byB1c2UgYW4gZXF1YWwgY2FuIGhhbmRsZSBvYmplY3RzXG4gICAgcmV0dXJuIHsnPyc6IGNoYW5nZXN9XG4gIH1cbiAgcmV0dXJuIGV4cG9ydHNcbn1cbmV4cG9ydHMobnVsbCwgZXhwb3J0cylcblxuXG5cbi8qKioqKioqKioqKioqKioqKlxuICoqIFdFQlBBQ0sgRk9PVEVSXG4gKiogLi9+L2FkaWZmL2luZGV4LmpzXG4gKiogbW9kdWxlIGlkID0gMVxuICoqIG1vZHVsZSBjaHVua3MgPSAwXG4gKiovIl0sInNvdXJjZVJvb3QiOiIifQ==");
|
54
|
+
|
55
|
+
/***/ }
|
56
|
+
/******/ ]);
|
@@ -44,7 +44,7 @@
|
|
44
44
|
/* 0 */
|
45
45
|
/***/ function(module, exports, __webpack_require__) {
|
46
46
|
|
47
|
-
eval("'use strict';\n\nvar _adiff = __webpack_require__(1);\n\nvar _adiff2 = _interopRequireDefault(_adiff);\n\nvar _flattenImageData = __webpack_require__(2);\n\nvar _flattenImageData2 = _interopRequireDefault(_flattenImageData);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar TRANSPARENT_PIXEL = [0, 0, 0, 0];\n\n/**\n * Construct a line of transparent pixels\n *\n * @param {Number} width\n * @return {Array}\n */\nfunction constructColoredLine(width) {\n var line = [];\n for (var i = 0; i < width; i++) {\n line.push(TRANSPARENT_PIXEL);\n }\n return line;\n}\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 var getPixelAt = function getPixelAt(x, y) {\n var startIndex = y * rowSize + x * 4;\n return [data[startIndex], data[startIndex + 1], data[startIndex + 2], data[startIndex + 3]];\n };\n\n var newData = [];\n for (var row = 0; row < height; row++) {\n var pixelsInRow = [];\n for (var col = 0; col < width; col++) {\n pixelsInRow.push(getPixelAt(col, row));\n }\n for (var pad = 0; pad < paddingRight; pad++) {\n pixelsInRow.push([0, 0, 0, 0]);\n }\n newData.push(pixelsInRow);\n }\n return newData;\n}\n\nfunction getAdiffResults(_ref2) {\n var previousData = _ref2.previousData;\n var currentData = _ref2.currentData;\n var previousImageData = _ref2.previousImageData;\n var currentImageData = _ref2.currentImageData;\n\n if (previousData.width !== currentData.width) {\n // we know that all rows will be different here, so we can take a shortcut\n var diff = [0, // diff starts at index 0\n previousData.height];\n diff.length = currentData.height + 2; // number of additions\n return [diff];\n }\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 return _adiff2.default.diff(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 redLine = constructColoredLine([255, 0, 0, 255], maxWidth);\n var greenLine = constructColoredLine([0, 255, 0, 255], maxWidth);\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 // add a green line to signal an addition\n previousImageData.splice(atIndex + y, 0, greenLine);\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 // add a red line to signal a deletion\n currentImageData.splice(atIndex + y, 0, redLine);\n }\n }\n }\n self.postMessage({ progress: 98 });\n\n return {\n currentData: {\n data: (0, _flattenImageData2.default)(currentImageData),\n height: currentImageData.length,\n width: maxWidth\n },\n previousData: {\n data: (0, _flattenImageData2.default)(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/ZGRiNSJdLCJuYW1lcyI6WyJUUkF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hlaWdodDogcHJldmlvdXNJbWFnZURhdGEubGVuZ3RoLFxuICAgICAgd2lkdGg6IG1heFdpZHRoLFxuICAgIH0sXG4gIH07XG59XG5cbnNlbGYuYWRkRXZlbnRMaXN0ZW5lcignbWVzc2FnZScsICh7IGRhdGE6IHsgcHJldmlvdXNEYXRhLCBjdXJyZW50RGF0YSB9IH0pID0+IHtcbiAgY29uc3QgcmVzdWx0ID0gY29tcHV0ZUFuZEluamVjdERpZmZzKHsgcHJldmlvdXNEYXRhLCBjdXJyZW50RGF0YSB9KTtcbiAgc2VsZi5wb3N0TWVzc2FnZShyZXN1bHQpO1xuICBzZWxmLmNsb3NlKCk7XG59KTtcblxuXG5cbi8qKiBXRUJQQUNLIEZPT1RFUiAqKlxuICoqIC4vanMvc3JjL3dvcmtlcnMvQ29tcHV0ZUFuZEluamVjdERpZmZzV29ya2VyLmpzXG4gKiovIl0sInNvdXJjZVJvb3QiOiIifQ==");
|
47
|
+
eval("'use strict';\n\nvar _adiff = __webpack_require__(1);\n\nvar _adiff2 = _interopRequireDefault(_adiff);\n\nvar _flattenImageData = __webpack_require__(2);\n\nvar _flattenImageData2 = _interopRequireDefault(_flattenImageData);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Construct a line of pixels of a certain rgba color\n *\n * @param {Array} rgba\n * @param {Number} width\n * @return {Array}\n */\nfunction constructColoredLine(rgba, width) {\n var line = [];\n for (var i = 0; i < width; i++) {\n line.push(rgba);\n }\n return line;\n}\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 var getPixelAt = function getPixelAt(x, y) {\n var startIndex = y * rowSize + x * 4;\n return [data[startIndex], data[startIndex + 1], data[startIndex + 2], data[startIndex + 3]];\n };\n\n var newData = [];\n for (var row = 0; row < height; row++) {\n var pixelsInRow = [];\n for (var col = 0; col < width; col++) {\n pixelsInRow.push(getPixelAt(col, row));\n }\n for (var pad = 0; pad < paddingRight; pad++) {\n pixelsInRow.push([0, 0, 0, 0]);\n }\n newData.push(pixelsInRow);\n }\n return newData;\n}\n\nfunction hash(a) {\n var res = 0;\n for (var i = 0; i < a.length; i++) {\n res += a[i];\n }\n}\n\nfunction getAdiffResults(_ref2) {\n var previousData = _ref2.previousData;\n var currentData = _ref2.currentData;\n var previousImageData = _ref2.previousImageData;\n var currentImageData = _ref2.currentImageData;\n\n if (previousData.width !== currentData.width) {\n // we know that all rows will be different here, so we can take a shortcut\n var diff = [0, // diff starts at index 0\n previousData.height];\n diff.length = currentData.height + 2; // number of additions\n return [diff];\n }\n var start = performance.now();\n var p = previousImageData.map(hash);\n var c = currentImageData.map(hash);\n\n console.log('hashing', performance.now() - start);\n\n var r = _adiff2.default.diff(p, c);\n console.log('total', performance.now() - start);\n return r;\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 redLine = constructColoredLine([255, 0, 0, 255], maxWidth);\n var greenLine = constructColoredLine([0, 255, 0, 255], maxWidth);\n\n var previousImageData = imageTo2DArray(previousData, maxWidth - previousData.width);\n\n var currentImageData = imageTo2DArray(currentData, maxWidth - currentData.width);\n\n var adiffResults = getAdiffResults({\n previousData: previousData,\n currentData: currentData,\n previousImageData: previousImageData,\n currentImageData: currentImageData\n });\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 // add a green line to signal an addition\n previousImageData.splice(atIndex + y, 0, greenLine);\n }\n }\n });\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 // add a red line to signal a deletion\n currentImageData.splice(atIndex + y, 0, redLine);\n }\n }\n }\n\n return {\n currentData: {\n data: (0, _flattenImageData2.default)(currentImageData),\n height: currentImageData.length,\n width: maxWidth\n },\n previousData: {\n data: (0, _flattenImageData2.default)(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/ZGRiNSJdLCJuYW1lcyI6WyJjb25zdHJ1Y3RDb2xvcmVkTGluZSIsInJnYmEiLCJ3aWR0aCIsImxpbmUiLCJpIiwicHVzaCIsImltYWdlVG8yREFycmF5IiwicGFkZGluZ1JpZ2h0IiwiZGF0YSIsImhlaWdodCIsInJvd1NpemUiLCJnZXRQaXhlbEF0IiwieCIsInkiLCJzdGFydEluZGV4IiwibmV3RGF0YSIsInJvdyIsInBpeGVsc0luUm93IiwiY29sIiwicGFkIiwiaGFzaCIsImEiLCJyZXMiLCJsZW5ndGgiLCJnZXRBZGlmZlJlc3VsdHMiLCJwcmV2aW91c0RhdGEiLCJjdXJyZW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2VyLmpzXG4gKiovIl0sInNvdXJjZVJvb3QiOiIifQ==");
|
48
48
|
|
49
49
|
/***/ },
|
50
50
|
/* 1 */
|
@@ -0,0 +1,62 @@
|
|
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 _getDiffPixel = __webpack_require__(1);\n\nvar _getDiffPixel2 = _interopRequireDefault(_getDiffPixel);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nself.addEventListener('message', function (_ref) {\n var _ref$data = _ref.data;\n var previous = _ref$data.previous;\n var current = _ref$data.current;\n var offset = _ref$data.offset;\n var chunkSize = _ref$data.chunkSize;\n\n var data = new Uint8ClampedArray(previous.length);\n\n for (var i = offset; i < chunkSize; i += 4) {\n var pixel = (0, _getDiffPixel2.default)(previous.slice(i, i + 4), current.slice(i, i + 4));\n data[i + 0] = pixel[0]; // r\n data[i + 1] = pixel[1]; // g\n data[i + 2] = pixel[2]; // b\n data[i + 3] = pixel[3]; // a\n }\n self.postMessage(data);\n self.close();\n});//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvd29ya2Vycy9JbWFnZURpZmZXb3JrZXIuanM/ZjExYiJdLCJuYW1lcyI6WyJzZWxmIiwiYWRkRXZlbnRMaXN0ZW5lciIsImRhdGEiLCJwcmV2aW91cyIsImN1cnJlbnQiLCJvZmZzZXQiLCJjaHVua1NpemUiLCJVaW50OENsYW1wZWRBcnJheSIsImxlbmd0aCIsImkiLCJwaXhlbCIsInNsaWNlIiwicG9zdE1lc3NhZ2UiLCJjbG9zZSJdLCJtYXBwaW5ncyI6Ijs7QUFBQTs7Ozs7O0FBRUFBLEtBQUtDLGdCQUFMLENBQXNCLFNBQXRCLEVBQWlDLGdCQUt6QjtBQUFBLHVCQUw0QkMsSUFLNUI7QUFBQSxNQUpOQyxRQUlNLGFBSk5BLFFBSU07QUFBQSxNQUhOQyxPQUdNLGFBSE5BLE9BR007QUFBQSxNQUZOQyxNQUVNLGFBRk5BLE1BRU07QUFBQSxNQUROQyxTQUNNLGFBRE5BLFNBQ007O0FBQ04sTUFBTUosT0FBTyxJQUFJSyxpQkFBSixDQUFzQkosU0FBU0ssTUFBL0IsQ0FBYjs7QUFFQSxPQUFLLElBQUl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ZWwoXG4gICAgICBwcmV2aW91cy5zbGljZShpLCBpICsgNCksXG4gICAgICBjdXJyZW50LnNsaWNlKGksIGkgKyA0KVxuICAgICk7XG4gICAgZGF0YVtpICsgMF0gPSBwaXhlbFswXTsgLy8gclxuICAgIGRhdGFbaSArIDFdID0gcGl4ZWxbMV07IC8vIGdcbiAgICBkYXRhW2kgKyAyXSA9IHBpeGVsWzJdOyAvLyBiXG4gICAgZGF0YVtpICsgM10gPSBwaXhlbFszXTsgLy8gYVxuICB9XG4gIHNlbGYucG9zdE1lc3NhZ2UoZGF0YSk7XG4gIHNlbGYuY2xvc2UoKTtcbn0pO1xuXG5cblxuLyoqIFdFQlBBQ0sgRk9PVEVSICoqXG4gKiogLi9qcy9zcmMvd29ya2Vycy9JbWFnZURpZmZXb3JrZXIuanNcbiAqKi8iXSwic291cmNlUm9vdCI6IiJ9");
|
48
|
+
|
49
|
+
/***/ },
|
50
|
+
/* 1 */
|
51
|
+
/***/ function(module, exports, __webpack_require__) {
|
52
|
+
|
53
|
+
eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = getDiffPixel;\n\nvar _euclideanDistance = __webpack_require__(2);\n\nvar _euclideanDistance2 = _interopRequireDefault(_euclideanDistance);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction getDiffPixel(previousPixel, currentPixel) {\n if (!previousPixel) {\n return currentPixel;\n }\n\n if (!currentPixel) {\n return previousPixel;\n }\n\n var diff = (0, _euclideanDistance2.default)(previousPixel, currentPixel);\n if (diff === 0) {\n return [currentPixel[0], currentPixel[1], currentPixel[2], 50];\n }\n\n if (diff < 0.2) {\n diff = 0.2;\n }\n return [255, 0, 0, 255 * diff]; // TODO don't use red here\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvZ2V0RGlmZlBpeGVsLmpzPz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UGl4ZWwpIHtcbiAgICByZXR1cm4gcHJldmlvdXNQaXhlbDtcbiAgfVxuXG4gIGxldCBkaWZmID0gZXVjbGlkZWFuRGlzdGFuY2UocHJldmlvdXNQaXhlbCwgY3VycmVudFBpeGVsKTtcbiAgaWYgKGRpZmYgPT09IDApIHtcbiAgICByZXR1cm4gW1xuICAgICAgY3VycmVudFBpeGVsWzBdLFxuICAgICAgY3VycmVudFBpeGVsWzFdLFxuICAgICAgY3VycmVudFBpeGVsWzJdLFxuICAgICAgNTAsXG4gICAgXTtcbiAgfVxuXG4gIGlmIChkaWZmIDwgMC4yKSB7XG4gICAgZGlmZiA9IDAuMjtcbiAgfVxuICByZXR1cm4gWzI1NSwgMCwgMCwgMjU1ICogZGlmZl07IC8vIFRPRE8gZG9uJ3QgdXNlIHJlZCBoZXJlXG59XG5cblxuXG4vKiogV0VCUEFDSyBGT09URVIgKipcbiAqKiAuL2pzL3NyYy9nZXREaWZmUGl4ZWwuanNcbiAqKi8iXSwic291cmNlUm9vdCI6IiJ9");
|
54
|
+
|
55
|
+
/***/ },
|
56
|
+
/* 2 */
|
57
|
+
/***/ function(module, exports) {
|
58
|
+
|
59
|
+
eval("\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = euclideanDistance;\n/**\n * Compute a score that represents the difference between 2 pixels\n *\n * This method simply takes the Euclidean distance between the RGBA channels\n * of 2 colors over the maximum possible Euclidean distance. This gives us a\n * percentage of how different the two colors are.\n *\n * Although it would be more perceptually accurate to calculate a proper\n * Delta E in Lab colorspace, we probably don't need perceptual accuracy for\n * this application, and it is nice to avoid the overhead of converting RGBA\n * to Lab.\n *\n * Returns a float number between 0 and 1 where 1 is completely different\n * and 0 is no difference\n */\nfunction euclideanDistance(rgba1, rgba2) {\n var distance = (rgba1[0] - rgba2[0]) * (rgba1[0] - rgba2[0]) + (rgba1[1] - rgba2[1]) * (rgba1[1] - rgba2[1]) + (rgba1[2] - rgba2[2]) * (rgba1[2] -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gLSByZ2JhMlsxXSkpXG4gICAgICAgICAgICAgICAgICsgKChyZ2JhMVsyXSAtIHJnYmEyWzJdKSAqIChyZ2JhMVsyXSAtIHJnYmEyWzJdKSlcbiAgICAgICAgICAgICAgICAgKyAoKHJnYmExWzNdIC0gcmdiYTJbM10pICogKHJnYmExWzNdIC0gcmdiYTJbM10pKTtcblxuICByZXR1cm4gKE1hdGguc3FydChkaXN0YW5jZSkgLyA0KSAvIDI1NTtcbn1cblxuXG5cbi8qKiBXRUJQQUNLIEZPT1RFUiAqKlxuICoqIC4vanMvc3JjL2V1Y2xpZGVhbkRpc3RhbmNlLmpzXG4gKiovIl0sInNvdXJjZVJvb3QiOiIifQ==");
|
60
|
+
|
61
|
+
/***/ }
|
62
|
+
/******/ ]);
|
@@ -0,0 +1,62 @@
|
|
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\nvar _flattenImageData = __webpack_require__(2);\n\nvar _flattenImageData2 = _interopRequireDefault(_flattenImageData);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Construct a line of pixels of a certain rgba color\n *\n * @param {Array} rgba\n * @param {Number} width\n * @return {Array}\n */\nfunction constructColoredLine(rgba, width) {\n var line = [];\n for (var i = 0; i < width; i++) {\n line.push(rgba);\n }\n return line;\n}\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 var getPixelAt = function getPixelAt(x, y) {\n var startIndex = y * rowSize + x * 4;\n return [data[startIndex], data[startIndex + 1], data[startIndex + 2], data[startIndex + 3]];\n };\n\n var newData = [];\n for (var row = 0; row < height; row++) {\n var pixelsInRow = [];\n for (var col = 0; col < width; col++) {\n pixelsInRow.push(getPixelAt(col, row));\n }\n for (var pad = 0; pad < paddingRight; pad++) {\n pixelsInRow.push([0, 0, 0, 0]);\n }\n newData.push(pixelsInRow);\n }\n return newData;\n}\n\nfunction getAdiffResults(_ref2) {\n var previousData = _ref2.previousData;\n var currentData = _ref2.currentData;\n var previousImageData = _ref2.previousImageData;\n var currentImageData = _ref2.currentImageData;\n\n if (previousData.width !== currentData.width) {\n // we know that all rows will be different here, so we can take a shortcut\n var diff = [0, // diff starts at index 0\n previousData.height];\n diff.length = currentData.height + 2; // number of additions\n }\n return _adiff2.default.diff(previousImageData.map(function (d) {\n return btoa(d);\n }), currentImageData.map(function (d) {\n return btoa(d);\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 redLine = constructColoredLine([255, 0, 0, 255], maxWidth);\n var greenLine = constructColoredLine([0, 255, 0, 255], maxWidth);\n\n var previousImageData = imageTo2DArray(previousData, maxWidth - previousData.width);\n\n var currentImageData = imageTo2DArray(currentData, maxWidth - currentData.width);\n\n var adiffResults = getAdiffResults({\n previousData: previousData,\n currentData: currentData,\n previousImageData: previousImageData,\n currentImageData: currentImageData\n });\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 // add a green line to signal an addition\n previousImageData.splice(atIndex + y, 0, greenLine);\n }\n }\n });\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 // add a red line to signal a deletion\n currentImageData.splice(atIndex + y, 0, redLine);\n }\n }\n }\n\n return {\n currentData: {\n data: (0, _flattenImageData2.default)(currentImageData),\n height: currentImageData.length,\n width: maxWidth\n },\n previousData: {\n data: (0, _flattenImageData2.default)(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/ZGRiNSJdLCJuYW1lcyI6WyJjb25zdHJ1Y3RDb2xvcmVkTGluZSIsInJnYmEiLCJ3aWR0aCIsImxpbmUiLCJpIiwicHVzaCIsImltYWdlVG8yREFycmF5IiwicGFkZGluZ1JpZ2h0IiwiZGF0YSIsImhlaWdodCIsInJvd1NpemUiLCJnZXRQaXhlbEF0IiwieCIsInkiLCJzdGFydEluZGV4IiwibmV3RGF0YSIsInJvdyIsInBpeGVsc0luUm93IiwiY29sIiwicGFkIiwiZ2V0QWRpZmZSZXN1bHRzIiwicHJldmlvdXNEYXRhIiwiY3VycmVudERhdGEiLCJwcmV2aW91c0ltYWdlRGF0YSIsImN1cnJlbnRJbWFnZURhdGEiLCJkaWZmIiwibGVuZ3RoIiwibWFwIiwiYnRvYSIsImQiLCJjb21wdXRlQW5kSW5qZWN0RGlmZnMiLCJtYXhXaWR0aCIsIk1hdGgiLCJtYXgiLCJyZWRMaW5lIiwiZ3JlZW5MaW5lIiwiYWRpZmZSZXN1bHRzIiwiZm9yRWFjaCIsImluc3RydWN0aW9uIiwiYXRJbmRleCIsImRlbGV0ZWRJdGVtcyIsImFkZGVkSXRlbXMiLCJzcGxpY2UiLCJzZWxmIiwiYWRkRXZlbnRMaXN0ZW5lciIsInJlc3VsdCIsInBvc3RNZXNzYWdlIiwiY2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ICsgeSwgMCwgcmVkTGluZSk7XG4gICAgICB9XG4gICAgfVxuICB9XG5cbiAgcmV0dXJuIHtcbiAgICBjdXJyZW50RGF0YToge1xuICAgICAgZGF0YTogZmxhdHRlbkltYWdlRGF0YShjdXJyZW50SW1hZ2VEYXRhKSxcbiAgICAgIGhlaWdodDogY3VycmVudEltYWdlRGF0YS5sZW5ndGgsXG4gICAgICB3aWR0aDogbWF4V2lkdGgsXG4gICAgfSxcbiAgICBwcmV2aW91c0RhdGE6IHtcbiAgICAgIGRhdGE6IGZsYXR0ZW5JbWFnZURhdGEocHJldmlvdXNJbWFnZURhdGEpLFxuICAgICAgaGVpZ2h0OiBwcmV2aW91c0ltYWdlRGF0YS5sZW5ndGgsXG4gICAgICB3aWR0aDogbWF4V2lkdGgsXG4gICAgfSxcbiAgfTtcbn1cblxuc2VsZi5hZGRFdmVudExpc3RlbmVyKCdtZXNzYWdlJywgKHsgZGF0YTogeyBwcmV2aW91c0RhdGEsIGN1cnJlbnREYXRhIH0gfSkgPT4ge1xuICBjb25zdCByZXN1bHQgPSBjb21wdXRlQW5kSW5qZWN0RGlmZnMoeyBwcmV2aW91c0RhdGEsIGN1cnJlbnREYXRhIH0pO1xuICBzZWxmLnBvc3RNZXNzYWdlKHJlc3VsdCk7XG4gIHNlbGYuY2xvc2UoKTtcbn0pO1xuXG5cblxuLyoqIFdFQlBBQ0sgRk9PVEVSICoqXG4gKiogLi9qcy9zcmMvd29ya2Vycy9Db21wdXRlQW5kSW5qZWN0RGlmZnNXb3JrZXIuanNcbiAqKi8iXSwic291cmNlUm9vdCI6IiJ9");
|
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+L2FkaWZmL2luZGV4LmpzPzA0ZDYiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBLGNBQWMsYUFBYTtBQUMzQjtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSxHQUFHO0FBQ0g7O0FBRUE7QUFDQTtBQUNBOzs7QUFHQTs7QUFFQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsbUJBQW1CLGdCQUFnQjtBQUNuQztBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLHlCO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBLGtCQUFrQjtBQUNsQjtBQUNBLE9BQU87QUF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aWN0ID0gWyc+Pj4+Pj4+Pj4+Pj4+Pj4+J11cbiAgICB3aGlsZShjaGFuZ2VzLmxlbmd0aClcbiAgICAgIGNvbmZsaWN0ID0gY29uZmxpY3QuY29uY2F0KGNoYW5nZXMuc2hpZnQoKSkuY29uY2F0KCc9PT09PT09PT09PT0nKVxuICAgIGNvbmZsaWN0LnBvcCgpXG4gICAgY29uZmxpY3QucHVzaCAgICAgICAgICAoJzw8PDw8PDw8PDw8PDw8PCcpXG4gICAgY2hhbmdlcy51bnNoaWZ0ICAgICAgICgnPj4+Pj4+Pj4+Pj4+Pj4+JylcbiAgICByZXR1cm4gY29uZmxpY3QqL1xuICAgIC8vbmFoLCBiZXR0ZXIgaXMganVzdCB0byB1c2UgYW4gZXF1YWwgY2FuIGhhbmRsZSBvYmplY3RzXG4gICAgcmV0dXJuIHsnPyc6IGNoYW5nZXN9XG4gIH1cbiAgcmV0dXJuIGV4cG9ydHNcbn1cbmV4cG9ydHMobnVsbCwgZXhwb3J0cylcblxuXG5cbi8qKioqKioqKioqKioqKioqKlxuICoqIFdFQlBBQ0sgRk9PVEVSXG4gKiogLi9+L2FkaWZmL2luZGV4LmpzXG4gKiogbW9kdWxlIGlkID0gMVxuICoqIG1vZHVsZSBjaHVua3MgPSAwXG4gKiovIl0sInNvdXJjZVJvb3QiOiIifQ==");
|
54
|
+
|
55
|
+
/***/ },
|
56
|
+
/* 2 */
|
57
|
+
/***/ function(module, exports) {
|
58
|
+
|
59
|
+
eval("\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = flattenImageData;\n/**\n * @param {Array} imageData a 2d array\n * @return {Uint8ClampedArray}\n */\nfunction flattenImageData(imageData) {\n var width = imageData[0].length;\n var result = new Uint8ClampedArray(imageData.length * width * 4);\n imageData.forEach(function (row, y) {\n row.forEach(function (pixel, x) {\n var index = y * width * 4 + x * 4;\n result[index] = pixel[0];\n result[index + 1] = pixel[1];\n result[index + 2] = pixel[2];\n result[index + 3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UFDRCIsImZpbGUiOiIyLmpzIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBAcGFyYW0ge0FycmF5fSBpbWFnZURhdGEgYSAyZCBhcnJheVxuICogQHJldHVybiB7VWludDhDbGFtcGVkQXJyYXl9XG4gKi9cbmV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIGZsYXR0ZW5JbWFnZURhdGEoaW1hZ2VEYXRhKSB7XG4gIGNvbnN0IHdpZHRoID0gaW1hZ2VEYXRhWzBdLmxlbmd0aDtcbiAgY29uc3QgcmVzdWx0ID0gbmV3IFVpbnQ4Q2xhbXBlZEFycmF5KGltYWdlRGF0YS5sZW5ndGggKiB3aWR0aCAqIDQpO1xuICBpbWFnZURhdGEuZm9yRWFjaCgocm93LCB5KSA9PiB7XG4gICAgcm93LmZvckVhY2goKHBpeGVsLCB4KSA9PiB7XG4gICAgICBjb25zdCBpbmRleCA9ICh5ICogd2lkdGggKiA0KSArICh4ICogNCk7XG4gICAgICByZXN1bHRbaW5kZXhdID0gcGl4ZWxbMF07XG4gICAgICByZXN1bHRbaW5kZXggKyAxXSA9IHBpeGVsWzFdO1xuICAgICAgcmVzdWx0W2luZGV4ICsgMl0gPSBwaXhlbFsyXTtcbiAgICAgIHJlc3VsdFtpbmRleCArIDNdID0gcGl4ZWxbM107XG4gICAgfSk7XG4gIH0pO1xuICByZXR1cm4gcmVzdWx0O1xufVxuXG5cblxuLyoqIFdFQlBBQ0sgRk9PVEVSICoqXG4gKiogLi9qcy9zcmMvZmxhdHRlbkltYWdlRGF0YS5qc1xuICoqLyJdLCJzb3VyY2VSb290IjoiIn0=");
|
60
|
+
|
61
|
+
/***/ }
|
62
|
+
/******/ ]);
|
@@ -0,0 +1,62 @@
|
|
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\nvar _flattenImageData = __webpack_require__(2);\n\nvar _flattenImageData2 = _interopRequireDefault(_flattenImageData);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Construct a line of pixels of a certain rgba color\n *\n * @param {Array} rgba\n * @param {Number} width\n * @return {Array}\n */\nfunction constructColoredLine(rgba, width) {\n var line = [];\n for (var i = 0; i < width; i++) {\n line.push(rgba);\n }\n return line;\n}\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 var getPixelAt = function getPixelAt(x, y) {\n var startIndex = y * rowSize + x * 4;\n return [data[startIndex], data[startIndex + 1], data[startIndex + 2], data[startIndex + 3]];\n };\n\n var newData = [];\n for (var row = 0; row < height; row++) {\n var pixelsInRow = [];\n for (var col = 0; col < width; col++) {\n pixelsInRow.push(getPixelAt(col, row));\n }\n for (var pad = 0; pad < paddingRight; pad++) {\n pixelsInRow.push([0, 0, 0, 0]);\n }\n newData.push(pixelsInRow);\n }\n return newData;\n}\n\nfunction getAdiffResults(_ref2) {\n var previousData = _ref2.previousData;\n var currentData = _ref2.currentData;\n var previousImageData = _ref2.previousImageData;\n var currentImageData = _ref2.currentImageData;\n\n var adiffResults = void 0;\n if (previousData.width !== currentData.width) {\n // we know that all rows will be different here, so we can take a shortcut\n return [0, // diff starts at index 0\n previousData.height, // number of deletions\n { length: currentData.height }];\n }\n return _adiff2.default.diff(previousImageData.map(function (d) {\n return btoa(d);\n }), currentImageData.map(function (d) {\n return btoa(d);\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 redLine = constructColoredLine([255, 0, 0, 255], maxWidth);\n var greenLine = constructColoredLine([0, 255, 0, 255], maxWidth);\n\n var previousImageData = imageTo2DArray(previousData, maxWidth - previousData.width);\n\n var currentImageData = imageTo2DArray(currentData, maxWidth - currentData.width);\n\n var adiffResults = getAdiffResults({\n previousData: previousData,\n currentData: currentData,\n previousImageData: previousImageData,\n currentImageData: currentImageData\n });\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 // add a green line to signal an addition\n previousImageData.splice(atIndex + y, 0, greenLine);\n }\n }\n });\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 // add a red line to signal a deletion\n currentImageData.splice(atIndex + y, 0, redLine);\n }\n }\n }\n\n return {\n currentData: {\n data: (0, _flattenImageData2.default)(currentImageData),\n height: currentImageData.length,\n width: maxWidth\n },\n previousData: {\n data: (0, _flattenImageData2.default)(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/ZGRiNSJdLCJuYW1lcyI6WyJjb25zdHJ1Y3RDb2xvcmVkTGluZSIsInJnYmEiLCJ3aWR0aCIsImxpbmUiLCJpIiwicHVzaCIsImltYWdlVG8yREFycmF5IiwicGFkZGluZ1JpZ2h0IiwiZGF0YSIsImhlaWdodCIsInJvd1NpemUiLCJnZXRQaXhlbEF0IiwieCIsInki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RhLCBjdXJyZW50RGF0YSB9IH0pID0+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+L2FkaWZmL2luZGV4LmpzPzA0ZDYiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBLGNBQWMsYUFBYTtBQUMzQjtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSxHQUFHO0FBQ0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VsbCwgZXhwb3J0cylcblxuXG5cbi8qKioqKioqKioqKioqKioqKlxuICoqIFdFQlBBQ0sgRk9PVEVSXG4gKiogLi9+L2FkaWZmL2luZGV4LmpzXG4gKiogbW9kdWxlIGlkID0gMVxuICoqIG1vZHVsZSBjaHVua3MgPSAwXG4gKiovIl0sInNvdXJjZVJvb3QiOiIifQ==");
|
54
|
+
|
55
|
+
/***/ },
|
56
|
+
/* 2 */
|
57
|
+
/***/ function(module, exports) {
|
58
|
+
|
59
|
+
eval("\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = flattenImageData;\n/**\n * @param {Array} imageData a 2d array\n * @return {Uint8ClampedArray}\n */\nfunction flattenImageData(imageData) {\n var width = imageData[0].length;\n var result = new Uint8ClampedArray(imageData.length * width * 4);\n imageData.forEach(function (row, y) {\n row.forEach(function (pixel, x) {\n var index = y * width * 4 + x * 4;\n result[index] = pixel[0];\n result[index + 1] = pixel[1];\n result[index + 2] = pixel[2];\n result[index + 3] = pixel[3];\n });\n });\n return result;\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvZmxhdHRlbkltYWdlRGF0YS5qcz8yZGRiIl0sIm5hbWVzIjpbImZsYXR0ZW5JbWFnZURhdGEiLCJpbWFnZURhdGEiLCJ3aWR0aCIsImxlbmd0aCIsInJlc3VsdCIsIlVpbnQ4Q2xhbXBlZEFycmF5IiwiZm9yRWFjaCIsInJvdyIsInkiLCJwaXhlbCIsIngiLCJpbmRleCJdLCJtYXBwaW5ncyI6Ijs7Ozs7a0JBSXdCQSxnQjtBQUp4Qjs7OztBQUllLFNBQVNBLGdCQUFULENBQTBCQyxTQUExQixFQUFxQztBQUNsRCxNQUFNQyxRQUFRRCxVQUFVLENBQVYsRUFBYUUsTUFBM0I7QUFDQSxNQUFNQyxTQUFTLElBQUlDLGlCQUFKLENBQXNCSixVQ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