@tko/utils 4.0.0-beta1.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/array.js +39 -35
  2. package/dist/array.js.map +2 -2
  3. package/dist/async.js +4 -3
  4. package/dist/async.js.map +2 -2
  5. package/dist/css.js +5 -4
  6. package/dist/css.js.map +2 -2
  7. package/dist/dom/data.js +36 -46
  8. package/dist/dom/data.js.map +2 -2
  9. package/dist/dom/disposal.js +23 -16
  10. package/dist/dom/disposal.js.map +2 -2
  11. package/dist/dom/event.js +39 -41
  12. package/dist/dom/event.js.map +2 -2
  13. package/dist/dom/fixes.js +5 -24
  14. package/dist/dom/fixes.js.map +2 -2
  15. package/dist/dom/html.js +46 -61
  16. package/dist/dom/html.js.map +2 -2
  17. package/dist/dom/info.js +10 -8
  18. package/dist/dom/info.js.map +2 -2
  19. package/dist/dom/manipulation.js +16 -24
  20. package/dist/dom/manipulation.js.map +2 -2
  21. package/dist/dom/selectExtensions.js +33 -23
  22. package/dist/dom/selectExtensions.js.map +2 -2
  23. package/dist/dom/virtualElements.js +40 -32
  24. package/dist/dom/virtualElements.js.map +3 -3
  25. package/dist/error.js +2 -1
  26. package/dist/error.js.map +2 -2
  27. package/dist/function.js +2 -1
  28. package/dist/function.js.map +2 -2
  29. package/dist/index.cjs +446 -449
  30. package/dist/index.cjs.map +4 -4
  31. package/dist/index.js +2 -3
  32. package/dist/index.js.map +2 -2
  33. package/dist/index.mjs +2 -3
  34. package/dist/index.mjs.map +2 -2
  35. package/dist/memoization.js +18 -13
  36. package/dist/memoization.js.map +3 -3
  37. package/dist/object.js +10 -8
  38. package/dist/object.js.map +2 -2
  39. package/dist/options.js +97 -35
  40. package/dist/options.js.map +2 -2
  41. package/dist/string.js +3 -5
  42. package/dist/string.js.map +2 -2
  43. package/dist/symbol.js +3 -2
  44. package/dist/symbol.js.map +2 -2
  45. package/dist/tasks.js +10 -20
  46. package/dist/tasks.js.map +2 -2
  47. package/helpers/jasmine-13-helper.ts +198 -147
  48. package/package.json +2 -3
  49. package/LICENSE +0 -22
  50. package/dist/bind-shim.js +0 -18
  51. package/dist/bind-shim.js.map +0 -7
  52. package/dist/ie.js +0 -15
  53. package/dist/ie.js.map +0 -7
  54. package/dist/jquery.js +0 -6
  55. package/dist/jquery.js.map +0 -7
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../index.ts", "../src/array.ts", "../src/options.ts", "../src/error.ts", "../src/async.ts", "../src/ie.ts", "../src/object.ts", "../src/function.ts", "../src/string.ts", "../src/symbol.ts", "../src/css.ts", "../src/jquery.ts", "../src/dom/info.ts", "../src/dom/data.ts", "../src/dom/disposal.ts", "../src/dom/event.ts", "../src/dom/manipulation.ts", "../src/dom/fixes.ts", "../src/dom/virtualElements.ts", "../src/dom/html.ts", "../src/dom/selectExtensions.ts", "../src/memoization.ts", "../src/tasks.ts"],
4
- "sourcesContent": ["export * from './src'\nexport { default } from './src'\n", "//\n// Array utilities\n//\n// Note that the array functions may be called with\n// Array-like things, such as NodeList.\n\nconst {isArray} = Array\n\nexport function arrayForEach (array, action, thisArg) {\n if (arguments.length > 2) { action = action.bind(thisArg) }\n for (let i = 0, j = array.length; i < j; ++i) {\n action(array[i], i, array)\n }\n}\n\nexport function arrayIndexOf (array, item) {\n return (isArray(array) ? array : [...array]).indexOf(item)\n}\n\nexport function arrayFirst (array, predicate, predicateOwner) {\n return (isArray(array) ? array : [...array])\n .find(predicate, predicateOwner)\n}\n\nexport function arrayMap (array = [], mapping, thisArg) {\n if (arguments.length > 2) { mapping = mapping.bind(thisArg) }\n return array === null ? [] : Array.from(array, mapping)\n}\n\nexport function arrayRemoveItem (array, itemToRemove) {\n var index = arrayIndexOf(array, itemToRemove)\n if (index > 0) {\n array.splice(index, 1)\n } else if (index === 0) {\n array.shift()\n }\n}\n\nexport function arrayGetDistinctValues (array = []) {\n const seen = new Set()\n if (array === null) { return [] }\n return (isArray(array) ? array : [...array])\n .filter(item => seen.has(item) ? false : seen.add(item))\n}\n\nexport function arrayFilter (array, predicate, thisArg) {\n if (arguments.length > 2) { predicate = predicate.bind(thisArg) }\n return array === null ? [] : (isArray(array) ? array : [...array]).filter(predicate)\n}\n\nexport function arrayPushAll (array, valuesToPush) {\n if (isArray(valuesToPush)) {\n array.push.apply(array, valuesToPush)\n } else {\n for (var i = 0, j = valuesToPush.length; i < j; i++) { array.push(valuesToPush[i]) }\n }\n return array\n}\n\nexport function addOrRemoveItem (array, value, included) {\n var existingEntryIndex = arrayIndexOf(typeof array.peek === 'function' ? array.peek() : array, value)\n if (existingEntryIndex < 0) {\n if (included) { array.push(value) }\n } else {\n if (!included) { array.splice(existingEntryIndex, 1) }\n }\n}\n\nexport function makeArray (arrayLikeObject) {\n return Array.from(arrayLikeObject)\n}\n\nexport function range (min, max) {\n min = typeof min === 'function' ? min() : min\n max = typeof max === 'function' ? max() : max\n var result = []\n for (var i = min; i <= max; i++) { result.push(i) }\n return result\n}\n\n// Go through the items that have been added and deleted and try to find matches between them.\nexport function findMovesInArrayComparison (left, right, limitFailedCompares) {\n if (left.length && right.length) {\n var failedCompares, l, r, leftItem, rightItem\n for (failedCompares = l = 0; (!limitFailedCompares || failedCompares < limitFailedCompares) && (leftItem = left[l]); ++l) {\n for (r = 0; rightItem = right[r]; ++r) {\n if (leftItem.value === rightItem.value) {\n leftItem.moved = rightItem.index\n rightItem.moved = leftItem.index\n right.splice(r, 1) // This item is marked as moved; so remove it from right list\n failedCompares = r = 0 // Reset failed compares count because we're checking for consecutive failures\n break\n }\n }\n failedCompares += r\n }\n }\n}\n\nconst statusNotInOld = 'added'\nconst statusNotInNew = 'deleted'\n\n // Simple calculation based on Levenshtein distance.\nexport function compareArrays (oldArray, newArray, options) {\n // For backward compatibility, if the third arg is actually a bool, interpret\n // it as the old parameter 'dontLimitMoves'. Newer code should use { dontLimitMoves: true }.\n options = (typeof options === 'boolean') ? { dontLimitMoves: options } : (options || {})\n oldArray = oldArray || []\n newArray = newArray || []\n\n if (oldArray.length < newArray.length) { return compareSmallArrayToBigArray(oldArray, newArray, statusNotInOld, statusNotInNew, options) } else { return compareSmallArrayToBigArray(newArray, oldArray, statusNotInNew, statusNotInOld, options) }\n}\n\nfunction compareSmallArrayToBigArray (smlArray, bigArray, statusNotInSml, statusNotInBig, options) {\n var myMin = Math.min,\n myMax = Math.max,\n editDistanceMatrix = [],\n smlIndex, smlIndexMax = smlArray.length,\n bigIndex, bigIndexMax = bigArray.length,\n compareRange = (bigIndexMax - smlIndexMax) || 1,\n maxDistance = smlIndexMax + bigIndexMax + 1,\n thisRow, lastRow,\n bigIndexMaxForRow, bigIndexMinForRow\n\n for (smlIndex = 0; smlIndex <= smlIndexMax; smlIndex++) {\n lastRow = thisRow\n editDistanceMatrix.push(thisRow = [])\n bigIndexMaxForRow = myMin(bigIndexMax, smlIndex + compareRange)\n bigIndexMinForRow = myMax(0, smlIndex - 1)\n for (bigIndex = bigIndexMinForRow; bigIndex <= bigIndexMaxForRow; bigIndex++) {\n if (!bigIndex) {\n thisRow[bigIndex] = smlIndex + 1\n } else if (!smlIndex) {\n // Top row - transform empty array into new array via additions\n thisRow[bigIndex] = bigIndex + 1\n } else if (smlArray[smlIndex - 1] === bigArray[bigIndex - 1]) {\n thisRow[bigIndex] = lastRow[bigIndex - 1]\n } else { // copy value (no edit)\n var northDistance = lastRow[bigIndex] || maxDistance // not in big (deletion)\n var westDistance = thisRow[bigIndex - 1] || maxDistance // not in small (addition)\n thisRow[bigIndex] = myMin(northDistance, westDistance) + 1\n }\n }\n }\n\n var editScript = [], meMinusOne, notInSml = [], notInBig = []\n for (smlIndex = smlIndexMax, bigIndex = bigIndexMax; smlIndex || bigIndex;) {\n meMinusOne = editDistanceMatrix[smlIndex][bigIndex] - 1\n if (bigIndex && meMinusOne === editDistanceMatrix[smlIndex][bigIndex - 1]) {\n notInSml.push(editScript[editScript.length] = { // added\n 'status': statusNotInSml,\n 'value': bigArray[--bigIndex],\n 'index': bigIndex })\n } else if (smlIndex && meMinusOne === editDistanceMatrix[smlIndex - 1][bigIndex]) {\n notInBig.push(editScript[editScript.length] = { // deleted\n 'status': statusNotInBig,\n 'value': smlArray[--smlIndex],\n 'index': smlIndex })\n } else {\n --bigIndex\n --smlIndex\n if (!options.sparse) {\n editScript.push({\n 'status': 'retained',\n 'value': bigArray[bigIndex] })\n }\n }\n }\n\n // Set a limit on the number of consecutive non-matching comparisons; having it a multiple of\n // smlIndexMax keeps the time complexity of this algorithm linear.\n findMovesInArrayComparison(notInBig, notInSml, !options.dontLimitMoves && smlIndexMax * 10)\n\n return editScript.reverse()\n}\n", "//\n// This becomes ko.options\n// --\n//\n// This is the root 'options', which must be extended by others.\n\nconst options = {\n deferUpdates: false,\n\n useOnlyNativeEvents: false,\n\n protoProperty: '__ko_proto__',\n\n // Modify the default attribute from `data-bind`.\n defaultBindingAttribute: 'data-bind',\n\n // Enable/disable <!-- ko binding: ... -> style bindings\n allowVirtualElements: true,\n\n // Global variables that can be accessed from bindings.\n bindingGlobals: Object.create(null),\n\n // An instance of the binding provider.\n bindingProviderInstance: null,\n\n // Whether the `with` binding creates a child context when used with `as`.\n createChildContextWithAs: false,\n\n // jQuery will be automatically set to globalThis.jQuery in applyBindings\n // if it is (strictly equal to) undefined. Set it to false or null to\n // disable automatically setting jQuery.\n jQuery: globalThis.jQuery,\n\n Promise: globalThis.Promise,\n\n taskScheduler: null,\n\n debug: false,\n\n global: globalThis,\n document: globalThis.document,\n\n // Filters for bindings\n // data-bind=\"expression | filter_1 | filter_2\"\n filters: {},\n\n // Used by the template binding.\n includeDestroyed: false,\n foreachHidesDestroyed: false,\n\n onError: function (e) { throw e },\n\n set: function (name, value) {\n options[name] = value\n },\n\n // Overload getBindingHandler to have a custom lookup function.\n getBindingHandler (/* key */) {},\n cleanExternalData (/* node, callback */) {}\n}\n\nObject.defineProperty(options, '$', {\n get: function () { return options.jQuery }\n})\n\nexport default options\n", "//\n// Error handling\n// ---\n//\n// The default onError handler is to re-throw.\nimport options from './options'\n\nexport function catchFunctionErrors (delegate) {\n if (!options.onError) { return delegate }\n return (...args) => {\n try {\n return delegate(...args)\n } catch (err) {\n options.onError(err)\n }\n }\n}\n\nexport function deferError (error) {\n safeSetTimeout(function () { throw error }, 0)\n}\n\nexport function safeSetTimeout (handler, timeout) {\n return setTimeout(catchFunctionErrors(handler), timeout)\n}\n", "//\n// Asynchronous functionality\n// ---\nimport { safeSetTimeout } from './error'\n\nexport function throttle (callback, timeout) {\n var timeoutInstance\n return function (...args) {\n if (!timeoutInstance) {\n timeoutInstance = safeSetTimeout(function () {\n timeoutInstance = undefined\n callback(...args)\n }, timeout)\n }\n }\n}\n\nexport function debounce (callback, timeout) {\n var timeoutInstance\n return function (...args) {\n clearTimeout(timeoutInstance)\n timeoutInstance = safeSetTimeout(() => callback(...args), timeout)\n }\n}\n", "//\n// Detection and Workarounds for Internet Explorer\n//\nimport options from './options'\n\nconst ieVersion = options.document && (function () {\n var version = 3, div = options.document.createElement('div'), iElems = div.getElementsByTagName('i')\n\n // Keep constructing conditional HTML blocks until we hit one that resolves to an empty fragment\n while (\n div.innerHTML = '<!--[if gt IE ' + (++version) + ']><i></i><![endif]-->',\n iElems[0]\n ) {}\n\n if (!version) {\n const userAgent = window.navigator.userAgent\n // Detect IE 10/11\n return ua.match(/MSIE ([^ ]+)/) || ua.match(/rv:([^ )]+)/)\n }\n return version > 4 ? version : undefined\n}())\n\nconst isIe6 = ieVersion === 6\nconst isIe7 = ieVersion === 7\n\nexport { ieVersion, isIe6, isIe7 }\n", "//\n// Object functions\n//\n\nexport function hasOwnProperty(obj, propName) {\n return Object.prototype.hasOwnProperty.call(obj, propName)\n}\n\n/**\n * True when obj is a non-null object, or a function.\n * @param obj \n * @returns \n */\nexport function isObjectLike(obj) {\n if (obj === null) { return false }\n return typeof obj === 'object' || typeof obj === 'function'\n}\n\nexport function extend (target, source) {\n if (source) {\n for (var prop in source) {\n if (hasOwnProperty(source, prop)) {\n target[prop] = source[prop]\n }\n }\n }\n return target\n}\n\nexport function objectForEach (obj, action) {\n for (var prop in obj) {\n if (hasOwnProperty(obj, prop)) {\n action(prop, obj[prop])\n }\n }\n}\n\nexport function objectMap (source, mapping, thisArg) {\n if (!source) { return source }\n if (arguments.length > 2) { mapping = mapping.bind(thisArg) }\n var target = {}\n for (var prop in source) {\n if (hasOwnProperty(source, prop)) {\n target[prop] = mapping(source[prop], prop, source)\n }\n }\n return target\n}\nexport function getObjectOwnProperty (obj, propName) {\n return hasOwnProperty(obj, propName) ? obj[propName] : undefined\n}\n\nexport function clonePlainObjectDeep (obj, seen) {\n if (!seen) { seen = [] }\n\n if (!obj || typeof obj !== 'object' ||\n obj.constructor !== Object ||\n seen.indexOf(obj) !== -1) {\n return obj\n }\n\n // Anything that makes it below is a plain object that has not yet\n // been seen/cloned.\n seen.push(obj)\n\n var result = {}\n for (var prop in obj) {\n if (hasOwnProperty(obj, prop)) {\n result[prop] = clonePlainObjectDeep(obj[prop], seen)\n }\n }\n return result\n}\n\n/**\n * JSON.stringify, but inserts `...` for objects that are referenced\n * multiple times, preventing infinite recursion.\n */\nexport function safeStringify (value) {\n const seen = new Set()\n return JSON.stringify(value, (k, v) => {\n if (seen.has(v)) { return '...' }\n if (typeof v === 'object') { seen.add(v) }\n return v\n })\n}\n\n\n/**\n * Promises/A+ compliant isThenable (per section 1.2)\n */\nexport function isThenable (object: any) {\n return isObjectLike(object) && typeof object.then === 'function'\n}\n", "\nfunction testOverwrite () {\n try {\n Object.defineProperty(function x () {}, 'length', {})\n return true\n } catch (e) {\n return false\n }\n}\n\nexport const functionSupportsLengthOverwrite = testOverwrite()\n\nexport function overwriteLengthPropertyIfSupported (fn, descriptor) {\n if (functionSupportsLengthOverwrite) {\n Object.defineProperty(fn, 'length', descriptor)\n }\n}\n", "//\n// String (and JSON)\n//\n\nexport function stringTrim (string) {\n return string === null || string === undefined ? ''\n : string.trim\n ? string.trim()\n : string.toString().replace(/^[\\s\\xa0]+|[\\s\\xa0]+$/g, '')\n}\n\nexport function stringStartsWith (string, startsWith) {\n string = string || ''\n if (startsWith.length > string.length) { return false }\n return string.substring(0, startsWith.length) === startsWith\n}\n\nexport function parseJson (jsonString) {\n if (typeof jsonString === 'string') {\n jsonString = stringTrim(jsonString)\n if (jsonString) {\n if (JSON && JSON.parse) // Use native parsing where available\n { return JSON.parse(jsonString) }\n return (new Function('return ' + jsonString))() // Fallback on less safe parsing for older browsers\n }\n }\n return null\n}\n", "//\n// ES6 Symbols\n//\n\nexport var useSymbols = typeof Symbol === 'function'\n\nexport function createSymbolOrString (identifier) {\n return useSymbols ? Symbol(identifier) : identifier\n}\n", "//\n// DOM - CSS\n//\n\nimport { arrayForEach, addOrRemoveItem } from './array'\n\n// For details on the pattern for changing node classes\n// see: https://github.com/knockout/knockout/issues/1597\nvar cssClassNameRegex = /\\S+/g\n\nfunction toggleDomNodeCssClass (node, classNames, shouldHaveClass) {\n var addOrRemoveFn\n if (!classNames) { return }\n if (typeof node.classList === 'object') {\n addOrRemoveFn = node.classList[shouldHaveClass ? 'add' : 'remove']\n arrayForEach(classNames.match(cssClassNameRegex), function (className) {\n addOrRemoveFn.call(node.classList, className)\n })\n } else if (typeof node.className['baseVal'] === 'string') {\n // SVG tag .classNames is an SVGAnimatedString instance\n toggleObjectClassPropertyString(node.className, 'baseVal', classNames, shouldHaveClass)\n } else {\n // node.className ought to be a string.\n toggleObjectClassPropertyString(node, 'className', classNames, shouldHaveClass)\n }\n}\n\nfunction toggleObjectClassPropertyString (obj, prop, classNames, shouldHaveClass) {\n // obj/prop is either a node/'className' or a SVGAnimatedString/'baseVal'.\n var currentClassNames = obj[prop].match(cssClassNameRegex) || []\n arrayForEach(classNames.match(cssClassNameRegex), function (className) {\n addOrRemoveItem(currentClassNames, className, shouldHaveClass)\n })\n obj[prop] = currentClassNames.join(' ')\n}\n\nexport { toggleDomNodeCssClass }\n", "//\n// jQuery\n//\n// TODO: deprecate in favour of options.$\n\nimport options from './options'\n\nexport var jQueryInstance = options.global && options.global.jQuery\n\nexport function jQuerySetInstance (jquery) {\n options.jQuery = jQueryInstance = jquery\n}\n", "//\n// Information about the DOM\n//\nimport { arrayFirst } from '../array'\n\nexport function domNodeIsContainedBy (node, containedByNode) {\n if (node === containedByNode) { return true }\n if (node.nodeType === 11) { return false } // Fixes issue #1162 - can't use node.contains for document fragments on IE8\n if (containedByNode.contains) { return containedByNode.contains(node.nodeType !== 1 ? node.parentNode : node) }\n if (containedByNode.compareDocumentPosition) { return (containedByNode.compareDocumentPosition(node) & 16) == 16 }\n while (node && node != containedByNode) {\n node = node.parentNode\n }\n return !!node\n}\n\nexport function domNodeIsAttachedToDocument (node) {\n return domNodeIsContainedBy(node, node.ownerDocument.documentElement)\n}\n\nexport function anyDomNodeIsAttachedToDocument (nodes) {\n return !!arrayFirst(nodes, domNodeIsAttachedToDocument)\n}\n\nexport function tagNameLower (element) {\n // For HTML elements, tagName will always be upper case; for XHTML elements, it'll be lower case.\n // Possible future optimization: If we know it's an element from an XHTML document (not HTML),\n // we don't need to do the .toLowerCase() as it will always be lower case anyway.\n return element && element.tagName && element.tagName.toLowerCase()\n}\n\nexport function isDomElement (obj) {\n if (window.HTMLElement) {\n return obj instanceof HTMLElement\n } else {\n return obj && obj.tagName && obj.nodeType === 1\n }\n}\n\nexport function isDocumentFragment (obj) {\n if (window.DocumentFragment) {\n return obj instanceof DocumentFragment\n } else {\n return obj && obj.nodeType === 11\n }\n}\n", "//\n// DOM node data\n//\nimport { ieVersion } from '../ie'\n\nconst datastoreTime = new Date().getTime()\nconst dataStoreKeyExpandoPropertyName = `__ko__${datastoreTime}`\nconst dataStoreSymbol = Symbol('Knockout data')\nvar dataStore\nlet uniqueId = 0\n\n/*\n * We considered using WeakMap, but it has a problem in IE 11 and Edge that\n * prevents using it cross-window, so instead we just store the data directly\n * on the node. See https://github.com/knockout/knockout/issues/2141\n */\nconst modern = {\n getDataForNode (node, createIfNotFound) {\n let dataForNode = node[dataStoreSymbol]\n if (!dataForNode && createIfNotFound) {\n dataForNode = node[dataStoreSymbol] = {}\n }\n return dataForNode\n },\n\n clear (node) {\n if (node[dataStoreSymbol]) {\n delete node[dataStoreSymbol]\n return true\n }\n return false\n }\n}\n\n/**\n * Old IE versions have memory issues if you store objects on the node, so we\n * use a separate data storage and link to it from the node using a string key.\n */\nconst IE = {\n getDataforNode (node, createIfNotFound) {\n let dataStoreKey = node[dataStoreKeyExpandoPropertyName]\n const hasExistingDataStore = dataStoreKey && (dataStoreKey !== 'null') && dataStore[dataStoreKey]\n if (!hasExistingDataStore) {\n if (!createIfNotFound) {\n return undefined\n }\n dataStoreKey = node[dataStoreKeyExpandoPropertyName] = 'ko' + uniqueId++\n dataStore[dataStoreKey] = {}\n }\n return dataStore[dataStoreKey]\n },\n\n clear (node) {\n const dataStoreKey = node[dataStoreKeyExpandoPropertyName]\n if (dataStoreKey) {\n delete dataStore[dataStoreKey]\n node[dataStoreKeyExpandoPropertyName] = null\n return true // Exposing 'did clean' flag purely so specs can infer whether things have been cleaned up as intended\n }\n return false\n }\n}\n\nconst {getDataForNode, clear} = ieVersion ? IE : modern\n\n/**\n * Create a unique key-string identifier.\n */\nexport function nextKey () {\n return (uniqueId++) + dataStoreKeyExpandoPropertyName\n}\n\nfunction get (node, key) {\n const dataForNode = getDataForNode(node, false)\n return dataForNode && dataForNode[key]\n}\n\nfunction set (node, key, value) {\n // Make sure we don't actually create a new domData key if we are actually deleting a value\n var dataForNode = getDataForNode(node, value !== undefined /* createIfNotFound */)\n dataForNode && (dataForNode[key] = value)\n}\n\nfunction getOrSet (node, key, value) {\n const dataForNode = getDataForNode(node, true, /* createIfNotFound */)\n return dataForNode[key] || (dataForNode[key] = value)\n}\n\nexport { get, set, getOrSet, clear }\n", "//\n// DOM node disposal\n//\n/* eslint no-cond-assign: 0 */\nimport * as domData from './data'\nimport { default as options } from '../options'\nimport {arrayRemoveItem, arrayIndexOf} from '../array'\nimport {jQueryInstance} from '../jquery'\n\nvar domDataKey = domData.nextKey()\n// Node types:\n// 1: Element\n// 8: Comment\n// 9: Document\nvar cleanableNodeTypes = { 1: true, 8: true, 9: true }\nvar cleanableNodeTypesWithDescendants = { 1: true, 9: true }\n\nfunction getDisposeCallbacksCollection (node, createIfNotFound) {\n var allDisposeCallbacks = domData.get(node, domDataKey)\n if ((allDisposeCallbacks === undefined) && createIfNotFound) {\n allDisposeCallbacks = []\n domData.set(node, domDataKey, allDisposeCallbacks)\n }\n return allDisposeCallbacks\n}\nfunction destroyCallbacksCollection (node) {\n domData.set(node, domDataKey, undefined)\n}\n\nfunction cleanSingleNode (node) {\n // Run all the dispose callbacks\n var callbacks = getDisposeCallbacksCollection(node, false)\n if (callbacks) {\n callbacks = callbacks.slice(0) // Clone, as the array may be modified during iteration (typically, callbacks will remove themselves)\n for (let i = 0; i < callbacks.length; i++) { callbacks[i](node) }\n }\n\n // Erase the DOM data\n domData.clear(node)\n\n // Perform cleanup needed by external libraries (currently only jQuery, but can be extended)\n for (let i = 0, j = otherNodeCleanerFunctions.length; i < j; ++i) {\n otherNodeCleanerFunctions[i](node)\n }\n\n if (options.cleanExternalData) {\n options.cleanExternalData(node)\n }\n\n // Clear any immediate-child comment nodes, as these wouldn't have been found by\n // node.getElementsByTagName('*') in cleanNode() (comment nodes aren't elements)\n if (cleanableNodeTypesWithDescendants[node.nodeType]) {\n cleanNodesInList(node.childNodes, true /* onlyComments */)\n }\n}\n\nfunction cleanNodesInList (nodeList, onlyComments) {\n const cleanedNodes = []\n let lastCleanedNode\n for (var i = 0; i < nodeList.length; i++) {\n if (!onlyComments || nodeList[i].nodeType === 8) {\n cleanSingleNode(cleanedNodes[cleanedNodes.length] = lastCleanedNode = nodeList[i]);\n if (nodeList[i] !== lastCleanedNode) {\n while (i-- && arrayIndexOf(cleanedNodes, nodeList[i]) === -1) {}\n }\n }\n }\n}\n\n// Exports\nexport function addDisposeCallback (node, callback) {\n if (typeof callback !== 'function') { throw new Error('Callback must be a function') }\n getDisposeCallbacksCollection(node, true).push(callback)\n}\n\nexport function removeDisposeCallback (node, callback) {\n var callbacksCollection = getDisposeCallbacksCollection(node, false)\n if (callbacksCollection) {\n arrayRemoveItem(callbacksCollection, callback)\n if (callbacksCollection.length === 0) { destroyCallbacksCollection(node) }\n }\n}\n\nexport function cleanNode (node) {\n // First clean this node, where applicable\n if (cleanableNodeTypes[node.nodeType]) {\n cleanSingleNode(node)\n\n // ... then its descendants, where applicable\n if (cleanableNodeTypesWithDescendants[node.nodeType]) {\n cleanNodesInList(node.getElementsByTagName(\"*\"))\n }\n }\n return node\n}\n\nexport function removeNode (node) {\n cleanNode(node)\n if (node.parentNode) { node.parentNode.removeChild(node) }\n}\n\n// Expose supplemental node cleaning functions.\nexport const otherNodeCleanerFunctions = []\n\nexport function addCleaner (fn) {\n otherNodeCleanerFunctions.push(fn)\n}\n\nexport function removeCleaner (fn) {\n const fnIndex = otherNodeCleanerFunctions.indexOf(fn)\n if (fnIndex >= 0) { otherNodeCleanerFunctions.splice(fnIndex, 1) }\n}\n\n// Special support for jQuery here because it's so commonly used.\n// Many jQuery plugins (including jquery.tmpl) store data using jQuery's equivalent of domData\n// so notify it to tear down any resources associated with the node & descendants here.\nexport function cleanjQueryData (node) {\n var jQueryCleanNodeFn = jQueryInstance ? jQueryInstance.cleanData : null\n\n if (jQueryCleanNodeFn) {\n jQueryCleanNodeFn([node])\n }\n}\n\notherNodeCleanerFunctions.push(cleanjQueryData)\n", "//\n// DOM Events\n//\n\nimport { objectForEach } from '../object'\nimport { jQueryInstance } from '../jquery'\nimport { ieVersion } from '../ie'\nimport { catchFunctionErrors } from '../error'\n\nimport { tagNameLower } from './info'\nimport { addDisposeCallback } from './disposal'\nimport options from '../options'\n\n// Represent the known event types in a compact way, then at runtime transform it into a hash with event name as key (for fast lookup)\nvar knownEvents = {},\n knownEventTypesByEventName = {}\n\nvar keyEventTypeName = (options.global.navigator && /Firefox\\/2/i.test(options.global.navigator.userAgent)) ? 'KeyboardEvent' : 'UIEvents'\n\nknownEvents[keyEventTypeName] = ['keyup', 'keydown', 'keypress']\n\nknownEvents['MouseEvents'] = [\n 'click', 'dblclick', 'mousedown', 'mouseup', 'mousemove', 'mouseover',\n 'mouseout', 'mouseenter', 'mouseleave']\n\nobjectForEach(knownEvents, function (eventType, knownEventsForType) {\n if (knownEventsForType.length) {\n for (var i = 0, j = knownEventsForType.length; i < j; i++) { knownEventTypesByEventName[knownEventsForType[i]] = eventType }\n }\n})\n\nfunction isClickOnCheckableElement (element, eventType) {\n if ((tagNameLower(element) !== 'input') || !element.type) return false\n if (eventType.toLowerCase() != 'click') return false\n var inputType = element.type\n return (inputType == 'checkbox') || (inputType == 'radio')\n}\n\n// Workaround for an IE9 issue - https://github.com/SteveSanderson/knockout/issues/406\nvar eventsThatMustBeRegisteredUsingAttachEvent = { 'propertychange': true }\nlet jQueryEventAttachName\n\nexport function registerEventHandler (element, eventType, handler, eventOptions = false) {\n const wrappedHandler = catchFunctionErrors(handler)\n const mustUseAttachEvent = ieVersion && eventsThatMustBeRegisteredUsingAttachEvent[eventType]\n const mustUseNative = Boolean(eventOptions)\n\n if (!options.useOnlyNativeEvents && !mustUseAttachEvent && !mustUseNative && jQueryInstance) {\n if (!jQueryEventAttachName) {\n jQueryEventAttachName = (typeof jQueryInstance(element).on === 'function') ? 'on' : 'bind'\n }\n jQueryInstance(element)[jQueryEventAttachName](eventType, wrappedHandler)\n } else if (!mustUseAttachEvent && typeof element.addEventListener === 'function') {\n element.addEventListener(eventType, wrappedHandler, eventOptions)\n } else if (typeof element.attachEvent !== 'undefined') {\n const attachEventHandler = function (event) { wrappedHandler.call(element, event) }\n const attachEventName = 'on' + eventType\n element.attachEvent(attachEventName, attachEventHandler)\n\n // IE does not dispose attachEvent handlers automatically (unlike with addEventListener)\n // so to avoid leaks, we have to remove them manually. See bug #856\n addDisposeCallback(element, function () {\n element.detachEvent(attachEventName, attachEventHandler)\n })\n } else {\n throw new Error(\"Browser doesn't support addEventListener or attachEvent\")\n }\n}\n\nexport function triggerEvent (element, eventType) {\n if (!(element && element.nodeType)) { throw new Error('element must be a DOM node when calling triggerEvent') }\n\n // For click events on checkboxes and radio buttons, jQuery toggles the element checked state *after* the\n // event handler runs instead of *before*. (This was fixed in 1.9 for checkboxes but not for radio buttons.)\n // IE doesn't change the checked state when you trigger the click event using \"fireEvent\".\n // In both cases, we'll use the click method instead.\n var useClickWorkaround = isClickOnCheckableElement(element, eventType)\n\n if (!options.useOnlyNativeEvents && jQueryInstance && !useClickWorkaround) {\n jQueryInstance(element).trigger(eventType)\n } else if (typeof document.createEvent === 'function') {\n if (typeof element.dispatchEvent === 'function') {\n var eventCategory = knownEventTypesByEventName[eventType] || 'HTMLEvents'\n var event = document.createEvent(eventCategory)\n event.initEvent(eventType, true, true, options.global, 0, 0, 0, 0, 0, false, false, false, false, 0, element)\n element.dispatchEvent(event)\n } else { throw new Error(\"The supplied element doesn't support dispatchEvent\") }\n } else if (useClickWorkaround && element.click) {\n element.click()\n } else if (typeof element.fireEvent !== 'undefined') {\n element.fireEvent('on' + eventType)\n } else {\n throw new Error(\"Browser doesn't support triggering events\")\n }\n}\n", "//\n// DOM manipulation\n//\n/* eslint no-empty: 0 */\nimport { makeArray } from '../array'\nimport { ieVersion } from '../ie'\nimport { cleanNode, removeNode } from './disposal'\n\nexport function moveCleanedNodesToContainerElement (nodes) {\n // Ensure it's a real array, as we're about to reparent the nodes and\n // we don't want the underlying collection to change while we're doing that.\n var nodesArray = makeArray(nodes)\n var templateDocument = (nodesArray[0] && nodesArray[0].ownerDocument) || document\n\n var container = templateDocument.createElement('div')\n for (var i = 0, j = nodesArray.length; i < j; i++) {\n container.appendChild(cleanNode(nodesArray[i]))\n }\n return container\n}\n\nexport function cloneNodes (nodesArray, shouldCleanNodes) {\n for (var i = 0, j = nodesArray.length, newNodesArray = []; i < j; i++) {\n var clonedNode = nodesArray[i].cloneNode(true)\n newNodesArray.push(shouldCleanNodes ? cleanNode(clonedNode) : clonedNode)\n }\n return newNodesArray\n}\n\nexport function setDomNodeChildren (domNode, childNodes) {\n emptyDomNode(domNode)\n if (childNodes) {\n for (var i = 0, j = childNodes.length; i < j; i++) { domNode.appendChild(childNodes[i]) }\n }\n}\n\nexport function replaceDomNodes (nodeToReplaceOrNodeArray, newNodesArray) {\n var nodesToReplaceArray = nodeToReplaceOrNodeArray.nodeType ? [nodeToReplaceOrNodeArray] : nodeToReplaceOrNodeArray\n if (nodesToReplaceArray.length > 0) {\n var insertionPoint = nodesToReplaceArray[0]\n var parent = insertionPoint.parentNode\n for (var i = 0, j = newNodesArray.length; i < j; i++) { parent.insertBefore(newNodesArray[i], insertionPoint) }\n for (i = 0, j = nodesToReplaceArray.length; i < j; i++) {\n removeNode(nodesToReplaceArray[i])\n }\n }\n}\n\nexport function setElementName (element, name) {\n element.name = name\n\n // Workaround IE 6/7 issue\n // - https://github.com/SteveSanderson/knockout/issues/197\n // - http://www.matts411.com/post/setting_the_name_attribute_in_ie_dom/\n if (ieVersion <= 7) {\n try {\n element.mergeAttributes(document.createElement(\"<input name='\" + element.name + \"'/>\"), false)\n } catch (e) {} // For IE9 with doc mode \"IE9 Standards\" and browser mode \"IE9 Compatibility View\"\n }\n}\n\nexport function emptyDomNode (domNode) {\n while (domNode.firstChild) {\n removeNode(domNode.firstChild)\n }\n}\n", "//\n// DOM node manipulation\n//\nimport { ieVersion } from '../ie'\n\nexport function fixUpContinuousNodeArray (continuousNodeArray, parentNode) {\n // Before acting on a set of nodes that were previously outputted by a template function, we have to reconcile\n // them against what is in the DOM right now. It may be that some of the nodes have already been removed, or that\n // new nodes might have been inserted in the middle, for example by a binding. Also, there may previously have been\n // leading comment nodes (created by rewritten string-based templates) that have since been removed during binding.\n // So, this function translates the old \"map\" output array into its best guess of the set of current DOM nodes.\n //\n // Rules:\n // [A] Any leading nodes that have been removed should be ignored\n // These most likely correspond to memoization nodes that were already removed during binding\n // See https://github.com/knockout/knockout/pull/440\n // [B] Any trailing nodes that have been remove should be ignored\n // This prevents the code here from adding unrelated nodes to the array while processing rule [C]\n // See https://github.com/knockout/knockout/pull/1903\n // [C] We want to output a continuous series of nodes. So, ignore any nodes that have already been removed,\n // and include any nodes that have been inserted among the previous collection\n\n if (continuousNodeArray.length) {\n // The parent node can be a virtual element; so get the real parent node\n parentNode = (parentNode.nodeType === 8 && parentNode.parentNode) || parentNode\n\n // Rule [A]\n while (continuousNodeArray.length && continuousNodeArray[0].parentNode !== parentNode) { continuousNodeArray.splice(0, 1) }\n\n // Rule [B]\n while (continuousNodeArray.length > 1 && continuousNodeArray[continuousNodeArray.length - 1].parentNode !== parentNode) { continuousNodeArray.length-- }\n\n // Rule [C]\n if (continuousNodeArray.length > 1) {\n var current = continuousNodeArray[0], last = continuousNodeArray[continuousNodeArray.length - 1]\n // Replace with the actual new continuous node set\n continuousNodeArray.length = 0\n while (current !== last) {\n continuousNodeArray.push(current)\n current = current.nextSibling\n }\n continuousNodeArray.push(last)\n }\n }\n return continuousNodeArray\n}\n\nexport function setOptionNodeSelectionState (optionNode, isSelected) {\n // IE6 sometimes throws \"unknown error\" if you try to write to .selected directly, whereas Firefox struggles with setAttribute. Pick one based on browser.\n if (ieVersion < 7) { optionNode.setAttribute('selected', isSelected) } else { optionNode.selected = isSelected }\n}\n\nexport function forceRefresh (node) {\n // Workaround for an IE9 rendering bug - https://github.com/SteveSanderson/knockout/issues/209\n if (ieVersion >= 9) {\n // For text nodes and comment nodes (most likely virtual elements), we will have to refresh the container\n var elem = node.nodeType == 1 ? node : node.parentNode\n if (elem.style) { elem.style.zoom = elem.style.zoom }\n }\n}\n\nexport function ensureSelectElementIsRenderedCorrectly (selectElement) {\n // Workaround for IE9 rendering bug - it doesn't reliably display all the text in dynamically-added select boxes unless you force it to re-render by updating the width.\n // (See https://github.com/SteveSanderson/knockout/issues/312, http://stackoverflow.com/questions/5908494/select-only-shows-first-char-of-selected-option)\n // Also fixes IE7 and IE8 bug that causes selects to be zero width if enclosed by 'if' or 'with'. (See issue #839)\n if (ieVersion) {\n var originalWidth = selectElement.style.width\n selectElement.style.width = 0\n selectElement.style.width = originalWidth\n }\n}\n", "/* eslint no-cond-assign: 0 */\n//\n// Virtual Elements\n//\n//\n// \"Virtual elements\" is an abstraction on top of the usual DOM API which understands the notion that comment nodes\n// may be used to represent hierarchy (in addition to the DOM's natural hierarchy).\n// If you call the DOM-manipulating functions on ko.virtualElements, you will be able to read and write the state\n// of that virtual hierarchy\n//\n// The point of all this is to support containerless templates (e.g., <!-- ko foreach:someCollection -->blah<!-- /ko -->)\n// without having to scatter special cases all over the binding and templating code.\n\n// IE 9 cannot reliably read the \"nodeValue\" property of a comment node (see https://github.com/SteveSanderson/knockout/issues/186)\n// but it does give them a nonstandard alternative property called \"text\" that it can read reliably. Other browsers don't have that property.\n// So, use node.text where available, and node.nodeValue elsewhere\nimport { emptyDomNode, setDomNodeChildren as setRegularDomNodeChildren } from './manipulation'\nimport { removeNode } from './disposal'\nimport { tagNameLower } from './info'\nimport * as domData from './data'\nimport options from '../options'\n\nvar commentNodesHaveTextProperty = options.document && options.document.createComment('test').text === '<!--test-->'\n\nexport var startCommentRegex = commentNodesHaveTextProperty ? /^<!--\\s*ko(?:\\s+([\\s\\S]+))?\\s*-->$/ : /^\\s*ko(?:\\s+([\\s\\S]+))?\\s*$/\nexport var endCommentRegex = commentNodesHaveTextProperty ? /^<!--\\s*\\/ko\\s*-->$/ : /^\\s*\\/ko\\s*$/\nvar htmlTagsWithOptionallyClosingChildren = { 'ul': true, 'ol': true }\n\nexport function isStartComment (node) {\n return (node.nodeType == 8) && startCommentRegex.test(commentNodesHaveTextProperty ? node.text : node.nodeValue)\n}\n\nexport function isEndComment (node) {\n return (node.nodeType == 8) && endCommentRegex.test(commentNodesHaveTextProperty ? node.text : node.nodeValue)\n}\n\nfunction isUnmatchedEndComment (node) {\n return isEndComment(node) && !domData.get(node, matchedEndCommentDataKey)\n}\n\nconst matchedEndCommentDataKey = '__ko_matchedEndComment__'\n\nexport function getVirtualChildren (startComment, allowUnbalanced) {\n var currentNode = startComment\n var depth = 1\n var children = []\n while (currentNode = currentNode.nextSibling) {\n if (isEndComment(currentNode)) {\n domData.set(currentNode, matchedEndCommentDataKey, true)\n depth--\n if (depth === 0) { return children }\n }\n\n children.push(currentNode)\n\n if (isStartComment(currentNode)) { depth++ }\n }\n if (!allowUnbalanced) { throw new Error('Cannot find closing comment tag to match: ' + startComment.nodeValue) }\n return null\n}\n\nfunction getMatchingEndComment (startComment, allowUnbalanced) {\n var allVirtualChildren = getVirtualChildren(startComment, allowUnbalanced)\n if (allVirtualChildren) {\n if (allVirtualChildren.length > 0) { return allVirtualChildren[allVirtualChildren.length - 1].nextSibling }\n return startComment.nextSibling\n } else { return null } // Must have no matching end comment, and allowUnbalanced is true\n}\n\nfunction getUnbalancedChildTags (node) {\n // e.g., from <div>OK</div><!-- ko blah --><span>Another</span>, returns: <!-- ko blah --><span>Another</span>\n // from <div>OK</div><!-- /ko --><!-- /ko -->, returns: <!-- /ko --><!-- /ko -->\n var childNode = node.firstChild, captureRemaining = null\n if (childNode) {\n do {\n if (captureRemaining) // We already hit an unbalanced node and are now just scooping up all subsequent nodes\n { captureRemaining.push(childNode) } else if (isStartComment(childNode)) {\n var matchingEndComment = getMatchingEndComment(childNode, /* allowUnbalanced: */ true)\n if (matchingEndComment) // It's a balanced tag, so skip immediately to the end of this virtual set\n { childNode = matchingEndComment } else { captureRemaining = [childNode] } // It's unbalanced, so start capturing from this point\n } else if (isEndComment(childNode)) {\n captureRemaining = [childNode] // It's unbalanced (if it wasn't, we'd have skipped over it already), so start capturing\n }\n } while (childNode = childNode.nextSibling)\n }\n return captureRemaining\n}\n\nexport var allowedBindings = {}\nexport var hasBindingValue = isStartComment\n\nexport function childNodes (node) {\n return isStartComment(node) ? getVirtualChildren(node) : node.childNodes\n}\n\nexport function emptyNode (node) {\n if (!isStartComment(node)) { emptyDomNode(node) } else {\n var virtualChildren = childNodes(node)\n for (var i = 0, j = virtualChildren.length; i < j; i++) { removeNode(virtualChildren[i]) }\n }\n}\n\nexport function setDomNodeChildren (node, childNodes) {\n if (!isStartComment(node)) { setRegularDomNodeChildren(node, childNodes) } else {\n emptyNode(node)\n const endCommentNode = node.nextSibling // Must be the next sibling, as we just emptied the children\n const parentNode = endCommentNode.parentNode\n for (var i = 0, j = childNodes.length; i < j; ++i) {\n parentNode.insertBefore(childNodes[i], endCommentNode)\n }\n }\n}\n\nexport function prepend (containerNode, nodeToPrepend) {\n if (!isStartComment(containerNode)) {\n if (containerNode.firstChild) { containerNode.insertBefore(nodeToPrepend, containerNode.firstChild) } else { containerNode.appendChild(nodeToPrepend) }\n } else {\n // Start comments must always have a parent and at least one following sibling (the end comment)\n containerNode.parentNode.insertBefore(nodeToPrepend, containerNode.nextSibling)\n }\n}\n\nexport function insertAfter (containerNode, nodeToInsert, insertAfterNode) {\n if (!insertAfterNode) {\n prepend(containerNode, nodeToInsert)\n } else if (!isStartComment(containerNode)) {\n // Insert after insertion point\n if (insertAfterNode.nextSibling) { containerNode.insertBefore(nodeToInsert, insertAfterNode.nextSibling) } else { containerNode.appendChild(nodeToInsert) }\n } else {\n // Children of start comments must always have a parent and at least one following sibling (the end comment)\n containerNode.parentNode.insertBefore(nodeToInsert, insertAfterNode.nextSibling)\n }\n}\n\nexport function firstChild (node) {\n if (!isStartComment(node)) {\n if (node.firstChild && isEndComment(node.firstChild)) {\n throw new Error('Found invalid end comment, as the first child of ' + node.outerHTML)\n }\n return node.firstChild\n }\n if (!node.nextSibling || isEndComment(node.nextSibling)) {\n return null\n }\n return node.nextSibling\n}\n\nexport function lastChild (node) {\n let nextChild = firstChild(node)\n let lastChildNode\n\n do {\n lastChildNode = nextChild\n } while (nextChild = nextSibling(nextChild))\n\n return lastChildNode\n}\n\nexport function nextSibling (node) {\n if (isStartComment(node)) {\n node = getMatchingEndComment(node)\n }\n\n if (node.nextSibling && isEndComment(node.nextSibling)) {\n if (isUnmatchedEndComment(node.nextSibling)) {\n throw Error('Found end comment without a matching opening comment, as next sibling of ' + node.outerHTML)\n }\n return null\n } else {\n return node.nextSibling\n }\n}\n\nexport function previousSibling (node) {\n var depth = 0\n do {\n if (node.nodeType === 8) {\n if (isStartComment(node)) {\n if (--depth === 0) {\n return node\n }\n } else if (isEndComment(node)) {\n depth++\n }\n } else {\n if (depth === 0) { return node }\n }\n } while (node = node.previousSibling)\n}\n\nexport function virtualNodeBindingValue (node) {\n var regexMatch = (commentNodesHaveTextProperty ? node.text : node.nodeValue).match(startCommentRegex)\n return regexMatch ? regexMatch[1] : null\n}\n\nexport function normaliseVirtualElementDomStructure (elementVerified) {\n // Workaround for https://github.com/SteveSanderson/knockout/issues/155\n // (IE <= 8 or IE 9 quirks mode parses your HTML weirdly, treating closing </li> tags as if they don't exist, thereby moving comment nodes\n // that are direct descendants of <ul> into the preceding <li>)\n if (!htmlTagsWithOptionallyClosingChildren[tagNameLower(elementVerified)]) { return }\n\n // Scan immediate children to see if they contain unbalanced comment tags. If they do, those comment tags\n // must be intended to appear *after* that child, so move them there.\n var childNode = elementVerified.firstChild\n if (childNode) {\n do {\n if (childNode.nodeType === 1) {\n var unbalancedTags = getUnbalancedChildTags(childNode)\n if (unbalancedTags) {\n // Fix up the DOM by moving the unbalanced tags to where they most likely were intended to be placed - *after* the child\n var nodeToInsertBefore = childNode.nextSibling\n for (var i = 0; i < unbalancedTags.length; i++) {\n if (nodeToInsertBefore) { elementVerified.insertBefore(unbalancedTags[i], nodeToInsertBefore) } else { elementVerified.appendChild(unbalancedTags[i]) }\n }\n }\n }\n } while (childNode = childNode.nextSibling)\n }\n}\n", "//\n// HTML-based manipulation\n//\nimport { stringTrim } from '../string'\nimport { makeArray } from '../array'\nimport { emptyDomNode, moveCleanedNodesToContainerElement } from './manipulation'\nimport { jQueryInstance } from '../jquery'\nimport { forceRefresh } from './fixes'\nimport * as virtualElements from './virtualElements'\nimport options from '../options'\n\nvar none = [0, '', ''],\n table = [1, '<table>', '</table>'],\n tbody = [2, '<table><tbody>', '</tbody></table>'],\n colgroup = [ 2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],\n tr = [3, '<table><tbody><tr>', '</tr></tbody></table>'],\n select = [1, \"<select multiple='multiple'>\", '</select>'],\n fieldset = [1, '<fieldset>', '</fieldset>'],\n map = [1, '<map>', '</map>'],\n object = [1, '<object>', '</object>'],\n lookup = {\n 'area': map,\n 'col': colgroup,\n 'colgroup': table,\n 'caption': table,\n 'legend': fieldset,\n 'thead': table,\n 'tbody': table,\n 'tfoot': table,\n 'tr': tbody,\n 'td': tr,\n 'th': tr,\n 'option': select,\n 'optgroup': select,\n 'param': object\n },\n\n // The canonical way to test that the HTML5 <template> tag is supported\n supportsTemplateTag = options.document && 'content' in options.document.createElement('template')\n\nfunction getWrap (tags) {\n const m = tags.match(/^(?:<!--.*?-->\\s*?)*?<([a-z]+)[\\s>]/)\n return (m && lookup[m[1]]) || none\n}\n\nfunction simpleHtmlParse (html, documentContext) {\n documentContext || (documentContext = document)\n var windowContext = documentContext['parentWindow'] || documentContext['defaultView'] || window\n\n // Based on jQuery's \"clean\" function, but only accounting for table-related elements.\n // If you have referenced jQuery, this won't be used anyway - KO will use jQuery's \"clean\" function directly\n\n // Note that there's still an issue in IE < 9 whereby it will discard comment nodes that are the first child of\n // a descendant node. For example: \"<div><!-- mycomment -->abc</div>\" will get parsed as \"<div>abc</div>\"\n // This won't affect anyone who has referenced jQuery, and there's always the workaround of inserting a dummy node\n // (possibly a text node) in front of the comment. So, KO does not attempt to workaround this IE issue automatically at present.\n\n // Trim whitespace, otherwise indexOf won't work as expected\n var tags = stringTrim(html).toLowerCase(), div = documentContext.createElement('div'),\n wrap = getWrap(tags),\n depth = wrap[0]\n\n // Go to html and back, then peel off extra wrappers\n // Note that we always prefix with some dummy text, because otherwise, IE<9 will strip out leading comment nodes in descendants. Total madness.\n var markup = 'ignored<div>' + wrap[1] + html + wrap[2] + '</div>'\n if (typeof windowContext['innerShiv'] === 'function') {\n // Note that innerShiv is deprecated in favour of html5shiv. We should consider adding\n // support for html5shiv (except if no explicit support is needed, e.g., if html5shiv\n // somehow shims the native APIs so it just works anyway)\n div.appendChild(windowContext['innerShiv'](markup))\n } else {\n div.innerHTML = markup\n }\n\n // Move to the right depth\n while (depth--) { div = div.lastChild }\n\n return makeArray(div.lastChild.childNodes)\n}\n\nfunction templateHtmlParse (html, documentContext) {\n if (!documentContext) { documentContext = document }\n var template = documentContext.createElement('template')\n template.innerHTML = html\n return makeArray(template.content.childNodes)\n}\n\nfunction jQueryHtmlParse (html, documentContext) {\n // jQuery's \"parseHTML\" function was introduced in jQuery 1.8.0 and is a documented public API.\n if (jQueryInstance.parseHTML) {\n return jQueryInstance.parseHTML(html, documentContext) || [] // Ensure we always return an array and never null\n } else {\n // For jQuery < 1.8.0, we fall back on the undocumented internal \"clean\" function.\n var elems = jQueryInstance.clean([html], documentContext)\n\n // As of jQuery 1.7.1, jQuery parses the HTML by appending it to some dummy parent nodes held in an in-memory document fragment.\n // Unfortunately, it never clears the dummy parent nodes from the document fragment, so it leaks memory over time.\n // Fix this by finding the top-most dummy parent element, and detaching it from its owner fragment.\n if (elems && elems[0]) {\n // Find the top-most parent element that's a direct child of a document fragment\n var elem = elems[0]\n while (elem.parentNode && elem.parentNode.nodeType !== 11 /* i.e., DocumentFragment */) { elem = elem.parentNode }\n // ... then detach it\n if (elem.parentNode) { elem.parentNode.removeChild(elem) }\n }\n\n return elems\n }\n}\n\n/**\n * parseHtmlFragment converts a string into an array of DOM Nodes.\n * If supported, it uses <template>-tag parsing, falling back on\n * jQuery parsing (if jQuery is present), and finally on a\n * straightforward parser.\n *\n * @param {string} html To be parsed.\n * @param {Object} documentContext That owns the executing code.\n * @return {[DOMNode]} Parsed DOM Nodes\n */\nexport function parseHtmlFragment (html, documentContext) {\n // Prefer <template>-tag based HTML parsing.\n return supportsTemplateTag ? templateHtmlParse(html, documentContext)\n\n // Benefit from jQuery's on old browsers, where possible\n // NOTE: jQuery's HTML parsing fails on element names like tr-*.\n // See: https://github.com/jquery/jquery/pull/1988\n : (jQueryInstance ? jQueryHtmlParse(html, documentContext)\n\n // ... otherwise, this simple logic will do in most common cases.\n : simpleHtmlParse(html, documentContext))\n}\n\nexport function parseHtmlForTemplateNodes (html, documentContext) {\n const nodes = parseHtmlFragment(html, documentContext)\n return (nodes.length && nodes[0].parentElement) || moveCleanedNodesToContainerElement(nodes)\n}\n\n/**\n * setHtml empties the node's contents, unwraps the HTML, and\n * sets the node's HTML using jQuery.html or parseHtmlFragment\n *\n * @param {DOMNode} node Node in which HTML needs to be set\n * @param {DOMNode} html HTML to be inserted in node\n * @returns undefined\n */\nexport function setHtml (node, html) {\n emptyDomNode(node)\n\n // There's few cases where we would want to display a stringified\n // function, so we unwrap it.\n if (typeof html === 'function') {\n html = html()\n }\n\n if ((html !== null) && (html !== undefined)) {\n if (typeof html !== 'string') { html = html.toString() }\n\n // If the browser supports <template> tags, prefer that, as\n // it obviates all the complex workarounds of jQuery.\n //\n // However, jQuery contains a lot of sophisticated code to parse arbitrary HTML fragments,\n // for example <tr> elements which are not normally allowed to exist on their own.\n // If you've referenced jQuery (and template tags are not supported) we'll use that rather than duplicating its code.\n if (jQueryInstance && !supportsTemplateTag) {\n jQueryInstance(node).html(html)\n } else {\n // ... otherwise, use KO's own parsing logic.\n var parsedNodes = parseHtmlFragment(html, node.ownerDocument)\n\n if (node.nodeType === 8) {\n if (html === null) {\n virtualElements.emptyNode(node)\n } else {\n virtualElements.setDomNodeChildren(node, parsedNodes)\n }\n } else {\n for (var i = 0; i < parsedNodes.length; i++) { node.appendChild(parsedNodes[i]) }\n }\n }\n }\n}\n\n\nexport function setTextContent (element, textContent) {\n var value = typeof textContent === 'function' ? textContent() : textContent\n if ((value === null) || (value === undefined)) { value = '' }\n\n // We need there to be exactly one child: a text node.\n // If there are no children, more than one, or if it's not a text node,\n // we'll clear everything and create a single text node.\n var innerTextNode = virtualElements.firstChild(element)\n if (!innerTextNode || innerTextNode.nodeType != 3 || virtualElements.nextSibling(innerTextNode)) {\n virtualElements.setDomNodeChildren(element, [element.ownerDocument.createTextNode(value)])\n } else {\n innerTextNode.data = value\n }\n\n forceRefresh(element)\n}\n", "\nimport { ieVersion } from '../ie'\nimport { safeSetTimeout } from '../error'\n\nimport { tagNameLower } from './info'\nimport * as domData from './data'\n\nvar hasDomDataExpandoProperty = Symbol('Knockout selectExtensions hasDomDataProperty')\n\n// Normally, SELECT elements and their OPTIONs can only take value of type 'string' (because the values\n// are stored on DOM attributes). ko.selectExtensions provides a way for SELECTs/OPTIONs to have values\n// that are arbitrary objects. This is very convenient when implementing things like cascading dropdowns.\n//\nexport var selectExtensions = {\n optionValueDomDataKey: domData.nextKey(),\n\n readValue: function (element) {\n switch (tagNameLower(element)) {\n case 'option':\n if (element[hasDomDataExpandoProperty] === true) { return domData.get(element, selectExtensions.optionValueDomDataKey) }\n return element.value\n case 'select':\n return element.selectedIndex >= 0 ? selectExtensions.readValue(element.options[element.selectedIndex]) : undefined\n default:\n return element.value\n }\n },\n\n writeValue: function (element, value, allowUnset) {\n switch (tagNameLower(element)) {\n case 'option':\n if (typeof value === 'string') {\n domData.set(element, selectExtensions.optionValueDomDataKey, undefined)\n if (hasDomDataExpandoProperty in element) { // IE <= 8 throws errors if you delete non-existent properties from a DOM node\n delete element[hasDomDataExpandoProperty]\n }\n element.value = value\n } else {\n // Store arbitrary object using DomData\n domData.set(element, selectExtensions.optionValueDomDataKey, value)\n element[hasDomDataExpandoProperty] = true\n // Special treatment of numbers is just for backward compatibility. KO 1.2.1 wrote numerical values to element.value.\n element.value = typeof value === 'number' ? value : ''\n }\n\n break\n case 'select':\n if (value === '' || value === null) {\n // A blank string or null value will select the caption\n value = undefined\n }\n var selection = -1\n for (let i = 0, n = element.options.length, optionValue; i < n; ++i) {\n optionValue = selectExtensions.readValue(element.options[i])\n // Include special check to handle selecting a caption with a blank string value\n // Note that the looser == check here is intentional so that integer model values will match string element values.\n const strictEqual = optionValue === value\n const blankEqual = optionValue === '' && value === undefined\n const numericEqual = typeof value === 'number' && Number(optionValue) === value\n if (strictEqual || blankEqual || numericEqual) {\n selection = i\n break\n }\n }\n if (allowUnset || selection >= 0 || (value === undefined && element.size > 1)) {\n element.selectedIndex = selection\n }\n break\n default:\n if ((value === null) || (value === undefined)) { value = '' }\n element.value = value\n break\n }\n }\n}\n", "//\n// Memoization\n//\nimport { arrayPushAll } from './array'\n\nvar memos = {}\n\nfunction randomMax8HexChars () {\n return (((1 + Math.random()) * 0x100000000) | 0).toString(16).substring(1)\n}\n\nfunction generateRandomId () {\n return randomMax8HexChars() + randomMax8HexChars()\n}\n\nfunction findMemoNodes (rootNode, appendToArray) {\n if (!rootNode) { return }\n if (rootNode.nodeType == 8) {\n var memoId = parseMemoText(rootNode.nodeValue)\n if (memoId != null) { appendToArray.push({ domNode: rootNode, memoId: memoId }) }\n } else if (rootNode.nodeType == 1) {\n for (var i = 0, childNodes = rootNode.childNodes, j = childNodes.length; i < j; i++) { findMemoNodes(childNodes[i], appendToArray) }\n }\n}\n\nexport function memoize (callback) {\n if (typeof callback !== 'function') { throw new Error('You can only pass a function to memoization.memoize()') }\n var memoId = generateRandomId()\n memos[memoId] = callback\n return '<!--[ko_memo:' + memoId + ']-->'\n}\n\nexport function unmemoize (memoId, callbackParams) {\n var callback = memos[memoId]\n if (callback === undefined) { throw new Error(\"Couldn't find any memo with ID \" + memoId + \". Perhaps it's already been unmemoized.\") }\n try {\n callback.apply(null, callbackParams || [])\n return true\n } finally { delete memos[memoId] }\n}\n\nexport function unmemoizeDomNodeAndDescendants (domNode, extraCallbackParamsArray) {\n var memos = []\n findMemoNodes(domNode, memos)\n for (var i = 0, j = memos.length; i < j; i++) {\n var node = memos[i].domNode\n var combinedParams = [node]\n if (extraCallbackParamsArray) { arrayPushAll(combinedParams, extraCallbackParamsArray) }\n unmemoize(memos[i].memoId, combinedParams)\n node.nodeValue = '' // Neuter this node so we don't try to unmemoize it again\n if (node.parentNode) { node.parentNode.removeChild(node) } // If possible, erase it totally (not always possible - someone else might just hold a reference to it then call unmemoizeDomNodeAndDescendants again)\n }\n}\n\nexport function parseMemoText (memoText) {\n var match = memoText.match(/^\\[ko_memo\\:(.*?)\\]$/)\n return match ? match[1] : null\n}\n", "//\n// Tasks Micro-scheduler\n// ===\n//\n/* eslint no-cond-assign: 0 */\nimport options from './options'\nimport { deferError } from './error'\n\nvar taskQueue = [],\n taskQueueLength = 0,\n nextHandle = 1,\n nextIndexToProcess = 0,\n w = options.global\n\nif (w && w.MutationObserver && !(w.navigator && w.navigator.standalone)) {\n // Chrome 27+, Firefox 14+, IE 11+, Opera 15+, Safari 6.1+, node\n // From https://github.com/petkaantonov/bluebird * Copyright (c) 2014 Petka Antonov * License: MIT\n options.taskScheduler = (function (callback) {\n var div = w.document.createElement('div')\n new w.MutationObserver(callback).observe(div, {attributes: true})\n return function () { div.classList.toggle('foo') }\n })(scheduledProcess)\n} else if (w && w.document && 'onreadystatechange' in w.document.createElement('script')) {\n // IE 6-10\n // From https://github.com/YuzuJS/setImmediate * Copyright (c) 2012 Barnesandnoble.com, llc, Donavon West, and Domenic Denicola * License: MIT\n options.taskScheduler = function (callback) {\n var script = document.createElement('script')\n script.onreadystatechange = function () {\n script.onreadystatechange = null\n document.documentElement.removeChild(script)\n script = null\n callback()\n }\n document.documentElement.appendChild(script)\n }\n} else {\n options.taskScheduler = function (callback) {\n setTimeout(callback, 0)\n }\n}\n\nfunction processTasks () {\n if (taskQueueLength) {\n // Each mark represents the end of a logical group of tasks and the number of these groups is\n // limited to prevent unchecked recursion.\n var mark = taskQueueLength, countMarks = 0\n\n // nextIndexToProcess keeps track of where we are in the queue; processTasks can be called recursively without issue\n for (var task; nextIndexToProcess < taskQueueLength;) {\n if (task = taskQueue[nextIndexToProcess++]) {\n if (nextIndexToProcess > mark) {\n if (++countMarks >= 5000) {\n nextIndexToProcess = taskQueueLength // skip all tasks remaining in the queue since any of them could be causing the recursion\n deferError(Error(\"'Too much recursion' after processing \" + countMarks + ' task groups.'))\n break\n }\n mark = taskQueueLength\n }\n try {\n task()\n } catch (ex) {\n deferError(ex)\n }\n }\n }\n }\n}\n\nfunction scheduledProcess () {\n processTasks()\n\n // Reset the queue\n nextIndexToProcess = taskQueueLength = taskQueue.length = 0\n}\n\nfunction scheduleTaskProcessing () {\n options.taskScheduler(scheduledProcess)\n}\n\nexport function schedule (func) {\n if (!taskQueueLength) {\n scheduleTaskProcessing()\n }\n\n taskQueue[taskQueueLength++] = func\n return nextHandle++\n}\n\nexport function cancel (handle) {\n var index = handle - (nextHandle - taskQueueLength)\n if (index >= nextIndexToProcess && index < taskQueueLength) {\n taskQueue[index] = null\n }\n}\n\n// For testing only: reset the queue and return the previous queue length\nexport function resetForTesting () {\n var length = taskQueueLength - nextIndexToProcess\n nextIndexToProcess = taskQueueLength = taskQueue.length = 0\n return length\n}\n\nexport {processTasks as runEarly}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACMA,IAAM,EAAC,YAAW;AAEX,sBAAuB,OAAO,QAAQ,SAAS;AACpD,MAAI,UAAU,SAAS,GAAG;AAAE,aAAS,OAAO,KAAK,OAAO;AAAA,EAAE;AAC1D,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,IAAI,GAAG,EAAE,GAAG;AAC5C,WAAO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AY,MAAM;AAC3C,eAAS;AACT,eAAS;AAAA,IACX;AACA,aAAS,gBAAgB,YAAY,MAAM;AAAA,EAC7C;AACF,OAAO;AACL,kBAAQ,gBAAgB,SAAU,UAAU;AAC1C,eAAW,UAAU,CAAC;AAAA,EACxB;AACF;AAEA,wBAAyB;AACvB,MAAI,iBAAiB;AAGnB,QAAI,OAAO,iBAAiB,aAAa;AAGzC,aAAS,MAAM,qBAAqB,mBAAkB;AACpD,UAAI,OAAO,UAAU,uBAAuB;AAC1C,YAAI,qBAAqB,MAAM;AAC7B,cAAI,EAAE,cAAc,KAAM;AACxB,iCAAqB;AACrB,uBAAW,MAAM,2CAA2C,aAAa,eAAe,CAAC;AACzF;AAAA,UACF;AACA,iBAAO;AAAA,QACT;AACA,YAAI;AACF,eAAK;AAAA,QACP,SAAS,IAAP;AACA,qBAAW,EAAE;AAAA,QACf;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEA,4BAA6B;AAC3B,eAAa;AAGb,uBAAqB,kBAAkB,UAAU,SAAS;AAC5D;AAEA,kCAAmC;AACjC,kBAAQ,cAAc,gBAAgB;AACxC;AAEO,kBAAmB,MAAM;AAC9B,MAAI,CAAC,iBAAiB;AACpB,2BAAuB;AAAA,EACzB;AAEA,YAAU,qBAAqB;AAC/B,SAAO;AACT;AAEO,gBAAiB,QAAQ;AAC9B,MAAI,QAAQ,SAAU,cAAa;AACnC,MAAI,SAAS,sBAAsB,QAAQ,iBAAiB;AAC1D,cAAU,SAAS;AAAA,EACrB;AACF;AAGO,2BAA4B;AACjC,MAAI,SAAS,kBAAkB;AAC/B,uBAAqB,kBAAkB,UAAU,SAAS;AAC1D,SAAO;AACT;",
6
- "names": []
3
+ "sources": ["../index.ts", "../src/array.ts", "../src/options.ts", "../src/error.ts", "../src/async.ts", "../src/object.ts", "../src/function.ts", "../src/string.ts", "../src/symbol.ts", "../src/css.ts", "../src/dom/info.ts", "../src/dom/event.ts", "../src/dom/data.ts", "../src/dom/disposal.ts", "../src/dom/manipulation.ts", "../src/dom/fixes.ts", "../src/dom/virtualElements.ts", "../src/dom/html.ts", "../src/dom/selectExtensions.ts", "../src/memoization.ts", "../src/tasks.ts"],
4
+ "sourcesContent": ["export * from './src'\nexport { options as default } from './src'\n", "//\n// Array utilities\n//\n// Note that the array functions may be called with\n// Array-like things, such as NodeList.\n\nconst { isArray } = Array\n\nexport function arrayForEach<T = any>(\n array: T[],\n action: (item: T, index?: number, array?: T[]) => void,\n actionOwner?: any\n): void {\n if (arguments.length > 2) {\n action = action.bind(actionOwner)\n }\n for (let i = 0, j = array.length; i < j; ++i) {\n action(array[i], i, array)\n }\n}\n\nexport function arrayIndexOf<T = any>(array: Array<T>, item: T): number {\n return (isArray(array) ? array : [...array]).indexOf(item)\n}\n\nexport function arrayFirst<T = any>(\n array: T[],\n predicate: (item: T, index?: number) => boolean,\n predicateOwner?: any\n): T | undefined {\n return (isArray(array) ? array : [...array]).find(predicate, predicateOwner)\n}\n\nexport function arrayMap<T = any, U = any>(array: ArrayLike<T>, mapping: (item: T, index?: number) => U, thisArg?) {\n if (arguments.length > 2) {\n mapping = mapping.bind(thisArg)\n }\n return array === null ? [] : Array.from(array, mapping)\n}\n\nexport function arrayRemoveItem<T = any>(array: Array<T>, itemToRemove: T): void {\n const index = arrayIndexOf(array, itemToRemove)\n if (index > 0) {\n array.splice(index, 1)\n } else if (index === 0) {\n array.shift()\n }\n}\n\nexport function arrayGetDistinctValues<T = any>(array: T[]): T[] {\n const seen = new Set()\n if (array === null) {\n return []\n }\n return (isArray(array) ? array : [...array]).filter(item => (seen.has(item) ? false : seen.add(item)))\n}\n\nexport function arrayFilter<T = any>(\n array: T[],\n predicate: (item: T, index?: number) => boolean,\n predicateOwner?: any\n): T[] {\n if (arguments.length > 2) {\n predicate = predicate.bind(predicateOwner)\n }\n return array === null ? [] : (isArray(array) ? array : [...array]).filter(predicate)\n}\n\nexport function arrayPushAll<T = any>(array: Array<T>, valuesToPush: ArrayLike<T>): T[] {\n if (isArray(valuesToPush)) {\n array.push.apply(array, valuesToPush)\n } else {\n for (let i = 0, j = valuesToPush.length; i < j; i++) {\n array.push(valuesToPush[i])\n }\n }\n return array\n}\n\nexport function addOrRemoveItem(array, value, included: boolean) {\n const existingEntryIndex = arrayIndexOf(typeof array.peek === 'function' ? array.peek() : array, value)\n if (existingEntryIndex < 0) {\n if (included) {\n array.push(value)\n }\n } else {\n if (!included) {\n array.splice(existingEntryIndex, 1)\n }\n }\n}\n\nexport function makeArray<T = any>(arrayLikeObject: ArrayLike<T>): T[] {\n return Array.from(arrayLikeObject)\n}\n\n//TODO May be MaybeSubscribable<number> -> I actually don't want the dependency\nexport function range(min: () => number | number, max: () => number | number): number[] {\n const minimum = typeof min === 'function' ? (min as () => number)() : (min as number)\n const maximum = typeof max === 'function' ? (max as () => number)() : (max as number)\n const result: number[] = []\n for (let i = minimum as number; i <= maximum; i++) {\n result.push(i)\n }\n return result\n}\n\n// Go through the items that have been added and deleted and try to find matches between them.\nexport function findMovesInArrayComparison(left, right, limitFailedCompares?: number | boolean) {\n if (left.length && right.length) {\n let failedCompares, l, r, leftItem, rightItem\n for (\n failedCompares = l = 0;\n (!limitFailedCompares || failedCompares < limitFailedCompares) && (leftItem = left[l]);\n ++l\n ) {\n for (r = 0; (rightItem = right[r]); ++r) {\n if (leftItem.value === rightItem.value) {\n leftItem.moved = rightItem.index\n rightItem.moved = leftItem.index\n right.splice(r, 1) // This item is marked as moved; so remove it from right list\n failedCompares = r = 0 // Reset failed compares count because we're checking for consecutive failures\n break\n }\n }\n failedCompares += r\n }\n }\n}\n\nconst statusNotInOld = 'added'\nconst statusNotInNew = 'deleted'\n\nexport interface ArrayChange<T = any> {\n status: 'added' | 'deleted' | 'retained'\n value: T\n index: number\n moved?: number\n}\n\nexport type ArrayChanges<T = any> = ArrayChange<T>[]\n\nexport interface CompareArraysOptions {\n dontLimitMoves?: boolean\n sparse?: boolean\n}\n\n// Simple calculation based on Levenshtein distance.\nexport function compareArrays<T = any>(\n oldArray: T[],\n newArray: T[],\n options?: CompareArraysOptions | boolean\n): ArrayChanges<T> {\n // For backward compatibility, if the third arg is actually a bool, interpret\n // it as the old parameter 'dontLimitMoves'. Newer code should use { dontLimitMoves: true }.\n options = typeof options === 'boolean' ? { dontLimitMoves: options } : options || {}\n oldArray = oldArray || []\n newArray = newArray || []\n\n if (oldArray.length < newArray.length) {\n return compareSmallArrayToBigArray(oldArray, newArray, statusNotInOld, statusNotInNew, options)\n } else {\n return compareSmallArrayToBigArray(newArray, oldArray, statusNotInNew, statusNotInOld, options)\n }\n}\n\nfunction compareSmallArrayToBigArray<T = any>(\n smlArray: T[],\n bigArray: T[],\n statusNotInSml: 'added' | 'deleted',\n statusNotInBig: 'added' | 'deleted',\n options: CompareArraysOptions\n): ArrayChanges<T> {\n let myMin = Math.min,\n myMax = Math.max,\n editDistanceMatrix = new Array(),\n smlIndex,\n smlIndexMax = smlArray.length,\n bigIndex,\n bigIndexMax = bigArray.length,\n compareRange = bigIndexMax - smlIndexMax || 1,\n maxDistance = smlIndexMax + bigIndexMax + 1,\n thisRow,\n lastRow,\n bigIndexMaxForRow,\n bigIndexMinForRow\n\n for (smlIndex = 0; smlIndex <= smlIndexMax; smlIndex++) {\n lastRow = thisRow\n editDistanceMatrix.push((thisRow = new Array()))\n bigIndexMaxForRow = myMin(bigIndexMax, smlIndex + compareRange)\n bigIndexMinForRow = myMax(0, smlIndex - 1)\n for (bigIndex = bigIndexMinForRow; bigIndex <= bigIndexMaxForRow; bigIndex++) {\n if (!bigIndex) {\n thisRow[bigIndex] = smlIndex + 1\n } else if (!smlIndex) {\n // Top row - transform empty array into new array via additions\n thisRow[bigIndex] = bigIndex + 1\n } else if (smlArray[smlIndex - 1] === bigArray[bigIndex - 1]) {\n thisRow[bigIndex] = lastRow[bigIndex - 1]\n } else {\n // copy value (no edit)\n const northDistance = lastRow[bigIndex] || maxDistance // not in big (deletion)\n const westDistance = thisRow[bigIndex - 1] || maxDistance // not in small (addition)\n thisRow[bigIndex] = myMin(northDistance, westDistance) + 1\n }\n }\n }\n\n let editScript = new Array(),\n meMinusOne,\n notInSml = new Array(),\n notInBig = new Array()\n for (smlIndex = smlIndexMax, bigIndex = bigIndexMax; smlIndex || bigIndex; ) {\n meMinusOne = editDistanceMatrix[smlIndex][bigIndex] - 1\n if (bigIndex && meMinusOne === editDistanceMatrix[smlIndex][bigIndex - 1]) {\n notInSml.push(\n (editScript[editScript.length] = {\n // added\n status: statusNotInSml,\n value: bigArray[--bigIndex],\n index: bigIndex\n })\n )\n } else if (smlIndex && meMinusOne === editDistanceMatrix[smlIndex - 1][bigIndex]) {\n notInBig.push(\n (editScript[editScript.length] = {\n // deleted\n status: statusNotInBig,\n value: smlArray[--smlIndex],\n index: smlIndex\n })\n )\n } else {\n --bigIndex\n --smlIndex\n if (!options?.sparse) {\n editScript.push({ status: 'retained', value: bigArray[bigIndex] })\n }\n }\n }\n\n // Set a limit on the number of consecutive non-matching comparisons; having it a multiple of\n // smlIndexMax keeps the time complexity of this algorithm linear.\n findMovesInArrayComparison(notInBig, notInSml, !options.dontLimitMoves && smlIndexMax * 10)\n\n return editScript.reverse()\n}\n", "import { Provider } from '@tko/provider'\nimport type { KnockoutInstance } from '@tko/builder'\n\nexport interface CustomBindingGlobalProperties {\n [customBindingName: string]: any\n}\n\nexport type BindingStringPreparsersFunction = (bindingString: string) => string\n\n//\n// This becomes ko.options\n// --\n//\n// This is the root 'options', which must be extended by others.\nexport class Options {\n // The following options can be set on ko.options to make a function rewriting or something similar.\n bindingStringPreparsers: BindingStringPreparsersFunction[] = []\n\n // Reference to the own knockout instance\n knockoutInstance: KnockoutInstance | null = null\n\n deferUpdates: boolean = false\n\n // Don't set this false, with jquery 3.7+\n useOnlyNativeEvents: boolean = true\n\n // Use HTML5 <template> tags if is supported\n useTemplateTag: boolean = true\n\n protoProperty: string = '__ko_proto__'\n\n // Modify the default attribute from `data-bind`.\n defaultBindingAttribute: string = 'data-bind'\n\n // Enable/disable <!-- ko binding: ... -> style bindings\n allowVirtualElements: boolean = true\n\n // Global variables that can be accessed from bindings.\n bindingGlobals: object & CustomBindingGlobalProperties = Object.create(null)\n\n // An instance of the binding provider.\n bindingProviderInstance: Provider\n\n // Whether the `with` binding creates a child context when used with `as`.\n createChildContextWithAs: boolean = false\n\n // jQuery will be automatically set to globalThis.jQuery in applyBindings\n // if it is (strictly equal to) undefined. Set it to true to\n // disable automatically setting jQuery.\n disableJQueryUsage: boolean = false\n\n get jQuery(): JQueryStatic | undefined {\n if (this.disableJQueryUsage) return\n return this._jQuery ?? (globalThis as any).jQuery\n }\n\n private _jQuery: JQueryStatic | undefined\n /**\n * Set jQuery manuall to be used by TKO.\n * @param jQuery If jQuery set to undefined, TKO will not use jQuery and this.disableJQueryUsage to true.\n */\n set jQuery(jQuery: JQueryStatic | undefined) {\n if (!jQuery) {\n this.disableJQueryUsage = true\n this._jQuery = undefined\n } else {\n this._jQuery = jQuery\n this.disableJQueryUsage = false\n }\n }\n\n Promise: PromiseConstructor = globalThis.Promise\n\n taskScheduler: any = null\n\n debug: boolean = false\n /**\n * The maximum size of template to parse.\n * Set to 0 to disable the limit.\n */\n templateSizeLimit: number = 4096\n\n /**\n * Whether or not to allow script tags in templates.\n * If false, an error will be thrown if a script tag is detected in the template.\n * It is not recommended to set this to true.\n */\n allowScriptTagsInTemplates: boolean = false\n\n private _sanitizeWarningLogged: boolean = false\n /**\n * Sanitize HTML templates before parsing them. Default is a no-op.\n * Please configure something like DOMPurify or validator.js for your environment.\n * @param html HTML string to be sanitized\n * @returns Sanitized HTML string\n */\n sanitizeHtmlTemplate(html: string): string {\n if (!this._sanitizeWarningLogged) {\n console.warn(\n \"WARNING -- You don't have a HTML sanitizer configured. Please configure options.sanitizeHtmlTemplate to avoid XSS vulnerabilities.\"\n )\n this._sanitizeWarningLogged = true\n }\n return html\n }\n\n global: any = globalThis\n\n document: Document = globalThis.document\n\n // Filters for bindings\n // data-bind=\"expression | filter_1 | filter_2\"\n filters: any = {}\n\n // Used by the template binding.\n includeDestroyed: boolean = false\n\n foreachHidesDestroyed: boolean = false\n\n onError(e: any, throws: boolean = true): typeof e {\n if (throws) throw e\n return e\n }\n\n set(name: string, value: any): void {\n this[name] = value\n }\n\n // Overload getBindingHandler to have a custom lookup function.\n getBindingHandler(key: string): any {\n return null\n }\n cleanExternalData(node: Node, callback?: Function) {}\n}\n\nconst options = new Options()\n\nexport default options\n", "//\n// Error handling\n// ---\n//\n// The default onError handler is to re-throw.\nimport options from './options'\n\nexport function catchFunctionErrors(delegate) {\n if (!options.onError) {\n return delegate\n }\n return (...args) => {\n try {\n return delegate(...args)\n } catch (err) {\n options.onError(err)\n }\n }\n}\n\nexport function deferError(error) {\n safeSetTimeout(function () {\n throw error\n }, 0)\n}\n\nexport function safeSetTimeout(handler, timeout: number) {\n return setTimeout(catchFunctionErrors(handler), timeout)\n}\n", "//\n// Asynchronous functionality\n// ---\nimport { safeSetTimeout } from './error'\n\nexport function throttle(callback, timeout) {\n let timeoutInstance: ReturnType<typeof setTimeout> | undefined\n return function (...args) {\n if (!timeoutInstance) {\n timeoutInstance = safeSetTimeout(function () {\n timeoutInstance = undefined\n callback(...args)\n }, timeout)\n }\n }\n}\n\nexport function debounce(callback, timeout: number) {\n let timeoutInstance: ReturnType<typeof setTimeout>\n return function (...args) {\n clearTimeout(timeoutInstance)\n timeoutInstance = safeSetTimeout(() => callback(...args), timeout)\n }\n}\n", "//\n// Object functions\n//\n\nexport function hasOwnProperty<T = any>(obj: T, propName: keyof T | any): boolean {\n return Object.prototype.hasOwnProperty.call(obj, propName)\n}\n\n/**\n * True when obj is a non-null object, or a function.\n * @param obj\n * @returns\n */\nexport function isObjectLike(obj) {\n if (obj === null) {\n return false\n }\n return typeof obj === 'object' || typeof obj === 'function'\n}\n\nexport function extend<T, U>(target: T, source: U): T & U {\n if (source) {\n for (const prop of Object.keys(source) as Array<keyof U>) {\n if (hasOwnProperty(source, prop)) {\n ;(target as T & U)[prop] = source[prop] as any\n }\n }\n }\n return target as T & U\n}\n\nexport function objectForEach<T = any>(obj: { [key: string]: T }, action: (key: string, value: T) => void): void {\n for (const prop in obj) {\n if (hasOwnProperty(obj, prop)) {\n action(prop, obj[prop])\n }\n }\n}\n\nexport function objectMap(source, mapping, thisArg?: any) {\n if (!source) {\n return source\n }\n if (arguments.length > 2) {\n mapping = mapping.bind(thisArg)\n }\n const target = {}\n for (const prop in source) {\n if (hasOwnProperty(source, prop)) {\n target[prop] = mapping(source[prop], prop, source)\n }\n }\n return target\n}\nexport function getObjectOwnProperty(obj, propName: string) {\n return hasOwnProperty(obj, propName) ? obj[propName] : undefined\n}\n\n/**\n * @deprecated Function is unused\n * */\nexport function clonePlainObjectDeep(obj, seen?: any[]) {\n if (!seen) {\n seen = new Array()\n }\n\n if (!obj || typeof obj !== 'object' || obj.constructor !== Object || seen.indexOf(obj) !== -1) {\n return obj\n }\n\n // Anything that makes it below is a plain object that has not yet\n // been seen/cloned.\n seen.push(obj)\n\n const result = {}\n for (const prop in obj) {\n if (hasOwnProperty(obj, prop)) {\n result[prop] = clonePlainObjectDeep(obj[prop], seen)\n }\n }\n return result\n}\n\n/**\n * JSON.stringify, but inserts `...` for objects that are referenced\n * multiple times, preventing infinite recursion.\n */\nexport function safeStringify(value) {\n const seen = new Set()\n return JSON.stringify(value, (k, v) => {\n if (seen.has(v)) {\n return '...'\n }\n if (typeof v === 'object') {\n seen.add(v)\n }\n return v\n })\n}\n\n/**\n * Promises/A+ compliant isThenable (per section 1.2)\n */\nexport function isThenable(object: any) {\n return isObjectLike(object) && typeof object.then === 'function'\n}\n", "function testOverwrite() {\n try {\n Object.defineProperty(function x() {}, 'length', {})\n return true\n } catch (e) {\n return false\n }\n}\n\nexport const functionSupportsLengthOverwrite = testOverwrite()\n\nexport function overwriteLengthPropertyIfSupported(fn, descriptor) {\n if (functionSupportsLengthOverwrite) {\n Object.defineProperty(fn, 'length', descriptor)\n }\n}\n", "//\n// String (and JSON)\n//\n\nexport function stringTrim(string) {\n return string === null || string === undefined\n ? ''\n : string.trim\n ? string.trim()\n : string.toString().replace(/^[\\s\\xa0]+|[\\s\\xa0]+$/g, '')\n}\n\nexport function stringStartsWith(string, startsWith) {\n string = string || ''\n if (startsWith.length > string.length) {\n return false\n }\n return string.substring(0, startsWith.length) === startsWith\n}\n\nexport function parseJson<T = any>(jsonString: string): T | null {\n if (typeof jsonString === 'string') {\n jsonString = stringTrim(jsonString)\n if (jsonString) {\n return JSON.parse(jsonString) as T\n }\n }\n return null\n}\n", "//\n// ES6 Symbols\n//\n\nexport const useSymbols = typeof Symbol === 'function'\n\nexport function createSymbolOrString(identifier) {\n return useSymbols ? Symbol(identifier) : identifier\n}\n", "//\n// DOM - CSS\n//\n\nimport { arrayForEach, addOrRemoveItem } from './array'\n\n// For details on the pattern for changing node classes\n// see: https://github.com/knockout/knockout/issues/1597\nconst cssClassNameRegex = /\\S+/g\n\nfunction toggleDomNodeCssClass(node: Element, classNames: string, shouldHaveClass?: boolean): void {\n let addOrRemoveFn\n if (!classNames) {\n return\n }\n if (typeof node.classList === 'object') {\n addOrRemoveFn = node.classList[shouldHaveClass ? 'add' : 'remove']\n arrayForEach(classNames.match(cssClassNameRegex)!, function (className) {\n addOrRemoveFn.call(node.classList, className)\n })\n } else if (typeof node.className['baseVal'] === 'string') {\n // SVG tag .classNames is an SVGAnimatedString instance\n toggleObjectClassPropertyString(node.className, 'baseVal', classNames, shouldHaveClass)\n } else {\n // node.className ought to be a string.\n toggleObjectClassPropertyString(node, 'className', classNames, shouldHaveClass)\n }\n}\n\nfunction toggleObjectClassPropertyString(obj, prop, classNames, shouldHaveClass) {\n // obj/prop is either a node/'className' or a SVGAnimatedString/'baseVal'.\n const currentClassNames = obj[prop].match(cssClassNameRegex) || []\n arrayForEach(classNames.match(cssClassNameRegex), function (className) {\n addOrRemoveItem(currentClassNames, className, shouldHaveClass)\n })\n obj[prop] = currentClassNames.join(' ')\n}\n\nexport { toggleDomNodeCssClass }\n", "//\n// Information about the DOM\n//\nimport { arrayFirst } from '../array'\n\nexport function domNodeIsContainedBy(node: Node, containedByNode: Node) {\n if (node === containedByNode) {\n return true\n }\n if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n return false\n } // Fixes issue #1162 - can't use node.contains for document fragments on IE8\n if (containedByNode.contains) {\n return containedByNode.contains(node.nodeType !== Node.ELEMENT_NODE ? node.parentNode : node)\n }\n if (containedByNode.compareDocumentPosition) {\n return (containedByNode.compareDocumentPosition(node) & 16) == 16\n }\n\n let parentNode: Node | null = node\n while (parentNode && parentNode != containedByNode) {\n parentNode = parentNode.parentNode\n }\n return !!parentNode\n}\n\nexport function domNodeIsAttachedToDocument(node) {\n return domNodeIsContainedBy(node, node.ownerDocument.documentElement)\n}\n\nexport function anyDomNodeIsAttachedToDocument(nodes) {\n return !!arrayFirst(nodes, domNodeIsAttachedToDocument)\n}\n\nexport function tagNameLower(element: Element) {\n // For HTML elements, tagName will always be upper case; for XHTML elements, it'll be lower case.\n // Possible future optimization: If we know it's an element from an XHTML document (not HTML),\n // we don't need to do the .toLowerCase() as it will always be lower case anyway.\n return element && element.tagName && element.tagName.toLowerCase()\n}\n\nexport function isDomElement(obj) {\n if (window.HTMLElement) {\n return obj instanceof HTMLElement\n } else {\n return obj && obj.tagName && obj.nodeType === Node.ELEMENT_NODE\n }\n}\n\nexport function isDocumentFragment(obj) {\n if (window.DocumentFragment) {\n return obj instanceof DocumentFragment\n } else {\n return obj && obj.nodeType === Node.DOCUMENT_FRAGMENT_NODE\n }\n}\n", "//\n// DOM Events\n//\n\nimport { objectForEach } from '../object'\nimport { catchFunctionErrors } from '../error'\nimport { tagNameLower } from './info'\n\nimport options from '../options'\n\n// Represent the known event types in a compact way, then at runtime transform it into a hash with event name as key (for fast lookup)\nconst knownEvents = {},\n knownEventTypesByEventName = {}\n\nknownEvents['UIEvents'] = ['keyup', 'keydown', 'keypress']\n\nknownEvents['MouseEvents'] = [\n 'click',\n 'dblclick',\n 'mousedown',\n 'mouseup',\n 'mousemove',\n 'mouseover',\n 'mouseout',\n 'mouseenter',\n 'mouseleave'\n]\n\nobjectForEach(knownEvents, function (eventType, knownEventsForType) {\n if (knownEventsForType.length) {\n for (let i = 0, j = knownEventsForType.length; i < j; i++) {\n knownEventTypesByEventName[knownEventsForType[i]] = eventType\n }\n }\n})\n\nfunction isClickOnCheckableElement(element: Element, eventType: string) {\n if (tagNameLower(element) !== 'input' || !(element as HTMLInputElement).type) return false\n if (eventType.toLowerCase() != 'click') return false\n const inputType = (element as HTMLInputElement).type\n return inputType == 'checkbox' || inputType == 'radio'\n}\n\nexport function registerEventHandler(\n element: Element,\n eventType: string,\n handler: EventListener,\n eventOptions = false\n): void {\n const wrappedHandler = catchFunctionErrors(handler)\n const mustUseNative = Boolean(eventOptions)\n const jQuery = options.jQuery\n\n if (!options.useOnlyNativeEvents && !mustUseNative && jQuery) {\n jQuery(element).on(eventType, wrappedHandler)\n } else if (typeof element.addEventListener === 'function') {\n element.addEventListener(eventType, wrappedHandler, eventOptions)\n } else {\n throw new Error(\"Browser doesn't support addEventListener\")\n }\n}\n\nfunction hasClick(element: Element): element is Element & { click(): void } {\n return typeof (element as any).click === 'function'\n}\n\nexport function triggerEvent(element: Element, eventType: string): void {\n if (!(element && element.nodeType)) {\n throw new Error('element must be a DOM node when calling triggerEvent')\n }\n\n // For click events on checkboxes and radio buttons, jQuery toggles the element checked state *after* the\n // event handler runs instead of *before*. (This was fixed in 1.9 for checkboxes but not for radio buttons.)\n const useClickWorkaround = isClickOnCheckableElement(element, eventType)\n\n if (!options.useOnlyNativeEvents && options.jQuery && !useClickWorkaround) {\n options.jQuery(element).trigger(eventType)\n } else if (typeof document.createEvent === 'function') {\n if (typeof element.dispatchEvent === 'function') {\n const eventCategory = knownEventTypesByEventName[eventType] || 'HTMLEvents'\n const event = document.createEvent(eventCategory)\n ;(event as any).initEvent(\n eventType,\n true,\n true,\n options.global,\n 0,\n 0,\n 0,\n 0,\n 0,\n false,\n false,\n false,\n false,\n 0,\n element\n )\n element.dispatchEvent(event)\n } else {\n throw new Error(\"The supplied element doesn't support dispatchEvent\")\n }\n } else if (useClickWorkaround && hasClick(element)) {\n element.click()\n } else {\n throw new Error(\"Browser doesn't support triggering events\")\n }\n}\n", "//\n// DOM node data\n//\n\nconst datastoreTime = new Date().getTime()\nconst dataStoreKeyExpandoPropertyName = `__ko__${datastoreTime}`\nconst dataStoreSymbol = Symbol('Knockout data')\nconst dataStore = {}\nlet uniqueId = 0\n\n// Prevent prototype pollution by restricting special property names\nfunction isSafeKey(key: string): boolean {\n return key !== '__proto__' && key !== 'constructor' && key !== 'prototype'\n}\n\n/*\n * We considered using WeakMap, but it has a problem in IE 11 and Edge that\n * prevents using it cross-window, so instead we just store the data directly\n * on the node. See https://github.com/knockout/knockout/issues/2141\n */\nfunction getDataForNode(node: Node, createIfNotFound: boolean): any {\n let dataForNode = node[dataStoreSymbol]\n if (!dataForNode && createIfNotFound) {\n dataForNode = node[dataStoreSymbol] = {}\n }\n return dataForNode\n}\n\nfunction clear(node: Node): boolean {\n if (node[dataStoreSymbol]) {\n delete node[dataStoreSymbol]\n return true\n }\n return false\n}\n\n/**\n * Create a unique key-string identifier.\n */\nexport function nextKey() {\n return uniqueId++ + dataStoreKeyExpandoPropertyName\n}\n\nfunction get(node: Node, key: string) {\n if (!isSafeKey(key)) throw new Error('Unsafe key for DOM data: ' + key)\n\n const dataForNode = getDataForNode(node, false)\n return dataForNode && dataForNode[key]\n}\n\nfunction set(node: Node, key: string, value: any) {\n if (!isSafeKey(key)) throw new Error('Unsafe key for DOM data: ' + key)\n // Make sure we don't actually create a new domData key if we are actually deleting a value\n const dataForNode = getDataForNode(node, value !== undefined /* createIfNotFound */)\n if (dataForNode) {\n dataForNode[key] = value\n }\n}\n\nfunction getOrSet(node: Node, key: string, value: any) {\n if (!isSafeKey(key)) throw new Error('Unsafe key for DOM data: ' + key)\n const dataForNode = getDataForNode(node, true /* createIfNotFound */)\n return dataForNode[key] || (dataForNode[key] = value)\n}\n\nexport { get, set, getOrSet, clear }\n", "//\n// DOM node disposal\n//\n/* eslint no-cond-assign: 0 */\nimport * as domData from './data'\nimport { default as options } from '../options'\nimport { arrayRemoveItem, arrayIndexOf } from '../array'\n\nconst domDataKey = domData.nextKey()\n// Node types:\n// 1: Element\n// 8: Comment\n// 9: Document\nconst cleanableNodeTypes = { 1: true, 8: true, 9: true }\nconst cleanableNodeTypesWithDescendants = { 1: true, 9: true }\n\nfunction getDisposeCallbacksCollection(node: Node, createIfNotFound: boolean) {\n let allDisposeCallbacks = domData.get(node, domDataKey)\n if (allDisposeCallbacks === undefined && createIfNotFound) {\n allDisposeCallbacks = new Array()\n domData.set(node, domDataKey, allDisposeCallbacks)\n }\n return allDisposeCallbacks\n}\nfunction destroyCallbacksCollection(node: Node) {\n domData.set(node, domDataKey, undefined)\n}\n\nfunction cleanSingleNode(node: Node) {\n // Run all the dispose callbacks\n let callbacks = getDisposeCallbacksCollection(node, false)\n if (callbacks) {\n callbacks = callbacks.slice(0) // Clone, as the array may be modified during iteration (typically, callbacks will remove themselves)\n for (let i = 0; i < callbacks.length; i++) {\n callbacks[i](node)\n }\n }\n\n // Erase the DOM data\n domData.clear(node)\n\n // Perform cleanup needed by external libraries (currently only jQuery, but can be extended)\n for (let i = 0, j = otherNodeCleanerFunctions.length; i < j; ++i) {\n otherNodeCleanerFunctions[i](node)\n }\n\n if (options.cleanExternalData) {\n options.cleanExternalData(node)\n }\n\n // Clear any immediate-child comment nodes, as these wouldn't have been found by\n // node.getElementsByTagName('*') in cleanNode() (comment nodes aren't elements)\n if (cleanableNodeTypesWithDescendants[node.nodeType]) {\n cleanNodesInList(node.childNodes, true /* onlyComments */)\n }\n}\n\nfunction cleanNodesInList(nodeList: NodeList | HTMLCollectionBase, onlyComments?: boolean) {\n const cleanedNodes = new Array<Node>()\n let lastCleanedNode\n for (let i = 0; i < nodeList.length; i++) {\n if (!onlyComments || nodeList[i].nodeType === Node.COMMENT_NODE) {\n cleanSingleNode((cleanedNodes[cleanedNodes.length] = lastCleanedNode = nodeList[i]))\n if (nodeList[i] !== lastCleanedNode) {\n while (i-- && arrayIndexOf(cleanedNodes, nodeList[i]) === -1) {}\n }\n }\n }\n}\n\n// Exports\nexport function addDisposeCallback(node: Node, callback: (node: Node) => void) {\n if (typeof callback !== 'function') {\n throw new Error('Callback must be a function')\n }\n getDisposeCallbacksCollection(node, true).push(callback)\n}\n\nexport function removeDisposeCallback(node: Node, callback: (node: Node) => void) {\n const callbacksCollection = getDisposeCallbacksCollection(node, false)\n if (callbacksCollection) {\n arrayRemoveItem(callbacksCollection, callback)\n if (callbacksCollection.length === 0) {\n destroyCallbacksCollection(node)\n }\n }\n}\n\nexport function cleanNode(node: Node): typeof node {\n // First clean this node, where applicable\n if (cleanableNodeTypes[node.nodeType]) {\n cleanSingleNode(node)\n\n // ... then its descendants, where applicable\n if (cleanableNodeTypesWithDescendants[node.nodeType] && node instanceof Element) {\n cleanNodesInList(node.getElementsByTagName('*'))\n }\n }\n return node\n}\n\nexport function removeNode(node: Node | null) {\n if (!node) {\n return\n }\n\n cleanNode(node)\n if (node.parentNode) {\n node.parentNode.removeChild(node)\n }\n}\n\n// Expose supplemental node cleaning functions.\nexport const otherNodeCleanerFunctions = new Array<Function>()\n\nexport function addCleaner(fn: Function) {\n otherNodeCleanerFunctions.push(fn)\n}\n\nexport function removeCleaner(fn: Function) {\n const fnIndex = otherNodeCleanerFunctions.indexOf(fn)\n if (fnIndex >= 0) {\n otherNodeCleanerFunctions.splice(fnIndex, 1)\n }\n}\n\n// Special support for jQuery here because it's so commonly used.\n// Many jQuery plugins (including jquery.tmpl) store data using jQuery's equivalent of domData\n// so notify it to tear down any resources associated with the node & descendants here.\nexport function cleanjQueryData(node: Node) {\n const jQueryCleanNodeFn = options.jQuery ? options.jQuery.cleanData : null\n\n if (jQueryCleanNodeFn) {\n jQueryCleanNodeFn([node])\n }\n}\n\notherNodeCleanerFunctions.push(cleanjQueryData)\n", "//\n// DOM manipulation\n//\n/* eslint no-empty: 0 */\nimport { makeArray } from '../array'\nimport { cleanNode, removeNode } from './disposal'\n\nexport function moveCleanedNodesToContainerElement(nodes: ArrayLike<Node>) {\n // Ensure it's a real array, as we're about to reparent the nodes and\n // we don't want the underlying collection to change while we're doing that.\n const nodesArray = makeArray(nodes) as Node[]\n const templateDocument = (nodesArray[0] && nodesArray[0].ownerDocument) || document\n\n const container = templateDocument.createElement('div')\n for (let i = 0, j = nodesArray.length; i < j; i++) {\n container.appendChild(cleanNode(nodesArray[i]))\n }\n return container\n}\n\nexport function cloneNodes(nodesArray: ArrayLike<Node>, shouldCleanNodes?: boolean) {\n const newNodesArray = new Array()\n\n for (let i = 0; i < nodesArray.length; i++) {\n const clonedNode = nodesArray[i].cloneNode(true)\n newNodesArray.push(shouldCleanNodes ? cleanNode(clonedNode) : clonedNode)\n }\n\n return newNodesArray\n}\n\nexport function setDomNodeChildren(domNode: Node, childNodes: ArrayLike<Node>) {\n emptyDomNode(domNode)\n if (childNodes) {\n for (let i = 0; i < childNodes.length; i++) {\n domNode.appendChild(childNodes[i])\n }\n }\n}\n\nexport function replaceDomNodes(nodeToReplaceOrNodeArray: Node[] | Node, newNodesArray: Node[]) {\n const nodesToReplaceArray = Array.isArray(nodeToReplaceOrNodeArray)\n ? nodeToReplaceOrNodeArray\n : [nodeToReplaceOrNodeArray]\n if (nodesToReplaceArray.length > 0) {\n const insertionPoint = nodesToReplaceArray[0]\n const parent = insertionPoint.parentNode\n\n for (let i = 0; i < newNodesArray.length; i++) {\n parent?.insertBefore(newNodesArray[i], insertionPoint)\n }\n for (let i = 0; i < nodesToReplaceArray.length; i++) {\n removeNode(nodesToReplaceArray[i])\n }\n }\n}\n\nexport function emptyDomNode(domNode: Node) {\n while (domNode.firstChild) {\n removeNode(domNode.firstChild)\n }\n}\n", "//\n// DOM node manipulation\n//\n\nexport function fixUpContinuousNodeArray(continuousNodeArray, parentNode) {\n // Before acting on a set of nodes that were previously outputted by a template function, we have to reconcile\n // them against what is in the DOM right now. It may be that some of the nodes have already been removed, or that\n // new nodes might have been inserted in the middle, for example by a binding. Also, there may previously have been\n // leading comment nodes (created by rewritten string-based templates) that have since been removed during binding.\n // So, this function translates the old \"map\" output array into its best guess of the set of current DOM nodes.\n //\n // Rules:\n // [A] Any leading nodes that have been removed should be ignored\n // These most likely correspond to memoization nodes that were already removed during binding\n // See https://github.com/knockout/knockout/pull/440\n // [B] Any trailing nodes that have been remove should be ignored\n // This prevents the code here from adding unrelated nodes to the array while processing rule [C]\n // See https://github.com/knockout/knockout/pull/1903\n // [C] We want to output a continuous series of nodes. So, ignore any nodes that have already been removed,\n // and include any nodes that have been inserted among the previous collection\n\n if (continuousNodeArray.length) {\n // The parent node can be a virtual element; so get the real parent node\n parentNode = (parentNode.nodeType === Node.COMMENT_NODE && parentNode.parentNode) || parentNode\n\n // Rule [A]\n while (continuousNodeArray.length && continuousNodeArray[0].parentNode !== parentNode) {\n continuousNodeArray.splice(0, 1)\n }\n\n // Rule [B]\n while (\n continuousNodeArray.length > 1\n && continuousNodeArray[continuousNodeArray.length - 1].parentNode !== parentNode\n ) {\n continuousNodeArray.length--\n }\n\n // Rule [C]\n if (continuousNodeArray.length > 1) {\n let current = continuousNodeArray[0],\n last = continuousNodeArray[continuousNodeArray.length - 1]\n // Replace with the actual new continuous node set\n continuousNodeArray.length = 0\n while (current !== last) {\n continuousNodeArray.push(current)\n current = current.nextSibling\n }\n continuousNodeArray.push(last)\n }\n }\n return continuousNodeArray\n}\n\nexport function setOptionNodeSelectionState(optionNode, isSelected) {\n optionNode.selected = isSelected\n}\n", "/* eslint no-cond-assign: 0 */\n//\n// Virtual Elements\n//\n//\n// \"Virtual elements\" is an abstraction on top of the usual DOM API which understands the notion that comment nodes\n// may be used to represent hierarchy (in addition to the DOM's natural hierarchy).\n// If you call the DOM-manipulating functions on ko.virtualElements, you will be able to read and write the state\n// of that virtual hierarchy\n//\n// The point of all this is to support containerless templates (e.g., <!-- ko foreach:someCollection -->blah<!-- /ko -->)\n// without having to scatter special cases all over the binding and templating code.\n\nimport { emptyDomNode, setDomNodeChildren as setRegularDomNodeChildren } from './manipulation'\nimport { removeNode } from './disposal'\nimport { tagNameLower } from './info'\nimport * as domData from './data'\nimport options from '../options'\n\nexport const startCommentRegex = /^\\s*ko(?:\\s+([\\s\\S]+))?\\s*$/\nexport const endCommentRegex = /^\\s*\\/ko\\s*$/\nconst htmlTagsWithOptionallyClosingChildren = { ul: true, ol: true }\n\nexport function isStartComment(node) {\n return node.nodeType === Node.COMMENT_NODE && startCommentRegex.test(node.nodeValue)\n}\n\nexport function isEndComment(node) {\n return node.nodeType === Node.COMMENT_NODE && endCommentRegex.test(node.nodeValue)\n}\n\nfunction isUnmatchedEndComment(node) {\n return isEndComment(node) && !domData.get(node, matchedEndCommentDataKey)\n}\n\nconst matchedEndCommentDataKey = '__ko_matchedEndComment__'\n\nexport function getVirtualChildren(startComment, allowUnbalanced?) {\n let currentNode = startComment\n let depth = 1\n const children = new Array()\n while ((currentNode = currentNode.nextSibling)) {\n if (isEndComment(currentNode)) {\n domData.set(currentNode, matchedEndCommentDataKey, true)\n depth--\n if (depth === 0) {\n return children\n }\n }\n\n children.push(currentNode)\n\n if (isStartComment(currentNode)) {\n depth++\n }\n }\n if (!allowUnbalanced) {\n throw new Error('Cannot find closing comment tag to match: ' + startComment.nodeValue)\n }\n return null\n}\n\nfunction getMatchingEndComment(startComment, allowUnbalanced?) {\n const allVirtualChildren = getVirtualChildren(startComment, allowUnbalanced)\n if (allVirtualChildren) {\n if (allVirtualChildren.length > 0) {\n return allVirtualChildren[allVirtualChildren.length - 1].nextSibling\n }\n return startComment.nextSibling\n } else {\n return null\n } // Must have no matching end comment, and allowUnbalanced is true\n}\n\nfunction getUnbalancedChildTags(node) {\n // e.g., from <div>OK</div><!-- ko blah --><span>Another</span>, returns: <!-- ko blah --><span>Another</span>\n // from <div>OK</div><!-- /ko --><!-- /ko -->, returns: <!-- /ko --><!-- /ko -->\n let childNode = node.firstChild,\n captureRemaining: any = null\n if (childNode) {\n do {\n if (captureRemaining) // We already hit an unbalanced node and are now just scooping up all subsequent nodes\n {\n captureRemaining.push(childNode)\n } else if (isStartComment(childNode)) {\n const matchingEndComment = getMatchingEndComment(childNode, /* allowUnbalanced: */ true)\n if (matchingEndComment) // It's a balanced tag, so skip immediately to the end of this virtual set\n {\n childNode = matchingEndComment\n } else {\n captureRemaining = [childNode]\n } // It's unbalanced, so start capturing from this point\n } else if (isEndComment(childNode)) {\n captureRemaining = [childNode] // It's unbalanced (if it wasn't, we'd have skipped over it already), so start capturing\n }\n } while ((childNode = childNode.nextSibling))\n }\n return captureRemaining\n}\n\nexport interface VirtualElementsAllowedBindings {\n text: boolean\n foreach: boolean\n if: boolean\n ifnot: boolean\n with: boolean\n let: boolean\n using: boolean\n template: boolean\n component: boolean\n}\n\nexport const allowedBindings: VirtualElementsAllowedBindings = Object.create(null)\nexport const hasBindingValue = isStartComment\n\nexport function childNodes(node: Node): any {\n return isStartComment(node) ? getVirtualChildren(node) : node.childNodes\n}\n\nexport function emptyNode(node: Node) {\n if (!isStartComment(node)) {\n emptyDomNode(node)\n } else {\n const virtualChildren = childNodes(node)\n for (let i = 0, j = virtualChildren.length; i < j; i++) {\n removeNode(virtualChildren[i])\n }\n }\n}\n\nexport function setDomNodeChildren(node: Node, childNodes: Node[]) {\n if (!isStartComment(node)) {\n setRegularDomNodeChildren(node, childNodes)\n } else {\n emptyNode(node)\n const endCommentNode = node.nextSibling // Must be the next sibling, as we just emptied the children\n if (endCommentNode && endCommentNode.parentNode) {\n const parentNode = endCommentNode.parentNode\n for (let i = 0, j = childNodes.length; i < j; ++i) {\n parentNode.insertBefore(childNodes[i], endCommentNode)\n }\n }\n }\n}\n\nexport function prepend(containerNode: Node, nodeToPrepend: Node) {\n if (!isStartComment(containerNode)) {\n if (containerNode.firstChild) {\n containerNode.insertBefore(nodeToPrepend, containerNode.firstChild)\n } else {\n containerNode.appendChild(nodeToPrepend)\n }\n } else {\n // Start comments must always have a parent and at least one following sibling (the end comment)\n containerNode.parentNode?.insertBefore(nodeToPrepend, containerNode.nextSibling)\n }\n}\n\nexport function insertAfter(containerNode: Node, nodeToInsert: Node, insertAfterNode: Node) {\n if (!insertAfterNode) {\n prepend(containerNode, nodeToInsert)\n } else if (!isStartComment(containerNode)) {\n // Insert after insertion point\n if (insertAfterNode.nextSibling) {\n containerNode.insertBefore(nodeToInsert, insertAfterNode.nextSibling)\n } else {\n containerNode.appendChild(nodeToInsert)\n }\n } else {\n // Children of start comments must always have a parent and at least one following sibling (the end comment)\n containerNode.parentNode?.insertBefore(nodeToInsert, insertAfterNode.nextSibling)\n }\n}\n\nexport function firstChild(node: Node) {\n if (!isStartComment(node)) {\n if (node.firstChild && isEndComment(node.firstChild)) {\n throw new Error('Found invalid end comment, as the first child of ' + (node as Element).outerHTML)\n }\n return node.firstChild\n }\n if (!node.nextSibling || isEndComment(node.nextSibling)) {\n return null\n }\n return node.nextSibling\n}\n\nexport function lastChild(node: Node) {\n let nextChild = firstChild(node)\n if (!nextChild) return null\n\n let lastChildNode\n\n do {\n lastChildNode = nextChild\n } while ((nextChild = nextSibling(nextChild)))\n\n return lastChildNode\n}\n\nexport function nextSibling(node: Node) {\n if (isStartComment(node)) {\n node = getMatchingEndComment(node)\n }\n\n if (node.nextSibling && isEndComment(node.nextSibling)) {\n if (isUnmatchedEndComment(node.nextSibling)) {\n throw Error(\n 'Found end comment without a matching opening comment, as next sibling of ' + (node as Element).outerHTML\n )\n }\n return null\n } else {\n return node.nextSibling\n }\n}\n\nexport function previousSibling(node) {\n let depth = 0\n do {\n if (node.nodeType === Node.COMMENT_NODE) {\n if (isStartComment(node)) {\n if (--depth === 0) {\n return node\n }\n } else if (isEndComment(node)) {\n depth++\n }\n } else {\n if (depth === 0) {\n return node\n }\n }\n } while ((node = node.previousSibling))\n}\n\nexport function virtualNodeBindingValue(node): string | null {\n const regexMatch = node.nodeValue.match(startCommentRegex) as RegExpMatchArray\n return regexMatch ? regexMatch[1] : null\n}\n\nexport function normaliseVirtualElementDomStructure(elementVerified) {\n // Workaround for https://github.com/SteveSanderson/knockout/issues/155\n // (IE <= 8 or IE 9 quirks mode parses your HTML weirdly, treating closing </li> tags as if they don't exist, thereby moving comment nodes\n // that are direct descendants of <ul> into the preceding <li>)\n if (!htmlTagsWithOptionallyClosingChildren[tagNameLower(elementVerified)]) {\n return\n }\n\n // Scan immediate children to see if they contain unbalanced comment tags. If they do, those comment tags\n // must be intended to appear *after* that child, so move them there.\n let childNode = elementVerified.firstChild\n if (childNode) {\n do {\n if (childNode.nodeType === Node.ELEMENT_NODE) {\n const unbalancedTags = getUnbalancedChildTags(childNode)\n if (unbalancedTags) {\n // Fix up the DOM by moving the unbalanced tags to where they most likely were intended to be placed - *after* the child\n const nodeToInsertBefore = childNode.nextSibling\n for (let i = 0; i < unbalancedTags.length; i++) {\n if (nodeToInsertBefore) {\n elementVerified.insertBefore(unbalancedTags[i], nodeToInsertBefore)\n } else {\n elementVerified.appendChild(unbalancedTags[i])\n }\n }\n }\n }\n } while ((childNode = childNode.nextSibling))\n }\n}\n", "//\n// HTML-based manipulation\n//\nimport { makeArray } from '../array'\nimport { emptyDomNode, moveCleanedNodesToContainerElement } from './manipulation'\nimport * as virtualElements from './virtualElements'\nimport options from '../options'\n\n// The canonical way to test that the HTML5 <template> tag is supported\nconst supportsTemplateTag =\n options.useTemplateTag && options.document && 'content' in options.document.createElement('template')\n\n/** @deprecated HTMLTemplateTag or the jquery-template-function as fallback are enough */\nfunction simpleHtmlParse(html: string, documentContext?: Document): Node[] {\n if (!documentContext) {\n documentContext = document\n }\n const div = documentContext.createElement('div')\n div.innerHTML = html\n return makeArray(div.childNodes)\n}\n\nfunction templateHtmlParse(html: string, documentContext?: Document): Node[] {\n if (!documentContext) {\n documentContext = document\n }\n const template = documentContext.createElement('template') as HTMLTemplateElement\n template.innerHTML = html\n return makeArray(template.content.childNodes)\n}\n\nfunction jQueryHtmlParse(html: string, documentContext?: Document): Node[] {\n const jQuery = options.jQuery\n\n // jQuery's \"parseHTML\" function was introduced in jQuery 1.8.0 and is a documented public API.\n if (jQuery) {\n return jQuery.parseHTML(html, documentContext) || [] // Ensure we always return an array and never null\n }\n\n return []\n}\n\n/**\n * parseHtmlFragment converts a string into an array of DOM Nodes.\n * If supported, it uses <template>-tag parsing, falling back on\n * jQuery parsing (if jQuery is present), and finally on a\n * straightforward parser.\n *\n * @param {string} html To be parsed.\n * @param {Document} documentContext That owns the executing code.\n * @return {[Node]} Parsed DOM Nodes\n */\nexport function parseHtmlFragment(html: string, documentContext?: Document): Node[] {\n const saferHtml = validateHTMLInput(html)\n\n // Prefer <template>-tag based HTML parsing.\n if (supportsTemplateTag) return templateHtmlParse(saferHtml, documentContext)\n\n //TODO: It is always true in modern browsers (higher IE11), so we can theoretically remove jQueryHtmlParse and simpleHtmlParse\n if (options.jQuery) {\n // Benefit from jQuery's on old browsers, where possible\n // NOTE: jQuery's HTML parsing fails on element names like tr-*.\n // See: https://github.com/jquery/jquery/pull/1988\n return jQueryHtmlParse(saferHtml, documentContext)\n }\n\n return simpleHtmlParse(saferHtml, documentContext)\n}\n\nconst scriptTagPattern = /<script\\b[^>]*>([\\s\\S]*?)<\\/script[^>]*>/i\nfunction validateHTMLInput(html: string): string {\n if (!html) return ''\n\n if (options.templateSizeLimit > 0 && html.length > options.templateSizeLimit) {\n throw new Error(\"Template is too long. Please configure the 'templateSizeLimit'\")\n }\n\n if (!options.allowScriptTagsInTemplates && scriptTagPattern.test(html)) {\n throw new Error('Script-tag in template detected.')\n }\n\n return options.sanitizeHtmlTemplate(html)\n}\n\nexport function parseHtmlForTemplateNodes(html, documentContext) {\n const nodes = parseHtmlFragment(html, documentContext)\n return (nodes.length && nodes[0].parentElement) || moveCleanedNodesToContainerElement(nodes)\n}\n\n/**\n * setHtml empties the node's contents, unwraps the HTML, and\n * sets the node's HTML using jQuery.html or parseHtmlFragment\n *\n * @param {DOMNode} node Node in which HTML needs to be set\n * @param {DOMNode} html HTML to be inserted in node\n * @returns undefined\n */\nexport function setHtml(node: Node, html: Function | string) {\n emptyDomNode(node)\n\n // There's few cases where we would want to display a stringified\n // function, so we unwrap it.\n if (typeof html === 'function') {\n html = html()\n }\n\n if (html !== null && html !== undefined) {\n if (typeof html !== 'string') {\n html = html.toString()\n }\n\n const jQuery = options.jQuery\n // If the browser supports <template> tags, prefer that, as\n // it obviates all the complex workarounds of jQuery.\n //\n // However, jQuery contains a lot of sophisticated code to parse arbitrary HTML fragments,\n // for example <tr> elements which are not normally allowed to exist on their own.\n // If you've referenced jQuery (and template tags are not supported) we'll use that rather than duplicating its code.\n if (jQuery && !supportsTemplateTag) {\n const saferHtml = validateHTMLInput(html)\n jQuery(node).html(saferHtml)\n } else {\n // ... otherwise, use KO's own parsing logic.\n let parsedNodes: Node[]\n if (node.ownerDocument) {\n parsedNodes = parseHtmlFragment(html, node.ownerDocument)\n } else {\n parsedNodes = parseHtmlFragment(html)\n }\n\n if (node.nodeType === Node.COMMENT_NODE) {\n if (html === null) {\n virtualElements.emptyNode(node)\n } else {\n virtualElements.setDomNodeChildren(node, parsedNodes)\n }\n } else {\n for (let i = 0; i < parsedNodes.length; i++) {\n node.appendChild(parsedNodes[i])\n }\n }\n }\n }\n}\n\n//TODO May be MaybeSubscribable<string> -> I actually don't want the dependency\ntype TextContent = string | null | undefined | Function\nexport function setTextContent(element: Node, textContent?: TextContent): void {\n let value = typeof textContent === 'function' ? (textContent as Function)() : textContent\n if (value === null || value === undefined) {\n value = ''\n }\n\n // We need there to be exactly one child: a text node.\n // If there are no children, more than one, or if it's not a text node,\n // we'll clear everything and create a single text node.\n const innerTextNode = virtualElements.firstChild(element)\n if (!innerTextNode || innerTextNode.nodeType !== Node.TEXT_NODE || virtualElements.nextSibling(innerTextNode)) {\n virtualElements.setDomNodeChildren(element, [element.ownerDocument!.createTextNode(value)])\n } else {\n ;(innerTextNode as Text).data = value\n }\n}\n", "import { tagNameLower } from './info'\nimport * as domData from './data'\n\nconst hasDomDataExpandoProperty = Symbol('Knockout selectExtensions hasDomDataProperty')\n\n// Normally, SELECT elements and their OPTIONs can only take value of type 'string' (because the values\n// are stored on DOM attributes). ko.selectExtensions provides a way for SELECTs/OPTIONs to have values\n// that are arbitrary objects. This is very convenient when implementing things like cascading dropdowns.\n//\nexport const selectExtensions = {\n optionValueDomDataKey: domData.nextKey(),\n\n readValue: function (element: HTMLElement) {\n switch (tagNameLower(element)) {\n case 'option': {\n if (element[hasDomDataExpandoProperty] === true) {\n return domData.get(element, selectExtensions.optionValueDomDataKey)\n }\n return (element as HTMLOptionElement).value\n }\n case 'select': {\n const selectElement = element as HTMLSelectElement\n return selectElement.selectedIndex >= 0\n ? selectExtensions.readValue(selectElement.options[selectElement.selectedIndex])\n : undefined\n }\n default:\n return (element as HTMLInputElement).value\n }\n },\n\n writeValue: function (element: HTMLElement, value?: any, allowUnset?: boolean) {\n switch (tagNameLower(element)) {\n case 'option':\n if (typeof value === 'string') {\n domData.set(element, selectExtensions.optionValueDomDataKey, undefined)\n if (hasDomDataExpandoProperty in element) {\n // IE <= 8 throws errors if you delete non-existent properties from a DOM node\n delete element[hasDomDataExpandoProperty]\n }\n ;(element as HTMLOptionElement).value = value\n } else {\n const el = element as any //TODO Custom-Type with hasDomDataExpandoProperty\n // Store arbitrary object using DomData\n domData.set(element, selectExtensions.optionValueDomDataKey, value)\n el[hasDomDataExpandoProperty] = true\n // Special treatment of numbers is just for backward compatibility. KO 1.2.1 wrote numerical values to element.value.\n el.value = typeof value === 'number' ? value : ''\n }\n\n break\n case 'select':\n {\n if (value === '' || value === null) {\n // A blank string or null value will select the caption\n value = undefined\n }\n let selection = -1\n\n const selectElement = element as HTMLSelectElement\n\n for (let i = 0, n = selectElement.options.length, optionValue; i < n; ++i) {\n optionValue = selectExtensions.readValue(selectElement.options[i])\n // Include special check to handle selecting a caption with a blank string value\n // Note that the looser == check here is intentional so that integer model values will match string element values.\n const strictEqual = optionValue === value\n const blankEqual = optionValue === '' && value === undefined\n const numericEqual = typeof value === 'number' && Number(optionValue) === value\n if (strictEqual || blankEqual || numericEqual) {\n selection = i\n break\n }\n }\n if (allowUnset || selection >= 0 || (value === undefined && selectElement.size > 1)) {\n selectElement.selectedIndex = selection\n }\n }\n break\n default:\n if (value === null || value === undefined) {\n value = ''\n }\n ;(element as HTMLInputElement).value = value\n break\n }\n }\n}\n", "//\n// Memoization\n//\nimport { arrayPushAll } from './array'\n\nconst memos = {}\n\nfunction randomMax8HexChars() {\n return (((1 + Math.random()) * 0x100000000) | 0).toString(16).substring(1)\n}\n\nfunction generateRandomId() {\n return randomMax8HexChars() + randomMax8HexChars()\n}\n\nfunction findMemoNodes(rootNode: Node, appendToArray: any[]) {\n if (!rootNode) {\n return\n }\n if (rootNode.nodeType === Node.COMMENT_NODE) {\n const comment = rootNode as Comment\n const memoId = parseMemoText(comment.nodeValue)\n if (memoId != null) {\n appendToArray.push({ domNode: rootNode, memoId: memoId })\n }\n } else if (rootNode.nodeType === Node.ELEMENT_NODE) {\n for (let i = 0, childNodes = rootNode.childNodes, j = childNodes.length; i < j; i++) {\n findMemoNodes(childNodes[i], appendToArray)\n }\n }\n}\n\nexport function memoize(callback: (val: any) => void): string {\n if (typeof callback !== 'function') {\n throw new Error('You can only pass a function to memoization.memoize()')\n }\n const memoId = generateRandomId()\n memos[memoId] = callback\n return '<!--[ko_memo:' + memoId + ']-->'\n}\n\nexport function unmemoize(memoId: string, callbackParams: any[]) {\n const callback = memos[memoId]\n if (callback === undefined) {\n throw new Error(\"Couldn't find any memo with ID \" + memoId + \". Perhaps it's already been unmemoized.\")\n }\n try {\n callback.apply(null, callbackParams || [])\n return true\n } finally {\n delete memos[memoId]\n }\n}\n\nexport function unmemoizeDomNodeAndDescendants(domNode: Node, extraCallbackParamsArray: any[]) {\n const memos = new Array()\n findMemoNodes(domNode, memos)\n for (let i = 0, j = memos.length; i < j; i++) {\n const node = memos[i].domNode\n const combinedParams = [node]\n if (extraCallbackParamsArray) {\n arrayPushAll(combinedParams, extraCallbackParamsArray)\n }\n unmemoize(memos[i].memoId, combinedParams)\n node.nodeValue = '' // Neuter this node so we don't try to unmemoize it again\n if (node.parentNode) {\n node.parentNode.removeChild(node)\n } // If possible, erase it totally (not always possible - someone else might just hold a reference to it then call unmemoizeDomNodeAndDescendants again)\n }\n}\n\nexport function parseMemoText(memoText: string | null): string | null {\n if (!memoText) {\n return null\n }\n\n const match = memoText.match(/^\\[ko_memo\\:(.*?)\\]$/)\n return match ? match[1] : null\n}\n", "//\n// Tasks Micro-scheduler\n// ===\n//\n/* eslint no-cond-assign: 0 */\nimport options from './options'\nimport { deferError } from './error'\n\nlet taskQueue = new Array(),\n taskQueueLength = 0,\n nextHandle = 1,\n nextIndexToProcess = 0,\n w = options.global\n\nif (w && w.MutationObserver && !(w.navigator && w.navigator.standalone)) {\n // Chrome 27+, Firefox 14+, IE 11+, Opera 15+, Safari 6.1+, node\n // From https://github.com/petkaantonov/bluebird * Copyright (c) 2014 Petka Antonov * License: MIT\n options.taskScheduler = (function (callback) {\n const div = w.document.createElement('div')\n new w.MutationObserver(callback).observe(div, { attributes: true })\n return function () {\n div.classList.toggle('foo')\n }\n })(scheduledProcess)\n} else {\n options.taskScheduler = function (callback) {\n setTimeout(callback, 0)\n }\n}\n\nfunction processTasks() {\n if (taskQueueLength) {\n // Each mark represents the end of a logical group of tasks and the number of these groups is\n // limited to prevent unchecked recursion.\n let mark = taskQueueLength,\n countMarks = 0\n\n // nextIndexToProcess keeps track of where we are in the queue; processTasks can be called recursively without issue\n for (let task; nextIndexToProcess < taskQueueLength; ) {\n if ((task = taskQueue[nextIndexToProcess++])) {\n if (nextIndexToProcess > mark) {\n if (++countMarks >= 5000) {\n nextIndexToProcess = taskQueueLength // skip all tasks remaining in the queue since any of them could be causing the recursion\n deferError(Error(\"'Too much recursion' after processing \" + countMarks + ' task groups.'))\n break\n }\n mark = taskQueueLength\n }\n try {\n task()\n } catch (ex) {\n deferError(ex)\n }\n }\n }\n }\n}\n\nfunction scheduledProcess() {\n processTasks()\n\n // Reset the queue\n nextIndexToProcess = taskQueueLength = taskQueue.length = 0\n}\n\nfunction scheduleTaskProcessing() {\n options.taskScheduler(scheduledProcess)\n}\n\nexport function schedule(func: () => any): number {\n if (!taskQueueLength) {\n scheduleTaskProcessing()\n }\n\n taskQueue[taskQueueLength++] = func\n return nextHandle++\n}\n\nexport function cancel(handle: number) {\n const index = handle - (nextHandle - taskQueueLength)\n if (index >= nextIndexToProcess && index < taskQueueLength) {\n taskQueue[index] = null\n }\n}\n\n// For testing only: reset the queue and return the previous queue length\nexport function resetForTesting() {\n const length = taskQueueLength - nextIndexToProcess\n nextIndexToProcess = taskQueueLength = taskQueue.length = 0\n return length\n}\n\nexport { processTasks as runEarly }\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACMA,IAAM,EAAE,QAAQ,IAAI;AAEb,SAAS,aACd,OACA,QACA,aACM;AACN,MAAI,UAAU,SAAS,GAAG;AACxB,aAAS,OAAO,KAAK,WAAW;AAAA,EAClC;AACA,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,IAAI,GAAG,EAAE,GAAG;AAC5C,WAAO,MAAM,CAAC,GAAG,GAAG,KAAK;AAAA,EAC3B;AACF;AAEO,SAAS,aAAsB,OAAiB,MAAi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AAU,aAAa;AACrC,MAAI,SAAS,sBAAsB,QAAQ,iBAAiB;AAC1D,cAAU,KAAK,IAAI;AAAA,EACrB;AACF;AAGO,SAAS,kBAAkB;AAChC,QAAM,SAAS,kBAAkB;AACjC,uBAAqB,kBAAkB,UAAU,SAAS;AAC1D,SAAO;AACT;",
6
+ "names": ["options", "childNodes", "setDomNodeChildren", "setDomNodeChildren", "childNodes", "setDomNodeChildren", "childNodes", "memos"]
7
7
  }
package/dist/index.js CHANGED
@@ -1,14 +1,13 @@
1
- // @tko/utils 🥊 4.0.0-beta1.0 ESM
1
+ // @tko/utils 🥊 4.0.0 ESM
2
+ "use strict";
2
3
  export * from "./array";
3
4
  export * from "./async";
4
5
  export * from "./error";
5
- export * from "./ie";
6
6
  export * from "./object";
7
7
  export * from "./function";
8
8
  export * from "./string";
9
9
  export * from "./symbol";
10
10
  export * from "./css";
11
- export { jQuerySetInstance } from "./jquery";
12
11
  export { default as options } from "./options";
13
12
  export * from "./dom/event";
14
13
  export * from "./dom/info";
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["/*\n tko.util\n ===\n\n*/\n\nexport * from './array'\nexport * from './async'\nexport * from './error'\nexport * from './ie'\nexport * from './object'\nexport * from './function'\nexport * from './string'\nexport * from './symbol'\nexport * from './css'\nexport { jQuerySetInstance } from './jquery'\nexport { default as options } from './options'\n\n// DOM;\nexport * from './dom/event'\nexport * from './dom/info'\nexport * from './dom/manipulation'\nexport * from './dom/fixes'\nexport * from './dom/html'\nexport * from './dom/disposal'\nexport * from './dom/selectExtensions'\n\n// Sub-Modules;\nimport * as memoization from './memoization'\nimport * as tasks from './tasks'\nimport * as virtualElements from './dom/virtualElements'\nimport * as domData from './dom/data'\n\nexport {tasks, virtualElements, domData, memoization}\n"],
5
- "mappings": ";AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AAEA;",
4
+ "sourcesContent": ["/*\n tko.util\n ===\n\n*/\n\nexport * from './array'\nexport * from './async'\nexport * from './error'\nexport * from './object'\nexport * from './function'\nexport * from './string'\nexport * from './symbol'\nexport * from './css'\nexport { default as options } from './options'\n\n// DOM;\nexport * from './dom/event'\nexport * from './dom/info'\nexport * from './dom/manipulation'\nexport * from './dom/fixes'\nexport * from './dom/html'\nexport * from './dom/disposal'\nexport * from './dom/selectExtensions'\n\n// Sub-Modules;\nimport * as memoization from './memoization'\nimport * as tasks from './tasks'\nimport * as virtualElements from './dom/virtualElements'\nimport * as domData from './dom/data'\n\nexport { tasks, virtualElements, domData, memoization }\n"],
5
+ "mappings": ";;AAMA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,SAAS,WAAW,eAAe;AAGnC,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,YAAY,iBAAiB;AAC7B,YAAY,WAAW;AACvB,YAAY,qBAAqB;AACjC,YAAY,aAAa;AAEzB,SAAS,OAAO,iBAAiB,SAAS;",
6
6
  "names": []
7
7
  }
package/dist/index.mjs CHANGED
@@ -1,14 +1,13 @@
1
- // @tko/utils 🥊 4.0.0-beta1.0 MJS
1
+ // @tko/utils 🥊 4.0.0 MJS
2
+ "use strict";
2
3
  export * from "./array";
3
4
  export * from "./async";
4
5
  export * from "./error";
5
- export * from "./ie";
6
6
  export * from "./object";
7
7
  export * from "./function";
8
8
  export * from "./string";
9
9
  export * from "./symbol";
10
10
  export * from "./css";
11
- export { jQuerySetInstance } from "./jquery";
12
11
  export { default as options } from "./options";
13
12
  export * from "./dom/event";
14
13
  export * from "./dom/info";
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["/*\n tko.util\n ===\n\n*/\n\nexport * from './array'\nexport * from './async'\nexport * from './error'\nexport * from './ie'\nexport * from './object'\nexport * from './function'\nexport * from './string'\nexport * from './symbol'\nexport * from './css'\nexport { jQuerySetInstance } from './jquery'\nexport { default as options } from './options'\n\n// DOM;\nexport * from './dom/event'\nexport * from './dom/info'\nexport * from './dom/manipulation'\nexport * from './dom/fixes'\nexport * from './dom/html'\nexport * from './dom/disposal'\nexport * from './dom/selectExtensions'\n\n// Sub-Modules;\nimport * as memoization from './memoization'\nimport * as tasks from './tasks'\nimport * as virtualElements from './dom/virtualElements'\nimport * as domData from './dom/data'\n\nexport {tasks, virtualElements, domData, memoization}\n"],
5
- "mappings": ";AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AAEA;",
4
+ "sourcesContent": ["/*\n tko.util\n ===\n\n*/\n\nexport * from './array'\nexport * from './async'\nexport * from './error'\nexport * from './object'\nexport * from './function'\nexport * from './string'\nexport * from './symbol'\nexport * from './css'\nexport { default as options } from './options'\n\n// DOM;\nexport * from './dom/event'\nexport * from './dom/info'\nexport * from './dom/manipulation'\nexport * from './dom/fixes'\nexport * from './dom/html'\nexport * from './dom/disposal'\nexport * from './dom/selectExtensions'\n\n// Sub-Modules;\nimport * as memoization from './memoization'\nimport * as tasks from './tasks'\nimport * as virtualElements from './dom/virtualElements'\nimport * as domData from './dom/data'\n\nexport { tasks, virtualElements, domData, memoization }\n"],
5
+ "mappings": ";;AAMA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,SAAS,WAAW,eAAe;AAGnC,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,YAAY,iBAAiB;AAC7B,YAAY,WAAW;AACvB,YAAY,qBAAqB;AACjC,YAAY,aAAa;AAEzB,SAAS,OAAO,iBAAiB,SAAS;",
6
6
  "names": []
7
7
  }
@@ -1,6 +1,7 @@
1
- // @tko/utils 🥊 4.0.0-beta1.0 ESM
1
+ // @tko/utils 🥊 4.0.0 ESM
2
+ "use strict";
2
3
  import { arrayPushAll } from "./array";
3
- var memos = {};
4
+ const memos = {};
4
5
  function randomMax8HexChars() {
5
6
  return ((1 + Math.random()) * 4294967296 | 0).toString(16).substring(1);
6
7
  }
@@ -11,13 +12,14 @@ function findMemoNodes(rootNode, appendToArray) {
11
12
  if (!rootNode) {
12
13
  return;
13
14
  }
14
- if (rootNode.nodeType == 8) {
15
- var memoId = parseMemoText(rootNode.nodeValue);
15
+ if (rootNode.nodeType === Node.COMMENT_NODE) {
16
+ const comment = rootNode;
17
+ const memoId = parseMemoText(comment.nodeValue);
16
18
  if (memoId != null) {
17
19
  appendToArray.push({ domNode: rootNode, memoId });
18
20
  }
19
- } else if (rootNode.nodeType == 1) {
20
- for (var i = 0, childNodes = rootNode.childNodes, j = childNodes.length; i < j; i++) {
21
+ } else if (rootNode.nodeType === Node.ELEMENT_NODE) {
22
+ for (let i = 0, childNodes = rootNode.childNodes, j = childNodes.length; i < j; i++) {
21
23
  findMemoNodes(childNodes[i], appendToArray);
22
24
  }
23
25
  }
@@ -26,12 +28,12 @@ export function memoize(callback) {
26
28
  if (typeof callback !== "function") {
27
29
  throw new Error("You can only pass a function to memoization.memoize()");
28
30
  }
29
- var memoId = generateRandomId();
31
+ const memoId = generateRandomId();
30
32
  memos[memoId] = callback;
31
33
  return "<!--[ko_memo:" + memoId + "]-->";
32
34
  }
33
35
  export function unmemoize(memoId, callbackParams) {
34
- var callback = memos[memoId];
36
+ const callback = memos[memoId];
35
37
  if (callback === void 0) {
36
38
  throw new Error("Couldn't find any memo with ID " + memoId + ". Perhaps it's already been unmemoized.");
37
39
  }
@@ -43,11 +45,11 @@ export function unmemoize(memoId, callbackParams) {
43
45
  }
44
46
  }
45
47
  export function unmemoizeDomNodeAndDescendants(domNode, extraCallbackParamsArray) {
46
- var memos2 = [];
48
+ const memos2 = new Array();
47
49
  findMemoNodes(domNode, memos2);
48
- for (var i = 0, j = memos2.length; i < j; i++) {
49
- var node = memos2[i].domNode;
50
- var combinedParams = [node];
50
+ for (let i = 0, j = memos2.length; i < j; i++) {
51
+ const node = memos2[i].domNode;
52
+ const combinedParams = [node];
51
53
  if (extraCallbackParamsArray) {
52
54
  arrayPushAll(combinedParams, extraCallbackParamsArray);
53
55
  }
@@ -59,6 +61,9 @@ export function unmemoizeDomNodeAndDescendants(domNode, extraCallbackParamsArray
59
61
  }
60
62
  }
61
63
  export function parseMemoText(memoText) {
62
- var match = memoText.match(/^\[ko_memo\:(.*?)\]$/);
64
+ if (!memoText) {
65
+ return null;
66
+ }
67
+ const match = memoText.match(/^\[ko_memo\:(.*?)\]$/);
63
68
  return match ? match[1] : null;
64
69
  }