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K,WAKD,OAJKR,KAAKqI,mBACNrI,KAAKqI,iBAAmB,IAAI,IAC5BrI,KAAKE,WAAWwB,KAAK1B,KAAKqI,mBAEvBrI,KAAKqI,gBAChB,EACA3H,YAAY,EACZC,cAAc,IAclBwH,EAAiB/H,UAAUkI,SAAW,SAAUC,EAAWC,GAEnDxI,KAAKqI,kBACDrI,KAAKyI,OAAOC,UAAUH,KAClBC,GACAA,EAAKtB,KAAOqB,EACZC,EAAK7G,OAAS6G,EAAK7G,QAAU3B,KAC7BA,KAAKyI,OAAOH,SAASC,EAAW,CAC5BrB,KAAMqB,EACN5G,OAAQ3B,QAIZA,KAAKyI,OAAOH,SAASC,EAAW,CAC5BrB,KAAMqB,EACN5G,OAAQ3B,OAK5B,EAQAmI,EAAiB/H,UAAUuI,oBAAsB,SAAUJ,EAAWC,GAE9DxI,KAAKqI,kBACDrI,KAAKyI,OAAOC,UAAUH,KAClBC,GACAA,EAAKtB,KAAOqB,EACZC,EAAK7G,OAAS6G,EAAK7G,QAAU3B,KAC7BA,KAAKyI,OAAOE,oBAAoBJ,EAAWC,IAG3CxI,KAAKyI,OAAOE,oBAAoBJ,EAAW,CACvCrB,KAAMqB,EACN5G,OAAQ3B,OAK5B,EAMAmI,EAAiB/H,UAAUsD,SAAW,SAAUkF,GAC5CR,EAAOhI,UAAUsD,SAASqB,KAAK/E,KAAM4I,GACjCA,EAAOP,kBACPrI,KAAKyI,OAAO/E,SAASkF,EAAOP,iBAEpC,EACOF,CACX,CA9FqC,CA8FnCpI,E","sources":["webpack://rokk3rfuel/./node_modules/@amcharts/amcharts4/.internal/core/Base.js"],"sourcesContent":["/**\r\n * Base functionality\r\n*/\r\nimport { __extends } from \"tslib\";\r\nimport { List, ListTemplate } from \"./utils/List\";\r\nimport { OrderedListTemplate, SortedListTemplate } from \"./utils/SortedList\";\r\nimport { Dictionary, DictionaryTemplate } from \"./utils/Dictionary\";\r\nimport { Disposer } from \"./utils/Disposer\";\r\nimport { EventDispatcher } from \"./utils/EventDispatcher\";\r\nimport { Adapter } from \"./utils/Adapter\";\r\nimport { Color, color } from \"./utils/Color\";\r\nimport { Percent, percent } from \"./utils/Percent\";\r\nimport { registry } from \"./Registry\";\r\nimport { cache } from \"./utils/Cache\";\r\nimport * as $array from \"./utils/Array\";\r\nimport * as $object from \"./utils/Object\";\r\nimport * as $type from \"./utils/Type\";\r\n//import * as $debug from \"./utils/Debug\";\r\n/**\r\n * Provides base functionality for all derivative objects, like generating ids,\r\n * handling cache, etc.\r\n */\r\nvar BaseObject = /** @class */ (function () {\r\n //protected _classes: { [index: string]: any } = {};\r\n /**\r\n * Constructor\r\n * * Sets class name\r\n */\r\n function BaseObject() {\r\n /**\r\n * Indicates if this object has already been deleted. Any\r\n * destruction/disposal code should take this into account when deciding\r\n * wheter to run potentially costly disposal operations if they already have\r\n * been run.\r\n */\r\n this._disposed = false;\r\n /**\r\n * List of IDisposer which will be disposed when the BaseObject is disposed.\r\n */\r\n this._disposers = [];\r\n this.className = \"BaseObject\";\r\n //this.debug();\r\n }\r\n BaseObject.prototype.debug = function () {\r\n //$debug.debug(this);\r\n };\r\n Object.defineProperty(BaseObject.prototype, \"uid\", {\r\n /**\r\n * Returns object's internal unique ID.\r\n *\r\n * @return Unique ID\r\n */\r\n get: function () {\r\n if (!this._uid) {\r\n this._uid = registry.getUniqueId();\r\n registry.map.setKey(this._uid, this);\r\n }\r\n return this._uid;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseObject.prototype, \"id\", {\r\n /**\r\n * @return Id\r\n */\r\n get: function () {\r\n return this._id;\r\n },\r\n /**\r\n * Sets the user-defined id of the element.\r\n *\r\n * @param value Id\r\n */\r\n set: function (value) {\r\n //registry.map.setKey(value, this); // registry.map only stores by uid\r\n this._id = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseObject.prototype, \"map\", {\r\n /**\r\n * Returns a universal collection for mapping ids with objects.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Map collection\r\n */\r\n get: function () {\r\n if (!this._map) {\r\n this._map = new Dictionary();\r\n }\r\n return this._map;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseObject.prototype, \"delayedMap\", {\r\n /**\r\n * Returns mapping for objects referenced by id in JSON config that are not yet\r\n * available at processing time.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Map collection\r\n */\r\n get: function () {\r\n if (!this._delayedMap) {\r\n this._delayedMap = new Dictionary();\r\n }\r\n return this._delayedMap;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Logs an id and property of the target element that is not yet available\r\n * for later assignment.\r\n *\r\n * @ignore\r\n * @param property Property to set\r\n * @param id ID of the target element\r\n */\r\n BaseObject.prototype.addDelayedMap = function (property, id) {\r\n var map = this.delayedMap;\r\n if (!map.hasKey(id)) {\r\n map.setKey(id, []);\r\n }\r\n var list = map.getKey(id);\r\n list.push({\r\n property: property,\r\n target: this\r\n });\r\n };\r\n /**\r\n * Processes delayed JSON config items.\r\n *\r\n * @ignore\r\n */\r\n BaseObject.prototype.processDelayedMap = function () {\r\n var _this = this;\r\n this.delayedMap.each(function (id, list) {\r\n if (_this.map.hasKey(id)) {\r\n var target_1 = _this.map.getKey(id);\r\n $array.each(list, function (item) {\r\n item.target[item.property] = target_1;\r\n });\r\n _this.delayedMap.removeKey(id);\r\n }\r\n });\r\n };\r\n /**\r\n * Applies properties from all assigned themes.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n BaseObject.prototype.applyTheme = function () {\r\n var _this = this;\r\n // TODO is this needed ?\r\n if (registry) {\r\n var themes = this.getCurrentThemes();\r\n // TODO is this needed ?\r\n if (themes) {\r\n $array.each(themes, function (theme, index) {\r\n theme(_this);\r\n });\r\n }\r\n }\r\n };\r\n Object.defineProperty(BaseObject.prototype, \"themes\", {\r\n /**\r\n * @ignore Exclude from docs\r\n * @return An array of themes\r\n */\r\n get: function () {\r\n return this._themes;\r\n },\r\n /**\r\n * A list of themes to be used for this element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param value An array of themes\r\n */\r\n set: function (value) {\r\n this._themes = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a list of themes that should be applied to this element. It could\r\n * either be a list of themes set explicitly on this element, or system-wide.\r\n *\r\n * @return List of themes\r\n */\r\n BaseObject.prototype.getCurrentThemes = function () {\r\n return this.themes || registry.themes;\r\n };\r\n /**\r\n * Returns if this object has been already been disposed.\r\n *\r\n * @return Is disposed?\r\n */\r\n BaseObject.prototype.isDisposed = function () {\r\n return this._disposed;\r\n };\r\n /**\r\n * Destroys this object and all related data.\r\n */\r\n BaseObject.prototype.dispose = function () {\r\n if (!this._disposed) {\r\n this._disposed = true;\r\n var a = this._disposers;\r\n this._disposers = null;\r\n while (a.length !== 0) {\r\n var disposer = a.shift();\r\n disposer.dispose();\r\n }\r\n // Clear cache\r\n this.clearCache();\r\n // remove from clones list\r\n if (this.clonedFrom) {\r\n this.clonedFrom.clones.removeValue(this);\r\n }\r\n var uid = this._uid;\r\n if (uid != null) {\r\n registry.map.removeKey(uid);\r\n }\r\n }\r\n };\r\n /**\r\n * Adds an IDisposer, which will be disposed when this object is disposed.\r\n *\r\n * @param target Object to dispose\r\n * @ignore Exclude from docs\r\n */\r\n BaseObject.prototype.addDisposer = function (target) {\r\n this._disposers.push(target);\r\n };\r\n /**\r\n * Disposes disposable object and removes it from `_disposers`.\r\n *\r\n * @param target Object to dispose\r\n * @ignore Exclude from docs\r\n */\r\n BaseObject.prototype.removeDispose = function (target) {\r\n //if(target){\r\n if (!this._disposed) {\r\n var index = $array.indexOf(this._disposers, target);\r\n if (index > -1) {\r\n this._disposers.splice(index, 1);\r\n }\r\n }\r\n target.dispose();\r\n //}\r\n };\r\n /**\r\n * Makes a copy of this object and returns the clone. Try to avoid cloning complex objects like chart, create new instances if you need them.\r\n *\r\n * @param cloneId An id to use for clone (if not set a unique id will be generated)\r\n * @returns Clone\r\n */\r\n BaseObject.prototype.clone = function (cloneId) {\r\n if (!cloneId) {\r\n cloneId = \"clone-\" + registry.getUniqueId();\r\n }\r\n var newObject = new this.constructor();\r\n newObject.cloneId = cloneId;\r\n newObject.copyFrom(this);\r\n // add to clones list\r\n // this.clones.push(newObject); // moved this to copyFrom\r\n return newObject;\r\n };\r\n Object.defineProperty(BaseObject.prototype, \"clones\", {\r\n /**\r\n * Returns a collection of object's clones.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Clones\r\n */\r\n get: function () {\r\n if (!this._clones) {\r\n this._clones = new List();\r\n }\r\n return this._clones;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Copies all properties and related data from different element.\r\n *\r\n * @param object Source element\r\n */\r\n BaseObject.prototype.copyFrom = function (object) {\r\n object.clones.push(this); // do not moveValue, as it is expensive! even if there will be several items in clones list, it's not that bad.\r\n this.clonedFrom = object;\r\n };\r\n Object.defineProperty(BaseObject.prototype, \"className\", {\r\n /**\r\n * @ignore Exclude from docs\r\n * @return Class name\r\n */\r\n get: function () {\r\n return this._className;\r\n },\r\n /**\r\n * Element's class name. (a class that was used to instantiate the element)\r\n *\r\n * @ignore Exclude from docs\r\n * @param value Class name\r\n */\r\n set: function (value) {\r\n this._className = value;\r\n /*if (registry) {\r\n registry.registeredClasses[value] = typeof this;\r\n }*/\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Caches value in object's cache.\r\n *\r\n * @ignore Exclude from docs\r\n * @param key Key\r\n * @param value Value\r\n * @param ttl TTL in seconds\r\n */\r\n BaseObject.prototype.setCache = function (key, value, ttl) {\r\n cache.set(this.uid, key, value, ttl);\r\n };\r\n /**\r\n * Retrieves cached value.\r\n *\r\n * If optional second padarameter is specified, it will return that value\r\n * if cache is not available or is expired.\r\n *\r\n * @ignore Exclude from docs\r\n * @param key Key\r\n * @param value Value to return if cache is not available\r\n * @return Value\r\n */\r\n BaseObject.prototype.getCache = function (key, value) {\r\n if (value === void 0) { value = undefined; }\r\n return cache.get(this.uid, key, value);\r\n };\r\n /**\r\n * Clears object's local cache.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n BaseObject.prototype.clearCache = function () {\r\n cache.clear(this.uid);\r\n };\r\n /**\r\n * Creates [[Disposer]] for `setTimeout` function call. This ensures that all\r\n * timeouts created by the object will be cleared when object itself is\r\n * disposed.\r\n *\r\n * @ignore Exclude from docs\r\n * @param fn Callback function\r\n * @param delay Timeout (ms)\r\n * @return Disposer for timeout\r\n */\r\n BaseObject.prototype.setTimeout = function (fn, delay) {\r\n var _this = this;\r\n var id = setTimeout(function () {\r\n _this.removeDispose(disposer);\r\n fn();\r\n }, delay);\r\n var disposer = new Disposer(function () {\r\n clearTimeout(id);\r\n });\r\n this._disposers.push(disposer);\r\n return disposer;\r\n };\r\n /**\r\n * Creates [[Disposer]] for `setInterval` function call. This ensures that all\r\n * timeouts created by the object will be cleared when object itself is\r\n * disposed.\r\n *\r\n * @ignore Exclude from docs\r\n * @param fn Callback function\r\n * @param delay Timeout (ms)\r\n * @return Disposer for timeout\r\n */\r\n BaseObject.prototype.setInterval = function (fn, delay) {\r\n var _this = this;\r\n var id = setInterval(function () {\r\n _this.removeDispose(disposer);\r\n fn();\r\n }, delay);\r\n var disposer = new Disposer(function () {\r\n clearTimeout(id);\r\n });\r\n this._disposers.push(disposer);\r\n return disposer;\r\n };\r\n Object.defineProperty(BaseObject.prototype, \"config\", {\r\n /**\r\n * ==========================================================================\r\n * JSON-BASED CONFIG PROCESSING\r\n * ==========================================================================\r\n * @hidden\r\n */\r\n /**\r\n * Use this property to set JSON-based config. When set, triggers processing\r\n * routine, which will go through all properties, and try to apply values,\r\n * create instances, etc.\r\n *\r\n * Use this with caution, as it is a time-consuming process. It's used for\r\n * initialchart setup only, not routine operations.\r\n *\r\n * @param json JSON config\r\n */\r\n set: function (config) {\r\n try {\r\n this.processConfig(config);\r\n }\r\n catch (e) {\r\n /*if (this instanceof Sprite) {\r\n this.raiseCriticalError(e);\r\n }*/\r\n this.raiseCriticalError(e);\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Processes the JSON config.\r\n *\r\n * @param json JSON config\r\n * @ignore Exclude from docs\r\n */\r\n BaseObject.prototype.processConfig = function (config) {\r\n var _this = this;\r\n if (!config) {\r\n return;\r\n }\r\n // Get target\r\n var target = this;\r\n // Iterate through all of the items\r\n $object.eachOrdered(config, function (configKey, value) {\r\n var configValue = value;\r\n // Is this a callback?\r\n if (configKey == \"callback\" && typeof value == \"function\") {\r\n value.call(target);\r\n }\r\n // Check if there's a property in target\r\n if (_this.hasProperty(configKey)) {\r\n var item_1;\r\n // Do we have instructions to create an object?\r\n // We create a new object if \"type\" key is set, but only if the\r\n // target object is of different type.\r\n if ($type.isObject(configValue)\r\n && $type.hasValue(configValue[\"type\"])\r\n && (!$type.isObject(target[configKey])\r\n || !$type.hasValue(target[configKey].className)\r\n || configValue[\"forceCreate\"]\r\n || target[configKey].className != configValue[\"type\"])\r\n && !_this.asIs(configKey)) {\r\n item_1 = _this.createClassInstance(configValue[\"type\"]);\r\n // Create new instance\r\n if (item_1) {\r\n target[configKey] = item_1;\r\n }\r\n else {\r\n item_1 = target[configKey];\r\n }\r\n }\r\n else {\r\n // Get item from the object\r\n item_1 = target[configKey];\r\n }\r\n /**\r\n * It is...\r\n * --------------------------------------------------------------------\r\n */\r\n if (item_1 instanceof Adapter) {\r\n // ... an Adapter, try to add handlers to it\r\n // ------------------------------------------------------------------\r\n _this.processAdapters(item_1, configValue);\r\n }\r\n else if (item_1 instanceof EventDispatcher) {\r\n // ... an EventDispatcher, try to add handlers to it\r\n // ------------------------------------------------------------------\r\n _this.processEvents(item_1, configValue);\r\n }\r\n else if (configKey == \"locale\" && $type.isString(configValue)) {\r\n // ... a locale specified as string, e.g. \"fr_FR\"\r\n // ------------------------------------------------------------------\r\n if (window[\"am4lang_\" + configValue]) {\r\n target[configKey] = window[\"am4lang_\" + configValue];\r\n }\r\n }\r\n else if (configKey == \"parent\" && $type.isString(configValue)) {\r\n // ... a parent referred via its it\r\n // ------------------------------------------------------------------\r\n var parent_1 = _this.map.getKey(configValue);\r\n if (parent_1) {\r\n target[configKey] = parent_1;\r\n }\r\n else {\r\n _this.addDelayedMap(\"parent\", configValue);\r\n }\r\n }\r\n else if (_this.asIs(configKey)) {\r\n // ... a special field, just set it to new value\r\n // ------------------------------------------------------------------\r\n // (no need to add each indvidual item)\r\n target[configKey] = configValue;\r\n }\r\n else if (_this.asFunction(configKey) && $type.isString(configValue)) {\r\n // ... a field indicating function name to look for in registry\r\n // ------------------------------------------------------------------\r\n if ($type.hasValue(registry.registeredClasses[configValue])) {\r\n target[configKey] = registry.registeredClasses[configValue];\r\n }\r\n else {\r\n throw Error(\"Invalid easing function: \" + configValue);\r\n }\r\n }\r\n else if (configValue instanceof BaseObject) {\r\n // ... a BaseObject object, we just going to use it as it is\r\n // ------------------------------------------------------------------\r\n target[configKey] = configValue;\r\n }\r\n else if (item_1 instanceof BaseObject) {\r\n // ... another child BaseObject\r\n // ------------------------------------------------------------------\r\n // Let's just pass in config part in and let itself deal with it\r\n item_1.config = configValue;\r\n }\r\n else if (item_1 instanceof ListTemplate || item_1 instanceof OrderedListTemplate || item_1 instanceof SortedListTemplate) {\r\n // ... a list with template\r\n // ------------------------------------------------------------------\r\n // Let's see what we can do with it\r\n if ($type.isArray(configValue)) {\r\n // It's an array.\r\n // Create a list item for entry, or try to apply properties to an\r\n // existing entry if possible and it is present.\r\n if (item_1 instanceof ListTemplate) {\r\n _this.processListTemplate(configValue, item_1);\r\n }\r\n else {\r\n _this.processOrderedTemplate(configValue, item_1);\r\n }\r\n }\r\n else if ($type.isObject(configValue)) {\r\n // It's a single oject.\r\n // Treat it as a template.\r\n if (configValue instanceof BaseObject) {\r\n // Item is already a BaseObject, no need to process it further\r\n item_1.template = configValue;\r\n }\r\n else {\r\n // Now let's find out if the whole object if a template, or we\r\n // need to get it from `template` key\r\n var templateValue = void 0;\r\n if ($type.hasValue(configValue.template)) {\r\n templateValue = configValue.template;\r\n }\r\n else {\r\n templateValue = configValue;\r\n }\r\n if (item_1.template instanceof BaseObject) {\r\n // Template is a BaseObject so we will just let its config\r\n // deal with the configuration\r\n item_1.template.config = templateValue;\r\n }\r\n else {\r\n $object.each(templateValue, function (entryKey, entryValue) {\r\n var listItem = item_1.template[entryKey];\r\n if (listItem instanceof Adapter) {\r\n _this.processAdapters(listItem, entryValue);\r\n }\r\n else if (listItem instanceof EventDispatcher) {\r\n _this.processEvents(listItem, entryValue);\r\n }\r\n else if (listItem instanceof DictionaryTemplate) {\r\n _this.processDictionaryTemplate(listItem, entryValue);\r\n }\r\n else if (item_1.template[entryKey] instanceof BaseObject) {\r\n // Template is a BaseObject. Let it deal with its own config.\r\n item_1.template[entryKey].config = entryValue;\r\n }\r\n else if ($type.isObject(entryValue) && $type.hasValue(entryValue[\"type\"])) {\r\n listItem = _this.createClassInstance(entryValue[\"type\"]);\r\n if (listItem) {\r\n if (listItem instanceof BaseObject) {\r\n listItem.config = entryValue;\r\n }\r\n item_1.template[entryKey] = listItem;\r\n }\r\n else {\r\n item_1.template[entryKey] = entryValue;\r\n }\r\n }\r\n else if (listItem instanceof List) {\r\n // It's List, process it\r\n _this.processList(entryValue, listItem);\r\n }\r\n else {\r\n // Aything else. Just assing and be done with it.\r\n item_1.template[entryKey] = _this.maybeColorOrPercent(entryValue);\r\n }\r\n });\r\n }\r\n // Check maybe there are `values` to insert\r\n if ($type.hasValue(configValue.values)) {\r\n if (item_1 instanceof ListTemplate) {\r\n _this.processListTemplate(configValue.values, item_1);\r\n }\r\n else {\r\n _this.processOrderedTemplate(configValue.values, item_1);\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n // Something else?\r\n // Not sure what to do with it on a list - ignore\r\n }\r\n }\r\n else if (item_1 instanceof List) {\r\n // ... a list\r\n // ------------------------------------------------------------------\r\n if (configKey == \"children\") {\r\n _this.processList(configValue, item_1, _this);\r\n }\r\n else {\r\n _this.processList(configValue, item_1);\r\n }\r\n }\r\n else if (item_1 instanceof DictionaryTemplate) {\r\n // ... a dictionary with template\r\n // ------------------------------------------------------------------\r\n _this.processDictionaryTemplate(item_1, configValue);\r\n }\r\n else if (item_1 instanceof Dictionary) {\r\n // ... a dictionary\r\n // ------------------------------------------------------------------\r\n _this.processDictionary(item_1, configValue);\r\n }\r\n else if (item_1 instanceof Color || item_1 instanceof Percent) {\r\n // ... it's a Color or Percent\r\n // ------------------------------------------------------------------\r\n target[configKey] = _this.maybeColorOrPercent(configValue);\r\n }\r\n else if ($type.isObject(item_1) && $type.isObject(configValue)) {\r\n // ... a regular object\r\n // ------------------------------------------------------------------\r\n $object.copyAllProperties(configValue, item_1);\r\n }\r\n else {\r\n // ... something else - probably a simple property or object\r\n // ------------------------------------------------------------------\r\n // Maybe convert to `Percent` or `Color`?\r\n configValue = _this.maybeColorOrPercent(configValue);\r\n // Assign\r\n target[configKey] = configValue;\r\n }\r\n }\r\n else if (!_this.isReserved(configKey)) {\r\n // Doesn't have property set. But we're going to assume JSON config\r\n // creator knows what he/she is doing and set it anyway.\r\n target[configKey] = configValue;\r\n }\r\n }, this.configOrder);\r\n // Any errors?\r\n if (this.processingErrors.length) {\r\n var errors = this.processingErrors.join(\"\\n\");\r\n this._processingErrors = [];\r\n throw Error(errors);\r\n }\r\n };\r\n /**\r\n * Tries to detect if value is color or percent and converts to proper object\r\n * if necessary.\r\n *\r\n * Returns the same source value if no color/percent detected\r\n *\r\n * @param value Source value\r\n * @return Converted value\r\n */\r\n BaseObject.prototype.maybeColorOrPercent = function (value) {\r\n if ($type.isString(value)) {\r\n if (value.match(/^[\\-]?[0-9.]+\\%$/)) {\r\n return percent($type.toNumber(value));\r\n }\r\n else if (value.match(/^\\#[0-9abcdef]{3,}$/i)) {\r\n return color(value);\r\n }\r\n }\r\n return value;\r\n };\r\n BaseObject.prototype.processAdapters = function (item, config) {\r\n var _this = this;\r\n if ($type.isArray(config)) {\r\n $array.each(config, function (entry, index) {\r\n item.add(entry.key, entry.callback, entry.priority || 0, _this);\r\n });\r\n }\r\n else if ($type.isObject(config)) {\r\n $object.each(config, function (key, entry) {\r\n if (!item.has(key, entry)) {\r\n item.add(key, entry);\r\n }\r\n });\r\n }\r\n };\r\n BaseObject.prototype.processEvents = function (item, config) {\r\n var _this = this;\r\n if ($type.isArray(config)) {\r\n $array.each(config, function (entry, index) {\r\n item.on(entry.type, entry.callback, _this);\r\n });\r\n }\r\n else if ($type.isObject(config)) {\r\n $object.each(config, function (key, entry) {\r\n if (!item.has(key, entry)) {\r\n item.on(key, entry);\r\n }\r\n });\r\n }\r\n };\r\n /**\r\n * Processes JSON config for a [[DictionaryTemplate]] item.\r\n *\r\n * @todo Description\r\n * @param item Item\r\n * @param config Config\r\n */\r\n BaseObject.prototype.processDictionaryTemplate = function (item, config) {\r\n // We can only process object\r\n // Not sure what to do with other types - ignore\r\n if ($type.isObject(config)) {\r\n // Create an entry for each item, or override properties for\r\n // existing one.\r\n $object.each(config, function (entryKey, entryValue) {\r\n var listItem;\r\n // Get existing one, or create a new one\r\n if (entryKey == \"template\") {\r\n listItem = item.template;\r\n }\r\n else if (item.hasKey(entryKey)) {\r\n listItem = item.getKey(entryKey);\r\n }\r\n else {\r\n listItem = item.create(entryKey);\r\n }\r\n // Set data\r\n if (listItem instanceof BaseObject) {\r\n listItem.config = entryValue;\r\n }\r\n else if ($type.isObject(listItem) && $type.isObject(entryValue)) {\r\n $object.copyAllProperties(entryValue, listItem);\r\n }\r\n else {\r\n listItem.setKey(entryKey, entryValue);\r\n }\r\n });\r\n }\r\n };\r\n /**\r\n * Processes JSON config for a [[Dictionary]] item.\r\n *\r\n * @todo Description\r\n * @param item Item\r\n * @param config Config\r\n */\r\n BaseObject.prototype.processDictionary = function (item, config) {\r\n // We can only process object\r\n // Not sure what to do with other types - ignore\r\n if ($type.isObject(config)) {\r\n // Create an entry for each item, or override properties for\r\n // existing one.\r\n // @todo support for non-basic types\r\n $object.each(config, function (entryKey, entryValue) {\r\n item.setKey(entryKey, entryValue);\r\n });\r\n }\r\n };\r\n /**\r\n * Processes [[ListTemplate]].\r\n *\r\n * @param configValue Config value\r\n * @param item Item\r\n */\r\n BaseObject.prototype.processListTemplate = function (configValue, item) {\r\n var _this = this;\r\n $array.each(configValue, function (entry, index) {\r\n var type = _this.getConfigEntryType(entry);\r\n var listItem;\r\n if (item.hasIndex(index) && !entry[\"forceCreate\"]) {\r\n listItem = item.getIndex(index);\r\n }\r\n else if (entry instanceof BaseObject) {\r\n // Item is already a BaseObject, no need to process it further\r\n item.push(entry);\r\n return;\r\n }\r\n else if (type) {\r\n listItem = item.create(type);\r\n }\r\n else {\r\n listItem = item.create();\r\n }\r\n if (entry === listItem) {\r\n // It's already the same item, do nothing\r\n }\r\n else {\r\n if ($type.isObject(entry)) {\r\n // If the list item is BaseObject, we just need to let it\r\n // deal if its own config\r\n if (listItem instanceof BaseObject) {\r\n listItem.config = entry;\r\n }\r\n else if ($type.isObject(listItem) && $type.isObject(entry)) {\r\n $object.copyAllProperties(entry, listItem);\r\n }\r\n else {\r\n item.setIndex(item.indexOf(listItem), entry);\r\n }\r\n }\r\n }\r\n });\r\n // Truncate the list if it contains less items than the config\r\n // array\r\n while (configValue.length > item.length) {\r\n item.pop();\r\n }\r\n };\r\n /**\r\n * Processes [[OrdererListTemplate]] or [[SortedListTemplate]].\r\n *\r\n * @param configValue Config value\r\n * @param item Item\r\n */\r\n BaseObject.prototype.processOrderedTemplate = function (configValue, item) {\r\n var _this = this;\r\n $array.each(configValue, function (entry, index) {\r\n var type = _this.getConfigEntryType(entry);\r\n var listItem;\r\n if (type) {\r\n listItem = item.create(type);\r\n }\r\n else {\r\n listItem = item.create();\r\n }\r\n if ($type.isObject(entry)) {\r\n // If the list item is BaseObject, we just need to let it\r\n // deal if its own config\r\n if (listItem instanceof BaseObject) {\r\n listItem.config = entry;\r\n }\r\n else if ($type.isObject(listItem) && $type.isObject(entry)) {\r\n $object.copyAllProperties(entry, listItem);\r\n }\r\n else {\r\n item.insert(entry);\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Processes [[List]].\r\n *\r\n * @param configValue Config value\r\n * @param item Item\r\n */\r\n BaseObject.prototype.processList = function (configValue, item, parent) {\r\n var _this = this;\r\n // Convert to array if necessary\r\n if (!$type.isArray(configValue)) {\r\n configValue = [configValue];\r\n }\r\n // It's an array\r\n // Create a list item for entry\r\n var itemCount = item.length;\r\n var extraCount = 0;\r\n $array.each(configValue, function (entry, index) {\r\n if ($type.isObject(entry)) {\r\n // An object.\r\n //\r\n // Let's see if we can instantiate a class out of it, or we need\r\n // to push it into list as it is.\r\n //\r\n // If there are items already at the specified index in the list,\r\n // apply properties rather than create a new one.\r\n var listItem = void 0;\r\n if ((index < itemCount) && !entry[\"forceCreate\"]) {\r\n listItem = item.getIndex(index);\r\n }\r\n else if (entry instanceof BaseObject) {\r\n // Item is already a BaseObject, no need to process it further\r\n item.push(entry);\r\n return;\r\n }\r\n else {\r\n extraCount++;\r\n listItem = _this.createEntryInstance(entry);\r\n if (parent) {\r\n listItem.parent = parent;\r\n }\r\n else {\r\n item.push(listItem);\r\n }\r\n }\r\n // If the list item is BaseObject, we just need to let it\r\n // deal if its own config\r\n if (listItem instanceof BaseObject) {\r\n listItem.config = entry;\r\n }\r\n else if ($type.isObject(listItem) && $type.isObject(entry)) {\r\n $object.copyAllProperties(entry, listItem);\r\n }\r\n }\r\n else {\r\n // Basic value.\r\n // Just push it into list, or override existing value\r\n if (item.hasIndex(index)) {\r\n item.setIndex(index, entry);\r\n }\r\n else {\r\n item.push(entry);\r\n }\r\n }\r\n });\r\n // Truncate the list if it contains less items than the config\r\n // array\r\n while (!parent && (configValue.length + extraCount) < item.length) {\r\n item.pop();\r\n }\r\n };\r\n /**\r\n * This function is used to sort element's JSON config properties, so that\r\n * some properties that absolutely need to be processed last, can be put at\r\n * the end.\r\n *\r\n * @ignore Exclude from docs\r\n * @param a Element 1\r\n * @param b Element 2\r\n * @return Sorting number\r\n */\r\n BaseObject.prototype.configOrder = function (a, b) {\r\n if (a == b) {\r\n return 0;\r\n }\r\n // Language must come first, so it's all set up when the rest of the\r\n // elements are being instantiated\r\n else if (a == \"language\") {\r\n return -1;\r\n }\r\n else if (b == \"language\") {\r\n return 1;\r\n }\r\n else {\r\n return 0;\r\n }\r\n };\r\n /**\r\n * Checks if field should be just assigned as is, without any checking when\r\n * processing JSON config.\r\n *\r\n * Extending functions can override this function to do their own checks.\r\n *\r\n * @param field Field name\r\n * @return Assign as is?\r\n */\r\n BaseObject.prototype.asIs = function (field) {\r\n return $array.indexOf([\"locale\"], field) != -1;\r\n };\r\n /**\r\n * Checks if field needs to be converted to function, if it is specified\r\n * as string.\r\n *\r\n * @param field Field name\r\n * @return Assign as function?\r\n */\r\n BaseObject.prototype.asFunction = function (field) {\r\n return false;\r\n };\r\n /**\r\n * Creates a relevant class instance if such class definition exists.\r\n *\r\n * @ignore Exclude from docs\r\n * @param className Class name\r\n * @return Instance\r\n */\r\n BaseObject.prototype.createClassInstance = function (className) {\r\n if ($type.hasValue(registry.registeredClasses[className])) {\r\n return new registry.registeredClasses[className]();\r\n }\r\n else {\r\n throw Error(\"Invalid type: \\\"\" + className + \"\\\".\");\r\n }\r\n };\r\n /**\r\n * Creates a class instance for a config entry using it's type. (as set in\r\n * `type` property)\r\n *\r\n * @ignore Exclude from docs\r\n * @param config Config part\r\n * @return Instance\r\n */\r\n BaseObject.prototype.createEntryInstance = function (config) {\r\n var res;\r\n if ($type.hasValue(config[\"type\"])) {\r\n res = this.createClassInstance(config[\"type\"]);\r\n }\r\n if (!res) {\r\n return config;\r\n }\r\n return res;\r\n };\r\n /**\r\n * Determines config object type.\r\n *\r\n * @ignore Exclude from docs\r\n * @param config Config part\r\n * @return Type\r\n */\r\n BaseObject.prototype.getConfigEntryType = function (config) {\r\n if ($type.hasValue(config[\"type\"])) {\r\n if ($type.hasValue(registry.registeredClasses[config[\"type\"]])) {\r\n return registry.registeredClasses[config[\"type\"]];\r\n }\r\n else {\r\n throw Error(\"Invalid type: \\\"\" + config[\"type\"] + \"\\\".\");\r\n }\r\n }\r\n return;\r\n };\r\n /**\r\n * Checks if this element has a property.\r\n *\r\n * @ignore Exclude from docs\r\n * @param prop Property name\r\n * @return Has property?\r\n */\r\n BaseObject.prototype.hasProperty = function (prop) {\r\n return prop in this ? true : false;\r\n };\r\n /**\r\n * Checkes whether JSON key is a reserved keyword.\r\n *\r\n * @param key Key\r\n * @return Reserved\r\n */\r\n BaseObject.prototype.isReserved = function (key) {\r\n return [\"type\", \"forceCreate\"].indexOf(key) !== -1;\r\n };\r\n Object.defineProperty(BaseObject.prototype, \"processingErrors\", {\r\n /**\r\n * A list of errors that happened during JSON processing.\r\n *\r\n * @return Errors\r\n */\r\n get: function () {\r\n if (!this._processingErrors) {\r\n this._processingErrors = [];\r\n }\r\n return this._processingErrors;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return BaseObject;\r\n}());\r\nexport { BaseObject };\r\n;\r\n/**\r\n * A version of [[BaseObject]] with events properties and methods.\r\n * Classes that use [[EventDispatcher]] should extend this instead of\r\n * [[BaseObject]] directly.\r\n */\r\nvar BaseObjectEvents = /** @class */ (function (_super) {\r\n __extends(BaseObjectEvents, _super);\r\n /**\r\n * Constructor\r\n */\r\n function BaseObjectEvents() {\r\n var _this = _super.call(this) || this;\r\n _this.className = \"BaseObjectEvents\";\r\n return _this;\r\n }\r\n Object.defineProperty(BaseObjectEvents.prototype, \"events\", {\r\n /**\r\n * An [[EventDispatcher]] instance\r\n */\r\n get: function () {\r\n if (!this._eventDispatcher) {\r\n this._eventDispatcher = new EventDispatcher();\r\n this._disposers.push(this._eventDispatcher);\r\n }\r\n return this._eventDispatcher;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n //public set events(value:EventDispatcher>){\r\n //\tthis._eventDispatcher = value;\r\n //}\r\n /**\r\n * Dispatches an event using own event dispatcher. Will automatically\r\n * populate event data object with event type and target (this element).\r\n * It also checks if there are any handlers registered for this sepecific\r\n * event.\r\n *\r\n * @param eventType Event type (name)\r\n * @param data Data to pass into event handler(s)\r\n */\r\n BaseObjectEvents.prototype.dispatch = function (eventType, data) {\r\n // @todo Implement proper type check\r\n if (this._eventDispatcher) {\r\n if (this.events.isEnabled(eventType)) {\r\n if (data) {\r\n data.type = eventType;\r\n data.target = data.target || this;\r\n this.events.dispatch(eventType, {\r\n type: eventType,\r\n target: this\r\n });\r\n }\r\n else {\r\n this.events.dispatch(eventType, {\r\n type: eventType,\r\n target: this\r\n });\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Works like `dispatch`, except event is triggered immediately, without\r\n * waiting for the next frame cycle.\r\n *\r\n * @param eventType Event type (name)\r\n * @param data Data to pass into event handler(s)\r\n */\r\n BaseObjectEvents.prototype.dispatchImmediately = function (eventType, data) {\r\n // @todo Implement proper type check\r\n if (this._eventDispatcher) {\r\n if (this.events.isEnabled(eventType)) {\r\n if (data) {\r\n data.type = eventType;\r\n data.target = data.target || this;\r\n this.events.dispatchImmediately(eventType, data);\r\n }\r\n else {\r\n this.events.dispatchImmediately(eventType, {\r\n type: eventType,\r\n target: this\r\n });\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Copies all parameters from another [[Sprite]].\r\n *\r\n * @param source Source object\r\n */\r\n BaseObjectEvents.prototype.copyFrom = function (source) {\r\n _super.prototype.copyFrom.call(this, source);\r\n if (source._eventDispatcher) {\r\n this.events.copyFrom(source._eventDispatcher);\r\n }\r\n };\r\n return BaseObjectEvents;\r\n}(BaseObject));\r\nexport { BaseObjectEvents };\r\n//# sourceMappingURL=Base.js.map"],"names":["BaseObject","this","_disposed","_disposers","className","prototype","debug","Object","defineProperty","get","_uid","enumerable","configurable","_id","set","value","_map","_delayedMap","addDelayedMap","property","id","map","delayedMap","hasKey","setKey","list","getKey","push","target","processDelayedMap","_this","each","target_1","item","removeKey","applyTheme","themes","getCurrentThemes","theme","index","_themes","isDisposed","dispose","a","length","disposer","shift","clearCache","clonedFrom","clones","removeValue","uid","addDisposer","removeDispose","splice","clone","cloneId","newObject","constructor","copyFrom","_clones","object","_className","setCache","key","ttl","getCache","undefined","setTimeout","fn","delay","clearTimeout","setInterval","config","processConfig","e","raiseCriticalError","configKey","item_1","configValue","call","hasProperty","asIs","createClassInstance","processAdapters","processEvents","window","parent_1","asFunction","Error","processListTemplate","processOrderedTemplate","template","templateValue","entryKey","entryValue","listItem","processDictionaryTemplate","processList","maybeColorOrPercent","values","processDictionary","isReserved","configOrder","processingErrors","errors","join","_processingErrors","match","entry","add","callback","priority","has","on","type","create","getConfigEntryType","hasIndex","getIndex","setIndex","indexOf","pop","insert","parent","itemCount","extraCount","createEntryInstance","b","field","res","prop","BaseObjectEvents","_super","_eventDispatcher","dispatch","eventType","data","events","isEnabled","dispatchImmediately","source"],"sourceRoot":""}