clapton 0.0.13 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/app/helpers/clapton/clapton_helper.rb +16 -1
- data/lib/clapton/engine.rb +20 -10
- data/lib/clapton/javascripts/dist/client.js +38 -27
- data/lib/clapton/javascripts/dist/components-for-test.js +439 -0
- data/lib/clapton/javascripts/dist/components.js +356 -382
- data/lib/clapton/javascripts/node_modules/diff-dom/LICENSE.txt +165 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/README.md +224 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/browser/diffDOM.js +2 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/browser/diffDOM.js.map +1 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/dist/dts/TraceLogger.d.ts +28 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/dist/dts/diffDOM/dom/apply.d.ts +4 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/dist/dts/diffDOM/dom/fromVirtual.d.ts +2 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/dist/dts/diffDOM/dom/index.d.ts +2 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/dist/dts/diffDOM/dom/undo.d.ts +3 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/dist/dts/diffDOM/helpers.d.ts +11 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/dist/dts/diffDOM/index.d.ts +10 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/dist/dts/diffDOM/types.d.ts +104 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/dist/dts/diffDOM/virtual/apply.d.ts +3 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/dist/dts/diffDOM/virtual/diff.d.ts +22 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/dist/dts/diffDOM/virtual/fromDOM.d.ts +2 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/dist/dts/diffDOM/virtual/fromString.d.ts +2 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/dist/dts/diffDOM/virtual/helpers.d.ts +40 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/dist/dts/diffDOM/virtual/index.d.ts +3 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/dist/dts/index.d.ts +2 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/dist/index.d.ts +136 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/dist/index.js +1996 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/dist/index.js.map +1 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/dist/index.min.js +2 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/dist/index.min.js.map +1 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/dist/module.js +1991 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/dist/module.js.map +1 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/index.html +62 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/package.json +54 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/rollup.config.mjs +67 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/src/TraceLogger.ts +143 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/src/diffDOM/dom/apply.ts +227 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/src/diffDOM/dom/fromVirtual.ts +83 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/src/diffDOM/dom/index.ts +2 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/src/diffDOM/dom/undo.ts +90 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/src/diffDOM/helpers.ts +40 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/src/diffDOM/index.ts +121 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/src/diffDOM/types.ts +154 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/src/diffDOM/virtual/apply.ts +349 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/src/diffDOM/virtual/diff.ts +855 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/src/diffDOM/virtual/fromDOM.ts +74 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/src/diffDOM/virtual/fromString.ts +239 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/src/diffDOM/virtual/helpers.ts +461 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/src/diffDOM/virtual/index.ts +3 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/src/index.ts +2 -0
- data/lib/clapton/javascripts/node_modules/diff-dom/tsconfig.json +103 -0
- data/lib/clapton/javascripts/rollup.config.mjs +17 -2
- data/lib/clapton/javascripts/src/actions/handle-action.ts +6 -6
- data/lib/clapton/javascripts/src/actions/initialize-actions.ts +6 -3
- data/lib/clapton/javascripts/src/channel/clapton-channel.js +6 -3
- data/lib/clapton/javascripts/src/client.ts +15 -15
- data/lib/clapton/javascripts/src/components-for-test.ts +29 -0
- data/lib/clapton/javascripts/src/components.ts +4 -1
- data/lib/clapton/javascripts/src/dom/update-component.ts +4 -4
- data/lib/clapton/javascripts/src/inputs/initialize-inputs.ts +2 -2
- data/lib/clapton/test_helper/base.rb +1 -1
- data/lib/clapton/version.rb +1 -2
- metadata +49 -3
- data/lib/clapton/javascripts/src/dom/update-component.spec.ts +0 -32
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.min.js","sources":["../node_modules/tslib/tslib.es6.js","../src/diffDOM/helpers.ts","../src/diffDOM/dom/fromVirtual.ts","../src/diffDOM/dom/apply.ts","../src/diffDOM/dom/undo.ts","../src/diffDOM/virtual/helpers.ts","../src/diffDOM/virtual/apply.ts","../src/diffDOM/virtual/fromDOM.ts","../src/diffDOM/virtual/fromString.ts","../src/diffDOM/virtual/diff.ts","../src/diffDOM/index.ts","../src/TraceLogger.ts"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n function next() {\r\n while (env.stack.length) {\r\n var rec = env.stack.pop();\r\n try {\r\n var result = rec.dispose && rec.dispose.call(rec.value);\r\n if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n};\r\n","import { elementNodeType } from \"./types\"\n\nexport class Diff {\n constructor(options = {}) {\n Object.entries(options).forEach(([key, value]) => (this[key] = value))\n }\n\n toString() {\n return JSON.stringify(this)\n }\n\n setValue(\n aKey: string | number,\n aValue:\n | string\n | number\n | boolean\n | number[]\n | { [key: string]: string | { [key: string]: string } }\n | elementNodeType,\n ) {\n this[aKey] = aValue\n return this\n }\n}\n\nexport function checkElementType(element, ...elementTypeNames: string[]) {\n if (typeof element === \"undefined\" || element === null) {\n return false\n }\n return elementTypeNames.some(\n (elementTypeName) =>\n // We need to check if the specified type is defined\n // because otherwise instanceof throws an exception.\n typeof element?.ownerDocument?.defaultView?.[elementTypeName] ===\n \"function\" &&\n element instanceof\n element.ownerDocument.defaultView[elementTypeName],\n )\n}\n","import { DiffDOMOptions, elementNodeType, textNodeType } from \"../types\"\nimport { checkElementType } from \"../helpers\"\n\nexport function objToNode(\n objNode: elementNodeType,\n insideSvg: boolean,\n options: DiffDOMOptions,\n) {\n let node: Element | Text | Comment\n if (objNode.nodeName === \"#text\") {\n node = options.document.createTextNode((objNode as textNodeType).data)\n } else if (objNode.nodeName === \"#comment\") {\n node = options.document.createComment((objNode as textNodeType).data)\n } else {\n if (insideSvg) {\n node = options.document.createElementNS(\n \"http://www.w3.org/2000/svg\",\n objNode.nodeName,\n )\n if (objNode.nodeName === \"foreignObject\") {\n insideSvg = false\n }\n } else if (objNode.nodeName.toLowerCase() === \"svg\") {\n node = options.document.createElementNS(\n \"http://www.w3.org/2000/svg\",\n \"svg\",\n )\n insideSvg = true\n } else {\n node = options.document.createElement(objNode.nodeName)\n }\n if (objNode.attributes) {\n Object.entries(objNode.attributes).forEach(([key, value]) =>\n (node as Element).setAttribute(key, value),\n )\n }\n if (objNode.childNodes) {\n node = node as Element\n objNode.childNodes.forEach(\n (childNode: elementNodeType | textNodeType) =>\n node.appendChild(objToNode(childNode, insideSvg, options)),\n )\n }\n if (options.valueDiffing) {\n if (\n objNode.value &&\n checkElementType(\n node,\n \"HTMLButtonElement\",\n \"HTMLDataElement\",\n \"HTMLInputElement\",\n \"HTMLLIElement\",\n \"HTMLMeterElement\",\n \"HTMLOptionElement\",\n \"HTMLProgressElement\",\n \"HTMLParamElement\",\n )\n ) {\n ;(\n node as\n | HTMLButtonElement\n | HTMLDataElement\n | HTMLInputElement\n | HTMLLIElement\n | HTMLMeterElement\n | HTMLOptionElement\n | HTMLProgressElement\n | HTMLParamElement\n ).value = objNode.value\n }\n if (objNode.checked && checkElementType(node, \"HTMLInputElement\")) {\n ;(node as HTMLInputElement).checked = objNode.checked\n }\n if (\n objNode.selected &&\n checkElementType(node, \"HTMLOptionElement\")\n ) {\n ;(node as HTMLOptionElement).selected = objNode.selected\n }\n }\n }\n return node\n}\n","import { DiffDOMOptions, diffType, nodeType } from \"../types\"\nimport { Diff, checkElementType } from \"../helpers\"\n\nimport { objToNode } from \"./fromVirtual\"\n\n// ===== Apply a diff =====\n\nconst getFromRoute = (\n node: Element,\n route: number[],\n): Element | Text | false => {\n route = route.slice()\n while (route.length > 0) {\n const c = route.splice(0, 1)[0]\n node = node.childNodes[c] as Element\n }\n return node\n}\n\nexport function applyDiff(\n tree: Element,\n diff: diffType,\n options: DiffDOMOptions, // {preDiffApply, postDiffApply, textDiff, valueDiffing, _const}\n) {\n const action = diff[options._const.action] as string | number\n const route = diff[options._const.route] as number[]\n let node\n\n if (\n ![options._const.addElement, options._const.addTextElement].includes(\n action,\n )\n ) {\n // For adding nodes, we calculate the route later on. It's different because it includes the position of the newly added item.\n node = getFromRoute(tree, route)\n }\n\n let newNode\n let reference: Element\n let nodeArray\n\n // pre-diff hook\n const info = {\n diff,\n node,\n }\n\n if (options.preDiffApply(info)) {\n return true\n }\n\n switch (action) {\n case options._const.addAttribute:\n if (!node || !checkElementType(node, \"Element\")) {\n return false\n }\n node.setAttribute(\n diff[options._const.name] as string,\n diff[options._const.value] as string,\n )\n break\n case options._const.modifyAttribute:\n if (!node || !checkElementType(node, \"Element\")) {\n return false\n }\n node.setAttribute(\n diff[options._const.name] as string,\n diff[options._const.newValue] as string,\n )\n if (\n checkElementType(node, \"HTMLInputElement\") &&\n diff[options._const.name] === \"value\"\n ) {\n node.value = diff[options._const.newValue] as string\n }\n break\n case options._const.removeAttribute:\n if (!node || !checkElementType(node, \"Element\")) {\n return false\n }\n node.removeAttribute(diff[options._const.name] as string)\n break\n case options._const.modifyTextElement:\n if (!node || !checkElementType(node, \"Text\")) {\n return false\n }\n options.textDiff(\n node,\n node.data,\n diff[options._const.oldValue] as string,\n diff[options._const.newValue] as string,\n )\n if (checkElementType(node.parentNode, \"HTMLTextAreaElement\")) {\n node.parentNode.value = diff[options._const.newValue] as string\n }\n break\n case options._const.modifyValue:\n if (!node || typeof node.value === \"undefined\") {\n return false\n }\n node.value = diff[options._const.newValue]\n break\n case options._const.modifyComment:\n if (!node || !checkElementType(node, \"Comment\")) {\n return false\n }\n options.textDiff(\n node,\n node.data,\n diff[options._const.oldValue] as string,\n diff[options._const.newValue] as string,\n )\n break\n case options._const.modifyChecked:\n if (!node || typeof node.checked === \"undefined\") {\n return false\n }\n node.checked = diff[options._const.newValue]\n break\n case options._const.modifySelected:\n if (!node || typeof node.selected === \"undefined\") {\n return false\n }\n node.selected = diff[options._const.newValue]\n break\n case options._const.replaceElement: {\n const insideSvg =\n (\n diff[options._const.newValue] as nodeType\n ).nodeName.toLowerCase() === \"svg\" ||\n node.parentNode.namespaceURI === \"http://www.w3.org/2000/svg\"\n node.parentNode.replaceChild(\n objToNode(\n diff[options._const.newValue] as nodeType,\n insideSvg,\n options,\n ),\n node,\n )\n break\n }\n case options._const.relocateGroup:\n nodeArray = [...new Array(diff[options._const.groupLength])].map(\n () =>\n node.removeChild(\n node.childNodes[diff[options._const.from] as number],\n ),\n )\n nodeArray.forEach((childNode, index) => {\n if (index === 0) {\n reference =\n node.childNodes[diff[options._const.to] as number]\n }\n node.insertBefore(childNode, reference || null)\n })\n break\n case options._const.removeElement:\n node.parentNode.removeChild(node)\n break\n case options._const.addElement: {\n const parentRoute = route.slice()\n const c: number = parentRoute.splice(parentRoute.length - 1, 1)[0]\n node = getFromRoute(tree, parentRoute)\n if (!checkElementType(node, \"Element\")) {\n return false\n }\n node.insertBefore(\n objToNode(\n diff[options._const.element] as nodeType,\n node.namespaceURI === \"http://www.w3.org/2000/svg\",\n options,\n ),\n node.childNodes[c] || null,\n )\n break\n }\n case options._const.removeTextElement: {\n if (!node || node.nodeType !== 3) {\n return false\n }\n const parentNode = node.parentNode\n parentNode.removeChild(node)\n if (checkElementType(parentNode, \"HTMLTextAreaElement\")) {\n parentNode.value = \"\"\n }\n break\n }\n case options._const.addTextElement: {\n const parentRoute = route.slice()\n const c: number = parentRoute.splice(parentRoute.length - 1, 1)[0]\n newNode = options.document.createTextNode(\n diff[options._const.value] as string,\n )\n node = getFromRoute(tree, parentRoute)\n if (!node.childNodes) {\n return false\n }\n node.insertBefore(newNode, node.childNodes[c] || null)\n if (checkElementType(node.parentNode, \"HTMLTextAreaElement\")) {\n node.parentNode.value = diff[options._const.value] as string\n }\n break\n }\n default:\n console.log(\"unknown action\")\n }\n\n // if a new node was created, we might be interested in its\n // post diff hook\n options.postDiffApply({\n diff: info.diff,\n node: info.node,\n newNode,\n })\n\n return true\n}\n\nexport function applyDOM(\n tree: Element,\n diffs: (Diff | diffType)[],\n options: DiffDOMOptions,\n) {\n return diffs.every((diff: Diff | diffType) =>\n applyDiff(tree, diff as diffType, options),\n )\n}\n","import { DiffDOMOptions, diffType } from \"../types\"\nimport { Diff } from \"../helpers\"\nimport { applyDiff } from \"./apply\"\n\n// ===== Undo a diff =====\n\nfunction swap(obj: object, p1: string | number, p2: string | number) {\n const tmp = obj[p1]\n obj[p1] = obj[p2]\n obj[p2] = tmp\n}\n\nfunction undoDiff(\n tree: Element,\n diff: diffType,\n options: DiffDOMOptions, // {preDiffApply, postDiffApply, textDiff, valueDiffing, _const}\n) {\n switch (diff[options._const.action]) {\n case options._const.addAttribute:\n diff[options._const.action] = options._const.removeAttribute\n applyDiff(tree, diff, options)\n break\n case options._const.modifyAttribute:\n swap(diff, options._const.oldValue, options._const.newValue)\n applyDiff(tree, diff, options)\n break\n case options._const.removeAttribute:\n diff[options._const.action] = options._const.addAttribute\n applyDiff(tree, diff, options)\n break\n case options._const.modifyTextElement:\n swap(diff, options._const.oldValue, options._const.newValue)\n applyDiff(tree, diff, options)\n break\n case options._const.modifyValue:\n swap(diff, options._const.oldValue, options._const.newValue)\n applyDiff(tree, diff, options)\n break\n case options._const.modifyComment:\n swap(diff, options._const.oldValue, options._const.newValue)\n applyDiff(tree, diff, options)\n break\n case options._const.modifyChecked:\n swap(diff, options._const.oldValue, options._const.newValue)\n applyDiff(tree, diff, options)\n break\n case options._const.modifySelected:\n swap(diff, options._const.oldValue, options._const.newValue)\n applyDiff(tree, diff, options)\n break\n case options._const.replaceElement:\n swap(diff, options._const.oldValue, options._const.newValue)\n applyDiff(tree, diff, options)\n break\n case options._const.relocateGroup:\n swap(diff, options._const.from, options._const.to)\n applyDiff(tree, diff, options)\n break\n case options._const.removeElement:\n diff[options._const.action] = options._const.addElement\n applyDiff(tree, diff, options)\n break\n case options._const.addElement:\n diff[options._const.action] = options._const.removeElement\n applyDiff(tree, diff, options)\n break\n case options._const.removeTextElement:\n diff[options._const.action] = options._const.addTextElement\n applyDiff(tree, diff, options)\n break\n case options._const.addTextElement:\n diff[options._const.action] = options._const.removeTextElement\n applyDiff(tree, diff, options)\n break\n default:\n console.log(\"unknown action\")\n }\n}\n\nexport function undoDOM(\n tree: Element,\n diffs: (diffType | Diff)[],\n options: DiffDOMOptions,\n) {\n diffs = diffs.slice()\n diffs.reverse()\n diffs.forEach((diff: diffType | Diff) => {\n undoDiff(tree, diff as diffType, options)\n })\n}\n","import {\n diffNodeType,\n elementDiffNodeType,\n elementNodeType,\n nodeType,\n subsetType,\n textDiffNodeType,\n textNodeType,\n} from \"../types\"\nimport { Diff } from \"../helpers\"\nconst elementDescriptors = (el: diffNodeType) => {\n const output = []\n output.push(el.nodeName)\n if (el.nodeName !== \"#text\" && el.nodeName !== \"#comment\") {\n el = el as elementDiffNodeType\n if (el.attributes) {\n if (el.attributes[\"class\"]) {\n output.push(\n `${el.nodeName}.${el.attributes[\"class\"].replace(\n / /g,\n \".\",\n )}`,\n )\n }\n if (el.attributes.id) {\n output.push(`${el.nodeName}#${el.attributes.id}`)\n }\n }\n }\n return output\n}\n\nconst findUniqueDescriptors = (li: diffNodeType[]) => {\n const uniqueDescriptors = {}\n const duplicateDescriptors = {}\n\n li.forEach((node: nodeType) => {\n elementDescriptors(node).forEach((descriptor) => {\n const inUnique = descriptor in uniqueDescriptors\n const inDupes = descriptor in duplicateDescriptors\n if (!inUnique && !inDupes) {\n uniqueDescriptors[descriptor] = true\n } else if (inUnique) {\n delete uniqueDescriptors[descriptor]\n duplicateDescriptors[descriptor] = true\n }\n })\n })\n\n return uniqueDescriptors\n}\n\nexport const uniqueInBoth = (l1: diffNodeType[], l2: diffNodeType[]) => {\n const l1Unique = findUniqueDescriptors(l1)\n const l2Unique = findUniqueDescriptors(l2)\n const inBoth = {}\n\n Object.keys(l1Unique).forEach((key) => {\n if (l2Unique[key]) {\n inBoth[key] = true\n }\n })\n\n return inBoth\n}\n\nexport const removeDone = (tree: elementDiffNodeType) => {\n delete tree.outerDone\n delete tree.innerDone\n delete tree.valueDone\n if (tree.childNodes) {\n return tree.childNodes.every(removeDone)\n } else {\n return true\n }\n}\n\nexport const cleanNode = (diffNode: diffNodeType) => {\n if (Object.prototype.hasOwnProperty.call(diffNode, \"data\")) {\n const textNode: textNodeType = {\n nodeName: diffNode.nodeName === \"#text\" ? \"#text\" : \"#comment\",\n data: (diffNode as textDiffNodeType).data,\n }\n return textNode\n } else {\n const elementNode: elementNodeType = {\n nodeName: diffNode.nodeName,\n }\n diffNode = diffNode as elementDiffNodeType\n if (Object.prototype.hasOwnProperty.call(diffNode, \"attributes\")) {\n elementNode.attributes = { ...diffNode.attributes }\n }\n if (Object.prototype.hasOwnProperty.call(diffNode, \"checked\")) {\n elementNode.checked = diffNode.checked\n }\n if (Object.prototype.hasOwnProperty.call(diffNode, \"value\")) {\n elementNode.value = diffNode.value\n }\n if (Object.prototype.hasOwnProperty.call(diffNode, \"selected\")) {\n elementNode.selected = diffNode.selected\n }\n if (Object.prototype.hasOwnProperty.call(diffNode, \"childNodes\")) {\n elementNode.childNodes = diffNode.childNodes.map((diffChildNode) =>\n cleanNode(diffChildNode),\n )\n }\n return elementNode\n }\n}\n\nexport const isEqual = (e1: diffNodeType, e2: diffNodeType) => {\n if (\n ![\"nodeName\", \"value\", \"checked\", \"selected\", \"data\"].every(\n (element) => {\n if (e1[element] !== e2[element]) {\n return false\n }\n return true\n },\n )\n ) {\n return false\n }\n if (Object.prototype.hasOwnProperty.call(e1, \"data\")) {\n // Comment or Text\n return true\n }\n e1 = e1 as elementDiffNodeType\n e2 = e2 as elementDiffNodeType\n if (Boolean(e1.attributes) !== Boolean(e2.attributes)) {\n return false\n }\n\n if (Boolean(e1.childNodes) !== Boolean(e2.childNodes)) {\n return false\n }\n if (e1.attributes) {\n const e1Attributes = Object.keys(e1.attributes)\n const e2Attributes = Object.keys(e2.attributes)\n\n if (e1Attributes.length !== e2Attributes.length) {\n return false\n }\n if (\n !e1Attributes.every((attribute) => {\n if (\n (e1 as elementDiffNodeType).attributes[attribute] !==\n (e2 as elementDiffNodeType).attributes[attribute]\n ) {\n return false\n }\n return true\n })\n ) {\n return false\n }\n }\n if (e1.childNodes) {\n if (e1.childNodes.length !== e2.childNodes.length) {\n return false\n }\n if (\n !e1.childNodes.every((childNode: nodeType, index: number) =>\n isEqual(childNode, e2.childNodes[index]),\n )\n ) {\n return false\n }\n }\n\n return true\n}\n\nexport const roughlyEqual = (\n e1: diffNodeType,\n e2: diffNodeType,\n uniqueDescriptors: { [key: string]: boolean },\n sameSiblings: boolean,\n preventRecursion = false,\n) => {\n if (!e1 || !e2) {\n return false\n }\n\n if (e1.nodeName !== e2.nodeName) {\n return false\n }\n\n if ([\"#text\", \"#comment\"].includes(e1.nodeName)) {\n // Note that we initially don't care what the text content of a node is,\n // the mere fact that it's the same tag and \"has text\" means it's roughly\n // equal, and then we can find out the true text difference later.\n return preventRecursion\n ? true\n : (e1 as textDiffNodeType).data === (e2 as textDiffNodeType).data\n }\n\n e1 = e1 as elementDiffNodeType\n e2 = e2 as elementDiffNodeType\n\n if (e1.nodeName in uniqueDescriptors) {\n return true\n }\n\n if (e1.attributes && e2.attributes) {\n if (e1.attributes.id) {\n if (e1.attributes.id !== e2.attributes.id) {\n return false\n } else {\n const idDescriptor = `${e1.nodeName}#${e1.attributes.id}`\n if (idDescriptor in uniqueDescriptors) {\n return true\n }\n }\n }\n if (\n e1.attributes[\"class\"] &&\n e1.attributes[\"class\"] === e2.attributes[\"class\"]\n ) {\n const classDescriptor = `${e1.nodeName}.${e1.attributes[\n \"class\"\n ].replace(/ /g, \".\")}`\n if (classDescriptor in uniqueDescriptors) {\n return true\n }\n }\n }\n\n if (sameSiblings) {\n return true\n }\n\n const nodeList1 = e1.childNodes ? e1.childNodes.slice().reverse() : []\n const nodeList2 = e2.childNodes ? e2.childNodes.slice().reverse() : []\n\n if (nodeList1.length !== nodeList2.length) {\n return false\n }\n\n if (preventRecursion) {\n return nodeList1.every(\n (element: nodeType, index: number) =>\n element.nodeName === nodeList2[index].nodeName,\n )\n } else {\n // note: we only allow one level of recursion at any depth. If 'preventRecursion'\n // was not set, we must explicitly force it to true for child iterations.\n const childUniqueDescriptors = uniqueInBoth(nodeList1, nodeList2)\n return nodeList1.every((element: nodeType, index: number) =>\n roughlyEqual(\n element,\n nodeList2[index],\n childUniqueDescriptors,\n true,\n true,\n ),\n )\n }\n}\n\n/**\n * based on https://en.wikibooks.org/wiki/Algorithm_implementation/Strings/Longest_common_substring#JavaScript\n */\nconst findCommonSubsets = (\n c1: diffNodeType[],\n c2: diffNodeType[],\n marked1: boolean[],\n marked2: boolean[],\n) => {\n let lcsSize = 0\n let index: number[] = []\n const c1Length = c1.length\n const c2Length = c2.length\n\n const // set up the matching table\n matches = [...new Array(c1Length + 1)].map(() => [])\n\n const uniqueDescriptors = uniqueInBoth(c1, c2)\n\n let // If all of the elements are the same tag, id and class, then we can\n // consider them roughly the same even if they have a different number of\n // children. This will reduce removing and re-adding similar elements.\n subsetsSame = c1Length === c2Length\n\n if (subsetsSame) {\n c1.some((element: nodeType, i: number) => {\n const c1Desc = elementDescriptors(element)\n const c2Desc = elementDescriptors(c2[i])\n if (c1Desc.length !== c2Desc.length) {\n subsetsSame = false\n return true\n }\n c1Desc.some((description, i) => {\n if (description !== c2Desc[i]) {\n subsetsSame = false\n return true\n }\n })\n if (!subsetsSame) {\n return true\n }\n })\n }\n\n // fill the matches with distance values\n for (let c1Index = 0; c1Index < c1Length; c1Index++) {\n const c1Element = c1[c1Index]\n for (let c2Index = 0; c2Index < c2Length; c2Index++) {\n const c2Element = c2[c2Index]\n if (\n !marked1[c1Index] &&\n !marked2[c2Index] &&\n roughlyEqual(\n c1Element,\n c2Element,\n uniqueDescriptors,\n subsetsSame,\n )\n ) {\n matches[c1Index + 1][c2Index + 1] = matches[c1Index][c2Index]\n ? matches[c1Index][c2Index] + 1\n : 1\n if (matches[c1Index + 1][c2Index + 1] >= lcsSize) {\n lcsSize = matches[c1Index + 1][c2Index + 1]\n index = [c1Index + 1, c2Index + 1]\n }\n } else {\n matches[c1Index + 1][c2Index + 1] = 0\n }\n }\n }\n\n if (lcsSize === 0) {\n return false\n }\n\n return {\n oldValue: index[0] - lcsSize,\n newValue: index[1] - lcsSize,\n length: lcsSize,\n }\n}\n\nconst makeBooleanArray = (n: number, v: boolean) =>\n [...new Array(n)].map(() => v)\n\n/**\n * Generate arrays that indicate which node belongs to which subset,\n * or whether it's actually an orphan node, existing in only one\n * of the two trees, rather than somewhere in both.\n *\n * So if t1 = <img><canvas><br>, t2 = <canvas><br><img>.\n * The longest subset is \"<canvas><br>\" (length 2), so it will group 0.\n * The second longest is \"<img>\" (length 1), so it will be group 1.\n * gaps1 will therefore be [1,0,0] and gaps2 [0,0,1].\n *\n * If an element is not part of any group, it will stay being 'true', which\n * is the initial value. For example:\n * t1 = <img><p></p><br><canvas>, t2 = <b></b><br><canvas><img>\n *\n * The \"<p></p>\" and \"<b></b>\" do only show up in one of the two and will\n * therefore be marked by \"true\". The remaining parts are parts of the\n * groups 0 and 1:\n * gaps1 = [1, true, 0, 0], gaps2 = [true, 0, 0, 1]\n *\n */\nexport const getGapInformation = (\n t1: elementDiffNodeType,\n t2: elementDiffNodeType,\n stable: subsetType[],\n) => {\n const gaps1: (true | number)[] = t1.childNodes\n ? (makeBooleanArray(t1.childNodes.length, true) as true[])\n : []\n const gaps2: (true | number)[] = t2.childNodes\n ? (makeBooleanArray(t2.childNodes.length, true) as true[])\n : []\n let group = 0\n\n // give elements from the same subset the same group number\n stable.forEach((subset: subsetType) => {\n const endOld = subset.oldValue + subset.length\n const endNew = subset.newValue + subset.length\n\n for (let j = subset.oldValue; j < endOld; j += 1) {\n gaps1[j] = group\n }\n for (let j = subset.newValue; j < endNew; j += 1) {\n gaps2[j] = group\n }\n group += 1\n })\n\n return {\n gaps1,\n gaps2,\n }\n}\n\n/**\n * Find all matching subsets, based on immediate child differences only.\n */\nconst markBoth = (marked1, marked2, subset: subsetType, i: number) => {\n marked1[subset.oldValue + i] = true\n marked2[subset.newValue + i] = true\n}\n\nexport const markSubTrees = (\n oldTree: elementDiffNodeType,\n newTree: elementDiffNodeType,\n) => {\n // note: the child lists are views, and so update as we update old/newTree\n const oldChildren = oldTree.childNodes ? oldTree.childNodes : []\n\n const newChildren = newTree.childNodes ? newTree.childNodes : []\n const marked1 = makeBooleanArray(oldChildren.length, false)\n const marked2 = makeBooleanArray(newChildren.length, false)\n const subsets = []\n\n const returnIndex = function () {\n return arguments[1]\n }\n\n let foundAllSubsets = false\n\n while (!foundAllSubsets) {\n const subset = findCommonSubsets(\n oldChildren,\n newChildren,\n marked1,\n marked2,\n )\n if (subset) {\n subsets.push(subset)\n const subsetArray = [...new Array(subset.length)].map(returnIndex)\n subsetArray.forEach((item) =>\n markBoth(marked1, marked2, subset, item),\n )\n } else {\n foundAllSubsets = true\n }\n }\n\n oldTree.subsets = subsets\n oldTree.subsetsAge = 100\n return subsets\n}\n\nexport class DiffTracker {\n list: Diff[]\n constructor() {\n this.list = []\n }\n\n add(diffs: Diff[]) {\n this.list.push(...diffs)\n }\n forEach(fn: (Diff) => void) {\n this.list.forEach((li: Diff) => fn(li))\n }\n}\n","import { DiffDOMOptions, elementNodeType, nodeType, subsetType } from \"../types\"\nimport { Diff } from \"../helpers\"\nimport { cleanNode } from \"./helpers\"\n// ===== Apply a virtual diff =====\n\nfunction getFromVirtualRoute(tree: elementNodeType, route: number[]) {\n let node = tree\n let parentNode\n let nodeIndex\n\n route = route.slice()\n while (route.length > 0) {\n nodeIndex = route.splice(0, 1)[0]\n parentNode = node\n node = node.childNodes ? node.childNodes[nodeIndex] : undefined\n }\n return {\n node,\n parentNode,\n nodeIndex,\n }\n}\n\nfunction applyVirtualDiff(\n tree: elementNodeType,\n diff: Diff,\n options: DiffDOMOptions, // {preVirtualDiffApply, postVirtualDiffApply, _const}\n) {\n let node, parentNode, nodeIndex\n\n if (\n ![options._const.addElement, options._const.addTextElement].includes(\n diff[options._const.action],\n )\n ) {\n // For adding nodes, we calculate the route later on. It's different because it includes the position of the newly added item.\n const routeInfo = getFromVirtualRoute(tree, diff[options._const.route])\n node = routeInfo.node\n parentNode = routeInfo.parentNode\n nodeIndex = routeInfo.nodeIndex\n }\n\n const newSubsets: subsetType[] = []\n\n // pre-diff hook\n const info = {\n diff,\n node,\n }\n\n if (options.preVirtualDiffApply(info)) {\n return true\n }\n\n let newNode\n let nodeArray\n let route\n\n switch (diff[options._const.action]) {\n case options._const.addAttribute:\n if (!node.attributes) {\n node.attributes = {}\n }\n\n node.attributes[diff[options._const.name]] =\n diff[options._const.value]\n\n if (diff[options._const.name] === \"checked\") {\n node.checked = true\n } else if (diff[options._const.name] === \"selected\") {\n node.selected = true\n } else if (\n node.nodeName === \"INPUT\" &&\n diff[options._const.name] === \"value\"\n ) {\n node.value = diff[options._const.value]\n }\n\n break\n case options._const.modifyAttribute:\n node.attributes[diff[options._const.name]] =\n diff[options._const.newValue]\n break\n case options._const.removeAttribute:\n delete node.attributes[diff[options._const.name]]\n\n if (Object.keys(node.attributes).length === 0) {\n delete node.attributes\n }\n\n if (diff[options._const.name] === \"checked\") {\n node.checked = false\n } else if (diff[options._const.name] === \"selected\") {\n delete node.selected\n } else if (\n node.nodeName === \"INPUT\" &&\n diff[options._const.name] === \"value\"\n ) {\n delete node.value\n }\n\n break\n case options._const.modifyTextElement:\n node.data = diff[options._const.newValue]\n if (parentNode.nodeName === \"TEXTAREA\") {\n parentNode.value = diff[options._const.newValue]\n }\n break\n case options._const.modifyValue:\n node.value = diff[options._const.newValue]\n break\n case options._const.modifyComment:\n node.data = diff[options._const.newValue]\n break\n case options._const.modifyChecked:\n node.checked = diff[options._const.newValue]\n break\n case options._const.modifySelected:\n node.selected = diff[options._const.newValue]\n break\n case options._const.replaceElement:\n newNode = cleanNode(diff[options._const.newValue])\n parentNode.childNodes[nodeIndex] = newNode\n break\n case options._const.relocateGroup:\n nodeArray = node.childNodes\n .splice(\n diff[options._const.from],\n diff[options._const.groupLength],\n )\n .reverse()\n nodeArray.forEach((movedNode: nodeType) =>\n node.childNodes.splice(diff[options._const.to], 0, movedNode),\n )\n if (node.subsets) {\n node.subsets.forEach((map: subsetType) => {\n if (\n diff[options._const.from] < diff[options._const.to] &&\n map.oldValue <= diff[options._const.to] &&\n map.oldValue > diff[options._const.from]\n ) {\n map.oldValue -= diff[options._const.groupLength]\n const splitLength =\n map.oldValue + map.length - diff[options._const.to]\n if (splitLength > 0) {\n // new insertion splits map.\n newSubsets.push({\n oldValue:\n diff[options._const.to] +\n diff[options._const.groupLength],\n newValue:\n map.newValue + map.length - splitLength,\n length: splitLength,\n })\n map.length -= splitLength\n }\n } else if (\n diff[options._const.from] > diff[options._const.to] &&\n map.oldValue > diff[options._const.to] &&\n map.oldValue < diff[options._const.from]\n ) {\n map.oldValue += diff[options._const.groupLength]\n const splitLength =\n map.oldValue + map.length - diff[options._const.to]\n if (splitLength > 0) {\n // new insertion splits map.\n newSubsets.push({\n oldValue:\n diff[options._const.to] +\n diff[options._const.groupLength],\n newValue:\n map.newValue + map.length - splitLength,\n length: splitLength,\n })\n map.length -= splitLength\n }\n } else if (map.oldValue === diff[options._const.from]) {\n map.oldValue = diff[options._const.to]\n }\n })\n }\n\n break\n case options._const.removeElement:\n parentNode.childNodes.splice(nodeIndex, 1)\n if (parentNode.subsets) {\n parentNode.subsets.forEach((map: subsetType) => {\n if (map.oldValue > nodeIndex) {\n map.oldValue -= 1\n } else if (map.oldValue === nodeIndex) {\n map.delete = true\n } else if (\n map.oldValue < nodeIndex &&\n map.oldValue + map.length > nodeIndex\n ) {\n if (map.oldValue + map.length - 1 === nodeIndex) {\n map.length--\n } else {\n newSubsets.push({\n newValue:\n map.newValue + nodeIndex - map.oldValue,\n oldValue: nodeIndex,\n length:\n map.length - nodeIndex + map.oldValue - 1,\n })\n map.length = nodeIndex - map.oldValue\n }\n }\n })\n }\n node = parentNode\n break\n case options._const.addElement: {\n route = diff[options._const.route].slice()\n const c: number = route.splice(route.length - 1, 1)[0]\n node = getFromVirtualRoute(tree, route)?.node\n newNode = cleanNode(diff[options._const.element])\n\n if (!node.childNodes) {\n node.childNodes = []\n }\n\n if (c >= node.childNodes.length) {\n node.childNodes.push(newNode)\n } else {\n node.childNodes.splice(c, 0, newNode)\n }\n if (node.subsets) {\n node.subsets.forEach((map: subsetType) => {\n if (map.oldValue >= c) {\n map.oldValue += 1\n } else if (\n map.oldValue < c &&\n map.oldValue + map.length > c\n ) {\n const splitLength = map.oldValue + map.length - c\n newSubsets.push({\n newValue: map.newValue + map.length - splitLength,\n oldValue: c + 1,\n length: splitLength,\n })\n map.length -= splitLength\n }\n })\n }\n break\n }\n case options._const.removeTextElement:\n parentNode.childNodes.splice(nodeIndex, 1)\n if (parentNode.nodeName === \"TEXTAREA\") {\n delete parentNode.value\n }\n if (parentNode.subsets) {\n parentNode.subsets.forEach((map: subsetType) => {\n if (map.oldValue > nodeIndex) {\n map.oldValue -= 1\n } else if (map.oldValue === nodeIndex) {\n map.delete = true\n } else if (\n map.oldValue < nodeIndex &&\n map.oldValue + map.length > nodeIndex\n ) {\n if (map.oldValue + map.length - 1 === nodeIndex) {\n map.length--\n } else {\n newSubsets.push({\n newValue:\n map.newValue + nodeIndex - map.oldValue,\n oldValue: nodeIndex,\n length:\n map.length - nodeIndex + map.oldValue - 1,\n })\n map.length = nodeIndex - map.oldValue\n }\n }\n })\n }\n node = parentNode\n break\n case options._const.addTextElement: {\n route = diff[options._const.route].slice()\n const c: number = route.splice(route.length - 1, 1)[0]\n newNode = {\n nodeName: \"#text\",\n data: diff[options._const.value],\n }\n node = getFromVirtualRoute(tree, route).node\n if (!node.childNodes) {\n node.childNodes = []\n }\n\n if (c >= node.childNodes.length) {\n node.childNodes.push(newNode)\n } else {\n node.childNodes.splice(c, 0, newNode)\n }\n if (node.nodeName === \"TEXTAREA\") {\n node.value = diff[options._const.newValue]\n }\n if (node.subsets) {\n node.subsets.forEach((map: subsetType) => {\n if (map.oldValue >= c) {\n map.oldValue += 1\n }\n if (map.oldValue < c && map.oldValue + map.length > c) {\n const splitLength = map.oldValue + map.length - c\n newSubsets.push({\n newValue: map.newValue + map.length - splitLength,\n oldValue: c + 1,\n length: splitLength,\n })\n map.length -= splitLength\n }\n })\n }\n break\n }\n default:\n console.log(\"unknown action\")\n }\n\n if (node.subsets) {\n node.subsets = node.subsets.filter(\n (map: subsetType) => !map.delete && map.oldValue !== map.newValue,\n )\n if (newSubsets.length) {\n node.subsets = node.subsets.concat(newSubsets)\n }\n }\n\n options.postVirtualDiffApply({\n node: info.node,\n diff: info.diff,\n newNode,\n })\n\n return\n}\n\nexport function applyVirtual(\n tree: elementNodeType,\n diffs: Diff[],\n options: DiffDOMOptions,\n) {\n diffs.forEach((diff: Diff) => {\n applyVirtualDiff(tree, diff, options)\n })\n return true\n}\n","import { DiffDOMOptionsPartial, elementNodeType, textNodeType } from \"../types\"\nimport { checkElementType } from \"../helpers\"\n\nexport function nodeToObj(\n aNode: Element,\n options: DiffDOMOptionsPartial = { valueDiffing: true },\n) {\n const objNode: elementNodeType | textNodeType = {\n nodeName: aNode.nodeName,\n }\n if (checkElementType(aNode, \"Text\", \"Comment\")) {\n ;(objNode as unknown as textNodeType).data = (\n aNode as unknown as Text | Comment\n ).data\n } else {\n if (aNode.attributes && aNode.attributes.length > 0) {\n objNode.attributes = {}\n const nodeArray = Array.prototype.slice.call(aNode.attributes)\n nodeArray.forEach(\n (attribute) =>\n (objNode.attributes[attribute.name] = attribute.value),\n )\n }\n if (aNode.childNodes && aNode.childNodes.length > 0) {\n objNode.childNodes = []\n const nodeArray = Array.prototype.slice.call(aNode.childNodes)\n nodeArray.forEach((childNode) =>\n objNode.childNodes.push(nodeToObj(childNode, options)),\n )\n }\n if (options.valueDiffing) {\n if (checkElementType(aNode, \"HTMLTextAreaElement\")) {\n objNode.value = (aNode as HTMLTextAreaElement).value\n }\n if (\n checkElementType(aNode, \"HTMLInputElement\") &&\n [\"radio\", \"checkbox\"].includes(\n (aNode as HTMLInputElement).type.toLowerCase(),\n ) &&\n (aNode as HTMLInputElement).checked !== undefined\n ) {\n objNode.checked = (aNode as HTMLInputElement).checked\n } else if (\n checkElementType(\n aNode,\n \"HTMLButtonElement\",\n \"HTMLDataElement\",\n \"HTMLInputElement\",\n \"HTMLLIElement\",\n \"HTMLMeterElement\",\n \"HTMLOptionElement\",\n \"HTMLProgressElement\",\n \"HTMLParamElement\",\n )\n ) {\n objNode.value = (\n aNode as\n | HTMLButtonElement\n | HTMLDataElement\n | HTMLInputElement\n | HTMLLIElement\n | HTMLMeterElement\n | HTMLOptionElement\n | HTMLProgressElement\n | HTMLParamElement\n ).value\n }\n if (checkElementType(aNode, \"HTMLOptionElement\")) {\n objNode.selected = (aNode as HTMLOptionElement).selected\n }\n }\n }\n return objNode\n}\n","import { DiffDOMOptionsPartial, nodeType } from \"../types\"\n\n// from html-parse-stringify (MIT)\n\nconst tagRE =\n /<\\s*\\/*[a-zA-Z:_][a-zA-Z0-9:_\\-.]*\\s*(?:\"[^\"]*\"['\"]*|'[^']*'['\"]*|[^'\"/>])*\\/*\\s*>|<!--(?:.|\\n|\\r)*?-->/g\n\nconst attrRE = /\\s([^'\"/\\s><]+?)[\\s/>]|([^\\s=]+)=\\s?(\".*?\"|'.*?')/g\n\nfunction unescape(string: string) {\n return string\n .replace(/</g, \"<\")\n .replace(/>/g, \">\")\n .replace(/&/g, \"&\")\n}\n\n// create optimized lookup object for\n// void elements as listed here:\n// https://www.w3.org/html/wg/drafts/html/master/syntax.html#void-elements\nconst lookup = {\n area: true,\n base: true,\n br: true,\n col: true,\n embed: true,\n hr: true,\n img: true,\n input: true,\n keygen: true,\n link: true,\n menuItem: true,\n meta: true,\n param: true,\n source: true,\n track: true,\n wbr: true,\n}\n\nconst parseTag = (tag: string, caseSensitive: boolean) => {\n const res = {\n nodeName: \"\",\n attributes: {},\n }\n let voidElement = false\n let type = \"tag\"\n\n let tagMatch = tag.match(/<\\/?([^\\s]+?)[/\\s>]/)\n if (tagMatch) {\n res.nodeName =\n caseSensitive || tagMatch[1] === \"svg\"\n ? tagMatch[1]\n : tagMatch[1].toUpperCase()\n if (lookup[tagMatch[1]] || tag.charAt(tag.length - 2) === \"/\") {\n voidElement = true\n }\n\n // handle comment tag\n if (res.nodeName.startsWith(\"!--\")) {\n const endIndex = tag.indexOf(\"-->\")\n return {\n type: \"comment\",\n node: {\n nodeName: \"#comment\",\n data: endIndex !== -1 ? tag.slice(4, endIndex) : \"\",\n },\n voidElement,\n }\n }\n }\n\n let reg = new RegExp(attrRE)\n let result = null\n let done = false\n while (!done) {\n result = reg.exec(tag)\n\n if (result === null) {\n done = true\n } else if (result[0].trim()) {\n if (result[1]) {\n let attr = result[1].trim()\n let arr = [attr, \"\"]\n\n if (attr.indexOf(\"=\") > -1) arr = attr.split(\"=\")\n res.attributes[arr[0]] = arr[1]\n reg.lastIndex--\n } else if (result[2])\n res.attributes[result[2]] = result[3]\n .trim()\n .substring(1, result[3].length - 1)\n }\n }\n\n return {\n type,\n node: res,\n voidElement,\n }\n}\n\nexport const stringToObj = (\n html: string,\n options: DiffDOMOptionsPartial = {\n valueDiffing: true,\n caseSensitive: false,\n },\n) => {\n const result: nodeType[] = []\n let current: { type: string; node: nodeType; voidElement: boolean }\n let level = -1\n const arr: { type: string; node: nodeType; voidElement: boolean }[] = []\n let inComponent = false,\n insideSvg = false\n\n // handle text at top level\n if (html.indexOf(\"<\") !== 0) {\n const end = html.indexOf(\"<\")\n result.push({\n nodeName: \"#text\",\n data: end === -1 ? html : html.substring(0, end),\n })\n }\n\n html.replace(tagRE, (tag: string, index: number) => {\n if (inComponent) {\n if (tag !== `</${current.node.nodeName}>`) {\n return \"\"\n } else {\n inComponent = false\n }\n }\n const isOpen = tag.charAt(1) !== \"/\"\n const isComment = tag.startsWith(\"<!--\")\n const start = index + tag.length\n const nextChar = html.charAt(start)\n\n if (isComment) {\n const comment = parseTag(tag, options.caseSensitive).node\n\n // if we're at root, push new base node\n if (level < 0) {\n result.push(comment)\n return \"\"\n }\n const parent = arr[level]\n if (parent && comment.nodeName) {\n if (!parent.node.childNodes) {\n parent.node.childNodes = []\n }\n parent.node.childNodes.push(comment)\n }\n return \"\"\n }\n\n if (isOpen) {\n current = parseTag(tag, options.caseSensitive || insideSvg)\n if (current.node.nodeName === \"svg\") {\n insideSvg = true\n }\n level++\n if (\n !current.voidElement &&\n !inComponent &&\n nextChar &&\n nextChar !== \"<\"\n ) {\n if (!current.node.childNodes) {\n current.node.childNodes = []\n }\n const data = unescape(\n html.slice(start, html.indexOf(\"<\", start)),\n )\n current.node.childNodes.push({\n nodeName: \"#text\",\n data,\n })\n if (\n options.valueDiffing &&\n current.node.nodeName === \"TEXTAREA\"\n ) {\n current.node.value = data\n }\n }\n // if we're at root, push new base node\n if (level === 0 && current.node.nodeName) {\n result.push(current.node)\n }\n\n const parent = arr[level - 1]\n if (parent && current.node.nodeName) {\n if (!parent.node.childNodes) {\n parent.node.childNodes = []\n }\n parent.node.childNodes.push(current.node)\n }\n arr[level] = current\n }\n if (!isOpen || current.voidElement) {\n if (\n level > -1 &&\n (current.voidElement ||\n (options.caseSensitive &&\n current.node.nodeName === tag.slice(2, -1)) ||\n (!options.caseSensitive &&\n current.node.nodeName.toUpperCase() ===\n tag.slice(2, -1).toUpperCase()))\n ) {\n level--\n // move current up a level to match the end tag\n if (level > -1) {\n if (current.node.nodeName === \"svg\") {\n insideSvg = false\n }\n current = arr[level]\n }\n }\n if (!inComponent && nextChar !== \"<\" && nextChar) {\n // trailing text node\n // if we're at the root, push a base text node. otherwise add as\n // a child to the current node.\n const childNodes =\n level === -1 ? result : arr[level].node.childNodes || []\n\n // calculate correct end of the data slice in case there's\n // no tag after the text node.\n const end = html.indexOf(\"<\", start)\n let data = unescape(\n html.slice(start, end === -1 ? undefined : end),\n )\n childNodes.push({\n nodeName: \"#text\",\n data,\n })\n }\n }\n return \"\"\n })\n return result[0]\n}\n","import {\n DiffDOMOptions,\n diffNodeType,\n elementDiffNodeType,\n elementNodeType,\n subsetType,\n textDiffNodeType,\n} from \"../types\"\nimport {\n DiffTracker,\n cleanNode,\n getGapInformation,\n isEqual,\n markSubTrees,\n removeDone,\n roughlyEqual,\n} from \"./helpers\"\nimport { Diff, checkElementType } from \"../helpers\"\nimport { applyVirtual } from \"./apply\"\nimport { nodeToObj } from \"./fromDOM\"\nimport { stringToObj } from \"./fromString\"\n\n// ===== Create a diff =====\n\nexport class DiffFinder {\n debug: boolean\n diffcount: number\n foundAll: boolean\n options: DiffDOMOptions\n t1: elementDiffNodeType\n t1Orig: elementNodeType\n t2: elementDiffNodeType\n t2Orig: elementNodeType\n tracker: DiffTracker\n constructor(\n t1Node: string | elementNodeType | Element,\n t2Node: string | elementNodeType | Element,\n options: DiffDOMOptions,\n ) {\n this.options = options\n this.t1 = (\n typeof Element !== \"undefined\" &&\n checkElementType(t1Node, \"Element\")\n ? nodeToObj(t1Node as Element, this.options)\n : typeof t1Node === \"string\"\n ? stringToObj(t1Node, this.options)\n : JSON.parse(JSON.stringify(t1Node))\n ) as elementDiffNodeType\n this.t2 = (\n typeof Element !== \"undefined\" &&\n checkElementType(t2Node, \"Element\")\n ? nodeToObj(t2Node as Element, this.options)\n : typeof t2Node === \"string\"\n ? stringToObj(t2Node, this.options)\n : JSON.parse(JSON.stringify(t2Node))\n ) as elementDiffNodeType\n this.diffcount = 0\n this.foundAll = false\n if (this.debug) {\n this.t1Orig =\n typeof Element !== \"undefined\" &&\n checkElementType(t1Node, \"Element\")\n ? nodeToObj(t1Node as Element, this.options)\n : typeof t1Node === \"string\"\n ? stringToObj(t1Node, this.options)\n : JSON.parse(JSON.stringify(t1Node))\n this.t2Orig =\n typeof Element !== \"undefined\" &&\n checkElementType(t2Node, \"Element\")\n ? nodeToObj(t2Node as Element, this.options)\n : typeof t2Node === \"string\"\n ? stringToObj(t2Node, this.options)\n : JSON.parse(JSON.stringify(t2Node))\n }\n\n this.tracker = new DiffTracker()\n }\n\n init() {\n return this.findDiffs(this.t1, this.t2)\n }\n\n findDiffs(t1: elementDiffNodeType, t2: elementDiffNodeType) {\n let diffs\n do {\n if (this.options.debug) {\n this.diffcount += 1\n if (this.diffcount > this.options.diffcap) {\n throw new Error(\n `surpassed diffcap:${JSON.stringify(\n this.t1Orig,\n )} -> ${JSON.stringify(this.t2Orig)}`,\n )\n }\n }\n diffs = this.findNextDiff(t1, t2, [])\n\n if (diffs.length === 0) {\n // Last check if the elements really are the same now.\n // If not, remove all info about being done and start over.\n // Sometimes a node can be marked as done, but the creation of subsequent diffs means that it has to be changed again.\n if (!isEqual(t1, t2)) {\n if (this.foundAll) {\n console.error(\"Could not find remaining diffs!\")\n } else {\n this.foundAll = true\n removeDone(t1)\n diffs = this.findNextDiff(t1, t2, [])\n }\n }\n }\n if (diffs.length > 0) {\n this.foundAll = false\n this.tracker.add(diffs)\n applyVirtual(t1, diffs, this.options)\n }\n } while (diffs.length > 0)\n\n return this.tracker.list\n }\n\n findNextDiff(t1: diffNodeType, t2: diffNodeType, route: number[]) {\n let diffs\n let fdiffs\n\n if (this.options.maxDepth && route.length > this.options.maxDepth) {\n return []\n }\n // outer differences?\n if (!t1.outerDone) {\n diffs = this.findOuterDiff(t1, t2, route)\n if (this.options.filterOuterDiff) {\n fdiffs = this.options.filterOuterDiff(t1, t2, diffs)\n if (fdiffs) diffs = fdiffs\n }\n if (diffs.length > 0) {\n t1.outerDone = true\n return diffs\n } else {\n t1.outerDone = true\n }\n }\n if (Object.prototype.hasOwnProperty.call(t1, \"data\")) {\n // Comment or Text\n return []\n }\n t1 = t1 as elementDiffNodeType\n t2 = t2 as elementDiffNodeType\n\n // inner differences?\n if (!t1.innerDone) {\n diffs = this.findInnerDiff(t1, t2, route)\n if (diffs.length > 0) {\n return diffs\n } else {\n t1.innerDone = true\n }\n }\n\n if (this.options.valueDiffing && !t1.valueDone) {\n // value differences?\n diffs = this.findValueDiff(t1, t2, route)\n\n if (diffs.length > 0) {\n t1.valueDone = true\n return diffs\n } else {\n t1.valueDone = true\n }\n }\n\n // no differences\n return []\n }\n\n findOuterDiff(t1: diffNodeType, t2: diffNodeType, route: number[]) {\n const diffs = []\n let attr\n let attr1\n let attr2\n let attrLength\n let pos\n let i\n if (t1.nodeName !== t2.nodeName) {\n if (!route.length) {\n throw new Error(\"Top level nodes have to be of the same kind.\")\n }\n return [\n new Diff()\n .setValue(\n this.options._const.action,\n this.options._const.replaceElement,\n )\n .setValue(this.options._const.oldValue, cleanNode(t1))\n .setValue(this.options._const.newValue, cleanNode(t2))\n .setValue(this.options._const.route, route),\n ]\n }\n if (\n route.length &&\n this.options.diffcap <\n Math.abs(\n (t1.childNodes || []).length - (t2.childNodes || []).length,\n )\n ) {\n return [\n new Diff()\n .setValue(\n this.options._const.action,\n this.options._const.replaceElement,\n )\n .setValue(this.options._const.oldValue, cleanNode(t1))\n .setValue(this.options._const.newValue, cleanNode(t2))\n .setValue(this.options._const.route, route),\n ]\n }\n\n if (\n Object.prototype.hasOwnProperty.call(t1, \"data\") &&\n (t1 as textDiffNodeType).data !== (t2 as textDiffNodeType).data\n ) {\n // Comment or text node.\n if (t1.nodeName === \"#text\") {\n return [\n new Diff()\n .setValue(\n this.options._const.action,\n this.options._const.modifyTextElement,\n )\n .setValue(this.options._const.route, route)\n .setValue(\n this.options._const.oldValue,\n (t1 as textDiffNodeType).data,\n )\n .setValue(\n this.options._const.newValue,\n (t2 as textDiffNodeType).data,\n ),\n ]\n } else {\n return [\n new Diff()\n .setValue(\n this.options._const.action,\n this.options._const.modifyComment,\n )\n .setValue(this.options._const.route, route)\n .setValue(\n this.options._const.oldValue,\n (t1 as textDiffNodeType).data,\n )\n .setValue(\n this.options._const.newValue,\n (t2 as textDiffNodeType).data,\n ),\n ]\n }\n }\n\n t1 = t1 as elementDiffNodeType\n t2 = t2 as elementDiffNodeType\n\n attr1 = t1.attributes ? Object.keys(t1.attributes).sort() : []\n attr2 = t2.attributes ? Object.keys(t2.attributes).sort() : []\n\n attrLength = attr1.length\n for (i = 0; i < attrLength; i++) {\n attr = attr1[i]\n pos = attr2.indexOf(attr)\n if (pos === -1) {\n diffs.push(\n new Diff()\n .setValue(\n this.options._const.action,\n this.options._const.removeAttribute,\n )\n .setValue(this.options._const.route, route)\n .setValue(this.options._const.name, attr)\n .setValue(\n this.options._const.value,\n t1.attributes[attr],\n ),\n )\n } else {\n attr2.splice(pos, 1)\n if (t1.attributes[attr] !== t2.attributes[attr]) {\n diffs.push(\n new Diff()\n .setValue(\n this.options._const.action,\n this.options._const.modifyAttribute,\n )\n .setValue(this.options._const.route, route)\n .setValue(this.options._const.name, attr)\n .setValue(\n this.options._const.oldValue,\n t1.attributes[attr],\n )\n .setValue(\n this.options._const.newValue,\n t2.attributes[attr],\n ),\n )\n }\n }\n }\n\n attrLength = attr2.length\n for (i = 0; i < attrLength; i++) {\n attr = attr2[i]\n diffs.push(\n new Diff()\n .setValue(\n this.options._const.action,\n this.options._const.addAttribute,\n )\n .setValue(this.options._const.route, route)\n .setValue(this.options._const.name, attr)\n .setValue(this.options._const.value, t2.attributes[attr]),\n )\n }\n\n return diffs\n }\n\n findInnerDiff(\n t1: elementDiffNodeType,\n t2: elementDiffNodeType,\n route: number[],\n ) {\n const t1ChildNodes = t1.childNodes ? t1.childNodes.slice() : []\n const t2ChildNodes = t2.childNodes ? t2.childNodes.slice() : []\n const last = Math.max(t1ChildNodes.length, t2ChildNodes.length)\n let childNodesLengthDifference = Math.abs(\n t1ChildNodes.length - t2ChildNodes.length,\n )\n let diffs: Diff[] = []\n let index = 0\n if (!this.options.maxChildCount || last < this.options.maxChildCount) {\n const cachedSubtrees = Boolean(t1.subsets && t1.subsetsAge--)\n const subtrees = cachedSubtrees\n ? t1.subsets\n : t1.childNodes && t2.childNodes\n ? markSubTrees(t1, t2)\n : []\n if (subtrees.length > 0) {\n /* One or more groups have been identified among the childnodes of t1\n * and t2.\n */\n diffs = this.attemptGroupRelocation(\n t1,\n t2,\n subtrees,\n route,\n cachedSubtrees,\n )\n if (diffs.length > 0) {\n return diffs\n }\n }\n }\n\n /* 0 or 1 groups of similar child nodes have been found\n * for t1 and t2. 1 If there is 1, it could be a sign that the\n * contents are the same. When the number of groups is below 2,\n * t1 and t2 are made to have the same length and each of the\n * pairs of child nodes are diffed.\n */\n\n for (let i = 0; i < last; i += 1) {\n const e1 = t1ChildNodes[i]\n const e2 = t2ChildNodes[i]\n\n if (childNodesLengthDifference) {\n /* t1 and t2 have different amounts of childNodes. Add\n * and remove as necessary to obtain the same length */\n if (e1 && !e2) {\n if (e1.nodeName === \"#text\") {\n diffs.push(\n new Diff()\n .setValue(\n this.options._const.action,\n this.options._const.removeTextElement,\n )\n .setValue(\n this.options._const.route,\n route.concat(index),\n )\n .setValue(\n this.options._const.value,\n (e1 as textDiffNodeType).data,\n ),\n )\n index -= 1\n } else {\n diffs.push(\n new Diff()\n .setValue(\n this.options._const.action,\n this.options._const.removeElement,\n )\n .setValue(\n this.options._const.route,\n route.concat(index),\n )\n .setValue(\n this.options._const.element,\n cleanNode(e1),\n ),\n )\n index -= 1\n }\n } else if (e2 && !e1) {\n if (e2.nodeName === \"#text\") {\n diffs.push(\n new Diff()\n .setValue(\n this.options._const.action,\n this.options._const.addTextElement,\n )\n .setValue(\n this.options._const.route,\n route.concat(index),\n )\n .setValue(\n this.options._const.value,\n (e2 as textDiffNodeType).data,\n ),\n )\n } else {\n diffs.push(\n new Diff()\n .setValue(\n this.options._const.action,\n this.options._const.addElement,\n )\n .setValue(\n this.options._const.route,\n route.concat(index),\n )\n .setValue(\n this.options._const.element,\n cleanNode(e2),\n ),\n )\n }\n }\n }\n /* We are now guaranteed that childNodes e1 and e2 exist,\n * and that they can be diffed.\n */\n /* Diffs in child nodes should not affect the parent node,\n * so we let these diffs be submitted together with other\n * diffs.\n */\n\n if (e1 && e2) {\n if (\n !this.options.maxChildCount ||\n last < this.options.maxChildCount\n ) {\n diffs = diffs.concat(\n this.findNextDiff(e1, e2, route.concat(index)),\n )\n } else if (!isEqual(e1, e2)) {\n if (t1ChildNodes.length > t2ChildNodes.length) {\n if (e1.nodeName === \"#text\") {\n diffs.push(\n new Diff()\n .setValue(\n this.options._const.action,\n this.options._const.removeTextElement,\n )\n .setValue(\n this.options._const.route,\n route.concat(index),\n )\n .setValue(\n this.options._const.value,\n (e1 as textDiffNodeType).data,\n ),\n )\n } else {\n diffs.push(\n new Diff()\n .setValue(\n this.options._const.action,\n this.options._const.removeElement,\n )\n .setValue(\n this.options._const.element,\n cleanNode(e1),\n )\n .setValue(\n this.options._const.route,\n route.concat(index),\n ),\n )\n }\n t1ChildNodes.splice(i, 1)\n i -= 1\n index -= 1\n\n childNodesLengthDifference -= 1\n } else if (t1ChildNodes.length < t2ChildNodes.length) {\n diffs = diffs.concat([\n new Diff()\n .setValue(\n this.options._const.action,\n this.options._const.addElement,\n )\n .setValue(\n this.options._const.element,\n cleanNode(e2),\n )\n .setValue(\n this.options._const.route,\n route.concat(index),\n ),\n ])\n t1ChildNodes.splice(i, 0, cleanNode(e2))\n childNodesLengthDifference -= 1\n } else {\n diffs = diffs.concat([\n new Diff()\n .setValue(\n this.options._const.action,\n this.options._const.replaceElement,\n )\n .setValue(\n this.options._const.oldValue,\n cleanNode(e1),\n )\n .setValue(\n this.options._const.newValue,\n cleanNode(e2),\n )\n .setValue(\n this.options._const.route,\n route.concat(index),\n ),\n ])\n }\n }\n }\n index += 1\n }\n t1.innerDone = true\n return diffs\n }\n\n attemptGroupRelocation(\n t1: elementDiffNodeType,\n t2: elementDiffNodeType,\n subtrees: subsetType[],\n route: number[],\n cachedSubtrees: boolean,\n ) {\n /* Either t1.childNodes and t2.childNodes have the same length, or\n * there are at least two groups of similar elements can be found.\n * attempts are made at equalizing t1 with t2. First all initial\n * elements with no group affiliation (gaps=true) are removed (if\n * only in t1) or added (if only in t2). Then the creation of a group\n * relocation diff is attempted.\n */\n const gapInformation = getGapInformation(t1, t2, subtrees)\n const gaps1 = gapInformation.gaps1\n const gaps2 = gapInformation.gaps2\n const t1ChildNodes = t1.childNodes.slice()\n const t2ChildNodes = t2.childNodes.slice()\n let shortest = Math.min(gaps1.length, gaps2.length)\n let destinationDifferent\n let toGroup\n let group\n let node\n let similarNode\n const diffs = []\n for (\n let index2 = 0, index1 = 0;\n index2 < shortest;\n index1 += 1, index2 += 1\n ) {\n if (\n cachedSubtrees &&\n (gaps1[index2] === true || gaps2[index2] === true)\n ) {\n // pass\n } else if (gaps1[index1] === true) {\n node = t1ChildNodes[index1]\n if (node.nodeName === \"#text\") {\n if (t2ChildNodes[index2].nodeName === \"#text\") {\n if (\n (node as textDiffNodeType).data !==\n (t2ChildNodes[index2] as textDiffNodeType).data\n ) {\n // Check whether a text node with the same value follows later on.\n let testI = index1\n while (\n t1ChildNodes.length > testI + 1 &&\n t1ChildNodes[testI + 1].nodeName === \"#text\"\n ) {\n testI += 1\n if (\n (t2ChildNodes[index2] as textDiffNodeType)\n .data ===\n (t1ChildNodes[testI] as textDiffNodeType)\n .data\n ) {\n similarNode = true\n break\n }\n }\n if (!similarNode) {\n diffs.push(\n new Diff()\n .setValue(\n this.options._const.action,\n this.options._const\n .modifyTextElement,\n )\n .setValue(\n this.options._const.route,\n route.concat(index1),\n )\n .setValue(\n this.options._const.oldValue,\n node.data,\n )\n .setValue(\n this.options._const.newValue,\n (\n t2ChildNodes[\n index2\n ] as textDiffNodeType\n ).data,\n ),\n // t1ChildNodes at position index1 is not up-to-date, but that does not matter as\n // index1 will increase +1\n )\n }\n }\n } else {\n diffs.push(\n new Diff()\n .setValue(\n this.options._const.action,\n this.options._const.removeTextElement,\n )\n .setValue(\n this.options._const.route,\n route.concat(index1),\n )\n .setValue(this.options._const.value, node.data),\n )\n gaps1.splice(index1, 1)\n t1ChildNodes.splice(index1, 1)\n shortest = Math.min(gaps1.length, gaps2.length)\n index1 -= 1\n index2 -= 1\n }\n } else if (gaps2[index2] === true) {\n // both gaps1[index1] and gaps2[index2] are true.\n // We replace one element with another.\n diffs.push(\n new Diff()\n .setValue(\n this.options._const.action,\n this.options._const.replaceElement,\n )\n .setValue(\n this.options._const.oldValue,\n cleanNode(node),\n )\n .setValue(\n this.options._const.newValue,\n cleanNode(t2ChildNodes[index2]),\n )\n .setValue(\n this.options._const.route,\n route.concat(index1),\n ),\n )\n // t1ChildNodes at position index1 is not up-to-date, but that does not matter as\n // index1 will increase +1\n } else {\n diffs.push(\n new Diff()\n .setValue(\n this.options._const.action,\n this.options._const.removeElement,\n )\n .setValue(\n this.options._const.route,\n route.concat(index1),\n )\n .setValue(\n this.options._const.element,\n cleanNode(node),\n ),\n )\n gaps1.splice(index1, 1)\n t1ChildNodes.splice(index1, 1)\n shortest = Math.min(gaps1.length, gaps2.length)\n index1 -= 1\n index2 -= 1\n }\n } else if (gaps2[index2] === true) {\n node = t2ChildNodes[index2]\n if (node.nodeName === \"#text\") {\n diffs.push(\n new Diff()\n .setValue(\n this.options._const.action,\n this.options._const.addTextElement,\n )\n .setValue(\n this.options._const.route,\n route.concat(index1),\n )\n .setValue(this.options._const.value, node.data),\n )\n gaps1.splice(index1, 0, true)\n t1ChildNodes.splice(index1, 0, {\n nodeName: \"#text\",\n data: node.data,\n })\n shortest = Math.min(gaps1.length, gaps2.length)\n //index1 += 1\n } else {\n diffs.push(\n new Diff()\n .setValue(\n this.options._const.action,\n this.options._const.addElement,\n )\n .setValue(\n this.options._const.route,\n route.concat(index1),\n )\n .setValue(\n this.options._const.element,\n cleanNode(node),\n ),\n )\n gaps1.splice(index1, 0, true)\n t1ChildNodes.splice(index1, 0, cleanNode(node))\n shortest = Math.min(gaps1.length, gaps2.length)\n //index1 += 1\n }\n } else if (gaps1[index1] !== gaps2[index2]) {\n if (diffs.length > 0) {\n return diffs\n }\n // group relocation\n group = subtrees[gaps1[index1] as number]\n toGroup = Math.min(\n group.newValue,\n t1ChildNodes.length - group.length,\n )\n if (toGroup !== group.oldValue && toGroup > -1) {\n // Check whether destination nodes are different than originating ones.\n destinationDifferent = false\n for (let j = 0; j < group.length; j += 1) {\n if (\n !roughlyEqual(\n t1ChildNodes[toGroup + j],\n t1ChildNodes[group.oldValue + j],\n {},\n false,\n true,\n )\n ) {\n destinationDifferent = true\n }\n }\n if (destinationDifferent) {\n return [\n new Diff()\n .setValue(\n this.options._const.action,\n this.options._const.relocateGroup,\n )\n .setValue(\n this.options._const.groupLength,\n group.length,\n )\n .setValue(\n this.options._const.from,\n group.oldValue,\n )\n .setValue(this.options._const.to, toGroup)\n .setValue(this.options._const.route, route),\n ]\n }\n }\n }\n }\n return diffs\n }\n\n findValueDiff(\n t1: elementDiffNodeType,\n t2: elementDiffNodeType,\n route: number[],\n ) {\n // Differences of value. Only useful if the value/selection/checked value\n // differs from what is represented in the DOM. For example in the case\n // of filled out forms, etc.\n const diffs = []\n\n if (t1.selected !== t2.selected) {\n diffs.push(\n new Diff()\n .setValue(\n this.options._const.action,\n this.options._const.modifySelected,\n )\n .setValue(this.options._const.oldValue, t1.selected)\n .setValue(this.options._const.newValue, t2.selected)\n .setValue(this.options._const.route, route),\n )\n }\n\n if (\n (t1.value || t2.value) &&\n t1.value !== t2.value &&\n t1.nodeName !== \"OPTION\"\n ) {\n diffs.push(\n new Diff()\n .setValue(\n this.options._const.action,\n this.options._const.modifyValue,\n )\n .setValue(this.options._const.oldValue, t1.value || \"\")\n .setValue(this.options._const.newValue, t2.value || \"\")\n .setValue(this.options._const.route, route),\n )\n }\n if (t1.checked !== t2.checked) {\n diffs.push(\n new Diff()\n .setValue(\n this.options._const.action,\n this.options._const.modifyChecked,\n )\n .setValue(this.options._const.oldValue, t1.checked)\n .setValue(this.options._const.newValue, t2.checked)\n .setValue(this.options._const.route, route),\n )\n }\n\n return diffs\n }\n}\n","import {\n ConstNames,\n ConstNamesPartial,\n DiffDOMOptions,\n DiffDOMOptionsPartial,\n diffType,\n elementNodeType,\n textNodeType,\n} from \"./types\"\nimport { applyDOM, undoDOM } from \"./dom/index\"\nimport { Diff } from \"./helpers\"\nimport { DiffFinder } from \"./virtual/index\"\nexport { nodeToObj, stringToObj } from \"./virtual/index\"\n\nconst DEFAULT_OPTIONS = {\n debug: false,\n diffcap: 10, // Limit for how many diffs are accepting when debugging. Inactive when debug is false.\n maxDepth: false, // False or a numeral. If set to a numeral, limits the level of depth that the the diff mechanism looks for differences. If false, goes through the entire tree.\n maxChildCount: 50, // False or a numeral. If set to a numeral, only does a simplified form of diffing of contents so that the number of diffs cannot be higher than the number of child nodes.\n valueDiffing: true, // Whether to take into consideration the values of forms that differ from auto assigned values (when a user fills out a form).\n // syntax: textDiff: function (node, currentValue, expectedValue, newValue)\n textDiff(\n node: textNodeType,\n currentValue: string,\n expectedValue: string,\n newValue: string,\n ) {\n node.data = newValue\n return\n },\n // empty functions were benchmarked as running faster than both\n // `f && f()` and `if (f) { f(); }`\n preVirtualDiffApply() {}, // eslint-disable-line @typescript-eslint/no-empty-function\n postVirtualDiffApply() {}, // eslint-disable-line @typescript-eslint/no-empty-function\n preDiffApply() {}, // eslint-disable-line @typescript-eslint/no-empty-function\n postDiffApply() {}, // eslint-disable-line @typescript-eslint/no-empty-function\n filterOuterDiff: null,\n compress: false, // Whether to work with compressed diffs\n _const: false, // object with strings for every change types to be used in diffs.\n document:\n typeof window !== \"undefined\" && window.document\n ? window.document\n : false,\n components: [], // list of components used for converting from string\n}\n\nexport class DiffDOM {\n options: DiffDOMOptions\n constructor(options: DiffDOMOptionsPartial = {}) {\n // IE11 doesn't have Object.assign and buble doesn't translate object spreaders\n // by default, so this is the safest way of doing it currently.\n Object.entries(DEFAULT_OPTIONS).forEach(([key, value]) => {\n if (!Object.prototype.hasOwnProperty.call(options, key)) {\n options[key] = value\n }\n })\n\n if (!options._const) {\n const varNames = [\n \"addAttribute\",\n \"modifyAttribute\",\n \"removeAttribute\",\n \"modifyTextElement\",\n \"relocateGroup\",\n \"removeElement\",\n \"addElement\",\n \"removeTextElement\",\n \"addTextElement\",\n \"replaceElement\",\n \"modifyValue\",\n \"modifyChecked\",\n \"modifySelected\",\n \"modifyComment\",\n \"action\",\n \"route\",\n \"oldValue\",\n \"newValue\",\n \"element\",\n \"group\",\n \"groupLength\",\n \"from\",\n \"to\",\n \"name\",\n \"value\",\n \"data\",\n \"attributes\",\n \"nodeName\",\n \"childNodes\",\n \"checked\",\n \"selected\",\n ]\n const constNames: ConstNamesPartial = {}\n if (options.compress) {\n varNames.forEach(\n (varName, index) => (constNames[varName] = index),\n )\n } else {\n varNames.forEach((varName) => (constNames[varName] = varName))\n }\n options._const = constNames as ConstNames\n }\n\n this.options = options as DiffDOMOptions\n }\n\n apply(tree: Element, diffs: (Diff | diffType)[]) {\n return applyDOM(tree, diffs, this.options)\n }\n\n undo(tree: Element, diffs: (Diff | diffType)[]) {\n return undoDOM(tree, diffs, this.options)\n }\n\n diff(\n t1Node: string | elementNodeType | Element,\n t2Node: string | elementNodeType | Element,\n ) {\n const finder = new DiffFinder(t1Node, t2Node, this.options)\n return finder.init()\n }\n}\n","import { checkElementType } from \"./diffDOM/helpers\"\n\n/**\n * Use TraceLogger to figure out function calls inside\n * JS objects by wrapping an object with a TraceLogger\n * instance.\n *\n * Pretty-prints the call trace (using unicode box code)\n * when tracelogger.toString() is called.\n */\n\n/**\n * Wrap an object by calling new TraceLogger(obj)\n *\n * If you're familiar with Python decorators, this\n * does roughly the same thing, adding pre/post\n * call hook logging calls so that you can see\n * what's going on.\n */\nexport class TraceLogger {\n messages: string[]\n pad: string\n padding: string\n tick: number\n constructor(obj = {}) {\n this.pad = \"│ \"\n this.padding = \"\"\n this.tick = 1\n this.messages = []\n const wrapkey = (obj: object, key: string) => {\n // trace this function\n const oldfn = obj[key]\n obj[key] = (\n ...args: ((\n ...args: (\n | string\n | HTMLElement\n | number\n | boolean\n | false\n | (string | HTMLElement | number | boolean | false)[]\n )[]\n ) => void)[]\n ) => {\n this.fin(key, Array.prototype.slice.call(args))\n const result = oldfn.apply(obj, args)\n this.fout(key, result)\n return result\n }\n }\n // can't use Object.keys for prototype walking\n for (let key in obj) {\n if (typeof obj[key] === \"function\") {\n wrapkey(obj, key)\n }\n }\n this.log(\"┌ TRACELOG START\")\n }\n // called when entering a function\n fin(\n fn: string,\n args:\n | string\n | HTMLElement\n | number\n | boolean\n | false\n | (string | HTMLElement | number | boolean | false)[],\n ) {\n this.padding += this.pad\n this.log(`├─> entering ${fn}`, args)\n }\n // called when exiting a function\n fout(\n fn: string,\n result:\n | string\n | HTMLElement\n | number\n | boolean\n | false\n | (string | HTMLElement | number | boolean | false)[],\n ) {\n this.log(\"│<──┘ generated return value\", result)\n this.padding = this.padding.substring(\n 0,\n this.padding.length - this.pad.length,\n )\n }\n // log message formatting\n format(s: string, tick: number) {\n let nf = function (t: number) {\n let tStr = `${t}`\n while (tStr.length < 4) {\n tStr = `0${t}`\n }\n return tStr\n }\n return `${nf(tick)}> ${this.padding}${s}`\n }\n // log a trace message\n log(...args) {\n const stringCollapse = function (\n v:\n | string\n | HTMLElement\n | number\n | boolean\n | false\n | (string | HTMLElement | number | boolean | false)[],\n ) {\n if (!v) {\n return \"<falsey>\"\n }\n if (typeof v === \"string\") {\n return v\n }\n if (checkElementType(v, \"HTMLElement\")) {\n return (v as HTMLElement).outerHTML || \"<empty>\"\n }\n if (v instanceof Array) {\n return `[${v.map(stringCollapse).join(\",\")}]`\n }\n return v.toString() || v.valueOf() || \"<unknown>\"\n }\n const s = args.map(stringCollapse).join(\", \")\n this.messages.push(this.format(s, this.tick++))\n }\n // turn the log into a structured string with\n // unicode box codes to make it a sensible trace.\n toString() {\n let cap = \"× \"\n let terminator = \"└───\"\n while (terminator.length <= this.padding.length + this.pad.length) {\n terminator += cap\n }\n let _ = this.padding\n this.padding = \"\"\n terminator = this.format(terminator, this.tick)\n this.padding = _\n return `${this.messages.join(\"\\n\")}\\n${terminator}`\n }\n}\n"],"names":["__assign","Object","assign","t","s","i","n","arguments","length","p","prototype","hasOwnProperty","call","apply","this","__spreadArray","to","from","pack","ar","l","Array","slice","concat","SuppressedError","Diff","options","_this","entries","forEach","_a","key","value","toString","JSON","stringify","setValue","aKey","aValue","checkElementType","element","elementTypeNames","_i","some","elementTypeName","_b","ownerDocument","defaultView","objToNode","objNode","insideSvg","node","nodeName","document","createTextNode","data","createComment","createElementNS","toLowerCase","createElement","attributes","setAttribute","childNodes","childNode","appendChild","valueDiffing","checked","selected","getFromRoute","route","c","splice","applyDiff","tree","diff","newNode","reference","action","_const","addElement","addTextElement","includes","info","preDiffApply","addAttribute","name","modifyAttribute","newValue","removeAttribute","modifyTextElement","textDiff","oldValue","parentNode","modifyValue","modifyComment","modifyChecked","modifySelected","replaceElement","namespaceURI","replaceChild","relocateGroup","groupLength","map","removeChild","index","insertBefore","removeElement","parentRoute","removeTextElement","nodeType","console","log","postDiffApply","swap","obj","p1","p2","tmp","undoDOM","diffs","reverse","undoDiff","elementDescriptors","el","output","push","replace","id","findUniqueDescriptors","li","uniqueDescriptors","duplicateDescriptors","descriptor","inUnique","uniqueInBoth","l1","l2","l1Unique","l2Unique","inBoth","keys","removeDone","outerDone","innerDone","valueDone","every","cleanNode","diffNode","elementNode","diffChildNode","isEqual","e1","e2","Boolean","e1Attributes","e2Attributes","attribute","roughlyEqual","sameSiblings","preventRecursion","nodeList1","nodeList2","childUniqueDescriptors_1","makeBooleanArray","v","markSubTrees","oldTree","newTree","oldChildren","newChildren","marked1","marked2","subsets","returnIndex","foundAllSubsets","subset","c1","c2","lcsSize","c1Length","c2Length","matches","subsetsSame","c1Desc","c2Desc","description","c1Index","c1Element","c2Index","c2Element","findCommonSubsets","item","markBoth","subsetsAge","DiffTracker","list","add","fn","getFromVirtualRoute","nodeIndex","undefined","applyVirtual","routeInfo","newSubsets","preVirtualDiffApply","movedNode","splitLength","c_1","c_2","filter","postVirtualDiffApply","applyVirtualDiff","nodeToObj","aNode","type","tagRE","attrRE","unescape","string","lookup","area","base","br","col","embed","hr","img","input","keygen","link","menuItem","meta","param","source","track","wbr","parseTag","tag","caseSensitive","res","voidElement","tagMatch","match","toUpperCase","charAt","startsWith","endIndex","indexOf","reg","RegExp","result","done","exec","trim","attr","arr","split","lastIndex","substring","stringToObj","html","current","level","end","isOpen","isComment","start","nextChar","comment","parent_1","parent_2","DiffFinder","t1Node","t2Node","t1","Element","parse","t2","diffcount","foundAll","debug","t1Orig","t2Orig","tracker","init","findDiffs","diffcap","Error","findNextDiff","error","fdiffs","maxDepth","findOuterDiff","filterOuterDiff","findInnerDiff","findValueDiff","attr1","attr2","attrLength","pos","Math","abs","sort","t1ChildNodes","t2ChildNodes","last","max","childNodesLengthDifference","maxChildCount","cachedSubtrees","subtrees","attemptGroupRelocation","destinationDifferent","toGroup","group","similarNode","gapInformation","stable","gaps1","gaps2","endOld","endNew","j","getGapInformation","shortest","min","index2","index1","testI","DEFAULT_OPTIONS","currentValue","expectedValue","compress","window","components","DiffDOM","varNames","constNames_1","varName","applyDOM","undo","TraceLogger","pad","padding","tick","messages","wrapkey","oldfn","args","fin","fout","format","tStr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