}` to the\r\n * native Fetch API.\r\n *\r\n * Visible for testing.\r\n */\n CachingClient.prototype.isCachedDataFresh = function (cacheMaxAgeMillis, lastSuccessfulFetchTimestampMillis) {\n // Cache can only be fresh if it's populated.\n if (!lastSuccessfulFetchTimestampMillis) {\n this.logger.debug('Config fetch cache check. Cache unpopulated.');\n return false;\n }\n // Calculates age of cache entry.\n var cacheAgeMillis = Date.now() - lastSuccessfulFetchTimestampMillis;\n var isCachedDataFresh = cacheAgeMillis <= cacheMaxAgeMillis;\n this.logger.debug('Config fetch cache check.' + (\" Cache age millis: \" + cacheAgeMillis + \".\") + (\" Cache max age millis (minimumFetchIntervalMillis setting): \" + cacheMaxAgeMillis + \".\") + (\" Is cache hit: \" + isCachedDataFresh + \".\"));\n return isCachedDataFresh;\n };\n CachingClient.prototype.fetch = function (request) {\n return tslib.__awaiter(this, void 0, void 0, function () {\n var _a, lastSuccessfulFetchTimestampMillis, lastSuccessfulFetchResponse, response, storageOperations;\n return tslib.__generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n return [4 /*yield*/, Promise.all([this.storage.getLastSuccessfulFetchTimestampMillis(), this.storage.getLastSuccessfulFetchResponse()])];\n case 1:\n _a = _b.sent(), lastSuccessfulFetchTimestampMillis = _a[0], lastSuccessfulFetchResponse = _a[1];\n // Exits early on cache hit.\n if (lastSuccessfulFetchResponse && this.isCachedDataFresh(request.cacheMaxAgeMillis, lastSuccessfulFetchTimestampMillis)) {\n return [2 /*return*/, lastSuccessfulFetchResponse];\n }\n // Deviates from pure decorator by not honoring a passed ETag since we don't have a public API\n // that allows the caller to pass an ETag.\n request.eTag = lastSuccessfulFetchResponse && lastSuccessfulFetchResponse.eTag;\n return [4 /*yield*/, this.client.fetch(request)];\n case 2:\n response = _b.sent();\n storageOperations = [\n // Uses write-through cache for consistency with synchronous public API.\n this.storageCache.setLastSuccessfulFetchTimestampMillis(Date.now())];\n if (response.status === 200) {\n // Caches response only if it has changed, ie non-304 responses.\n storageOperations.push(this.storage.setLastSuccessfulFetchResponse(response));\n }\n return [4 /*yield*/, Promise.all(storageOperations)];\n case 3:\n _b.sent();\n return [2 /*return*/, response];\n }\n });\n });\n };\n return CachingClient;\n}();\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nvar _a;\nvar ERROR_DESCRIPTION_MAP = (_a = {}, _a[\"registration-window\" /* REGISTRATION_WINDOW */] = 'Undefined window object. This SDK only supports usage in a browser environment.', _a[\"registration-project-id\" /* REGISTRATION_PROJECT_ID */] = 'Undefined project identifier. Check Firebase app initialization.', _a[\"registration-api-key\" /* REGISTRATION_API_KEY */] = 'Undefined API key. Check Firebase app initialization.', _a[\"registration-app-id\" /* REGISTRATION_APP_ID */] = 'Undefined app identifier. Check Firebase app initialization.', _a[\"storage-open\" /* STORAGE_OPEN */] = 'Error thrown when opening storage. Original error: {$originalErrorMessage}.', _a[\"storage-get\" /* STORAGE_GET */] = 'Error thrown when reading from storage. Original error: {$originalErrorMessage}.', _a[\"storage-set\" /* STORAGE_SET */] = 'Error thrown when writing to storage. Original error: {$originalErrorMessage}.', _a[\"storage-delete\" /* STORAGE_DELETE */] = 'Error thrown when deleting from storage. Original error: {$originalErrorMessage}.', _a[\"fetch-client-network\" /* FETCH_NETWORK */] = 'Fetch client failed to connect to a network. Check Internet connection.' + ' Original error: {$originalErrorMessage}.', _a[\"fetch-timeout\" /* FETCH_TIMEOUT */] = 'The config fetch request timed out. ' + ' Configure timeout using \"fetchTimeoutMillis\" SDK setting.', _a[\"fetch-throttle\" /* FETCH_THROTTLE */] = 'The config fetch request timed out while in an exponential backoff state.' + ' Configure timeout using \"fetchTimeoutMillis\" SDK setting.' + ' Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.', _a[\"fetch-client-parse\" /* FETCH_PARSE */] = 'Fetch client could not parse response.' + ' Original error: {$originalErrorMessage}.', _a[\"fetch-status\" /* FETCH_STATUS */] = 'Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.', _a);\nvar ERROR_FACTORY = new util.ErrorFactory('remoteconfig' /* service */, 'Remote Config' /* service name */, ERROR_DESCRIPTION_MAP);\n// Note how this is like typeof/instanceof, but for ErrorCode.\nfunction hasErrorCode(e, errorCode) {\n return e instanceof util.FirebaseError && e.code.indexOf(errorCode) !== -1;\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Attempts to get the most accurate browser language setting.\r\n *\r\n *
Adapted from getUserLanguage in packages/auth/src/utils.js for TypeScript.\r\n *\r\n *
Defers default language specification to server logic for consistency.\r\n *\r\n * @param navigatorLanguage Enables tests to override read-only {@link NavigatorLanguage}.\r\n */\nfunction getUserLanguage(navigatorLanguage) {\n if (navigatorLanguage === void 0) {\n navigatorLanguage = navigator;\n }\n return (\n // Most reliable, but only supported in Chrome/Firefox.\n navigatorLanguage.languages && navigatorLanguage.languages[0] ||\n // Supported in most browsers, but returns the language of the browser\n // UI, not the language set in browser settings.\n navigatorLanguage.language\n // Polyfill otherwise.\n );\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Implements the Client abstraction for the Remote Config REST API.\r\n */\nvar RestClient = /** @class */function () {\n function RestClient(firebaseInstallations, sdkVersion, namespace, projectId, apiKey, appId) {\n this.firebaseInstallations = firebaseInstallations;\n this.sdkVersion = sdkVersion;\n this.namespace = namespace;\n this.projectId = projectId;\n this.apiKey = apiKey;\n this.appId = appId;\n }\n /**\r\n * Fetches from the Remote Config REST API.\r\n *\r\n * @throws a {@link ErrorCode.FETCH_NETWORK} error if {@link GlobalFetch#fetch} can't\r\n * connect to the network.\r\n * @throws a {@link ErrorCode.FETCH_PARSE} error if {@link Response#json} can't parse the\r\n * fetch response.\r\n * @throws a {@link ErrorCode.FETCH_STATUS} error if the service returns an HTTP error status.\r\n */\n RestClient.prototype.fetch = function (request) {\n return tslib.__awaiter(this, void 0, void 0, function () {\n var _a, installationId, installationToken, urlBase, url, headers, requestBody, options, fetchPromise, timeoutPromise, response, originalError_1, errorCode, status, responseEtag, config, state, responseBody, originalError_2;\n return tslib.__generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n return [4 /*yield*/, Promise.all([this.firebaseInstallations.getId(), this.firebaseInstallations.getToken()])];\n case 1:\n _a = _b.sent(), installationId = _a[0], installationToken = _a[1];\n urlBase = window.FIREBASE_REMOTE_CONFIG_URL_BASE || 'https://firebaseremoteconfig.googleapis.com';\n url = urlBase + \"/v1/projects/\" + this.projectId + \"/namespaces/\" + this.namespace + \":fetch?key=\" + this.apiKey;\n headers = {\n 'Content-Type': 'application/json',\n 'Content-Encoding': 'gzip',\n // Deviates from pure decorator by not passing max-age header since we don't currently have\n // service behavior using that header.\n 'If-None-Match': request.eTag || '*'\n };\n requestBody = {\n /* eslint-disable camelcase */\n sdk_version: this.sdkVersion,\n app_instance_id: installationId,\n app_instance_id_token: installationToken,\n app_id: this.appId,\n language_code: getUserLanguage()\n /* eslint-enable camelcase */\n };\n\n options = {\n method: 'POST',\n headers: headers,\n body: JSON.stringify(requestBody)\n };\n fetchPromise = fetch(url, options);\n timeoutPromise = new Promise(function (_resolve, reject) {\n // Maps async event listener to Promise API.\n request.signal.addEventListener(function () {\n // Emulates https://heycam.github.io/webidl/#aborterror\n var error = new Error('The operation was aborted.');\n error.name = 'AbortError';\n reject(error);\n });\n });\n _b.label = 2;\n case 2:\n _b.trys.push([2, 5,, 6]);\n return [4 /*yield*/, Promise.race([fetchPromise, timeoutPromise])];\n case 3:\n _b.sent();\n return [4 /*yield*/, fetchPromise];\n case 4:\n response = _b.sent();\n return [3 /*break*/, 6];\n case 5:\n originalError_1 = _b.sent();\n errorCode = \"fetch-client-network\" /* FETCH_NETWORK */;\n if (originalError_1.name === 'AbortError') {\n errorCode = \"fetch-timeout\" /* FETCH_TIMEOUT */;\n }\n\n throw ERROR_FACTORY.create(errorCode, {\n originalErrorMessage: originalError_1.message\n });\n case 6:\n status = response.status;\n responseEtag = response.headers.get('ETag') || undefined;\n if (!(response.status === 200)) return [3 /*break*/, 11];\n responseBody = void 0;\n _b.label = 7;\n case 7:\n _b.trys.push([7, 9,, 10]);\n return [4 /*yield*/, response.json()];\n case 8:\n responseBody = _b.sent();\n return [3 /*break*/, 10];\n case 9:\n originalError_2 = _b.sent();\n throw ERROR_FACTORY.create(\"fetch-client-parse\" /* FETCH_PARSE */, {\n originalErrorMessage: originalError_2.message\n });\n case 10:\n config = responseBody['entries'];\n state = responseBody['state'];\n _b.label = 11;\n case 11:\n // Normalizes based on legacy state.\n if (state === 'INSTANCE_STATE_UNSPECIFIED') {\n status = 500;\n } else if (state === 'NO_CHANGE') {\n status = 304;\n } else if (state === 'NO_TEMPLATE' || state === 'EMPTY_CONFIG') {\n // These cases can be fixed remotely, so normalize to safe value.\n config = {};\n }\n // Normalize to exception-based control flow for non-success cases.\n // Encapsulates HTTP specifics in this class as much as possible. Status is still the best for\n // differentiating success states (200 from 304; the state body param is undefined in a\n // standard 304).\n if (status !== 304 && status !== 200) {\n throw ERROR_FACTORY.create(\"fetch-status\" /* FETCH_STATUS */, {\n httpStatus: status\n });\n }\n return [2 /*return*/, {\n status: status,\n eTag: responseEtag,\n config: config\n }];\n }\n });\n });\n };\n return RestClient;\n}();\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Shims a minimal AbortSignal.\r\n *\r\n *
AbortController's AbortSignal conveniently decouples fetch timeout logic from other aspects\r\n * of networking, such as retries. Firebase doesn't use AbortController enough to justify a\r\n * polyfill recommendation, like we do with the Fetch API, but this minimal shim can easily be\r\n * swapped out if/when we do.\r\n */\nvar RemoteConfigAbortSignal = /** @class */function () {\n function RemoteConfigAbortSignal() {\n this.listeners = [];\n }\n RemoteConfigAbortSignal.prototype.addEventListener = function (listener) {\n this.listeners.push(listener);\n };\n RemoteConfigAbortSignal.prototype.abort = function () {\n this.listeners.forEach(function (listener) {\n return listener();\n });\n };\n return RemoteConfigAbortSignal;\n}();\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nvar DEFAULT_VALUE_FOR_BOOLEAN = false;\nvar DEFAULT_VALUE_FOR_STRING = '';\nvar DEFAULT_VALUE_FOR_NUMBER = 0;\nvar BOOLEAN_TRUTHY_VALUES = ['1', 'true', 't', 'yes', 'y', 'on'];\nvar Value = /** @class */function () {\n function Value(_source, _value) {\n if (_value === void 0) {\n _value = DEFAULT_VALUE_FOR_STRING;\n }\n this._source = _source;\n this._value = _value;\n }\n Value.prototype.asString = function () {\n return this._value;\n };\n Value.prototype.asBoolean = function () {\n if (this._source === 'static') {\n return DEFAULT_VALUE_FOR_BOOLEAN;\n }\n return BOOLEAN_TRUTHY_VALUES.indexOf(this._value.toLowerCase()) >= 0;\n };\n Value.prototype.asNumber = function () {\n if (this._source === 'static') {\n return DEFAULT_VALUE_FOR_NUMBER;\n }\n var num = Number(this._value);\n if (isNaN(num)) {\n num = DEFAULT_VALUE_FOR_NUMBER;\n }\n return num;\n };\n Value.prototype.getSource = function () {\n return this._source;\n };\n return Value;\n}();\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nvar DEFAULT_FETCH_TIMEOUT_MILLIS = 60 * 1000; // One minute\nvar DEFAULT_CACHE_MAX_AGE_MILLIS = 12 * 60 * 60 * 1000; // Twelve hours.\n/**\r\n * Encapsulates business logic mapping network and storage dependencies to the public SDK API.\r\n *\r\n * See {@link https://github.com/FirebasePrivate/firebase-js-sdk/blob/master/packages/firebase/index.d.ts|interface documentation} for method descriptions.\r\n */\nvar RemoteConfig = /** @class */function () {\n function RemoteConfig(\n // Required by FirebaseServiceFactory interface.\n app,\n // JS doesn't support private yet\n // (https://github.com/tc39/proposal-class-fields#private-fields), so we hint using an\n // underscore prefix.\n _client, _storageCache, _storage, _logger) {\n this.app = app;\n this._client = _client;\n this._storageCache = _storageCache;\n this._storage = _storage;\n this._logger = _logger;\n // Tracks completion of initialization promise.\n this._isInitializationComplete = false;\n this.settings = {\n fetchTimeoutMillis: DEFAULT_FETCH_TIMEOUT_MILLIS,\n minimumFetchIntervalMillis: DEFAULT_CACHE_MAX_AGE_MILLIS\n };\n this.defaultConfig = {};\n }\n // Based on packages/firestore/src/util/log.ts but not static because we need per-instance levels\n // to differentiate 2p and 3p use-cases.\n RemoteConfig.prototype.setLogLevel = function (logLevel) {\n switch (logLevel) {\n case 'debug':\n this._logger.logLevel = logger.LogLevel.DEBUG;\n break;\n case 'silent':\n this._logger.logLevel = logger.LogLevel.SILENT;\n break;\n default:\n this._logger.logLevel = logger.LogLevel.ERROR;\n }\n };\n Object.defineProperty(RemoteConfig.prototype, \"fetchTimeMillis\", {\n get: function () {\n return this._storageCache.getLastSuccessfulFetchTimestampMillis() || -1;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(RemoteConfig.prototype, \"lastFetchStatus\", {\n get: function () {\n return this._storageCache.getLastFetchStatus() || 'no-fetch-yet';\n },\n enumerable: false,\n configurable: true\n });\n RemoteConfig.prototype.activate = function () {\n return tslib.__awaiter(this, void 0, void 0, function () {\n var _a, lastSuccessfulFetchResponse, activeConfigEtag;\n return tslib.__generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n return [4 /*yield*/, Promise.all([this._storage.getLastSuccessfulFetchResponse(), this._storage.getActiveConfigEtag()])];\n case 1:\n _a = _b.sent(), lastSuccessfulFetchResponse = _a[0], activeConfigEtag = _a[1];\n if (!lastSuccessfulFetchResponse || !lastSuccessfulFetchResponse.config || !lastSuccessfulFetchResponse.eTag || lastSuccessfulFetchResponse.eTag === activeConfigEtag) {\n // Either there is no successful fetched config, or is the same as current active\n // config.\n return [2 /*return*/, false];\n }\n return [4 /*yield*/, Promise.all([this._storageCache.setActiveConfig(lastSuccessfulFetchResponse.config), this._storage.setActiveConfigEtag(lastSuccessfulFetchResponse.eTag)])];\n case 2:\n _b.sent();\n return [2 /*return*/, true];\n }\n });\n });\n };\n RemoteConfig.prototype.ensureInitialized = function () {\n var _this = this;\n if (!this._initializePromise) {\n this._initializePromise = this._storageCache.loadFromStorage().then(function () {\n _this._isInitializationComplete = true;\n });\n }\n return this._initializePromise;\n };\n /**\r\n * @throws a {@link ErrorCode.FETCH_CLIENT_TIMEOUT} if the request takes longer than\r\n * {@link Settings.fetchTimeoutInSeconds} or\r\n * {@link DEFAULT_FETCH_TIMEOUT_SECONDS}.\r\n */\n RemoteConfig.prototype.fetch = function () {\n return tslib.__awaiter(this, void 0, void 0, function () {\n var abortSignal, e_1, lastFetchStatus;\n var _this = this;\n return tslib.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n abortSignal = new RemoteConfigAbortSignal();\n setTimeout(function () {\n return tslib.__awaiter(_this, void 0, void 0, function () {\n return tslib.__generator(this, function (_a) {\n // Note a very low delay, eg < 10ms, can elapse before listeners are initialized.\n abortSignal.abort();\n return [2 /*return*/];\n });\n });\n }, this.settings.fetchTimeoutMillis);\n _a.label = 1;\n case 1:\n _a.trys.push([1, 4,, 6]);\n return [4 /*yield*/, this._client.fetch({\n cacheMaxAgeMillis: this.settings.minimumFetchIntervalMillis,\n signal: abortSignal\n })];\n case 2:\n _a.sent();\n return [4 /*yield*/, this._storageCache.setLastFetchStatus('success')];\n case 3:\n _a.sent();\n return [3 /*break*/, 6];\n case 4:\n e_1 = _a.sent();\n lastFetchStatus = hasErrorCode(e_1, \"fetch-throttle\" /* FETCH_THROTTLE */) ? 'throttle' : 'failure';\n return [4 /*yield*/, this._storageCache.setLastFetchStatus(lastFetchStatus)];\n case 5:\n _a.sent();\n throw e_1;\n case 6:\n return [2 /*return*/];\n }\n });\n });\n };\n\n RemoteConfig.prototype.fetchAndActivate = function () {\n return tslib.__awaiter(this, void 0, void 0, function () {\n return tslib.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4 /*yield*/, this.fetch()];\n case 1:\n _a.sent();\n return [2 /*return*/, this.activate()];\n }\n });\n });\n };\n RemoteConfig.prototype.getAll = function () {\n var _this = this;\n return getAllKeys(this._storageCache.getActiveConfig(), this.defaultConfig).reduce(function (allConfigs, key) {\n allConfigs[key] = _this.getValue(key);\n return allConfigs;\n }, {});\n };\n RemoteConfig.prototype.getBoolean = function (key) {\n return this.getValue(key).asBoolean();\n };\n RemoteConfig.prototype.getNumber = function (key) {\n return this.getValue(key).asNumber();\n };\n RemoteConfig.prototype.getString = function (key) {\n return this.getValue(key).asString();\n };\n RemoteConfig.prototype.getValue = function (key) {\n if (!this._isInitializationComplete) {\n this._logger.debug(\"A value was requested for key \\\"\" + key + \"\\\" before SDK initialization completed.\" + ' Await on ensureInitialized if the intent was to get a previously activated value.');\n }\n var activeConfig = this._storageCache.getActiveConfig();\n if (activeConfig && activeConfig[key] !== undefined) {\n return new Value('remote', activeConfig[key]);\n } else if (this.defaultConfig && this.defaultConfig[key] !== undefined) {\n return new Value('default', String(this.defaultConfig[key]));\n }\n this._logger.debug(\"Returning static value for key \\\"\" + key + \"\\\".\" + ' Define a default or remote value if this is unintentional.');\n return new Value('static');\n };\n return RemoteConfig;\n}();\n/**\r\n * Dedupes and returns an array of all the keys of the received objects.\r\n */\nfunction getAllKeys(obj1, obj2) {\n if (obj1 === void 0) {\n obj1 = {};\n }\n if (obj2 === void 0) {\n obj2 = {};\n }\n return Object.keys(tslib.__assign(tslib.__assign({}, obj1), obj2));\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Converts an error event associated with a {@link IDBRequest} to a {@link FirebaseError}.\r\n */\nfunction toFirebaseError(event, errorCode) {\n var originalError = event.target.error || undefined;\n return ERROR_FACTORY.create(errorCode, {\n originalErrorMessage: originalError && originalError.message\n });\n}\n/**\r\n * A general-purpose store keyed by app + namespace + {@link\r\n * ProjectNamespaceKeyFieldValue}.\r\n *\r\n *
The Remote Config SDK can be used with multiple app installations, and each app can interact\r\n * with multiple namespaces, so this store uses app (ID + name) and namespace as common parent keys\r\n * for a set of key-value pairs. See {@link Storage#createCompositeKey}.\r\n *\r\n *
Visible for testing.\r\n */\nvar APP_NAMESPACE_STORE = 'app_namespace_store';\nvar DB_NAME = 'firebase_remote_config';\nvar DB_VERSION = 1;\n// Visible for testing.\nfunction openDatabase() {\n return new Promise(function (resolve, reject) {\n var request = indexedDB.open(DB_NAME, DB_VERSION);\n request.onerror = function (event) {\n reject(toFirebaseError(event, \"storage-open\" /* STORAGE_OPEN */));\n };\n\n request.onsuccess = function (event) {\n resolve(event.target.result);\n };\n request.onupgradeneeded = function (event) {\n var db = event.target.result;\n // We don't use 'break' in this switch statement, the fall-through\n // behavior is what we want, because if there are multiple versions between\n // the old version and the current version, we want ALL the migrations\n // that correspond to those versions to run, not only the last one.\n // eslint-disable-next-line default-case\n switch (event.oldVersion) {\n case 0:\n db.createObjectStore(APP_NAMESPACE_STORE, {\n keyPath: 'compositeKey'\n });\n }\n };\n });\n}\n/**\r\n * Abstracts data persistence.\r\n */\nvar Storage = /** @class */function () {\n /**\r\n * @param appId enables storage segmentation by app (ID + name).\r\n * @param appName enables storage segmentation by app (ID + name).\r\n * @param namespace enables storage segmentation by namespace.\r\n */\n function Storage(appId, appName, namespace, openDbPromise) {\n if (openDbPromise === void 0) {\n openDbPromise = openDatabase();\n }\n this.appId = appId;\n this.appName = appName;\n this.namespace = namespace;\n this.openDbPromise = openDbPromise;\n }\n Storage.prototype.getLastFetchStatus = function () {\n return this.get('last_fetch_status');\n };\n Storage.prototype.setLastFetchStatus = function (status) {\n return this.set('last_fetch_status', status);\n };\n // This is comparable to a cache entry timestamp. If we need to expire other data, we could\n // consider adding timestamp to all storage records and an optional max age arg to getters.\n Storage.prototype.getLastSuccessfulFetchTimestampMillis = function () {\n return this.get('last_successful_fetch_timestamp_millis');\n };\n Storage.prototype.setLastSuccessfulFetchTimestampMillis = function (timestamp) {\n return this.set('last_successful_fetch_timestamp_millis', timestamp);\n };\n Storage.prototype.getLastSuccessfulFetchResponse = function () {\n return this.get('last_successful_fetch_response');\n };\n Storage.prototype.setLastSuccessfulFetchResponse = function (response) {\n return this.set('last_successful_fetch_response', response);\n };\n Storage.prototype.getActiveConfig = function () {\n return this.get('active_config');\n };\n Storage.prototype.setActiveConfig = function (config) {\n return this.set('active_config', config);\n };\n Storage.prototype.getActiveConfigEtag = function () {\n return this.get('active_config_etag');\n };\n Storage.prototype.setActiveConfigEtag = function (etag) {\n return this.set('active_config_etag', etag);\n };\n Storage.prototype.getThrottleMetadata = function () {\n return this.get('throttle_metadata');\n };\n Storage.prototype.setThrottleMetadata = function (metadata) {\n return this.set('throttle_metadata', metadata);\n };\n Storage.prototype.deleteThrottleMetadata = function () {\n return this.delete('throttle_metadata');\n };\n Storage.prototype.get = function (key) {\n return tslib.__awaiter(this, void 0, void 0, function () {\n var db;\n var _this = this;\n return tslib.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4 /*yield*/, this.openDbPromise];\n case 1:\n db = _a.sent();\n return [2 /*return*/, new Promise(function (resolve, reject) {\n var transaction = db.transaction([APP_NAMESPACE_STORE], 'readonly');\n var objectStore = transaction.objectStore(APP_NAMESPACE_STORE);\n var compositeKey = _this.createCompositeKey(key);\n try {\n var request = objectStore.get(compositeKey);\n request.onerror = function (event) {\n reject(toFirebaseError(event, \"storage-get\" /* STORAGE_GET */));\n };\n\n request.onsuccess = function (event) {\n var result = event.target.result;\n if (result) {\n resolve(result.value);\n } else {\n resolve(undefined);\n }\n };\n } catch (e) {\n reject(ERROR_FACTORY.create(\"storage-get\" /* STORAGE_GET */, {\n originalErrorMessage: e && e.message\n }));\n }\n })];\n }\n });\n });\n };\n Storage.prototype.set = function (key, value) {\n return tslib.__awaiter(this, void 0, void 0, function () {\n var db;\n var _this = this;\n return tslib.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4 /*yield*/, this.openDbPromise];\n case 1:\n db = _a.sent();\n return [2 /*return*/, new Promise(function (resolve, reject) {\n var transaction = db.transaction([APP_NAMESPACE_STORE], 'readwrite');\n var objectStore = transaction.objectStore(APP_NAMESPACE_STORE);\n var compositeKey = _this.createCompositeKey(key);\n try {\n var request = objectStore.put({\n compositeKey: compositeKey,\n value: value\n });\n request.onerror = function (event) {\n reject(toFirebaseError(event, \"storage-set\" /* STORAGE_SET */));\n };\n\n request.onsuccess = function () {\n resolve();\n };\n } catch (e) {\n reject(ERROR_FACTORY.create(\"storage-set\" /* STORAGE_SET */, {\n originalErrorMessage: e && e.message\n }));\n }\n })];\n }\n });\n });\n };\n Storage.prototype.delete = function (key) {\n return tslib.__awaiter(this, void 0, void 0, function () {\n var db;\n var _this = this;\n return tslib.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4 /*yield*/, this.openDbPromise];\n case 1:\n db = _a.sent();\n return [2 /*return*/, new Promise(function (resolve, reject) {\n var transaction = db.transaction([APP_NAMESPACE_STORE], 'readwrite');\n var objectStore = transaction.objectStore(APP_NAMESPACE_STORE);\n var compositeKey = _this.createCompositeKey(key);\n try {\n var request = objectStore.delete(compositeKey);\n request.onerror = function (event) {\n reject(toFirebaseError(event, \"storage-delete\" /* STORAGE_DELETE */));\n };\n\n request.onsuccess = function () {\n resolve();\n };\n } catch (e) {\n reject(ERROR_FACTORY.create(\"storage-delete\" /* STORAGE_DELETE */, {\n originalErrorMessage: e && e.message\n }));\n }\n })];\n }\n });\n });\n };\n // Facilitates composite key functionality (which is unsupported in IE).\n Storage.prototype.createCompositeKey = function (key) {\n return [this.appId, this.appName, this.namespace, key].join();\n };\n return Storage;\n}();\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * A memory cache layer over storage to support the SDK's synchronous read requirements.\r\n */\nvar StorageCache = /** @class */function () {\n function StorageCache(storage) {\n this.storage = storage;\n }\n /**\r\n * Memory-only getters\r\n */\n StorageCache.prototype.getLastFetchStatus = function () {\n return this.lastFetchStatus;\n };\n StorageCache.prototype.getLastSuccessfulFetchTimestampMillis = function () {\n return this.lastSuccessfulFetchTimestampMillis;\n };\n StorageCache.prototype.getActiveConfig = function () {\n return this.activeConfig;\n };\n /**\r\n * Read-ahead getter\r\n */\n StorageCache.prototype.loadFromStorage = function () {\n return tslib.__awaiter(this, void 0, void 0, function () {\n var lastFetchStatusPromise, lastSuccessfulFetchTimestampMillisPromise, activeConfigPromise, lastFetchStatus, lastSuccessfulFetchTimestampMillis, activeConfig;\n return tslib.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n lastFetchStatusPromise = this.storage.getLastFetchStatus();\n lastSuccessfulFetchTimestampMillisPromise = this.storage.getLastSuccessfulFetchTimestampMillis();\n activeConfigPromise = this.storage.getActiveConfig();\n return [4 /*yield*/, lastFetchStatusPromise];\n case 1:\n lastFetchStatus = _a.sent();\n if (lastFetchStatus) {\n this.lastFetchStatus = lastFetchStatus;\n }\n return [4 /*yield*/, lastSuccessfulFetchTimestampMillisPromise];\n case 2:\n lastSuccessfulFetchTimestampMillis = _a.sent();\n if (lastSuccessfulFetchTimestampMillis) {\n this.lastSuccessfulFetchTimestampMillis = lastSuccessfulFetchTimestampMillis;\n }\n return [4 /*yield*/, activeConfigPromise];\n case 3:\n activeConfig = _a.sent();\n if (activeConfig) {\n this.activeConfig = activeConfig;\n }\n return [2 /*return*/];\n }\n });\n });\n };\n /**\r\n * Write-through setters\r\n */\n StorageCache.prototype.setLastFetchStatus = function (status) {\n this.lastFetchStatus = status;\n return this.storage.setLastFetchStatus(status);\n };\n StorageCache.prototype.setLastSuccessfulFetchTimestampMillis = function (timestampMillis) {\n this.lastSuccessfulFetchTimestampMillis = timestampMillis;\n return this.storage.setLastSuccessfulFetchTimestampMillis(timestampMillis);\n };\n StorageCache.prototype.setActiveConfig = function (activeConfig) {\n this.activeConfig = activeConfig;\n return this.storage.setActiveConfig(activeConfig);\n };\n return StorageCache;\n}();\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Supports waiting on a backoff by:\r\n *\r\n *
\r\n * Promisifying setTimeout, so we can set a timeout in our Promise chain \r\n * Listening on a signal bus for abort events, just like the Fetch API \r\n * Failing in the same way the Fetch API fails, so timing out a live request and a throttled\r\n * request appear the same. \r\n * \r\n *\r\n * Visible for testing.\r\n */\nfunction setAbortableTimeout(signal, throttleEndTimeMillis) {\n return new Promise(function (resolve, reject) {\n // Derives backoff from given end time, normalizing negative numbers to zero.\n var backoffMillis = Math.max(throttleEndTimeMillis - Date.now(), 0);\n var timeout = setTimeout(resolve, backoffMillis);\n // Adds listener, rather than sets onabort, because signal is a shared object.\n signal.addEventListener(function () {\n clearTimeout(timeout);\n // If the request completes before this timeout, the rejection has no effect.\n reject(ERROR_FACTORY.create(\"fetch-throttle\" /* FETCH_THROTTLE */, {\n throttleEndTimeMillis: throttleEndTimeMillis\n }));\n });\n });\n}\n/**\r\n * Returns true if the {@link Error} indicates a fetch request may succeed later.\r\n */\nfunction isRetriableError(e) {\n if (!(e instanceof util.FirebaseError)) {\n return false;\n }\n // Uses string index defined by ErrorData, which FirebaseError implements.\n var httpStatus = Number(e['httpStatus']);\n return httpStatus === 429 || httpStatus === 500 || httpStatus === 503 || httpStatus === 504;\n}\n/**\r\n * Decorates a Client with retry logic.\r\n *\r\n *
Comparable to CachingClient, but uses backoff logic instead of cache max age and doesn't cache\r\n * responses (because the SDK has no use for error responses).\r\n */\nvar RetryingClient = /** @class */function () {\n function RetryingClient(client, storage) {\n this.client = client;\n this.storage = storage;\n }\n RetryingClient.prototype.fetch = function (request) {\n return tslib.__awaiter(this, void 0, void 0, function () {\n var throttleMetadata;\n return tslib.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4 /*yield*/, this.storage.getThrottleMetadata()];\n case 1:\n throttleMetadata = _a.sent() || {\n backoffCount: 0,\n throttleEndTimeMillis: Date.now()\n };\n return [2 /*return*/, this.attemptFetch(request, throttleMetadata)];\n }\n });\n });\n };\n /**\r\n * A recursive helper for attempting a fetch request repeatedly.\r\n *\r\n * @throws any non-retriable errors.\r\n */\n RetryingClient.prototype.attemptFetch = function (request, _a) {\n var throttleEndTimeMillis = _a.throttleEndTimeMillis,\n backoffCount = _a.backoffCount;\n return tslib.__awaiter(this, void 0, void 0, function () {\n var response, e_1, throttleMetadata;\n return tslib.__generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n // Starts with a (potentially zero) timeout to support resumption from stored state.\n // Ensures the throttle end time is honored if the last attempt timed out.\n // Note the SDK will never make a request if the fetch timeout expires at this point.\n return [4 /*yield*/, setAbortableTimeout(request.signal, throttleEndTimeMillis)];\n case 1:\n // Starts with a (potentially zero) timeout to support resumption from stored state.\n // Ensures the throttle end time is honored if the last attempt timed out.\n // Note the SDK will never make a request if the fetch timeout expires at this point.\n _b.sent();\n _b.label = 2;\n case 2:\n _b.trys.push([2, 5,, 7]);\n return [4 /*yield*/, this.client.fetch(request)];\n case 3:\n response = _b.sent();\n // Note the SDK only clears throttle state if response is success or non-retriable.\n return [4 /*yield*/, this.storage.deleteThrottleMetadata()];\n case 4:\n // Note the SDK only clears throttle state if response is success or non-retriable.\n _b.sent();\n return [2 /*return*/, response];\n case 5:\n e_1 = _b.sent();\n if (!isRetriableError(e_1)) {\n throw e_1;\n }\n throttleMetadata = {\n throttleEndTimeMillis: Date.now() + util.calculateBackoffMillis(backoffCount),\n backoffCount: backoffCount + 1\n };\n // Persists state.\n return [4 /*yield*/, this.storage.setThrottleMetadata(throttleMetadata)];\n case 6:\n // Persists state.\n _b.sent();\n return [2 /*return*/, this.attemptFetch(request, throttleMetadata)];\n case 7:\n return [2 /*return*/];\n }\n });\n });\n };\n\n return RetryingClient;\n}();\nvar name = \"@firebase/remote-config\";\nvar version = \"0.1.28\";\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nfunction registerRemoteConfig(firebaseInstance) {\n firebaseInstance.INTERNAL.registerComponent(new component.Component('remoteConfig', remoteConfigFactory, \"PUBLIC\" /* PUBLIC */).setMultipleInstances(true));\n firebaseInstance.registerVersion(name, version);\n function remoteConfigFactory(container, namespace) {\n /* Dependencies */\n // getImmediate for FirebaseApp will always succeed\n var app = container.getProvider('app').getImmediate();\n // The following call will always succeed because rc has `import '@firebase/installations'`\n var installations = container.getProvider('installations').getImmediate();\n // Guards against the SDK being used in non-browser environments.\n if (typeof window === 'undefined') {\n throw ERROR_FACTORY.create(\"registration-window\" /* REGISTRATION_WINDOW */);\n }\n // Normalizes optional inputs.\n var _a = app.options,\n projectId = _a.projectId,\n apiKey = _a.apiKey,\n appId = _a.appId;\n if (!projectId) {\n throw ERROR_FACTORY.create(\"registration-project-id\" /* REGISTRATION_PROJECT_ID */);\n }\n\n if (!apiKey) {\n throw ERROR_FACTORY.create(\"registration-api-key\" /* REGISTRATION_API_KEY */);\n }\n\n if (!appId) {\n throw ERROR_FACTORY.create(\"registration-app-id\" /* REGISTRATION_APP_ID */);\n }\n\n namespace = namespace || 'firebase';\n var storage = new Storage(appId, app.name, namespace);\n var storageCache = new StorageCache(storage);\n var logger$1 = new logger.Logger(name);\n // Sets ERROR as the default log level.\n // See RemoteConfig#setLogLevel for corresponding normalization to ERROR log level.\n logger$1.logLevel = logger.LogLevel.ERROR;\n var restClient = new RestClient(installations,\n // Uses the JS SDK version, by which the RC package version can be deduced, if necessary.\n firebaseInstance.SDK_VERSION, namespace, projectId, apiKey, appId);\n var retryingClient = new RetryingClient(restClient, storage);\n var cachingClient = new CachingClient(retryingClient, storage, storageCache, logger$1);\n var remoteConfigInstance = new RemoteConfig(app, cachingClient, storageCache, storage, logger$1);\n // Starts warming cache.\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n remoteConfigInstance.ensureInitialized();\n return remoteConfigInstance;\n }\n}\nregisterRemoteConfig(firebase__default['default']);\nexports.registerRemoteConfig = registerRemoteConfig;","import firebase from '@firebase/app';\nimport { __awaiter, __generator, __spreadArrays } from 'tslib';\nimport { Component } from '@firebase/component';\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * @fileoverview Constants used in the Firebase Storage library.\r\n */\n/**\r\n * Domain name for firebase storage.\r\n */\nvar DEFAULT_HOST = 'firebasestorage.googleapis.com';\n/**\r\n * The key in Firebase config json for the storage bucket.\r\n */\nvar CONFIG_STORAGE_BUCKET_KEY = 'storageBucket';\n/**\r\n * 2 minutes\r\n *\r\n * The timeout for all operations except upload.\r\n */\nvar DEFAULT_MAX_OPERATION_RETRY_TIME = 2 * 60 * 1000;\n/**\r\n * 10 minutes\r\n *\r\n * The timeout for upload.\r\n */\nvar DEFAULT_MAX_UPLOAD_RETRY_TIME = 10 * 60 * 1000;\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nvar FirebaseStorageError = /** @class */function () {\n function FirebaseStorageError(code, message) {\n this.code_ = prependCode(code);\n this.message_ = 'Firebase Storage: ' + message;\n this.serverResponse_ = null;\n this.name_ = 'FirebaseError';\n }\n FirebaseStorageError.prototype.codeProp = function () {\n return this.code;\n };\n FirebaseStorageError.prototype.codeEquals = function (code) {\n return prependCode(code) === this.codeProp();\n };\n FirebaseStorageError.prototype.serverResponseProp = function () {\n return this.serverResponse_;\n };\n FirebaseStorageError.prototype.setServerResponseProp = function (serverResponse) {\n this.serverResponse_ = serverResponse;\n };\n Object.defineProperty(FirebaseStorageError.prototype, \"name\", {\n get: function () {\n return this.name_;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(FirebaseStorageError.prototype, \"code\", {\n get: function () {\n return this.code_;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(FirebaseStorageError.prototype, \"message\", {\n get: function () {\n if (this.serverResponse_) {\n return this.message_ + '\\n' + this.serverResponse_;\n } else {\n return this.message_;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(FirebaseStorageError.prototype, \"serverResponse\", {\n get: function () {\n return this.serverResponse_;\n },\n enumerable: false,\n configurable: true\n });\n return FirebaseStorageError;\n}();\nvar Code = {\n // Shared between all platforms\n UNKNOWN: 'unknown',\n OBJECT_NOT_FOUND: 'object-not-found',\n BUCKET_NOT_FOUND: 'bucket-not-found',\n PROJECT_NOT_FOUND: 'project-not-found',\n QUOTA_EXCEEDED: 'quota-exceeded',\n UNAUTHENTICATED: 'unauthenticated',\n UNAUTHORIZED: 'unauthorized',\n RETRY_LIMIT_EXCEEDED: 'retry-limit-exceeded',\n INVALID_CHECKSUM: 'invalid-checksum',\n CANCELED: 'canceled',\n // JS specific\n INVALID_EVENT_NAME: 'invalid-event-name',\n INVALID_URL: 'invalid-url',\n INVALID_DEFAULT_BUCKET: 'invalid-default-bucket',\n NO_DEFAULT_BUCKET: 'no-default-bucket',\n CANNOT_SLICE_BLOB: 'cannot-slice-blob',\n SERVER_FILE_WRONG_SIZE: 'server-file-wrong-size',\n NO_DOWNLOAD_URL: 'no-download-url',\n INVALID_ARGUMENT: 'invalid-argument',\n INVALID_ARGUMENT_COUNT: 'invalid-argument-count',\n APP_DELETED: 'app-deleted',\n INVALID_ROOT_OPERATION: 'invalid-root-operation',\n INVALID_FORMAT: 'invalid-format',\n INTERNAL_ERROR: 'internal-error'\n};\nfunction prependCode(code) {\n return 'storage/' + code;\n}\nfunction unknown() {\n var message = 'An unknown error occurred, please check the error payload for ' + 'server response.';\n return new FirebaseStorageError(Code.UNKNOWN, message);\n}\nfunction objectNotFound(path) {\n return new FirebaseStorageError(Code.OBJECT_NOT_FOUND, \"Object '\" + path + \"' does not exist.\");\n}\nfunction quotaExceeded(bucket) {\n return new FirebaseStorageError(Code.QUOTA_EXCEEDED, \"Quota for bucket '\" + bucket + \"' exceeded, please view quota on \" + 'https://firebase.google.com/pricing/.');\n}\nfunction unauthenticated() {\n var message = 'User is not authenticated, please authenticate using Firebase ' + 'Authentication and try again.';\n return new FirebaseStorageError(Code.UNAUTHENTICATED, message);\n}\nfunction unauthorized(path) {\n return new FirebaseStorageError(Code.UNAUTHORIZED, \"User does not have permission to access '\" + path + \"'.\");\n}\nfunction retryLimitExceeded() {\n return new FirebaseStorageError(Code.RETRY_LIMIT_EXCEEDED, 'Max retry time for operation exceeded, please try again.');\n}\nfunction canceled() {\n return new FirebaseStorageError(Code.CANCELED, 'User canceled the upload/download.');\n}\nfunction invalidUrl(url) {\n return new FirebaseStorageError(Code.INVALID_URL, \"Invalid URL '\" + url + \"'.\");\n}\nfunction invalidDefaultBucket(bucket) {\n return new FirebaseStorageError(Code.INVALID_DEFAULT_BUCKET, \"Invalid default bucket '\" + bucket + \"'.\");\n}\nfunction cannotSliceBlob() {\n return new FirebaseStorageError(Code.CANNOT_SLICE_BLOB, 'Cannot slice blob for upload. Please retry the upload.');\n}\nfunction serverFileWrongSize() {\n return new FirebaseStorageError(Code.SERVER_FILE_WRONG_SIZE, 'Server recorded incorrect upload file size, please retry the upload.');\n}\nfunction noDownloadURL() {\n return new FirebaseStorageError(Code.NO_DOWNLOAD_URL, 'The given file does not have any download URLs.');\n}\nfunction invalidArgument(index, fnName, message) {\n return new FirebaseStorageError(Code.INVALID_ARGUMENT, 'Invalid argument in `' + fnName + '` at index ' + index + ': ' + message);\n}\nfunction invalidArgumentCount(argMin, argMax, fnName, real) {\n var countPart;\n var plural;\n if (argMin === argMax) {\n countPart = argMin;\n plural = argMin === 1 ? 'argument' : 'arguments';\n } else {\n countPart = 'between ' + argMin + ' and ' + argMax;\n plural = 'arguments';\n }\n return new FirebaseStorageError(Code.INVALID_ARGUMENT_COUNT, 'Invalid argument count in `' + fnName + '`: Expected ' + countPart + ' ' + plural + ', received ' + real + '.');\n}\nfunction appDeleted() {\n return new FirebaseStorageError(Code.APP_DELETED, 'The Firebase app was deleted.');\n}\n/**\r\n * @param name The name of the operation that was invalid.\r\n */\nfunction invalidRootOperation(name) {\n return new FirebaseStorageError(Code.INVALID_ROOT_OPERATION, \"The operation '\" + name + \"' cannot be performed on a root reference, create a non-root \" + \"reference using child, such as .child('file.png').\");\n}\n/**\r\n * @param format The format that was not valid.\r\n * @param message A message describing the format violation.\r\n */\nfunction invalidFormat(format, message) {\n return new FirebaseStorageError(Code.INVALID_FORMAT, \"String does not match format '\" + format + \"': \" + message);\n}\n/**\r\n * @param message A message describing the internal error.\r\n */\nfunction internalError(message) {\n throw new FirebaseStorageError(Code.INTERNAL_ERROR, 'Internal error: ' + message);\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nvar StringFormat = {\n RAW: 'raw',\n BASE64: 'base64',\n BASE64URL: 'base64url',\n DATA_URL: 'data_url'\n};\nfunction formatValidator(stringFormat) {\n switch (stringFormat) {\n case StringFormat.RAW:\n case StringFormat.BASE64:\n case StringFormat.BASE64URL:\n case StringFormat.DATA_URL:\n return;\n default:\n throw 'Expected one of the event types: [' + StringFormat.RAW + ', ' + StringFormat.BASE64 + ', ' + StringFormat.BASE64URL + ', ' + StringFormat.DATA_URL + '].';\n }\n}\n/**\r\n * @struct\r\n */\nvar StringData = /** @class */function () {\n function StringData(data, contentType) {\n this.data = data;\n this.contentType = contentType || null;\n }\n return StringData;\n}();\nfunction dataFromString(format, stringData) {\n switch (format) {\n case StringFormat.RAW:\n return new StringData(utf8Bytes_(stringData));\n case StringFormat.BASE64:\n case StringFormat.BASE64URL:\n return new StringData(base64Bytes_(format, stringData));\n case StringFormat.DATA_URL:\n return new StringData(dataURLBytes_(stringData), dataURLContentType_(stringData));\n // do nothing\n }\n // assert(false);\n throw unknown();\n}\nfunction utf8Bytes_(value) {\n var b = [];\n for (var i = 0; i < value.length; i++) {\n var c = value.charCodeAt(i);\n if (c <= 127) {\n b.push(c);\n } else {\n if (c <= 2047) {\n b.push(192 | c >> 6, 128 | c & 63);\n } else {\n if ((c & 64512) === 55296) {\n // The start of a surrogate pair.\n var valid = i < value.length - 1 && (value.charCodeAt(i + 1) & 64512) === 56320;\n if (!valid) {\n // The second surrogate wasn't there.\n b.push(239, 191, 189);\n } else {\n var hi = c;\n var lo = value.charCodeAt(++i);\n c = 65536 | (hi & 1023) << 10 | lo & 1023;\n b.push(240 | c >> 18, 128 | c >> 12 & 63, 128 | c >> 6 & 63, 128 | c & 63);\n }\n } else {\n if ((c & 64512) === 56320) {\n // Invalid low surrogate.\n b.push(239, 191, 189);\n } else {\n b.push(224 | c >> 12, 128 | c >> 6 & 63, 128 | c & 63);\n }\n }\n }\n }\n }\n return new Uint8Array(b);\n}\nfunction percentEncodedBytes_(value) {\n var decoded;\n try {\n decoded = decodeURIComponent(value);\n } catch (e) {\n throw invalidFormat(StringFormat.DATA_URL, 'Malformed data URL.');\n }\n return utf8Bytes_(decoded);\n}\nfunction base64Bytes_(format, value) {\n switch (format) {\n case StringFormat.BASE64:\n {\n var hasMinus = value.indexOf('-') !== -1;\n var hasUnder = value.indexOf('_') !== -1;\n if (hasMinus || hasUnder) {\n var invalidChar = hasMinus ? '-' : '_';\n throw invalidFormat(format, \"Invalid character '\" + invalidChar + \"' found: is it base64url encoded?\");\n }\n break;\n }\n case StringFormat.BASE64URL:\n {\n var hasPlus = value.indexOf('+') !== -1;\n var hasSlash = value.indexOf('/') !== -1;\n if (hasPlus || hasSlash) {\n var invalidChar = hasPlus ? '+' : '/';\n throw invalidFormat(format, \"Invalid character '\" + invalidChar + \"' found: is it base64 encoded?\");\n }\n value = value.replace(/-/g, '+').replace(/_/g, '/');\n break;\n }\n // do nothing\n }\n\n var bytes;\n try {\n bytes = atob(value);\n } catch (e) {\n throw invalidFormat(format, 'Invalid character found');\n }\n var array = new Uint8Array(bytes.length);\n for (var i = 0; i < bytes.length; i++) {\n array[i] = bytes.charCodeAt(i);\n }\n return array;\n}\n/**\r\n * @struct\r\n */\nvar DataURLParts = /** @class */function () {\n function DataURLParts(dataURL) {\n this.base64 = false;\n this.contentType = null;\n var matches = dataURL.match(/^data:([^,]+)?,/);\n if (matches === null) {\n throw invalidFormat(StringFormat.DATA_URL, \"Must be formatted 'data:[][;base64],\");\n }\n var middle = matches[1] || null;\n if (middle != null) {\n this.base64 = endsWith(middle, ';base64');\n this.contentType = this.base64 ? middle.substring(0, middle.length - ';base64'.length) : middle;\n }\n this.rest = dataURL.substring(dataURL.indexOf(',') + 1);\n }\n return DataURLParts;\n}();\nfunction dataURLBytes_(dataUrl) {\n var parts = new DataURLParts(dataUrl);\n if (parts.base64) {\n return base64Bytes_(StringFormat.BASE64, parts.rest);\n } else {\n return percentEncodedBytes_(parts.rest);\n }\n}\nfunction dataURLContentType_(dataUrl) {\n var parts = new DataURLParts(dataUrl);\n return parts.contentType;\n}\nfunction endsWith(s, end) {\n var longEnough = s.length >= end.length;\n if (!longEnough) {\n return false;\n }\n return s.substring(s.length - end.length) === end;\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nvar TaskEvent = {\n /** Triggered whenever the task changes or progress is updated. */\n STATE_CHANGED: 'state_changed'\n};\nvar InternalTaskState = {\n RUNNING: 'running',\n PAUSING: 'pausing',\n PAUSED: 'paused',\n SUCCESS: 'success',\n CANCELING: 'canceling',\n CANCELED: 'canceled',\n ERROR: 'error'\n};\nvar TaskState = {\n /** The task is currently transferring data. */\n RUNNING: 'running',\n /** The task was paused by the user. */\n PAUSED: 'paused',\n /** The task completed successfully. */\n SUCCESS: 'success',\n /** The task was canceled. */\n CANCELED: 'canceled',\n /** The task failed with an error. */\n ERROR: 'error'\n};\nfunction taskStateFromInternalTaskState(state) {\n switch (state) {\n case InternalTaskState.RUNNING:\n case InternalTaskState.PAUSING:\n case InternalTaskState.CANCELING:\n return TaskState.RUNNING;\n case InternalTaskState.PAUSED:\n return TaskState.PAUSED;\n case InternalTaskState.SUCCESS:\n return TaskState.SUCCESS;\n case InternalTaskState.CANCELED:\n return TaskState.CANCELED;\n case InternalTaskState.ERROR:\n return TaskState.ERROR;\n default:\n // TODO(andysoto): assert(false);\n return TaskState.ERROR;\n }\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * @return False if the object is undefined or null, true otherwise.\r\n */\nfunction isDef(p) {\n return p != null;\n}\nfunction isJustDef(p) {\n return p !== void 0;\n}\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction isFunction(p) {\n return typeof p === 'function';\n}\nfunction isObject(p) {\n return typeof p === 'object';\n}\nfunction isNonNullObject(p) {\n return isObject(p) && p !== null;\n}\nfunction isNonArrayObject(p) {\n return isObject(p) && !Array.isArray(p);\n}\nfunction isString(p) {\n return typeof p === 'string' || p instanceof String;\n}\nfunction isInteger(p) {\n return isNumber(p) && Number.isInteger(p);\n}\nfunction isNumber(p) {\n return typeof p === 'number' || p instanceof Number;\n}\nfunction isNativeBlob(p) {\n return isNativeBlobDefined() && p instanceof Blob;\n}\nfunction isNativeBlobDefined() {\n return typeof Blob !== 'undefined';\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * @enum{number}\r\n */\nvar ErrorCode;\n(function (ErrorCode) {\n ErrorCode[ErrorCode[\"NO_ERROR\"] = 0] = \"NO_ERROR\";\n ErrorCode[ErrorCode[\"NETWORK_ERROR\"] = 1] = \"NETWORK_ERROR\";\n ErrorCode[ErrorCode[\"ABORT\"] = 2] = \"ABORT\";\n})(ErrorCode || (ErrorCode = {}));\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * We use this instead of goog.net.XhrIo because goog.net.XhrIo is hyuuuuge and\r\n * doesn't work in React Native on Android.\r\n */\nvar NetworkXhrIo = /** @class */function () {\n function NetworkXhrIo() {\n var _this = this;\n this.sent_ = false;\n this.xhr_ = new XMLHttpRequest();\n this.errorCode_ = ErrorCode.NO_ERROR;\n this.sendPromise_ = new Promise(function (resolve) {\n _this.xhr_.addEventListener('abort', function () {\n _this.errorCode_ = ErrorCode.ABORT;\n resolve(_this);\n });\n _this.xhr_.addEventListener('error', function () {\n _this.errorCode_ = ErrorCode.NETWORK_ERROR;\n resolve(_this);\n });\n _this.xhr_.addEventListener('load', function () {\n resolve(_this);\n });\n });\n }\n /**\r\n * @override\r\n */\n NetworkXhrIo.prototype.send = function (url, method, body, headers) {\n if (this.sent_) {\n throw internalError('cannot .send() more than once');\n }\n this.sent_ = true;\n this.xhr_.open(method, url, true);\n if (isDef(headers)) {\n for (var key in headers) {\n if (headers.hasOwnProperty(key)) {\n this.xhr_.setRequestHeader(key, headers[key].toString());\n }\n }\n }\n if (isDef(body)) {\n this.xhr_.send(body);\n } else {\n this.xhr_.send();\n }\n return this.sendPromise_;\n };\n /**\r\n * @override\r\n */\n NetworkXhrIo.prototype.getErrorCode = function () {\n if (!this.sent_) {\n throw internalError('cannot .getErrorCode() before sending');\n }\n return this.errorCode_;\n };\n /**\r\n * @override\r\n */\n NetworkXhrIo.prototype.getStatus = function () {\n if (!this.sent_) {\n throw internalError('cannot .getStatus() before sending');\n }\n try {\n return this.xhr_.status;\n } catch (e) {\n return -1;\n }\n };\n /**\r\n * @override\r\n */\n NetworkXhrIo.prototype.getResponseText = function () {\n if (!this.sent_) {\n throw internalError('cannot .getResponseText() before sending');\n }\n return this.xhr_.responseText;\n };\n /**\r\n * Aborts the request.\r\n * @override\r\n */\n NetworkXhrIo.prototype.abort = function () {\n this.xhr_.abort();\n };\n /**\r\n * @override\r\n */\n NetworkXhrIo.prototype.getResponseHeader = function (header) {\n return this.xhr_.getResponseHeader(header);\n };\n /**\r\n * @override\r\n */\n NetworkXhrIo.prototype.addUploadProgressListener = function (listener) {\n if (isDef(this.xhr_.upload)) {\n this.xhr_.upload.addEventListener('progress', listener);\n }\n };\n /**\r\n * @override\r\n */\n NetworkXhrIo.prototype.removeUploadProgressListener = function (listener) {\n if (isDef(this.xhr_.upload)) {\n this.xhr_.upload.removeEventListener('progress', listener);\n }\n };\n return NetworkXhrIo;\n}();\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Factory-like class for creating XhrIo instances.\r\n */\nvar XhrIoPool = /** @class */function () {\n function XhrIoPool() {}\n XhrIoPool.prototype.createXhrIo = function () {\n return new NetworkXhrIo();\n };\n return XhrIoPool;\n}();\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nfunction getBlobBuilder() {\n if (typeof BlobBuilder !== 'undefined') {\n return BlobBuilder;\n } else if (typeof WebKitBlobBuilder !== 'undefined') {\n return WebKitBlobBuilder;\n } else {\n return undefined;\n }\n}\n/**\r\n * Concatenates one or more values together and converts them to a Blob.\r\n *\r\n * @param args The values that will make up the resulting blob.\r\n * @return The blob.\r\n */\nfunction getBlob() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var BlobBuilder = getBlobBuilder();\n if (BlobBuilder !== undefined) {\n var bb = new BlobBuilder();\n for (var i = 0; i < args.length; i++) {\n bb.append(args[i]);\n }\n return bb.getBlob();\n } else {\n if (isNativeBlobDefined()) {\n return new Blob(args);\n } else {\n throw Error(\"This browser doesn't seem to support creating Blobs\");\n }\n }\n}\n/**\r\n * Slices the blob. The returned blob contains data from the start byte\r\n * (inclusive) till the end byte (exclusive). Negative indices cannot be used.\r\n *\r\n * @param blob The blob to be sliced.\r\n * @param start Index of the starting byte.\r\n * @param end Index of the ending byte.\r\n * @return The blob slice or null if not supported.\r\n */\nfunction sliceBlob(blob, start, end) {\n if (blob.webkitSlice) {\n return blob.webkitSlice(start, end);\n } else if (blob.mozSlice) {\n return blob.mozSlice(start, end);\n } else if (blob.slice) {\n return blob.slice(start, end);\n }\n return null;\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * @param opt_elideCopy If true, doesn't copy mutable input data\r\n * (e.g. Uint8Arrays). Pass true only if you know the objects will not be\r\n * modified after this blob's construction.\r\n */\nvar FbsBlob = /** @class */function () {\n function FbsBlob(data, elideCopy) {\n var size = 0;\n var blobType = '';\n if (isNativeBlob(data)) {\n this.data_ = data;\n size = data.size;\n blobType = data.type;\n } else if (data instanceof ArrayBuffer) {\n if (elideCopy) {\n this.data_ = new Uint8Array(data);\n } else {\n this.data_ = new Uint8Array(data.byteLength);\n this.data_.set(new Uint8Array(data));\n }\n size = this.data_.length;\n } else if (data instanceof Uint8Array) {\n if (elideCopy) {\n this.data_ = data;\n } else {\n this.data_ = new Uint8Array(data.length);\n this.data_.set(data);\n }\n size = data.length;\n }\n this.size_ = size;\n this.type_ = blobType;\n }\n FbsBlob.prototype.size = function () {\n return this.size_;\n };\n FbsBlob.prototype.type = function () {\n return this.type_;\n };\n FbsBlob.prototype.slice = function (startByte, endByte) {\n if (isNativeBlob(this.data_)) {\n var realBlob = this.data_;\n var sliced = sliceBlob(realBlob, startByte, endByte);\n if (sliced === null) {\n return null;\n }\n return new FbsBlob(sliced);\n } else {\n var slice = new Uint8Array(this.data_.buffer, startByte, endByte - startByte);\n return new FbsBlob(slice, true);\n }\n };\n FbsBlob.getBlob = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (isNativeBlobDefined()) {\n var blobby = args.map(function (val) {\n if (val instanceof FbsBlob) {\n return val.data_;\n } else {\n return val;\n }\n });\n return new FbsBlob(getBlob.apply(null, blobby));\n } else {\n var uint8Arrays = args.map(function (val) {\n if (isString(val)) {\n return dataFromString(StringFormat.RAW, val).data;\n } else {\n // Blobs don't exist, so this has to be a Uint8Array.\n return val.data_;\n }\n });\n var finalLength_1 = 0;\n uint8Arrays.forEach(function (array) {\n finalLength_1 += array.byteLength;\n });\n var merged_1 = new Uint8Array(finalLength_1);\n var index_1 = 0;\n uint8Arrays.forEach(function (array) {\n for (var i = 0; i < array.length; i++) {\n merged_1[index_1++] = array[i];\n }\n });\n return new FbsBlob(merged_1, true);\n }\n };\n FbsBlob.prototype.uploadData = function () {\n return this.data_;\n };\n return FbsBlob;\n}();\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * @struct\r\n */\nvar Location = /** @class */function () {\n function Location(bucket, path) {\n this.bucket = bucket;\n this.path_ = path;\n }\n Object.defineProperty(Location.prototype, \"path\", {\n get: function () {\n return this.path_;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Location.prototype, \"isRoot\", {\n get: function () {\n return this.path.length === 0;\n },\n enumerable: false,\n configurable: true\n });\n Location.prototype.fullServerUrl = function () {\n var encode = encodeURIComponent;\n return '/b/' + encode(this.bucket) + '/o/' + encode(this.path);\n };\n Location.prototype.bucketOnlyServerUrl = function () {\n var encode = encodeURIComponent;\n return '/b/' + encode(this.bucket) + '/o';\n };\n Location.makeFromBucketSpec = function (bucketString) {\n var bucketLocation;\n try {\n bucketLocation = Location.makeFromUrl(bucketString);\n } catch (e) {\n // Not valid URL, use as-is. This lets you put bare bucket names in\n // config.\n return new Location(bucketString, '');\n }\n if (bucketLocation.path === '') {\n return bucketLocation;\n } else {\n throw invalidDefaultBucket(bucketString);\n }\n };\n Location.makeFromUrl = function (url) {\n var location = null;\n var bucketDomain = '([A-Za-z0-9.\\\\-_]+)';\n function gsModify(loc) {\n if (loc.path.charAt(loc.path.length - 1) === '/') {\n loc.path_ = loc.path_.slice(0, -1);\n }\n }\n var gsPath = '(/(.*))?$';\n var gsRegex = new RegExp('^gs://' + bucketDomain + gsPath, 'i');\n var gsIndices = {\n bucket: 1,\n path: 3\n };\n function httpModify(loc) {\n loc.path_ = decodeURIComponent(loc.path);\n }\n var version = 'v[A-Za-z0-9_]+';\n var firebaseStorageHost = DEFAULT_HOST.replace(/[.]/g, '\\\\.');\n var firebaseStoragePath = '(/([^?#]*).*)?$';\n var firebaseStorageRegExp = new RegExp(\"^https?://\" + firebaseStorageHost + \"/\" + version + \"/b/\" + bucketDomain + \"/o\" + firebaseStoragePath, 'i');\n var firebaseStorageIndices = {\n bucket: 1,\n path: 3\n };\n var cloudStorageHost = '(?:storage.googleapis.com|storage.cloud.google.com)';\n var cloudStoragePath = '([^?#]*)';\n var cloudStorageRegExp = new RegExp(\"^https?://\" + cloudStorageHost + \"/\" + bucketDomain + \"/\" + cloudStoragePath, 'i');\n var cloudStorageIndices = {\n bucket: 1,\n path: 2\n };\n var groups = [{\n regex: gsRegex,\n indices: gsIndices,\n postModify: gsModify\n }, {\n regex: firebaseStorageRegExp,\n indices: firebaseStorageIndices,\n postModify: httpModify\n }, {\n regex: cloudStorageRegExp,\n indices: cloudStorageIndices,\n postModify: httpModify\n }];\n for (var i = 0; i < groups.length; i++) {\n var group = groups[i];\n var captures = group.regex.exec(url);\n if (captures) {\n var bucketValue = captures[group.indices.bucket];\n var pathValue = captures[group.indices.path];\n if (!pathValue) {\n pathValue = '';\n }\n location = new Location(bucketValue, pathValue);\n group.postModify(location);\n break;\n }\n }\n if (location == null) {\n throw invalidUrl(url);\n }\n return location;\n };\n return Location;\n}();\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Returns the Object resulting from parsing the given JSON, or null if the\r\n * given string does not represent a JSON object.\r\n */\nfunction jsonObjectOrNull(s) {\n var obj;\n try {\n obj = JSON.parse(s);\n } catch (e) {\n return null;\n }\n if (isNonArrayObject(obj)) {\n return obj;\n } else {\n return null;\n }\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * @fileoverview Contains helper methods for manipulating paths.\r\n */\n/**\r\n * @return Null if the path is already at the root.\r\n */\nfunction parent(path) {\n if (path.length === 0) {\n return null;\n }\n var index = path.lastIndexOf('/');\n if (index === -1) {\n return '';\n }\n var newPath = path.slice(0, index);\n return newPath;\n}\nfunction child(path, childPath) {\n var canonicalChildPath = childPath.split('/').filter(function (component) {\n return component.length > 0;\n }).join('/');\n if (path.length === 0) {\n return canonicalChildPath;\n } else {\n return path + '/' + canonicalChildPath;\n }\n}\n/**\r\n * Returns the last component of a path.\r\n * '/foo/bar' -> 'bar'\r\n * '/foo/bar/baz/' -> 'baz/'\r\n * '/a' -> 'a'\r\n */\nfunction lastComponent(path) {\n var index = path.lastIndexOf('/', path.length - 2);\n if (index === -1) {\n return path;\n } else {\n return path.slice(index + 1);\n }\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nfunction makeUrl(urlPart) {\n return \"https://\" + DEFAULT_HOST + \"/v0\" + urlPart;\n}\nfunction makeQueryString(params) {\n var encode = encodeURIComponent;\n var queryPart = '?';\n for (var key in params) {\n if (params.hasOwnProperty(key)) {\n // @ts-ignore TODO: remove once typescript is upgraded to 3.5.x\n var nextPart = encode(key) + '=' + encode(params[key]);\n queryPart = queryPart + nextPart + '&';\n }\n }\n // Chop off the extra '&' or '?' on the end\n queryPart = queryPart.slice(0, -1);\n return queryPart;\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nfunction noXform_(metadata, value) {\n return value;\n}\n/**\r\n * @struct\r\n */\nvar Mapping = /** @class */function () {\n function Mapping(server, local, writable, xform) {\n this.server = server;\n this.local = local || server;\n this.writable = !!writable;\n this.xform = xform || noXform_;\n }\n return Mapping;\n}();\nvar mappings_ = null;\nfunction xformPath(fullPath) {\n if (!isString(fullPath) || fullPath.length < 2) {\n return fullPath;\n } else {\n return lastComponent(fullPath);\n }\n}\nfunction getMappings() {\n if (mappings_) {\n return mappings_;\n }\n var mappings = [];\n mappings.push(new Mapping('bucket'));\n mappings.push(new Mapping('generation'));\n mappings.push(new Mapping('metageneration'));\n mappings.push(new Mapping('name', 'fullPath', true));\n function mappingsXformPath(_metadata, fullPath) {\n return xformPath(fullPath);\n }\n var nameMapping = new Mapping('name');\n nameMapping.xform = mappingsXformPath;\n mappings.push(nameMapping);\n /**\r\n * Coerces the second param to a number, if it is defined.\r\n */\n function xformSize(_metadata, size) {\n if (isDef(size)) {\n return Number(size);\n } else {\n return size;\n }\n }\n var sizeMapping = new Mapping('size');\n sizeMapping.xform = xformSize;\n mappings.push(sizeMapping);\n mappings.push(new Mapping('timeCreated'));\n mappings.push(new Mapping('updated'));\n mappings.push(new Mapping('md5Hash', null, true));\n mappings.push(new Mapping('cacheControl', null, true));\n mappings.push(new Mapping('contentDisposition', null, true));\n mappings.push(new Mapping('contentEncoding', null, true));\n mappings.push(new Mapping('contentLanguage', null, true));\n mappings.push(new Mapping('contentType', null, true));\n mappings.push(new Mapping('metadata', 'customMetadata', true));\n mappings_ = mappings;\n return mappings_;\n}\nfunction addRef(metadata, service) {\n function generateRef() {\n var bucket = metadata['bucket'];\n var path = metadata['fullPath'];\n var loc = new Location(bucket, path);\n return service.makeStorageReference(loc);\n }\n Object.defineProperty(metadata, 'ref', {\n get: generateRef\n });\n}\nfunction fromResource(service, resource, mappings) {\n var metadata = {};\n metadata['type'] = 'file';\n var len = mappings.length;\n for (var i = 0; i < len; i++) {\n var mapping = mappings[i];\n metadata[mapping.local] = mapping.xform(metadata, resource[mapping.server]);\n }\n addRef(metadata, service);\n return metadata;\n}\nfunction fromResourceString(service, resourceString, mappings) {\n var obj = jsonObjectOrNull(resourceString);\n if (obj === null) {\n return null;\n }\n var resource = obj;\n return fromResource(service, resource, mappings);\n}\nfunction downloadUrlFromResourceString(metadata, resourceString) {\n var obj = jsonObjectOrNull(resourceString);\n if (obj === null) {\n return null;\n }\n if (!isString(obj['downloadTokens'])) {\n // This can happen if objects are uploaded through GCS and retrieved\n // through list, so we don't want to throw an Error.\n return null;\n }\n var tokens = obj['downloadTokens'];\n if (tokens.length === 0) {\n return null;\n }\n var encode = encodeURIComponent;\n var tokensList = tokens.split(',');\n var urls = tokensList.map(function (token) {\n var bucket = metadata['bucket'];\n var path = metadata['fullPath'];\n var urlPart = '/b/' + encode(bucket) + '/o/' + encode(path);\n var base = makeUrl(urlPart);\n var queryString = makeQueryString({\n alt: 'media',\n token: token\n });\n return base + queryString;\n });\n return urls[0];\n}\nfunction toResourceString(metadata, mappings) {\n var resource = {};\n var len = mappings.length;\n for (var i = 0; i < len; i++) {\n var mapping = mappings[i];\n if (mapping.writable) {\n resource[mapping.server] = metadata[mapping.local];\n }\n }\n return JSON.stringify(resource);\n}\nfunction metadataValidator(p) {\n if (!isObject(p) || !p) {\n throw 'Expected Metadata object.';\n }\n for (var key in p) {\n if (p.hasOwnProperty(key)) {\n var val = p[key];\n if (key === 'customMetadata') {\n if (!isObject(val)) {\n throw 'Expected object for \\'customMetadata\\' mapping.';\n }\n } else {\n if (isNonNullObject(val)) {\n throw \"Mapping for '\" + key + \"' cannot be an object.\";\n }\n }\n }\n }\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nvar MAX_RESULTS_KEY = 'maxResults';\nvar MAX_MAX_RESULTS = 1000;\nvar PAGE_TOKEN_KEY = 'pageToken';\nvar PREFIXES_KEY = 'prefixes';\nvar ITEMS_KEY = 'items';\nfunction fromBackendResponse(service, bucket, resource) {\n var listResult = {\n prefixes: [],\n items: [],\n nextPageToken: resource['nextPageToken']\n };\n if (resource[PREFIXES_KEY]) {\n for (var _i = 0, _a = resource[PREFIXES_KEY]; _i < _a.length; _i++) {\n var path = _a[_i];\n var pathWithoutTrailingSlash = path.replace(/\\/$/, '');\n var reference = service.makeStorageReference(new Location(bucket, pathWithoutTrailingSlash));\n listResult.prefixes.push(reference);\n }\n }\n if (resource[ITEMS_KEY]) {\n for (var _b = 0, _c = resource[ITEMS_KEY]; _b < _c.length; _b++) {\n var item = _c[_b];\n var reference = service.makeStorageReference(new Location(bucket, item['name']));\n listResult.items.push(reference);\n }\n }\n return listResult;\n}\nfunction fromResponseString(service, bucket, resourceString) {\n var obj = jsonObjectOrNull(resourceString);\n if (obj === null) {\n return null;\n }\n var resource = obj;\n return fromBackendResponse(service, bucket, resource);\n}\nfunction listOptionsValidator(p) {\n if (!isObject(p) || !p) {\n throw 'Expected ListOptions object.';\n }\n for (var key in p) {\n if (key === MAX_RESULTS_KEY) {\n if (!isInteger(p[MAX_RESULTS_KEY]) || p[MAX_RESULTS_KEY] <= 0) {\n throw 'Expected maxResults to be a positive number.';\n }\n if (p[MAX_RESULTS_KEY] > 1000) {\n throw \"Expected maxResults to be less than or equal to \" + MAX_MAX_RESULTS + \".\";\n }\n } else if (key === PAGE_TOKEN_KEY) {\n if (p[PAGE_TOKEN_KEY] && !isString(p[PAGE_TOKEN_KEY])) {\n throw 'Expected pageToken to be string.';\n }\n } else {\n throw 'Unknown option: ' + key;\n }\n }\n}\nvar RequestInfo = /** @class */function () {\n function RequestInfo(url, method,\n /**\r\n * Returns the value with which to resolve the request's promise. Only called\r\n * if the request is successful. Throw from this function to reject the\r\n * returned Request's promise with the thrown error.\r\n * Note: The XhrIo passed to this function may be reused after this callback\r\n * returns. Do not keep a reference to it in any way.\r\n */\n handler, timeout) {\n this.url = url;\n this.method = method;\n this.handler = handler;\n this.timeout = timeout;\n this.urlParams = {};\n this.headers = {};\n this.body = null;\n this.errorHandler = null;\n /**\r\n * Called with the current number of bytes uploaded and total size (-1 if not\r\n * computable) of the request body (i.e. used to report upload progress).\r\n */\n this.progressCallback = null;\n this.successCodes = [200];\n this.additionalRetryCodes = [];\n }\n return RequestInfo;\n}();\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Throws the UNKNOWN FirebaseStorageError if cndn is false.\r\n */\nfunction handlerCheck(cndn) {\n if (!cndn) {\n throw unknown();\n }\n}\nfunction metadataHandler(service, mappings) {\n function handler(xhr, text) {\n var metadata = fromResourceString(service, text, mappings);\n handlerCheck(metadata !== null);\n return metadata;\n }\n return handler;\n}\nfunction listHandler(service, bucket) {\n function handler(xhr, text) {\n var listResult = fromResponseString(service, bucket, text);\n handlerCheck(listResult !== null);\n return listResult;\n }\n return handler;\n}\nfunction downloadUrlHandler(service, mappings) {\n function handler(xhr, text) {\n var metadata = fromResourceString(service, text, mappings);\n handlerCheck(metadata !== null);\n return downloadUrlFromResourceString(metadata, text);\n }\n return handler;\n}\nfunction sharedErrorHandler(location) {\n function errorHandler(xhr, err) {\n var newErr;\n if (xhr.getStatus() === 401) {\n newErr = unauthenticated();\n } else {\n if (xhr.getStatus() === 402) {\n newErr = quotaExceeded(location.bucket);\n } else {\n if (xhr.getStatus() === 403) {\n newErr = unauthorized(location.path);\n } else {\n newErr = err;\n }\n }\n }\n newErr.setServerResponseProp(err.serverResponseProp());\n return newErr;\n }\n return errorHandler;\n}\nfunction objectErrorHandler(location) {\n var shared = sharedErrorHandler(location);\n function errorHandler(xhr, err) {\n var newErr = shared(xhr, err);\n if (xhr.getStatus() === 404) {\n newErr = objectNotFound(location.path);\n }\n newErr.setServerResponseProp(err.serverResponseProp());\n return newErr;\n }\n return errorHandler;\n}\nfunction getMetadata(service, location, mappings) {\n var urlPart = location.fullServerUrl();\n var url = makeUrl(urlPart);\n var method = 'GET';\n var timeout = service.maxOperationRetryTime;\n var requestInfo = new RequestInfo(url, method, metadataHandler(service, mappings), timeout);\n requestInfo.errorHandler = objectErrorHandler(location);\n return requestInfo;\n}\nfunction list(service, location, delimiter, pageToken, maxResults) {\n var urlParams = {};\n if (location.isRoot) {\n urlParams['prefix'] = '';\n } else {\n urlParams['prefix'] = location.path + '/';\n }\n if (delimiter && delimiter.length > 0) {\n urlParams['delimiter'] = delimiter;\n }\n if (pageToken) {\n urlParams['pageToken'] = pageToken;\n }\n if (maxResults) {\n urlParams['maxResults'] = maxResults;\n }\n var urlPart = location.bucketOnlyServerUrl();\n var url = makeUrl(urlPart);\n var method = 'GET';\n var timeout = service.maxOperationRetryTime;\n var requestInfo = new RequestInfo(url, method, listHandler(service, location.bucket), timeout);\n requestInfo.urlParams = urlParams;\n requestInfo.errorHandler = sharedErrorHandler(location);\n return requestInfo;\n}\nfunction getDownloadUrl(service, location, mappings) {\n var urlPart = location.fullServerUrl();\n var url = makeUrl(urlPart);\n var method = 'GET';\n var timeout = service.maxOperationRetryTime;\n var requestInfo = new RequestInfo(url, method, downloadUrlHandler(service, mappings), timeout);\n requestInfo.errorHandler = objectErrorHandler(location);\n return requestInfo;\n}\nfunction updateMetadata(service, location, metadata, mappings) {\n var urlPart = location.fullServerUrl();\n var url = makeUrl(urlPart);\n var method = 'PATCH';\n var body = toResourceString(metadata, mappings);\n var headers = {\n 'Content-Type': 'application/json; charset=utf-8'\n };\n var timeout = service.maxOperationRetryTime;\n var requestInfo = new RequestInfo(url, method, metadataHandler(service, mappings), timeout);\n requestInfo.headers = headers;\n requestInfo.body = body;\n requestInfo.errorHandler = objectErrorHandler(location);\n return requestInfo;\n}\nfunction deleteObject(service, location) {\n var urlPart = location.fullServerUrl();\n var url = makeUrl(urlPart);\n var method = 'DELETE';\n var timeout = service.maxOperationRetryTime;\n function handler(_xhr, _text) {}\n var requestInfo = new RequestInfo(url, method, handler, timeout);\n requestInfo.successCodes = [200, 204];\n requestInfo.errorHandler = objectErrorHandler(location);\n return requestInfo;\n}\nfunction determineContentType_(metadata, blob) {\n return metadata && metadata['contentType'] || blob && blob.type() || 'application/octet-stream';\n}\nfunction metadataForUpload_(location, blob, metadata) {\n var metadataClone = Object.assign({}, metadata);\n metadataClone['fullPath'] = location.path;\n metadataClone['size'] = blob.size();\n if (!metadataClone['contentType']) {\n metadataClone['contentType'] = determineContentType_(null, blob);\n }\n return metadataClone;\n}\nfunction multipartUpload(service, location, mappings, blob, metadata) {\n var urlPart = location.bucketOnlyServerUrl();\n var headers = {\n 'X-Goog-Upload-Protocol': 'multipart'\n };\n function genBoundary() {\n var str = '';\n for (var i = 0; i < 2; i++) {\n str = str + Math.random().toString().slice(2);\n }\n return str;\n }\n var boundary = genBoundary();\n headers['Content-Type'] = 'multipart/related; boundary=' + boundary;\n var metadata_ = metadataForUpload_(location, blob, metadata);\n var metadataString = toResourceString(metadata_, mappings);\n var preBlobPart = '--' + boundary + '\\r\\n' + 'Content-Type: application/json; charset=utf-8\\r\\n\\r\\n' + metadataString + '\\r\\n--' + boundary + '\\r\\n' + 'Content-Type: ' + metadata_['contentType'] + '\\r\\n\\r\\n';\n var postBlobPart = '\\r\\n--' + boundary + '--';\n var body = FbsBlob.getBlob(preBlobPart, blob, postBlobPart);\n if (body === null) {\n throw cannotSliceBlob();\n }\n var urlParams = {\n name: metadata_['fullPath']\n };\n var url = makeUrl(urlPart);\n var method = 'POST';\n var timeout = service.maxUploadRetryTime;\n var requestInfo = new RequestInfo(url, method, metadataHandler(service, mappings), timeout);\n requestInfo.urlParams = urlParams;\n requestInfo.headers = headers;\n requestInfo.body = body.uploadData();\n requestInfo.errorHandler = sharedErrorHandler(location);\n return requestInfo;\n}\n/**\r\n * @param current The number of bytes that have been uploaded so far.\r\n * @param total The total number of bytes in the upload.\r\n * @param opt_finalized True if the server has finished the upload.\r\n * @param opt_metadata The upload metadata, should\r\n * only be passed if opt_finalized is true.\r\n * @struct\r\n */\nvar ResumableUploadStatus = /** @class */function () {\n function ResumableUploadStatus(current, total, finalized, metadata) {\n this.current = current;\n this.total = total;\n this.finalized = !!finalized;\n this.metadata = metadata || null;\n }\n return ResumableUploadStatus;\n}();\nfunction checkResumeHeader_(xhr, allowed) {\n var status = null;\n try {\n status = xhr.getResponseHeader('X-Goog-Upload-Status');\n } catch (e) {\n handlerCheck(false);\n }\n var allowedStatus = allowed || ['active'];\n handlerCheck(!!status && allowedStatus.indexOf(status) !== -1);\n return status;\n}\nfunction createResumableUpload(service, location, mappings, blob, metadata) {\n var urlPart = location.bucketOnlyServerUrl();\n var metadataForUpload = metadataForUpload_(location, blob, metadata);\n var urlParams = {\n name: metadataForUpload['fullPath']\n };\n var url = makeUrl(urlPart);\n var method = 'POST';\n var headers = {\n 'X-Goog-Upload-Protocol': 'resumable',\n 'X-Goog-Upload-Command': 'start',\n 'X-Goog-Upload-Header-Content-Length': blob.size(),\n 'X-Goog-Upload-Header-Content-Type': metadataForUpload['contentType'],\n 'Content-Type': 'application/json; charset=utf-8'\n };\n var body = toResourceString(metadataForUpload, mappings);\n var timeout = service.maxUploadRetryTime;\n function handler(xhr) {\n checkResumeHeader_(xhr);\n var url;\n try {\n url = xhr.getResponseHeader('X-Goog-Upload-URL');\n } catch (e) {\n handlerCheck(false);\n }\n handlerCheck(isString(url));\n return url;\n }\n var requestInfo = new RequestInfo(url, method, handler, timeout);\n requestInfo.urlParams = urlParams;\n requestInfo.headers = headers;\n requestInfo.body = body;\n requestInfo.errorHandler = sharedErrorHandler(location);\n return requestInfo;\n}\n/**\r\n * @param url From a call to fbs.requests.createResumableUpload.\r\n */\nfunction getResumableUploadStatus(service, location, url, blob) {\n var headers = {\n 'X-Goog-Upload-Command': 'query'\n };\n function handler(xhr) {\n var status = checkResumeHeader_(xhr, ['active', 'final']);\n var sizeString = null;\n try {\n sizeString = xhr.getResponseHeader('X-Goog-Upload-Size-Received');\n } catch (e) {\n handlerCheck(false);\n }\n if (!sizeString) {\n // null or empty string\n handlerCheck(false);\n }\n var size = Number(sizeString);\n handlerCheck(!isNaN(size));\n return new ResumableUploadStatus(size, blob.size(), status === 'final');\n }\n var method = 'POST';\n var timeout = service.maxUploadRetryTime;\n var requestInfo = new RequestInfo(url, method, handler, timeout);\n requestInfo.headers = headers;\n requestInfo.errorHandler = sharedErrorHandler(location);\n return requestInfo;\n}\n/**\r\n * Any uploads via the resumable upload API must transfer a number of bytes\r\n * that is a multiple of this number.\r\n */\nvar resumableUploadChunkSize = 256 * 1024;\n/**\r\n * @param url From a call to fbs.requests.createResumableUpload.\r\n * @param chunkSize Number of bytes to upload.\r\n * @param status The previous status.\r\n * If not passed or null, we start from the beginning.\r\n * @throws fbs.Error If the upload is already complete, the passed in status\r\n * has a final size inconsistent with the blob, or the blob cannot be sliced\r\n * for upload.\r\n */\nfunction continueResumableUpload(location, service, url, blob, chunkSize, mappings, status, progressCallback) {\n // TODO(andysoto): standardize on internal asserts\n // assert(!(opt_status && opt_status.finalized));\n var status_ = new ResumableUploadStatus(0, 0);\n if (status) {\n status_.current = status.current;\n status_.total = status.total;\n } else {\n status_.current = 0;\n status_.total = blob.size();\n }\n if (blob.size() !== status_.total) {\n throw serverFileWrongSize();\n }\n var bytesLeft = status_.total - status_.current;\n var bytesToUpload = bytesLeft;\n if (chunkSize > 0) {\n bytesToUpload = Math.min(bytesToUpload, chunkSize);\n }\n var startByte = status_.current;\n var endByte = startByte + bytesToUpload;\n var uploadCommand = bytesToUpload === bytesLeft ? 'upload, finalize' : 'upload';\n var headers = {\n 'X-Goog-Upload-Command': uploadCommand,\n 'X-Goog-Upload-Offset': status_.current\n };\n var body = blob.slice(startByte, endByte);\n if (body === null) {\n throw cannotSliceBlob();\n }\n function handler(xhr, text) {\n // TODO(andysoto): Verify the MD5 of each uploaded range:\n // the 'x-range-md5' header comes back with status code 308 responses.\n // We'll only be able to bail out though, because you can't re-upload a\n // range that you previously uploaded.\n var uploadStatus = checkResumeHeader_(xhr, ['active', 'final']);\n var newCurrent = status_.current + bytesToUpload;\n var size = blob.size();\n var metadata;\n if (uploadStatus === 'final') {\n metadata = metadataHandler(service, mappings)(xhr, text);\n } else {\n metadata = null;\n }\n return new ResumableUploadStatus(newCurrent, size, uploadStatus === 'final', metadata);\n }\n var method = 'POST';\n var timeout = service.maxUploadRetryTime;\n var requestInfo = new RequestInfo(url, method, handler, timeout);\n requestInfo.headers = headers;\n requestInfo.body = body.uploadData();\n requestInfo.progressCallback = progressCallback || null;\n requestInfo.errorHandler = sharedErrorHandler(location);\n return requestInfo;\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * @struct\r\n */\nvar Observer = /** @class */function () {\n function Observer(nextOrObserver, error, complete) {\n var asFunctions = isFunction(nextOrObserver) || isDef(error) || isDef(complete);\n if (asFunctions) {\n this.next = nextOrObserver;\n this.error = error || null;\n this.complete = complete || null;\n } else {\n var observer = nextOrObserver;\n this.next = observer.next || null;\n this.error = observer.error || null;\n this.complete = observer.complete || null;\n }\n }\n return Observer;\n}();\nvar UploadTaskSnapshot = /** @class */function () {\n function UploadTaskSnapshot(bytesTransferred, totalBytes, state, metadata, task, ref) {\n this.bytesTransferred = bytesTransferred;\n this.totalBytes = totalBytes;\n this.state = state;\n this.metadata = metadata;\n this.task = task;\n this.ref = ref;\n }\n return UploadTaskSnapshot;\n}();\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * @param name Name of the function.\r\n * @param specs Argument specs.\r\n * @param passed The actual arguments passed to the function.\r\n * @throws {fbs.Error} If the arguments are invalid.\r\n */\nfunction validate(name, specs, passed) {\n var minArgs = specs.length;\n var maxArgs = specs.length;\n for (var i = 0; i < specs.length; i++) {\n if (specs[i].optional) {\n minArgs = i;\n break;\n }\n }\n var validLength = minArgs <= passed.length && passed.length <= maxArgs;\n if (!validLength) {\n throw invalidArgumentCount(minArgs, maxArgs, name, passed.length);\n }\n for (var i = 0; i < passed.length; i++) {\n try {\n specs[i].validator(passed[i]);\n } catch (e) {\n if (e instanceof Error) {\n throw invalidArgument(i, name, e.message);\n } else {\n throw invalidArgument(i, name, e);\n }\n }\n }\n}\n/**\r\n * @struct\r\n */\nvar ArgSpec = /** @class */function () {\n function ArgSpec(validator, optional) {\n var self = this;\n this.validator = function (p) {\n if (self.optional && !isJustDef(p)) {\n return;\n }\n validator(p);\n };\n this.optional = !!optional;\n }\n return ArgSpec;\n}();\nfunction and_(v1, v2) {\n return function (p) {\n v1(p);\n v2(p);\n };\n}\nfunction stringSpec(validator, optional) {\n function stringValidator(p) {\n if (!isString(p)) {\n throw 'Expected string.';\n }\n }\n var chainedValidator;\n if (validator) {\n chainedValidator = and_(stringValidator, validator);\n } else {\n chainedValidator = stringValidator;\n }\n return new ArgSpec(chainedValidator, optional);\n}\nfunction uploadDataSpec() {\n function validator(p) {\n var valid = p instanceof Uint8Array || p instanceof ArrayBuffer || isNativeBlobDefined() && p instanceof Blob;\n if (!valid) {\n throw 'Expected Blob or File.';\n }\n }\n return new ArgSpec(validator);\n}\nfunction metadataSpec(optional) {\n return new ArgSpec(metadataValidator, optional);\n}\nfunction listOptionSpec(optional) {\n return new ArgSpec(listOptionsValidator, optional);\n}\nfunction nonNegativeNumberSpec() {\n function validator(p) {\n var valid = isNumber(p) && p >= 0;\n if (!valid) {\n throw 'Expected a number 0 or greater.';\n }\n }\n return new ArgSpec(validator);\n}\nfunction looseObjectSpec(validator, optional) {\n function isLooseObjectValidator(p) {\n var isLooseObject = p === null || isDef(p) && p instanceof Object;\n if (!isLooseObject) {\n throw 'Expected an Object.';\n }\n if (validator !== undefined && validator !== null) {\n validator(p);\n }\n }\n return new ArgSpec(isLooseObjectValidator, optional);\n}\nfunction nullFunctionSpec(optional) {\n function validator(p) {\n var valid = p === null || isFunction(p);\n if (!valid) {\n throw 'Expected a Function.';\n }\n }\n return new ArgSpec(validator, optional);\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Returns a function that invokes f with its arguments asynchronously as a\r\n * microtask, i.e. as soon as possible after the current script returns back\r\n * into browser code.\r\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction async(f) {\n return function () {\n var argsToForward = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n argsToForward[_i] = arguments[_i];\n }\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n Promise.resolve().then(function () {\n return f.apply(void 0, argsToForward);\n });\n };\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Represents a blob being uploaded. Can be used to pause/resume/cancel the\r\n * upload and manage callbacks for various events.\r\n */\nvar UploadTask = /** @class */function () {\n /**\r\n * @param ref The firebaseStorage.Reference object this task came\r\n * from, untyped to avoid cyclic dependencies.\r\n * @param blob The blob to upload.\r\n */\n function UploadTask(ref, service, location, mappings, blob, metadata) {\n var _this = this;\n if (metadata === void 0) {\n metadata = null;\n }\n this.transferred_ = 0;\n this.needToFetchStatus_ = false;\n this.needToFetchMetadata_ = false;\n this.observers_ = [];\n this.error_ = null;\n this.uploadUrl_ = null;\n this.request_ = null;\n this.chunkMultiplier_ = 1;\n this.resolve_ = null;\n this.reject_ = null;\n this.ref_ = ref;\n this.service_ = service;\n this.location_ = location;\n this.blob_ = blob;\n this.metadata_ = metadata;\n this.mappings_ = mappings;\n this.resumable_ = this.shouldDoResumable_(this.blob_);\n this.state_ = InternalTaskState.RUNNING;\n this.errorHandler_ = function (error) {\n _this.request_ = null;\n _this.chunkMultiplier_ = 1;\n if (error.codeEquals(Code.CANCELED)) {\n _this.needToFetchStatus_ = true;\n _this.completeTransitions_();\n } else {\n _this.error_ = error;\n _this.transition_(InternalTaskState.ERROR);\n }\n };\n this.metadataErrorHandler_ = function (error) {\n _this.request_ = null;\n if (error.codeEquals(Code.CANCELED)) {\n _this.completeTransitions_();\n } else {\n _this.error_ = error;\n _this.transition_(InternalTaskState.ERROR);\n }\n };\n this.promise_ = new Promise(function (resolve, reject) {\n _this.resolve_ = resolve;\n _this.reject_ = reject;\n _this.start_();\n });\n // Prevent uncaught rejections on the internal promise from bubbling out\n // to the top level with a dummy handler.\n this.promise_.then(null, function () {});\n }\n UploadTask.prototype.makeProgressCallback_ = function () {\n var _this = this;\n var sizeBefore = this.transferred_;\n return function (loaded) {\n return _this.updateProgress_(sizeBefore + loaded);\n };\n };\n UploadTask.prototype.shouldDoResumable_ = function (blob) {\n return blob.size() > 256 * 1024;\n };\n UploadTask.prototype.start_ = function () {\n if (this.state_ !== InternalTaskState.RUNNING) {\n // This can happen if someone pauses us in a resume callback, for example.\n return;\n }\n if (this.request_ !== null) {\n return;\n }\n if (this.resumable_) {\n if (this.uploadUrl_ === null) {\n this.createResumable_();\n } else {\n if (this.needToFetchStatus_) {\n this.fetchStatus_();\n } else {\n if (this.needToFetchMetadata_) {\n // Happens if we miss the metadata on upload completion.\n this.fetchMetadata_();\n } else {\n this.continueUpload_();\n }\n }\n }\n } else {\n this.oneShotUpload_();\n }\n };\n UploadTask.prototype.resolveToken_ = function (callback) {\n var _this = this;\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.service_.getAuthToken().then(function (authToken) {\n switch (_this.state_) {\n case InternalTaskState.RUNNING:\n callback(authToken);\n break;\n case InternalTaskState.CANCELING:\n _this.transition_(InternalTaskState.CANCELED);\n break;\n case InternalTaskState.PAUSING:\n _this.transition_(InternalTaskState.PAUSED);\n break;\n }\n });\n };\n // TODO(andysoto): assert false\n UploadTask.prototype.createResumable_ = function () {\n var _this = this;\n this.resolveToken_(function (authToken) {\n var requestInfo = createResumableUpload(_this.service_, _this.location_, _this.mappings_, _this.blob_, _this.metadata_);\n var createRequest = _this.service_.makeRequest(requestInfo, authToken);\n _this.request_ = createRequest;\n createRequest.getPromise().then(function (url) {\n _this.request_ = null;\n _this.uploadUrl_ = url;\n _this.needToFetchStatus_ = false;\n _this.completeTransitions_();\n }, _this.errorHandler_);\n });\n };\n UploadTask.prototype.fetchStatus_ = function () {\n var _this = this;\n // TODO(andysoto): assert(this.uploadUrl_ !== null);\n var url = this.uploadUrl_;\n this.resolveToken_(function (authToken) {\n var requestInfo = getResumableUploadStatus(_this.service_, _this.location_, url, _this.blob_);\n var statusRequest = _this.service_.makeRequest(requestInfo, authToken);\n _this.request_ = statusRequest;\n statusRequest.getPromise().then(function (status) {\n status = status;\n _this.request_ = null;\n _this.updateProgress_(status.current);\n _this.needToFetchStatus_ = false;\n if (status.finalized) {\n _this.needToFetchMetadata_ = true;\n }\n _this.completeTransitions_();\n }, _this.errorHandler_);\n });\n };\n UploadTask.prototype.continueUpload_ = function () {\n var _this = this;\n var chunkSize = resumableUploadChunkSize * this.chunkMultiplier_;\n var status = new ResumableUploadStatus(this.transferred_, this.blob_.size());\n // TODO(andysoto): assert(this.uploadUrl_ !== null);\n var url = this.uploadUrl_;\n this.resolveToken_(function (authToken) {\n var requestInfo;\n try {\n requestInfo = continueResumableUpload(_this.location_, _this.service_, url, _this.blob_, chunkSize, _this.mappings_, status, _this.makeProgressCallback_());\n } catch (e) {\n _this.error_ = e;\n _this.transition_(InternalTaskState.ERROR);\n return;\n }\n var uploadRequest = _this.service_.makeRequest(requestInfo, authToken);\n _this.request_ = uploadRequest;\n uploadRequest.getPromise().then(function (newStatus) {\n _this.increaseMultiplier_();\n _this.request_ = null;\n _this.updateProgress_(newStatus.current);\n if (newStatus.finalized) {\n _this.metadata_ = newStatus.metadata;\n _this.transition_(InternalTaskState.SUCCESS);\n } else {\n _this.completeTransitions_();\n }\n }, _this.errorHandler_);\n });\n };\n UploadTask.prototype.increaseMultiplier_ = function () {\n var currentSize = resumableUploadChunkSize * this.chunkMultiplier_;\n // Max chunk size is 32M.\n if (currentSize < 32 * 1024 * 1024) {\n this.chunkMultiplier_ *= 2;\n }\n };\n UploadTask.prototype.fetchMetadata_ = function () {\n var _this = this;\n this.resolveToken_(function (authToken) {\n var requestInfo = getMetadata(_this.service_, _this.location_, _this.mappings_);\n var metadataRequest = _this.service_.makeRequest(requestInfo, authToken);\n _this.request_ = metadataRequest;\n metadataRequest.getPromise().then(function (metadata) {\n _this.request_ = null;\n _this.metadata_ = metadata;\n _this.transition_(InternalTaskState.SUCCESS);\n }, _this.metadataErrorHandler_);\n });\n };\n UploadTask.prototype.oneShotUpload_ = function () {\n var _this = this;\n this.resolveToken_(function (authToken) {\n var requestInfo = multipartUpload(_this.service_, _this.location_, _this.mappings_, _this.blob_, _this.metadata_);\n var multipartRequest = _this.service_.makeRequest(requestInfo, authToken);\n _this.request_ = multipartRequest;\n multipartRequest.getPromise().then(function (metadata) {\n _this.request_ = null;\n _this.metadata_ = metadata;\n _this.updateProgress_(_this.blob_.size());\n _this.transition_(InternalTaskState.SUCCESS);\n }, _this.errorHandler_);\n });\n };\n UploadTask.prototype.updateProgress_ = function (transferred) {\n var old = this.transferred_;\n this.transferred_ = transferred;\n // A progress update can make the \"transferred\" value smaller (e.g. a\n // partial upload not completed by server, after which the \"transferred\"\n // value may reset to the value at the beginning of the request).\n if (this.transferred_ !== old) {\n this.notifyObservers_();\n }\n };\n UploadTask.prototype.transition_ = function (state) {\n if (this.state_ === state) {\n return;\n }\n switch (state) {\n case InternalTaskState.CANCELING:\n // TODO(andysoto):\n // assert(this.state_ === InternalTaskState.RUNNING ||\n // this.state_ === InternalTaskState.PAUSING);\n this.state_ = state;\n if (this.request_ !== null) {\n this.request_.cancel();\n }\n break;\n case InternalTaskState.PAUSING:\n // TODO(andysoto):\n // assert(this.state_ === InternalTaskState.RUNNING);\n this.state_ = state;\n if (this.request_ !== null) {\n this.request_.cancel();\n }\n break;\n case InternalTaskState.RUNNING:\n // TODO(andysoto):\n // assert(this.state_ === InternalTaskState.PAUSED ||\n // this.state_ === InternalTaskState.PAUSING);\n var wasPaused = this.state_ === InternalTaskState.PAUSED;\n this.state_ = state;\n if (wasPaused) {\n this.notifyObservers_();\n this.start_();\n }\n break;\n case InternalTaskState.PAUSED:\n // TODO(andysoto):\n // assert(this.state_ === InternalTaskState.PAUSING);\n this.state_ = state;\n this.notifyObservers_();\n break;\n case InternalTaskState.CANCELED:\n // TODO(andysoto):\n // assert(this.state_ === InternalTaskState.PAUSED ||\n // this.state_ === InternalTaskState.CANCELING);\n this.error_ = canceled();\n this.state_ = state;\n this.notifyObservers_();\n break;\n case InternalTaskState.ERROR:\n // TODO(andysoto):\n // assert(this.state_ === InternalTaskState.RUNNING ||\n // this.state_ === InternalTaskState.PAUSING ||\n // this.state_ === InternalTaskState.CANCELING);\n this.state_ = state;\n this.notifyObservers_();\n break;\n case InternalTaskState.SUCCESS:\n // TODO(andysoto):\n // assert(this.state_ === InternalTaskState.RUNNING ||\n // this.state_ === InternalTaskState.PAUSING ||\n // this.state_ === InternalTaskState.CANCELING);\n this.state_ = state;\n this.notifyObservers_();\n break;\n }\n };\n UploadTask.prototype.completeTransitions_ = function () {\n switch (this.state_) {\n case InternalTaskState.PAUSING:\n this.transition_(InternalTaskState.PAUSED);\n break;\n case InternalTaskState.CANCELING:\n this.transition_(InternalTaskState.CANCELED);\n break;\n case InternalTaskState.RUNNING:\n this.start_();\n break;\n }\n };\n Object.defineProperty(UploadTask.prototype, \"snapshot\", {\n get: function () {\n var externalState = taskStateFromInternalTaskState(this.state_);\n return new UploadTaskSnapshot(this.transferred_, this.blob_.size(), externalState, this.metadata_, this, this.ref_);\n },\n enumerable: false,\n configurable: true\n });\n /**\r\n * Adds a callback for an event.\r\n * @param type The type of event to listen for.\r\n */\n UploadTask.prototype.on = function (type, nextOrObserver, error, completed) {\n function typeValidator() {\n if (type !== TaskEvent.STATE_CHANGED) {\n throw \"Expected one of the event types: [\" + TaskEvent.STATE_CHANGED + \"].\";\n }\n }\n var nextOrObserverMessage = 'Expected a function or an Object with one of ' + '`next`, `error`, `complete` properties.';\n var nextValidator = nullFunctionSpec(true).validator;\n var observerValidator = looseObjectSpec(null, true).validator;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function nextOrObserverValidator(p) {\n try {\n nextValidator(p);\n return;\n } catch (e) {}\n try {\n observerValidator(p);\n var anyDefined = isJustDef(p['next']) || isJustDef(p['error']) || isJustDef(p['complete']);\n if (!anyDefined) {\n throw '';\n }\n return;\n } catch (e) {\n throw nextOrObserverMessage;\n }\n }\n var specs = [stringSpec(typeValidator), looseObjectSpec(nextOrObserverValidator, true), nullFunctionSpec(true), nullFunctionSpec(true)];\n validate('on', specs, arguments);\n var self = this;\n function makeBinder(specs) {\n function binder(nextOrObserver, error, complete) {\n if (specs !== null) {\n validate('on', specs, arguments);\n }\n var observer = new Observer(nextOrObserver, error, completed);\n self.addObserver_(observer);\n return function () {\n self.removeObserver_(observer);\n };\n }\n return binder;\n }\n function binderNextOrObserverValidator(p) {\n if (p === null) {\n throw nextOrObserverMessage;\n }\n nextOrObserverValidator(p);\n }\n var binderSpecs = [looseObjectSpec(binderNextOrObserverValidator), nullFunctionSpec(true), nullFunctionSpec(true)];\n var typeOnly = !(isJustDef(nextOrObserver) || isJustDef(error) || isJustDef(completed));\n if (typeOnly) {\n return makeBinder(binderSpecs);\n } else {\n return makeBinder(null)(nextOrObserver, error, completed);\n }\n };\n /**\r\n * This object behaves like a Promise, and resolves with its snapshot data\r\n * when the upload completes.\r\n * @param onFulfilled The fulfillment callback. Promise chaining works as normal.\r\n * @param onRejected The rejection callback.\r\n */\n UploadTask.prototype.then = function (onFulfilled, onRejected) {\n // These casts are needed so that TypeScript can infer the types of the\n // resulting Promise.\n return this.promise_.then(onFulfilled, onRejected);\n };\n /**\r\n * Equivalent to calling `then(null, onRejected)`.\r\n */\n UploadTask.prototype.catch = function (onRejected) {\n return this.then(null, onRejected);\n };\n /**\r\n * Adds the given observer.\r\n */\n UploadTask.prototype.addObserver_ = function (observer) {\n this.observers_.push(observer);\n this.notifyObserver_(observer);\n };\n /**\r\n * Removes the given observer.\r\n */\n UploadTask.prototype.removeObserver_ = function (observer) {\n var i = this.observers_.indexOf(observer);\n if (i !== -1) {\n this.observers_.splice(i, 1);\n }\n };\n UploadTask.prototype.notifyObservers_ = function () {\n var _this = this;\n this.finishPromise_();\n var observers = this.observers_.slice();\n observers.forEach(function (observer) {\n _this.notifyObserver_(observer);\n });\n };\n UploadTask.prototype.finishPromise_ = function () {\n if (this.resolve_ !== null) {\n var triggered = true;\n switch (taskStateFromInternalTaskState(this.state_)) {\n case TaskState.SUCCESS:\n async(this.resolve_.bind(null, this.snapshot))();\n break;\n case TaskState.CANCELED:\n case TaskState.ERROR:\n var toCall = this.reject_;\n async(toCall.bind(null, this.error_))();\n break;\n default:\n triggered = false;\n break;\n }\n if (triggered) {\n this.resolve_ = null;\n this.reject_ = null;\n }\n }\n };\n UploadTask.prototype.notifyObserver_ = function (observer) {\n var externalState = taskStateFromInternalTaskState(this.state_);\n switch (externalState) {\n case TaskState.RUNNING:\n case TaskState.PAUSED:\n if (observer.next) {\n async(observer.next.bind(observer, this.snapshot))();\n }\n break;\n case TaskState.SUCCESS:\n if (observer.complete) {\n async(observer.complete.bind(observer))();\n }\n break;\n case TaskState.CANCELED:\n case TaskState.ERROR:\n if (observer.error) {\n async(observer.error.bind(observer, this.error_))();\n }\n break;\n default:\n // TODO(andysoto): assert(false);\n if (observer.error) {\n async(observer.error.bind(observer, this.error_))();\n }\n }\n };\n /**\r\n * Resumes a paused task. Has no effect on a currently running or failed task.\r\n * @return True if the operation took effect, false if ignored.\r\n */\n UploadTask.prototype.resume = function () {\n validate('resume', [], arguments);\n var valid = this.state_ === InternalTaskState.PAUSED || this.state_ === InternalTaskState.PAUSING;\n if (valid) {\n this.transition_(InternalTaskState.RUNNING);\n }\n return valid;\n };\n /**\r\n * Pauses a currently running task. Has no effect on a paused or failed task.\r\n * @return True if the operation took effect, false if ignored.\r\n */\n UploadTask.prototype.pause = function () {\n validate('pause', [], arguments);\n var valid = this.state_ === InternalTaskState.RUNNING;\n if (valid) {\n this.transition_(InternalTaskState.PAUSING);\n }\n return valid;\n };\n /**\r\n * Cancels a currently running or paused task. Has no effect on a complete or\r\n * failed task.\r\n * @return True if the operation took effect, false if ignored.\r\n */\n UploadTask.prototype.cancel = function () {\n validate('cancel', [], arguments);\n var valid = this.state_ === InternalTaskState.RUNNING || this.state_ === InternalTaskState.PAUSING;\n if (valid) {\n this.transition_(InternalTaskState.CANCELING);\n }\n return valid;\n };\n return UploadTask;\n}();\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Provides methods to interact with a bucket in the Firebase Storage service.\r\n * @param location An fbs.location, or the URL at\r\n * which to base this object, in one of the following forms:\r\n * gs:///\r\n * http[s]://firebasestorage.googleapis.com/\r\n * /b//o/\r\n * Any query or fragment strings will be ignored in the http[s]\r\n * format. If no value is passed, the storage object will use a URL based on\r\n * the project ID of the base firebase.App instance.\r\n */\nvar Reference = /** @class */function () {\n function Reference(service, location) {\n this.service = service;\n if (location instanceof Location) {\n this.location = location;\n } else {\n this.location = Location.makeFromUrl(location);\n }\n }\n /**\r\n * @return The URL for the bucket and path this object references,\r\n * in the form gs:///\r\n * @override\r\n */\n Reference.prototype.toString = function () {\n validate('toString', [], arguments);\n return 'gs://' + this.location.bucket + '/' + this.location.path;\n };\n Reference.prototype.newRef = function (service, location) {\n return new Reference(service, location);\n };\n Reference.prototype.mappings = function () {\n return getMappings();\n };\n /**\r\n * @return A reference to the object obtained by\r\n * appending childPath, removing any duplicate, beginning, or trailing\r\n * slashes.\r\n */\n Reference.prototype.child = function (childPath) {\n validate('child', [stringSpec()], arguments);\n var newPath = child(this.location.path, childPath);\n var location = new Location(this.location.bucket, newPath);\n return this.newRef(this.service, location);\n };\n Object.defineProperty(Reference.prototype, \"parent\", {\n /**\r\n * @return A reference to the parent of the\r\n * current object, or null if the current object is the root.\r\n */\n get: function () {\n var newPath = parent(this.location.path);\n if (newPath === null) {\n return null;\n }\n var location = new Location(this.location.bucket, newPath);\n return this.newRef(this.service, location);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Reference.prototype, \"root\", {\n /**\r\n * @return An reference to the root of this\r\n * object's bucket.\r\n */\n get: function () {\n var location = new Location(this.location.bucket, '');\n return this.newRef(this.service, location);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Reference.prototype, \"bucket\", {\n get: function () {\n return this.location.bucket;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Reference.prototype, \"fullPath\", {\n get: function () {\n return this.location.path;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Reference.prototype, \"name\", {\n get: function () {\n return lastComponent(this.location.path);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Reference.prototype, \"storage\", {\n get: function () {\n return this.service;\n },\n enumerable: false,\n configurable: true\n });\n /**\r\n * Uploads a blob to this object's location.\r\n * @param data The blob to upload.\r\n * @return An UploadTask that lets you control and\r\n * observe the upload.\r\n */\n Reference.prototype.put = function (data, metadata) {\n if (metadata === void 0) {\n metadata = null;\n }\n validate('put', [uploadDataSpec(), metadataSpec(true)], arguments);\n this.throwIfRoot_('put');\n return new UploadTask(this, this.service, this.location, this.mappings(), new FbsBlob(data), metadata);\n };\n /**\r\n * Uploads a string to this object's location.\r\n * @param value The string to upload.\r\n * @param format The format of the string to upload.\r\n * @return An UploadTask that lets you control and\r\n * observe the upload.\r\n */\n Reference.prototype.putString = function (value, format, metadata) {\n if (format === void 0) {\n format = StringFormat.RAW;\n }\n validate('putString', [stringSpec(), stringSpec(formatValidator, true), metadataSpec(true)], arguments);\n this.throwIfRoot_('putString');\n var data = dataFromString(format, value);\n var metadataClone = Object.assign({}, metadata);\n if (!isDef(metadataClone['contentType']) && isDef(data.contentType)) {\n metadataClone['contentType'] = data.contentType;\n }\n return new UploadTask(this, this.service, this.location, this.mappings(), new FbsBlob(data.data, true), metadataClone);\n };\n /**\r\n * Deletes the object at this location.\r\n * @return A promise that resolves if the deletion succeeds.\r\n */\n Reference.prototype.delete = function () {\n var _this = this;\n validate('delete', [], arguments);\n this.throwIfRoot_('delete');\n return this.service.getAuthToken().then(function (authToken) {\n var requestInfo = deleteObject(_this.service, _this.location);\n return _this.service.makeRequest(requestInfo, authToken).getPromise();\n });\n };\n /**\r\n * List all items (files) and prefixes (folders) under this storage reference.\r\n *\r\n * This is a helper method for calling list() repeatedly until there are\r\n * no more results. The default pagination size is 1000.\r\n *\r\n * Note: The results may not be consistent if objects are changed while this\r\n * operation is running.\r\n *\r\n * Warning: listAll may potentially consume too many resources if there are\r\n * too many results.\r\n *\r\n * @return A Promise that resolves with all the items and prefixes under\r\n * the current storage reference. `prefixes` contains references to\r\n * sub-directories and `items` contains references to objects in this\r\n * folder. `nextPageToken` is never returned.\r\n */\n Reference.prototype.listAll = function () {\n validate('listAll', [], arguments);\n var accumulator = {\n prefixes: [],\n items: []\n };\n return this.listAllHelper(accumulator).then(function () {\n return accumulator;\n });\n };\n Reference.prototype.listAllHelper = function (accumulator, pageToken) {\n return __awaiter(this, void 0, void 0, function () {\n var opt, nextPage;\n var _a, _b;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n opt = {\n // maxResults is 1000 by default.\n pageToken: pageToken\n };\n return [4 /*yield*/, this.list(opt)];\n case 1:\n nextPage = _c.sent();\n (_a = accumulator.prefixes).push.apply(_a, nextPage.prefixes);\n (_b = accumulator.items).push.apply(_b, nextPage.items);\n if (!(nextPage.nextPageToken != null)) return [3 /*break*/, 3];\n return [4 /*yield*/, this.listAllHelper(accumulator, nextPage.nextPageToken)];\n case 2:\n _c.sent();\n _c.label = 3;\n case 3:\n return [2 /*return*/];\n }\n });\n });\n };\n /**\r\n * List items (files) and prefixes (folders) under this storage reference.\r\n *\r\n * List API is only available for Firebase Rules Version 2.\r\n *\r\n * GCS is a key-blob store. Firebase Storage imposes the semantic of '/'\r\n * delimited folder structure.\r\n * Refer to GCS's List API if you want to learn more.\r\n *\r\n * To adhere to Firebase Rules's Semantics, Firebase Storage does not\r\n * support objects whose paths end with \"/\" or contain two consecutive\r\n * \"/\"s. Firebase Storage List API will filter these unsupported objects.\r\n * list() may fail if there are too many unsupported objects in the bucket.\r\n *\r\n * @param options See ListOptions for details.\r\n * @return A Promise that resolves with the items and prefixes.\r\n * `prefixes` contains references to sub-folders and `items`\r\n * contains references to objects in this folder. `nextPageToken`\r\n * can be used to get the rest of the results.\r\n */\n Reference.prototype.list = function (options) {\n validate('list', [listOptionSpec(true)], arguments);\n var self = this;\n return this.service.getAuthToken().then(function (authToken) {\n var op = options || {};\n var requestInfo = list(self.service, self.location, /*delimiter= */'/', op.pageToken, op.maxResults);\n return self.service.makeRequest(requestInfo, authToken).getPromise();\n });\n };\n /**\r\n * A promise that resolves with the metadata for this object. If this\r\n * object doesn't exist or metadata cannot be retreived, the promise is\r\n * rejected.\r\n */\n Reference.prototype.getMetadata = function () {\n var _this = this;\n validate('getMetadata', [], arguments);\n this.throwIfRoot_('getMetadata');\n return this.service.getAuthToken().then(function (authToken) {\n var requestInfo = getMetadata(_this.service, _this.location, _this.mappings());\n return _this.service.makeRequest(requestInfo, authToken).getPromise();\n });\n };\n /**\r\n * Updates the metadata for this object.\r\n * @param metadata The new metadata for the object.\r\n * Only values that have been explicitly set will be changed. Explicitly\r\n * setting a value to null will remove the metadata.\r\n * @return A promise that resolves\r\n * with the new metadata for this object.\r\n * @see firebaseStorage.Reference.prototype.getMetadata\r\n */\n Reference.prototype.updateMetadata = function (metadata) {\n var _this = this;\n validate('updateMetadata', [metadataSpec()], arguments);\n this.throwIfRoot_('updateMetadata');\n return this.service.getAuthToken().then(function (authToken) {\n var requestInfo = updateMetadata(_this.service, _this.location, metadata, _this.mappings());\n return _this.service.makeRequest(requestInfo, authToken).getPromise();\n });\n };\n /**\r\n * @return A promise that resolves with the download\r\n * URL for this object.\r\n */\n Reference.prototype.getDownloadURL = function () {\n var _this = this;\n validate('getDownloadURL', [], arguments);\n this.throwIfRoot_('getDownloadURL');\n return this.service.getAuthToken().then(function (authToken) {\n var requestInfo = getDownloadUrl(_this.service, _this.location, _this.mappings());\n return _this.service.makeRequest(requestInfo, authToken).getPromise().then(function (url) {\n if (url === null) {\n throw noDownloadURL();\n }\n return url;\n });\n });\n };\n Reference.prototype.throwIfRoot_ = function (name) {\n if (this.location.path === '') {\n throw invalidRootOperation(name);\n }\n };\n return Reference;\n}();\n\n/**\r\n * A request whose promise always fails.\r\n * @struct\r\n * @template T\r\n */\nvar FailRequest = /** @class */function () {\n function FailRequest(error) {\n this.promise_ = Promise.reject(error);\n }\n /** @inheritDoc */\n FailRequest.prototype.getPromise = function () {\n return this.promise_;\n };\n /** @inheritDoc */\n FailRequest.prototype.cancel = function (_appDelete) {};\n return FailRequest;\n}();\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * @param f May be invoked\r\n * before the function returns.\r\n * @param callback Get all the arguments passed to the function\r\n * passed to f, including the initial boolean.\r\n */\nfunction start(f,\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ncallback, timeout) {\n // TODO(andysoto): make this code cleaner (probably refactor into an actual\n // type instead of a bunch of functions with state shared in the closure)\n var waitSeconds = 1;\n // Would type this as \"number\" but that doesn't work for Node so ¯\\_(ツ)_/¯\n // TODO: find a way to exclude Node type definition for storage because storage only works in browser\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n var timeoutId = null;\n var hitTimeout = false;\n var cancelState = 0;\n function canceled() {\n return cancelState === 2;\n }\n var triggeredCallback = false;\n // TODO: This disable can be removed and the 'ignoreRestArgs' option added to\n // the no-explicit-any rule when ESlint releases it.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function triggerCallback() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (!triggeredCallback) {\n triggeredCallback = true;\n callback.apply(null, args);\n }\n }\n function callWithDelay(millis) {\n timeoutId = setTimeout(function () {\n timeoutId = null;\n f(handler, canceled());\n }, millis);\n }\n // TODO: This disable can be removed and the 'ignoreRestArgs' option added to\n // the no-explicit-any rule when ESlint releases it.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function handler(success) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n if (triggeredCallback) {\n return;\n }\n if (success) {\n triggerCallback.call.apply(triggerCallback, __spreadArrays([null, success], args));\n return;\n }\n var mustStop = canceled() || hitTimeout;\n if (mustStop) {\n triggerCallback.call.apply(triggerCallback, __spreadArrays([null, success], args));\n return;\n }\n if (waitSeconds < 64) {\n /* TODO(andysoto): don't back off so quickly if we know we're offline. */\n waitSeconds *= 2;\n }\n var waitMillis;\n if (cancelState === 1) {\n cancelState = 2;\n waitMillis = 0;\n } else {\n waitMillis = (waitSeconds + Math.random()) * 1000;\n }\n callWithDelay(waitMillis);\n }\n var stopped = false;\n function stop(wasTimeout) {\n if (stopped) {\n return;\n }\n stopped = true;\n if (triggeredCallback) {\n return;\n }\n if (timeoutId !== null) {\n if (!wasTimeout) {\n cancelState = 2;\n }\n clearTimeout(timeoutId);\n callWithDelay(0);\n } else {\n if (!wasTimeout) {\n cancelState = 1;\n }\n }\n }\n callWithDelay(0);\n setTimeout(function () {\n hitTimeout = true;\n stop(true);\n }, timeout);\n return stop;\n}\n/**\r\n * Stops the retry loop from repeating.\r\n * If the function is currently \"in between\" retries, it is invoked immediately\r\n * with the second parameter as \"true\". Otherwise, it will be invoked once more\r\n * after the current invocation finishes iff the current invocation would have\r\n * triggered another retry.\r\n */\nfunction stop(id) {\n id(false);\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * @struct\r\n * @template T\r\n */\nvar NetworkRequest = /** @class */function () {\n function NetworkRequest(url, method, headers, body, successCodes, additionalRetryCodes, callback, errorCallback, timeout, progressCallback, pool) {\n var _this = this;\n this.pendingXhr_ = null;\n this.backoffId_ = null;\n this.canceled_ = false;\n this.appDelete_ = false;\n this.url_ = url;\n this.method_ = method;\n this.headers_ = headers;\n this.body_ = body;\n this.successCodes_ = successCodes.slice();\n this.additionalRetryCodes_ = additionalRetryCodes.slice();\n this.callback_ = callback;\n this.errorCallback_ = errorCallback;\n this.progressCallback_ = progressCallback;\n this.timeout_ = timeout;\n this.pool_ = pool;\n this.promise_ = new Promise(function (resolve, reject) {\n _this.resolve_ = resolve;\n _this.reject_ = reject;\n _this.start_();\n });\n }\n /**\r\n * Actually starts the retry loop.\r\n */\n NetworkRequest.prototype.start_ = function () {\n var self = this;\n function doTheRequest(backoffCallback, canceled) {\n if (canceled) {\n backoffCallback(false, new RequestEndStatus(false, null, true));\n return;\n }\n var xhr = self.pool_.createXhrIo();\n self.pendingXhr_ = xhr;\n function progressListener(progressEvent) {\n var loaded = progressEvent.loaded;\n var total = progressEvent.lengthComputable ? progressEvent.total : -1;\n if (self.progressCallback_ !== null) {\n self.progressCallback_(loaded, total);\n }\n }\n if (self.progressCallback_ !== null) {\n xhr.addUploadProgressListener(progressListener);\n }\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n xhr.send(self.url_, self.method_, self.body_, self.headers_).then(function (xhr) {\n if (self.progressCallback_ !== null) {\n xhr.removeUploadProgressListener(progressListener);\n }\n self.pendingXhr_ = null;\n xhr = xhr;\n var hitServer = xhr.getErrorCode() === ErrorCode.NO_ERROR;\n var status = xhr.getStatus();\n if (!hitServer || self.isRetryStatusCode_(status)) {\n var wasCanceled = xhr.getErrorCode() === ErrorCode.ABORT;\n backoffCallback(false, new RequestEndStatus(false, null, wasCanceled));\n return;\n }\n var successCode = self.successCodes_.indexOf(status) !== -1;\n backoffCallback(true, new RequestEndStatus(successCode, xhr));\n });\n }\n /**\r\n * @param requestWentThrough True if the request eventually went\r\n * through, false if it hit the retry limit or was canceled.\r\n */\n function backoffDone(requestWentThrough, status) {\n var resolve = self.resolve_;\n var reject = self.reject_;\n var xhr = status.xhr;\n if (status.wasSuccessCode) {\n try {\n var result = self.callback_(xhr, xhr.getResponseText());\n if (isJustDef(result)) {\n resolve(result);\n } else {\n resolve();\n }\n } catch (e) {\n reject(e);\n }\n } else {\n if (xhr !== null) {\n var err = unknown();\n err.setServerResponseProp(xhr.getResponseText());\n if (self.errorCallback_) {\n reject(self.errorCallback_(xhr, err));\n } else {\n reject(err);\n }\n } else {\n if (status.canceled) {\n var err = self.appDelete_ ? appDeleted() : canceled();\n reject(err);\n } else {\n var err = retryLimitExceeded();\n reject(err);\n }\n }\n }\n }\n if (this.canceled_) {\n backoffDone(false, new RequestEndStatus(false, null, true));\n } else {\n this.backoffId_ = start(doTheRequest, backoffDone, this.timeout_);\n }\n };\n /** @inheritDoc */\n NetworkRequest.prototype.getPromise = function () {\n return this.promise_;\n };\n /** @inheritDoc */\n NetworkRequest.prototype.cancel = function (appDelete) {\n this.canceled_ = true;\n this.appDelete_ = appDelete || false;\n if (this.backoffId_ !== null) {\n stop(this.backoffId_);\n }\n if (this.pendingXhr_ !== null) {\n this.pendingXhr_.abort();\n }\n };\n NetworkRequest.prototype.isRetryStatusCode_ = function (status) {\n // The codes for which to retry came from this page:\n // https://cloud.google.com/storage/docs/exponential-backoff\n var isFiveHundredCode = status >= 500 && status < 600;\n var extraRetryCodes = [\n // Request Timeout: web server didn't receive full request in time.\n 408,\n // Too Many Requests: you're getting rate-limited, basically.\n 429];\n var isExtraRetryCode = extraRetryCodes.indexOf(status) !== -1;\n var isRequestSpecificRetryCode = this.additionalRetryCodes_.indexOf(status) !== -1;\n return isFiveHundredCode || isExtraRetryCode || isRequestSpecificRetryCode;\n };\n return NetworkRequest;\n}();\n/**\r\n * A collection of information about the result of a network request.\r\n * @param opt_canceled Defaults to false.\r\n * @struct\r\n */\nvar RequestEndStatus = /** @class */function () {\n function RequestEndStatus(wasSuccessCode, xhr, canceled) {\n this.wasSuccessCode = wasSuccessCode;\n this.xhr = xhr;\n this.canceled = !!canceled;\n }\n return RequestEndStatus;\n}();\nfunction addAuthHeader_(headers, authToken) {\n if (authToken !== null && authToken.length > 0) {\n headers['Authorization'] = 'Firebase ' + authToken;\n }\n}\nfunction addVersionHeader_(headers) {\n var version = typeof firebase !== 'undefined' ? firebase.SDK_VERSION : 'AppManager';\n headers['X-Firebase-Storage-Version'] = 'webjs/' + version;\n}\nfunction addGmpidHeader_(headers, appId) {\n if (appId) {\n headers['X-Firebase-GMPID'] = appId;\n }\n}\n/**\r\n * @template T\r\n */\nfunction makeRequest(requestInfo, appId, authToken, pool) {\n var queryPart = makeQueryString(requestInfo.urlParams);\n var url = requestInfo.url + queryPart;\n var headers = Object.assign({}, requestInfo.headers);\n addGmpidHeader_(headers, appId);\n addAuthHeader_(headers, authToken);\n addVersionHeader_(headers);\n return new NetworkRequest(url, requestInfo.method, headers, requestInfo.body, requestInfo.successCodes, requestInfo.additionalRetryCodes, requestInfo.handler, requestInfo.errorHandler, requestInfo.timeout, requestInfo.progressCallback, pool);\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * A service that provides firebaseStorage.Reference instances.\r\n * @param opt_url gs:// url to a custom Storage Bucket\r\n *\r\n * @struct\r\n */\nvar StorageService = /** @class */function () {\n function StorageService(app, authProvider, pool, url) {\n var _a;\n this.bucket_ = null;\n this.appId_ = null;\n this.deleted_ = false;\n this.app_ = app;\n this.authProvider_ = authProvider;\n this.maxOperationRetryTime_ = DEFAULT_MAX_OPERATION_RETRY_TIME;\n this.maxUploadRetryTime_ = DEFAULT_MAX_UPLOAD_RETRY_TIME;\n this.requests_ = new Set();\n this.pool_ = pool;\n if (url != null) {\n this.bucket_ = Location.makeFromBucketSpec(url);\n } else {\n this.bucket_ = StorageService.extractBucket_((_a = this.app_) === null || _a === void 0 ? void 0 : _a.options);\n }\n this.internals_ = new ServiceInternals(this);\n }\n StorageService.extractBucket_ = function (config) {\n var bucketString = config === null || config === void 0 ? void 0 : config[CONFIG_STORAGE_BUCKET_KEY];\n if (bucketString == null) {\n return null;\n }\n return Location.makeFromBucketSpec(bucketString);\n };\n StorageService.prototype.getAuthToken = function () {\n return __awaiter(this, void 0, void 0, function () {\n var auth, tokenData;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n auth = this.authProvider_.getImmediate({\n optional: true\n });\n if (!auth) return [3 /*break*/, 2];\n return [4 /*yield*/, auth.getToken()];\n case 1:\n tokenData = _a.sent();\n if (tokenData !== null) {\n return [2 /*return*/, tokenData.accessToken];\n }\n _a.label = 2;\n case 2:\n return [2 /*return*/, null];\n }\n });\n });\n };\n /**\r\n * Stop running requests and prevent more from being created.\r\n */\n StorageService.prototype.deleteApp = function () {\n this.deleted_ = true;\n this.app_ = null;\n this.requests_.forEach(function (request) {\n return request.cancel();\n });\n this.requests_.clear();\n };\n /**\r\n * Returns a new firebaseStorage.Reference object referencing this StorageService\r\n * at the given Location.\r\n * @param loc The Location.\r\n * @return A firebaseStorage.Reference.\r\n */\n StorageService.prototype.makeStorageReference = function (loc) {\n return new Reference(this, loc);\n };\n StorageService.prototype.makeRequest = function (requestInfo, authToken) {\n var _this = this;\n if (!this.deleted_) {\n var request_1 = makeRequest(requestInfo, this.appId_, authToken, this.pool_);\n this.requests_.add(request_1);\n // Request removes itself from set when complete.\n request_1.getPromise().then(function () {\n return _this.requests_.delete(request_1);\n }, function () {\n return _this.requests_.delete(request_1);\n });\n return request_1;\n } else {\n return new FailRequest(appDeleted());\n }\n };\n /**\r\n * Returns a firebaseStorage.Reference for the given path in the default\r\n * bucket.\r\n */\n StorageService.prototype.ref = function (path) {\n function validator(path) {\n if (typeof path !== 'string') {\n throw 'Path is not a string.';\n }\n if (/^[A-Za-z]+:\\/\\//.test(path)) {\n throw 'Expected child path but got a URL, use refFromURL instead.';\n }\n }\n validate('ref', [stringSpec(validator, true)], arguments);\n if (this.bucket_ == null) {\n throw new Error('No Storage Bucket defined in Firebase Options.');\n }\n var ref = new Reference(this, this.bucket_);\n if (path != null) {\n return ref.child(path);\n } else {\n return ref;\n }\n };\n /**\r\n * Returns a firebaseStorage.Reference object for the given absolute URL,\r\n * which must be a gs:// or http[s]:// URL.\r\n */\n StorageService.prototype.refFromURL = function (url) {\n function validator(p) {\n if (typeof p !== 'string') {\n throw 'Path is not a string.';\n }\n if (!/^[A-Za-z]+:\\/\\//.test(p)) {\n throw 'Expected full URL but got a child path, use ref instead.';\n }\n try {\n Location.makeFromUrl(p);\n } catch (e) {\n throw 'Expected valid full URL but got an invalid one.';\n }\n }\n validate('refFromURL', [stringSpec(validator, false)], arguments);\n return new Reference(this, url);\n };\n Object.defineProperty(StorageService.prototype, \"maxUploadRetryTime\", {\n get: function () {\n return this.maxUploadRetryTime_;\n },\n enumerable: false,\n configurable: true\n });\n StorageService.prototype.setMaxUploadRetryTime = function (time) {\n validate('setMaxUploadRetryTime', [nonNegativeNumberSpec()], arguments);\n this.maxUploadRetryTime_ = time;\n };\n Object.defineProperty(StorageService.prototype, \"maxOperationRetryTime\", {\n get: function () {\n return this.maxOperationRetryTime_;\n },\n enumerable: false,\n configurable: true\n });\n StorageService.prototype.setMaxOperationRetryTime = function (time) {\n validate('setMaxOperationRetryTime', [nonNegativeNumberSpec()], arguments);\n this.maxOperationRetryTime_ = time;\n };\n Object.defineProperty(StorageService.prototype, \"app\", {\n get: function () {\n return this.app_;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(StorageService.prototype, \"INTERNAL\", {\n get: function () {\n return this.internals_;\n },\n enumerable: false,\n configurable: true\n });\n return StorageService;\n}();\n/**\r\n * @struct\r\n */\nvar ServiceInternals = /** @class */function () {\n function ServiceInternals(service) {\n this.service_ = service;\n }\n /**\r\n * Called when the associated app is deleted.\r\n */\n ServiceInternals.prototype.delete = function () {\n this.service_.deleteApp();\n return Promise.resolve();\n };\n return ServiceInternals;\n}();\nvar name = \"@firebase/storage\";\nvar version = \"0.3.43\";\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Type constant for Firebase Storage.\r\n */\nvar STORAGE_TYPE = 'storage';\nfunction factory(container, url) {\n // Dependencies\n var app = container.getProvider('app').getImmediate();\n var authProvider = container.getProvider('auth-internal');\n return new StorageService(app, authProvider, new XhrIoPool(), url);\n}\nfunction registerStorage(instance) {\n var namespaceExports = {\n // no-inline\n TaskState: TaskState,\n TaskEvent: TaskEvent,\n StringFormat: StringFormat,\n Storage: StorageService,\n Reference: Reference\n };\n instance.INTERNAL.registerComponent(new Component(STORAGE_TYPE, factory, \"PUBLIC\" /* PUBLIC */).setServiceProps(namespaceExports).setMultipleInstances(true));\n instance.registerVersion(name, version);\n}\nregisterStorage(firebase);\nexport { registerStorage };","'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n});\nvar tslib = require('tslib');\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * @fileoverview Firebase constants. Some of these (@defines) can be overridden at compile-time.\r\n */\nvar CONSTANTS = {\n /**\r\n * @define {boolean} Whether this is the client Node.js SDK.\r\n */\n NODE_CLIENT: false,\n /**\r\n * @define {boolean} Whether this is the Admin Node.js SDK.\r\n */\n NODE_ADMIN: false,\n /**\r\n * Firebase SDK Version\r\n */\n SDK_VERSION: '${JSCORE_VERSION}'\n};\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Throws an error if the provided assertion is falsy\r\n */\nvar assert = function (assertion, message) {\n if (!assertion) {\n throw assertionError(message);\n }\n};\n/**\r\n * Returns an Error object suitable for throwing.\r\n */\nvar assertionError = function (message) {\n return new Error('Firebase Database (' + CONSTANTS.SDK_VERSION + ') INTERNAL ASSERT FAILED: ' + message);\n};\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nvar stringToByteArray = function (str) {\n // TODO(user): Use native implementations if/when available\n var out = [];\n var p = 0;\n for (var i = 0; i < str.length; i++) {\n var c = str.charCodeAt(i);\n if (c < 128) {\n out[p++] = c;\n } else if (c < 2048) {\n out[p++] = c >> 6 | 192;\n out[p++] = c & 63 | 128;\n } else if ((c & 0xfc00) === 0xd800 && i + 1 < str.length && (str.charCodeAt(i + 1) & 0xfc00) === 0xdc00) {\n // Surrogate Pair\n c = 0x10000 + ((c & 0x03ff) << 10) + (str.charCodeAt(++i) & 0x03ff);\n out[p++] = c >> 18 | 240;\n out[p++] = c >> 12 & 63 | 128;\n out[p++] = c >> 6 & 63 | 128;\n out[p++] = c & 63 | 128;\n } else {\n out[p++] = c >> 12 | 224;\n out[p++] = c >> 6 & 63 | 128;\n out[p++] = c & 63 | 128;\n }\n }\n return out;\n};\n/**\r\n * Turns an array of numbers into the string given by the concatenation of the\r\n * characters to which the numbers correspond.\r\n * @param bytes Array of numbers representing characters.\r\n * @return Stringification of the array.\r\n */\nvar byteArrayToString = function (bytes) {\n // TODO(user): Use native implementations if/when available\n var out = [];\n var pos = 0,\n c = 0;\n while (pos < bytes.length) {\n var c1 = bytes[pos++];\n if (c1 < 128) {\n out[c++] = String.fromCharCode(c1);\n } else if (c1 > 191 && c1 < 224) {\n var c2 = bytes[pos++];\n out[c++] = String.fromCharCode((c1 & 31) << 6 | c2 & 63);\n } else if (c1 > 239 && c1 < 365) {\n // Surrogate Pair\n var c2 = bytes[pos++];\n var c3 = bytes[pos++];\n var c4 = bytes[pos++];\n var u = ((c1 & 7) << 18 | (c2 & 63) << 12 | (c3 & 63) << 6 | c4 & 63) - 0x10000;\n out[c++] = String.fromCharCode(0xd800 + (u >> 10));\n out[c++] = String.fromCharCode(0xdc00 + (u & 1023));\n } else {\n var c2 = bytes[pos++];\n var c3 = bytes[pos++];\n out[c++] = String.fromCharCode((c1 & 15) << 12 | (c2 & 63) << 6 | c3 & 63);\n }\n }\n return out.join('');\n};\n// We define it as an object literal instead of a class because a class compiled down to es5 can't\n// be treeshaked. https://github.com/rollup/rollup/issues/1691\n// Static lookup maps, lazily populated by init_()\nvar base64 = {\n /**\r\n * Maps bytes to characters.\r\n */\n byteToCharMap_: null,\n /**\r\n * Maps characters to bytes.\r\n */\n charToByteMap_: null,\n /**\r\n * Maps bytes to websafe characters.\r\n * @private\r\n */\n byteToCharMapWebSafe_: null,\n /**\r\n * Maps websafe characters to bytes.\r\n * @private\r\n */\n charToByteMapWebSafe_: null,\n /**\r\n * Our default alphabet, shared between\r\n * ENCODED_VALS and ENCODED_VALS_WEBSAFE\r\n */\n ENCODED_VALS_BASE: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + 'abcdefghijklmnopqrstuvwxyz' + '0123456789',\n /**\r\n * Our default alphabet. Value 64 (=) is special; it means \"nothing.\"\r\n */\n get ENCODED_VALS() {\n return this.ENCODED_VALS_BASE + '+/=';\n },\n /**\r\n * Our websafe alphabet.\r\n */\n get ENCODED_VALS_WEBSAFE() {\n return this.ENCODED_VALS_BASE + '-_.';\n },\n /**\r\n * Whether this browser supports the atob and btoa functions. This extension\r\n * started at Mozilla but is now implemented by many browsers. We use the\r\n * ASSUME_* variables to avoid pulling in the full useragent detection library\r\n * but still allowing the standard per-browser compilations.\r\n *\r\n */\n HAS_NATIVE_SUPPORT: typeof atob === 'function',\n /**\r\n * Base64-encode an array of bytes.\r\n *\r\n * @param input An array of bytes (numbers with\r\n * value in [0, 255]) to encode.\r\n * @param webSafe Boolean indicating we should use the\r\n * alternative alphabet.\r\n * @return The base64 encoded string.\r\n */\n encodeByteArray: function (input, webSafe) {\n if (!Array.isArray(input)) {\n throw Error('encodeByteArray takes an array as a parameter');\n }\n this.init_();\n var byteToCharMap = webSafe ? this.byteToCharMapWebSafe_ : this.byteToCharMap_;\n var output = [];\n for (var i = 0; i < input.length; i += 3) {\n var byte1 = input[i];\n var haveByte2 = i + 1 < input.length;\n var byte2 = haveByte2 ? input[i + 1] : 0;\n var haveByte3 = i + 2 < input.length;\n var byte3 = haveByte3 ? input[i + 2] : 0;\n var outByte1 = byte1 >> 2;\n var outByte2 = (byte1 & 0x03) << 4 | byte2 >> 4;\n var outByte3 = (byte2 & 0x0f) << 2 | byte3 >> 6;\n var outByte4 = byte3 & 0x3f;\n if (!haveByte3) {\n outByte4 = 64;\n if (!haveByte2) {\n outByte3 = 64;\n }\n }\n output.push(byteToCharMap[outByte1], byteToCharMap[outByte2], byteToCharMap[outByte3], byteToCharMap[outByte4]);\n }\n return output.join('');\n },\n /**\r\n * Base64-encode a string.\r\n *\r\n * @param input A string to encode.\r\n * @param webSafe If true, we should use the\r\n * alternative alphabet.\r\n * @return The base64 encoded string.\r\n */\n encodeString: function (input, webSafe) {\n // Shortcut for Mozilla browsers that implement\n // a native base64 encoder in the form of \"btoa/atob\"\n if (this.HAS_NATIVE_SUPPORT && !webSafe) {\n return btoa(input);\n }\n return this.encodeByteArray(stringToByteArray(input), webSafe);\n },\n /**\r\n * Base64-decode a string.\r\n *\r\n * @param input to decode.\r\n * @param webSafe True if we should use the\r\n * alternative alphabet.\r\n * @return string representing the decoded value.\r\n */\n decodeString: function (input, webSafe) {\n // Shortcut for Mozilla browsers that implement\n // a native base64 encoder in the form of \"btoa/atob\"\n if (this.HAS_NATIVE_SUPPORT && !webSafe) {\n return atob(input);\n }\n return byteArrayToString(this.decodeStringToByteArray(input, webSafe));\n },\n /**\r\n * Base64-decode a string.\r\n *\r\n * In base-64 decoding, groups of four characters are converted into three\r\n * bytes. If the encoder did not apply padding, the input length may not\r\n * be a multiple of 4.\r\n *\r\n * In this case, the last group will have fewer than 4 characters, and\r\n * padding will be inferred. If the group has one or two characters, it decodes\r\n * to one byte. If the group has three characters, it decodes to two bytes.\r\n *\r\n * @param input Input to decode.\r\n * @param webSafe True if we should use the web-safe alphabet.\r\n * @return bytes representing the decoded value.\r\n */\n decodeStringToByteArray: function (input, webSafe) {\n this.init_();\n var charToByteMap = webSafe ? this.charToByteMapWebSafe_ : this.charToByteMap_;\n var output = [];\n for (var i = 0; i < input.length;) {\n var byte1 = charToByteMap[input.charAt(i++)];\n var haveByte2 = i < input.length;\n var byte2 = haveByte2 ? charToByteMap[input.charAt(i)] : 0;\n ++i;\n var haveByte3 = i < input.length;\n var byte3 = haveByte3 ? charToByteMap[input.charAt(i)] : 64;\n ++i;\n var haveByte4 = i < input.length;\n var byte4 = haveByte4 ? charToByteMap[input.charAt(i)] : 64;\n ++i;\n if (byte1 == null || byte2 == null || byte3 == null || byte4 == null) {\n throw Error();\n }\n var outByte1 = byte1 << 2 | byte2 >> 4;\n output.push(outByte1);\n if (byte3 !== 64) {\n var outByte2 = byte2 << 4 & 0xf0 | byte3 >> 2;\n output.push(outByte2);\n if (byte4 !== 64) {\n var outByte3 = byte3 << 6 & 0xc0 | byte4;\n output.push(outByte3);\n }\n }\n }\n return output;\n },\n /**\r\n * Lazy static initialization function. Called before\r\n * accessing any of the static map variables.\r\n * @private\r\n */\n init_: function () {\n if (!this.byteToCharMap_) {\n this.byteToCharMap_ = {};\n this.charToByteMap_ = {};\n this.byteToCharMapWebSafe_ = {};\n this.charToByteMapWebSafe_ = {};\n // We want quick mappings back and forth, so we precompute two maps.\n for (var i = 0; i < this.ENCODED_VALS.length; i++) {\n this.byteToCharMap_[i] = this.ENCODED_VALS.charAt(i);\n this.charToByteMap_[this.byteToCharMap_[i]] = i;\n this.byteToCharMapWebSafe_[i] = this.ENCODED_VALS_WEBSAFE.charAt(i);\n this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[i]] = i;\n // Be forgiving when decoding and correctly decode both encodings.\n if (i >= this.ENCODED_VALS_BASE.length) {\n this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(i)] = i;\n this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(i)] = i;\n }\n }\n }\n }\n};\n/**\r\n * URL-safe base64 encoding\r\n */\nvar base64Encode = function (str) {\n var utf8Bytes = stringToByteArray(str);\n return base64.encodeByteArray(utf8Bytes, true);\n};\n/**\r\n * URL-safe base64 decoding\r\n *\r\n * NOTE: DO NOT use the global atob() function - it does NOT support the\r\n * base64Url variant encoding.\r\n *\r\n * @param str To be decoded\r\n * @return Decoded result, if possible\r\n */\nvar base64Decode = function (str) {\n try {\n return base64.decodeString(str, true);\n } catch (e) {\n console.error('base64Decode failed: ', e);\n }\n return null;\n};\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Do a deep-copy of basic JavaScript Objects or Arrays.\r\n */\nfunction deepCopy(value) {\n return deepExtend(undefined, value);\n}\n/**\r\n * Copy properties from source to target (recursively allows extension\r\n * of Objects and Arrays). Scalar values in the target are over-written.\r\n * If target is undefined, an object of the appropriate type will be created\r\n * (and returned).\r\n *\r\n * We recursively copy all child properties of plain Objects in the source- so\r\n * that namespace- like dictionaries are merged.\r\n *\r\n * Note that the target can be a function, in which case the properties in\r\n * the source Object are copied onto it as static properties of the Function.\r\n */\nfunction deepExtend(target, source) {\n if (!(source instanceof Object)) {\n return source;\n }\n switch (source.constructor) {\n case Date:\n // Treat Dates like scalars; if the target date object had any child\n // properties - they will be lost!\n var dateValue = source;\n return new Date(dateValue.getTime());\n case Object:\n if (target === undefined) {\n target = {};\n }\n break;\n case Array:\n // Always copy the array source and overwrite the target.\n target = [];\n break;\n default:\n // Not a plain Object - treat it as a scalar.\n return source;\n }\n for (var prop in source) {\n if (!source.hasOwnProperty(prop)) {\n continue;\n }\n target[prop] = deepExtend(target[prop], source[prop]);\n }\n return target;\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nvar Deferred = /** @class */function () {\n function Deferred() {\n var _this = this;\n this.reject = function () {};\n this.resolve = function () {};\n this.promise = new Promise(function (resolve, reject) {\n _this.resolve = resolve;\n _this.reject = reject;\n });\n }\n /**\r\n * Our API internals are not promiseified and cannot because our callback APIs have subtle expectations around\r\n * invoking promises inline, which Promises are forbidden to do. This method accepts an optional node-style callback\r\n * and returns a node-style callback which will resolve or reject the Deferred's promise.\r\n */\n Deferred.prototype.wrapCallback = function (callback) {\n var _this = this;\n return function (error, value) {\n if (error) {\n _this.reject(error);\n } else {\n _this.resolve(value);\n }\n if (typeof callback === 'function') {\n // Attaching noop handler just in case developer wasn't expecting\n // promises\n _this.promise.catch(function () {});\n // Some of our callbacks don't expect a value and our own tests\n // assert that the parameter length is 1\n if (callback.length === 1) {\n callback(error);\n } else {\n callback(error, value);\n }\n }\n };\n };\n return Deferred;\n}();\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Returns navigator.userAgent string or '' if it's not defined.\r\n * @return user agent string\r\n */\nfunction getUA() {\n if (typeof navigator !== 'undefined' && typeof navigator['userAgent'] === 'string') {\n return navigator['userAgent'];\n } else {\n return '';\n }\n}\n/**\r\n * Detect Cordova / PhoneGap / Ionic frameworks on a mobile device.\r\n *\r\n * Deliberately does not rely on checking `file://` URLs (as this fails PhoneGap\r\n * in the Ripple emulator) nor Cordova `onDeviceReady`, which would normally\r\n * wait for a callback.\r\n */\nfunction isMobileCordova() {\n return typeof window !== 'undefined' &&\n // @ts-ignore Setting up an broadly applicable index signature for Window\n // just to deal with this case would probably be a bad idea.\n !!(window['cordova'] || window['phonegap'] || window['PhoneGap']) && /ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(getUA());\n}\n/**\r\n * Detect Node.js.\r\n *\r\n * @return true if Node.js environment is detected.\r\n */\n// Node detection logic from: https://github.com/iliakan/detect-node/\nfunction isNode() {\n try {\n return Object.prototype.toString.call(global.process) === '[object process]';\n } catch (e) {\n return false;\n }\n}\n/**\r\n * Detect Browser Environment\r\n */\nfunction isBrowser() {\n return typeof self === 'object' && self.self === self;\n}\nfunction isBrowserExtension() {\n var runtime = typeof chrome === 'object' ? chrome.runtime : typeof browser === 'object' ? browser.runtime : undefined;\n return typeof runtime === 'object' && runtime.id !== undefined;\n}\n/**\r\n * Detect React Native.\r\n *\r\n * @return true if ReactNative environment is detected.\r\n */\nfunction isReactNative() {\n return typeof navigator === 'object' && navigator['product'] === 'ReactNative';\n}\n/** Detects Electron apps. */\nfunction isElectron() {\n return getUA().indexOf('Electron/') >= 0;\n}\n/** Detects Internet Explorer. */\nfunction isIE() {\n var ua = getUA();\n return ua.indexOf('MSIE ') >= 0 || ua.indexOf('Trident/') >= 0;\n}\n/** Detects Universal Windows Platform apps. */\nfunction isUWP() {\n return getUA().indexOf('MSAppHost/') >= 0;\n}\n/**\r\n * Detect whether the current SDK build is the Node version.\r\n *\r\n * @return true if it's the Node SDK build.\r\n */\nfunction isNodeSdk() {\n return CONSTANTS.NODE_CLIENT === true || CONSTANTS.NODE_ADMIN === true;\n}\n/** Returns true if we are running in Safari. */\nfunction isSafari() {\n return !isNode() && navigator.userAgent.includes('Safari') && !navigator.userAgent.includes('Chrome');\n}\n/**\r\n * This method checks if indexedDB is supported by current browser/service worker context\r\n * @return true if indexedDB is supported by current browser/service worker context\r\n */\nfunction isIndexedDBAvailable() {\n return 'indexedDB' in self && indexedDB != null;\n}\n/**\r\n * This method validates browser context for indexedDB by opening a dummy indexedDB database and reject\r\n * if errors occur during the database open operation.\r\n */\nfunction validateIndexedDBOpenable() {\n return new Promise(function (resolve, reject) {\n try {\n var preExist_1 = true;\n var DB_CHECK_NAME_1 = 'validate-browser-context-for-indexeddb-analytics-module';\n var request_1 = window.indexedDB.open(DB_CHECK_NAME_1);\n request_1.onsuccess = function () {\n request_1.result.close();\n // delete database only when it doesn't pre-exist\n if (!preExist_1) {\n window.indexedDB.deleteDatabase(DB_CHECK_NAME_1);\n }\n resolve(true);\n };\n request_1.onupgradeneeded = function () {\n preExist_1 = false;\n };\n request_1.onerror = function () {\n var _a;\n reject(((_a = request_1.error) === null || _a === void 0 ? void 0 : _a.message) || '');\n };\n } catch (error) {\n reject(error);\n }\n });\n}\n/**\r\n *\r\n * This method checks whether cookie is enabled within current browser\r\n * @return true if cookie is enabled within current browser\r\n */\nfunction areCookiesEnabled() {\n if (!navigator || !navigator.cookieEnabled) {\n return false;\n }\n return true;\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nvar ERROR_NAME = 'FirebaseError';\n// Based on code from:\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Custom_Error_Types\nvar FirebaseError = /** @class */function (_super) {\n tslib.__extends(FirebaseError, _super);\n function FirebaseError(code, message) {\n var _this = _super.call(this, message) || this;\n _this.code = code;\n _this.name = ERROR_NAME;\n // Fix For ES5\n // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\n Object.setPrototypeOf(_this, FirebaseError.prototype);\n // Maintains proper stack trace for where our error was thrown.\n // Only available on V8.\n if (Error.captureStackTrace) {\n Error.captureStackTrace(_this, ErrorFactory.prototype.create);\n }\n return _this;\n }\n return FirebaseError;\n}(Error);\nvar ErrorFactory = /** @class */function () {\n function ErrorFactory(service, serviceName, errors) {\n this.service = service;\n this.serviceName = serviceName;\n this.errors = errors;\n }\n ErrorFactory.prototype.create = function (code) {\n var data = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n data[_i - 1] = arguments[_i];\n }\n var customData = data[0] || {};\n var fullCode = this.service + \"/\" + code;\n var template = this.errors[code];\n var message = template ? replaceTemplate(template, customData) : 'Error';\n // Service Name: Error message (service/code).\n var fullMessage = this.serviceName + \": \" + message + \" (\" + fullCode + \").\";\n var error = new FirebaseError(fullCode, fullMessage);\n // Keys with an underscore at the end of their name are not included in\n // error.data for some reason.\n // TODO: Replace with Object.entries when lib is updated to es2017.\n for (var _a = 0, _b = Object.keys(customData); _a < _b.length; _a++) {\n var key = _b[_a];\n if (key.slice(-1) !== '_') {\n if (key in error) {\n console.warn(\"Overwriting FirebaseError base field \\\"\" + key + \"\\\" can cause unexpected behavior.\");\n }\n error[key] = customData[key];\n }\n }\n return error;\n };\n return ErrorFactory;\n}();\nfunction replaceTemplate(template, data) {\n return template.replace(PATTERN, function (_, key) {\n var value = data[key];\n return value != null ? String(value) : \"<\" + key + \"?>\";\n });\n}\nvar PATTERN = /\\{\\$([^}]+)}/g;\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Evaluates a JSON string into a javascript object.\r\n *\r\n * @param {string} str A string containing JSON.\r\n * @return {*} The javascript object representing the specified JSON.\r\n */\nfunction jsonEval(str) {\n return JSON.parse(str);\n}\n/**\r\n * Returns JSON representing a javascript object.\r\n * @param {*} data Javascript object to be stringified.\r\n * @return {string} The JSON contents of the object.\r\n */\nfunction stringify(data) {\n return JSON.stringify(data);\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Decodes a Firebase auth. token into constituent parts.\r\n *\r\n * Notes:\r\n * - May return with invalid / incomplete claims if there's no native base64 decoding support.\r\n * - Doesn't check if the token is actually valid.\r\n */\nvar decode = function (token) {\n var header = {},\n claims = {},\n data = {},\n signature = '';\n try {\n var parts = token.split('.');\n header = jsonEval(base64Decode(parts[0]) || '');\n claims = jsonEval(base64Decode(parts[1]) || '');\n signature = parts[2];\n data = claims['d'] || {};\n delete claims['d'];\n } catch (e) {}\n return {\n header: header,\n claims: claims,\n data: data,\n signature: signature\n };\n};\n/**\r\n * Decodes a Firebase auth. token and checks the validity of its time-based claims. Will return true if the\r\n * token is within the time window authorized by the 'nbf' (not-before) and 'iat' (issued-at) claims.\r\n *\r\n * Notes:\r\n * - May return a false negative if there's no native base64 decoding support.\r\n * - Doesn't check if the token is actually valid.\r\n */\nvar isValidTimestamp = function (token) {\n var claims = decode(token).claims;\n var now = Math.floor(new Date().getTime() / 1000);\n var validSince = 0,\n validUntil = 0;\n if (typeof claims === 'object') {\n if (claims.hasOwnProperty('nbf')) {\n validSince = claims['nbf'];\n } else if (claims.hasOwnProperty('iat')) {\n validSince = claims['iat'];\n }\n if (claims.hasOwnProperty('exp')) {\n validUntil = claims['exp'];\n } else {\n // token will expire after 24h by default\n validUntil = validSince + 86400;\n }\n }\n return !!now && !!validSince && !!validUntil && now >= validSince && now <= validUntil;\n};\n/**\r\n * Decodes a Firebase auth. token and returns its issued at time if valid, null otherwise.\r\n *\r\n * Notes:\r\n * - May return null if there's no native base64 decoding support.\r\n * - Doesn't check if the token is actually valid.\r\n */\nvar issuedAtTime = function (token) {\n var claims = decode(token).claims;\n if (typeof claims === 'object' && claims.hasOwnProperty('iat')) {\n return claims['iat'];\n }\n return null;\n};\n/**\r\n * Decodes a Firebase auth. token and checks the validity of its format. Expects a valid issued-at time.\r\n *\r\n * Notes:\r\n * - May return a false negative if there's no native base64 decoding support.\r\n * - Doesn't check if the token is actually valid.\r\n */\nvar isValidFormat = function (token) {\n var decoded = decode(token),\n claims = decoded.claims;\n return !!claims && typeof claims === 'object' && claims.hasOwnProperty('iat');\n};\n/**\r\n * Attempts to peer into an auth token and determine if it's an admin auth token by looking at the claims portion.\r\n *\r\n * Notes:\r\n * - May return a false negative if there's no native base64 decoding support.\r\n * - Doesn't check if the token is actually valid.\r\n */\nvar isAdmin = function (token) {\n var claims = decode(token).claims;\n return typeof claims === 'object' && claims['admin'] === true;\n};\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nfunction contains(obj, key) {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\nfunction safeGet(obj, key) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n return obj[key];\n } else {\n return undefined;\n }\n}\nfunction isEmpty(obj) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n return false;\n }\n }\n return true;\n}\nfunction map(obj, fn, contextObj) {\n var res = {};\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n res[key] = fn.call(contextObj, obj[key], key, obj);\n }\n }\n return res;\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Returns a querystring-formatted string (e.g. &arg=val&arg2=val2) from a\r\n * params object (e.g. {arg: 'val', arg2: 'val2'})\r\n * Note: You must prepend it with ? when adding it to a URL.\r\n */\nfunction querystring(querystringParams) {\n var params = [];\n var _loop_1 = function (key, value) {\n if (Array.isArray(value)) {\n value.forEach(function (arrayVal) {\n params.push(encodeURIComponent(key) + '=' + encodeURIComponent(arrayVal));\n });\n } else {\n params.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));\n }\n };\n for (var _i = 0, _a = Object.entries(querystringParams); _i < _a.length; _i++) {\n var _b = _a[_i],\n key = _b[0],\n value = _b[1];\n _loop_1(key, value);\n }\n return params.length ? '&' + params.join('&') : '';\n}\n/**\r\n * Decodes a querystring (e.g. ?arg=val&arg2=val2) into a params object\r\n * (e.g. {arg: 'val', arg2: 'val2'})\r\n */\nfunction querystringDecode(querystring) {\n var obj = {};\n var tokens = querystring.replace(/^\\?/, '').split('&');\n tokens.forEach(function (token) {\n if (token) {\n var key = token.split('=');\n obj[key[0]] = key[1];\n }\n });\n return obj;\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * @fileoverview SHA-1 cryptographic hash.\r\n * Variable names follow the notation in FIPS PUB 180-3:\r\n * http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf.\r\n *\r\n * Usage:\r\n * var sha1 = new sha1();\r\n * sha1.update(bytes);\r\n * var hash = sha1.digest();\r\n *\r\n * Performance:\r\n * Chrome 23: ~400 Mbit/s\r\n * Firefox 16: ~250 Mbit/s\r\n *\r\n */\n/**\r\n * SHA-1 cryptographic hash constructor.\r\n *\r\n * The properties declared here are discussed in the above algorithm document.\r\n * @constructor\r\n * @final\r\n * @struct\r\n */\nvar Sha1 = /** @class */function () {\n function Sha1() {\n /**\r\n * Holds the previous values of accumulated variables a-e in the compress_\r\n * function.\r\n * @private\r\n */\n this.chain_ = [];\n /**\r\n * A buffer holding the partially computed hash result.\r\n * @private\r\n */\n this.buf_ = [];\n /**\r\n * An array of 80 bytes, each a part of the message to be hashed. Referred to\r\n * as the message schedule in the docs.\r\n * @private\r\n */\n this.W_ = [];\n /**\r\n * Contains data needed to pad messages less than 64 bytes.\r\n * @private\r\n */\n this.pad_ = [];\n /**\r\n * @private {number}\r\n */\n this.inbuf_ = 0;\n /**\r\n * @private {number}\r\n */\n this.total_ = 0;\n this.blockSize = 512 / 8;\n this.pad_[0] = 128;\n for (var i = 1; i < this.blockSize; ++i) {\n this.pad_[i] = 0;\n }\n this.reset();\n }\n Sha1.prototype.reset = function () {\n this.chain_[0] = 0x67452301;\n this.chain_[1] = 0xefcdab89;\n this.chain_[2] = 0x98badcfe;\n this.chain_[3] = 0x10325476;\n this.chain_[4] = 0xc3d2e1f0;\n this.inbuf_ = 0;\n this.total_ = 0;\n };\n /**\r\n * Internal compress helper function.\r\n * @param buf Block to compress.\r\n * @param offset Offset of the block in the buffer.\r\n * @private\r\n */\n Sha1.prototype.compress_ = function (buf, offset) {\n if (!offset) {\n offset = 0;\n }\n var W = this.W_;\n // get 16 big endian words\n if (typeof buf === 'string') {\n for (var i = 0; i < 16; i++) {\n // TODO(user): [bug 8140122] Recent versions of Safari for Mac OS and iOS\n // have a bug that turns the post-increment ++ operator into pre-increment\n // during JIT compilation. We have code that depends heavily on SHA-1 for\n // correctness and which is affected by this bug, so I've removed all uses\n // of post-increment ++ in which the result value is used. We can revert\n // this change once the Safari bug\n // (https://bugs.webkit.org/show_bug.cgi?id=109036) has been fixed and\n // most clients have been updated.\n W[i] = buf.charCodeAt(offset) << 24 | buf.charCodeAt(offset + 1) << 16 | buf.charCodeAt(offset + 2) << 8 | buf.charCodeAt(offset + 3);\n offset += 4;\n }\n } else {\n for (var i = 0; i < 16; i++) {\n W[i] = buf[offset] << 24 | buf[offset + 1] << 16 | buf[offset + 2] << 8 | buf[offset + 3];\n offset += 4;\n }\n }\n // expand to 80 words\n for (var i = 16; i < 80; i++) {\n var t = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];\n W[i] = (t << 1 | t >>> 31) & 0xffffffff;\n }\n var a = this.chain_[0];\n var b = this.chain_[1];\n var c = this.chain_[2];\n var d = this.chain_[3];\n var e = this.chain_[4];\n var f, k;\n // TODO(user): Try to unroll this loop to speed up the computation.\n for (var i = 0; i < 80; i++) {\n if (i < 40) {\n if (i < 20) {\n f = d ^ b & (c ^ d);\n k = 0x5a827999;\n } else {\n f = b ^ c ^ d;\n k = 0x6ed9eba1;\n }\n } else {\n if (i < 60) {\n f = b & c | d & (b | c);\n k = 0x8f1bbcdc;\n } else {\n f = b ^ c ^ d;\n k = 0xca62c1d6;\n }\n }\n var t = (a << 5 | a >>> 27) + f + e + k + W[i] & 0xffffffff;\n e = d;\n d = c;\n c = (b << 30 | b >>> 2) & 0xffffffff;\n b = a;\n a = t;\n }\n this.chain_[0] = this.chain_[0] + a & 0xffffffff;\n this.chain_[1] = this.chain_[1] + b & 0xffffffff;\n this.chain_[2] = this.chain_[2] + c & 0xffffffff;\n this.chain_[3] = this.chain_[3] + d & 0xffffffff;\n this.chain_[4] = this.chain_[4] + e & 0xffffffff;\n };\n Sha1.prototype.update = function (bytes, length) {\n // TODO(johnlenz): tighten the function signature and remove this check\n if (bytes == null) {\n return;\n }\n if (length === undefined) {\n length = bytes.length;\n }\n var lengthMinusBlock = length - this.blockSize;\n var n = 0;\n // Using local instead of member variables gives ~5% speedup on Firefox 16.\n var buf = this.buf_;\n var inbuf = this.inbuf_;\n // The outer while loop should execute at most twice.\n while (n < length) {\n // When we have no data in the block to top up, we can directly process the\n // input buffer (assuming it contains sufficient data). This gives ~25%\n // speedup on Chrome 23 and ~15% speedup on Firefox 16, but requires that\n // the data is provided in large chunks (or in multiples of 64 bytes).\n if (inbuf === 0) {\n while (n <= lengthMinusBlock) {\n this.compress_(bytes, n);\n n += this.blockSize;\n }\n }\n if (typeof bytes === 'string') {\n while (n < length) {\n buf[inbuf] = bytes.charCodeAt(n);\n ++inbuf;\n ++n;\n if (inbuf === this.blockSize) {\n this.compress_(buf);\n inbuf = 0;\n // Jump to the outer loop so we use the full-block optimization.\n break;\n }\n }\n } else {\n while (n < length) {\n buf[inbuf] = bytes[n];\n ++inbuf;\n ++n;\n if (inbuf === this.blockSize) {\n this.compress_(buf);\n inbuf = 0;\n // Jump to the outer loop so we use the full-block optimization.\n break;\n }\n }\n }\n }\n this.inbuf_ = inbuf;\n this.total_ += length;\n };\n /** @override */\n Sha1.prototype.digest = function () {\n var digest = [];\n var totalBits = this.total_ * 8;\n // Add pad 0x80 0x00*.\n if (this.inbuf_ < 56) {\n this.update(this.pad_, 56 - this.inbuf_);\n } else {\n this.update(this.pad_, this.blockSize - (this.inbuf_ - 56));\n }\n // Add # bits.\n for (var i = this.blockSize - 1; i >= 56; i--) {\n this.buf_[i] = totalBits & 255;\n totalBits /= 256; // Don't use bit-shifting here!\n }\n\n this.compress_(this.buf_);\n var n = 0;\n for (var i = 0; i < 5; i++) {\n for (var j = 24; j >= 0; j -= 8) {\n digest[n] = this.chain_[i] >> j & 255;\n ++n;\n }\n }\n return digest;\n };\n return Sha1;\n}();\n\n/**\r\n * Helper to make a Subscribe function (just like Promise helps make a\r\n * Thenable).\r\n *\r\n * @param executor Function which can make calls to a single Observer\r\n * as a proxy.\r\n * @param onNoObservers Callback when count of Observers goes to zero.\r\n */\nfunction createSubscribe(executor, onNoObservers) {\n var proxy = new ObserverProxy(executor, onNoObservers);\n return proxy.subscribe.bind(proxy);\n}\n/**\r\n * Implement fan-out for any number of Observers attached via a subscribe\r\n * function.\r\n */\nvar ObserverProxy = /** @class */function () {\n /**\r\n * @param executor Function which can make calls to a single Observer\r\n * as a proxy.\r\n * @param onNoObservers Callback when count of Observers goes to zero.\r\n */\n function ObserverProxy(executor, onNoObservers) {\n var _this = this;\n this.observers = [];\n this.unsubscribes = [];\n this.observerCount = 0;\n // Micro-task scheduling by calling task.then().\n this.task = Promise.resolve();\n this.finalized = false;\n this.onNoObservers = onNoObservers;\n // Call the executor asynchronously so subscribers that are called\n // synchronously after the creation of the subscribe function\n // can still receive the very first value generated in the executor.\n this.task.then(function () {\n executor(_this);\n }).catch(function (e) {\n _this.error(e);\n });\n }\n ObserverProxy.prototype.next = function (value) {\n this.forEachObserver(function (observer) {\n observer.next(value);\n });\n };\n ObserverProxy.prototype.error = function (error) {\n this.forEachObserver(function (observer) {\n observer.error(error);\n });\n this.close(error);\n };\n ObserverProxy.prototype.complete = function () {\n this.forEachObserver(function (observer) {\n observer.complete();\n });\n this.close();\n };\n /**\r\n * Subscribe function that can be used to add an Observer to the fan-out list.\r\n *\r\n * - We require that no event is sent to a subscriber sychronously to their\r\n * call to subscribe().\r\n */\n ObserverProxy.prototype.subscribe = function (nextOrObserver, error, complete) {\n var _this = this;\n var observer;\n if (nextOrObserver === undefined && error === undefined && complete === undefined) {\n throw new Error('Missing Observer.');\n }\n // Assemble an Observer object when passed as callback functions.\n if (implementsAnyMethods(nextOrObserver, ['next', 'error', 'complete'])) {\n observer = nextOrObserver;\n } else {\n observer = {\n next: nextOrObserver,\n error: error,\n complete: complete\n };\n }\n if (observer.next === undefined) {\n observer.next = noop;\n }\n if (observer.error === undefined) {\n observer.error = noop;\n }\n if (observer.complete === undefined) {\n observer.complete = noop;\n }\n var unsub = this.unsubscribeOne.bind(this, this.observers.length);\n // Attempt to subscribe to a terminated Observable - we\n // just respond to the Observer with the final error or complete\n // event.\n if (this.finalized) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.task.then(function () {\n try {\n if (_this.finalError) {\n observer.error(_this.finalError);\n } else {\n observer.complete();\n }\n } catch (e) {\n // nothing\n }\n return;\n });\n }\n this.observers.push(observer);\n return unsub;\n };\n // Unsubscribe is synchronous - we guarantee that no events are sent to\n // any unsubscribed Observer.\n ObserverProxy.prototype.unsubscribeOne = function (i) {\n if (this.observers === undefined || this.observers[i] === undefined) {\n return;\n }\n delete this.observers[i];\n this.observerCount -= 1;\n if (this.observerCount === 0 && this.onNoObservers !== undefined) {\n this.onNoObservers(this);\n }\n };\n ObserverProxy.prototype.forEachObserver = function (fn) {\n if (this.finalized) {\n // Already closed by previous event....just eat the additional values.\n return;\n }\n // Since sendOne calls asynchronously - there is no chance that\n // this.observers will become undefined.\n for (var i = 0; i < this.observers.length; i++) {\n this.sendOne(i, fn);\n }\n };\n // Call the Observer via one of it's callback function. We are careful to\n // confirm that the observe has not been unsubscribed since this asynchronous\n // function had been queued.\n ObserverProxy.prototype.sendOne = function (i, fn) {\n var _this = this;\n // Execute the callback asynchronously\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.task.then(function () {\n if (_this.observers !== undefined && _this.observers[i] !== undefined) {\n try {\n fn(_this.observers[i]);\n } catch (e) {\n // Ignore exceptions raised in Observers or missing methods of an\n // Observer.\n // Log error to console. b/31404806\n if (typeof console !== 'undefined' && console.error) {\n console.error(e);\n }\n }\n }\n });\n };\n ObserverProxy.prototype.close = function (err) {\n var _this = this;\n if (this.finalized) {\n return;\n }\n this.finalized = true;\n if (err !== undefined) {\n this.finalError = err;\n }\n // Proxy is no longer needed - garbage collect references\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.task.then(function () {\n _this.observers = undefined;\n _this.onNoObservers = undefined;\n });\n };\n return ObserverProxy;\n}();\n/** Turn synchronous function into one called asynchronously. */\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true).then(function () {\n fn.apply(void 0, args);\n }).catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}\n/**\r\n * Return true if the object passed in implements any of the named methods.\r\n */\nfunction implementsAnyMethods(obj, methods) {\n if (typeof obj !== 'object' || obj === null) {\n return false;\n }\n for (var _i = 0, methods_1 = methods; _i < methods_1.length; _i++) {\n var method = methods_1[_i];\n if (method in obj && typeof obj[method] === 'function') {\n return true;\n }\n }\n return false;\n}\nfunction noop() {\n // do nothing\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Check to make sure the appropriate number of arguments are provided for a public function.\r\n * Throws an error if it fails.\r\n *\r\n * @param fnName The function name\r\n * @param minCount The minimum number of arguments to allow for the function call\r\n * @param maxCount The maximum number of argument to allow for the function call\r\n * @param argCount The actual number of arguments provided.\r\n */\nvar validateArgCount = function (fnName, minCount, maxCount, argCount) {\n var argError;\n if (argCount < minCount) {\n argError = 'at least ' + minCount;\n } else if (argCount > maxCount) {\n argError = maxCount === 0 ? 'none' : 'no more than ' + maxCount;\n }\n if (argError) {\n var error = fnName + ' failed: Was called with ' + argCount + (argCount === 1 ? ' argument.' : ' arguments.') + ' Expects ' + argError + '.';\n throw new Error(error);\n }\n};\n/**\r\n * Generates a string to prefix an error message about failed argument validation\r\n *\r\n * @param fnName The function name\r\n * @param argumentNumber The index of the argument\r\n * @param optional Whether or not the argument is optional\r\n * @return The prefix to add to the error thrown for validation.\r\n */\nfunction errorPrefix(fnName, argumentNumber, optional) {\n var argName = '';\n switch (argumentNumber) {\n case 1:\n argName = optional ? 'first' : 'First';\n break;\n case 2:\n argName = optional ? 'second' : 'Second';\n break;\n case 3:\n argName = optional ? 'third' : 'Third';\n break;\n case 4:\n argName = optional ? 'fourth' : 'Fourth';\n break;\n default:\n throw new Error('errorPrefix called with argumentNumber > 4. Need to update it?');\n }\n var error = fnName + ' failed: ';\n error += argName + ' argument ';\n return error;\n}\n/**\r\n * @param fnName\r\n * @param argumentNumber\r\n * @param namespace\r\n * @param optional\r\n */\nfunction validateNamespace(fnName, argumentNumber, namespace, optional) {\n if (optional && !namespace) {\n return;\n }\n if (typeof namespace !== 'string') {\n //TODO: I should do more validation here. We only allow certain chars in namespaces.\n throw new Error(errorPrefix(fnName, argumentNumber, optional) + 'must be a valid firebase namespace.');\n }\n}\nfunction validateCallback(fnName, argumentNumber,\n// eslint-disable-next-line @typescript-eslint/ban-types\ncallback, optional) {\n if (optional && !callback) {\n return;\n }\n if (typeof callback !== 'function') {\n throw new Error(errorPrefix(fnName, argumentNumber, optional) + 'must be a valid function.');\n }\n}\nfunction validateContextObject(fnName, argumentNumber, context, optional) {\n if (optional && !context) {\n return;\n }\n if (typeof context !== 'object' || context === null) {\n throw new Error(errorPrefix(fnName, argumentNumber, optional) + 'must be a valid context object.');\n }\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n// Code originally came from goog.crypt.stringToUtf8ByteArray, but for some reason they\n// automatically replaced '\\r\\n' with '\\n', and they didn't handle surrogate pairs,\n// so it's been modified.\n// Note that not all Unicode characters appear as single characters in JavaScript strings.\n// fromCharCode returns the UTF-16 encoding of a character - so some Unicode characters\n// use 2 characters in Javascript. All 4-byte UTF-8 characters begin with a first\n// character in the range 0xD800 - 0xDBFF (the first character of a so-called surrogate\n// pair).\n// See http://www.ecma-international.org/ecma-262/5.1/#sec-15.1.3\n/**\r\n * @param {string} str\r\n * @return {Array}\r\n */\nvar stringToByteArray$1 = function (str) {\n var out = [];\n var p = 0;\n for (var i = 0; i < str.length; i++) {\n var c = str.charCodeAt(i);\n // Is this the lead surrogate in a surrogate pair?\n if (c >= 0xd800 && c <= 0xdbff) {\n var high = c - 0xd800; // the high 10 bits.\n i++;\n assert(i < str.length, 'Surrogate pair missing trail surrogate.');\n var low = str.charCodeAt(i) - 0xdc00; // the low 10 bits.\n c = 0x10000 + (high << 10) + low;\n }\n if (c < 128) {\n out[p++] = c;\n } else if (c < 2048) {\n out[p++] = c >> 6 | 192;\n out[p++] = c & 63 | 128;\n } else if (c < 65536) {\n out[p++] = c >> 12 | 224;\n out[p++] = c >> 6 & 63 | 128;\n out[p++] = c & 63 | 128;\n } else {\n out[p++] = c >> 18 | 240;\n out[p++] = c >> 12 & 63 | 128;\n out[p++] = c >> 6 & 63 | 128;\n out[p++] = c & 63 | 128;\n }\n }\n return out;\n};\n/**\r\n * Calculate length without actually converting; useful for doing cheaper validation.\r\n * @param {string} str\r\n * @return {number}\r\n */\nvar stringLength = function (str) {\n var p = 0;\n for (var i = 0; i < str.length; i++) {\n var c = str.charCodeAt(i);\n if (c < 128) {\n p++;\n } else if (c < 2048) {\n p += 2;\n } else if (c >= 0xd800 && c <= 0xdbff) {\n // Lead surrogate of a surrogate pair. The pair together will take 4 bytes to represent.\n p += 4;\n i++; // skip trail surrogate.\n } else {\n p += 3;\n }\n }\n return p;\n};\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * The amount of milliseconds to exponentially increase.\r\n */\nvar DEFAULT_INTERVAL_MILLIS = 1000;\n/**\r\n * The factor to backoff by.\r\n * Should be a number greater than 1.\r\n */\nvar DEFAULT_BACKOFF_FACTOR = 2;\n/**\r\n * The maximum milliseconds to increase to.\r\n *\r\n * Visible for testing\r\n */\nvar MAX_VALUE_MILLIS = 4 * 60 * 60 * 1000; // Four hours, like iOS and Android.\n/**\r\n * The percentage of backoff time to randomize by.\r\n * See\r\n * http://go/safe-client-behavior#step-1-determine-the-appropriate-retry-interval-to-handle-spike-traffic\r\n * for context.\r\n *\r\n *
Visible for testing\r\n */\nvar RANDOM_FACTOR = 0.5;\n/**\r\n * Based on the backoff method from\r\n * https://github.com/google/closure-library/blob/master/closure/goog/math/exponentialbackoff.js.\r\n * Extracted here so we don't need to pass metadata and a stateful ExponentialBackoff object around.\r\n */\nfunction calculateBackoffMillis(backoffCount, intervalMillis, backoffFactor) {\n if (intervalMillis === void 0) {\n intervalMillis = DEFAULT_INTERVAL_MILLIS;\n }\n if (backoffFactor === void 0) {\n backoffFactor = DEFAULT_BACKOFF_FACTOR;\n }\n // Calculates an exponentially increasing value.\n // Deviation: calculates value from count and a constant interval, so we only need to save value\n // and count to restore state.\n var currBaseValue = intervalMillis * Math.pow(backoffFactor, backoffCount);\n // A random \"fuzz\" to avoid waves of retries.\n // Deviation: randomFactor is required.\n var randomWait = Math.round(\n // A fraction of the backoff value to add/subtract.\n // Deviation: changes multiplication order to improve readability.\n RANDOM_FACTOR * currBaseValue * (\n // A random float (rounded to int by Math.round above) in the range [-1, 1]. Determines\n // if we add or subtract.\n Math.random() - 0.5) * 2);\n // Limits backoff to max to avoid effectively permanent backoff.\n return Math.min(MAX_VALUE_MILLIS, currBaseValue + randomWait);\n}\nexports.CONSTANTS = CONSTANTS;\nexports.Deferred = Deferred;\nexports.ErrorFactory = ErrorFactory;\nexports.FirebaseError = FirebaseError;\nexports.MAX_VALUE_MILLIS = MAX_VALUE_MILLIS;\nexports.RANDOM_FACTOR = RANDOM_FACTOR;\nexports.Sha1 = Sha1;\nexports.areCookiesEnabled = areCookiesEnabled;\nexports.assert = assert;\nexports.assertionError = assertionError;\nexports.async = async;\nexports.base64 = base64;\nexports.base64Decode = base64Decode;\nexports.base64Encode = base64Encode;\nexports.calculateBackoffMillis = calculateBackoffMillis;\nexports.contains = contains;\nexports.createSubscribe = createSubscribe;\nexports.decode = decode;\nexports.deepCopy = deepCopy;\nexports.deepExtend = deepExtend;\nexports.errorPrefix = errorPrefix;\nexports.getUA = getUA;\nexports.isAdmin = isAdmin;\nexports.isBrowser = isBrowser;\nexports.isBrowserExtension = isBrowserExtension;\nexports.isElectron = isElectron;\nexports.isEmpty = isEmpty;\nexports.isIE = isIE;\nexports.isIndexedDBAvailable = isIndexedDBAvailable;\nexports.isMobileCordova = isMobileCordova;\nexports.isNode = isNode;\nexports.isNodeSdk = isNodeSdk;\nexports.isReactNative = isReactNative;\nexports.isSafari = isSafari;\nexports.isUWP = isUWP;\nexports.isValidFormat = isValidFormat;\nexports.isValidTimestamp = isValidTimestamp;\nexports.issuedAtTime = issuedAtTime;\nexports.jsonEval = jsonEval;\nexports.map = map;\nexports.querystring = querystring;\nexports.querystringDecode = querystringDecode;\nexports.safeGet = safeGet;\nexports.stringLength = stringLength;\nexports.stringToByteArray = stringToByteArray$1;\nexports.stringify = stringify;\nexports.validateArgCount = validateArgCount;\nexports.validateCallback = validateCallback;\nexports.validateContextObject = validateContextObject;\nexports.validateIndexedDBOpenable = validateIndexedDBOpenable;\nexports.validateNamespace = validateNamespace;","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\n/* global Reflect, Promise */\n\nvar extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];\n };\n return extendStatics(d, b);\n};\nfunction __extends(d, b) {\n extendStatics(d, b);\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\nfunction __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator,\n m = s && o[s],\n i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return {\n value: o && o[i++],\n done: !o\n };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\nvar commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\nvar g,\n goog = goog || {},\n k = commonjsGlobal || self;\nfunction aa() {}\nfunction ba(a) {\n var b = typeof a;\n return \"object\" != b ? b : a ? Array.isArray(a) ? \"array\" : b : \"null\";\n}\nfunction ca(a) {\n var b = ba(a);\n return \"array\" == b || \"object\" == b && \"number\" == typeof a.length;\n}\nfunction n(a) {\n var b = typeof a;\n return \"object\" == b && null != a || \"function\" == b;\n}\nfunction da(a) {\n return Object.prototype.hasOwnProperty.call(a, ea) && a[ea] || (a[ea] = ++fa);\n}\nvar ea = \"closure_uid_\" + (1E9 * Math.random() >>> 0),\n fa = 0;\nfunction ha(a, b, c) {\n return a.call.apply(a.bind, arguments);\n}\nfunction ja(a, b, c) {\n if (!a) throw Error();\n if (2 < arguments.length) {\n var d = Array.prototype.slice.call(arguments, 2);\n return function () {\n var e = Array.prototype.slice.call(arguments);\n Array.prototype.unshift.apply(e, d);\n return a.apply(b, e);\n };\n }\n return function () {\n return a.apply(b, arguments);\n };\n}\nfunction p(a, b, c) {\n Function.prototype.bind && -1 != Function.prototype.bind.toString().indexOf(\"native code\") ? p = ha : p = ja;\n return p.apply(null, arguments);\n}\nfunction ka(a, b) {\n var c = Array.prototype.slice.call(arguments, 1);\n return function () {\n var d = c.slice();\n d.push.apply(d, arguments);\n return a.apply(this, d);\n };\n}\nvar q = Date.now;\nfunction r(a, b) {\n function c() {}\n c.prototype = b.prototype;\n a.S = b.prototype;\n a.prototype = new c();\n a.prototype.constructor = a;\n}\nfunction u() {\n this.j = this.j;\n this.i = this.i;\n}\nvar la = 0;\nu.prototype.j = !1;\nu.prototype.ja = function () {\n if (!this.j && (this.j = !0, this.G(), 0 != la)) {\n var a = da(this);\n }\n};\nu.prototype.G = function () {\n if (this.i) for (; this.i.length;) this.i.shift()();\n};\nvar na = Array.prototype.indexOf ? function (a, b) {\n return Array.prototype.indexOf.call(a, b, void 0);\n } : function (a, b) {\n if (\"string\" === typeof a) return \"string\" !== typeof b || 1 != b.length ? -1 : a.indexOf(b, 0);\n for (var c = 0; c < a.length; c++) if (c in a && a[c] === b) return c;\n return -1;\n },\n oa = Array.prototype.forEach ? function (a, b, c) {\n Array.prototype.forEach.call(a, b, c);\n } : function (a, b, c) {\n for (var d = a.length, e = \"string\" === typeof a ? a.split(\"\") : a, f = 0; f < d; f++) f in e && b.call(c, e[f], f, a);\n };\nfunction pa(a) {\n a: {\n var b = qa;\n for (var c = a.length, d = \"string\" === typeof a ? a.split(\"\") : a, e = 0; e < c; e++) if (e in d && b.call(void 0, d[e], e, a)) {\n b = e;\n break a;\n }\n b = -1;\n }\n return 0 > b ? null : \"string\" === typeof a ? a.charAt(b) : a[b];\n}\nfunction ra(a) {\n return Array.prototype.concat.apply([], arguments);\n}\nfunction sa(a) {\n var b = a.length;\n if (0 < b) {\n for (var c = Array(b), d = 0; d < b; d++) c[d] = a[d];\n return c;\n }\n return [];\n}\nfunction ta(a) {\n return /^[\\s\\xa0]*$/.test(a);\n}\nvar ua = String.prototype.trim ? function (a) {\n return a.trim();\n} : function (a) {\n return /^[\\s\\xa0]*([\\s\\S]*?)[\\s\\xa0]*$/.exec(a)[1];\n};\nfunction v(a, b) {\n return -1 != a.indexOf(b);\n}\nfunction xa(a, b) {\n return a < b ? -1 : a > b ? 1 : 0;\n}\nvar w;\na: {\n var ya = k.navigator;\n if (ya) {\n var za = ya.userAgent;\n if (za) {\n w = za;\n break a;\n }\n }\n w = \"\";\n}\nfunction Aa(a, b, c) {\n for (var d in a) b.call(c, a[d], d, a);\n}\nfunction Ba(a) {\n var b = {};\n for (var c in a) b[c] = a[c];\n return b;\n}\nvar Ca = \"constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf\".split(\" \");\nfunction Da(a, b) {\n var c, d;\n for (var e = 1; e < arguments.length; e++) {\n d = arguments[e];\n for (c in d) a[c] = d[c];\n for (var f = 0; f < Ca.length; f++) c = Ca[f], Object.prototype.hasOwnProperty.call(d, c) && (a[c] = d[c]);\n }\n}\nfunction Ea(a) {\n Ea[\" \"](a);\n return a;\n}\nEa[\" \"] = aa;\nfunction Fa(a, b) {\n var c = Ga;\n return Object.prototype.hasOwnProperty.call(c, a) ? c[a] : c[a] = b(a);\n}\nvar Ha = v(w, \"Opera\"),\n x = v(w, \"Trident\") || v(w, \"MSIE\"),\n Ia = v(w, \"Edge\"),\n Ja = Ia || x,\n Ka = v(w, \"Gecko\") && !(v(w.toLowerCase(), \"webkit\") && !v(w, \"Edge\")) && !(v(w, \"Trident\") || v(w, \"MSIE\")) && !v(w, \"Edge\"),\n La = v(w.toLowerCase(), \"webkit\") && !v(w, \"Edge\");\nfunction Ma() {\n var a = k.document;\n return a ? a.documentMode : void 0;\n}\nvar Na;\na: {\n var Oa = \"\",\n Pa = function () {\n var a = w;\n if (Ka) return /rv:([^\\);]+)(\\)|;)/.exec(a);\n if (Ia) return /Edge\\/([\\d\\.]+)/.exec(a);\n if (x) return /\\b(?:MSIE|rv)[: ]([^\\);]+)(\\)|;)/.exec(a);\n if (La) return /WebKit\\/(\\S+)/.exec(a);\n if (Ha) return /(?:Version)[ \\/]?(\\S+)/.exec(a);\n }();\n Pa && (Oa = Pa ? Pa[1] : \"\");\n if (x) {\n var Qa = Ma();\n if (null != Qa && Qa > parseFloat(Oa)) {\n Na = String(Qa);\n break a;\n }\n }\n Na = Oa;\n}\nvar Ga = {};\nfunction Ra(a) {\n return Fa(a, function () {\n {\n var b = 0;\n var e = ua(String(Na)).split(\".\"),\n f = ua(String(a)).split(\".\"),\n h = Math.max(e.length, f.length);\n for (var m = 0; 0 == b && m < h; m++) {\n var c = e[m] || \"\",\n d = f[m] || \"\";\n do {\n c = /(\\d*)(\\D*)(.*)/.exec(c) || [\"\", \"\", \"\", \"\"];\n d = /(\\d*)(\\D*)(.*)/.exec(d) || [\"\", \"\", \"\", \"\"];\n if (0 == c[0].length && 0 == d[0].length) break;\n b = xa(0 == c[1].length ? 0 : parseInt(c[1], 10), 0 == d[1].length ? 0 : parseInt(d[1], 10)) || xa(0 == c[2].length, 0 == d[2].length) || xa(c[2], d[2]);\n c = c[3];\n d = d[3];\n } while (0 == b);\n }\n }\n return 0 <= b;\n });\n}\nvar Sa;\nif (k.document && x) {\n var Ta = Ma();\n Sa = Ta ? Ta : parseInt(Na, 10) || void 0;\n} else Sa = void 0;\nvar Ua = Sa;\nvar Va = !x || 9 <= Number(Ua),\n Wa = x && !Ra(\"9\"),\n Xa = function () {\n if (!k.addEventListener || !Object.defineProperty) return !1;\n var a = !1,\n b = Object.defineProperty({}, \"passive\", {\n get: function () {\n a = !0;\n }\n });\n try {\n k.addEventListener(\"test\", aa, b), k.removeEventListener(\"test\", aa, b);\n } catch (c) {}\n return a;\n }();\nfunction y(a, b) {\n this.type = a;\n this.a = this.target = b;\n this.defaultPrevented = !1;\n}\ny.prototype.b = function () {\n this.defaultPrevented = !0;\n};\nfunction A(a, b) {\n y.call(this, a ? a.type : \"\");\n this.relatedTarget = this.a = this.target = null;\n this.button = this.screenY = this.screenX = this.clientY = this.clientX = 0;\n this.key = \"\";\n this.metaKey = this.shiftKey = this.altKey = this.ctrlKey = !1;\n this.pointerId = 0;\n this.pointerType = \"\";\n this.c = null;\n if (a) {\n var c = this.type = a.type,\n d = a.changedTouches && a.changedTouches.length ? a.changedTouches[0] : null;\n this.target = a.target || a.srcElement;\n this.a = b;\n if (b = a.relatedTarget) {\n if (Ka) {\n a: {\n try {\n Ea(b.nodeName);\n var e = !0;\n break a;\n } catch (f) {}\n e = !1;\n }\n e || (b = null);\n }\n } else \"mouseover\" == c ? b = a.fromElement : \"mouseout\" == c && (b = a.toElement);\n this.relatedTarget = b;\n d ? (this.clientX = void 0 !== d.clientX ? d.clientX : d.pageX, this.clientY = void 0 !== d.clientY ? d.clientY : d.pageY, this.screenX = d.screenX || 0, this.screenY = d.screenY || 0) : (this.clientX = void 0 !== a.clientX ? a.clientX : a.pageX, this.clientY = void 0 !== a.clientY ? a.clientY : a.pageY, this.screenX = a.screenX || 0, this.screenY = a.screenY || 0);\n this.button = a.button;\n this.key = a.key || \"\";\n this.ctrlKey = a.ctrlKey;\n this.altKey = a.altKey;\n this.shiftKey = a.shiftKey;\n this.metaKey = a.metaKey;\n this.pointerId = a.pointerId || 0;\n this.pointerType = \"string\" === typeof a.pointerType ? a.pointerType : Ya[a.pointerType] || \"\";\n this.c = a;\n a.defaultPrevented && this.b();\n }\n}\nr(A, y);\nvar Ya = {\n 2: \"touch\",\n 3: \"pen\",\n 4: \"mouse\"\n};\nA.prototype.b = function () {\n A.S.b.call(this);\n var a = this.c;\n if (a.preventDefault) a.preventDefault();else if (a.returnValue = !1, Wa) try {\n if (a.ctrlKey || 112 <= a.keyCode && 123 >= a.keyCode) a.keyCode = -1;\n } catch (b) {}\n};\nvar C = \"closure_listenable_\" + (1E6 * Math.random() | 0),\n Za = 0;\nfunction $a(a, b, c, d, e) {\n this.listener = a;\n this.proxy = null;\n this.src = b;\n this.type = c;\n this.capture = !!d;\n this.ca = e;\n this.key = ++Za;\n this.Y = this.Z = !1;\n}\nfunction ab(a) {\n a.Y = !0;\n a.listener = null;\n a.proxy = null;\n a.src = null;\n a.ca = null;\n}\nfunction bb(a) {\n this.src = a;\n this.a = {};\n this.b = 0;\n}\nbb.prototype.add = function (a, b, c, d, e) {\n var f = a.toString();\n a = this.a[f];\n a || (a = this.a[f] = [], this.b++);\n var h = cb(a, b, d, e);\n -1 < h ? (b = a[h], c || (b.Z = !1)) : (b = new $a(b, this.src, f, !!d, e), b.Z = c, a.push(b));\n return b;\n};\nfunction db(a, b) {\n var c = b.type;\n if (c in a.a) {\n var d = a.a[c],\n e = na(d, b),\n f;\n (f = 0 <= e) && Array.prototype.splice.call(d, e, 1);\n f && (ab(b), 0 == a.a[c].length && (delete a.a[c], a.b--));\n }\n}\nfunction cb(a, b, c, d) {\n for (var e = 0; e < a.length; ++e) {\n var f = a[e];\n if (!f.Y && f.listener == b && f.capture == !!c && f.ca == d) return e;\n }\n return -1;\n}\nvar eb = \"closure_lm_\" + (1E6 * Math.random() | 0),\n fb = {};\nfunction hb(a, b, c, d, e) {\n if (d && d.once) return ib(a, b, c, d, e);\n if (Array.isArray(b)) {\n for (var f = 0; f < b.length; f++) hb(a, b[f], c, d, e);\n return null;\n }\n c = jb(c);\n return a && a[C] ? a.va(b, c, n(d) ? !!d.capture : !!d, e) : kb(a, b, c, !1, d, e);\n}\nfunction kb(a, b, c, d, e, f) {\n if (!b) throw Error(\"Invalid event type\");\n var h = n(e) ? !!e.capture : !!e;\n if (h && !Va) return null;\n var m = lb(a);\n m || (a[eb] = m = new bb(a));\n c = m.add(b, c, d, h, f);\n if (c.proxy) return c;\n d = mb();\n c.proxy = d;\n d.src = a;\n d.listener = c;\n if (a.addEventListener) Xa || (e = h), void 0 === e && (e = !1), a.addEventListener(b.toString(), d, e);else if (a.attachEvent) a.attachEvent(nb(b.toString()), d);else if (a.addListener && a.removeListener) a.addListener(d);else throw Error(\"addEventListener and attachEvent are unavailable.\");\n return c;\n}\nfunction mb() {\n var a = ob,\n b = Va ? function (c) {\n return a.call(b.src, b.listener, c);\n } : function (c) {\n c = a.call(b.src, b.listener, c);\n if (!c) return c;\n };\n return b;\n}\nfunction ib(a, b, c, d, e) {\n if (Array.isArray(b)) {\n for (var f = 0; f < b.length; f++) ib(a, b[f], c, d, e);\n return null;\n }\n c = jb(c);\n return a && a[C] ? a.wa(b, c, n(d) ? !!d.capture : !!d, e) : kb(a, b, c, !0, d, e);\n}\nfunction pb(a, b, c, d, e) {\n if (Array.isArray(b)) for (var f = 0; f < b.length; f++) pb(a, b[f], c, d, e);else (d = n(d) ? !!d.capture : !!d, c = jb(c), a && a[C]) ? (a = a.c, b = String(b).toString(), b in a.a && (f = a.a[b], c = cb(f, c, d, e), -1 < c && (ab(f[c]), Array.prototype.splice.call(f, c, 1), 0 == f.length && (delete a.a[b], a.b--)))) : a && (a = lb(a)) && (b = a.a[b.toString()], a = -1, b && (a = cb(b, c, d, e)), (c = -1 < a ? b[a] : null) && rb(c));\n}\nfunction rb(a) {\n if (\"number\" !== typeof a && a && !a.Y) {\n var b = a.src;\n if (b && b[C]) db(b.c, a);else {\n var c = a.type,\n d = a.proxy;\n b.removeEventListener ? b.removeEventListener(c, d, a.capture) : b.detachEvent ? b.detachEvent(nb(c), d) : b.addListener && b.removeListener && b.removeListener(d);\n (c = lb(b)) ? (db(c, a), 0 == c.b && (c.src = null, b[eb] = null)) : ab(a);\n }\n }\n}\nfunction nb(a) {\n return a in fb ? fb[a] : fb[a] = \"on\" + a;\n}\nfunction sb(a, b) {\n var c = a.listener,\n d = a.ca || a.src;\n a.Z && rb(a);\n return c.call(d, b);\n}\nfunction ob(a, b) {\n if (a.Y) return !0;\n if (!Va) {\n if (!b) a: {\n b = [\"window\", \"event\"];\n for (var c = k, d = 0; d < b.length; d++) if (c = c[b[d]], null == c) {\n b = null;\n break a;\n }\n b = c;\n }\n b = new A(b, this);\n return sb(a, b);\n }\n return sb(a, new A(b, this));\n}\nfunction lb(a) {\n a = a[eb];\n return a instanceof bb ? a : null;\n}\nvar tb = \"__closure_events_fn_\" + (1E9 * Math.random() >>> 0);\nfunction jb(a) {\n if (\"function\" == ba(a)) return a;\n a[tb] || (a[tb] = function (b) {\n return a.handleEvent(b);\n });\n return a[tb];\n}\nfunction D() {\n u.call(this);\n this.c = new bb(this);\n this.J = this;\n this.C = null;\n}\nr(D, u);\nD.prototype[C] = !0;\ng = D.prototype;\ng.addEventListener = function (a, b, c, d) {\n hb(this, a, b, c, d);\n};\ng.removeEventListener = function (a, b, c, d) {\n pb(this, a, b, c, d);\n};\ng.dispatchEvent = function (a) {\n var b,\n c = this.C;\n if (c) for (b = []; c; c = c.C) b.push(c);\n c = this.J;\n var d = a.type || a;\n if (\"string\" === typeof a) a = new y(a, c);else if (a instanceof y) a.target = a.target || c;else {\n var e = a;\n a = new y(d, c);\n Da(a, e);\n }\n e = !0;\n if (b) for (var f = b.length - 1; 0 <= f; f--) {\n var h = a.a = b[f];\n e = ub(h, d, !0, a) && e;\n }\n h = a.a = c;\n e = ub(h, d, !0, a) && e;\n e = ub(h, d, !1, a) && e;\n if (b) for (f = 0; f < b.length; f++) h = a.a = b[f], e = ub(h, d, !1, a) && e;\n return e;\n};\ng.G = function () {\n D.S.G.call(this);\n if (this.c) {\n var a = this.c,\n c;\n for (c in a.a) {\n for (var d = a.a[c], e = 0; e < d.length; e++) ab(d[e]);\n delete a.a[c];\n a.b--;\n }\n }\n this.C = null;\n};\ng.va = function (a, b, c, d) {\n return this.c.add(String(a), b, !1, c, d);\n};\ng.wa = function (a, b, c, d) {\n return this.c.add(String(a), b, !0, c, d);\n};\nfunction ub(a, b, c, d) {\n b = a.c.a[String(b)];\n if (!b) return !0;\n b = b.concat();\n for (var e = !0, f = 0; f < b.length; ++f) {\n var h = b[f];\n if (h && !h.Y && h.capture == c) {\n var m = h.listener,\n l = h.ca || h.src;\n h.Z && db(a.c, h);\n e = !1 !== m.call(l, d) && e;\n }\n }\n return e && !d.defaultPrevented;\n}\nvar vb = k.JSON.stringify;\nfunction wb() {\n this.b = this.a = null;\n}\nvar yb = new ( /** @class */function () {\n function class_1(a, b, c) {\n this.f = c;\n this.c = a;\n this.g = b;\n this.b = 0;\n this.a = null;\n }\n class_1.prototype.get = function () {\n var a;\n 0 < this.b ? (this.b--, a = this.a, this.a = a.next, a.next = null) : a = this.c();\n return a;\n };\n return class_1;\n}())(function () {\n return new xb();\n}, function (a) {\n a.reset();\n}, 100);\nwb.prototype.add = function (a, b) {\n var c = yb.get();\n c.set(a, b);\n this.b ? this.b.next = c : this.a = c;\n this.b = c;\n};\nfunction zb() {\n var a = Ab,\n b = null;\n a.a && (b = a.a, a.a = a.a.next, a.a || (a.b = null), b.next = null);\n return b;\n}\nfunction xb() {\n this.next = this.b = this.a = null;\n}\nxb.prototype.set = function (a, b) {\n this.a = a;\n this.b = b;\n this.next = null;\n};\nxb.prototype.reset = function () {\n this.next = this.b = this.a = null;\n};\nfunction Bb(a) {\n k.setTimeout(function () {\n throw a;\n }, 0);\n}\nfunction Cb(a, b) {\n Db || Eb();\n Fb || (Db(), Fb = !0);\n Ab.add(a, b);\n}\nvar Db;\nfunction Eb() {\n var a = k.Promise.resolve(void 0);\n Db = function () {\n a.then(Gb);\n };\n}\nvar Fb = !1,\n Ab = new wb();\nfunction Gb() {\n for (var a; a = zb();) {\n try {\n a.a.call(a.b);\n } catch (c) {\n Bb(c);\n }\n var b = yb;\n b.g(a);\n b.b < b.f && (b.b++, a.next = b.a, b.a = a);\n }\n Fb = !1;\n}\nfunction Hb(a, b) {\n D.call(this);\n this.b = a || 1;\n this.a = b || k;\n this.f = p(this.Ya, this);\n this.g = q();\n}\nr(Hb, D);\ng = Hb.prototype;\ng.aa = !1;\ng.M = null;\ng.Ya = function () {\n if (this.aa) {\n var a = q() - this.g;\n 0 < a && a < .8 * this.b ? this.M = this.a.setTimeout(this.f, this.b - a) : (this.M && (this.a.clearTimeout(this.M), this.M = null), this.dispatchEvent(\"tick\"), this.aa && (Ib(this), this.start()));\n }\n};\ng.start = function () {\n this.aa = !0;\n this.M || (this.M = this.a.setTimeout(this.f, this.b), this.g = q());\n};\nfunction Ib(a) {\n a.aa = !1;\n a.M && (a.a.clearTimeout(a.M), a.M = null);\n}\ng.G = function () {\n Hb.S.G.call(this);\n Ib(this);\n delete this.a;\n};\nfunction Jb(a, b, c) {\n if (\"function\" == ba(a)) c && (a = p(a, c));else if (a && \"function\" == typeof a.handleEvent) a = p(a.handleEvent, a);else throw Error(\"Invalid listener argument\");\n return 2147483647 < Number(b) ? -1 : k.setTimeout(a, b || 0);\n}\nfunction Kb(a) {\n a.a = Jb(function () {\n a.a = null;\n a.c && (a.c = !1, Kb(a));\n }, a.h);\n var b = a.b;\n a.b = null;\n a.g.apply(null, b);\n}\nvar Lb = /** @class */function (_super) {\n __extends(Lb, _super);\n function Lb(a, b, c) {\n var _this = _super.call(this) || this;\n _this.g = null != c ? a.bind(c) : a;\n _this.h = b;\n _this.b = null;\n _this.c = !1;\n _this.a = null;\n return _this;\n }\n Lb.prototype.f = function (a) {\n this.b = arguments;\n this.a ? this.c = !0 : Kb(this);\n };\n Lb.prototype.G = function () {\n _super.prototype.G.call(this);\n this.a && (k.clearTimeout(this.a), this.a = null, this.c = !1, this.b = null);\n };\n return Lb;\n}(u);\nfunction E(a) {\n u.call(this);\n this.b = a;\n this.a = {};\n}\nr(E, u);\nvar Mb = [];\nfunction Nb(a, b, c, d) {\n Array.isArray(c) || (c && (Mb[0] = c.toString()), c = Mb);\n for (var e = 0; e < c.length; e++) {\n var f = hb(b, c[e], d || a.handleEvent, !1, a.b || a);\n if (!f) break;\n a.a[f.key] = f;\n }\n}\nfunction Ob(a) {\n Aa(a.a, function (b, c) {\n this.a.hasOwnProperty(c) && rb(b);\n }, a);\n a.a = {};\n}\nE.prototype.G = function () {\n E.S.G.call(this);\n Ob(this);\n};\nE.prototype.handleEvent = function () {\n throw Error(\"EventHandler.handleEvent not implemented\");\n};\nfunction Pb() {\n this.a = !0;\n}\nfunction Qb(a, b, c, d, e, f) {\n a.info(function () {\n if (a.a) {\n if (f) {\n var h = \"\";\n for (var m = f.split(\"&\"), l = 0; l < m.length; l++) {\n var t = m[l].split(\"=\");\n if (1 < t.length) {\n var B = t[0];\n t = t[1];\n var z = B.split(\"_\");\n h = 2 <= z.length && \"type\" == z[1] ? h + (B + \"=\" + t + \"&\") : h + (B + \"=redacted&\");\n }\n }\n } else h = null;\n } else h = f;\n return \"XMLHTTP REQ (\" + d + \") [attempt \" + e + \"]: \" + b + \"\\n\" + c + \"\\n\" + h;\n });\n}\nfunction Rb(a, b, c, d, e, f, h) {\n a.info(function () {\n return \"XMLHTTP RESP (\" + d + \") [ attempt \" + e + \"]: \" + b + \"\\n\" + c + \"\\n\" + f + \" \" + h;\n });\n}\nfunction F(a, b, c, d) {\n a.info(function () {\n return \"XMLHTTP TEXT (\" + b + \"): \" + Sb(a, c) + (d ? \" \" + d : \"\");\n });\n}\nfunction Tb(a, b) {\n a.info(function () {\n return \"TIMEOUT: \" + b;\n });\n}\nPb.prototype.info = function () {};\nfunction Sb(a, b) {\n if (!a.a) return b;\n if (!b) return null;\n try {\n var c = JSON.parse(b);\n if (c) for (a = 0; a < c.length; a++) if (Array.isArray(c[a])) {\n var d = c[a];\n if (!(2 > d.length)) {\n var e = d[1];\n if (Array.isArray(e) && !(1 > e.length)) {\n var f = e[0];\n if (\"noop\" != f && \"stop\" != f && \"close\" != f) for (var h = 1; h < e.length; h++) e[h] = \"\";\n }\n }\n }\n return vb(c);\n } catch (m) {\n return b;\n }\n}\nvar Ub = null;\nfunction Vb() {\n return Ub = Ub || new D();\n}\nfunction Wb(a) {\n y.call(this, \"serverreachability\", a);\n}\nr(Wb, y);\nfunction G(a) {\n var b = Vb();\n b.dispatchEvent(new Wb(b, a));\n}\nfunction Xb(a) {\n y.call(this, \"statevent\", a);\n}\nr(Xb, y);\nfunction H(a) {\n var b = Vb();\n b.dispatchEvent(new Xb(b, a));\n}\nfunction Yb(a) {\n y.call(this, \"timingevent\", a);\n}\nr(Yb, y);\nfunction I(a, b) {\n if (\"function\" != ba(a)) throw Error(\"Fn must not be null and must be a function\");\n return k.setTimeout(function () {\n a();\n }, b);\n}\nvar Zb = {\n NO_ERROR: 0,\n Za: 1,\n gb: 2,\n fb: 3,\n bb: 4,\n eb: 5,\n hb: 6,\n Da: 7,\n TIMEOUT: 8,\n kb: 9\n};\nvar $b = {\n ab: \"complete\",\n ob: \"success\",\n Ea: \"error\",\n Da: \"abort\",\n mb: \"ready\",\n nb: \"readystatechange\",\n TIMEOUT: \"timeout\",\n ib: \"incrementaldata\",\n lb: \"progress\",\n cb: \"downloadprogress\",\n pb: \"uploadprogress\"\n};\nfunction ac() {}\nac.prototype.a = null;\nfunction bc(a) {\n var b;\n (b = a.a) || (b = a.a = {});\n return b;\n}\nfunction cc() {}\nvar J = {\n OPEN: \"a\",\n $a: \"b\",\n Ea: \"c\",\n jb: \"d\"\n};\nfunction dc() {\n y.call(this, \"d\");\n}\nr(dc, y);\nfunction ec() {\n y.call(this, \"c\");\n}\nr(ec, y);\nvar fc;\nfunction gc() {}\nr(gc, ac);\nfc = new gc();\nfunction K(a, b, c, d) {\n this.g = a;\n this.c = b;\n this.f = c;\n this.T = d || 1;\n this.J = new E(this);\n this.P = hc;\n a = Ja ? 125 : void 0;\n this.R = new Hb(a);\n this.B = null;\n this.b = !1;\n this.j = this.l = this.i = this.H = this.u = this.U = this.o = null;\n this.s = [];\n this.a = null;\n this.D = 0;\n this.h = this.m = null;\n this.N = -1;\n this.A = !1;\n this.O = 0;\n this.F = null;\n this.W = this.C = this.V = this.I = !1;\n}\nvar hc = 45E3,\n ic = {},\n jc = {};\ng = K.prototype;\ng.setTimeout = function (a) {\n this.P = a;\n};\nfunction kc(a, b, c) {\n a.H = 1;\n a.i = lc(L(b));\n a.j = c;\n a.I = !0;\n mc(a, null);\n}\nfunction mc(a, b) {\n a.u = q();\n M(a);\n a.l = L(a.i);\n var c = a.l,\n d = a.T;\n Array.isArray(d) || (d = [String(d)]);\n nc(c.b, \"t\", d);\n a.D = 0;\n a.a = oc(a.g, a.g.C ? b : null);\n 0 < a.O && (a.F = new Lb(p(a.Ca, a, a.a), a.O));\n Nb(a.J, a.a, \"readystatechange\", a.Wa);\n b = a.B ? Ba(a.B) : {};\n a.j ? (a.m || (a.m = \"POST\"), b[\"Content-Type\"] = \"application/x-www-form-urlencoded\", a.a.ba(a.l, a.m, a.j, b)) : (a.m = \"GET\", a.a.ba(a.l, a.m, null, b));\n G(1);\n Qb(a.c, a.m, a.l, a.f, a.T, a.j);\n}\ng.Wa = function (a) {\n a = a.target;\n var b = this.F;\n b && 3 == N(a) ? b.f() : this.Ca(a);\n};\ng.Ca = function (a) {\n try {\n if (a == this.a) a: {\n var b = N(this.a),\n c = this.a.ua(),\n d = this.a.X();\n if (!(3 > b || 3 == b && !Ja && !this.a.$())) {\n this.A || 4 != b || 7 == c || (8 == c || 0 >= d ? G(3) : G(2));\n pc(this);\n var e = this.a.X();\n this.N = e;\n var f = this.a.$();\n this.b = 200 == e;\n Rb(this.c, this.m, this.l, this.f, this.T, b, e);\n if (this.b) {\n if (this.V && !this.C) {\n b: {\n if (this.a) {\n var h,\n m = this.a;\n if ((h = m.a ? m.a.getResponseHeader(\"X-HTTP-Initial-Response\") : null) && !ta(h)) {\n var l = h;\n break b;\n }\n }\n l = null;\n }\n if (l) F(this.c, this.f, l, \"Initial handshake response via X-HTTP-Initial-Response\"), this.C = !0, qc(this, l);else {\n this.b = !1;\n this.h = 3;\n H(12);\n O(this);\n rc(this);\n break a;\n }\n }\n this.I ? (tc(this, b, f), Ja && this.b && 3 == b && (Nb(this.J, this.R, \"tick\", this.Va), this.R.start())) : (F(this.c, this.f, f, null), qc(this, f));\n 4 == b && O(this);\n this.b && !this.A && (4 == b ? uc(this.g, this) : (this.b = !1, M(this)));\n } else 400 == e && 0 < f.indexOf(\"Unknown SID\") ? (this.h = 3, H(12)) : (this.h = 0, H(13)), O(this), rc(this);\n }\n }\n } catch (t) {} finally {}\n};\nfunction tc(a, b, c) {\n for (var d = !0; !a.A && a.D < c.length;) {\n var e = vc(a, c);\n if (e == jc) {\n 4 == b && (a.h = 4, H(14), d = !1);\n F(a.c, a.f, null, \"[Incomplete Response]\");\n break;\n } else if (e == ic) {\n a.h = 4;\n H(15);\n F(a.c, a.f, c, \"[Invalid Chunk]\");\n d = !1;\n break;\n } else F(a.c, a.f, e, null), qc(a, e);\n }\n 4 == b && 0 == c.length && (a.h = 1, H(16), d = !1);\n a.b = a.b && d;\n d ? 0 < c.length && !a.W && (a.W = !0, b = a.g, b.a == a && b.V && !b.F && (b.c.info(\"Great, no buffering proxy detected. Bytes received: \" + c.length), xc(b), b.F = !0)) : (F(a.c, a.f, c, \"[Invalid Chunked Response]\"), O(a), rc(a));\n}\ng.Va = function () {\n if (this.a) {\n var a = N(this.a),\n b = this.a.$();\n this.D < b.length && (pc(this), tc(this, a, b), this.b && 4 != a && M(this));\n }\n};\nfunction vc(a, b) {\n var c = a.D,\n d = b.indexOf(\"\\n\", c);\n if (-1 == d) return jc;\n c = Number(b.substring(c, d));\n if (isNaN(c)) return ic;\n d += 1;\n if (d + c > b.length) return jc;\n b = b.substr(d, c);\n a.D = d + c;\n return b;\n}\ng.cancel = function () {\n this.A = !0;\n O(this);\n};\nfunction M(a) {\n a.U = q() + a.P;\n yc(a, a.P);\n}\nfunction yc(a, b) {\n if (null != a.o) throw Error(\"WatchDog timer not null\");\n a.o = I(p(a.Ua, a), b);\n}\nfunction pc(a) {\n a.o && (k.clearTimeout(a.o), a.o = null);\n}\ng.Ua = function () {\n this.o = null;\n var a = q();\n 0 <= a - this.U ? (Tb(this.c, this.l), 2 != this.H && (G(3), H(17)), O(this), this.h = 2, rc(this)) : yc(this, this.U - a);\n};\nfunction rc(a) {\n 0 == a.g.v || a.A || uc(a.g, a);\n}\nfunction O(a) {\n pc(a);\n var b = a.F;\n b && \"function\" == typeof b.ja && b.ja();\n a.F = null;\n Ib(a.R);\n Ob(a.J);\n a.a && (b = a.a, a.a = null, b.abort(), b.ja());\n}\nfunction qc(a, b) {\n try {\n var c = a.g;\n if (0 != c.v && (c.a == a || zc(c.b, a))) if (c.I = a.N, !a.C && zc(c.b, a) && 3 == c.v) {\n try {\n var d = c.ka.a.parse(b);\n } catch (sc) {\n d = null;\n }\n if (Array.isArray(d) && 3 == d.length) {\n var e = d;\n if (0 == e[0]) a: {\n if (!c.j) {\n if (c.a) if (c.a.u + 3E3 < a.u) Ac(c), Bc(c);else break a;\n Cc(c);\n H(18);\n }\n } else c.oa = e[1], 0 < c.oa - c.P && 37500 > e[2] && c.H && 0 == c.o && !c.m && (c.m = I(p(c.Ra, c), 6E3));\n if (1 >= Dc(c.b) && c.ea) {\n try {\n c.ea();\n } catch (sc) {}\n c.ea = void 0;\n }\n } else P(c, 11);\n } else if ((a.C || c.a == a) && Ac(c), !ta(b)) for (b = d = c.ka.a.parse(b), d = 0; d < b.length; d++) if (e = b[d], c.P = e[0], e = e[1], 2 == c.v) {\n if (\"c\" == e[0]) {\n c.J = e[1];\n c.ga = e[2];\n var f = e[3];\n null != f && (c.ha = f, c.c.info(\"VER=\" + c.ha));\n var h = e[4];\n null != h && (c.pa = h, c.c.info(\"SVER=\" + c.pa));\n var m = e[5];\n if (null != m && \"number\" === typeof m && 0 < m) {\n var l = 1.5 * m;\n c.D = l;\n c.c.info(\"backChannelRequestTimeoutMs_=\" + l);\n }\n l = c;\n var t = a.a;\n if (t) {\n var B = t.a ? t.a.getResponseHeader(\"X-Client-Wire-Protocol\") : null;\n if (B) {\n var z = l.b;\n !z.a && (v(B, \"spdy\") || v(B, \"quic\") || v(B, \"h2\")) && (z.f = z.g, z.a = new Set(), z.b && (Ec(z, z.b), z.b = null));\n }\n if (l.A) {\n var qb = t.a ? t.a.getResponseHeader(\"X-HTTP-Session-Id\") : null;\n qb && (l.na = qb, Q(l.B, l.A, qb));\n }\n }\n c.v = 3;\n c.f && c.f.ta();\n c.V && (c.N = q() - a.u, c.c.info(\"Handshake RTT: \" + c.N + \"ms\"));\n l = c;\n var va = a;\n l.la = Fc(l, l.C ? l.ga : null, l.fa);\n if (va.C) {\n Gc(l.b, va);\n var wa = va,\n wc = l.D;\n wc && wa.setTimeout(wc);\n wa.o && (pc(wa), M(wa));\n l.a = va;\n } else Hc(l);\n 0 < c.g.length && Ic(c);\n } else \"stop\" != e[0] && \"close\" != e[0] || P(c, 7);\n } else 3 == c.v && (\"stop\" == e[0] || \"close\" == e[0] ? \"stop\" == e[0] ? P(c, 7) : Jc(c) : \"noop\" != e[0] && c.f && c.f.sa(e), c.o = 0);\n G(4);\n } catch (sc) {}\n}\nfunction Kc(a) {\n if (a.K && \"function\" == typeof a.K) return a.K();\n if (\"string\" === typeof a) return a.split(\"\");\n if (ca(a)) {\n for (var b = [], c = a.length, d = 0; d < c; d++) b.push(a[d]);\n return b;\n }\n b = [];\n c = 0;\n for (d in a) b[c++] = a[d];\n return a = b;\n}\nfunction Lc(a, b) {\n if (a.forEach && \"function\" == typeof a.forEach) a.forEach(b, void 0);else if (ca(a) || \"string\" === typeof a) oa(a, b, void 0);else {\n if (a.L && \"function\" == typeof a.L) var c = a.L();else if (a.K && \"function\" == typeof a.K) c = void 0;else if (ca(a) || \"string\" === typeof a) {\n c = [];\n for (var d = a.length, e = 0; e < d; e++) c.push(e);\n } else for (e in c = [], d = 0, a) c[d++] = e;\n d = Kc(a);\n e = d.length;\n for (var f = 0; f < e; f++) b.call(void 0, d[f], c && c[f], a);\n }\n}\nfunction R(a, b) {\n this.b = {};\n this.a = [];\n this.c = 0;\n var c = arguments.length;\n if (1 < c) {\n if (c % 2) throw Error(\"Uneven number of arguments\");\n for (var d = 0; d < c; d += 2) this.set(arguments[d], arguments[d + 1]);\n } else if (a) if (a instanceof R) for (c = a.L(), d = 0; d < c.length; d++) this.set(c[d], a.get(c[d]));else for (d in a) this.set(d, a[d]);\n}\ng = R.prototype;\ng.K = function () {\n Mc(this);\n for (var a = [], b = 0; b < this.a.length; b++) a.push(this.b[this.a[b]]);\n return a;\n};\ng.L = function () {\n Mc(this);\n return this.a.concat();\n};\nfunction Mc(a) {\n if (a.c != a.a.length) {\n for (var b = 0, c = 0; b < a.a.length;) {\n var d = a.a[b];\n S(a.b, d) && (a.a[c++] = d);\n b++;\n }\n a.a.length = c;\n }\n if (a.c != a.a.length) {\n var e = {};\n for (c = b = 0; b < a.a.length;) d = a.a[b], S(e, d) || (a.a[c++] = d, e[d] = 1), b++;\n a.a.length = c;\n }\n}\ng.get = function (a, b) {\n return S(this.b, a) ? this.b[a] : b;\n};\ng.set = function (a, b) {\n S(this.b, a) || (this.c++, this.a.push(a));\n this.b[a] = b;\n};\ng.forEach = function (a, b) {\n for (var c = this.L(), d = 0; d < c.length; d++) {\n var e = c[d],\n f = this.get(e);\n a.call(b, f, e, this);\n }\n};\nfunction S(a, b) {\n return Object.prototype.hasOwnProperty.call(a, b);\n}\nvar Nc = /^(?:([^:/?#.]+):)?(?:\\/\\/(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$/;\nfunction Oc(a, b) {\n if (a) {\n a = a.split(\"&\");\n for (var c = 0; c < a.length; c++) {\n var d = a[c].indexOf(\"=\"),\n e = null;\n if (0 <= d) {\n var f = a[c].substring(0, d);\n e = a[c].substring(d + 1);\n } else f = a[c];\n b(f, e ? decodeURIComponent(e.replace(/\\+/g, \" \")) : \"\");\n }\n }\n}\nfunction T(a, b) {\n this.c = this.j = this.f = \"\";\n this.h = null;\n this.i = this.g = \"\";\n this.a = !1;\n if (a instanceof T) {\n this.a = void 0 !== b ? b : a.a;\n Pc(this, a.f);\n this.j = a.j;\n Qc(this, a.c);\n Rc(this, a.h);\n this.g = a.g;\n b = a.b;\n var c = new U();\n c.c = b.c;\n b.a && (c.a = new R(b.a), c.b = b.b);\n Sc(this, c);\n this.i = a.i;\n } else a && (c = String(a).match(Nc)) ? (this.a = !!b, Pc(this, c[1] || \"\", !0), this.j = Tc(c[2] || \"\"), Qc(this, c[3] || \"\", !0), Rc(this, c[4]), this.g = Tc(c[5] || \"\", !0), Sc(this, c[6] || \"\", !0), this.i = Tc(c[7] || \"\")) : (this.a = !!b, this.b = new U(null, this.a));\n}\nT.prototype.toString = function () {\n var a = [],\n b = this.f;\n b && a.push(Uc(b, Vc, !0), \":\");\n var c = this.c;\n if (c || \"file\" == b) a.push(\"//\"), (b = this.j) && a.push(Uc(b, Vc, !0), \"@\"), a.push(encodeURIComponent(String(c)).replace(/%25([0-9a-fA-F]{2})/g, \"%$1\")), c = this.h, null != c && a.push(\":\", String(c));\n if (c = this.g) this.c && \"/\" != c.charAt(0) && a.push(\"/\"), a.push(Uc(c, \"/\" == c.charAt(0) ? Wc : Xc, !0));\n (c = this.b.toString()) && a.push(\"?\", c);\n (c = this.i) && a.push(\"#\", Uc(c, Yc));\n return a.join(\"\");\n};\nfunction L(a) {\n return new T(a);\n}\nfunction Pc(a, b, c) {\n a.f = c ? Tc(b, !0) : b;\n a.f && (a.f = a.f.replace(/:$/, \"\"));\n}\nfunction Qc(a, b, c) {\n a.c = c ? Tc(b, !0) : b;\n}\nfunction Rc(a, b) {\n if (b) {\n b = Number(b);\n if (isNaN(b) || 0 > b) throw Error(\"Bad port number \" + b);\n a.h = b;\n } else a.h = null;\n}\nfunction Sc(a, b, c) {\n b instanceof U ? (a.b = b, Zc(a.b, a.a)) : (c || (b = Uc(b, $c)), a.b = new U(b, a.a));\n}\nfunction Q(a, b, c) {\n a.b.set(b, c);\n}\nfunction lc(a) {\n Q(a, \"zx\", Math.floor(2147483648 * Math.random()).toString(36) + Math.abs(Math.floor(2147483648 * Math.random()) ^ q()).toString(36));\n return a;\n}\nfunction ad(a) {\n return a instanceof T ? L(a) : new T(a, void 0);\n}\nfunction bd(a, b, c, d) {\n var e = new T(null, void 0);\n a && Pc(e, a);\n b && Qc(e, b);\n c && Rc(e, c);\n d && (e.g = d);\n return e;\n}\nfunction Tc(a, b) {\n return a ? b ? decodeURI(a.replace(/%25/g, \"%2525\")) : decodeURIComponent(a) : \"\";\n}\nfunction Uc(a, b, c) {\n return \"string\" === typeof a ? (a = encodeURI(a).replace(b, cd), c && (a = a.replace(/%25([0-9a-fA-F]{2})/g, \"%$1\")), a) : null;\n}\nfunction cd(a) {\n a = a.charCodeAt(0);\n return \"%\" + (a >> 4 & 15).toString(16) + (a & 15).toString(16);\n}\nvar Vc = /[#\\/\\?@]/g,\n Xc = /[#\\?:]/g,\n Wc = /[#\\?]/g,\n $c = /[#\\?@]/g,\n Yc = /#/g;\nfunction U(a, b) {\n this.b = this.a = null;\n this.c = a || null;\n this.f = !!b;\n}\nfunction V(a) {\n a.a || (a.a = new R(), a.b = 0, a.c && Oc(a.c, function (b, c) {\n a.add(decodeURIComponent(b.replace(/\\+/g, \" \")), c);\n }));\n}\ng = U.prototype;\ng.add = function (a, b) {\n V(this);\n this.c = null;\n a = W(this, a);\n var c = this.a.get(a);\n c || this.a.set(a, c = []);\n c.push(b);\n this.b += 1;\n return this;\n};\nfunction dd(a, b) {\n V(a);\n b = W(a, b);\n S(a.a.b, b) && (a.c = null, a.b -= a.a.get(b).length, a = a.a, S(a.b, b) && (delete a.b[b], a.c--, a.a.length > 2 * a.c && Mc(a)));\n}\nfunction ed(a, b) {\n V(a);\n b = W(a, b);\n return S(a.a.b, b);\n}\ng.forEach = function (a, b) {\n V(this);\n this.a.forEach(function (c, d) {\n oa(c, function (e) {\n a.call(b, e, d, this);\n }, this);\n }, this);\n};\ng.L = function () {\n V(this);\n for (var a = this.a.K(), b = this.a.L(), c = [], d = 0; d < b.length; d++) for (var e = a[d], f = 0; f < e.length; f++) c.push(b[d]);\n return c;\n};\ng.K = function (a) {\n V(this);\n var b = [];\n if (\"string\" === typeof a) ed(this, a) && (b = ra(b, this.a.get(W(this, a))));else {\n a = this.a.K();\n for (var c = 0; c < a.length; c++) b = ra(b, a[c]);\n }\n return b;\n};\ng.set = function (a, b) {\n V(this);\n this.c = null;\n a = W(this, a);\n ed(this, a) && (this.b -= this.a.get(a).length);\n this.a.set(a, [b]);\n this.b += 1;\n return this;\n};\ng.get = function (a, b) {\n if (!a) return b;\n a = this.K(a);\n return 0 < a.length ? String(a[0]) : b;\n};\nfunction nc(a, b, c) {\n dd(a, b);\n 0 < c.length && (a.c = null, a.a.set(W(a, b), sa(c)), a.b += c.length);\n}\ng.toString = function () {\n if (this.c) return this.c;\n if (!this.a) return \"\";\n for (var a = [], b = this.a.L(), c = 0; c < b.length; c++) {\n var d = b[c],\n e = encodeURIComponent(String(d));\n d = this.K(d);\n for (var f = 0; f < d.length; f++) {\n var h = e;\n \"\" !== d[f] && (h += \"=\" + encodeURIComponent(String(d[f])));\n a.push(h);\n }\n }\n return this.c = a.join(\"&\");\n};\nfunction W(a, b) {\n b = String(b);\n a.f && (b = b.toLowerCase());\n return b;\n}\nfunction Zc(a, b) {\n b && !a.f && (V(a), a.c = null, a.a.forEach(function (c, d) {\n var e = d.toLowerCase();\n d != e && (dd(this, d), nc(this, e, c));\n }, a));\n a.f = b;\n}\nfunction fd(a, b) {\n this.b = a;\n this.a = b;\n}\nfunction gd(a) {\n this.g = a || hd;\n k.PerformanceNavigationTiming ? (a = k.performance.getEntriesByType(\"navigation\"), a = 0 < a.length && (\"hq\" == a[0].nextHopProtocol || \"h2\" == a[0].nextHopProtocol)) : a = !!(k.ia && k.ia.ya && k.ia.ya() && k.ia.ya().qb);\n this.f = a ? this.g : 1;\n this.a = null;\n 1 < this.f && (this.a = new Set());\n this.b = null;\n this.c = [];\n}\nvar hd = 10;\nfunction id(a) {\n return a.b ? !0 : a.a ? a.a.size >= a.f : !1;\n}\nfunction Dc(a) {\n return a.b ? 1 : a.a ? a.a.size : 0;\n}\nfunction zc(a, b) {\n return a.b ? a.b == b : a.a ? a.a.has(b) : !1;\n}\nfunction Ec(a, b) {\n a.a ? a.a.add(b) : a.b = b;\n}\nfunction Gc(a, b) {\n a.b && a.b == b ? a.b = null : a.a && a.a.has(b) && a.a.delete(b);\n}\ngd.prototype.cancel = function () {\n var e_1, _a;\n this.c = jd(this);\n if (this.b) this.b.cancel(), this.b = null;else if (this.a && 0 !== this.a.size) {\n try {\n for (var _b = __values(this.a.values()), _c = _b.next(); !_c.done; _c = _b.next()) {\n var a = _c.value;\n a.cancel();\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n this.a.clear();\n }\n};\nfunction jd(a) {\n var e_2, _a;\n if (null != a.b) return a.c.concat(a.b.s);\n if (null != a.a && 0 !== a.a.size) {\n var b = a.c;\n try {\n for (var _b = __values(a.a.values()), _c = _b.next(); !_c.done; _c = _b.next()) {\n var c = _c.value;\n b = b.concat(c.s);\n }\n } catch (e_2_1) {\n e_2 = {\n error: e_2_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n return b;\n }\n return sa(a.c);\n}\nfunction kd() {}\nkd.prototype.stringify = function (a) {\n return k.JSON.stringify(a, void 0);\n};\nkd.prototype.parse = function (a) {\n return k.JSON.parse(a, void 0);\n};\nfunction ld() {\n this.a = new kd();\n}\nfunction md(a, b, c) {\n var d = c || \"\";\n try {\n Lc(a, function (e, f) {\n var h = e;\n n(e) && (h = vb(e));\n b.push(d + f + \"=\" + encodeURIComponent(h));\n });\n } catch (e) {\n throw b.push(d + \"type=\" + encodeURIComponent(\"_badmap\")), e;\n }\n}\nfunction nd(a, b) {\n var c = new Pb();\n if (k.Image) {\n var d = new Image();\n d.onload = ka(od, c, d, \"TestLoadImage: loaded\", !0, b);\n d.onerror = ka(od, c, d, \"TestLoadImage: error\", !1, b);\n d.onabort = ka(od, c, d, \"TestLoadImage: abort\", !1, b);\n d.ontimeout = ka(od, c, d, \"TestLoadImage: timeout\", !1, b);\n k.setTimeout(function () {\n if (d.ontimeout) d.ontimeout();\n }, 1E4);\n d.src = a;\n } else b(!1);\n}\nfunction od(a, b, c, d, e) {\n try {\n b.onload = null, b.onerror = null, b.onabort = null, b.ontimeout = null, e(d);\n } catch (f) {}\n}\nvar pd = k.JSON.parse;\nfunction X(a) {\n D.call(this);\n this.headers = new R();\n this.H = a || null;\n this.b = !1;\n this.s = this.a = null;\n this.B = \"\";\n this.h = 0;\n this.f = \"\";\n this.g = this.A = this.l = this.u = !1;\n this.o = 0;\n this.m = null;\n this.I = qd;\n this.D = this.F = !1;\n}\nr(X, D);\nvar qd = \"\",\n rd = /^https?$/i,\n sd = [\"POST\", \"PUT\"];\ng = X.prototype;\ng.ba = function (a, b, c, d) {\n if (this.a) throw Error(\"[goog.net.XhrIo] Object is active with another request=\" + this.B + \"; newUri=\" + a);\n b = b ? b.toUpperCase() : \"GET\";\n this.B = a;\n this.f = \"\";\n this.h = 0;\n this.u = !1;\n this.b = !0;\n this.a = new XMLHttpRequest();\n this.s = this.H ? bc(this.H) : bc(fc);\n this.a.onreadystatechange = p(this.za, this);\n try {\n this.A = !0, this.a.open(b, String(a), !0), this.A = !1;\n } catch (f) {\n td(this, f);\n return;\n }\n a = c || \"\";\n var e = new R(this.headers);\n d && Lc(d, function (f, h) {\n e.set(h, f);\n });\n d = pa(e.L());\n c = k.FormData && a instanceof k.FormData;\n !(0 <= na(sd, b)) || d || c || e.set(\"Content-Type\", \"application/x-www-form-urlencoded;charset=utf-8\");\n e.forEach(function (f, h) {\n this.a.setRequestHeader(h, f);\n }, this);\n this.I && (this.a.responseType = this.I);\n \"withCredentials\" in this.a && this.a.withCredentials !== this.F && (this.a.withCredentials = this.F);\n try {\n ud(this), 0 < this.o && ((this.D = vd(this.a)) ? (this.a.timeout = this.o, this.a.ontimeout = p(this.xa, this)) : this.m = Jb(this.xa, this.o, this)), this.l = !0, this.a.send(a), this.l = !1;\n } catch (f) {\n td(this, f);\n }\n};\nfunction vd(a) {\n return x && Ra(9) && \"number\" === typeof a.timeout && void 0 !== a.ontimeout;\n}\nfunction qa(a) {\n return \"content-type\" == a.toLowerCase();\n}\ng.xa = function () {\n \"undefined\" != typeof goog && this.a && (this.f = \"Timed out after \" + this.o + \"ms, aborting\", this.h = 8, this.dispatchEvent(\"timeout\"), this.abort(8));\n};\nfunction td(a, b) {\n a.b = !1;\n a.a && (a.g = !0, a.a.abort(), a.g = !1);\n a.f = b;\n a.h = 5;\n wd(a);\n xd(a);\n}\nfunction wd(a) {\n a.u || (a.u = !0, a.dispatchEvent(\"complete\"), a.dispatchEvent(\"error\"));\n}\ng.abort = function (a) {\n this.a && this.b && (this.b = !1, this.g = !0, this.a.abort(), this.g = !1, this.h = a || 7, this.dispatchEvent(\"complete\"), this.dispatchEvent(\"abort\"), xd(this));\n};\ng.G = function () {\n this.a && (this.b && (this.b = !1, this.g = !0, this.a.abort(), this.g = !1), xd(this, !0));\n X.S.G.call(this);\n};\ng.za = function () {\n this.j || (this.A || this.l || this.g ? yd(this) : this.Ta());\n};\ng.Ta = function () {\n yd(this);\n};\nfunction yd(a) {\n if (a.b && \"undefined\" != typeof goog && (!a.s[1] || 4 != N(a) || 2 != a.X())) if (a.l && 4 == N(a)) Jb(a.za, 0, a);else if (a.dispatchEvent(\"readystatechange\"), 4 == N(a)) {\n a.b = !1;\n try {\n var b = a.X();\n a: switch (b) {\n case 200:\n case 201:\n case 202:\n case 204:\n case 206:\n case 304:\n case 1223:\n var c = !0;\n break a;\n default:\n c = !1;\n }\n var d;\n if (!(d = c)) {\n var e;\n if (e = 0 === b) {\n var f = String(a.B).match(Nc)[1] || null;\n if (!f && k.self && k.self.location) {\n var h = k.self.location.protocol;\n f = h.substr(0, h.length - 1);\n }\n e = !rd.test(f ? f.toLowerCase() : \"\");\n }\n d = e;\n }\n if (d) a.dispatchEvent(\"complete\"), a.dispatchEvent(\"success\");else {\n a.h = 6;\n try {\n var m = 2 < N(a) ? a.a.statusText : \"\";\n } catch (l) {\n m = \"\";\n }\n a.f = m + \" [\" + a.X() + \"]\";\n wd(a);\n }\n } finally {\n xd(a);\n }\n }\n}\nfunction xd(a, b) {\n if (a.a) {\n ud(a);\n var c = a.a,\n d = a.s[0] ? aa : null;\n a.a = null;\n a.s = null;\n b || a.dispatchEvent(\"ready\");\n try {\n c.onreadystatechange = d;\n } catch (e) {}\n }\n}\nfunction ud(a) {\n a.a && a.D && (a.a.ontimeout = null);\n a.m && (k.clearTimeout(a.m), a.m = null);\n}\nfunction N(a) {\n return a.a ? a.a.readyState : 0;\n}\ng.X = function () {\n try {\n return 2 < N(this) ? this.a.status : -1;\n } catch (a) {\n return -1;\n }\n};\ng.$ = function () {\n try {\n return this.a ? this.a.responseText : \"\";\n } catch (a) {\n return \"\";\n }\n};\ng.Na = function (a) {\n if (this.a) {\n var b = this.a.responseText;\n a && 0 == b.indexOf(a) && (b = b.substring(a.length));\n return pd(b);\n }\n};\ng.ua = function () {\n return this.h;\n};\ng.Qa = function () {\n return \"string\" === typeof this.f ? this.f : String(this.f);\n};\nfunction zd(a) {\n var b = \"\";\n Aa(a, function (c, d) {\n b += d;\n b += \":\";\n b += c;\n b += \"\\r\\n\";\n });\n return b;\n}\nfunction Ad(a, b, c) {\n a: {\n for (d in c) {\n var d = !1;\n break a;\n }\n d = !0;\n }\n d || (c = zd(c), \"string\" === typeof a ? null != c && encodeURIComponent(String(c)) : Q(a, b, c));\n}\nfunction Bd(a, b, c) {\n return c && c.internalChannelParams ? c.internalChannelParams[a] || b : b;\n}\nfunction Cd(a) {\n this.pa = 0;\n this.g = [];\n this.c = new Pb();\n this.ga = this.la = this.B = this.fa = this.a = this.na = this.A = this.W = this.i = this.O = this.l = null;\n this.La = this.R = 0;\n this.Ia = Bd(\"failFast\", !1, a);\n this.H = this.m = this.j = this.h = this.f = null;\n this.T = !0;\n this.I = this.oa = this.P = -1;\n this.U = this.o = this.u = 0;\n this.Fa = Bd(\"baseRetryDelayMs\", 5E3, a);\n this.Ma = Bd(\"retryDelaySeedMs\", 1E4, a);\n this.Ja = Bd(\"forwardChannelMaxRetries\", 2, a);\n this.ma = Bd(\"forwardChannelRequestTimeoutMs\", 2E4, a);\n this.Ka = a && a.g || void 0;\n this.D = void 0;\n this.C = a && a.supportsCrossDomainXhr || !1;\n this.J = \"\";\n this.b = new gd(a && a.concurrentRequestLimit);\n this.ka = new ld();\n this.da = a && a.fastHandshake || !1;\n this.Ga = a && a.b || !1;\n a && a.f && (this.c.a = !1);\n a && a.forceLongPolling && (this.T = !1);\n this.V = !this.da && this.T && a && a.c || !1;\n this.ea = void 0;\n this.N = 0;\n this.F = !1;\n this.s = null;\n}\ng = Cd.prototype;\ng.ha = 8;\ng.v = 1;\nfunction Jc(a) {\n Dd(a);\n if (3 == a.v) {\n var b = a.R++,\n c = L(a.B);\n Q(c, \"SID\", a.J);\n Q(c, \"RID\", b);\n Q(c, \"TYPE\", \"terminate\");\n Ed(a, c);\n b = new K(a, a.c, b, void 0);\n b.H = 2;\n b.i = lc(L(c));\n c = !1;\n k.navigator && k.navigator.sendBeacon && (c = k.navigator.sendBeacon(b.i.toString(), \"\"));\n !c && k.Image && (new Image().src = b.i, c = !0);\n c || (b.a = oc(b.g, null), b.a.ba(b.i));\n b.u = q();\n M(b);\n }\n Fd(a);\n}\nfunction Bc(a) {\n a.a && (xc(a), a.a.cancel(), a.a = null);\n}\nfunction Dd(a) {\n Bc(a);\n a.j && (k.clearTimeout(a.j), a.j = null);\n Ac(a);\n a.b.cancel();\n a.h && (\"number\" === typeof a.h && k.clearTimeout(a.h), a.h = null);\n}\nfunction Gd(a, b) {\n a.g.push(new fd(a.La++, b));\n 3 == a.v && Ic(a);\n}\nfunction Ic(a) {\n id(a.b) || a.h || (a.h = !0, Cb(a.Ba, a), a.u = 0);\n}\nfunction Hd(a, b) {\n if (Dc(a.b) >= a.b.f - (a.h ? 1 : 0)) return !1;\n if (a.h) return a.g = b.s.concat(a.g), !0;\n if (1 == a.v || 2 == a.v || a.u >= (a.Ia ? 0 : a.Ja)) return !1;\n a.h = I(p(a.Ba, a, b), Id(a, a.u));\n a.u++;\n return !0;\n}\ng.Ba = function (a) {\n if (this.h) if (this.h = null, 1 == this.v) {\n if (!a) {\n this.R = Math.floor(1E5 * Math.random());\n a = this.R++;\n var b = new K(this, this.c, a, void 0),\n c = this.l;\n this.O && (c ? (c = Ba(c), Da(c, this.O)) : c = this.O);\n null === this.i && (b.B = c);\n var d;\n if (this.da) a: {\n for (var e = d = 0; e < this.g.length; e++) {\n b: {\n var f = this.g[e];\n if (\"__data__\" in f.a && (f = f.a.__data__, \"string\" === typeof f)) {\n f = f.length;\n break b;\n }\n f = void 0;\n }\n if (void 0 === f) break;\n d += f;\n if (4096 < d) {\n d = e;\n break a;\n }\n if (4096 === d || e === this.g.length - 1) {\n d = e + 1;\n break a;\n }\n }\n d = 1E3;\n } else d = 1E3;\n d = Jd(this, b, d);\n e = L(this.B);\n Q(e, \"RID\", a);\n Q(e, \"CVER\", 22);\n this.A && Q(e, \"X-HTTP-Session-Id\", this.A);\n Ed(this, e);\n this.i && c && Ad(e, this.i, c);\n Ec(this.b, b);\n this.Ga && Q(e, \"TYPE\", \"init\");\n this.da ? (Q(e, \"$req\", d), Q(e, \"SID\", \"null\"), b.V = !0, kc(b, e, null)) : kc(b, e, d);\n this.v = 2;\n }\n } else 3 == this.v && (a ? Kd(this, a) : 0 == this.g.length || id(this.b) || Kd(this));\n};\nfunction Kd(a, b) {\n var c;\n b ? c = b.f : c = a.R++;\n var d = L(a.B);\n Q(d, \"SID\", a.J);\n Q(d, \"RID\", c);\n Q(d, \"AID\", a.P);\n Ed(a, d);\n a.i && a.l && Ad(d, a.i, a.l);\n c = new K(a, a.c, c, a.u + 1);\n null === a.i && (c.B = a.l);\n b && (a.g = b.s.concat(a.g));\n b = Jd(a, c, 1E3);\n c.setTimeout(Math.round(.5 * a.ma) + Math.round(.5 * a.ma * Math.random()));\n Ec(a.b, c);\n kc(c, d, b);\n}\nfunction Ed(a, b) {\n a.f && Lc({}, function (c, d) {\n Q(b, d, c);\n });\n}\nfunction Jd(a, b, c) {\n c = Math.min(a.g.length, c);\n var d = a.f ? p(a.f.Ha, a.f, a) : null;\n a: for (var e = a.g, f = -1;;) {\n var h = [\"count=\" + c];\n -1 == f ? 0 < c ? (f = e[0].b, h.push(\"ofs=\" + f)) : f = 0 : h.push(\"ofs=\" + f);\n for (var m = !0, l = 0; l < c; l++) {\n var t = e[l].b,\n B = e[l].a;\n t -= f;\n if (0 > t) f = Math.max(0, e[l].b - 100), m = !1;else try {\n md(B, h, \"req\" + t + \"_\");\n } catch (z) {\n d && d(B);\n }\n }\n if (m) {\n d = h.join(\"&\");\n break a;\n }\n }\n a = a.g.splice(0, c);\n b.s = a;\n return d;\n}\nfunction Hc(a) {\n a.a || a.j || (a.U = 1, Cb(a.Aa, a), a.o = 0);\n}\nfunction Cc(a) {\n if (a.a || a.j || 3 <= a.o) return !1;\n a.U++;\n a.j = I(p(a.Aa, a), Id(a, a.o));\n a.o++;\n return !0;\n}\ng.Aa = function () {\n this.j = null;\n Ld(this);\n if (this.V && !(this.F || null == this.a || 0 >= this.N)) {\n var a = 2 * this.N;\n this.c.info(\"BP detection timer enabled: \" + a);\n this.s = I(p(this.Sa, this), a);\n }\n};\ng.Sa = function () {\n this.s && (this.s = null, this.c.info(\"BP detection timeout reached.\"), this.c.info(\"Buffering proxy detected and switch to long-polling!\"), this.H = !1, this.F = !0, Bc(this), Ld(this));\n};\nfunction xc(a) {\n null != a.s && (k.clearTimeout(a.s), a.s = null);\n}\nfunction Ld(a) {\n a.a = new K(a, a.c, \"rpc\", a.U);\n null === a.i && (a.a.B = a.l);\n a.a.O = 0;\n var b = L(a.la);\n Q(b, \"RID\", \"rpc\");\n Q(b, \"SID\", a.J);\n Q(b, \"CI\", a.H ? \"0\" : \"1\");\n Q(b, \"AID\", a.P);\n Ed(a, b);\n Q(b, \"TYPE\", \"xmlhttp\");\n a.i && a.l && Ad(b, a.i, a.l);\n a.D && a.a.setTimeout(a.D);\n var c = a.a;\n a = a.ga;\n c.H = 1;\n c.i = lc(L(b));\n c.j = null;\n c.I = !0;\n mc(c, a);\n}\ng.Ra = function () {\n null != this.m && (this.m = null, Bc(this), Cc(this), H(19));\n};\nfunction Ac(a) {\n null != a.m && (k.clearTimeout(a.m), a.m = null);\n}\nfunction uc(a, b) {\n var c = null;\n if (a.a == b) {\n Ac(a);\n xc(a);\n a.a = null;\n var d = 2;\n } else if (zc(a.b, b)) c = b.s, Gc(a.b, b), d = 1;else return;\n a.I = b.N;\n if (0 != a.v) if (b.b) {\n if (1 == d) {\n c = b.j ? b.j.length : 0;\n b = q() - b.u;\n var e = a.u;\n d = Vb();\n d.dispatchEvent(new Yb(d, c, b, e));\n Ic(a);\n } else Hc(a);\n } else if (e = b.h, 3 == e || 0 == e && 0 < a.I || !(1 == d && Hd(a, b) || 2 == d && Cc(a))) switch (c && 0 < c.length && (b = a.b, b.c = b.c.concat(c)), e) {\n case 1:\n P(a, 5);\n break;\n case 4:\n P(a, 10);\n break;\n case 3:\n P(a, 6);\n break;\n default:\n P(a, 2);\n }\n}\nfunction Id(a, b) {\n var c = a.Fa + Math.floor(Math.random() * a.Ma);\n a.f || (c *= 2);\n return c * b;\n}\nfunction P(a, b) {\n a.c.info(\"Error code \" + b);\n if (2 == b) {\n var c = null;\n a.f && (c = null);\n var d = p(a.Xa, a);\n c || (c = new T(\"//www.google.com/images/cleardot.gif\"), k.location && \"http\" == k.location.protocol || Pc(c, \"https\"), lc(c));\n nd(c.toString(), d);\n } else H(2);\n a.v = 0;\n a.f && a.f.ra(b);\n Fd(a);\n Dd(a);\n}\ng.Xa = function (a) {\n a ? (this.c.info(\"Successfully pinged google.com\"), H(2)) : (this.c.info(\"Failed to ping google.com\"), H(1));\n};\nfunction Fd(a) {\n a.v = 0;\n a.I = -1;\n if (a.f) {\n if (0 != jd(a.b).length || 0 != a.g.length) a.b.c.length = 0, sa(a.g), a.g.length = 0;\n a.f.qa();\n }\n}\nfunction Fc(a, b, c) {\n var d = ad(c);\n if (\"\" != d.c) b && Qc(d, b + \".\" + d.c), Rc(d, d.h);else {\n var e = k.location;\n d = bd(e.protocol, b ? b + \".\" + e.hostname : e.hostname, +e.port, c);\n }\n a.W && Aa(a.W, function (f, h) {\n Q(d, h, f);\n });\n b = a.A;\n c = a.na;\n b && c && Q(d, b, c);\n Q(d, \"VER\", a.ha);\n Ed(a, d);\n return d;\n}\nfunction oc(a, b) {\n if (b && !a.C) throw Error(\"Can't create secondary domain capable XhrIo object.\");\n b = new X(a.Ka);\n b.F = a.C;\n return b;\n}\nfunction Md() {}\ng = Md.prototype;\ng.ta = function () {};\ng.sa = function () {};\ng.ra = function () {};\ng.qa = function () {};\ng.Ha = function () {};\nfunction Nd() {\n if (x && !(10 <= Number(Ua))) throw Error(\"Environmental error: no available transport.\");\n}\nNd.prototype.a = function (a, b) {\n return new Y(a, b);\n};\nfunction Y(a, b) {\n D.call(this);\n this.a = new Cd(b);\n this.l = a;\n this.b = b && b.messageUrlParams || null;\n a = b && b.messageHeaders || null;\n b && b.clientProtocolHeaderRequired && (a ? a[\"X-Client-Protocol\"] = \"webchannel\" : a = {\n \"X-Client-Protocol\": \"webchannel\"\n });\n this.a.l = a;\n a = b && b.initMessageHeaders || null;\n b && b.messageContentType && (a ? a[\"X-WebChannel-Content-Type\"] = b.messageContentType : a = {\n \"X-WebChannel-Content-Type\": b.messageContentType\n });\n b && b.a && (a ? a[\"X-WebChannel-Client-Profile\"] = b.a : a = {\n \"X-WebChannel-Client-Profile\": b.a\n });\n this.a.O = a;\n (a = b && b.httpHeadersOverwriteParam) && !ta(a) && (this.a.i = a);\n this.h = b && b.supportsCrossDomainXhr || !1;\n this.g = b && b.sendRawJson || !1;\n (b = b && b.httpSessionIdParam) && !ta(b) && (this.a.A = b, a = this.b, null !== a && b in a && (a = this.b, b in a && delete a[b]));\n this.f = new Z(this);\n}\nr(Y, D);\ng = Y.prototype;\ng.addEventListener = function (a, b, c, d) {\n Y.S.addEventListener.call(this, a, b, c, d);\n};\ng.removeEventListener = function (a, b, c, d) {\n Y.S.removeEventListener.call(this, a, b, c, d);\n};\ng.Oa = function () {\n this.a.f = this.f;\n this.h && (this.a.C = !0);\n var a = this.a,\n b = this.l,\n c = this.b || void 0;\n H(0);\n a.fa = b;\n a.W = c || {};\n a.H = a.T;\n a.B = Fc(a, null, a.fa);\n Ic(a);\n};\ng.close = function () {\n Jc(this.a);\n};\ng.Pa = function (a) {\n if (\"string\" === typeof a) {\n var b = {};\n b.__data__ = a;\n Gd(this.a, b);\n } else this.g ? (b = {}, b.__data__ = vb(a), Gd(this.a, b)) : Gd(this.a, a);\n};\ng.G = function () {\n this.a.f = null;\n delete this.f;\n Jc(this.a);\n delete this.a;\n Y.S.G.call(this);\n};\nfunction Od(a) {\n dc.call(this);\n var b = a.__sm__;\n if (b) {\n a: {\n for (var c in b) {\n a = c;\n break a;\n }\n a = void 0;\n }\n (this.c = a) ? (a = this.c, this.data = null !== b && a in b ? b[a] : void 0) : this.data = b;\n } else this.data = a;\n}\nr(Od, dc);\nfunction Pd() {\n ec.call(this);\n this.status = 1;\n}\nr(Pd, ec);\nfunction Z(a) {\n this.a = a;\n}\nr(Z, Md);\nZ.prototype.ta = function () {\n this.a.dispatchEvent(\"a\");\n};\nZ.prototype.sa = function (a) {\n this.a.dispatchEvent(new Od(a));\n};\nZ.prototype.ra = function (a) {\n this.a.dispatchEvent(new Pd(a));\n};\nZ.prototype.qa = function () {\n this.a.dispatchEvent(\"b\");\n}; /*\r\n Copyright 2017 Google LLC\r\n Licensed under the Apache License, Version 2.0 (the \"License\");\r\n you may not use this file except in compliance with the License.\r\n You may obtain a copy of the License at\r\n http://www.apache.org/licenses/LICENSE-2.0\r\n Unless required by applicable law or agreed to in writing, software\r\n distributed under the License is distributed on an \"AS IS\" BASIS,\r\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n See the License for the specific language governing permissions and\r\n limitations under the License.\r\n */\nNd.prototype.createWebChannel = Nd.prototype.a;\nY.prototype.send = Y.prototype.Pa;\nY.prototype.open = Y.prototype.Oa;\nY.prototype.close = Y.prototype.close;\nZb.NO_ERROR = 0;\nZb.TIMEOUT = 8;\nZb.HTTP_ERROR = 6;\n$b.COMPLETE = \"complete\";\ncc.EventType = J;\nJ.OPEN = \"a\";\nJ.CLOSE = \"b\";\nJ.ERROR = \"c\";\nJ.MESSAGE = \"d\";\nD.prototype.listen = D.prototype.va;\nX.prototype.listenOnce = X.prototype.wa;\nX.prototype.getLastError = X.prototype.Qa;\nX.prototype.getLastErrorCode = X.prototype.ua;\nX.prototype.getStatus = X.prototype.X;\nX.prototype.getResponseJson = X.prototype.Na;\nX.prototype.getResponseText = X.prototype.$;\nX.prototype.send = X.prototype.ba;\nvar createWebChannelTransport = function () {\n return new Nd();\n};\nvar ErrorCode = Zb;\nvar EventType = $b;\nvar WebChannel = cc;\nvar XhrIo = X;\nvar esm = {\n createWebChannelTransport: createWebChannelTransport,\n ErrorCode: ErrorCode,\n EventType: EventType,\n WebChannel: WebChannel,\n XhrIo: XhrIo\n};\nexport default esm;\nexport { ErrorCode, EventType, WebChannel, XhrIo, createWebChannelTransport };","var sparkMd5 = {\n exports: {}\n};\n(function (module, exports) {\n (function (factory) {\n {\n module.exports = factory();\n }\n })(function (undefined$1) {\n var hex_chr = [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"a\", \"b\", \"c\", \"d\", \"e\", \"f\"];\n function md5cycle(x, k) {\n var a = x[0],\n b = x[1],\n c = x[2],\n d = x[3];\n a += (b & c | ~b & d) + k[0] - 680876936 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[1] - 389564586 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[2] + 606105819 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[3] - 1044525330 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & c | ~b & d) + k[4] - 176418897 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[5] + 1200080426 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[6] - 1473231341 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[7] - 45705983 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & c | ~b & d) + k[8] + 1770035416 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[9] - 1958414417 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[10] - 42063 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[11] - 1990404162 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & c | ~b & d) + k[12] + 1804603682 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[13] - 40341101 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[14] - 1502002290 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[15] + 1236535329 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & d | c & ~d) + k[1] - 165796510 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[6] - 1069501632 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[11] + 643717713 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[0] - 373897302 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b & d | c & ~d) + k[5] - 701558691 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[10] + 38016083 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[15] - 660478335 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[4] - 405537848 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b & d | c & ~d) + k[9] + 568446438 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[14] - 1019803690 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[3] - 187363961 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[8] + 1163531501 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b & d | c & ~d) + k[13] - 1444681467 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[2] - 51403784 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[7] + 1735328473 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[12] - 1926607734 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b ^ c ^ d) + k[5] - 378558 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[8] - 2022574463 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[11] + 1839030562 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[14] - 35309556 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (b ^ c ^ d) + k[1] - 1530992060 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[4] + 1272893353 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[7] - 155497632 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[10] - 1094730640 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (b ^ c ^ d) + k[13] + 681279174 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[0] - 358537222 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[3] - 722521979 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[6] + 76029189 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (b ^ c ^ d) + k[9] - 640364487 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[12] - 421815835 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[15] + 530742520 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[2] - 995338651 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (c ^ (b | ~d)) + k[0] - 198630844 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[7] + 1126891415 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[14] - 1416354905 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[5] - 57434055 | 0;\n b = (b << 21 | b >>> 11) + c | 0;\n a += (c ^ (b | ~d)) + k[12] + 1700485571 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[3] - 1894986606 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[10] - 1051523 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[1] - 2054922799 | 0;\n b = (b << 21 | b >>> 11) + c | 0;\n a += (c ^ (b | ~d)) + k[8] + 1873313359 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[15] - 30611744 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[6] - 1560198380 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[13] + 1309151649 | 0;\n b = (b << 21 | b >>> 11) + c | 0;\n a += (c ^ (b | ~d)) + k[4] - 145523070 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[11] - 1120210379 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[2] + 718787259 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[9] - 343485551 | 0;\n b = (b << 21 | b >>> 11) + c | 0;\n x[0] = a + x[0] | 0;\n x[1] = b + x[1] | 0;\n x[2] = c + x[2] | 0;\n x[3] = d + x[3] | 0;\n }\n function md5blk(s) {\n var md5blks = [],\n i;\n for (i = 0; i < 64; i += 4) {\n md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24);\n }\n return md5blks;\n }\n function md5blk_array(a) {\n var md5blks = [],\n i;\n for (i = 0; i < 64; i += 4) {\n md5blks[i >> 2] = a[i] + (a[i + 1] << 8) + (a[i + 2] << 16) + (a[i + 3] << 24);\n }\n return md5blks;\n }\n function md51(s) {\n var n = s.length,\n state = [1732584193, -271733879, -1732584194, 271733878],\n i,\n length,\n tail,\n tmp,\n lo,\n hi;\n for (i = 64; i <= n; i += 64) {\n md5cycle(state, md5blk(s.substring(i - 64, i)));\n }\n s = s.substring(i - 64);\n length = s.length;\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= s.charCodeAt(i) << (i % 4 << 3);\n }\n tail[i >> 2] |= 128 << (i % 4 << 3);\n if (i > 55) {\n md5cycle(state, tail);\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\n }\n tmp = n * 8;\n tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);\n lo = parseInt(tmp[2], 16);\n hi = parseInt(tmp[1], 16) || 0;\n tail[14] = lo;\n tail[15] = hi;\n md5cycle(state, tail);\n return state;\n }\n function md51_array(a) {\n var n = a.length,\n state = [1732584193, -271733879, -1732584194, 271733878],\n i,\n length,\n tail,\n tmp,\n lo,\n hi;\n for (i = 64; i <= n; i += 64) {\n md5cycle(state, md5blk_array(a.subarray(i - 64, i)));\n }\n a = i - 64 < n ? a.subarray(i - 64) : new Uint8Array(0);\n length = a.length;\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= a[i] << (i % 4 << 3);\n }\n tail[i >> 2] |= 128 << (i % 4 << 3);\n if (i > 55) {\n md5cycle(state, tail);\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\n }\n tmp = n * 8;\n tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);\n lo = parseInt(tmp[2], 16);\n hi = parseInt(tmp[1], 16) || 0;\n tail[14] = lo;\n tail[15] = hi;\n md5cycle(state, tail);\n return state;\n }\n function rhex(n) {\n var s = \"\",\n j;\n for (j = 0; j < 4; j += 1) {\n s += hex_chr[n >> j * 8 + 4 & 15] + hex_chr[n >> j * 8 & 15];\n }\n return s;\n }\n function hex(x) {\n var i;\n for (i = 0; i < x.length; i += 1) {\n x[i] = rhex(x[i]);\n }\n return x.join(\"\");\n }\n if (hex(md51(\"hello\")) !== \"5d41402abc4b2a76b9719d911017c592\") ;\n if (typeof ArrayBuffer !== \"undefined\" && !ArrayBuffer.prototype.slice) {\n (function () {\n function clamp(val, length) {\n val = val | 0 || 0;\n if (val < 0) {\n return Math.max(val + length, 0);\n }\n return Math.min(val, length);\n }\n ArrayBuffer.prototype.slice = function (from, to) {\n var length = this.byteLength,\n begin = clamp(from, length),\n end = length,\n num,\n target,\n targetArray,\n sourceArray;\n if (to !== undefined$1) {\n end = clamp(to, length);\n }\n if (begin > end) {\n return new ArrayBuffer(0);\n }\n num = end - begin;\n target = new ArrayBuffer(num);\n targetArray = new Uint8Array(target);\n sourceArray = new Uint8Array(this, begin, num);\n targetArray.set(sourceArray);\n return target;\n };\n })();\n }\n function toUtf8(str) {\n if (/[\\u0080-\\uFFFF]/.test(str)) {\n str = unescape(encodeURIComponent(str));\n }\n return str;\n }\n function utf8Str2ArrayBuffer(str, returnUInt8Array) {\n var length = str.length,\n buff = new ArrayBuffer(length),\n arr = new Uint8Array(buff),\n i;\n for (i = 0; i < length; i += 1) {\n arr[i] = str.charCodeAt(i);\n }\n return returnUInt8Array ? arr : buff;\n }\n function arrayBuffer2Utf8Str(buff) {\n return String.fromCharCode.apply(null, new Uint8Array(buff));\n }\n function concatenateArrayBuffers(first, second, returnUInt8Array) {\n var result = new Uint8Array(first.byteLength + second.byteLength);\n result.set(new Uint8Array(first));\n result.set(new Uint8Array(second), first.byteLength);\n return returnUInt8Array ? result : result.buffer;\n }\n function hexToBinaryString(hex) {\n var bytes = [],\n length = hex.length,\n x;\n for (x = 0; x < length - 1; x += 2) {\n bytes.push(parseInt(hex.substr(x, 2), 16));\n }\n return String.fromCharCode.apply(String, bytes);\n }\n function SparkMD5() {\n this.reset();\n }\n SparkMD5.prototype.append = function (str) {\n this.appendBinary(toUtf8(str));\n return this;\n };\n SparkMD5.prototype.appendBinary = function (contents) {\n this._buff += contents;\n this._length += contents.length;\n var length = this._buff.length,\n i;\n for (i = 64; i <= length; i += 64) {\n md5cycle(this._hash, md5blk(this._buff.substring(i - 64, i)));\n }\n this._buff = this._buff.substring(i - 64);\n return this;\n };\n SparkMD5.prototype.end = function (raw) {\n var buff = this._buff,\n length = buff.length,\n i,\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n ret;\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= buff.charCodeAt(i) << (i % 4 << 3);\n }\n this._finish(tail, length);\n ret = hex(this._hash);\n if (raw) {\n ret = hexToBinaryString(ret);\n }\n this.reset();\n return ret;\n };\n SparkMD5.prototype.reset = function () {\n this._buff = \"\";\n this._length = 0;\n this._hash = [1732584193, -271733879, -1732584194, 271733878];\n return this;\n };\n SparkMD5.prototype.getState = function () {\n return {\n buff: this._buff,\n length: this._length,\n hash: this._hash.slice()\n };\n };\n SparkMD5.prototype.setState = function (state) {\n this._buff = state.buff;\n this._length = state.length;\n this._hash = state.hash;\n return this;\n };\n SparkMD5.prototype.destroy = function () {\n delete this._hash;\n delete this._buff;\n delete this._length;\n };\n SparkMD5.prototype._finish = function (tail, length) {\n var i = length,\n tmp,\n lo,\n hi;\n tail[i >> 2] |= 128 << (i % 4 << 3);\n if (i > 55) {\n md5cycle(this._hash, tail);\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\n }\n tmp = this._length * 8;\n tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);\n lo = parseInt(tmp[2], 16);\n hi = parseInt(tmp[1], 16) || 0;\n tail[14] = lo;\n tail[15] = hi;\n md5cycle(this._hash, tail);\n };\n SparkMD5.hash = function (str, raw) {\n return SparkMD5.hashBinary(toUtf8(str), raw);\n };\n SparkMD5.hashBinary = function (content, raw) {\n var hash = md51(content),\n ret = hex(hash);\n return raw ? hexToBinaryString(ret) : ret;\n };\n SparkMD5.ArrayBuffer = function () {\n this.reset();\n };\n SparkMD5.ArrayBuffer.prototype.append = function (arr) {\n var buff = concatenateArrayBuffers(this._buff.buffer, arr, true),\n length = buff.length,\n i;\n this._length += arr.byteLength;\n for (i = 64; i <= length; i += 64) {\n md5cycle(this._hash, md5blk_array(buff.subarray(i - 64, i)));\n }\n this._buff = i - 64 < length ? new Uint8Array(buff.buffer.slice(i - 64)) : new Uint8Array(0);\n return this;\n };\n SparkMD5.ArrayBuffer.prototype.end = function (raw) {\n var buff = this._buff,\n length = buff.length,\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n i,\n ret;\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= buff[i] << (i % 4 << 3);\n }\n this._finish(tail, length);\n ret = hex(this._hash);\n if (raw) {\n ret = hexToBinaryString(ret);\n }\n this.reset();\n return ret;\n };\n SparkMD5.ArrayBuffer.prototype.reset = function () {\n this._buff = new Uint8Array(0);\n this._length = 0;\n this._hash = [1732584193, -271733879, -1732584194, 271733878];\n return this;\n };\n SparkMD5.ArrayBuffer.prototype.getState = function () {\n var state = SparkMD5.prototype.getState.call(this);\n state.buff = arrayBuffer2Utf8Str(state.buff);\n return state;\n };\n SparkMD5.ArrayBuffer.prototype.setState = function (state) {\n state.buff = utf8Str2ArrayBuffer(state.buff, true);\n return SparkMD5.prototype.setState.call(this, state);\n };\n SparkMD5.ArrayBuffer.prototype.destroy = SparkMD5.prototype.destroy;\n SparkMD5.ArrayBuffer.prototype._finish = SparkMD5.prototype._finish;\n SparkMD5.ArrayBuffer.hash = function (arr, raw) {\n var hash = md51_array(new Uint8Array(arr)),\n ret = hex(hash);\n return raw ? hexToBinaryString(ret) : ret;\n };\n return SparkMD5;\n });\n})(sparkMd5);\nvar SparkMD5 = sparkMd5.exports;\nconst fileSlice = File.prototype.slice || File.prototype.mozSlice || File.prototype.webkitSlice;\nclass FileChecksum {\n static create(file, callback) {\n const instance = new FileChecksum(file);\n instance.create(callback);\n }\n constructor(file) {\n this.file = file;\n this.chunkSize = 2097152;\n this.chunkCount = Math.ceil(this.file.size / this.chunkSize);\n this.chunkIndex = 0;\n }\n create(callback) {\n this.callback = callback;\n this.md5Buffer = new SparkMD5.ArrayBuffer();\n this.fileReader = new FileReader();\n this.fileReader.addEventListener(\"load\", event => this.fileReaderDidLoad(event));\n this.fileReader.addEventListener(\"error\", event => this.fileReaderDidError(event));\n this.readNextChunk();\n }\n fileReaderDidLoad(event) {\n this.md5Buffer.append(event.target.result);\n if (!this.readNextChunk()) {\n const binaryDigest = this.md5Buffer.end(true);\n const base64digest = btoa(binaryDigest);\n this.callback(null, base64digest);\n }\n }\n fileReaderDidError(event) {\n this.callback(`Error reading ${this.file.name}`);\n }\n readNextChunk() {\n if (this.chunkIndex < this.chunkCount || this.chunkIndex == 0 && this.chunkCount == 0) {\n const start = this.chunkIndex * this.chunkSize;\n const end = Math.min(start + this.chunkSize, this.file.size);\n const bytes = fileSlice.call(this.file, start, end);\n this.fileReader.readAsArrayBuffer(bytes);\n this.chunkIndex++;\n return true;\n } else {\n return false;\n }\n }\n}\nfunction getMetaValue(name) {\n const element = findElement(document.head, `meta[name=\"${name}\"]`);\n if (element) {\n return element.getAttribute(\"content\");\n }\n}\nfunction findElements(root, selector) {\n if (typeof root == \"string\") {\n selector = root;\n root = document;\n }\n const elements = root.querySelectorAll(selector);\n return toArray(elements);\n}\nfunction findElement(root, selector) {\n if (typeof root == \"string\") {\n selector = root;\n root = document;\n }\n return root.querySelector(selector);\n}\nfunction dispatchEvent(element, type) {\n let eventInit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n const disabled = element.disabled;\n const bubbles = eventInit.bubbles,\n cancelable = eventInit.cancelable,\n detail = eventInit.detail;\n const event = document.createEvent(\"Event\");\n event.initEvent(type, bubbles || true, cancelable || true);\n event.detail = detail || {};\n try {\n element.disabled = false;\n element.dispatchEvent(event);\n } finally {\n element.disabled = disabled;\n }\n return event;\n}\nfunction toArray(value) {\n if (Array.isArray(value)) {\n return value;\n } else if (Array.from) {\n return Array.from(value);\n } else {\n return [].slice.call(value);\n }\n}\nclass BlobRecord {\n constructor(file, checksum, url) {\n this.file = file;\n this.attributes = {\n filename: file.name,\n content_type: file.type || \"application/octet-stream\",\n byte_size: file.size,\n checksum: checksum\n };\n this.xhr = new XMLHttpRequest();\n this.xhr.open(\"POST\", url, true);\n this.xhr.responseType = \"json\";\n this.xhr.setRequestHeader(\"Content-Type\", \"application/json\");\n this.xhr.setRequestHeader(\"Accept\", \"application/json\");\n this.xhr.setRequestHeader(\"X-Requested-With\", \"XMLHttpRequest\");\n const csrfToken = getMetaValue(\"csrf-token\");\n if (csrfToken != undefined) {\n this.xhr.setRequestHeader(\"X-CSRF-Token\", csrfToken);\n }\n this.xhr.addEventListener(\"load\", event => this.requestDidLoad(event));\n this.xhr.addEventListener(\"error\", event => this.requestDidError(event));\n }\n get status() {\n return this.xhr.status;\n }\n get response() {\n const _this$xhr = this.xhr,\n responseType = _this$xhr.responseType,\n response = _this$xhr.response;\n if (responseType == \"json\") {\n return response;\n } else {\n return JSON.parse(response);\n }\n }\n create(callback) {\n this.callback = callback;\n this.xhr.send(JSON.stringify({\n blob: this.attributes\n }));\n }\n requestDidLoad(event) {\n if (this.status >= 200 && this.status < 300) {\n const response = this.response;\n const direct_upload = response.direct_upload;\n delete response.direct_upload;\n this.attributes = response;\n this.directUploadData = direct_upload;\n this.callback(null, this.toJSON());\n } else {\n this.requestDidError(event);\n }\n }\n requestDidError(event) {\n this.callback(`Error creating Blob for \"${this.file.name}\". Status: ${this.status}`);\n }\n toJSON() {\n const result = {};\n for (const key in this.attributes) {\n result[key] = this.attributes[key];\n }\n return result;\n }\n}\nclass BlobUpload {\n constructor(blob) {\n this.blob = blob;\n this.file = blob.file;\n const _blob$directUploadDat = blob.directUploadData,\n url = _blob$directUploadDat.url,\n headers = _blob$directUploadDat.headers;\n this.xhr = new XMLHttpRequest();\n this.xhr.open(\"PUT\", url, true);\n this.xhr.responseType = \"text\";\n for (const key in headers) {\n this.xhr.setRequestHeader(key, headers[key]);\n }\n this.xhr.addEventListener(\"load\", event => this.requestDidLoad(event));\n this.xhr.addEventListener(\"error\", event => this.requestDidError(event));\n }\n create(callback) {\n this.callback = callback;\n this.xhr.send(this.file.slice());\n }\n requestDidLoad(event) {\n const _this$xhr2 = this.xhr,\n status = _this$xhr2.status,\n response = _this$xhr2.response;\n if (status >= 200 && status < 300) {\n this.callback(null, response);\n } else {\n this.requestDidError(event);\n }\n }\n requestDidError(event) {\n this.callback(`Error storing \"${this.file.name}\". Status: ${this.xhr.status}`);\n }\n}\nlet id = 0;\nclass DirectUpload {\n constructor(file, url, delegate) {\n this.id = ++id;\n this.file = file;\n this.url = url;\n this.delegate = delegate;\n }\n create(callback) {\n FileChecksum.create(this.file, (error, checksum) => {\n if (error) {\n callback(error);\n return;\n }\n const blob = new BlobRecord(this.file, checksum, this.url);\n notify(this.delegate, \"directUploadWillCreateBlobWithXHR\", blob.xhr);\n blob.create(error => {\n if (error) {\n callback(error);\n } else {\n const upload = new BlobUpload(blob);\n notify(this.delegate, \"directUploadWillStoreFileWithXHR\", upload.xhr);\n upload.create(error => {\n if (error) {\n callback(error);\n } else {\n callback(null, blob.toJSON());\n }\n });\n }\n });\n });\n }\n}\nfunction notify(object, methodName) {\n if (object && typeof object[methodName] == \"function\") {\n for (var _len = arguments.length, messages = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n messages[_key - 2] = arguments[_key];\n }\n return object[methodName](...messages);\n }\n}\nclass DirectUploadController {\n constructor(input, file) {\n this.input = input;\n this.file = file;\n this.directUpload = new DirectUpload(this.file, this.url, this);\n this.dispatch(\"initialize\");\n }\n start(callback) {\n const hiddenInput = document.createElement(\"input\");\n hiddenInput.type = \"hidden\";\n hiddenInput.name = this.input.name;\n this.input.insertAdjacentElement(\"beforebegin\", hiddenInput);\n this.dispatch(\"start\");\n this.directUpload.create((error, attributes) => {\n if (error) {\n hiddenInput.parentNode.removeChild(hiddenInput);\n this.dispatchError(error);\n } else {\n hiddenInput.value = attributes.signed_id;\n }\n this.dispatch(\"end\");\n callback(error);\n });\n }\n uploadRequestDidProgress(event) {\n const progress = event.loaded / event.total * 100;\n if (progress) {\n this.dispatch(\"progress\", {\n progress: progress\n });\n }\n }\n get url() {\n return this.input.getAttribute(\"data-direct-upload-url\");\n }\n dispatch(name) {\n let detail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n detail.file = this.file;\n detail.id = this.directUpload.id;\n return dispatchEvent(this.input, `direct-upload:${name}`, {\n detail: detail\n });\n }\n dispatchError(error) {\n const event = this.dispatch(\"error\", {\n error: error\n });\n if (!event.defaultPrevented) {\n alert(error);\n }\n }\n directUploadWillCreateBlobWithXHR(xhr) {\n this.dispatch(\"before-blob-request\", {\n xhr: xhr\n });\n }\n directUploadWillStoreFileWithXHR(xhr) {\n this.dispatch(\"before-storage-request\", {\n xhr: xhr\n });\n xhr.upload.addEventListener(\"progress\", event => this.uploadRequestDidProgress(event));\n }\n}\nconst inputSelector = \"input[type=file][data-direct-upload-url]:not([disabled])\";\nclass DirectUploadsController {\n constructor(form) {\n this.form = form;\n this.inputs = findElements(form, inputSelector).filter(input => input.files.length);\n }\n start(callback) {\n const controllers = this.createDirectUploadControllers();\n const startNextController = () => {\n const controller = controllers.shift();\n if (controller) {\n controller.start(error => {\n if (error) {\n callback(error);\n this.dispatch(\"end\");\n } else {\n startNextController();\n }\n });\n } else {\n callback();\n this.dispatch(\"end\");\n }\n };\n this.dispatch(\"start\");\n startNextController();\n }\n createDirectUploadControllers() {\n const controllers = [];\n this.inputs.forEach(input => {\n toArray(input.files).forEach(file => {\n const controller = new DirectUploadController(input, file);\n controllers.push(controller);\n });\n });\n return controllers;\n }\n dispatch(name) {\n let detail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return dispatchEvent(this.form, `direct-uploads:${name}`, {\n detail: detail\n });\n }\n}\nconst processingAttribute = \"data-direct-uploads-processing\";\nconst submitButtonsByForm = new WeakMap();\nlet started = false;\nfunction start() {\n if (!started) {\n started = true;\n document.addEventListener(\"click\", didClick, true);\n document.addEventListener(\"submit\", didSubmitForm, true);\n document.addEventListener(\"ajax:before\", didSubmitRemoteElement);\n }\n}\nfunction didClick(event) {\n const target = event.target;\n if ((target.tagName == \"INPUT\" || target.tagName == \"BUTTON\") && target.type == \"submit\" && target.form) {\n submitButtonsByForm.set(target.form, target);\n }\n}\nfunction didSubmitForm(event) {\n handleFormSubmissionEvent(event);\n}\nfunction didSubmitRemoteElement(event) {\n if (event.target.tagName == \"FORM\") {\n handleFormSubmissionEvent(event);\n }\n}\nfunction handleFormSubmissionEvent(event) {\n const form = event.target;\n if (form.hasAttribute(processingAttribute)) {\n event.preventDefault();\n return;\n }\n const controller = new DirectUploadsController(form);\n const inputs = controller.inputs;\n if (inputs.length) {\n event.preventDefault();\n form.setAttribute(processingAttribute, \"\");\n inputs.forEach(disable);\n controller.start(error => {\n form.removeAttribute(processingAttribute);\n if (error) {\n inputs.forEach(enable);\n } else {\n submitForm(form);\n }\n });\n }\n}\nfunction submitForm(form) {\n let button = submitButtonsByForm.get(form) || findElement(form, \"input[type=submit], button[type=submit]\");\n if (button) {\n const _button = button,\n disabled = _button.disabled;\n button.disabled = false;\n button.focus();\n button.click();\n button.disabled = disabled;\n } else {\n button = document.createElement(\"input\");\n button.type = \"submit\";\n button.style.display = \"none\";\n form.appendChild(button);\n button.click();\n form.removeChild(button);\n }\n submitButtonsByForm.delete(form);\n}\nfunction disable(input) {\n input.disabled = true;\n}\nfunction enable(input) {\n input.disabled = false;\n}\nfunction autostart() {\n if (window.ActiveStorage) {\n start();\n }\n}\nsetTimeout(autostart, 1);\nexport { DirectUpload, start };","/*\nUnobtrusive JavaScript\nhttps://github.com/rails/rails/blob/main/actionview/app/assets/javascripts\nReleased under the MIT license\n */;\n(function () {\n var context = this;\n (function () {\n (function () {\n this.Rails = {\n linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]',\n buttonClickSelector: {\n selector: 'button[data-remote]:not([form]), button[data-confirm]:not([form])',\n exclude: 'form button'\n },\n inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]',\n formSubmitSelector: 'form:not([data-turbo=true])',\n formInputClickSelector: 'form:not([data-turbo=true]) input[type=submit], form:not([data-turbo=true]) input[type=image], form:not([data-turbo=true]) button[type=submit], form:not([data-turbo=true]) button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])',\n formDisableSelector: 'input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled',\n formEnableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled',\n fileInputSelector: 'input[name][type=file]:not([disabled])',\n linkDisableSelector: 'a[data-disable-with], a[data-disable]',\n buttonDisableSelector: 'button[data-remote][data-disable-with], button[data-remote][data-disable]'\n };\n }).call(this);\n }).call(context);\n var Rails = context.Rails;\n (function () {\n (function () {\n var nonce;\n nonce = null;\n Rails.loadCSPNonce = function () {\n var ref;\n return nonce = (ref = document.querySelector(\"meta[name=csp-nonce]\")) != null ? ref.content : void 0;\n };\n Rails.cspNonce = function () {\n return nonce != null ? nonce : Rails.loadCSPNonce();\n };\n }).call(this);\n (function () {\n var expando, m;\n m = Element.prototype.matches || Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector;\n Rails.matches = function (element, selector) {\n if (selector.exclude != null) {\n return m.call(element, selector.selector) && !m.call(element, selector.exclude);\n } else {\n return m.call(element, selector);\n }\n };\n expando = '_ujsData';\n Rails.getData = function (element, key) {\n var ref;\n return (ref = element[expando]) != null ? ref[key] : void 0;\n };\n Rails.setData = function (element, key, value) {\n if (element[expando] == null) {\n element[expando] = {};\n }\n return element[expando][key] = value;\n };\n Rails.isContentEditable = function (element) {\n var isEditable;\n isEditable = false;\n while (true) {\n if (element.isContentEditable) {\n isEditable = true;\n break;\n }\n element = element.parentElement;\n if (!element) {\n break;\n }\n }\n return isEditable;\n };\n Rails.$ = function (selector) {\n return Array.prototype.slice.call(document.querySelectorAll(selector));\n };\n }).call(this);\n (function () {\n var $, csrfParam, csrfToken;\n $ = Rails.$;\n csrfToken = Rails.csrfToken = function () {\n var meta;\n meta = document.querySelector('meta[name=csrf-token]');\n return meta && meta.content;\n };\n csrfParam = Rails.csrfParam = function () {\n var meta;\n meta = document.querySelector('meta[name=csrf-param]');\n return meta && meta.content;\n };\n Rails.CSRFProtection = function (xhr) {\n var token;\n token = csrfToken();\n if (token != null) {\n return xhr.setRequestHeader('X-CSRF-Token', token);\n }\n };\n Rails.refreshCSRFTokens = function () {\n var param, token;\n token = csrfToken();\n param = csrfParam();\n if (token != null && param != null) {\n return $('form input[name=\"' + param + '\"]').forEach(function (input) {\n return input.value = token;\n });\n }\n };\n }).call(this);\n (function () {\n var CustomEvent, fire, matches, preventDefault;\n matches = Rails.matches;\n CustomEvent = window.CustomEvent;\n if (typeof CustomEvent !== 'function') {\n CustomEvent = function (event, params) {\n var evt;\n evt = document.createEvent('CustomEvent');\n evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n return evt;\n };\n CustomEvent.prototype = window.Event.prototype;\n preventDefault = CustomEvent.prototype.preventDefault;\n CustomEvent.prototype.preventDefault = function () {\n var result;\n result = preventDefault.call(this);\n if (this.cancelable && !this.defaultPrevented) {\n Object.defineProperty(this, 'defaultPrevented', {\n get: function () {\n return true;\n }\n });\n }\n return result;\n };\n }\n fire = Rails.fire = function (obj, name, data) {\n var event;\n event = new CustomEvent(name, {\n bubbles: true,\n cancelable: true,\n detail: data\n });\n obj.dispatchEvent(event);\n return !event.defaultPrevented;\n };\n Rails.stopEverything = function (e) {\n fire(e.target, 'ujs:everythingStopped');\n e.preventDefault();\n e.stopPropagation();\n return e.stopImmediatePropagation();\n };\n Rails.delegate = function (element, selector, eventType, handler) {\n return element.addEventListener(eventType, function (e) {\n var target;\n target = e.target;\n while (!(!(target instanceof Element) || matches(target, selector))) {\n target = target.parentNode;\n }\n if (target instanceof Element && handler.call(target, e) === false) {\n e.preventDefault();\n return e.stopPropagation();\n }\n });\n };\n }).call(this);\n (function () {\n var AcceptHeaders, CSRFProtection, createXHR, cspNonce, fire, prepareOptions, processResponse;\n cspNonce = Rails.cspNonce, CSRFProtection = Rails.CSRFProtection, fire = Rails.fire;\n AcceptHeaders = {\n '*': '*/*',\n text: 'text/plain',\n html: 'text/html',\n xml: 'application/xml, text/xml',\n json: 'application/json, text/javascript',\n script: 'text/javascript, application/javascript, application/ecmascript, application/x-ecmascript'\n };\n Rails.ajax = function (options) {\n var xhr;\n options = prepareOptions(options);\n xhr = createXHR(options, function () {\n var ref, response;\n response = processResponse((ref = xhr.response) != null ? ref : xhr.responseText, xhr.getResponseHeader('Content-Type'));\n if (Math.floor(xhr.status / 100) === 2) {\n if (typeof options.success === \"function\") {\n options.success(response, xhr.statusText, xhr);\n }\n } else {\n if (typeof options.error === \"function\") {\n options.error(response, xhr.statusText, xhr);\n }\n }\n return typeof options.complete === \"function\" ? options.complete(xhr, xhr.statusText) : void 0;\n });\n if (options.beforeSend != null && !options.beforeSend(xhr, options)) {\n return false;\n }\n if (xhr.readyState === XMLHttpRequest.OPENED) {\n return xhr.send(options.data);\n }\n };\n prepareOptions = function (options) {\n options.url = options.url || location.href;\n options.type = options.type.toUpperCase();\n if (options.type === 'GET' && options.data) {\n if (options.url.indexOf('?') < 0) {\n options.url += '?' + options.data;\n } else {\n options.url += '&' + options.data;\n }\n }\n if (AcceptHeaders[options.dataType] == null) {\n options.dataType = '*';\n }\n options.accept = AcceptHeaders[options.dataType];\n if (options.dataType !== '*') {\n options.accept += ', */*; q=0.01';\n }\n return options;\n };\n createXHR = function (options, done) {\n var xhr;\n xhr = new XMLHttpRequest();\n xhr.open(options.type, options.url, true);\n xhr.setRequestHeader('Accept', options.accept);\n if (typeof options.data === 'string') {\n xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');\n }\n if (!options.crossDomain) {\n xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');\n CSRFProtection(xhr);\n }\n xhr.withCredentials = !!options.withCredentials;\n xhr.onreadystatechange = function () {\n if (xhr.readyState === XMLHttpRequest.DONE) {\n return done(xhr);\n }\n };\n return xhr;\n };\n processResponse = function (response, type) {\n var parser, script;\n if (typeof response === 'string' && typeof type === 'string') {\n if (type.match(/\\bjson\\b/)) {\n try {\n response = JSON.parse(response);\n } catch (error) {}\n } else if (type.match(/\\b(?:java|ecma)script\\b/)) {\n script = document.createElement('script');\n script.setAttribute('nonce', cspNonce());\n script.text = response;\n document.head.appendChild(script).parentNode.removeChild(script);\n } else if (type.match(/\\b(xml|html|svg)\\b/)) {\n parser = new DOMParser();\n type = type.replace(/;.+/, '');\n try {\n response = parser.parseFromString(response, type);\n } catch (error) {}\n }\n }\n return response;\n };\n Rails.href = function (element) {\n return element.href;\n };\n Rails.isCrossDomain = function (url) {\n var e, originAnchor, urlAnchor;\n originAnchor = document.createElement('a');\n originAnchor.href = location.href;\n urlAnchor = document.createElement('a');\n try {\n urlAnchor.href = url;\n return !((!urlAnchor.protocol || urlAnchor.protocol === ':') && !urlAnchor.host || originAnchor.protocol + '//' + originAnchor.host === urlAnchor.protocol + '//' + urlAnchor.host);\n } catch (error) {\n e = error;\n return true;\n }\n };\n }).call(this);\n (function () {\n var matches, toArray;\n matches = Rails.matches;\n toArray = function (e) {\n return Array.prototype.slice.call(e);\n };\n Rails.serializeElement = function (element, additionalParam) {\n var inputs, params;\n inputs = [element];\n if (matches(element, 'form')) {\n inputs = toArray(element.elements);\n }\n params = [];\n inputs.forEach(function (input) {\n if (!input.name || input.disabled) {\n return;\n }\n if (matches(input, 'fieldset[disabled] *')) {\n return;\n }\n if (matches(input, 'select')) {\n return toArray(input.options).forEach(function (option) {\n if (option.selected) {\n return params.push({\n name: input.name,\n value: option.value\n });\n }\n });\n } else if (input.checked || ['radio', 'checkbox', 'submit'].indexOf(input.type) === -1) {\n return params.push({\n name: input.name,\n value: input.value\n });\n }\n });\n if (additionalParam) {\n params.push(additionalParam);\n }\n return params.map(function (param) {\n if (param.name != null) {\n return encodeURIComponent(param.name) + \"=\" + encodeURIComponent(param.value);\n } else {\n return param;\n }\n }).join('&');\n };\n Rails.formElements = function (form, selector) {\n if (matches(form, 'form')) {\n return toArray(form.elements).filter(function (el) {\n return matches(el, selector);\n });\n } else {\n return toArray(form.querySelectorAll(selector));\n }\n };\n }).call(this);\n (function () {\n var allowAction, fire, stopEverything;\n fire = Rails.fire, stopEverything = Rails.stopEverything;\n Rails.handleConfirm = function (e) {\n if (!allowAction(this)) {\n return stopEverything(e);\n }\n };\n Rails.confirm = function (message, element) {\n return confirm(message);\n };\n allowAction = function (element) {\n var answer, callback, message;\n message = element.getAttribute('data-confirm');\n if (!message) {\n return true;\n }\n answer = false;\n if (fire(element, 'confirm')) {\n try {\n answer = Rails.confirm(message, element);\n } catch (error) {}\n callback = fire(element, 'confirm:complete', [answer]);\n }\n return answer && callback;\n };\n }).call(this);\n (function () {\n var disableFormElement, disableFormElements, disableLinkElement, enableFormElement, enableFormElements, enableLinkElement, formElements, getData, isContentEditable, isXhrRedirect, matches, setData, stopEverything;\n matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, stopEverything = Rails.stopEverything, formElements = Rails.formElements, isContentEditable = Rails.isContentEditable;\n Rails.handleDisabledElement = function (e) {\n var element;\n element = this;\n if (element.disabled) {\n return stopEverything(e);\n }\n };\n Rails.enableElement = function (e) {\n var element;\n if (e instanceof Event) {\n if (isXhrRedirect(e)) {\n return;\n }\n element = e.target;\n } else {\n element = e;\n }\n if (isContentEditable(element)) {\n return;\n }\n if (matches(element, Rails.linkDisableSelector)) {\n return enableLinkElement(element);\n } else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formEnableSelector)) {\n return enableFormElement(element);\n } else if (matches(element, Rails.formSubmitSelector)) {\n return enableFormElements(element);\n }\n };\n Rails.disableElement = function (e) {\n var element;\n element = e instanceof Event ? e.target : e;\n if (isContentEditable(element)) {\n return;\n }\n if (matches(element, Rails.linkDisableSelector)) {\n return disableLinkElement(element);\n } else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formDisableSelector)) {\n return disableFormElement(element);\n } else if (matches(element, Rails.formSubmitSelector)) {\n return disableFormElements(element);\n }\n };\n disableLinkElement = function (element) {\n var replacement;\n if (getData(element, 'ujs:disabled')) {\n return;\n }\n replacement = element.getAttribute('data-disable-with');\n if (replacement != null) {\n setData(element, 'ujs:enable-with', element.innerHTML);\n element.innerHTML = replacement;\n }\n element.addEventListener('click', stopEverything);\n return setData(element, 'ujs:disabled', true);\n };\n enableLinkElement = function (element) {\n var originalText;\n originalText = getData(element, 'ujs:enable-with');\n if (originalText != null) {\n element.innerHTML = originalText;\n setData(element, 'ujs:enable-with', null);\n }\n element.removeEventListener('click', stopEverything);\n return setData(element, 'ujs:disabled', null);\n };\n disableFormElements = function (form) {\n return formElements(form, Rails.formDisableSelector).forEach(disableFormElement);\n };\n disableFormElement = function (element) {\n var replacement;\n if (getData(element, 'ujs:disabled')) {\n return;\n }\n replacement = element.getAttribute('data-disable-with');\n if (replacement != null) {\n if (matches(element, 'button')) {\n setData(element, 'ujs:enable-with', element.innerHTML);\n element.innerHTML = replacement;\n } else {\n setData(element, 'ujs:enable-with', element.value);\n element.value = replacement;\n }\n }\n element.disabled = true;\n return setData(element, 'ujs:disabled', true);\n };\n enableFormElements = function (form) {\n return formElements(form, Rails.formEnableSelector).forEach(enableFormElement);\n };\n enableFormElement = function (element) {\n var originalText;\n originalText = getData(element, 'ujs:enable-with');\n if (originalText != null) {\n if (matches(element, 'button')) {\n element.innerHTML = originalText;\n } else {\n element.value = originalText;\n }\n setData(element, 'ujs:enable-with', null);\n }\n element.disabled = false;\n return setData(element, 'ujs:disabled', null);\n };\n isXhrRedirect = function (event) {\n var ref, xhr;\n xhr = (ref = event.detail) != null ? ref[0] : void 0;\n return (xhr != null ? xhr.getResponseHeader(\"X-Xhr-Redirect\") : void 0) != null;\n };\n }).call(this);\n (function () {\n var isContentEditable, stopEverything;\n stopEverything = Rails.stopEverything;\n isContentEditable = Rails.isContentEditable;\n Rails.handleMethod = function (e) {\n var csrfParam, csrfToken, form, formContent, href, link, method;\n link = this;\n method = link.getAttribute('data-method');\n if (!method) {\n return;\n }\n if (isContentEditable(this)) {\n return;\n }\n href = Rails.href(link);\n csrfToken = Rails.csrfToken();\n csrfParam = Rails.csrfParam();\n form = document.createElement('form');\n formContent = \" \";\n if (csrfParam != null && csrfToken != null && !Rails.isCrossDomain(href)) {\n formContent += \" \";\n }\n formContent += ' ';\n form.method = 'post';\n form.action = href;\n form.target = link.target;\n form.innerHTML = formContent;\n form.style.display = 'none';\n document.body.appendChild(form);\n form.querySelector('[type=\"submit\"]').click();\n return stopEverything(e);\n };\n }).call(this);\n (function () {\n var ajax,\n fire,\n getData,\n isContentEditable,\n isCrossDomain,\n isRemote,\n matches,\n serializeElement,\n setData,\n stopEverything,\n slice = [].slice;\n matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, fire = Rails.fire, stopEverything = Rails.stopEverything, ajax = Rails.ajax, isCrossDomain = Rails.isCrossDomain, serializeElement = Rails.serializeElement, isContentEditable = Rails.isContentEditable;\n isRemote = function (element) {\n var value;\n value = element.getAttribute('data-remote');\n return value != null && value !== 'false';\n };\n Rails.handleRemote = function (e) {\n var button, data, dataType, element, method, url, withCredentials;\n element = this;\n if (!isRemote(element)) {\n return true;\n }\n if (!fire(element, 'ajax:before')) {\n fire(element, 'ajax:stopped');\n return false;\n }\n if (isContentEditable(element)) {\n fire(element, 'ajax:stopped');\n return false;\n }\n withCredentials = element.getAttribute('data-with-credentials');\n dataType = element.getAttribute('data-type') || 'script';\n if (matches(element, Rails.formSubmitSelector)) {\n button = getData(element, 'ujs:submit-button');\n method = getData(element, 'ujs:submit-button-formmethod') || element.method;\n url = getData(element, 'ujs:submit-button-formaction') || element.getAttribute('action') || location.href;\n if (method.toUpperCase() === 'GET') {\n url = url.replace(/\\?.*$/, '');\n }\n if (element.enctype === 'multipart/form-data') {\n data = new FormData(element);\n if (button != null) {\n data.append(button.name, button.value);\n }\n } else {\n data = serializeElement(element, button);\n }\n setData(element, 'ujs:submit-button', null);\n setData(element, 'ujs:submit-button-formmethod', null);\n setData(element, 'ujs:submit-button-formaction', null);\n } else if (matches(element, Rails.buttonClickSelector) || matches(element, Rails.inputChangeSelector)) {\n method = element.getAttribute('data-method');\n url = element.getAttribute('data-url');\n data = serializeElement(element, element.getAttribute('data-params'));\n } else {\n method = element.getAttribute('data-method');\n url = Rails.href(element);\n data = element.getAttribute('data-params');\n }\n ajax({\n type: method || 'GET',\n url: url,\n data: data,\n dataType: dataType,\n beforeSend: function (xhr, options) {\n if (fire(element, 'ajax:beforeSend', [xhr, options])) {\n return fire(element, 'ajax:send', [xhr]);\n } else {\n fire(element, 'ajax:stopped');\n return false;\n }\n },\n success: function () {\n var args;\n args = 1 <= arguments.length ? slice.call(arguments, 0) : [];\n return fire(element, 'ajax:success', args);\n },\n error: function () {\n var args;\n args = 1 <= arguments.length ? slice.call(arguments, 0) : [];\n return fire(element, 'ajax:error', args);\n },\n complete: function () {\n var args;\n args = 1 <= arguments.length ? slice.call(arguments, 0) : [];\n return fire(element, 'ajax:complete', args);\n },\n crossDomain: isCrossDomain(url),\n withCredentials: withCredentials != null && withCredentials !== 'false'\n });\n return stopEverything(e);\n };\n Rails.formSubmitButtonClick = function (e) {\n var button, form;\n button = this;\n form = button.form;\n if (!form) {\n return;\n }\n if (button.name) {\n setData(form, 'ujs:submit-button', {\n name: button.name,\n value: button.value\n });\n }\n setData(form, 'ujs:formnovalidate-button', button.formNoValidate);\n setData(form, 'ujs:submit-button-formaction', button.getAttribute('formaction'));\n return setData(form, 'ujs:submit-button-formmethod', button.getAttribute('formmethod'));\n };\n Rails.preventInsignificantClick = function (e) {\n var data, insignificantMetaClick, link, metaClick, method, nonPrimaryMouseClick;\n link = this;\n method = (link.getAttribute('data-method') || 'GET').toUpperCase();\n data = link.getAttribute('data-params');\n metaClick = e.metaKey || e.ctrlKey;\n insignificantMetaClick = metaClick && method === 'GET' && !data;\n nonPrimaryMouseClick = e.button != null && e.button !== 0;\n if (nonPrimaryMouseClick || insignificantMetaClick) {\n return e.stopImmediatePropagation();\n }\n };\n }).call(this);\n (function () {\n var $, CSRFProtection, delegate, disableElement, enableElement, fire, formSubmitButtonClick, getData, handleConfirm, handleDisabledElement, handleMethod, handleRemote, loadCSPNonce, preventInsignificantClick, refreshCSRFTokens;\n fire = Rails.fire, delegate = Rails.delegate, getData = Rails.getData, $ = Rails.$, refreshCSRFTokens = Rails.refreshCSRFTokens, CSRFProtection = Rails.CSRFProtection, loadCSPNonce = Rails.loadCSPNonce, enableElement = Rails.enableElement, disableElement = Rails.disableElement, handleDisabledElement = Rails.handleDisabledElement, handleConfirm = Rails.handleConfirm, preventInsignificantClick = Rails.preventInsignificantClick, handleRemote = Rails.handleRemote, formSubmitButtonClick = Rails.formSubmitButtonClick, handleMethod = Rails.handleMethod;\n if (typeof jQuery !== \"undefined\" && jQuery !== null && jQuery.ajax != null) {\n if (jQuery.rails) {\n throw new Error('If you load both jquery_ujs and rails-ujs, use rails-ujs only.');\n }\n jQuery.rails = Rails;\n jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {\n if (!options.crossDomain) {\n return CSRFProtection(xhr);\n }\n });\n }\n Rails.start = function () {\n if (window._rails_loaded) {\n throw new Error('rails-ujs has already been loaded!');\n }\n window.addEventListener('pageshow', function () {\n $(Rails.formEnableSelector).forEach(function (el) {\n if (getData(el, 'ujs:disabled')) {\n return enableElement(el);\n }\n });\n return $(Rails.linkDisableSelector).forEach(function (el) {\n if (getData(el, 'ujs:disabled')) {\n return enableElement(el);\n }\n });\n });\n delegate(document, Rails.linkDisableSelector, 'ajax:complete', enableElement);\n delegate(document, Rails.linkDisableSelector, 'ajax:stopped', enableElement);\n delegate(document, Rails.buttonDisableSelector, 'ajax:complete', enableElement);\n delegate(document, Rails.buttonDisableSelector, 'ajax:stopped', enableElement);\n delegate(document, Rails.linkClickSelector, 'click', preventInsignificantClick);\n delegate(document, Rails.linkClickSelector, 'click', handleDisabledElement);\n delegate(document, Rails.linkClickSelector, 'click', handleConfirm);\n delegate(document, Rails.linkClickSelector, 'click', disableElement);\n delegate(document, Rails.linkClickSelector, 'click', handleRemote);\n delegate(document, Rails.linkClickSelector, 'click', handleMethod);\n delegate(document, Rails.buttonClickSelector, 'click', preventInsignificantClick);\n delegate(document, Rails.buttonClickSelector, 'click', handleDisabledElement);\n delegate(document, Rails.buttonClickSelector, 'click', handleConfirm);\n delegate(document, Rails.buttonClickSelector, 'click', disableElement);\n delegate(document, Rails.buttonClickSelector, 'click', handleRemote);\n delegate(document, Rails.inputChangeSelector, 'change', handleDisabledElement);\n delegate(document, Rails.inputChangeSelector, 'change', handleConfirm);\n delegate(document, Rails.inputChangeSelector, 'change', handleRemote);\n delegate(document, Rails.formSubmitSelector, 'submit', handleDisabledElement);\n delegate(document, Rails.formSubmitSelector, 'submit', handleConfirm);\n delegate(document, Rails.formSubmitSelector, 'submit', handleRemote);\n delegate(document, Rails.formSubmitSelector, 'submit', function (e) {\n return setTimeout(function () {\n return disableElement(e);\n }, 13);\n });\n delegate(document, Rails.formSubmitSelector, 'ajax:send', disableElement);\n delegate(document, Rails.formSubmitSelector, 'ajax:complete', enableElement);\n delegate(document, Rails.formInputClickSelector, 'click', preventInsignificantClick);\n delegate(document, Rails.formInputClickSelector, 'click', handleDisabledElement);\n delegate(document, Rails.formInputClickSelector, 'click', handleConfirm);\n delegate(document, Rails.formInputClickSelector, 'click', formSubmitButtonClick);\n document.addEventListener('DOMContentLoaded', refreshCSRFTokens);\n document.addEventListener('DOMContentLoaded', loadCSPNonce);\n return window._rails_loaded = true;\n };\n if (window.Rails === Rails && fire(document, 'rails:attachBindings')) {\n Rails.start();\n }\n }).call(this);\n }).call(this);\n if (typeof module === \"object\" && module.exports) {\n module.exports = Rails;\n } else if (typeof define === \"function\" && define.amd) {\n define(Rails);\n }\n}).call(this);","'use strict';\n\nvar firebase = require('@firebase/app');\nrequire('@firebase/auth');\nrequire('@firebase/database');\nrequire('@firebase/firestore');\nrequire('@firebase/functions');\nrequire('@firebase/messaging');\nrequire('@firebase/storage');\nrequire('@firebase/performance');\nrequire('@firebase/analytics');\nrequire('@firebase/remote-config');\nfunction _interopDefaultLegacy(e) {\n return e && typeof e === 'object' && 'default' in e ? e : {\n 'default': e\n };\n}\nvar firebase__default = /*#__PURE__*/_interopDefaultLegacy(firebase);\nvar name = \"firebase\";\nvar version = \"7.24.0\";\n\n/**\r\n * @license\r\n * Copyright 2018 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nfirebase__default['default'].registerVersion(name, version, 'app');\nvar name$1 = \"firebase\";\nvar version$1 = \"7.24.0\";\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nconsole.warn(\"\\nIt looks like you're using the development build of the Firebase JS SDK.\\nWhen deploying Firebase apps to production, it is advisable to only import\\nthe individual SDK components you intend to use.\\n\\nFor the module builds, these are available in the following manner\\n(replace with the name of a component - i.e. auth, database, etc):\\n\\nCommonJS Modules:\\nconst firebase = require('firebase/app');\\nrequire('firebase/');\\n\\nES Modules:\\nimport firebase from 'firebase/app';\\nimport 'firebase/';\\n\\nTypescript:\\nimport * as firebase from 'firebase/app';\\nimport 'firebase/';\\n\");\nfirebase__default['default'].registerVersion(name$1, version$1);\nmodule.exports = firebase__default['default'];","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = global || self, factory(global.idb = {}));\n})(this, function (exports) {\n 'use strict';\n\n function toArray(arr) {\n return Array.prototype.slice.call(arr);\n }\n function promisifyRequest(request) {\n return new Promise(function (resolve, reject) {\n request.onsuccess = function () {\n resolve(request.result);\n };\n request.onerror = function () {\n reject(request.error);\n };\n });\n }\n function promisifyRequestCall(obj, method, args) {\n var request;\n var p = new Promise(function (resolve, reject) {\n request = obj[method].apply(obj, args);\n promisifyRequest(request).then(resolve, reject);\n });\n p.request = request;\n return p;\n }\n function promisifyCursorRequestCall(obj, method, args) {\n var p = promisifyRequestCall(obj, method, args);\n return p.then(function (value) {\n if (!value) return;\n return new Cursor(value, p.request);\n });\n }\n function proxyProperties(ProxyClass, targetProp, properties) {\n properties.forEach(function (prop) {\n Object.defineProperty(ProxyClass.prototype, prop, {\n get: function () {\n return this[targetProp][prop];\n },\n set: function (val) {\n this[targetProp][prop] = val;\n }\n });\n });\n }\n function proxyRequestMethods(ProxyClass, targetProp, Constructor, properties) {\n properties.forEach(function (prop) {\n if (!(prop in Constructor.prototype)) return;\n ProxyClass.prototype[prop] = function () {\n return promisifyRequestCall(this[targetProp], prop, arguments);\n };\n });\n }\n function proxyMethods(ProxyClass, targetProp, Constructor, properties) {\n properties.forEach(function (prop) {\n if (!(prop in Constructor.prototype)) return;\n ProxyClass.prototype[prop] = function () {\n return this[targetProp][prop].apply(this[targetProp], arguments);\n };\n });\n }\n function proxyCursorRequestMethods(ProxyClass, targetProp, Constructor, properties) {\n properties.forEach(function (prop) {\n if (!(prop in Constructor.prototype)) return;\n ProxyClass.prototype[prop] = function () {\n return promisifyCursorRequestCall(this[targetProp], prop, arguments);\n };\n });\n }\n function Index(index) {\n this._index = index;\n }\n proxyProperties(Index, '_index', ['name', 'keyPath', 'multiEntry', 'unique']);\n proxyRequestMethods(Index, '_index', IDBIndex, ['get', 'getKey', 'getAll', 'getAllKeys', 'count']);\n proxyCursorRequestMethods(Index, '_index', IDBIndex, ['openCursor', 'openKeyCursor']);\n function Cursor(cursor, request) {\n this._cursor = cursor;\n this._request = request;\n }\n proxyProperties(Cursor, '_cursor', ['direction', 'key', 'primaryKey', 'value']);\n proxyRequestMethods(Cursor, '_cursor', IDBCursor, ['update', 'delete']);\n\n // proxy 'next' methods\n ['advance', 'continue', 'continuePrimaryKey'].forEach(function (methodName) {\n if (!(methodName in IDBCursor.prototype)) return;\n Cursor.prototype[methodName] = function () {\n var cursor = this;\n var args = arguments;\n return Promise.resolve().then(function () {\n cursor._cursor[methodName].apply(cursor._cursor, args);\n return promisifyRequest(cursor._request).then(function (value) {\n if (!value) return;\n return new Cursor(value, cursor._request);\n });\n });\n };\n });\n function ObjectStore(store) {\n this._store = store;\n }\n ObjectStore.prototype.createIndex = function () {\n return new Index(this._store.createIndex.apply(this._store, arguments));\n };\n ObjectStore.prototype.index = function () {\n return new Index(this._store.index.apply(this._store, arguments));\n };\n proxyProperties(ObjectStore, '_store', ['name', 'keyPath', 'indexNames', 'autoIncrement']);\n proxyRequestMethods(ObjectStore, '_store', IDBObjectStore, ['put', 'add', 'delete', 'clear', 'get', 'getAll', 'getKey', 'getAllKeys', 'count']);\n proxyCursorRequestMethods(ObjectStore, '_store', IDBObjectStore, ['openCursor', 'openKeyCursor']);\n proxyMethods(ObjectStore, '_store', IDBObjectStore, ['deleteIndex']);\n function Transaction(idbTransaction) {\n this._tx = idbTransaction;\n this.complete = new Promise(function (resolve, reject) {\n idbTransaction.oncomplete = function () {\n resolve();\n };\n idbTransaction.onerror = function () {\n reject(idbTransaction.error);\n };\n idbTransaction.onabort = function () {\n reject(idbTransaction.error);\n };\n });\n }\n Transaction.prototype.objectStore = function () {\n return new ObjectStore(this._tx.objectStore.apply(this._tx, arguments));\n };\n proxyProperties(Transaction, '_tx', ['objectStoreNames', 'mode']);\n proxyMethods(Transaction, '_tx', IDBTransaction, ['abort']);\n function UpgradeDB(db, oldVersion, transaction) {\n this._db = db;\n this.oldVersion = oldVersion;\n this.transaction = new Transaction(transaction);\n }\n UpgradeDB.prototype.createObjectStore = function () {\n return new ObjectStore(this._db.createObjectStore.apply(this._db, arguments));\n };\n proxyProperties(UpgradeDB, '_db', ['name', 'version', 'objectStoreNames']);\n proxyMethods(UpgradeDB, '_db', IDBDatabase, ['deleteObjectStore', 'close']);\n function DB(db) {\n this._db = db;\n }\n DB.prototype.transaction = function () {\n return new Transaction(this._db.transaction.apply(this._db, arguments));\n };\n proxyProperties(DB, '_db', ['name', 'version', 'objectStoreNames']);\n proxyMethods(DB, '_db', IDBDatabase, ['close']);\n\n // Add cursor iterators\n // TODO: remove this once browsers do the right thing with promises\n ['openCursor', 'openKeyCursor'].forEach(function (funcName) {\n [ObjectStore, Index].forEach(function (Constructor) {\n // Don't create iterateKeyCursor if openKeyCursor doesn't exist.\n if (!(funcName in Constructor.prototype)) return;\n Constructor.prototype[funcName.replace('open', 'iterate')] = function () {\n var args = toArray(arguments);\n var callback = args[args.length - 1];\n var nativeObject = this._store || this._index;\n var request = nativeObject[funcName].apply(nativeObject, args.slice(0, -1));\n request.onsuccess = function () {\n callback(request.result);\n };\n };\n });\n });\n\n // polyfill getAll\n [Index, ObjectStore].forEach(function (Constructor) {\n if (Constructor.prototype.getAll) return;\n Constructor.prototype.getAll = function (query, count) {\n var instance = this;\n var items = [];\n return new Promise(function (resolve) {\n instance.iterateCursor(query, function (cursor) {\n if (!cursor) {\n resolve(items);\n return;\n }\n items.push(cursor.value);\n if (count !== undefined && items.length == count) {\n resolve(items);\n return;\n }\n cursor.continue();\n });\n });\n };\n });\n function openDb(name, version, upgradeCallback) {\n var p = promisifyRequestCall(indexedDB, 'open', [name, version]);\n var request = p.request;\n if (request) {\n request.onupgradeneeded = function (event) {\n if (upgradeCallback) {\n upgradeCallback(new UpgradeDB(request.result, event.oldVersion, request.transaction));\n }\n };\n }\n return p.then(function (db) {\n return new DB(db);\n });\n }\n function deleteDb(name) {\n return promisifyRequestCall(indexedDB, 'deleteDatabase', [name]);\n }\n exports.openDb = openDb;\n exports.deleteDb = deleteDb;\n Object.defineProperty(exports, '__esModule', {\n value: true\n });\n});","/*!\n * jQuery JavaScript Library v3.7.0\n * https://jquery.com/\n *\n * Copyright OpenJS Foundation and other contributors\n * Released under the MIT license\n * https://jquery.org/license\n *\n * Date: 2023-05-11T18:29Z\n */\n(function (global, factory) {\n \"use strict\";\n\n if (typeof module === \"object\" && typeof module.exports === \"object\") {\n // For CommonJS and CommonJS-like environments where a proper `window`\n // is present, execute the factory and get jQuery.\n // For environments that do not have a `window` with a `document`\n // (such as Node.js), expose a factory as module.exports.\n // This accentuates the need for the creation of a real `window`.\n // e.g. var jQuery = require(\"jquery\")(window);\n // See ticket trac-14549 for more info.\n module.exports = global.document ? factory(global, true) : function (w) {\n if (!w.document) {\n throw new Error(\"jQuery requires a window with a document\");\n }\n return factory(w);\n };\n } else {\n factory(global);\n }\n\n // Pass this if window is not defined yet\n})(typeof window !== \"undefined\" ? window : this, function (window, noGlobal) {\n // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1\n // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode\n // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common\n // enough that all such attempts are guarded in a try block.\n \"use strict\";\n\n var arr = [];\n var getProto = Object.getPrototypeOf;\n var slice = arr.slice;\n var flat = arr.flat ? function (array) {\n return arr.flat.call(array);\n } : function (array) {\n return arr.concat.apply([], array);\n };\n var push = arr.push;\n var indexOf = arr.indexOf;\n var class2type = {};\n var toString = class2type.toString;\n var hasOwn = class2type.hasOwnProperty;\n var fnToString = hasOwn.toString;\n var ObjectFunctionString = fnToString.call(Object);\n var support = {};\n var isFunction = function isFunction(obj) {\n // Support: Chrome <=57, Firefox <=52\n // In some browsers, typeof returns \"function\" for HTML elements\n // (i.e., `typeof document.createElement( \"object\" ) === \"function\"`).\n // We don't want to classify *any* DOM node as a function.\n // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5\n // Plus for old WebKit, typeof returns \"function\" for HTML collections\n // (e.g., `typeof document.getElementsByTagName(\"div\") === \"function\"`). (gh-4756)\n return typeof obj === \"function\" && typeof obj.nodeType !== \"number\" && typeof obj.item !== \"function\";\n };\n var isWindow = function isWindow(obj) {\n return obj != null && obj === obj.window;\n };\n var document = window.document;\n var preservedScriptAttributes = {\n type: true,\n src: true,\n nonce: true,\n noModule: true\n };\n function DOMEval(code, node, doc) {\n doc = doc || document;\n var i,\n val,\n script = doc.createElement(\"script\");\n script.text = code;\n if (node) {\n for (i in preservedScriptAttributes) {\n // Support: Firefox 64+, Edge 18+\n // Some browsers don't support the \"nonce\" property on scripts.\n // On the other hand, just using `getAttribute` is not enough as\n // the `nonce` attribute is reset to an empty string whenever it\n // becomes browsing-context connected.\n // See https://github.com/whatwg/html/issues/2369\n // See https://html.spec.whatwg.org/#nonce-attributes\n // The `node.getAttribute` check was added for the sake of\n // `jQuery.globalEval` so that it can fake a nonce-containing node\n // via an object.\n val = node[i] || node.getAttribute && node.getAttribute(i);\n if (val) {\n script.setAttribute(i, val);\n }\n }\n }\n doc.head.appendChild(script).parentNode.removeChild(script);\n }\n function toType(obj) {\n if (obj == null) {\n return obj + \"\";\n }\n\n // Support: Android <=2.3 only (functionish RegExp)\n return typeof obj === \"object\" || typeof obj === \"function\" ? class2type[toString.call(obj)] || \"object\" : typeof obj;\n }\n /* global Symbol */\n // Defining this global in .eslintrc.json would create a danger of using the global\n // unguarded in another place, it seems safer to define global only for this module\n\n var version = \"3.7.0\",\n rhtmlSuffix = /HTML$/i,\n // Define a local copy of jQuery\n jQuery = function (selector, context) {\n // The jQuery object is actually just the init constructor 'enhanced'\n // Need init if jQuery is called (just allow error to be thrown if not included)\n return new jQuery.fn.init(selector, context);\n };\n jQuery.fn = jQuery.prototype = {\n // The current version of jQuery being used\n jquery: version,\n constructor: jQuery,\n // The default length of a jQuery object is 0\n length: 0,\n toArray: function () {\n return slice.call(this);\n },\n // Get the Nth element in the matched element set OR\n // Get the whole matched element set as a clean array\n get: function (num) {\n // Return all the elements in a clean array\n if (num == null) {\n return slice.call(this);\n }\n\n // Return just the one element from the set\n return num < 0 ? this[num + this.length] : this[num];\n },\n // Take an array of elements and push it onto the stack\n // (returning the new matched element set)\n pushStack: function (elems) {\n // Build a new jQuery matched element set\n var ret = jQuery.merge(this.constructor(), elems);\n\n // Add the old object onto the stack (as a reference)\n ret.prevObject = this;\n\n // Return the newly-formed element set\n return ret;\n },\n // Execute a callback for every element in the matched set.\n each: function (callback) {\n return jQuery.each(this, callback);\n },\n map: function (callback) {\n return this.pushStack(jQuery.map(this, function (elem, i) {\n return callback.call(elem, i, elem);\n }));\n },\n slice: function () {\n return this.pushStack(slice.apply(this, arguments));\n },\n first: function () {\n return this.eq(0);\n },\n last: function () {\n return this.eq(-1);\n },\n even: function () {\n return this.pushStack(jQuery.grep(this, function (_elem, i) {\n return (i + 1) % 2;\n }));\n },\n odd: function () {\n return this.pushStack(jQuery.grep(this, function (_elem, i) {\n return i % 2;\n }));\n },\n eq: function (i) {\n var len = this.length,\n j = +i + (i < 0 ? len : 0);\n return this.pushStack(j >= 0 && j < len ? [this[j]] : []);\n },\n end: function () {\n return this.prevObject || this.constructor();\n },\n // For internal use only.\n // Behaves like an Array's method, not like a jQuery method.\n push: push,\n sort: arr.sort,\n splice: arr.splice\n };\n jQuery.extend = jQuery.fn.extend = function () {\n var options,\n name,\n src,\n copy,\n copyIsArray,\n clone,\n target = arguments[0] || {},\n i = 1,\n length = arguments.length,\n deep = false;\n\n // Handle a deep copy situation\n if (typeof target === \"boolean\") {\n deep = target;\n\n // Skip the boolean and the target\n target = arguments[i] || {};\n i++;\n }\n\n // Handle case when target is a string or something (possible in deep copy)\n if (typeof target !== \"object\" && !isFunction(target)) {\n target = {};\n }\n\n // Extend jQuery itself if only one argument is passed\n if (i === length) {\n target = this;\n i--;\n }\n for (; i < length; i++) {\n // Only deal with non-null/undefined values\n if ((options = arguments[i]) != null) {\n // Extend the base object\n for (name in options) {\n copy = options[name];\n\n // Prevent Object.prototype pollution\n // Prevent never-ending loop\n if (name === \"__proto__\" || target === copy) {\n continue;\n }\n\n // Recurse if we're merging plain objects or arrays\n if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) {\n src = target[name];\n\n // Ensure proper type for the source value\n if (copyIsArray && !Array.isArray(src)) {\n clone = [];\n } else if (!copyIsArray && !jQuery.isPlainObject(src)) {\n clone = {};\n } else {\n clone = src;\n }\n copyIsArray = false;\n\n // Never move original objects, clone them\n target[name] = jQuery.extend(deep, clone, copy);\n\n // Don't bring in undefined values\n } else if (copy !== undefined) {\n target[name] = copy;\n }\n }\n }\n }\n\n // Return the modified object\n return target;\n };\n jQuery.extend({\n // Unique for each copy of jQuery on the page\n expando: \"jQuery\" + (version + Math.random()).replace(/\\D/g, \"\"),\n // Assume jQuery is ready without the ready module\n isReady: true,\n error: function (msg) {\n throw new Error(msg);\n },\n noop: function () {},\n isPlainObject: function (obj) {\n var proto, Ctor;\n\n // Detect obvious negatives\n // Use toString instead of jQuery.type to catch host objects\n if (!obj || toString.call(obj) !== \"[object Object]\") {\n return false;\n }\n proto = getProto(obj);\n\n // Objects with no prototype (e.g., `Object.create( null )`) are plain\n if (!proto) {\n return true;\n }\n\n // Objects with prototype are plain iff they were constructed by a global Object function\n Ctor = hasOwn.call(proto, \"constructor\") && proto.constructor;\n return typeof Ctor === \"function\" && fnToString.call(Ctor) === ObjectFunctionString;\n },\n isEmptyObject: function (obj) {\n var name;\n for (name in obj) {\n return false;\n }\n return true;\n },\n // Evaluates a script in a provided context; falls back to the global one\n // if not specified.\n globalEval: function (code, options, doc) {\n DOMEval(code, {\n nonce: options && options.nonce\n }, doc);\n },\n each: function (obj, callback) {\n var length,\n i = 0;\n if (isArrayLike(obj)) {\n length = obj.length;\n for (; i < length; i++) {\n if (callback.call(obj[i], i, obj[i]) === false) {\n break;\n }\n }\n } else {\n for (i in obj) {\n if (callback.call(obj[i], i, obj[i]) === false) {\n break;\n }\n }\n }\n return obj;\n },\n // Retrieve the text value of an array of DOM nodes\n text: function (elem) {\n var node,\n ret = \"\",\n i = 0,\n nodeType = elem.nodeType;\n if (!nodeType) {\n // If no nodeType, this is expected to be an array\n while (node = elem[i++]) {\n // Do not traverse comment nodes\n ret += jQuery.text(node);\n }\n } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {\n return elem.textContent;\n } else if (nodeType === 3 || nodeType === 4) {\n return elem.nodeValue;\n }\n\n // Do not include comment or processing instruction nodes\n\n return ret;\n },\n // results is for internal usage only\n makeArray: function (arr, results) {\n var ret = results || [];\n if (arr != null) {\n if (isArrayLike(Object(arr))) {\n jQuery.merge(ret, typeof arr === \"string\" ? [arr] : arr);\n } else {\n push.call(ret, arr);\n }\n }\n return ret;\n },\n inArray: function (elem, arr, i) {\n return arr == null ? -1 : indexOf.call(arr, elem, i);\n },\n isXMLDoc: function (elem) {\n var namespace = elem && elem.namespaceURI,\n docElem = elem && (elem.ownerDocument || elem).documentElement;\n\n // Assume HTML when documentElement doesn't yet exist, such as inside\n // document fragments.\n return !rhtmlSuffix.test(namespace || docElem && docElem.nodeName || \"HTML\");\n },\n // Support: Android <=4.0 only, PhantomJS 1 only\n // push.apply(_, arraylike) throws on ancient WebKit\n merge: function (first, second) {\n var len = +second.length,\n j = 0,\n i = first.length;\n for (; j < len; j++) {\n first[i++] = second[j];\n }\n first.length = i;\n return first;\n },\n grep: function (elems, callback, invert) {\n var callbackInverse,\n matches = [],\n i = 0,\n length = elems.length,\n callbackExpect = !invert;\n\n // Go through the array, only saving the items\n // that pass the validator function\n for (; i < length; i++) {\n callbackInverse = !callback(elems[i], i);\n if (callbackInverse !== callbackExpect) {\n matches.push(elems[i]);\n }\n }\n return matches;\n },\n // arg is for internal usage only\n map: function (elems, callback, arg) {\n var length,\n value,\n i = 0,\n ret = [];\n\n // Go through the array, translating each of the items to their new values\n if (isArrayLike(elems)) {\n length = elems.length;\n for (; i < length; i++) {\n value = callback(elems[i], i, arg);\n if (value != null) {\n ret.push(value);\n }\n }\n\n // Go through every key on the object,\n } else {\n for (i in elems) {\n value = callback(elems[i], i, arg);\n if (value != null) {\n ret.push(value);\n }\n }\n }\n\n // Flatten any nested arrays\n return flat(ret);\n },\n // A global GUID counter for objects\n guid: 1,\n // jQuery.support is not used in Core but other projects attach their\n // properties to it so it needs to exist.\n support: support\n });\n if (typeof Symbol === \"function\") {\n jQuery.fn[Symbol.iterator] = arr[Symbol.iterator];\n }\n\n // Populate the class2type map\n jQuery.each(\"Boolean Number String Function Array Date RegExp Object Error Symbol\".split(\" \"), function (_i, name) {\n class2type[\"[object \" + name + \"]\"] = name.toLowerCase();\n });\n function isArrayLike(obj) {\n // Support: real iOS 8.2 only (not reproducible in simulator)\n // `in` check used to prevent JIT error (gh-2145)\n // hasOwn isn't used here due to false negatives\n // regarding Nodelist length in IE\n var length = !!obj && \"length\" in obj && obj.length,\n type = toType(obj);\n if (isFunction(obj) || isWindow(obj)) {\n return false;\n }\n return type === \"array\" || length === 0 || typeof length === \"number\" && length > 0 && length - 1 in obj;\n }\n function nodeName(elem, name) {\n return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();\n }\n var pop = arr.pop;\n var sort = arr.sort;\n var splice = arr.splice;\n var whitespace = \"[\\\\x20\\\\t\\\\r\\\\n\\\\f]\";\n var rtrimCSS = new RegExp(\"^\" + whitespace + \"+|((?:^|[^\\\\\\\\])(?:\\\\\\\\.)*)\" + whitespace + \"+$\", \"g\");\n\n // Note: an element does not contain itself\n jQuery.contains = function (a, b) {\n var bup = b && b.parentNode;\n return a === bup || !!(bup && bup.nodeType === 1 && (\n // Support: IE 9 - 11+\n // IE doesn't have `contains` on SVG.\n a.contains ? a.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16));\n };\n\n // CSS string/identifier serialization\n // https://drafts.csswg.org/cssom/#common-serializing-idioms\n var rcssescape = /([\\0-\\x1f\\x7f]|^-?\\d)|^-$|[^\\x80-\\uFFFF\\w-]/g;\n function fcssescape(ch, asCodePoint) {\n if (asCodePoint) {\n // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER\n if (ch === \"\\0\") {\n return \"\\uFFFD\";\n }\n\n // Control characters and (dependent upon position) numbers get escaped as code points\n return ch.slice(0, -1) + \"\\\\\" + ch.charCodeAt(ch.length - 1).toString(16) + \" \";\n }\n\n // Other potentially-special ASCII characters get backslash-escaped\n return \"\\\\\" + ch;\n }\n jQuery.escapeSelector = function (sel) {\n return (sel + \"\").replace(rcssescape, fcssescape);\n };\n var preferredDoc = document,\n pushNative = push;\n (function () {\n var i,\n Expr,\n outermostContext,\n sortInput,\n hasDuplicate,\n push = pushNative,\n // Local document vars\n document,\n documentElement,\n documentIsHTML,\n rbuggyQSA,\n matches,\n // Instance-specific data\n expando = jQuery.expando,\n dirruns = 0,\n done = 0,\n classCache = createCache(),\n tokenCache = createCache(),\n compilerCache = createCache(),\n nonnativeSelectorCache = createCache(),\n sortOrder = function (a, b) {\n if (a === b) {\n hasDuplicate = true;\n }\n return 0;\n },\n booleans = \"checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|\" + \"loop|multiple|open|readonly|required|scoped\",\n // Regular expressions\n\n // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram\n identifier = \"(?:\\\\\\\\[\\\\da-fA-F]{1,6}\" + whitespace + \"?|\\\\\\\\[^\\\\r\\\\n\\\\f]|[\\\\w-]|[^\\0-\\\\x7f])+\",\n // Attribute selectors: https://www.w3.org/TR/selectors/#attribute-selectors\n attributes = \"\\\\[\" + whitespace + \"*(\" + identifier + \")(?:\" + whitespace +\n // Operator (capture 2)\n \"*([*^$|!~]?=)\" + whitespace +\n // \"Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]\"\n \"*(?:'((?:\\\\\\\\.|[^\\\\\\\\'])*)'|\\\"((?:\\\\\\\\.|[^\\\\\\\\\\\"])*)\\\"|(\" + identifier + \"))|)\" + whitespace + \"*\\\\]\",\n pseudos = \":(\" + identifier + \")(?:\\\\((\" +\n // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:\n // 1. quoted (capture 3; capture 4 or capture 5)\n \"('((?:\\\\\\\\.|[^\\\\\\\\'])*)'|\\\"((?:\\\\\\\\.|[^\\\\\\\\\\\"])*)\\\")|\" +\n // 2. simple (capture 6)\n \"((?:\\\\\\\\.|[^\\\\\\\\()[\\\\]]|\" + attributes + \")*)|\" +\n // 3. anything else (capture 2)\n \".*\" + \")\\\\)|)\",\n // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter\n rwhitespace = new RegExp(whitespace + \"+\", \"g\"),\n rcomma = new RegExp(\"^\" + whitespace + \"*,\" + whitespace + \"*\"),\n rleadingCombinator = new RegExp(\"^\" + whitespace + \"*([>+~]|\" + whitespace + \")\" + whitespace + \"*\"),\n rdescend = new RegExp(whitespace + \"|>\"),\n rpseudo = new RegExp(pseudos),\n ridentifier = new RegExp(\"^\" + identifier + \"$\"),\n matchExpr = {\n ID: new RegExp(\"^#(\" + identifier + \")\"),\n CLASS: new RegExp(\"^\\\\.(\" + identifier + \")\"),\n TAG: new RegExp(\"^(\" + identifier + \"|[*])\"),\n ATTR: new RegExp(\"^\" + attributes),\n PSEUDO: new RegExp(\"^\" + pseudos),\n CHILD: new RegExp(\"^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\\\(\" + whitespace + \"*(even|odd|(([+-]|)(\\\\d*)n|)\" + whitespace + \"*(?:([+-]|)\" + whitespace + \"*(\\\\d+)|))\" + whitespace + \"*\\\\)|)\", \"i\"),\n bool: new RegExp(\"^(?:\" + booleans + \")$\", \"i\"),\n // For use in libraries implementing .is()\n // We use this for POS matching in `select`\n needsContext: new RegExp(\"^\" + whitespace + \"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\\\(\" + whitespace + \"*((?:-\\\\d)?\\\\d*)\" + whitespace + \"*\\\\)|)(?=[^-]|$)\", \"i\")\n },\n rinputs = /^(?:input|select|textarea|button)$/i,\n rheader = /^h\\d$/i,\n // Easily-parseable/retrievable ID or TAG or CLASS selectors\n rquickExpr = /^(?:#([\\w-]+)|(\\w+)|\\.([\\w-]+))$/,\n rsibling = /[+~]/,\n // CSS escapes\n // https://www.w3.org/TR/CSS21/syndata.html#escaped-characters\n runescape = new RegExp(\"\\\\\\\\[\\\\da-fA-F]{1,6}\" + whitespace + \"?|\\\\\\\\([^\\\\r\\\\n\\\\f])\", \"g\"),\n funescape = function (escape, nonHex) {\n var high = \"0x\" + escape.slice(1) - 0x10000;\n if (nonHex) {\n // Strip the backslash prefix from a non-hex escape sequence\n return nonHex;\n }\n\n // Replace a hexadecimal escape sequence with the encoded Unicode code point\n // Support: IE <=11+\n // For values outside the Basic Multilingual Plane (BMP), manually construct a\n // surrogate pair\n return high < 0 ? String.fromCharCode(high + 0x10000) : String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00);\n },\n // Used for iframes; see `setDocument`.\n // Support: IE 9 - 11+, Edge 12 - 18+\n // Removing the function wrapper causes a \"Permission Denied\"\n // error in IE/Edge.\n unloadHandler = function () {\n setDocument();\n },\n inDisabledFieldset = addCombinator(function (elem) {\n return elem.disabled === true && nodeName(elem, \"fieldset\");\n }, {\n dir: \"parentNode\",\n next: \"legend\"\n });\n\n // Support: IE <=9 only\n // Accessing document.activeElement can throw unexpectedly\n // https://bugs.jquery.com/ticket/13393\n function safeActiveElement() {\n try {\n return document.activeElement;\n } catch (err) {}\n }\n\n // Optimize for push.apply( _, NodeList )\n try {\n push.apply(arr = slice.call(preferredDoc.childNodes), preferredDoc.childNodes);\n\n // Support: Android <=4.0\n // Detect silently failing push.apply\n // eslint-disable-next-line no-unused-expressions\n arr[preferredDoc.childNodes.length].nodeType;\n } catch (e) {\n push = {\n apply: function (target, els) {\n pushNative.apply(target, slice.call(els));\n },\n call: function (target) {\n pushNative.apply(target, slice.call(arguments, 1));\n }\n };\n }\n function find(selector, context, results, seed) {\n var m,\n i,\n elem,\n nid,\n match,\n groups,\n newSelector,\n newContext = context && context.ownerDocument,\n // nodeType defaults to 9, since context defaults to document\n nodeType = context ? context.nodeType : 9;\n results = results || [];\n\n // Return early from calls with invalid selector or context\n if (typeof selector !== \"string\" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {\n return results;\n }\n\n // Try to shortcut find operations (as opposed to filters) in HTML documents\n if (!seed) {\n setDocument(context);\n context = context || document;\n if (documentIsHTML) {\n // If the selector is sufficiently simple, try using a \"get*By*\" DOM method\n // (excepting DocumentFragment context, where the methods don't exist)\n if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {\n // ID selector\n if (m = match[1]) {\n // Document context\n if (nodeType === 9) {\n if (elem = context.getElementById(m)) {\n // Support: IE 9 only\n // getElementById can match elements by name instead of ID\n if (elem.id === m) {\n push.call(results, elem);\n return results;\n }\n } else {\n return results;\n }\n\n // Element context\n } else {\n // Support: IE 9 only\n // getElementById can match elements by name instead of ID\n if (newContext && (elem = newContext.getElementById(m)) && find.contains(context, elem) && elem.id === m) {\n push.call(results, elem);\n return results;\n }\n }\n\n // Type selector\n } else if (match[2]) {\n push.apply(results, context.getElementsByTagName(selector));\n return results;\n\n // Class selector\n } else if ((m = match[3]) && context.getElementsByClassName) {\n push.apply(results, context.getElementsByClassName(m));\n return results;\n }\n }\n\n // Take advantage of querySelectorAll\n if (!nonnativeSelectorCache[selector + \" \"] && (!rbuggyQSA || !rbuggyQSA.test(selector))) {\n newSelector = selector;\n newContext = context;\n\n // qSA considers elements outside a scoping root when evaluating child or\n // descendant combinators, which is not what we want.\n // In such cases, we work around the behavior by prefixing every selector in the\n // list with an ID selector referencing the scope context.\n // The technique has to be used as well when a leading combinator is used\n // as such selectors are not recognized by querySelectorAll.\n // Thanks to Andrew Dupont for this technique.\n if (nodeType === 1 && (rdescend.test(selector) || rleadingCombinator.test(selector))) {\n // Expand context for sibling selectors\n newContext = rsibling.test(selector) && testContext(context.parentNode) || context;\n\n // We can use :scope instead of the ID hack if the browser\n // supports it & if we're not changing the context.\n // Support: IE 11+, Edge 17 - 18+\n // IE/Edge sometimes throw a \"Permission denied\" error when\n // strict-comparing two documents; shallow comparisons work.\n // eslint-disable-next-line eqeqeq\n if (newContext != context || !support.scope) {\n // Capture the context ID, setting it first if necessary\n if (nid = context.getAttribute(\"id\")) {\n nid = jQuery.escapeSelector(nid);\n } else {\n context.setAttribute(\"id\", nid = expando);\n }\n }\n\n // Prefix every selector in the list\n groups = tokenize(selector);\n i = groups.length;\n while (i--) {\n groups[i] = (nid ? \"#\" + nid : \":scope\") + \" \" + toSelector(groups[i]);\n }\n newSelector = groups.join(\",\");\n }\n try {\n push.apply(results, newContext.querySelectorAll(newSelector));\n return results;\n } catch (qsaError) {\n nonnativeSelectorCache(selector, true);\n } finally {\n if (nid === expando) {\n context.removeAttribute(\"id\");\n }\n }\n }\n }\n }\n\n // All others\n return select(selector.replace(rtrimCSS, \"$1\"), context, results, seed);\n }\n\n /**\n * Create key-value caches of limited size\n * @returns {function(string, object)} Returns the Object data after storing it on itself with\n *\tproperty name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)\n *\tdeleting the oldest entry\n */\n function createCache() {\n var keys = [];\n function cache(key, value) {\n // Use (key + \" \") to avoid collision with native prototype properties\n // (see https://github.com/jquery/sizzle/issues/157)\n if (keys.push(key + \" \") > Expr.cacheLength) {\n // Only keep the most recent entries\n delete cache[keys.shift()];\n }\n return cache[key + \" \"] = value;\n }\n return cache;\n }\n\n /**\n * Mark a function for special use by jQuery selector module\n * @param {Function} fn The function to mark\n */\n function markFunction(fn) {\n fn[expando] = true;\n return fn;\n }\n\n /**\n * Support testing using an element\n * @param {Function} fn Passed the created element and returns a boolean result\n */\n function assert(fn) {\n var el = document.createElement(\"fieldset\");\n try {\n return !!fn(el);\n } catch (e) {\n return false;\n } finally {\n // Remove from its parent by default\n if (el.parentNode) {\n el.parentNode.removeChild(el);\n }\n\n // release memory in IE\n el = null;\n }\n }\n\n /**\n * Returns a function to use in pseudos for input types\n * @param {String} type\n */\n function createInputPseudo(type) {\n return function (elem) {\n return nodeName(elem, \"input\") && elem.type === type;\n };\n }\n\n /**\n * Returns a function to use in pseudos for buttons\n * @param {String} type\n */\n function createButtonPseudo(type) {\n return function (elem) {\n return (nodeName(elem, \"input\") || nodeName(elem, \"button\")) && elem.type === type;\n };\n }\n\n /**\n * Returns a function to use in pseudos for :enabled/:disabled\n * @param {Boolean} disabled true for :disabled; false for :enabled\n */\n function createDisabledPseudo(disabled) {\n // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable\n return function (elem) {\n // Only certain elements can match :enabled or :disabled\n // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled\n // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled\n if (\"form\" in elem) {\n // Check for inherited disabledness on relevant non-disabled elements:\n // * listed form-associated elements in a disabled fieldset\n // https://html.spec.whatwg.org/multipage/forms.html#category-listed\n // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled\n // * option elements in a disabled optgroup\n // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled\n // All such elements have a \"form\" property.\n if (elem.parentNode && elem.disabled === false) {\n // Option elements defer to a parent optgroup if present\n if (\"label\" in elem) {\n if (\"label\" in elem.parentNode) {\n return elem.parentNode.disabled === disabled;\n } else {\n return elem.disabled === disabled;\n }\n }\n\n // Support: IE 6 - 11+\n // Use the isDisabled shortcut property to check for disabled fieldset ancestors\n return elem.isDisabled === disabled ||\n // Where there is no isDisabled, check manually\n elem.isDisabled !== !disabled && inDisabledFieldset(elem) === disabled;\n }\n return elem.disabled === disabled;\n\n // Try to winnow out elements that can't be disabled before trusting the disabled property.\n // Some victims get caught in our net (label, legend, menu, track), but it shouldn't\n // even exist on them, let alone have a boolean value.\n } else if (\"label\" in elem) {\n return elem.disabled === disabled;\n }\n\n // Remaining elements are neither :enabled nor :disabled\n return false;\n };\n }\n\n /**\n * Returns a function to use in pseudos for positionals\n * @param {Function} fn\n */\n function createPositionalPseudo(fn) {\n return markFunction(function (argument) {\n argument = +argument;\n return markFunction(function (seed, matches) {\n var j,\n matchIndexes = fn([], seed.length, argument),\n i = matchIndexes.length;\n\n // Match elements found at the specified indexes\n while (i--) {\n if (seed[j = matchIndexes[i]]) {\n seed[j] = !(matches[j] = seed[j]);\n }\n }\n });\n });\n }\n\n /**\n * Checks a node for validity as a jQuery selector context\n * @param {Element|Object=} context\n * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value\n */\n function testContext(context) {\n return context && typeof context.getElementsByTagName !== \"undefined\" && context;\n }\n\n /**\n * Sets document-related variables once based on the current document\n * @param {Element|Object} [node] An element or document object to use to set the document\n * @returns {Object} Returns the current document\n */\n function setDocument(node) {\n var subWindow,\n doc = node ? node.ownerDocument || node : preferredDoc;\n\n // Return early if doc is invalid or already selected\n // Support: IE 11+, Edge 17 - 18+\n // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n // two documents; shallow comparisons work.\n // eslint-disable-next-line eqeqeq\n if (doc == document || doc.nodeType !== 9 || !doc.documentElement) {\n return document;\n }\n\n // Update global variables\n document = doc;\n documentElement = document.documentElement;\n documentIsHTML = !jQuery.isXMLDoc(document);\n\n // Support: iOS 7 only, IE 9 - 11+\n // Older browsers didn't support unprefixed `matches`.\n matches = documentElement.matches || documentElement.webkitMatchesSelector || documentElement.msMatchesSelector;\n\n // Support: IE 9 - 11+, Edge 12 - 18+\n // Accessing iframe documents after unload throws \"permission denied\" errors (see trac-13936)\n // Support: IE 11+, Edge 17 - 18+\n // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n // two documents; shallow comparisons work.\n // eslint-disable-next-line eqeqeq\n if (preferredDoc != document && (subWindow = document.defaultView) && subWindow.top !== subWindow) {\n // Support: IE 9 - 11+, Edge 12 - 18+\n subWindow.addEventListener(\"unload\", unloadHandler);\n }\n\n // Support: IE <10\n // Check if getElementById returns elements by name\n // The broken getElementById methods don't pick up programmatically-set names,\n // so use a roundabout getElementsByName test\n support.getById = assert(function (el) {\n documentElement.appendChild(el).id = jQuery.expando;\n return !document.getElementsByName || !document.getElementsByName(jQuery.expando).length;\n });\n\n // Support: IE 9 only\n // Check to see if it's possible to do matchesSelector\n // on a disconnected node.\n support.disconnectedMatch = assert(function (el) {\n return matches.call(el, \"*\");\n });\n\n // Support: IE 9 - 11+, Edge 12 - 18+\n // IE/Edge don't support the :scope pseudo-class.\n support.scope = assert(function () {\n return document.querySelectorAll(\":scope\");\n });\n\n // Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only\n // Make sure the `:has()` argument is parsed unforgivingly.\n // We include `*` in the test to detect buggy implementations that are\n // _selectively_ forgiving (specifically when the list includes at least\n // one valid selector).\n // Note that we treat complete lack of support for `:has()` as if it were\n // spec-compliant support, which is fine because use of `:has()` in such\n // environments will fail in the qSA path and fall back to jQuery traversal\n // anyway.\n support.cssHas = assert(function () {\n try {\n document.querySelector(\":has(*,:jqfake)\");\n return false;\n } catch (e) {\n return true;\n }\n });\n\n // ID filter and find\n if (support.getById) {\n Expr.filter.ID = function (id) {\n var attrId = id.replace(runescape, funescape);\n return function (elem) {\n return elem.getAttribute(\"id\") === attrId;\n };\n };\n Expr.find.ID = function (id, context) {\n if (typeof context.getElementById !== \"undefined\" && documentIsHTML) {\n var elem = context.getElementById(id);\n return elem ? [elem] : [];\n }\n };\n } else {\n Expr.filter.ID = function (id) {\n var attrId = id.replace(runescape, funescape);\n return function (elem) {\n var node = typeof elem.getAttributeNode !== \"undefined\" && elem.getAttributeNode(\"id\");\n return node && node.value === attrId;\n };\n };\n\n // Support: IE 6 - 7 only\n // getElementById is not reliable as a find shortcut\n Expr.find.ID = function (id, context) {\n if (typeof context.getElementById !== \"undefined\" && documentIsHTML) {\n var node,\n i,\n elems,\n elem = context.getElementById(id);\n if (elem) {\n // Verify the id attribute\n node = elem.getAttributeNode(\"id\");\n if (node && node.value === id) {\n return [elem];\n }\n\n // Fall back on getElementsByName\n elems = context.getElementsByName(id);\n i = 0;\n while (elem = elems[i++]) {\n node = elem.getAttributeNode(\"id\");\n if (node && node.value === id) {\n return [elem];\n }\n }\n }\n return [];\n }\n };\n }\n\n // Tag\n Expr.find.TAG = function (tag, context) {\n if (typeof context.getElementsByTagName !== \"undefined\") {\n return context.getElementsByTagName(tag);\n\n // DocumentFragment nodes don't have gEBTN\n } else {\n return context.querySelectorAll(tag);\n }\n };\n\n // Class\n Expr.find.CLASS = function (className, context) {\n if (typeof context.getElementsByClassName !== \"undefined\" && documentIsHTML) {\n return context.getElementsByClassName(className);\n }\n };\n\n /* QSA/matchesSelector\n ---------------------------------------------------------------------- */\n\n // QSA and matchesSelector support\n\n rbuggyQSA = [];\n\n // Build QSA regex\n // Regex strategy adopted from Diego Perini\n assert(function (el) {\n var input;\n documentElement.appendChild(el).innerHTML = \" \" + \"\" + \" \";\n\n // Support: iOS <=7 - 8 only\n // Boolean attributes and \"value\" are not treated correctly in some XML documents\n if (!el.querySelectorAll(\"[selected]\").length) {\n rbuggyQSA.push(\"\\\\[\" + whitespace + \"*(?:value|\" + booleans + \")\");\n }\n\n // Support: iOS <=7 - 8 only\n if (!el.querySelectorAll(\"[id~=\" + expando + \"-]\").length) {\n rbuggyQSA.push(\"~=\");\n }\n\n // Support: iOS 8 only\n // https://bugs.webkit.org/show_bug.cgi?id=136851\n // In-page `selector#id sibling-combinator selector` fails\n if (!el.querySelectorAll(\"a#\" + expando + \"+*\").length) {\n rbuggyQSA.push(\".#.+[+~]\");\n }\n\n // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+\n // In some of the document kinds, these selectors wouldn't work natively.\n // This is probably OK but for backwards compatibility we want to maintain\n // handling them through jQuery traversal in jQuery 3.x.\n if (!el.querySelectorAll(\":checked\").length) {\n rbuggyQSA.push(\":checked\");\n }\n\n // Support: Windows 8 Native Apps\n // The type and name attributes are restricted during .innerHTML assignment\n input = document.createElement(\"input\");\n input.setAttribute(\"type\", \"hidden\");\n el.appendChild(input).setAttribute(\"name\", \"D\");\n\n // Support: IE 9 - 11+\n // IE's :disabled selector does not pick up the children of disabled fieldsets\n // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+\n // In some of the document kinds, these selectors wouldn't work natively.\n // This is probably OK but for backwards compatibility we want to maintain\n // handling them through jQuery traversal in jQuery 3.x.\n documentElement.appendChild(el).disabled = true;\n if (el.querySelectorAll(\":disabled\").length !== 2) {\n rbuggyQSA.push(\":enabled\", \":disabled\");\n }\n\n // Support: IE 11+, Edge 15 - 18+\n // IE 11/Edge don't find elements on a `[name='']` query in some cases.\n // Adding a temporary attribute to the document before the selection works\n // around the issue.\n // Interestingly, IE 10 & older don't seem to have the issue.\n input = document.createElement(\"input\");\n input.setAttribute(\"name\", \"\");\n el.appendChild(input);\n if (!el.querySelectorAll(\"[name='']\").length) {\n rbuggyQSA.push(\"\\\\[\" + whitespace + \"*name\" + whitespace + \"*=\" + whitespace + \"*(?:''|\\\"\\\")\");\n }\n });\n if (!support.cssHas) {\n // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+\n // Our regular `try-catch` mechanism fails to detect natively-unsupported\n // pseudo-classes inside `:has()` (such as `:has(:contains(\"Foo\"))`)\n // in browsers that parse the `:has()` argument as a forgiving selector list.\n // https://drafts.csswg.org/selectors/#relational now requires the argument\n // to be parsed unforgivingly, but browsers have not yet fully adjusted.\n rbuggyQSA.push(\":has\");\n }\n rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join(\"|\"));\n\n /* Sorting\n ---------------------------------------------------------------------- */\n\n // Document order sorting\n sortOrder = function (a, b) {\n // Flag for duplicate removal\n if (a === b) {\n hasDuplicate = true;\n return 0;\n }\n\n // Sort on method existence if only one input has compareDocumentPosition\n var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;\n if (compare) {\n return compare;\n }\n\n // Calculate position if both inputs belong to the same document\n // Support: IE 11+, Edge 17 - 18+\n // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n // two documents; shallow comparisons work.\n // eslint-disable-next-line eqeqeq\n compare = (a.ownerDocument || a) == (b.ownerDocument || b) ? a.compareDocumentPosition(b) :\n // Otherwise we know they are disconnected\n 1;\n\n // Disconnected nodes\n if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) {\n // Choose the first element that is related to our preferred document\n // Support: IE 11+, Edge 17 - 18+\n // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n // two documents; shallow comparisons work.\n // eslint-disable-next-line eqeqeq\n if (a === document || a.ownerDocument == preferredDoc && find.contains(preferredDoc, a)) {\n return -1;\n }\n\n // Support: IE 11+, Edge 17 - 18+\n // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n // two documents; shallow comparisons work.\n // eslint-disable-next-line eqeqeq\n if (b === document || b.ownerDocument == preferredDoc && find.contains(preferredDoc, b)) {\n return 1;\n }\n\n // Maintain original order\n return sortInput ? indexOf.call(sortInput, a) - indexOf.call(sortInput, b) : 0;\n }\n return compare & 4 ? -1 : 1;\n };\n return document;\n }\n find.matches = function (expr, elements) {\n return find(expr, null, null, elements);\n };\n find.matchesSelector = function (elem, expr) {\n setDocument(elem);\n if (documentIsHTML && !nonnativeSelectorCache[expr + \" \"] && (!rbuggyQSA || !rbuggyQSA.test(expr))) {\n try {\n var ret = matches.call(elem, expr);\n\n // IE 9's matchesSelector returns false on disconnected nodes\n if (ret || support.disconnectedMatch ||\n // As well, disconnected nodes are said to be in a document\n // fragment in IE 9\n elem.document && elem.document.nodeType !== 11) {\n return ret;\n }\n } catch (e) {\n nonnativeSelectorCache(expr, true);\n }\n }\n return find(expr, document, null, [elem]).length > 0;\n };\n find.contains = function (context, elem) {\n // Set document vars if needed\n // Support: IE 11+, Edge 17 - 18+\n // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n // two documents; shallow comparisons work.\n // eslint-disable-next-line eqeqeq\n if ((context.ownerDocument || context) != document) {\n setDocument(context);\n }\n return jQuery.contains(context, elem);\n };\n find.attr = function (elem, name) {\n // Set document vars if needed\n // Support: IE 11+, Edge 17 - 18+\n // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n // two documents; shallow comparisons work.\n // eslint-disable-next-line eqeqeq\n if ((elem.ownerDocument || elem) != document) {\n setDocument(elem);\n }\n var fn = Expr.attrHandle[name.toLowerCase()],\n // Don't get fooled by Object.prototype properties (see trac-13807)\n val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : undefined;\n if (val !== undefined) {\n return val;\n }\n return elem.getAttribute(name);\n };\n find.error = function (msg) {\n throw new Error(\"Syntax error, unrecognized expression: \" + msg);\n };\n\n /**\n * Document sorting and removing duplicates\n * @param {ArrayLike} results\n */\n jQuery.uniqueSort = function (results) {\n var elem,\n duplicates = [],\n j = 0,\n i = 0;\n\n // Unless we *know* we can detect duplicates, assume their presence\n //\n // Support: Android <=4.0+\n // Testing for detecting duplicates is unpredictable so instead assume we can't\n // depend on duplicate detection in all browsers without a stable sort.\n hasDuplicate = !support.sortStable;\n sortInput = !support.sortStable && slice.call(results, 0);\n sort.call(results, sortOrder);\n if (hasDuplicate) {\n while (elem = results[i++]) {\n if (elem === results[i]) {\n j = duplicates.push(i);\n }\n }\n while (j--) {\n splice.call(results, duplicates[j], 1);\n }\n }\n\n // Clear input after sorting to release objects\n // See https://github.com/jquery/sizzle/pull/225\n sortInput = null;\n return results;\n };\n jQuery.fn.uniqueSort = function () {\n return this.pushStack(jQuery.uniqueSort(slice.apply(this)));\n };\n Expr = jQuery.expr = {\n // Can be adjusted by the user\n cacheLength: 50,\n createPseudo: markFunction,\n match: matchExpr,\n attrHandle: {},\n find: {},\n relative: {\n \">\": {\n dir: \"parentNode\",\n first: true\n },\n \" \": {\n dir: \"parentNode\"\n },\n \"+\": {\n dir: \"previousSibling\",\n first: true\n },\n \"~\": {\n dir: \"previousSibling\"\n }\n },\n preFilter: {\n ATTR: function (match) {\n match[1] = match[1].replace(runescape, funescape);\n\n // Move the given value to match[3] whether quoted or unquoted\n match[3] = (match[3] || match[4] || match[5] || \"\").replace(runescape, funescape);\n if (match[2] === \"~=\") {\n match[3] = \" \" + match[3] + \" \";\n }\n return match.slice(0, 4);\n },\n CHILD: function (match) {\n /* matches from matchExpr[\"CHILD\"]\n \t1 type (only|nth|...)\n \t2 what (child|of-type)\n \t3 argument (even|odd|\\d*|\\d*n([+-]\\d+)?|...)\n \t4 xn-component of xn+y argument ([+-]?\\d*n|)\n \t5 sign of xn-component\n \t6 x of xn-component\n \t7 sign of y-component\n \t8 y of y-component\n */\n match[1] = match[1].toLowerCase();\n if (match[1].slice(0, 3) === \"nth\") {\n // nth-* requires argument\n if (!match[3]) {\n find.error(match[0]);\n }\n\n // numeric x and y parameters for Expr.filter.CHILD\n // remember that false/true cast respectively to 0/1\n match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === \"even\" || match[3] === \"odd\"));\n match[5] = +(match[7] + match[8] || match[3] === \"odd\");\n\n // other types prohibit arguments\n } else if (match[3]) {\n find.error(match[0]);\n }\n return match;\n },\n PSEUDO: function (match) {\n var excess,\n unquoted = !match[6] && match[2];\n if (matchExpr.CHILD.test(match[0])) {\n return null;\n }\n\n // Accept quoted arguments as-is\n if (match[3]) {\n match[2] = match[4] || match[5] || \"\";\n\n // Strip excess characters from unquoted arguments\n } else if (unquoted && rpseudo.test(unquoted) && (\n // Get excess from tokenize (recursively)\n excess = tokenize(unquoted, true)) && (\n // advance to the next closing parenthesis\n excess = unquoted.indexOf(\")\", unquoted.length - excess) - unquoted.length)) {\n // excess is a negative index\n match[0] = match[0].slice(0, excess);\n match[2] = unquoted.slice(0, excess);\n }\n\n // Return only captures needed by the pseudo filter method (type and argument)\n return match.slice(0, 3);\n }\n },\n filter: {\n TAG: function (nodeNameSelector) {\n var expectedNodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();\n return nodeNameSelector === \"*\" ? function () {\n return true;\n } : function (elem) {\n return nodeName(elem, expectedNodeName);\n };\n },\n CLASS: function (className) {\n var pattern = classCache[className + \" \"];\n return pattern || (pattern = new RegExp(\"(^|\" + whitespace + \")\" + className + \"(\" + whitespace + \"|$)\")) && classCache(className, function (elem) {\n return pattern.test(typeof elem.className === \"string\" && elem.className || typeof elem.getAttribute !== \"undefined\" && elem.getAttribute(\"class\") || \"\");\n });\n },\n ATTR: function (name, operator, check) {\n return function (elem) {\n var result = find.attr(elem, name);\n if (result == null) {\n return operator === \"!=\";\n }\n if (!operator) {\n return true;\n }\n result += \"\";\n if (operator === \"=\") {\n return result === check;\n }\n if (operator === \"!=\") {\n return result !== check;\n }\n if (operator === \"^=\") {\n return check && result.indexOf(check) === 0;\n }\n if (operator === \"*=\") {\n return check && result.indexOf(check) > -1;\n }\n if (operator === \"$=\") {\n return check && result.slice(-check.length) === check;\n }\n if (operator === \"~=\") {\n return (\" \" + result.replace(rwhitespace, \" \") + \" \").indexOf(check) > -1;\n }\n if (operator === \"|=\") {\n return result === check || result.slice(0, check.length + 1) === check + \"-\";\n }\n return false;\n };\n },\n CHILD: function (type, what, _argument, first, last) {\n var simple = type.slice(0, 3) !== \"nth\",\n forward = type.slice(-4) !== \"last\",\n ofType = what === \"of-type\";\n return first === 1 && last === 0 ?\n // Shortcut for :nth-*(n)\n function (elem) {\n return !!elem.parentNode;\n } : function (elem, _context, xml) {\n var cache,\n outerCache,\n node,\n nodeIndex,\n start,\n dir = simple !== forward ? \"nextSibling\" : \"previousSibling\",\n parent = elem.parentNode,\n name = ofType && elem.nodeName.toLowerCase(),\n useCache = !xml && !ofType,\n diff = false;\n if (parent) {\n // :(first|last|only)-(child|of-type)\n if (simple) {\n while (dir) {\n node = elem;\n while (node = node[dir]) {\n if (ofType ? nodeName(node, name) : node.nodeType === 1) {\n return false;\n }\n }\n\n // Reverse direction for :only-* (if we haven't yet done so)\n start = dir = type === \"only\" && !start && \"nextSibling\";\n }\n return true;\n }\n start = [forward ? parent.firstChild : parent.lastChild];\n\n // non-xml :nth-child(...) stores cache data on `parent`\n if (forward && useCache) {\n // Seek `elem` from a previously-cached index\n outerCache = parent[expando] || (parent[expando] = {});\n cache = outerCache[type] || [];\n nodeIndex = cache[0] === dirruns && cache[1];\n diff = nodeIndex && cache[2];\n node = nodeIndex && parent.childNodes[nodeIndex];\n while (node = ++nodeIndex && node && node[dir] || (\n // Fallback to seeking `elem` from the start\n diff = nodeIndex = 0) || start.pop()) {\n // When found, cache indexes on `parent` and break\n if (node.nodeType === 1 && ++diff && node === elem) {\n outerCache[type] = [dirruns, nodeIndex, diff];\n break;\n }\n }\n } else {\n // Use previously-cached element index if available\n if (useCache) {\n outerCache = elem[expando] || (elem[expando] = {});\n cache = outerCache[type] || [];\n nodeIndex = cache[0] === dirruns && cache[1];\n diff = nodeIndex;\n }\n\n // xml :nth-child(...)\n // or :nth-last-child(...) or :nth(-last)?-of-type(...)\n if (diff === false) {\n // Use the same loop as above to seek `elem` from the start\n while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) {\n if ((ofType ? nodeName(node, name) : node.nodeType === 1) && ++diff) {\n // Cache the index of each encountered element\n if (useCache) {\n outerCache = node[expando] || (node[expando] = {});\n outerCache[type] = [dirruns, diff];\n }\n if (node === elem) {\n break;\n }\n }\n }\n }\n }\n\n // Incorporate the offset, then check against cycle size\n diff -= last;\n return diff === first || diff % first === 0 && diff / first >= 0;\n }\n };\n },\n PSEUDO: function (pseudo, argument) {\n // pseudo-class names are case-insensitive\n // https://www.w3.org/TR/selectors/#pseudo-classes\n // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters\n // Remember that setFilters inherits from pseudos\n var args,\n fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || find.error(\"unsupported pseudo: \" + pseudo);\n\n // The user may use createPseudo to indicate that\n // arguments are needed to create the filter function\n // just as jQuery does\n if (fn[expando]) {\n return fn(argument);\n }\n\n // But maintain support for old signatures\n if (fn.length > 1) {\n args = [pseudo, pseudo, \"\", argument];\n return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function (seed, matches) {\n var idx,\n matched = fn(seed, argument),\n i = matched.length;\n while (i--) {\n idx = indexOf.call(seed, matched[i]);\n seed[idx] = !(matches[idx] = matched[i]);\n }\n }) : function (elem) {\n return fn(elem, 0, args);\n };\n }\n return fn;\n }\n },\n pseudos: {\n // Potentially complex pseudos\n not: markFunction(function (selector) {\n // Trim the selector passed to compile\n // to avoid treating leading and trailing\n // spaces as combinators\n var input = [],\n results = [],\n matcher = compile(selector.replace(rtrimCSS, \"$1\"));\n return matcher[expando] ? markFunction(function (seed, matches, _context, xml) {\n var elem,\n unmatched = matcher(seed, null, xml, []),\n i = seed.length;\n\n // Match elements unmatched by `matcher`\n while (i--) {\n if (elem = unmatched[i]) {\n seed[i] = !(matches[i] = elem);\n }\n }\n }) : function (elem, _context, xml) {\n input[0] = elem;\n matcher(input, null, xml, results);\n\n // Don't keep the element\n // (see https://github.com/jquery/sizzle/issues/299)\n input[0] = null;\n return !results.pop();\n };\n }),\n has: markFunction(function (selector) {\n return function (elem) {\n return find(selector, elem).length > 0;\n };\n }),\n contains: markFunction(function (text) {\n text = text.replace(runescape, funescape);\n return function (elem) {\n return (elem.textContent || jQuery.text(elem)).indexOf(text) > -1;\n };\n }),\n // \"Whether an element is represented by a :lang() selector\n // is based solely on the element's language value\n // being equal to the identifier C,\n // or beginning with the identifier C immediately followed by \"-\".\n // The matching of C against the element's language value is performed case-insensitively.\n // The identifier C does not have to be a valid language name.\"\n // https://www.w3.org/TR/selectors/#lang-pseudo\n lang: markFunction(function (lang) {\n // lang value must be a valid identifier\n if (!ridentifier.test(lang || \"\")) {\n find.error(\"unsupported lang: \" + lang);\n }\n lang = lang.replace(runescape, funescape).toLowerCase();\n return function (elem) {\n var elemLang;\n do {\n if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute(\"xml:lang\") || elem.getAttribute(\"lang\")) {\n elemLang = elemLang.toLowerCase();\n return elemLang === lang || elemLang.indexOf(lang + \"-\") === 0;\n }\n } while ((elem = elem.parentNode) && elem.nodeType === 1);\n return false;\n };\n }),\n // Miscellaneous\n target: function (elem) {\n var hash = window.location && window.location.hash;\n return hash && hash.slice(1) === elem.id;\n },\n root: function (elem) {\n return elem === documentElement;\n },\n focus: function (elem) {\n return elem === safeActiveElement() && document.hasFocus() && !!(elem.type || elem.href || ~elem.tabIndex);\n },\n // Boolean properties\n enabled: createDisabledPseudo(false),\n disabled: createDisabledPseudo(true),\n checked: function (elem) {\n // In CSS3, :checked should return both checked and selected elements\n // https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked\n return nodeName(elem, \"input\") && !!elem.checked || nodeName(elem, \"option\") && !!elem.selected;\n },\n selected: function (elem) {\n // Support: IE <=11+\n // Accessing the selectedIndex property\n // forces the browser to treat the default option as\n // selected when in an optgroup.\n if (elem.parentNode) {\n // eslint-disable-next-line no-unused-expressions\n elem.parentNode.selectedIndex;\n }\n return elem.selected === true;\n },\n // Contents\n empty: function (elem) {\n // https://www.w3.org/TR/selectors/#empty-pseudo\n // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),\n // but not by others (comment: 8; processing instruction: 7; etc.)\n // nodeType < 6 works because attributes (2) do not appear as children\n for (elem = elem.firstChild; elem; elem = elem.nextSibling) {\n if (elem.nodeType < 6) {\n return false;\n }\n }\n return true;\n },\n parent: function (elem) {\n return !Expr.pseudos.empty(elem);\n },\n // Element/input types\n header: function (elem) {\n return rheader.test(elem.nodeName);\n },\n input: function (elem) {\n return rinputs.test(elem.nodeName);\n },\n button: function (elem) {\n return nodeName(elem, \"input\") && elem.type === \"button\" || nodeName(elem, \"button\");\n },\n text: function (elem) {\n var attr;\n return nodeName(elem, \"input\") && elem.type === \"text\" && (\n // Support: IE <10 only\n // New HTML5 attribute values (e.g., \"search\") appear\n // with elem.type === \"text\"\n (attr = elem.getAttribute(\"type\")) == null || attr.toLowerCase() === \"text\");\n },\n // Position-in-collection\n first: createPositionalPseudo(function () {\n return [0];\n }),\n last: createPositionalPseudo(function (_matchIndexes, length) {\n return [length - 1];\n }),\n eq: createPositionalPseudo(function (_matchIndexes, length, argument) {\n return [argument < 0 ? argument + length : argument];\n }),\n even: createPositionalPseudo(function (matchIndexes, length) {\n var i = 0;\n for (; i < length; i += 2) {\n matchIndexes.push(i);\n }\n return matchIndexes;\n }),\n odd: createPositionalPseudo(function (matchIndexes, length) {\n var i = 1;\n for (; i < length; i += 2) {\n matchIndexes.push(i);\n }\n return matchIndexes;\n }),\n lt: createPositionalPseudo(function (matchIndexes, length, argument) {\n var i;\n if (argument < 0) {\n i = argument + length;\n } else if (argument > length) {\n i = length;\n } else {\n i = argument;\n }\n for (; --i >= 0;) {\n matchIndexes.push(i);\n }\n return matchIndexes;\n }),\n gt: createPositionalPseudo(function (matchIndexes, length, argument) {\n var i = argument < 0 ? argument + length : argument;\n for (; ++i < length;) {\n matchIndexes.push(i);\n }\n return matchIndexes;\n })\n }\n };\n Expr.pseudos.nth = Expr.pseudos.eq;\n\n // Add button/input type pseudos\n for (i in {\n radio: true,\n checkbox: true,\n file: true,\n password: true,\n image: true\n }) {\n Expr.pseudos[i] = createInputPseudo(i);\n }\n for (i in {\n submit: true,\n reset: true\n }) {\n Expr.pseudos[i] = createButtonPseudo(i);\n }\n\n // Easy API for creating new setFilters\n function setFilters() {}\n setFilters.prototype = Expr.filters = Expr.pseudos;\n Expr.setFilters = new setFilters();\n function tokenize(selector, parseOnly) {\n var matched,\n match,\n tokens,\n type,\n soFar,\n groups,\n preFilters,\n cached = tokenCache[selector + \" \"];\n if (cached) {\n return parseOnly ? 0 : cached.slice(0);\n }\n soFar = selector;\n groups = [];\n preFilters = Expr.preFilter;\n while (soFar) {\n // Comma and first run\n if (!matched || (match = rcomma.exec(soFar))) {\n if (match) {\n // Don't consume trailing commas as valid\n soFar = soFar.slice(match[0].length) || soFar;\n }\n groups.push(tokens = []);\n }\n matched = false;\n\n // Combinators\n if (match = rleadingCombinator.exec(soFar)) {\n matched = match.shift();\n tokens.push({\n value: matched,\n // Cast descendant combinators to space\n type: match[0].replace(rtrimCSS, \" \")\n });\n soFar = soFar.slice(matched.length);\n }\n\n // Filters\n for (type in Expr.filter) {\n if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) {\n matched = match.shift();\n tokens.push({\n value: matched,\n type: type,\n matches: match\n });\n soFar = soFar.slice(matched.length);\n }\n }\n if (!matched) {\n break;\n }\n }\n\n // Return the length of the invalid excess\n // if we're just parsing\n // Otherwise, throw an error or return tokens\n if (parseOnly) {\n return soFar.length;\n }\n return soFar ? find.error(selector) :\n // Cache the tokens\n tokenCache(selector, groups).slice(0);\n }\n function toSelector(tokens) {\n var i = 0,\n len = tokens.length,\n selector = \"\";\n for (; i < len; i++) {\n selector += tokens[i].value;\n }\n return selector;\n }\n function addCombinator(matcher, combinator, base) {\n var dir = combinator.dir,\n skip = combinator.next,\n key = skip || dir,\n checkNonElements = base && key === \"parentNode\",\n doneName = done++;\n return combinator.first ?\n // Check against closest ancestor/preceding element\n function (elem, context, xml) {\n while (elem = elem[dir]) {\n if (elem.nodeType === 1 || checkNonElements) {\n return matcher(elem, context, xml);\n }\n }\n return false;\n } :\n // Check against all ancestor/preceding elements\n function (elem, context, xml) {\n var oldCache,\n outerCache,\n newCache = [dirruns, doneName];\n\n // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching\n if (xml) {\n while (elem = elem[dir]) {\n if (elem.nodeType === 1 || checkNonElements) {\n if (matcher(elem, context, xml)) {\n return true;\n }\n }\n }\n } else {\n while (elem = elem[dir]) {\n if (elem.nodeType === 1 || checkNonElements) {\n outerCache = elem[expando] || (elem[expando] = {});\n if (skip && nodeName(elem, skip)) {\n elem = elem[dir] || elem;\n } else if ((oldCache = outerCache[key]) && oldCache[0] === dirruns && oldCache[1] === doneName) {\n // Assign to newCache so results back-propagate to previous elements\n return newCache[2] = oldCache[2];\n } else {\n // Reuse newcache so results back-propagate to previous elements\n outerCache[key] = newCache;\n\n // A match means we're done; a fail means we have to keep checking\n if (newCache[2] = matcher(elem, context, xml)) {\n return true;\n }\n }\n }\n }\n }\n return false;\n };\n }\n function elementMatcher(matchers) {\n return matchers.length > 1 ? function (elem, context, xml) {\n var i = matchers.length;\n while (i--) {\n if (!matchers[i](elem, context, xml)) {\n return false;\n }\n }\n return true;\n } : matchers[0];\n }\n function multipleContexts(selector, contexts, results) {\n var i = 0,\n len = contexts.length;\n for (; i < len; i++) {\n find(selector, contexts[i], results);\n }\n return results;\n }\n function condense(unmatched, map, filter, context, xml) {\n var elem,\n newUnmatched = [],\n i = 0,\n len = unmatched.length,\n mapped = map != null;\n for (; i < len; i++) {\n if (elem = unmatched[i]) {\n if (!filter || filter(elem, context, xml)) {\n newUnmatched.push(elem);\n if (mapped) {\n map.push(i);\n }\n }\n }\n }\n return newUnmatched;\n }\n function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {\n if (postFilter && !postFilter[expando]) {\n postFilter = setMatcher(postFilter);\n }\n if (postFinder && !postFinder[expando]) {\n postFinder = setMatcher(postFinder, postSelector);\n }\n return markFunction(function (seed, results, context, xml) {\n var temp,\n i,\n elem,\n matcherOut,\n preMap = [],\n postMap = [],\n preexisting = results.length,\n // Get initial elements from seed or context\n elems = seed || multipleContexts(selector || \"*\", context.nodeType ? [context] : context, []),\n // Prefilter to get matcher input, preserving a map for seed-results synchronization\n matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems;\n if (matcher) {\n // If we have a postFinder, or filtered seed, or non-seed postFilter\n // or preexisting results,\n matcherOut = postFinder || (seed ? preFilter : preexisting || postFilter) ?\n // ...intermediate processing is necessary\n [] :\n // ...otherwise use results directly\n results;\n\n // Find primary matches\n matcher(matcherIn, matcherOut, context, xml);\n } else {\n matcherOut = matcherIn;\n }\n\n // Apply postFilter\n if (postFilter) {\n temp = condense(matcherOut, postMap);\n postFilter(temp, [], context, xml);\n\n // Un-match failing elements by moving them back to matcherIn\n i = temp.length;\n while (i--) {\n if (elem = temp[i]) {\n matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);\n }\n }\n }\n if (seed) {\n if (postFinder || preFilter) {\n if (postFinder) {\n // Get the final matcherOut by condensing this intermediate into postFinder contexts\n temp = [];\n i = matcherOut.length;\n while (i--) {\n if (elem = matcherOut[i]) {\n // Restore matcherIn since elem is not yet a final match\n temp.push(matcherIn[i] = elem);\n }\n }\n postFinder(null, matcherOut = [], temp, xml);\n }\n\n // Move matched elements from seed to results to keep them synchronized\n i = matcherOut.length;\n while (i--) {\n if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf.call(seed, elem) : preMap[i]) > -1) {\n seed[temp] = !(results[temp] = elem);\n }\n }\n }\n\n // Add elements to results, through postFinder if defined\n } else {\n matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut);\n if (postFinder) {\n postFinder(null, results, matcherOut, xml);\n } else {\n push.apply(results, matcherOut);\n }\n }\n });\n }\n function matcherFromTokens(tokens) {\n var checkContext,\n matcher,\n j,\n len = tokens.length,\n leadingRelative = Expr.relative[tokens[0].type],\n implicitRelative = leadingRelative || Expr.relative[\" \"],\n i = leadingRelative ? 1 : 0,\n // The foundational matcher ensures that elements are reachable from top-level context(s)\n matchContext = addCombinator(function (elem) {\n return elem === checkContext;\n }, implicitRelative, true),\n matchAnyContext = addCombinator(function (elem) {\n return indexOf.call(checkContext, elem) > -1;\n }, implicitRelative, true),\n matchers = [function (elem, context, xml) {\n // Support: IE 11+, Edge 17 - 18+\n // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n // two documents; shallow comparisons work.\n // eslint-disable-next-line eqeqeq\n var ret = !leadingRelative && (xml || context != outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));\n\n // Avoid hanging onto element\n // (see https://github.com/jquery/sizzle/issues/299)\n checkContext = null;\n return ret;\n }];\n for (; i < len; i++) {\n if (matcher = Expr.relative[tokens[i].type]) {\n matchers = [addCombinator(elementMatcher(matchers), matcher)];\n } else {\n matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);\n\n // Return special upon seeing a positional matcher\n if (matcher[expando]) {\n // Find the next relative operator (if any) for proper handling\n j = ++i;\n for (; j < len; j++) {\n if (Expr.relative[tokens[j].type]) {\n break;\n }\n }\n return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(\n // If the preceding token was a descendant combinator, insert an implicit any-element `*`\n tokens.slice(0, i - 1).concat({\n value: tokens[i - 2].type === \" \" ? \"*\" : \"\"\n })).replace(rtrimCSS, \"$1\"), matcher, i < j && matcherFromTokens(tokens.slice(i, j)), j < len && matcherFromTokens(tokens = tokens.slice(j)), j < len && toSelector(tokens));\n }\n matchers.push(matcher);\n }\n }\n return elementMatcher(matchers);\n }\n function matcherFromGroupMatchers(elementMatchers, setMatchers) {\n var bySet = setMatchers.length > 0,\n byElement = elementMatchers.length > 0,\n superMatcher = function (seed, context, xml, results, outermost) {\n var elem,\n j,\n matcher,\n matchedCount = 0,\n i = \"0\",\n unmatched = seed && [],\n setMatched = [],\n contextBackup = outermostContext,\n // We must always have either seed elements or outermost context\n elems = seed || byElement && Expr.find.TAG(\"*\", outermost),\n // Use integer dirruns iff this is the outermost matcher\n dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1,\n len = elems.length;\n if (outermost) {\n // Support: IE 11+, Edge 17 - 18+\n // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n // two documents; shallow comparisons work.\n // eslint-disable-next-line eqeqeq\n outermostContext = context == document || context || outermost;\n }\n\n // Add elements passing elementMatchers directly to results\n // Support: iOS <=7 - 9 only\n // Tolerate NodeList properties (IE: \"length\"; Safari: ) matching\n // elements by id. (see trac-14142)\n for (; i !== len && (elem = elems[i]) != null; i++) {\n if (byElement && elem) {\n j = 0;\n\n // Support: IE 11+, Edge 17 - 18+\n // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n // two documents; shallow comparisons work.\n // eslint-disable-next-line eqeqeq\n if (!context && elem.ownerDocument != document) {\n setDocument(elem);\n xml = !documentIsHTML;\n }\n while (matcher = elementMatchers[j++]) {\n if (matcher(elem, context || document, xml)) {\n push.call(results, elem);\n break;\n }\n }\n if (outermost) {\n dirruns = dirrunsUnique;\n }\n }\n\n // Track unmatched elements for set filters\n if (bySet) {\n // They will have gone through all possible matchers\n if (elem = !matcher && elem) {\n matchedCount--;\n }\n\n // Lengthen the array for every element, matched or not\n if (seed) {\n unmatched.push(elem);\n }\n }\n }\n\n // `i` is now the count of elements visited above, and adding it to `matchedCount`\n // makes the latter nonnegative.\n matchedCount += i;\n\n // Apply set filters to unmatched elements\n // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`\n // equals `i`), unless we didn't visit _any_ elements in the above loop because we have\n // no element matchers and no seed.\n // Incrementing an initially-string \"0\" `i` allows `i` to remain a string only in that\n // case, which will result in a \"00\" `matchedCount` that differs from `i` but is also\n // numerically zero.\n if (bySet && i !== matchedCount) {\n j = 0;\n while (matcher = setMatchers[j++]) {\n matcher(unmatched, setMatched, context, xml);\n }\n if (seed) {\n // Reintegrate element matches to eliminate the need for sorting\n if (matchedCount > 0) {\n while (i--) {\n if (!(unmatched[i] || setMatched[i])) {\n setMatched[i] = pop.call(results);\n }\n }\n }\n\n // Discard index placeholder values to get only actual matches\n setMatched = condense(setMatched);\n }\n\n // Add matches to results\n push.apply(results, setMatched);\n\n // Seedless set matches succeeding multiple successful matchers stipulate sorting\n if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) {\n jQuery.uniqueSort(results);\n }\n }\n\n // Override manipulation of globals by nested matchers\n if (outermost) {\n dirruns = dirrunsUnique;\n outermostContext = contextBackup;\n }\n return unmatched;\n };\n return bySet ? markFunction(superMatcher) : superMatcher;\n }\n function compile(selector, match /* Internal Use Only */) {\n var i,\n setMatchers = [],\n elementMatchers = [],\n cached = compilerCache[selector + \" \"];\n if (!cached) {\n // Generate a function of recursive functions that can be used to check each element\n if (!match) {\n match = tokenize(selector);\n }\n i = match.length;\n while (i--) {\n cached = matcherFromTokens(match[i]);\n if (cached[expando]) {\n setMatchers.push(cached);\n } else {\n elementMatchers.push(cached);\n }\n }\n\n // Cache the compiled function\n cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));\n\n // Save selector and tokenization\n cached.selector = selector;\n }\n return cached;\n }\n\n /**\n * A low-level selection function that works with jQuery's compiled\n * selector functions\n * @param {String|Function} selector A selector or a pre-compiled\n * selector function built with jQuery selector compile\n * @param {Element} context\n * @param {Array} [results]\n * @param {Array} [seed] A set of elements to match against\n */\n function select(selector, context, results, seed) {\n var i,\n tokens,\n token,\n type,\n find,\n compiled = typeof selector === \"function\" && selector,\n match = !seed && tokenize(selector = compiled.selector || selector);\n results = results || [];\n\n // Try to minimize operations if there is only one selector in the list and no seed\n // (the latter of which guarantees us context)\n if (match.length === 1) {\n // Reduce context if the leading compound selector is an ID\n tokens = match[0] = match[0].slice(0);\n if (tokens.length > 2 && (token = tokens[0]).type === \"ID\" && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {\n context = (Expr.find.ID(token.matches[0].replace(runescape, funescape), context) || [])[0];\n if (!context) {\n return results;\n\n // Precompiled matchers will still verify ancestry, so step up a level\n } else if (compiled) {\n context = context.parentNode;\n }\n selector = selector.slice(tokens.shift().value.length);\n }\n\n // Fetch a seed set for right-to-left matching\n i = matchExpr.needsContext.test(selector) ? 0 : tokens.length;\n while (i--) {\n token = tokens[i];\n\n // Abort if we hit a combinator\n if (Expr.relative[type = token.type]) {\n break;\n }\n if (find = Expr.find[type]) {\n // Search, expanding context for leading sibling combinators\n if (seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context)) {\n // If seed is empty or no tokens remain, we can return early\n tokens.splice(i, 1);\n selector = seed.length && toSelector(tokens);\n if (!selector) {\n push.apply(results, seed);\n return results;\n }\n break;\n }\n }\n }\n }\n\n // Compile and execute a filtering function if one is not provided\n // Provide `match` to avoid retokenization if we modified the selector above\n (compiled || compile(selector, match))(seed, context, !documentIsHTML, results, !context || rsibling.test(selector) && testContext(context.parentNode) || context);\n return results;\n }\n\n // One-time assignments\n\n // Support: Android <=4.0 - 4.1+\n // Sort stability\n support.sortStable = expando.split(\"\").sort(sortOrder).join(\"\") === expando;\n\n // Initialize against the default document\n setDocument();\n\n // Support: Android <=4.0 - 4.1+\n // Detached nodes confoundingly follow *each other*\n support.sortDetached = assert(function (el) {\n // Should return 1, but returns 4 (following)\n return el.compareDocumentPosition(document.createElement(\"fieldset\")) & 1;\n });\n jQuery.find = find;\n\n // Deprecated\n jQuery.expr[\":\"] = jQuery.expr.pseudos;\n jQuery.unique = jQuery.uniqueSort;\n\n // These have always been private, but they used to be documented\n // as part of Sizzle so let's maintain them in the 3.x line\n // for backwards compatibility purposes.\n find.compile = compile;\n find.select = select;\n find.setDocument = setDocument;\n find.escape = jQuery.escapeSelector;\n find.getText = jQuery.text;\n find.isXML = jQuery.isXMLDoc;\n find.selectors = jQuery.expr;\n find.support = jQuery.support;\n find.uniqueSort = jQuery.uniqueSort;\n\n /* eslint-enable */\n })();\n\n var dir = function (elem, dir, until) {\n var matched = [],\n truncate = until !== undefined;\n while ((elem = elem[dir]) && elem.nodeType !== 9) {\n if (elem.nodeType === 1) {\n if (truncate && jQuery(elem).is(until)) {\n break;\n }\n matched.push(elem);\n }\n }\n return matched;\n };\n var siblings = function (n, elem) {\n var matched = [];\n for (; n; n = n.nextSibling) {\n if (n.nodeType === 1 && n !== elem) {\n matched.push(n);\n }\n }\n return matched;\n };\n var rneedsContext = jQuery.expr.match.needsContext;\n var rsingleTag = /^<([a-z][^\\/\\0>:\\x20\\t\\r\\n\\f]*)[\\x20\\t\\r\\n\\f]*\\/?>(?:<\\/\\1>|)$/i;\n\n // Implement the identical functionality for filter and not\n function winnow(elements, qualifier, not) {\n if (isFunction(qualifier)) {\n return jQuery.grep(elements, function (elem, i) {\n return !!qualifier.call(elem, i, elem) !== not;\n });\n }\n\n // Single element\n if (qualifier.nodeType) {\n return jQuery.grep(elements, function (elem) {\n return elem === qualifier !== not;\n });\n }\n\n // Arraylike of elements (jQuery, arguments, Array)\n if (typeof qualifier !== \"string\") {\n return jQuery.grep(elements, function (elem) {\n return indexOf.call(qualifier, elem) > -1 !== not;\n });\n }\n\n // Filtered directly for both simple and complex selectors\n return jQuery.filter(qualifier, elements, not);\n }\n jQuery.filter = function (expr, elems, not) {\n var elem = elems[0];\n if (not) {\n expr = \":not(\" + expr + \")\";\n }\n if (elems.length === 1 && elem.nodeType === 1) {\n return jQuery.find.matchesSelector(elem, expr) ? [elem] : [];\n }\n return jQuery.find.matches(expr, jQuery.grep(elems, function (elem) {\n return elem.nodeType === 1;\n }));\n };\n jQuery.fn.extend({\n find: function (selector) {\n var i,\n ret,\n len = this.length,\n self = this;\n if (typeof selector !== \"string\") {\n return this.pushStack(jQuery(selector).filter(function () {\n for (i = 0; i < len; i++) {\n if (jQuery.contains(self[i], this)) {\n return true;\n }\n }\n }));\n }\n ret = this.pushStack([]);\n for (i = 0; i < len; i++) {\n jQuery.find(selector, self[i], ret);\n }\n return len > 1 ? jQuery.uniqueSort(ret) : ret;\n },\n filter: function (selector) {\n return this.pushStack(winnow(this, selector || [], false));\n },\n not: function (selector) {\n return this.pushStack(winnow(this, selector || [], true));\n },\n is: function (selector) {\n return !!winnow(this,\n // If this is a positional/relative selector, check membership in the returned set\n // so $(\"p:first\").is(\"p:last\") won't return true for a doc with two \"p\".\n typeof selector === \"string\" && rneedsContext.test(selector) ? jQuery(selector) : selector || [], false).length;\n }\n });\n\n // Initialize a jQuery object\n\n // A central reference to the root jQuery(document)\n var rootjQuery,\n // A simple way to check for HTML strings\n // Prioritize #id over to avoid XSS via location.hash (trac-9521)\n // Strict HTML recognition (trac-11290: must start with <)\n // Shortcut simple #id case for speed\n rquickExpr = /^(?:\\s*(<[\\w\\W]+>)[^>]*|#([\\w-]+))$/,\n init = jQuery.fn.init = function (selector, context, root) {\n var match, elem;\n\n // HANDLE: $(\"\"), $(null), $(undefined), $(false)\n if (!selector) {\n return this;\n }\n\n // Method init() accepts an alternate rootjQuery\n // so migrate can support jQuery.sub (gh-2101)\n root = root || rootjQuery;\n\n // Handle HTML strings\n if (typeof selector === \"string\") {\n if (selector[0] === \"<\" && selector[selector.length - 1] === \">\" && selector.length >= 3) {\n // Assume that strings that start and end with <> are HTML and skip the regex check\n match = [null, selector, null];\n } else {\n match = rquickExpr.exec(selector);\n }\n\n // Match html or make sure no context is specified for #id\n if (match && (match[1] || !context)) {\n // HANDLE: $(html) -> $(array)\n if (match[1]) {\n context = context instanceof jQuery ? context[0] : context;\n\n // Option to run scripts is true for back-compat\n // Intentionally let the error be thrown if parseHTML is not present\n jQuery.merge(this, jQuery.parseHTML(match[1], context && context.nodeType ? context.ownerDocument || context : document, true));\n\n // HANDLE: $(html, props)\n if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {\n for (match in context) {\n // Properties of context are called as methods if possible\n if (isFunction(this[match])) {\n this[match](context[match]);\n\n // ...and otherwise set as attributes\n } else {\n this.attr(match, context[match]);\n }\n }\n }\n return this;\n\n // HANDLE: $(#id)\n } else {\n elem = document.getElementById(match[2]);\n if (elem) {\n // Inject the element directly into the jQuery object\n this[0] = elem;\n this.length = 1;\n }\n return this;\n }\n\n // HANDLE: $(expr, $(...))\n } else if (!context || context.jquery) {\n return (context || root).find(selector);\n\n // HANDLE: $(expr, context)\n // (which is just equivalent to: $(context).find(expr)\n } else {\n return this.constructor(context).find(selector);\n }\n\n // HANDLE: $(DOMElement)\n } else if (selector.nodeType) {\n this[0] = selector;\n this.length = 1;\n return this;\n\n // HANDLE: $(function)\n // Shortcut for document ready\n } else if (isFunction(selector)) {\n return root.ready !== undefined ? root.ready(selector) :\n // Execute immediately if ready is not present\n selector(jQuery);\n }\n return jQuery.makeArray(selector, this);\n };\n\n // Give the init function the jQuery prototype for later instantiation\n init.prototype = jQuery.fn;\n\n // Initialize central reference\n rootjQuery = jQuery(document);\n var rparentsprev = /^(?:parents|prev(?:Until|All))/,\n // Methods guaranteed to produce a unique set when starting from a unique set\n guaranteedUnique = {\n children: true,\n contents: true,\n next: true,\n prev: true\n };\n jQuery.fn.extend({\n has: function (target) {\n var targets = jQuery(target, this),\n l = targets.length;\n return this.filter(function () {\n var i = 0;\n for (; i < l; i++) {\n if (jQuery.contains(this, targets[i])) {\n return true;\n }\n }\n });\n },\n closest: function (selectors, context) {\n var cur,\n i = 0,\n l = this.length,\n matched = [],\n targets = typeof selectors !== \"string\" && jQuery(selectors);\n\n // Positional selectors never match, since there's no _selection_ context\n if (!rneedsContext.test(selectors)) {\n for (; i < l; i++) {\n for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {\n // Always skip document fragments\n if (cur.nodeType < 11 && (targets ? targets.index(cur) > -1 :\n // Don't pass non-elements to jQuery#find\n cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors))) {\n matched.push(cur);\n break;\n }\n }\n }\n }\n return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched);\n },\n // Determine the position of an element within the set\n index: function (elem) {\n // No argument, return index in parent\n if (!elem) {\n return this[0] && this[0].parentNode ? this.first().prevAll().length : -1;\n }\n\n // Index in selector\n if (typeof elem === \"string\") {\n return indexOf.call(jQuery(elem), this[0]);\n }\n\n // Locate the position of the desired element\n return indexOf.call(this,\n // If it receives a jQuery object, the first element is used\n elem.jquery ? elem[0] : elem);\n },\n add: function (selector, context) {\n return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(), jQuery(selector, context))));\n },\n addBack: function (selector) {\n return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector));\n }\n });\n function sibling(cur, dir) {\n while ((cur = cur[dir]) && cur.nodeType !== 1) {}\n return cur;\n }\n jQuery.each({\n parent: function (elem) {\n var parent = elem.parentNode;\n return parent && parent.nodeType !== 11 ? parent : null;\n },\n parents: function (elem) {\n return dir(elem, \"parentNode\");\n },\n parentsUntil: function (elem, _i, until) {\n return dir(elem, \"parentNode\", until);\n },\n next: function (elem) {\n return sibling(elem, \"nextSibling\");\n },\n prev: function (elem) {\n return sibling(elem, \"previousSibling\");\n },\n nextAll: function (elem) {\n return dir(elem, \"nextSibling\");\n },\n prevAll: function (elem) {\n return dir(elem, \"previousSibling\");\n },\n nextUntil: function (elem, _i, until) {\n return dir(elem, \"nextSibling\", until);\n },\n prevUntil: function (elem, _i, until) {\n return dir(elem, \"previousSibling\", until);\n },\n siblings: function (elem) {\n return siblings((elem.parentNode || {}).firstChild, elem);\n },\n children: function (elem) {\n return siblings(elem.firstChild);\n },\n contents: function (elem) {\n if (elem.contentDocument != null &&\n // Support: IE 11+\n // elements with no `data` attribute has an object\n // `contentDocument` with a `null` prototype.\n getProto(elem.contentDocument)) {\n return elem.contentDocument;\n }\n\n // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only\n // Treat the template element as a regular one in browsers that\n // don't support it.\n if (nodeName(elem, \"template\")) {\n elem = elem.content || elem;\n }\n return jQuery.merge([], elem.childNodes);\n }\n }, function (name, fn) {\n jQuery.fn[name] = function (until, selector) {\n var matched = jQuery.map(this, fn, until);\n if (name.slice(-5) !== \"Until\") {\n selector = until;\n }\n if (selector && typeof selector === \"string\") {\n matched = jQuery.filter(selector, matched);\n }\n if (this.length > 1) {\n // Remove duplicates\n if (!guaranteedUnique[name]) {\n jQuery.uniqueSort(matched);\n }\n\n // Reverse order for parents* and prev-derivatives\n if (rparentsprev.test(name)) {\n matched.reverse();\n }\n }\n return this.pushStack(matched);\n };\n });\n var rnothtmlwhite = /[^\\x20\\t\\r\\n\\f]+/g;\n\n // Convert String-formatted options into Object-formatted ones\n function createOptions(options) {\n var object = {};\n jQuery.each(options.match(rnothtmlwhite) || [], function (_, flag) {\n object[flag] = true;\n });\n return object;\n }\n\n /*\n * Create a callback list using the following parameters:\n *\n *\toptions: an optional list of space-separated options that will change how\n *\t\t\tthe callback list behaves or a more traditional option object\n *\n * By default a callback list will act like an event callback list and can be\n * \"fired\" multiple times.\n *\n * Possible options:\n *\n *\tonce:\t\t\twill ensure the callback list can only be fired once (like a Deferred)\n *\n *\tmemory:\t\t\twill keep track of previous values and will call any callback added\n *\t\t\t\t\tafter the list has been fired right away with the latest \"memorized\"\n *\t\t\t\t\tvalues (like a Deferred)\n *\n *\tunique:\t\t\twill ensure a callback can only be added once (no duplicate in the list)\n *\n *\tstopOnFalse:\tinterrupt callings when a callback returns false\n *\n */\n jQuery.Callbacks = function (options) {\n // Convert options from String-formatted to Object-formatted if needed\n // (we check in cache first)\n options = typeof options === \"string\" ? createOptions(options) : jQuery.extend({}, options);\n var\n // Flag to know if list is currently firing\n firing,\n // Last fire value for non-forgettable lists\n memory,\n // Flag to know if list was already fired\n fired,\n // Flag to prevent firing\n locked,\n // Actual callback list\n list = [],\n // Queue of execution data for repeatable lists\n queue = [],\n // Index of currently firing callback (modified by add/remove as needed)\n firingIndex = -1,\n // Fire callbacks\n fire = function () {\n // Enforce single-firing\n locked = locked || options.once;\n\n // Execute callbacks for all pending executions,\n // respecting firingIndex overrides and runtime changes\n fired = firing = true;\n for (; queue.length; firingIndex = -1) {\n memory = queue.shift();\n while (++firingIndex < list.length) {\n // Run callback and check for early termination\n if (list[firingIndex].apply(memory[0], memory[1]) === false && options.stopOnFalse) {\n // Jump to end and forget the data so .add doesn't re-fire\n firingIndex = list.length;\n memory = false;\n }\n }\n }\n\n // Forget the data if we're done with it\n if (!options.memory) {\n memory = false;\n }\n firing = false;\n\n // Clean up if we're done firing for good\n if (locked) {\n // Keep an empty list if we have data for future add calls\n if (memory) {\n list = [];\n\n // Otherwise, this object is spent\n } else {\n list = \"\";\n }\n }\n },\n // Actual Callbacks object\n self = {\n // Add a callback or a collection of callbacks to the list\n add: function () {\n if (list) {\n // If we have memory from a past run, we should fire after adding\n if (memory && !firing) {\n firingIndex = list.length - 1;\n queue.push(memory);\n }\n (function add(args) {\n jQuery.each(args, function (_, arg) {\n if (isFunction(arg)) {\n if (!options.unique || !self.has(arg)) {\n list.push(arg);\n }\n } else if (arg && arg.length && toType(arg) !== \"string\") {\n // Inspect recursively\n add(arg);\n }\n });\n })(arguments);\n if (memory && !firing) {\n fire();\n }\n }\n return this;\n },\n // Remove a callback from the list\n remove: function () {\n jQuery.each(arguments, function (_, arg) {\n var index;\n while ((index = jQuery.inArray(arg, list, index)) > -1) {\n list.splice(index, 1);\n\n // Handle firing indexes\n if (index <= firingIndex) {\n firingIndex--;\n }\n }\n });\n return this;\n },\n // Check if a given callback is in the list.\n // If no argument is given, return whether or not list has callbacks attached.\n has: function (fn) {\n return fn ? jQuery.inArray(fn, list) > -1 : list.length > 0;\n },\n // Remove all callbacks from the list\n empty: function () {\n if (list) {\n list = [];\n }\n return this;\n },\n // Disable .fire and .add\n // Abort any current/pending executions\n // Clear all callbacks and values\n disable: function () {\n locked = queue = [];\n list = memory = \"\";\n return this;\n },\n disabled: function () {\n return !list;\n },\n // Disable .fire\n // Also disable .add unless we have memory (since it would have no effect)\n // Abort any pending executions\n lock: function () {\n locked = queue = [];\n if (!memory && !firing) {\n list = memory = \"\";\n }\n return this;\n },\n locked: function () {\n return !!locked;\n },\n // Call all callbacks with the given context and arguments\n fireWith: function (context, args) {\n if (!locked) {\n args = args || [];\n args = [context, args.slice ? args.slice() : args];\n queue.push(args);\n if (!firing) {\n fire();\n }\n }\n return this;\n },\n // Call all the callbacks with the given arguments\n fire: function () {\n self.fireWith(this, arguments);\n return this;\n },\n // To know if the callbacks have already been called at least once\n fired: function () {\n return !!fired;\n }\n };\n return self;\n };\n function Identity(v) {\n return v;\n }\n function Thrower(ex) {\n throw ex;\n }\n function adoptValue(value, resolve, reject, noValue) {\n var method;\n try {\n // Check for promise aspect first to privilege synchronous behavior\n if (value && isFunction(method = value.promise)) {\n method.call(value).done(resolve).fail(reject);\n\n // Other thenables\n } else if (value && isFunction(method = value.then)) {\n method.call(value, resolve, reject);\n\n // Other non-thenables\n } else {\n // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:\n // * false: [ value ].slice( 0 ) => resolve( value )\n // * true: [ value ].slice( 1 ) => resolve()\n resolve.apply(undefined, [value].slice(noValue));\n }\n\n // For Promises/A+, convert exceptions into rejections\n // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in\n // Deferred#then to conditionally suppress rejection.\n } catch (value) {\n // Support: Android 4.0 only\n // Strict mode functions invoked without .call/.apply get global-object context\n reject.apply(undefined, [value]);\n }\n }\n jQuery.extend({\n Deferred: function (func) {\n var tuples = [\n // action, add listener, callbacks,\n // ... .then handlers, argument index, [final state]\n [\"notify\", \"progress\", jQuery.Callbacks(\"memory\"), jQuery.Callbacks(\"memory\"), 2], [\"resolve\", \"done\", jQuery.Callbacks(\"once memory\"), jQuery.Callbacks(\"once memory\"), 0, \"resolved\"], [\"reject\", \"fail\", jQuery.Callbacks(\"once memory\"), jQuery.Callbacks(\"once memory\"), 1, \"rejected\"]],\n state = \"pending\",\n promise = {\n state: function () {\n return state;\n },\n always: function () {\n deferred.done(arguments).fail(arguments);\n return this;\n },\n \"catch\": function (fn) {\n return promise.then(null, fn);\n },\n // Keep pipe for back-compat\n pipe: function /* fnDone, fnFail, fnProgress */\n () {\n var fns = arguments;\n return jQuery.Deferred(function (newDefer) {\n jQuery.each(tuples, function (_i, tuple) {\n // Map tuples (progress, done, fail) to arguments (done, fail, progress)\n var fn = isFunction(fns[tuple[4]]) && fns[tuple[4]];\n\n // deferred.progress(function() { bind to newDefer or newDefer.notify })\n // deferred.done(function() { bind to newDefer or newDefer.resolve })\n // deferred.fail(function() { bind to newDefer or newDefer.reject })\n deferred[tuple[1]](function () {\n var returned = fn && fn.apply(this, arguments);\n if (returned && isFunction(returned.promise)) {\n returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject);\n } else {\n newDefer[tuple[0] + \"With\"](this, fn ? [returned] : arguments);\n }\n });\n });\n fns = null;\n }).promise();\n },\n then: function (onFulfilled, onRejected, onProgress) {\n var maxDepth = 0;\n function resolve(depth, deferred, handler, special) {\n return function () {\n var that = this,\n args = arguments,\n mightThrow = function () {\n var returned, then;\n\n // Support: Promises/A+ section 2.3.3.3.3\n // https://promisesaplus.com/#point-59\n // Ignore double-resolution attempts\n if (depth < maxDepth) {\n return;\n }\n returned = handler.apply(that, args);\n\n // Support: Promises/A+ section 2.3.1\n // https://promisesaplus.com/#point-48\n if (returned === deferred.promise()) {\n throw new TypeError(\"Thenable self-resolution\");\n }\n\n // Support: Promises/A+ sections 2.3.3.1, 3.5\n // https://promisesaplus.com/#point-54\n // https://promisesaplus.com/#point-75\n // Retrieve `then` only once\n then = returned && (\n // Support: Promises/A+ section 2.3.4\n // https://promisesaplus.com/#point-64\n // Only check objects and functions for thenability\n typeof returned === \"object\" || typeof returned === \"function\") && returned.then;\n\n // Handle a returned thenable\n if (isFunction(then)) {\n // Special processors (notify) just wait for resolution\n if (special) {\n then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special));\n\n // Normal processors (resolve) also hook into progress\n } else {\n // ...and disregard older resolution values\n maxDepth++;\n then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special), resolve(maxDepth, deferred, Identity, deferred.notifyWith));\n }\n\n // Handle all other returned values\n } else {\n // Only substitute handlers pass on context\n // and multiple values (non-spec behavior)\n if (handler !== Identity) {\n that = undefined;\n args = [returned];\n }\n\n // Process the value(s)\n // Default process is resolve\n (special || deferred.resolveWith)(that, args);\n }\n },\n // Only normal processors (resolve) catch and reject exceptions\n process = special ? mightThrow : function () {\n try {\n mightThrow();\n } catch (e) {\n if (jQuery.Deferred.exceptionHook) {\n jQuery.Deferred.exceptionHook(e, process.error);\n }\n\n // Support: Promises/A+ section 2.3.3.3.4.1\n // https://promisesaplus.com/#point-61\n // Ignore post-resolution exceptions\n if (depth + 1 >= maxDepth) {\n // Only substitute handlers pass on context\n // and multiple values (non-spec behavior)\n if (handler !== Thrower) {\n that = undefined;\n args = [e];\n }\n deferred.rejectWith(that, args);\n }\n }\n };\n\n // Support: Promises/A+ section 2.3.3.3.1\n // https://promisesaplus.com/#point-57\n // Re-resolve promises immediately to dodge false rejection from\n // subsequent errors\n if (depth) {\n process();\n } else {\n // Call an optional hook to record the error, in case of exception\n // since it's otherwise lost when execution goes async\n if (jQuery.Deferred.getErrorHook) {\n process.error = jQuery.Deferred.getErrorHook();\n\n // The deprecated alias of the above. While the name suggests\n // returning the stack, not an error instance, jQuery just passes\n // it directly to `console.warn` so both will work; an instance\n // just better cooperates with source maps.\n } else if (jQuery.Deferred.getStackHook) {\n process.error = jQuery.Deferred.getStackHook();\n }\n window.setTimeout(process);\n }\n };\n }\n return jQuery.Deferred(function (newDefer) {\n // progress_handlers.add( ... )\n tuples[0][3].add(resolve(0, newDefer, isFunction(onProgress) ? onProgress : Identity, newDefer.notifyWith));\n\n // fulfilled_handlers.add( ... )\n tuples[1][3].add(resolve(0, newDefer, isFunction(onFulfilled) ? onFulfilled : Identity));\n\n // rejected_handlers.add( ... )\n tuples[2][3].add(resolve(0, newDefer, isFunction(onRejected) ? onRejected : Thrower));\n }).promise();\n },\n // Get a promise for this deferred\n // If obj is provided, the promise aspect is added to the object\n promise: function (obj) {\n return obj != null ? jQuery.extend(obj, promise) : promise;\n }\n },\n deferred = {};\n\n // Add list-specific methods\n jQuery.each(tuples, function (i, tuple) {\n var list = tuple[2],\n stateString = tuple[5];\n\n // promise.progress = list.add\n // promise.done = list.add\n // promise.fail = list.add\n promise[tuple[1]] = list.add;\n\n // Handle state\n if (stateString) {\n list.add(function () {\n // state = \"resolved\" (i.e., fulfilled)\n // state = \"rejected\"\n state = stateString;\n },\n // rejected_callbacks.disable\n // fulfilled_callbacks.disable\n tuples[3 - i][2].disable,\n // rejected_handlers.disable\n // fulfilled_handlers.disable\n tuples[3 - i][3].disable,\n // progress_callbacks.lock\n tuples[0][2].lock,\n // progress_handlers.lock\n tuples[0][3].lock);\n }\n\n // progress_handlers.fire\n // fulfilled_handlers.fire\n // rejected_handlers.fire\n list.add(tuple[3].fire);\n\n // deferred.notify = function() { deferred.notifyWith(...) }\n // deferred.resolve = function() { deferred.resolveWith(...) }\n // deferred.reject = function() { deferred.rejectWith(...) }\n deferred[tuple[0]] = function () {\n deferred[tuple[0] + \"With\"](this === deferred ? undefined : this, arguments);\n return this;\n };\n\n // deferred.notifyWith = list.fireWith\n // deferred.resolveWith = list.fireWith\n // deferred.rejectWith = list.fireWith\n deferred[tuple[0] + \"With\"] = list.fireWith;\n });\n\n // Make the deferred a promise\n promise.promise(deferred);\n\n // Call given func if any\n if (func) {\n func.call(deferred, deferred);\n }\n\n // All done!\n return deferred;\n },\n // Deferred helper\n when: function (singleValue) {\n var\n // count of uncompleted subordinates\n remaining = arguments.length,\n // count of unprocessed arguments\n i = remaining,\n // subordinate fulfillment data\n resolveContexts = Array(i),\n resolveValues = slice.call(arguments),\n // the primary Deferred\n primary = jQuery.Deferred(),\n // subordinate callback factory\n updateFunc = function (i) {\n return function (value) {\n resolveContexts[i] = this;\n resolveValues[i] = arguments.length > 1 ? slice.call(arguments) : value;\n if (! --remaining) {\n primary.resolveWith(resolveContexts, resolveValues);\n }\n };\n };\n\n // Single- and empty arguments are adopted like Promise.resolve\n if (remaining <= 1) {\n adoptValue(singleValue, primary.done(updateFunc(i)).resolve, primary.reject, !remaining);\n\n // Use .then() to unwrap secondary thenables (cf. gh-3000)\n if (primary.state() === \"pending\" || isFunction(resolveValues[i] && resolveValues[i].then)) {\n return primary.then();\n }\n }\n\n // Multiple arguments are aggregated like Promise.all array elements\n while (i--) {\n adoptValue(resolveValues[i], updateFunc(i), primary.reject);\n }\n return primary.promise();\n }\n });\n\n // These usually indicate a programmer mistake during development,\n // warn about them ASAP rather than swallowing them by default.\n var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;\n\n // If `jQuery.Deferred.getErrorHook` is defined, `asyncError` is an error\n // captured before the async barrier to get the original error cause\n // which may otherwise be hidden.\n jQuery.Deferred.exceptionHook = function (error, asyncError) {\n // Support: IE 8 - 9 only\n // Console exists when dev tools are open, which can happen at any time\n if (window.console && window.console.warn && error && rerrorNames.test(error.name)) {\n window.console.warn(\"jQuery.Deferred exception: \" + error.message, error.stack, asyncError);\n }\n };\n jQuery.readyException = function (error) {\n window.setTimeout(function () {\n throw error;\n });\n };\n\n // The deferred used on DOM ready\n var readyList = jQuery.Deferred();\n jQuery.fn.ready = function (fn) {\n readyList.then(fn)\n\n // Wrap jQuery.readyException in a function so that the lookup\n // happens at the time of error handling instead of callback\n // registration.\n .catch(function (error) {\n jQuery.readyException(error);\n });\n return this;\n };\n jQuery.extend({\n // Is the DOM ready to be used? Set to true once it occurs.\n isReady: false,\n // A counter to track how many items to wait for before\n // the ready event fires. See trac-6781\n readyWait: 1,\n // Handle when the DOM is ready\n ready: function (wait) {\n // Abort if there are pending holds or we're already ready\n if (wait === true ? --jQuery.readyWait : jQuery.isReady) {\n return;\n }\n\n // Remember that the DOM is ready\n jQuery.isReady = true;\n\n // If a normal DOM Ready event fired, decrement, and wait if need be\n if (wait !== true && --jQuery.readyWait > 0) {\n return;\n }\n\n // If there are functions bound, to execute\n readyList.resolveWith(document, [jQuery]);\n }\n });\n jQuery.ready.then = readyList.then;\n\n // The ready event handler and self cleanup method\n function completed() {\n document.removeEventListener(\"DOMContentLoaded\", completed);\n window.removeEventListener(\"load\", completed);\n jQuery.ready();\n }\n\n // Catch cases where $(document).ready() is called\n // after the browser event has already occurred.\n // Support: IE <=9 - 10 only\n // Older IE sometimes signals \"interactive\" too soon\n if (document.readyState === \"complete\" || document.readyState !== \"loading\" && !document.documentElement.doScroll) {\n // Handle it asynchronously to allow scripts the opportunity to delay ready\n window.setTimeout(jQuery.ready);\n } else {\n // Use the handy event callback\n document.addEventListener(\"DOMContentLoaded\", completed);\n\n // A fallback to window.onload, that will always work\n window.addEventListener(\"load\", completed);\n }\n\n // Multifunctional method to get and set values of a collection\n // The value/s can optionally be executed if it's a function\n var access = function (elems, fn, key, value, chainable, emptyGet, raw) {\n var i = 0,\n len = elems.length,\n bulk = key == null;\n\n // Sets many values\n if (toType(key) === \"object\") {\n chainable = true;\n for (i in key) {\n access(elems, fn, i, key[i], true, emptyGet, raw);\n }\n\n // Sets one value\n } else if (value !== undefined) {\n chainable = true;\n if (!isFunction(value)) {\n raw = true;\n }\n if (bulk) {\n // Bulk operations run against the entire set\n if (raw) {\n fn.call(elems, value);\n fn = null;\n\n // ...except when executing function values\n } else {\n bulk = fn;\n fn = function (elem, _key, value) {\n return bulk.call(jQuery(elem), value);\n };\n }\n }\n if (fn) {\n for (; i < len; i++) {\n fn(elems[i], key, raw ? value : value.call(elems[i], i, fn(elems[i], key)));\n }\n }\n }\n if (chainable) {\n return elems;\n }\n\n // Gets\n if (bulk) {\n return fn.call(elems);\n }\n return len ? fn(elems[0], key) : emptyGet;\n };\n\n // Matches dashed string for camelizing\n var rmsPrefix = /^-ms-/,\n rdashAlpha = /-([a-z])/g;\n\n // Used by camelCase as callback to replace()\n function fcamelCase(_all, letter) {\n return letter.toUpperCase();\n }\n\n // Convert dashed to camelCase; used by the css and data modules\n // Support: IE <=9 - 11, Edge 12 - 15\n // Microsoft forgot to hump their vendor prefix (trac-9572)\n function camelCase(string) {\n return string.replace(rmsPrefix, \"ms-\").replace(rdashAlpha, fcamelCase);\n }\n var acceptData = function (owner) {\n // Accepts only:\n // - Node\n // - Node.ELEMENT_NODE\n // - Node.DOCUMENT_NODE\n // - Object\n // - Any\n return owner.nodeType === 1 || owner.nodeType === 9 || !+owner.nodeType;\n };\n function Data() {\n this.expando = jQuery.expando + Data.uid++;\n }\n Data.uid = 1;\n Data.prototype = {\n cache: function (owner) {\n // Check if the owner object already has a cache\n var value = owner[this.expando];\n\n // If not, create one\n if (!value) {\n value = {};\n\n // We can accept data for non-element nodes in modern browsers,\n // but we should not, see trac-8335.\n // Always return an empty object.\n if (acceptData(owner)) {\n // If it is a node unlikely to be stringify-ed or looped over\n // use plain assignment\n if (owner.nodeType) {\n owner[this.expando] = value;\n\n // Otherwise secure it in a non-enumerable property\n // configurable must be true to allow the property to be\n // deleted when data is removed\n } else {\n Object.defineProperty(owner, this.expando, {\n value: value,\n configurable: true\n });\n }\n }\n }\n return value;\n },\n set: function (owner, data, value) {\n var prop,\n cache = this.cache(owner);\n\n // Handle: [ owner, key, value ] args\n // Always use camelCase key (gh-2257)\n if (typeof data === \"string\") {\n cache[camelCase(data)] = value;\n\n // Handle: [ owner, { properties } ] args\n } else {\n // Copy the properties one-by-one to the cache object\n for (prop in data) {\n cache[camelCase(prop)] = data[prop];\n }\n }\n return cache;\n },\n get: function (owner, key) {\n return key === undefined ? this.cache(owner) :\n // Always use camelCase key (gh-2257)\n owner[this.expando] && owner[this.expando][camelCase(key)];\n },\n access: function (owner, key, value) {\n // In cases where either:\n //\n // 1. No key was specified\n // 2. A string key was specified, but no value provided\n //\n // Take the \"read\" path and allow the get method to determine\n // which value to return, respectively either:\n //\n // 1. The entire cache object\n // 2. The data stored at the key\n //\n if (key === undefined || key && typeof key === \"string\" && value === undefined) {\n return this.get(owner, key);\n }\n\n // When the key is not a string, or both a key and value\n // are specified, set or extend (existing objects) with either:\n //\n // 1. An object of properties\n // 2. A key and value\n //\n this.set(owner, key, value);\n\n // Since the \"set\" path can have two possible entry points\n // return the expected data based on which path was taken[*]\n return value !== undefined ? value : key;\n },\n remove: function (owner, key) {\n var i,\n cache = owner[this.expando];\n if (cache === undefined) {\n return;\n }\n if (key !== undefined) {\n // Support array or space separated string of keys\n if (Array.isArray(key)) {\n // If key is an array of keys...\n // We always set camelCase keys, so remove that.\n key = key.map(camelCase);\n } else {\n key = camelCase(key);\n\n // If a key with the spaces exists, use it.\n // Otherwise, create an array by matching non-whitespace\n key = key in cache ? [key] : key.match(rnothtmlwhite) || [];\n }\n i = key.length;\n while (i--) {\n delete cache[key[i]];\n }\n }\n\n // Remove the expando if there's no more data\n if (key === undefined || jQuery.isEmptyObject(cache)) {\n // Support: Chrome <=35 - 45\n // Webkit & Blink performance suffers when deleting properties\n // from DOM nodes, so set to undefined instead\n // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)\n if (owner.nodeType) {\n owner[this.expando] = undefined;\n } else {\n delete owner[this.expando];\n }\n }\n },\n hasData: function (owner) {\n var cache = owner[this.expando];\n return cache !== undefined && !jQuery.isEmptyObject(cache);\n }\n };\n var dataPriv = new Data();\n var dataUser = new Data();\n\n //\tImplementation Summary\n //\n //\t1. Enforce API surface and semantic compatibility with 1.9.x branch\n //\t2. Improve the module's maintainability by reducing the storage\n //\t\tpaths to a single mechanism.\n //\t3. Use the same single mechanism to support \"private\" and \"user\" data.\n //\t4. _Never_ expose \"private\" data to user code (TODO: Drop _data, _removeData)\n //\t5. Avoid exposing implementation details on user objects (eg. expando properties)\n //\t6. Provide a clear path for implementation upgrade to WeakMap in 2014\n\n var rbrace = /^(?:\\{[\\w\\W]*\\}|\\[[\\w\\W]*\\])$/,\n rmultiDash = /[A-Z]/g;\n function getData(data) {\n if (data === \"true\") {\n return true;\n }\n if (data === \"false\") {\n return false;\n }\n if (data === \"null\") {\n return null;\n }\n\n // Only convert to a number if it doesn't change the string\n if (data === +data + \"\") {\n return +data;\n }\n if (rbrace.test(data)) {\n return JSON.parse(data);\n }\n return data;\n }\n function dataAttr(elem, key, data) {\n var name;\n\n // If nothing was found internally, try to fetch any\n // data from the HTML5 data-* attribute\n if (data === undefined && elem.nodeType === 1) {\n name = \"data-\" + key.replace(rmultiDash, \"-$&\").toLowerCase();\n data = elem.getAttribute(name);\n if (typeof data === \"string\") {\n try {\n data = getData(data);\n } catch (e) {}\n\n // Make sure we set the data so it isn't changed later\n dataUser.set(elem, key, data);\n } else {\n data = undefined;\n }\n }\n return data;\n }\n jQuery.extend({\n hasData: function (elem) {\n return dataUser.hasData(elem) || dataPriv.hasData(elem);\n },\n data: function (elem, name, data) {\n return dataUser.access(elem, name, data);\n },\n removeData: function (elem, name) {\n dataUser.remove(elem, name);\n },\n // TODO: Now that all calls to _data and _removeData have been replaced\n // with direct calls to dataPriv methods, these can be deprecated.\n _data: function (elem, name, data) {\n return dataPriv.access(elem, name, data);\n },\n _removeData: function (elem, name) {\n dataPriv.remove(elem, name);\n }\n });\n jQuery.fn.extend({\n data: function (key, value) {\n var i,\n name,\n data,\n elem = this[0],\n attrs = elem && elem.attributes;\n\n // Gets all values\n if (key === undefined) {\n if (this.length) {\n data = dataUser.get(elem);\n if (elem.nodeType === 1 && !dataPriv.get(elem, \"hasDataAttrs\")) {\n i = attrs.length;\n while (i--) {\n // Support: IE 11 only\n // The attrs elements can be null (trac-14894)\n if (attrs[i]) {\n name = attrs[i].name;\n if (name.indexOf(\"data-\") === 0) {\n name = camelCase(name.slice(5));\n dataAttr(elem, name, data[name]);\n }\n }\n }\n dataPriv.set(elem, \"hasDataAttrs\", true);\n }\n }\n return data;\n }\n\n // Sets multiple values\n if (typeof key === \"object\") {\n return this.each(function () {\n dataUser.set(this, key);\n });\n }\n return access(this, function (value) {\n var data;\n\n // The calling jQuery object (element matches) is not empty\n // (and therefore has an element appears at this[ 0 ]) and the\n // `value` parameter was not undefined. An empty jQuery object\n // will result in `undefined` for elem = this[ 0 ] which will\n // throw an exception if an attempt to read a data cache is made.\n if (elem && value === undefined) {\n // Attempt to get data from the cache\n // The key will always be camelCased in Data\n data = dataUser.get(elem, key);\n if (data !== undefined) {\n return data;\n }\n\n // Attempt to \"discover\" the data in\n // HTML5 custom data-* attrs\n data = dataAttr(elem, key);\n if (data !== undefined) {\n return data;\n }\n\n // We tried really hard, but the data doesn't exist.\n return;\n }\n\n // Set the data...\n this.each(function () {\n // We always store the camelCased key\n dataUser.set(this, key, value);\n });\n }, null, value, arguments.length > 1, null, true);\n },\n removeData: function (key) {\n return this.each(function () {\n dataUser.remove(this, key);\n });\n }\n });\n jQuery.extend({\n queue: function (elem, type, data) {\n var queue;\n if (elem) {\n type = (type || \"fx\") + \"queue\";\n queue = dataPriv.get(elem, type);\n\n // Speed up dequeue by getting out quickly if this is just a lookup\n if (data) {\n if (!queue || Array.isArray(data)) {\n queue = dataPriv.access(elem, type, jQuery.makeArray(data));\n } else {\n queue.push(data);\n }\n }\n return queue || [];\n }\n },\n dequeue: function (elem, type) {\n type = type || \"fx\";\n var queue = jQuery.queue(elem, type),\n startLength = queue.length,\n fn = queue.shift(),\n hooks = jQuery._queueHooks(elem, type),\n next = function () {\n jQuery.dequeue(elem, type);\n };\n\n // If the fx queue is dequeued, always remove the progress sentinel\n if (fn === \"inprogress\") {\n fn = queue.shift();\n startLength--;\n }\n if (fn) {\n // Add a progress sentinel to prevent the fx queue from being\n // automatically dequeued\n if (type === \"fx\") {\n queue.unshift(\"inprogress\");\n }\n\n // Clear up the last queue stop function\n delete hooks.stop;\n fn.call(elem, next, hooks);\n }\n if (!startLength && hooks) {\n hooks.empty.fire();\n }\n },\n // Not public - generate a queueHooks object, or return the current one\n _queueHooks: function (elem, type) {\n var key = type + \"queueHooks\";\n return dataPriv.get(elem, key) || dataPriv.access(elem, key, {\n empty: jQuery.Callbacks(\"once memory\").add(function () {\n dataPriv.remove(elem, [type + \"queue\", key]);\n })\n });\n }\n });\n jQuery.fn.extend({\n queue: function (type, data) {\n var setter = 2;\n if (typeof type !== \"string\") {\n data = type;\n type = \"fx\";\n setter--;\n }\n if (arguments.length < setter) {\n return jQuery.queue(this[0], type);\n }\n return data === undefined ? this : this.each(function () {\n var queue = jQuery.queue(this, type, data);\n\n // Ensure a hooks for this queue\n jQuery._queueHooks(this, type);\n if (type === \"fx\" && queue[0] !== \"inprogress\") {\n jQuery.dequeue(this, type);\n }\n });\n },\n dequeue: function (type) {\n return this.each(function () {\n jQuery.dequeue(this, type);\n });\n },\n clearQueue: function (type) {\n return this.queue(type || \"fx\", []);\n },\n // Get a promise resolved when queues of a certain type\n // are emptied (fx is the type by default)\n promise: function (type, obj) {\n var tmp,\n count = 1,\n defer = jQuery.Deferred(),\n elements = this,\n i = this.length,\n resolve = function () {\n if (! --count) {\n defer.resolveWith(elements, [elements]);\n }\n };\n if (typeof type !== \"string\") {\n obj = type;\n type = undefined;\n }\n type = type || \"fx\";\n while (i--) {\n tmp = dataPriv.get(elements[i], type + \"queueHooks\");\n if (tmp && tmp.empty) {\n count++;\n tmp.empty.add(resolve);\n }\n }\n resolve();\n return defer.promise(obj);\n }\n });\n var pnum = /[+-]?(?:\\d*\\.|)\\d+(?:[eE][+-]?\\d+|)/.source;\n var rcssNum = new RegExp(\"^(?:([+-])=|)(\" + pnum + \")([a-z%]*)$\", \"i\");\n var cssExpand = [\"Top\", \"Right\", \"Bottom\", \"Left\"];\n var documentElement = document.documentElement;\n var isAttached = function (elem) {\n return jQuery.contains(elem.ownerDocument, elem);\n },\n composed = {\n composed: true\n };\n\n // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only\n // Check attachment across shadow DOM boundaries when possible (gh-3504)\n // Support: iOS 10.0-10.2 only\n // Early iOS 10 versions support `attachShadow` but not `getRootNode`,\n // leading to errors. We need to check for `getRootNode`.\n if (documentElement.getRootNode) {\n isAttached = function (elem) {\n return jQuery.contains(elem.ownerDocument, elem) || elem.getRootNode(composed) === elem.ownerDocument;\n };\n }\n var isHiddenWithinTree = function (elem, el) {\n // isHiddenWithinTree might be called from jQuery#filter function;\n // in that case, element will be second argument\n elem = el || elem;\n\n // Inline style trumps all\n return elem.style.display === \"none\" || elem.style.display === \"\" &&\n // Otherwise, check computed style\n // Support: Firefox <=43 - 45\n // Disconnected elements can have computed display: none, so first confirm that elem is\n // in the document.\n isAttached(elem) && jQuery.css(elem, \"display\") === \"none\";\n };\n function adjustCSS(elem, prop, valueParts, tween) {\n var adjusted,\n scale,\n maxIterations = 20,\n currentValue = tween ? function () {\n return tween.cur();\n } : function () {\n return jQuery.css(elem, prop, \"\");\n },\n initial = currentValue(),\n unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? \"\" : \"px\"),\n // Starting value computation is required for potential unit mismatches\n initialInUnit = elem.nodeType && (jQuery.cssNumber[prop] || unit !== \"px\" && +initial) && rcssNum.exec(jQuery.css(elem, prop));\n if (initialInUnit && initialInUnit[3] !== unit) {\n // Support: Firefox <=54\n // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)\n initial = initial / 2;\n\n // Trust units reported by jQuery.css\n unit = unit || initialInUnit[3];\n\n // Iteratively approximate from a nonzero starting point\n initialInUnit = +initial || 1;\n while (maxIterations--) {\n // Evaluate and update our best guess (doubling guesses that zero out).\n // Finish if the scale equals or crosses 1 (making the old*new product non-positive).\n jQuery.style(elem, prop, initialInUnit + unit);\n if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) {\n maxIterations = 0;\n }\n initialInUnit = initialInUnit / scale;\n }\n initialInUnit = initialInUnit * 2;\n jQuery.style(elem, prop, initialInUnit + unit);\n\n // Make sure we update the tween properties later on\n valueParts = valueParts || [];\n }\n if (valueParts) {\n initialInUnit = +initialInUnit || +initial || 0;\n\n // Apply relative offset (+=/-=) if specified\n adjusted = valueParts[1] ? initialInUnit + (valueParts[1] + 1) * valueParts[2] : +valueParts[2];\n if (tween) {\n tween.unit = unit;\n tween.start = initialInUnit;\n tween.end = adjusted;\n }\n }\n return adjusted;\n }\n var defaultDisplayMap = {};\n function getDefaultDisplay(elem) {\n var temp,\n doc = elem.ownerDocument,\n nodeName = elem.nodeName,\n display = defaultDisplayMap[nodeName];\n if (display) {\n return display;\n }\n temp = doc.body.appendChild(doc.createElement(nodeName));\n display = jQuery.css(temp, \"display\");\n temp.parentNode.removeChild(temp);\n if (display === \"none\") {\n display = \"block\";\n }\n defaultDisplayMap[nodeName] = display;\n return display;\n }\n function showHide(elements, show) {\n var display,\n elem,\n values = [],\n index = 0,\n length = elements.length;\n\n // Determine new display value for elements that need to change\n for (; index < length; index++) {\n elem = elements[index];\n if (!elem.style) {\n continue;\n }\n display = elem.style.display;\n if (show) {\n // Since we force visibility upon cascade-hidden elements, an immediate (and slow)\n // check is required in this first loop unless we have a nonempty display value (either\n // inline or about-to-be-restored)\n if (display === \"none\") {\n values[index] = dataPriv.get(elem, \"display\") || null;\n if (!values[index]) {\n elem.style.display = \"\";\n }\n }\n if (elem.style.display === \"\" && isHiddenWithinTree(elem)) {\n values[index] = getDefaultDisplay(elem);\n }\n } else {\n if (display !== \"none\") {\n values[index] = \"none\";\n\n // Remember what we're overwriting\n dataPriv.set(elem, \"display\", display);\n }\n }\n }\n\n // Set the display of the elements in a second loop to avoid constant reflow\n for (index = 0; index < length; index++) {\n if (values[index] != null) {\n elements[index].style.display = values[index];\n }\n }\n return elements;\n }\n jQuery.fn.extend({\n show: function () {\n return showHide(this, true);\n },\n hide: function () {\n return showHide(this);\n },\n toggle: function (state) {\n if (typeof state === \"boolean\") {\n return state ? this.show() : this.hide();\n }\n return this.each(function () {\n if (isHiddenWithinTree(this)) {\n jQuery(this).show();\n } else {\n jQuery(this).hide();\n }\n });\n }\n });\n var rcheckableType = /^(?:checkbox|radio)$/i;\n var rtagName = /<([a-z][^\\/\\0>\\x20\\t\\r\\n\\f]*)/i;\n var rscriptType = /^$|^module$|\\/(?:java|ecma)script/i;\n (function () {\n var fragment = document.createDocumentFragment(),\n div = fragment.appendChild(document.createElement(\"div\")),\n input = document.createElement(\"input\");\n\n // Support: Android 4.0 - 4.3 only\n // Check state lost if the name is set (trac-11217)\n // Support: Windows Web Apps (WWA)\n // `name` and `type` must use .setAttribute for WWA (trac-14901)\n input.setAttribute(\"type\", \"radio\");\n input.setAttribute(\"checked\", \"checked\");\n input.setAttribute(\"name\", \"t\");\n div.appendChild(input);\n\n // Support: Android <=4.1 only\n // Older WebKit doesn't clone checked state correctly in fragments\n support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;\n\n // Support: IE <=11 only\n // Make sure textarea (and checkbox) defaultValue is properly cloned\n div.innerHTML = \"\";\n support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;\n\n // Support: IE <=9 only\n // IE <=9 replaces tags with their contents when inserted outside of\n // the select element.\n div.innerHTML = \" \";\n support.option = !!div.lastChild;\n })();\n\n // We have to close these tags to support XHTML (trac-13200)\n var wrapMap = {\n // XHTML parsers do not magically insert elements in the\n // same way that tag soup parsers do. So we cannot shorten\n // this by omitting or other required elements.\n thead: [1, \"\"],\n col: [2, \"\"],\n tr: [2, \"\"],\n td: [3, \"\"],\n _default: [0, \"\", \"\"]\n };\n wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;\n wrapMap.th = wrapMap.td;\n\n // Support: IE <=9 only\n if (!support.option) {\n wrapMap.optgroup = wrapMap.option = [1, \"\", \" \"];\n }\n function getAll(context, tag) {\n // Support: IE <=9 - 11 only\n // Use typeof to avoid zero-argument method invocation on host objects (trac-15151)\n var ret;\n if (typeof context.getElementsByTagName !== \"undefined\") {\n ret = context.getElementsByTagName(tag || \"*\");\n } else if (typeof context.querySelectorAll !== \"undefined\") {\n ret = context.querySelectorAll(tag || \"*\");\n } else {\n ret = [];\n }\n if (tag === undefined || tag && nodeName(context, tag)) {\n return jQuery.merge([context], ret);\n }\n return ret;\n }\n\n // Mark scripts as having already been evaluated\n function setGlobalEval(elems, refElements) {\n var i = 0,\n l = elems.length;\n for (; i < l; i++) {\n dataPriv.set(elems[i], \"globalEval\", !refElements || dataPriv.get(refElements[i], \"globalEval\"));\n }\n }\n var rhtml = /<|?\\w+;/;\n function buildFragment(elems, context, scripts, selection, ignored) {\n var elem,\n tmp,\n tag,\n wrap,\n attached,\n j,\n fragment = context.createDocumentFragment(),\n nodes = [],\n i = 0,\n l = elems.length;\n for (; i < l; i++) {\n elem = elems[i];\n if (elem || elem === 0) {\n // Add nodes directly\n if (toType(elem) === \"object\") {\n // Support: Android <=4.0 only, PhantomJS 1 only\n // push.apply(_, arraylike) throws on ancient WebKit\n jQuery.merge(nodes, elem.nodeType ? [elem] : elem);\n\n // Convert non-html into a text node\n } else if (!rhtml.test(elem)) {\n nodes.push(context.createTextNode(elem));\n\n // Convert html into DOM nodes\n } else {\n tmp = tmp || fragment.appendChild(context.createElement(\"div\"));\n\n // Deserialize a standard representation\n tag = (rtagName.exec(elem) || [\"\", \"\"])[1].toLowerCase();\n wrap = wrapMap[tag] || wrapMap._default;\n tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2];\n\n // Descend through wrappers to the right content\n j = wrap[0];\n while (j--) {\n tmp = tmp.lastChild;\n }\n\n // Support: Android <=4.0 only, PhantomJS 1 only\n // push.apply(_, arraylike) throws on ancient WebKit\n jQuery.merge(nodes, tmp.childNodes);\n\n // Remember the top-level container\n tmp = fragment.firstChild;\n\n // Ensure the created nodes are orphaned (trac-12392)\n tmp.textContent = \"\";\n }\n }\n }\n\n // Remove wrapper from fragment\n fragment.textContent = \"\";\n i = 0;\n while (elem = nodes[i++]) {\n // Skip elements already in the context collection (trac-4087)\n if (selection && jQuery.inArray(elem, selection) > -1) {\n if (ignored) {\n ignored.push(elem);\n }\n continue;\n }\n attached = isAttached(elem);\n\n // Append to fragment\n tmp = getAll(fragment.appendChild(elem), \"script\");\n\n // Preserve script evaluation history\n if (attached) {\n setGlobalEval(tmp);\n }\n\n // Capture executables\n if (scripts) {\n j = 0;\n while (elem = tmp[j++]) {\n if (rscriptType.test(elem.type || \"\")) {\n scripts.push(elem);\n }\n }\n }\n }\n return fragment;\n }\n var rtypenamespace = /^([^.]*)(?:\\.(.+)|)/;\n function returnTrue() {\n return true;\n }\n function returnFalse() {\n return false;\n }\n function on(elem, types, selector, data, fn, one) {\n var origFn, type;\n\n // Types can be a map of types/handlers\n if (typeof types === \"object\") {\n // ( types-Object, selector, data )\n if (typeof selector !== \"string\") {\n // ( types-Object, data )\n data = data || selector;\n selector = undefined;\n }\n for (type in types) {\n on(elem, type, selector, data, types[type], one);\n }\n return elem;\n }\n if (data == null && fn == null) {\n // ( types, fn )\n fn = selector;\n data = selector = undefined;\n } else if (fn == null) {\n if (typeof selector === \"string\") {\n // ( types, selector, fn )\n fn = data;\n data = undefined;\n } else {\n // ( types, data, fn )\n fn = data;\n data = selector;\n selector = undefined;\n }\n }\n if (fn === false) {\n fn = returnFalse;\n } else if (!fn) {\n return elem;\n }\n if (one === 1) {\n origFn = fn;\n fn = function (event) {\n // Can use an empty set, since event contains the info\n jQuery().off(event);\n return origFn.apply(this, arguments);\n };\n\n // Use same guid so caller can remove using origFn\n fn.guid = origFn.guid || (origFn.guid = jQuery.guid++);\n }\n return elem.each(function () {\n jQuery.event.add(this, types, fn, data, selector);\n });\n }\n\n /*\n * Helper functions for managing events -- not part of the public interface.\n * Props to Dean Edwards' addEvent library for many of the ideas.\n */\n jQuery.event = {\n global: {},\n add: function (elem, types, handler, data, selector) {\n var handleObjIn,\n eventHandle,\n tmp,\n events,\n t,\n handleObj,\n special,\n handlers,\n type,\n namespaces,\n origType,\n elemData = dataPriv.get(elem);\n\n // Only attach events to objects that accept data\n if (!acceptData(elem)) {\n return;\n }\n\n // Caller can pass in an object of custom data in lieu of the handler\n if (handler.handler) {\n handleObjIn = handler;\n handler = handleObjIn.handler;\n selector = handleObjIn.selector;\n }\n\n // Ensure that invalid selectors throw exceptions at attach time\n // Evaluate against documentElement in case elem is a non-element node (e.g., document)\n if (selector) {\n jQuery.find.matchesSelector(documentElement, selector);\n }\n\n // Make sure that the handler has a unique ID, used to find/remove it later\n if (!handler.guid) {\n handler.guid = jQuery.guid++;\n }\n\n // Init the element's event structure and main handler, if this is the first\n if (!(events = elemData.events)) {\n events = elemData.events = Object.create(null);\n }\n if (!(eventHandle = elemData.handle)) {\n eventHandle = elemData.handle = function (e) {\n // Discard the second event of a jQuery.event.trigger() and\n // when an event is called after a page has unloaded\n return typeof jQuery !== \"undefined\" && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply(elem, arguments) : undefined;\n };\n }\n\n // Handle multiple events separated by a space\n types = (types || \"\").match(rnothtmlwhite) || [\"\"];\n t = types.length;\n while (t--) {\n tmp = rtypenamespace.exec(types[t]) || [];\n type = origType = tmp[1];\n namespaces = (tmp[2] || \"\").split(\".\").sort();\n\n // There *must* be a type, no attaching namespace-only handlers\n if (!type) {\n continue;\n }\n\n // If event changes its type, use the special event handlers for the changed type\n special = jQuery.event.special[type] || {};\n\n // If selector defined, determine special event api type, otherwise given type\n type = (selector ? special.delegateType : special.bindType) || type;\n\n // Update special based on newly reset type\n special = jQuery.event.special[type] || {};\n\n // handleObj is passed to all event handlers\n handleObj = jQuery.extend({\n type: type,\n origType: origType,\n data: data,\n handler: handler,\n guid: handler.guid,\n selector: selector,\n needsContext: selector && jQuery.expr.match.needsContext.test(selector),\n namespace: namespaces.join(\".\")\n }, handleObjIn);\n\n // Init the event handler queue if we're the first\n if (!(handlers = events[type])) {\n handlers = events[type] = [];\n handlers.delegateCount = 0;\n\n // Only use addEventListener if the special events handler returns false\n if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {\n if (elem.addEventListener) {\n elem.addEventListener(type, eventHandle);\n }\n }\n }\n if (special.add) {\n special.add.call(elem, handleObj);\n if (!handleObj.handler.guid) {\n handleObj.handler.guid = handler.guid;\n }\n }\n\n // Add to the element's handler list, delegates in front\n if (selector) {\n handlers.splice(handlers.delegateCount++, 0, handleObj);\n } else {\n handlers.push(handleObj);\n }\n\n // Keep track of which events have ever been used, for event optimization\n jQuery.event.global[type] = true;\n }\n },\n // Detach an event or set of events from an element\n remove: function (elem, types, handler, selector, mappedTypes) {\n var j,\n origCount,\n tmp,\n events,\n t,\n handleObj,\n special,\n handlers,\n type,\n namespaces,\n origType,\n elemData = dataPriv.hasData(elem) && dataPriv.get(elem);\n if (!elemData || !(events = elemData.events)) {\n return;\n }\n\n // Once for each type.namespace in types; type may be omitted\n types = (types || \"\").match(rnothtmlwhite) || [\"\"];\n t = types.length;\n while (t--) {\n tmp = rtypenamespace.exec(types[t]) || [];\n type = origType = tmp[1];\n namespaces = (tmp[2] || \"\").split(\".\").sort();\n\n // Unbind all events (on this namespace, if provided) for the element\n if (!type) {\n for (type in events) {\n jQuery.event.remove(elem, type + types[t], handler, selector, true);\n }\n continue;\n }\n special = jQuery.event.special[type] || {};\n type = (selector ? special.delegateType : special.bindType) || type;\n handlers = events[type] || [];\n tmp = tmp[2] && new RegExp(\"(^|\\\\.)\" + namespaces.join(\"\\\\.(?:.*\\\\.|)\") + \"(\\\\.|$)\");\n\n // Remove matching events\n origCount = j = handlers.length;\n while (j--) {\n handleObj = handlers[j];\n if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === \"**\" && handleObj.selector)) {\n handlers.splice(j, 1);\n if (handleObj.selector) {\n handlers.delegateCount--;\n }\n if (special.remove) {\n special.remove.call(elem, handleObj);\n }\n }\n }\n\n // Remove generic event handler if we removed something and no more handlers exist\n // (avoids potential for endless recursion during removal of special event handlers)\n if (origCount && !handlers.length) {\n if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {\n jQuery.removeEvent(elem, type, elemData.handle);\n }\n delete events[type];\n }\n }\n\n // Remove data and the expando if it's no longer used\n if (jQuery.isEmptyObject(events)) {\n dataPriv.remove(elem, \"handle events\");\n }\n },\n dispatch: function (nativeEvent) {\n var i,\n j,\n ret,\n matched,\n handleObj,\n handlerQueue,\n args = new Array(arguments.length),\n // Make a writable jQuery.Event from the native event object\n event = jQuery.event.fix(nativeEvent),\n handlers = (dataPriv.get(this, \"events\") || Object.create(null))[event.type] || [],\n special = jQuery.event.special[event.type] || {};\n\n // Use the fix-ed jQuery.Event rather than the (read-only) native event\n args[0] = event;\n for (i = 1; i < arguments.length; i++) {\n args[i] = arguments[i];\n }\n event.delegateTarget = this;\n\n // Call the preDispatch hook for the mapped type, and let it bail if desired\n if (special.preDispatch && special.preDispatch.call(this, event) === false) {\n return;\n }\n\n // Determine handlers\n handlerQueue = jQuery.event.handlers.call(this, event, handlers);\n\n // Run delegates first; they may want to stop propagation beneath us\n i = 0;\n while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {\n event.currentTarget = matched.elem;\n j = 0;\n while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) {\n // If the event is namespaced, then each handler is only invoked if it is\n // specially universal or its namespaces are a superset of the event's.\n if (!event.rnamespace || handleObj.namespace === false || event.rnamespace.test(handleObj.namespace)) {\n event.handleObj = handleObj;\n event.data = handleObj.data;\n ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args);\n if (ret !== undefined) {\n if ((event.result = ret) === false) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n }\n }\n }\n\n // Call the postDispatch hook for the mapped type\n if (special.postDispatch) {\n special.postDispatch.call(this, event);\n }\n return event.result;\n },\n handlers: function (event, handlers) {\n var i,\n handleObj,\n sel,\n matchedHandlers,\n matchedSelectors,\n handlerQueue = [],\n delegateCount = handlers.delegateCount,\n cur = event.target;\n\n // Find delegate handlers\n if (delegateCount &&\n // Support: IE <=9\n // Black-hole SVG instance trees (trac-13180)\n cur.nodeType &&\n // Support: Firefox <=42\n // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)\n // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click\n // Support: IE 11 only\n // ...but not arrow key \"clicks\" of radio inputs, which can have `button` -1 (gh-2343)\n !(event.type === \"click\" && event.button >= 1)) {\n for (; cur !== this; cur = cur.parentNode || this) {\n // Don't check non-elements (trac-13208)\n // Don't process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764)\n if (cur.nodeType === 1 && !(event.type === \"click\" && cur.disabled === true)) {\n matchedHandlers = [];\n matchedSelectors = {};\n for (i = 0; i < delegateCount; i++) {\n handleObj = handlers[i];\n\n // Don't conflict with Object.prototype properties (trac-13203)\n sel = handleObj.selector + \" \";\n if (matchedSelectors[sel] === undefined) {\n matchedSelectors[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) > -1 : jQuery.find(sel, this, null, [cur]).length;\n }\n if (matchedSelectors[sel]) {\n matchedHandlers.push(handleObj);\n }\n }\n if (matchedHandlers.length) {\n handlerQueue.push({\n elem: cur,\n handlers: matchedHandlers\n });\n }\n }\n }\n }\n\n // Add the remaining (directly-bound) handlers\n cur = this;\n if (delegateCount < handlers.length) {\n handlerQueue.push({\n elem: cur,\n handlers: handlers.slice(delegateCount)\n });\n }\n return handlerQueue;\n },\n addProp: function (name, hook) {\n Object.defineProperty(jQuery.Event.prototype, name, {\n enumerable: true,\n configurable: true,\n get: isFunction(hook) ? function () {\n if (this.originalEvent) {\n return hook(this.originalEvent);\n }\n } : function () {\n if (this.originalEvent) {\n return this.originalEvent[name];\n }\n },\n set: function (value) {\n Object.defineProperty(this, name, {\n enumerable: true,\n configurable: true,\n writable: true,\n value: value\n });\n }\n });\n },\n fix: function (originalEvent) {\n return originalEvent[jQuery.expando] ? originalEvent : new jQuery.Event(originalEvent);\n },\n special: {\n load: {\n // Prevent triggered image.load events from bubbling to window.load\n noBubble: true\n },\n click: {\n // Utilize native event to ensure correct state for checkable inputs\n setup: function (data) {\n // For mutual compressibility with _default, replace `this` access with a local var.\n // `|| data` is dead code meant only to preserve the variable through minification.\n var el = this || data;\n\n // Claim the first handler\n if (rcheckableType.test(el.type) && el.click && nodeName(el, \"input\")) {\n // dataPriv.set( el, \"click\", ... )\n leverageNative(el, \"click\", true);\n }\n\n // Return false to allow normal processing in the caller\n return false;\n },\n trigger: function (data) {\n // For mutual compressibility with _default, replace `this` access with a local var.\n // `|| data` is dead code meant only to preserve the variable through minification.\n var el = this || data;\n\n // Force setup before triggering a click\n if (rcheckableType.test(el.type) && el.click && nodeName(el, \"input\")) {\n leverageNative(el, \"click\");\n }\n\n // Return non-false to allow normal event-path propagation\n return true;\n },\n // For cross-browser consistency, suppress native .click() on links\n // Also prevent it if we're currently inside a leveraged native-event stack\n _default: function (event) {\n var target = event.target;\n return rcheckableType.test(target.type) && target.click && nodeName(target, \"input\") && dataPriv.get(target, \"click\") || nodeName(target, \"a\");\n }\n },\n beforeunload: {\n postDispatch: function (event) {\n // Support: Firefox 20+\n // Firefox doesn't alert if the returnValue field is not set.\n if (event.result !== undefined && event.originalEvent) {\n event.originalEvent.returnValue = event.result;\n }\n }\n }\n }\n };\n\n // Ensure the presence of an event listener that handles manually-triggered\n // synthetic events by interrupting progress until reinvoked in response to\n // *native* events that it fires directly, ensuring that state changes have\n // already occurred before other listeners are invoked.\n function leverageNative(el, type, isSetup) {\n // Missing `isSetup` indicates a trigger call, which must force setup through jQuery.event.add\n if (!isSetup) {\n if (dataPriv.get(el, type) === undefined) {\n jQuery.event.add(el, type, returnTrue);\n }\n return;\n }\n\n // Register the controller as a special universal handler for all event namespaces\n dataPriv.set(el, type, false);\n jQuery.event.add(el, type, {\n namespace: false,\n handler: function (event) {\n var result,\n saved = dataPriv.get(this, type);\n if (event.isTrigger & 1 && this[type]) {\n // Interrupt processing of the outer synthetic .trigger()ed event\n if (!saved) {\n // Store arguments for use when handling the inner native event\n // There will always be at least one argument (an event object), so this array\n // will not be confused with a leftover capture object.\n saved = slice.call(arguments);\n dataPriv.set(this, type, saved);\n\n // Trigger the native event and capture its result\n this[type]();\n result = dataPriv.get(this, type);\n dataPriv.set(this, type, false);\n if (saved !== result) {\n // Cancel the outer synthetic event\n event.stopImmediatePropagation();\n event.preventDefault();\n return result;\n }\n\n // If this is an inner synthetic event for an event with a bubbling surrogate\n // (focus or blur), assume that the surrogate already propagated from triggering\n // the native event and prevent that from happening again here.\n // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the\n // bubbling surrogate propagates *after* the non-bubbling base), but that seems\n // less bad than duplication.\n } else if ((jQuery.event.special[type] || {}).delegateType) {\n event.stopPropagation();\n }\n\n // If this is a native event triggered above, everything is now in order\n // Fire an inner synthetic event with the original arguments\n } else if (saved) {\n // ...and capture the result\n dataPriv.set(this, type, jQuery.event.trigger(saved[0], saved.slice(1), this));\n\n // Abort handling of the native event by all jQuery handlers while allowing\n // native handlers on the same element to run. On target, this is achieved\n // by stopping immediate propagation just on the jQuery event. However,\n // the native event is re-wrapped by a jQuery one on each level of the\n // propagation so the only way to stop it for jQuery is to stop it for\n // everyone via native `stopPropagation()`. This is not a problem for\n // focus/blur which don't bubble, but it does also stop click on checkboxes\n // and radios. We accept this limitation.\n event.stopPropagation();\n event.isImmediatePropagationStopped = returnTrue;\n }\n }\n });\n }\n jQuery.removeEvent = function (elem, type, handle) {\n // This \"if\" is needed for plain objects\n if (elem.removeEventListener) {\n elem.removeEventListener(type, handle);\n }\n };\n jQuery.Event = function (src, props) {\n // Allow instantiation without the 'new' keyword\n if (!(this instanceof jQuery.Event)) {\n return new jQuery.Event(src, props);\n }\n\n // Event object\n if (src && src.type) {\n this.originalEvent = src;\n this.type = src.type;\n\n // Events bubbling up the document may have been marked as prevented\n // by a handler lower down the tree; reflect the correct value.\n this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined &&\n // Support: Android <=2.3 only\n src.returnValue === false ? returnTrue : returnFalse;\n\n // Create target properties\n // Support: Safari <=6 - 7 only\n // Target should not be a text node (trac-504, trac-13143)\n this.target = src.target && src.target.nodeType === 3 ? src.target.parentNode : src.target;\n this.currentTarget = src.currentTarget;\n this.relatedTarget = src.relatedTarget;\n\n // Event type\n } else {\n this.type = src;\n }\n\n // Put explicitly provided properties onto the event object\n if (props) {\n jQuery.extend(this, props);\n }\n\n // Create a timestamp if incoming event doesn't have one\n this.timeStamp = src && src.timeStamp || Date.now();\n\n // Mark it as fixed\n this[jQuery.expando] = true;\n };\n\n // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding\n // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html\n jQuery.Event.prototype = {\n constructor: jQuery.Event,\n isDefaultPrevented: returnFalse,\n isPropagationStopped: returnFalse,\n isImmediatePropagationStopped: returnFalse,\n isSimulated: false,\n preventDefault: function () {\n var e = this.originalEvent;\n this.isDefaultPrevented = returnTrue;\n if (e && !this.isSimulated) {\n e.preventDefault();\n }\n },\n stopPropagation: function () {\n var e = this.originalEvent;\n this.isPropagationStopped = returnTrue;\n if (e && !this.isSimulated) {\n e.stopPropagation();\n }\n },\n stopImmediatePropagation: function () {\n var e = this.originalEvent;\n this.isImmediatePropagationStopped = returnTrue;\n if (e && !this.isSimulated) {\n e.stopImmediatePropagation();\n }\n this.stopPropagation();\n }\n };\n\n // Includes all common event props including KeyEvent and MouseEvent specific props\n jQuery.each({\n altKey: true,\n bubbles: true,\n cancelable: true,\n changedTouches: true,\n ctrlKey: true,\n detail: true,\n eventPhase: true,\n metaKey: true,\n pageX: true,\n pageY: true,\n shiftKey: true,\n view: true,\n \"char\": true,\n code: true,\n charCode: true,\n key: true,\n keyCode: true,\n button: true,\n buttons: true,\n clientX: true,\n clientY: true,\n offsetX: true,\n offsetY: true,\n pointerId: true,\n pointerType: true,\n screenX: true,\n screenY: true,\n targetTouches: true,\n toElement: true,\n touches: true,\n which: true\n }, jQuery.event.addProp);\n jQuery.each({\n focus: \"focusin\",\n blur: \"focusout\"\n }, function (type, delegateType) {\n function focusMappedHandler(nativeEvent) {\n if (document.documentMode) {\n // Support: IE 11+\n // Attach a single focusin/focusout handler on the document while someone wants\n // focus/blur. This is because the former are synchronous in IE while the latter\n // are async. In other browsers, all those handlers are invoked synchronously.\n\n // `handle` from private data would already wrap the event, but we need\n // to change the `type` here.\n var handle = dataPriv.get(this, \"handle\"),\n event = jQuery.event.fix(nativeEvent);\n event.type = nativeEvent.type === \"focusin\" ? \"focus\" : \"blur\";\n event.isSimulated = true;\n\n // First, handle focusin/focusout\n handle(nativeEvent);\n\n // ...then, handle focus/blur\n //\n // focus/blur don't bubble while focusin/focusout do; simulate the former by only\n // invoking the handler at the lower level.\n if (event.target === event.currentTarget) {\n // The setup part calls `leverageNative`, which, in turn, calls\n // `jQuery.event.add`, so event handle will already have been set\n // by this point.\n handle(event);\n }\n } else {\n // For non-IE browsers, attach a single capturing handler on the document\n // while someone wants focusin/focusout.\n jQuery.event.simulate(delegateType, nativeEvent.target, jQuery.event.fix(nativeEvent));\n }\n }\n jQuery.event.special[type] = {\n // Utilize native event if possible so blur/focus sequence is correct\n setup: function () {\n var attaches;\n\n // Claim the first handler\n // dataPriv.set( this, \"focus\", ... )\n // dataPriv.set( this, \"blur\", ... )\n leverageNative(this, type, true);\n if (document.documentMode) {\n // Support: IE 9 - 11+\n // We use the same native handler for focusin & focus (and focusout & blur)\n // so we need to coordinate setup & teardown parts between those events.\n // Use `delegateType` as the key as `type` is already used by `leverageNative`.\n attaches = dataPriv.get(this, delegateType);\n if (!attaches) {\n this.addEventListener(delegateType, focusMappedHandler);\n }\n dataPriv.set(this, delegateType, (attaches || 0) + 1);\n } else {\n // Return false to allow normal processing in the caller\n return false;\n }\n },\n trigger: function () {\n // Force setup before trigger\n leverageNative(this, type);\n\n // Return non-false to allow normal event-path propagation\n return true;\n },\n teardown: function () {\n var attaches;\n if (document.documentMode) {\n attaches = dataPriv.get(this, delegateType) - 1;\n if (!attaches) {\n this.removeEventListener(delegateType, focusMappedHandler);\n dataPriv.remove(this, delegateType);\n } else {\n dataPriv.set(this, delegateType, attaches);\n }\n } else {\n // Return false to indicate standard teardown should be applied\n return false;\n }\n },\n // Suppress native focus or blur if we're currently inside\n // a leveraged native-event stack\n _default: function (event) {\n return dataPriv.get(event.target, type);\n },\n delegateType: delegateType\n };\n\n // Support: Firefox <=44\n // Firefox doesn't have focus(in | out) events\n // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787\n //\n // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1\n // focus(in | out) events fire after focus & blur events,\n // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order\n // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857\n //\n // Support: IE 9 - 11+\n // To preserve relative focusin/focus & focusout/blur event order guaranteed on the 3.x branch,\n // attach a single handler for both events in IE.\n jQuery.event.special[delegateType] = {\n setup: function () {\n // Handle: regular nodes (via `this.ownerDocument`), window\n // (via `this.document`) & document (via `this`).\n var doc = this.ownerDocument || this.document || this,\n dataHolder = document.documentMode ? this : doc,\n attaches = dataPriv.get(dataHolder, delegateType);\n\n // Support: IE 9 - 11+\n // We use the same native handler for focusin & focus (and focusout & blur)\n // so we need to coordinate setup & teardown parts between those events.\n // Use `delegateType` as the key as `type` is already used by `leverageNative`.\n if (!attaches) {\n if (document.documentMode) {\n this.addEventListener(delegateType, focusMappedHandler);\n } else {\n doc.addEventListener(type, focusMappedHandler, true);\n }\n }\n dataPriv.set(dataHolder, delegateType, (attaches || 0) + 1);\n },\n teardown: function () {\n var doc = this.ownerDocument || this.document || this,\n dataHolder = document.documentMode ? this : doc,\n attaches = dataPriv.get(dataHolder, delegateType) - 1;\n if (!attaches) {\n if (document.documentMode) {\n this.removeEventListener(delegateType, focusMappedHandler);\n } else {\n doc.removeEventListener(type, focusMappedHandler, true);\n }\n dataPriv.remove(dataHolder, delegateType);\n } else {\n dataPriv.set(dataHolder, delegateType, attaches);\n }\n }\n };\n });\n\n // Create mouseenter/leave events using mouseover/out and event-time checks\n // so that event delegation works in jQuery.\n // Do the same for pointerenter/pointerleave and pointerover/pointerout\n //\n // Support: Safari 7 only\n // Safari sends mouseenter too often; see:\n // https://bugs.chromium.org/p/chromium/issues/detail?id=470258\n // for the description of the bug (it existed in older Chrome versions as well).\n jQuery.each({\n mouseenter: \"mouseover\",\n mouseleave: \"mouseout\",\n pointerenter: \"pointerover\",\n pointerleave: \"pointerout\"\n }, function (orig, fix) {\n jQuery.event.special[orig] = {\n delegateType: fix,\n bindType: fix,\n handle: function (event) {\n var ret,\n target = this,\n related = event.relatedTarget,\n handleObj = event.handleObj;\n\n // For mouseenter/leave call the handler if related is outside the target.\n // NB: No relatedTarget if the mouse left/entered the browser window\n if (!related || related !== target && !jQuery.contains(target, related)) {\n event.type = handleObj.origType;\n ret = handleObj.handler.apply(this, arguments);\n event.type = fix;\n }\n return ret;\n }\n };\n });\n jQuery.fn.extend({\n on: function (types, selector, data, fn) {\n return on(this, types, selector, data, fn);\n },\n one: function (types, selector, data, fn) {\n return on(this, types, selector, data, fn, 1);\n },\n off: function (types, selector, fn) {\n var handleObj, type;\n if (types && types.preventDefault && types.handleObj) {\n // ( event ) dispatched jQuery.Event\n handleObj = types.handleObj;\n jQuery(types.delegateTarget).off(handleObj.namespace ? handleObj.origType + \".\" + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler);\n return this;\n }\n if (typeof types === \"object\") {\n // ( types-object [, selector] )\n for (type in types) {\n this.off(type, selector, types[type]);\n }\n return this;\n }\n if (selector === false || typeof selector === \"function\") {\n // ( types [, fn] )\n fn = selector;\n selector = undefined;\n }\n if (fn === false) {\n fn = returnFalse;\n }\n return this.each(function () {\n jQuery.event.remove(this, types, fn, selector);\n });\n }\n });\n var\n // Support: IE <=10 - 11, Edge 12 - 13 only\n // In IE/Edge using regex groups here causes severe slowdowns.\n // See https://connect.microsoft.com/IE/feedback/details/1736512/\n rnoInnerhtml = /