htmldiff-js-ie11
Version:
JavaScript port of HtmlDiff.Net which is itself a C# port of HtmlDiff (IE11 compatible fork)
1,692 lines (1,349 loc) • 117 kB
JavaScript
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/dist/";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 100);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
var store = __webpack_require__(42)('wks');
var uid = __webpack_require__(23);
var Symbol = __webpack_require__(3).Symbol;
var USE_SYMBOL = typeof Symbol == 'function';
var $exports = module.exports = function (name) {
return store[name] || (store[name] =
USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
};
$exports.store = store;
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
var anObject = __webpack_require__(8);
var IE8_DOM_DEFINE = __webpack_require__(91);
var toPrimitive = __webpack_require__(90);
var dP = Object.defineProperty;
exports.f = __webpack_require__(2) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
anObject(O);
P = toPrimitive(P, true);
anObject(Attributes);
if (IE8_DOM_DEFINE) try {
return dP(O, P, Attributes);
} catch (e) { /* empty */ }
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
if ('value' in Attributes) O[P] = Attributes.value;
return O;
};
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
// Thank's IE8 for his funny defineProperty
module.exports = !__webpack_require__(15)(function () {
return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
});
/***/ }),
/* 3 */
/***/ (function(module, exports) {
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global = module.exports = typeof window != 'undefined' && window.Math == Math
? window : typeof self != 'undefined' && self.Math == Math ? self
// eslint-disable-next-line no-new-func
: Function('return this')();
if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
/***/ }),
/* 4 */
/***/ (function(module, exports) {
module.exports = function (it) {
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
var dP = __webpack_require__(1);
var createDesc = __webpack_require__(26);
module.exports = __webpack_require__(2) ? function (object, key, value) {
return dP.f(object, key, createDesc(1, value));
} : function (object, key, value) {
object[key] = value;
return object;
};
/***/ }),
/* 6 */
/***/ (function(module, exports) {
var core = module.exports = { version: '2.5.3' };
if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(3);
var core = __webpack_require__(6);
var ctx = __webpack_require__(9);
var hide = __webpack_require__(5);
var PROTOTYPE = 'prototype';
var $export = function (type, name, source) {
var IS_FORCED = type & $export.F;
var IS_GLOBAL = type & $export.G;
var IS_STATIC = type & $export.S;
var IS_PROTO = type & $export.P;
var IS_BIND = type & $export.B;
var IS_WRAP = type & $export.W;
var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
var expProto = exports[PROTOTYPE];
var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];
var key, own, out;
if (IS_GLOBAL) source = name;
for (key in source) {
// contains in native
own = !IS_FORCED && target && target[key] !== undefined;
if (own && key in exports) continue;
// export native or passed
out = own ? target[key] : source[key];
// prevent global pollution for namespaces
exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
// bind timers to global for call from export context
: IS_BIND && own ? ctx(out, global)
// wrap global constructors for prevent change them in library
: IS_WRAP && target[key] == out ? (function (C) {
var F = function (a, b, c) {
if (this instanceof C) {
switch (arguments.length) {
case 0: return new C();
case 1: return new C(a);
case 2: return new C(a, b);
} return new C(a, b, c);
} return C.apply(this, arguments);
};
F[PROTOTYPE] = C[PROTOTYPE];
return F;
// make static versions for prototype methods
})(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
// export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
if (IS_PROTO) {
(exports.virtual || (exports.virtual = {}))[key] = out;
// export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);
}
}
};
// type bitmap
$export.F = 1; // forced
$export.G = 2; // global
$export.S = 4; // static
$export.P = 8; // proto
$export.B = 16; // bind
$export.W = 32; // wrap
$export.U = 64; // safe
$export.R = 128; // real proto method for `library`
module.exports = $export;
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(4);
module.exports = function (it) {
if (!isObject(it)) throw TypeError(it + ' is not an object!');
return it;
};
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
// optional / simple context binding
var aFunction = __webpack_require__(45);
module.exports = function (fn, that, length) {
aFunction(fn);
if (that === undefined) return fn;
switch (length) {
case 1: return function (a) {
return fn.call(that, a);
};
case 2: return function (a, b) {
return fn.call(that, a, b);
};
case 3: return function (a, b, c) {
return fn.call(that, a, b, c);
};
}
return function (/* ...args */) {
return fn.apply(that, arguments);
};
};
/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.default = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
/***/ }),
/* 11 */
/***/ (function(module, exports) {
var hasOwnProperty = {}.hasOwnProperty;
module.exports = function (it, key) {
return hasOwnProperty.call(it, key);
};
/***/ }),
/* 12 */
/***/ (function(module, exports) {
module.exports = {};
/***/ }),
/* 13 */
/***/ (function(module, exports, __webpack_require__) {
var ctx = __webpack_require__(9);
var call = __webpack_require__(37);
var isArrayIter = __webpack_require__(36);
var anObject = __webpack_require__(8);
var toLength = __webpack_require__(14);
var getIterFn = __webpack_require__(19);
var BREAK = {};
var RETURN = {};
var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {
var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable);
var f = ctx(fn, that, entries ? 2 : 1);
var index = 0;
var length, step, iterator, result;
if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');
// fast case for arrays with default iterator
if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) {
result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
if (result === BREAK || result === RETURN) return result;
} else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {
result = call(iterator, f, step.value, entries);
if (result === BREAK || result === RETURN) return result;
}
};
exports.BREAK = BREAK;
exports.RETURN = RETURN;
/***/ }),
/* 14 */
/***/ (function(module, exports, __webpack_require__) {
// 7.1.15 ToLength
var toInteger = __webpack_require__(25);
var min = Math.min;
module.exports = function (it) {
return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
};
/***/ }),
/* 15 */
/***/ (function(module, exports) {
module.exports = function (exec) {
try {
return !!exec();
} catch (e) {
return true;
}
};
/***/ }),
/* 16 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var tagRegex = /^\s*<\/?[^>]+>\s*$/;
var tagWordRegex = /<[^\s>]+/;
var whitespaceRegex = /^(\s| )+$/;
var wordRegex = /[\w\#@]+/;
var specialCaseWordTags = ['<img'];
function isTag(item) {
if (specialCaseWordTags.some(function (re) {
return item !== null && item.startsWith(re);
})) {
return false;
}
return tagRegex.test(item);
}
function stripTagAttributes(word) {
var tag = tagWordRegex.exec(word)[0];
word = tag + (word.endsWith("/>") ? "/>" : ">");
return word;
}
function wrapText(text, tagName, cssClass) {
return ['<', tagName, ' class="', cssClass, '">', text, '</', tagName, '>'].join('');
}
function isStartOfTag(val) {
return val === '<';
}
function isEndOfTag(val) {
return val === '>';
}
function isStartOfEntity(val) {
return val === '&';
}
function isEndOfEntity(val) {
return val === ';';
}
function isWhiteSpace(value) {
return whitespaceRegex.test(value);
}
function stripAnyAttributes(word) {
if (isTag(word)) {
return stripTagAttributes(word);
}
return word;
}
function isWord(text) {
return wordRegex.test(text);
}
exports.isTag = isTag;
exports.stripTagAttributes = stripTagAttributes;
exports.wrapText = wrapText;
exports.isStartOfTag = isStartOfTag;
exports.isEndOfTag = isEndOfTag;
exports.isStartOfEntity = isStartOfEntity;
exports.isEndOfEntity = isEndOfEntity;
exports.isWhiteSpace = isWhiteSpace;
exports.stripAnyAttributes = stripAnyAttributes;
exports.isWord = isWord;
/***/ }),
/* 17 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(75), __esModule: true };
/***/ }),
/* 18 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _defineProperty = __webpack_require__(78);
var _defineProperty2 = _interopRequireDefault(_defineProperty);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
(0, _defineProperty2.default)(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {
var classof = __webpack_require__(40);
var ITERATOR = __webpack_require__(0)('iterator');
var Iterators = __webpack_require__(12);
module.exports = __webpack_require__(6).getIteratorMethod = function (it) {
if (it != undefined) return it[ITERATOR]
|| it['@@iterator']
|| Iterators[classof(it)];
};
/***/ }),
/* 20 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var $at = __webpack_require__(80)(true);
// 21.1.3.27 String.prototype[@@iterator]()
__webpack_require__(27)(String, 'String', function (iterated) {
this._t = String(iterated); // target
this._i = 0; // next index
// 21.1.5.2.1 %StringIteratorPrototype%.next()
}, function () {
var O = this._t;
var index = this._i;
var point;
if (index >= O.length) return { value: undefined, done: true };
point = $at(O, index);
this._i += point.length;
return { value: point, done: false };
});
/***/ }),
/* 21 */
/***/ (function(module, exports, __webpack_require__) {
// 7.1.13 ToObject(argument)
var defined = __webpack_require__(28);
module.exports = function (it) {
return Object(defined(it));
};
/***/ }),
/* 22 */
/***/ (function(module, exports, __webpack_require__) {
var def = __webpack_require__(1).f;
var has = __webpack_require__(11);
var TAG = __webpack_require__(0)('toStringTag');
module.exports = function (it, tag, stat) {
if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
};
/***/ }),
/* 23 */
/***/ (function(module, exports) {
var id = 0;
var px = Math.random();
module.exports = function (key) {
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
};
/***/ }),
/* 24 */
/***/ (function(module, exports, __webpack_require__) {
var shared = __webpack_require__(42)('keys');
var uid = __webpack_require__(23);
module.exports = function (key) {
return shared[key] || (shared[key] = uid(key));
};
/***/ }),
/* 25 */
/***/ (function(module, exports) {
// 7.1.4 ToInteger
var ceil = Math.ceil;
var floor = Math.floor;
module.exports = function (it) {
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
};
/***/ }),
/* 26 */
/***/ (function(module, exports) {
module.exports = function (bitmap, value) {
return {
enumerable: !(bitmap & 1),
configurable: !(bitmap & 2),
writable: !(bitmap & 4),
value: value
};
};
/***/ }),
/* 27 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var LIBRARY = __webpack_require__(92);
var $export = __webpack_require__(7);
var redefine = __webpack_require__(89);
var hide = __webpack_require__(5);
var has = __webpack_require__(11);
var Iterators = __webpack_require__(12);
var $iterCreate = __webpack_require__(88);
var setToStringTag = __webpack_require__(22);
var getPrototypeOf = __webpack_require__(81);
var ITERATOR = __webpack_require__(0)('iterator');
var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
var FF_ITERATOR = '@@iterator';
var KEYS = 'keys';
var VALUES = 'values';
var returnThis = function () { return this; };
module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
$iterCreate(Constructor, NAME, next);
var getMethod = function (kind) {
if (!BUGGY && kind in proto) return proto[kind];
switch (kind) {
case KEYS: return function keys() { return new Constructor(this, kind); };
case VALUES: return function values() { return new Constructor(this, kind); };
} return function entries() { return new Constructor(this, kind); };
};
var TAG = NAME + ' Iterator';
var DEF_VALUES = DEFAULT == VALUES;
var VALUES_BUG = false;
var proto = Base.prototype;
var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
var $default = (!BUGGY && $native) || getMethod(DEFAULT);
var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
var methods, key, IteratorPrototype;
// Fix native
if ($anyNative) {
IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));
if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
// Set @@toStringTag to native iterators
setToStringTag(IteratorPrototype, TAG, true);
// fix for some old engines
if (!LIBRARY && !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis);
}
}
// fix Array#{values, @@iterator}.name in V8 / FF
if (DEF_VALUES && $native && $native.name !== VALUES) {
VALUES_BUG = true;
$default = function values() { return $native.call(this); };
}
// Define iterator
if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
hide(proto, ITERATOR, $default);
}
// Plug for library
Iterators[NAME] = $default;
Iterators[TAG] = returnThis;
if (DEFAULT) {
methods = {
values: DEF_VALUES ? $default : getMethod(VALUES),
keys: IS_SET ? $default : getMethod(KEYS),
entries: $entries
};
if (FORCED) for (key in methods) {
if (!(key in proto)) redefine(proto, key, methods[key]);
} else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
}
return methods;
};
/***/ }),
/* 28 */
/***/ (function(module, exports) {
// 7.2.1 RequireObjectCoercible(argument)
module.exports = function (it) {
if (it == undefined) throw TypeError("Can't call method on " + it);
return it;
};
/***/ }),
/* 29 */
/***/ (function(module, exports) {
var toString = {}.toString;
module.exports = function (it) {
return toString.call(it).slice(8, -1);
};
/***/ }),
/* 30 */
/***/ (function(module, exports, __webpack_require__) {
// to indexed object, toObject with fallback for non-array-like ES3 strings
var IObject = __webpack_require__(46);
var defined = __webpack_require__(28);
module.exports = function (it) {
return IObject(defined(it));
};
/***/ }),
/* 31 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(95), __esModule: true };
/***/ }),
/* 32 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _classCallCheck2 = __webpack_require__(10);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var MatchOptions = function MatchOptions() {
(0, _classCallCheck3.default)(this, MatchOptions);
this.blockSize = 0;
this.repeatingWordsAccuracy = 0.0;
this.ignoreWhitespaceDifferences = false;
};
exports.default = MatchOptions;
/***/ }),
/* 33 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _classCallCheck2 = __webpack_require__(10);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = __webpack_require__(18);
var _createClass3 = _interopRequireDefault(_createClass2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var Match = function () {
function Match(startInOld, startInNew, size) {
(0, _classCallCheck3.default)(this, Match);
this.startInOld = startInOld;
this.startInNew = startInNew;
this.size = size;
}
(0, _createClass3.default)(Match, [{
key: "endInOld",
get: function get() {
return this.startInOld + this.size;
}
}, {
key: "endInNew",
get: function get() {
return this.startInNew + this.size;
}
}]);
return Match;
}();
exports.default = Match;
;
/***/ }),
/* 34 */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(4);
module.exports = function (it, TYPE) {
if (!isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!');
return it;
};
/***/ }),
/* 35 */
/***/ (function(module, exports, __webpack_require__) {
var META = __webpack_require__(23)('meta');
var isObject = __webpack_require__(4);
var has = __webpack_require__(11);
var setDesc = __webpack_require__(1).f;
var id = 0;
var isExtensible = Object.isExtensible || function () {
return true;
};
var FREEZE = !__webpack_require__(15)(function () {
return isExtensible(Object.preventExtensions({}));
});
var setMeta = function (it) {
setDesc(it, META, { value: {
i: 'O' + ++id, // object ID
w: {} // weak collections IDs
} });
};
var fastKey = function (it, create) {
// return primitive with prefix
if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
if (!has(it, META)) {
// can't set metadata to uncaught frozen object
if (!isExtensible(it)) return 'F';
// not necessary to add metadata
if (!create) return 'E';
// add missing metadata
setMeta(it);
// return object ID
} return it[META].i;
};
var getWeak = function (it, create) {
if (!has(it, META)) {
// can't set metadata to uncaught frozen object
if (!isExtensible(it)) return true;
// not necessary to add metadata
if (!create) return false;
// add missing metadata
setMeta(it);
// return hash weak collections IDs
} return it[META].w;
};
// add metadata on freeze-family methods calling
var onFreeze = function (it) {
if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);
return it;
};
var meta = module.exports = {
KEY: META,
NEED: false,
fastKey: fastKey,
getWeak: getWeak,
onFreeze: onFreeze
};
/***/ }),
/* 36 */
/***/ (function(module, exports, __webpack_require__) {
// check on default Array iterator
var Iterators = __webpack_require__(12);
var ITERATOR = __webpack_require__(0)('iterator');
var ArrayProto = Array.prototype;
module.exports = function (it) {
return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
};
/***/ }),
/* 37 */
/***/ (function(module, exports, __webpack_require__) {
// call something on iterator step with safe closing on error
var anObject = __webpack_require__(8);
module.exports = function (iterator, fn, value, entries) {
try {
return entries ? fn(anObject(value)[0], value[1]) : fn(value);
// 7.4.6 IteratorClose(iterator, completion)
} catch (e) {
var ret = iterator['return'];
if (ret !== undefined) anObject(ret.call(iterator));
throw e;
}
};
/***/ }),
/* 38 */
/***/ (function(module, exports) {
module.exports = function (it, Constructor, name, forbiddenField) {
if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {
throw TypeError(name + ': incorrect invocation!');
} return it;
};
/***/ }),
/* 39 */
/***/ (function(module, exports, __webpack_require__) {
var hide = __webpack_require__(5);
module.exports = function (target, src, safe) {
for (var key in src) {
if (safe && target[key]) target[key] = src[key];
else hide(target, key, src[key]);
} return target;
};
/***/ }),
/* 40 */
/***/ (function(module, exports, __webpack_require__) {
// getting tag from 19.1.3.6 Object.prototype.toString()
var cof = __webpack_require__(29);
var TAG = __webpack_require__(0)('toStringTag');
// ES3 wrong here
var ARG = cof(function () { return arguments; }()) == 'Arguments';
// fallback for IE11 Script Access Denied error
var tryGet = function (it, key) {
try {
return it[key];
} catch (e) { /* empty */ }
};
module.exports = function (it) {
var O, T, B;
return it === undefined ? 'Undefined' : it === null ? 'Null'
// @@toStringTag case
: typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
// builtinTag case
: ARG ? cof(O)
// ES3 arguments fallback
: (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
};
/***/ }),
/* 41 */
/***/ (function(module, exports) {
// IE 8- don't enum bug keys
module.exports = (
'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
).split(',');
/***/ }),
/* 42 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(3);
var SHARED = '__core-js_shared__';
var store = global[SHARED] || (global[SHARED] = {});
module.exports = function (key) {
return store[key] || (store[key] = {});
};
/***/ }),
/* 43 */
/***/ (function(module, exports, __webpack_require__) {
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
var anObject = __webpack_require__(8);
var dPs = __webpack_require__(87);
var enumBugKeys = __webpack_require__(41);
var IE_PROTO = __webpack_require__(24)('IE_PROTO');
var Empty = function () { /* empty */ };
var PROTOTYPE = 'prototype';
// Create object with fake `null` prototype: use iframe Object with cleared prototype
var createDict = function () {
// Thrash, waste and sodomy: IE GC bug
var iframe = __webpack_require__(44)('iframe');
var i = enumBugKeys.length;
var lt = '<';
var gt = '>';
var iframeDocument;
iframe.style.display = 'none';
__webpack_require__(82).appendChild(iframe);
iframe.src = 'javascript:'; // eslint-disable-line no-script-url
// createDict = iframe.contentWindow.Object;
// html.removeChild(iframe);
iframeDocument = iframe.contentWindow.document;
iframeDocument.open();
iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
iframeDocument.close();
createDict = iframeDocument.F;
while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];
return createDict();
};
module.exports = Object.create || function create(O, Properties) {
var result;
if (O !== null) {
Empty[PROTOTYPE] = anObject(O);
result = new Empty();
Empty[PROTOTYPE] = null;
// add "__proto__" for Object.getPrototypeOf polyfill
result[IE_PROTO] = O;
} else result = createDict();
return Properties === undefined ? result : dPs(result, Properties);
};
/***/ }),
/* 44 */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(4);
var document = __webpack_require__(3).document;
// typeof document.createElement is 'object' in old IE
var is = isObject(document) && isObject(document.createElement);
module.exports = function (it) {
return is ? document.createElement(it) : {};
};
/***/ }),
/* 45 */
/***/ (function(module, exports) {
module.exports = function (it) {
if (typeof it != 'function') throw TypeError(it + ' is not a function!');
return it;
};
/***/ }),
/* 46 */
/***/ (function(module, exports, __webpack_require__) {
// fallback for non-array-like ES3 and non-enumerable old V8 strings
var cof = __webpack_require__(29);
// eslint-disable-next-line no-prototype-builtins
module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
return cof(it) == 'String' ? it.split('') : Object(it);
};
/***/ }),
/* 47 */
/***/ (function(module, exports) {
module.exports = function (done, value) {
return { value: value, done: !!done };
};
/***/ }),
/* 48 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(94);
var global = __webpack_require__(3);
var hide = __webpack_require__(5);
var Iterators = __webpack_require__(12);
var TO_STRING_TAG = __webpack_require__(0)('toStringTag');
var DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' +
'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' +
'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' +
'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' +
'TextTrackList,TouchList').split(',');
for (var i = 0; i < DOMIterables.length; i++) {
var NAME = DOMIterables[i];
var Collection = global[NAME];
var proto = Collection && Collection.prototype;
if (proto && !proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);
Iterators[NAME] = Iterators.Array;
}
/***/ }),
/* 49 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var Mode = {
character: 0,
tag: 1,
whitespace: 2,
entity: 3
};
exports.default = Mode;
/***/ }),
/* 50 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.convertHtmlToListOfWords = undefined;
var _getIterator2 = __webpack_require__(31);
var _getIterator3 = _interopRequireDefault(_getIterator2);
var _map = __webpack_require__(17);
var _map2 = _interopRequireDefault(_map);
var _Mode = __webpack_require__(49);
var _Mode2 = _interopRequireDefault(_Mode);
var _Utils = __webpack_require__(16);
var Utils = _interopRequireWildcard(_Utils);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function convertHtmlToListOfWords(text, blockExpressions) {
var state = {
mode: _Mode2.default.character,
currentWord: [],
words: []
};
var blockLocations = findBlocks(text, blockExpressions);
var isBlockCheckRequired = !!blockLocations.size;
var isGrouping = false;
var groupingUntil = -1;
for (var i = 0; i < text.length; i++) {
var character = text[i];
// Don't bother executing block checks if we don't have any blocks to check for!
if (isBlockCheckRequired) {
// Check if we have completed grouping a text sequence/block
if (groupingUntil === index) {
groupingUntil = -1;
isGrouping = false;
}
// Check if we need to group the next text sequence/block
var until = 0;
if (blockLocations.has(index)) {
until = blockLocations.get(index);
isGrouping = true;
groupingUntil = until;
}
// if we are grouping, then we don't care about what type of character we have, it's going to be treated as a word
if (isGrouping) {
state.currentWord.push(character);
state.mode = _Mode2.default.character;
continue;
}
}
switch (state.mode) {
case _Mode2.default.character:
if (Utils.isStartOfTag(character)) {
addClearWordSwitchMode(state, '<', _Mode2.default.tag);
} else if (Utils.isStartOfEntity(character)) {
addClearWordSwitchMode(state, character, _Mode2.default.entity);
} else if (Utils.isWhiteSpace(character)) {
addClearWordSwitchMode(state, character, _Mode2.default.whitespace);
} else if (Utils.isWord(character) && (state.currentWord.length === 0 || Utils.isWord(state.currentWord[state.currentWord.length - 1]))) {
state.currentWord.push(character);
} else {
addClearWordSwitchMode(state, character, _Mode2.default.character);
}
break;
case _Mode2.default.tag:
if (Utils.isEndOfTag(character)) {
state.currentWord.push(character);
state.words.push(state.currentWord.join(''));
state.currentWord = [];
state.mode = Utils.isWhiteSpace(character) ? _Mode2.default.whitespace : _Mode2.default.character;
} else {
state.currentWord.push(character);
}
break;
case _Mode2.default.whitespace:
if (Utils.isStartOfTag(character)) {
addClearWordSwitchMode(state, character, _Mode2.default.tag);
} else if (Utils.isStartOfEntity(character)) {
addClearWordSwitchMode(state, character, _Mode2.default.entity);
} else if (Utils.isWhiteSpace(character)) {
state.currentWord.push(character);
} else {
addClearWordSwitchMode(state, character, _Mode2.default.character);
}
break;
case _Mode2.default.entity:
if (Utils.isStartOfTag(character)) {
addClearWordSwitchMode(state, character, _Mode2.default.tag);
} else if (Utils.isWhiteSpace(character)) {
addClearWordSwitchMode(state, character, _Mode2.default.whitespace);
} else if (Utils.isEndOfEntity(character)) {
var switchToNextMode = true;
if (state.currentWord.length !== 0) {
state.currentWord.push(character);
state.words.push(state.currentWord.join(''));
//join entity with last whitespace
if (state.words.length > 2 && Utils.isWhiteSpace(state.words[state.words.length - 2]) && Utils.isWhiteSpace(state.words[state.words.length - 1])) {
var w1 = state.words[state.words.length - 2];
var w2 = state.words[state.words.length - 1];
state.words.splice(state.words.length - 2, 2);
state.currentWord = [(w1 + w2).split()];
state.mode = _Mode2.default.whitespace;
switchToNextMode = false;
}
}
if (switchToNextMode) {
state.currentWord = [];
state.mode = _Mode2.default.character;
}
} else if (Utils.isWord(character)) {
state.currentWord.push(character);
} else {
addClearWordSwitchMode(state, character, _Mode2.default.character);
}
break;
}
}
if (state.currentWord.length !== 0) {
state.words.push(state.currentWord.join(''));
}
return state.words;
}
function addClearWordSwitchMode(state, character, mode) {
if (state.currentWord.length !== 0) {
state.words.push(state.currentWord.join(''));
}
state.currentWord = [character];
state.mode = mode;
}
function findBlocks(text, blockExpressions) {
var blockLocations = new _map2.default();
if (blockExpressions === null) {
return blockLocations;
}
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = (0, _getIterator3.default)(blockExpressions), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var exp = _step.value;
var m = void 0;
while ((m = exp.exec(text)) !== null) {
if (blockLocations.has(m.index)) {
throw new Error("One or more block expressions result in a text sequence that overlaps. Current expression: " + exp.toString());
}
blockLocations.set(m.index, m.index + m[0].length);
}
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
return blockLocations;
}
exports.convertHtmlToListOfWords = convertHtmlToListOfWords;
/***/ }),
/* 51 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _classCallCheck2 = __webpack_require__(10);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var Operation = function Operation(action, startInOld, endInOld, startInNew, endInNew) {
(0, _classCallCheck3.default)(this, Operation);
this.action = action;
this.startInOld = startInOld;
this.endInOld = endInOld;
this.startInNew = startInNew;
this.endInNew = endInNew;
};
exports.default = Operation;
/***/ }),
/* 52 */
/***/ (function(module, exports, __webpack_require__) {
var ITERATOR = __webpack_require__(0)('iterator');
var SAFE_CLOSING = false;
try {
var riter = [7][ITERATOR]();
riter['return'] = function () { SAFE_CLOSING = true; };
// eslint-disable-next-line no-throw-literal
Array.from(riter, function () { throw 2; });
} catch (e) { /* empty */ }
module.exports = function (exec, skipClosing) {
if (!skipClosing && !SAFE_CLOSING) return false;
var safe = false;
try {
var arr = [7];
var iter = arr[ITERATOR]();
iter.next = function () { return { done: safe = true }; };
arr[ITERATOR] = function () { return iter; };
exec(arr);
} catch (e) { /* empty */ }
return safe;
};
/***/ }),
/* 53 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var $defineProperty = __webpack_require__(1);
var createDesc = __webpack_require__(26);
module.exports = function (object, index, value) {
if (index in object) $defineProperty.f(object, index, createDesc(0, value));
else object[index] = value;
};
/***/ }),
/* 54 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var ctx = __webpack_require__(9);
var $export = __webpack_require__(7);
var toObject = __webpack_require__(21);
var call = __webpack_require__(37);
var isArrayIter = __webpack_require__(36);
var toLength = __webpack_require__(14);
var createProperty = __webpack_require__(53);
var getIterFn = __webpack_require__(19);
$export($export.S + $export.F * !__webpack_require__(52)(function (iter) { Array.from(iter); }), 'Array', {
// 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
var O = toObject(arrayLike);
var C = typeof this == 'function' ? this : Array;
var aLen = arguments.length;
var mapfn = aLen > 1 ? arguments[1] : undefined;
var mapping = mapfn !== undefined;
var index = 0;
var iterFn = getIterFn(O);
var length, result, step, iterator;
if (mapping) mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2);
// if object isn't iterable or it's array with default iterator - use simple case
if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) {
for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) {
createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value);
}
} else {
length = toLength(O.length);
for (result = new C(length); length > index; index++) {
createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
}
}
result.length = index;
return result;
}
});
/***/ }),
/* 55 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(20);
__webpack_require__(54);
module.exports = __webpack_require__(6).Array.from;
/***/ }),
/* 56 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(55), __esModule: true };
/***/ }),
/* 57 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _from = __webpack_require__(56);
var _from2 = _interopRequireDefault(_from);
var _getIterator2 = __webpack_require__(31);
var _getIterator3 = _interopRequireDefault(_getIterator2);
var _map = __webpack_require__(17);
var _map2 = _interopRequireDefault(_map);
var _classCallCheck2 = __webpack_require__(10);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = __webpack_require__(18);
var _createClass3 = _interopRequireDefault(_createClass2);
var _Match = __webpack_require__(33);
var _Match2 = _interopRequireDefault(_Match);
var _MatchOptions = __webpack_require__(32);
var _MatchOptions2 = _interopRequireDefault(_MatchOptions);
var _Utils = __webpack_require__(16);
var Utils = _interopRequireWildcard(_Utils);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function putNewWord(block, word, blockSize) {
block.push(word);
if (block.length > blockSize) {
block.shift();
}
if (block.length !== blockSize) {
return null;
}
return block.join('');
}
// Finds the longest match in given texts. It uses indexing with fixed granularity that is used to compare blocks of text.
var MatchFinder = function () {
function MatchFinder(oldWords, newWords, startInOld, endInOld, startInNew, endInNew, options) {
(0, _classCallCheck3.default)(this, MatchFinder);
this.oldWords = oldWords;
this.newWords = newWords;
this.startInOld = startInOld;
this.endInOld = endInOld;
this.startInNew = startInNew;
this.endInNew = endInNew;
this.options = options;
}
(0, _createClass3.default)(MatchFinder, [{
key: 'indexNewWords',
value: function indexNewWords() {
this.wordIndices = new _map2.default();
var block = [];
for (var i = this.startInNew; i < this.endInNew; i++) {
// if word is a tag, we should ignore attributes as attribute changes are not supported (yet)
var word = this.normalizeForIndex(this.newWords[i]);
var key = putNewWord(block, word, this.options.blockSize);
if (key === null) {
continue;
}
if (this.wordIndices.has(key)) {
this.wordIndices.get(key).push(i);
} else {
this.wordIndices.set(key, [i]);
}
}
}
// Converts the word to index-friendly value so it can be compared with other similar words
}, {
key: 'normalizeForIndex',
value: function normalizeForIndex(word) {
word = Utils.stripAnyAttributes(word);
if (this.options.IgnoreWhiteSpaceDifferences && Utils.isWhiteSpace(word)) {
return ' ';
}
return word;
}
}, {
key: 'findMatch',
value: function findMatch() {
this.indexNewWords();
this.removeRepeatingWords();
if (this.wordIndices.length === 0) {
return null;
}
var bestMatchInOld = this.startInOld;
var bestMatchInNew = this.startInNew;
var bestMatchSize = 0;
var matchLengthAt = new _map2.default();
var blockSize = this.options.blockSize;
var block = [];
for (var indexInOld = this.startInOld; indexInOld < this.endInOld; indexInOld++) {
var word = this.normalizeForIndex(this.oldWords[indexInOld]);
var index = putNewWord(block, word, blockSize);
if (index === null) {
continue;
}
var newMatchLengthAt = new _map2.default();
if (!this.wordIndices.has(index)) {
matchLengthAt = newMatchLengthAt;
continue;
}
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = (0, _getIterator3.default)(this.wordIndices.get(index)), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var indexInNew = _step.value;
var newMatchLength = (matchLengthAt.has(indexInNew - 1) ? matchLengthAt.get(indexInNew - 1) : 0) + 1;
newMatchLengthAt.set(indexInNew, newMatchLength);
if (newMatchLength > bestMatchSize) {
bestMatchInOld = indexInOld - newMatchLength - blockSize + 2;
bestMatchInNew = indexInNew - newMatchLength - blockSize + 2;
bestMatchSize = newMatchLength;
}
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
matchLengthAt = newMatchLengthAt;
}
return bestMatchSize !== 0 ? new _Match2.default(bestMatchInOld, bestMatchInNew, bestMatchSize + blockSize - 1) : null;
}
// This method removes words that occur too many times. This way it reduces total count of comparison operations
// and as result the diff algoritm takes less time. But the side effect is that it may detect false differences of
// the repeating words.
}, {
key: 'removeRepeatingWords',
value: function removeRepeatingWords() {
var threshold = this.newWords.length + this.options.repeatingWordsAccuracy;
var repeatingWords = (0, _from2.default)(this.wordIndices.entries()).filter(function (i) {
return i[1].length > threshold;
}).map(function (i) {
return i[0];
});
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
try {
for (var _iterator2 = (0, _getIterator3.default)(repeatingWords), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var w = _step2.value;
this.wordIndices.delete(w);
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2.return) {
_iterator2.return();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
}
}
}]);
return MatchFinder;
}();
exports.default = MatchFinder;
/***/ }),
/* 58 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var Action = {
equal: 0,
delete: 1,
insert: 2,
none: 3,
replace: 4
};
exports.default = Action;
/***/ }),
/* 59 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// https://tc39.github.io/proposal-setmap-offrom/
var $export = __webpack_require__(7);
var aFunction = __webpack_require__(45);
var ctx = __webpack_require__(9);
var forOf = __webpack_require__(13);
module.exports = function (COLLECTION) {
$export($export.S, COLLECTION, { from: function from(source /* , mapFn, thisArg */) {
var mapFn = arguments[1];
var mapping, A, n, cb;
aFunction(this);
mapping = m