@microsoft/applicationinsights-properties-js 3.0.0-beta.2211-03 → 3.0.0-beta.2211-04

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Properties Plugin, 3.0.0-beta.2211-03
2
+ * Application Insights JavaScript SDK - Properties Plugin, 3.0.0-beta.2211-04
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -931,13 +931,14 @@
931
931
  var _DYN_INITIALIZE = "initialize";
932
932
  var _DYN_IDENTIFIER = "identifier";
933
933
  var _DYN_IS_INITIALIZED = "isInitialized";
934
+ var _DYN_GET_PLUGIN = "getPlugin";
934
935
  var _DYN_NAME$1 = "name";
935
936
  var _DYN_TIME = "time";
936
937
  var _DYN_PROCESS_NEXT = "processNext";
937
938
  var _DYN_GET_PROCESS_TEL_CONT0 = "getProcessTelContext";
938
939
  var _DYN_CALL = "call";
939
- var _DYN_GET_PLUGIN = "getPlugin";
940
940
  var _DYN_LOGGING_LEVEL_CONSOL4 = "loggingLevelConsole";
941
+ var _DYN_CREATE_NEW = "createNew";
941
942
  var _DYN_TEARDOWN = "teardown";
942
943
  var _DYN_MESSAGE_ID = "messageId";
943
944
  var _DYN_MESSAGE = "message";
@@ -947,8 +948,6 @@
947
948
  var _DYN_UPDATE$1 = "update";
948
949
  var _DYN_GET_NEXT = "getNext";
949
950
  var _DYN_SET_NEXT_PLUGIN = "setNextPlugin";
950
- var _DYN_CREATE_NEW = "createNew";
951
- var _DYN_CONFIG = "config";
952
951
  var _DYN_USER_AGENT = "userAgent";
953
952
  var _DYN_SPLIT = "split";
954
953
  var _DYN_NODE_TYPE = "nodeType";
@@ -1215,7 +1214,7 @@
1215
1214
  }
1216
1215
 
1217
1216
  var _objDefineProperty = ObjDefineProperty;
1218
- var version = "3.0.0-beta.2211-03";
1217
+ var version = "3.0.0-beta.2211-04";
1219
1218
  var instanceName = "." + newId(6);
1220
1219
  var _dataUid = 0;
1221
1220
  function _createAccessor(target, prop, value) {
@@ -1899,791 +1898,791 @@
1899
1898
  _getLogger(logger)[_DYN_LOG_INTERNAL_MESSAGE ](severity, message);
1900
1899
  }
1901
1900
 
1902
- var strExecutionContextKey = "ctx";
1903
- var strParentContextKey = "ParentContextKey";
1904
- var strChildrenContextKey = "ChildrenContextKey";
1905
- var PerfEvent = /** @class */ (function () {
1906
- function PerfEvent(name, payloadDetails, isAsync) {
1907
- var _self = this;
1908
- _self.start = utcNow();
1909
- _self[_DYN_NAME$1 ] = name;
1910
- _self[_DYN_IS_ASYNC ] = isAsync;
1911
- _self[_DYN_IS_CHILD_EVT ] = function () { return false; };
1912
- if (isFunction(payloadDetails)) {
1913
- var theDetails_1;
1914
- objDefineAccessors(_self, "payload", function () {
1915
- if (!theDetails_1 && isFunction(payloadDetails)) {
1916
- theDetails_1 = payloadDetails();
1917
- payloadDetails = null;
1918
- }
1919
- return theDetails_1;
1920
- });
1921
- }
1922
- _self[_DYN_GET_CTX ] = function (key) {
1923
- if (key) {
1924
- if (key === PerfEvent[strParentContextKey] || key === PerfEvent[strChildrenContextKey]) {
1925
- return _self[key];
1926
- }
1927
- return (_self[strExecutionContextKey] || {})[key];
1928
- }
1929
- return null;
1930
- };
1931
- _self[_DYN_SET_CTX ] = function (key, value) {
1932
- if (key) {
1933
- if (key === PerfEvent[strParentContextKey]) {
1934
- if (!_self[key]) {
1935
- _self[_DYN_IS_CHILD_EVT ] = function () { return true; };
1936
- }
1937
- _self[key] = value;
1938
- }
1939
- else if (key === PerfEvent[strChildrenContextKey]) {
1940
- _self[key] = value;
1941
- }
1942
- else {
1943
- var ctx = _self[strExecutionContextKey] = _self[strExecutionContextKey] || {};
1944
- ctx[key] = value;
1945
- }
1946
- }
1947
- };
1948
- _self[_DYN_COMPLETE ] = function () {
1949
- var childTime = 0;
1950
- var childEvts = _self[_DYN_GET_CTX ](PerfEvent[strChildrenContextKey]);
1951
- if (isArray(childEvts)) {
1952
- for (var lp = 0; lp < childEvts[_DYN_LENGTH$2 ]; lp++) {
1953
- var childEvt = childEvts[lp];
1954
- if (childEvt) {
1955
- childTime += childEvt[_DYN_TIME ];
1956
- }
1957
- }
1958
- }
1959
- _self[_DYN_TIME ] = utcNow() - _self.start;
1960
- _self.exTime = _self[_DYN_TIME ] - childTime;
1961
- _self[_DYN_COMPLETE ] = function () { };
1962
- };
1963
- }
1964
- PerfEvent.ParentContextKey = "parent";
1965
- PerfEvent.ChildrenContextKey = "childEvts";
1966
- return PerfEvent;
1967
- }());
1968
- var doPerfActiveKey = "CoreUtils.doPerf";
1969
- function doPerf(mgrSource, getSource, func, details, isAsync) {
1970
- if (mgrSource) {
1971
- var perfMgr = mgrSource;
1972
- if (perfMgr[STR_GET_PERF_MGR]) {
1973
- perfMgr = perfMgr[STR_GET_PERF_MGR]();
1974
- }
1975
- if (perfMgr) {
1976
- var perfEvt = void 0;
1977
- var currentActive = perfMgr[_DYN_GET_CTX ](doPerfActiveKey);
1978
- try {
1979
- perfEvt = perfMgr.create(getSource(), details, isAsync);
1980
- if (perfEvt) {
1981
- if (currentActive && perfEvt[_DYN_SET_CTX ]) {
1982
- perfEvt[_DYN_SET_CTX ](PerfEvent[strParentContextKey], currentActive);
1983
- if (currentActive[_DYN_GET_CTX ] && currentActive[_DYN_SET_CTX ]) {
1984
- var children = currentActive[_DYN_GET_CTX ](PerfEvent[strChildrenContextKey]);
1985
- if (!children) {
1986
- children = [];
1987
- currentActive[_DYN_SET_CTX ](PerfEvent[strChildrenContextKey], children);
1988
- }
1989
- children[_DYN_PUSH ](perfEvt);
1990
- }
1991
- }
1992
- perfMgr[_DYN_SET_CTX ](doPerfActiveKey, perfEvt);
1993
- return func(perfEvt);
1994
- }
1995
- }
1996
- catch (ex) {
1997
- if (perfEvt && perfEvt[_DYN_SET_CTX ]) {
1998
- perfEvt[_DYN_SET_CTX ]("exception", ex);
1999
- }
2000
- }
2001
- finally {
2002
- if (perfEvt) {
2003
- perfMgr.fire(perfEvt);
2004
- }
2005
- perfMgr[_DYN_SET_CTX ](doPerfActiveKey, currentActive);
2006
- }
2007
- }
1901
+ var _a$2, _b;
1902
+ var strToGMTString = "toGMTString";
1903
+ var strToUTCString = "toUTCString";
1904
+ var strCookie = "cookie";
1905
+ var strExpires = "expires";
1906
+ var strIsCookieUseDisabled = "isCookieUseDisabled";
1907
+ var strDisableCookiesUsage = "disableCookiesUsage";
1908
+ var strConfigCookieMgr = "_ckMgr";
1909
+ var _supportsCookies = null;
1910
+ var _allowUaSameSite = null;
1911
+ var _parsedCookieValue = null;
1912
+ var _doc = getDocument();
1913
+ var _cookieCache = {};
1914
+ var _globalCookieConfig = {};
1915
+ var defaultConfig = objDeepFreeze((_a$2 = {},
1916
+ _a$2[STR_DOMAIN] = { fb: "cookieDomain", dfVal: isNotNullOrUndefined },
1917
+ _a$2.path = { fb: "cookiePath", dfVal: isNotNullOrUndefined },
1918
+ _a$2.enabled = UNDEFINED_VALUE,
1919
+ _a$2));
1920
+ var rootDefaultConfig = (_b = {
1921
+ cookieCfg: {},
1922
+ cookieDomain: UNDEFINED_VALUE,
1923
+ cookiePath: UNDEFINED_VALUE
1924
+ },
1925
+ _b[strDisableCookiesUsage] = UNDEFINED_VALUE,
1926
+ _b);
1927
+ function _gblCookieMgr(config, logger) {
1928
+ var inst = createCookieMgr[strConfigCookieMgr] || _globalCookieConfig[strConfigCookieMgr];
1929
+ if (!inst) {
1930
+ inst = createCookieMgr[strConfigCookieMgr] = createCookieMgr(config, logger);
1931
+ _globalCookieConfig[strConfigCookieMgr] = inst;
2008
1932
  }
2009
- return func();
1933
+ return inst;
2010
1934
  }
2011
-
2012
- function generateW3CId() {
2013
- var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
2014
- var oct = STR_EMPTY, tmp;
2015
- for (var a = 0; a < 4; a++) {
2016
- tmp = random32();
2017
- oct +=
2018
- hexValues[tmp & 0xF] +
2019
- hexValues[tmp >> 4 & 0xF] +
2020
- hexValues[tmp >> 8 & 0xF] +
2021
- hexValues[tmp >> 12 & 0xF] +
2022
- hexValues[tmp >> 16 & 0xF] +
2023
- hexValues[tmp >> 20 & 0xF] +
2024
- hexValues[tmp >> 24 & 0xF] +
2025
- hexValues[tmp >> 28 & 0xF];
1935
+ function _isMgrEnabled(cookieMgr) {
1936
+ if (cookieMgr) {
1937
+ return cookieMgr.isEnabled();
2026
1938
  }
2027
- var clockSequenceHi = hexValues[8 + (random32() & 0x03) | 0];
2028
- return strSubstr(oct, 0, 8) + strSubstr(oct, 9, 4) + "4" + strSubstr(oct, 13, 3) + clockSequenceHi + strSubstr(oct, 16, 3) + strSubstr(oct, 19, 12);
1939
+ return true;
2029
1940
  }
2030
-
2031
- var INVALID_TRACE_ID = "00000000000000000000000000000000";
2032
- var INVALID_SPAN_ID = "0000000000000000";
2033
- function _isValid(value, len, invalidValue) {
2034
- if (value && value[_DYN_LENGTH$2 ] === len && value !== invalidValue) {
2035
- return !!value.match(/^[\da-f]*$/i);
1941
+ function _isIgnoredCookie(cookieMgrCfg, name) {
1942
+ if (name && cookieMgrCfg && isArray(cookieMgrCfg.ignoreCookies)) {
1943
+ return arrIndexOf(cookieMgrCfg.ignoreCookies, name) !== -1;
2036
1944
  }
2037
1945
  return false;
2038
1946
  }
2039
- function isValidTraceId(value) {
2040
- return _isValid(value, 32, INVALID_TRACE_ID);
2041
- }
2042
- function isValidSpanId(value) {
2043
- return _isValid(value, 16, INVALID_SPAN_ID);
2044
- }
2045
-
2046
- var pluginStateData = createElmNodeData("plugin");
2047
- function _getPluginState(plugin) {
2048
- return pluginStateData.get(plugin, "state", {}, true);
2049
- }
2050
-
2051
- var strTelemetryPluginChain = "TelemetryPluginChain";
2052
- var strHasRunFlags = "_hasRun";
2053
- var strGetTelCtx = "_getTelCtx";
2054
- var _chainId = 0;
2055
- function _getNextProxyStart(proxy, core, startAt) {
2056
- while (proxy) {
2057
- if (proxy[_DYN_GET_PLUGIN ]() === startAt) {
2058
- return proxy;
1947
+ function _isBlockedCookie(cookieMgrCfg, name) {
1948
+ if (name && cookieMgrCfg && isArray(cookieMgrCfg.blockedCookies)) {
1949
+ if (arrIndexOf(cookieMgrCfg.blockedCookies, name) !== -1) {
1950
+ return true;
2059
1951
  }
2060
- proxy = proxy[_DYN_GET_NEXT ]();
2061
1952
  }
2062
- return createTelemetryProxyChain([startAt], core[_DYN_CONFIG ] || {}, core);
1953
+ return _isIgnoredCookie(cookieMgrCfg, name);
2063
1954
  }
2064
- function _createInternalContext(telemetryChain, dynamicHandler, core, startAt) {
2065
- var _nextProxy = null;
2066
- var _onComplete = [];
2067
- if (!dynamicHandler) {
2068
- dynamicHandler = createDynamicConfig({}, null, core[_DYN_LOGGER ]);
2069
- }
2070
- if (startAt !== null) {
2071
- _nextProxy = startAt ? _getNextProxyStart(telemetryChain, core, startAt) : telemetryChain;
1955
+ function safeGetCookieMgr(core, config) {
1956
+ var cookieMgr;
1957
+ if (core) {
1958
+ cookieMgr = core.getCookieMgr();
2072
1959
  }
2073
- var context = {
2074
- _next: _moveNext,
2075
- ctx: {
2076
- core: function () {
2077
- return core;
2078
- },
2079
- diagLog: function () {
2080
- return safeGetLogger(core, dynamicHandler.cfg);
2081
- },
2082
- getCfg: function () {
2083
- return dynamicHandler.cfg;
2084
- },
2085
- getExtCfg: _resolveExtCfg,
2086
- getConfig: _getConfig,
2087
- hasNext: function () {
2088
- return !!_nextProxy;
2089
- },
2090
- getNext: function () {
2091
- return _nextProxy;
2092
- },
2093
- setNext: function (nextPlugin) {
2094
- _nextProxy = nextPlugin;
2095
- },
2096
- iterate: _iterateChain,
2097
- onComplete: _addOnComplete
2098
- }
2099
- };
2100
- function _addOnComplete(onComplete, that) {
2101
- var args = [];
2102
- for (var _i = 2; _i < arguments.length; _i++) {
2103
- args[_i - 2] = arguments[_i];
1960
+ else if (config) {
1961
+ var cookieCfg = config.cookieCfg;
1962
+ if (cookieCfg && cookieCfg[strConfigCookieMgr]) {
1963
+ cookieMgr = cookieCfg[strConfigCookieMgr];
2104
1964
  }
2105
- if (onComplete) {
2106
- _onComplete[_DYN_PUSH ]({
2107
- func: onComplete,
2108
- self: !isUndefined(that) ? that : context.ctx,
2109
- args: args
2110
- });
1965
+ else {
1966
+ cookieMgr = createCookieMgr(config);
2111
1967
  }
2112
1968
  }
2113
- function _moveNext() {
2114
- var nextProxy = _nextProxy;
2115
- _nextProxy = nextProxy ? nextProxy[_DYN_GET_NEXT ]() : null;
2116
- if (!nextProxy) {
2117
- var onComplete = _onComplete;
2118
- if (onComplete && onComplete[_DYN_LENGTH$2 ] > 0) {
2119
- arrForEach(onComplete, function (completeDetails) {
2120
- try {
2121
- completeDetails.func[_DYN_CALL ](completeDetails.self, completeDetails.args);
2122
- }
2123
- catch (e) {
2124
- _throwInternal(core[_DYN_LOGGER ], 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
2125
- }
2126
- });
2127
- _onComplete = [];
2128
- }
2129
- }
2130
- return nextProxy;
1969
+ if (!cookieMgr) {
1970
+ cookieMgr = _gblCookieMgr(config, (core || {})[_DYN_LOGGER ]);
2131
1971
  }
2132
- function _getExtCfg(identifier, createIfMissing) {
2133
- var idCfg = null;
2134
- var cfg = dynamicHandler.cfg;
2135
- if (cfg && identifier) {
2136
- var extCfg = cfg[STR_EXTENSION_CONFIG ];
2137
- if (!extCfg && createIfMissing) {
2138
- extCfg = {};
1972
+ return cookieMgr;
1973
+ }
1974
+ function createCookieMgr(rootConfig, logger) {
1975
+ var cookieMgrConfig;
1976
+ var _path;
1977
+ var _domain;
1978
+ var _enabled;
1979
+ var _getCookieFn;
1980
+ var _setCookieFn;
1981
+ var _delCookieFn;
1982
+ rootConfig = createDynamicConfig(rootConfig || _globalCookieConfig, null, logger).cfg;
1983
+ onConfigChange(rootConfig, function (details) {
1984
+ details[_DYN_SET_DF ](details.cfg, rootDefaultConfig);
1985
+ cookieMgrConfig = details[_DYN_SET_DF ](details.cfg.cookieCfg, defaultConfig);
1986
+ var isEnabled = cookieMgrConfig.enabled;
1987
+ if (isNullOrUndefined(isEnabled)) {
1988
+ var cookieEnabled = void 0;
1989
+ if (!isUndefined(rootConfig[strIsCookieUseDisabled])) {
1990
+ cookieEnabled = !rootConfig[strIsCookieUseDisabled];
2139
1991
  }
2140
- dynamicHandler.set(cfg, STR_EXTENSION_CONFIG, extCfg);
2141
- extCfg = cfg[STR_EXTENSION_CONFIG ];
2142
- if (extCfg) {
2143
- idCfg = extCfg[identifier];
2144
- if (!idCfg && createIfMissing) {
2145
- idCfg = {};
2146
- }
2147
- dynamicHandler.set(extCfg, identifier, idCfg);
2148
- idCfg = extCfg[identifier];
1992
+ if (!isUndefined(rootConfig[strDisableCookiesUsage])) {
1993
+ cookieEnabled = !rootConfig[strDisableCookiesUsage];
2149
1994
  }
1995
+ isEnabled = cookieEnabled;
2150
1996
  }
2151
- return idCfg;
2152
- }
2153
- function _resolveExtCfg(identifier, defaultValues) {
2154
- var newConfig = _getExtCfg(identifier, true);
2155
- if (defaultValues) {
2156
- objForEachKey(defaultValues, function (field, defaultValue) {
2157
- if (isNullOrUndefined(newConfig[field])) {
2158
- var cfgValue = dynamicHandler.cfg[field];
2159
- if (cfgValue || !isNullOrUndefined(cfgValue)) {
2160
- newConfig[field] = cfgValue;
1997
+ _path = cookieMgrConfig[STR_PATH ] || "/";
1998
+ _domain = cookieMgrConfig[STR_DOMAIN ];
1999
+ _enabled = isEnabled !== false;
2000
+ _getCookieFn = cookieMgrConfig.getCookie || _getCookieValue;
2001
+ _setCookieFn = cookieMgrConfig.setCookie || _setCookieValue;
2002
+ _delCookieFn = cookieMgrConfig.delCookie || _setCookieValue;
2003
+ }, logger);
2004
+ var cookieMgr = {
2005
+ isEnabled: function () {
2006
+ var enabled = _enabled && areCookiesSupported(logger);
2007
+ var gblManager = _globalCookieConfig[strConfigCookieMgr];
2008
+ if (enabled && gblManager && cookieMgr !== gblManager) {
2009
+ enabled = _isMgrEnabled(gblManager);
2010
+ }
2011
+ return enabled;
2012
+ },
2013
+ setEnabled: function (value) {
2014
+ _enabled = value !== false;
2015
+ },
2016
+ set: function (name, value, maxAgeSec, domain, path) {
2017
+ var result = false;
2018
+ if (_isMgrEnabled(cookieMgr) && !_isBlockedCookie(cookieMgrConfig, name)) {
2019
+ var values = {};
2020
+ var theValue = strTrim(value || STR_EMPTY);
2021
+ var idx = strIndexOf(theValue, ";");
2022
+ if (idx !== -1) {
2023
+ theValue = strTrim(strLeft(value, idx));
2024
+ values = _extractParts(strSubstring(value, idx + 1));
2025
+ }
2026
+ setValue(values, STR_DOMAIN, domain || _domain, isTruthy, isUndefined);
2027
+ if (!isNullOrUndefined(maxAgeSec)) {
2028
+ var _isIE = isIE();
2029
+ if (isUndefined(values[strExpires])) {
2030
+ var nowMs = utcNow();
2031
+ var expireMs = nowMs + (maxAgeSec * 1000);
2032
+ if (expireMs > 0) {
2033
+ var expiry = new Date();
2034
+ expiry.setTime(expireMs);
2035
+ setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || STR_EMPTY, isTruthy);
2036
+ }
2037
+ }
2038
+ if (!_isIE) {
2039
+ setValue(values, "max-age", STR_EMPTY + maxAgeSec, null, isUndefined);
2161
2040
  }
2162
2041
  }
2163
- _applyDefaultValue(dynamicHandler, newConfig, field, defaultValue);
2164
- });
2042
+ var location_1 = getLocation();
2043
+ if (location_1 && location_1.protocol === "https:") {
2044
+ setValue(values, "secure", null, null, isUndefined);
2045
+ if (_allowUaSameSite === null) {
2046
+ _allowUaSameSite = !uaDisallowsSameSiteNone((getNavigator() || {})[_DYN_USER_AGENT ]);
2047
+ }
2048
+ if (_allowUaSameSite) {
2049
+ setValue(values, "SameSite", "None", null, isUndefined);
2050
+ }
2051
+ }
2052
+ setValue(values, STR_PATH, path || _path, null, isUndefined);
2053
+ _setCookieFn(name, _formatCookieValue(theValue, values));
2054
+ result = true;
2055
+ }
2056
+ return result;
2057
+ },
2058
+ get: function (name) {
2059
+ var value = STR_EMPTY;
2060
+ if (_isMgrEnabled(cookieMgr) && !_isIgnoredCookie(cookieMgrConfig, name)) {
2061
+ value = _getCookieFn(name);
2062
+ }
2063
+ return value;
2064
+ },
2065
+ del: function (name, path) {
2066
+ var result = false;
2067
+ if (_isMgrEnabled(cookieMgr)) {
2068
+ result = cookieMgr.purge(name, path);
2069
+ }
2070
+ return result;
2071
+ },
2072
+ purge: function (name, path) {
2073
+ var _a;
2074
+ var result = false;
2075
+ if (areCookiesSupported(logger)) {
2076
+ var values = (_a = {},
2077
+ _a[STR_PATH] = path ? path : "/",
2078
+ _a[strExpires] = "Thu, 01 Jan 1970 00:00:01 GMT",
2079
+ _a);
2080
+ if (!isIE()) {
2081
+ values["max-age"] = "0";
2082
+ }
2083
+ _delCookieFn(name, _formatCookieValue(STR_EMPTY, values));
2084
+ result = true;
2085
+ }
2086
+ return result;
2165
2087
  }
2166
- return dynamicHandler[_DYN_SET_DF ](newConfig, defaultValues);
2167
- }
2168
- function _getConfig(identifier, field, defaultValue) {
2169
- if (defaultValue === void 0) { defaultValue = false; }
2170
- var theValue;
2171
- var extConfig = _getExtCfg(identifier, false);
2172
- var rootConfig = dynamicHandler.cfg;
2173
- if (extConfig && (extConfig[field] || !isNullOrUndefined(extConfig[field]))) {
2174
- theValue = extConfig[field];
2088
+ };
2089
+ cookieMgr[strConfigCookieMgr] = cookieMgr;
2090
+ return cookieMgr;
2091
+ }
2092
+ function areCookiesSupported(logger) {
2093
+ if (_supportsCookies === null) {
2094
+ _supportsCookies = false;
2095
+ try {
2096
+ var doc = _doc || {};
2097
+ _supportsCookies = doc[strCookie] !== undefined;
2175
2098
  }
2176
- else if (rootConfig[field] || !isNullOrUndefined(rootConfig[field])) {
2177
- theValue = rootConfig[field];
2099
+ catch (e) {
2100
+ _throwInternal(logger, 2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
2178
2101
  }
2179
- return (theValue || !isNullOrUndefined(theValue)) ? theValue : defaultValue;
2180
2102
  }
2181
- function _iterateChain(cb) {
2182
- var nextPlugin;
2183
- while (!!(nextPlugin = context._next())) {
2184
- var plugin = nextPlugin[_DYN_GET_PLUGIN ]();
2185
- if (plugin) {
2186
- cb(plugin);
2103
+ return _supportsCookies;
2104
+ }
2105
+ function _extractParts(theValue) {
2106
+ var values = {};
2107
+ if (theValue && theValue[_DYN_LENGTH$2 ]) {
2108
+ var parts = strTrim(theValue)[_DYN_SPLIT ](";");
2109
+ arrForEach(parts, function (thePart) {
2110
+ thePart = strTrim(thePart || STR_EMPTY);
2111
+ if (thePart) {
2112
+ var idx = strIndexOf(thePart, "=");
2113
+ if (idx === -1) {
2114
+ values[thePart] = null;
2115
+ }
2116
+ else {
2117
+ values[strTrim(strLeft(thePart, idx))] = strTrim(strSubstring(thePart, idx + 1));
2118
+ }
2187
2119
  }
2188
- }
2120
+ });
2189
2121
  }
2190
- return context;
2122
+ return values;
2191
2123
  }
2192
- function createProcessTelemetryContext(telemetryChain, cfg, core, startAt) {
2193
- var config = createDynamicConfig(cfg);
2194
- var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
2195
- var context = internalContext.ctx;
2196
- function _processNext(env) {
2197
- var nextPlugin = internalContext._next();
2198
- if (nextPlugin) {
2199
- nextPlugin[STR_PROCESS_TELEMETRY ](env, context);
2200
- }
2201
- return !nextPlugin;
2124
+ function _formatDate(theDate, func) {
2125
+ if (isFunction(theDate[func])) {
2126
+ return theDate[func]();
2202
2127
  }
2203
- function _createNew(plugins, startAt) {
2204
- if (plugins === void 0) { plugins = null; }
2205
- if (isArray(plugins)) {
2206
- plugins = createTelemetryProxyChain(plugins, config.cfg, core, startAt);
2128
+ return null;
2129
+ }
2130
+ function _formatCookieValue(value, values) {
2131
+ var cookieValue = value || STR_EMPTY;
2132
+ objForEachKey(values, function (name, theValue) {
2133
+ cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : STR_EMPTY);
2134
+ });
2135
+ return cookieValue;
2136
+ }
2137
+ function _getCookieValue(name) {
2138
+ var cookieValue = STR_EMPTY;
2139
+ if (_doc) {
2140
+ var theCookie = _doc[strCookie] || STR_EMPTY;
2141
+ if (_parsedCookieValue !== theCookie) {
2142
+ _cookieCache = _extractParts(theCookie);
2143
+ _parsedCookieValue = theCookie;
2207
2144
  }
2208
- return createProcessTelemetryContext(plugins || context[_DYN_GET_NEXT ](), config.cfg, core, startAt);
2145
+ cookieValue = strTrim(_cookieCache[name] || STR_EMPTY);
2209
2146
  }
2210
- context[_DYN_PROCESS_NEXT ] = _processNext;
2211
- context[_DYN_CREATE_NEW ] = _createNew;
2212
- return context;
2147
+ return cookieValue;
2213
2148
  }
2214
- function createProcessTelemetryUnloadContext(telemetryChain, core, startAt) {
2215
- var config = createDynamicConfig(core[_DYN_CONFIG ]);
2216
- var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
2217
- var context = internalContext.ctx;
2218
- function _processNext(unloadState) {
2219
- var nextPlugin = internalContext._next();
2220
- nextPlugin && nextPlugin.unload(context, unloadState);
2221
- return !nextPlugin;
2149
+ function _setCookieValue(name, cookieValue) {
2150
+ if (_doc) {
2151
+ _doc[strCookie] = name + "=" + cookieValue;
2222
2152
  }
2223
- function _createNew(plugins, startAt) {
2224
- if (plugins === void 0) { plugins = null; }
2225
- if (isArray(plugins)) {
2226
- plugins = createTelemetryProxyChain(plugins, config.cfg, core, startAt);
2227
- }
2228
- return createProcessTelemetryUnloadContext(plugins || context[_DYN_GET_NEXT ](), core, startAt);
2229
- }
2230
- context[_DYN_PROCESS_NEXT ] = _processNext;
2231
- context[_DYN_CREATE_NEW ] = _createNew;
2232
- return context;
2233
2153
  }
2234
- function createProcessTelemetryUpdateContext(telemetryChain, core, startAt) {
2235
- var config = createDynamicConfig(core[_DYN_CONFIG ]);
2236
- var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
2237
- var context = internalContext.ctx;
2238
- function _processNext(updateState) {
2239
- return context.iterate(function (plugin) {
2240
- if (isFunction(plugin[_DYN_UPDATE$1 ])) {
2241
- plugin[_DYN_UPDATE$1 ](context, updateState);
2242
- }
2243
- });
2154
+ function uaDisallowsSameSiteNone(userAgent) {
2155
+ if (!isString(userAgent)) {
2156
+ return false;
2244
2157
  }
2245
- function _createNew(plugins, startAt) {
2246
- if (plugins === void 0) { plugins = null; }
2247
- if (isArray(plugins)) {
2248
- plugins = createTelemetryProxyChain(plugins, config.cfg, core, startAt);
2249
- }
2250
- return createProcessTelemetryUpdateContext(plugins || context[_DYN_GET_NEXT ](), core, startAt);
2158
+ if (strContains(userAgent, "CPU iPhone OS 12") || strContains(userAgent, "iPad; CPU OS 12")) {
2159
+ return true;
2251
2160
  }
2252
- context[_DYN_PROCESS_NEXT ] = _processNext;
2253
- context[_DYN_CREATE_NEW ] = _createNew;
2254
- return context;
2255
- }
2256
- function createTelemetryProxyChain(plugins, config, core, startAt) {
2257
- var firstProxy = null;
2258
- var add = startAt ? false : true;
2259
- if (isArray(plugins) && plugins[_DYN_LENGTH$2 ] > 0) {
2260
- var lastProxy_1 = null;
2261
- arrForEach(plugins, function (thePlugin) {
2262
- if (!add && startAt === thePlugin) {
2263
- add = true;
2264
- }
2265
- if (add && thePlugin && isFunction(thePlugin[STR_PROCESS_TELEMETRY ])) {
2266
- var newProxy = createTelemetryPluginProxy(thePlugin, config, core);
2267
- if (!firstProxy) {
2268
- firstProxy = newProxy;
2269
- }
2270
- if (lastProxy_1) {
2271
- lastProxy_1._setNext(newProxy);
2272
- }
2273
- lastProxy_1 = newProxy;
2274
- }
2275
- });
2161
+ if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strContains(userAgent, "Version/") && strContains(userAgent, "Safari")) {
2162
+ return true;
2276
2163
  }
2277
- if (startAt && !firstProxy) {
2278
- return createTelemetryProxyChain([startAt], config, core);
2164
+ if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strEndsWith(userAgent, "AppleWebKit/605.1.15 (KHTML, like Gecko)")) {
2165
+ return true;
2279
2166
  }
2280
- return firstProxy;
2281
- }
2282
- function createTelemetryPluginProxy(plugin, config, core) {
2283
- var nextProxy = null;
2284
- var hasProcessTelemetry = isFunction(plugin[STR_PROCESS_TELEMETRY ]);
2285
- var hasSetNext = isFunction(plugin[_DYN_SET_NEXT_PLUGIN ]);
2286
- var chainId;
2287
- if (plugin) {
2288
- chainId = plugin[_DYN_IDENTIFIER ] + "-" + plugin[STR_PRIORITY ] + "-" + _chainId++;
2167
+ if (strContains(userAgent, "Chrome/5") || strContains(userAgent, "Chrome/6")) {
2168
+ return true;
2289
2169
  }
2290
- else {
2291
- chainId = "Unknown-0-" + _chainId++;
2170
+ if (strContains(userAgent, "UnrealEngine") && !strContains(userAgent, "Chrome")) {
2171
+ return true;
2292
2172
  }
2293
- var proxyChain = {
2294
- getPlugin: function () {
2295
- return plugin;
2296
- },
2297
- getNext: function () {
2298
- return nextProxy;
2299
- },
2300
- processTelemetry: _processTelemetry,
2301
- unload: _unloadPlugin,
2302
- update: _updatePlugin,
2303
- _id: chainId,
2304
- _setNext: function (nextPlugin) {
2305
- nextProxy = nextPlugin;
2306
- }
2307
- };
2308
- function _getTelCtx() {
2309
- var itemCtx;
2310
- if (plugin && isFunction(plugin[strGetTelCtx])) {
2311
- itemCtx = plugin[strGetTelCtx]();
2312
- }
2313
- if (!itemCtx) {
2314
- itemCtx = createProcessTelemetryContext(proxyChain, config, core);
2315
- }
2316
- return itemCtx;
2173
+ if (strContains(userAgent, "UCBrowser/12") || strContains(userAgent, "UCBrowser/11")) {
2174
+ return true;
2317
2175
  }
2318
- function _processChain(itemCtx, processPluginFn, name, details, isAsync) {
2319
- var hasRun = false;
2320
- var identifier = plugin ? plugin[_DYN_IDENTIFIER ] : strTelemetryPluginChain;
2321
- var hasRunContext = itemCtx[strHasRunFlags];
2322
- if (!hasRunContext) {
2323
- hasRunContext = itemCtx[strHasRunFlags] = {};
2176
+ return false;
2177
+ }
2178
+
2179
+ var strExecutionContextKey = "ctx";
2180
+ var strParentContextKey = "ParentContextKey";
2181
+ var strChildrenContextKey = "ChildrenContextKey";
2182
+ var PerfEvent = /** @class */ (function () {
2183
+ function PerfEvent(name, payloadDetails, isAsync) {
2184
+ var _self = this;
2185
+ _self.start = utcNow();
2186
+ _self[_DYN_NAME$1 ] = name;
2187
+ _self[_DYN_IS_ASYNC ] = isAsync;
2188
+ _self[_DYN_IS_CHILD_EVT ] = function () { return false; };
2189
+ if (isFunction(payloadDetails)) {
2190
+ var theDetails_1;
2191
+ objDefineAccessors(_self, "payload", function () {
2192
+ if (!theDetails_1 && isFunction(payloadDetails)) {
2193
+ theDetails_1 = payloadDetails();
2194
+ payloadDetails = null;
2195
+ }
2196
+ return theDetails_1;
2197
+ });
2324
2198
  }
2325
- itemCtx.setNext(nextProxy);
2326
- if (plugin) {
2327
- doPerf(itemCtx[STR_CORE ](), function () { return identifier + ":" + name; }, function () {
2328
- hasRunContext[chainId] = true;
2329
- try {
2330
- var nextId = nextProxy ? nextProxy._id : STR_EMPTY;
2331
- if (nextId) {
2332
- hasRunContext[nextId] = false;
2333
- }
2334
- hasRun = processPluginFn(itemCtx);
2199
+ _self[_DYN_GET_CTX ] = function (key) {
2200
+ if (key) {
2201
+ if (key === PerfEvent[strParentContextKey] || key === PerfEvent[strChildrenContextKey]) {
2202
+ return _self[key];
2335
2203
  }
2336
- catch (error) {
2337
- var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;
2338
- if (hasNextRun) {
2339
- hasRun = true;
2340
- }
2341
- if (!nextProxy || !hasNextRun) {
2342
- _throwInternal(itemCtx[_DYN_DIAG_LOG ](), 1 , 73 , "Plugin [" + identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
2204
+ return (_self[strExecutionContextKey] || {})[key];
2205
+ }
2206
+ return null;
2207
+ };
2208
+ _self[_DYN_SET_CTX ] = function (key, value) {
2209
+ if (key) {
2210
+ if (key === PerfEvent[strParentContextKey]) {
2211
+ if (!_self[key]) {
2212
+ _self[_DYN_IS_CHILD_EVT ] = function () { return true; };
2343
2213
  }
2214
+ _self[key] = value;
2215
+ }
2216
+ else if (key === PerfEvent[strChildrenContextKey]) {
2217
+ _self[key] = value;
2218
+ }
2219
+ else {
2220
+ var ctx = _self[strExecutionContextKey] = _self[strExecutionContextKey] || {};
2221
+ ctx[key] = value;
2344
2222
  }
2345
- }, details, isAsync);
2346
- }
2347
- return hasRun;
2348
- }
2349
- function _processTelemetry(env, itemCtx) {
2350
- itemCtx = itemCtx || _getTelCtx();
2351
- function _callProcessTelemetry(itemCtx) {
2352
- if (!plugin || !hasProcessTelemetry) {
2353
- return false;
2354
- }
2355
- var pluginState = _getPluginState(plugin);
2356
- if (pluginState[_DYN_TEARDOWN ] || pluginState[STR_DISABLED]) {
2357
- return false;
2358
2223
  }
2359
- if (hasSetNext) {
2360
- plugin[_DYN_SET_NEXT_PLUGIN ](nextProxy);
2224
+ };
2225
+ _self[_DYN_COMPLETE ] = function () {
2226
+ var childTime = 0;
2227
+ var childEvts = _self[_DYN_GET_CTX ](PerfEvent[strChildrenContextKey]);
2228
+ if (isArray(childEvts)) {
2229
+ for (var lp = 0; lp < childEvts[_DYN_LENGTH$2 ]; lp++) {
2230
+ var childEvt = childEvts[lp];
2231
+ if (childEvt) {
2232
+ childTime += childEvt[_DYN_TIME ];
2233
+ }
2234
+ }
2361
2235
  }
2362
- plugin[STR_PROCESS_TELEMETRY ](env, itemCtx);
2363
- return true;
2364
- }
2365
- if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
2366
- itemCtx[_DYN_PROCESS_NEXT ](env);
2367
- }
2236
+ _self[_DYN_TIME ] = utcNow() - _self.start;
2237
+ _self.exTime = _self[_DYN_TIME ] - childTime;
2238
+ _self[_DYN_COMPLETE ] = function () { };
2239
+ };
2368
2240
  }
2369
- function _unloadPlugin(unloadCtx, unloadState) {
2370
- function _callTeardown() {
2371
- var hasRun = false;
2372
- if (plugin) {
2373
- var pluginState = _getPluginState(plugin);
2374
- var pluginCore = plugin[STR_CORE] || pluginState[STR_CORE ];
2375
- if (plugin && (!pluginCore || pluginCore === unloadCtx.core()) && !pluginState[_DYN_TEARDOWN ]) {
2376
- pluginState[STR_CORE ] = null;
2377
- pluginState[_DYN_TEARDOWN ] = true;
2378
- pluginState[_DYN_IS_INITIALIZED ] = false;
2379
- if (plugin[_DYN_TEARDOWN ] && plugin[_DYN_TEARDOWN ](unloadCtx, unloadState) === true) {
2380
- hasRun = true;
2241
+ PerfEvent.ParentContextKey = "parent";
2242
+ PerfEvent.ChildrenContextKey = "childEvts";
2243
+ return PerfEvent;
2244
+ }());
2245
+ var doPerfActiveKey = "CoreUtils.doPerf";
2246
+ function doPerf(mgrSource, getSource, func, details, isAsync) {
2247
+ if (mgrSource) {
2248
+ var perfMgr = mgrSource;
2249
+ if (perfMgr[STR_GET_PERF_MGR]) {
2250
+ perfMgr = perfMgr[STR_GET_PERF_MGR]();
2251
+ }
2252
+ if (perfMgr) {
2253
+ var perfEvt = void 0;
2254
+ var currentActive = perfMgr[_DYN_GET_CTX ](doPerfActiveKey);
2255
+ try {
2256
+ perfEvt = perfMgr.create(getSource(), details, isAsync);
2257
+ if (perfEvt) {
2258
+ if (currentActive && perfEvt[_DYN_SET_CTX ]) {
2259
+ perfEvt[_DYN_SET_CTX ](PerfEvent[strParentContextKey], currentActive);
2260
+ if (currentActive[_DYN_GET_CTX ] && currentActive[_DYN_SET_CTX ]) {
2261
+ var children = currentActive[_DYN_GET_CTX ](PerfEvent[strChildrenContextKey]);
2262
+ if (!children) {
2263
+ children = [];
2264
+ currentActive[_DYN_SET_CTX ](PerfEvent[strChildrenContextKey], children);
2265
+ }
2266
+ children[_DYN_PUSH ](perfEvt);
2267
+ }
2381
2268
  }
2269
+ perfMgr[_DYN_SET_CTX ](doPerfActiveKey, perfEvt);
2270
+ return func(perfEvt);
2382
2271
  }
2383
2272
  }
2384
- return hasRun;
2385
- }
2386
- if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState[_DYN_IS_ASYNC ])) {
2387
- unloadCtx[_DYN_PROCESS_NEXT ](unloadState);
2273
+ catch (ex) {
2274
+ if (perfEvt && perfEvt[_DYN_SET_CTX ]) {
2275
+ perfEvt[_DYN_SET_CTX ]("exception", ex);
2276
+ }
2277
+ }
2278
+ finally {
2279
+ if (perfEvt) {
2280
+ perfMgr.fire(perfEvt);
2281
+ }
2282
+ perfMgr[_DYN_SET_CTX ](doPerfActiveKey, currentActive);
2283
+ }
2388
2284
  }
2389
2285
  }
2390
- function _updatePlugin(updateCtx, updateState) {
2391
- function _callUpdate() {
2392
- var hasRun = false;
2393
- if (plugin) {
2394
- var pluginState = _getPluginState(plugin);
2395
- var pluginCore = plugin[STR_CORE] || pluginState[STR_CORE ];
2396
- if (plugin && (!pluginCore || pluginCore === updateCtx.core()) && !pluginState[_DYN_TEARDOWN ]) {
2397
- if (plugin[_DYN_UPDATE$1 ] && plugin[_DYN_UPDATE$1 ](updateCtx, updateState) === true) {
2398
- hasRun = true;
2399
- }
2400
- }
2401
- }
2402
- return hasRun;
2403
- }
2404
- if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
2405
- updateCtx[_DYN_PROCESS_NEXT ](updateState);
2406
- }
2407
- }
2408
- return objFreeze(proxyChain);
2286
+ return func();
2409
2287
  }
2410
2288
 
2411
- var _a$2, _b;
2412
- var strToGMTString = "toGMTString";
2413
- var strToUTCString = "toUTCString";
2414
- var strCookie = "cookie";
2415
- var strExpires = "expires";
2416
- var strIsCookieUseDisabled = "isCookieUseDisabled";
2417
- var strDisableCookiesUsage = "disableCookiesUsage";
2418
- var strConfigCookieMgr = "_ckMgr";
2419
- var _supportsCookies = null;
2420
- var _allowUaSameSite = null;
2421
- var _parsedCookieValue = null;
2422
- var _doc = getDocument();
2423
- var _cookieCache = {};
2424
- var _globalCookieConfig = {};
2425
- var defaultConfig = objDeepFreeze((_a$2 = {},
2426
- _a$2[STR_DOMAIN] = { fb: "cookieDomain", dfVal: isNotNullOrUndefined },
2427
- _a$2.path = { fb: "cookiePath", dfVal: isNotNullOrUndefined },
2428
- _a$2.enabled = UNDEFINED_VALUE,
2429
- _a$2));
2430
- var rootDefaultConfig = (_b = {
2431
- cookieCfg: {},
2432
- cookieDomain: UNDEFINED_VALUE,
2433
- cookiePath: UNDEFINED_VALUE
2434
- },
2435
- _b[strDisableCookiesUsage] = UNDEFINED_VALUE,
2436
- _b);
2437
- function _gblCookieMgr(config, logger) {
2438
- var inst = createCookieMgr[strConfigCookieMgr] || _globalCookieConfig[strConfigCookieMgr];
2439
- if (!inst) {
2440
- inst = createCookieMgr[strConfigCookieMgr] = createCookieMgr(config, logger);
2441
- _globalCookieConfig[strConfigCookieMgr] = inst;
2442
- }
2443
- return inst;
2444
- }
2445
- function _isMgrEnabled(cookieMgr) {
2446
- if (cookieMgr) {
2447
- return cookieMgr.isEnabled();
2289
+ function generateW3CId() {
2290
+ var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
2291
+ var oct = STR_EMPTY, tmp;
2292
+ for (var a = 0; a < 4; a++) {
2293
+ tmp = random32();
2294
+ oct +=
2295
+ hexValues[tmp & 0xF] +
2296
+ hexValues[tmp >> 4 & 0xF] +
2297
+ hexValues[tmp >> 8 & 0xF] +
2298
+ hexValues[tmp >> 12 & 0xF] +
2299
+ hexValues[tmp >> 16 & 0xF] +
2300
+ hexValues[tmp >> 20 & 0xF] +
2301
+ hexValues[tmp >> 24 & 0xF] +
2302
+ hexValues[tmp >> 28 & 0xF];
2448
2303
  }
2449
- return true;
2304
+ var clockSequenceHi = hexValues[8 + (random32() & 0x03) | 0];
2305
+ return strSubstr(oct, 0, 8) + strSubstr(oct, 9, 4) + "4" + strSubstr(oct, 13, 3) + clockSequenceHi + strSubstr(oct, 16, 3) + strSubstr(oct, 19, 12);
2450
2306
  }
2451
- function _isIgnoredCookie(cookieMgrCfg, name) {
2452
- if (name && cookieMgrCfg && isArray(cookieMgrCfg.ignoreCookies)) {
2453
- return arrIndexOf(cookieMgrCfg.ignoreCookies, name) !== -1;
2307
+
2308
+ var INVALID_TRACE_ID = "00000000000000000000000000000000";
2309
+ var INVALID_SPAN_ID = "0000000000000000";
2310
+ function _isValid(value, len, invalidValue) {
2311
+ if (value && value[_DYN_LENGTH$2 ] === len && value !== invalidValue) {
2312
+ return !!value.match(/^[\da-f]*$/i);
2454
2313
  }
2455
2314
  return false;
2456
2315
  }
2457
- function _isBlockedCookie(cookieMgrCfg, name) {
2458
- if (name && cookieMgrCfg && isArray(cookieMgrCfg.blockedCookies)) {
2459
- if (arrIndexOf(cookieMgrCfg.blockedCookies, name) !== -1) {
2460
- return true;
2316
+ function isValidTraceId(value) {
2317
+ return _isValid(value, 32, INVALID_TRACE_ID);
2318
+ }
2319
+ function isValidSpanId(value) {
2320
+ return _isValid(value, 16, INVALID_SPAN_ID);
2321
+ }
2322
+
2323
+ var pluginStateData = createElmNodeData("plugin");
2324
+ function _getPluginState(plugin) {
2325
+ return pluginStateData.get(plugin, "state", {}, true);
2326
+ }
2327
+
2328
+ var strTelemetryPluginChain = "TelemetryPluginChain";
2329
+ var strHasRunFlags = "_hasRun";
2330
+ var strGetTelCtx = "_getTelCtx";
2331
+ var _chainId = 0;
2332
+ function _getNextProxyStart(proxy, core, startAt) {
2333
+ while (proxy) {
2334
+ if (proxy[_DYN_GET_PLUGIN ]() === startAt) {
2335
+ return proxy;
2461
2336
  }
2337
+ proxy = proxy[_DYN_GET_NEXT ]();
2462
2338
  }
2463
- return _isIgnoredCookie(cookieMgrCfg, name);
2339
+ return createTelemetryProxyChain([startAt], core.config || {}, core);
2464
2340
  }
2465
- function safeGetCookieMgr(core, config) {
2466
- var cookieMgr;
2467
- if (core) {
2468
- cookieMgr = core.getCookieMgr();
2341
+ function _createInternalContext(telemetryChain, dynamicHandler, core, startAt) {
2342
+ var _nextProxy = null;
2343
+ var _onComplete = [];
2344
+ if (!dynamicHandler) {
2345
+ dynamicHandler = createDynamicConfig({}, null, core[_DYN_LOGGER ]);
2469
2346
  }
2470
- else if (config) {
2471
- var cookieCfg = config.cookieCfg;
2472
- if (cookieCfg && cookieCfg[strConfigCookieMgr]) {
2473
- cookieMgr = cookieCfg[strConfigCookieMgr];
2347
+ if (startAt !== null) {
2348
+ _nextProxy = startAt ? _getNextProxyStart(telemetryChain, core, startAt) : telemetryChain;
2349
+ }
2350
+ var context = {
2351
+ _next: _moveNext,
2352
+ ctx: {
2353
+ core: function () {
2354
+ return core;
2355
+ },
2356
+ diagLog: function () {
2357
+ return safeGetLogger(core, dynamicHandler.cfg);
2358
+ },
2359
+ getCfg: function () {
2360
+ return dynamicHandler.cfg;
2361
+ },
2362
+ getExtCfg: _resolveExtCfg,
2363
+ getConfig: _getConfig,
2364
+ hasNext: function () {
2365
+ return !!_nextProxy;
2366
+ },
2367
+ getNext: function () {
2368
+ return _nextProxy;
2369
+ },
2370
+ setNext: function (nextPlugin) {
2371
+ _nextProxy = nextPlugin;
2372
+ },
2373
+ iterate: _iterateChain,
2374
+ onComplete: _addOnComplete
2474
2375
  }
2475
- else {
2476
- cookieMgr = createCookieMgr(config);
2376
+ };
2377
+ function _addOnComplete(onComplete, that) {
2378
+ var args = [];
2379
+ for (var _i = 2; _i < arguments.length; _i++) {
2380
+ args[_i - 2] = arguments[_i];
2477
2381
  }
2478
- }
2479
- if (!cookieMgr) {
2480
- cookieMgr = _gblCookieMgr(config, (core || {})[_DYN_LOGGER ]);
2481
- }
2482
- return cookieMgr;
2483
- }
2484
- function createCookieMgr(rootConfig, logger) {
2485
- var cookieMgrConfig;
2486
- var _path;
2487
- var _domain;
2488
- var _enabled;
2489
- var _getCookieFn;
2490
- var _setCookieFn;
2491
- var _delCookieFn;
2492
- rootConfig = createDynamicConfig(rootConfig || _globalCookieConfig, null, logger).cfg;
2493
- onConfigChange(rootConfig, function (details) {
2494
- details[_DYN_SET_DF ](details.cfg, rootDefaultConfig);
2495
- cookieMgrConfig = details[_DYN_SET_DF ](details.cfg.cookieCfg, defaultConfig);
2496
- var isEnabled = cookieMgrConfig.enabled;
2497
- if (isNullOrUndefined(isEnabled)) {
2498
- var cookieEnabled = void 0;
2499
- if (!isUndefined(rootConfig[strIsCookieUseDisabled])) {
2500
- cookieEnabled = !rootConfig[strIsCookieUseDisabled];
2501
- }
2502
- if (!isUndefined(rootConfig[strDisableCookiesUsage])) {
2503
- cookieEnabled = !rootConfig[strDisableCookiesUsage];
2504
- }
2505
- isEnabled = cookieEnabled;
2382
+ if (onComplete) {
2383
+ _onComplete[_DYN_PUSH ]({
2384
+ func: onComplete,
2385
+ self: !isUndefined(that) ? that : context.ctx,
2386
+ args: args
2387
+ });
2506
2388
  }
2507
- _path = cookieMgrConfig[STR_PATH ] || "/";
2508
- _domain = cookieMgrConfig[STR_DOMAIN ];
2509
- _enabled = isEnabled !== false;
2510
- _getCookieFn = cookieMgrConfig.getCookie || _getCookieValue;
2511
- _setCookieFn = cookieMgrConfig.setCookie || _setCookieValue;
2512
- _delCookieFn = cookieMgrConfig.delCookie || _setCookieValue;
2513
- }, logger);
2514
- var cookieMgr = {
2515
- isEnabled: function () {
2516
- var enabled = _enabled && areCookiesSupported(logger);
2517
- var gblManager = _globalCookieConfig[strConfigCookieMgr];
2518
- if (enabled && gblManager && cookieMgr !== gblManager) {
2519
- enabled = _isMgrEnabled(gblManager);
2520
- }
2521
- return enabled;
2522
- },
2523
- setEnabled: function (value) {
2524
- _enabled = value !== false;
2525
- },
2526
- set: function (name, value, maxAgeSec, domain, path) {
2527
- var result = false;
2528
- if (_isMgrEnabled(cookieMgr) && !_isBlockedCookie(cookieMgrConfig, name)) {
2529
- var values = {};
2530
- var theValue = strTrim(value || STR_EMPTY);
2531
- var idx = strIndexOf(theValue, ";");
2532
- if (idx !== -1) {
2533
- theValue = strTrim(strLeft(value, idx));
2534
- values = _extractParts(strSubstring(value, idx + 1));
2535
- }
2536
- setValue(values, STR_DOMAIN, domain || _domain, isTruthy, isUndefined);
2537
- if (!isNullOrUndefined(maxAgeSec)) {
2538
- var _isIE = isIE();
2539
- if (isUndefined(values[strExpires])) {
2540
- var nowMs = utcNow();
2541
- var expireMs = nowMs + (maxAgeSec * 1000);
2542
- if (expireMs > 0) {
2543
- var expiry = new Date();
2544
- expiry.setTime(expireMs);
2545
- setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || STR_EMPTY, isTruthy);
2546
- }
2547
- }
2548
- if (!_isIE) {
2549
- setValue(values, "max-age", STR_EMPTY + maxAgeSec, null, isUndefined);
2550
- }
2551
- }
2552
- var location_1 = getLocation();
2553
- if (location_1 && location_1.protocol === "https:") {
2554
- setValue(values, "secure", null, null, isUndefined);
2555
- if (_allowUaSameSite === null) {
2556
- _allowUaSameSite = !uaDisallowsSameSiteNone((getNavigator() || {})[_DYN_USER_AGENT ]);
2389
+ }
2390
+ function _moveNext() {
2391
+ var nextProxy = _nextProxy;
2392
+ _nextProxy = nextProxy ? nextProxy[_DYN_GET_NEXT ]() : null;
2393
+ if (!nextProxy) {
2394
+ var onComplete = _onComplete;
2395
+ if (onComplete && onComplete[_DYN_LENGTH$2 ] > 0) {
2396
+ arrForEach(onComplete, function (completeDetails) {
2397
+ try {
2398
+ completeDetails.func[_DYN_CALL ](completeDetails.self, completeDetails.args);
2557
2399
  }
2558
- if (_allowUaSameSite) {
2559
- setValue(values, "SameSite", "None", null, isUndefined);
2400
+ catch (e) {
2401
+ _throwInternal(core[_DYN_LOGGER ], 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
2560
2402
  }
2561
- }
2562
- setValue(values, STR_PATH, path || _path, null, isUndefined);
2563
- _setCookieFn(name, _formatCookieValue(theValue, values));
2564
- result = true;
2403
+ });
2404
+ _onComplete = [];
2565
2405
  }
2566
- return result;
2567
- },
2568
- get: function (name) {
2569
- var value = STR_EMPTY;
2570
- if (_isMgrEnabled(cookieMgr) && !_isIgnoredCookie(cookieMgrConfig, name)) {
2571
- value = _getCookieFn(name);
2406
+ }
2407
+ return nextProxy;
2408
+ }
2409
+ function _getExtCfg(identifier, createIfMissing) {
2410
+ var idCfg = null;
2411
+ var cfg = dynamicHandler.cfg;
2412
+ if (cfg && identifier) {
2413
+ var extCfg = cfg[STR_EXTENSION_CONFIG ];
2414
+ if (!extCfg && createIfMissing) {
2415
+ extCfg = {};
2572
2416
  }
2573
- return value;
2574
- },
2575
- del: function (name, path) {
2576
- var result = false;
2577
- if (_isMgrEnabled(cookieMgr)) {
2578
- result = cookieMgr.purge(name, path);
2417
+ dynamicHandler.set(cfg, STR_EXTENSION_CONFIG, extCfg);
2418
+ extCfg = cfg[STR_EXTENSION_CONFIG ];
2419
+ if (extCfg) {
2420
+ idCfg = extCfg[identifier];
2421
+ if (!idCfg && createIfMissing) {
2422
+ idCfg = {};
2423
+ }
2424
+ dynamicHandler.set(extCfg, identifier, idCfg);
2425
+ idCfg = extCfg[identifier];
2579
2426
  }
2580
- return result;
2581
- },
2582
- purge: function (name, path) {
2583
- var _a;
2584
- var result = false;
2585
- if (areCookiesSupported(logger)) {
2586
- var values = (_a = {},
2587
- _a[STR_PATH] = path ? path : "/",
2588
- _a[strExpires] = "Thu, 01 Jan 1970 00:00:01 GMT",
2589
- _a);
2590
- if (!isIE()) {
2591
- values["max-age"] = "0";
2427
+ }
2428
+ return idCfg;
2429
+ }
2430
+ function _resolveExtCfg(identifier, defaultValues) {
2431
+ var newConfig = _getExtCfg(identifier, true);
2432
+ if (defaultValues) {
2433
+ objForEachKey(defaultValues, function (field, defaultValue) {
2434
+ if (isNullOrUndefined(newConfig[field])) {
2435
+ var cfgValue = dynamicHandler.cfg[field];
2436
+ if (cfgValue || !isNullOrUndefined(cfgValue)) {
2437
+ newConfig[field] = cfgValue;
2438
+ }
2592
2439
  }
2593
- _delCookieFn(name, _formatCookieValue(STR_EMPTY, values));
2594
- result = true;
2440
+ _applyDefaultValue(dynamicHandler, newConfig, field, defaultValue);
2441
+ });
2442
+ }
2443
+ return dynamicHandler[_DYN_SET_DF ](newConfig, defaultValues);
2444
+ }
2445
+ function _getConfig(identifier, field, defaultValue) {
2446
+ if (defaultValue === void 0) { defaultValue = false; }
2447
+ var theValue;
2448
+ var extConfig = _getExtCfg(identifier, false);
2449
+ var rootConfig = dynamicHandler.cfg;
2450
+ if (extConfig && (extConfig[field] || !isNullOrUndefined(extConfig[field]))) {
2451
+ theValue = extConfig[field];
2452
+ }
2453
+ else if (rootConfig[field] || !isNullOrUndefined(rootConfig[field])) {
2454
+ theValue = rootConfig[field];
2455
+ }
2456
+ return (theValue || !isNullOrUndefined(theValue)) ? theValue : defaultValue;
2457
+ }
2458
+ function _iterateChain(cb) {
2459
+ var nextPlugin;
2460
+ while (!!(nextPlugin = context._next())) {
2461
+ var plugin = nextPlugin[_DYN_GET_PLUGIN ]();
2462
+ if (plugin) {
2463
+ cb(plugin);
2595
2464
  }
2596
- return result;
2597
2465
  }
2598
- };
2599
- cookieMgr[strConfigCookieMgr] = cookieMgr;
2600
- return cookieMgr;
2466
+ }
2467
+ return context;
2468
+ }
2469
+ function createProcessTelemetryContext(telemetryChain, cfg, core, startAt) {
2470
+ var config = createDynamicConfig(cfg);
2471
+ var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
2472
+ var context = internalContext.ctx;
2473
+ function _processNext(env) {
2474
+ var nextPlugin = internalContext._next();
2475
+ if (nextPlugin) {
2476
+ nextPlugin[STR_PROCESS_TELEMETRY ](env, context);
2477
+ }
2478
+ return !nextPlugin;
2479
+ }
2480
+ function _createNew(plugins, startAt) {
2481
+ if (plugins === void 0) { plugins = null; }
2482
+ if (isArray(plugins)) {
2483
+ plugins = createTelemetryProxyChain(plugins, config.cfg, core, startAt);
2484
+ }
2485
+ return createProcessTelemetryContext(plugins || context[_DYN_GET_NEXT ](), config.cfg, core, startAt);
2486
+ }
2487
+ context[_DYN_PROCESS_NEXT ] = _processNext;
2488
+ context[_DYN_CREATE_NEW ] = _createNew;
2489
+ return context;
2601
2490
  }
2602
- function areCookiesSupported(logger) {
2603
- if (_supportsCookies === null) {
2604
- _supportsCookies = false;
2605
- try {
2606
- var doc = _doc || {};
2607
- _supportsCookies = doc[strCookie] !== undefined;
2608
- }
2609
- catch (e) {
2610
- _throwInternal(logger, 2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
2491
+ function createProcessTelemetryUnloadContext(telemetryChain, core, startAt) {
2492
+ var config = createDynamicConfig(core.config);
2493
+ var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
2494
+ var context = internalContext.ctx;
2495
+ function _processNext(unloadState) {
2496
+ var nextPlugin = internalContext._next();
2497
+ nextPlugin && nextPlugin.unload(context, unloadState);
2498
+ return !nextPlugin;
2499
+ }
2500
+ function _createNew(plugins, startAt) {
2501
+ if (plugins === void 0) { plugins = null; }
2502
+ if (isArray(plugins)) {
2503
+ plugins = createTelemetryProxyChain(plugins, config.cfg, core, startAt);
2611
2504
  }
2505
+ return createProcessTelemetryUnloadContext(plugins || context[_DYN_GET_NEXT ](), core, startAt);
2612
2506
  }
2613
- return _supportsCookies;
2507
+ context[_DYN_PROCESS_NEXT ] = _processNext;
2508
+ context[_DYN_CREATE_NEW ] = _createNew;
2509
+ return context;
2614
2510
  }
2615
- function _extractParts(theValue) {
2616
- var values = {};
2617
- if (theValue && theValue[_DYN_LENGTH$2 ]) {
2618
- var parts = strTrim(theValue)[_DYN_SPLIT ](";");
2619
- arrForEach(parts, function (thePart) {
2620
- thePart = strTrim(thePart || STR_EMPTY);
2621
- if (thePart) {
2622
- var idx = strIndexOf(thePart, "=");
2623
- if (idx === -1) {
2624
- values[thePart] = null;
2625
- }
2626
- else {
2627
- values[strTrim(strLeft(thePart, idx))] = strTrim(strSubstring(thePart, idx + 1));
2628
- }
2511
+ function createProcessTelemetryUpdateContext(telemetryChain, core, startAt) {
2512
+ var config = createDynamicConfig(core.config);
2513
+ var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
2514
+ var context = internalContext.ctx;
2515
+ function _processNext(updateState) {
2516
+ return context.iterate(function (plugin) {
2517
+ if (isFunction(plugin[_DYN_UPDATE$1 ])) {
2518
+ plugin[_DYN_UPDATE$1 ](context, updateState);
2629
2519
  }
2630
2520
  });
2631
2521
  }
2632
- return values;
2633
- }
2634
- function _formatDate(theDate, func) {
2635
- if (isFunction(theDate[func])) {
2636
- return theDate[func]();
2637
- }
2638
- return null;
2639
- }
2640
- function _formatCookieValue(value, values) {
2641
- var cookieValue = value || STR_EMPTY;
2642
- objForEachKey(values, function (name, theValue) {
2643
- cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : STR_EMPTY);
2644
- });
2645
- return cookieValue;
2646
- }
2647
- function _getCookieValue(name) {
2648
- var cookieValue = STR_EMPTY;
2649
- if (_doc) {
2650
- var theCookie = _doc[strCookie] || STR_EMPTY;
2651
- if (_parsedCookieValue !== theCookie) {
2652
- _cookieCache = _extractParts(theCookie);
2653
- _parsedCookieValue = theCookie;
2522
+ function _createNew(plugins, startAt) {
2523
+ if (plugins === void 0) { plugins = null; }
2524
+ if (isArray(plugins)) {
2525
+ plugins = createTelemetryProxyChain(plugins, config.cfg, core, startAt);
2654
2526
  }
2655
- cookieValue = strTrim(_cookieCache[name] || STR_EMPTY);
2527
+ return createProcessTelemetryUpdateContext(plugins || context[_DYN_GET_NEXT ](), core, startAt);
2656
2528
  }
2657
- return cookieValue;
2529
+ context[_DYN_PROCESS_NEXT ] = _processNext;
2530
+ context[_DYN_CREATE_NEW ] = _createNew;
2531
+ return context;
2658
2532
  }
2659
- function _setCookieValue(name, cookieValue) {
2660
- if (_doc) {
2661
- _doc[strCookie] = name + "=" + cookieValue;
2533
+ function createTelemetryProxyChain(plugins, config, core, startAt) {
2534
+ var firstProxy = null;
2535
+ var add = startAt ? false : true;
2536
+ if (isArray(plugins) && plugins[_DYN_LENGTH$2 ] > 0) {
2537
+ var lastProxy_1 = null;
2538
+ arrForEach(plugins, function (thePlugin) {
2539
+ if (!add && startAt === thePlugin) {
2540
+ add = true;
2541
+ }
2542
+ if (add && thePlugin && isFunction(thePlugin[STR_PROCESS_TELEMETRY ])) {
2543
+ var newProxy = createTelemetryPluginProxy(thePlugin, config, core);
2544
+ if (!firstProxy) {
2545
+ firstProxy = newProxy;
2546
+ }
2547
+ if (lastProxy_1) {
2548
+ lastProxy_1._setNext(newProxy);
2549
+ }
2550
+ lastProxy_1 = newProxy;
2551
+ }
2552
+ });
2662
2553
  }
2554
+ if (startAt && !firstProxy) {
2555
+ return createTelemetryProxyChain([startAt], config, core);
2556
+ }
2557
+ return firstProxy;
2663
2558
  }
2664
- function uaDisallowsSameSiteNone(userAgent) {
2665
- if (!isString(userAgent)) {
2666
- return false;
2559
+ function createTelemetryPluginProxy(plugin, config, core) {
2560
+ var nextProxy = null;
2561
+ var hasProcessTelemetry = isFunction(plugin[STR_PROCESS_TELEMETRY ]);
2562
+ var hasSetNext = isFunction(plugin[_DYN_SET_NEXT_PLUGIN ]);
2563
+ var chainId;
2564
+ if (plugin) {
2565
+ chainId = plugin[_DYN_IDENTIFIER ] + "-" + plugin[STR_PRIORITY ] + "-" + _chainId++;
2667
2566
  }
2668
- if (strContains(userAgent, "CPU iPhone OS 12") || strContains(userAgent, "iPad; CPU OS 12")) {
2669
- return true;
2567
+ else {
2568
+ chainId = "Unknown-0-" + _chainId++;
2670
2569
  }
2671
- if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strContains(userAgent, "Version/") && strContains(userAgent, "Safari")) {
2672
- return true;
2570
+ var proxyChain = {
2571
+ getPlugin: function () {
2572
+ return plugin;
2573
+ },
2574
+ getNext: function () {
2575
+ return nextProxy;
2576
+ },
2577
+ processTelemetry: _processTelemetry,
2578
+ unload: _unloadPlugin,
2579
+ update: _updatePlugin,
2580
+ _id: chainId,
2581
+ _setNext: function (nextPlugin) {
2582
+ nextProxy = nextPlugin;
2583
+ }
2584
+ };
2585
+ function _getTelCtx() {
2586
+ var itemCtx;
2587
+ if (plugin && isFunction(plugin[strGetTelCtx])) {
2588
+ itemCtx = plugin[strGetTelCtx]();
2589
+ }
2590
+ if (!itemCtx) {
2591
+ itemCtx = createProcessTelemetryContext(proxyChain, config, core);
2592
+ }
2593
+ return itemCtx;
2673
2594
  }
2674
- if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strEndsWith(userAgent, "AppleWebKit/605.1.15 (KHTML, like Gecko)")) {
2675
- return true;
2595
+ function _processChain(itemCtx, processPluginFn, name, details, isAsync) {
2596
+ var hasRun = false;
2597
+ var identifier = plugin ? plugin[_DYN_IDENTIFIER ] : strTelemetryPluginChain;
2598
+ var hasRunContext = itemCtx[strHasRunFlags];
2599
+ if (!hasRunContext) {
2600
+ hasRunContext = itemCtx[strHasRunFlags] = {};
2601
+ }
2602
+ itemCtx.setNext(nextProxy);
2603
+ if (plugin) {
2604
+ doPerf(itemCtx[STR_CORE ](), function () { return identifier + ":" + name; }, function () {
2605
+ hasRunContext[chainId] = true;
2606
+ try {
2607
+ var nextId = nextProxy ? nextProxy._id : STR_EMPTY;
2608
+ if (nextId) {
2609
+ hasRunContext[nextId] = false;
2610
+ }
2611
+ hasRun = processPluginFn(itemCtx);
2612
+ }
2613
+ catch (error) {
2614
+ var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;
2615
+ if (hasNextRun) {
2616
+ hasRun = true;
2617
+ }
2618
+ if (!nextProxy || !hasNextRun) {
2619
+ _throwInternal(itemCtx[_DYN_DIAG_LOG ](), 1 , 73 , "Plugin [" + identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
2620
+ }
2621
+ }
2622
+ }, details, isAsync);
2623
+ }
2624
+ return hasRun;
2676
2625
  }
2677
- if (strContains(userAgent, "Chrome/5") || strContains(userAgent, "Chrome/6")) {
2678
- return true;
2626
+ function _processTelemetry(env, itemCtx) {
2627
+ itemCtx = itemCtx || _getTelCtx();
2628
+ function _callProcessTelemetry(itemCtx) {
2629
+ if (!plugin || !hasProcessTelemetry) {
2630
+ return false;
2631
+ }
2632
+ var pluginState = _getPluginState(plugin);
2633
+ if (pluginState[_DYN_TEARDOWN ] || pluginState[STR_DISABLED]) {
2634
+ return false;
2635
+ }
2636
+ if (hasSetNext) {
2637
+ plugin[_DYN_SET_NEXT_PLUGIN ](nextProxy);
2638
+ }
2639
+ plugin[STR_PROCESS_TELEMETRY ](env, itemCtx);
2640
+ return true;
2641
+ }
2642
+ if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
2643
+ itemCtx[_DYN_PROCESS_NEXT ](env);
2644
+ }
2679
2645
  }
2680
- if (strContains(userAgent, "UnrealEngine") && !strContains(userAgent, "Chrome")) {
2681
- return true;
2646
+ function _unloadPlugin(unloadCtx, unloadState) {
2647
+ function _callTeardown() {
2648
+ var hasRun = false;
2649
+ if (plugin) {
2650
+ var pluginState = _getPluginState(plugin);
2651
+ var pluginCore = plugin[STR_CORE] || pluginState[STR_CORE ];
2652
+ if (plugin && (!pluginCore || pluginCore === unloadCtx.core()) && !pluginState[_DYN_TEARDOWN ]) {
2653
+ pluginState[STR_CORE ] = null;
2654
+ pluginState[_DYN_TEARDOWN ] = true;
2655
+ pluginState[_DYN_IS_INITIALIZED ] = false;
2656
+ if (plugin[_DYN_TEARDOWN ] && plugin[_DYN_TEARDOWN ](unloadCtx, unloadState) === true) {
2657
+ hasRun = true;
2658
+ }
2659
+ }
2660
+ }
2661
+ return hasRun;
2662
+ }
2663
+ if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState[_DYN_IS_ASYNC ])) {
2664
+ unloadCtx[_DYN_PROCESS_NEXT ](unloadState);
2665
+ }
2682
2666
  }
2683
- if (strContains(userAgent, "UCBrowser/12") || strContains(userAgent, "UCBrowser/11")) {
2684
- return true;
2667
+ function _updatePlugin(updateCtx, updateState) {
2668
+ function _callUpdate() {
2669
+ var hasRun = false;
2670
+ if (plugin) {
2671
+ var pluginState = _getPluginState(plugin);
2672
+ var pluginCore = plugin[STR_CORE] || pluginState[STR_CORE ];
2673
+ if (plugin && (!pluginCore || pluginCore === updateCtx.core()) && !pluginState[_DYN_TEARDOWN ]) {
2674
+ if (plugin[_DYN_UPDATE$1 ] && plugin[_DYN_UPDATE$1 ](updateCtx, updateState) === true) {
2675
+ hasRun = true;
2676
+ }
2677
+ }
2678
+ }
2679
+ return hasRun;
2680
+ }
2681
+ if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
2682
+ updateCtx[_DYN_PROCESS_NEXT ](updateState);
2683
+ }
2685
2684
  }
2686
- return false;
2685
+ return objFreeze(proxyChain);
2687
2686
  }
2688
2687
 
2689
2688
  function createUnloadHandlerContainer() {