clapton 0.0.12 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +33 -0
- data/app/helpers/clapton/clapton_helper.rb +16 -1
- data/lib/clapton/engine.rb +16 -10
- data/lib/clapton/javascripts/dist/client.js +65 -39
- data/lib/clapton/javascripts/dist/components-for-test.js +439 -0
- data/lib/clapton/javascripts/dist/components.js +357 -369
- 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 -1
- data/lib/clapton/javascripts/src/actions/initialize-actions.ts +11 -0
- data/lib/clapton/javascripts/src/channel/clapton-channel.js +8 -4
- data/lib/clapton/javascripts/src/client.ts +15 -18
- data/lib/clapton/javascripts/src/components/box.ts +5 -0
- data/lib/clapton/javascripts/src/components/embed.spec.ts +8 -0
- data/lib/clapton/javascripts/src/components/embed.ts +11 -0
- data/lib/clapton/javascripts/src/components-for-test.ts +29 -0
- data/lib/clapton/javascripts/src/components.ts +5 -1
- data/lib/clapton/javascripts/src/dom/update-component.ts +3 -2
- data/lib/clapton/javascripts/src/inputs/initialize-inputs.ts +3 -3
- data/lib/clapton/test_helper/base.rb +1 -1
- data/lib/clapton/version.rb +2 -1
- metadata +51 -3
- data/lib/clapton/javascripts/src/dom/update-component.spec.ts +0 -32
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.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":["arguments"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAeA;AACO,IAAI,QAAQ,GAAG,WAAW;AACjC,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,IAAI,SAAS,QAAQ,CAAC,CAAC,EAAE;;AAAC;AACtD,QAAQ,KAAK,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;AAC7D,YAAY,CAAC,GAAGA,WAAS,CAAC,CAAC,CAAC,CAAC;AAC7B,YAAY,KAAK,IAAI,CAAC,IAAI,CAAC,EAAA,EAAE,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAA,EAAE,CAAC,CAAC,CAAC,CAAC,GA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,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;KAClD,CAAA;;;AAGD,IAAA,WAAA,CAAA,SAAA,CAAA,QAAQ,GAAR,YAAA;QACI,IAAI,GAAG,GAAG,MAAM,CAAA;QAChB,IAAI,UAAU,GAAG,MAAM,CAAA;AACvB,QAAA,OAAO,UAAU,CAAC,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE;YAC/D,UAAU,IAAI,GAAG,CAAA;AACpB,SAAA;AACD,QAAA,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAA;AACpB,QAAA,IAAI,CAAC,OAAO,GAAG,EAAE,CAAA;QACjB,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;AAC/C,QAAA,IAAI,CAAC,OAAO,GAAG,CAAC,CAAA;AAChB,QAAA,OAAO,EAAG,CAAA,MAAA,CAAA,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAA,IAAA,CAAA,CAAA,MAAA,CAAK,UAAU,CAAE,CAAA;KACtD,CAAA;IACL,OAAC,WAAA,CAAA;AAAD,CAAC,EAAA;;;;;;;","x_google_ignoreList":[0]}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
"use strict";var e=function(){return e=Object.assign||function(e){for(var t,n=arguments,o=1,s=arguments.length;o<s;o++)for(var i in t=n[o])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},e.apply(this,arguments)};function t(e,t,n){if(n||2===arguments.length)for(var o,s=0,i=t.length;s<i;s++)!o&&s in t||(o||(o=Array.prototype.slice.call(t,0,s)),o[s]=t[s]);return e.concat(o||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var n=function(){function e(e){void 0===e&&(e={});var t=this;Object.entries(e).forEach((function(e){var n=e[0],o=e[1];return t[n]=o}))}return e.prototype.toString=function(){return JSON.stringify(this)},e.prototype.setValue=function(e,t){return this[e]=t,this},e}();function o(e){for(var t=arguments,n=[],o=1;o<arguments.length;o++)n[o-1]=t[o];return null!=e&&n.some((function(t){var n,o;return"function"==typeof(null===(o=null===(n=null==e?void 0:e.ownerDocument)||void 0===n?void 0:n.defaultView)||void 0===o?void 0:o[t])&&e instanceof e.ownerDocument.defaultView[t]}))}function s(e,t,n){var i;return"#text"===e.nodeName?i=n.document.createTextNode(e.data):"#comment"===e.nodeName?i=n.document.createComment(e.data):(t?(i=n.document.createElementNS("http://www.w3.org/2000/svg",e.nodeName),"foreignObject"===e.nodeName&&(t=!1)):"svg"===e.nodeName.toLowerCase()?(i=n.document.createElementNS("http://www.w3.org/2000/svg","svg"),t=!0):i=n.document.createElement(e.nodeName),e.attributes&&Object.entries(e.attributes).forEach((function(e){var t=e[0],n=e[1];return i.setAttribute(t,n)})),e.childNodes&&e.childNodes.forEach((function(e){return i.appendChild(s(e,t,n))})),n.valueDiffing&&(e.value&&o(i,"HTMLButtonElement","HTMLDataElement","HTMLInputElement","HTMLLIElement","HTMLMeterElement","HTMLOptionElement","HTMLProgressElement","HTMLParamElement")&&(i.value=e.value),e.checked&&o(i,"HTMLInputElement")&&(i.checked=e.checked),e.selected&&o(i,"HTMLOptionElement")&&(i.selected=e.selected))),i}var i=function(e,t){for(t=t.slice();t.length>0;){var n=t.splice(0,1)[0];e=e.childNodes[n]}return e};function a(e,n,a){var l,c,r,u=n[a._const.action],d=n[a._const.route];[a._const.addElement,a._const.addTextElement].includes(u)||(l=i(e,d));var h={diff:n,node:l};if(a.preDiffApply(h))return!0;switch(u){case a._const.addAttribute:if(!l||!o(l,"Element"))return!1;l.setAttribute(n[a._const.name],n[a._const.value]);break;case a._const.modifyAttribute:if(!l||!o(l,"Element"))return!1;l.setAttribute(n[a._const.name],n[a._const.newValue]),o(l,"HTMLInputElement")&&"value"===n[a._const.name]&&(l.value=n[a._const.newValue]);break;case a._const.removeAttribute:if(!l||!o(l,"Element"))return!1;l.removeAttribute(n[a._const.name]);break;case a._const.modifyTextElement:if(!l||!o(l,"Text"))return!1;a.textDiff(l,l.data,n[a._const.oldValue],n[a._const.newValue]),o(l.parentNode,"HTMLTextAreaElement")&&(l.parentNode.value=n[a._const.newValue]);break;case a._const.modifyValue:if(!l||void 0===l.value)return!1;l.value=n[a._const.newValue];break;case a._const.modifyComment:if(!l||!o(l,"Comment"))return!1;a.textDiff(l,l.data,n[a._const.oldValue],n[a._const.newValue]);break;case a._const.modifyChecked:if(!l||void 0===l.checked)return!1;l.checked=n[a._const.newValue];break;case a._const.modifySelected:if(!l||void 0===l.selected)return!1;l.selected=n[a._const.newValue];break;case a._const.replaceElement:var f="svg"===n[a._const.newValue].nodeName.toLowerCase()||"http://www.w3.org/2000/svg"===l.parentNode.namespaceURI;l.parentNode.replaceChild(s(n[a._const.newValue],f,a),l);break;case a._const.relocateGroup:t([],new Array(n[a._const.groupLength]),!0).map((function(){return l.removeChild(l.childNodes[n[a._const.from]])})).forEach((function(e,t){0===t&&(r=l.childNodes[n[a._const.to]]),l.insertBefore(e,r||null)}));break;case a._const.removeElement:l.parentNode.removeChild(l);break;case a._const.addElement:var p=(_=d.slice()).splice(_.length-1,1)[0];if(!o(l=i(e,_),"Element"))return!1;l.insertBefore(s(n[a._const.element],"http://www.w3.org/2000/svg"===l.namespaceURI,a),l.childNodes[p]||null);break;case a._const.removeTextElement:if(!l||3!==l.nodeType)return!1;var m=l.parentNode;m.removeChild(l),o(m,"HTMLTextAreaElement")&&(m.value="");break;case a._const.addTextElement:var _;p=(_=d.slice()).splice(_.length-1,1)[0];if(c=a.document.createTextNode(n[a._const.value]),!(l=i(e,_)).childNodes)return!1;l.insertBefore(c,l.childNodes[p]||null),o(l.parentNode,"HTMLTextAreaElement")&&(l.parentNode.value=n[a._const.value]);break;default:console.log("unknown action")}return a.postDiffApply({diff:h.diff,node:h.node,newNode:c}),!0}function l(e,t,n){var o=e[t];e[t]=e[n],e[n]=o}function c(e,t,n){(t=t.slice()).reverse(),t.forEach((function(t){!function(e,t,n){switch(t[n._const.action]){case n._const.addAttribute:t[n._const.action]=n._const.removeAttribute,a(e,t,n);break;case n._const.modifyAttribute:l(t,n._const.oldValue,n._const.newValue),a(e,t,n);break;case n._const.removeAttribute:t[n._const.action]=n._const.addAttribute,a(e,t,n);break;case n._const.modifyTextElement:case n._const.modifyValue:case n._const.modifyComment:case n._const.modifyChecked:case n._const.modifySelected:case n._const.replaceElement:l(t,n._const.oldValue,n._const.newValue),a(e,t,n);break;case n._const.relocateGroup:l(t,n._const.from,n._const.to),a(e,t,n);break;case n._const.removeElement:t[n._const.action]=n._const.addElement,a(e,t,n);break;case n._const.addElement:t[n._const.action]=n._const.removeElement,a(e,t,n);break;case n._const.removeTextElement:t[n._const.action]=n._const.addTextElement,a(e,t,n);break;case n._const.addTextElement:t[n._const.action]=n._const.removeTextElement,a(e,t,n);break;default:console.log("unknown action")}}(e,t,n)}))}var r=function(e){var t=[];return t.push(e.nodeName),"#text"!==e.nodeName&&"#comment"!==e.nodeName&&e.attributes&&(e.attributes.class&&t.push("".concat(e.nodeName,".").concat(e.attributes.class.replace(/ /g,"."))),e.attributes.id&&t.push("".concat(e.nodeName,"#").concat(e.attributes.id))),t},u=function(e){var t={},n={};return e.forEach((function(e){r(e).forEach((function(e){var o=e in t;o||e in n?o&&(delete t[e],n[e]=!0):t[e]=!0}))})),t},d=function(e,t){var n=u(e),o=u(t),s={};return Object.keys(n).forEach((function(e){o[e]&&(s[e]=!0)})),s},h=function(e){return delete e.outerDone,delete e.innerDone,delete e.valueDone,!e.childNodes||e.childNodes.every(h)},f=function(t){if(Object.prototype.hasOwnProperty.call(t,"data"))return{nodeName:"#text"===t.nodeName?"#text":"#comment",data:t.data};var n={nodeName:t.nodeName};return Object.prototype.hasOwnProperty.call(t,"attributes")&&(n.attributes=e({},t.attributes)),Object.prototype.hasOwnProperty.call(t,"checked")&&(n.checked=t.checked),Object.prototype.hasOwnProperty.call(t,"value")&&(n.value=t.value),Object.prototype.hasOwnProperty.call(t,"selected")&&(n.selected=t.selected),Object.prototype.hasOwnProperty.call(t,"childNodes")&&(n.childNodes=t.childNodes.map((function(e){return f(e)}))),n},p=function(e,t){if(!["nodeName","value","checked","selected","data"].every((function(n){return e[n]===t[n]})))return!1;if(Object.prototype.hasOwnProperty.call(e,"data"))return!0;if(Boolean(e.attributes)!==Boolean(t.attributes))return!1;if(Boolean(e.childNodes)!==Boolean(t.childNodes))return!1;if(e.attributes){var n=Object.keys(e.attributes),o=Object.keys(t.attributes);if(n.length!==o.length)return!1;if(!n.every((function(n){return e.attributes[n]===t.attributes[n]})))return!1}if(e.childNodes){if(e.childNodes.length!==t.childNodes.length)return!1;if(!e.childNodes.every((function(e,n){return p(e,t.childNodes[n])})))return!1}return!0},m=function(e,t,n,o,s){if(void 0===s&&(s=!1),!e||!t)return!1;if(e.nodeName!==t.nodeName)return!1;if(["#text","#comment"].includes(e.nodeName))return!!s||e.data===t.data;if(e.nodeName in n)return!0;if(e.attributes&&t.attributes){if(e.attributes.id){if(e.attributes.id!==t.attributes.id)return!1;if("".concat(e.nodeName,"#").concat(e.attributes.id)in n)return!0}if(e.attributes.class&&e.attributes.class===t.attributes.class)if("".concat(e.nodeName,".").concat(e.attributes.class.replace(/ /g,"."))in n)return!0}if(o)return!0;var i=e.childNodes?e.childNodes.slice().reverse():[],a=t.childNodes?t.childNodes.slice().reverse():[];if(i.length!==a.length)return!1;if(s)return i.every((function(e,t){return e.nodeName===a[t].nodeName}));var l=d(i,a);return i.every((function(e,t){return m(e,a[t],l,!0,!0)}))},_=function(e,n){return t([],new Array(e),!0).map((function(){return n}))},v=function(e,n){for(var o=e.childNodes?e.childNodes:[],s=n.childNodes?n.childNodes:[],i=_(o.length,!1),a=_(s.length,!1),l=[],c=function(){return arguments[1]},u=!1,h=function(){var e=function(e,n,o,s){var i=0,a=[],l=e.length,c=n.length,u=t([],new Array(l+1),!0).map((function(){return[]})),h=d(e,n),f=l===c;f&&e.some((function(e,t){var o=r(e),s=r(n[t]);return o.length!==s.length?(f=!1,!0):(o.some((function(e,t){if(e!==s[t])return f=!1,!0})),!f||void 0)}));for(var p=0;p<l;p++)for(var _=e[p],v=0;v<c;v++){var g=n[v];o[p]||s[v]||!m(_,g,h,f)?u[p+1][v+1]=0:(u[p+1][v+1]=u[p][v]?u[p][v]+1:1,u[p+1][v+1]>=i&&(i=u[p+1][v+1],a=[p+1,v+1]))}return 0!==i&&{oldValue:a[0]-i,newValue:a[1]-i,length:i}}(o,s,i,a);e?(l.push(e),t([],new Array(e.length),!0).map(c).forEach((function(t){return function(e,t,n,o){e[n.oldValue+o]=!0,t[n.newValue+o]=!0}(i,a,e,t)}))):u=!0};!u;)h();return e.subsets=l,e.subsetsAge=100,l},g=function(){function e(){this.list=[]}return e.prototype.add=function(e){var t;(t=this.list).push.apply(t,e)},e.prototype.forEach=function(e){this.list.forEach((function(t){return e(t)}))},e}();function V(e,t){var n,o,s=e;for(t=t.slice();t.length>0;)o=t.splice(0,1)[0],n=s,s=s.childNodes?s.childNodes[o]:void 0;return{node:s,parentNode:n,nodeIndex:o}}function b(e,t,n){return t.forEach((function(t){!function(e,t,n){var o,s,i,a;if(![n._const.addElement,n._const.addTextElement].includes(t[n._const.action])){var l=V(e,t[n._const.route]);s=l.node,i=l.parentNode,a=l.nodeIndex}var c,r,u=[],d={diff:t,node:s};if(n.preVirtualDiffApply(d))return!0;switch(t[n._const.action]){case n._const.addAttribute:s.attributes||(s.attributes={}),s.attributes[t[n._const.name]]=t[n._const.value],"checked"===t[n._const.name]?s.checked=!0:"selected"===t[n._const.name]?s.selected=!0:"INPUT"===s.nodeName&&"value"===t[n._const.name]&&(s.value=t[n._const.value]);break;case n._const.modifyAttribute:s.attributes[t[n._const.name]]=t[n._const.newValue];break;case n._const.removeAttribute:delete s.attributes[t[n._const.name]],0===Object.keys(s.attributes).length&&delete s.attributes,"checked"===t[n._const.name]?s.checked=!1:"selected"===t[n._const.name]?delete s.selected:"INPUT"===s.nodeName&&"value"===t[n._const.name]&&delete s.value;break;case n._const.modifyTextElement:s.data=t[n._const.newValue],"TEXTAREA"===i.nodeName&&(i.value=t[n._const.newValue]);break;case n._const.modifyValue:s.value=t[n._const.newValue];break;case n._const.modifyComment:s.data=t[n._const.newValue];break;case n._const.modifyChecked:s.checked=t[n._const.newValue];break;case n._const.modifySelected:s.selected=t[n._const.newValue];break;case n._const.replaceElement:c=f(t[n._const.newValue]),i.childNodes[a]=c;break;case n._const.relocateGroup:s.childNodes.splice(t[n._const.from],t[n._const.groupLength]).reverse().forEach((function(e){return s.childNodes.splice(t[n._const.to],0,e)})),s.subsets&&s.subsets.forEach((function(e){if(t[n._const.from]<t[n._const.to]&&e.oldValue<=t[n._const.to]&&e.oldValue>t[n._const.from])e.oldValue-=t[n._const.groupLength],(o=e.oldValue+e.length-t[n._const.to])>0&&(u.push({oldValue:t[n._const.to]+t[n._const.groupLength],newValue:e.newValue+e.length-o,length:o}),e.length-=o);else if(t[n._const.from]>t[n._const.to]&&e.oldValue>t[n._const.to]&&e.oldValue<t[n._const.from]){var o;e.oldValue+=t[n._const.groupLength],(o=e.oldValue+e.length-t[n._const.to])>0&&(u.push({oldValue:t[n._const.to]+t[n._const.groupLength],newValue:e.newValue+e.length-o,length:o}),e.length-=o)}else e.oldValue===t[n._const.from]&&(e.oldValue=t[n._const.to])}));break;case n._const.removeElement:i.childNodes.splice(a,1),i.subsets&&i.subsets.forEach((function(e){e.oldValue>a?e.oldValue-=1:e.oldValue===a?e.delete=!0:e.oldValue<a&&e.oldValue+e.length>a&&(e.oldValue+e.length-1===a?e.length--:(u.push({newValue:e.newValue+a-e.oldValue,oldValue:a,length:e.length-a+e.oldValue-1}),e.length=a-e.oldValue))})),s=i;break;case n._const.addElement:var h=(r=t[n._const.route].slice()).splice(r.length-1,1)[0];s=null===(o=V(e,r))||void 0===o?void 0:o.node,c=f(t[n._const.element]),s.childNodes||(s.childNodes=[]),h>=s.childNodes.length?s.childNodes.push(c):s.childNodes.splice(h,0,c),s.subsets&&s.subsets.forEach((function(e){if(e.oldValue>=h)e.oldValue+=1;else if(e.oldValue<h&&e.oldValue+e.length>h){var t=e.oldValue+e.length-h;u.push({newValue:e.newValue+e.length-t,oldValue:h+1,length:t}),e.length-=t}}));break;case n._const.removeTextElement:i.childNodes.splice(a,1),"TEXTAREA"===i.nodeName&&delete i.value,i.subsets&&i.subsets.forEach((function(e){e.oldValue>a?e.oldValue-=1:e.oldValue===a?e.delete=!0:e.oldValue<a&&e.oldValue+e.length>a&&(e.oldValue+e.length-1===a?e.length--:(u.push({newValue:e.newValue+a-e.oldValue,oldValue:a,length:e.length-a+e.oldValue-1}),e.length=a-e.oldValue))})),s=i;break;case n._const.addTextElement:var p=(r=t[n._const.route].slice()).splice(r.length-1,1)[0];c={nodeName:"#text",data:t[n._const.value]},(s=V(e,r).node).childNodes||(s.childNodes=[]),p>=s.childNodes.length?s.childNodes.push(c):s.childNodes.splice(p,0,c),"TEXTAREA"===s.nodeName&&(s.value=t[n._const.newValue]),s.subsets&&s.subsets.forEach((function(e){if(e.oldValue>=p&&(e.oldValue+=1),e.oldValue<p&&e.oldValue+e.length>p){var t=e.oldValue+e.length-p;u.push({newValue:e.newValue+e.length-t,oldValue:p+1,length:t}),e.length-=t}}));break;default:console.log("unknown action")}s.subsets&&(s.subsets=s.subsets.filter((function(e){return!e.delete&&e.oldValue!==e.newValue})),u.length&&(s.subsets=s.subsets.concat(u))),n.postVirtualDiffApply({node:d.node,diff:d.diff,newNode:c})}(e,t,n)})),!0}function N(e,t){void 0===t&&(t={valueDiffing:!0});var n={nodeName:e.nodeName};if(o(e,"Text","Comment"))n.data=e.data;else{if(e.attributes&&e.attributes.length>0)n.attributes={},Array.prototype.slice.call(e.attributes).forEach((function(e){return n.attributes[e.name]=e.value}));if(e.childNodes&&e.childNodes.length>0)n.childNodes=[],Array.prototype.slice.call(e.childNodes).forEach((function(e){return n.childNodes.push(N(e,t))}));t.valueDiffing&&(o(e,"HTMLTextAreaElement")&&(n.value=e.value),o(e,"HTMLInputElement")&&["radio","checkbox"].includes(e.type.toLowerCase())&&void 0!==e.checked?n.checked=e.checked:o(e,"HTMLButtonElement","HTMLDataElement","HTMLInputElement","HTMLLIElement","HTMLMeterElement","HTMLOptionElement","HTMLProgressElement","HTMLParamElement")&&(n.value=e.value),o(e,"HTMLOptionElement")&&(n.selected=e.selected))}return n}var y=/<\s*\/*[a-zA-Z:_][a-zA-Z0-9:_\-.]*\s*(?:"[^"]*"['"]*|'[^']*'['"]*|[^'"/>])*\/*\s*>|<!--(?:.|\n|\r)*?-->/g,w=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function E(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}var k={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,menuItem:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},x=function(e,t){var n={nodeName:"",attributes:{}},o=!1,s=e.match(/<\/?([^\s]+?)[/\s>]/);if(s&&(n.nodeName=t||"svg"===s[1]?s[1]:s[1].toUpperCase(),(k[s[1]]||"/"===e.charAt(e.length-2))&&(o=!0),n.nodeName.startsWith("!--"))){var i=e.indexOf("--\x3e");return{type:"comment",node:{nodeName:"#comment",data:-1!==i?e.slice(4,i):""},voidElement:o}}for(var a=new RegExp(w),l=null,c=!1;!c;)if(null===(l=a.exec(e)))c=!0;else if(l[0].trim())if(l[1]){var r=l[1].trim(),u=[r,""];r.indexOf("=")>-1&&(u=r.split("=")),n.attributes[u[0]]=u[1],a.lastIndex--}else l[2]&&(n.attributes[l[2]]=l[3].trim().substring(1,l[3].length-1));return{type:"tag",node:n,voidElement:o}},T=function(e,t){void 0===t&&(t={valueDiffing:!0,caseSensitive:!1});var n,o=[],s=-1,i=[],a=!1;if(0!==e.indexOf("<")){var l=e.indexOf("<");o.push({nodeName:"#text",data:-1===l?e:e.substring(0,l)})}return e.replace(y,(function(l,c){var r="/"!==l.charAt(1),u=l.startsWith("\x3c!--"),d=c+l.length,h=e.charAt(d);if(u){var f=x(l,t.caseSensitive).node;if(s<0)return o.push(f),"";var p=i[s];return p&&f.nodeName&&(p.node.childNodes||(p.node.childNodes=[]),p.node.childNodes.push(f)),""}if(r){if("svg"===(n=x(l,t.caseSensitive||a)).node.nodeName&&(a=!0),s++,!n.voidElement&&h&&"<"!==h){n.node.childNodes||(n.node.childNodes=[]);var m=E(e.slice(d,e.indexOf("<",d)));n.node.childNodes.push({nodeName:"#text",data:m}),t.valueDiffing&&"TEXTAREA"===n.node.nodeName&&(n.node.value=m)}0===s&&n.node.nodeName&&o.push(n.node);var _=i[s-1];_&&n.node.nodeName&&(_.node.childNodes||(_.node.childNodes=[]),_.node.childNodes.push(n.node)),i[s]=n}if((!r||n.voidElement)&&(s>-1&&(n.voidElement||t.caseSensitive&&n.node.nodeName===l.slice(2,-1)||!t.caseSensitive&&n.node.nodeName.toUpperCase()===l.slice(2,-1).toUpperCase())&&--s>-1&&("svg"===n.node.nodeName&&(a=!1),n=i[s]),"<"!==h&&h)){var v=-1===s?o:i[s].node.childNodes||[],g=e.indexOf("<",d);m=E(e.slice(d,-1===g?void 0:g));v.push({nodeName:"#text",data:m})}return""})),o[0]},O=function(){function e(e,t,n){this.options=n,this.t1="undefined"!=typeof Element&&o(e,"Element")?N(e,this.options):"string"==typeof e?T(e,this.options):JSON.parse(JSON.stringify(e)),this.t2="undefined"!=typeof Element&&o(t,"Element")?N(t,this.options):"string"==typeof t?T(t,this.options):JSON.parse(JSON.stringify(t)),this.diffcount=0,this.foundAll=!1,this.debug&&(this.t1Orig="undefined"!=typeof Element&&o(e,"Element")?N(e,this.options):"string"==typeof e?T(e,this.options):JSON.parse(JSON.stringify(e)),this.t2Orig="undefined"!=typeof Element&&o(t,"Element")?N(t,this.options):"string"==typeof t?T(t,this.options):JSON.parse(JSON.stringify(t))),this.tracker=new g}return e.prototype.init=function(){return this.findDiffs(this.t1,this.t2)},e.prototype.findDiffs=function(e,t){var n;do{if(this.options.debug&&(this.diffcount+=1,this.diffcount>this.options.diffcap))throw new Error("surpassed diffcap:".concat(JSON.stringify(this.t1Orig)," -> ").concat(JSON.stringify(this.t2Orig)));0===(n=this.findNextDiff(e,t,[])).length&&(p(e,t)||(this.foundAll?console.error("Could not find remaining diffs!"):(this.foundAll=!0,h(e),n=this.findNextDiff(e,t,[])))),n.length>0&&(this.foundAll=!1,this.tracker.add(n),b(e,n,this.options))}while(n.length>0);return this.tracker.list},e.prototype.findNextDiff=function(e,t,n){var o,s;if(this.options.maxDepth&&n.length>this.options.maxDepth)return[];if(!e.outerDone){if(o=this.findOuterDiff(e,t,n),this.options.filterOuterDiff&&(s=this.options.filterOuterDiff(e,t,o))&&(o=s),o.length>0)return e.outerDone=!0,o;e.outerDone=!0}if(Object.prototype.hasOwnProperty.call(e,"data"))return[];if(!e.innerDone){if((o=this.findInnerDiff(e,t,n)).length>0)return o;e.innerDone=!0}if(this.options.valueDiffing&&!e.valueDone){if((o=this.findValueDiff(e,t,n)).length>0)return e.valueDone=!0,o;e.valueDone=!0}return[]},e.prototype.findOuterDiff=function(e,t,o){var s,i,a,l,c,r,u=[];if(e.nodeName!==t.nodeName){if(!o.length)throw new Error("Top level nodes have to be of the same kind.");return[(new n).setValue(this.options._const.action,this.options._const.replaceElement).setValue(this.options._const.oldValue,f(e)).setValue(this.options._const.newValue,f(t)).setValue(this.options._const.route,o)]}if(o.length&&this.options.diffcap<Math.abs((e.childNodes||[]).length-(t.childNodes||[]).length))return[(new n).setValue(this.options._const.action,this.options._const.replaceElement).setValue(this.options._const.oldValue,f(e)).setValue(this.options._const.newValue,f(t)).setValue(this.options._const.route,o)];if(Object.prototype.hasOwnProperty.call(e,"data")&&e.data!==t.data)return"#text"===e.nodeName?[(new n).setValue(this.options._const.action,this.options._const.modifyTextElement).setValue(this.options._const.route,o).setValue(this.options._const.oldValue,e.data).setValue(this.options._const.newValue,t.data)]:[(new n).setValue(this.options._const.action,this.options._const.modifyComment).setValue(this.options._const.route,o).setValue(this.options._const.oldValue,e.data).setValue(this.options._const.newValue,t.data)];for(i=e.attributes?Object.keys(e.attributes).sort():[],a=t.attributes?Object.keys(t.attributes).sort():[],l=i.length,r=0;r<l;r++)s=i[r],-1===(c=a.indexOf(s))?u.push((new n).setValue(this.options._const.action,this.options._const.removeAttribute).setValue(this.options._const.route,o).setValue(this.options._const.name,s).setValue(this.options._const.value,e.attributes[s])):(a.splice(c,1),e.attributes[s]!==t.attributes[s]&&u.push((new n).setValue(this.options._const.action,this.options._const.modifyAttribute).setValue(this.options._const.route,o).setValue(this.options._const.name,s).setValue(this.options._const.oldValue,e.attributes[s]).setValue(this.options._const.newValue,t.attributes[s])));for(l=a.length,r=0;r<l;r++)s=a[r],u.push((new n).setValue(this.options._const.action,this.options._const.addAttribute).setValue(this.options._const.route,o).setValue(this.options._const.name,s).setValue(this.options._const.value,t.attributes[s]));return u},e.prototype.findInnerDiff=function(e,t,o){var s=e.childNodes?e.childNodes.slice():[],i=t.childNodes?t.childNodes.slice():[],a=Math.max(s.length,i.length),l=Math.abs(s.length-i.length),c=[],r=0;if(!this.options.maxChildCount||a<this.options.maxChildCount){var u=Boolean(e.subsets&&e.subsetsAge--),d=u?e.subsets:e.childNodes&&t.childNodes?v(e,t):[];if(d.length>0&&(c=this.attemptGroupRelocation(e,t,d,o,u)).length>0)return c}for(var h=0;h<a;h+=1){var m=s[h],_=i[h];l&&(m&&!_?"#text"===m.nodeName?(c.push((new n).setValue(this.options._const.action,this.options._const.removeTextElement).setValue(this.options._const.route,o.concat(r)).setValue(this.options._const.value,m.data)),r-=1):(c.push((new n).setValue(this.options._const.action,this.options._const.removeElement).setValue(this.options._const.route,o.concat(r)).setValue(this.options._const.element,f(m))),r-=1):_&&!m&&("#text"===_.nodeName?c.push((new n).setValue(this.options._const.action,this.options._const.addTextElement).setValue(this.options._const.route,o.concat(r)).setValue(this.options._const.value,_.data)):c.push((new n).setValue(this.options._const.action,this.options._const.addElement).setValue(this.options._const.route,o.concat(r)).setValue(this.options._const.element,f(_))))),m&&_&&(!this.options.maxChildCount||a<this.options.maxChildCount?c=c.concat(this.findNextDiff(m,_,o.concat(r))):p(m,_)||(s.length>i.length?("#text"===m.nodeName?c.push((new n).setValue(this.options._const.action,this.options._const.removeTextElement).setValue(this.options._const.route,o.concat(r)).setValue(this.options._const.value,m.data)):c.push((new n).setValue(this.options._const.action,this.options._const.removeElement).setValue(this.options._const.element,f(m)).setValue(this.options._const.route,o.concat(r))),s.splice(h,1),h-=1,r-=1,l-=1):s.length<i.length?(c=c.concat([(new n).setValue(this.options._const.action,this.options._const.addElement).setValue(this.options._const.element,f(_)).setValue(this.options._const.route,o.concat(r))]),s.splice(h,0,f(_)),l-=1):c=c.concat([(new n).setValue(this.options._const.action,this.options._const.replaceElement).setValue(this.options._const.oldValue,f(m)).setValue(this.options._const.newValue,f(_)).setValue(this.options._const.route,o.concat(r))]))),r+=1}return e.innerDone=!0,c},e.prototype.attemptGroupRelocation=function(e,t,o,s,i){for(var a,l,c,r,u,d=function(e,t,n){var o=e.childNodes?_(e.childNodes.length,!0):[],s=t.childNodes?_(t.childNodes.length,!0):[],i=0;return n.forEach((function(e){for(var t=e.oldValue+e.length,n=e.newValue+e.length,a=e.oldValue;a<t;a+=1)o[a]=i;for(a=e.newValue;a<n;a+=1)s[a]=i;i+=1})),{gaps1:o,gaps2:s}}(e,t,o),h=d.gaps1,p=d.gaps2,v=e.childNodes.slice(),g=t.childNodes.slice(),V=Math.min(h.length,p.length),b=[],N=0,y=0;N<V;y+=1,N+=1)if(!i||!0!==h[N]&&!0!==p[N]){if(!0===h[y])if("#text"===(r=v[y]).nodeName)if("#text"===g[N].nodeName){if(r.data!==g[N].data){for(var w=y;v.length>w+1&&"#text"===v[w+1].nodeName;)if(w+=1,g[N].data===v[w].data){u=!0;break}u||b.push((new n).setValue(this.options._const.action,this.options._const.modifyTextElement).setValue(this.options._const.route,s.concat(y)).setValue(this.options._const.oldValue,r.data).setValue(this.options._const.newValue,g[N].data))}}else b.push((new n).setValue(this.options._const.action,this.options._const.removeTextElement).setValue(this.options._const.route,s.concat(y)).setValue(this.options._const.value,r.data)),h.splice(y,1),v.splice(y,1),V=Math.min(h.length,p.length),y-=1,N-=1;else!0===p[N]?b.push((new n).setValue(this.options._const.action,this.options._const.replaceElement).setValue(this.options._const.oldValue,f(r)).setValue(this.options._const.newValue,f(g[N])).setValue(this.options._const.route,s.concat(y))):(b.push((new n).setValue(this.options._const.action,this.options._const.removeElement).setValue(this.options._const.route,s.concat(y)).setValue(this.options._const.element,f(r))),h.splice(y,1),v.splice(y,1),V=Math.min(h.length,p.length),y-=1,N-=1);else if(!0===p[N])"#text"===(r=g[N]).nodeName?(b.push((new n).setValue(this.options._const.action,this.options._const.addTextElement).setValue(this.options._const.route,s.concat(y)).setValue(this.options._const.value,r.data)),h.splice(y,0,!0),v.splice(y,0,{nodeName:"#text",data:r.data}),V=Math.min(h.length,p.length)):(b.push((new n).setValue(this.options._const.action,this.options._const.addElement).setValue(this.options._const.route,s.concat(y)).setValue(this.options._const.element,f(r))),h.splice(y,0,!0),v.splice(y,0,f(r)),V=Math.min(h.length,p.length));else if(h[y]!==p[N]){if(b.length>0)return b;if(c=o[h[y]],(l=Math.min(c.newValue,v.length-c.length))!==c.oldValue&&l>-1){a=!1;for(var E=0;E<c.length;E+=1)m(v[l+E],v[c.oldValue+E],{},!1,!0)||(a=!0);if(a)return[(new n).setValue(this.options._const.action,this.options._const.relocateGroup).setValue(this.options._const.groupLength,c.length).setValue(this.options._const.from,c.oldValue).setValue(this.options._const.to,l).setValue(this.options._const.route,s)]}}}else;return b},e.prototype.findValueDiff=function(e,t,o){var s=[];return e.selected!==t.selected&&s.push((new n).setValue(this.options._const.action,this.options._const.modifySelected).setValue(this.options._const.oldValue,e.selected).setValue(this.options._const.newValue,t.selected).setValue(this.options._const.route,o)),(e.value||t.value)&&e.value!==t.value&&"OPTION"!==e.nodeName&&s.push((new n).setValue(this.options._const.action,this.options._const.modifyValue).setValue(this.options._const.oldValue,e.value||"").setValue(this.options._const.newValue,t.value||"").setValue(this.options._const.route,o)),e.checked!==t.checked&&s.push((new n).setValue(this.options._const.action,this.options._const.modifyChecked).setValue(this.options._const.oldValue,e.checked).setValue(this.options._const.newValue,t.checked).setValue(this.options._const.route,o)),s},e}(),A={debug:!1,diffcap:10,maxDepth:!1,maxChildCount:50,valueDiffing:!0,textDiff:function(e,t,n,o){e.data=o},preVirtualDiffApply:function(){},postVirtualDiffApply:function(){},preDiffApply:function(){},postDiffApply:function(){},filterOuterDiff:null,compress:!1,_const:!1,document:!("undefined"==typeof window||!window.document)&&window.document,components:[]},D=function(){function e(e){if(void 0===e&&(e={}),Object.entries(A).forEach((function(t){var n=t[0],o=t[1];Object.prototype.hasOwnProperty.call(e,n)||(e[n]=o)})),!e._const){var t=["addAttribute","modifyAttribute","removeAttribute","modifyTextElement","relocateGroup","removeElement","addElement","removeTextElement","addTextElement","replaceElement","modifyValue","modifyChecked","modifySelected","modifyComment","action","route","oldValue","newValue","element","group","groupLength","from","to","name","value","data","attributes","nodeName","childNodes","checked","selected"],n={};e.compress?t.forEach((function(e,t){return n[e]=t})):t.forEach((function(e){return n[e]=e})),e._const=n}this.options=e}return e.prototype.apply=function(e,t){return function(e,t,n){return t.every((function(t){return a(e,t,n)}))}(e,t,this.options)},e.prototype.undo=function(e,t){return c(e,t,this.options)},e.prototype.diff=function(e,t){return new O(e,t,this.options).init()},e}(),L=function(){function e(e){void 0===e&&(e={});var t=this;this.pad="│ ",this.padding="",this.tick=1,this.messages=[];var n=function(e,n){var o=e[n];e[n]=function(){for(var s=arguments,i=[],a=0;a<arguments.length;a++)i[a]=s[a];t.fin(n,Array.prototype.slice.call(i));var l=o.apply(e,i);return t.fout(n,l),l}};for(var o in e)"function"==typeof e[o]&&n(e,o);this.log("┌ TRACELOG START")}return e.prototype.fin=function(e,t){this.padding+=this.pad,this.log("├─> entering ".concat(e),t)},e.prototype.fout=function(e,t){this.log("│<──┘ generated return value",t),this.padding=this.padding.substring(0,this.padding.length-this.pad.length)},e.prototype.format=function(e,t){return"".concat(function(e){for(var t="".concat(e);t.length<4;)t="0".concat(e);return t}(t),"> ").concat(this.padding).concat(e)},e.prototype.log=function(){for(var e=arguments,t=[],n=0;n<arguments.length;n++)t[n]=e[n];var s=function(e){return e?"string"==typeof e?e:o(e,"HTMLElement")?e.outerHTML||"<empty>":e instanceof Array?"[".concat(e.map(s).join(","),"]"):e.toString()||e.valueOf()||"<unknown>":"<falsey>"},i=t.map(s).join(", ");this.messages.push(this.format(i,this.tick++))},e.prototype.toString=function(){for(var e="└───";e.length<=this.padding.length+this.pad.length;)e+="× ";var t=this.padding;return this.padding="",e=this.format(e,this.tick),this.padding=t,"".concat(this.messages.join("\n"),"\n").concat(e)},e}();exports.DiffDOM=D,exports.TraceLogger=L,exports.nodeToObj=N,exports.stringToObj=T;
|
2
|
+
//# sourceMappingURL=index.min.js.map
|