{"version":3,"file":"indexeddbshim-noninvasive.min.js","sources":["../node_modules/rollup-plugin-node-polyfills/polyfills/global.js","../node_modules/rollup-plugin-node-globals/src/global.js","../node_modules/eventtargeter/dist/index-es.js","../src/CFG.js","../src/unicode-regex.js","../src/util.js","../src/Event.js","../src/IDBVersionChangeEvent.js","../src/DOMException.js","../src/IDBRequest.js","../node_modules/sync-promise/dist/sync-promise-commonjs.js","../src/cmp.js","../src/Key.js","../src/IDBKeyRange.js","../src/DOMStringList.js","../src/IDBTransaction.js","../node_modules/base64-arraybuffer-es6/dist/base64-arraybuffer-es.js","../node_modules/typeson/dist/typeson.js","../node_modules/typeson-registry/types/arraybuffer.js","../node_modules/typeson-registry/types/bigint-object.js","../node_modules/typeson-registry/types/bigint.js","../node_modules/typeson-registry/utils/stringArrayBuffer.js","../node_modules/typeson-registry/types/blob.js","../node_modules/typeson-registry/utils/generateUUID.js","../node_modules/typeson-registry/types/cloneable.js","../node_modules/typeson-registry/types/dataview.js","../node_modules/typeson-registry/types/date.js","../node_modules/typeson-registry/types/error.js","../node_modules/typeson-registry/types/errors.js","../node_modules/typeson-registry/types/file.js","../node_modules/typeson-registry/types/filelist.js","../node_modules/typeson-registry/types/imagebitmap.js","../node_modules/typeson-registry/types/imagedata.js","../node_modules/typeson-registry/types/infinity.js","../node_modules/typeson-registry/types/intl-types.js","../node_modules/typeson-registry/types/map.js","../node_modules/typeson-registry/types/nan.js","../node_modules/typeson-registry/types/negative-infinity.js","../node_modules/typeson-registry/types/nonbuiltin-ignore.js","../node_modules/typeson-registry/types/primitive-objects.js","../node_modules/typeson-registry/types/regexp.js","../node_modules/typeson-registry/types/resurrectable.js","../node_modules/typeson-registry/types/set.js","../node_modules/typeson-registry/types/typed-arrays-socketio.js","../node_modules/typeson-registry/types/typed-arrays.js","../node_modules/typeson-registry/types/undef.js","../node_modules/typeson-registry/types/user-object.js","../node_modules/typeson-registry/presets/array-nonindex-keys.js","../node_modules/typeson-registry/presets/special-numbers.js","../node_modules/typeson-registry/presets/builtin.js","../node_modules/typeson-registry/presets/postmessage.js","../node_modules/typeson-registry/presets/socketio.js","../node_modules/typeson-registry/presets/sparse-undefined.js","../node_modules/typeson-registry/presets/structured-cloning.js","../node_modules/typeson-registry/presets/structured-cloning-throwing.js","../node_modules/typeson-registry/presets/undef.js","../node_modules/typeson-registry/presets/universal.js","../node_modules/typeson-registry/index.js","../src/Sca.js","../src/IDBIndex.js","../src/IDBObjectStore.js","../node_modules/rollup-plugin-node-polyfills/polyfills/path.js","../src/IDBDatabase.js","../src/IDBFactory.js","../src/IDBCursor.js","../src/setGlobalVars.js","../src/browser-noninvasive.js","../src/UnicodeIdentifiers.js"],"sourcesContent":["export default (typeof global !== \"undefined\" ? global :\n typeof self !== \"undefined\" ? self :\n typeof window !== \"undefined\" ? window : {});","export default (typeof global !== \"undefined\" ? global :\n typeof self !== \"undefined\" ? self :\n typeof window !== \"undefined\" ? window : {});\n","function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\n/* eslint-disable no-sync, no-restricted-syntax */\n// Todo: Switch to ES6 classes\nvar phases = {\n NONE: 0,\n CAPTURING_PHASE: 1,\n AT_TARGET: 2,\n BUBBLING_PHASE: 3\n};\nvar ShimDOMException = typeof DOMException === 'undefined' // Todo: Better polyfill (if even needed here)\n// eslint-disable-next-line no-shadow\n? function DOMException(msg, name) {\n // No need for `toString` as same as for `Error`\n var err = new Error(msg);\n err.name = name;\n return err;\n} : DOMException;\nvar ev = new WeakMap();\nvar evCfg = new WeakMap(); // Todo: Set _ev argument outside of this function\n\n/* eslint-disable func-name-matching, no-shadow */\n\n/**\n* We use an adapter class rather than a proxy not only for compatibility\n* but also since we have to clone native event properties anyways in order\n* to properly set `target`, etc.\n* The regular DOM method `dispatchEvent` won't work with this polyfill as\n* it expects a native event.\n* @class\n* @param {string} type\n*/\n\nvar ShimEvent = function Event(type) {\n /* eslint-enable func-name-matching, no-shadow */\n // For WebIDL checks of function's `length`, we check `arguments` for the optional arguments\n this[Symbol.toStringTag] = 'Event';\n\n this.toString = function () {\n return '[object Event]';\n }; // eslint-disable-next-line prefer-rest-params\n\n\n var _arguments = Array.prototype.slice.call(arguments),\n evInit = _arguments[1],\n _ev = _arguments[2];\n\n if (!arguments.length) {\n throw new TypeError(\"Failed to construct 'Event': 1 argument required, but only 0 present.\");\n }\n\n evInit = evInit || {};\n _ev = _ev || {};\n var _evCfg = {};\n\n if ('composed' in evInit) {\n _evCfg.composed = evInit.composed;\n } // _evCfg.isTrusted = true; // We are not always using this for user-created events\n // _evCfg.timeStamp = new Date().valueOf(); // This is no longer a timestamp, but monotonic (elapsed?)\n\n\n ev.set(this, _ev);\n evCfg.set(this, _evCfg);\n this.initEvent(type, evInit.bubbles, evInit.cancelable);\n Object.defineProperties(this, ['target', 'currentTarget', 'eventPhase', 'defaultPrevented'].reduce(function (obj, prop) {\n obj[prop] = {\n get: function get() {\n return (\n /* prop in _evCfg && */\n _evCfg[prop] !== undefined ? _evCfg[prop] : prop in _ev ? _ev[prop] : // Defaults\n prop === 'eventPhase' ? 0 : prop === 'defaultPrevented' ? false : null\n );\n }\n };\n return obj;\n }, {}));\n var props = [// Event\n 'type', 'bubbles', 'cancelable', // Defaults to false\n 'isTrusted', 'timeStamp', 'initEvent', // Other event properties (not used by our code)\n 'composedPath', 'composed'];\n\n if (this.toString() === '[object CustomEvent]') {\n props.push('detail', 'initCustomEvent');\n }\n\n Object.defineProperties(this, props.reduce(function (obj, prop) {\n obj[prop] = {\n get: function get() {\n return prop in _evCfg ? _evCfg[prop] : prop in _ev ? _ev[prop] : ['bubbles', 'cancelable', 'composed'].includes(prop) ? false : undefined;\n }\n };\n return obj;\n }, {}));\n};\n\nShimEvent.prototype.preventDefault = function () {\n if (!(this instanceof ShimEvent)) {\n throw new TypeError('Illegal invocation');\n }\n\n var _ev = ev.get(this);\n\n var _evCfg = evCfg.get(this);\n\n if (this.cancelable && !_evCfg._passive) {\n _evCfg.defaultPrevented = true;\n\n if (typeof _ev.preventDefault === 'function') {\n // Prevent any predefined defaults\n _ev.preventDefault();\n }\n }\n};\n\nShimEvent.prototype.stopImmediatePropagation = function () {\n var _evCfg = evCfg.get(this);\n\n _evCfg._stopImmediatePropagation = true;\n};\n\nShimEvent.prototype.stopPropagation = function () {\n var _evCfg = evCfg.get(this);\n\n _evCfg._stopPropagation = true;\n};\n\nShimEvent.prototype.initEvent = function (type, bubbles, cancelable) {\n // Chrome currently has function length 1 only but WebIDL says 3\n // const bubbles = arguments[1];\n // const cancelable = arguments[2];\n var _evCfg = evCfg.get(this);\n\n if (_evCfg._dispatched) {\n return;\n }\n\n _evCfg.type = type;\n\n if (bubbles !== undefined) {\n _evCfg.bubbles = bubbles;\n }\n\n if (cancelable !== undefined) {\n _evCfg.cancelable = cancelable;\n }\n};\n\n['type', 'target', 'currentTarget'].forEach(function (prop) {\n Object.defineProperty(ShimEvent.prototype, prop, {\n enumerable: true,\n configurable: true,\n get: function get() {\n throw new TypeError('Illegal invocation');\n }\n });\n});\n['eventPhase', 'defaultPrevented', 'bubbles', 'cancelable', 'timeStamp'].forEach(function (prop) {\n Object.defineProperty(ShimEvent.prototype, prop, {\n enumerable: true,\n configurable: true,\n get: function get() {\n throw new TypeError('Illegal invocation');\n }\n });\n});\n['NONE', 'CAPTURING_PHASE', 'AT_TARGET', 'BUBBLING_PHASE'].forEach(function (prop, i) {\n Object.defineProperty(ShimEvent, prop, {\n enumerable: true,\n writable: false,\n value: i\n });\n Object.defineProperty(ShimEvent.prototype, prop, {\n writable: false,\n value: i\n });\n});\nShimEvent[Symbol.toStringTag] = 'Function';\nShimEvent.prototype[Symbol.toStringTag] = 'EventPrototype';\nObject.defineProperty(ShimEvent, 'prototype', {\n writable: false\n});\n/* eslint-disable func-name-matching, no-shadow */\n\n/**\n *\n * @param {string} type\n * @class\n */\n\nvar ShimCustomEvent = function CustomEvent(type) {\n /* eslint-enable func-name-matching, no-shadow */\n // eslint-disable-next-line prefer-rest-params\n var _arguments2 = Array.prototype.slice.call(arguments),\n evInit = _arguments2[1],\n _ev = _arguments2[2];\n\n ShimEvent.call(this, type, evInit, _ev);\n this[Symbol.toStringTag] = 'CustomEvent';\n\n this.toString = function () {\n return '[object CustomEvent]';\n }; // var _evCfg = evCfg.get(this);\n\n\n evInit = evInit || {};\n this.initCustomEvent(type, evInit.bubbles, evInit.cancelable, 'detail' in evInit ? evInit.detail : null);\n};\n\nObject.defineProperty(ShimCustomEvent.prototype, 'constructor', {\n enumerable: false,\n writable: true,\n configurable: true,\n value: ShimCustomEvent\n});\n\nShimCustomEvent.prototype.initCustomEvent = function (type, bubbles, cancelable, detail) {\n if (!(this instanceof ShimCustomEvent)) {\n throw new TypeError('Illegal invocation');\n }\n\n var _evCfg = evCfg.get(this);\n\n ShimCustomEvent.call(this, type, {\n bubbles: bubbles,\n cancelable: cancelable,\n detail: detail // eslint-disable-next-line prefer-rest-params\n\n }, arguments[4]);\n\n if (_evCfg._dispatched) {\n return;\n }\n\n if (detail !== undefined) {\n _evCfg.detail = detail;\n }\n\n Object.defineProperty(this, 'detail', {\n get: function get() {\n return _evCfg.detail;\n }\n });\n};\n\nShimCustomEvent[Symbol.toStringTag] = 'Function';\nShimCustomEvent.prototype[Symbol.toStringTag] = 'CustomEventPrototype';\nObject.defineProperty(ShimCustomEvent.prototype, 'detail', {\n enumerable: true,\n configurable: true,\n get: function get() {\n throw new TypeError('Illegal invocation');\n }\n});\nObject.defineProperty(ShimCustomEvent, 'prototype', {\n writable: false\n});\n/**\n *\n * @param {Event} e\n * @returns {ShimEvent}\n */\n\nfunction copyEvent(e) {\n var bubbles = e.bubbles,\n cancelable = e.cancelable,\n detail = e.detail,\n type = e.type;\n\n if ('detail' in e) {\n return new ShimCustomEvent(type, {\n bubbles: bubbles,\n cancelable: cancelable,\n detail: detail\n }, e);\n }\n\n return new ShimEvent(type, {\n bubbles: bubbles,\n cancelable: cancelable\n }, e);\n}\n/**\n* @typedef {PlainObject} ListenerOptions\n* @property {boolean} once Remove listener after invoking once\n* @property {boolean} passive Don't allow `preventDefault`\n* @property {boolean} capture Use `_children` and set `eventPhase`\n*/\n\n/**\n* @typedef {PlainObject} ListenerAndOptions\n* @property {listener} listener\n* @property {ListenerOptions} options\n*/\n\n/**\n* @typedef {PlainObject} ListenerInfo\n* @property {ListenerAndOptions[]} listenersByTypeOptions\n* @property {ListenerOptions} options\n* @property {ListenerAndOptions[]} listenersByType\n*/\n\n/**\n* @callback Listener\n* @param {Event} e\n* @returns {boolean}\n*/\n\n/**\n * Keys are event types.\n * @typedef {Object} Listeners\n*/\n\n/**\n *\n * @param {Listeners} listeners\n * @param {string} type\n * @param {boolean|ListenerOptions} options\n * @returns {ListenerInfo}\n */\n\n\nfunction getListenersOptions(listeners, type, options) {\n var listenersByType = listeners[type];\n if (listenersByType === undefined) listeners[type] = listenersByType = [];\n options = typeof options === 'boolean' ? {\n capture: options\n } : options || {};\n var stringifiedOptions = JSON.stringify(options);\n var listenersByTypeOptions = listenersByType.filter(function (obj) {\n return stringifiedOptions === JSON.stringify(obj.options);\n });\n return {\n listenersByTypeOptions: listenersByTypeOptions,\n options: options,\n listenersByType: listenersByType\n };\n}\n\nvar methods = {\n addListener: function addListener(listeners, listener, type, options) {\n var listenerOptions = getListenersOptions(listeners, type, options);\n var listenersByTypeOptions = listenerOptions.listenersByTypeOptions;\n options = listenerOptions.options;\n var listenersByType = listenerOptions.listenersByType;\n if (listenersByTypeOptions.some(function (l) {\n return l.listener === listener;\n })) return;\n listenersByType.push({\n listener: listener,\n options: options\n });\n },\n removeListener: function removeListener(listeners, listener, type, options) {\n var listenerOptions = getListenersOptions(listeners, type, options);\n var listenersByType = listenerOptions.listenersByType;\n var stringifiedOptions = JSON.stringify(listenerOptions.options);\n listenersByType.some(function (l, i) {\n if (l.listener === listener && stringifiedOptions === JSON.stringify(l.options)) {\n listenersByType.splice(i, 1);\n if (!listenersByType.length) delete listeners[type];\n return true;\n }\n\n return false;\n });\n },\n hasListener: function hasListener(listeners, listener, type, options) {\n var listenerOptions = getListenersOptions(listeners, type, options);\n var listenersByTypeOptions = listenerOptions.listenersByTypeOptions;\n return listenersByTypeOptions.some(function (l) {\n return l.listener === listener;\n });\n }\n};\n/* eslint-disable no-shadow */\n\n/**\n * @class\n */\n\nfunction EventTarget() {\n /* eslint-enable no-shadow */\n throw new TypeError('Illegal constructor');\n}\n\nObject.assign(EventTarget.prototype, ['Early', '', 'Late', 'Default'].reduce(function (obj, listenerType) {\n ['add', 'remove', 'has'].forEach(function (method) {\n obj[method + listenerType + 'EventListener'] = function (type, listener) {\n // eslint-disable-next-line prefer-rest-params\n var options = arguments[2]; // We keep the listener `length` as per WebIDL\n\n if (arguments.length < 2) throw new TypeError('2 or more arguments required');\n\n if (typeof type !== 'string') {\n throw new ShimDOMException('UNSPECIFIED_EVENT_TYPE_ERR', 'UNSPECIFIED_EVENT_TYPE_ERR');\n }\n\n try {\n // As per code such as the following, handleEvent may throw,\n // but is uncaught\n // https://github.com/web-platform-tests/wpt/blob/master/IndexedDB/fire-error-event-exception.html#L54-L56\n if (listener.handleEvent && listener.handleEvent.bind) {\n listener = listener.handleEvent.bind(listener);\n }\n } catch (err) {\n // eslint-disable-next-line no-console\n console.log('Uncaught `handleEvent` error', err);\n }\n\n var arrStr = '_' + listenerType.toLowerCase() + (listenerType === '' ? 'l' : 'L') + 'isteners';\n\n if (!this[arrStr]) {\n Object.defineProperty(this, arrStr, {\n value: {}\n });\n }\n\n return methods[method + 'Listener'](this[arrStr], listener, type, options);\n };\n });\n return obj;\n}, {}));\nObject.assign(EventTarget.prototype, {\n __setOptions: function __setOptions(customOptions) {\n customOptions = customOptions || {}; // Todo: Make into event properties?\n\n this._defaultSync = customOptions.defaultSync;\n this._extraProperties = customOptions.extraProperties || [];\n\n if (customOptions.legacyOutputDidListenersThrowFlag) {\n // IndexedDB\n this._legacyOutputDidListenersThrowCheck = true;\n\n this._extraProperties.push('__legacyOutputDidListenersThrowError');\n }\n },\n dispatchEvent: function dispatchEvent(e) {\n return this._dispatchEvent(e, true);\n },\n _dispatchEvent: function _dispatchEvent(e, setTarget) {\n var _this = this;\n\n ['early', '', 'late', 'default'].forEach(function (listenerType) {\n var arrStr = '_' + listenerType + (listenerType === '' ? 'l' : 'L') + 'isteners';\n\n if (!_this[arrStr]) {\n Object.defineProperty(_this, arrStr, {\n value: {}\n });\n }\n });\n\n var _evCfg = evCfg.get(e);\n\n if (_evCfg && setTarget && _evCfg._dispatched) {\n throw new ShimDOMException('The object is in an invalid state.', 'InvalidStateError');\n }\n\n var eventCopy;\n\n if (_evCfg) {\n eventCopy = e;\n } else {\n eventCopy = copyEvent(e);\n _evCfg = evCfg.get(eventCopy);\n _evCfg._dispatched = true;\n\n this._extraProperties.forEach(function (prop) {\n if (prop in e) {\n eventCopy[prop] = e[prop]; // Todo: Put internal to `ShimEvent`?\n }\n });\n }\n\n var _eventCopy = eventCopy,\n type = _eventCopy.type;\n /**\n *\n * @returns {void}\n */\n\n function finishEventDispatch() {\n _evCfg.eventPhase = phases.NONE;\n _evCfg.currentTarget = null;\n delete _evCfg._children;\n }\n /**\n *\n * @returns {void}\n */\n\n\n function invokeDefaults() {\n // Ignore stopPropagation from defaults\n _evCfg._stopImmediatePropagation = undefined;\n _evCfg._stopPropagation = undefined; // We check here for whether we should invoke since may have changed since timeout (if late listener prevented default)\n\n if (!eventCopy.defaultPrevented || !_evCfg.cancelable) {\n // 2nd check should be redundant\n _evCfg.eventPhase = phases.AT_TARGET; // Temporarily set before we invoke default listeners\n\n eventCopy.target.invokeCurrentListeners(eventCopy.target._defaultListeners, eventCopy, type);\n }\n\n finishEventDispatch();\n }\n\n var continueEventDispatch = function continueEventDispatch() {\n // Ignore stop propagation of user now\n _evCfg._stopImmediatePropagation = undefined;\n _evCfg._stopPropagation = undefined;\n\n if (!_this._defaultSync) {\n setTimeout(invokeDefaults, 0);\n } else invokeDefaults();\n\n _evCfg.eventPhase = phases.AT_TARGET; // Temporarily set before we invoke late listeners\n // Sync default might have stopped\n\n if (!_evCfg._stopPropagation) {\n _evCfg._stopImmediatePropagation = undefined;\n _evCfg._stopPropagation = undefined; // We could allow stopPropagation by only executing upon (_evCfg._stopPropagation)\n\n eventCopy.target.invokeCurrentListeners(eventCopy.target._lateListeners, eventCopy, type);\n }\n\n finishEventDispatch();\n return !eventCopy.defaultPrevented;\n };\n\n if (setTarget) _evCfg.target = this;\n\n switch (eventCopy.eventPhase) {\n default:\n case phases.NONE:\n {\n _evCfg.eventPhase = phases.AT_TARGET; // Temporarily set before we invoke early listeners\n\n this.invokeCurrentListeners(this._earlyListeners, eventCopy, type);\n\n if (!this.__getParent) {\n _evCfg.eventPhase = phases.AT_TARGET;\n return this._dispatchEvent(eventCopy, false);\n }\n /* eslint-disable consistent-this */\n\n\n var par = this;\n var root = this;\n /* eslint-enable consistent-this */\n\n while (par.__getParent && (par = par.__getParent()) !== null) {\n if (!_evCfg._children) {\n _evCfg._children = [];\n }\n\n _evCfg._children.push(root);\n\n root = par;\n }\n\n root._defaultSync = this._defaultSync;\n _evCfg.eventPhase = phases.CAPTURING_PHASE;\n return root._dispatchEvent(eventCopy, false);\n }\n\n case phases.CAPTURING_PHASE:\n {\n if (_evCfg._stopPropagation) {\n return continueEventDispatch();\n }\n\n this.invokeCurrentListeners(this._listeners, eventCopy, type);\n\n var child = _evCfg._children && _evCfg._children.length && _evCfg._children.pop();\n\n if (!child || child === eventCopy.target) {\n _evCfg.eventPhase = phases.AT_TARGET;\n }\n\n if (child) child._defaultSync = this._defaultSync;\n return (child || this)._dispatchEvent(eventCopy, false);\n }\n\n case phases.AT_TARGET:\n if (_evCfg._stopPropagation) {\n return continueEventDispatch();\n }\n\n this.invokeCurrentListeners(this._listeners, eventCopy, type, true);\n\n if (!_evCfg.bubbles) {\n return continueEventDispatch();\n }\n\n _evCfg.eventPhase = phases.BUBBLING_PHASE;\n return this._dispatchEvent(eventCopy, false);\n\n case phases.BUBBLING_PHASE:\n {\n if (_evCfg._stopPropagation) {\n return continueEventDispatch();\n }\n\n var parent = this.__getParent && this.__getParent();\n\n if (!parent) {\n return continueEventDispatch();\n }\n\n parent.invokeCurrentListeners(parent._listeners, eventCopy, type, true);\n parent._defaultSync = this._defaultSync;\n return parent._dispatchEvent(eventCopy, false);\n }\n }\n },\n invokeCurrentListeners: function invokeCurrentListeners(listeners, eventCopy, type, checkOnListeners) {\n var _this2 = this;\n\n var _evCfg = evCfg.get(eventCopy);\n\n _evCfg.currentTarget = this;\n var listOpts = getListenersOptions(listeners, type, {});\n var listenersByType = listOpts.listenersByType.concat();\n var dummyIPos = listenersByType.length ? 1 : 0;\n listenersByType.some(function (listenerObj, i) {\n var onListener = checkOnListeners ? _this2['on' + type] : null;\n if (_evCfg._stopImmediatePropagation) return true;\n\n if (i === dummyIPos && typeof onListener === 'function') {\n // We don't splice this in as could be overwritten; executes here per\n // https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-attributes:event-handlers-14\n _this2.tryCatch(eventCopy, function () {\n var ret = onListener.call(eventCopy.currentTarget, eventCopy);\n\n if (ret === false) {\n eventCopy.preventDefault();\n }\n });\n }\n\n var options = listenerObj.options;\n var once = options.once,\n passive = options.passive,\n capture = options.capture;\n _evCfg._passive = passive;\n\n if (capture && eventCopy.target !== eventCopy.currentTarget && eventCopy.eventPhase === phases.CAPTURING_PHASE || eventCopy.eventPhase === phases.AT_TARGET || !capture && eventCopy.target !== eventCopy.currentTarget && eventCopy.eventPhase === phases.BUBBLING_PHASE) {\n var listener = listenerObj.listener;\n\n _this2.tryCatch(eventCopy, function () {\n listener.call(eventCopy.currentTarget, eventCopy);\n });\n\n if (once) {\n _this2.removeEventListener(type, listener, options);\n }\n }\n\n return false;\n });\n this.tryCatch(eventCopy, function () {\n var onListener = checkOnListeners ? _this2['on' + type] : null;\n\n if (typeof onListener === 'function' && listenersByType.length < 2) {\n var ret = onListener.call(eventCopy.currentTarget, eventCopy); // Won't have executed if too short\n\n if (ret === false) {\n eventCopy.preventDefault();\n }\n }\n });\n return !eventCopy.defaultPrevented;\n },\n // eslint-disable-next-line promise/prefer-await-to-callbacks\n tryCatch: function tryCatch(evt, cb) {\n try {\n // Per MDN: Exceptions thrown by event handlers are reported\n // as uncaught exceptions; the event handlers run on a nested\n // callstack: they block the caller until they complete, but\n // exceptions do not propagate to the caller.\n // eslint-disable-next-line promise/prefer-await-to-callbacks, callback-return\n cb();\n } catch (err) {\n this.triggerErrorEvent(err, evt);\n }\n },\n triggerErrorEvent: function triggerErrorEvent(err, evt) {\n var error = err;\n\n if (typeof err === 'string') {\n error = new Error('Uncaught exception: ' + err);\n }\n\n var triggerGlobalErrorEvent;\n var useNodeImpl = false;\n\n if (typeof window === 'undefined' || typeof ErrorEvent === 'undefined' || window && (typeof window === \"undefined\" ? \"undefined\" : _typeof(window)) === 'object' && !window.dispatchEvent) {\n useNodeImpl = true;\n\n triggerGlobalErrorEvent = function triggerGlobalErrorEvent() {\n setTimeout(function () {\n // Node won't be able to catch in this way if we throw in the main thread\n // console.log(err); // Should we auto-log for user?\n throw error; // Let user listen to `process.on('uncaughtException', (err) => {});`\n });\n };\n } else {\n triggerGlobalErrorEvent = function triggerGlobalErrorEvent() {\n // See https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onerror\n // and https://github.com/w3c/IndexedDB/issues/49\n // Note that a regular Event will properly trigger\n // `window.addEventListener('error')` handlers, but it will not trigger\n // `window.onerror` as per https://html.spec.whatwg.org/multipage/webappapis.html#handler-onerror\n // Note also that the following line won't handle `window.addEventListener` handlers\n // if (window.onerror) window.onerror(error.message, err.fileName, err.lineNumber, error.columnNumber, error);\n // `ErrorEvent` properly triggers `window.onerror` and `window.addEventListener('error')` handlers\n var errEv = new ErrorEvent('error', {\n error: err,\n message: error.message || '',\n // We can't get the actually useful user's values!\n filename: error.fileName || '',\n lineno: error.lineNumber || 0,\n colno: error.columnNumber || 0\n });\n window.dispatchEvent(errEv); // console.log(err); // Should we auto-log for user?\n };\n } // Todo: This really should always run here but as we can't set the global\n // `window` (e.g., using jsdom) since `setGlobalVars` becomes unable to\n // shim `indexedDB` in such a case currently (apparently due to\n // ), we can't\n // avoid the above Node implementation (which, while providing some\n // fallback mechanism, is unstable)\n\n\n if (!useNodeImpl || !this._legacyOutputDidListenersThrowCheck) triggerGlobalErrorEvent(); // See https://dom.spec.whatwg.org/#concept-event-listener-inner-invoke and\n // https://github.com/w3c/IndexedDB/issues/140 (also https://github.com/w3c/IndexedDB/issues/49 )\n\n if (this._legacyOutputDidListenersThrowCheck) {\n evt.__legacyOutputDidListenersThrowError = error;\n }\n }\n});\nEventTarget.prototype[Symbol.toStringTag] = 'EventTargetPrototype';\nObject.defineProperty(EventTarget, 'prototype', {\n writable: false\n});\nvar ShimEventTarget = EventTarget;\nvar EventTargetFactory = {\n createInstance: function createInstance(customOptions) {\n /* eslint-disable no-shadow */\n\n /**\n * @class\n */\n function EventTarget() {\n /* eslint-enable no-shadow */\n this.__setOptions(customOptions);\n }\n\n EventTarget.prototype = ShimEventTarget.prototype;\n return new EventTarget();\n }\n};\nEventTarget.ShimEvent = ShimEvent;\nEventTarget.ShimCustomEvent = ShimCustomEvent;\nEventTarget.ShimDOMException = ShimDOMException;\nEventTarget.ShimEventTarget = EventTarget;\nEventTarget.EventTargetFactory = EventTargetFactory;\n/**\n * @returns {void}\n */\n\nfunction setPrototypeOfCustomEvent() {\n // TODO: IDL needs but reported as slow!\n Object.setPrototypeOf(ShimCustomEvent, ShimEvent);\n Object.setPrototypeOf(ShimCustomEvent.prototype, ShimEvent.prototype);\n} // Todo: Move to own library (but allowing WeakMaps to be passed in for sharing here)\n\nexport { EventTargetFactory, ShimCustomEvent, ShimDOMException, ShimEvent, EventTarget as ShimEventTarget, setPrototypeOfCustomEvent };\n","const map = {};\nconst CFG = {};\n\n[\n // Boolean for verbose reporting\n 'DEBUG', // Effectively defaults to false (ignored unless `true`)\n\n // Boolean (effectively defaults to true) on whether to cache WebSQL\n // `openDatabase` instances\n 'cacheDatabaseInstances',\n\n // Boolean on whether to auto-name databases (based on an\n // auto-increment) when the empty string is supplied; useful with\n // `memoryDatabase`; defaults to `false` which means the empty string\n // will be used as the (valid) database name\n 'autoName',\n\n // Determines whether the slow-performing `Object.setPrototypeOf`\n // calls required for full WebIDL compliance will be used. Probably\n // only needed for testing or environments where full introspection\n // on class relationships is required; see\n // http://stackoverflow.com/questions/41927589/rationales-consequences-of-webidl-class-inheritance-requirements\n 'fullIDLSupport', // Effectively defaults to false (ignored unless `true`)\n\n // Boolean on whether to perform origin checks in `IDBFactory` methods\n // Effectively defaults to `true` (must be set to `false` to cancel checks)\n 'checkOrigin',\n\n // Used by `IDBCursor` continue methods for number of records to cache;\n // Defaults to 100\n 'cursorPreloadPackSize',\n\n // See optional API (`shimIndexedDB.__setUnicodeIdentifiers`);\n // or just use the Unicode builds which invoke this method\n // automatically using the large, fully spec-compliant, regular\n // expression strings of `src/UnicodeIdentifiers.js`)\n // In the non-Unicode builds, defaults to /[$A-Z_a-z]/\n 'UnicodeIDStart',\n // In the non-Unicode builds, defaults to /[$0-9A-Z_a-z]/\n 'UnicodeIDContinue',\n\n // Used by SCA.js for optional restructuring of typeson-registry\n // Structured Cloning Algorithm; should only be needed for ensuring data\n // created in 3.* versions of IndexedDBShim continue to work; see the\n // library `typeson-registry-sca-reverter` to get a function to do this\n 'registerSCA',\n\n // BROWSER-SPECIFIC CONFIG\n 'avoidAutoShim', // Where WebSQL is detected but where `indexedDB` is\n // missing or poor support is known (non-Chrome Android or\n // non-Safari iOS9), the shim will be auto-applied without\n // `shimIndexedDB.__useShim()`. Set this to `true` to avoid forcing\n // the shim for such cases.\n\n // -----------SQL CONFIG----------\n // Object (`window` in the browser) on which there may be an\n // `openDatabase` method (if any) for WebSQL. (The browser\n // throws if attempting to call `openDatabase` without the window\n // so this is why the config doesn't just allow the function.)\n // Defaults to `window` or `self` in browser builds or\n // a singleton object with the `openDatabase` method set to\n // the \"websql\" package in Node.\n 'win',\n\n // For internal `openDatabase` calls made by `IDBFactory` methods;\n // per the WebSQL spec, \"User agents are expected to use the display name\n // and the estimated database size to optimize the user experience.\n // For example, a user agent could use the estimated size to suggest an\n // initial quota to the user. This allows a site that is aware that it\n // will try to use hundreds of megabytes to declare this upfront, instead\n // of the user agent prompting the user for permission to increase the\n // quota every five megabytes.\"\n // Defaults to (4 * 1024 * 1024) or (25 * 1024 * 1024) in Safari\n 'DEFAULT_DB_SIZE',\n // Whether to create indexes on SQLite tables (and also whether to try\n // dropping)\n // Effectively defaults to `false` (ignored unless `true`)\n 'useSQLiteIndexes',\n\n // NODE-IMPINGING SETTINGS (created for sake of limitations in Node\n // or desktop file system implementation but applied by default in\n // browser for parity)\n\n // File system module with `unlink` to remove deleted database files\n 'fs',\n\n // Used when setting global shims to determine whether to try to add\n // other globals shimmed by the library (`ShimDOMException`,\n // `ShimDOMStringList`, `ShimEvent`, `ShimCustomEvent`, `ShimEventTarget`)\n // Effectively defaults to `false` (ignored unless `true`)\n 'addNonIDBGlobals',\n // Used when setting global shims to determine whether to try to overwrite\n // other globals shimmed by the library (`DOMException`, `DOMStringList`,\n // `Event`, `CustomEvent`, `EventTarget`)\n // Effectively defaults to `false` (ignored unless `true`)\n 'replaceNonIDBGlobals',\n\n // Overcoming limitations with node-sqlite3/storing database name on\n // file systems\n // https://en.wikipedia.org/wiki/Filename#Reserved_characters_and_words\n // Defaults to prefixing database with `D_`, escaping\n // `databaseCharacterEscapeList`, escaping NUL, and\n // escaping upper case letters, as well as enforcing\n // `databaseNameLengthLimit`\n 'escapeDatabaseName',\n // Not used internally; usable as a convenience method\n 'unescapeDatabaseName',\n\n // Defaults to global regex representing the following\n // (characters nevertheless commonly reserved in modern,\n // Unicode-supporting systems): 0x00-0x1F 0x7F \" * / : < > ? \\ |\n 'databaseCharacterEscapeList',\n // Defaults to 254 (shortest typical modern file length limit)\n 'databaseNameLengthLimit',\n\n // Boolean defaulting to true on whether to escape NFD-escaping\n // characters to avoid clashes on MacOS which performs NFD on files\n 'escapeNFDForDatabaseNames',\n\n // Boolean on whether to add the `.sqlite` extension to file names;\n // defaults to `true`\n 'addSQLiteExtension',\n // Various types of in-memory databases that can auto-delete\n ['memoryDatabase', (val) => {\n if (!(/^(?::memory:|file::memory:(\\?[^#]*)?(#.*)?)?$/u).test(val)) {\n throw new TypeError(\n '`memoryDatabase` must be the empty string, \":memory:\", or a ' +\n '\"file::memory:[?queryString][#hash] URL\".'\n );\n }\n }],\n\n // NODE-SPECIFIC CONFIG\n // Boolean on whether to delete the database file itself after\n // `deleteDatabase`; defaults to `true` as the database will be empty\n 'deleteDatabaseFiles',\n 'databaseBasePath',\n 'sysDatabaseBasePath',\n\n // NODE-SPECIFIC WEBSQL CONFIG\n 'sqlBusyTimeout', // Defaults to 1000\n 'sqlTrace', // Callback not used by default\n 'sqlProfile' // Callback not used by default\n].forEach((prop) => {\n let validator;\n if (Array.isArray(prop)) {\n [prop, validator] = prop;\n }\n Object.defineProperty(CFG, prop, {\n get () {\n return map[prop];\n },\n set (val) {\n if (validator) {\n validator(val);\n }\n map[prop] = val;\n }\n });\n});\n\nexport default CFG;\n","var regex=/[\\xC0-\\xC5\\xC7-\\xCF\\xD1-\\xD6\\xD9-\\xDD\\xE0-\\xE5\\xE7-\\xEF\\xF1-\\xF6\\xF9-\\xFD\\xFF-\\u010F\\u0112-\\u0125\\u0128-\\u0130\\u0134-\\u0137\\u0139-\\u013E\\u0143-\\u0148\\u014C-\\u0151\\u0154-\\u0165\\u0168-\\u017E\\u01A0\\u01A1\\u01AF\\u01B0\\u01CD-\\u01DC\\u01DE-\\u01E3\\u01E6-\\u01F0\\u01F4\\u01F5\\u01F8-\\u021B\\u021E\\u021F\\u0226-\\u0233\\u0344\\u0385\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u0390\\u03AA-\\u03B0\\u03CA-\\u03CE\\u03D3\\u03D4\\u0400\\u0401\\u0403\\u0407\\u040C-\\u040E\\u0419\\u0439\\u0450\\u0451\\u0453\\u0457\\u045C-\\u045E\\u0476\\u0477\\u04C1\\u04C2\\u04D0-\\u04D3\\u04D6\\u04D7\\u04DA-\\u04DF\\u04E2-\\u04E7\\u04EA-\\u04F5\\u04F8\\u04F9\\u0622-\\u0626\\u06C0\\u06C2\\u06D3\\u0929\\u0931\\u0934\\u0958-\\u095F\\u09CB\\u09CC\\u09DC\\u09DD\\u09DF\\u0A33\\u0A36\\u0A59-\\u0A5B\\u0A5E\\u0B48\\u0B4B\\u0B4C\\u0B5C\\u0B5D\\u0B94\\u0BCA-\\u0BCC\\u0C48\\u0CC0\\u0CC7\\u0CC8\\u0CCA\\u0CCB\\u0D4A-\\u0D4C\\u0DDA\\u0DDC-\\u0DDE\\u0F43\\u0F4D\\u0F52\\u0F57\\u0F5C\\u0F69\\u0F73\\u0F75\\u0F76\\u0F78\\u0F81\\u0F93\\u0F9D\\u0FA2\\u0FA7\\u0FAC\\u0FB9\\u1026\\u1B06\\u1B08\\u1B0A\\u1B0C\\u1B0E\\u1B12\\u1B3B\\u1B3D\\u1B40\\u1B41\\u1B43\\u1E00-\\u1E99\\u1E9B\\u1EA0-\\u1EF9\\u1F00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FC1-\\u1FC4\\u1FC6-\\u1FD3\\u1FD6-\\u1FDB\\u1FDD-\\u1FEE\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u212B\\u219A\\u219B\\u21AE\\u21CD-\\u21CF\\u2204\\u2209\\u220C\\u2224\\u2226\\u2241\\u2244\\u2247\\u2249\\u2260\\u2262\\u226D-\\u2271\\u2274\\u2275\\u2278\\u2279\\u2280\\u2281\\u2284\\u2285\\u2288\\u2289\\u22AC-\\u22AF\\u22E0-\\u22E3\\u22EA-\\u22ED\\u2ADC\\u304C\\u304E\\u3050\\u3052\\u3054\\u3056\\u3058\\u305A\\u305C\\u305E\\u3060\\u3062\\u3065\\u3067\\u3069\\u3070\\u3071\\u3073\\u3074\\u3076\\u3077\\u3079\\u307A\\u307C\\u307D\\u3094\\u309E\\u30AC\\u30AE\\u30B0\\u30B2\\u30B4\\u30B6\\u30B8\\u30BA\\u30BC\\u30BE\\u30C0\\u30C2\\u30C5\\u30C7\\u30C9\\u30D0\\u30D1\\u30D3\\u30D4\\u30D6\\u30D7\\u30D9\\u30DA\\u30DC\\u30DD\\u30F4\\u30F7-\\u30FA\\u30FE\\uAC00-\\uD7A3\\uFB1D\\uFB1F\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFB4E]|\\uD804[\\uDC9A\\uDC9C\\uDCAB\\uDD2E\\uDD2F\\uDF4B\\uDF4C]|\\uD805[\\uDCBB\\uDCBC\\uDCBE\\uDDBA\\uDDBB]|\\uD834[\\uDD5E-\\uDD64\\uDDBB-\\uDDC0]/;\n\nexport default regex;\n","import CFG from './CFG.js';\nimport expandsOnNFD from './unicode-regex.js';\n\nfunction escapeUnmatchedSurrogates (arg) {\n // http://stackoverflow.com/a/6701665/271577\n return arg.replace(\n /([\\uD800-\\uDBFF])(?![\\uDC00-\\uDFFF])|(^|[^\\uD800-\\uDBFF])([\\uDC00-\\uDFFF])/gu,\n function (_, unmatchedHighSurrogate, precedingLow, unmatchedLowSurrogate) {\n // Could add a corresponding surrogate for compatibility with `node-sqlite3`: http://bugs.python.org/issue12569 and http://stackoverflow.com/a/6701665/271577\n // but Chrome having problems\n if (unmatchedHighSurrogate) {\n return '^2' + padStart(unmatchedHighSurrogate.charCodeAt().toString(16), 4, '0');\n }\n return (precedingLow || '') + '^3' + padStart(unmatchedLowSurrogate.charCodeAt().toString(16), 4, '0');\n }\n );\n}\n\nfunction escapeNameForSQLiteIdentifier (arg) {\n // http://stackoverflow.com/a/6701665/271577\n return '_' + // Prevent empty string\n escapeUnmatchedSurrogates(\n arg.replace(/\\^/gu, '^^') // Escape our escape\n // http://www.sqlite.org/src/tktview?name=57c971fc74\n .replace(/\\0/gu, '^0')\n // We need to avoid identifiers being treated as duplicates based on SQLite's ASCII-only case-insensitive table and column names\n // (For SQL in general, however, see http://stackoverflow.com/a/17215009/271577\n // See also https://www.sqlite.org/faq.html#q18 re: Unicode (non-ASCII) case-insensitive not working\n .replace(/([A-Z])/gu, '^$1')\n );\n}\n\n// The escaping of unmatched surrogates was needed by Chrome but not Node\nfunction escapeSQLiteStatement (arg) {\n return escapeUnmatchedSurrogates(arg.replace(/\\^/gu, '^^').replace(/\\0/gu, '^0'));\n}\nfunction unescapeSQLiteResponse (arg) {\n return unescapeUnmatchedSurrogates(arg)\n .replace(/(\\^+)0/gu, (_, esc) => {\n return esc.length % 2\n ? esc.slice(1) + '\\0'\n : _;\n })\n .replace(/\\^\\^/gu, '^');\n}\n\nfunction sqlEscape (arg) {\n // https://www.sqlite.org/lang_keywords.html\n // http://stackoverflow.com/a/6701665/271577\n // There is no need to escape ', `, or [], as\n // we should always be within double quotes\n // NUL should have already been stripped\n return arg.replace(/\"/gu, '\"\"');\n}\n\nfunction sqlQuote (arg) {\n return '\"' + sqlEscape(arg) + '\"';\n}\n\nfunction escapeDatabaseNameForSQLAndFiles (db) {\n if (CFG.escapeDatabaseName) {\n // We at least ensure NUL is escaped by default, but we need to still\n // handle empty string and possibly also length (potentially\n // throwing if too long), escaping casing (including Unicode?),\n // and escaping special characters depending on file system\n return CFG.escapeDatabaseName(escapeSQLiteStatement(db));\n }\n db = 'D' + escapeNameForSQLiteIdentifier(db);\n if (CFG.escapeNFDForDatabaseNames !== false) {\n // ES6 copying of regex with different flags\n // Todo: Remove `.source` when\n // https://github.com/babel/babel/issues/5978 completed (see also\n // https://github.com/axemclion/IndexedDBShim/issues/311#issuecomment-316090147 )\n db = db.replace(new RegExp(expandsOnNFD.source, 'gu'), function (expandable) {\n return '^4' + padStart(expandable.codePointAt().toString(16), 6, '0');\n });\n }\n if (CFG.databaseCharacterEscapeList !== false) {\n db = db.replace(\n (CFG.databaseCharacterEscapeList\n ? new RegExp(CFG.databaseCharacterEscapeList, 'gu')\n : /[\\u0000-\\u001F\\u007F\"*/:<>?\\\\|]/gu), // eslint-disable-line no-control-regex\n function (n0) {\n return '^1' + padStart(n0.charCodeAt().toString(16), 2, '0');\n }\n );\n }\n if (CFG.databaseNameLengthLimit !== false &&\n db.length >= ((CFG.databaseNameLengthLimit || 254) - (CFG.addSQLiteExtension !== false ? 7 /* '.sqlite'.length */ : 0))) {\n throw new Error(\n 'Unexpectedly long database name supplied; length limit required for Node compatibility; passed length: ' +\n db.length + '; length limit setting: ' + (CFG.databaseNameLengthLimit || 254) + '.'\n );\n }\n return db + (CFG.addSQLiteExtension !== false ? '.sqlite' : ''); // Shouldn't have quoting (do we even need NUL/case escaping here?)\n}\n\nfunction unescapeUnmatchedSurrogates (arg) {\n return arg\n .replace(/(\\^+)3(d[0-9a-f]{3})/gu, (_, esc, lowSurr) => {\n return esc.length % 2\n ? esc.slice(1) + String.fromCharCode(Number.parseInt(lowSurr, 16))\n : _;\n }).replace(/(\\^+)2(d[0-9a-f]{3})/gu, (_, esc, highSurr) => {\n return esc.length % 2\n ? esc.slice(1) + String.fromCharCode(Number.parseInt(highSurr, 16))\n : _;\n });\n}\n\n// Not in use internally but supplied for convenience\nfunction unescapeDatabaseNameForSQLAndFiles (db) {\n if (CFG.unescapeDatabaseName) {\n // We at least ensure NUL is unescaped by default, but we need to still\n // handle empty string and possibly also length (potentially\n // throwing if too long), unescaping casing (including Unicode?),\n // and unescaping special characters depending on file system\n return CFG.unescapeDatabaseName(unescapeSQLiteResponse(db));\n }\n\n return unescapeUnmatchedSurrogates(\n db.slice(2) // D_\n // CFG.databaseCharacterEscapeList\n .replace(/(\\^+)1([0-9a-f]{2})/gu, (_, esc, hex) => {\n return esc.length % 2\n ? esc.slice(1) + String.fromCharCode(Number.parseInt(hex, 16))\n : _;\n // CFG.escapeNFDForDatabaseNames\n }).replace(/(\\^+)4([0-9a-f]{6})/gu, (_, esc, hex) => {\n return esc.length % 2\n ? esc.slice(1) + String.fromCodePoint(Number.parseInt(hex, 16))\n : _;\n })\n // escapeNameForSQLiteIdentifier (including unescapeUnmatchedSurrogates() above)\n ).replace(/(\\^+)([A-Z])/gu, (_, esc, upperCase) => {\n return esc.length % 2\n ? esc.slice(1) + upperCase\n : _;\n }).replace(/(\\^+)0/gu, (_, esc) => {\n return esc.length % 2\n ? esc.slice(1) + '\\0'\n : _;\n }).replace(/\\^\\^/gu, '^');\n}\n\nfunction escapeStoreNameForSQL (store) {\n return sqlQuote('S' + escapeNameForSQLiteIdentifier(store));\n}\n\nfunction escapeIndexNameForSQL (index) {\n return sqlQuote('I' + escapeNameForSQLiteIdentifier(index));\n}\n\nfunction escapeIndexNameForSQLKeyColumn (index) {\n return 'I' + escapeNameForSQLiteIdentifier(index);\n}\n\nfunction sqlLIKEEscape (str) {\n // https://www.sqlite.org/lang_expr.html#like\n return sqlEscape(str).replace(/\\^/gu, '^^');\n}\n\n// Babel doesn't seem to provide a means of using the `instanceof` operator with Symbol.hasInstance (yet?)\nfunction instanceOf (obj, Clss) {\n return Clss[Symbol.hasInstance](obj);\n}\n\nfunction isObj (obj) {\n return obj && typeof obj === 'object';\n}\n\nfunction isDate (obj) {\n return isObj(obj) && typeof obj.getDate === 'function';\n}\n\nfunction isBlob (obj) {\n return isObj(obj) && typeof obj.size === 'number' && typeof obj.slice === 'function' && !('lastModified' in obj);\n}\n\nfunction isRegExp (obj) {\n return isObj(obj) && typeof obj.flags === 'string' && typeof obj.exec === 'function';\n}\n\nfunction isFile (obj) {\n return isObj(obj) && typeof obj.name === 'string' && typeof obj.slice === 'function' && 'lastModified' in obj;\n}\n\nfunction isBinary (obj) {\n return isObj(obj) && typeof obj.byteLength === 'number' && (\n typeof obj.slice === 'function' || // `TypedArray` (view on buffer) or `ArrayBuffer`\n typeof obj.getFloat64 === 'function' // `DataView` (view on buffer)\n );\n}\n\nfunction isIterable (obj) {\n return isObj(obj) && typeof obj[Symbol.iterator] === 'function';\n}\n\nfunction defineOuterInterface (obj, props) {\n props.forEach((prop) => {\n const o = {\n get [prop] () {\n throw new TypeError('Illegal invocation');\n },\n set [prop] (val) {\n throw new TypeError('Illegal invocation');\n }\n };\n const desc = Object.getOwnPropertyDescriptor(o, prop);\n Object.defineProperty(obj, prop, desc);\n });\n}\n\nfunction defineReadonlyOuterInterface (obj, props) {\n props.forEach((prop) => {\n const o = {\n get [prop] () {\n throw new TypeError('Illegal invocation');\n }\n };\n const desc = Object.getOwnPropertyDescriptor(o, prop);\n Object.defineProperty(obj, prop, desc);\n });\n}\n\nfunction defineListenerProperties (obj, listeners) {\n listeners = typeof listeners === 'string' ? [listeners] : listeners;\n listeners.forEach((listener) => {\n const o = {\n get [listener] () {\n return obj['__' + listener];\n },\n set [listener] (val) {\n obj['__' + listener] = val;\n }\n };\n const desc = Object.getOwnPropertyDescriptor(o, listener);\n // desc.enumerable = true; // Default\n // desc.configurable = true; // Default // Needed by support.js in W3C IndexedDB tests (for openListeners)\n Object.defineProperty(obj, listener, desc);\n });\n listeners.forEach((l) => {\n obj[l] = null;\n });\n}\n\nfunction defineReadonlyProperties (obj, props, getter = null) {\n props = typeof props === 'string' ? [props] : props;\n props.forEach(function (prop) {\n let o;\n if (getter && prop in getter) {\n o = getter[prop];\n } else {\n Object.defineProperty(obj, '__' + prop, {\n enumerable: false,\n configurable: false,\n writable: true\n });\n // We must resort to this to get \"get \" as\n // the function `name` for proper IDL\n o = {\n get [prop] () {\n return this['__' + prop];\n }\n };\n }\n\n const desc = Object.getOwnPropertyDescriptor(o, prop);\n // desc.enumerable = true; // Default\n // desc.configurable = true; // Default\n Object.defineProperty(obj, prop, desc);\n });\n}\n\nfunction isIdentifier (item) {\n // For load-time and run-time performance, we don't provide the complete regular\n // expression for identifiers, but these can be passed in, using the expressions\n // found at https://gist.github.com/brettz9/b4cd6821d990daa023b2e604de371407\n // ID_Start (includes Other_ID_Start)\n const UnicodeIDStart = CFG.UnicodeIDStart || '[$A-Z_a-z]';\n // ID_Continue (includes Other_ID_Continue)\n const UnicodeIDContinue = CFG.UnicodeIDContinue || '[$0-9A-Z_a-z]';\n const IdentifierStart = '(?:' + UnicodeIDStart + '|[$_])';\n const IdentifierPart = '(?:' + UnicodeIDContinue + '|[$_\\u200C\\u200D])';\n return (new RegExp('^' + IdentifierStart + IdentifierPart + '*$', 'u')).test(item);\n}\n\nfunction isValidKeyPathString (keyPathString) {\n return typeof keyPathString === 'string' &&\n (keyPathString === '' || isIdentifier(keyPathString) || keyPathString.split('.').every((pathComponent) => {\n return isIdentifier(pathComponent);\n }));\n}\n\nfunction isValidKeyPath (keyPath) {\n return isValidKeyPathString(keyPath) || (\n Array.isArray(keyPath) && keyPath.length &&\n // Convert array from sparse to dense http://www.2ality.com/2012/06/dense-arrays.html\n // See also https://heycam.github.io/webidl/#idl-DOMString\n [...keyPath].every((pathComponent) => {\n return isValidKeyPathString(pathComponent);\n })\n );\n}\n\nfunction enforceRange (number, type) {\n number = Math.floor(Number(number));\n let max, min;\n switch (type) {\n case 'unsigned long long': {\n max = 0x1FFFFFFFFFFFFF; // 2^53 - 1\n min = 0;\n break;\n }\n case 'unsigned long': {\n max = 0xFFFFFFFF; // 2^32 - 1\n min = 0;\n break;\n }\n default:\n throw new Error('Unrecognized type supplied to enforceRange');\n }\n if (!Number.isFinite(number) ||\n number > max ||\n number < min) {\n throw new TypeError('Invalid range: ' + number);\n }\n return number;\n}\n\nfunction convertToDOMString (v, treatNullAs) {\n return v === null && treatNullAs ? '' : ToString(v);\n}\n\nfunction ToString (o) { // Todo: See `es-abstract/es7`\n // `String()` will not throw with Symbols\n return '' + o; // eslint-disable-line no-implicit-coercion\n}\n\nfunction convertToSequenceDOMString (val) {\n // Per , converting to a sequence works with iterables\n if (isIterable(val)) { // We don't want conversion to array to convert primitives\n // Per , converting to a `DOMString` to be via `ToString`: https://tc39.github.io/ecma262/#sec-tostring\n return [...val].map((item) => {\n return ToString(item);\n });\n }\n return ToString(val);\n}\n\nfunction isNullish (v) {\n return v === null || v === undefined;\n}\n\nfunction hasOwn (obj, prop) {\n return {}.hasOwnProperty.call(obj, prop);\n}\n\n// Todo: Replace with `String.prototype.padStart` when targeting supporting Node version\nfunction padStart (str, ct, fill) {\n return new Array(ct - (String(str)).length + 1).join(fill) + str;\n}\n\nexport {escapeSQLiteStatement, unescapeSQLiteResponse,\n escapeDatabaseNameForSQLAndFiles, unescapeDatabaseNameForSQLAndFiles,\n escapeStoreNameForSQL, escapeIndexNameForSQL, escapeIndexNameForSQLKeyColumn,\n sqlLIKEEscape, sqlQuote,\n instanceOf,\n isObj, isDate, isBlob, isRegExp, isFile, isBinary, isIterable,\n defineOuterInterface, defineReadonlyOuterInterface,\n defineListenerProperties, defineReadonlyProperties,\n isValidKeyPath, enforceRange,\n convertToDOMString, convertToSequenceDOMString,\n isNullish, hasOwn, padStart};\n","import {ShimEventTarget, ShimEvent, ShimCustomEvent} from 'eventtargeter';\nimport * as util from './util.js';\n\n/**\n *\n * @param {string} type\n * @param {Any} debug\n * @param {EventInit} evInit\n * @returns {Event}\n */\nfunction createEvent (type, debug, evInit) {\n const ev = new ShimEvent(type, evInit);\n ev.debug = debug;\n return ev;\n}\n\n// We don't add within polyfill repo as might not always be the desired implementation\nObject.defineProperty(ShimEvent, Symbol.hasInstance, {\n value: (obj) => util.isObj(obj) && 'target' in obj && typeof obj.bubbles === 'boolean'\n});\n\nexport {createEvent, ShimEvent, ShimCustomEvent, ShimEventTarget};\n","import {ShimEvent} from './Event.js';\nimport * as util from './util.js';\n\nconst readonlyProperties = ['oldVersion', 'newVersion'];\n\n// Babel apparently having a problem adding `hasInstance` to a class, so we are redefining as a function\nfunction IDBVersionChangeEvent (type /* , eventInitDict */) { // eventInitDict is a IDBVersionChangeEventInit (but is not defined as a global)\n ShimEvent.call(this, type);\n this[Symbol.toStringTag] = 'IDBVersionChangeEvent';\n this.toString = function () {\n return '[object IDBVersionChangeEvent]';\n };\n // eslint-disable-next-line prefer-rest-params\n this.__eventInitDict = arguments[1] || {};\n}\n\nIDBVersionChangeEvent.prototype = Object.create(ShimEvent.prototype);\n\nIDBVersionChangeEvent.prototype[Symbol.toStringTag] = 'IDBVersionChangeEventPrototype';\n\nreadonlyProperties.forEach((prop) => {\n // Ensure for proper interface testing that \"get \" is the function name\n const o = {\n get [prop] () {\n if (!(this instanceof IDBVersionChangeEvent)) {\n throw new TypeError('Illegal invocation');\n }\n return (this.__eventInitDict && this.__eventInitDict[prop]) || (prop === 'oldVersion' ? 0 : null);\n }\n };\n const desc = Object.getOwnPropertyDescriptor(o, prop);\n // desc.enumerable = true; // Default\n // desc.configurable = true; // Default\n Object.defineProperty(IDBVersionChangeEvent.prototype, prop, desc);\n});\n\nObject.defineProperty(IDBVersionChangeEvent, Symbol.hasInstance, {\n value: (obj) => util.isObj(obj) && 'oldVersion' in obj && typeof obj.defaultPrevented === 'boolean'\n});\n\nObject.defineProperty(IDBVersionChangeEvent.prototype, 'constructor', {\n enumerable: false,\n writable: true,\n configurable: true,\n value: IDBVersionChangeEvent\n});\n\nObject.defineProperty(IDBVersionChangeEvent, 'prototype', {\n writable: false\n});\n\nexport default IDBVersionChangeEvent;\n","/* globals DOMException */\nimport CFG from './CFG.js';\n\n/**\n * Creates a native DOMException, for browsers that support it.\n * @param {string} name\n * @param {string} message\n * @returns {DOMException}\n */\nfunction createNativeDOMException (name, message) {\n return new DOMException.prototype.constructor(\n message,\n name || 'DOMException'\n );\n}\n\n// From web-platform-tests testharness.js name_code_map (though not in new spec)\nconst codes = {\n IndexSizeError: 1,\n HierarchyRequestError: 3,\n WrongDocumentError: 4,\n InvalidCharacterError: 5,\n NoModificationAllowedError: 7,\n NotFoundError: 8,\n NotSupportedError: 9,\n InUseAttributeError: 10,\n InvalidStateError: 11,\n SyntaxError: 12,\n InvalidModificationError: 13,\n NamespaceError: 14,\n InvalidAccessError: 15,\n TypeMismatchError: 17,\n SecurityError: 18,\n NetworkError: 19,\n AbortError: 20,\n URLMismatchError: 21,\n QuotaExceededError: 22,\n TimeoutError: 23,\n InvalidNodeTypeError: 24,\n DataCloneError: 25,\n\n EncodingError: 0,\n NotReadableError: 0,\n UnknownError: 0,\n ConstraintError: 0,\n DataError: 0,\n TransactionInactiveError: 0,\n ReadOnlyError: 0,\n VersionError: 0,\n OperationError: 0,\n NotAllowedError: 0\n};\n\nconst legacyCodes = {\n INDEX_SIZE_ERR: 1,\n DOMSTRING_SIZE_ERR: 2,\n HIERARCHY_REQUEST_ERR: 3,\n WRONG_DOCUMENT_ERR: 4,\n INVALID_CHARACTER_ERR: 5,\n NO_DATA_ALLOWED_ERR: 6,\n NO_MODIFICATION_ALLOWED_ERR: 7,\n NOT_FOUND_ERR: 8,\n NOT_SUPPORTED_ERR: 9,\n INUSE_ATTRIBUTE_ERR: 10,\n INVALID_STATE_ERR: 11,\n SYNTAX_ERR: 12,\n INVALID_MODIFICATION_ERR: 13,\n NAMESPACE_ERR: 14,\n INVALID_ACCESS_ERR: 15,\n VALIDATION_ERR: 16,\n TYPE_MISMATCH_ERR: 17,\n SECURITY_ERR: 18,\n NETWORK_ERR: 19,\n ABORT_ERR: 20,\n URL_MISMATCH_ERR: 21,\n QUOTA_EXCEEDED_ERR: 22,\n TIMEOUT_ERR: 23,\n INVALID_NODE_TYPE_ERR: 24,\n DATA_CLONE_ERR: 25\n};\n\n/**\n *\n * @returns {DOMException}\n */\nfunction createNonNativeDOMExceptionClass () {\n function DOMException (message, name) {\n // const err = Error.prototype.constructor.call(this, message); // Any use to this? Won't set this.message\n this[Symbol.toStringTag] = 'DOMException';\n this._code = name in codes ? codes[name] : (legacyCodes[name] || 0);\n this._name = name || 'Error';\n // We avoid `String()` in this next line as it converts Symbols\n this._message = message === undefined ? '' : ('' + message); // eslint-disable-line no-implicit-coercion\n Object.defineProperty(this, 'code', {\n configurable: true,\n enumerable: true,\n writable: true,\n value: this._code\n });\n if (name !== undefined) {\n Object.defineProperty(this, 'name', {\n configurable: true,\n enumerable: true,\n writable: true,\n value: this._name\n });\n }\n if (message !== undefined) {\n Object.defineProperty(this, 'message', {\n configurable: true,\n enumerable: false,\n writable: true,\n value: this._message\n });\n }\n }\n\n // Necessary for W3C tests which complains if `DOMException` has properties on its \"own\" prototype\n\n // class DummyDOMException extends Error {}; // Sometimes causing problems in Node\n // eslint-disable-next-line func-name-matching\n const DummyDOMException = function DOMException () { /* */ };\n DummyDOMException.prototype = Object.create(Error.prototype); // Intended for subclassing\n ['name', 'message'].forEach((prop) => {\n Object.defineProperty(DummyDOMException.prototype, prop, {\n enumerable: true,\n get () {\n if (!(this instanceof DOMException ||\n this instanceof DummyDOMException ||\n this instanceof Error)) {\n throw new TypeError('Illegal invocation');\n }\n return this['_' + prop];\n }\n });\n });\n // DOMException uses the same `toString` as `Error`\n Object.defineProperty(DummyDOMException.prototype, 'code', {\n configurable: true,\n enumerable: true,\n get () {\n throw new TypeError('Illegal invocation');\n }\n });\n DOMException.prototype = new DummyDOMException();\n\n DOMException.prototype[Symbol.toStringTag] = 'DOMExceptionPrototype';\n Object.defineProperty(DOMException, 'prototype', {\n writable: false\n });\n\n Object.keys(codes).forEach((codeName) => {\n Object.defineProperty(DOMException.prototype, codeName, {\n enumerable: true,\n configurable: false,\n value: codes[codeName]\n });\n Object.defineProperty(DOMException, codeName, {\n enumerable: true,\n configurable: false,\n value: codes[codeName]\n });\n });\n Object.keys(legacyCodes).forEach((codeName) => {\n Object.defineProperty(DOMException.prototype, codeName, {\n enumerable: true,\n configurable: false,\n value: legacyCodes[codeName]\n });\n Object.defineProperty(DOMException, codeName, {\n enumerable: true,\n configurable: false,\n value: legacyCodes[codeName]\n });\n });\n Object.defineProperty(DOMException.prototype, 'constructor', {\n writable: true,\n configurable: true,\n enumerable: false,\n value: DOMException\n });\n\n return DOMException;\n}\n\nconst ShimNonNativeDOMException = createNonNativeDOMExceptionClass();\n\n/**\n * Creates a generic Error object.\n * @param {string} name\n * @param {string} message\n * @returns {Error}\n */\nfunction createNonNativeDOMException (name, message) {\n return new ShimNonNativeDOMException(message, name);\n}\n\n/**\n * Logs detailed error information to the console.\n * @param {string} name\n * @param {string} message\n * @param {string|Error|null} error\n * @returns {void}\n */\nfunction logError (name, message, error) {\n if (CFG.DEBUG) {\n if (error && error.message) {\n error = error.message;\n }\n\n const method = typeof (console.error) === 'function' ? 'error' : 'log';\n console[method](name + ': ' + message + '. ' + (error || ''));\n console.trace && console.trace();\n }\n}\n\nfunction isErrorOrDOMErrorOrDOMException (obj) {\n return obj && typeof obj === 'object' && // We don't use util.isObj here as mutual dependency causing problems in Babel with browser\n typeof obj.name === 'string';\n}\n\n/**\n * Finds the error argument. This is useful because some WebSQL callbacks\n * pass the error as the first argument, and some pass it as the second\n * argument.\n * @param {Array} args\n * @returns {Error|DOMException|undefined}\n */\nfunction findError (args) {\n let err;\n if (args) {\n if (args.length === 1) {\n return args[0];\n }\n for (const arg of args) {\n if (isErrorOrDOMErrorOrDOMException(arg)) {\n return arg;\n }\n if (arg && typeof arg.message === 'string') {\n err = arg;\n }\n }\n }\n return err;\n}\n\n/**\n *\n * @param {external:WebSQLError} webSQLErr\n * @returns {DOMException}\n */\nfunction webSQLErrback (webSQLErr) {\n let name, message;\n switch (webSQLErr.code) {\n case 4: { // SQLError.QUOTA_ERR\n name = 'QuotaExceededError';\n message = 'The operation failed because there was not enough ' +\n 'remaining storage space, or the storage quota was reached ' +\n 'and the user declined to give more space to the database.';\n break;\n }\n /*\n // Should a WebSQL timeout treat as IndexedDB `TransactionInactiveError` or `UnknownError`?\n case 7: { // SQLError.TIMEOUT_ERR\n // All transaction errors abort later, so no need to mark inactive\n name = 'TransactionInactiveError';\n message = 'A request was placed against a transaction which is currently not active, or which is finished (Internal SQL Timeout).';\n break;\n }\n */\n default: {\n name = 'UnknownError';\n message = 'The operation failed for reasons unrelated to the database itself and not covered by any other errors.';\n break;\n }\n }\n message += ' (' + webSQLErr.message + ')--(' + webSQLErr.code + ')';\n const err = createDOMException(name, message);\n err.sqlError = webSQLErr;\n return err;\n}\n\nlet test, useNativeDOMException = false;\n\n// Test whether we can use the browser's native DOMException class\ntry {\n test = createNativeDOMException('test name', 'test message');\n if (isErrorOrDOMErrorOrDOMException(test) && test.name === 'test name' && test.message === 'test message') {\n // Native DOMException works as expected\n useNativeDOMException = true;\n }\n} catch (e) {}\n\nconst createDOMException = useNativeDOMException\n ? function (name, message, error) {\n logError(name, message, error);\n return createNativeDOMException(name, message);\n }\n : function (name, message, error) {\n logError(name, message, error);\n return createNonNativeDOMException(name, message);\n };\n\nconst ShimDOMException = useNativeDOMException\n ? DOMException\n : ShimNonNativeDOMException;\n\nexport {logError, findError, ShimDOMException, createDOMException, webSQLErrback};\n","import {EventTargetFactory} from 'eventtargeter';\nimport {createDOMException} from './DOMException.js';\nimport * as util from './util.js';\n\nconst listeners = ['onsuccess', 'onerror'];\nconst readonlyProperties = ['source', 'transaction', 'readyState'];\nconst doneFlagGetters = ['result', 'error'];\n\n/**\n * The IDBRequest Object that is returns for all async calls.\n * @see http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#request-api\n * @class\n */\nfunction IDBRequest () {\n throw new TypeError('Illegal constructor');\n}\n// eslint-disable-next-line func-name-matching\nIDBRequest.__super = function IDBRequest () {\n this[Symbol.toStringTag] = 'IDBRequest';\n this.__setOptions({\n legacyOutputDidListenersThrowFlag: true // Event hook for IndexedB\n });\n doneFlagGetters.forEach(function (prop) {\n Object.defineProperty(this, '__' + prop, {\n enumerable: false,\n configurable: false,\n writable: true\n });\n Object.defineProperty(this, prop, {\n enumerable: true,\n configurable: true,\n get () {\n if (!this.__done) {\n throw createDOMException('InvalidStateError', \"Can't get \" + prop + '; the request is still pending.');\n }\n return this['__' + prop];\n }\n });\n }, this);\n util.defineReadonlyProperties(this, readonlyProperties, {\n readyState: {\n get readyState () {\n return this.__done ? 'done' : 'pending';\n }\n }\n });\n util.defineListenerProperties(this, listeners);\n\n this.__result = undefined;\n this.__error = this.__source = this.__transaction = null;\n this.__done = false;\n};\n\nIDBRequest.__createInstance = function () {\n return new IDBRequest.__super();\n};\n\nIDBRequest.prototype = EventTargetFactory.createInstance({extraProperties: ['debug']});\nIDBRequest.prototype[Symbol.toStringTag] = 'IDBRequestPrototype';\n\nIDBRequest.prototype.__getParent = function () {\n if (this.toString() === '[object IDBOpenDBRequest]') {\n return null;\n }\n return this.__transaction;\n};\n\n// Illegal invocations\nutil.defineReadonlyOuterInterface(IDBRequest.prototype, readonlyProperties);\nutil.defineReadonlyOuterInterface(IDBRequest.prototype, doneFlagGetters);\n\nutil.defineOuterInterface(IDBRequest.prototype, listeners);\n\nObject.defineProperty(IDBRequest.prototype, 'constructor', {\n enumerable: false,\n writable: true,\n configurable: true,\n value: IDBRequest\n});\nIDBRequest.__super.prototype = IDBRequest.prototype;\n\nObject.defineProperty(IDBRequest, 'prototype', {\n writable: false\n});\n\nconst openListeners = ['onblocked', 'onupgradeneeded'];\n\n/**\n * The IDBOpenDBRequest called when a database is opened.\n * @class\n */\nfunction IDBOpenDBRequest () {\n throw new TypeError('Illegal constructor');\n}\nIDBOpenDBRequest.prototype = Object.create(IDBRequest.prototype);\n\nObject.defineProperty(IDBOpenDBRequest.prototype, 'constructor', {\n enumerable: false,\n writable: true,\n configurable: true,\n value: IDBOpenDBRequest\n});\n\nconst IDBOpenDBRequestAlias = IDBOpenDBRequest;\nIDBOpenDBRequest.__createInstance = function () {\n function IDBOpenDBRequest () {\n IDBRequest.__super.call(this);\n\n this[Symbol.toStringTag] = 'IDBOpenDBRequest';\n this.__setOptions({\n legacyOutputDidListenersThrowFlag: true, // Event hook for IndexedB\n extraProperties: ['oldVersion', 'newVersion', 'debug']\n }); // Ensure EventTarget preserves our properties\n util.defineListenerProperties(this, openListeners);\n }\n IDBOpenDBRequest.prototype = IDBOpenDBRequestAlias.prototype;\n return new IDBOpenDBRequest();\n};\n\nutil.defineOuterInterface(IDBOpenDBRequest.prototype, openListeners);\n\nIDBOpenDBRequest.prototype[Symbol.toStringTag] = 'IDBOpenDBRequestPrototype';\n\nObject.defineProperty(IDBOpenDBRequest, 'prototype', {\n writable: false\n});\n\nexport {IDBRequest, IDBOpenDBRequest};\n","// Since [immediate](https://github.com/calvinmetcalf/immediate) is\n// not doing the trick for our WebSQL transactions (at least in Node),\n// we are forced to make the promises run fully synchronously.\n\nfunction isPromise(p) {\n return p && typeof p.then === 'function';\n}\nfunction addReject(prom, reject) {\n prom.then(null, reject) // Use this style for sake of non-Promise thenables (e.g., jQuery Deferred)\n}\n\n// States\nvar PENDING = 2,\n FULFILLED = 0, // We later abuse these as array indices\n REJECTED = 1;\n\nfunction SyncPromise(fn) {\n var self = this;\n self.v = 0; // Value, this will be set to either a resolved value or rejected reason\n self.s = PENDING; // State of the promise\n self.c = [[],[]]; // Callbacks c[0] is fulfillment and c[1] contains rejection callbacks\n function transist(val, state) {\n self.v = val;\n self.s = state;\n self.c[state].forEach(function(fn) { fn(val); });\n // Release memory, but if no handlers have been added, as we\n // assume that we will resolve/reject (truly) synchronously\n // and thus we avoid flagging checks about whether we've\n // already resolved/rejected.\n if (self.c[state].length) self.c = null;\n }\n function resolve(val) {\n if (!self.c) {\n // Already resolved (or will be resolved), do nothing.\n } else if (isPromise(val)) {\n addReject(val.then(resolve), reject);\n } else {\n transist(val, FULFILLED);\n }\n }\n function reject(reason) {\n if (!self.c) {\n // Already resolved (or will be resolved), do nothing.\n } else if (isPromise(reason)) {\n addReject(reason.then(reject), reject);\n } else {\n transist(reason, REJECTED);\n }\n }\n try {\n fn(resolve, reject);\n } catch (err) {\n reject(err);\n }\n}\n\nvar prot = SyncPromise.prototype;\n\nprot.then = function(cb, errBack) {\n var self = this;\n return new SyncPromise(function(resolve, reject) {\n var rej = typeof errBack === 'function' ? errBack : reject;\n function settle() {\n try {\n resolve(cb ? cb(self.v) : self.v);\n } catch(e) {\n rej(e);\n }\n }\n if (self.s === FULFILLED) {\n settle();\n } else if (self.s === REJECTED) {\n rej(self.v);\n } else {\n self.c[FULFILLED].push(settle);\n self.c[REJECTED].push(rej);\n }\n });\n};\n\nprot.catch = function(cb) {\n var self = this;\n return new SyncPromise(function(resolve, reject) {\n function settle() {\n try {\n resolve(cb(self.v));\n } catch(e) {\n reject(e);\n }\n }\n if (self.s === REJECTED) {\n settle();\n } else if (self.s === FULFILLED) {\n resolve(self.v);\n } else {\n self.c[REJECTED].push(settle);\n self.c[FULFILLED].push(resolve);\n }\n });\n};\n\nSyncPromise.all = function(promises) {\n return new SyncPromise(function(resolve, reject, l) {\n l = promises.length;\n var hasPromises = false;\n var newPromises = [];\n if (!l) {\n resolve(newPromises);\n return;\n }\n promises.forEach(function(p, i) {\n if (isPromise(p)) {\n addReject(p.then(function(res) {\n newPromises[i] = res;\n --l || resolve(newPromises);\n }), reject);\n } else {\n newPromises[i] = p;\n --l || resolve(promises);\n }\n });\n });\n};\n\nSyncPromise.race = function(promises) {\n var resolved = false;\n return new SyncPromise(function(resolve, reject) {\n promises.some(function(p, i) {\n if (isPromise(p)) {\n addReject(p.then(function(res) {\n if (resolved) {\n return;\n }\n resolve(res);\n resolved = true;\n }), reject);\n } else {\n resolve(p);\n resolved = true;\n return true;\n }\n });\n });\n};\n\nSyncPromise.resolve = function(val) {\n return new SyncPromise(function(resolve, reject) {\n resolve(val);\n });\n};\n\nSyncPromise.reject = function(val) {\n return new SyncPromise(function(resolve, reject) {\n reject(val);\n });\n};\nmodule.exports = SyncPromise;\n","import CFG from './CFG.js';\nimport {encode as keyEncode, decode as keyDecode} from './Key.js';\n\n/**\n * Compares two keys.\n * @param first\n * @param second\n * @returns {number}\n */\nfunction cmp (first, second) {\n const encodedKey1 = keyEncode(first);\n const encodedKey2 = keyEncode(second);\n const result = encodedKey1 > encodedKey2\n ? 1\n : encodedKey1 === encodedKey2 ? 0 : -1;\n\n if (CFG.DEBUG) {\n // verify that the keys encoded correctly\n let decodedKey1 = keyDecode(encodedKey1);\n let decodedKey2 = keyDecode(encodedKey2);\n if (typeof first === 'object') {\n first = JSON.stringify(first);\n decodedKey1 = JSON.stringify(decodedKey1);\n }\n if (typeof second === 'object') {\n second = JSON.stringify(second);\n decodedKey2 = JSON.stringify(decodedKey2);\n }\n\n // Encoding/decoding mismatches are usually due to a loss of\n // floating-point precision\n if (decodedKey1 !== first) {\n console.warn(\n first + ' was incorrectly encoded as ' + decodedKey1\n );\n }\n if (decodedKey2 !== second) {\n console.warn(\n second + ' was incorrectly encoded as ' + decodedKey2\n );\n }\n }\n\n return result;\n}\n\nexport default cmp;\n","import {createDOMException} from './DOMException.js';\nimport * as util from './util.js';\nimport cmp from './cmp.js';\nimport CFG from './CFG.js';\n\n/**\n * @module Key\n */\n\n/**\n * Encodes the keys based on their types. This is required to maintain collations\n * We leave space for future keys.\n */\nconst keyTypeToEncodedChar = {\n invalid: 100,\n number: 200,\n date: 300,\n string: 400,\n binary: 500,\n array: 600\n};\nconst keyTypes = Object.keys(keyTypeToEncodedChar);\nkeyTypes.forEach((k) => {\n keyTypeToEncodedChar[k] = String.fromCharCode(keyTypeToEncodedChar[k]);\n});\n\nconst encodedCharToKeyType = keyTypes.reduce((o, k) => {\n o[keyTypeToEncodedChar[k]] = k;\n return o;\n}, {});\n\n/**\n * The sign values for numbers, ordered from least to greatest.\n * - \"negativeInfinity\": Sorts below all other values.\n * - \"bigNegative\": Negative values less than or equal to negative one.\n * - \"smallNegative\": Negative values between negative one and zero, noninclusive.\n * - \"smallPositive\": Positive values between zero and one, including zero but not one.\n * - \"largePositive\": Positive values greater than or equal to one.\n * - \"positiveInfinity\": Sorts above all other values.\n */\nconst signValues = ['negativeInfinity', 'bigNegative', 'smallNegative', 'smallPositive', 'bigPositive', 'positiveInfinity'];\n\nconst types = {\n invalid: {\n encode (key) {\n return keyTypeToEncodedChar.invalid + '-';\n },\n decode (key) {\n return undefined;\n }\n },\n\n // Numbers are represented in a lexically sortable base-32 sign-exponent-mantissa\n // notation.\n //\n // sign: takes a value between zero and five, inclusive. Represents infinite cases\n // and the signs of both the exponent and the fractional part of the number.\n // exponent: padded to two base-32 digits, represented by the 32's compliment in the\n // \"smallPositive\" and \"bigNegative\" cases to ensure proper lexical sorting.\n // mantissa: also called the fractional part. Normed 11-digit base-32 representation.\n // Represented by the 32's compliment in the \"smallNegative\" and \"bigNegative\"\n // cases to ensure proper lexical sorting.\n number: {\n // The encode step checks for six numeric cases and generates 14-digit encoded\n // sign-exponent-mantissa strings.\n encode (key) {\n let key32 = key === Number.MIN_VALUE\n // Mocha test `IDBFactory/cmp-spec.js` exposed problem for some\n // Node (and Chrome) versions with `Number.MIN_VALUE` being treated\n // as 0\n // https://stackoverflow.com/questions/43305403/number-min-value-and-tostring\n ? '0.' + '0'.repeat(214) + '2'\n : Math.abs(key).toString(32);\n // Get the index of the decimal.\n const decimalIndex = key32.indexOf('.');\n // Remove the decimal.\n key32 = (decimalIndex !== -1) ? key32.replace('.', '') : key32;\n // Get the index of the first significant digit.\n const significantDigitIndex = key32.search(/[^0]/u);\n // Truncate leading zeros.\n key32 = key32.slice(significantDigitIndex);\n let sign, exponent, mantissa;\n\n // Finite cases:\n if (Number.isFinite(\n Number(key)\n )) {\n // Negative cases:\n if (key < 0) {\n // Negative exponent case:\n if (key > -1) {\n sign = signValues.indexOf('smallNegative');\n exponent = padBase32Exponent(significantDigitIndex);\n mantissa = flipBase32(padBase32Mantissa(key32));\n // Non-negative exponent case:\n } else {\n sign = signValues.indexOf('bigNegative');\n exponent = flipBase32(padBase32Exponent(\n (decimalIndex !== -1) ? decimalIndex : key32.length\n ));\n mantissa = flipBase32(padBase32Mantissa(key32));\n }\n // Non-negative cases:\n // Negative exponent case:\n } else if (key < 1) {\n sign = signValues.indexOf('smallPositive');\n exponent = flipBase32(padBase32Exponent(significantDigitIndex));\n mantissa = padBase32Mantissa(key32);\n // Non-negative exponent case:\n } else {\n sign = signValues.indexOf('bigPositive');\n exponent = padBase32Exponent(\n (decimalIndex !== -1) ? decimalIndex : key32.length\n );\n mantissa = padBase32Mantissa(key32);\n }\n // Infinite cases:\n } else {\n exponent = zeros(2);\n mantissa = zeros(11);\n sign = signValues.indexOf(\n key > 0 ? 'positiveInfinity' : 'negativeInfinity'\n );\n }\n\n return keyTypeToEncodedChar.number + '-' + sign + exponent + mantissa;\n },\n // The decode step must interpret the sign, reflip values encoded as the 32's complements,\n // apply signs to the exponent and mantissa, do the base-32 power operation, and return\n // the original JavaScript number values.\n decode (key) {\n const sign = Number(key.slice(2, 3));\n let exponent = key.slice(3, 5);\n let mantissa = key.slice(5, 16);\n\n switch (signValues[sign]) {\n case 'negativeInfinity':\n return -Infinity;\n case 'positiveInfinity':\n return Infinity;\n case 'bigPositive':\n return pow32(mantissa, exponent);\n case 'smallPositive':\n exponent = negate(flipBase32(exponent));\n return pow32(mantissa, exponent);\n case 'smallNegative':\n exponent = negate(exponent);\n mantissa = flipBase32(mantissa);\n return -pow32(mantissa, exponent);\n case 'bigNegative':\n exponent = flipBase32(exponent);\n mantissa = flipBase32(mantissa);\n return -pow32(mantissa, exponent);\n default:\n throw new Error('Invalid number.');\n }\n }\n },\n\n // Strings are encoded as JSON strings (with quotes and unicode characters escaped).\n //\n // If the strings are in an array, then some extra encoding is done to make sorting work correctly:\n // Since we can't force all strings to be the same length, we need to ensure that characters line-up properly\n // for sorting, while also accounting for the extra characters that are added when the array itself is encoded as JSON.\n // To do this, each character of the string is prepended with a dash (\"-\"), and a space is added to the end of the string.\n // This effectively doubles the size of every string, but it ensures that when two arrays of strings are compared,\n // the indexes of each string's characters line up with each other.\n string: {\n encode (key, inArray) {\n if (inArray) {\n // prepend each character with a dash, and append a space to the end\n key = key.replace(/(.)/gu, '-$1') + ' ';\n }\n return keyTypeToEncodedChar.string + '-' + key;\n },\n decode (key, inArray) {\n key = key.slice(2);\n if (inArray) {\n // remove the space at the end, and the dash before each character\n key = key.slice(0, -1).replace(/-(.)/gu, '$1');\n }\n return key;\n }\n },\n\n // Arrays are encoded as JSON strings.\n // An extra, value is added to each array during encoding to make\n // empty arrays sort correctly.\n array: {\n encode (key) {\n const encoded = [];\n for (const [i, item] of key.entries()) {\n const encodedItem = encode(item, true); // encode the array item\n encoded[i] = encodedItem;\n }\n encoded.push(keyTypeToEncodedChar.invalid + '-'); // append an extra item, so empty arrays sort correctly\n return keyTypeToEncodedChar.array + '-' + JSON.stringify(encoded);\n },\n decode (key) {\n const decoded = JSON.parse(key.slice(2));\n decoded.pop(); // remove the extra item\n for (let i = 0; i < decoded.length; i++) {\n const item = decoded[i];\n const decodedItem = decode(item, true); // decode the item\n decoded[i] = decodedItem;\n }\n return decoded;\n }\n },\n\n // Dates are encoded as ISO 8601 strings, in UTC time zone.\n date: {\n encode (key) {\n return keyTypeToEncodedChar.date + '-' + key.toJSON();\n },\n decode (key) {\n return new Date(key.slice(2));\n }\n },\n binary: {\n // `ArrayBuffer`/Views on buffers (`TypedArray` or `DataView`)\n encode (key) {\n return keyTypeToEncodedChar.binary + '-' + (key.byteLength\n ? [...getCopyBytesHeldByBufferSource(key)].map((b) => util.padStart(b, 3, '0')) // e.g., '255,005,254,000,001,033'\n : '');\n },\n decode (key) {\n // Set the entries in buffer's [[ArrayBufferData]] to those in `value`\n const k = key.slice(2);\n const arr = k.length ? k.split(',').map((s) => Number.parseInt(s)) : [];\n const buffer = new ArrayBuffer(arr.length);\n const uint8 = new Uint8Array(buffer);\n uint8.set(arr);\n return buffer;\n }\n }\n};\n\n/**\n * Return a padded base-32 exponent value.\n * @param {number} n\n * @returns {string}\n */\nfunction padBase32Exponent (n) {\n n = n.toString(32);\n return (n.length === 1) ? '0' + n : n;\n}\n\n/**\n * Return a padded base-32 mantissa.\n * @param {string} s\n * @returns {string}\n */\nfunction padBase32Mantissa (s) {\n return (s + zeros(11)).slice(0, 11);\n}\n\n/**\n * Flips each digit of a base-32 encoded string.\n * @param {string} encoded\n * @returns {string}\n */\nfunction flipBase32 (encoded) {\n let flipped = '';\n for (const ch of encoded) {\n flipped += (31 - Number.parseInt(ch, 32)).toString(32);\n }\n return flipped;\n}\n\n/**\n * Base-32 power function.\n * RESEARCH: This function does not precisely decode floats because it performs\n * floating point arithmetic to recover values. But can the original values be\n * recovered exactly?\n * Someone may have already figured out a good way to store JavaScript floats as\n * binary strings and convert back. Barring a better method, however, one route\n * may be to generate decimal strings that `parseFloat` decodes predictably.\n * @param {string} mantissa\n * @param {string} exponent\n * @returns {number}\n */\nfunction pow32 (mantissa, exponent) {\n exponent = Number.parseInt(exponent, 32);\n if (exponent < 0) {\n return roundToPrecision(\n Number.parseInt(mantissa, 32) * (32 ** (exponent - 10))\n );\n }\n if (exponent < 11) {\n let whole = mantissa.slice(0, exponent);\n whole = Number.parseInt(whole, 32);\n let fraction = mantissa.slice(exponent);\n fraction = Number.parseInt(fraction, 32) * (32 ** (exponent - 11));\n return roundToPrecision(whole + fraction);\n }\n const expansion = mantissa + zeros(exponent - 11);\n return Number.parseInt(expansion, 32);\n}\n\n/**\n * @param {Float} num\n * @param {Float} precision\n * @returns {Float}\n */\nfunction roundToPrecision (num, precision) {\n precision = precision || 16;\n return Number.parseFloat(num.toPrecision(precision));\n}\n\n/**\n * Returns a string of n zeros.\n * @param {number} n\n * @returns {string}\n */\nfunction zeros (n) {\n return '0'.repeat(n);\n}\n\n/**\n * Negates numeric strings.\n * @param {string} s\n * @returns {string}\n */\nfunction negate (s) {\n return '-' + s;\n}\n\n/**\n* @typedef {\"number\"|\"date\"|\"string\"|\"binary\"|\"array\"} module:Key.KeyType\n*/\n\n/**\n * @param key\n * @returns {module:Key.KeyType}\n */\nfunction getKeyType (key) {\n if (Array.isArray(key)) return 'array';\n if (util.isDate(key)) return 'date';\n if (util.isBinary(key)) return 'binary';\n const keyType = typeof key;\n return ['string', 'number'].includes(keyType) ? keyType : 'invalid';\n}\n\n/**\n * Keys must be strings, numbers (besides `NaN`), Dates (if value is not\n * `NaN`), binary objects or Arrays.\n * @param input The key input\n * @param {?(Array)} [seen] An array of already seen keys\n * @returns {module:Key.keyValueObject}\n */\nfunction convertValueToKey (input, seen) {\n return convertValueToKeyValueDecoded(input, seen, false, true);\n}\n\n/**\n* Currently not in use.\n* @param input\n* @returns {module:Key.keyValueObject}\n*/\nfunction convertValueToMultiEntryKey (input) {\n return convertValueToKeyValueDecoded(input, null, true, true);\n}\n\n/**\n *\n * @param O\n * @throws {TypeError}\n * @see https://heycam.github.io/webidl/#ref-for-dfn-get-buffer-source-copy-2\n * @returns {Uint8Array}\n */\nfunction getCopyBytesHeldByBufferSource (O) {\n let offset = 0;\n let length = 0;\n if (ArrayBuffer.isView(O)) { // Has [[ViewedArrayBuffer]] internal slot\n const arrayBuffer = O.buffer;\n if (arrayBuffer === undefined) {\n throw new TypeError(\n 'Could not copy the bytes held by a buffer source as the buffer was undefined.'\n );\n }\n offset = O.byteOffset; // [[ByteOffset]] (will also throw as desired if detached)\n length = O.byteLength; // [[ByteLength]] (will also throw as desired if detached)\n } else {\n length = O.byteLength; // [[ArrayBufferByteLength]] on ArrayBuffer (will also throw as desired if detached)\n }\n // const octets = new Uint8Array(input);\n // const octets = types.binary.decode(types.binary.encode(input));\n return new Uint8Array(O.buffer || O, offset, length);\n}\n\n/**\n* @typedef {PlainObject} module:Key.keyValueObject\n* @property {module:Key.KeyType|\"NaN\"} type\n* @property {*} [value]\n* @property {boolean} [invalid]\n* @property {string} [message]\n* @todo Specify acceptable `value` more precisely\n*/\n\n/**\n* Shortcut utility to avoid returning full keys from `convertValueToKey`\n* and subsequent need to process in calling code unless `fullKeys` is\n* set; may throw.\n* @param {module:Key.Key} input\n* @param {?(Array)} [seen]\n* @param {boolean} [multiEntry]\n* @param {boolean} [fullKeys]\n* @throws {TypeError} See `getCopyBytesHeldByBufferSource`\n* @todo Document other allowable `input`\n* @returns {module:Key.keyValueObject}\n*/\nfunction convertValueToKeyValueDecoded (input, seen, multiEntry, fullKeys) {\n seen = seen || [];\n if (seen.includes(input)) {\n return {\n type: 'array',\n invalid: true,\n message: 'An array key cannot be circular'\n };\n }\n const type = getKeyType(input);\n const ret = {type, value: input};\n switch (type) {\n case 'number': {\n if (Number.isNaN(input)) {\n // List as 'NaN' type for convenience of consumers in reporting errors\n return {type: 'NaN', invalid: true};\n }\n return ret;\n } case 'string': {\n return ret;\n } case 'binary': { // May throw (if detached)\n // Get a copy of the bytes held by the buffer source\n // https://heycam.github.io/webidl/#ref-for-dfn-get-buffer-source-copy-2\n const octets = getCopyBytesHeldByBufferSource(input);\n return {type: 'binary', value: octets};\n } case 'array': { // May throw (from binary)\n const len = input.length;\n seen.push(input);\n const keys = [];\n for (let i = 0; i < len; i++) { // We cannot iterate here with array extras as we must ensure sparse arrays are invalidated\n if (!multiEntry && !Object.prototype.hasOwnProperty.call(input, i)) {\n return {type, invalid: true, message: 'Does not have own index property'};\n }\n try {\n const entry = input[i];\n const key = convertValueToKeyValueDecoded(entry, seen, false, fullKeys); // Though steps do not list rethrowing, the next is returnifabrupt when not multiEntry\n if (key.invalid) {\n if (multiEntry) {\n continue;\n }\n return {type, invalid: true, message: 'Bad array entry value-to-key conversion'};\n }\n if (!multiEntry ||\n (!fullKeys && keys.every((k) => cmp(k, key.value) !== 0)) ||\n (fullKeys && keys.every((k) => cmp(k, key) !== 0))\n ) {\n keys.push(fullKeys ? key : key.value);\n }\n } catch (err) {\n if (!multiEntry) {\n throw err;\n }\n }\n }\n return {type, value: keys};\n } case 'date': {\n if (!Number.isNaN(input.getTime())) {\n return fullKeys\n ? {type, value: input.getTime()}\n : {type, value: new Date(input.getTime())};\n }\n return {type, invalid: true, message: 'Not a valid date'};\n // Falls through\n } case 'invalid': default: {\n // Other `typeof` types which are not valid keys:\n // 'undefined', 'boolean', 'object' (including `null`), 'symbol', 'function\n const type = input === null ? 'null' : typeof input; // Convert `null` for convenience of consumers in reporting errors\n return {type, invalid: true, message: 'Not a valid key; type ' + type};\n }\n }\n}\n\n/**\n* @typedef {*} module:Key.Key\n* @todo Specify possible value more precisely\n*/\n\n/**\n *\n * @param {module:Key.Key} key\n * @param {boolean} fullKeys\n * @returns {module:Key.keyValueObject}\n * @todo Document other allowable `key`?\n */\nfunction convertValueToMultiEntryKeyDecoded (key, fullKeys) {\n return convertValueToKeyValueDecoded(key, null, true, fullKeys);\n}\n\n/**\n* An internal utility.\n* @param input\n* @param {boolean} seen\n* @throws {DOMException} `DataError`\n* @returns {module:Key.keyValueObject}\n*/\nfunction convertValueToKeyRethrowingAndIfInvalid (input, seen) {\n const key = convertValueToKey(input, seen);\n if (key.invalid) {\n throw createDOMException('DataError', key.message || 'Not a valid key; type: ' + key.type);\n }\n return key;\n}\n\n/**\n *\n * @param value\n * @param keyPath\n * @param {boolean} multiEntry\n * @returns {module:Key.keyValueObject|module:Key.KeyPathEvaluateValue}\n * @todo Document other possible return?\n */\nfunction extractKeyFromValueUsingKeyPath (value, keyPath, multiEntry) {\n return extractKeyValueDecodedFromValueUsingKeyPath(value, keyPath, multiEntry, true);\n}\n/**\n* Not currently in use.\n* @param value\n* @param keyPath\n* @param {boolean} multiEntry\n* @returns {module:Key.KeyPathEvaluateValue}\n*/\nfunction evaluateKeyPathOnValue (value, keyPath, multiEntry) {\n return evaluateKeyPathOnValueToDecodedValue(value, keyPath, multiEntry, true);\n}\n\n/**\n* May throw, return `{failure: true}` (e.g., non-object on keyPath resolution)\n* or `{invalid: true}` (e.g., `NaN`).\n* @param value\n* @param keyPath\n* @param {boolean} multiEntry\n* @param {boolean} fullKeys\n* @returns {module:Key.keyValueObject|module:Key.KeyPathEvaluateValue}\n* @todo Document other possible return?\n*/\nfunction extractKeyValueDecodedFromValueUsingKeyPath (value, keyPath, multiEntry, fullKeys) {\n const r = evaluateKeyPathOnValueToDecodedValue(value, keyPath, multiEntry, fullKeys);\n if (r.failure) {\n return r;\n }\n if (!multiEntry) {\n return convertValueToKeyValueDecoded(r.value, null, false, fullKeys);\n }\n return convertValueToMultiEntryKeyDecoded(r.value, fullKeys);\n}\n\n/**\n* @typedef {PlainObject} module:Key.KeyPathEvaluateFailure\n* @property {boolean} failure\n*/\n\n/**\n* @typedef {PlainObject} module:Key.KeyPathEvaluateValue\n* @property {undefined|array|string} value\n*/\n\n/**\n * Returns the value of an inline key based on a key path (wrapped in an\n * object with key `value`) or `{failure: true}`\n * @param {object} value\n * @param {string|array} keyPath\n * @param {boolean} multiEntry\n * @param {boolean} [fullKeys]\n * @returns {module:Key.KeyPathEvaluateValue}\n */\nfunction evaluateKeyPathOnValueToDecodedValue (value, keyPath, multiEntry, fullKeys) {\n if (Array.isArray(keyPath)) {\n const result = [];\n return keyPath.some((item) => {\n const key = evaluateKeyPathOnValueToDecodedValue(value, item, multiEntry, fullKeys);\n if (key.failure) {\n return true;\n }\n result.push(key.value);\n return false;\n })\n ? {failure: true}\n : {value: result};\n }\n if (keyPath === '') {\n return {value};\n }\n const identifiers = keyPath.split('.');\n return identifiers.some((idntfr, i) => {\n if (idntfr === 'length' && (\n typeof value === 'string' || Array.isArray(value)\n )) {\n value = value.length;\n } else if (util.isBlob(value)) {\n switch (idntfr) {\n case 'size': case 'type':\n value = value[idntfr];\n break;\n }\n } else if (util.isFile(value)) {\n switch (idntfr) {\n case 'name': case 'lastModified':\n value = value[idntfr];\n break;\n case 'lastModifiedDate':\n value = new Date(value.lastModified);\n break;\n }\n } else if (!util.isObj(value) || !Object.prototype.hasOwnProperty.call(value, idntfr)) {\n return true;\n } else {\n value = value[idntfr];\n return value === undefined;\n }\n return false;\n })\n ? {failure: true}\n : {value};\n}\n\n/**\n * Sets the inline key value.\n * @param {object} value\n * @param {*} key\n * @param {string} keyPath\n * @returns {void}\n */\nfunction injectKeyIntoValueUsingKeyPath (value, key, keyPath) {\n const identifiers = keyPath.split('.');\n const last = identifiers.pop();\n identifiers.forEach((identifier) => {\n const hop = Object.prototype.hasOwnProperty.call(value, identifier);\n if (!hop) {\n value[identifier] = {};\n }\n value = value[identifier];\n });\n value[last] = key; // key is already a `keyValue` in our processing so no need to convert\n}\n\n/**\n *\n * @param value\n * @param keyPath\n * @see https://github.com/w3c/IndexedDB/pull/146\n * @returns {boolean}\n */\nfunction checkKeyCouldBeInjectedIntoValue (value, keyPath) {\n const identifiers = keyPath.split('.');\n identifiers.pop();\n for (const identifier of identifiers) {\n if (!util.isObj(value)) {\n return false;\n }\n const hop = Object.prototype.hasOwnProperty.call(value, identifier);\n if (!hop) {\n return true;\n }\n value = value[identifier];\n }\n return util.isObj(value);\n}\n\n/**\n *\n * @param {module:Key.Key} key\n * @param {IDBKeyRange} range\n * @param {boolean} checkCached\n * @returns {boolean}\n */\nfunction isKeyInRange (key, range, checkCached) {\n let lowerMatch = range.lower === undefined;\n let upperMatch = range.upper === undefined;\n const encodedKey = encode(key, true);\n const lower = checkCached ? range.__lowerCached : encode(range.lower, true);\n const upper = checkCached ? range.__upperCached : encode(range.upper, true);\n\n if (range.lower !== undefined) {\n if (range.lowerOpen && encodedKey > lower) {\n lowerMatch = true;\n }\n if (!range.lowerOpen && encodedKey >= lower) {\n lowerMatch = true;\n }\n }\n if (range.upper !== undefined) {\n if (range.upperOpen && encodedKey < upper) {\n upperMatch = true;\n }\n if (!range.upperOpen && encodedKey <= upper) {\n upperMatch = true;\n }\n }\n\n return lowerMatch && upperMatch;\n}\n\n/**\n * Determines whether an index entry matches a multi-entry key value.\n * @param {string} encodedEntry The entry value (already encoded)\n * @param {string} encodedKey The full index key (already encoded)\n * @returns {boolean}\n */\nfunction isMultiEntryMatch (encodedEntry, encodedKey) {\n const keyType = encodedCharToKeyType[encodedKey.slice(0, 1)];\n\n if (keyType === 'array') {\n return encodedKey.indexOf(encodedEntry) > 1;\n }\n return encodedKey === encodedEntry;\n}\n\n/**\n *\n * @param {module:Key.Key} keyEntry\n * @param {IDBKeyRange} range\n * @returns {module:Key.Key[]}\n */\nfunction findMultiEntryMatches (keyEntry, range) {\n const matches = [];\n\n if (Array.isArray(keyEntry)) {\n for (let key of keyEntry) {\n if (Array.isArray(key)) {\n if (range && range.lower === range.upper) {\n continue;\n }\n if (key.length === 1) {\n key = key[0];\n } else {\n const nested = findMultiEntryMatches(key, range);\n if (nested.length > 0) {\n matches.push(key);\n }\n continue;\n }\n }\n\n if (util.isNullish(range) || isKeyInRange(key, range, true)) {\n matches.push(key);\n }\n }\n } else if (util.isNullish(range) || isKeyInRange(keyEntry, range, true)) {\n matches.push(keyEntry);\n }\n return matches;\n}\n\n/**\n* @typedef {number|string|Date|ArrayBuffer|module:Key.ValueTypes[]} module:Key.ValueTypes\n*/\n\n/**\n* Not currently in use but keeping for spec parity.\n* @param {module:Key.Key} key\n* @throws {Error} Upon a \"bad key\"\n* @returns {module:Key.ValueTypes}\n*/\nfunction convertKeyToValue (key) {\n const {type, value} = key;\n switch (type) {\n case 'number': case 'string': {\n return value;\n } case 'array': {\n const array = [];\n const len = value.length;\n let index = 0;\n while (index < len) {\n const entry = convertKeyToValue(value[index]);\n array[index] = entry;\n index++;\n }\n return array;\n } case 'date': {\n return new Date(value);\n } case 'binary': {\n const len = value.length;\n const buffer = new ArrayBuffer(len);\n // Set the entries in buffer's [[ArrayBufferData]] to those in `value`\n const uint8 = new Uint8Array(buffer, value.byteOffset || 0, value.byteLength);\n uint8.set(value);\n return buffer;\n } case 'invalid': default:\n throw new Error('Bad key');\n }\n}\n\n/**\n *\n * @param {module:Key.Key} key\n * @param {boolean} inArray\n * @returns {string|null}\n */\nfunction encode (key, inArray) {\n // Bad keys like `null`, `object`, `boolean`, 'function', 'symbol' should not be passed here due to prior validation\n if (key === undefined) {\n return null;\n }\n // array, date, number, string, binary (should already have detected \"invalid\")\n return types[getKeyType(key)].encode(key, inArray);\n}\n\n/**\n *\n * @param {module:Key.Key} key\n * @param {boolean} inArray\n * @throws {Error} Invalid number\n * @returns {undefined|module:Key.ValueTypes}\n */\nfunction decode (key, inArray) {\n if (typeof key !== 'string') {\n return undefined;\n }\n return types[encodedCharToKeyType[key.slice(0, 1)]].decode(key, inArray);\n}\n\n/**\n *\n * @param {module:Key.Key} key\n * @param {boolean} inArray\n * @returns {undefined|module:Key.ValueTypes}\n */\nfunction roundTrip (key, inArray) {\n return decode(encode(key, inArray), inArray);\n}\n\nconst MAX_ALLOWED_CURRENT_NUMBER = 9007199254740992; // 2 ^ 53 (Also equal to `Number.MAX_SAFE_INTEGER + 1`)\n\n/**\n * @external WebSQLTransaction\n */\n\n/**\n* @typedef {IDBObjectStore} IDBObjectStoreWithCurrentName\n* @property {string} __currentName\n*/\n\n/**\n * @callback CurrentNumberCallback\n * @param {Integer} The current number\n * @returns {void}\n */\n\n/**\n* @callback SQLFailureCallback\n* @param {DOMException} exception\n* @returns {void}\n*/\n\n/**\n *\n * @param {external:WebSQLTransaction} tx\n * @param {IDBObjectStoreWithCurrentName} store\n * @param {CurrentNumberCallback} func\n * @param {SQLFailureCallback} sqlFailCb\n * @returns {void}\n */\nfunction getCurrentNumber (tx, store, func, sqlFailCb) {\n tx.executeSql('SELECT \"currNum\" FROM __sys__ WHERE \"name\" = ?', [\n util.escapeSQLiteStatement(store.__currentName)\n ], function (tx, data) {\n if (data.rows.length !== 1) {\n func(1);\n } else {\n func(data.rows.item(0).currNum);\n }\n }, function (tx, error) {\n sqlFailCb(createDOMException(\n 'DataError',\n 'Could not get the auto increment value for key',\n error\n ));\n });\n}\n\n/**\n *\n * @param {external:WebSQLTransaction} tx\n * @param {IDBObjectStoreWithCurrentName} store\n * @param {Integer} num\n * @param {CurrentNumberCallback} successCb\n * @param {SQLFailureCallback} failCb\n * @returns {void}\n */\nfunction assignCurrentNumber (tx, store, num, successCb, failCb) {\n const sql = 'UPDATE __sys__ SET \"currNum\" = ? WHERE \"name\" = ?';\n const sqlValues = [num, util.escapeSQLiteStatement(store.__currentName)];\n CFG.DEBUG && console.log(sql, sqlValues);\n tx.executeSql(sql, sqlValues, function (tx, data) {\n successCb(num);\n }, function (tx, err) {\n failCb(createDOMException('UnknownError', 'Could not set the auto increment value for key', err));\n });\n}\n\n/**\n * Bump up the auto-inc counter if the key path-resolved value is valid\n * (greater than old value and >=1) OR if a manually passed in key is\n * valid (numeric and >= 1) and >= any primaryKey.\n * @param {external:WebSQLTransaction} tx\n * @param {IDBObjectStoreWithCurrentName} store\n * @param {Integer} num\n * @param {CurrentNumberCallback} successCb\n * @param {SQLFailureCallback} failCb\n * @returns {void}\n */\nfunction setCurrentNumber (tx, store, num, successCb, failCb) {\n num = num === MAX_ALLOWED_CURRENT_NUMBER\n ? num + 2 // Since incrementing by one will have no effect in JavaScript on this unsafe max, we represent the max as a number incremented by two. The getting of the current number is never returned to the user and is only used in safe comparisons, so it is safe for us to represent it in this manner\n : num + 1;\n return assignCurrentNumber(tx, store, num, successCb, failCb);\n}\n\n/**\n * @callback KeyForStoreCallback\n * @param {\"failure\"|null} arg1\n * @param {Integer} [arg2]\n * @param {Integer} [arg3]\n * @returns {void}\n */\n\n/**\n *\n * @param {external:WebSQLTransaction} tx\n * @param {IDBObjectStoreWithCurrentName} store\n * @param {KeyForStoreCallback} cb\n * @param {SQLFailureCallback} sqlFailCb\n * @returns {void}\n */\nfunction generateKeyForStore (tx, store, cb, sqlFailCb) {\n getCurrentNumber(tx, store, function (key) {\n if (key > MAX_ALLOWED_CURRENT_NUMBER) { // 2 ^ 53 (See )\n cb('failure'); // eslint-disable-line standard/no-callback-literal\n return;\n }\n // Increment current number by 1 (we cannot leverage SQLite's\n // autoincrement (and decrement when not needed), as decrementing\n // will be overwritten/ignored upon the next insert)\n setCurrentNumber(\n tx, store, key,\n function () {\n cb(null, key, key);\n },\n sqlFailCb\n );\n }, sqlFailCb);\n}\n\n// Fractional or numbers exceeding the max do not get changed in the result\n// per https://github.com/w3c/IndexedDB/issues/147\n// so we do not return a key\n/**\n *\n * @param {external:WebSQLTransaction} tx\n * @param {IDBObjectStoreWithCurrentName} store\n * @param {*|Integer} key\n * @param {CurrentNumberCallback|void} successCb\n * @param {SQLFailureCallback} sqlFailCb\n * @returns {void}\n */\nfunction possiblyUpdateKeyGenerator (tx, store, key, successCb, sqlFailCb) {\n // Per https://github.com/w3c/IndexedDB/issues/147 , non-finite numbers\n // (or numbers larger than the max) are now to have the explicit effect of\n // setting the current number (up to the max), so we do not optimize them\n // out here\n if (typeof key !== 'number' || key < 1) { // Optimize with no need to get the current number\n // Auto-increment attempted with a bad key;\n // we are not to change the current number, but the steps don't call for failure\n // Numbers < 1 are optimized out as they will never be greater than the current number which must be at least 1\n successCb();\n } else {\n // If auto-increment and the keyPath item is a valid numeric key, get the old auto-increment to compare if the new is higher\n // to determine which to use and whether to update the current number\n getCurrentNumber(tx, store, function (cn) {\n const value = Math.floor(\n Math.min(key, MAX_ALLOWED_CURRENT_NUMBER)\n );\n const useNewKeyForAutoInc = value >= cn;\n if (useNewKeyForAutoInc) {\n setCurrentNumber(tx, store, value, function () {\n successCb(cn); // Supply old current number in case needs to be reverted\n }, sqlFailCb);\n } else { // Not updated\n successCb();\n }\n }, sqlFailCb);\n }\n}\n\nexport {encode, decode, roundTrip, convertKeyToValue, convertValueToKeyValueDecoded,\n convertValueToMultiEntryKeyDecoded,\n convertValueToKey,\n convertValueToMultiEntryKey, convertValueToKeyRethrowingAndIfInvalid,\n extractKeyFromValueUsingKeyPath, evaluateKeyPathOnValue,\n extractKeyValueDecodedFromValueUsingKeyPath, injectKeyIntoValueUsingKeyPath, checkKeyCouldBeInjectedIntoValue,\n isMultiEntryMatch, isKeyInRange, findMultiEntryMatches,\n assignCurrentNumber,\n generateKeyForStore, possiblyUpdateKeyGenerator};\n","import {createDOMException} from './DOMException.js';\nimport * as Key from './Key.js';\nimport * as util from './util.js';\n\nconst readonlyProperties = ['lower', 'upper', 'lowerOpen', 'upperOpen'];\n\n/* eslint-disable jsdoc/check-param-names */\n/**\n * The IndexedDB KeyRange object.\n * @see http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#dfn-key-range\n * @param {Object} lower\n * @param {Object} upper\n * @param {Object} lowerOpen\n * @param {Object} upperOpen\n * @throws {TypeError}\n * @class\n */\nfunction IDBKeyRange () {\n /* eslint-enable jsdoc/check-param-names */\n throw new TypeError('Illegal constructor');\n}\nconst IDBKeyRangeAlias = IDBKeyRange;\nIDBKeyRange.__createInstance = function (lower, upper, lowerOpen, upperOpen) {\n function IDBKeyRange () {\n this[Symbol.toStringTag] = 'IDBKeyRange';\n if (lower === undefined && upper === undefined) {\n throw createDOMException('DataError', 'Both arguments to the key range method cannot be undefined');\n }\n let lowerConverted, upperConverted;\n if (lower !== undefined) {\n lowerConverted = Key.roundTrip(lower); // Todo: does this make the \"conversions\" redundant\n Key.convertValueToKeyRethrowingAndIfInvalid(lower);\n }\n if (upper !== undefined) {\n upperConverted = Key.roundTrip(upper); // Todo: does this make the \"conversions\" redundant\n Key.convertValueToKeyRethrowingAndIfInvalid(upper);\n }\n if (lower !== undefined && upper !== undefined && lower !== upper) {\n if (Key.encode(lower) > Key.encode(upper)) {\n throw createDOMException('DataError', '`lower` must not be greater than `upper` argument in `bound()` call.');\n }\n }\n\n this.__lower = lowerConverted;\n this.__upper = upperConverted;\n this.__lowerOpen = Boolean(lowerOpen);\n this.__upperOpen = Boolean(upperOpen);\n }\n IDBKeyRange.prototype = IDBKeyRangeAlias.prototype;\n return new IDBKeyRange();\n};\nIDBKeyRange.prototype.includes = function (key) {\n // We can't do a regular instanceof check as it will create a loop given our hasInstance implementation\n if (!util.isObj(this) || typeof this.__lowerOpen !== 'boolean') {\n throw new TypeError('Illegal invocation');\n }\n if (!arguments.length) {\n throw new TypeError('IDBKeyRange.includes requires a key argument');\n }\n Key.convertValueToKeyRethrowingAndIfInvalid(key);\n return Key.isKeyInRange(key, this);\n};\n\nIDBKeyRange.only = function (value) {\n if (!arguments.length) {\n throw new TypeError('IDBKeyRange.only requires a value argument');\n }\n return IDBKeyRange.__createInstance(value, value, false, false);\n};\n\nIDBKeyRange.lowerBound = function (value /*, open */) {\n if (!arguments.length) {\n throw new TypeError('IDBKeyRange.lowerBound requires a value argument');\n }\n // eslint-disable-next-line prefer-rest-params\n return IDBKeyRange.__createInstance(value, undefined, arguments[1], true);\n};\nIDBKeyRange.upperBound = function (value /*, open */) {\n if (!arguments.length) {\n throw new TypeError('IDBKeyRange.upperBound requires a value argument');\n }\n // eslint-disable-next-line prefer-rest-params\n return IDBKeyRange.__createInstance(undefined, value, true, arguments[1]);\n};\nIDBKeyRange.bound = function (lower, upper /* , lowerOpen, upperOpen */) {\n if (arguments.length <= 1) {\n throw new TypeError('IDBKeyRange.bound requires lower and upper arguments');\n }\n // eslint-disable-next-line prefer-rest-params\n return IDBKeyRange.__createInstance(lower, upper, arguments[2], arguments[3]);\n};\nIDBKeyRange.prototype[Symbol.toStringTag] = 'IDBKeyRangePrototype';\n\nreadonlyProperties.forEach((prop) => {\n Object.defineProperty(IDBKeyRange.prototype, '__' + prop, {\n enumerable: false,\n configurable: false,\n writable: true\n });\n // Ensure for proper interface testing that \"get \" is the function name\n const o = {\n get [prop] () {\n // We can't do a regular instanceof check as it will create a loop given our hasInstance implementation\n if (!util.isObj(this) || typeof this.__lowerOpen !== 'boolean') {\n throw new TypeError('Illegal invocation');\n }\n return this['__' + prop];\n }\n };\n const desc = Object.getOwnPropertyDescriptor(o, prop);\n // desc.enumerable = true; // Default\n // desc.configurable = true; // Default\n Object.defineProperty(IDBKeyRange.prototype, prop, desc);\n});\n\nObject.defineProperty(IDBKeyRange, Symbol.hasInstance, {\n value: (obj) => util.isObj(obj) && 'upper' in obj && typeof obj.lowerOpen === 'boolean'\n});\n\nObject.defineProperty(IDBKeyRange, 'prototype', {\n writable: false\n});\n\nfunction setSQLForKeyRange (range, quotedKeyColumnName, sql, sqlValues, addAnd, checkCached) {\n if (range && (range.lower !== undefined || range.upper !== undefined)) {\n if (addAnd) sql.push('AND');\n let encodedLowerKey, encodedUpperKey;\n const hasLower = range.lower !== undefined;\n const hasUpper = range.upper !== undefined;\n if (hasLower) {\n encodedLowerKey = checkCached ? range.__lowerCached : Key.encode(range.lower);\n }\n if (hasUpper) {\n encodedUpperKey = checkCached ? range.__upperCached : Key.encode(range.upper);\n }\n if (hasLower) {\n sqlValues.push(util.escapeSQLiteStatement(encodedLowerKey));\n if (hasUpper && encodedLowerKey === encodedUpperKey && !range.lowerOpen && !range.upperOpen) {\n sql.push(quotedKeyColumnName, '=', '?');\n return;\n }\n sql.push(quotedKeyColumnName, (range.lowerOpen ? '>' : '>='), '?');\n }\n (hasLower && hasUpper) && sql.push('AND');\n if (hasUpper) {\n sql.push(quotedKeyColumnName, (range.upperOpen ? '<' : '<='), '?');\n sqlValues.push(util.escapeSQLiteStatement(encodedUpperKey));\n }\n }\n}\n\nfunction convertValueToKeyRange (value, nullDisallowed) {\n if (util.instanceOf(value, IDBKeyRange)) {\n // We still need to validate IDBKeyRange-like objects (the above check is based on loose duck-typing)\n if (value.toString() !== '[object IDBKeyRange]') {\n return IDBKeyRange.__createInstance(value.lower, value.upper, value.lowerOpen, value.upperOpen);\n }\n return value;\n }\n if (util.isNullish(value)) {\n if (nullDisallowed) {\n throw createDOMException('DataError', 'No key or range was specified');\n }\n return undefined; // Represents unbounded\n }\n Key.convertValueToKeyRethrowingAndIfInvalid(value);\n return IDBKeyRange.only(value);\n}\n\nexport {setSQLForKeyRange, IDBKeyRange, convertValueToKeyRange, IDBKeyRange as default};\n","let cleanInterface = false;\n\nconst testObject = {test: true};\n// Test whether Object.defineProperty really works.\nif (Object.defineProperty) {\n try {\n Object.defineProperty(testObject, 'test', {enumerable: false});\n if (testObject.test) {\n cleanInterface = true;\n }\n } catch (e) {\n // Object.defineProperty does not work as intended.\n }\n}\n\n/**\n * Shim the DOMStringList object.\n * @throws {TypeError}\n * @class\n */\nconst DOMStringList = function () {\n throw new TypeError('Illegal constructor');\n};\nDOMStringList.prototype = {\n constructor: DOMStringList,\n // Interface.\n contains (str) {\n if (!arguments.length) {\n throw new TypeError('DOMStringList.contains must be supplied a value');\n }\n return this._items.includes(str);\n },\n item (key) {\n if (!arguments.length) {\n throw new TypeError('DOMStringList.item must be supplied a value');\n }\n if (key < 0 || key >= this.length || !Number.isInteger(key)) {\n return null;\n }\n return this._items[key];\n },\n\n // Helpers. Should only be used internally.\n clone () {\n const stringList = DOMStringList.__createInstance();\n stringList._items = this._items.slice();\n stringList._length = this.length;\n stringList.addIndexes();\n return stringList;\n },\n addIndexes () {\n for (let i = 0; i < this._items.length; i++) {\n this[i] = this._items[i];\n }\n },\n sortList () {\n // http://w3c.github.io/IndexedDB/#sorted-list\n // https://tc39.github.io/ecma262/#sec-abstract-relational-comparison\n this._items.sort();\n this.addIndexes();\n return this._items;\n },\n forEach (cb, thisArg) {\n // eslint-disable-next-line unicorn/no-fn-reference-in-iterator\n this._items.forEach(cb, thisArg);\n },\n map (cb, thisArg) {\n // eslint-disable-next-line unicorn/no-fn-reference-in-iterator\n return this._items.map(cb, thisArg);\n },\n indexOf (str) {\n return this._items.indexOf(str);\n },\n push (item) {\n this._items.push(item);\n this._length++;\n this.sortList();\n },\n splice (...args /* index, howmany, item1, ..., itemX */) {\n this._items.splice(...args);\n this._length = this._items.length;\n for (const i in this) {\n if (i === String(Number.parseInt(i))) {\n delete this[i];\n }\n }\n this.sortList();\n },\n [Symbol.toStringTag]: 'DOMStringListPrototype',\n // At least because `DOMStringList`, as a [list](https://infra.spec.whatwg.org/#list)\n // can be converted to a sequence per https://infra.spec.whatwg.org/#list-iterate\n // and particularly as some methods, e.g., `IDBDatabase.transaction`\n // expect such sequence (or DOMString), we need an iterator (some of\n // the Mocha tests rely on these)\n * [Symbol.iterator] () {\n let i = 0;\n while (i < this._items.length) {\n yield this._items[i++];\n }\n }\n};\nObject.defineProperty(DOMStringList, Symbol.hasInstance, {\n value (obj) {\n return ({}.toString.call(obj) === 'DOMStringListPrototype');\n }\n});\nconst DOMStringListAlias = DOMStringList;\nObject.defineProperty(DOMStringList, '__createInstance', {\n value () {\n const DOMStringList = function DOMStringList () {\n this.toString = function () {\n return '[object DOMStringList]';\n };\n // Internal functions on the prototype have been made non-enumerable below.\n Object.defineProperty(this, 'length', {\n enumerable: true,\n get () {\n return this._length;\n }\n });\n this._items = [];\n this._length = 0;\n };\n DOMStringList.prototype = DOMStringListAlias.prototype;\n return new DOMStringList();\n }\n});\n\nif (cleanInterface) {\n Object.defineProperty(DOMStringList, 'prototype', {\n writable: false\n });\n\n const nonenumerableReadonly = ['addIndexes', 'sortList', 'forEach', 'map', 'indexOf', 'push', 'splice', 'constructor', '__createInstance'];\n nonenumerableReadonly.forEach((nonenumerableReadonly) => {\n Object.defineProperty(DOMStringList.prototype, nonenumerableReadonly, {\n enumerable: false\n });\n });\n\n // Illegal invocations\n Object.defineProperty(DOMStringList.prototype, 'length', {\n configurable: true,\n enumerable: true,\n get () {\n throw new TypeError('Illegal invocation');\n }\n });\n\n const nonenumerableWritable = ['_items', '_length'];\n nonenumerableWritable.forEach((nonenumerableWritable) => {\n Object.defineProperty(DOMStringList.prototype, nonenumerableWritable, {\n enumerable: false,\n writable: true\n });\n });\n}\n\nexport default DOMStringList;\n","import {EventTargetFactory} from 'eventtargeter';\nimport SyncPromise from 'sync-promise';\nimport {createEvent} from './Event.js';\nimport {logError, findError, webSQLErrback, createDOMException} from './DOMException.js';\nimport {IDBRequest} from './IDBRequest.js';\nimport * as util from './util.js';\nimport IDBObjectStore from './IDBObjectStore.js';\nimport CFG from './CFG.js';\n\nlet uniqueID = 0;\nconst listeners = ['onabort', 'oncomplete', 'onerror'];\nconst readonlyProperties = ['objectStoreNames', 'mode', 'db', 'error'];\n\n/* eslint-disable jsdoc/check-param-names */\n/**\n * The IndexedDB Transaction.\n * @see http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBTransaction\n * @param {IDBDatabase} db\n * @param {string[]} storeNames\n * @param {string} mode\n * @class\n */\nfunction IDBTransaction () {\n /* eslint-enable jsdoc/check-param-names */\n throw new TypeError('Illegal constructor');\n}\nconst IDBTransactionAlias = IDBTransaction;\nIDBTransaction.__createInstance = function (db, storeNames, mode) {\n function IDBTransaction () {\n const me = this;\n me[Symbol.toStringTag] = 'IDBTransaction';\n util.defineReadonlyProperties(me, readonlyProperties);\n me.__id = ++uniqueID; // for debugging simultaneous transactions\n me.__active = true;\n me.__running = false;\n me.__errored = false;\n me.__requests = [];\n me.__objectStoreNames = storeNames;\n me.__mode = mode;\n me.__db = db;\n me.__error = null;\n me.__setOptions({\n legacyOutputDidListenersThrowFlag: true // Event hook for IndexedB\n });\n\n readonlyProperties.forEach((readonlyProp) => {\n Object.defineProperty(this, readonlyProp, {\n configurable: true\n });\n });\n util.defineListenerProperties(this, listeners);\n me.__storeHandles = {};\n\n // Kick off the transaction as soon as all synchronous code is done\n setTimeout(() => { me.__executeRequests(); }, 0);\n }\n IDBTransaction.prototype = IDBTransactionAlias.prototype;\n return new IDBTransaction();\n};\n\nIDBTransaction.prototype = EventTargetFactory.createInstance({\n defaultSync: true,\n // Ensure EventTarget preserves our properties\n extraProperties: ['complete']\n});\n\nIDBTransaction.prototype.__transFinishedCb = function (err, cb) {\n cb(Boolean(err));\n};\nIDBTransaction.prototype.__executeRequests = function () {\n const me = this;\n if (me.__running) {\n CFG.DEBUG && console.log('Looks like the request set is already running', me.mode);\n return;\n }\n\n me.__running = true;\n\n me.db.__db[me.mode === 'readonly' ? 'readTransaction' : 'transaction']( // `readTransaction` is optimized, at least in `node-websql`\n function executeRequests (tx) {\n me.__tx = tx;\n let q = null, i = -1;\n\n function success (result, req) {\n if (me.__errored || me.__requestsFinished) {\n // We've already called \"onerror\", \"onabort\", or thrown within the transaction, so don't do it again.\n return;\n }\n if (req) {\n q.req = req; // Need to do this in case of cursors\n }\n if (q.req.__done) { // Avoid continuing with aborted requests\n return;\n }\n q.req.__done = true;\n q.req.__result = result;\n q.req.__error = null;\n\n me.__active = true;\n const e = createEvent('success');\n q.req.dispatchEvent(e);\n // Do not set __active flag to false yet: https://github.com/w3c/IndexedDB/issues/87\n if (e.__legacyOutputDidListenersThrowError) {\n logError('Error', 'An error occurred in a success handler attached to request chain', e.__legacyOutputDidListenersThrowError); // We do nothing else with this error as per spec\n me.__abortTransaction(createDOMException('AbortError', 'A request was aborted (in user handler after success).'));\n return;\n }\n executeNextRequest();\n }\n\n function error (...args /* tx, err */) {\n if (me.__errored || me.__requestsFinished) {\n // We've already called \"onerror\", \"onabort\", or thrown within\n // the transaction, so don't do it again.\n return;\n }\n if (q.req && q.req.__done) { // Avoid continuing with aborted requests\n return;\n }\n const err = findError(args);\n if (!q.req) {\n me.__abortTransaction(err);\n return;\n }\n\n // Fire an error event for the current IDBRequest\n q.req.__done = true;\n q.req.__error = err;\n q.req.__result = undefined; // Must be undefined if an error per `result` getter\n q.req.addLateEventListener('error', function (e) {\n if (e.cancelable && e.defaultPrevented && !e.__legacyOutputDidListenersThrowError) {\n executeNextRequest();\n }\n });\n q.req.addDefaultEventListener('error', function () {\n me.__abortTransaction(q.req.__error);\n });\n\n me.__active = true;\n const e = createEvent('error', err, {bubbles: true, cancelable: true});\n q.req.dispatchEvent(e);\n // Do not set __active flag to false yet: https://github.com/w3c/IndexedDB/issues/87\n if (e.__legacyOutputDidListenersThrowError) {\n logError('Error', 'An error occurred in an error handler attached to request chain', e.__legacyOutputDidListenersThrowError); // We do nothing else with this error as per spec\n e.preventDefault(); // Prevent 'error' default as steps indicate we should abort with `AbortError` even without cancellation\n me.__abortTransaction(createDOMException('AbortError', 'A request was aborted (in user handler after error).'));\n }\n }\n\n function executeNextRequest () {\n if (me.__errored || me.__requestsFinished) {\n // We've already called \"onerror\", \"onabort\", or thrown within the transaction, so don't do it again.\n return;\n }\n i++;\n if (i >= me.__requests.length) {\n // All requests in the transaction are done\n me.__requests = [];\n if (me.__active) {\n requestsFinished();\n }\n } else {\n try {\n q = me.__requests[i];\n if (!q.req) {\n q.op(tx, q.args, executeNextRequest, error);\n return;\n }\n if (q.req.__done) { // Avoid continuing with aborted requests\n return;\n }\n q.op(tx, q.args, success, error, executeNextRequest);\n } catch (e) {\n error(e);\n }\n }\n }\n\n executeNextRequest();\n },\n function webSQLError (webSQLErr) {\n if (webSQLErr === true) { // Not a genuine SQL error\n return;\n }\n const err = webSQLErrback(webSQLErr);\n me.__abortTransaction(err);\n },\n function () {\n // For Node, we don't need to try running here as we can keep\n // the transaction running long enough to rollback (in the\n // next (non-standard) callback for this transaction call)\n if (me.__transFinishedCb !== IDBTransaction.prototype.__transFinishedCb) { // Node\n return;\n }\n if (!me.__transactionEndCallback && !me.__requestsFinished) {\n me.__transactionFinished = true;\n return;\n }\n if (me.__transactionEndCallback && !me.__completed) {\n me.__transFinishedCb(me.__errored, me.__transactionEndCallback);\n }\n },\n function (currentTask, err, done, rollback, commit) {\n if (currentTask.readOnly || err) {\n return true;\n }\n me.__transFinishedCb = function (err, cb) {\n if (err) {\n rollback(err, cb);\n } else {\n commit(cb);\n }\n };\n if (me.__transactionEndCallback && !me.__completed) {\n me.__transFinishedCb(me.__errored, me.__transactionEndCallback);\n }\n return false;\n }\n );\n\n function requestsFinished () {\n me.__active = false;\n me.__requestsFinished = true;\n\n function complete () {\n me.__completed = true;\n CFG.DEBUG && console.log('Transaction completed');\n const evt = createEvent('complete');\n try {\n me.__internal = true;\n me.dispatchEvent(evt);\n me.__internal = false;\n me.dispatchEvent(createEvent('__complete'));\n } catch (e) {\n me.__internal = false;\n // An error occurred in the \"oncomplete\" handler.\n // It's too late to call \"onerror\" or \"onabort\". Throw a global error instead.\n // (this may seem odd/bad, but it's how all native IndexedDB implementations work)\n me.__errored = true;\n throw e;\n } finally {\n me.__storeHandles = {};\n }\n }\n if (me.mode === 'readwrite') {\n if (me.__transactionFinished) {\n complete();\n return;\n }\n me.__transactionEndCallback = complete;\n return;\n }\n if (me.mode === 'readonly') {\n complete();\n return;\n }\n const ev = createEvent('__beforecomplete');\n ev.complete = complete;\n me.dispatchEvent(ev);\n }\n};\n\n/**\n * Creates a new IDBRequest for the transaction.\n * NOTE: The transaction is not queued until you call {@link IDBTransaction#__pushToQueue}.\n * @param {IDBDatabase} source\n * @returns {IDBRequest}\n * @protected\n */\nIDBTransaction.prototype.__createRequest = function (source) {\n const me = this;\n const request = IDBRequest.__createInstance();\n request.__source = source !== undefined ? source : me.db;\n request.__transaction = me;\n return request;\n};\n\n/**\n * Adds a callback function to the transaction queue.\n * @param {function} callback\n * @param {*} args\n * @param {IDBDatabase} source\n * @returns {IDBRequest}\n * @protected\n */\nIDBTransaction.prototype.__addToTransactionQueue = function (callback, args, source) {\n const request = this.__createRequest(source);\n this.__pushToQueue(request, callback, args);\n return request;\n};\n\n/**\n * Adds a callback function to the transaction queue without generating a\n * request.\n * @param {function} callback\n * @param {*} args\n * @param {IDBDatabase} source\n * @returns {void}\n * @protected\n */\nIDBTransaction.prototype.__addNonRequestToTransactionQueue = function (callback, args, source) {\n this.__pushToQueue(null, callback, args);\n};\n\n/**\n * Adds an IDBRequest to the transaction queue.\n * @param {IDBRequest} request\n * @param {function} callback\n * @param {*} args\n * @protected\n * @returns {void}\n */\nIDBTransaction.prototype.__pushToQueue = function (request, callback, args) {\n this.__assertActive();\n this.__requests.push({\n op: callback,\n args,\n req: request\n });\n};\n\nIDBTransaction.prototype.__assertActive = function () {\n if (!this.__active) {\n throw createDOMException('TransactionInactiveError', 'A request was placed against a transaction which is currently not active, or which is finished');\n }\n};\n\nIDBTransaction.prototype.__assertWritable = function () {\n if (this.mode === 'readonly') {\n throw createDOMException('ReadOnlyError', 'The transaction is read only');\n }\n};\n\nIDBTransaction.prototype.__assertVersionChange = function () {\n IDBTransaction.__assertVersionChange(this);\n};\n\n/**\n * Returns the specified object store.\n * @param {string} objectStoreName\n * @returns {IDBObjectStore}\n */\nIDBTransaction.prototype.objectStore = function (objectStoreName) {\n const me = this;\n if (!(me instanceof IDBTransaction)) {\n throw new TypeError('Illegal invocation');\n }\n if (arguments.length === 0) {\n throw new TypeError('No object store name was specified');\n }\n IDBTransaction.__assertNotFinished(me);\n if (me.__objectStoreNames.indexOf(objectStoreName) === -1) { // eslint-disable-line unicorn/prefer-includes\n throw createDOMException('NotFoundError', objectStoreName + ' is not participating in this transaction');\n }\n const store = me.db.__objectStores[objectStoreName];\n if (!store) {\n throw createDOMException('NotFoundError', objectStoreName + ' does not exist in ' + me.db.name);\n }\n\n if (!me.__storeHandles[objectStoreName] ||\n // These latter conditions are to allow store\n // recreation to create new clone object\n me.__storeHandles[objectStoreName].__pendingDelete ||\n me.__storeHandles[objectStoreName].__deleted) {\n me.__storeHandles[objectStoreName] = IDBObjectStore.__clone(store, me);\n }\n return me.__storeHandles[objectStoreName];\n};\n\nIDBTransaction.prototype.__abortTransaction = function (err) {\n const me = this;\n logError('Error', 'An error occurred in a transaction', err);\n if (me.__errored) {\n // We've already called \"onerror\", \"onabort\", or thrown, so don't do it again.\n return;\n }\n me.__errored = true;\n\n if (me.mode === 'versionchange') { // Steps for aborting an upgrade transaction\n me.db.__version = me.db.__oldVersion;\n me.db.__objectStoreNames = me.db.__oldObjectStoreNames;\n me.__objectStoreNames = me.db.__oldObjectStoreNames;\n Object.values(me.db.__objectStores).concat(\n Object.values(me.__storeHandles)\n ).forEach(function (store) {\n // Store was already created so we restore to name before the rename\n if ('__pendingName' in store &&\n me.db.__oldObjectStoreNames.indexOf(store.__pendingName) > -1 // eslint-disable-line unicorn/prefer-includes\n ) {\n store.__name = store.__originalName;\n }\n store.__indexNames = store.__oldIndexNames;\n delete store.__pendingDelete;\n Object.values(store.__indexes).concat(\n Object.values(store.__indexHandles)\n ).forEach(function (index) {\n // Index was already created so we restore to name before the rename\n if ('__pendingName' in index &&\n store.__oldIndexNames.indexOf(index.__pendingName) > -1 // eslint-disable-line unicorn/prefer-includes\n ) {\n index.__name = index.__originalName;\n }\n delete index.__pendingDelete;\n });\n });\n }\n me.__active = false; // Setting here and in requestsFinished for https://github.com/w3c/IndexedDB/issues/87\n\n if (err !== null) {\n me.__error = err;\n }\n\n if (me.__requestsFinished) {\n // The transaction has already completed, so we can't call \"onerror\" or \"onabort\".\n // So throw the error instead.\n setTimeout(() => {\n throw err;\n }, 0);\n }\n\n function abort (tx, errOrResult) {\n if (!tx) {\n CFG.DEBUG && console.log('Rollback not possible due to missing transaction', me);\n } else if (errOrResult && typeof errOrResult.code === 'number') {\n CFG.DEBUG && console.log('Rollback erred; feature is probably not supported as per WebSQL', me);\n } else {\n CFG.DEBUG && console.log('Rollback succeeded', me);\n }\n\n me.dispatchEvent(createEvent('__preabort'));\n me.__requests.filter(function (q, i, arr) { // eslint-disable-line promise/no-promise-in-callback\n return q.req && !q.req.__done && [i, -1].includes(\n arr.map((q) => q.req).lastIndexOf(q.req)\n );\n }).reduce(function (promises, q) {\n // We reduce to a chain of promises to be queued in order, so we cannot\n // use `Promise.all`, and I'm unsure whether `setTimeout` currently\n // behaves first-in-first-out with the same timeout so we could\n // just use a `forEach`.\n return promises.then(function () {\n q.req.__done = true;\n q.req.__result = undefined;\n q.req.__error = createDOMException('AbortError', 'A request was aborted (an unfinished request).');\n const reqEvt = createEvent('error', q.req.__error, {bubbles: true, cancelable: true});\n return new SyncPromise(function (resolve) {\n setTimeout(() => {\n q.req.dispatchEvent(reqEvt); // No need to catch errors\n resolve();\n });\n });\n });\n }, SyncPromise.resolve()).then(function () { // Also works when there are no pending requests\n const evt = createEvent('abort', err, {bubbles: true, cancelable: false});\n setTimeout(() => {\n me.__abortFinished = true;\n me.dispatchEvent(evt);\n me.__storeHandles = {};\n me.dispatchEvent(createEvent('__abort'));\n });\n return undefined;\n }).catch((err) => {\n console.log('Abort error');\n throw err;\n });\n }\n\n me.__transFinishedCb(true, function (rollback) {\n if (rollback && me.__tx) { // Not supported in standard SQL (and WebSQL errors should\n // rollback automatically), but for Node.js, etc., we give chance for\n // manual aborts which would otherwise not work.\n if (me.mode === 'readwrite') {\n if (me.__transactionFinished) {\n abort();\n return;\n }\n me.__transactionEndCallback = abort;\n return;\n }\n try {\n me.__tx.executeSql('ROLLBACK', [], abort, abort); // Not working in some circumstances, even in Node\n } catch (err) {\n // Browser errs when transaction has ended and since it most likely already erred here,\n // we call to abort\n abort();\n }\n } else {\n abort(null, {code: 0});\n }\n });\n};\n\nIDBTransaction.prototype.abort = function () {\n const me = this;\n if (!(me instanceof IDBTransaction)) {\n throw new TypeError('Illegal invocation');\n }\n CFG.DEBUG && console.log('The transaction was aborted', me);\n IDBTransaction.__assertNotFinished(me);\n me.__abortTransaction(null);\n};\n\nIDBTransaction.prototype[Symbol.toStringTag] = 'IDBTransactionPrototype';\n\nIDBTransaction.__assertVersionChange = function (tx) {\n if (!tx || tx.mode !== 'versionchange') {\n throw createDOMException('InvalidStateError', 'Not a version transaction');\n }\n};\nIDBTransaction.__assertNotVersionChange = function (tx) {\n if (tx && tx.mode === 'versionchange') {\n throw createDOMException('InvalidStateError', 'Cannot be called during a version transaction');\n }\n};\n\nIDBTransaction.__assertNotFinished = function (tx) {\n if (!tx || tx.__completed || tx.__abortFinished || tx.__errored) {\n throw createDOMException('InvalidStateError', 'Transaction finished by commit or abort');\n }\n};\n\n// object store methods behave differently: see https://github.com/w3c/IndexedDB/issues/192\nIDBTransaction.__assertNotFinishedObjectStoreMethod = function (tx) {\n try {\n IDBTransaction.__assertNotFinished(tx);\n } catch (err) {\n if (tx && !tx.__completed && !tx.__abortFinished) {\n throw createDOMException('TransactionInactiveError', 'A request was placed against a transaction which is currently not active, or which is finished');\n }\n throw err;\n }\n};\n\nIDBTransaction.__assertActive = function (tx) {\n if (!tx || !tx.__active) {\n throw createDOMException('TransactionInactiveError', 'A request was placed against a transaction which is currently not active, or which is finished');\n }\n};\n\n/**\n* Used by our `EventTarget.prototype` library to implement bubbling/capturing.\n* @returns {IDBDatabase}\n*/\nIDBTransaction.prototype.__getParent = function () {\n return this.db;\n};\n\nutil.defineOuterInterface(IDBTransaction.prototype, listeners);\nutil.defineReadonlyOuterInterface(IDBTransaction.prototype, readonlyProperties);\n\nObject.defineProperty(IDBTransaction.prototype, 'constructor', {\n enumerable: false,\n writable: true,\n configurable: true,\n value: IDBTransaction\n});\n\nObject.defineProperty(IDBTransaction, 'prototype', {\n writable: false\n});\n\nexport default IDBTransaction;\n","/* eslint-disable node/no-unsupported-features/es-syntax */\n\n/*\n * base64-arraybuffer\n * https://github.com/niklasvh/base64-arraybuffer\n *\n * Copyright (c) 2017 Brett Zamir, 2012 Niklas von Hertzen\n * Licensed under the MIT license.\n */\nvar chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; // Use a lookup table to find the index.\n\nvar lookup = new Uint8Array(256);\n\nfor (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n}\n/**\n * @param {ArrayBuffer} arraybuffer\n * @param {Integer} byteOffset\n * @param {Integer} lngth\n * @returns {string}\n */\n\n\nvar encode = function encode(arraybuffer, byteOffset, lngth) {\n if (lngth === null || lngth === undefined) {\n lngth = arraybuffer.byteLength; // Needed for Safari\n }\n\n var bytes = new Uint8Array(arraybuffer, byteOffset || 0, // Default needed for Safari\n lngth);\n var len = bytes.length;\n var base64 = '';\n\n for (var _i = 0; _i < len; _i += 3) {\n base64 += chars[bytes[_i] >> 2];\n base64 += chars[(bytes[_i] & 3) << 4 | bytes[_i + 1] >> 4];\n base64 += chars[(bytes[_i + 1] & 15) << 2 | bytes[_i + 2] >> 6];\n base64 += chars[bytes[_i + 2] & 63];\n }\n\n if (len % 3 === 2) {\n base64 = base64.slice(0, -1) + '=';\n } else if (len % 3 === 1) {\n base64 = base64.slice(0, -2) + '==';\n }\n\n return base64;\n};\n/**\n * @param {string} base64\n * @returns {ArrayBuffer}\n */\n\nvar decode = function decode(base64) {\n var len = base64.length;\n var bufferLength = base64.length * 0.75;\n var p = 0;\n var encoded1, encoded2, encoded3, encoded4;\n\n if (base64[base64.length - 1] === '=') {\n bufferLength--;\n\n if (base64[base64.length - 2] === '=') {\n bufferLength--;\n }\n }\n\n var arraybuffer = new ArrayBuffer(bufferLength),\n bytes = new Uint8Array(arraybuffer);\n\n for (var _i2 = 0; _i2 < len; _i2 += 4) {\n encoded1 = lookup[base64.charCodeAt(_i2)];\n encoded2 = lookup[base64.charCodeAt(_i2 + 1)];\n encoded3 = lookup[base64.charCodeAt(_i2 + 2)];\n encoded4 = lookup[base64.charCodeAt(_i2 + 3)];\n bytes[p++] = encoded1 << 2 | encoded2 >> 4;\n bytes[p++] = (encoded2 & 15) << 4 | encoded3 >> 2;\n bytes[p++] = (encoded3 & 3) << 6 | encoded4 & 63;\n }\n\n return arraybuffer;\n};\n\nexport { decode, encode };\n","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global = global || self, global.Typeson = factory());\n}(this, (function () { 'use strict';\n\n function _typeof(obj) {\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n }\n\n function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n }\n\n function _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n }\n\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n }\n\n function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n }\n\n function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n }\n\n function ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly) symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n }\n\n function _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n }\n\n function _slicedToArray(arr, i) {\n return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();\n }\n\n function _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();\n }\n\n function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n\n return arr2;\n }\n }\n\n function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n }\n\n function _iterableToArray(iter) {\n if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter);\n }\n\n function _iterableToArrayLimit(arr, i) {\n if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === \"[object Arguments]\")) {\n return;\n }\n\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n }\n\n function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance\");\n }\n\n function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n }\n\n /**\n * We keep this function minimized so if using two instances of this\n * library, where one is minimized and one is not, it will still work\n * with `hasConstructorOf`.\n * With ES6 classes, we may be able to simply use `class TypesonPromise\n * extends Promise` and add a string tag for detection.\n * @param {function} f\n */\n // eslint-disable-next-line max-len\n // eslint-disable-next-line block-spacing, space-before-function-paren, space-before-blocks, space-infix-ops, semi, promise/avoid-new\n var TypesonPromise = function TypesonPromise(f) {\n _classCallCheck(this, TypesonPromise);\n\n this.p = new Promise(f);\n }; // eslint-disable-next-line max-len\n // class TypesonPromise extends Promise {get[Symbol.toStringTag](){return 'TypesonPromise'};} // eslint-disable-line keyword-spacing, space-before-function-paren, space-before-blocks, block-spacing, semi\n\n\n TypesonPromise.__typeson__type__ = 'TypesonPromise'; // Note: core-js-bundle provides a `Symbol` polyfill\n\n /* istanbul ignore else */\n\n if (typeof Symbol !== 'undefined') {\n // Ensure `isUserObject` will return `false` for `TypesonPromise`\n TypesonPromise.prototype[Symbol.toStringTag] = 'TypesonPromise';\n }\n /**\n *\n * @param {function} [onFulfilled]\n * @param {function} [onRejected]\n * @returns {TypesonPromise}\n */\n\n\n TypesonPromise.prototype.then = function (onFulfilled, onRejected) {\n var _this = this;\n\n return new TypesonPromise(function (typesonResolve, typesonReject) {\n // eslint-disable-next-line promise/catch-or-return\n _this.p.then(function (res) {\n // eslint-disable-next-line promise/always-return\n typesonResolve(onFulfilled ? onFulfilled(res) : res);\n })[\"catch\"](function (res) {\n return onRejected ? onRejected(res) : Promise.reject(res);\n }).then(typesonResolve, typesonReject);\n });\n };\n /**\n *\n * @param {function} onRejected\n * @returns {TypesonPromise}\n */\n\n\n TypesonPromise.prototype[\"catch\"] = function (onRejected) {\n return this.then(null, onRejected);\n };\n /**\n *\n * @param {Any} v\n * @returns {TypesonPromise}\n */\n\n\n TypesonPromise.resolve = function (v) {\n return new TypesonPromise(function (typesonResolve) {\n typesonResolve(v);\n });\n };\n /**\n *\n * @param {Any} v\n * @returns {TypesonPromise}\n */\n\n\n TypesonPromise.reject = function (v) {\n return new TypesonPromise(function (typesonResolve, typesonReject) {\n typesonReject(v);\n });\n };\n\n ['all', 'race'].forEach(function (meth) {\n /**\n *\n * @param {Promise[]} promArr\n * @returns {TypesonPromise}\n */\n TypesonPromise[meth] = function (promArr) {\n return new TypesonPromise(function (typesonResolve, typesonReject) {\n // eslint-disable-next-line promise/catch-or-return\n Promise[meth](promArr.map(function (prom) {\n return prom && prom.constructor && prom.constructor.__typeson__type__ === 'TypesonPromise' ? prom.p : prom;\n })).then(typesonResolve, typesonReject);\n });\n };\n });\n\n var _ref = {},\n toStr = _ref.toString,\n hasOwn = {}.hasOwnProperty,\n getProto = Object.getPrototypeOf,\n fnToString = hasOwn.toString;\n /**\n * Second argument not in use internally, but provided for utility.\n * @param {Any} v\n * @param {boolean} catchCheck\n * @returns {boolean}\n */\n\n function isThenable(v, catchCheck) {\n return isObject(v) && typeof v.then === 'function' && (!catchCheck || typeof v[\"catch\"] === 'function');\n }\n /**\n *\n * @param {Any} val\n * @returns {string}\n */\n\n\n function toStringTag(val) {\n return toStr.call(val).slice(8, -1);\n }\n /**\n * This function is dependent on both constructors\n * being identical so any minimization is expected of both.\n * @param {Any} a\n * @param {function} b\n * @returns {boolean}\n */\n\n\n function hasConstructorOf(a, b) {\n if (!a || _typeof(a) !== 'object') {\n return false;\n }\n\n var proto = getProto(a);\n\n if (!proto) {\n return b === null;\n }\n\n var Ctor = hasOwn.call(proto, 'constructor') && proto.constructor;\n\n if (typeof Ctor !== 'function') {\n return b === null;\n }\n\n if (b === Ctor) {\n return true;\n }\n\n if (b !== null && fnToString.call(Ctor) === fnToString.call(b)) {\n return true;\n }\n\n if (typeof b === 'function' && typeof Ctor.__typeson__type__ === 'string' && Ctor.__typeson__type__ === b.__typeson__type__) {\n return true;\n }\n\n return false;\n }\n /**\n *\n * @param {Any} val\n * @returns {boolean}\n */\n\n\n function isPlainObject(val) {\n // Mirrors jQuery's\n if (!val || toStringTag(val) !== 'Object') {\n return false;\n }\n\n var proto = getProto(val);\n\n if (!proto) {\n // `Object.create(null)`\n return true;\n }\n\n return hasConstructorOf(val, Object);\n }\n /**\n *\n * @param {Any} val\n * @returns {boolean}\n */\n\n\n function isUserObject(val) {\n if (!val || toStringTag(val) !== 'Object') {\n return false;\n }\n\n var proto = getProto(val);\n\n if (!proto) {\n // `Object.create(null)`\n return true;\n }\n\n return hasConstructorOf(val, Object) || isUserObject(proto);\n }\n /**\n *\n * @param {Any} v\n * @returns {boolean}\n */\n\n\n function isObject(v) {\n return v && _typeof(v) === 'object';\n }\n /**\n *\n * @param {string} keyPathComponent\n * @returns {string}\n */\n\n\n function escapeKeyPathComponent(keyPathComponent) {\n return keyPathComponent.replace(/~/g, '~0').replace(/\\./g, '~1');\n }\n /**\n *\n * @param {string} keyPathComponent\n * @returns {string}\n */\n\n\n function unescapeKeyPathComponent(keyPathComponent) {\n return keyPathComponent.replace(/~1/g, '.').replace(/~0/g, '~');\n }\n /**\n * @param {PlainObject|GenericArray} obj\n * @param {string} keyPath\n * @returns {Any}\n */\n\n\n function getByKeyPath(obj, keyPath) {\n if (keyPath === '') {\n return obj;\n }\n\n var period = keyPath.indexOf('.');\n\n if (period > -1) {\n var innerObj = obj[unescapeKeyPathComponent(keyPath.slice(0, period))];\n return innerObj === undefined ? undefined : getByKeyPath(innerObj, keyPath.slice(period + 1));\n }\n\n return obj[unescapeKeyPathComponent(keyPath)];\n }\n /**\n *\n * @param {PlainObject} obj\n * @param {string} keyPath\n * @param {Any} value\n * @returns {Any}\n */\n\n\n function setAtKeyPath(obj, keyPath, value) {\n if (keyPath === '') {\n return value;\n }\n\n var period = keyPath.indexOf('.');\n\n if (period > -1) {\n var innerObj = obj[unescapeKeyPathComponent(keyPath.slice(0, period))];\n return setAtKeyPath(innerObj, keyPath.slice(period + 1), value);\n }\n\n obj[unescapeKeyPathComponent(keyPath)] = value;\n return obj;\n }\n /**\n *\n * @param {external:JSON} value\n * @returns {\"null\"|\"array\"|\"undefined\"|\"boolean\"|\"number\"|\"string\"|\n * \"object\"|\"symbol\"}\n */\n\n\n function getJSONType(value) {\n return value === null ? 'null' : Array.isArray(value) ? 'array' : _typeof(value);\n }\n\n var keys = Object.keys,\n isArray = Array.isArray,\n hasOwn$1 = {}.hasOwnProperty,\n internalStateObjPropsToIgnore = ['type', 'replaced', 'iterateIn', 'iterateUnsetNumeric'];\n /**\n * Handle plain object revivers first so reference setting can use\n * revived type (e.g., array instead of object); assumes revived\n * has same structure or will otherwise break subsequent references.\n * @param {PlainObjectType} a\n * @param {PlainObjectType} b\n * @returns {1|-1|boolean}\n */\n\n function nestedPathsFirst(a, b) {\n if (a.keypath === '') {\n return -1;\n }\n\n var as = a.keypath.match(/\\./g) || 0;\n var bs = b.keypath.match(/\\./g) || 0;\n\n if (as) {\n as = as.length;\n }\n\n if (bs) {\n bs = bs.length;\n }\n\n return as > bs ? -1 : as < bs ? 1 : a.keypath < b.keypath ? -1 : a.keypath > b.keypath;\n }\n /**\n * An instance of this class can be used to call `stringify()` and `parse()`.\n * Typeson resolves cyclic references by default. Can also be extended to\n * support custom types using the register() method.\n *\n * @class\n * @param {{cyclic: boolean}} [options] - if cyclic (default true),\n * cyclic references will be handled gracefully.\n */\n\n\n var Typeson =\n /*#__PURE__*/\n function () {\n function Typeson(options) {\n _classCallCheck(this, Typeson);\n\n this.options = options; // Replacers signature: replace (value). Returns falsy if not\n // replacing. Otherwise ['Date', value.getTime()]\n\n this.plainObjectReplacers = [];\n this.nonplainObjectReplacers = []; // Revivers: [{type => reviver}, {plain: boolean}].\n // Sample: [{'Date': value => new Date(value)}, {plain: false}]\n\n this.revivers = {};\n /** Types registered via `register()`. */\n\n this.types = {};\n }\n /**\n * @typedef {null|boolean|number|string|GenericArray|PlainObject} JSON\n */\n\n /**\n * @callback JSONReplacer\n * @param {\"\"|string} key\n * @param {JSON} value\n * @returns {number|string|boolean|null|PlainObject|undefined}\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The%20replacer%20parameter\n */\n\n /**\n * Serialize given object to Typeson.\n * Initial arguments work identical to those of `JSON.stringify`.\n * The `replacer` argument has nothing to do with our replacers.\n * @param {Any} obj\n * @param {JSONReplacer|string[]} replacer\n * @param {number|string} space\n * @param {object} opts\n * @returns {string|Promise} Promise resolves to a string\n */\n\n\n _createClass(Typeson, [{\n key: \"stringify\",\n value: function stringify(obj, replacer, space, opts) {\n opts = _objectSpread2({}, this.options, {}, opts, {\n stringification: true\n });\n var encapsulated = this.encapsulate(obj, null, opts);\n\n if (isArray(encapsulated)) {\n return JSON.stringify(encapsulated[0], replacer, space);\n }\n\n return encapsulated.then(function (res) {\n return JSON.stringify(res, replacer, space);\n });\n }\n /**\n * Also sync but throws on non-sync result.\n * @param {Any} obj\n * @param {JSONReplacer|string[]} replacer\n * @param {number|string} space\n * @param {object} opts\n * @returns {string}\n */\n\n }, {\n key: \"stringifySync\",\n value: function stringifySync(obj, replacer, space, opts) {\n return this.stringify(obj, replacer, space, _objectSpread2({\n throwOnBadSyncType: true\n }, opts, {\n sync: true\n }));\n }\n /**\n *\n * @param {Any} obj\n * @param {JSONReplacer|string[]} replacer\n * @param {number|string} space\n * @param {object} opts\n * @returns {Promise}\n */\n\n }, {\n key: \"stringifyAsync\",\n value: function stringifyAsync(obj, replacer, space, opts) {\n return this.stringify(obj, replacer, space, _objectSpread2({\n throwOnBadSyncType: true\n }, opts, {\n sync: false\n }));\n }\n /**\n * Parse Typeson back into an obejct.\n * Initial arguments works identical to those of `JSON.parse()`.\n * @param {string} text\n * @param {function} reviver This JSON reviver has nothing to do with\n * our revivers.\n * @param {object} opts\n * @returns {external:JSON}\n */\n\n }, {\n key: \"parse\",\n value: function parse(text, reviver, opts) {\n opts = _objectSpread2({}, this.options, {}, opts, {\n parse: true\n });\n return this.revive(JSON.parse(text, reviver), opts);\n }\n /**\n * Also sync but throws on non-sync result.\n * @param {string} text\n * @param {function} reviver This JSON reviver has nothing to do with\n * our revivers.\n * @param {object} opts\n * @returns {external:JSON}\n */\n\n }, {\n key: \"parseSync\",\n value: function parseSync(text, reviver, opts) {\n return this.parse(text, reviver, _objectSpread2({\n throwOnBadSyncType: true\n }, opts, {\n sync: true\n }));\n }\n /**\n * @param {string} text\n * @param {function} reviver This JSON reviver has nothing to do with\n * our revivers.\n * @param {object} opts\n * @returns {Promise} Resolves to `external:JSON`\n */\n\n }, {\n key: \"parseAsync\",\n value: function parseAsync(text, reviver, opts) {\n return this.parse(text, reviver, _objectSpread2({\n throwOnBadSyncType: true\n }, opts, {\n sync: false\n }));\n }\n /**\n *\n * @param {Any} obj\n * @param {object} stateObj\n * @param {object} [opts={}]\n * @returns {string[]|false}\n */\n\n }, {\n key: \"specialTypeNames\",\n value: function specialTypeNames(obj, stateObj) {\n var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n opts.returnTypeNames = true;\n return this.encapsulate(obj, stateObj, opts);\n }\n /**\n *\n * @param {Any} obj\n * @param {PlainObject} stateObj\n * @param {PlainObject} [opts={}]\n * @returns {Promise|GenericArray|PlainObject|string|false}\n */\n\n }, {\n key: \"rootTypeName\",\n value: function rootTypeName(obj, stateObj) {\n var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n opts.iterateNone = true;\n return this.encapsulate(obj, stateObj, opts);\n }\n /**\n * Encapsulate a complex object into a plain Object by replacing\n * registered types with plain objects representing the types data.\n *\n * This method is used internally by `Typeson.stringify()`.\n * @param {Any} obj - Object to encapsulate.\n * @param {PlainObject} stateObj\n * @param {PlainObject} opts\n * @returns {Promise|GenericArray|PlainObject|string|false}\n */\n\n }, {\n key: \"encapsulate\",\n value: function encapsulate(obj, stateObj, opts) {\n opts = _objectSpread2({\n sync: true\n }, this.options, {}, opts);\n var _opts = opts,\n sync = _opts.sync;\n var that = this,\n types = {},\n refObjs = [],\n // For checking cyclic references\n refKeys = [],\n // For checking cyclic references\n promisesDataRoot = []; // Clone the object deeply while at the same time replacing any\n // special types or cyclic reference:\n\n var cyclic = 'cyclic' in opts ? opts.cyclic : true;\n var _opts2 = opts,\n encapsulateObserver = _opts2.encapsulateObserver;\n\n var ret = _encapsulate('', obj, cyclic, stateObj || {}, promisesDataRoot);\n /**\n *\n * @param {Any} ret\n * @returns {GenericArray|PlainObject|string|false}\n */\n\n\n function finish(ret) {\n // Add `$types` to result only if we ever bumped into a\n // special type (or special case where object has own `$types`)\n var typeNames = Object.values(types);\n\n if (opts.iterateNone) {\n if (typeNames.length) {\n return typeNames[0];\n }\n\n return Typeson.getJSONType(ret);\n }\n\n if (typeNames.length) {\n if (opts.returnTypeNames) {\n return _toConsumableArray(new Set(typeNames));\n } // Special if array (or a primitive) was serialized\n // because JSON would ignore custom `$types` prop on it\n\n\n if (!ret || !isPlainObject(ret) || // Also need to handle if this is an object with its\n // own `$types` property (to avoid ambiguity)\n hasOwn$1.call(ret, '$types')) {\n ret = {\n $: ret,\n $types: {\n $: types\n }\n };\n } else {\n ret.$types = types;\n } // No special types\n\n } else if (isObject(ret) && hasOwn$1.call(ret, '$types')) {\n ret = {\n $: ret,\n $types: true\n };\n }\n\n if (opts.returnTypeNames) {\n return false;\n }\n\n return ret;\n }\n /**\n *\n * @param {Any} ret\n * @param {GenericArray} promisesData\n * @returns {Promise}\n */\n\n\n function checkPromises(_x, _x2) {\n return _checkPromises.apply(this, arguments);\n }\n /**\n *\n * @param {object} stateObj\n * @param {object} ownKeysObj\n * @param {function} cb\n * @returns {undefined}\n */\n\n\n function _checkPromises() {\n _checkPromises = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee2(ret, promisesData) {\n var promResults;\n return regeneratorRuntime.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n _context2.next = 2;\n return Promise.all(promisesData.map(function (pd) {\n return pd[1].p;\n }));\n\n case 2:\n promResults = _context2.sent;\n _context2.next = 5;\n return Promise.all(promResults.map(\n /*#__PURE__*/\n function () {\n var _ref = _asyncToGenerator(\n /*#__PURE__*/\n regeneratorRuntime.mark(function _callee(promResult) {\n var newPromisesData, _promisesData$splice, _promisesData$splice2, prData, _prData, keyPath, cyclic, stateObj, parentObj, key, detectedType, encaps, isTypesonPromise, encaps2;\n\n return regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n newPromisesData = [];\n _promisesData$splice = promisesData.splice(0, 1), _promisesData$splice2 = _slicedToArray(_promisesData$splice, 1), prData = _promisesData$splice2[0];\n _prData = _slicedToArray(prData, 7), keyPath = _prData[0], cyclic = _prData[2], stateObj = _prData[3], parentObj = _prData[4], key = _prData[5], detectedType = _prData[6];\n encaps = _encapsulate(keyPath, promResult, cyclic, stateObj, newPromisesData, true, detectedType);\n isTypesonPromise = hasConstructorOf(encaps, TypesonPromise); // Handle case where an embedded custom type itself\n // returns a `Typeson.Promise`\n\n if (!(keyPath && isTypesonPromise)) {\n _context.next = 11;\n break;\n }\n\n _context.next = 8;\n return encaps.p;\n\n case 8:\n encaps2 = _context.sent;\n parentObj[key] = encaps2;\n return _context.abrupt(\"return\", checkPromises(ret, newPromisesData));\n\n case 11:\n if (keyPath) {\n parentObj[key] = encaps;\n } else if (isTypesonPromise) {\n ret = encaps.p;\n } else {\n // If this is itself a `Typeson.Promise` (because the\n // original value supplied was a `Promise` or\n // because the supplied custom type value resolved\n // to one), returning it below will be fine since\n // a `Promise` is expected anyways given current\n // config (and if not a `Promise`, it will be ready\n // as the resolve value)\n ret = encaps;\n }\n\n return _context.abrupt(\"return\", checkPromises(ret, newPromisesData));\n\n case 13:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n\n return function (_x3) {\n return _ref.apply(this, arguments);\n };\n }()));\n\n case 5:\n return _context2.abrupt(\"return\", ret);\n\n case 6:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n return _checkPromises.apply(this, arguments);\n }\n\n function _adaptBuiltinStateObjectProperties(stateObj, ownKeysObj, cb) {\n Object.assign(stateObj, ownKeysObj);\n var vals = internalStateObjPropsToIgnore.map(function (prop) {\n var tmp = stateObj[prop];\n delete stateObj[prop];\n return tmp;\n }); // eslint-disable-next-line callback-return\n\n cb();\n internalStateObjPropsToIgnore.forEach(function (prop, i) {\n stateObj[prop] = vals[i];\n });\n }\n /**\n *\n * @param {string} keypath\n * @param {Any} value\n * @param {boolean} cyclic\n * @param {PlainObject} stateObj\n * @param {boolean} promisesData\n * @param {boolean} resolvingTypesonPromise\n * @param {string} detectedType\n * @returns {Any}\n */\n\n\n function _encapsulate(keypath, value, cyclic, stateObj, promisesData, resolvingTypesonPromise, detectedType) {\n var ret;\n var observerData = {};\n\n var $typeof = _typeof(value);\n\n var runObserver = encapsulateObserver ? function (obj) {\n var type = detectedType || stateObj.type || Typeson.getJSONType(value);\n encapsulateObserver(Object.assign(obj || observerData, {\n keypath: keypath,\n value: value,\n cyclic: cyclic,\n stateObj: stateObj,\n promisesData: promisesData,\n resolvingTypesonPromise: resolvingTypesonPromise,\n awaitingTypesonPromise: hasConstructorOf(value, TypesonPromise)\n }, {\n type: type\n }));\n } : null;\n\n if (['string', 'boolean', 'number', 'undefined'].includes($typeof)) {\n if (value === undefined || $typeof === 'number' && (isNaN(value) || value === -Infinity || value === Infinity)) {\n if (stateObj.replaced) {\n ret = value;\n } else {\n ret = replace(keypath, value, stateObj, promisesData, false, resolvingTypesonPromise, runObserver);\n }\n\n if (ret !== value) {\n observerData = {\n replaced: ret\n };\n }\n } else {\n ret = value;\n }\n\n if (runObserver) {\n runObserver();\n }\n\n return ret;\n }\n\n if (value === null) {\n if (runObserver) {\n runObserver();\n }\n\n return value;\n }\n\n if (cyclic && !stateObj.iterateIn && !stateObj.iterateUnsetNumeric && value && _typeof(value) === 'object') {\n // Options set to detect cyclic references and be able\n // to rewrite them.\n var refIndex = refObjs.indexOf(value);\n\n if (refIndex < 0) {\n if (cyclic === true) {\n refObjs.push(value);\n refKeys.push(keypath);\n }\n } else {\n types[keypath] = '#';\n\n if (runObserver) {\n runObserver({\n cyclicKeypath: refKeys[refIndex]\n });\n }\n\n return '#' + refKeys[refIndex];\n }\n }\n\n var isPlainObj = isPlainObject(value);\n var isArr = isArray(value);\n var replaced = // Running replace will cause infinite loop as will test\n // positive again\n (isPlainObj || isArr) && (!that.plainObjectReplacers.length || stateObj.replaced) || stateObj.iterateIn ? // Optimization: if plain object and no plain-object\n // replacers, don't try finding a replacer\n value : replace(keypath, value, stateObj, promisesData, isPlainObj || isArr, null, runObserver);\n var clone;\n\n if (replaced !== value) {\n ret = replaced;\n observerData = {\n replaced: replaced\n };\n } else {\n // eslint-disable-next-line no-lonely-if\n if (keypath === '' && hasConstructorOf(value, TypesonPromise)) {\n promisesData.push([keypath, value, cyclic, stateObj, undefined, undefined, stateObj.type]);\n ret = value;\n } else if (isArr && stateObj.iterateIn !== 'object' || stateObj.iterateIn === 'array') {\n clone = new Array(value.length);\n observerData = {\n clone: clone\n };\n } else if (!['function', 'symbol'].includes(_typeof(value)) && !('toJSON' in value) && !hasConstructorOf(value, TypesonPromise) && !hasConstructorOf(value, Promise) && !hasConstructorOf(value, ArrayBuffer) || isPlainObj || stateObj.iterateIn === 'object') {\n clone = {};\n\n if (stateObj.addLength) {\n clone.length = value.length;\n }\n\n observerData = {\n clone: clone\n };\n } else {\n ret = value; // Only clone vanilla objects and arrays\n }\n }\n\n if (runObserver) {\n runObserver();\n }\n\n if (opts.iterateNone) {\n return clone || ret;\n }\n\n if (!clone) {\n return ret;\n } // Iterate object or array\n\n\n if (stateObj.iterateIn) {\n var _loop = function _loop(key) {\n var ownKeysObj = {\n ownKeys: hasOwn$1.call(value, key)\n };\n\n _adaptBuiltinStateObjectProperties(stateObj, ownKeysObj, function () {\n var kp = keypath + (keypath ? '.' : '') + escapeKeyPathComponent(key);\n\n var val = _encapsulate(kp, value[key], Boolean(cyclic), stateObj, promisesData, resolvingTypesonPromise);\n\n if (hasConstructorOf(val, TypesonPromise)) {\n promisesData.push([kp, val, Boolean(cyclic), stateObj, clone, key, stateObj.type]);\n } else if (val !== undefined) {\n clone[key] = val;\n }\n });\n };\n\n // eslint-disable-next-line guard-for-in\n for (var key in value) {\n _loop(key);\n }\n\n if (runObserver) {\n runObserver({\n endIterateIn: true,\n end: true\n });\n }\n } else {\n // Note: Non-indexes on arrays won't survive stringify so\n // somewhat wasteful for arrays, but so too is iterating\n // all numeric indexes on sparse arrays when not wanted\n // or filtering own keys for positive integers\n keys(value).forEach(function (key) {\n var kp = keypath + (keypath ? '.' : '') + escapeKeyPathComponent(key);\n var ownKeysObj = {\n ownKeys: true\n };\n\n _adaptBuiltinStateObjectProperties(stateObj, ownKeysObj, function () {\n var val = _encapsulate(kp, value[key], Boolean(cyclic), stateObj, promisesData, resolvingTypesonPromise);\n\n if (hasConstructorOf(val, TypesonPromise)) {\n promisesData.push([kp, val, Boolean(cyclic), stateObj, clone, key, stateObj.type]);\n } else if (val !== undefined) {\n clone[key] = val;\n }\n });\n });\n\n if (runObserver) {\n runObserver({\n endIterateOwn: true,\n end: true\n });\n }\n } // Iterate array for non-own numeric properties (we can't\n // replace the prior loop though as it iterates non-integer\n // keys)\n\n\n if (stateObj.iterateUnsetNumeric) {\n var vl = value.length;\n\n var _loop2 = function _loop2(i) {\n if (!(i in value)) {\n // No need to escape numeric\n var kp = keypath + (keypath ? '.' : '') + i;\n var ownKeysObj = {\n ownKeys: false\n };\n\n _adaptBuiltinStateObjectProperties(stateObj, ownKeysObj, function () {\n var val = _encapsulate(kp, undefined, Boolean(cyclic), stateObj, promisesData, resolvingTypesonPromise);\n\n if (hasConstructorOf(val, TypesonPromise)) {\n promisesData.push([kp, val, Boolean(cyclic), stateObj, clone, i, stateObj.type]);\n } else if (val !== undefined) {\n clone[i] = val;\n }\n });\n }\n };\n\n for (var i = 0; i < vl; i++) {\n _loop2(i);\n }\n\n if (runObserver) {\n runObserver({\n endIterateUnsetNumeric: true,\n end: true\n });\n }\n }\n\n return clone;\n }\n /**\n *\n * @param {string} keypath\n * @param {Any} value\n * @param {PlainObject} stateObj\n * @param {GenericArray} promisesData\n * @param {boolean} plainObject\n * @param {boolean} resolvingTypesonPromise\n * @param {function} [runObserver]\n * @returns {*}\n */\n\n\n function replace(keypath, value, stateObj, promisesData, plainObject, resolvingTypesonPromise, runObserver) {\n // Encapsulate registered types\n var replacers = plainObject ? that.plainObjectReplacers : that.nonplainObjectReplacers;\n var i = replacers.length;\n\n while (i--) {\n var replacer = replacers[i];\n\n if (replacer.test(value, stateObj)) {\n var type = replacer.type;\n\n if (that.revivers[type]) {\n // Record the type only if a corresponding reviver\n // exists. This is to support specs where only\n // replacement is done.\n // For example, ensuring deep cloning of the object,\n // or replacing a type to its equivalent without\n // the need to revive it.\n var existing = types[keypath]; // type can comprise an array of types (see test\n // \"should support intermediate types\")\n\n types[keypath] = existing ? [type].concat(existing) : type;\n }\n\n Object.assign(stateObj, {\n type: type,\n replaced: true\n });\n\n if ((sync || !replacer.replaceAsync) && !replacer.replace) {\n if (runObserver) {\n runObserver({\n typeDetected: true\n });\n }\n\n return _encapsulate(keypath, value, cyclic && 'readonly', stateObj, promisesData, resolvingTypesonPromise, type);\n }\n\n if (runObserver) {\n runObserver({\n replacing: true\n });\n } // Now, also traverse the result in case it contains its\n // own types to replace\n\n\n var replaceMethod = sync || !replacer.replaceAsync ? 'replace' : 'replaceAsync';\n return _encapsulate(keypath, replacer[replaceMethod](value, stateObj), cyclic && 'readonly', stateObj, promisesData, resolvingTypesonPromise, type);\n }\n }\n\n return value;\n }\n\n return promisesDataRoot.length ? sync && opts.throwOnBadSyncType ? function () {\n throw new TypeError('Sync method requested but async result obtained');\n }() : Promise.resolve(checkPromises(ret, promisesDataRoot)).then(finish) : !sync && opts.throwOnBadSyncType ? function () {\n throw new TypeError('Async method requested but sync result obtained');\n }() // If this is a synchronous request for stringification, yet\n // a promise is the result, we don't want to resolve leading\n // to an async result, so we return an array to avoid\n // ambiguity\n : opts.stringification && sync ? [finish(ret)] : sync ? finish(ret) : Promise.resolve(finish(ret));\n }\n /**\n * Also sync but throws on non-sync result.\n * @param {*} obj\n * @param {object} stateObj\n * @param {object} opts\n * @returns {*}\n */\n\n }, {\n key: \"encapsulateSync\",\n value: function encapsulateSync(obj, stateObj, opts) {\n return this.encapsulate(obj, stateObj, _objectSpread2({\n throwOnBadSyncType: true\n }, opts, {\n sync: true\n }));\n }\n /**\n * @param {*} obj\n * @param {object} stateObj\n * @param {object} opts\n * @returns {*}\n */\n\n }, {\n key: \"encapsulateAsync\",\n value: function encapsulateAsync(obj, stateObj, opts) {\n return this.encapsulate(obj, stateObj, _objectSpread2({\n throwOnBadSyncType: true\n }, opts, {\n sync: false\n }));\n }\n /**\n * Revive an encapsulated object.\n * This method is used internally by `Typeson.parse()`.\n * @param {object} obj - Object to revive. If it has `$types` member, the\n * properties that are listed there will be replaced with its true type\n * instead of just plain objects.\n * @param {object} opts\n * @throws TypeError If mismatch between sync/async type and result\n * @returns {Promise|*} If async, returns a Promise that resolves to `*`\n */\n\n }, {\n key: \"revive\",\n value: function revive(obj, opts) {\n var types = obj && obj.$types; // No type info added. Revival not needed.\n\n if (!types) {\n return obj;\n } // Object happened to have own `$types` property but with\n // no actual types, so we unescape and return that object\n\n\n if (types === true) {\n return obj.$;\n }\n\n opts = _objectSpread2({\n sync: true\n }, this.options, {}, opts);\n var _opts3 = opts,\n sync = _opts3.sync;\n var keyPathResolutions = [];\n var stateObj = {};\n var ignore$Types = true; // Special when root object is not a trivial Object, it will\n // be encapsulated in `$`. It will also be encapsulated in\n // `$` if it has its own `$` property to avoid ambiguity\n\n if (types.$ && isPlainObject(types.$)) {\n obj = obj.$;\n types = types.$;\n ignore$Types = false;\n }\n\n var that = this;\n /**\n * @callback RevivalReducer\n * @param {Any} value\n * @param {string} type\n * @returns {Any}\n */\n\n /**\n *\n * @param {string} type\n * @param {Any} val\n * @returns {[type]} [description]\n */\n\n function executeReviver(type, val) {\n var _ref2 = that.revivers[type] || [],\n _ref3 = _slicedToArray(_ref2, 1),\n reviver = _ref3[0];\n\n if (!reviver) {\n throw new Error('Unregistered type: ' + type);\n } // Only `sync` expected here, as problematic async would\n // be missing both `reviver` and `reviverAsync`, and\n // encapsulation shouldn't have added types, so\n // should have made an early exit\n\n\n if (sync && !('revive' in reviver)) {\n // Just return value as is\n return val;\n }\n\n return reviver[sync && reviver.revive ? 'revive' : !sync && reviver.reviveAsync ? 'reviveAsync' : 'revive'](val, stateObj);\n }\n /**\n *\n * @returns {void|TypesonPromise}\n */\n\n\n function revivePlainObjects() {\n // const references = [];\n // const reviveTypes = [];\n var plainObjectTypes = [];\n Object.entries(types).forEach(function (_ref4) {\n var _ref5 = _slicedToArray(_ref4, 2),\n keypath = _ref5[0],\n type = _ref5[1];\n\n if (type === '#') {\n /*\n references.push({\n keypath,\n reference: getByKeyPath(obj, keypath)\n });\n */\n return;\n }\n\n [].concat(type).forEach(function (type) {\n var _ref6 = that.revivers[type] || [null, {}],\n _ref7 = _slicedToArray(_ref6, 2),\n plain = _ref7[1].plain;\n\n if (!plain) {\n // reviveTypes.push({keypath, type});\n return;\n }\n\n plainObjectTypes.push({\n keypath: keypath,\n type: type\n });\n delete types[keypath]; // Avoid repeating\n });\n });\n\n if (!plainObjectTypes.length) {\n return undefined;\n } // console.log(plainObjectTypes.sort(nestedPathsFirst));\n\n /**\n * @typedef {PlainObject} PlainObjectType\n * @property {string} keypath\n * @property {string} type\n */\n\n\n return plainObjectTypes.sort(nestedPathsFirst).reduce(function reducer(possibleTypesonPromise, _ref8) {\n var keypath = _ref8.keypath,\n type = _ref8.type;\n\n if (isThenable(possibleTypesonPromise)) {\n return possibleTypesonPromise.then(function (val) {\n return reducer(val, {\n keypath: keypath,\n type: type\n });\n });\n } // console.log('obj', JSON.stringify(keypath), obj);\n\n\n var val = getByKeyPath(obj, keypath);\n val = executeReviver(type, val);\n\n if (hasConstructorOf(val, TypesonPromise)) {\n return val.then(function (v) {\n var newVal = setAtKeyPath(obj, keypath, v);\n\n if (newVal === v) {\n obj = newVal;\n }\n\n return undefined;\n });\n }\n\n var newVal = setAtKeyPath(obj, keypath, val);\n\n if (newVal === val) {\n obj = newVal;\n }\n\n return undefined;\n }, undefined // This argument must be explicit\n ); // references.forEach(({keypath, reference}) => {});\n // reviveTypes.sort(nestedPathsFirst).forEach(() => {});\n }\n\n var revivalPromises = [];\n /**\n *\n * @param {string} keypath\n * @param {Any} value\n * @param {?(Array|object)} target\n * @param {Array|object} [clone]\n * @param {string} [key]\n * @returns {Any}\n */\n\n function _revive(keypath, value, target, clone, key) {\n if (ignore$Types && keypath === '$types') {\n return undefined;\n }\n\n var type = types[keypath];\n var isArr = isArray(value);\n\n if (isArr || isPlainObject(value)) {\n var _clone = isArr ? new Array(value.length) : {}; // Iterate object or array\n\n\n keys(value).forEach(function (k) {\n var val = _revive(keypath + (keypath ? '.' : '') + escapeKeyPathComponent(k), value[k], target || _clone, _clone, k);\n\n var set = function set(v) {\n if (hasConstructorOf(v, Undefined)) {\n _clone[k] = undefined;\n } else if (v !== undefined) {\n _clone[k] = v;\n }\n\n return v;\n };\n\n if (hasConstructorOf(val, TypesonPromise)) {\n revivalPromises.push(val.then(function (ret) {\n return set(ret);\n }));\n } else {\n set(val);\n }\n });\n value = _clone; // Try to resolve cyclic reference as soon as available\n\n while (keyPathResolutions.length) {\n var _keyPathResolutions$ = _slicedToArray(keyPathResolutions[0], 4),\n _target = _keyPathResolutions$[0],\n keyPath = _keyPathResolutions$[1],\n _clone2 = _keyPathResolutions$[2],\n k = _keyPathResolutions$[3];\n\n var val = getByKeyPath(_target, keyPath); // Typeson.Undefined not expected here as not cyclic or\n // `undefined`\n\n if (val !== undefined) {\n _clone2[k] = val;\n } else {\n break;\n }\n\n keyPathResolutions.splice(0, 1);\n }\n }\n\n if (!type) {\n return value;\n }\n\n if (type === '#') {\n var _ret = getByKeyPath(target, value.slice(1));\n\n if (_ret === undefined) {\n // Cyclic reference not yet available\n keyPathResolutions.push([target, value.slice(1), clone, key]);\n }\n\n return _ret;\n } // `type` can be an array here\n\n\n return [].concat(type).reduce(function reducer(val, typ) {\n if (hasConstructorOf(val, TypesonPromise)) {\n return val.then(function (v) {\n // TypesonPromise here too\n return reducer(v, typ);\n });\n }\n\n return executeReviver(typ, val);\n }, value);\n }\n /**\n *\n * @param {Any} retrn\n * @returns {undefined|Any}\n */\n\n\n function checkUndefined(retrn) {\n return hasConstructorOf(retrn, Undefined) ? undefined : retrn;\n }\n\n var possibleTypesonPromise = revivePlainObjects();\n var ret;\n\n if (hasConstructorOf(possibleTypesonPromise, TypesonPromise)) {\n ret = possibleTypesonPromise.then(function () {\n return obj;\n });\n } else {\n ret = _revive('', obj, null);\n\n if (revivalPromises.length) {\n // Ensure children resolved\n ret = TypesonPromise.resolve(ret).then(function (r) {\n return TypesonPromise.all([// May be a TypesonPromise or not\n r].concat(revivalPromises));\n }).then(function (_ref9) {\n var _ref10 = _slicedToArray(_ref9, 1),\n r = _ref10[0];\n\n return r;\n });\n }\n }\n\n return isThenable(ret) ? sync && opts.throwOnBadSyncType ? function () {\n throw new TypeError('Sync method requested but async result obtained');\n }() : hasConstructorOf(ret, TypesonPromise) ? ret.p.then(checkUndefined) : ret : !sync && opts.throwOnBadSyncType ? function () {\n throw new TypeError('Async method requested but sync result obtained');\n }() : sync ? checkUndefined(ret) : Promise.resolve(checkUndefined(ret));\n }\n /**\n * Also sync but throws on non-sync result.\n * @param {Any} obj\n * @param {object} opts\n * @returns {Any}\n */\n\n }, {\n key: \"reviveSync\",\n value: function reviveSync(obj, opts) {\n return this.revive(obj, _objectSpread2({\n throwOnBadSyncType: true\n }, opts, {\n sync: true\n }));\n }\n /**\n * @param {Any} obj\n * @param {object} opts\n * @returns {Promise} Resolves to `*`\n */\n\n }, {\n key: \"reviveAsync\",\n value: function reviveAsync(obj, opts) {\n return this.revive(obj, _objectSpread2({\n throwOnBadSyncType: true\n }, opts, {\n sync: false\n }));\n }\n /**\n * Register types.\n * For examples on how to use this method, see\n * {@link https://github.com/dfahlander/typeson-registry/tree/master/types}.\n * @param {object.[]} typeSpecSets - Types and\n * their functions [test, encapsulate, revive];\n * @param {object} opts\n * @returns {Typeson}\n */\n\n }, {\n key: \"register\",\n value: function register(typeSpecSets, opts) {\n opts = opts || {};\n [].concat(typeSpecSets).forEach(function R(typeSpec) {\n var _this = this;\n\n // Allow arrays of arrays of arrays...\n if (isArray(typeSpec)) {\n return typeSpec.map(function (typSpec) {\n return R.call(_this, typSpec);\n });\n }\n\n typeSpec && keys(typeSpec).forEach(function (typeId) {\n if (typeId === '#') {\n throw new TypeError('# cannot be used as a type name as it is reserved ' + 'for cyclic objects');\n } else if (Typeson.JSON_TYPES.includes(typeId)) {\n throw new TypeError('Plain JSON object types are reserved as type names');\n }\n\n var spec = typeSpec[typeId];\n var replacers = spec && spec.testPlainObjects ? this.plainObjectReplacers : this.nonplainObjectReplacers;\n var existingReplacer = replacers.filter(function (r) {\n return r.type === typeId;\n });\n\n if (existingReplacer.length) {\n // Remove existing spec and replace with this one.\n replacers.splice(replacers.indexOf(existingReplacer[0]), 1);\n delete this.revivers[typeId];\n delete this.types[typeId];\n }\n\n if (typeof spec === 'function') {\n // Support registering just a class without replacer/reviver\n var Class = spec;\n spec = {\n test: function test(x) {\n return x && x.constructor === Class;\n },\n replace: function replace(x) {\n return _objectSpread2({}, x);\n },\n revive: function revive(x) {\n return Object.assign(Object.create(Class.prototype), x);\n }\n };\n } else if (isArray(spec)) {\n var _spec = spec,\n _spec2 = _slicedToArray(_spec, 3),\n test = _spec2[0],\n replace = _spec2[1],\n revive = _spec2[2];\n\n spec = {\n test: test,\n replace: replace,\n revive: revive\n };\n }\n\n if (!spec || !spec.test) {\n return;\n }\n\n var replacerObj = {\n type: typeId,\n test: spec.test.bind(spec)\n };\n\n if (spec.replace) {\n replacerObj.replace = spec.replace.bind(spec);\n }\n\n if (spec.replaceAsync) {\n replacerObj.replaceAsync = spec.replaceAsync.bind(spec);\n }\n\n var start = typeof opts.fallback === 'number' ? opts.fallback : opts.fallback ? 0 : Infinity;\n\n if (spec.testPlainObjects) {\n this.plainObjectReplacers.splice(start, 0, replacerObj);\n } else {\n this.nonplainObjectReplacers.splice(start, 0, replacerObj);\n } // Todo: We might consider a testAsync type\n\n\n if (spec.revive || spec.reviveAsync) {\n var reviverObj = {};\n\n if (spec.revive) {\n reviverObj.revive = spec.revive.bind(spec);\n }\n\n if (spec.reviveAsync) {\n reviverObj.reviveAsync = spec.reviveAsync.bind(spec);\n }\n\n this.revivers[typeId] = [reviverObj, {\n plain: spec.testPlainObjects\n }];\n } // Record to be retrieved via public types property.\n\n\n this.types[typeId] = spec;\n }, this);\n }, this);\n return this;\n }\n }]);\n\n return Typeson;\n }();\n /**\n * We keep this function minimized so if using two instances of this\n * library, where one is minimized and one is not, it will still work\n * with `hasConstructorOf`.\n * @class\n */\n\n\n var Undefined = function Undefined() {\n _classCallCheck(this, Undefined);\n }; // eslint-disable-line space-before-blocks\n\n\n Undefined.__typeson__type__ = 'TypesonUndefined'; // The following provide classes meant to avoid clashes with other values\n // To insist `undefined` should be added\n\n Typeson.Undefined = Undefined; // To support async encapsulation/stringification\n\n Typeson.Promise = TypesonPromise; // Some fundamental type-checking utilities\n\n Typeson.isThenable = isThenable;\n Typeson.toStringTag = toStringTag;\n Typeson.hasConstructorOf = hasConstructorOf;\n Typeson.isObject = isObject;\n Typeson.isPlainObject = isPlainObject;\n Typeson.isUserObject = isUserObject;\n Typeson.escapeKeyPathComponent = escapeKeyPathComponent;\n Typeson.unescapeKeyPathComponent = unescapeKeyPathComponent;\n Typeson.getByKeyPath = getByKeyPath;\n Typeson.getJSONType = getJSONType;\n Typeson.JSON_TYPES = ['null', 'boolean', 'number', 'string', 'array', 'object'];\n\n return Typeson;\n\n})));\n","import Typeson from 'typeson';\nimport {encode, decode} from 'base64-arraybuffer-es6';\n\nconst arraybuffer = {\n arraybuffer: {\n test (x) { return Typeson.toStringTag(x) === 'ArrayBuffer'; },\n replace (b, stateObj) {\n if (!stateObj.buffers) {\n stateObj.buffers = [];\n }\n const index = stateObj.buffers.indexOf(b);\n if (index > -1) {\n return {index};\n }\n stateObj.buffers.push(b);\n return encode(b);\n },\n revive (b64, stateObj) {\n if (!stateObj.buffers) {\n stateObj.buffers = [];\n }\n if (typeof b64 === 'object') {\n return stateObj.buffers[b64.index];\n }\n const buffer = decode(b64);\n stateObj.buffers.push(buffer);\n return buffer;\n }\n }\n};\n\nexport default arraybuffer;\n\n// See also typed-arrays!\n","/* globals BigInt */\nimport Typeson from 'typeson';\n\nconst bigintObject = {\n bigintObject: {\n test (x) {\n return typeof x === 'object' && Typeson.hasConstructorOf(x, BigInt);\n },\n replace (n) { return String(n); },\n revive (s) {\n // Filed this to avoid error: https://github.com/eslint/eslint/issues/11810\n // eslint-disable-next-line no-new-object\n return new Object(BigInt(s));\n }\n }\n};\n\nexport default bigintObject;\n","/* globals BigInt */\n\nconst bigint = {\n bigint: {\n test (x) {\n return typeof x === 'bigint';\n },\n replace (n) { return String(n); },\n revive (s) { return BigInt(s); }\n }\n};\n\nexport default bigint;\n","/**\n * Not currently in use internally, but provided for parity.\n * @param {ArrayBuffer} buf\n * @returns {Uint8Array}\n */\nfunction arraybuffer2string (buf) {\n return new Uint8Array(buf).reduce(\n (s, byte) => s + String.fromCharCode(byte), ''\n );\n}\n\n/**\n *\n * @param {string} str\n * @returns {ArrayBuffer}\n */\nfunction string2arraybuffer (str) {\n /*\n // UTF-8 approaches\n const utf8 = unescape(encodeURIComponent(str));\n const arr = new Uint8Array(utf8.length);\n for (let i = 0; i < utf8.length; i++) {\n arr[i] = utf8.charCodeAt(i);\n }\n return arr.buffer;\n\n const utf8 = [];\n for (let i = 0; i < str.length; i++) {\n let charcode = str.charCodeAt(i);\n if (charcode < 0x80) utf8.push(charcode);\n else if (charcode < 0x800) {\n utf8.push(0xc0 | (charcode >> 6),\n 0x80 | (charcode & 0x3f));\n } else if (charcode < 0xd800 || charcode >= 0xe000) {\n utf8.push(0xe0 | (charcode >> 12),\n 0x80 | ((charcode >> 6) & 0x3f),\n 0x80 | (charcode & 0x3f));\n // surrogate pair\n } else {\n i++;\n // UTF-16 encodes 0x10000-0x10FFFF by\n // subtracting 0x10000 and splitting the\n // 20 bits of 0x0-0xFFFFF into two halves\n charcode = 0x10000 + (((charcode & 0x3ff) << 10) |\n (str.charCodeAt(i) & 0x3ff));\n utf8.push(0xf0 | (charcode >> 18),\n 0x80 | ((charcode >> 12) & 0x3f),\n 0x80 | ((charcode >> 6) & 0x3f),\n 0x80 | (charcode & 0x3f));\n }\n }\n return utf8;\n */\n /*\n // Working UTF-16 options (equivalents)\n const buf = new ArrayBuffer(str.length * 2); // 2 bytes for each char\n const bufView = new Uint16Array(buf);\n for (let i = 0, strLen = str.length; i < strLen; i++) {\n bufView[i] = str.charCodeAt(i);\n }\n return buf;\n */\n\n const array = new Uint8Array(str.length);\n for (let i = 0; i < str.length; i++) {\n array[i] = str.charCodeAt(i); // & 0xff;\n }\n return array.buffer;\n}\nexport {arraybuffer2string, string2arraybuffer};\n","/* globals XMLHttpRequest, Blob, FileReader */\nimport Typeson from 'typeson';\nimport {string2arraybuffer} from '../utils/stringArrayBuffer.js';\n\nconst blob = {\n blob: {\n test (x) { return Typeson.toStringTag(x) === 'Blob'; },\n replace (b) { // Sync\n const req = new XMLHttpRequest();\n req.overrideMimeType('text/plain; charset=x-user-defined');\n // eslint-disable-next-line max-len\n // eslint-disable-next-line node/no-unsupported-features/node-builtins\n req.open('GET', URL.createObjectURL(b), false); // Sync\n req.send();\n\n // Seems not feasible to accurately simulate\n /* istanbul ignore next */\n if (req.status !== 200 && req.status !== 0) {\n throw new Error('Bad Blob access: ' + req.status);\n }\n return {\n type: b.type,\n stringContents: req.responseText\n };\n },\n revive ({type, stringContents}) {\n return new Blob([string2arraybuffer(stringContents)], {type});\n },\n replaceAsync (b) {\n return new Typeson.Promise((resolve, reject) => {\n /*\n if (b.isClosed) { // On MDN, but not in https://w3c.github.io/FileAPI/#dfn-Blob\n reject(new Error('The Blob is closed'));\n return;\n }\n */\n const reader = new FileReader();\n reader.addEventListener('load', () => {\n resolve({\n type: b.type,\n stringContents: reader.result\n });\n });\n // Seems not feasible to accurately simulate\n /* istanbul ignore next */\n reader.addEventListener('error', () => {\n reject(reader.error);\n });\n reader.readAsBinaryString(b);\n });\n }\n }\n};\n\nexport default blob;\n","/* globals performance */\n\n// The `performance` global is optional\n\n/**\n * @todo We could use `import generateUUID from 'uuid/v4';` (but it needs\n * crypto library, etc.; `rollup-plugin-node-builtins` doesn't recommend\n * using its own version and though there is ,\n * it may be troublesome to bundle and not strongly needed)\n * @returns {string}\n */\nexport default function generateUUID () { // Adapted from original: public domain/MIT: http://stackoverflow.com/a/8809472/271577\n /* istanbul ignore next */\n let d = new Date().getTime() +\n // use high-precision timer if available\n (typeof performance !== 'undefined' && typeof performance.now === 'function'\n ? performance.now()\n : 0);\n\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/gu, function (c) {\n /* eslint-disable no-bitwise */\n const r = (d + Math.random() * 16) % 16 | 0;\n d = Math.floor(d / 16);\n return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);\n /* eslint-enable no-bitwise */\n });\n}\n","import generateUUID from '../utils/generateUUID.js';\n\nconst cloneableObjectsByUUID = {};\n\nconst cloneable = {\n cloneable: {\n test (x) {\n return x && typeof x === 'object' &&\n typeof x[Symbol.for('cloneEncapsulate')] === 'function';\n },\n replace (clonable) {\n const encapsulated = clonable[Symbol.for('cloneEncapsulate')]();\n const uuid = generateUUID();\n cloneableObjectsByUUID[uuid] = clonable;\n return {uuid, encapsulated};\n },\n revive ({uuid, encapsulated}) {\n return cloneableObjectsByUUID[uuid][Symbol.for('cloneRevive')](\n encapsulated\n );\n }\n }\n};\n\nexport default cloneable;\n","import Typeson from 'typeson';\nimport {encode, decode} from 'base64-arraybuffer-es6';\n\nconst dataview = {\n dataview: {\n test (x) { return Typeson.toStringTag(x) === 'DataView'; },\n replace ({buffer, byteOffset, byteLength}, stateObj) {\n if (!stateObj.buffers) {\n stateObj.buffers = [];\n }\n const index = stateObj.buffers.indexOf(buffer);\n if (index > -1) {\n return {index, byteOffset, byteLength};\n }\n stateObj.buffers.push(buffer);\n return {\n encoded: encode(buffer),\n byteOffset,\n byteLength\n };\n },\n revive (b64Obj, stateObj) {\n if (!stateObj.buffers) {\n stateObj.buffers = [];\n }\n const {byteOffset, byteLength, encoded, index} = b64Obj;\n let buffer;\n if ('index' in b64Obj) {\n buffer = stateObj.buffers[index];\n } else {\n buffer = decode(encoded);\n stateObj.buffers.push(buffer);\n }\n return new DataView(buffer, byteOffset, byteLength);\n }\n }\n};\n\nexport default dataview;\n","import Typeson from 'typeson';\n\nconst date = {\n date: {\n test (x) { return Typeson.toStringTag(x) === 'Date'; },\n replace (dt) {\n const time = dt.getTime();\n if (Number.isNaN(time)) {\n return 'NaN';\n }\n return time;\n },\n revive (time) {\n if (time === 'NaN') {\n return new Date(Number.NaN);\n }\n return new Date(time);\n }\n }\n};\n\nexport default date;\n","import Typeson from 'typeson';\n\nconst error = {\n error: {\n test (x) { return Typeson.toStringTag(x) === 'Error'; },\n replace ({name, message}) {\n return {name, message};\n },\n revive ({name, message}) {\n const e = new Error(message);\n e.name = name;\n return e;\n }\n }\n};\n// See also errors.js that may be registered after having registered this type.\n\nexport default error;\n","/* eslint-env browser, node */\nimport Typeson from 'typeson';\n\n/* istanbul ignore next */\nconst _global = typeof self === 'undefined' ? global : self;\n\nconst errors = {};\n// Comprises all built-in errors.\n[\n 'TypeError',\n 'RangeError',\n 'SyntaxError',\n 'ReferenceError',\n 'EvalError',\n 'URIError',\n 'InternalError' // non-standard\n].forEach((errName) => {\n const Cnstrctr = _global[errName];\n if (Cnstrctr) {\n errors[errName.toLowerCase()] = {\n test (x) { return Typeson.hasConstructorOf(x, Cnstrctr); },\n replace (e) { return e.message; },\n revive (message) { return new Cnstrctr(message); }\n };\n }\n});\n\nexport default errors;\n","/* globals XMLHttpRequest, File, FileReader */\nimport Typeson from 'typeson';\nimport {string2arraybuffer} from '../utils/stringArrayBuffer.js';\n\nconst file = {\n file: {\n test (x) { return Typeson.toStringTag(x) === 'File'; },\n replace (f) { // Sync\n const req = new XMLHttpRequest();\n req.overrideMimeType('text/plain; charset=x-user-defined');\n // eslint-disable-next-line max-len\n // eslint-disable-next-line node/no-unsupported-features/node-builtins\n req.open('GET', URL.createObjectURL(f), false); // Sync\n req.send();\n\n // Seems not feasible to accurately simulate\n /* istanbul ignore next */\n if (req.status !== 200 && req.status !== 0) {\n throw new Error('Bad File access: ' + req.status);\n }\n return {\n type: f.type,\n stringContents: req.responseText,\n name: f.name,\n lastModified: f.lastModified\n };\n },\n revive ({name, type, stringContents, lastModified}) {\n return new File([string2arraybuffer(stringContents)], name, {\n type,\n lastModified\n });\n },\n replaceAsync (f) {\n return new Typeson.Promise(function (resolve, reject) {\n /*\n if (f.isClosed) { // On MDN, but not in https://w3c.github.io/FileAPI/#dfn-Blob\n reject(new Error('The File is closed'));\n return;\n }\n */\n const reader = new FileReader();\n reader.addEventListener('load', function () {\n resolve({\n type: f.type,\n stringContents: reader.result,\n name: f.name,\n lastModified: f.lastModified\n });\n });\n // Seems not feasible to accurately simulate\n /* istanbul ignore next */\n reader.addEventListener('error', function () {\n reject(reader.error);\n });\n reader.readAsBinaryString(f);\n });\n }\n }\n};\n\nexport default file;\n","import Typeson from 'typeson';\nimport file from './file.js';\n\nconst filelist = {\n file: file.file,\n filelist: {\n test (x) { return Typeson.toStringTag(x) === 'FileList'; },\n replace (fl) {\n const arr = [];\n for (let i = 0; i < fl.length; i++) {\n arr[i] = fl.item(i);\n }\n return arr;\n },\n revive (o) {\n /**\n * `FileList` polyfill.\n */\n class FileList {\n /**\n * Set private properties and length.\n */\n constructor () {\n // eslint-disable-next-line prefer-rest-params\n this._files = arguments[0];\n this.length = this._files.length;\n }\n /**\n * @param {Integer} index\n * @returns {File}\n */\n item (index) {\n return this._files[index];\n }\n /* eslint-disable class-methods-use-this */\n /**\n * @returns {\"FileList\"}\n */\n get [Symbol.toStringTag] () {\n /* eslint-enable class-methods-use-this */\n return 'FileList';\n }\n }\n return new FileList(o);\n }\n }\n};\n\nexport default filelist;\n","/* globals createImageBitmap */\n// `ImageBitmap` is browser / DOM specific. It also can only work\n// same-domain (or CORS)\n\nimport Typeson from 'typeson';\n\nconst imagebitmap = {\n imagebitmap: {\n test (x) {\n return Typeson.toStringTag(x) === 'ImageBitmap' ||\n // In Node, our polyfill sets the dataset on a canvas\n // element as JSDom no longer allows overriding toStringTag\n (x && x.dataset && x.dataset.toStringTag === 'ImageBitmap');\n },\n replace (bm) {\n const canvas = document.createElement('canvas');\n const ctx = canvas.getContext('2d');\n ctx.drawImage(bm, 0, 0);\n // Although `width` and `height` are part of `ImageBitMap`,\n // these will be auto-created for us when reviving with the\n // data URL (and they are not settable even if they weren't)\n // return {\n // width: bm.width, height: bm.height, dataURL: canvas.toDataURL()\n // };\n return canvas.toDataURL();\n },\n revive (o) {\n /*\n var req = new XMLHttpRequest();\n req.open('GET', o, false); // Sync\n if (req.status !== 200 && req.status !== 0) {\n throw new Error('Bad ImageBitmap access: ' + req.status);\n }\n req.send();\n return req.responseText;\n */\n const canvas = document.createElement('canvas');\n const ctx = canvas.getContext('2d');\n const img = document.createElement('img');\n // The onload is needed by some browsers per http://stackoverflow.com/a/4776378/271577\n img.addEventListener('load', function () {\n ctx.drawImage(img, 0, 0);\n });\n img.src = o;\n // Works in contexts allowing an `ImageBitmap` (We might use\n // `OffscreenCanvas.transferToBitmap` when supported)\n return canvas;\n },\n reviveAsync (o) {\n const canvas = document.createElement('canvas');\n const ctx = canvas.getContext('2d');\n const img = document.createElement('img');\n // The onload is needed by some browsers per http://stackoverflow.com/a/4776378/271577\n img.addEventListener('load', function () {\n ctx.drawImage(img, 0, 0);\n });\n img.src = o; // o.dataURL;\n return createImageBitmap(canvas); // Returns a promise\n }\n }\n};\n\nexport default imagebitmap;\n","/* globals ImageData */\n// `ImageData` is browser / DOM specific (though `node-canvas` has it\n// available on `Canvas`).\n\nimport Typeson from 'typeson';\n\nconst imagedata = {\n imagedata: {\n test (x) { return Typeson.toStringTag(x) === 'ImageData'; },\n replace (d) {\n return {\n // Ensure `length` gets preserved for revival\n array: [...d.data],\n width: d.width,\n height: d.height\n };\n },\n revive (o) {\n return new ImageData(\n new Uint8ClampedArray(o.array), o.width, o.height\n );\n }\n }\n};\n\nexport default imagedata;\n","const infinity = {\n infinity: {\n test (x) { return x === Infinity; },\n replace (n) { return 'Infinity'; },\n revive (s) { return Infinity; }\n }\n};\n\nexport default infinity;\n","import Typeson from 'typeson';\n\nconst IntlCollator = {\n test (x) { return Typeson.hasConstructorOf(x, Intl.Collator); },\n replace (c) { return c.resolvedOptions(); },\n revive (options) { return new Intl.Collator(options.locale, options); }\n};\n\nconst IntlDateTimeFormat = {\n test (x) { return Typeson.hasConstructorOf(x, Intl.DateTimeFormat); },\n replace (dtf) { return dtf.resolvedOptions(); },\n revive (options) {\n return new Intl.DateTimeFormat(options.locale, options);\n }\n};\n\nconst IntlNumberFormat = {\n test (x) { return Typeson.hasConstructorOf(x, Intl.NumberFormat); },\n replace (nf) { return nf.resolvedOptions(); },\n revive (options) { return new Intl.NumberFormat(options.locale, options); }\n};\n\nconst intlTypes = {\n IntlCollator,\n IntlDateTimeFormat,\n IntlNumberFormat\n};\n\nexport default intlTypes;\n","import Typeson from 'typeson';\n\nconst map = {\n map: {\n test (x) { return Typeson.toStringTag(x) === 'Map'; },\n replace (mp) { return [...mp.entries()]; },\n revive (entries) { return new Map(entries); }\n }\n};\n\nexport default map;\n","const nan = {\n nan: {\n test (x) { return Number.isNaN(x); },\n replace (n) { return 'NaN'; },\n revive (s) { return Number.NaN; }\n }\n};\n\nexport default nan;\n","const negativeInfinity = {\n negativeInfinity: {\n test (x) { return x === -Infinity; },\n replace (n) { return '-Infinity'; },\n revive (s) { return -Infinity; }\n }\n};\n\nexport default negativeInfinity;\n","import Typeson from 'typeson';\n\nconst nonbuiltinIgnore = {\n nonbuiltinIgnore: {\n test (x) {\n return x && typeof x === 'object' && !Array.isArray(x) && ![\n 'Object',\n // `Proxy` and `Reflect`, two other built-in objects, will also\n // have a `toStringTag` of `Object`; we don't want built-in\n // function objects, however\n 'Boolean', 'Number', 'String',\n 'Error', 'RegExp', 'Math', 'Date',\n 'Map', 'Set',\n 'JSON',\n 'ArrayBuffer', 'SharedArrayBuffer', 'DataView',\n 'Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array',\n 'Uint16Array', 'Int32Array', 'Uint32Array',\n 'Float32Array', 'Float64Array',\n 'Promise',\n 'String Iterator', 'Array Iterator',\n 'Map Iterator', 'Set Iterator',\n 'WeakMap', 'WeakSet',\n 'Atomics', 'Module'\n ].includes(Typeson.toStringTag(x));\n },\n replace (rexp) {\n // Not in use\n }\n }\n};\n\nexport default nonbuiltinIgnore;\n","// This module is for objectified primitives (such as `new Number(3)` or\n// `new String(\"foo\")`)\n/* eslint-disable no-new-wrappers, unicorn/new-for-builtins */\nimport Typeson from 'typeson';\n\nconst primitiveObjects = {\n // String Object (not primitive string which need no type spec)\n StringObject: {\n test (x) {\n return Typeson.toStringTag(x) === 'String' && typeof x === 'object';\n },\n replace (s) { return String(s); }, // convert to primitive string\n revive (s) { return new String(s); } // Revive to an objectified string\n },\n // Boolean Object (not primitive boolean which need no type spec)\n BooleanObject: {\n test (x) {\n return Typeson.toStringTag(x) === 'Boolean' &&\n typeof x === 'object';\n },\n replace (b) { return Boolean(b); }, // convert to primitive boolean\n revive (b) {\n // Revive to an objectified Boolean\n return new Boolean(b);\n }\n },\n // Number Object (not primitive number which need no type spec)\n NumberObject: {\n test (x) {\n return Typeson.toStringTag(x) === 'Number' && typeof x === 'object';\n },\n replace (n) { return Number(n); }, // convert to primitive number\n revive (n) { return new Number(n); } // Revive to an objectified number\n }\n};\n/* eslint-enable no-new-wrappers, unicorn/new-for-builtins */\n\nexport default primitiveObjects;\n","import Typeson from 'typeson';\n\nconst regexp = {\n regexp: {\n test (x) { return Typeson.toStringTag(x) === 'RegExp'; },\n replace (rexp) {\n return {\n source: rexp.source,\n flags: (rexp.global ? 'g' : '') +\n (rexp.ignoreCase ? 'i' : '') +\n (rexp.multiline ? 'm' : '') +\n (rexp.sticky ? 'y' : '') +\n (rexp.unicode ? 'u' : '')\n };\n },\n revive ({source, flags}) { return new RegExp(source, flags); }\n }\n};\n\nexport default regexp;\n","// Here we allow the exact same non-plain object, function, and symbol\n// instances to be resurrected (assuming the same session/environment);\n// plain objects are ignored by Typeson so not presently available and\n// we consciously exclude arrays\n\nimport generateUUID from '../utils/generateUUID.js';\n\nconst resurrectableObjectsByUUID = {};\n\nconst resurrectable = {\n resurrectable: {\n test (x) {\n return x &&\n !Array.isArray(x) &&\n ['object', 'function', 'symbol'].includes(typeof x);\n },\n replace (rsrrctble) {\n const uuid = generateUUID();\n resurrectableObjectsByUUID[uuid] = rsrrctble;\n return uuid;\n },\n revive (serializedResurrectable) {\n return resurrectableObjectsByUUID[serializedResurrectable];\n }\n }\n};\n\nexport default resurrectable;\n","import Typeson from 'typeson';\n\nconst set = {\n set: {\n test (x) { return Typeson.toStringTag(x) === 'Set'; },\n replace (st) {\n return [...st.values()];\n },\n revive (values) { return new Set(values); }\n }\n};\n\nexport default set;\n","/* eslint-env browser, node */\nimport Typeson from 'typeson';\n\n/* istanbul ignore next */\nconst _global = typeof self === 'undefined' ? global : self;\n\n// Support all kinds of typed arrays (views of ArrayBuffers)\nconst typedArraysSocketIO = {};\n[\n 'Int8Array',\n 'Uint8Array',\n 'Uint8ClampedArray',\n 'Int16Array',\n 'Uint16Array',\n 'Int32Array',\n 'Uint32Array',\n 'Float32Array',\n 'Float64Array'\n].forEach(function (typeName) {\n const arrType = typeName;\n const TypedArray = _global[typeName];\n /* istanbul ignore if */\n if (!TypedArray) {\n return;\n }\n typedArraysSocketIO[typeName.toLowerCase()] = {\n test (x) { return Typeson.toStringTag(x) === arrType; },\n replace (a) {\n return (a.byteOffset === 0 &&\n a.byteLength === a.buffer.byteLength\n ? a\n // socket.io supports streaming ArrayBuffers.\n // If we have a typed array representing a portion\n // of the buffer, we need to clone\n // the buffer before leaving it to socket.io.\n : a.slice(0)).buffer;\n },\n revive (buf) {\n // One may configure socket.io to revive binary data as\n // Buffer or Blob.\n // We should therefore not rely on that the instance we\n // get here is an ArrayBuffer\n // If not, let's assume user wants to receive it as\n // configured with socket.io.\n return Typeson.toStringTag(buf) === 'ArrayBuffer'\n ? new TypedArray(buf)\n : buf;\n }\n };\n});\n\nexport default typedArraysSocketIO;\n","/* eslint-env browser, node */\nimport Typeson from 'typeson';\nimport {encode, decode} from 'base64-arraybuffer-es6';\n\n/* istanbul ignore next */\nconst _global = typeof self === 'undefined' ? global : self;\n\nconst typedArrays = {};\n[\n 'Int8Array',\n 'Uint8Array',\n 'Uint8ClampedArray',\n 'Int16Array',\n 'Uint16Array',\n 'Int32Array',\n 'Uint32Array',\n 'Float32Array',\n 'Float64Array'\n].forEach(function (typeName) {\n const arrType = typeName;\n const TypedArray = _global[arrType];\n /* istanbul ignore if */\n if (!TypedArray) {\n return;\n }\n typedArrays[typeName.toLowerCase()] = {\n test (x) { return Typeson.toStringTag(x) === arrType; },\n replace ({buffer, byteOffset, length: l}, stateObj) {\n if (!stateObj.buffers) {\n stateObj.buffers = [];\n }\n const index = stateObj.buffers.indexOf(buffer);\n if (index > -1) {\n return {index, byteOffset, length: l};\n }\n stateObj.buffers.push(buffer);\n return {\n encoded: encode(buffer),\n byteOffset,\n length: l\n };\n },\n revive (b64Obj, stateObj) {\n if (!stateObj.buffers) {\n stateObj.buffers = [];\n }\n const {byteOffset, length: len, encoded, index} = b64Obj;\n let buffer;\n if ('index' in b64Obj) {\n buffer = stateObj.buffers[index];\n } else {\n buffer = decode(encoded);\n stateObj.buffers.push(buffer);\n }\n return new TypedArray(buffer, byteOffset, len);\n }\n };\n});\n\nexport default typedArrays;\n","// This does not preserve `undefined` in sparse arrays; see the `undefined`\n// or `sparse-undefined` preset\nimport Typeson from 'typeson';\n\nconst undef = {\n undef: {\n test (x, stateObj) {\n return typeof x === 'undefined' &&\n (stateObj.ownKeys || !('ownKeys' in stateObj));\n },\n replace (n) { return 0; },\n revive (s) {\n // Will add `undefined` (returning `undefined` would instead\n // avoid explicitly setting)\n return new Typeson.Undefined();\n }\n }\n};\n\nexport default undef;\n","import Typeson from 'typeson';\n\nconst userObject = {\n userObject: {\n test (x, stateObj) { return Typeson.isUserObject(x); },\n replace (n) { return {...n}; },\n revive (s) { return s; }\n }\n};\n\nexport default userObject;\n","const arrayNonindexKeys = [\n {\n arrayNonindexKeys: {\n testPlainObjects: true,\n test (x, stateObj) {\n if (Array.isArray(x)) {\n if (\n // By avoiding serializing arrays into objects which\n // have only positive-integer keys, we reduce\n // size and improve revival performance; arrays with\n // non-index keys will be larger however\n Object.keys(x).some((k) => {\n // No need to check for `isNaN` or\n // `isNaN(Number.parseInt())` as `NaN` will be\n // treated as a string.\n // No need to do check as\n // `Number.parseInt(Number())` since scientific\n // notation will be pre-resolved if a number\n // was given, and it will otherwise be a string\n return String(Number.parseInt(k)) !== k;\n })\n ) {\n stateObj.iterateIn = 'object';\n stateObj.addLength = true;\n }\n return true;\n }\n return false;\n },\n replace (a, stateObj) {\n // Catch sparse undefined\n stateObj.iterateUnsetNumeric = true;\n return a;\n },\n revive (o) {\n if (Array.isArray(o)) {\n return o;\n }\n const arr = [];\n // No map here as may be a sparse array (including\n // with `length` set)\n // Todo: Reenable when Node `engines` >= 7\n // Object.entries(o).forEach(([key, val]) => {\n Object.keys(o).forEach((key) => {\n const val = o[key];\n arr[key] = val;\n });\n return arr;\n }\n }\n },\n {\n sparseUndefined: {\n test (x, stateObj) {\n return typeof x === 'undefined' && stateObj.ownKeys === false;\n },\n replace (n) { return 0; },\n revive (s) { return undefined; } // Will avoid adding anything\n }\n }\n];\n\nexport default arrayNonindexKeys;\n","import nan from '../types/nan.js';\nimport infinity from '../types/infinity.js';\nimport NegativeInfinity from '../types/negative-infinity.js';\n\nconst specialNumbers = [\n nan,\n infinity,\n NegativeInfinity\n];\n\nexport default specialNumbers;\n","/* This preset includes types that are built-in into the JavaScript\n language itself, this should work universally.\n\n Types that were added in ES6 or beyond will be checked before inclusion\n so that this module can be consumed by both ES5 and ES6 environments.\n\n Some types cannot be encapsulated because their inner state is private:\n `WeakMap`, `WeakSet`.\n\n The Function type is not included because their closures would not be\n serialized, so a revived Function that uses closures would not behave\n as expected.\n\n Symbols are similarly not included.\n*/\n\nimport arrayNonindexKeys from './array-nonindex-keys.js';\nimport undef from '../types/undef.js';\nimport primitiveObjects from '../types/primitive-objects.js';\nimport specialNumbers from './special-numbers.js';\nimport date from '../types/date.js';\nimport error from '../types/error.js';\nimport errors from '../types/errors.js';\nimport regexp from '../types/regexp.js';\nimport map from '../types/map.js';\nimport set from '../types/set.js';\nimport arraybuffer from '../types/arraybuffer.js';\nimport typedArrays from '../types/typed-arrays.js';\nimport dataview from '../types/dataview.js';\nimport intlTypes from '../types/intl-types.js';\nimport bigint from '../types/bigint.js';\nimport bigintObject from '../types/bigint-object.js';\n\nconst expObj = [\n undef,\n // ES5\n arrayNonindexKeys, primitiveObjects, specialNumbers,\n date, error, errors, regexp\n].concat(\n // ES2015 (ES6)\n /* istanbul ignore next */\n typeof Map === 'function' ? map : [],\n /* istanbul ignore next */\n typeof Set === 'function' ? set : [],\n /* istanbul ignore next */\n typeof ArrayBuffer === 'function' ? arraybuffer : [],\n /* istanbul ignore next */\n typeof Uint8Array === 'function' ? typedArrays : [],\n /* istanbul ignore next */\n typeof DataView === 'function' ? dataview : [],\n /* istanbul ignore next */\n typeof Intl !== 'undefined' ? intlTypes : [],\n\n /* istanbul ignore next */\n typeof BigInt !== 'undefined' ? [bigint, bigintObject] : []\n);\nexport default expObj;\n","/*\nWhen communicating via `postMessage()` (`Worker.postMessage()` or\n`window.postMessage()`), the browser will use a similar algorithm as Typeson\ndoes to encapsulate and revive all items in the structure (aka the structured\nclone algorithm). This algorithm supports all built-in types as well as many\nDOM types. Therefore, only types that are not included in the structured clone\nalgorithm need to be registered, which is:\n\n* Error\n* Specific Errors like SyntaxError, TypeError, etc.\n* Any custom type you want to send across window- or worker boundraries\n\nThis preset will only include the Error types and you can register your\ncustom types after having registered these.\n*/\n\nimport error from '../types/error.js';\nimport errors from '../types/errors.js';\n\nconst postmessage = [\n error,\n errors\n];\n\nexport default postmessage;\n","import builtin from './builtin.js';\nimport typedArraysSocketIO from '../types/typed-arrays-socketio.js';\n\nconst socketio = [\n builtin,\n // Leave ArrayBuffer as is, and let socket.io stream it instead.\n {arraybuffer: null},\n // Encapsulate TypedArrays in ArrayBuffers instead of base64 strings.\n typedArraysSocketIO\n];\n\nexport default socketio;\n","const sparseUndefined = [\n {\n sparseArrays: {\n testPlainObjects: true,\n test (x) { return Array.isArray(x); },\n replace (a, stateObj) {\n stateObj.iterateUnsetNumeric = true;\n return a;\n }\n }\n },\n {\n sparseUndefined: {\n test (x, stateObj) {\n return typeof x === 'undefined' && stateObj.ownKeys === false;\n },\n replace (n) { return 0; },\n revive (s) { return undefined; } // Will avoid adding anything\n }\n }\n];\n\nexport default sparseUndefined;\n","/* This preset includes types for the Structured Cloning Algorithm. */\n\nimport userObject from '../types/user-object.js';\nimport arrayNonindexKeys from './array-nonindex-keys.js';\nimport undef from '../types/undef.js';\nimport primitiveObjects from '../types/primitive-objects.js';\nimport specialNumbers from './special-numbers.js';\nimport date from '../types/date.js';\nimport regexp from '../types/regexp.js';\nimport map from '../types/map.js';\nimport set from '../types/set.js';\nimport arraybuffer from '../types/arraybuffer.js';\nimport typedArrays from '../types/typed-arrays.js';\nimport dataview from '../types/dataview.js';\nimport intlTypes from '../types/intl-types.js';\n\nimport imagedata from '../types/imagedata.js';\nimport imagebitmap from '../types/imagebitmap.js'; // Async return\nimport file from '../types/file.js';\nimport filelist from '../types/filelist.js';\nimport blob from '../types/blob.js';\nimport bigint from '../types/bigint.js';\nimport bigintObject from '../types/bigint-object.js';\n\nconst expObj = [\n // Todo: Might also register synchronous `ImageBitmap` and\n // `Blob`/`File`/`FileList`?\n // ES5\n userObject, // Processed last (non-builtin)\n\n undef,\n arrayNonindexKeys, primitiveObjects, specialNumbers,\n date, regexp,\n\n // Non-built-ins\n imagedata,\n imagebitmap, // Async return\n file,\n filelist,\n blob\n].concat(\n // ES2015 (ES6)\n /* istanbul ignore next */\n typeof Map === 'function' ? map : [],\n /* istanbul ignore next */\n typeof Set === 'function' ? set : [],\n /* istanbul ignore next */\n typeof ArrayBuffer === 'function' ? arraybuffer : [],\n /* istanbul ignore next */\n typeof Uint8Array === 'function' ? typedArrays : [],\n /* istanbul ignore next */\n typeof DataView === 'function' ? dataview : [],\n /* istanbul ignore next */\n typeof Intl !== 'undefined' ? intlTypes : [],\n\n /* istanbul ignore next */\n typeof BigInt !== 'undefined' ? [bigint, bigintObject] : []\n);\nexport default expObj;\n","/* globals DOMException */\nimport structuredCloning from './structured-cloning.js';\n\nexport default structuredCloning.concat({\n checkDataCloneException: {\n test (val) {\n // Should also throw with:\n // 1. `IsDetachedBuffer` (a process not called within the\n // ECMAScript spec)\n // 2. `IsCallable` (covered by `typeof === 'function'` or a\n // function's `toStringTag`)\n // 3. internal slots besides [[Prototype]] or [[Extensible]] (e.g.,\n // [[PromiseState]] or [[WeakMapData]])\n // 4. exotic object (e.g., `Proxy`) (unless an `%ObjectPrototype%`\n // intrinsic object) (which does not have default\n // behavior for one or more of the essential internal methods\n // that are limited to the following for non-function objects\n // (we auto-exclude functions):\n // [[GetPrototypeOf]],[[SetPrototypeOf]],[[IsExtensible]],\n // [[PreventExtensions]],[[GetOwnProperty]],\n // [[DefineOwnProperty]],[[HasProperty]],\n // [[Get]],[[Set]],[[Delete]],[[OwnPropertyKeys]]);\n // except for the standard, built-in exotic objects, we'd need\n // to know whether these methods had distinct behaviors\n // Note: There is no apparent way for us to detect a `Proxy` and\n // reject (Chrome at least is not rejecting anyways)\n const stringTag = ({}.toString.call(val).slice(8, -1));\n if (\n [\n // Symbol's `toStringTag` is only \"Symbol\" for its initial\n // value, so we check `typeof`\n 'symbol',\n // All functions including bound function exotic objects\n 'function'\n ].includes(typeof val) ||\n [\n // A non-array exotic object\n 'Arguments',\n // A non-array exotic object\n 'Module',\n // `Error` and other errors have the [[ErrorData]] internal\n // slot and give \"Error\"\n 'Error',\n // Promise instances have an extra slot ([[PromiseState]])\n // but not throwing in Chrome `postMessage`\n 'Promise',\n // WeakMap instances have an extra slot ([[WeakMapData]])\n // but not throwing in Chrome `postMessage`\n 'WeakMap',\n // WeakSet instances have an extra slot ([[WeakSetData]])\n // but not throwing in Chrome `postMessage`\n 'WeakSet',\n\n // HTML-SPECIFIC\n 'Event',\n // Also in Node `worker_threads` (currently experimental)\n 'MessageChannel'\n ].includes(stringTag) ||\n /*\n // isClosed is no longer documented\n ((stringTag === 'Blob' || stringTag === 'File') &&\n val.isClosed) ||\n */\n (val && typeof val === 'object' &&\n // Duck-type DOM node objects (non-array exotic?\n // objects which cannot be cloned by the SCA)\n typeof val.nodeType === 'number' &&\n typeof val.insertBefore === 'function')\n ) {\n throw new DOMException(\n 'The object cannot be cloned.', 'DataCloneError'\n );\n }\n return false;\n }\n }\n});\n","import sparseUndefined from './sparse-undefined.js';\nimport undf from '../types/undef.js';\n\nconst undef = [\n sparseUndefined,\n undf\n];\n\nexport default undef;\n","import builtin from './builtin.js';\n\nconst universal = [\n builtin\n // TODO: Add types that are de-facto universal even though not\n // built-in into ecmasript standard.\n];\n\nexport default universal;\n","// This file is auto-generated from `build.js`\nimport Typeson from 'typeson';\n\n// TYPES\nimport arraybuffer from './types/arraybuffer.js';\nimport bigintObject from './types/bigint-object.js';\nimport bigint from './types/bigint.js';\nimport blob from './types/blob.js';\nimport cloneable from './types/cloneable.js';\nimport dataview from './types/dataview.js';\nimport date from './types/date.js';\nimport error from './types/error.js';\nimport errors from './types/errors.js';\nimport file from './types/file.js';\nimport filelist from './types/filelist.js';\nimport imagebitmap from './types/imagebitmap.js';\nimport imagedata from './types/imagedata.js';\nimport infinity from './types/infinity.js';\nimport intlTypes from './types/intl-types.js';\nimport map from './types/map.js';\nimport nan from './types/nan.js';\nimport negativeInfinity from './types/negative-infinity.js';\nimport nonbuiltinIgnore from './types/nonbuiltin-ignore.js';\nimport primitiveObjects from './types/primitive-objects.js';\nimport regexp from './types/regexp.js';\nimport resurrectable from './types/resurrectable.js';\nimport set from './types/set.js';\nimport typedArraysSocketio from './types/typed-arrays-socketio.js';\nimport typedArrays from './types/typed-arrays.js';\nimport undef from './types/undef.js';\nimport userObject from './types/user-object.js';\n\n// PRESETS\nimport arrayNonindexKeys from './presets/array-nonindex-keys.js';\nimport builtin from './presets/builtin.js';\nimport postmessage from './presets/postmessage.js';\nimport socketio from './presets/socketio.js';\nimport sparseUndefined from './presets/sparse-undefined.js';\nimport specialNumbers from './presets/special-numbers.js';\nimport structuredCloningThrowing from\n './presets/structured-cloning-throwing.js';\nimport structuredCloning from './presets/structured-cloning.js';\nimport undefPreset from './presets/undef.js';\nimport universal from './presets/universal.js';\n\nTypeson.types = {\n arraybuffer, bigintObject, bigint, blob, cloneable, dataview, date, error,\n errors, file, filelist, imagebitmap, imagedata, infinity, intlTypes, map,\n nan, negativeInfinity, nonbuiltinIgnore, primitiveObjects, regexp,\n resurrectable, set, typedArraysSocketio, typedArrays, undef, userObject\n};\nTypeson.presets = {\n arrayNonindexKeys, builtin, postmessage, socketio, sparseUndefined,\n specialNumbers, structuredCloningThrowing, structuredCloning,\n undef: undefPreset, universal\n};\n\nexport default Typeson;\n","import Typeson from 'typeson-registry';\n\nimport {createDOMException, ShimDOMException} from './DOMException.js';\n\n// See: http://stackoverflow.com/questions/42170826/categories-for-rejection-by-the-structured-cloning-algorithm\n\nlet typeson = new Typeson().register(Typeson.presets.structuredCloningThrowing);\n\nfunction register (func) {\n typeson = new Typeson().register(func(Typeson.presets.structuredCloningThrowing));\n}\n\n// We are keeping the callback approach for now in case we wish to reexpose\n// `Blob`, `File`, `FileList` asynchronously (though in such a case, we\n// should probably refactor as a Promise)\nfunction encode (obj, func) {\n let ret;\n try {\n // eslint-disable-next-line node/no-sync\n ret = typeson.stringifySync(obj);\n } catch (err) {\n // SCA in typeson-registry using `DOMException` which is not defined (e.g., in Node)\n if (Typeson.hasConstructorOf(err, ReferenceError) ||\n // SCA in typeson-registry threw a cloning error and we are in a\n // supporting environment (e.g., the browser) where `ShimDOMException` is\n // an alias for `DOMException`; if typeson-registry ever uses our shim\n // to throw, we can use this condition alone.\n Typeson.hasConstructorOf(err, ShimDOMException)) {\n throw createDOMException('DataCloneError', 'The object cannot be cloned.');\n }\n // We should rethrow non-cloning exceptions like from\n // throwing getters (as in the W3C test, key-conversion-exceptions.htm)\n throw err;\n }\n if (func) func(ret);\n return ret;\n}\n\nfunction decode (obj) {\n return typeson.parse(obj);\n}\n\nfunction clone (val) {\n // We don't return the intermediate `encode` as we'll need to reencode\n // the clone as it may differ\n return decode(encode(val));\n}\n\nexport {encode, decode, clone, register};\n","import SyncPromise from 'sync-promise';\nimport {createDOMException} from './DOMException.js';\nimport {IDBCursor, IDBCursorWithValue} from './IDBCursor.js';\nimport * as util from './util.js';\nimport * as Key from './Key.js';\nimport {setSQLForKeyRange, IDBKeyRange, convertValueToKeyRange} from './IDBKeyRange.js';\nimport IDBTransaction from './IDBTransaction.js';\nimport * as Sca from './Sca.js';\nimport CFG from './CFG.js';\nimport IDBObjectStore from './IDBObjectStore.js';\n\nconst readonlyProperties = ['objectStore', 'keyPath', 'multiEntry', 'unique'];\n\n/* eslint-disable jsdoc/check-param-names */\n/**\n * IDB Index.\n * @see http://www.w3.org/TR/IndexedDB/#idl-def-IDBIndex\n * @param {IDBObjectStore} store\n * @param {IDBIndexProperties} indexProperties\n * @class\n */\nfunction IDBIndex () {\n /* eslint-enable jsdoc/check-param-names */\n throw new TypeError('Illegal constructor');\n}\nconst IDBIndexAlias = IDBIndex;\nIDBIndex.__createInstance = function (store, indexProperties) {\n function IDBIndex () {\n const me = this;\n me[Symbol.toStringTag] = 'IDBIndex';\n util.defineReadonlyProperties(me, readonlyProperties);\n me.__objectStore = store;\n me.__name = me.__originalName = indexProperties.columnName;\n me.__keyPath = Array.isArray(indexProperties.keyPath) ? indexProperties.keyPath.slice() : indexProperties.keyPath;\n const {optionalParams} = indexProperties;\n me.__multiEntry = Boolean(optionalParams && optionalParams.multiEntry);\n me.__unique = Boolean(optionalParams && optionalParams.unique);\n me.__deleted = Boolean(indexProperties.__deleted);\n me.__objectStore.__cursors = indexProperties.cursors || [];\n Object.defineProperty(me, '__currentName', {\n get () {\n return '__pendingName' in me ? me.__pendingName : me.name;\n }\n });\n Object.defineProperty(me, 'name', {\n enumerable: false,\n configurable: false,\n get () {\n return this.__name;\n },\n set (newName) {\n const me = this;\n newName = util.convertToDOMString(newName);\n const oldName = me.name;\n IDBTransaction.__assertVersionChange(me.objectStore.transaction);\n IDBTransaction.__assertActive(me.objectStore.transaction);\n IDBIndexAlias.__invalidStateIfDeleted(me);\n IDBObjectStore.__invalidStateIfDeleted(me);\n if (newName === oldName) {\n return;\n }\n\n if (me.objectStore.__indexes[newName] && !me.objectStore.__indexes[newName].__deleted &&\n !me.objectStore.__indexes[newName].__pendingDelete) {\n throw createDOMException('ConstraintError', 'Index \"' + newName + '\" already exists on ' + me.objectStore.__currentName);\n }\n\n me.__name = newName;\n\n const {objectStore} = me;\n delete objectStore.__indexes[oldName];\n objectStore.__indexes[newName] = me;\n objectStore.indexNames.splice(objectStore.indexNames.indexOf(oldName), 1, newName);\n\n const storeHandle = objectStore.transaction.__storeHandles[objectStore.name];\n const oldIndexHandle = storeHandle.__indexHandles[oldName];\n oldIndexHandle.__name = newName; // Fix old references\n storeHandle.__indexHandles[newName] = oldIndexHandle; // Ensure new reference accessible\n me.__pendingName = oldName;\n\n const colInfoToPreserveArr = [\n ['key', 'BLOB ' + (objectStore.autoIncrement ? 'UNIQUE, inc INTEGER PRIMARY KEY AUTOINCREMENT' : 'PRIMARY KEY')],\n ['value', 'BLOB']\n ].concat(\n [...objectStore.indexNames]\n .filter((indexName) => indexName !== newName)\n .map((indexName) => [util.escapeIndexNameForSQL(indexName), 'BLOB'])\n );\n\n me.__renameIndex(objectStore, oldName, newName, colInfoToPreserveArr, function (tx, success) {\n IDBIndexAlias.__updateIndexList(store, tx, function (store) {\n delete storeHandle.__pendingName;\n success(store);\n });\n });\n }\n });\n }\n IDBIndex.prototype = IDBIndexAlias.prototype;\n return new IDBIndex();\n};\n\nIDBIndex.__invalidStateIfDeleted = function (index, msg) {\n if (index.__deleted || index.__pendingDelete || (\n index.__pendingCreate && index.objectStore.transaction && index.objectStore.transaction.__errored\n )) {\n throw createDOMException('InvalidStateError', msg || 'This index has been deleted');\n }\n};\n\n/**\n * Clones an IDBIndex instance for a different IDBObjectStore instance.\n * @param {IDBIndex} index\n * @param {IDBObjectStore} store\n * @protected\n * @returns {IDBIndex}\n */\nIDBIndex.__clone = function (index, store) {\n const idx = IDBIndex.__createInstance(store, {\n columnName: index.name,\n keyPath: index.keyPath,\n optionalParams: {\n multiEntry: index.multiEntry,\n unique: index.unique\n }\n });\n ['__pendingCreate', '__pendingDelete', '__deleted', '__originalName', '__recreated'].forEach((p) => {\n idx[p] = index[p];\n });\n return idx;\n};\n\n/**\n * Creates a new index on an object store.\n * @param {IDBObjectStore} store\n * @param {IDBIndex} index\n * @returns {void}\n * @protected\n */\nIDBIndex.__createIndex = function (store, index) {\n const indexName = index.name;\n const storeName = store.__currentName;\n const idx = store.__indexes[indexName];\n\n index.__pendingCreate = true;\n\n // Add the index to the IDBObjectStore\n store.indexNames.push(indexName);\n store.__indexes[indexName] = index; // We add to indexes as needs to be available, e.g., if there is a subsequent deleteIndex call\n\n let indexHandle = store.__indexHandles[indexName];\n if (!indexHandle ||\n index.__pendingDelete ||\n index.__deleted ||\n indexHandle.__pendingDelete ||\n indexHandle.__deleted\n ) {\n indexHandle = store.__indexHandles[indexName] = IDBIndex.__clone(index, store);\n }\n\n // Create the index in WebSQL\n const {transaction} = store;\n transaction.__addNonRequestToTransactionQueue(function createIndex (tx, args, success, failure) {\n const columnExists = idx && (idx.__deleted || idx.__recreated); // This check must occur here rather than earlier as properties may not have been set yet otherwise\n let indexValues = {};\n\n function error (tx, err) {\n failure(createDOMException('UnknownError', 'Could not create index \"' + indexName + '\"' + err.code + '::' + err.message, err));\n }\n\n function applyIndex (tx) {\n // Update the object store's index list\n IDBIndex.__updateIndexList(store, tx, function () {\n // Add index entries for all existing records\n tx.executeSql('SELECT \"key\", \"value\" FROM ' + util.escapeStoreNameForSQL(storeName), [], function (tx, data) {\n CFG.DEBUG && console.log('Adding existing ' + storeName + ' records to the ' + indexName + ' index');\n addIndexEntry(0);\n\n function addIndexEntry (i) {\n if (i < data.rows.length) {\n try {\n const value = Sca.decode(util.unescapeSQLiteResponse(data.rows.item(i).value));\n let indexKey = Key.extractKeyValueDecodedFromValueUsingKeyPath(value, index.keyPath, index.multiEntry); // Todo: Do we need this stricter error checking?\n if (indexKey.invalid || indexKey.failure) { // Todo: Do we need invalid checks and should we instead treat these as being duplicates?\n throw new Error('Go to catch; ignore bad indexKey');\n }\n indexKey = Key.encode(indexKey.value, index.multiEntry);\n if (index.unique) {\n if (indexValues[indexKey]) {\n indexValues = {};\n failure(createDOMException(\n 'ConstraintError',\n 'Duplicate values already exist within the store'\n ));\n return;\n }\n indexValues[indexKey] = true;\n }\n\n tx.executeSql(\n 'UPDATE ' + util.escapeStoreNameForSQL(storeName) + ' SET ' +\n util.escapeIndexNameForSQL(indexName) + ' = ? WHERE \"key\" = ?',\n [util.escapeSQLiteStatement(indexKey), data.rows.item(i).key],\n function (tx, data) {\n addIndexEntry(i + 1);\n }, error\n );\n } catch (e) {\n // Not a valid value to insert into index, so just continue\n addIndexEntry(i + 1);\n }\n } else {\n delete index.__pendingCreate;\n delete indexHandle.__pendingCreate;\n if (index.__deleted) {\n delete index.__deleted;\n delete indexHandle.__deleted;\n index.__recreated = true;\n indexHandle.__recreated = true;\n }\n indexValues = {};\n success(store);\n }\n }\n }, error);\n }, error);\n }\n\n const escapedStoreNameSQL = util.escapeStoreNameForSQL(storeName);\n const escapedIndexNameSQL = util.escapeIndexNameForSQL(index.name);\n\n function addIndexSQL (tx) {\n if (!CFG.useSQLiteIndexes) {\n applyIndex(tx);\n return;\n }\n tx.executeSql(\n 'CREATE INDEX IF NOT EXISTS \"' +\n // The escaped index name must be unique among indexes in the whole database;\n // so we prefix with store name; as prefixed, will also not conflict with\n // index on `key`\n // Avoid quotes and separate with special escape sequence\n escapedStoreNameSQL.slice(1, -1) + '^5' + escapedIndexNameSQL.slice(1, -1) +\n '\" ON ' + escapedStoreNameSQL + '(' + escapedIndexNameSQL + ')',\n [],\n applyIndex,\n error\n );\n }\n\n if (columnExists) {\n // For a previously existing index, just update the index entries in the existing column;\n // no need to add SQLite index to it either as should already exist\n applyIndex(tx);\n } else {\n // For a new index, add a new column to the object store, then apply the index\n const sql = ['ALTER TABLE', escapedStoreNameSQL, 'ADD', escapedIndexNameSQL, 'BLOB'].join(' ');\n CFG.DEBUG && console.log(sql);\n tx.executeSql(sql, [], addIndexSQL, error);\n }\n }, undefined, store);\n};\n\n/**\n * Deletes an index from an object store.\n * @param {IDBObjectStore} store\n * @param {IDBIndex} index\n * @protected\n * @returns {void}\n */\nIDBIndex.__deleteIndex = function (store, index) {\n // Remove the index from the IDBObjectStore\n index.__pendingDelete = true;\n const indexHandle = store.__indexHandles[index.name];\n if (indexHandle) {\n indexHandle.__pendingDelete = true;\n }\n\n store.indexNames.splice(store.indexNames.indexOf(index.name), 1);\n\n // Remove the index in WebSQL\n const {transaction} = store;\n transaction.__addNonRequestToTransactionQueue(function deleteIndex (tx, args, success, failure) {\n function error (tx, err) {\n failure(createDOMException('UnknownError', 'Could not delete index \"' + index.name + '\"', err));\n }\n\n function finishDeleteIndex () {\n // Update the object store's index list\n IDBIndex.__updateIndexList(store, tx, function (store) {\n delete index.__pendingDelete;\n delete index.__recreated;\n index.__deleted = true;\n if (indexHandle) {\n indexHandle.__deleted = true;\n delete indexHandle.__pendingDelete;\n }\n success(store);\n }, error);\n }\n\n if (!CFG.useSQLiteIndexes) {\n finishDeleteIndex();\n return;\n }\n tx.executeSql(\n 'DROP INDEX IF EXISTS ' +\n util.sqlQuote(\n util.escapeStoreNameForSQL(store.name).slice(1, -1) + '^5' +\n util.escapeIndexNameForSQL(index.name).slice(1, -1)\n ),\n [],\n finishDeleteIndex,\n error\n );\n }, undefined, store);\n};\n\n/**\n * Updates index list for the given object store.\n * @param {IDBObjectStore} store\n * @param {object} tx\n * @param {function} success\n * @param {function} failure\n * @returns {void}\n */\nIDBIndex.__updateIndexList = function (store, tx, success, failure) {\n const indexList = {};\n for (let i = 0; i < store.indexNames.length; i++) {\n const idx = store.__indexes[store.indexNames[i]];\n /** @type {IDBIndexProperties} **/\n indexList[idx.name] = {\n columnName: idx.name,\n keyPath: idx.keyPath,\n optionalParams: {\n unique: idx.unique,\n multiEntry: idx.multiEntry\n },\n deleted: Boolean(idx.deleted)\n };\n }\n\n CFG.DEBUG && console.log('Updating the index list for ' + store.__currentName, indexList);\n tx.executeSql('UPDATE __sys__ SET \"indexList\" = ? WHERE \"name\" = ?', [JSON.stringify(indexList), util.escapeSQLiteStatement(store.__currentName)], function () {\n success(store);\n }, failure);\n};\n\n/**\n * Retrieves index data for the given key.\n * @param {*|IDBKeyRange} range\n * @param {string} opType\n * @param {boolean} nullDisallowed\n * @param {number} count\n * @returns {IDBRequest}\n * @private\n */\nIDBIndex.prototype.__fetchIndexData = function (range, opType, nullDisallowed, count) {\n const me = this;\n if (count !== undefined) {\n count = util.enforceRange(count, 'unsigned long');\n }\n\n IDBIndex.__invalidStateIfDeleted(me);\n IDBObjectStore.__invalidStateIfDeleted(me.objectStore);\n if (me.objectStore.__deleted) {\n throw createDOMException('InvalidStateError', \"This index's object store has been deleted\");\n }\n IDBTransaction.__assertActive(me.objectStore.transaction);\n\n if (nullDisallowed && util.isNullish(range)) {\n throw createDOMException('DataError', 'No key or range was specified');\n }\n\n const fetchArgs = buildFetchIndexDataSQL(nullDisallowed, me, range, opType, false);\n return me.objectStore.transaction.__addToTransactionQueue(function (...args) {\n executeFetchIndexData(count, ...fetchArgs, ...args);\n }, undefined, me);\n};\n\n/* eslint-disable jsdoc/check-param-names */\n/**\n * Opens a cursor over the given key range.\n * @param {*|IDBKeyRange} query\n * @param {string} direction\n * @returns {IDBRequest}\n */\nIDBIndex.prototype.openCursor = function (/* query, direction */) {\n /* eslint-enable jsdoc/check-param-names */\n const me = this;\n // eslint-disable-next-line prefer-rest-params\n const [query, direction] = arguments;\n const cursor = IDBCursorWithValue.__createInstance(query, direction, me.objectStore, me, util.escapeIndexNameForSQLKeyColumn(me.name), 'value');\n me.__objectStore.__cursors.push(cursor);\n return cursor.__request;\n};\n\n/* eslint-disable jsdoc/check-param-names */\n/**\n * Opens a cursor over the given key range. The cursor only includes key values, not data.\n * @param {*|IDBKeyRange} query\n * @param {string} direction\n * @returns {IDBRequest}\n */\nIDBIndex.prototype.openKeyCursor = function (/* query, direction */) {\n /* eslint-enable jsdoc/check-param-names */\n const me = this;\n // eslint-disable-next-line prefer-rest-params\n const [query, direction] = arguments;\n const cursor = IDBCursor.__createInstance(query, direction, me.objectStore, me, util.escapeIndexNameForSQLKeyColumn(me.name), 'key');\n me.__objectStore.__cursors.push(cursor);\n return cursor.__request;\n};\n\nIDBIndex.prototype.get = function (query) {\n if (!arguments.length) { // Per https://heycam.github.io/webidl/\n throw new TypeError('A parameter was missing for `IDBIndex.get`.');\n }\n return this.__fetchIndexData(query, 'value', true);\n};\n\nIDBIndex.prototype.getKey = function (query) {\n if (!arguments.length) { // Per https://heycam.github.io/webidl/\n throw new TypeError('A parameter was missing for `IDBIndex.getKey`.');\n }\n return this.__fetchIndexData(query, 'key', true);\n};\n\nIDBIndex.prototype.getAll = function (/* query, count */) {\n // eslint-disable-next-line prefer-rest-params\n const [query, count] = arguments;\n return this.__fetchIndexData(query, 'value', false, count);\n};\n\nIDBIndex.prototype.getAllKeys = function (/* query, count */) {\n // eslint-disable-next-line prefer-rest-params\n const [query, count] = arguments;\n return this.__fetchIndexData(query, 'key', false, count);\n};\n\nIDBIndex.prototype.count = function (/* query */) {\n const me = this;\n // eslint-disable-next-line prefer-rest-params\n const query = arguments[0];\n // With the exception of needing to check whether the index has been\n // deleted, we could, for greater spec parity (if not accuracy),\n // just call:\n // `return me.__objectStore.count(query);`\n\n if (util.instanceOf(query, IDBKeyRange)) { // Todo: Do we need this block?\n // We don't need to add to cursors array since has the count parameter which won't cache\n return IDBCursorWithValue.__createInstance(query, 'next', me.objectStore, me, util.escapeIndexNameForSQLKeyColumn(me.name), 'value', true).__request;\n }\n return me.__fetchIndexData(query, 'count', false);\n};\n\nIDBIndex.prototype.__renameIndex = function (store, oldName, newName, colInfoToPreserveArr = [], cb = null) {\n const newNameType = 'BLOB';\n const storeName = store.__currentName;\n const escapedStoreNameSQL = util.escapeStoreNameForSQL(storeName);\n const escapedNewIndexNameSQL = util.escapeIndexNameForSQL(newName);\n const escapedTmpStoreNameSQL = util.sqlQuote('tmp_' + util.escapeStoreNameForSQL(storeName).slice(1, -1));\n const colNamesToPreserve = colInfoToPreserveArr.map((colInfo) => colInfo[0]);\n const colInfoToPreserve = colInfoToPreserveArr.map((colInfo) => colInfo.join(' '));\n const listColInfoToPreserve = (colInfoToPreserve.length ? (colInfoToPreserve.join(', ') + ', ') : '');\n const listColsToPreserve = (colNamesToPreserve.length ? (colNamesToPreserve.join(', ') + ', ') : '');\n\n // We could adapt the approach at http://stackoverflow.com/a/8430746/271577\n // to make the approach reusable without passing column names, but it is a bit fragile\n store.transaction.__addNonRequestToTransactionQueue(function renameIndex (tx, args, success, error) {\n function sqlError (tx, err) {\n error(err);\n }\n function finish () {\n if (cb) {\n cb(tx, success);\n return;\n }\n success();\n }\n // See https://www.sqlite.org/lang_altertable.html#otheralter\n // We don't query for indexes as we already have the info\n // This approach has the advantage of auto-deleting indexes via the DROP TABLE\n const sql = 'CREATE TABLE ' + escapedTmpStoreNameSQL +\n '(' + listColInfoToPreserve + escapedNewIndexNameSQL + ' ' + newNameType + ')';\n CFG.DEBUG && console.log(sql);\n tx.executeSql(sql, [], function () {\n const sql = 'INSERT INTO ' + escapedTmpStoreNameSQL + '(' +\n listColsToPreserve + escapedNewIndexNameSQL +\n ') SELECT ' + listColsToPreserve + util.escapeIndexNameForSQL(oldName) + ' FROM ' + escapedStoreNameSQL;\n CFG.DEBUG && console.log(sql);\n tx.executeSql(sql, [], function () {\n const sql = 'DROP TABLE ' + escapedStoreNameSQL;\n CFG.DEBUG && console.log(sql);\n tx.executeSql(sql, [], function () {\n const sql = 'ALTER TABLE ' + escapedTmpStoreNameSQL + ' RENAME TO ' + escapedStoreNameSQL;\n CFG.DEBUG && console.log(sql);\n tx.executeSql(sql, [], function (tx, data) {\n if (!CFG.useSQLiteIndexes) {\n finish();\n return;\n }\n const indexCreations = colNamesToPreserve\n .slice(2) // Doing `key` separately and no need for index on `value`\n .map((escapedIndexNameSQL) => new SyncPromise(function (resolve, reject) {\n const escapedIndexToRecreate = util.sqlQuote(\n escapedStoreNameSQL.slice(1, -1) + '^5' + escapedIndexNameSQL.slice(1, -1)\n );\n // const sql = 'DROP INDEX IF EXISTS ' + escapedIndexToRecreate;\n // CFG.DEBUG && console.log(sql);\n // tx.executeSql(sql, [], function () {\n const sql = 'CREATE INDEX ' +\n escapedIndexToRecreate + ' ON ' + escapedStoreNameSQL + '(' + escapedIndexNameSQL + ')';\n CFG.DEBUG && console.log(sql);\n tx.executeSql(sql, [], resolve, function (tx, err) {\n reject(err);\n });\n // }, function (tx, err) {\n // reject(err);\n // });\n }));\n indexCreations.push(\n new SyncPromise(function (resolve, reject) {\n const escapedIndexToRecreate = util.sqlQuote('sk_' + escapedStoreNameSQL.slice(1, -1));\n // Chrome erring here if not dropped first; Node does not\n const sql = 'DROP INDEX IF EXISTS ' + escapedIndexToRecreate;\n CFG.DEBUG && console.log(sql);\n tx.executeSql(sql, [], function () {\n const sql = 'CREATE INDEX ' + escapedIndexToRecreate +\n ' ON ' + escapedStoreNameSQL + '(\"key\")';\n CFG.DEBUG && console.log(sql);\n tx.executeSql(sql, [], resolve, function (tx, err) {\n reject(err);\n });\n }, function (tx, err) {\n reject(err);\n });\n })\n );\n SyncPromise.all(indexCreations).then(finish, error).catch((err) => {\n console.log('Index rename error');\n throw err;\n });\n }, sqlError);\n }, sqlError);\n }, sqlError);\n }, sqlError);\n });\n};\n\nObject.defineProperty(IDBIndex, Symbol.hasInstance, {\n value: (obj) => util.isObj(obj) && typeof obj.openCursor === 'function' && typeof obj.multiEntry === 'boolean'\n});\n\nutil.defineReadonlyOuterInterface(IDBIndex.prototype, readonlyProperties);\nutil.defineOuterInterface(IDBIndex.prototype, ['name']);\n\nIDBIndex.prototype[Symbol.toStringTag] = 'IDBIndexPrototype';\n\nObject.defineProperty(IDBIndex, 'prototype', {\n writable: false\n});\n\nfunction executeFetchIndexData (count, unboundedDisallowed, index, hasKey, range, opType, multiChecks, sql, sqlValues, tx, args, success, error) {\n if (unboundedDisallowed) {\n count = 1;\n }\n if (count) {\n sql.push('LIMIT', count);\n }\n const isCount = opType === 'count';\n CFG.DEBUG && console.log('Trying to fetch data for Index', sql.join(' '), sqlValues);\n tx.executeSql(sql.join(' '), sqlValues, function (tx, data) {\n const records = [];\n let recordCount = 0;\n const decode = isCount\n ? () => { /* */ }\n : (opType === 'key'\n ? (record) => {\n // Key.convertValueToKey(record.key); // Already validated before storage\n return Key.decode(util.unescapeSQLiteResponse(record.key));\n }\n : (record) => { // when opType is value\n return Sca.decode(util.unescapeSQLiteResponse(record.value));\n });\n if (index.multiEntry) {\n const escapedIndexNameForKeyCol = util.escapeIndexNameForSQLKeyColumn(index.name);\n const encodedKey = Key.encode(range, index.multiEntry);\n for (let i = 0; i < data.rows.length; i++) {\n const row = data.rows.item(i);\n const rowKey = Key.decode(row[escapedIndexNameForKeyCol]);\n let record;\n if (hasKey && (\n (multiChecks && range.some((check) => rowKey.includes(check))) || // More precise than our SQL\n Key.isMultiEntryMatch(encodedKey, row[escapedIndexNameForKeyCol])\n )) {\n recordCount++;\n record = row;\n } else if (!hasKey && !multiChecks) {\n if (rowKey !== undefined) {\n recordCount += (Array.isArray(rowKey) ? rowKey.length : 1);\n record = row;\n }\n }\n if (record) {\n records.push(decode(record));\n if (unboundedDisallowed) {\n break;\n }\n }\n }\n } else {\n for (let i = 0; i < data.rows.length; i++) {\n const record = data.rows.item(i);\n if (record) {\n records.push(decode(record));\n }\n }\n recordCount = records.length;\n }\n if (isCount) {\n success(recordCount);\n } else if (recordCount === 0) {\n success(unboundedDisallowed ? undefined : []);\n } else {\n success(unboundedDisallowed ? records[0] : records);\n }\n }, error);\n}\n\nfunction buildFetchIndexDataSQL (nullDisallowed, index, range, opType, multiChecks) {\n const hasRange = nullDisallowed || !util.isNullish(range);\n const col = opType === 'count' ? 'key' : opType; // It doesn't matter which column we use for 'count' as long as it is valid\n const sql = [\n 'SELECT', util.sqlQuote(col) + (\n index.multiEntry ? ', ' + util.escapeIndexNameForSQL(index.name) : ''\n ),\n 'FROM', util.escapeStoreNameForSQL(index.objectStore.__currentName),\n 'WHERE', util.escapeIndexNameForSQL(index.name), 'NOT NULL'\n ];\n const sqlValues = [];\n if (hasRange) {\n if (multiChecks) {\n sql.push('AND (');\n range.forEach((innerKey, i) => {\n if (i > 0) sql.push('OR');\n sql.push(util.escapeIndexNameForSQL(index.name), \"LIKE ? ESCAPE '^' \");\n sqlValues.push('%' + util.sqlLIKEEscape(Key.encode(innerKey, index.multiEntry)) + '%');\n });\n sql.push(')');\n } else if (index.multiEntry) {\n sql.push('AND', util.escapeIndexNameForSQL(index.name), \"LIKE ? ESCAPE '^'\");\n sqlValues.push('%' + util.sqlLIKEEscape(Key.encode(range, index.multiEntry)) + '%');\n } else {\n const convertedRange = convertValueToKeyRange(range, nullDisallowed);\n setSQLForKeyRange(convertedRange, util.escapeIndexNameForSQL(index.name), sql, sqlValues, true, false);\n }\n }\n return [nullDisallowed, index, hasRange, range, opType, multiChecks, sql, sqlValues];\n}\n\nexport {buildFetchIndexDataSQL, executeFetchIndexData, IDBIndex, IDBIndex as default};\n","import SyncPromise from 'sync-promise';\nimport {createDOMException} from './DOMException.js';\nimport {IDBCursor, IDBCursorWithValue} from './IDBCursor.js';\nimport {setSQLForKeyRange, convertValueToKeyRange} from './IDBKeyRange.js';\nimport DOMStringList from './DOMStringList.js';\nimport * as util from './util.js';\nimport * as Key from './Key.js';\nimport {executeFetchIndexData, buildFetchIndexDataSQL, IDBIndex} from './IDBIndex.js';\nimport IDBTransaction from './IDBTransaction.js';\nimport * as Sca from './Sca.js';\nimport CFG from './CFG.js';\n\nconst readonlyProperties = ['keyPath', 'indexNames', 'transaction', 'autoIncrement'];\n\n/* eslint-disable jsdoc/check-param-names */\n/**\n * IndexedDB Object Store.\n * @see http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBObjectStore\n * @param {IDBObjectStoreProperties} storeProperties\n * @param {IDBTransaction} transaction\n * @class\n */\nfunction IDBObjectStore () {\n /* eslint-enable jsdoc/check-param-names */\n throw new TypeError('Illegal constructor');\n}\nconst IDBObjectStoreAlias = IDBObjectStore;\nIDBObjectStore.__createInstance = function (storeProperties, transaction) {\n function IDBObjectStore () {\n const me = this;\n me[Symbol.toStringTag] = 'IDBObjectStore';\n util.defineReadonlyProperties(this, readonlyProperties);\n me.__name = me.__originalName = storeProperties.name;\n me.__keyPath = Array.isArray(storeProperties.keyPath) ? storeProperties.keyPath.slice() : storeProperties.keyPath;\n me.__transaction = transaction;\n me.__idbdb = storeProperties.idbdb;\n me.__cursors = storeProperties.cursors || [];\n\n // autoInc is numeric (0/1) on WinPhone\n me.__autoIncrement = Boolean(storeProperties.autoInc);\n\n me.__indexes = {};\n me.__indexHandles = {};\n me.__indexNames = DOMStringList.__createInstance();\n const {indexList} = storeProperties;\n for (const indexName in indexList) {\n if (util.hasOwn(indexList, indexName)) {\n const index = IDBIndex.__createInstance(me, indexList[indexName]);\n me.__indexes[index.name] = index;\n if (!index.__deleted) {\n me.indexNames.push(index.name);\n }\n }\n }\n me.__oldIndexNames = me.indexNames.clone();\n Object.defineProperty(this, '__currentName', {\n get () {\n return '__pendingName' in this ? this.__pendingName : this.name;\n }\n });\n Object.defineProperty(this, 'name', {\n enumerable: false,\n configurable: false,\n get () {\n return this.__name;\n },\n set (name) {\n const me = this;\n name = util.convertToDOMString(name);\n const oldName = me.name;\n IDBObjectStoreAlias.__invalidStateIfDeleted(me);\n IDBTransaction.__assertVersionChange(me.transaction);\n IDBTransaction.__assertActive(me.transaction);\n if (oldName === name) {\n return;\n }\n if (me.__idbdb.__objectStores[name] && !me.__idbdb.__objectStores[name].__pendingDelete) {\n throw createDOMException('ConstraintError', 'Object store \"' + name + '\" already exists in ' + me.__idbdb.name);\n }\n\n me.__name = name;\n\n const oldStore = me.__idbdb.__objectStores[oldName];\n oldStore.__name = name; // Fix old references\n me.__idbdb.__objectStores[name] = oldStore; // Ensure new reference accessible\n delete me.__idbdb.__objectStores[oldName]; // Ensure won't be found\n\n me.__idbdb.objectStoreNames.splice(me.__idbdb.objectStoreNames.indexOf(oldName), 1, name);\n\n const oldHandle = me.transaction.__storeHandles[oldName];\n oldHandle.__name = name; // Fix old references\n me.transaction.__storeHandles[name] = oldHandle; // Ensure new reference accessible\n\n me.__pendingName = oldName;\n\n const sql = 'UPDATE __sys__ SET \"name\" = ? WHERE \"name\" = ?';\n const sqlValues = [util.escapeSQLiteStatement(name), util.escapeSQLiteStatement(oldName)];\n CFG.DEBUG && console.log(sql, sqlValues);\n me.transaction.__addNonRequestToTransactionQueue(function objectStoreClear (tx, args, success, error) {\n tx.executeSql(sql, sqlValues, function (tx, data) {\n // This SQL preserves indexes per https://www.sqlite.org/lang_altertable.html\n const sql = 'ALTER TABLE ' + util.escapeStoreNameForSQL(oldName) + ' RENAME TO ' + util.escapeStoreNameForSQL(name);\n CFG.DEBUG && console.log(sql);\n tx.executeSql(sql, [], function (tx, data) {\n delete me.__pendingName;\n success();\n });\n }, function (tx, err) {\n error(err);\n });\n });\n }\n });\n }\n IDBObjectStore.prototype = IDBObjectStoreAlias.prototype;\n return new IDBObjectStore();\n};\n\n/**\n * Clones an IDBObjectStore instance for a different IDBTransaction instance.\n * @param {IDBObjectStore} store\n * @param {IDBTransaction} transaction\n * @protected\n * @returns {IDBObjectStore}\n */\nIDBObjectStore.__clone = function (store, transaction) {\n const newStore = IDBObjectStore.__createInstance({\n name: store.__currentName,\n keyPath: Array.isArray(store.keyPath) ? store.keyPath.slice() : store.keyPath,\n autoInc: store.autoIncrement,\n indexList: {},\n idbdb: store.__idbdb,\n cursors: store.__cursors\n }, transaction);\n\n ['__indexes', '__indexNames', '__oldIndexNames', '__deleted', '__pendingDelete', '__pendingCreate', '__originalName'].forEach((p) => {\n newStore[p] = store[p];\n });\n return newStore;\n};\n\nIDBObjectStore.__invalidStateIfDeleted = function (store, msg) {\n if (store.__deleted || store.__pendingDelete || (store.__pendingCreate && (store.transaction && store.transaction.__errored))) {\n throw createDOMException('InvalidStateError', msg || 'This store has been deleted');\n }\n};\n\n/**\n * Creates a new object store in the database.\n * @param {IDBDatabase} db\n * @param {IDBObjectStore} store\n * @protected\n * @returns {IDBObjectStore}\n */\nIDBObjectStore.__createObjectStore = function (db, store) {\n // Add the object store to the IDBDatabase\n const storeName = store.__currentName;\n store.__pendingCreate = true;\n db.__objectStores[storeName] = store;\n db.objectStoreNames.push(storeName);\n\n // Add the object store to WebSQL\n const transaction = db.__versionTransaction;\n\n const storeHandles = transaction.__storeHandles;\n if (!storeHandles[storeName] ||\n // These latter conditions are to allow store\n // recreation to create new clone object\n storeHandles[storeName].__pendingDelete ||\n storeHandles[storeName].__deleted) {\n storeHandles[storeName] = IDBObjectStore.__clone(store, transaction);\n }\n\n transaction.__addNonRequestToTransactionQueue(function createObjectStore (tx, args, success, failure) {\n function error (tx, err) {\n CFG.DEBUG && console.log(err);\n failure(createDOMException('UnknownError', 'Could not create object store \"' + storeName + '\"', err));\n }\n\n const escapedStoreNameSQL = util.escapeStoreNameForSQL(storeName);\n // key INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE\n const sql = ['CREATE TABLE', escapedStoreNameSQL, '(key BLOB', store.autoIncrement ? 'UNIQUE, inc INTEGER PRIMARY KEY AUTOINCREMENT' : 'PRIMARY KEY', ', value BLOB)'].join(' ');\n CFG.DEBUG && console.log(sql);\n tx.executeSql(sql, [], function (tx, data) {\n function insertStoreInfo () {\n const encodedKeyPath = JSON.stringify(store.keyPath);\n tx.executeSql('INSERT INTO __sys__ VALUES (?,?,?,?,?)', [\n util.escapeSQLiteStatement(storeName),\n encodedKeyPath,\n // For why converting here, see comment and following\n // discussion at:\n // https://github.com/axemclion/IndexedDBShim/issues/313#issuecomment-590086778\n Number(store.autoIncrement),\n '{}',\n 1\n ], function () {\n delete store.__pendingCreate;\n delete store.__deleted;\n success(store);\n }, error);\n }\n if (!CFG.useSQLiteIndexes) {\n insertStoreInfo();\n return;\n }\n tx.executeSql('CREATE INDEX IF NOT EXISTS ' + (\n util.sqlQuote('sk_' + escapedStoreNameSQL.slice(1, -1))\n ) + ' ON ' + escapedStoreNameSQL + '(\"key\")', [], insertStoreInfo, error);\n }, error);\n });\n return storeHandles[storeName];\n};\n\n/**\n * Deletes an object store from the database.\n * @param {IDBDatabase} db\n * @param {IDBObjectStore} store\n * @protected\n * @returns {void}\n */\nIDBObjectStore.__deleteObjectStore = function (db, store) {\n // Remove the object store from the IDBDatabase\n store.__pendingDelete = true;\n // We don't delete the other index holders in case need reversion\n store.__indexNames = DOMStringList.__createInstance();\n\n db.objectStoreNames.splice(db.objectStoreNames.indexOf(store.__currentName), 1);\n\n const storeHandle = db.__versionTransaction.__storeHandles[store.__currentName];\n if (storeHandle) {\n storeHandle.__indexNames = DOMStringList.__createInstance();\n storeHandle.__pendingDelete = true;\n }\n\n // Remove the object store from WebSQL\n const transaction = db.__versionTransaction;\n transaction.__addNonRequestToTransactionQueue(function deleteObjectStore (tx, args, success, failure) {\n function error (tx, err) {\n CFG.DEBUG && console.log(err);\n failure(createDOMException('UnknownError', 'Could not delete ObjectStore', err));\n }\n\n tx.executeSql('SELECT \"name\" FROM __sys__ WHERE \"name\" = ?', [util.escapeSQLiteStatement(store.__currentName)], function (tx, data) {\n if (data.rows.length > 0) {\n tx.executeSql('DROP TABLE ' + util.escapeStoreNameForSQL(store.__currentName), [], function () {\n tx.executeSql('DELETE FROM __sys__ WHERE \"name\" = ?', [util.escapeSQLiteStatement(store.__currentName)], function () {\n delete store.__pendingDelete;\n store.__deleted = true;\n if (storeHandle) {\n delete storeHandle.__pendingDelete;\n storeHandle.__deleted = true;\n }\n success();\n }, error);\n }, error);\n }\n });\n });\n};\n\n/**\n* @typedef {GenericArray} KeyValueArray\n* @property {module:Key.Key} 0\n* @property {*} 1\n*/\n\n// Todo: Although we may end up needing to do cloning genuinely asynchronously (for Blobs and FileLists),\n// and we'll want to ensure the queue starts up synchronously, we nevertheless do the cloning\n// before entering the queue and its callback since the encoding we do is preceded by validation\n// which we must do synchronously anyways. If we reimplement Blobs and FileLists asynchronously,\n// we can detect these types (though validating synchronously as possible) and once entering the\n// queue callback, ensure they load before triggering success or failure (perhaps by returning and\n// a `SyncPromise` from the `Sca.clone` operation and later detecting and ensuring it is resolved\n// before continuing).\n/**\n * Determines whether the given inline or out-of-line key is valid,\n * according to the object store's schema.\n * @param {*} value Used for inline keys\n * @param {*} key Used for out-of-line keys\n * @param {boolean} cursorUpdate\n * @throws {DOMException}\n * @returns {KeyValueArray}\n * @private\n */\nIDBObjectStore.prototype.__validateKeyAndValueAndCloneValue = function (value, key, cursorUpdate) {\n const me = this;\n if (me.keyPath !== null) {\n if (key !== undefined) {\n throw createDOMException('DataError', 'The object store uses in-line keys and the key parameter was provided', me);\n }\n // Todo Binary: Avoid blobs loading async to ensure cloning (and errors therein)\n // occurs sync; then can make cloning and this method without callbacks (except where ok\n // to be async)\n const clonedValue = Sca.clone(value);\n key = Key.extractKeyValueDecodedFromValueUsingKeyPath(clonedValue, me.keyPath); // May throw so \"rethrow\"\n if (key.invalid) {\n throw createDOMException('DataError', 'KeyPath was specified, but key was invalid.');\n }\n if (key.failure) {\n if (!cursorUpdate) {\n if (!me.autoIncrement) {\n throw createDOMException('DataError', 'Could not evaluate a key from keyPath and there is no key generator');\n }\n if (!Key.checkKeyCouldBeInjectedIntoValue(clonedValue, me.keyPath)) {\n throw createDOMException('DataError', 'A key could not be injected into a value');\n }\n // A key will be generated\n return [undefined, clonedValue];\n }\n throw createDOMException('DataError', 'Could not evaluate a key from keyPath');\n }\n // An `IDBCursor.update` call will also throw if not equal to the cursor’s effective key\n return [key.value, clonedValue];\n }\n if (key === undefined) {\n if (!me.autoIncrement) {\n throw createDOMException('DataError', 'The object store uses out-of-line keys and has no key generator and the key parameter was not provided.', me);\n }\n // A key will be generated\n key = undefined;\n } else {\n Key.convertValueToKeyRethrowingAndIfInvalid(key);\n }\n const clonedValue = Sca.clone(value);\n return [key, clonedValue];\n};\n\n/**\n * From the store properties and object, extracts the value for the key in\n * the object store\n * If the table has auto increment, get the current number (unless it has\n * a keyPath leading to a valid but non-numeric or < 1 key).\n * @param {Object} tx\n * @param {Object} value\n * @param {Object} key\n * @param {function} success\n * @param {function} failCb\n * @returns {void}\n */\nIDBObjectStore.prototype.__deriveKey = function (tx, value, key, success, failCb) {\n const me = this;\n\n // Only run if cloning is needed\n function keyCloneThenSuccess (oldCn) { // We want to return the original key, so we don't need to accept an argument here\n Sca.encode(key, function (key) {\n key = Sca.decode(key);\n success(key, oldCn);\n });\n }\n\n if (me.autoIncrement) {\n // If auto-increment and no valid primaryKey found on the keyPath, get and set the new value, and use\n if (key === undefined) {\n Key.generateKeyForStore(tx, me, function (failure, key, oldCn) {\n if (failure) {\n failCb(createDOMException('ConstraintError', 'The key generator\\'s current number has reached the maximum safe integer limit'));\n return;\n }\n if (me.keyPath !== null) {\n // Should not throw now as checked earlier\n Key.injectKeyIntoValueUsingKeyPath(value, key, me.keyPath);\n }\n success(key, oldCn);\n }, failCb);\n } else {\n Key.possiblyUpdateKeyGenerator(tx, me, key, keyCloneThenSuccess, failCb);\n }\n // Not auto-increment\n } else {\n keyCloneThenSuccess();\n }\n};\n\nIDBObjectStore.prototype.__insertData = function (tx, encoded, value, clonedKeyOrCurrentNumber, oldCn, success, error) {\n const me = this;\n // The `ConstraintError` to occur for `add` upon a duplicate will occur naturally in attempting an insert\n // We process the index information first as it will stored in the same table as the store\n const paramMap = {};\n const indexPromises = Object.keys(\n // We do not iterate `indexNames` as those can be modified synchronously (e.g.,\n // `deleteIndex` could, by its synchronous removal from `indexNames`, prevent\n // iteration here of an index though per IndexedDB test\n // `idbobjectstore_createIndex4-deleteIndex-event_order.js`, `createIndex`\n // should be allowed to first fail even in such a case).\n me.__indexes\n ).map((indexName) => {\n // While this may sometimes resolve sync and sometimes async, the\n // idea is to avoid, where possible, unnecessary delays (and\n // consuming code ought to only see a difference in the browser\n // where we can't control the transaction timeout anyways).\n return new SyncPromise((resolve, reject) => {\n const index = me.__indexes[indexName];\n if (\n // `createIndex` was called synchronously after the current insertion was added to\n // the transaction queue so although it was added to `__indexes`, it is not yet\n // ready to be checked here for the insertion as it will be when running the\n // `createIndex` operation (e.g., if two items with the same key were added and\n // *then* a unique index was created, it should not continue to err and abort\n // yet, as we're still handling the insertions which must be processed (e.g., to\n // add duplicates which then cause a unique index to fail))\n index.__pendingCreate ||\n // If already deleted (and not just slated for deletion (by `__pendingDelete`\n // after this add), we avoid checks\n index.__deleted\n ) {\n resolve();\n return;\n }\n let indexKey;\n try {\n indexKey = Key.extractKeyValueDecodedFromValueUsingKeyPath(value, index.keyPath, index.multiEntry); // Add as necessary to this and skip past this index if exceptions here)\n if (indexKey.invalid || indexKey.failure) {\n throw new Error('Go to catch');\n }\n } catch (err) {\n resolve();\n return;\n }\n indexKey = indexKey.value;\n function setIndexInfo (index) {\n if (indexKey === undefined) {\n return;\n }\n paramMap[index.__currentName] = Key.encode(indexKey, index.multiEntry);\n }\n if (index.unique) {\n const multiCheck = index.multiEntry && Array.isArray(indexKey);\n const fetchArgs = buildFetchIndexDataSQL(true, index, indexKey, 'key', multiCheck);\n executeFetchIndexData(null, ...fetchArgs, tx, null, function success (key) {\n if (key === undefined) {\n setIndexInfo(index);\n resolve();\n return;\n }\n reject(createDOMException(\n 'ConstraintError',\n 'Index already contains a record equal to ' +\n (multiCheck ? 'one of the subkeys of' : '') +\n '`indexKey`'\n ));\n }, reject);\n } else {\n setIndexInfo(index);\n resolve();\n }\n });\n });\n return SyncPromise.all(indexPromises).then(() => {\n const sqlStart = ['INSERT INTO', util.escapeStoreNameForSQL(me.__currentName), '('];\n const sqlEnd = [' VALUES ('];\n const insertSqlValues = [];\n if (clonedKeyOrCurrentNumber !== undefined) {\n // Key.convertValueToKey(primaryKey); // Already run\n sqlStart.push(util.sqlQuote('key'), ',');\n sqlEnd.push('?,');\n insertSqlValues.push(\n util.escapeSQLiteStatement(\n Key.encode(clonedKeyOrCurrentNumber)\n )\n );\n }\n Object.entries(paramMap).forEach(([key, stmt]) => {\n sqlStart.push(util.escapeIndexNameForSQL(key) + ',');\n sqlEnd.push('?,');\n insertSqlValues.push(util.escapeSQLiteStatement(stmt));\n });\n // removing the trailing comma\n sqlStart.push(util.sqlQuote('value') + ' )');\n sqlEnd.push('?)');\n insertSqlValues.push(util.escapeSQLiteStatement(encoded));\n\n const insertSql = sqlStart.join(' ') + sqlEnd.join(' ');\n CFG.DEBUG && console.log('SQL for adding', insertSql, insertSqlValues);\n\n tx.executeSql(insertSql, insertSqlValues, function (tx, data) {\n success(clonedKeyOrCurrentNumber);\n }, function (tx, err) {\n // Should occur for `add` operation\n error(createDOMException('ConstraintError', err.message, err));\n });\n return undefined;\n }).catch(function (err) {\n function fail () {\n // Todo: Add a different error object here if `assignCurrentNumber` fails in reverting?\n error(err);\n }\n if (typeof oldCn === 'number') {\n Key.assignCurrentNumber(tx, me, oldCn, fail, fail);\n return;\n }\n fail();\n });\n};\n\nIDBObjectStore.prototype.add = function (value /* , key */) {\n const me = this;\n // eslint-disable-next-line prefer-rest-params\n const key = arguments[1];\n if (!(me instanceof IDBObjectStore)) {\n throw new TypeError('Illegal invocation');\n }\n if (arguments.length === 0) {\n throw new TypeError('No value was specified');\n }\n IDBObjectStore.__invalidStateIfDeleted(me);\n IDBTransaction.__assertActive(me.transaction);\n me.transaction.__assertWritable();\n\n const request = me.transaction.__createRequest(me);\n const [ky, clonedValue] = me.__validateKeyAndValueAndCloneValue(value, key, false);\n IDBObjectStore.__storingRecordObjectStore(request, me, true, clonedValue, true, ky);\n return request;\n};\n\nIDBObjectStore.prototype.put = function (value /*, key */) {\n const me = this;\n // eslint-disable-next-line prefer-rest-params\n const key = arguments[1];\n if (!(me instanceof IDBObjectStore)) {\n throw new TypeError('Illegal invocation');\n }\n if (arguments.length === 0) {\n throw new TypeError('No value was specified');\n }\n IDBObjectStore.__invalidStateIfDeleted(me);\n IDBTransaction.__assertActive(me.transaction);\n me.transaction.__assertWritable();\n\n const request = me.transaction.__createRequest(me);\n const [ky, clonedValue] = me.__validateKeyAndValueAndCloneValue(value, key, false);\n IDBObjectStore.__storingRecordObjectStore(request, me, true, clonedValue, false, ky);\n return request;\n};\n\nIDBObjectStore.prototype.__overwrite = function (tx, key, cb, error) {\n const me = this;\n // First try to delete if the record exists\n // Key.convertValueToKey(key); // Already run\n const sql = 'DELETE FROM ' + util.escapeStoreNameForSQL(me.__currentName) + ' WHERE \"key\" = ?';\n const encodedKey = Key.encode(key);\n tx.executeSql(sql, [util.escapeSQLiteStatement(encodedKey)], function (tx, data) {\n CFG.DEBUG && console.log('Did the row with the', key, 'exist?', data.rowsAffected);\n cb(tx);\n }, function (tx, err) {\n error(err);\n });\n};\n\nIDBObjectStore.__storingRecordObjectStore = function (request, store, invalidateCache, value, noOverwrite /* , key */) {\n // eslint-disable-next-line prefer-rest-params\n const key = arguments[5];\n store.transaction.__pushToQueue(request, function (tx, args, success, error) {\n store.__deriveKey(tx, value, key, function (clonedKeyOrCurrentNumber, oldCn) {\n Sca.encode(value, function (encoded) {\n function insert (tx) {\n store.__insertData(tx, encoded, value, clonedKeyOrCurrentNumber, oldCn, function (...args) {\n if (invalidateCache) {\n store.__cursors.forEach((cursor) => {\n cursor.__invalidateCache();\n });\n }\n success(...args);\n }, error);\n }\n if (!noOverwrite) {\n store.__overwrite(tx, clonedKeyOrCurrentNumber, insert, error);\n return;\n }\n insert(tx);\n });\n }, error);\n });\n};\n\nIDBObjectStore.prototype.__get = function (query, getKey, getAll, count) {\n const me = this;\n if (count !== undefined) {\n count = util.enforceRange(count, 'unsigned long');\n }\n IDBObjectStore.__invalidStateIfDeleted(me);\n IDBTransaction.__assertActive(me.transaction);\n\n const range = convertValueToKeyRange(query, !getAll);\n\n const col = getKey ? 'key' : 'value';\n let sql = ['SELECT', util.sqlQuote(col), 'FROM', util.escapeStoreNameForSQL(me.__currentName)];\n const sqlValues = [];\n if (range !== undefined) {\n sql.push('WHERE');\n setSQLForKeyRange(range, util.sqlQuote('key'), sql, sqlValues);\n }\n if (!getAll) {\n count = 1;\n }\n if (count) {\n if (!Number.isFinite(count)) {\n throw new TypeError('The count parameter must be a finite number');\n }\n sql.push('LIMIT', count);\n }\n sql = sql.join(' ');\n return me.transaction.__addToTransactionQueue(function objectStoreGet (tx, args, success, error) {\n CFG.DEBUG && console.log('Fetching', me.__currentName, sqlValues);\n tx.executeSql(sql, sqlValues, function (tx, data) {\n CFG.DEBUG && console.log('Fetched data', data);\n let ret;\n try {\n // Opera can't deal with the try-catch here.\n if (data.rows.length === 0) {\n if (getAll) {\n success([]);\n } else {\n success();\n }\n return;\n }\n ret = [];\n if (getKey) {\n for (let i = 0; i < data.rows.length; i++) {\n // Key.convertValueToKey(data.rows.item(i).key); // Already validated before storage\n ret.push(\n Key.decode(util.unescapeSQLiteResponse(data.rows.item(i).key), false)\n );\n }\n } else {\n for (let i = 0; i < data.rows.length; i++) {\n ret.push(\n Sca.decode(util.unescapeSQLiteResponse(data.rows.item(i).value))\n );\n }\n }\n if (!getAll) {\n ret = ret[0];\n }\n } catch (e) {\n // If no result is returned, or error occurs when parsing JSON\n CFG.DEBUG && console.log(e);\n }\n success(ret);\n }, function (tx, err) {\n error(err);\n });\n }, undefined, me);\n};\n\nIDBObjectStore.prototype.get = function (query) {\n if (!arguments.length) {\n throw new TypeError('A parameter was missing for `IDBObjectStore.get`.');\n }\n return this.__get(query);\n};\n\nIDBObjectStore.prototype.getKey = function (query) {\n if (!arguments.length) {\n throw new TypeError('A parameter was missing for `IDBObjectStore.getKey`.');\n }\n return this.__get(query, true);\n};\n\nIDBObjectStore.prototype.getAll = function (/* query, count */) {\n // eslint-disable-next-line prefer-rest-params\n const [query, count] = arguments;\n return this.__get(query, false, true, count);\n};\n\nIDBObjectStore.prototype.getAllKeys = function (/* query, count */) {\n // eslint-disable-next-line prefer-rest-params\n const [query, count] = arguments;\n return this.__get(query, true, true, count);\n};\n\nIDBObjectStore.prototype.delete = function (query) {\n const me = this;\n if (!(this instanceof IDBObjectStore)) {\n throw new TypeError('Illegal invocation');\n }\n if (!arguments.length) {\n throw new TypeError('A parameter was missing for `IDBObjectStore.delete`.');\n }\n\n IDBObjectStore.__invalidStateIfDeleted(me);\n IDBTransaction.__assertActive(me.transaction);\n me.transaction.__assertWritable();\n\n const range = convertValueToKeyRange(query, true);\n\n const sqlArr = ['DELETE FROM', util.escapeStoreNameForSQL(me.__currentName), 'WHERE'];\n const sqlValues = [];\n setSQLForKeyRange(range, util.sqlQuote('key'), sqlArr, sqlValues);\n const sql = sqlArr.join(' ');\n\n return me.transaction.__addToTransactionQueue(function objectStoreDelete (tx, args, success, error) {\n CFG.DEBUG && console.log('Deleting', me.__currentName, sqlValues);\n tx.executeSql(sql, sqlValues, function (tx, data) {\n CFG.DEBUG && console.log('Deleted from database', data.rowsAffected);\n me.__cursors.forEach((cursor) => {\n cursor.__invalidateCache(); // Delete\n });\n success();\n }, function (tx, err) {\n error(err);\n });\n }, undefined, me);\n};\n\nIDBObjectStore.prototype.clear = function () {\n const me = this;\n if (!(this instanceof IDBObjectStore)) {\n throw new TypeError('Illegal invocation');\n }\n IDBObjectStore.__invalidStateIfDeleted(me);\n IDBTransaction.__assertActive(me.transaction);\n me.transaction.__assertWritable();\n\n return me.transaction.__addToTransactionQueue(function objectStoreClear (tx, args, success, error) {\n tx.executeSql('DELETE FROM ' + util.escapeStoreNameForSQL(me.__currentName), [], function (tx, data) {\n CFG.DEBUG && console.log('Cleared all records from database', data.rowsAffected);\n me.__cursors.forEach((cursor) => {\n cursor.__invalidateCache(); // Clear\n });\n success();\n }, function (tx, err) {\n error(err);\n });\n }, undefined, me);\n};\n\nIDBObjectStore.prototype.count = function (/* query */) {\n const me = this;\n // eslint-disable-next-line prefer-rest-params\n const query = arguments[0];\n if (!(me instanceof IDBObjectStore)) {\n throw new TypeError('Illegal invocation');\n }\n IDBObjectStore.__invalidStateIfDeleted(me);\n IDBTransaction.__assertActive(me.transaction);\n\n // We don't need to add to cursors array since has the count parameter which won't cache\n return IDBCursorWithValue.__createInstance(query, 'next', me, me, 'key', 'value', true).__request;\n};\n\nIDBObjectStore.prototype.openCursor = function (/* query, direction */) {\n const me = this;\n // eslint-disable-next-line prefer-rest-params\n const [query, direction] = arguments;\n if (!(me instanceof IDBObjectStore)) {\n throw new TypeError('Illegal invocation');\n }\n IDBObjectStore.__invalidStateIfDeleted(me);\n const cursor = IDBCursorWithValue.__createInstance(query, direction, me, me, 'key', 'value');\n me.__cursors.push(cursor);\n return cursor.__request;\n};\n\nIDBObjectStore.prototype.openKeyCursor = function (/* query, direction */) {\n const me = this;\n if (!(me instanceof IDBObjectStore)) {\n throw new TypeError('Illegal invocation');\n }\n IDBObjectStore.__invalidStateIfDeleted(me);\n // eslint-disable-next-line prefer-rest-params\n const [query, direction] = arguments;\n const cursor = IDBCursor.__createInstance(query, direction, me, me, 'key', 'key');\n me.__cursors.push(cursor);\n return cursor.__request;\n};\n\nIDBObjectStore.prototype.index = function (indexName) {\n const me = this;\n if (!(me instanceof IDBObjectStore)) {\n throw new TypeError('Illegal invocation');\n }\n if (arguments.length === 0) {\n throw new TypeError('No index name was specified');\n }\n IDBObjectStore.__invalidStateIfDeleted(me);\n IDBTransaction.__assertNotFinished(me.transaction);\n const index = me.__indexes[indexName];\n if (!index || index.__deleted) {\n throw createDOMException('NotFoundError', 'Index \"' + indexName + '\" does not exist on ' + me.__currentName);\n }\n\n if (!me.__indexHandles[indexName] ||\n me.__indexes[indexName].__pendingDelete ||\n me.__indexes[indexName].__deleted\n ) {\n me.__indexHandles[indexName] = IDBIndex.__clone(index, me);\n }\n return me.__indexHandles[indexName];\n};\n\n/* eslint-disable jsdoc/check-param-names */\n/**\n * Creates a new index on the object store.\n * @param {string} indexName\n * @param {string} keyPath\n * @param {object} optionalParameters\n * @returns {IDBIndex}\n */\nIDBObjectStore.prototype.createIndex = function (indexName, keyPath /* , optionalParameters */) {\n /* eslint-enable jsdoc/check-param-names */\n const me = this;\n // eslint-disable-next-line prefer-rest-params\n let optionalParameters = arguments[2];\n if (!(me instanceof IDBObjectStore)) {\n throw new TypeError('Illegal invocation');\n }\n indexName = String(indexName); // W3C test within IDBObjectStore.js seems to accept string conversion\n if (arguments.length === 0) {\n throw new TypeError('No index name was specified');\n }\n if (arguments.length === 1) {\n throw new TypeError('No key path was specified');\n }\n IDBTransaction.__assertVersionChange(me.transaction);\n IDBObjectStore.__invalidStateIfDeleted(me);\n IDBTransaction.__assertActive(me.transaction);\n if (me.__indexes[indexName] && !me.__indexes[indexName].__deleted && !me.__indexes[indexName].__pendingDelete) {\n throw createDOMException('ConstraintError', 'Index \"' + indexName + '\" already exists on ' + me.__currentName);\n }\n\n keyPath = util.convertToSequenceDOMString(keyPath);\n if (!util.isValidKeyPath(keyPath)) {\n throw createDOMException('SyntaxError', 'A valid keyPath must be supplied');\n }\n if (Array.isArray(keyPath) && optionalParameters && optionalParameters.multiEntry) {\n throw createDOMException('InvalidAccessError', 'The keyPath argument was an array and the multiEntry option is true.');\n }\n\n optionalParameters = optionalParameters || {};\n /** @name IDBIndexProperties **/\n const indexProperties = {\n columnName: indexName,\n keyPath,\n optionalParams: {\n unique: Boolean(optionalParameters.unique),\n multiEntry: Boolean(optionalParameters.multiEntry)\n }\n };\n const index = IDBIndex.__createInstance(me, indexProperties);\n IDBIndex.__createIndex(me, index);\n return index;\n};\n\nIDBObjectStore.prototype.deleteIndex = function (name) {\n const me = this;\n if (!(me instanceof IDBObjectStore)) {\n throw new TypeError('Illegal invocation');\n }\n if (arguments.length === 0) {\n throw new TypeError('No index name was specified');\n }\n IDBTransaction.__assertVersionChange(me.transaction);\n IDBObjectStore.__invalidStateIfDeleted(me);\n IDBTransaction.__assertActive(me.transaction);\n const index = me.__indexes[name];\n if (!index) {\n throw createDOMException('NotFoundError', 'Index \"' + name + '\" does not exist on ' + me.__currentName);\n }\n\n IDBIndex.__deleteIndex(me, index);\n};\n\nutil.defineReadonlyOuterInterface(IDBObjectStore.prototype, readonlyProperties);\nutil.defineOuterInterface(IDBObjectStore.prototype, ['name']);\n\nIDBObjectStore.prototype[Symbol.toStringTag] = 'IDBObjectStorePrototype';\n\nObject.defineProperty(IDBObjectStore, 'prototype', {\n writable: false\n});\n\nexport default IDBObjectStore;\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// resolves . and .. elements in a path array with directory names there\n// must be no slashes, empty elements, or device names (c:\\) in the array\n// (so also no leading and trailing slashes - it does not distinguish\n// relative and absolute paths)\nfunction normalizeArray(parts, allowAboveRoot) {\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = parts.length - 1; i >= 0; i--) {\n var last = parts[i];\n if (last === '.') {\n parts.splice(i, 1);\n } else if (last === '..') {\n parts.splice(i, 1);\n up++;\n } else if (up) {\n parts.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (allowAboveRoot) {\n for (; up--; up) {\n parts.unshift('..');\n }\n }\n\n return parts;\n}\n\n// Split a filename into [root, dir, basename, ext], unix version\n// 'root' is just a slash, or nothing.\nvar splitPathRe =\n /^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/;\nvar splitPath = function(filename) {\n return splitPathRe.exec(filename).slice(1);\n};\n\n// path.resolve([from ...], to)\n// posix version\nexport function resolve() {\n var resolvedPath = '',\n resolvedAbsolute = false;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = (i >= 0) ? arguments[i] : '/';\n\n // Skip empty and invalid entries\n if (typeof path !== 'string') {\n throw new TypeError('Arguments to path.resolve must be strings');\n } else if (!path) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {\n return !!p;\n }), !resolvedAbsolute).join('/');\n\n return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';\n};\n\n// path.normalize(path)\n// posix version\nexport function normalize(path) {\n var isPathAbsolute = isAbsolute(path),\n trailingSlash = substr(path, -1) === '/';\n\n // Normalize the path\n path = normalizeArray(filter(path.split('/'), function(p) {\n return !!p;\n }), !isPathAbsolute).join('/');\n\n if (!path && !isPathAbsolute) {\n path = '.';\n }\n if (path && trailingSlash) {\n path += '/';\n }\n\n return (isPathAbsolute ? '/' : '') + path;\n};\n\n// posix version\nexport function isAbsolute(path) {\n return path.charAt(0) === '/';\n}\n\n// posix version\nexport function join() {\n var paths = Array.prototype.slice.call(arguments, 0);\n return normalize(filter(paths, function(p, index) {\n if (typeof p !== 'string') {\n throw new TypeError('Arguments to path.join must be strings');\n }\n return p;\n }).join('/'));\n}\n\n\n// path.relative(from, to)\n// posix version\nexport function relative(from, to) {\n from = resolve(from).substr(1);\n to = resolve(to).substr(1);\n\n function trim(arr) {\n var start = 0;\n for (; start < arr.length; start++) {\n if (arr[start] !== '') break;\n }\n\n var end = arr.length - 1;\n for (; end >= 0; end--) {\n if (arr[end] !== '') break;\n }\n\n if (start > end) return [];\n return arr.slice(start, end - start + 1);\n }\n\n var fromParts = trim(from.split('/'));\n var toParts = trim(to.split('/'));\n\n var length = Math.min(fromParts.length, toParts.length);\n var samePartsLength = length;\n for (var i = 0; i < length; i++) {\n if (fromParts[i] !== toParts[i]) {\n samePartsLength = i;\n break;\n }\n }\n\n var outputParts = [];\n for (var i = samePartsLength; i < fromParts.length; i++) {\n outputParts.push('..');\n }\n\n outputParts = outputParts.concat(toParts.slice(samePartsLength));\n\n return outputParts.join('/');\n}\n\nexport var sep = '/';\nexport var delimiter = ':';\n\nexport function dirname(path) {\n var result = splitPath(path),\n root = result[0],\n dir = result[1];\n\n if (!root && !dir) {\n // No dirname whatsoever\n return '.';\n }\n\n if (dir) {\n // It has a dirname, strip trailing slash\n dir = dir.substr(0, dir.length - 1);\n }\n\n return root + dir;\n}\n\nexport function basename(path, ext) {\n var f = splitPath(path)[2];\n // TODO: make this comparison case-insensitive on windows?\n if (ext && f.substr(-1 * ext.length) === ext) {\n f = f.substr(0, f.length - ext.length);\n }\n return f;\n}\n\n\nexport function extname(path) {\n return splitPath(path)[3];\n}\nexport default {\n extname: extname,\n basename: basename,\n dirname: dirname,\n sep: sep,\n delimiter: delimiter,\n relative: relative,\n join: join,\n isAbsolute: isAbsolute,\n normalize: normalize,\n resolve: resolve\n};\nfunction filter (xs, f) {\n if (xs.filter) return xs.filter(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n if (f(xs[i], i, xs)) res.push(xs[i]);\n }\n return res;\n}\n\n// String.prototype.substr - negative index don't work in IE8\nvar substr = 'ab'.substr(-1) === 'b' ?\n function (str, start, len) { return str.substr(start, len) } :\n function (str, start, len) {\n if (start < 0) start = str.length + start;\n return str.substr(start, len);\n }\n;\n","import {EventTargetFactory} from 'eventtargeter';\nimport {createDOMException} from './DOMException.js';\nimport {createEvent} from './Event.js';\nimport * as util from './util.js';\nimport DOMStringList from './DOMStringList.js';\nimport IDBObjectStore from './IDBObjectStore.js';\nimport IDBTransaction from './IDBTransaction.js';\n\nconst listeners = ['onabort', 'onclose', 'onerror', 'onversionchange'];\nconst readonlyProperties = ['name', 'version', 'objectStoreNames'];\n\n/**\n * IDB Database Object.\n * @see http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#database-interface\n * @class\n */\nfunction IDBDatabase () {\n throw new TypeError('Illegal constructor');\n}\nconst IDBDatabaseAlias = IDBDatabase;\nIDBDatabase.__createInstance = function (db, name, oldVersion, version, storeProperties) {\n function IDBDatabase () {\n this[Symbol.toStringTag] = 'IDBDatabase';\n util.defineReadonlyProperties(this, readonlyProperties);\n this.__db = db;\n this.__closePending = false;\n this.__oldVersion = oldVersion;\n this.__version = version;\n this.__name = name;\n this.__upgradeTransaction = null;\n util.defineListenerProperties(this, listeners);\n this.__setOptions({\n legacyOutputDidListenersThrowFlag: true // Event hook for IndexedB\n });\n\n this.__transactions = [];\n this.__objectStores = {};\n this.__objectStoreNames = DOMStringList.__createInstance();\n const itemCopy = {};\n for (let i = 0; i < storeProperties.rows.length; i++) {\n const item = storeProperties.rows.item(i);\n // Safari implements `item` getter return object's properties\n // as readonly, so we copy all its properties (except our\n // custom `currNum` which we don't need) onto a new object\n itemCopy.name = item.name;\n itemCopy.keyPath = JSON.parse(item.keyPath);\n // Though `autoInc` is coming from the database as a NUMERIC\n // type (how SQLite stores BOOLEAN set in CREATE TABLE),\n // and should thus be parsed into a number here (0 or 1),\n // `IDBObjectStore.__createInstance` will convert to a boolean\n // when setting the store's `autoIncrement`.\n ['autoInc', 'indexList'].forEach(function (prop) {\n itemCopy[prop] = JSON.parse(item[prop]);\n });\n itemCopy.idbdb = this;\n const store = IDBObjectStore.__createInstance(itemCopy);\n this.__objectStores[store.name] = store;\n this.objectStoreNames.push(store.name);\n }\n this.__oldObjectStoreNames = this.objectStoreNames.clone();\n }\n IDBDatabase.prototype = IDBDatabaseAlias.prototype;\n return new IDBDatabase();\n};\n\nIDBDatabase.prototype = EventTargetFactory.createInstance();\nIDBDatabase.prototype[Symbol.toStringTag] = 'IDBDatabasePrototype';\n\n/* eslint-disable jsdoc/check-param-names */\n/**\n * Creates a new object store.\n * @param {string} storeName\n * @param {object} [createOptions]\n * @returns {IDBObjectStore}\n */\nIDBDatabase.prototype.createObjectStore = function (storeName /* , createOptions */) {\n /* eslint-enable jsdoc/check-param-names */\n // eslint-disable-next-line prefer-rest-params\n let createOptions = arguments[1];\n storeName = String(storeName); // W3C test within IDBObjectStore.js seems to accept string conversion\n if (!(this instanceof IDBDatabase)) {\n throw new TypeError('Illegal invocation');\n }\n if (arguments.length === 0) {\n throw new TypeError('No object store name was specified');\n }\n IDBTransaction.__assertVersionChange(this.__versionTransaction); // this.__versionTransaction may not exist if called mistakenly by user in onsuccess\n this.throwIfUpgradeTransactionNull();\n IDBTransaction.__assertActive(this.__versionTransaction);\n\n createOptions = {...createOptions};\n let {keyPath} = createOptions;\n keyPath = keyPath === undefined ? null : util.convertToSequenceDOMString(keyPath);\n if (keyPath !== null && !util.isValidKeyPath(keyPath)) {\n throw createDOMException('SyntaxError', 'The keyPath argument contains an invalid key path.');\n }\n\n if (this.__objectStores[storeName] && !this.__objectStores[storeName].__pendingDelete) {\n throw createDOMException('ConstraintError', 'Object store \"' + storeName + '\" already exists in ' + this.name);\n }\n\n const autoInc = createOptions.autoIncrement;\n if (autoInc && (keyPath === '' || Array.isArray(keyPath))) {\n throw createDOMException('InvalidAccessError', 'With autoIncrement set, the keyPath argument must not be an array or empty string.');\n }\n\n /** @name IDBObjectStoreProperties **/\n const storeProperties = {\n name: storeName,\n keyPath,\n autoInc,\n indexList: {},\n idbdb: this\n };\n const store = IDBObjectStore.__createInstance(storeProperties, this.__versionTransaction);\n return IDBObjectStore.__createObjectStore(this, store);\n};\n\n/**\n * Deletes an object store.\n * @param {string} storeName\n * @throws {TypeError|DOMException}\n * @returns {void}\n */\nIDBDatabase.prototype.deleteObjectStore = function (storeName) {\n if (!(this instanceof IDBDatabase)) {\n throw new TypeError('Illegal invocation');\n }\n if (arguments.length === 0) {\n throw new TypeError('No object store name was specified');\n }\n IDBTransaction.__assertVersionChange(this.__versionTransaction);\n this.throwIfUpgradeTransactionNull();\n IDBTransaction.__assertActive(this.__versionTransaction);\n\n const store = this.__objectStores[storeName];\n if (!store) {\n throw createDOMException('NotFoundError', 'Object store \"' + storeName + '\" does not exist in ' + this.name);\n }\n\n IDBObjectStore.__deleteObjectStore(this, store);\n};\n\nIDBDatabase.prototype.close = function () {\n if (!(this instanceof IDBDatabase)) {\n throw new TypeError('Illegal invocation');\n }\n this.__closePending = true;\n if (this.__unblocking) {\n this.__unblocking.check();\n }\n};\n\n/* eslint-disable jsdoc/check-param-names */\n/**\n * Starts a new transaction.\n * @param {string|string[]} storeNames\n * @param {string} mode\n * @returns {IDBTransaction}\n */\nIDBDatabase.prototype.transaction = function (storeNames /* , mode */) {\n /* eslint-enable jsdoc/check-param-names */\n if (arguments.length === 0) {\n throw new TypeError('You must supply a valid `storeNames` to `IDBDatabase.transaction`');\n }\n // eslint-disable-next-line prefer-rest-params\n let mode = arguments[1];\n storeNames = util.isIterable(storeNames)\n // Creating new array also ensures sequence is passed by value: https://heycam.github.io/webidl/#idl-sequence\n ? [...new Set( // to be unique\n util.convertToSequenceDOMString(storeNames) // iterables have `ToString` applied (and we convert to array for convenience)\n )].sort() // must be sorted\n : [util.convertToDOMString(storeNames)];\n\n /* (function () {\n throw new TypeError('You must supply a valid `storeNames` to `IDBDatabase.transaction`');\n }())); */\n\n // Since SQLite (at least node-websql and definitely WebSQL) requires\n // locking of the whole database, to allow simultaneous readwrite\n // operations on transactions without overlapping stores, we'd probably\n // need to save the stores in separate databases (we could also consider\n // prioritizing readonly but not starving readwrite).\n // Even for readonly transactions, due to [issue 17](https://github.com/nolanlawson/node-websql/issues/17),\n // we're not currently actually running the SQL requests in parallel.\n mode = mode || 'readonly';\n\n IDBTransaction.__assertNotVersionChange(this.__versionTransaction);\n if (this.__closePending) {\n throw createDOMException('InvalidStateError', 'An attempt was made to start a new transaction on a database connection that is not open');\n }\n\n const objectStoreNames = DOMStringList.__createInstance();\n storeNames.forEach((storeName) => {\n if (!this.objectStoreNames.contains(storeName)) {\n throw createDOMException('NotFoundError', 'The \"' + storeName + '\" object store does not exist');\n }\n objectStoreNames.push(storeName);\n });\n\n if (storeNames.length === 0) {\n throw createDOMException('InvalidAccessError', 'No valid object store names were specified');\n }\n\n if (mode !== 'readonly' && mode !== 'readwrite') {\n throw new TypeError('Invalid transaction mode: ' + mode);\n }\n\n // Do not set transaction state to \"inactive\" yet (will be set after\n // timeout on creating transaction instance):\n // https://github.com/w3c/IndexedDB/issues/87\n const trans = IDBTransaction.__createInstance(this, objectStoreNames, mode);\n this.__transactions.push(trans);\n return trans;\n};\n\n// See https://github.com/w3c/IndexedDB/issues/192\nIDBDatabase.prototype.throwIfUpgradeTransactionNull = function () {\n if (this.__upgradeTransaction === null) {\n throw createDOMException('InvalidStateError', 'No upgrade transaction associated with database.');\n }\n};\n\n// Todo __forceClose: Add tests for `__forceClose`\n/**\n *\n * @param {string} msg\n * @returns {void}\n */\nIDBDatabase.prototype.__forceClose = function (msg) {\n const me = this;\n me.close();\n let ct = 0;\n me.__transactions.forEach(function (trans) {\n trans.on__abort = function () {\n ct++;\n if (ct === me.__transactions.length) {\n // Todo __forceClose: unblock any pending `upgradeneeded` or `deleteDatabase` calls\n const evt = createEvent('close');\n setTimeout(() => {\n me.dispatchEvent(evt);\n });\n }\n };\n trans.__abortTransaction(createDOMException(\n 'AbortError',\n 'The connection was force-closed: ' + (msg || '')\n ));\n });\n};\n\nutil.defineOuterInterface(IDBDatabase.prototype, listeners);\nutil.defineReadonlyOuterInterface(IDBDatabase.prototype, readonlyProperties);\n\nObject.defineProperty(IDBDatabase.prototype, 'constructor', {\n enumerable: false,\n writable: true,\n configurable: true,\n value: IDBDatabase\n});\n\nObject.defineProperty(IDBDatabase, 'prototype', {\n writable: false\n});\n\nexport default IDBDatabase;\n","/* globals location */\nimport path from 'path';\nimport SyncPromise from 'sync-promise';\n\nimport {createEvent} from './Event.js';\nimport IDBVersionChangeEvent from './IDBVersionChangeEvent.js';\nimport {logError, webSQLErrback, createDOMException} from './DOMException.js';\nimport {IDBOpenDBRequest} from './IDBRequest.js';\nimport cmp from './cmp.js';\nimport * as util from './util.js';\nimport * as Key from './Key.js';\nimport IDBTransaction from './IDBTransaction.js';\nimport IDBDatabase from './IDBDatabase.js';\nimport CFG from './CFG.js';\n\nlet fs;\nconst setFS = (_fs) => {\n fs = _fs;\n};\n\nconst getOrigin = () => {\n return (typeof location !== 'object' || !location) ? 'null' : location.origin;\n};\nconst hasNullOrigin = () => CFG.checkOrigin !== false && (getOrigin() === 'null');\n\n// Todo: This really should be process and tab-independent so the\n// origin could vary; in the browser, this might be through a\n// `SharedWorker`\nconst connectionQueue = {};\n\nfunction processNextInConnectionQueue (name, origin = getOrigin()) {\n const queueItems = connectionQueue[origin][name];\n if (!queueItems[0]) { // Nothing left to process\n return;\n }\n const {req, cb} = queueItems[0]; // Keep in queue to prevent continuation\n function removeFromQueue () {\n queueItems.shift();\n processNextInConnectionQueue(name, origin);\n }\n req.addEventListener('success', removeFromQueue);\n req.addEventListener('error', removeFromQueue);\n cb(req);\n}\n\n// eslint-disable-next-line default-param-last\nfunction addRequestToConnectionQueue (req, name, origin = getOrigin(), cb) {\n if (!connectionQueue[origin][name]) {\n connectionQueue[origin][name] = [];\n }\n connectionQueue[origin][name].push({req, cb});\n\n if (connectionQueue[origin][name].length === 1) { // If there are no items in the queue, we have to start it\n processNextInConnectionQueue(name, origin);\n }\n}\n\nfunction triggerAnyVersionChangeAndBlockedEvents (openConnections, req, oldVersion, newVersion) {\n // Todo: For Node (and in browser using service workers if available?) the\n // connections ought to involve those in any process; should also\n // auto-close if unloading\n const connectionIsClosed = (connection) => connection.__closePending;\n const connectionsClosed = () => openConnections.every((conn) => {\n return connectionIsClosed(conn);\n });\n return openConnections.reduce(function (promises, entry) {\n if (connectionIsClosed(entry)) {\n return promises;\n }\n return promises.then(function () {\n if (connectionIsClosed(entry)) {\n // Prior onversionchange must have caused this connection to be closed\n return undefined;\n }\n const e = new IDBVersionChangeEvent('versionchange', {oldVersion, newVersion});\n return new SyncPromise(function (resolve) {\n setTimeout(() => {\n entry.dispatchEvent(e); // No need to catch errors\n resolve();\n });\n });\n });\n }, SyncPromise.resolve()).then(function () {\n if (connectionsClosed()) {\n return undefined;\n }\n return new SyncPromise(function (resolve) {\n const unblocking = {\n check () {\n if (connectionsClosed()) {\n resolve();\n }\n }\n };\n const e = new IDBVersionChangeEvent('blocked', {oldVersion, newVersion});\n setTimeout(() => {\n req.dispatchEvent(e); // No need to catch errors\n if (!connectionsClosed()) {\n openConnections.forEach((connection) => {\n if (!connectionIsClosed(connection)) {\n connection.__unblocking = unblocking;\n }\n });\n } else {\n resolve();\n }\n });\n });\n });\n}\n\nconst websqlDBCache = {};\nlet sysdb;\nlet nameCounter = 0;\n\nfunction getLatestCachedWebSQLVersion (name) {\n return Object.keys(websqlDBCache[name]).map((version) => {\n return Number(version);\n }).reduce(\n (prev, curr) => {\n return curr > prev ? curr : prev;\n }, 0\n );\n}\n\nfunction getLatestCachedWebSQLDB (name) {\n return websqlDBCache[name] && websqlDBCache[name][\n getLatestCachedWebSQLVersion(name)\n ];\n}\n\nfunction cleanupDatabaseResources (__openDatabase, name, escapedDatabaseName, databaseDeleted, dbError) {\n const useMemoryDatabase = typeof CFG.memoryDatabase === 'string';\n if (useMemoryDatabase) {\n const latestSQLiteDBCached = websqlDBCache[name] ? getLatestCachedWebSQLDB(name) : null;\n if (!latestSQLiteDBCached) {\n console.warn('Could not find a memory database instance to delete.');\n databaseDeleted();\n return;\n }\n const sqliteDB = latestSQLiteDBCached._db && latestSQLiteDBCached._db._db;\n if (!sqliteDB || !sqliteDB.close) {\n console.error('The `openDatabase` implementation does not have the expected `._db._db.close` method for closing the database');\n return;\n }\n sqliteDB.close(function (err) {\n if (err) {\n console.warn('Error closing (destroying) memory database');\n return;\n }\n databaseDeleted();\n });\n return;\n }\n if (fs && CFG.deleteDatabaseFiles !== false) {\n fs.unlink(path.join(CFG.databaseBasePath || '', escapedDatabaseName), (err) => {\n if (err && err.code !== 'ENOENT') { // Ignore if file is already deleted\n dbError({\n code: 0,\n message: 'Error removing database file: ' + escapedDatabaseName + ' ' + err\n });\n return;\n }\n databaseDeleted();\n });\n return;\n }\n\n const sqliteDB = __openDatabase(\n path.join(CFG.databaseBasePath || '', escapedDatabaseName),\n 1,\n name,\n CFG.DEFAULT_DB_SIZE\n );\n sqliteDB.transaction(function (tx) {\n tx.executeSql('SELECT \"name\" FROM __sys__', [], function (tx, data) {\n const tables = data.rows;\n (function deleteTables (i) {\n if (i >= tables.length) {\n // If all tables are deleted, delete the housekeeping tables\n tx.executeSql('DROP TABLE IF EXISTS __sys__', [], function () {\n databaseDeleted();\n }, dbError);\n } else {\n // Delete all tables in this database, maintained in the sys table\n tx.executeSql('DROP TABLE ' + util.escapeStoreNameForSQL(\n util.unescapeSQLiteResponse( // Avoid double-escaping\n tables.item(i).name\n )\n ), [], function () {\n deleteTables(i + 1);\n }, function () {\n deleteTables(i + 1);\n });\n }\n }(0));\n }, function (e) {\n // __sys__ table does not exist, but that does not mean delete did not happen\n databaseDeleted();\n });\n });\n}\n\n/**\n* @callback CreateSysDBSuccessCallback\n* @returns {void}\n*/\n\n/**\n * Creates the sysDB to keep track of version numbers for databases.\n * @param {openDatabase} __openDatabase\n * @param {CreateSysDBSuccessCallback} success\n * @param {DOMException} failure\n * @returns {void}\n */\nfunction createSysDB (__openDatabase, success, failure) {\n function sysDbCreateError (tx, err) {\n err = webSQLErrback(err || tx);\n CFG.DEBUG && console.log('Error in sysdb transaction - when creating dbVersions', err);\n failure(err);\n }\n\n if (sysdb) {\n success();\n } else {\n sysdb = __openDatabase(\n typeof CFG.memoryDatabase === 'string'\n ? CFG.memoryDatabase\n : path.join(\n (typeof CFG.sysDatabaseBasePath === 'string'\n ? CFG.sysDatabaseBasePath\n : (CFG.databaseBasePath || '')),\n '__sysdb__' + (CFG.addSQLiteExtension !== false ? '.sqlite' : '')\n ),\n 1,\n 'System Database',\n CFG.DEFAULT_DB_SIZE\n );\n sysdb.transaction(function (systx) {\n systx.executeSql('CREATE TABLE IF NOT EXISTS dbVersions (name BLOB, version INT);', [], function (systx) {\n if (!CFG.useSQLiteIndexes) {\n success();\n return;\n }\n systx.executeSql('CREATE INDEX IF NOT EXISTS dbvname ON dbVersions(name)', [], success, sysDbCreateError);\n }, sysDbCreateError);\n }, sysDbCreateError);\n }\n}\n\n/**\n * IDBFactory Class.\n * @see https://w3c.github.io/IndexedDB/#idl-def-IDBFactory\n * @class\n */\nfunction IDBFactory () {\n throw new TypeError('Illegal constructor');\n}\nconst IDBFactoryAlias = IDBFactory;\nIDBFactory.__createInstance = function () {\n function IDBFactory () {\n this[Symbol.toStringTag] = 'IDBFactory';\n this.__connections = {};\n }\n IDBFactory.prototype = IDBFactoryAlias.prototype;\n return new IDBFactory();\n};\n\n/* eslint-disable jsdoc/check-param-names */\n/**\n * The IndexedDB Method to create a new database and return the DB.\n * @param {string} name\n * @param {number} version\n * @throws {TypeError} Illegal invocation or no arguments (for database name)\n * @returns {IDBOpenDBRequest}\n */\nIDBFactory.prototype.open = function (name /* , version */) {\n /* eslint-enable jsdoc/check-param-names */\n const me = this;\n if (!(me instanceof IDBFactory)) {\n throw new TypeError('Illegal invocation');\n }\n // eslint-disable-next-line prefer-rest-params\n let version = arguments[1];\n\n if (arguments.length === 0) {\n throw new TypeError('Database name is required');\n }\n if (version !== undefined) {\n version = util.enforceRange(version, 'unsigned long long');\n if (version === 0) {\n throw new TypeError('Version cannot be 0');\n }\n }\n if (hasNullOrigin()) {\n throw createDOMException('SecurityError', 'Cannot open an IndexedDB database from an opaque origin.');\n }\n\n const req = IDBOpenDBRequest.__createInstance();\n let calledDbCreateError = false;\n\n if (CFG.autoName && name === '') {\n name = 'autoNamedDatabase_' + nameCounter++;\n }\n name = String(name); // cast to a string\n const sqlSafeName = util.escapeSQLiteStatement(name);\n\n const useMemoryDatabase = typeof CFG.memoryDatabase === 'string';\n const useDatabaseCache = CFG.cacheDatabaseInstances !== false || useMemoryDatabase;\n\n let escapedDatabaseName;\n // eslint-disable-next-line no-useless-catch\n try {\n escapedDatabaseName = util.escapeDatabaseNameForSQLAndFiles(name);\n // eslint-disable-next-line sonarjs/no-useless-catch\n } catch (err) {\n throw err; // new TypeError('You have supplied a database name which does not match the currently supported configuration, possibly due to a length limit enforced for Node compatibility.');\n }\n\n function dbCreateError (tx, err) {\n if (calledDbCreateError) {\n return;\n }\n err = err ? webSQLErrback(err) : tx;\n calledDbCreateError = true;\n // Re: why bubbling here (and how cancelable is only really relevant for `window.onerror`) see: https://github.com/w3c/IndexedDB/issues/86\n const evt = createEvent('error', err, {bubbles: true, cancelable: true});\n req.__done = true;\n req.__error = err;\n req.__result = undefined; // Must be undefined if an error per `result` getter\n req.dispatchEvent(evt);\n }\n\n function setupDatabase (tx, db, oldVersion) {\n tx.executeSql('SELECT \"name\", \"keyPath\", \"autoInc\", \"indexList\" FROM __sys__', [], function (tx, data) {\n function finishRequest () {\n req.__result = connection;\n req.__done = true;\n }\n const connection = IDBDatabase.__createInstance(db, name, oldVersion, version, data);\n if (!me.__connections[name]) {\n me.__connections[name] = [];\n }\n me.__connections[name].push(connection);\n\n if (oldVersion < version) {\n const openConnections = me.__connections[name].slice(0, -1);\n triggerAnyVersionChangeAndBlockedEvents(openConnections, req, oldVersion, version).then(function () {\n // DB Upgrade in progress\n let sysdbFinishedCb = function (systx, err, cb) {\n if (err) {\n try {\n systx.executeSql('ROLLBACK', [], cb, cb);\n } catch (er) {\n // Browser may fail with expired transaction above so\n // no choice but to manually revert\n sysdb.transaction(function (systx) {\n function reportError (msg) {\n throw new Error('Unable to roll back upgrade transaction!' + (msg || ''));\n }\n\n // Attempt to revert\n if (oldVersion === 0) {\n systx.executeSql('DELETE FROM dbVersions WHERE \"name\" = ?', [sqlSafeName], function () {\n cb(reportError); // eslint-disable-line promise/no-callback-in-promise\n }, reportError);\n } else {\n systx.executeSql('UPDATE dbVersions SET \"version\" = ? WHERE \"name\" = ?', [oldVersion, sqlSafeName], cb, reportError);\n }\n });\n }\n return;\n }\n // In browser, should auto-commit\n cb(); // eslint-disable-line promise/no-callback-in-promise\n };\n\n sysdb.transaction(function (systx) {\n function versionSet () {\n const e = new IDBVersionChangeEvent('upgradeneeded', {oldVersion, newVersion: version});\n req.__result = connection;\n connection.__upgradeTransaction = req.__transaction = req.__result.__versionTransaction = IDBTransaction.__createInstance(req.__result, req.__result.objectStoreNames, 'versionchange');\n req.__done = true;\n\n req.transaction.__addNonRequestToTransactionQueue(function onupgradeneeded (tx, args, finished, error) {\n req.dispatchEvent(e);\n\n if (e.__legacyOutputDidListenersThrowError) {\n logError('Error', 'An error occurred in an upgradeneeded handler attached to request chain', e.__legacyOutputDidListenersThrowError); // We do nothing else with this error as per spec\n req.transaction.__abortTransaction(createDOMException('AbortError', 'A request was aborted.'));\n return;\n }\n finished();\n });\n req.transaction.on__beforecomplete = function (ev) {\n connection.__upgradeTransaction = null;\n req.__result.__versionTransaction = null;\n sysdbFinishedCb(systx, false, function () {\n req.transaction.__transFinishedCb(false, function () {\n ev.complete();\n req.__transaction = null;\n });\n });\n };\n req.transaction.on__preabort = function () {\n connection.__upgradeTransaction = null;\n // We ensure any cache is deleted before any request error events fire and try to reopen\n if (useDatabaseCache) {\n if (name in websqlDBCache) {\n delete websqlDBCache[name][version];\n }\n }\n };\n req.transaction.on__abort = function () {\n req.__transaction = null;\n // `readyState` and `result` will be reset anyways by `dbCreateError` but we follow spec.\n req.__result = undefined;\n req.__done = false;\n\n connection.close();\n setTimeout(() => {\n const err = createDOMException('AbortError', 'The upgrade transaction was aborted.');\n sysdbFinishedCb(systx, err, function (reportError) {\n if (oldVersion === 0) {\n cleanupDatabaseResources(me.__openDatabase, name, escapedDatabaseName, dbCreateError.bind(null, err), reportError || dbCreateError);\n return;\n }\n dbCreateError(err);\n });\n });\n };\n req.transaction.on__complete = function () {\n if (req.__result.__closePending) {\n req.__transaction = null;\n const err = createDOMException('AbortError', 'The connection has been closed.');\n dbCreateError(err);\n return;\n }\n // Since this is running directly after `IDBTransaction.complete`,\n // there should be a new task. However, while increasing the\n // timeout 1ms in `IDBTransaction.__executeRequests` can allow\n // `IDBOpenDBRequest.onsuccess` to trigger faster than a new\n // transaction as required by \"transaction-create_in_versionchange\" in\n // w3c/Transaction.js (though still on a timeout separate from this\n // preceding `IDBTransaction.oncomplete`), this causes a race condition\n // somehow with old transactions (e.g., for the Mocha test,\n // in `IDBObjectStore.deleteIndex`, \"should delete an index that was\n // created in a previous transaction\").\n // setTimeout(() => {\n\n finishRequest();\n\n req.__transaction = null;\n const e = createEvent('success');\n req.dispatchEvent(e);\n // });\n };\n }\n\n if (oldVersion === 0) {\n systx.executeSql('INSERT INTO dbVersions VALUES (?,?)', [sqlSafeName, version], versionSet, dbCreateError);\n } else {\n systx.executeSql('UPDATE dbVersions SET \"version\" = ? WHERE \"name\" = ?', [version, sqlSafeName], versionSet, dbCreateError);\n }\n }, dbCreateError, null, function (currentTask, err, done, rollback, commit) {\n if (currentTask.readOnly || err) {\n return true;\n }\n sysdbFinishedCb = function (systx, err, cb) {\n if (err) {\n rollback(err, cb);\n } else {\n commit(cb);\n }\n };\n return false;\n });\n return undefined;\n }).catch((err) => {\n console.log('Error within `triggerAnyVersionChangeAndBlockedEvents`');\n throw err;\n });\n } else {\n finishRequest();\n\n const e = createEvent('success');\n req.dispatchEvent(e);\n }\n }, dbCreateError);\n }\n\n function openDB (oldVersion) {\n let db;\n if ((useMemoryDatabase || useDatabaseCache) && name in websqlDBCache && websqlDBCache[name][version]) {\n db = websqlDBCache[name][version];\n } else {\n db = me.__openDatabase(\n useMemoryDatabase ? CFG.memoryDatabase : path.join(CFG.databaseBasePath || '', escapedDatabaseName),\n 1,\n name,\n CFG.DEFAULT_DB_SIZE\n );\n if (useDatabaseCache) {\n if (!(name in websqlDBCache)) {\n websqlDBCache[name] = {};\n }\n websqlDBCache[name][version] = db;\n }\n }\n\n if (version === undefined) {\n version = oldVersion || 1;\n }\n if (oldVersion > version) {\n const err = createDOMException('VersionError', 'An attempt was made to open a database using a lower version than the existing version.', version);\n if (useDatabaseCache) {\n setTimeout(() => {\n dbCreateError(err);\n });\n } else {\n dbCreateError(err);\n }\n return;\n }\n\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE IF NOT EXISTS __sys__ (name BLOB, keyPath BLOB, autoInc BOOLEAN, indexList BLOB, currNum INTEGER)', [], function () {\n function setup () {\n setupDatabase(tx, db, oldVersion);\n }\n if (!CFG.createIndexes) {\n setup();\n return;\n }\n tx.executeSql('CREATE INDEX IF NOT EXISTS sysname ON __sys__(name)', [], setup, dbCreateError);\n }, dbCreateError);\n }, dbCreateError);\n }\n\n addRequestToConnectionQueue(req, name, /* origin */ undefined, function (req) {\n let latestCachedVersion;\n if (useDatabaseCache) {\n if (!(name in websqlDBCache)) {\n websqlDBCache[name] = {};\n }\n latestCachedVersion = getLatestCachedWebSQLVersion(name);\n }\n if (latestCachedVersion) {\n openDB(latestCachedVersion);\n } else {\n createSysDB(me.__openDatabase, function () {\n sysdb.readTransaction(function (sysReadTx) {\n sysReadTx.executeSql('SELECT \"version\" FROM dbVersions WHERE \"name\" = ?', [sqlSafeName], function (sysReadTx, data) {\n if (data.rows.length === 0) {\n // Database with this name does not exist\n openDB(0);\n } else {\n openDB(data.rows.item(0).version);\n }\n }, dbCreateError);\n }, dbCreateError);\n }, dbCreateError);\n }\n });\n\n return req;\n};\n\n/**\n * Deletes a database.\n * @param {string} name\n * @returns {IDBOpenDBRequest}\n */\nIDBFactory.prototype.deleteDatabase = function (name) {\n const me = this;\n if (!(me instanceof IDBFactory)) {\n throw new TypeError('Illegal invocation');\n }\n if (arguments.length === 0) {\n throw new TypeError('Database name is required');\n }\n if (hasNullOrigin()) {\n throw createDOMException('SecurityError', 'Cannot delete an IndexedDB database from an opaque origin.');\n }\n\n name = String(name); // cast to a string\n const sqlSafeName = util.escapeSQLiteStatement(name);\n\n let escapedDatabaseName;\n // eslint-disable-next-line no-useless-catch\n try {\n escapedDatabaseName = util.escapeDatabaseNameForSQLAndFiles(name);\n // eslint-disable-next-line sonarjs/no-useless-catch\n } catch (err) {\n throw err; // throw new TypeError('You have supplied a database name which does not match the currently supported configuration, possibly due to a length limit enforced for Node compatibility.');\n }\n\n const useMemoryDatabase = typeof CFG.memoryDatabase === 'string';\n const useDatabaseCache = CFG.cacheDatabaseInstances !== false || useMemoryDatabase;\n\n const req = IDBOpenDBRequest.__createInstance();\n let calledDBError = false;\n let version = 0;\n\n let sysdbFinishedCbDelete = function (err, cb) {\n cb(err);\n };\n\n // Although the spec has no specific conditions where an error\n // may occur in `deleteDatabase`, it does provide for\n // `UnknownError` as we may require upon a SQL deletion error\n function dbError (tx, err) {\n if (calledDBError || err === true) {\n return;\n }\n err = webSQLErrback(err || tx);\n sysdbFinishedCbDelete(true, function () {\n req.__done = true;\n req.__error = err;\n req.__result = undefined; // Must be undefined if an error per `result` getter\n // Re: why bubbling here (and how cancelable is only really relevant for `window.onerror`) see: https://github.com/w3c/IndexedDB/issues/86\n const e = createEvent('error', err, {bubbles: true, cancelable: true});\n req.dispatchEvent(e);\n calledDBError = true;\n });\n }\n\n addRequestToConnectionQueue(req, name, /* origin */ undefined, function (req) {\n createSysDB(me.__openDatabase, function () {\n // function callback (cb) { cb(); }\n // callback(function () {\n\n function completeDatabaseDelete () {\n req.__result = undefined;\n req.__done = true;\n const e = new IDBVersionChangeEvent('success', {oldVersion: version, newVersion: null});\n req.dispatchEvent(e);\n }\n\n function databaseDeleted () {\n sysdbFinishedCbDelete(false, function () {\n if (useDatabaseCache && name in websqlDBCache) {\n delete websqlDBCache[name]; // New calls will treat as though never existed\n }\n delete me.__connections[name];\n\n completeDatabaseDelete();\n });\n }\n sysdb.readTransaction(function (sysReadTx) {\n sysReadTx.executeSql('SELECT \"version\" FROM dbVersions WHERE \"name\" = ?', [sqlSafeName], function (sysReadTx, data) {\n if (data.rows.length === 0) {\n completeDatabaseDelete();\n return undefined;\n }\n ({version} = data.rows.item(0));\n\n const openConnections = me.__connections[name] || [];\n triggerAnyVersionChangeAndBlockedEvents(openConnections, req, version, null).then(function () { // eslint-disable-line promise/catch-or-return\n // Since we need two databases which can't be in a single transaction, we\n // do this deleting from `dbVersions` first since the `__sys__` deleting\n // only impacts file memory whereas this one is critical for avoiding it\n // being found via `open` or `databases`; however, we will\n // avoid committing anyways until all deletions are made and rollback the\n // `dbVersions` change if they fail\n sysdb.transaction(function (systx) {\n systx.executeSql('DELETE FROM dbVersions WHERE \"name\" = ? ', [sqlSafeName], function () {\n // Todo: We should also check whether `dbVersions` is empty and if so, delete upon\n // `deleteDatabaseFiles` config. We also ought to do this when aborting (see\n // above code with `DELETE FROM dbVersions`)\n cleanupDatabaseResources(me.__openDatabase, name, escapedDatabaseName, databaseDeleted, dbError);\n }, dbError);\n }, dbError, null, function (currentTask, err, done, rollback, commit) {\n if (currentTask.readOnly || err) {\n return true;\n }\n sysdbFinishedCbDelete = function (err, cb) {\n if (err) {\n rollback(err, cb);\n } else {\n commit(cb);\n }\n };\n return false;\n });\n return undefined;\n }, dbError);\n return undefined;\n }, dbError);\n });\n }, dbError);\n });\n\n return req;\n};\n\nIDBFactory.prototype.cmp = function (key1, key2) {\n if (!(this instanceof IDBFactory)) {\n throw new TypeError('Illegal invocation');\n }\n if (arguments.length < 2) {\n throw new TypeError('You must provide two keys to be compared');\n }\n // We use encoding facilities already built for proper sorting;\n // the following \"conversions\" are for validation only\n Key.convertValueToKeyRethrowingAndIfInvalid(key1);\n Key.convertValueToKeyRethrowingAndIfInvalid(key2);\n return cmp(key1, key2);\n};\n\n/**\n* May return outdated information if a database has since been deleted.\n* @see https://github.com/w3c/IndexedDB/pull/240/files\n* @returns {Promise}\n*/\nIDBFactory.prototype.databases = function () {\n const me = this;\n let calledDbCreateError = false;\n return new Promise(function (resolve, reject) { // eslint-disable-line promise/avoid-new\n if (!(me instanceof IDBFactory)) {\n throw new TypeError('Illegal invocation');\n }\n if (hasNullOrigin()) {\n throw createDOMException('SecurityError', 'Cannot get IndexedDB database names from an opaque origin.');\n }\n function dbGetDatabaseNamesError (tx, err) {\n if (calledDbCreateError) {\n return;\n }\n err = err ? webSQLErrback(err) : tx;\n calledDbCreateError = true;\n reject(err);\n }\n createSysDB(me.__openDatabase, function () {\n sysdb.readTransaction(function (sysReadTx) {\n sysReadTx.executeSql('SELECT \"name\", \"version\" FROM dbVersions', [], function (sysReadTx, data) {\n const dbNames = [];\n for (let i = 0; i < data.rows.length; i++) {\n const {name, version} = data.rows.item(i);\n dbNames.push({\n name: util.unescapeSQLiteResponse(name),\n version\n });\n }\n resolve(dbNames);\n }, dbGetDatabaseNamesError);\n }, dbGetDatabaseNamesError);\n }, dbGetDatabaseNamesError);\n });\n};\n\n/**\n* @todo forceClose: Test\n* This is provided to facilitate unit-testing of the\n* closing of a database connection with a forced flag:\n* \n* @param {string} dbName\n* @param {Integer} connIdx\n* @param {string} msg\n* @throws {TypeError}\n* @returns {void}\n*/\nIDBFactory.prototype.__forceClose = function (dbName, connIdx, msg) {\n const me = this;\n function forceClose (conn) {\n conn.__forceClose(msg);\n }\n if (util.isNullish(dbName)) {\n Object.values(me.__connections).forEach((conn) => {\n forceClose(conn);\n });\n } else if (!me.__connections[dbName]) {\n console.log('No database connections with that name to force close');\n } else if (util.isNullish(connIdx)) {\n me.__connections[dbName].forEach((conn) => {\n forceClose(conn);\n });\n } else if (!Number.isInteger(connIdx) || connIdx < 0 || connIdx > me.__connections[dbName].length - 1) {\n throw new TypeError(\n 'If providing an argument, __forceClose must be called with a ' +\n 'numeric index to indicate a specific connection to lose'\n );\n } else {\n forceClose(me.__connections[dbName][connIdx]);\n }\n};\n\nIDBFactory.prototype.__setConnectionQueueOrigin = function (origin = getOrigin()) {\n connectionQueue[origin] = {};\n};\n\nIDBFactory.prototype[Symbol.toStringTag] = 'IDBFactoryPrototype';\n\nObject.defineProperty(IDBFactory, 'prototype', {\n writable: false\n});\n\nconst shimIndexedDB = IDBFactory.__createInstance();\nexport {IDBFactory, cmp, shimIndexedDB, setFS};\n","import {IDBRequest} from './IDBRequest.js';\nimport IDBObjectStore from './IDBObjectStore.js';\nimport {createDOMException} from './DOMException.js';\nimport {setSQLForKeyRange, convertValueToKeyRange} from './IDBKeyRange.js';\nimport {cmp} from './IDBFactory.js';\nimport * as util from './util.js';\nimport IDBTransaction from './IDBTransaction.js';\nimport * as Key from './Key.js';\nimport * as Sca from './Sca.js';\nimport IDBIndex from './IDBIndex.js'; // eslint-disable-line import/no-named-as-default\nimport CFG from './CFG.js';\n\nfunction IDBCursor () {\n throw new TypeError('Illegal constructor');\n}\nconst IDBCursorAlias = IDBCursor;\n\n/* eslint-disable func-name-matching */\n/**\n * The IndexedDB Cursor Object.\n * @see http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBCursor\n * @param {IDBKeyRange} query\n * @param {string} direction\n * @param {IDBObjectStore} store\n * @param {IDBObjectStore|IDBIndex} source\n * @param {string} keyColumnName\n * @param {string} valueColumnName\n * @param {boolean} count\n * @returns {void}\n */\nIDBCursor.__super = function IDBCursor (query, direction, store, source, keyColumnName, valueColumnName, count) {\n /* eslint-enable func-name-matching */\n this[Symbol.toStringTag] = 'IDBCursor';\n util.defineReadonlyProperties(this, ['key', 'primaryKey', 'request']);\n IDBObjectStore.__invalidStateIfDeleted(store);\n this.__indexSource = util.instanceOf(source, IDBIndex);\n if (this.__indexSource) IDBIndex.__invalidStateIfDeleted(source);\n IDBTransaction.__assertActive(store.transaction);\n const range = convertValueToKeyRange(query);\n if (direction !== undefined && !(['next', 'prev', 'nextunique', 'prevunique'].includes(direction))) {\n throw new TypeError(direction + 'is not a valid cursor direction');\n }\n\n Object.defineProperties(this, {\n // Babel is not respecting default writable false here, so make explicit\n source: {writable: false, value: source},\n direction: {writable: false, value: direction || 'next'}\n });\n this.__key = undefined;\n this.__primaryKey = undefined;\n\n this.__store = store;\n this.__range = range;\n this.__request = IDBRequest.__createInstance();\n this.__request.__source = source;\n this.__request.__transaction = this.__store.transaction;\n this.__keyColumnName = keyColumnName;\n this.__valueColumnName = valueColumnName;\n this.__keyOnly = valueColumnName === 'key';\n this.__valueDecoder = this.__keyOnly ? Key : Sca;\n this.__count = count;\n this.__prefetchedIndex = -1;\n this.__multiEntryIndex = this.__indexSource ? source.multiEntry : false;\n this.__unique = this.direction.includes('unique');\n this.__sqlDirection = ['prev', 'prevunique'].includes(this.direction) ? 'DESC' : 'ASC';\n\n if (range !== undefined) {\n // Encode the key range and cache the encoded values, so we don't have to re-encode them over and over\n range.__lowerCached = range.lower !== undefined && Key.encode(range.lower, this.__multiEntryIndex);\n range.__upperCached = range.upper !== undefined && Key.encode(range.upper, this.__multiEntryIndex);\n }\n this.__gotValue = true;\n this.continue();\n};\n\nIDBCursor.__createInstance = function (...args) {\n const IDBCursor = IDBCursorAlias.__super;\n IDBCursor.prototype = IDBCursorAlias.prototype;\n return new IDBCursor(...args);\n};\n\nIDBCursor.prototype.__find = function (...args /* key, tx, success, error, recordsToLoad */) {\n if (this.__multiEntryIndex) {\n this.__findMultiEntry(...args);\n } else {\n this.__findBasic(...args);\n }\n};\n\nIDBCursor.prototype.__findBasic = function (key, primaryKey, tx, success, error, recordsToLoad) {\n const continueCall = recordsToLoad !== undefined;\n recordsToLoad = recordsToLoad || 1;\n\n const me = this;\n const quotedKeyColumnName = util.sqlQuote(me.__keyColumnName);\n const quotedKey = util.sqlQuote('key');\n let sql = ['SELECT * FROM', util.escapeStoreNameForSQL(me.__store.__currentName)];\n const sqlValues = [];\n sql.push('WHERE', quotedKeyColumnName, 'NOT NULL');\n setSQLForKeyRange(me.__range, quotedKeyColumnName, sql, sqlValues, true, true);\n\n // Determine the ORDER BY direction based on the cursor.\n const direction = me.__sqlDirection;\n const op = direction === 'ASC' ? '>' : '<';\n\n if (primaryKey !== undefined) {\n sql.push('AND', quotedKey, op + '= ?');\n // Key.convertValueToKey(primaryKey); // Already checked by `continuePrimaryKey`\n sqlValues.push(Key.encode(primaryKey));\n }\n if (key !== undefined) {\n sql.push('AND', quotedKeyColumnName, op + '= ?');\n // Key.convertValueToKey(key); // Already checked by `continue` or `continuePrimaryKey`\n sqlValues.push(Key.encode(key));\n } else if (continueCall && me.__key !== undefined) {\n sql.push('AND', quotedKeyColumnName, op + ' ?');\n // Key.convertValueToKey(me.__key); // Already checked when stored\n sqlValues.push(Key.encode(me.__key));\n }\n\n if (!me.__count) {\n // 1. Sort by key\n sql.push('ORDER BY', quotedKeyColumnName, direction);\n\n if (me.__keyColumnName !== 'key') { // Avoid adding 'key' twice\n if (!me.__unique) {\n // 2. Sort by primaryKey (if defined and not unique)\n // 3. Sort by position (if defined)\n sql.push(',', quotedKey, direction);\n } else if (me.direction === 'prevunique') {\n // Sort by first record with key matching\n sql.push(',', quotedKey, 'ASC');\n }\n }\n\n if (!me.__unique && me.__indexSource) {\n // 4. Sort by object store position (if defined and not unique)\n sql.push(',', util.sqlQuote(me.__valueColumnName), direction);\n }\n sql.push('LIMIT', recordsToLoad);\n }\n sql = sql.join(' ');\n CFG.DEBUG && console.log(sql, sqlValues);\n\n tx.executeSql(sql, sqlValues, function (tx, data) {\n if (me.__count) {\n success(undefined, data.rows.length, undefined);\n } else if (data.rows.length > 1) {\n me.__prefetchedIndex = 0;\n me.__prefetchedData = data.rows;\n CFG.DEBUG && console.log('Preloaded ' + me.__prefetchedData.length + ' records for cursor');\n me.__decode(data.rows.item(0), success);\n } else if (data.rows.length === 1) {\n me.__decode(data.rows.item(0), success);\n } else {\n CFG.DEBUG && console.log('Reached end of cursors');\n success(undefined, undefined, undefined);\n }\n }, function (tx, err) {\n CFG.DEBUG && console.log('Could not execute Cursor.continue', sql, sqlValues);\n error(err);\n });\n};\n\nconst leftBracketRegex = /\\[/gu;\n\nIDBCursor.prototype.__findMultiEntry = function (key, primaryKey, tx, success, error) {\n const me = this;\n\n if (me.__prefetchedData && me.__prefetchedData.length === me.__prefetchedIndex) {\n CFG.DEBUG && console.log('Reached end of multiEntry cursor');\n success(undefined, undefined, undefined);\n return;\n }\n\n const quotedKeyColumnName = util.sqlQuote(me.__keyColumnName);\n let sql = ['SELECT * FROM', util.escapeStoreNameForSQL(me.__store.__currentName)];\n const sqlValues = [];\n sql.push('WHERE', quotedKeyColumnName, 'NOT NULL');\n if (me.__range && (me.__range.lower !== undefined && Array.isArray(me.__range.upper))) {\n if (me.__range.upper.indexOf(me.__range.lower) === 0) {\n sql.push('AND', quotedKeyColumnName, \"LIKE ? ESCAPE '^'\");\n sqlValues.push('%' + util.sqlLIKEEscape(me.__range.__lowerCached.slice(0, -1)) + '%');\n }\n }\n\n // Determine the ORDER BY direction based on the cursor.\n const direction = me.__sqlDirection;\n const op = direction === 'ASC' ? '>' : '<';\n const quotedKey = util.sqlQuote('key');\n\n if (primaryKey !== undefined) {\n sql.push('AND', quotedKey, op + '= ?');\n // Key.convertValueToKey(primaryKey); // Already checked by `continuePrimaryKey`\n sqlValues.push(Key.encode(primaryKey));\n }\n if (key !== undefined) {\n sql.push('AND', quotedKeyColumnName, op + '= ?');\n // Key.convertValueToKey(key); // Already checked by `continue` or `continuePrimaryKey`\n sqlValues.push(Key.encode(key));\n } else if (me.__key !== undefined) {\n sql.push('AND', quotedKeyColumnName, op + ' ?');\n // Key.convertValueToKey(me.__key); // Already checked when entered\n sqlValues.push(Key.encode(me.__key));\n }\n\n if (!me.__count) {\n // 1. Sort by key\n sql.push('ORDER BY', quotedKeyColumnName, direction);\n\n // 2. Sort by primaryKey (if defined and not unique)\n if (!me.__unique && me.__keyColumnName !== 'key') { // Avoid adding 'key' twice\n sql.push(',', util.sqlQuote('key'), direction);\n }\n\n // 3. Sort by position (if defined)\n\n if (!me.__unique && me.__indexSource) {\n // 4. Sort by object store position (if defined and not unique)\n sql.push(',', util.sqlQuote(me.__valueColumnName), direction);\n }\n }\n sql = sql.join(' ');\n CFG.DEBUG && console.log(sql, sqlValues);\n\n tx.executeSql(sql, sqlValues, function (tx, data) {\n if (data.rows.length > 0) {\n if (me.__count) { // Avoid caching and other processing below\n let ct = 0;\n for (let i = 0; i < data.rows.length; i++) {\n const rowItem = data.rows.item(i);\n const rowKey = Key.decode(rowItem[me.__keyColumnName], true);\n const matches = Key.findMultiEntryMatches(rowKey, me.__range);\n ct += matches.length;\n }\n success(undefined, ct, undefined);\n return;\n }\n const rows = [];\n for (let i = 0; i < data.rows.length; i++) {\n const rowItem = data.rows.item(i);\n const rowKey = Key.decode(rowItem[me.__keyColumnName], true);\n const matches = Key.findMultiEntryMatches(rowKey, me.__range);\n\n for (const matchingKey of matches) {\n const clone = {\n matchingKey: Key.encode(matchingKey, true),\n key: rowItem.key\n };\n clone[me.__keyColumnName] = rowItem[me.__keyColumnName];\n clone[me.__valueColumnName] = rowItem[me.__valueColumnName];\n rows.push(clone);\n }\n }\n const reverse = me.direction.indexOf('prev') === 0;\n rows.sort(function (a, b) {\n if (a.matchingKey.replace(leftBracketRegex, 'z') < b.matchingKey.replace(leftBracketRegex, 'z')) {\n return reverse ? 1 : -1;\n }\n if (a.matchingKey.replace(leftBracketRegex, 'z') > b.matchingKey.replace(leftBracketRegex, 'z')) {\n return reverse ? -1 : 1;\n }\n if (a.key < b.key) {\n return me.direction === 'prev' ? 1 : -1;\n }\n if (a.key > b.key) {\n return me.direction === 'prev' ? -1 : 1;\n }\n return 0;\n });\n\n if (rows.length > 1) {\n me.__prefetchedIndex = 0;\n me.__prefetchedData = {\n data: rows,\n length: rows.length,\n item (index) {\n return this.data[index];\n }\n };\n CFG.DEBUG && console.log('Preloaded ' + me.__prefetchedData.length + ' records for multiEntry cursor');\n me.__decode(rows[0], success);\n } else if (rows.length === 1) {\n CFG.DEBUG && console.log('Reached end of multiEntry cursor');\n me.__decode(rows[0], success);\n } else {\n CFG.DEBUG && console.log('Reached end of multiEntry cursor');\n success(undefined, undefined, undefined);\n }\n } else {\n CFG.DEBUG && console.log('Reached end of multiEntry cursor');\n success(undefined, undefined, undefined);\n }\n }, function (tx, err) {\n CFG.DEBUG && console.log('Could not execute Cursor.continue', sql, sqlValues);\n error(err);\n });\n};\n\n/**\n* @callback module:IDBCursor.SuccessArg\n* @param value\n* @param {IDBRequest} req\n* @returns {void}\n*/\n\n/**\n* @callback module:IDBCursor.SuccessCallback\n* @param key\n* @param value\n* @param primaryKey\n* @returns {void}\n*/\n\n/**\n * Creates an \"onsuccess\" callback.\n * @private\n * @param {module:IDBCursor.SuccessArg} success\n * @returns {module:IDBCursor.SuccessCallback}\n */\nIDBCursor.prototype.__onsuccess = function (success) {\n const me = this;\n return function (key, value, primaryKey) {\n if (me.__count) {\n success(value, me.__request);\n } else {\n if (key !== undefined) {\n me.__gotValue = true;\n }\n me.__key = key === undefined ? null : key;\n me.__primaryKey = primaryKey === undefined ? null : primaryKey;\n me.__value = value === undefined ? null : value;\n const result = key === undefined ? null : me;\n success(result, me.__request);\n }\n };\n};\n\nIDBCursor.prototype.__decode = function (rowItem, callback) {\n const me = this;\n if (me.__multiEntryIndex && me.__unique) {\n if (!me.__matchedKeys) {\n me.__matchedKeys = {};\n }\n if (me.__matchedKeys[rowItem.matchingKey]) {\n callback(undefined, undefined, undefined);\n return;\n }\n me.__matchedKeys[rowItem.matchingKey] = true;\n }\n const encKey = util.unescapeSQLiteResponse(\n me.__multiEntryIndex\n ? rowItem.matchingKey\n : rowItem[me.__keyColumnName]\n );\n const encVal = util.unescapeSQLiteResponse(rowItem[me.__valueColumnName]);\n const encPrimaryKey = util.unescapeSQLiteResponse(rowItem.key);\n\n const key = Key.decode(\n encKey,\n me.__multiEntryIndex\n );\n const val = me.__valueDecoder.decode(encVal);\n const primaryKey = Key.decode(encPrimaryKey);\n callback(key, val, primaryKey, encKey /*, encVal, encPrimaryKey */);\n};\n\nIDBCursor.prototype.__sourceOrEffectiveObjStoreDeleted = function () {\n IDBObjectStore.__invalidStateIfDeleted(this.__store, \"The cursor's effective object store has been deleted\");\n if (this.__indexSource) IDBIndex.__invalidStateIfDeleted(this.source, \"The cursor's index source has been deleted\");\n};\n\nIDBCursor.prototype.__invalidateCache = function () {\n this.__prefetchedData = null;\n};\n\nIDBCursor.prototype.__continue = function (key, advanceContinue) {\n const me = this;\n const advanceState = me.__advanceCount !== undefined;\n IDBTransaction.__assertActive(me.__store.transaction);\n me.__sourceOrEffectiveObjStoreDeleted();\n if (!me.__gotValue && !advanceContinue) {\n throw createDOMException('InvalidStateError', 'The cursor is being iterated or has iterated past its end.');\n }\n if (key !== undefined) {\n Key.convertValueToKeyRethrowingAndIfInvalid(key);\n const cmpResult = cmp(key, me.key);\n if (cmpResult === 0 ||\n (me.direction.includes('next') && cmpResult === -1) ||\n (me.direction.includes('prev') && cmpResult === 1)\n ) {\n throw createDOMException('DataError', 'Cannot ' + (advanceState ? 'advance' : 'continue') + ' the cursor in an unexpected direction');\n }\n }\n this.__continueFinish(key, undefined, advanceState);\n};\n\nIDBCursor.prototype.__continueFinish = function (key, primaryKey, advanceState) {\n const me = this;\n const recordsToPreloadOnContinue = me.__advanceCount || CFG.cursorPreloadPackSize || 100;\n me.__gotValue = false;\n me.__request.__done = false;\n\n me.__store.transaction.__pushToQueue(me.__request, function cursorContinue (tx, args, success, error, executeNextRequest) {\n function triggerSuccess (k, val, primKey) {\n if (advanceState) {\n if (me.__advanceCount >= 2 && k !== undefined) {\n me.__advanceCount--;\n me.__key = k;\n me.__continue(undefined, true);\n executeNextRequest(); // We don't call success yet but do need to advance the transaction queue\n return;\n }\n me.__advanceCount = undefined;\n }\n me.__onsuccess(success)(k, val, primKey);\n }\n if (me.__prefetchedData) {\n // We have pre-loaded data for the cursor\n me.__prefetchedIndex++;\n if (me.__prefetchedIndex < me.__prefetchedData.length) {\n me.__decode(me.__prefetchedData.item(me.__prefetchedIndex), function (k, val, primKey, encKey) {\n function checkKey () {\n const cmpResult = key === undefined || cmp(k, key);\n if (cmpResult > 0 || (\n cmpResult === 0 && (\n me.__unique || primaryKey === undefined || cmp(primKey, primaryKey) >= 0\n )\n )) {\n triggerSuccess(k, val, primKey);\n return;\n }\n cursorContinue(tx, args, success, error);\n }\n if (me.__unique && !me.__multiEntryIndex &&\n encKey === Key.encode(me.key, me.__multiEntryIndex)) {\n cursorContinue(tx, args, success, error);\n return;\n }\n checkKey();\n });\n return;\n }\n }\n\n // No (or not enough) pre-fetched data, do query\n me.__find(key, primaryKey, tx, triggerSuccess, function (...args) {\n me.__advanceCount = undefined;\n error(...args);\n }, recordsToPreloadOnContinue);\n });\n};\n\nIDBCursor.prototype.continue = function (/* key */) {\n // eslint-disable-next-line prefer-rest-params\n this.__continue(arguments[0]);\n};\n\nIDBCursor.prototype.continuePrimaryKey = function (key, primaryKey) {\n const me = this;\n IDBTransaction.__assertActive(me.__store.transaction);\n me.__sourceOrEffectiveObjStoreDeleted();\n if (!me.__indexSource) {\n throw createDOMException('InvalidAccessError', '`continuePrimaryKey` may only be called on an index source.');\n }\n if (!['next', 'prev'].includes(me.direction)) {\n throw createDOMException('InvalidAccessError', '`continuePrimaryKey` may not be called with unique cursors.');\n }\n if (!me.__gotValue) {\n throw createDOMException('InvalidStateError', 'The cursor is being iterated or has iterated past its end.');\n }\n Key.convertValueToKeyRethrowingAndIfInvalid(key);\n Key.convertValueToKeyRethrowingAndIfInvalid(primaryKey);\n\n const cmpResult = cmp(key, me.key);\n if (\n (me.direction === 'next' && cmpResult === -1) ||\n (me.direction === 'prev' && cmpResult === 1)\n ) {\n throw createDOMException('DataError', 'Cannot continue the cursor in an unexpected direction');\n }\n function noErrors () {\n me.__continueFinish(key, primaryKey, false);\n }\n if (cmpResult === 0) {\n Sca.encode(primaryKey, function (encPrimaryKey) {\n Sca.encode(me.primaryKey, function (encObjectStorePos) {\n if (encPrimaryKey === encObjectStorePos ||\n (me.direction === 'next' && encPrimaryKey < encObjectStorePos) ||\n (me.direction === 'prev' && encPrimaryKey > encObjectStorePos)\n ) {\n throw createDOMException('DataError', 'Cannot continue the cursor in an unexpected direction');\n }\n noErrors();\n });\n });\n } else {\n noErrors();\n }\n};\n\nIDBCursor.prototype.advance = function (count) {\n const me = this;\n count = util.enforceRange(count, 'unsigned long');\n if (count === 0) {\n throw new TypeError('Calling advance() with count argument 0');\n }\n if (me.__gotValue) { // Only set the count if not running in error (otherwise will override earlier good advance calls)\n me.__advanceCount = count;\n }\n me.__continue();\n};\n\nIDBCursor.prototype.update = function (valueToUpdate) {\n const me = this;\n if (!arguments.length) throw new TypeError('A value must be passed to update()');\n IDBTransaction.__assertActive(me.__store.transaction);\n me.__store.transaction.__assertWritable();\n me.__sourceOrEffectiveObjStoreDeleted();\n if (!me.__gotValue) {\n throw createDOMException('InvalidStateError', 'The cursor is being iterated or has iterated past its end.');\n }\n if (me.__keyOnly) {\n throw createDOMException('InvalidStateError', 'This cursor method cannot be called when the key only flag has been set.');\n }\n const request = me.__store.transaction.__createRequest(me);\n const key = me.primaryKey;\n function addToQueue (clonedValue) {\n // We set the `invalidateCache` argument to `false` since the old value shouldn't be accessed\n IDBObjectStore.__storingRecordObjectStore(request, me.__store, false, clonedValue, false, key);\n }\n if (me.__store.keyPath !== null) {\n const [evaluatedKey, clonedValue] = me.__store.__validateKeyAndValueAndCloneValue(valueToUpdate, undefined, true);\n if (cmp(me.primaryKey, evaluatedKey) !== 0) {\n throw createDOMException('DataError', 'The key of the supplied value to `update` is not equal to the cursor\\'s effective key');\n }\n addToQueue(clonedValue);\n } else {\n const clonedValue = Sca.clone(valueToUpdate);\n addToQueue(clonedValue);\n }\n return request;\n};\n\nIDBCursor.prototype.delete = function () {\n const me = this;\n IDBTransaction.__assertActive(me.__store.transaction);\n me.__store.transaction.__assertWritable();\n me.__sourceOrEffectiveObjStoreDeleted();\n if (!me.__gotValue) {\n throw createDOMException('InvalidStateError', 'The cursor is being iterated or has iterated past its end.');\n }\n if (me.__keyOnly) {\n throw createDOMException('InvalidStateError', 'This cursor method cannot be called when the key only flag has been set.');\n }\n return this.__store.transaction.__addToTransactionQueue(function cursorDelete (tx, args, success, error) {\n me.__find(undefined, undefined, tx, function (key, value, primaryKey) {\n const sql = 'DELETE FROM ' + util.escapeStoreNameForSQL(me.__store.__currentName) + ' WHERE \"key\" = ?';\n CFG.DEBUG && console.log(sql, key, primaryKey);\n // Key.convertValueToKey(primaryKey); // Already checked when entered\n tx.executeSql(sql, [util.escapeSQLiteStatement(Key.encode(primaryKey))], function (tx, data) {\n if (data.rowsAffected === 1) {\n // We don't invalidate the cache (as we don't access it anymore\n // and it will set the index off)\n success(undefined);\n } else {\n error('No rows with key found' + key);\n }\n }, function (tx, data) {\n error(data);\n });\n }, error);\n }, undefined, me);\n};\n\nIDBCursor.prototype[Symbol.toStringTag] = 'IDBCursorPrototype';\n\nutil.defineReadonlyOuterInterface(\n IDBCursor.prototype,\n ['source', 'direction', 'key', 'primaryKey', 'request']\n);\nObject.defineProperty(IDBCursor, 'prototype', {\n writable: false\n});\n\nfunction IDBCursorWithValue () {\n throw new TypeError('Illegal constructor');\n}\n\nIDBCursorWithValue.prototype = Object.create(IDBCursor.prototype);\nObject.defineProperty(IDBCursorWithValue.prototype, 'constructor', {\n enumerable: false,\n writable: true,\n configurable: true,\n value: IDBCursorWithValue\n});\n\nconst IDBCursorWithValueAlias = IDBCursorWithValue;\nIDBCursorWithValue.__createInstance = function (...args) {\n function IDBCursorWithValue () {\n IDBCursor.__super.call(this, ...args);\n this[Symbol.toStringTag] = 'IDBCursorWithValue';\n util.defineReadonlyProperties(this, 'value');\n }\n IDBCursorWithValue.prototype = IDBCursorWithValueAlias.prototype;\n return new IDBCursorWithValue();\n};\n\nutil.defineReadonlyOuterInterface(IDBCursorWithValue.prototype, ['value']);\n\nIDBCursorWithValue.prototype[Symbol.toStringTag] = 'IDBCursorWithValuePrototype';\n\nObject.defineProperty(IDBCursorWithValue, 'prototype', {\n writable: false\n});\n\nexport {IDBCursor, IDBCursorWithValue};\n","/* globals self */\nimport {setPrototypeOfCustomEvent} from 'eventtargeter';\nimport shimIDBVersionChangeEvent from './IDBVersionChangeEvent.js';\nimport {IDBCursor as shimIDBCursor, IDBCursorWithValue as shimIDBCursorWithValue} from './IDBCursor.js';\nimport {IDBRequest as shimIDBRequest, IDBOpenDBRequest as shimIDBOpenDBRequest} from './IDBRequest.js';\nimport {createDOMException, ShimDOMException} from './DOMException.js';\nimport {shimIndexedDB, IDBFactory, setFS} from './IDBFactory.js';\nimport DOMStringList from './DOMStringList.js';\nimport {ShimEvent, ShimCustomEvent, ShimEventTarget} from './Event.js';\nimport {register} from './Sca.js';\nimport shimIDBKeyRange from './IDBKeyRange.js';\nimport shimIDBObjectStore from './IDBObjectStore.js';\nimport shimIDBIndex from './IDBIndex.js';\nimport shimIDBTransaction from './IDBTransaction.js';\nimport shimIDBDatabase from './IDBDatabase.js';\nimport CFG from './CFG.js';\nimport {isNullish} from './util.js';\n\nfunction setConfig (prop, val) {\n if (prop && typeof prop === 'object') {\n Object.entries(prop).forEach(([p, val]) => {\n setConfig(p, val);\n });\n return;\n }\n if (!(prop in CFG)) {\n throw new Error(prop + ' is not a valid configuration property');\n }\n CFG[prop] = val;\n if (prop === 'registerSCA' && typeof val === 'function') {\n register(val);\n }\n}\n\nfunction setGlobalVars (idb, initialConfig) {\n if (initialConfig) {\n setConfig(initialConfig);\n }\n const IDB = idb || (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : (typeof global !== 'undefined' ? global : {})));\n function shim (name, value, propDesc) {\n if (!propDesc || !Object.defineProperty) {\n try {\n // Try setting the property. This will fail if the property is read-only.\n IDB[name] = value;\n } catch (e) {\n console.log(e);\n }\n }\n if (IDB[name] !== value && Object.defineProperty) {\n // Setting a read-only property failed, so try re-defining the property\n try {\n let desc = propDesc || {};\n if (!('get' in desc)) {\n if (!('value' in desc)) {\n desc.value = value;\n }\n if (!('writable' in desc)) {\n desc.writable = true;\n }\n } else {\n const o = {\n get [name] () {\n return propDesc.get.call(this);\n }\n };\n desc = Object.getOwnPropertyDescriptor(o, name);\n }\n Object.defineProperty(IDB, name, desc);\n } catch (e) {\n // With `indexedDB`, PhantomJS fails here and below but\n // not above, while Chrome is reverse (and Firefox doesn't\n // get here since no WebSQL to use for shimming)\n }\n }\n if (IDB[name] !== value) {\n typeof console !== 'undefined' && console.warn && console.warn('Unable to shim ' + name);\n }\n }\n if (CFG.win.openDatabase !== undefined) {\n shim('shimIndexedDB', shimIndexedDB, {\n enumerable: false,\n configurable: true\n });\n }\n if (IDB.shimIndexedDB) {\n IDB.shimIndexedDB.__useShim = function () {\n function setNonIDBGlobals (prefix = '') {\n shim(prefix + 'DOMException', ShimDOMException);\n shim(prefix + 'DOMStringList', DOMStringList, {\n enumerable: false,\n configurable: true,\n writable: true,\n value: DOMStringList\n });\n shim(prefix + 'Event', ShimEvent, {\n configurable: true,\n writable: true,\n value: ShimEvent,\n enumerable: false\n });\n shim(prefix + 'CustomEvent', ShimCustomEvent, {\n configurable: true,\n writable: true,\n value: ShimCustomEvent,\n enumerable: false\n });\n shim(prefix + 'EventTarget', ShimEventTarget, {\n configurable: true,\n writable: true,\n value: ShimEventTarget,\n enumerable: false\n });\n }\n const shimIDBFactory = IDBFactory;\n if (CFG.win.openDatabase !== undefined) {\n shimIndexedDB.__openDatabase = CFG.win.openDatabase.bind(CFG.win); // We cache here in case the function is overwritten later as by the IndexedDB support promises tests\n // Polyfill ALL of IndexedDB, using WebSQL\n shim('indexedDB', shimIndexedDB, {\n enumerable: true,\n configurable: true,\n get () {\n if (this !== IDB && !isNullish(this) && !this.shimNS) { // Latter is hack for test environment\n throw new TypeError('Illegal invocation');\n }\n return shimIndexedDB;\n }\n });\n [\n ['IDBFactory', shimIDBFactory],\n ['IDBDatabase', shimIDBDatabase],\n ['IDBObjectStore', shimIDBObjectStore],\n ['IDBIndex', shimIDBIndex],\n ['IDBTransaction', shimIDBTransaction],\n ['IDBCursor', shimIDBCursor],\n ['IDBCursorWithValue', shimIDBCursorWithValue],\n ['IDBKeyRange', shimIDBKeyRange],\n ['IDBRequest', shimIDBRequest],\n ['IDBOpenDBRequest', shimIDBOpenDBRequest],\n ['IDBVersionChangeEvent', shimIDBVersionChangeEvent]\n ].forEach(([prop, obj]) => {\n shim(prop, obj, {\n enumerable: false,\n configurable: true\n });\n });\n // For Node environments\n if (CFG.fs) {\n setFS(CFG.fs);\n }\n if (CFG.fullIDLSupport) {\n // Slow per MDN so off by default! Though apparently needed for WebIDL: http://stackoverflow.com/questions/41927589/rationales-consequences-of-webidl-class-inheritance-requirements\n\n Object.setPrototypeOf(IDB.IDBOpenDBRequest, IDB.IDBRequest);\n Object.setPrototypeOf(IDB.IDBCursorWithValue, IDB.IDBCursor);\n\n Object.setPrototypeOf(shimIDBDatabase, ShimEventTarget);\n Object.setPrototypeOf(shimIDBRequest, ShimEventTarget);\n Object.setPrototypeOf(shimIDBTransaction, ShimEventTarget);\n Object.setPrototypeOf(shimIDBVersionChangeEvent, ShimEvent);\n Object.setPrototypeOf(ShimDOMException, Error);\n Object.setPrototypeOf(ShimDOMException.prototype, Error.prototype);\n setPrototypeOfCustomEvent();\n }\n if (IDB.indexedDB && !IDB.indexedDB.toString().includes('[native code]')) {\n if (CFG.addNonIDBGlobals) {\n // As `DOMStringList` exists per IDL (and Chrome) in the global\n // thread (but not in workers), we prefix the name to avoid\n // shadowing or conflicts\n setNonIDBGlobals('Shim');\n }\n if (CFG.replaceNonIDBGlobals) {\n setNonIDBGlobals();\n }\n }\n IDB.shimIndexedDB.__setConnectionQueueOrigin();\n }\n };\n\n IDB.shimIndexedDB.__debug = function (val) {\n CFG.DEBUG = val;\n };\n IDB.shimIndexedDB.__setConfig = setConfig;\n IDB.shimIndexedDB.__getConfig = function (prop) {\n if (!(prop in CFG)) {\n throw new Error(prop + ' is not a valid configuration property');\n }\n return CFG[prop];\n };\n IDB.shimIndexedDB.__setUnicodeIdentifiers = function ({UnicodeIDStart, UnicodeIDContinue}) {\n setConfig({UnicodeIDStart, UnicodeIDContinue});\n };\n } else {\n // We no-op the harmless set-up properties and methods with a warning; the `IDBFactory` methods,\n // however (including our non-standard methods), are not stubbed as they ought\n // to fail earlier rather than potentially having side effects.\n IDB.shimIndexedDB = {};\n ['__useShim', '__debug', '__setConfig', '__getConfig', '__setUnicodeIdentifiers'].forEach((prop) => {\n IDB.shimIndexedDB[prop] = function () {\n console.warn('This browser does not have WebSQL to shim.');\n };\n });\n }\n\n // Workaround to prevent an error in Firefox\n if (!('indexedDB' in IDB) && typeof window !== 'undefined') { // 2nd condition avoids problems in Node\n IDB.indexedDB = IDB.indexedDB || IDB.webkitIndexedDB || IDB.mozIndexedDB || IDB.oIndexedDB || IDB.msIndexedDB;\n }\n\n // Detect browsers with known IndexedDB issues (e.g. Android pre-4.4)\n let poorIndexedDbSupport = false;\n if (\n typeof navigator !== 'undefined' &&\n // Not apparently defined in React Native\n navigator.userAgent &&\n ( // Ignore Node or other environments\n (\n // Bad non-Chrome Android support\n (/Android (?:2|3|4\\.[0-3])/u).test(navigator.userAgent) &&\n !navigator.userAgent.includes('Chrome')\n ) ||\n (\n // Bad non-Safari iOS9 support (see )\n (!navigator.userAgent.includes('Safari') || navigator.userAgent.includes('Chrome')) && // Exclude genuine Safari: http://stackoverflow.com/a/7768006/271577\n // Detect iOS: http://stackoverflow.com/questions/9038625/detect-if-device-is-ios/9039885#9039885\n // and detect version 9: http://stackoverflow.com/a/26363560/271577\n (/(iPad|iPhone|iPod).* os 9_/ui).test(navigator.userAgent) &&\n !window.MSStream // But avoid IE11\n )\n )\n ) {\n poorIndexedDbSupport = true;\n }\n if (!CFG.DEFAULT_DB_SIZE) {\n CFG.DEFAULT_DB_SIZE = (\n ( // Safari currently requires larger size: (We don't need a larger size for Node as node-websql doesn't use this info)\n // https://github.com/axemclion/IndexedDBShim/issues/41\n // https://github.com/axemclion/IndexedDBShim/issues/115\n typeof navigator !== 'undefined' &&\n // React Native\n navigator.userAgent &&\n navigator.userAgent.includes('Safari') &&\n !navigator.userAgent.includes('Chrome')\n )\n ? 25\n : 4\n ) * 1024 * 1024;\n }\n if (!CFG.avoidAutoShim &&\n (!IDB.indexedDB || poorIndexedDbSupport) &&\n CFG.win.openDatabase !== undefined\n ) {\n IDB.shimIndexedDB.__useShim();\n } else {\n IDB.IDBDatabase = IDB.IDBDatabase || IDB.webkitIDBDatabase;\n IDB.IDBTransaction = IDB.IDBTransaction || IDB.webkitIDBTransaction || {};\n IDB.IDBCursor = IDB.IDBCursor || IDB.webkitIDBCursor;\n IDB.IDBKeyRange = IDB.IDBKeyRange || IDB.webkitIDBKeyRange;\n }\n return IDB;\n}\n\n// Expose for ease in simulating such exceptions during testing\nexport {createDOMException};\n\nexport default setGlobalVars;\n","/* eslint-env browser, worker */\nimport {UnicodeIDStart, UnicodeIDContinue} from './UnicodeIdentifiers.js';\n\n// BEGIN: Same code as in browser.js\nimport setGlobalVars from './setGlobalVars.js';\nimport CFG from './CFG.js';\n\nCFG.win = typeof window !== 'undefined' ? window : self; // For Web Workers\n// END: Same code as in browser.js\n\nCFG.UnicodeIDStart = UnicodeIDStart;\nCFG.UnicodeIDContinue = UnicodeIDContinue;\n\nexport default setGlobalVars;\n","// ID_Start (includes Other_ID_Start)\nconst UnicodeIDStart =\n '(?:[$A-Z_a-z\\\\xAA\\\\xB5\\\\xBA\\\\xC0-\\\\xD6\\\\xD8-\\\\xF6\\\\xF8-\\\\u02C1\\\\u02C6-\\\\u02D1\\\\u02E0-\\\\u02E4\\\\u02EC\\\\u02EE\\\\u0370-\\\\u0374\\\\u0376\\\\u0377\\\\u037A-\\\\u037D\\\\u037F\\\\u0386\\\\u0388-\\\\u038A\\\\u038C\\\\u038E-\\\\u03A1\\\\u03A3-\\\\u03F5\\\\u03F7-\\\\u0481\\\\u048A-\\\\u052F\\\\u0531-\\\\u0556\\\\u0559\\\\u0561-\\\\u0587\\\\u05D0-\\\\u05EA\\\\u05F0-\\\\u05F2\\\\u0620-\\\\u064A\\\\u066E\\\\u066F\\\\u0671-\\\\u06D3\\\\u06D5\\\\u06E5\\\\u06E6\\\\u06EE\\\\u06EF\\\\u06FA-\\\\u06FC\\\\u06FF\\\\u0710\\\\u0712-\\\\u072F\\\\u074D-\\\\u07A5\\\\u07B1\\\\u07CA-\\\\u07EA\\\\u07F4\\\\u07F5\\\\u07FA\\\\u0800-\\\\u0815\\\\u081A\\\\u0824\\\\u0828\\\\u0840-\\\\u0858\\\\u08A0-\\\\u08B4\\\\u08B6-\\\\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\\u1310\\\\u1312-\\\\u1315\\\\u1318-\\\\u135A\\\\u1380-\\\\u138F\\\\u13A0-\\\\u13F5\\\\u13F8-\\\\u13FD\\\\u1401-\\\\u166C\\\\u166F-\\\\u167F\\\\u1681-\\\\u169A\\\\u16A0-\\\\u16EA\\\\u16EE-\\\\u16F8\\\\u1700-\\\\u170C\\\\u170E-\\\\u1711\\\\u1720-\\\\u1731\\\\u1740-\\\\u1751\\\\u1760-\\\\u176C\\\\u176E-\\\\u1770\\\\u1780-\\\\u17B3\\\\u17D7\\\\u17DC\\\\u1820-\\\\u1877\\\\u1880-\\\\u18A8\\\\u18AA\\\\u18B0-\\\\u18F5\\\\u1900-\\\\u191E\\\\u1950-\\\\u196D\\\\u1970-\\\\u1974\\\\u1980-\\\\u19AB\\\\u19B0-\\\\u19C9\\\\u1A00-\\\\u1A16\\\\u1A20-\\\\u1A54\\\\u1AA7\\\\u1B05-\\\\u1B33\\\\u1B45-\\\\u1B4B\\\\u1B83-\\\\u1BA0\\\\u1BAE\\\\u1BAF\\\\u1BBA-\\\\u1BE5\\\\u1C00-\\\\u1C23\\\\u1C4D-\\\\u1C4F\\\\u1C5A-\\\\u1C7D\\\\u1C80-\\\\u1C88\\\\u1CE9-\\\\u1CEC\\\\u1CEE-\\\\u1CF1\\\\u1CF5\\\\u1CF6\\\\u1D00-\\\\u1DBF\\\\u1E00-\\\\u1F15\\\\u1F18-\\\\u1F1D\\\\u1F20-\\\\u1F45\\\\u1F48-\\\\u1F4D\\\\u1F50-\\\\u1F57\\\\u1F59\\\\u1F5B\\\\u1F5D\\\\u1F5F-\\\\u1F7D\\\\u1F80-\\\\u1FB4\\\\u1FB6-\\\\u1FBC\\\\u1FBE\\\\u1FC2-\\\\u1FC4\\\\u1FC6-\\\\u1FCC\\\\u1FD0-\\\\u1FD3\\\\u1FD6-\\\\u1FDB\\\\u1FE0-\\\\u1FEC\\\\u1FF2-\\\\u1FF4\\\\u1FF6-\\\\u1FFC\\\\u2071\\\\u207F\\\\u2090-\\\\u209C\\\\u2102\\\\u2107\\\\u210A-\\\\u2113\\\\u2115\\\\u2118-\\\\u211D\\\\u2124\\\\u2126\\\\u2128\\\\u212A-\\\\u2139\\\\u213C-\\\\u213F\\\\u2145-\\\\u2149\\\\u214E\\\\u2160-\\\\u2188\\\\u2C00-\\\\u2C2E\\\\u2C30-\\\\u2C5E\\\\u2C60-\\\\u2CE4\\\\u2CEB-\\\\u2CEE\\\\u2CF2\\\\u2CF3\\\\u2D00-\\\\u2D25\\\\u2D27\\\\u2D2D\\\\u2D30-\\\\u2D67\\\\u2D6F\\\\u2D80-\\\\u2D96\\\\u2DA0-\\\\u2DA6\\\\u2DA8-\\\\u2DAE\\\\u2DB0-\\\\u2DB6\\\\u2DB8-\\\\u2DBE\\\\u2DC0-\\\\u2DC6\\\\u2DC8-\\\\u2DCE\\\\u2DD0-\\\\u2DD6\\\\u2DD8-\\\\u2DDE\\\\u3005-\\\\u3007\\\\u3021-\\\\u3029\\\\u3031-\\\\u3035\\\\u3038-\\\\u303C\\\\u3041-\\\\u3096\\\\u309B-\\\\u309F\\\\u30A1-\\\\u30FA\\\\u30FC-\\\\u30FF\\\\u3105-\\\\u312D\\\\u3131-\\\\u318E\\\\u31A0-\\\\u31BA\\\\u31F0-\\\\u31FF\\\\u3400-\\\\u4DB5\\\\u4E00-\\\\u9FD5\\\\uA000-\\\\uA48C\\\\uA4D0-\\\\uA4FD\\\\uA500-\\\\uA60C\\\\uA610-\\\\uA61F\\\\uA62A\\\\uA62B\\\\uA640-\\\\uA66E\\\\uA67F-\\\\uA69D\\\\uA6A0-\\\\uA6EF\\\\uA717-\\\\uA71F\\\\uA722-\\\\uA788\\\\uA78B-\\\\uA7AE\\\\uA7B0-\\\\uA7B7\\\\uA7F7-\\\\uA801\\\\uA803-\\\\uA805\\\\uA807-\\\\uA80A\\\\uA80C-\\\\uA822\\\\uA840-\\\\uA873\\\\uA882-\\\\uA8B3\\\\uA8F2-\\\\uA8F7\\\\uA8FB\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E5D\\\\uDE5F\\\\uDE61\\\\uDE62\\\\uDE64\\\\uDE67-\\\\uDE6A\\\\uDE6C-\\\\uDE72\\\\uDE74-\\\\uDE77\\\\uDE79-\\\\uDE7C\\\\uDE7E\\\\uDE80-\\\\uDE89\\\\uDE8B-\\\\uDE9B\\\\uDEA1-\\\\uDEA3\\\\uDEA5-\\\\uDEA9\\\\uDEAB-\\\\uDEBB]|\\\\uD869[\\\\uDC00-\\\\uDED6\\\\uDF00-\\\\uDFFF]|\\\\uD86D[\\\\uDC00-\\\\uDF34\\\\uDF40-\\\\uDFFF]|\\\\uD86E[\\\\uDC00-\\\\uDC1D\\\\uDC20-\\\\uDFFF]|\\\\uD873[\\\\uDC00-\\\\uDEA1]|\\\\uD87E[\\\\uDC00-\\\\uDE1D])';\n\n// ID_Continue (includes Other_ID_Continue)\nconst UnicodeIDContinue =\n '(?:[$0-9A-Z_a-z\\\\xAA\\\\xB5\\\\xB7\\\\xBA\\\\xC0-\\\\xD6\\\\xD8-\\\\xF6\\\\xF8-\\\\u02C1\\\\u02C6-\\\\u02D1\\\\u02E0-\\\\u02E4\\\\u02EC\\\\u02EE\\\\u0300-\\\\u0374\\\\u0376\\\\u0377\\\\u037A-\\\\u037D\\\\u037F\\\\u0386-\\\\u038A\\\\u038C\\\\u038E-\\\\u03A1\\\\u03A3-\\\\u03F5\\\\u03F7-\\\\u0481\\\\u0483-\\\\u0487\\\\u048A-\\\\u052F\\\\u0531-\\\\u0556\\\\u0559\\\\u0561-\\\\u0587\\\\u0591-\\\\u05BD\\\\u05BF\\\\u05C1\\\\u05C2\\\\u05C4\\\\u05C5\\\\u05C7\\\\u05D0-\\\\u05EA\\\\u05F0-\\\\u05F2\\\\u0610-\\\\u061A\\\\u0620-\\\\u0669\\\\u066E-\\\\u06D3\\\\u06D5-\\\\u06DC\\\\u06DF-\\\\u06E8\\\\u06EA-\\\\u06FC\\\\u06FF\\\\u0710-\\\\u074A\\\\u074D-\\\\u07B1\\\\u07C0-\\\\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\\u0DB3-\\\\u0DBB\\\\u0DBD\\\\u0DC0-\\\\u0DC6\\\\u0DCA\\\\u0DCF-\\\\u0DD4\\\\u0DD6\\\\u0DD8-\\\\u0DDF\\\\u0DE6-\\\\u0DEF\\\\u0DF2\\\\u0DF3\\\\u0E01-\\\\u0E3A\\\\u0E40-\\\\u0E4E\\\\u0E50-\\\\u0E59\\\\u0E81\\\\u0E82\\\\u0E84\\\\u0E87\\\\u0E88\\\\u0E8A\\\\u0E8D\\\\u0E94-\\\\u0E97\\\\u0E99-\\\\u0E9F\\\\u0EA1-\\\\u0EA3\\\\u0EA5\\\\u0EA7\\\\u0EAA\\\\u0EAB\\\\u0EAD-\\\\u0EB9\\\\u0EBB-\\\\u0EBD\\\\u0EC0-\\\\u0EC4\\\\u0EC6\\\\u0EC8-\\\\u0ECD\\\\u0ED0-\\\\u0ED9\\\\u0EDC-\\\\u0EDF\\\\u0F00\\\\u0F18\\\\u0F19\\\\u0F20-\\\\u0F29\\\\u0F35\\\\u0F37\\\\u0F39\\\\u0F3E-\\\\u0F47\\\\u0F49-\\\\u0F6C\\\\u0F71-\\\\u0F84\\\\u0F86-\\\\u0F97\\\\u0F99-\\\\u0FBC\\\\u0FC6\\\\u1000-\\\\u1049\\\\u1050-\\\\u109D\\\\u10A0-\\\\u10C5\\\\u10C7\\\\u10CD\\\\u10D0-\\\\u10FA\\\\u10FC-\\\\u1248\\\\u124A-\\\\u124D\\\\u1250-\\\\u1256\\\\u1258\\\\u125A-\\\\u125D\\\\u1260-\\\\u1288\\\\u128A-\\\\u128D\\\\u1290-\\\\u12B0\\\\u12B2-\\\\u12B5\\\\u12B8-\\\\u12BE\\\\u12C0\\\\u12C2-\\\\u12C5\\\\u12C8-\\\\u12D6\\\\u12D8-\\\\u1310\\\\u1312-\\\\u1315\\\\u1318-\\\\u135A\\\\u135D-\\\\u135F\\\\u1369-\\\\u1371\\\\u1380-\\\\u138F\\\\u13A0-\\\\u13F5\\\\u13F8-\\\\u13FD\\\\u1401-\\\\u166C\\\\u166F-\\\\u167F\\\\u1681-\\\\u169A\\\\u16A0-\\\\u16EA\\\\u16EE-\\\\u16F8\\\\u1700-\\\\u170C\\\\u170E-\\\\u1714\\\\u1720-\\\\u1734\\\\u1740-\\\\u1753\\\\u1760-\\\\u176C\\\\u176E-\\\\u1770\\\\u1772\\\\u1773\\\\u1780-\\\\u17D3\\\\u17D7\\\\u17DC\\\\u17DD\\\\u17E0-\\\\u17E9\\\\u180B-\\\\u180D\\\\u1810-\\\\u1819\\\\u1820-\\\\u1877\\\\u1880-\\\\u18AA\\\\u18B0-\\\\u18F5\\\\u1900-\\\\u191E\\\\u1920-\\\\u192B\\\\u1930-\\\\u193B\\\\u1946-\\\\u196D\\\\u1970-\\\\u1974\\\\u1980-\\\\u19AB\\\\u19B0-\\\\u19C9\\\\u19D0-\\\\u19DA\\\\u1A00-\\\\u1A1B\\\\u1A20-\\\\u1A5E\\\\u1A60-\\\\u1A7C\\\\u1A7F-\\\\u1A89\\\\u1A90-\\\\u1A99\\\\u1AA7\\\\u1AB0-\\\\u1ABD\\\\u1B00-\\\\u1B4B\\\\u1B50-\\\\u1B59\\\\u1B6B-\\\\u1B73\\\\u1B80-\\\\u1BF3\\\\u1C00-\\\\u1C37\\\\u1C40-\\\\u1C49\\\\u1C4D-\\\\u1C7D\\\\u1C80-\\\\u1C88\\\\u1CD0-\\\\u1CD2\\\\u1CD4-\\\\u1CF6\\\\u1CF8\\\\u1CF9\\\\u1D00-\\\\u1DF5\\\\u1DFB-\\\\u1F15\\\\u1F18-\\\\u1F1D\\\\u1F20-\\\\u1F45\\\\u1F48-\\\\u1F4D\\\\u1F50-\\\\u1F57\\\\u1F59\\\\u1F5B\\\\u1F5D\\\\u1F5F-\\\\u1F7D\\\\u1F80-\\\\u1FB4\\\\u1FB6-\\\\u1FBC\\\\u1FBE\\\\u1FC2-\\\\u1FC4\\\\u1FC6-\\\\u1FCC\\\\u1FD0-\\\\u1FD3\\\\u1FD6-\\\\u1FDB\\\\u1FE0-\\\\u1FEC\\\\u1FF2-\\\\u1FF4\\\\u1FF6-\\\\u1FFC\\\\u200C\\\\u200D\\\\u203F\\\\u2040\\\\u2054\\\\u2071\\\\u207F\\\\u2090-\\\\u209C\\\\u20D0-\\\\u20DC\\\\u20E1\\\\u20E5-\\\\u20F0\\\\u2102\\\\u2107\\\\u210A-\\\\u2113\\\\u2115\\\\u2118-\\\\u211D\\\\u2124\\\\u2126\\\\u2128\\\\u212A-\\\\u2139\\\\u213C-\\\\u213F\\\\u2145-\\\\u2149\\\\u214E\\\\u2160-\\\\u2188\\\\u2C00-\\\\u2C2E\\\\u2C30-\\\\u2C5E\\\\u2C60-\\\\u2CE4\\\\u2CEB-\\\\u2CF3\\\\u2D00-\\\\u2D25\\\\u2D27\\\\u2D2D\\\\u2D30-\\\\u2D67\\\\u2D6F\\\\u2D7F-\\\\u2D96\\\\u2DA0-\\\\u2DA6\\\\u2DA8-\\\\u2DAE\\\\u2DB0-\\\\u2DB6\\\\u2DB8-\\\\u2DBE\\\\u2DC0-\\\\u2DC6\\\\u2DC8-\\\\u2DCE\\\\u2DD0-\\\\u2DD6\\\\u2DD8-\\\\u2DDE\\\\u2DE0-\\\\u2DFF\\\\u3005-\\\\u3007\\\\u3021-\\\\u302F\\\\u3031-\\\\u3035\\\\u3038-\\\\u303C\\\\u3041-\\\\u3096\\\\u3099-\\\\u309F\\\\u30A1-\\\\u30FA\\\\u30FC-\\\\u30FF\\\\u3105-\\\\u312D\\\\u3131-\\\\u318E\\\\u31A0-\\\\u31BA\\\\u31F0-\\\\u31FF\\\\u3400-\\\\u4DB5\\\\u4E00-\\\\u9FD5\\\\uA000-\\\\uA48C\\\\uA4D0-\\\\uA4FD\\\\uA500-\\\\uA60C\\\\uA610-\\\\uA62B\\\\uA640-\\\\uA66F\\\\uA674-\\\\uA67D\\\\uA67F-\\\\uA6F1\\\\uA717-\\\\uA71F\\\\uA722-\\\\uA788\\\\uA78B-\\\\uA7AE\\\\uA7B0-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uDE5F\\\\uDE61\\\\uDE62\\\\uDE64\\\\uDE67-\\\\uDE6A\\\\uDE6C-\\\\uDE72\\\\uDE74-\\\\uDE77\\\\uDE79-\\\\uDE7C\\\\uDE7E\\\\uDE80-\\\\uDE89\\\\uDE8B-\\\\uDE9B\\\\uDEA1-\\\\uDEA3\\\\uDEA5-\\\\uDEA9\\\\uDEAB-\\\\uDEBB]|\\\\uD869[\\\\uDC00-\\\\uDED6\\\\uDF00-\\\\uDFFF]|\\\\uD86D[\\\\uDC00-\\\\uDF34\\\\uDF40-\\\\uDFFF]|\\\\uD86E[\\\\uDC00-\\\\uDC1D\\\\uDC20-\\\\uDFFF]|\\\\uD873[\\\\uDC00-\\\\uDEA1]|\\\\uD87E[\\\\uDC00-\\\\uDE1D]|\\\\uDB40[\\\\uDD00-\\\\uDDEF])';\n\nexport {UnicodeIDStart, UnicodeIDContinue};\n"],"names":["global","self","window","_typeof","obj","Symbol","iterator","constructor","prototype","phases","ShimDOMException","DOMException","msg","name","err","Error","ev","WeakMap","evCfg","ShimEvent","type","toStringTag","toString","_arguments","Array","slice","call","arguments","evInit","_ev","length","TypeError","_evCfg","composed","set","this","initEvent","bubbles","cancelable","Object","defineProperties","reduce","prop","get","undefined","props","push","includes","preventDefault","_passive","defaultPrevented","stopImmediatePropagation","_stopImmediatePropagation","stopPropagation","_stopPropagation","_dispatched","forEach","defineProperty","enumerable","configurable","i","writable","value","ShimCustomEvent","_arguments2","initCustomEvent","detail","getListenersOptions","listeners","options","listenersByType","capture","stringifiedOptions","JSON","stringify","listenersByTypeOptions","filter","methods","addListener","listener","listenerOptions","some","l","removeListener","splice","hasListener","EventTarget","assign","listenerType","method","handleEvent","bind","console","log","arrStr","toLowerCase","__setOptions","customOptions","_defaultSync","defaultSync","_extraProperties","extraProperties","legacyOutputDidListenersThrowFlag","_legacyOutputDidListenersThrowCheck","dispatchEvent","e","_dispatchEvent","setTarget","_this","eventCopy","copyEvent","finishEventDispatch","eventPhase","currentTarget","_children","invokeDefaults","target","invokeCurrentListeners","_defaultListeners","continueEventDispatch","setTimeout","_lateListeners","_earlyListeners","__getParent","par","root","_listeners","child","pop","parent","checkOnListeners","_this2","concat","dummyIPos","listenerObj","onListener","tryCatch","once","passive","removeEventListener","evt","cb","triggerErrorEvent","triggerGlobalErrorEvent","error","useNodeImpl","ErrorEvent","errEv","message","filename","fileName","lineno","lineNumber","colno","columnNumber","__legacyOutputDidListenersThrowError","ShimEventTarget","EventTargetFactory","createInstance","map","CFG","val","test","validator","isArray","regex","escapeUnmatchedSurrogates","arg","replace","_","unmatchedHighSurrogate","precedingLow","unmatchedLowSurrogate","padStart","charCodeAt","escapeNameForSQLiteIdentifier","escapeSQLiteStatement","unescapeSQLiteResponse","esc","lowSurr","String","fromCharCode","Number","parseInt","highSurr","unescapeUnmatchedSurrogates","sqlEscape","sqlQuote","escapeDatabaseNameForSQLAndFiles","db","escapeDatabaseName","escapeNFDForDatabaseNames","RegExp","expandsOnNFD","source","expandable","codePointAt","databaseCharacterEscapeList","n0","databaseNameLengthLimit","addSQLiteExtension","escapeStoreNameForSQL","store","escapeIndexNameForSQL","index","escapeIndexNameForSQLKeyColumn","sqlLIKEEscape","str","instanceOf","Clss","hasInstance","isObj","isIterable","defineOuterInterface","o","desc","getOwnPropertyDescriptor","defineReadonlyOuterInterface","defineListenerProperties","defineReadonlyProperties","getter","isIdentifier","item","UnicodeIDStart","UnicodeIDContinue","isValidKeyPathString","keyPathString","split","every","pathComponent","isValidKeyPath","keyPath","enforceRange","number","max","min","Math","floor","isFinite","convertToDOMString","v","treatNullAs","ToString","convertToSequenceDOMString","_toConsumableArray","isNullish","ct","fill","join","createEvent","debug","util","IDBVersionChangeEvent","__eventInitDict","createNativeDOMException","create","codes","IndexSizeError","HierarchyRequestError","WrongDocumentError","InvalidCharacterError","NoModificationAllowedError","NotFoundError","NotSupportedError","InUseAttributeError","InvalidStateError","SyntaxError","InvalidModificationError","NamespaceError","InvalidAccessError","TypeMismatchError","SecurityError","NetworkError","AbortError","URLMismatchError","QuotaExceededError","TimeoutError","InvalidNodeTypeError","DataCloneError","EncodingError","NotReadableError","UnknownError","ConstraintError","DataError","TransactionInactiveError","ReadOnlyError","VersionError","OperationError","NotAllowedError","legacyCodes","INDEX_SIZE_ERR","DOMSTRING_SIZE_ERR","HIERARCHY_REQUEST_ERR","WRONG_DOCUMENT_ERR","INVALID_CHARACTER_ERR","NO_DATA_ALLOWED_ERR","NO_MODIFICATION_ALLOWED_ERR","NOT_FOUND_ERR","NOT_SUPPORTED_ERR","INUSE_ATTRIBUTE_ERR","INVALID_STATE_ERR","SYNTAX_ERR","INVALID_MODIFICATION_ERR","NAMESPACE_ERR","INVALID_ACCESS_ERR","VALIDATION_ERR","TYPE_MISMATCH_ERR","SECURITY_ERR","NETWORK_ERR","ABORT_ERR","URL_MISMATCH_ERR","QUOTA_EXCEEDED_ERR","TIMEOUT_ERR","INVALID_NODE_TYPE_ERR","DATA_CLONE_ERR","ShimNonNativeDOMException","_code","_name","_message","DummyDOMException","keys","codeName","createNonNativeDOMExceptionClass","logError","DEBUG","trace","isErrorOrDOMErrorOrDOMException","findError","args","webSQLErrback","webSQLErr","code","createDOMException","sqlError","useNativeDOMException","createNonNativeDOMException","readonlyProperties","doneFlagGetters","IDBRequest","__super","__done","readyState","__result","__error","__source","__transaction","__createInstance","openListeners","IDBOpenDBRequest","IDBOpenDBRequestAlias","isPromise","p","then","addReject","prom","reject","SyncPromise","fn","transist","state","s","c","reason","resolve","prot","errBack","rej","settle","all","promises","newPromises","res","race","resolved","cmp","first","second","encodedKey1","keyEncode","encodedKey2","result","decodedKey1","keyDecode","decodedKey2","warn","keyTypeToEncodedChar","invalid","date","string","binary","array","keyTypes","k","encodedCharToKeyType","signValues","types","encode","key","decode","sign","exponent","mantissa","key32","MIN_VALUE","repeat","abs","decimalIndex","indexOf","significantDigitIndex","search","padBase32Exponent","flipBase32","padBase32Mantissa","zeros","Infinity","pow32","negate","inArray","encoded","entries","encodedItem","decoded","parse","decodedItem","toJSON","Date","byteLength","getCopyBytesHeldByBufferSource","b","arr","buffer","ArrayBuffer","Uint8Array","n","flipped","ch","roundToPrecision","whole","fraction","expansion","num","precision","parseFloat","toPrecision","getKeyType","getDate","getFloat64","keyType","convertValueToKey","input","seen","convertValueToKeyValueDecoded","O","offset","isView","byteOffset","multiEntry","fullKeys","ret","isNaN","len","hasOwnProperty","getTime","convertValueToMultiEntryKeyDecoded","convertValueToKeyRethrowingAndIfInvalid","extractKeyValueDecodedFromValueUsingKeyPath","r","evaluateKeyPathOnValueToDecodedValue","failure","idntfr","size","lastModified","injectKeyIntoValueUsingKeyPath","identifiers","last","identifier","checkKeyCouldBeInjectedIntoValue","isKeyInRange","range","checkCached","lowerMatch","lower","upperMatch","upper","encodedKey","__lowerCached","__upperCached","lowerOpen","upperOpen","isMultiEntryMatch","encodedEntry","findMultiEntryMatches","keyEntry","matches","roundTrip","getCurrentNumber","tx","func","sqlFailCb","executeSql","__currentName","data","rows","currNum","assignCurrentNumber","successCb","failCb","sql","sqlValues","setCurrentNumber","generateKeyForStore","possiblyUpdateKeyGenerator","cn","convertKeyToValue","entry","IDBKeyRange","IDBKeyRangeAlias","setSQLForKeyRange","quotedKeyColumnName","addAnd","encodedLowerKey","encodedUpperKey","hasLower","hasUpper","Key","convertValueToKeyRange","nullDisallowed","only","lowerConverted","upperConverted","__lower","__upper","__lowerOpen","Boolean","__upperOpen","lowerBound","upperBound","bound","cleanInterface","testObject","DOMStringList","contains","_items","isInteger","clone","stringList","_length","addIndexes","sortList","sort","thisArg","DOMStringListAlias","nonenumerableReadonly","nonenumerableWritable","uniqueID","IDBTransaction","IDBTransactionAlias","storeNames","mode","me","__id","__active","__running","__errored","__requests","__objectStoreNames","__mode","__db","readonlyProp","__storeHandles","__executeRequests","__transFinishedCb","__tx","q","success","req","__requestsFinished","__abortTransaction","executeNextRequest","addLateEventListener","addDefaultEventListener","complete","__completed","__internal","__transactionFinished","__transactionEndCallback","requestsFinished","op","currentTask","done","rollback","commit","readOnly","__createRequest","request","__addToTransactionQueue","callback","__pushToQueue","__addNonRequestToTransactionQueue","__assertActive","__assertWritable","__assertVersionChange","objectStore","objectStoreName","__assertNotFinished","__objectStores","__pendingDelete","__deleted","IDBObjectStore","__clone","abort","errOrResult","lastIndexOf","reqEvt","__abortFinished","__version","__oldVersion","__oldObjectStoreNames","values","__pendingName","__name","__originalName","__indexNames","__oldIndexNames","__indexes","__indexHandles","__assertNotVersionChange","__assertNotFinishedObjectStoreMethod","module","_typeof2","asyncGeneratorStep","gen","_next","_throw","info","Promise","_asyncToGenerator","apply","_classCallCheck","instance","Constructor","_defineProperties","descriptor","_defineProperty","ownKeys","object","enumerableOnly","getOwnPropertySymbols","symbols","sym","_objectSpread2","getOwnPropertyDescriptors","_slicedToArray","_arrayWithHoles","_arr","_n","_d","_e","_s","_i","next","_iterableToArrayLimit","_nonIterableRest","arr2","_arrayWithoutHoles","iter","from","_iterableToArray","_nonIterableSpread","TypesonPromise","f","__typeson__type__","onFulfilled","onRejected","typesonResolve","typesonReject","meth","promArr","toStr","hasOwn","getProto","getPrototypeOf","fnToString","isThenable","catchCheck","isObject","hasConstructorOf","a","proto","Ctor","isPlainObject","escapeKeyPathComponent","keyPathComponent","unescapeKeyPathComponent","getByKeyPath","period","innerObj","setAtKeyPath","hasOwn$1","internalStateObjPropsToIgnore","nestedPathsFirst","keypath","as","match","bs","Typeson","plainObjectReplacers","nonplainObjectReplacers","revivers","protoProps","staticProps","replacer","space","opts","stringification","encapsulated","encapsulate","throwOnBadSyncType","sync","text","reviver","revive","stateObj","returnTypeNames","iterateNone","that","refObjs","refKeys","promisesDataRoot","cyclic","encapsulateObserver","_encapsulate","finish","typeNames","getJSONType","Set","$types","$","checkPromises","_x","_x2","_checkPromises","regeneratorRuntime","mark","_callee2","promisesData","promResults","wrap","_context2","prev","pd","sent","_ref","_callee","promResult","newPromisesData","_promisesData$splice","_promisesData$splice2","prData","_prData","parentObj","detectedType","encaps","isTypesonPromise","encaps2","_context","abrupt","stop","_x3","_adaptBuiltinStateObjectProperties","ownKeysObj","vals","tmp","resolvingTypesonPromise","observerData","$typeof","runObserver","awaitingTypesonPromise","replaced","iterateIn","iterateUnsetNumeric","refIndex","cyclicKeypath","isPlainObj","isArr","addLength","_loop","kp","endIterateIn","end","endIterateOwn","vl","_loop2","endIterateUnsetNumeric","plainObject","replacers","existing","replaceAsync","replacing","typeDetected","keyPathResolutions","ignore$Types","executeReviver","reviveAsync","revivalPromises","checkUndefined","retrn","Undefined","possibleTypesonPromise","plainObjectTypes","_ref4","_ref5","plain","reducer","_ref8","newVal","revivePlainObjects","_revive","_clone","_keyPathResolutions$","_target","_clone2","_ret","typ","_ref9","typeSpecSets","R","typeSpec","typSpec","typeId","JSON_TYPES","spec","testPlainObjects","existingReplacer","Class","x","_spec2","replacerObj","start","fallback","reviverObj","isUserObject","factory","chars","lookup","arraybuffer","lngth","bytes","base64","encoded1","encoded2","encoded3","encoded4","bufferLength","_i2","buffers","b64","bigintObject","BigInt","bigint","string2arraybuffer","blob","XMLHttpRequest","overrideMimeType","open","URL","createObjectURL","send","status","stringContents","responseText","Blob","reader","FileReader","addEventListener","readAsBinaryString","generateUUID","d","performance","now","random","cloneableObjectsByUUID","cloneable","clonable","uuid","dataview","b64Obj","DataView","dt","time","NaN","_global","errors","errName","Cnstrctr","file","File","filelist","fl","_files","imagebitmap","dataset","bm","canvas","document","createElement","getContext","drawImage","toDataURL","ctx","img","src","createImageBitmap","imagedata","width","height","ImageData","Uint8ClampedArray","infinity","intlTypes","IntlCollator","Intl","Collator","resolvedOptions","locale","IntlDateTimeFormat","DateTimeFormat","dtf","IntlNumberFormat","NumberFormat","nf","mp","Map","nan","negativeInfinity","nonbuiltinIgnore","rexp","primitiveObjects","StringObject","BooleanObject","NumberObject","regexp","flags","ignoreCase","multiline","sticky","unicode","resurrectableObjectsByUUID","resurrectable","rsrrctble","serializedResurrectable","st","typedArraysSocketIO","typeName","arrType","TypedArray","buf","typedArrays","undef","userObject","arrayNonindexKeys","sparseUndefined","specialNumbers","NegativeInfinity","expObj","postmessage","socketio","builtin","sparseArrays","structuredCloning","checkDataCloneException","stringTag","nodeType","insertBefore","undf","universal","typedArraysSocketio","presets","structuredCloningThrowing","undefPreset","typeson","register","stringifySync","ReferenceError","IDBIndex","IDBIndexAlias","executeFetchIndexData","count","unboundedDisallowed","hasKey","opType","multiChecks","isCount","records","recordCount","record","Sca","escapedIndexNameForKeyCol","row","rowKey","check","buildFetchIndexDataSQL","hasRange","innerKey","indexProperties","__objectStore","columnName","__keyPath","optionalParams","__multiEntry","__unique","unique","__cursors","cursors","newName","oldName","transaction","__invalidStateIfDeleted","indexNames","storeHandle","oldIndexHandle","colInfoToPreserveArr","autoIncrement","indexName","__renameIndex","__updateIndexList","__pendingCreate","idx","__createIndex","storeName","indexHandle","columnExists","__recreated","indexValues","applyIndex","addIndexEntry","indexKey","escapedStoreNameSQL","escapedIndexNameSQL","useSQLiteIndexes","__deleteIndex","finishDeleteIndex","indexList","deleted","__fetchIndexData","fetchArgs","openCursor","query","direction","cursor","IDBCursorWithValue","__request","openKeyCursor","IDBCursor","getKey","getAll","getAllKeys","newNameType","escapedNewIndexNameSQL","escapedTmpStoreNameSQL","colNamesToPreserve","colInfo","colInfoToPreserve","listColInfoToPreserve","listColsToPreserve","indexCreations","escapedIndexToRecreate","IDBObjectStoreAlias","normalizeArray","parts","allowAboveRoot","up","unshift","storeProperties","__idbdb","idbdb","__autoIncrement","autoInc","oldStore","objectStoreNames","oldHandle","newStore","__createObjectStore","__versionTransaction","storeHandles","insertStoreInfo","encodedKeyPath","__deleteObjectStore","__validateKeyAndValueAndCloneValue","cursorUpdate","clonedValue","__deriveKey","keyCloneThenSuccess","oldCn","__insertData","clonedKeyOrCurrentNumber","paramMap","indexPromises","multiCheck","setIndexInfo","sqlStart","sqlEnd","insertSqlValues","stmt","insertSql","fail","add","ky","__storingRecordObjectStore","put","__overwrite","rowsAffected","invalidateCache","noOverwrite","insert","__invalidateCache","__get","sqlArr","clear","createIndex","optionalParameters","deleteIndex","splitPathRe","splitPath","exec","resolvedPath","resolvedAbsolute","path","charAt","normalize","isPathAbsolute","isAbsolute","trailingSlash","substr","extname","basename","ext","dirname","dir","sep","delimiter","relative","to","trim","fromParts","toParts","samePartsLength","outputParts","paths","xs","IDBDatabase","fs","IDBDatabaseAlias","oldVersion","version","__closePending","__upgradeTransaction","__transactions","itemCopy","createObjectStore","createOptions","throwIfUpgradeTransactionNull","deleteObjectStore","close","__unblocking","trans","__forceClose","on__abort","getOrigin","location","origin","hasNullOrigin","checkOrigin","connectionQueue","processNextInConnectionQueue","queueItems","removeFromQueue","shift","addRequestToConnectionQueue","triggerAnyVersionChangeAndBlockedEvents","openConnections","newVersion","connectionIsClosed","connection","connectionsClosed","conn","unblocking","sysdb","websqlDBCache","nameCounter","getLatestCachedWebSQLVersion","curr","cleanupDatabaseResources","__openDatabase","escapedDatabaseName","databaseDeleted","dbError","memoryDatabase","latestSQLiteDBCached","getLatestCachedWebSQLDB","sqliteDB","_db","deleteDatabaseFiles","unlink","databaseBasePath","DEFAULT_DB_SIZE","tables","deleteTables","createSysDB","sysDbCreateError","sysDatabaseBasePath","systx","IDBFactory","IDBFactoryAlias","__connections","calledDbCreateError","autoName","sqlSafeName","useMemoryDatabase","useDatabaseCache","cacheDatabaseInstances","dbCreateError","setupDatabase","finishRequest","sysdbFinishedCb","er","reportError","versionSet","finished","on__beforecomplete","on__preabort","on__complete","openDB","setup","createIndexes","latestCachedVersion","readTransaction","sysReadTx","deleteDatabase","calledDBError","sysdbFinishedCbDelete","completeDatabaseDelete","key1","key2","databases","dbGetDatabaseNamesError","dbNames","dbName","connIdx","forceClose","__setConnectionQueueOrigin","shimIndexedDB","IDBCursorAlias","keyColumnName","valueColumnName","__indexSource","__key","__primaryKey","__store","__range","__keyColumnName","__valueColumnName","__keyOnly","__valueDecoder","__count","__prefetchedIndex","__multiEntryIndex","__sqlDirection","__gotValue","__find","__findMultiEntry","__findBasic","primaryKey","recordsToLoad","continueCall","quotedKey","__prefetchedData","__decode","leftBracketRegex","rowItem","matchingKey","reverse","__onsuccess","__value","__matchedKeys","encKey","encVal","encPrimaryKey","__sourceOrEffectiveObjStoreDeleted","__continue","advanceContinue","advanceState","__advanceCount","cmpResult","__continueFinish","recordsToPreloadOnContinue","cursorPreloadPackSize","cursorContinue","triggerSuccess","primKey","continuePrimaryKey","noErrors","encObjectStorePos","advance","update","valueToUpdate","addToQueue","evaluatedKey","IDBCursorWithValueAlias","setConfig","win","idb","initialConfig","IDB","shim","propDesc","openDatabase","__useShim","setNonIDBGlobals","prefix","_fs","shimIDBFactory","shimNS","shimIDBDatabase","shimIDBObjectStore","shimIDBIndex","shimIDBTransaction","shimIDBCursor","shimIDBCursorWithValue","shimIDBKeyRange","shimIDBRequest","shimIDBOpenDBRequest","shimIDBVersionChangeEvent","fullIDLSupport","setPrototypeOf","indexedDB","addNonIDBGlobals","replaceNonIDBGlobals","__debug","__setConfig","__getConfig","__setUnicodeIdentifiers","webkitIndexedDB","mozIndexedDB","oIndexedDB","msIndexedDB","poorIndexedDbSupport","navigator","userAgent","MSStream","avoidAutoShim","webkitIDBDatabase","webkitIDBTransaction","webkitIDBCursor","webkitIDBKeyRange"],"mappings":";smIAAkC,IAAXA,EAAyBA,EAC9B,oBAATC,KAAuBA,KACZ,oBAAXC,OAAyBA,OAAS,UCFT,IAAXF,EAAyBA,EACpB,oBAATC,KAAuBA,KACZ,oBAAXC,OAAyBA,OAAS,GCFrD,SAASC,EAAQC,UAIbD,EADoB,mBAAXE,QAAoD,iBAApBA,OAAOC,SACtC,SAAUF,iBACJA,GAGN,SAAUA,UACXA,GAAyB,mBAAXC,QAAyBD,EAAIG,cAAgBF,QAAUD,IAAQC,OAAOG,UAAY,gBAAkBJ,IAI9GA,GAKjB,IAAIK,EACI,EADJA,EAEe,EAFfA,EAGS,EAHTA,EAIc,EAEdC,EAA2C,oBAAjBC,aAE5B,SAAsBC,EAAKC,OAEvBC,EAAM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