This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/web/dist/main.js.map
2020-11-29 19:40:28 +01:00

1 line
2.4 MiB

{"version":3,"file":"main.js","sources":["../node_modules/construct-style-sheets-polyfill/dist/adoptedStyleSheets.js","../node_modules/tslib/tslib.es6.js","../node_modules/lit-html/src/lib/dom.ts","../node_modules/lit-html/src/lib/template.ts","../node_modules/lit-html/src/lib/modify-template.ts","../node_modules/lit-html/src/lib/directive.ts","../node_modules/lit-html/src/lib/part.ts","../node_modules/lit-html/src/lib/template-instance.ts","../node_modules/lit-html/src/lib/template-result.ts","../node_modules/lit-html/src/lib/parts.ts","../node_modules/lit-html/src/lib/template-factory.ts","../node_modules/lit-html/src/lib/render.ts","../node_modules/lit-html/src/lib/default-template-processor.ts","../node_modules/lit-html/src/lit-html.ts","../node_modules/lit-html/src/lib/shady-render.ts","../node_modules/lit-element/src/lib/updating-element.ts","../node_modules/lit-element/src/lib/decorators.ts","../node_modules/lit-element/src/lib/css-tag.ts","../node_modules/lit-element/src/lit-element.ts","../src/constants.ts","../src/elements/SpinnerButton.ts","../src/elements/ActionButton.ts","../src/utils.ts","../node_modules/moment/moment.js","../node_modules/chart.js/dist/Chart.js","../src/elements/AdminLoginsChart.ts","../node_modules/codemirror/lib/codemirror.js","../node_modules/codemirror/addon/display/autorefresh.js","../node_modules/codemirror/mode/xml/xml.js","../node_modules/codemirror/mode/yaml/yaml.js","../node_modules/codemirror/mode/python/python.js","../src/elements/CodeMirror.ts","../src/elements/Dropdown.ts","../src/elements/FetchFillSlot.ts","../src/elements/Messages.ts","../src/elements/ModalButton.ts","../src/api/errors.ts","../src/api/client.ts","../src/elements/Sidebar.ts","../src/api/user.ts","../node_modules/@sentry/types/src/session.ts","../node_modules/@sentry/types/src/severity.ts","../node_modules/@sentry/types/src/status.ts","../node_modules/@sentry/utils/src/is.ts","../node_modules/@sentry/utils/src/browser.ts","../node_modules/@sentry/utils/src/polyfill.ts","../node_modules/@sentry/utils/src/error.ts","../node_modules/@sentry/utils/src/dsn.ts","../node_modules/@sentry/utils/src/memo.ts","../node_modules/@sentry/utils/src/stacktrace.ts","../node_modules/@sentry/utils/src/string.ts","../node_modules/@sentry/utils/src/object.ts","../node_modules/@sentry/utils/src/node.ts","../node_modules/@sentry/utils/src/misc.ts","../node_modules/@sentry/utils/src/logger.ts","../node_modules/@sentry/utils/src/supports.ts","../node_modules/@sentry/utils/src/instrument.ts","../node_modules/@sentry/utils/src/syncpromise.ts","../node_modules/@sentry/utils/src/promisebuffer.ts","../node_modules/@sentry/utils/src/time.ts","../node_modules/@sentry/hub/src/scope.ts","../node_modules/@sentry/hub/src/session.ts","../node_modules/@sentry/hub/src/hub.ts","../node_modules/@sentry/minimal/src/index.ts","../node_modules/@sentry/core/src/api.ts","../node_modules/@sentry/core/src/integration.ts","../node_modules/@sentry/core/src/baseclient.ts","../node_modules/@sentry/core/src/integrations/functiontostring.ts","../node_modules/@sentry/core/src/transports/noop.ts","../node_modules/@sentry/core/src/basebackend.ts","../node_modules/@sentry/core/src/request.ts","../node_modules/@sentry/core/src/integrations/inboundfilters.ts","../node_modules/@sentry/browser/src/tracekit.ts","../node_modules/@sentry/browser/src/parsers.ts","../node_modules/@sentry/browser/src/eventbuilder.ts","../node_modules/@sentry/browser/src/transports/base.ts","../node_modules/@sentry/browser/src/transports/fetch.ts","../node_modules/@sentry/browser/src/transports/xhr.ts","../node_modules/@sentry/browser/src/backend.ts","../node_modules/@sentry/browser/src/helpers.ts","../node_modules/@sentry/browser/src/integrations/globalhandlers.ts","../node_modules/@sentry/tracing/src/spanstatus.ts","../node_modules/@sentry/browser/src/integrations/trycatch.ts","../node_modules/@sentry/browser/src/integrations/breadcrumbs.ts","../node_modules/@sentry/browser/src/integrations/linkederrors.ts","../node_modules/@sentry/browser/src/integrations/useragent.ts","../node_modules/@sentry/browser/src/client.ts","../node_modules/@sentry/browser/src/version.ts","../node_modules/@sentry/browser/src/sdk.ts","../node_modules/@sentry/core/src/sdk.ts","../node_modules/@sentry/tracing/src/utils.ts","../node_modules/@sentry/tracing/src/errors.ts","../node_modules/@sentry/tracing/src/span.ts","../node_modules/@sentry/tracing/src/transaction.ts","../node_modules/@sentry/tracing/src/idletransaction.ts","../node_modules/@sentry/tracing/src/hubextensions.ts","../node_modules/@sentry/tracing/src/browser/backgroundtab.ts","../node_modules/@sentry/tracing/src/browser/web-vitals/lib/bindReporter.ts","../node_modules/@sentry/tracing/src/browser/web-vitals/lib/getFirstHidden.ts","../node_modules/@sentry/tracing/src/browser/web-vitals/lib/whenInput.ts","../node_modules/@sentry/tracing/src/browser/web-vitals/lib/initMetric.ts","../node_modules/@sentry/tracing/src/browser/web-vitals/lib/generateUniqueID.ts","../node_modules/@sentry/tracing/src/browser/web-vitals/lib/observe.ts","../node_modules/@sentry/tracing/src/browser/web-vitals/lib/onHidden.ts","../node_modules/@sentry/tracing/src/browser/web-vitals/getLCP.ts","../node_modules/@sentry/tracing/src/browser/web-vitals/getTTFB.ts","../node_modules/@sentry/tracing/src/browser/metrics.ts","../node_modules/@sentry/tracing/src/browser/web-vitals/getCLS.ts","../node_modules/@sentry/tracing/src/browser/web-vitals/getFID.ts","../node_modules/@sentry/tracing/src/browser/request.ts","../node_modules/@sentry/tracing/src/browser/router.ts","../node_modules/@sentry/tracing/src/browser/browsertracing.ts","../node_modules/@sentry/tracing/src/integrations/express.ts","../node_modules/@sentry/tracing/src/index.ts","../src/elements/SidebarBrand.ts","../src/api/config.ts","../src/elements/SidebarUser.ts","../src/elements/Tabs.ts","../src/elements/TokenCopyButton.ts","../src/api/token.ts","../src/common/styles.ts","../node_modules/lit-html/src/directives/until.ts","../src/elements/Table.ts","../src/pages/applications/ApplicationViewPage.ts","../src/api/application.ts","../src/pages/FlowShellCard.ts","../src/pages/RouterOutlet.ts","../src/pages/SiteShell.ts"],"sourcesContent":["(function () {\n 'use strict';\n\n if ('adoptedStyleSheets' in document) { return; }\n\n var hasShadyCss = 'ShadyCSS' in window && !window.ShadyCSS.nativeShadow;\n var deferredStyleSheets = [];\n var deferredDocumentStyleElements = [];\n var adoptedSheetsRegistry = new WeakMap();\n var sheetMetadataRegistry = new WeakMap();\n var locationRegistry = new WeakMap();\n var observerRegistry = new WeakMap();\n var appliedActionsCursorRegistry = new WeakMap();\n var state = {\n loaded: false\n };\n var frame = {\n body: null,\n CSSStyleSheet: null\n };\n var OldCSSStyleSheet = CSSStyleSheet;\n\n var importPattern = /@import\\surl(.*?);/gi;\n function instanceOfStyleSheet(instance) {\n return instance instanceof OldCSSStyleSheet || instance instanceof frame.CSSStyleSheet;\n }\n function checkAndPrepare(sheets, container) {\n var locationType = container === document ? 'Document' : 'ShadowRoot';\n if (!Array.isArray(sheets)) {\n throw new TypeError(\"Failed to set the 'adoptedStyleSheets' property on \" + locationType + \": Iterator getter is not callable.\");\n }\n if (!sheets.every(instanceOfStyleSheet)) {\n throw new TypeError(\"Failed to set the 'adoptedStyleSheets' property on \" + locationType + \": Failed to convert value to 'CSSStyleSheet'\");\n }\n var uniqueSheets = sheets.filter(function (value, index) {\n return sheets.indexOf(value) === index;\n });\n adoptedSheetsRegistry.set(container, uniqueSheets);\n return uniqueSheets;\n }\n function isDocumentLoading() {\n return document.readyState === 'loading';\n }\n function getAdoptedStyleSheet(location) {\n return adoptedSheetsRegistry.get(location.parentNode === document.documentElement ? document : location);\n }\n function rejectImports(contents) {\n var imports = contents.match(importPattern, '') || [];\n var sheetContent = contents;\n if (imports.length) {\n console.warn('@import rules are not allowed here. See https://github.com/WICG/construct-stylesheets/issues/119#issuecomment-588352418');\n imports.forEach(function (_import) {\n sheetContent = sheetContent.replace(_import, '');\n });\n }\n return sheetContent;\n }\n\n var cssStyleSheetMethods = ['addImport', 'addPageRule', 'addRule', 'deleteRule', 'insertRule', 'removeImport', 'removeRule'];\n var cssStyleSheetNewMethods = ['replace', 'replaceSync'];\n function updatePrototype(proto) {\n cssStyleSheetNewMethods.forEach(function (methodKey) {\n proto[methodKey] = function () {\n return ConstructStyleSheet.prototype[methodKey].apply(this, arguments);\n };\n });\n cssStyleSheetMethods.forEach(function (methodKey) {\n var oldMethod = proto[methodKey];\n proto[methodKey] = function () {\n var args = arguments;\n var result = oldMethod.apply(this, args);\n if (sheetMetadataRegistry.has(this)) {\n var _sheetMetadataRegistr = sheetMetadataRegistry.get(this),\n adopters = _sheetMetadataRegistr.adopters,\n actions = _sheetMetadataRegistr.actions;\n adopters.forEach(function (styleElement) {\n if (styleElement.sheet) {\n styleElement.sheet[methodKey].apply(styleElement.sheet, args);\n }\n });\n actions.push([methodKey, args]);\n }\n return result;\n };\n });\n }\n function updateAdopters(sheet) {\n var _sheetMetadataRegistr2 = sheetMetadataRegistry.get(sheet),\n adopters = _sheetMetadataRegistr2.adopters,\n basicStyleElement = _sheetMetadataRegistr2.basicStyleElement;\n adopters.forEach(function (styleElement) {\n styleElement.innerHTML = basicStyleElement.innerHTML;\n });\n }\n var ConstructStyleSheet =\n function () {\n function ConstructStyleSheet() {\n var basicStyleElement = document.createElement('style');\n if (state.loaded) {\n frame.body.appendChild(basicStyleElement);\n } else {\n document.head.appendChild(basicStyleElement);\n basicStyleElement.disabled = true;\n deferredStyleSheets.push(basicStyleElement);\n }\n var nativeStyleSheet = basicStyleElement.sheet;\n sheetMetadataRegistry.set(nativeStyleSheet, {\n adopters: new Map(),\n actions: [],\n basicStyleElement: basicStyleElement\n });\n return nativeStyleSheet;\n }\n var _proto = ConstructStyleSheet.prototype;\n _proto.replace = function replace(contents) {\n var _this = this;\n var sanitized = rejectImports(contents);\n return new Promise(function (resolve, reject) {\n if (sheetMetadataRegistry.has(_this)) {\n var _sheetMetadataRegistr3 = sheetMetadataRegistry.get(_this),\n basicStyleElement = _sheetMetadataRegistr3.basicStyleElement;\n basicStyleElement.innerHTML = sanitized;\n resolve(basicStyleElement.sheet);\n updateAdopters(_this);\n } else {\n reject(new Error(\"Can't call replace on non-constructed CSSStyleSheets.\"));\n }\n });\n };\n _proto.replaceSync = function replaceSync(contents) {\n var sanitized = rejectImports(contents);\n if (sheetMetadataRegistry.has(this)) {\n var _sheetMetadataRegistr4 = sheetMetadataRegistry.get(this),\n basicStyleElement = _sheetMetadataRegistr4.basicStyleElement;\n basicStyleElement.innerHTML = sanitized;\n updateAdopters(this);\n return basicStyleElement.sheet;\n } else {\n throw new Error(\"Failed to execute 'replaceSync' on 'CSSStyleSheet': Can't call replaceSync on non-constructed CSSStyleSheets.\");\n }\n };\n return ConstructStyleSheet;\n }();\n Object.defineProperty(ConstructStyleSheet, Symbol.hasInstance, {\n configurable: true,\n value: instanceOfStyleSheet\n });\n\n function adoptStyleSheets(location) {\n var newStyles = document.createDocumentFragment();\n var sheets = getAdoptedStyleSheet(location);\n var observer = observerRegistry.get(location);\n for (var i = 0, len = sheets.length; i < len; i++) {\n var _sheetMetadataRegistr = sheetMetadataRegistry.get(sheets[i]),\n adopters = _sheetMetadataRegistr.adopters,\n basicStyleElement = _sheetMetadataRegistr.basicStyleElement;\n var elementToAdopt = adopters.get(location);\n if (elementToAdopt) {\n observer.disconnect();\n newStyles.appendChild(elementToAdopt);\n if (!elementToAdopt.innerHTML || elementToAdopt.sheet && !elementToAdopt.sheet.cssText) {\n elementToAdopt.innerHTML = basicStyleElement.innerHTML;\n }\n observer.observe();\n } else {\n elementToAdopt = document.createElement('style');\n elementToAdopt.innerHTML = basicStyleElement.innerHTML;\n locationRegistry.set(elementToAdopt, location);\n appliedActionsCursorRegistry.set(elementToAdopt, 0);\n adopters.set(location, elementToAdopt);\n newStyles.appendChild(elementToAdopt);\n }\n if (location === document.head) {\n deferredDocumentStyleElements.push(elementToAdopt);\n }\n }\n location.insertBefore(newStyles, location.firstChild);\n for (var _i = 0, _len = sheets.length; _i < _len; _i++) {\n var _sheetMetadataRegistr2 = sheetMetadataRegistry.get(sheets[_i]),\n _adopters = _sheetMetadataRegistr2.adopters,\n actions = _sheetMetadataRegistr2.actions;\n var adoptedStyleElement = _adopters.get(location);\n var cursor = appliedActionsCursorRegistry.get(adoptedStyleElement);\n if (actions.length > 0) {\n for (var _i2 = cursor, _len2 = actions.length; _i2 < _len2; _i2++) {\n var _actions$_i = actions[_i2],\n key = _actions$_i[0],\n args = _actions$_i[1];\n adoptedStyleElement.sheet[key].apply(adoptedStyleElement.sheet, args);\n }\n appliedActionsCursorRegistry.set(adoptedStyleElement, actions.length - 1);\n }\n }\n }\n function removeExcludedStyleSheets(location, oldSheets) {\n var sheets = getAdoptedStyleSheet(location);\n for (var i = 0, len = oldSheets.length; i < len; i++) {\n if (sheets.indexOf(oldSheets[i]) > -1) {\n continue;\n }\n var _sheetMetadataRegistr3 = sheetMetadataRegistry.get(oldSheets[i]),\n adopters = _sheetMetadataRegistr3.adopters;\n var observer = observerRegistry.get(location);\n var styleElement = adopters.get(location);\n if (!styleElement) {\n styleElement = adopters.get(document.head);\n }\n observer.disconnect();\n styleElement.parentNode.removeChild(styleElement);\n observer.observe();\n }\n }\n\n function adoptAndRestoreStylesOnMutationCallback(mutations) {\n for (var i = 0, len = mutations.length; i < len; i++) {\n var _mutations$i = mutations[i],\n addedNodes = _mutations$i.addedNodes,\n removedNodes = _mutations$i.removedNodes;\n for (var _i = 0, _len = removedNodes.length; _i < _len; _i++) {\n var location = locationRegistry.get(removedNodes[_i]);\n if (location) {\n adoptStyleSheets(location);\n }\n }\n if (!hasShadyCss) {\n for (var _i2 = 0, _len2 = addedNodes.length; _i2 < _len2; _i2++) {\n var iter = document.createNodeIterator(addedNodes[_i2], NodeFilter.SHOW_ELEMENT, function (node) {\n return node.shadowRoot && node.shadowRoot.adoptedStyleSheets.length > 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT;\n },\n null, false);\n var node = void 0;\n while (node = iter.nextNode()) {\n adoptStyleSheets(node.shadowRoot);\n }\n }\n }\n }\n }\n function createObserver(location) {\n var observer = new MutationObserver(adoptAndRestoreStylesOnMutationCallback);\n var observerTool = {\n observe: function observe() {\n observer.observe(location, {\n childList: true,\n subtree: true\n });\n },\n disconnect: function disconnect() {\n observer.disconnect();\n }\n };\n observerRegistry.set(location, observerTool);\n observerTool.observe();\n }\n\n function initPolyfill() {\n var iframe = document.createElement('iframe');\n iframe.hidden = true;\n document.body.appendChild(iframe);\n frame.body = iframe.contentWindow.document.body;\n frame.CSSStyleSheet = iframe.contentWindow.CSSStyleSheet;\n updatePrototype(iframe.contentWindow.CSSStyleSheet.prototype);\n createObserver(document.body);\n state.loaded = true;\n var fragment = document.createDocumentFragment();\n for (var i = 0, len = deferredStyleSheets.length; i < len; i++) {\n deferredStyleSheets[i].disabled = false;\n fragment.appendChild(deferredStyleSheets[i]);\n }\n frame.body.appendChild(fragment);\n for (var _i = 0, _len = deferredDocumentStyleElements.length; _i < _len; _i++) {\n fragment.appendChild(deferredDocumentStyleElements[_i]);\n }\n document.body.insertBefore(fragment, document.body.firstChild);\n deferredStyleSheets.length = 0;\n deferredDocumentStyleElements.length = 0;\n }\n function initAdoptedStyleSheets() {\n var adoptedStyleSheetAccessors = {\n configurable: true,\n get: function get() {\n return adoptedSheetsRegistry.get(this) || [];\n },\n set: function set(sheets) {\n var oldSheets = adoptedSheetsRegistry.get(this) || [];\n checkAndPrepare(sheets, this);\n var location = this === document ?\n isDocumentLoading() ? this.head : this.body : this;\n var isConnected = 'isConnected' in location ? location.isConnected : document.body.contains(location);\n window.requestAnimationFrame(function () {\n if (isConnected) {\n adoptStyleSheets(location);\n removeExcludedStyleSheets(location, oldSheets);\n }\n });\n }\n };\n Object.defineProperty(Document.prototype, 'adoptedStyleSheets', adoptedStyleSheetAccessors);\n if (typeof ShadowRoot !== 'undefined') {\n var attachShadow = Element.prototype.attachShadow;\n Element.prototype.attachShadow = function () {\n var location = hasShadyCss ? this : attachShadow.apply(this, arguments);\n createObserver(location);\n return location;\n };\n Object.defineProperty(ShadowRoot.prototype, 'adoptedStyleSheets', adoptedStyleSheetAccessors);\n }\n }\n\n updatePrototype(OldCSSStyleSheet.prototype);\n window.CSSStyleSheet = ConstructStyleSheet;\n initAdoptedStyleSheets();\n if (isDocumentLoading()) {\n document.addEventListener('DOMContentLoaded', initPolyfill);\n } else {\n initPolyfill();\n }\n\n}());\n","/*! *****************************************************************************\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***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\ninterface MaybePolyfilledCe extends CustomElementRegistry {\n readonly polyfillWrapFlushCallback?: object;\n}\n\n/**\n * True if the custom elements polyfill is in use.\n */\nexport const isCEPolyfill = typeof window !== 'undefined' &&\n window.customElements != null &&\n (window.customElements as MaybePolyfilledCe).polyfillWrapFlushCallback !==\n undefined;\n\n/**\n * Reparents nodes, starting from `start` (inclusive) to `end` (exclusive),\n * into another container (could be the same container), before `before`. If\n * `before` is null, it appends the nodes to the container.\n */\nexport const reparentNodes =\n (container: Node,\n start: Node|null,\n end: Node|null = null,\n before: Node|null = null): void => {\n while (start !== end) {\n const n = start!.nextSibling;\n container.insertBefore(start!, before);\n start = n;\n }\n };\n\n/**\n * Removes nodes, starting from `start` (inclusive) to `end` (exclusive), from\n * `container`.\n */\nexport const removeNodes =\n (container: Node, start: Node|null, end: Node|null = null): void => {\n while (start !== end) {\n const n = start!.nextSibling;\n container.removeChild(start!);\n start = n;\n }\n };\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {TemplateResult} from './template-result.js';\n\n/**\n * An expression marker with embedded unique key to avoid collision with\n * possible text in templates.\n */\nexport const marker = `{{lit-${String(Math.random()).slice(2)}}}`;\n\n/**\n * An expression marker used text-positions, multi-binding attributes, and\n * attributes with markup-like text values.\n */\nexport const nodeMarker = `<!--${marker}-->`;\n\nexport const markerRegex = new RegExp(`${marker}|${nodeMarker}`);\n\n/**\n * Suffix appended to all bound attribute names.\n */\nexport const boundAttributeSuffix = '$lit$';\n\n/**\n * An updatable Template that tracks the location of dynamic parts.\n */\nexport class Template {\n readonly parts: TemplatePart[] = [];\n readonly element: HTMLTemplateElement;\n\n constructor(result: TemplateResult, element: HTMLTemplateElement) {\n this.element = element;\n\n const nodesToRemove: Node[] = [];\n const stack: Node[] = [];\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(\n element.content,\n 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */,\n null,\n false);\n // Keeps track of the last index associated with a part. We try to delete\n // unnecessary nodes, but we never want to associate two different parts\n // to the same index. They must have a constant node between.\n let lastPartIndex = 0;\n let index = -1;\n let partIndex = 0;\n const {strings, values: {length}} = result;\n while (partIndex < length) {\n const node = walker.nextNode() as Element | Comment | Text | null;\n if (node === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop()!;\n continue;\n }\n index++;\n\n if (node.nodeType === 1 /* Node.ELEMENT_NODE */) {\n if ((node as Element).hasAttributes()) {\n const attributes = (node as Element).attributes;\n const {length} = attributes;\n // Per\n // https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap,\n // attributes are not guaranteed to be returned in document order.\n // In particular, Edge/IE can return them out of order, so we cannot\n // assume a correspondence between part index and attribute index.\n let count = 0;\n for (let i = 0; i < length; i++) {\n if (endsWith(attributes[i].name, boundAttributeSuffix)) {\n count++;\n }\n }\n while (count-- > 0) {\n // Get the template literal section leading up to the first\n // expression in this attribute\n const stringForPart = strings[partIndex];\n // Find the attribute name\n const name = lastAttributeNameRegex.exec(stringForPart)![2];\n // Find the corresponding attribute\n // All bound attributes have had a suffix added in\n // TemplateResult#getHTML to opt out of special attribute\n // handling. To look up the attribute value we also need to add\n // the suffix.\n const attributeLookupName =\n name.toLowerCase() + boundAttributeSuffix;\n const attributeValue =\n (node as Element).getAttribute(attributeLookupName)!;\n (node as Element).removeAttribute(attributeLookupName);\n const statics = attributeValue.split(markerRegex);\n this.parts.push({type: 'attribute', index, name, strings: statics});\n partIndex += statics.length - 1;\n }\n }\n if ((node as Element).tagName === 'TEMPLATE') {\n stack.push(node);\n walker.currentNode = (node as HTMLTemplateElement).content;\n }\n } else if (node.nodeType === 3 /* Node.TEXT_NODE */) {\n const data = (node as Text).data;\n if (data.indexOf(marker) >= 0) {\n const parent = node.parentNode!;\n const strings = data.split(markerRegex);\n const lastIndex = strings.length - 1;\n // Generate a new text node for each literal section\n // These nodes are also used as the markers for node parts\n for (let i = 0; i < lastIndex; i++) {\n let insert: Node;\n let s = strings[i];\n if (s === '') {\n insert = createMarker();\n } else {\n const match = lastAttributeNameRegex.exec(s);\n if (match !== null && endsWith(match[2], boundAttributeSuffix)) {\n s = s.slice(0, match.index) + match[1] +\n match[2].slice(0, -boundAttributeSuffix.length) + match[3];\n }\n insert = document.createTextNode(s);\n }\n parent.insertBefore(insert, node);\n this.parts.push({type: 'node', index: ++index});\n }\n // If there's no text, we must insert a comment to mark our place.\n // Else, we can trust it will stick around after cloning.\n if (strings[lastIndex] === '') {\n parent.insertBefore(createMarker(), node);\n nodesToRemove.push(node);\n } else {\n (node as Text).data = strings[lastIndex];\n }\n // We have a part for each match found\n partIndex += lastIndex;\n }\n } else if (node.nodeType === 8 /* Node.COMMENT_NODE */) {\n if ((node as Comment).data === marker) {\n const parent = node.parentNode!;\n // Add a new marker node to be the startNode of the Part if any of\n // the following are true:\n // * We don't have a previousSibling\n // * The previousSibling is already the start of a previous part\n if (node.previousSibling === null || index === lastPartIndex) {\n index++;\n parent.insertBefore(createMarker(), node);\n }\n lastPartIndex = index;\n this.parts.push({type: 'node', index});\n // If we don't have a nextSibling, keep this node so we have an end.\n // Else, we can remove it to save future costs.\n if (node.nextSibling === null) {\n (node as Comment).data = '';\n } else {\n nodesToRemove.push(node);\n index--;\n }\n partIndex++;\n } else {\n let i = -1;\n while ((i = (node as Comment).data.indexOf(marker, i + 1)) !== -1) {\n // Comment node has a binding marker inside, make an inactive part\n // The binding won't work, but subsequent bindings will\n // TODO (justinfagnani): consider whether it's even worth it to\n // make bindings in comments work\n this.parts.push({type: 'node', index: -1});\n partIndex++;\n }\n }\n }\n }\n\n // Remove text binding nodes after the walk to not disturb the TreeWalker\n for (const n of nodesToRemove) {\n n.parentNode!.removeChild(n);\n }\n }\n}\n\nconst endsWith = (str: string, suffix: string): boolean => {\n const index = str.length - suffix.length;\n return index >= 0 && str.slice(index) === suffix;\n};\n\n/**\n * A placeholder for a dynamic expression in an HTML template.\n *\n * There are two built-in part types: AttributePart and NodePart. NodeParts\n * always represent a single dynamic expression, while AttributeParts may\n * represent as many expressions are contained in the attribute.\n *\n * A Template's parts are mutable, so parts can be replaced or modified\n * (possibly to implement different template semantics). The contract is that\n * parts can only be replaced, not removed, added or reordered, and parts must\n * always consume the correct number of values in their `update()` method.\n *\n * TODO(justinfagnani): That requirement is a little fragile. A\n * TemplateInstance could instead be more careful about which values it gives\n * to Part.update().\n */\nexport type TemplatePart = {\n readonly type: 'node'; index: number;\n}|{\n readonly type: 'attribute';\n index: number;\n readonly name: string;\n readonly strings: ReadonlyArray<string>;\n};\n\nexport const isTemplatePartActive = (part: TemplatePart) => part.index !== -1;\n\n// Allows `document.createComment('')` to be renamed for a\n// small manual size-savings.\nexport const createMarker = () => document.createComment('');\n\n/**\n * This regex extracts the attribute name preceding an attribute-position\n * expression. It does this by matching the syntax allowed for attributes\n * against the string literal directly preceding the expression, assuming that\n * the expression is in an attribute-value position.\n *\n * See attributes in the HTML spec:\n * https://www.w3.org/TR/html5/syntax.html#elements-attributes\n *\n * \" \\x09\\x0a\\x0c\\x0d\" are HTML space characters:\n * https://www.w3.org/TR/html5/infrastructure.html#space-characters\n *\n * \"\\0-\\x1F\\x7F-\\x9F\" are Unicode control characters, which includes every\n * space character except \" \".\n *\n * So an attribute is:\n * * The name: any character except a control character, space character, ('),\n * (\"), \">\", \"=\", or \"/\"\n * * Followed by zero or more space characters\n * * Followed by \"=\"\n * * Followed by zero or more space characters\n * * Followed by:\n * * Any character except space, ('), (\"), \"<\", \">\", \"=\", (`), or\n * * (\") then any non-(\"), or\n * * (') then any non-(')\n */\nexport const lastAttributeNameRegex =\n // eslint-disable-next-line no-control-regex\n /([ \\x09\\x0a\\x0c\\x0d])([^\\0-\\x1F\\x7F-\\x9F \"'>=/]+)([ \\x09\\x0a\\x0c\\x0d]*=[ \\x09\\x0a\\x0c\\x0d]*(?:[^ \\x09\\x0a\\x0c\\x0d\"'`<>=]*|\"[^\"]*|'[^']*))$/;\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {isTemplatePartActive, Template, TemplatePart} from './template.js';\n\nconst walkerNodeFilter = 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */;\n\n/**\n * Removes the list of nodes from a Template safely. In addition to removing\n * nodes from the Template, the Template part indices are updated to match\n * the mutated Template DOM.\n *\n * As the template is walked the removal state is tracked and\n * part indices are adjusted as needed.\n *\n * div\n * div#1 (remove) <-- start removing (removing node is div#1)\n * div\n * div#2 (remove) <-- continue removing (removing node is still div#1)\n * div\n * div <-- stop removing since previous sibling is the removing node (div#1,\n * removed 4 nodes)\n */\nexport function removeNodesFromTemplate(\n template: Template, nodesToRemove: Set<Node>) {\n const {element: {content}, parts} = template;\n const walker =\n document.createTreeWalker(content, walkerNodeFilter, null, false);\n let partIndex = nextActiveIndexInTemplateParts(parts);\n let part = parts[partIndex];\n let nodeIndex = -1;\n let removeCount = 0;\n const nodesToRemoveInTemplate = [];\n let currentRemovingNode: Node|null = null;\n while (walker.nextNode()) {\n nodeIndex++;\n const node = walker.currentNode as Element;\n // End removal if stepped past the removing node\n if (node.previousSibling === currentRemovingNode) {\n currentRemovingNode = null;\n }\n // A node to remove was found in the template\n if (nodesToRemove.has(node)) {\n nodesToRemoveInTemplate.push(node);\n // Track node we're removing\n if (currentRemovingNode === null) {\n currentRemovingNode = node;\n }\n }\n // When removing, increment count by which to adjust subsequent part indices\n if (currentRemovingNode !== null) {\n removeCount++;\n }\n while (part !== undefined && part.index === nodeIndex) {\n // If part is in a removed node deactivate it by setting index to -1 or\n // adjust the index as needed.\n part.index = currentRemovingNode !== null ? -1 : part.index - removeCount;\n // go to the next active part.\n partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n part = parts[partIndex];\n }\n }\n nodesToRemoveInTemplate.forEach((n) => n.parentNode!.removeChild(n));\n}\n\nconst countNodes = (node: Node) => {\n let count = (node.nodeType === 11 /* Node.DOCUMENT_FRAGMENT_NODE */) ? 0 : 1;\n const walker = document.createTreeWalker(node, walkerNodeFilter, null, false);\n while (walker.nextNode()) {\n count++;\n }\n return count;\n};\n\nconst nextActiveIndexInTemplateParts =\n (parts: TemplatePart[], startIndex = -1) => {\n for (let i = startIndex + 1; i < parts.length; i++) {\n const part = parts[i];\n if (isTemplatePartActive(part)) {\n return i;\n }\n }\n return -1;\n };\n\n/**\n * Inserts the given node into the Template, optionally before the given\n * refNode. In addition to inserting the node into the Template, the Template\n * part indices are updated to match the mutated Template DOM.\n */\nexport function insertNodeIntoTemplate(\n template: Template, node: Node, refNode: Node|null = null) {\n const {element: {content}, parts} = template;\n // If there's no refNode, then put node at end of template.\n // No part indices need to be shifted in this case.\n if (refNode === null || refNode === undefined) {\n content.appendChild(node);\n return;\n }\n const walker =\n document.createTreeWalker(content, walkerNodeFilter, null, false);\n let partIndex = nextActiveIndexInTemplateParts(parts);\n let insertCount = 0;\n let walkerIndex = -1;\n while (walker.nextNode()) {\n walkerIndex++;\n const walkerNode = walker.currentNode as Element;\n if (walkerNode === refNode) {\n insertCount = countNodes(node);\n refNode.parentNode!.insertBefore(node, refNode);\n }\n while (partIndex !== -1 && parts[partIndex].index === walkerIndex) {\n // If we've inserted the node, simply adjust all subsequent parts\n if (insertCount > 0) {\n while (partIndex !== -1) {\n parts[partIndex].index += insertCount;\n partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n }\n return;\n }\n partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n }\n }\n}\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {Part} from './part.js';\n\nconst directives = new WeakMap<object, true>();\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type DirectiveFactory = (...args: any[]) => object;\n\nexport type DirectiveFn = (part: Part) => void;\n\n/**\n * Brands a function as a directive factory function so that lit-html will call\n * the function during template rendering, rather than passing as a value.\n *\n * A _directive_ is a function that takes a Part as an argument. It has the\n * signature: `(part: Part) => void`.\n *\n * A directive _factory_ is a function that takes arguments for data and\n * configuration and returns a directive. Users of directive usually refer to\n * the directive factory as the directive. For example, \"The repeat directive\".\n *\n * Usually a template author will invoke a directive factory in their template\n * with relevant arguments, which will then return a directive function.\n *\n * Here's an example of using the `repeat()` directive factory that takes an\n * array and a function to render an item:\n *\n * ```js\n * html`<ul><${repeat(items, (item) => html`<li>${item}</li>`)}</ul>`\n * ```\n *\n * When `repeat` is invoked, it returns a directive function that closes over\n * `items` and the template function. When the outer template is rendered, the\n * return directive function is called with the Part for the expression.\n * `repeat` then performs it's custom logic to render multiple items.\n *\n * @param f The directive factory function. Must be a function that returns a\n * function of the signature `(part: Part) => void`. The returned function will\n * be called with the part object.\n *\n * @example\n *\n * import {directive, html} from 'lit-html';\n *\n * const immutable = directive((v) => (part) => {\n * if (part.value !== v) {\n * part.setValue(v)\n * }\n * });\n */\nexport const directive = <F extends DirectiveFactory>(f: F): F =>\n ((...args: unknown[]) => {\n const d = f(...args);\n directives.set(d, true);\n return d;\n }) as F;\n\nexport const isDirective = (o: unknown): o is DirectiveFn => {\n return typeof o === 'function' && directives.has(o);\n};\n","/**\n * @license\n * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * The Part interface represents a dynamic part of a template instance rendered\n * by lit-html.\n */\nexport interface Part {\n readonly value: unknown;\n\n /**\n * Sets the current part value, but does not write it to the DOM.\n * @param value The value that will be committed.\n */\n setValue(value: unknown): void;\n\n /**\n * Commits the current part value, causing it to actually be written to the\n * DOM.\n *\n * Directives are run at the start of `commit`, so that if they call\n * `part.setValue(...)` synchronously that value will be used in the current\n * commit, and there's no need to call `part.commit()` within the directive.\n * If directives set a part value asynchronously, then they must call\n * `part.commit()` manually.\n */\n commit(): void;\n}\n\n/**\n * A sentinel value that signals that a value was handled by a directive and\n * should not be written to the DOM.\n */\nexport const noChange = {};\n\n/**\n * A sentinel value that signals a NodePart to fully clear its content.\n */\nexport const nothing = {};\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {isCEPolyfill} from './dom.js';\nimport {Part} from './part.js';\nimport {RenderOptions} from './render-options.js';\nimport {TemplateProcessor} from './template-processor.js';\nimport {isTemplatePartActive, Template, TemplatePart} from './template.js';\n\n/**\n * An instance of a `Template` that can be attached to the DOM and updated\n * with new values.\n */\nexport class TemplateInstance {\n private readonly __parts: Array<Part|undefined> = [];\n readonly processor: TemplateProcessor;\n readonly options: RenderOptions;\n readonly template: Template;\n\n constructor(\n template: Template, processor: TemplateProcessor,\n options: RenderOptions) {\n this.template = template;\n this.processor = processor;\n this.options = options;\n }\n\n update(values: readonly unknown[]) {\n let i = 0;\n for (const part of this.__parts) {\n if (part !== undefined) {\n part.setValue(values[i]);\n }\n i++;\n }\n for (const part of this.__parts) {\n if (part !== undefined) {\n part.commit();\n }\n }\n }\n\n _clone(): DocumentFragment {\n // There are a number of steps in the lifecycle of a template instance's\n // DOM fragment:\n // 1. Clone - create the instance fragment\n // 2. Adopt - adopt into the main document\n // 3. Process - find part markers and create parts\n // 4. Upgrade - upgrade custom elements\n // 5. Update - set node, attribute, property, etc., values\n // 6. Connect - connect to the document. Optional and outside of this\n // method.\n //\n // We have a few constraints on the ordering of these steps:\n // * We need to upgrade before updating, so that property values will pass\n // through any property setters.\n // * We would like to process before upgrading so that we're sure that the\n // cloned fragment is inert and not disturbed by self-modifying DOM.\n // * We want custom elements to upgrade even in disconnected fragments.\n //\n // Given these constraints, with full custom elements support we would\n // prefer the order: Clone, Process, Adopt, Upgrade, Update, Connect\n //\n // But Safari does not implement CustomElementRegistry#upgrade, so we\n // can not implement that order and still have upgrade-before-update and\n // upgrade disconnected fragments. So we instead sacrifice the\n // process-before-upgrade constraint, since in Custom Elements v1 elements\n // must not modify their light DOM in the constructor. We still have issues\n // when co-existing with CEv0 elements like Polymer 1, and with polyfills\n // that don't strictly adhere to the no-modification rule because shadow\n // DOM, which may be created in the constructor, is emulated by being placed\n // in the light DOM.\n //\n // The resulting order is on native is: Clone, Adopt, Upgrade, Process,\n // Update, Connect. document.importNode() performs Clone, Adopt, and Upgrade\n // in one step.\n //\n // The Custom Elements v1 polyfill supports upgrade(), so the order when\n // polyfilled is the more ideal: Clone, Process, Adopt, Upgrade, Update,\n // Connect.\n\n const fragment = isCEPolyfill ?\n this.template.element.content.cloneNode(true) as DocumentFragment :\n document.importNode(this.template.element.content, true);\n\n const stack: Node[] = [];\n const parts = this.template.parts;\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(\n fragment,\n 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */,\n null,\n false);\n let partIndex = 0;\n let nodeIndex = 0;\n let part: TemplatePart;\n let node = walker.nextNode();\n // Loop through all the nodes and parts of a template\n while (partIndex < parts.length) {\n part = parts[partIndex];\n if (!isTemplatePartActive(part)) {\n this.__parts.push(undefined);\n partIndex++;\n continue;\n }\n\n // Progress the tree walker until we find our next part's node.\n // Note that multiple parts may share the same node (attribute parts\n // on a single element), so this loop may not run at all.\n while (nodeIndex < part.index) {\n nodeIndex++;\n if (node!.nodeName === 'TEMPLATE') {\n stack.push(node!);\n walker.currentNode = (node as HTMLTemplateElement).content;\n }\n if ((node = walker.nextNode()) === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop()!;\n node = walker.nextNode();\n }\n }\n\n // We've arrived at our part's node.\n if (part.type === 'node') {\n const part = this.processor.handleTextExpression(this.options);\n part.insertAfterNode(node!.previousSibling!);\n this.__parts.push(part);\n } else {\n this.__parts.push(...this.processor.handleAttributeExpressions(\n node as Element, part.name, part.strings, this.options));\n }\n partIndex++;\n }\n\n if (isCEPolyfill) {\n document.adoptNode(fragment);\n customElements.upgrade(fragment);\n }\n return fragment;\n }\n}\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * @module lit-html\n */\n\nimport {reparentNodes} from './dom.js';\nimport {TemplateProcessor} from './template-processor.js';\nimport {boundAttributeSuffix, lastAttributeNameRegex, marker, nodeMarker} from './template.js';\n\ndeclare const trustedTypes: typeof window.trustedTypes;\n/**\n * Our TrustedTypePolicy for HTML which is declared using the html template\n * tag function.\n *\n * That HTML is a developer-authored constant, and is parsed with innerHTML\n * before any untrusted expressions have been mixed in. Therefor it is\n * considered safe by construction.\n */\nconst policy = window.trustedTypes &&\n trustedTypes!.createPolicy('lit-html', {createHTML: (s) => s});\n\nconst commentMarker = ` ${marker} `;\n\n/**\n * The return type of `html`, which holds a Template and the values from\n * interpolated expressions.\n */\nexport class TemplateResult {\n readonly strings: TemplateStringsArray;\n readonly values: readonly unknown[];\n readonly type: string;\n readonly processor: TemplateProcessor;\n\n constructor(\n strings: TemplateStringsArray, values: readonly unknown[], type: string,\n processor: TemplateProcessor) {\n this.strings = strings;\n this.values = values;\n this.type = type;\n this.processor = processor;\n }\n\n /**\n * Returns a string of HTML used to create a `<template>` element.\n */\n getHTML(): string {\n const l = this.strings.length - 1;\n let html = '';\n let isCommentBinding = false;\n\n for (let i = 0; i < l; i++) {\n const s = this.strings[i];\n // For each binding we want to determine the kind of marker to insert\n // into the template source before it's parsed by the browser's HTML\n // parser. The marker type is based on whether the expression is in an\n // attribute, text, or comment position.\n // * For node-position bindings we insert a comment with the marker\n // sentinel as its text content, like <!--{{lit-guid}}-->.\n // * For attribute bindings we insert just the marker sentinel for the\n // first binding, so that we support unquoted attribute bindings.\n // Subsequent bindings can use a comment marker because multi-binding\n // attributes must be quoted.\n // * For comment bindings we insert just the marker sentinel so we don't\n // close the comment.\n //\n // The following code scans the template source, but is *not* an HTML\n // parser. We don't need to track the tree structure of the HTML, only\n // whether a binding is inside a comment, and if not, if it appears to be\n // the first binding in an attribute.\n const commentOpen = s.lastIndexOf('<!--');\n // We're in comment position if we have a comment open with no following\n // comment close. Because <-- can appear in an attribute value there can\n // be false positives.\n isCommentBinding = (commentOpen > -1 || isCommentBinding) &&\n s.indexOf('-->', commentOpen + 1) === -1;\n // Check to see if we have an attribute-like sequence preceding the\n // expression. This can match \"name=value\" like structures in text,\n // comments, and attribute values, so there can be false-positives.\n const attributeMatch = lastAttributeNameRegex.exec(s);\n if (attributeMatch === null) {\n // We're only in this branch if we don't have a attribute-like\n // preceding sequence. For comments, this guards against unusual\n // attribute values like <div foo=\"<!--${'bar'}\">. Cases like\n // <!-- foo=${'bar'}--> are handled correctly in the attribute branch\n // below.\n html += s + (isCommentBinding ? commentMarker : nodeMarker);\n } else {\n // For attributes we use just a marker sentinel, and also append a\n // $lit$ suffix to the name to opt-out of attribute-specific parsing\n // that IE and Edge do for style and certain SVG attributes.\n html += s.substr(0, attributeMatch.index) + attributeMatch[1] +\n attributeMatch[2] + boundAttributeSuffix + attributeMatch[3] +\n marker;\n }\n }\n html += this.strings[l];\n return html;\n }\n\n getTemplateElement(): HTMLTemplateElement {\n const template = document.createElement('template');\n let value = this.getHTML();\n if (policy !== undefined) {\n // this is secure because `this.strings` is a TemplateStringsArray.\n // TODO: validate this when\n // https://github.com/tc39/proposal-array-is-template-object is\n // implemented.\n value = policy.createHTML(value) as unknown as string;\n }\n template.innerHTML = value;\n return template;\n }\n}\n\n/**\n * A TemplateResult for SVG fragments.\n *\n * This class wraps HTML in an `<svg>` tag in order to parse its contents in the\n * SVG namespace, then modifies the template to remove the `<svg>` tag so that\n * clones only container the original fragment.\n */\nexport class SVGTemplateResult extends TemplateResult {\n getHTML(): string {\n return `<svg>${super.getHTML()}</svg>`;\n }\n\n getTemplateElement(): HTMLTemplateElement {\n const template = super.getTemplateElement();\n const content = template.content;\n const svgElement = content.firstChild!;\n content.removeChild(svgElement);\n reparentNodes(content, svgElement.firstChild);\n return template;\n }\n}\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {isDirective} from './directive.js';\nimport {removeNodes} from './dom.js';\nimport {noChange, nothing, Part} from './part.js';\nimport {RenderOptions} from './render-options.js';\nimport {TemplateInstance} from './template-instance.js';\nimport {TemplateResult} from './template-result.js';\nimport {createMarker} from './template.js';\n\n// https://tc39.github.io/ecma262/#sec-typeof-operator\nexport type Primitive = null|undefined|boolean|number|string|symbol|bigint;\nexport const isPrimitive = (value: unknown): value is Primitive => {\n return (\n value === null ||\n !(typeof value === 'object' || typeof value === 'function'));\n};\nexport const isIterable = (value: unknown): value is Iterable<unknown> => {\n return Array.isArray(value) ||\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n !!(value && (value as any)[Symbol.iterator]);\n};\n\n/**\n * Writes attribute values to the DOM for a group of AttributeParts bound to a\n * single attribute. The value is only set once even if there are multiple parts\n * for an attribute.\n */\nexport class AttributeCommitter {\n readonly element: Element;\n readonly name: string;\n readonly strings: ReadonlyArray<string>;\n readonly parts: ReadonlyArray<AttributePart>;\n dirty = true;\n\n constructor(element: Element, name: string, strings: ReadonlyArray<string>) {\n this.element = element;\n this.name = name;\n this.strings = strings;\n this.parts = [];\n for (let i = 0; i < strings.length - 1; i++) {\n (this.parts as AttributePart[])[i] = this._createPart();\n }\n }\n\n /**\n * Creates a single part. Override this to create a differnt type of part.\n */\n protected _createPart(): AttributePart {\n return new AttributePart(this);\n }\n\n protected _getValue(): unknown {\n const strings = this.strings;\n const l = strings.length - 1;\n const parts = this.parts;\n\n // If we're assigning an attribute via syntax like:\n // attr=\"${foo}\" or attr=${foo}\n // but not\n // attr=\"${foo} ${bar}\" or attr=\"${foo} baz\"\n // then we don't want to coerce the attribute value into one long\n // string. Instead we want to just return the value itself directly,\n // so that sanitizeDOMValue can get the actual value rather than\n // String(value)\n // The exception is if v is an array, in which case we do want to smash\n // it together into a string without calling String() on the array.\n //\n // This also allows trusted values (when using TrustedTypes) being\n // assigned to DOM sinks without being stringified in the process.\n if (l === 1 && strings[0] === '' && strings[1] === '') {\n const v = parts[0].value;\n if (typeof v === 'symbol') {\n return String(v);\n }\n if (typeof v === 'string' || !isIterable(v)) {\n return v;\n }\n }\n let text = '';\n\n for (let i = 0; i < l; i++) {\n text += strings[i];\n const part = parts[i];\n if (part !== undefined) {\n const v = part.value;\n if (isPrimitive(v) || !isIterable(v)) {\n text += typeof v === 'string' ? v : String(v);\n } else {\n for (const t of v) {\n text += typeof t === 'string' ? t : String(t);\n }\n }\n }\n }\n\n text += strings[l];\n return text;\n }\n\n commit(): void {\n if (this.dirty) {\n this.dirty = false;\n this.element.setAttribute(this.name, this._getValue() as string);\n }\n }\n}\n\n/**\n * A Part that controls all or part of an attribute value.\n */\nexport class AttributePart implements Part {\n readonly committer: AttributeCommitter;\n value: unknown = undefined;\n\n constructor(committer: AttributeCommitter) {\n this.committer = committer;\n }\n\n setValue(value: unknown): void {\n if (value !== noChange && (!isPrimitive(value) || value !== this.value)) {\n this.value = value;\n // If the value is a not a directive, dirty the committer so that it'll\n // call setAttribute. If the value is a directive, it'll dirty the\n // committer if it calls setValue().\n if (!isDirective(value)) {\n this.committer.dirty = true;\n }\n }\n }\n\n commit() {\n while (isDirective(this.value)) {\n const directive = this.value;\n this.value = noChange;\n directive(this);\n }\n if (this.value === noChange) {\n return;\n }\n this.committer.commit();\n }\n}\n\n/**\n * A Part that controls a location within a Node tree. Like a Range, NodePart\n * has start and end locations and can set and update the Nodes between those\n * locations.\n *\n * NodeParts support several value types: primitives, Nodes, TemplateResults,\n * as well as arrays and iterables of those types.\n */\nexport class NodePart implements Part {\n readonly options: RenderOptions;\n startNode!: Node;\n endNode!: Node;\n value: unknown = undefined;\n private __pendingValue: unknown = undefined;\n\n constructor(options: RenderOptions) {\n this.options = options;\n }\n\n /**\n * Appends this part into a container.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n appendInto(container: Node) {\n this.startNode = container.appendChild(createMarker());\n this.endNode = container.appendChild(createMarker());\n }\n\n /**\n * Inserts this part after the `ref` node (between `ref` and `ref`'s next\n * sibling). Both `ref` and its next sibling must be static, unchanging nodes\n * such as those that appear in a literal section of a template.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n insertAfterNode(ref: Node) {\n this.startNode = ref;\n this.endNode = ref.nextSibling!;\n }\n\n /**\n * Appends this part into a parent part.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n appendIntoPart(part: NodePart) {\n part.__insert(this.startNode = createMarker());\n part.__insert(this.endNode = createMarker());\n }\n\n /**\n * Inserts this part after the `ref` part.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n insertAfterPart(ref: NodePart) {\n ref.__insert(this.startNode = createMarker());\n this.endNode = ref.endNode;\n ref.endNode = this.startNode;\n }\n\n setValue(value: unknown): void {\n this.__pendingValue = value;\n }\n\n commit() {\n if (this.startNode.parentNode === null) {\n return;\n }\n while (isDirective(this.__pendingValue)) {\n const directive = this.__pendingValue;\n this.__pendingValue = noChange;\n directive(this);\n }\n const value = this.__pendingValue;\n if (value === noChange) {\n return;\n }\n if (isPrimitive(value)) {\n if (value !== this.value) {\n this.__commitText(value);\n }\n } else if (value instanceof TemplateResult) {\n this.__commitTemplateResult(value);\n } else if (value instanceof Node) {\n this.__commitNode(value);\n } else if (isIterable(value)) {\n this.__commitIterable(value);\n } else if (value === nothing) {\n this.value = nothing;\n this.clear();\n } else {\n // Fallback, will render the string representation\n this.__commitText(value);\n }\n }\n\n private __insert(node: Node) {\n this.endNode.parentNode!.insertBefore(node, this.endNode);\n }\n\n private __commitNode(value: Node): void {\n if (this.value === value) {\n return;\n }\n this.clear();\n this.__insert(value);\n this.value = value;\n }\n\n private __commitText(value: unknown): void {\n const node = this.startNode.nextSibling!;\n value = value == null ? '' : value;\n // If `value` isn't already a string, we explicitly convert it here in case\n // it can't be implicitly converted - i.e. it's a symbol.\n const valueAsString: string =\n typeof value === 'string' ? value : String(value);\n if (node === this.endNode.previousSibling &&\n node.nodeType === 3 /* Node.TEXT_NODE */) {\n // If we only have a single text node between the markers, we can just\n // set its value, rather than replacing it.\n // TODO(justinfagnani): Can we just check if this.value is primitive?\n (node as Text).data = valueAsString;\n } else {\n this.__commitNode(document.createTextNode(valueAsString));\n }\n this.value = value;\n }\n\n private __commitTemplateResult(value: TemplateResult): void {\n const template = this.options.templateFactory(value);\n if (this.value instanceof TemplateInstance &&\n this.value.template === template) {\n this.value.update(value.values);\n } else {\n // Make sure we propagate the template processor from the TemplateResult\n // so that we use its syntax extension, etc. The template factory comes\n // from the render function options so that it can control template\n // caching and preprocessing.\n const instance =\n new TemplateInstance(template, value.processor, this.options);\n const fragment = instance._clone();\n instance.update(value.values);\n this.__commitNode(fragment);\n this.value = instance;\n }\n }\n\n private __commitIterable(value: Iterable<unknown>): void {\n // For an Iterable, we create a new InstancePart per item, then set its\n // value to the item. This is a little bit of overhead for every item in\n // an Iterable, but it lets us recurse easily and efficiently update Arrays\n // of TemplateResults that will be commonly returned from expressions like:\n // array.map((i) => html`${i}`), by reusing existing TemplateInstances.\n\n // If _value is an array, then the previous render was of an\n // iterable and _value will contain the NodeParts from the previous\n // render. If _value is not an array, clear this part and make a new\n // array for NodeParts.\n if (!Array.isArray(this.value)) {\n this.value = [];\n this.clear();\n }\n\n // Lets us keep track of how many items we stamped so we can clear leftover\n // items from a previous render\n const itemParts = this.value as NodePart[];\n let partIndex = 0;\n let itemPart: NodePart|undefined;\n\n for (const item of value) {\n // Try to reuse an existing part\n itemPart = itemParts[partIndex];\n\n // If no existing part, create a new one\n if (itemPart === undefined) {\n itemPart = new NodePart(this.options);\n itemParts.push(itemPart);\n if (partIndex === 0) {\n itemPart.appendIntoPart(this);\n } else {\n itemPart.insertAfterPart(itemParts[partIndex - 1]);\n }\n }\n itemPart.setValue(item);\n itemPart.commit();\n partIndex++;\n }\n\n if (partIndex < itemParts.length) {\n // Truncate the parts array so _value reflects the current state\n itemParts.length = partIndex;\n this.clear(itemPart && itemPart.endNode);\n }\n }\n\n clear(startNode: Node = this.startNode) {\n removeNodes(\n this.startNode.parentNode!, startNode.nextSibling!, this.endNode);\n }\n}\n\n/**\n * Implements a boolean attribute, roughly as defined in the HTML\n * specification.\n *\n * If the value is truthy, then the attribute is present with a value of\n * ''. If the value is falsey, the attribute is removed.\n */\nexport class BooleanAttributePart implements Part {\n readonly element: Element;\n readonly name: string;\n readonly strings: readonly string[];\n value: unknown = undefined;\n private __pendingValue: unknown = undefined;\n\n constructor(element: Element, name: string, strings: readonly string[]) {\n if (strings.length !== 2 || strings[0] !== '' || strings[1] !== '') {\n throw new Error(\n 'Boolean attributes can only contain a single expression');\n }\n this.element = element;\n this.name = name;\n this.strings = strings;\n }\n\n setValue(value: unknown): void {\n this.__pendingValue = value;\n }\n\n commit() {\n while (isDirective(this.__pendingValue)) {\n const directive = this.__pendingValue;\n this.__pendingValue = noChange;\n directive(this);\n }\n if (this.__pendingValue === noChange) {\n return;\n }\n const value = !!this.__pendingValue;\n if (this.value !== value) {\n if (value) {\n this.element.setAttribute(this.name, '');\n } else {\n this.element.removeAttribute(this.name);\n }\n this.value = value;\n }\n this.__pendingValue = noChange;\n }\n}\n\n/**\n * Sets attribute values for PropertyParts, so that the value is only set once\n * even if there are multiple parts for a property.\n *\n * If an expression controls the whole property value, then the value is simply\n * assigned to the property under control. If there are string literals or\n * multiple expressions, then the strings are expressions are interpolated into\n * a string first.\n */\nexport class PropertyCommitter extends AttributeCommitter {\n readonly single: boolean;\n\n constructor(element: Element, name: string, strings: ReadonlyArray<string>) {\n super(element, name, strings);\n this.single =\n (strings.length === 2 && strings[0] === '' && strings[1] === '');\n }\n\n protected _createPart(): PropertyPart {\n return new PropertyPart(this);\n }\n\n protected _getValue() {\n if (this.single) {\n return this.parts[0].value;\n }\n return super._getValue();\n }\n\n commit(): void {\n if (this.dirty) {\n this.dirty = false;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (this.element as any)[this.name] = this._getValue();\n }\n }\n}\n\nexport class PropertyPart extends AttributePart {}\n\n// Detect event listener options support. If the `capture` property is read\n// from the options object, then options are supported. If not, then the third\n// argument to add/removeEventListener is interpreted as the boolean capture\n// value so we should only pass the `capture` property.\nlet eventOptionsSupported = false;\n\n// Wrap into an IIFE because MS Edge <= v41 does not support having try/catch\n// blocks right into the body of a module\n(() => {\n try {\n const options = {\n get capture() {\n eventOptionsSupported = true;\n return false;\n }\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n window.addEventListener('test', options as any, options);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n window.removeEventListener('test', options as any, options);\n } catch (_e) {\n // event options not supported\n }\n})();\n\ntype EventHandlerWithOptions =\n EventListenerOrEventListenerObject&Partial<AddEventListenerOptions>;\nexport class EventPart implements Part {\n readonly element: Element;\n readonly eventName: string;\n readonly eventContext?: EventTarget;\n value: undefined|EventHandlerWithOptions = undefined;\n private __options?: AddEventListenerOptions;\n private __pendingValue: undefined|EventHandlerWithOptions = undefined;\n private readonly __boundHandleEvent: (event: Event) => void;\n\n constructor(element: Element, eventName: string, eventContext?: EventTarget) {\n this.element = element;\n this.eventName = eventName;\n this.eventContext = eventContext;\n this.__boundHandleEvent = (e) => this.handleEvent(e);\n }\n\n setValue(value: undefined|EventHandlerWithOptions): void {\n this.__pendingValue = value;\n }\n\n commit() {\n while (isDirective(this.__pendingValue)) {\n const directive = this.__pendingValue;\n this.__pendingValue = noChange as EventHandlerWithOptions;\n directive(this);\n }\n if (this.__pendingValue === noChange) {\n return;\n }\n\n const newListener = this.__pendingValue;\n const oldListener = this.value;\n const shouldRemoveListener = newListener == null ||\n oldListener != null &&\n (newListener.capture !== oldListener.capture ||\n newListener.once !== oldListener.once ||\n newListener.passive !== oldListener.passive);\n const shouldAddListener =\n newListener != null && (oldListener == null || shouldRemoveListener);\n\n if (shouldRemoveListener) {\n this.element.removeEventListener(\n this.eventName, this.__boundHandleEvent, this.__options);\n }\n if (shouldAddListener) {\n this.__options = getOptions(newListener);\n this.element.addEventListener(\n this.eventName, this.__boundHandleEvent, this.__options);\n }\n this.value = newListener;\n this.__pendingValue = noChange as EventHandlerWithOptions;\n }\n\n handleEvent(event: Event) {\n if (typeof this.value === 'function') {\n this.value.call(this.eventContext || this.element, event);\n } else {\n (this.value as EventListenerObject).handleEvent(event);\n }\n }\n}\n\n// We copy options because of the inconsistent behavior of browsers when reading\n// the third argument of add/removeEventListener. IE11 doesn't support options\n// at all. Chrome 41 only reads `capture` if the argument is an object.\nconst getOptions = (o: AddEventListenerOptions|undefined) => o &&\n (eventOptionsSupported ?\n {capture: o.capture, passive: o.passive, once: o.once} :\n o.capture as AddEventListenerOptions);\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {TemplateResult} from './template-result.js';\nimport {marker, Template} from './template.js';\n\n/**\n * A function type that creates a Template from a TemplateResult.\n *\n * This is a hook into the template-creation process for rendering that\n * requires some modification of templates before they're used, like ShadyCSS,\n * which must add classes to elements and remove styles.\n *\n * Templates should be cached as aggressively as possible, so that many\n * TemplateResults produced from the same expression only do the work of\n * creating the Template the first time.\n *\n * Templates are usually cached by TemplateResult.strings and\n * TemplateResult.type, but may be cached by other keys if this function\n * modifies the template.\n *\n * Note that currently TemplateFactories must not add, remove, or reorder\n * expressions, because there is no way to describe such a modification\n * to render() so that values are interpolated to the correct place in the\n * template instances.\n */\nexport type TemplateFactory = (result: TemplateResult) => Template;\n\n/**\n * The default TemplateFactory which caches Templates keyed on\n * result.type and result.strings.\n */\nexport function templateFactory(result: TemplateResult) {\n let templateCache = templateCaches.get(result.type);\n if (templateCache === undefined) {\n templateCache = {\n stringsArray: new WeakMap<TemplateStringsArray, Template>(),\n keyString: new Map<string, Template>()\n };\n templateCaches.set(result.type, templateCache);\n }\n\n let template = templateCache.stringsArray.get(result.strings);\n if (template !== undefined) {\n return template;\n }\n\n // If the TemplateStringsArray is new, generate a key from the strings\n // This key is shared between all templates with identical content\n const key = result.strings.join(marker);\n\n // Check if we already have a Template for this key\n template = templateCache.keyString.get(key);\n if (template === undefined) {\n // If we have not seen this key before, create a new Template\n template = new Template(result, result.getTemplateElement());\n // Cache the Template for this key\n templateCache.keyString.set(key, template);\n }\n\n // Cache all future queries for this TemplateStringsArray\n templateCache.stringsArray.set(result.strings, template);\n return template;\n}\n\n/**\n * The first argument to JS template tags retain identity across multiple\n * calls to a tag for the same literal, so we can cache work done per literal\n * in a Map.\n *\n * Safari currently has a bug which occasionally breaks this behavior, so we\n * need to cache the Template at two levels. We first cache the\n * TemplateStringsArray, and if that fails, we cache a key constructed by\n * joining the strings array.\n */\nexport interface TemplateCache {\n readonly stringsArray: WeakMap<TemplateStringsArray, Template>;\n readonly keyString: Map<string, Template>;\n}\n\nexport const templateCaches = new Map<string, TemplateCache>();\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {removeNodes} from './dom.js';\nimport {NodePart} from './parts.js';\nimport {RenderOptions} from './render-options.js';\nimport {templateFactory} from './template-factory.js';\n\nexport const parts = new WeakMap<Node, NodePart>();\n\n/**\n * Renders a template result or other value to a container.\n *\n * To update a container with new values, reevaluate the template literal and\n * call `render` with the new result.\n *\n * @param result Any value renderable by NodePart - typically a TemplateResult\n * created by evaluating a template tag like `html` or `svg`.\n * @param container A DOM parent to render to. The entire contents are either\n * replaced, or efficiently updated if the same result type was previous\n * rendered there.\n * @param options RenderOptions for the entire render tree rendered to this\n * container. Render options must *not* change between renders to the same\n * container, as those changes will not effect previously rendered DOM.\n */\nexport const render =\n (result: unknown,\n container: Element|DocumentFragment,\n options?: Partial<RenderOptions>) => {\n let part = parts.get(container);\n if (part === undefined) {\n removeNodes(container, container.firstChild);\n parts.set(container, part = new NodePart({\n templateFactory,\n ...options,\n }));\n part.appendInto(container);\n }\n part.setValue(result);\n part.commit();\n };\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {Part} from './part.js';\nimport {AttributeCommitter, BooleanAttributePart, EventPart, NodePart, PropertyCommitter} from './parts.js';\nimport {RenderOptions} from './render-options.js';\nimport {TemplateProcessor} from './template-processor.js';\n\n/**\n * Creates Parts when a template is instantiated.\n */\nexport class DefaultTemplateProcessor implements TemplateProcessor {\n /**\n * Create parts for an attribute-position binding, given the event, attribute\n * name, and string literals.\n *\n * @param element The element containing the binding\n * @param name The attribute name\n * @param strings The string literals. There are always at least two strings,\n * event for fully-controlled bindings with a single expression.\n */\n handleAttributeExpressions(\n element: Element, name: string, strings: string[],\n options: RenderOptions): ReadonlyArray<Part> {\n const prefix = name[0];\n if (prefix === '.') {\n const committer = new PropertyCommitter(element, name.slice(1), strings);\n return committer.parts;\n }\n if (prefix === '@') {\n return [new EventPart(element, name.slice(1), options.eventContext)];\n }\n if (prefix === '?') {\n return [new BooleanAttributePart(element, name.slice(1), strings)];\n }\n const committer = new AttributeCommitter(element, name, strings);\n return committer.parts;\n }\n /**\n * Create parts for a text-position binding.\n * @param templateFactory\n */\n handleTextExpression(options: RenderOptions) {\n return new NodePart(options);\n }\n}\n\nexport const defaultTemplateProcessor = new DefaultTemplateProcessor();\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n *\n * Main lit-html module.\n *\n * Main exports:\n *\n * - [[html]]\n * - [[svg]]\n * - [[render]]\n *\n * @packageDocumentation\n */\n\n/**\n * Do not remove this comment; it keeps typedoc from misplacing the module\n * docs.\n */\nimport {defaultTemplateProcessor} from './lib/default-template-processor.js';\nimport {SVGTemplateResult, TemplateResult} from './lib/template-result.js';\n\nexport {DefaultTemplateProcessor, defaultTemplateProcessor} from './lib/default-template-processor.js';\nexport {directive, DirectiveFn, isDirective} from './lib/directive.js';\n// TODO(justinfagnani): remove line when we get NodePart moving methods\nexport {removeNodes, reparentNodes} from './lib/dom.js';\nexport {noChange, nothing, Part} from './lib/part.js';\nexport {AttributeCommitter, AttributePart, BooleanAttributePart, EventPart, isIterable, isPrimitive, NodePart, PropertyCommitter, PropertyPart} from './lib/parts.js';\nexport {RenderOptions} from './lib/render-options.js';\nexport {parts, render} from './lib/render.js';\nexport {templateCaches, templateFactory} from './lib/template-factory.js';\nexport {TemplateInstance} from './lib/template-instance.js';\nexport {TemplateProcessor} from './lib/template-processor.js';\nexport {SVGTemplateResult, TemplateResult} from './lib/template-result.js';\nexport {createMarker, isTemplatePartActive, Template} from './lib/template.js';\n\ndeclare global {\n interface Window {\n litHtmlVersions: string[];\n }\n}\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for lit-html usage.\n// TODO(justinfagnani): inject version number at build time\nif (typeof window !== 'undefined') {\n (window['litHtmlVersions'] || (window['litHtmlVersions'] = [])).push('1.3.0');\n}\n\n/**\n * Interprets a template literal as an HTML template that can efficiently\n * render to and update a container.\n */\nexport const html = (strings: TemplateStringsArray, ...values: unknown[]) =>\n new TemplateResult(strings, values, 'html', defaultTemplateProcessor);\n\n/**\n * Interprets a template literal as an SVG template that can efficiently\n * render to and update a container.\n */\nexport const svg = (strings: TemplateStringsArray, ...values: unknown[]) =>\n new SVGTemplateResult(strings, values, 'svg', defaultTemplateProcessor);\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * Module to add shady DOM/shady CSS polyfill support to lit-html template\n * rendering. See the [[render]] method for details.\n *\n * @packageDocumentation\n */\n\n/**\n * Do not remove this comment; it keeps typedoc from misplacing the module\n * docs.\n */\nimport {removeNodes} from './dom.js';\nimport {insertNodeIntoTemplate, removeNodesFromTemplate} from './modify-template.js';\nimport {RenderOptions} from './render-options.js';\nimport {parts, render as litRender} from './render.js';\nimport {templateCaches} from './template-factory.js';\nimport {TemplateInstance} from './template-instance.js';\nimport {TemplateResult} from './template-result.js';\nimport {marker, Template} from './template.js';\n\nexport {html, svg, TemplateResult} from '../lit-html.js';\n\n// Get a key to lookup in `templateCaches`.\nconst getTemplateCacheKey = (type: string, scopeName: string) =>\n `${type}--${scopeName}`;\n\nlet compatibleShadyCSSVersion = true;\n\nif (typeof window.ShadyCSS === 'undefined') {\n compatibleShadyCSSVersion = false;\n} else if (typeof window.ShadyCSS.prepareTemplateDom === 'undefined') {\n console.warn(\n `Incompatible ShadyCSS version detected. ` +\n `Please update to at least @webcomponents/webcomponentsjs@2.0.2 and ` +\n `@webcomponents/shadycss@1.3.1.`);\n compatibleShadyCSSVersion = false;\n}\n\n/**\n * Template factory which scopes template DOM using ShadyCSS.\n * @param scopeName {string}\n */\nexport const shadyTemplateFactory = (scopeName: string) =>\n (result: TemplateResult) => {\n const cacheKey = getTemplateCacheKey(result.type, scopeName);\n let templateCache = templateCaches.get(cacheKey);\n if (templateCache === undefined) {\n templateCache = {\n stringsArray: new WeakMap<TemplateStringsArray, Template>(),\n keyString: new Map<string, Template>()\n };\n templateCaches.set(cacheKey, templateCache);\n }\n\n let template = templateCache.stringsArray.get(result.strings);\n if (template !== undefined) {\n return template;\n }\n\n const key = result.strings.join(marker);\n template = templateCache.keyString.get(key);\n if (template === undefined) {\n const element = result.getTemplateElement();\n if (compatibleShadyCSSVersion) {\n window.ShadyCSS!.prepareTemplateDom(element, scopeName);\n }\n template = new Template(result, element);\n templateCache.keyString.set(key, template);\n }\n templateCache.stringsArray.set(result.strings, template);\n return template;\n };\n\nconst TEMPLATE_TYPES = ['html', 'svg'];\n\n/**\n * Removes all style elements from Templates for the given scopeName.\n */\nconst removeStylesFromLitTemplates = (scopeName: string) => {\n TEMPLATE_TYPES.forEach((type) => {\n const templates = templateCaches.get(getTemplateCacheKey(type, scopeName));\n if (templates !== undefined) {\n templates.keyString.forEach((template) => {\n const {element: {content}} = template;\n // IE 11 doesn't support the iterable param Set constructor\n const styles = new Set<Element>();\n Array.from(content.querySelectorAll('style')).forEach((s: Element) => {\n styles.add(s);\n });\n removeNodesFromTemplate(template, styles);\n });\n }\n });\n};\n\nconst shadyRenderSet = new Set<string>();\n\n/**\n * For the given scope name, ensures that ShadyCSS style scoping is performed.\n * This is done just once per scope name so the fragment and template cannot\n * be modified.\n * (1) extracts styles from the rendered fragment and hands them to ShadyCSS\n * to be scoped and appended to the document\n * (2) removes style elements from all lit-html Templates for this scope name.\n *\n * Note, <style> elements can only be placed into templates for the\n * initial rendering of the scope. If <style> elements are included in templates\n * dynamically rendered to the scope (after the first scope render), they will\n * not be scoped and the <style> will be left in the template and rendered\n * output.\n */\nconst prepareTemplateStyles =\n (scopeName: string, renderedDOM: DocumentFragment, template?: Template) => {\n shadyRenderSet.add(scopeName);\n // If `renderedDOM` is stamped from a Template, then we need to edit that\n // Template's underlying template element. Otherwise, we create one here\n // to give to ShadyCSS, which still requires one while scoping.\n const templateElement =\n !!template ? template.element : document.createElement('template');\n // Move styles out of rendered DOM and store.\n const styles = renderedDOM.querySelectorAll('style');\n const {length} = styles;\n // If there are no styles, skip unnecessary work\n if (length === 0) {\n // Ensure prepareTemplateStyles is called to support adding\n // styles via `prepareAdoptedCssText` since that requires that\n // `prepareTemplateStyles` is called.\n //\n // ShadyCSS will only update styles containing @apply in the template\n // given to `prepareTemplateStyles`. If no lit Template was given,\n // ShadyCSS will not be able to update uses of @apply in any relevant\n // template. However, this is not a problem because we only create the\n // template for the purpose of supporting `prepareAdoptedCssText`,\n // which doesn't support @apply at all.\n window.ShadyCSS!.prepareTemplateStyles(templateElement, scopeName);\n return;\n }\n const condensedStyle = document.createElement('style');\n // Collect styles into a single style. This helps us make sure ShadyCSS\n // manipulations will not prevent us from being able to fix up template\n // part indices.\n // NOTE: collecting styles is inefficient for browsers but ShadyCSS\n // currently does this anyway. When it does not, this should be changed.\n for (let i = 0; i < length; i++) {\n const style = styles[i];\n style.parentNode!.removeChild(style);\n condensedStyle.textContent! += style.textContent;\n }\n // Remove styles from nested templates in this scope.\n removeStylesFromLitTemplates(scopeName);\n // And then put the condensed style into the \"root\" template passed in as\n // `template`.\n const content = templateElement.content;\n if (!!template) {\n insertNodeIntoTemplate(template, condensedStyle, content.firstChild);\n } else {\n content.insertBefore(condensedStyle, content.firstChild);\n }\n // Note, it's important that ShadyCSS gets the template that `lit-html`\n // will actually render so that it can update the style inside when\n // needed (e.g. @apply native Shadow DOM case).\n window.ShadyCSS!.prepareTemplateStyles(templateElement, scopeName);\n const style = content.querySelector('style');\n if (window.ShadyCSS!.nativeShadow && style !== null) {\n // When in native Shadow DOM, ensure the style created by ShadyCSS is\n // included in initially rendered output (`renderedDOM`).\n renderedDOM.insertBefore(style.cloneNode(true), renderedDOM.firstChild);\n } else if (!!template) {\n // When no style is left in the template, parts will be broken as a\n // result. To fix this, we put back the style node ShadyCSS removed\n // and then tell lit to remove that node from the template.\n // There can be no style in the template in 2 cases (1) when Shady DOM\n // is in use, ShadyCSS removes all styles, (2) when native Shadow DOM\n // is in use ShadyCSS removes the style if it contains no content.\n // NOTE, ShadyCSS creates its own style so we can safely add/remove\n // `condensedStyle` here.\n content.insertBefore(condensedStyle, content.firstChild);\n const removes = new Set<Node>();\n removes.add(condensedStyle);\n removeNodesFromTemplate(template, removes);\n }\n };\n\nexport interface ShadyRenderOptions extends Partial<RenderOptions> {\n scopeName: string;\n}\n\n/**\n * Extension to the standard `render` method which supports rendering\n * to ShadowRoots when the ShadyDOM (https://github.com/webcomponents/shadydom)\n * and ShadyCSS (https://github.com/webcomponents/shadycss) polyfills are used\n * or when the webcomponentsjs\n * (https://github.com/webcomponents/webcomponentsjs) polyfill is used.\n *\n * Adds a `scopeName` option which is used to scope element DOM and stylesheets\n * when native ShadowDOM is unavailable. The `scopeName` will be added to\n * the class attribute of all rendered DOM. In addition, any style elements will\n * be automatically re-written with this `scopeName` selector and moved out\n * of the rendered DOM and into the document `<head>`.\n *\n * It is common to use this render method in conjunction with a custom element\n * which renders a shadowRoot. When this is done, typically the element's\n * `localName` should be used as the `scopeName`.\n *\n * In addition to DOM scoping, ShadyCSS also supports a basic shim for css\n * custom properties (needed only on older browsers like IE11) and a shim for\n * a deprecated feature called `@apply` that supports applying a set of css\n * custom properties to a given location.\n *\n * Usage considerations:\n *\n * * Part values in `<style>` elements are only applied the first time a given\n * `scopeName` renders. Subsequent changes to parts in style elements will have\n * no effect. Because of this, parts in style elements should only be used for\n * values that will never change, for example parts that set scope-wide theme\n * values or parts which render shared style elements.\n *\n * * Note, due to a limitation of the ShadyDOM polyfill, rendering in a\n * custom element's `constructor` is not supported. Instead rendering should\n * either done asynchronously, for example at microtask timing (for example\n * `Promise.resolve()`), or be deferred until the first time the element's\n * `connectedCallback` runs.\n *\n * Usage considerations when using shimmed custom properties or `@apply`:\n *\n * * Whenever any dynamic changes are made which affect\n * css custom properties, `ShadyCSS.styleElement(element)` must be called\n * to update the element. There are two cases when this is needed:\n * (1) the element is connected to a new parent, (2) a class is added to the\n * element that causes it to match different custom properties.\n * To address the first case when rendering a custom element, `styleElement`\n * should be called in the element's `connectedCallback`.\n *\n * * Shimmed custom properties may only be defined either for an entire\n * shadowRoot (for example, in a `:host` rule) or via a rule that directly\n * matches an element with a shadowRoot. In other words, instead of flowing from\n * parent to child as do native css custom properties, shimmed custom properties\n * flow only from shadowRoots to nested shadowRoots.\n *\n * * When using `@apply` mixing css shorthand property names with\n * non-shorthand names (for example `border` and `border-width`) is not\n * supported.\n */\nexport const render =\n (result: unknown,\n container: Element|DocumentFragment|ShadowRoot,\n options: ShadyRenderOptions) => {\n if (!options || typeof options !== 'object' || !options.scopeName) {\n throw new Error('The `scopeName` option is required.');\n }\n const scopeName = options.scopeName;\n const hasRendered = parts.has(container);\n const needsScoping = compatibleShadyCSSVersion &&\n container.nodeType === 11 /* Node.DOCUMENT_FRAGMENT_NODE */ &&\n !!(container as ShadowRoot).host;\n // Handle first render to a scope specially...\n const firstScopeRender = needsScoping && !shadyRenderSet.has(scopeName);\n // On first scope render, render into a fragment; this cannot be a single\n // fragment that is reused since nested renders can occur synchronously.\n const renderContainer =\n firstScopeRender ? document.createDocumentFragment() : container;\n litRender(\n result,\n renderContainer,\n {templateFactory: shadyTemplateFactory(scopeName), ...options} as\n RenderOptions);\n // When performing first scope render,\n // (1) We've rendered into a fragment so that there's a chance to\n // `prepareTemplateStyles` before sub-elements hit the DOM\n // (which might cause them to render based on a common pattern of\n // rendering in a custom element's `connectedCallback`);\n // (2) Scope the template with ShadyCSS one time only for this scope.\n // (3) Render the fragment into the container and make sure the\n // container knows its `part` is the one we just rendered. This ensures\n // DOM will be re-used on subsequent renders.\n if (firstScopeRender) {\n const part = parts.get(renderContainer)!;\n parts.delete(renderContainer);\n // ShadyCSS might have style sheets (e.g. from `prepareAdoptedCssText`)\n // that should apply to `renderContainer` even if the rendered value is\n // not a TemplateInstance. However, it will only insert scoped styles\n // into the document if `prepareTemplateStyles` has already been called\n // for the given scope name.\n const template = part.value instanceof TemplateInstance ?\n part.value.template :\n undefined;\n prepareTemplateStyles(\n scopeName, renderContainer as DocumentFragment, template);\n removeNodes(container, container.firstChild);\n container.appendChild(renderContainer);\n parts.set(container, part);\n }\n // After elements have hit the DOM, update styling if this is the\n // initial render to this container.\n // This is needed whenever dynamic changes are made so it would be\n // safest to do every render; however, this would regress performance\n // so we leave it up to the user to call `ShadyCSS.styleElement`\n // for dynamic changes.\n if (!hasRendered && needsScoping) {\n window.ShadyCSS!.styleElement((container as ShadowRoot).host);\n }\n };\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * Use this module if you want to create your own base class extending\n * [[UpdatingElement]].\n * @packageDocumentation\n */\n\n/*\n * When using Closure Compiler, JSCompiler_renameProperty(property, object) is\n * replaced at compile time by the munged name for object[property]. We cannot\n * alias this function, so we have to use a small shim that has the same\n * behavior when not compiling.\n */\nwindow.JSCompiler_renameProperty =\n <P extends PropertyKey>(prop: P, _obj: unknown): P => prop;\n\ndeclare global {\n var JSCompiler_renameProperty: <P extends PropertyKey>(\n prop: P, _obj: unknown) => P;\n\n interface Window {\n JSCompiler_renameProperty: typeof JSCompiler_renameProperty;\n }\n}\n\n/**\n * Converts property values to and from attribute values.\n */\nexport interface ComplexAttributeConverter<Type = unknown, TypeHint = unknown> {\n /**\n * Function called to convert an attribute value to a property\n * value.\n */\n fromAttribute?(value: string|null, type?: TypeHint): Type;\n\n /**\n * Function called to convert a property value to an attribute\n * value.\n *\n * It returns unknown instead of string, to be compatible with\n * https://github.com/WICG/trusted-types (and similar efforts).\n */\n toAttribute?(value: Type, type?: TypeHint): unknown;\n}\n\ntype AttributeConverter<Type = unknown, TypeHint = unknown> =\n ComplexAttributeConverter<Type>|\n ((value: string|null, type?: TypeHint) => Type);\n\n/**\n * Defines options for a property accessor.\n */\nexport interface PropertyDeclaration<Type = unknown, TypeHint = unknown> {\n /**\n * Indicates how and whether the property becomes an observed attribute.\n * If the value is `false`, the property is not added to `observedAttributes`.\n * If true or absent, the lowercased property name is observed (e.g. `fooBar`\n * becomes `foobar`). If a string, the string value is observed (e.g\n * `attribute: 'foo-bar'`).\n */\n readonly attribute?: boolean|string;\n\n /**\n * Indicates the type of the property. This is used only as a hint for the\n * `converter` to determine how to convert the attribute\n * to/from a property.\n */\n readonly type?: TypeHint;\n\n /**\n * Indicates how to convert the attribute to/from a property. If this value\n * is a function, it is used to convert the attribute value a the property\n * value. If it's an object, it can have keys for `fromAttribute` and\n * `toAttribute`. If no `toAttribute` function is provided and\n * `reflect` is set to `true`, the property value is set directly to the\n * attribute. A default `converter` is used if none is provided; it supports\n * `Boolean`, `String`, `Number`, `Object`, and `Array`. Note,\n * when a property changes and the converter is used to update the attribute,\n * the property is never updated again as a result of the attribute changing,\n * and vice versa.\n */\n readonly converter?: AttributeConverter<Type, TypeHint>;\n\n /**\n * Indicates if the property should reflect to an attribute.\n * If `true`, when the property is set, the attribute is set using the\n * attribute name determined according to the rules for the `attribute`\n * property option and the value of the property converted using the rules\n * from the `converter` property option.\n */\n readonly reflect?: boolean;\n\n /**\n * A function that indicates if a property should be considered changed when\n * it is set. The function should take the `newValue` and `oldValue` and\n * return `true` if an update should be requested.\n */\n hasChanged?(value: Type, oldValue: Type): boolean;\n\n /**\n * Indicates whether an accessor will be created for this property. By\n * default, an accessor will be generated for this property that requests an\n * update when set. If this flag is `true`, no accessor will be created, and\n * it will be the user's responsibility to call\n * `this.requestUpdate(propertyName, oldValue)` to request an update when\n * the property changes.\n */\n readonly noAccessor?: boolean;\n}\n\n/**\n * Map of properties to PropertyDeclaration options. For each property an\n * accessor is made, and the property is processed according to the\n * PropertyDeclaration options.\n */\nexport interface PropertyDeclarations {\n readonly [key: string]: PropertyDeclaration;\n}\n\ntype PropertyDeclarationMap = Map<PropertyKey, PropertyDeclaration>;\n\ntype AttributeMap = Map<string, PropertyKey>;\n\n/**\n * Map of changed properties with old values. Takes an optional generic\n * interface corresponding to the declared element properties.\n */\n// tslint:disable-next-line:no-any\nexport type PropertyValues<T = any> =\n keyof T extends PropertyKey ? Map<keyof T, unknown>: never;\n\nexport const defaultConverter: ComplexAttributeConverter = {\n\n toAttribute(value: unknown, type?: unknown): unknown {\n switch (type) {\n case Boolean:\n return value ? '' : null;\n case Object:\n case Array:\n // if the value is `null` or `undefined` pass this through\n // to allow removing/no change behavior.\n return value == null ? value : JSON.stringify(value);\n }\n return value;\n },\n\n fromAttribute(value: string|null, type?: unknown) {\n switch (type) {\n case Boolean:\n return value !== null;\n case Number:\n return value === null ? null : Number(value);\n case Object:\n case Array:\n return JSON.parse(value!);\n }\n return value;\n }\n\n};\n\nexport interface HasChanged {\n (value: unknown, old: unknown): boolean;\n}\n\n/**\n * Change function that returns true if `value` is different from `oldValue`.\n * This method is used as the default for a property's `hasChanged` function.\n */\nexport const notEqual: HasChanged = (value: unknown, old: unknown): boolean => {\n // This ensures (old==NaN, value==NaN) always returns false\n return old !== value && (old === old || value === value);\n};\n\nconst defaultPropertyDeclaration: PropertyDeclaration = {\n attribute: true,\n type: String,\n converter: defaultConverter,\n reflect: false,\n hasChanged: notEqual\n};\n\nconst STATE_HAS_UPDATED = 1;\nconst STATE_UPDATE_REQUESTED = 1 << 2;\nconst STATE_IS_REFLECTING_TO_ATTRIBUTE = 1 << 3;\nconst STATE_IS_REFLECTING_TO_PROPERTY = 1 << 4;\ntype UpdateState = typeof STATE_HAS_UPDATED|typeof STATE_UPDATE_REQUESTED|\n typeof STATE_IS_REFLECTING_TO_ATTRIBUTE|\n typeof STATE_IS_REFLECTING_TO_PROPERTY;\n\n/**\n * The Closure JS Compiler doesn't currently have good support for static\n * property semantics where \"this\" is dynamic (e.g.\n * https://github.com/google/closure-compiler/issues/3177 and others) so we use\n * this hack to bypass any rewriting by the compiler.\n */\nconst finalized = 'finalized';\n\n/**\n * Base element class which manages element properties and attributes. When\n * properties change, the `update` method is asynchronously called. This method\n * should be supplied by subclassers to render updates as desired.\n * @noInheritDoc\n */\nexport abstract class UpdatingElement extends HTMLElement {\n /*\n * Due to closure compiler ES6 compilation bugs, @nocollapse is required on\n * all static methods and properties with initializers. Reference:\n * - https://github.com/google/closure-compiler/issues/1776\n */\n\n /**\n * Maps attribute names to properties; for example `foobar` attribute to\n * `fooBar` property. Created lazily on user subclasses when finalizing the\n * class.\n */\n private static _attributeToPropertyMap: AttributeMap;\n\n /**\n * Marks class as having finished creating properties.\n */\n protected static[finalized] = true;\n\n /**\n * Memoized list of all class properties, including any superclass properties.\n * Created lazily on user subclasses when finalizing the class.\n */\n private static _classProperties?: PropertyDeclarationMap;\n\n /**\n * User-supplied object that maps property names to `PropertyDeclaration`\n * objects containing options for configuring the property.\n */\n static properties: PropertyDeclarations;\n\n /**\n * Returns a list of attributes corresponding to the registered properties.\n * @nocollapse\n */\n static get observedAttributes() {\n // note: piggy backing on this to ensure we're finalized.\n this.finalize();\n const attributes: string[] = [];\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n this._classProperties!.forEach((v, p) => {\n const attr = this._attributeNameForProperty(p, v);\n if (attr !== undefined) {\n this._attributeToPropertyMap.set(attr, p);\n attributes.push(attr);\n }\n });\n return attributes;\n }\n\n /**\n * Ensures the private `_classProperties` property metadata is created.\n * In addition to `finalize` this is also called in `createProperty` to\n * ensure the `@property` decorator can add property metadata.\n */\n /** @nocollapse */\n private static _ensureClassProperties() {\n // ensure private storage for property declarations.\n if (!this.hasOwnProperty(\n JSCompiler_renameProperty('_classProperties', this))) {\n this._classProperties = new Map();\n // NOTE: Workaround IE11 not supporting Map constructor argument.\n const superProperties: PropertyDeclarationMap =\n Object.getPrototypeOf(this)._classProperties;\n if (superProperties !== undefined) {\n superProperties.forEach(\n (v: PropertyDeclaration, k: PropertyKey) =>\n this._classProperties!.set(k, v));\n }\n }\n }\n\n /**\n * Creates a property accessor on the element prototype if one does not exist\n * and stores a PropertyDeclaration for the property with the given options.\n * The property setter calls the property's `hasChanged` property option\n * or uses a strict identity check to determine whether or not to request\n * an update.\n *\n * This method may be overridden to customize properties; however,\n * when doing so, it's important to call `super.createProperty` to ensure\n * the property is setup correctly. This method calls\n * `getPropertyDescriptor` internally to get a descriptor to install.\n * To customize what properties do when they are get or set, override\n * `getPropertyDescriptor`. To customize the options for a property,\n * implement `createProperty` like this:\n *\n * static createProperty(name, options) {\n * options = Object.assign(options, {myOption: true});\n * super.createProperty(name, options);\n * }\n *\n * @nocollapse\n */\n static createProperty(\n name: PropertyKey,\n options: PropertyDeclaration = defaultPropertyDeclaration) {\n // Note, since this can be called by the `@property` decorator which\n // is called before `finalize`, we ensure storage exists for property\n // metadata.\n this._ensureClassProperties();\n this._classProperties!.set(name, options);\n // Do not generate an accessor if the prototype already has one, since\n // it would be lost otherwise and that would never be the user's intention;\n // Instead, we expect users to call `requestUpdate` themselves from\n // user-defined accessors. Note that if the super has an accessor we will\n // still overwrite it\n if (options.noAccessor || this.prototype.hasOwnProperty(name)) {\n return;\n }\n const key = typeof name === 'symbol' ? Symbol() : `__${name}`;\n const descriptor = this.getPropertyDescriptor(name, key, options);\n if (descriptor !== undefined) {\n Object.defineProperty(this.prototype, name, descriptor);\n }\n }\n\n /**\n * Returns a property descriptor to be defined on the given named property.\n * If no descriptor is returned, the property will not become an accessor.\n * For example,\n *\n * class MyElement extends LitElement {\n * static getPropertyDescriptor(name, key, options) {\n * const defaultDescriptor =\n * super.getPropertyDescriptor(name, key, options);\n * const setter = defaultDescriptor.set;\n * return {\n * get: defaultDescriptor.get,\n * set(value) {\n * setter.call(this, value);\n * // custom action.\n * },\n * configurable: true,\n * enumerable: true\n * }\n * }\n * }\n *\n * @nocollapse\n */\n protected static getPropertyDescriptor(\n name: PropertyKey, key: string|symbol, options: PropertyDeclaration) {\n return {\n // tslint:disable-next-line:no-any no symbol in index\n get(): any {\n return (this as {[key: string]: unknown})[key as string];\n },\n set(this: UpdatingElement, value: unknown) {\n const oldValue =\n (this as {} as {[key: string]: unknown})[name as string];\n (this as {} as {[key: string]: unknown})[key as string] = value;\n (this as unknown as UpdatingElement)\n .requestUpdateInternal(name, oldValue, options);\n },\n configurable: true,\n enumerable: true\n };\n }\n\n /**\n * Returns the property options associated with the given property.\n * These options are defined with a PropertyDeclaration via the `properties`\n * object or the `@property` decorator and are registered in\n * `createProperty(...)`.\n *\n * Note, this method should be considered \"final\" and not overridden. To\n * customize the options for a given property, override `createProperty`.\n *\n * @nocollapse\n * @final\n */\n protected static getPropertyOptions(name: PropertyKey) {\n return this._classProperties && this._classProperties.get(name) ||\n defaultPropertyDeclaration;\n }\n\n /**\n * Creates property accessors for registered properties and ensures\n * any superclasses are also finalized.\n * @nocollapse\n */\n protected static finalize() {\n // finalize any superclasses\n const superCtor = Object.getPrototypeOf(this);\n if (!superCtor.hasOwnProperty(finalized)) {\n superCtor.finalize();\n }\n this[finalized] = true;\n this._ensureClassProperties();\n // initialize Map populated in observedAttributes\n this._attributeToPropertyMap = new Map();\n // make any properties\n // Note, only process \"own\" properties since this element will inherit\n // any properties defined on the superClass, and finalization ensures\n // the entire prototype chain is finalized.\n if (this.hasOwnProperty(JSCompiler_renameProperty('properties', this))) {\n const props = this.properties;\n // support symbols in properties (IE11 does not support this)\n const propKeys = [\n ...Object.getOwnPropertyNames(props),\n ...(typeof Object.getOwnPropertySymbols === 'function') ?\n Object.getOwnPropertySymbols(props) :\n []\n ];\n // This for/of is ok because propKeys is an array\n for (const p of propKeys) {\n // note, use of `any` is due to TypeSript lack of support for symbol in\n // index types\n // tslint:disable-next-line:no-any no symbol in index\n this.createProperty(p, (props as any)[p]);\n }\n }\n }\n\n /**\n * Returns the property name for the given attribute `name`.\n * @nocollapse\n */\n private static _attributeNameForProperty(\n name: PropertyKey, options: PropertyDeclaration) {\n const attribute = options.attribute;\n return attribute === false ?\n undefined :\n (typeof attribute === 'string' ?\n attribute :\n (typeof name === 'string' ? name.toLowerCase() : undefined));\n }\n\n /**\n * Returns true if a property should request an update.\n * Called when a property value is set and uses the `hasChanged`\n * option for the property if present or a strict identity check.\n * @nocollapse\n */\n private static _valueHasChanged(\n value: unknown, old: unknown, hasChanged: HasChanged = notEqual) {\n return hasChanged(value, old);\n }\n\n /**\n * Returns the property value for the given attribute value.\n * Called via the `attributeChangedCallback` and uses the property's\n * `converter` or `converter.fromAttribute` property option.\n * @nocollapse\n */\n private static _propertyValueFromAttribute(\n value: string|null, options: PropertyDeclaration) {\n const type = options.type;\n const converter = options.converter || defaultConverter;\n const fromAttribute =\n (typeof converter === 'function' ? converter : converter.fromAttribute);\n return fromAttribute ? fromAttribute(value, type) : value;\n }\n\n /**\n * Returns the attribute value for the given property value. If this\n * returns undefined, the property will *not* be reflected to an attribute.\n * If this returns null, the attribute will be removed, otherwise the\n * attribute will be set to the value.\n * This uses the property's `reflect` and `type.toAttribute` property options.\n * @nocollapse\n */\n private static _propertyValueToAttribute(\n value: unknown, options: PropertyDeclaration) {\n if (options.reflect === undefined) {\n return;\n }\n const type = options.type;\n const converter = options.converter;\n const toAttribute =\n converter && (converter as ComplexAttributeConverter).toAttribute ||\n defaultConverter.toAttribute;\n return toAttribute!(value, type);\n }\n\n private _updateState!: UpdateState;\n private _instanceProperties?: PropertyValues;\n // Initialize to an unresolved Promise so we can make sure the element has\n // connected before first update.\n private _updatePromise!: Promise<unknown>;\n private _enableUpdatingResolver: (() => void)|undefined;\n\n /**\n * Map with keys for any properties that have changed since the last\n * update cycle with previous values.\n */\n private _changedProperties!: PropertyValues;\n\n /**\n * Map with keys of properties that should be reflected when updated.\n */\n private _reflectingProperties?: Map<PropertyKey, PropertyDeclaration>;\n\n constructor() {\n super();\n this.initialize();\n }\n\n /**\n * Performs element initialization. By default captures any pre-set values for\n * registered properties.\n */\n protected initialize() {\n this._updateState = 0;\n this._updatePromise =\n new Promise((res) => this._enableUpdatingResolver = res);\n this._changedProperties = new Map();\n this._saveInstanceProperties();\n // ensures first update will be caught by an early access of\n // `updateComplete`\n this.requestUpdateInternal();\n }\n\n /**\n * Fixes any properties set on the instance before upgrade time.\n * Otherwise these would shadow the accessor and break these properties.\n * The properties are stored in a Map which is played back after the\n * constructor runs. Note, on very old versions of Safari (<=9) or Chrome\n * (<=41), properties created for native platform properties like (`id` or\n * `name`) may not have default values set in the element constructor. On\n * these browsers native properties appear on instances and therefore their\n * default value will overwrite any element default (e.g. if the element sets\n * this.id = 'id' in the constructor, the 'id' will become '' since this is\n * the native platform default).\n */\n private _saveInstanceProperties() {\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n (this.constructor as typeof UpdatingElement)\n ._classProperties!.forEach((_v, p) => {\n if (this.hasOwnProperty(p)) {\n const value = this[p as keyof this];\n delete this[p as keyof this];\n if (!this._instanceProperties) {\n this._instanceProperties = new Map();\n }\n this._instanceProperties.set(p, value);\n }\n });\n }\n\n /**\n * Applies previously saved instance properties.\n */\n private _applyInstanceProperties() {\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n // tslint:disable-next-line:no-any\n this._instanceProperties!.forEach((v, p) => (this as any)[p] = v);\n this._instanceProperties = undefined;\n }\n\n connectedCallback() {\n // Ensure first connection completes an update. Updates cannot complete\n // before connection.\n this.enableUpdating();\n }\n\n protected enableUpdating() {\n if (this._enableUpdatingResolver !== undefined) {\n this._enableUpdatingResolver();\n this._enableUpdatingResolver = undefined;\n }\n }\n\n /**\n * Allows for `super.disconnectedCallback()` in extensions while\n * reserving the possibility of making non-breaking feature additions\n * when disconnecting at some point in the future.\n */\n disconnectedCallback() {\n }\n\n /**\n * Synchronizes property values when attributes change.\n */\n attributeChangedCallback(name: string, old: string|null, value: string|null) {\n if (old !== value) {\n this._attributeToProperty(name, value);\n }\n }\n\n private _propertyToAttribute(\n name: PropertyKey, value: unknown,\n options: PropertyDeclaration = defaultPropertyDeclaration) {\n const ctor = (this.constructor as typeof UpdatingElement);\n const attr = ctor._attributeNameForProperty(name, options);\n if (attr !== undefined) {\n const attrValue = ctor._propertyValueToAttribute(value, options);\n // an undefined value does not change the attribute.\n if (attrValue === undefined) {\n return;\n }\n // Track if the property is being reflected to avoid\n // setting the property again via `attributeChangedCallback`. Note:\n // 1. this takes advantage of the fact that the callback is synchronous.\n // 2. will behave incorrectly if multiple attributes are in the reaction\n // stack at time of calling. However, since we process attributes\n // in `update` this should not be possible (or an extreme corner case\n // that we'd like to discover).\n // mark state reflecting\n this._updateState = this._updateState | STATE_IS_REFLECTING_TO_ATTRIBUTE;\n if (attrValue == null) {\n this.removeAttribute(attr);\n } else {\n this.setAttribute(attr, attrValue as string);\n }\n // mark state not reflecting\n this._updateState = this._updateState & ~STATE_IS_REFLECTING_TO_ATTRIBUTE;\n }\n }\n\n private _attributeToProperty(name: string, value: string|null) {\n // Use tracking info to avoid deserializing attribute value if it was\n // just set from a property setter.\n if (this._updateState & STATE_IS_REFLECTING_TO_ATTRIBUTE) {\n return;\n }\n const ctor = (this.constructor as typeof UpdatingElement);\n // Note, hint this as an `AttributeMap` so closure clearly understands\n // the type; it has issues with tracking types through statics\n // tslint:disable-next-line:no-unnecessary-type-assertion\n const propName = (ctor._attributeToPropertyMap as AttributeMap).get(name);\n if (propName !== undefined) {\n const options = ctor.getPropertyOptions(propName);\n // mark state reflecting\n this._updateState = this._updateState | STATE_IS_REFLECTING_TO_PROPERTY;\n this[propName as keyof this] =\n // tslint:disable-next-line:no-any\n ctor._propertyValueFromAttribute(value, options) as any;\n // mark state not reflecting\n this._updateState = this._updateState & ~STATE_IS_REFLECTING_TO_PROPERTY;\n }\n }\n\n /**\n * This protected version of `requestUpdate` does not access or return the\n * `updateComplete` promise. This promise can be overridden and is therefore\n * not free to access.\n */\n protected requestUpdateInternal(\n name?: PropertyKey, oldValue?: unknown, options?: PropertyDeclaration) {\n let shouldRequestUpdate = true;\n // If we have a property key, perform property update steps.\n if (name !== undefined) {\n const ctor = this.constructor as typeof UpdatingElement;\n options = options || ctor.getPropertyOptions(name);\n if (ctor._valueHasChanged(\n this[name as keyof this], oldValue, options.hasChanged)) {\n if (!this._changedProperties.has(name)) {\n this._changedProperties.set(name, oldValue);\n }\n // Add to reflecting properties set.\n // Note, it's important that every change has a chance to add the\n // property to `_reflectingProperties`. This ensures setting\n // attribute + property reflects correctly.\n if (options.reflect === true &&\n !(this._updateState & STATE_IS_REFLECTING_TO_PROPERTY)) {\n if (this._reflectingProperties === undefined) {\n this._reflectingProperties = new Map();\n }\n this._reflectingProperties.set(name, options);\n }\n } else {\n // Abort the request if the property should not be considered changed.\n shouldRequestUpdate = false;\n }\n }\n if (!this._hasRequestedUpdate && shouldRequestUpdate) {\n this._updatePromise = this._enqueueUpdate();\n }\n }\n\n /**\n * Requests an update which is processed asynchronously. This should\n * be called when an element should update based on some state not triggered\n * by setting a property. In this case, pass no arguments. It should also be\n * called when manually implementing a property setter. In this case, pass the\n * property `name` and `oldValue` to ensure that any configured property\n * options are honored. Returns the `updateComplete` Promise which is resolved\n * when the update completes.\n *\n * @param name {PropertyKey} (optional) name of requesting property\n * @param oldValue {any} (optional) old value of requesting property\n * @returns {Promise} A Promise that is resolved when the update completes.\n */\n requestUpdate(name?: PropertyKey, oldValue?: unknown) {\n this.requestUpdateInternal(name, oldValue);\n return this.updateComplete;\n }\n\n /**\n * Sets up the element to asynchronously update.\n */\n private async _enqueueUpdate() {\n this._updateState = this._updateState | STATE_UPDATE_REQUESTED;\n try {\n // Ensure any previous update has resolved before updating.\n // This `await` also ensures that property changes are batched.\n await this._updatePromise;\n } catch (e) {\n // Ignore any previous errors. We only care that the previous cycle is\n // done. Any error should have been handled in the previous update.\n }\n const result = this.performUpdate();\n // If `performUpdate` returns a Promise, we await it. This is done to\n // enable coordinating updates with a scheduler. Note, the result is\n // checked to avoid delaying an additional microtask unless we need to.\n if (result != null) {\n await result;\n }\n return !this._hasRequestedUpdate;\n }\n\n private get _hasRequestedUpdate() {\n return (this._updateState & STATE_UPDATE_REQUESTED);\n }\n\n protected get hasUpdated() {\n return (this._updateState & STATE_HAS_UPDATED);\n }\n\n /**\n * Performs an element update. Note, if an exception is thrown during the\n * update, `firstUpdated` and `updated` will not be called.\n *\n * You can override this method to change the timing of updates. If this\n * method is overridden, `super.performUpdate()` must be called.\n *\n * For instance, to schedule updates to occur just before the next frame:\n *\n * ```\n * protected async performUpdate(): Promise<unknown> {\n * await new Promise((resolve) => requestAnimationFrame(() => resolve()));\n * super.performUpdate();\n * }\n * ```\n */\n protected performUpdate(): void|Promise<unknown> {\n // Abort any update if one is not pending when this is called.\n // This can happen if `performUpdate` is called early to \"flush\"\n // the update.\n if (!this._hasRequestedUpdate) {\n return;\n }\n // Mixin instance properties once, if they exist.\n if (this._instanceProperties) {\n this._applyInstanceProperties();\n }\n let shouldUpdate = false;\n const changedProperties = this._changedProperties;\n try {\n shouldUpdate = this.shouldUpdate(changedProperties);\n if (shouldUpdate) {\n this.update(changedProperties);\n } else {\n this._markUpdated();\n }\n } catch (e) {\n // Prevent `firstUpdated` and `updated` from running when there's an\n // update exception.\n shouldUpdate = false;\n // Ensure element can accept additional updates after an exception.\n this._markUpdated();\n throw e;\n }\n if (shouldUpdate) {\n if (!(this._updateState & STATE_HAS_UPDATED)) {\n this._updateState = this._updateState | STATE_HAS_UPDATED;\n this.firstUpdated(changedProperties);\n }\n this.updated(changedProperties);\n }\n }\n\n private _markUpdated() {\n this._changedProperties = new Map();\n this._updateState = this._updateState & ~STATE_UPDATE_REQUESTED;\n }\n\n /**\n * Returns a Promise that resolves when the element has completed updating.\n * The Promise value is a boolean that is `true` if the element completed the\n * update without triggering another update. The Promise result is `false` if\n * a property was set inside `updated()`. If the Promise is rejected, an\n * exception was thrown during the update.\n *\n * To await additional asynchronous work, override the `_getUpdateComplete`\n * method. For example, it is sometimes useful to await a rendered element\n * before fulfilling this Promise. To do this, first await\n * `super._getUpdateComplete()`, then any subsequent state.\n *\n * @returns {Promise} The Promise returns a boolean that indicates if the\n * update resolved without triggering another update.\n */\n get updateComplete() {\n return this._getUpdateComplete();\n }\n\n /**\n * Override point for the `updateComplete` promise.\n *\n * It is not safe to override the `updateComplete` getter directly due to a\n * limitation in TypeScript which means it is not possible to call a\n * superclass getter (e.g. `super.updateComplete.then(...)`) when the target\n * language is ES5 (https://github.com/microsoft/TypeScript/issues/338).\n * This method should be overridden instead. For example:\n *\n * class MyElement extends LitElement {\n * async _getUpdateComplete() {\n * await super._getUpdateComplete();\n * await this._myChild.updateComplete;\n * }\n * }\n */\n protected _getUpdateComplete() {\n return this._updatePromise;\n }\n\n /**\n * Controls whether or not `update` should be called when the element requests\n * an update. By default, this method always returns `true`, but this can be\n * customized to control when to update.\n *\n * @param _changedProperties Map of changed properties with old values\n */\n protected shouldUpdate(_changedProperties: PropertyValues): boolean {\n return true;\n }\n\n /**\n * Updates the element. This method reflects property values to attributes.\n * It can be overridden to render and keep updated element DOM.\n * Setting properties inside this method will *not* trigger\n * another update.\n *\n * @param _changedProperties Map of changed properties with old values\n */\n protected update(_changedProperties: PropertyValues) {\n if (this._reflectingProperties !== undefined &&\n this._reflectingProperties.size > 0) {\n // Use forEach so this works even if for/of loops are compiled to for\n // loops expecting arrays\n this._reflectingProperties.forEach(\n (v, k) => this._propertyToAttribute(k, this[k as keyof this], v));\n this._reflectingProperties = undefined;\n }\n this._markUpdated();\n }\n\n /**\n * Invoked whenever the element is updated. Implement to perform\n * post-updating tasks via DOM APIs, for example, focusing an element.\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * @param _changedProperties Map of changed properties with old values\n */\n protected updated(_changedProperties: PropertyValues) {\n }\n\n /**\n * Invoked when the element is first updated. Implement to perform one time\n * work on the element after update.\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * @param _changedProperties Map of changed properties with old values\n */\n protected firstUpdated(_changedProperties: PropertyValues) {\n }\n}\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport {LitElement} from '../lit-element.js';\n\nimport {PropertyDeclaration, UpdatingElement} from './updating-element.js';\n\nexport type Constructor<T> = {\n // tslint:disable-next-line:no-any\n new (...args: any[]): T\n};\n\n// From the TC39 Decorators proposal\ninterface ClassDescriptor {\n kind: 'class';\n elements: ClassElement[];\n finisher?: <T>(clazz: Constructor<T>) => undefined | Constructor<T>;\n}\n\n// From the TC39 Decorators proposal\ninterface ClassElement {\n kind: 'field'|'method';\n key: PropertyKey;\n placement: 'static'|'prototype'|'own';\n initializer?: Function;\n extras?: ClassElement[];\n finisher?: <T>(clazz: Constructor<T>) => undefined | Constructor<T>;\n descriptor?: PropertyDescriptor;\n}\n\nconst legacyCustomElement =\n (tagName: string, clazz: Constructor<HTMLElement>) => {\n window.customElements.define(tagName, clazz);\n // Cast as any because TS doesn't recognize the return type as being a\n // subtype of the decorated class when clazz is typed as\n // `Constructor<HTMLElement>` for some reason.\n // `Constructor<HTMLElement>` is helpful to make sure the decorator is\n // applied to elements however.\n // tslint:disable-next-line:no-any\n return clazz as any;\n };\n\nconst standardCustomElement =\n (tagName: string, descriptor: ClassDescriptor) => {\n const {kind, elements} = descriptor;\n return {\n kind,\n elements,\n // This callback is called once the class is otherwise fully defined\n finisher(clazz: Constructor<HTMLElement>) {\n window.customElements.define(tagName, clazz);\n }\n };\n };\n\n/**\n * Class decorator factory that defines the decorated class as a custom element.\n *\n * ```\n * @customElement('my-element')\n * class MyElement {\n * render() {\n * return html``;\n * }\n * }\n * ```\n * @category Decorator\n * @param tagName The name of the custom element to define.\n */\nexport const customElement = (tagName: string) =>\n (classOrDescriptor: Constructor<HTMLElement>|ClassDescriptor) =>\n (typeof classOrDescriptor === 'function') ?\n legacyCustomElement(tagName, classOrDescriptor) :\n standardCustomElement(tagName, classOrDescriptor);\n\nconst standardProperty =\n (options: PropertyDeclaration, element: ClassElement) => {\n // When decorating an accessor, pass it through and add property metadata.\n // Note, the `hasOwnProperty` check in `createProperty` ensures we don't\n // stomp over the user's accessor.\n if (element.kind === 'method' && element.descriptor &&\n !('value' in element.descriptor)) {\n return {\n ...element,\n finisher(clazz: typeof UpdatingElement) {\n clazz.createProperty(element.key, options);\n }\n };\n } else {\n // createProperty() takes care of defining the property, but we still\n // must return some kind of descriptor, so return a descriptor for an\n // unused prototype field. The finisher calls createProperty().\n return {\n kind: 'field',\n key: Symbol(),\n placement: 'own',\n descriptor: {},\n // When @babel/plugin-proposal-decorators implements initializers,\n // do this instead of the initializer below. See:\n // https://github.com/babel/babel/issues/9260 extras: [\n // {\n // kind: 'initializer',\n // placement: 'own',\n // initializer: descriptor.initializer,\n // }\n // ],\n initializer(this: {[key: string]: unknown}) {\n if (typeof element.initializer === 'function') {\n this[element.key as string] = element.initializer.call(this);\n }\n },\n finisher(clazz: typeof UpdatingElement) {\n clazz.createProperty(element.key, options);\n }\n };\n }\n };\n\nconst legacyProperty =\n (options: PropertyDeclaration, proto: Object, name: PropertyKey) => {\n (proto.constructor as typeof UpdatingElement)\n .createProperty(name, options);\n };\n\n/**\n * A property decorator which creates a LitElement property which reflects a\n * corresponding attribute value. A [[`PropertyDeclaration`]] may optionally be\n * supplied to configure property features.\n *\n * This decorator should only be used for public fields. Private or protected\n * fields should use the [[`internalProperty`]] decorator.\n *\n * @example\n * ```ts\n * class MyElement {\n * @property({ type: Boolean })\n * clicked = false;\n * }\n * ```\n * @category Decorator\n * @ExportDecoratedItems\n */\nexport function property(options?: PropertyDeclaration) {\n // tslint:disable-next-line:no-any decorator\n return (protoOrDescriptor: Object|ClassElement, name?: PropertyKey): any =>\n (name !== undefined) ?\n legacyProperty(options!, protoOrDescriptor as Object, name) :\n standardProperty(options!, protoOrDescriptor as ClassElement);\n}\n\nexport interface InternalPropertyDeclaration<Type = unknown> {\n /**\n * A function that indicates if a property should be considered changed when\n * it is set. The function should take the `newValue` and `oldValue` and\n * return `true` if an update should be requested.\n */\n hasChanged?(value: Type, oldValue: Type): boolean;\n}\n\n/**\n * Declares a private or protected property that still triggers updates to the\n * element when it changes.\n *\n * Properties declared this way must not be used from HTML or HTML templating\n * systems, they're solely for properties internal to the element. These\n * properties may be renamed by optimization tools like closure compiler.\n * @category Decorator\n */\nexport function internalProperty(options?: InternalPropertyDeclaration) {\n return property({attribute: false, hasChanged: options?.hasChanged});\n}\n\n/**\n * A property decorator that converts a class property into a getter that\n * executes a querySelector on the element's renderRoot.\n *\n * @param selector A DOMString containing one or more selectors to match.\n * @param cache An optional boolean which when true performs the DOM query only\n * once and caches the result.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector\n *\n * @example\n *\n * ```ts\n * class MyElement {\n * @query('#first')\n * first;\n *\n * render() {\n * return html`\n * <div id=\"first\"></div>\n * <div id=\"second\"></div>\n * `;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function query(selector: string, cache?: boolean) {\n return (protoOrDescriptor: Object|ClassElement,\n // tslint:disable-next-line:no-any decorator\n name?: PropertyKey): any => {\n const descriptor = {\n get(this: LitElement) {\n return this.renderRoot.querySelector(selector);\n },\n enumerable: true,\n configurable: true,\n };\n if (cache) {\n const key = typeof name === 'symbol' ? Symbol() : `__${name}`;\n descriptor.get = function(this: LitElement) {\n if ((this as unknown as\n {[key: string]: Element | null})[key as string] === undefined) {\n ((this as unknown as {[key: string]: Element | null})[key as string] =\n this.renderRoot.querySelector(selector));\n }\n return (\n this as unknown as {[key: string]: Element | null})[key as string];\n };\n }\n return (name !== undefined) ?\n legacyQuery(descriptor, protoOrDescriptor as Object, name) :\n standardQuery(descriptor, protoOrDescriptor as ClassElement);\n };\n}\n\n// Note, in the future, we may extend this decorator to support the use case\n// where the queried element may need to do work to become ready to interact\n// with (e.g. load some implementation code). If so, we might elect to\n// add a second argument defining a function that can be run to make the\n// queried element loaded/updated/ready.\n/**\n * A property decorator that converts a class property into a getter that\n * returns a promise that resolves to the result of a querySelector on the\n * element's renderRoot done after the element's `updateComplete` promise\n * resolves. When the queried property may change with element state, this\n * decorator can be used instead of requiring users to await the\n * `updateComplete` before accessing the property.\n *\n * @param selector A DOMString containing one or more selectors to match.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector\n *\n * @example\n * ```ts\n * class MyElement {\n * @queryAsync('#first')\n * first;\n *\n * render() {\n * return html`\n * <div id=\"first\"></div>\n * <div id=\"second\"></div>\n * `;\n * }\n * }\n *\n * // external usage\n * async doSomethingWithFirst() {\n * (await aMyElement.first).doSomething();\n * }\n * ```\n * @category Decorator\n */\nexport function queryAsync(selector: string) {\n return (protoOrDescriptor: Object|ClassElement,\n // tslint:disable-next-line:no-any decorator\n name?: PropertyKey): any => {\n const descriptor = {\n async get(this: LitElement) {\n await this.updateComplete;\n return this.renderRoot.querySelector(selector);\n },\n enumerable: true,\n configurable: true,\n };\n return (name !== undefined) ?\n legacyQuery(descriptor, protoOrDescriptor as Object, name) :\n standardQuery(descriptor, protoOrDescriptor as ClassElement);\n };\n}\n\n/**\n * A property decorator that converts a class property into a getter\n * that executes a querySelectorAll on the element's renderRoot.\n *\n * @param selector A DOMString containing one or more selectors to match.\n *\n * See:\n * https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll\n *\n * @example\n * ```ts\n * class MyElement {\n * @queryAll('div')\n * divs;\n *\n * render() {\n * return html`\n * <div id=\"first\"></div>\n * <div id=\"second\"></div>\n * `;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function queryAll(selector: string) {\n return (protoOrDescriptor: Object|ClassElement,\n // tslint:disable-next-line:no-any decorator\n name?: PropertyKey): any => {\n const descriptor = {\n get(this: LitElement) {\n return this.renderRoot.querySelectorAll(selector);\n },\n enumerable: true,\n configurable: true,\n };\n return (name !== undefined) ?\n legacyQuery(descriptor, protoOrDescriptor as Object, name) :\n standardQuery(descriptor, protoOrDescriptor as ClassElement);\n };\n}\n\nconst legacyQuery =\n (descriptor: PropertyDescriptor, proto: Object, name: PropertyKey) => {\n Object.defineProperty(proto, name, descriptor);\n };\n\nconst standardQuery = (descriptor: PropertyDescriptor, element: ClassElement) =>\n ({\n kind: 'method',\n placement: 'prototype',\n key: element.key,\n descriptor,\n });\n\nconst standardEventOptions =\n (options: AddEventListenerOptions, element: ClassElement) => {\n return {\n ...element,\n finisher(clazz: typeof UpdatingElement) {\n Object.assign(\n clazz.prototype[element.key as keyof UpdatingElement], options);\n }\n };\n };\n\nconst legacyEventOptions =\n // tslint:disable-next-line:no-any legacy decorator\n (options: AddEventListenerOptions, proto: any, name: PropertyKey) => {\n Object.assign(proto[name], options);\n };\n\n/**\n * Adds event listener options to a method used as an event listener in a\n * lit-html template.\n *\n * @param options An object that specifies event listener options as accepted by\n * `EventTarget#addEventListener` and `EventTarget#removeEventListener`.\n *\n * Current browsers support the `capture`, `passive`, and `once` options. See:\n * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters\n *\n * @example\n * ```ts\n * class MyElement {\n * clicked = false;\n *\n * render() {\n * return html`\n * <div @click=${this._onClick}`>\n * <button></button>\n * </div>\n * `;\n * }\n *\n * @eventOptions({capture: true})\n * _onClick(e) {\n * this.clicked = true;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function eventOptions(options: AddEventListenerOptions) {\n // Return value typed as any to prevent TypeScript from complaining that\n // standard decorator function signature does not match TypeScript decorator\n // signature\n // TODO(kschaaf): unclear why it was only failing on this decorator and not\n // the others\n return ((protoOrDescriptor: Object|ClassElement, name?: string) =>\n (name !== undefined) ?\n legacyEventOptions(options, protoOrDescriptor as Object, name) :\n standardEventOptions(\n options, protoOrDescriptor as ClassElement)) as\n // tslint:disable-next-line:no-any decorator\n any;\n}\n\n// x-browser support for matches\n// tslint:disable-next-line:no-any\nconst ElementProto = Element.prototype as any;\nconst legacyMatches =\n ElementProto.msMatchesSelector || ElementProto.webkitMatchesSelector;\n\n/**\n * A property decorator that converts a class property into a getter that\n * returns the `assignedNodes` of the given named `slot`. Note, the type of\n * this property should be annotated as `NodeListOf<HTMLElement>`.\n *\n * @param slotName A string name of the slot.\n * @param flatten A boolean which when true flattens the assigned nodes,\n * meaning any assigned nodes that are slot elements are replaced with their\n * assigned nodes.\n * @param selector A string which filters the results to elements that match\n * the given css selector.\n *\n * * @example\n * ```ts\n * class MyElement {\n * @queryAssignedNodes('list', true, '.item')\n * listItems;\n *\n * render() {\n * return html`\n * <slot name=\"list\"></slot>\n * `;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function queryAssignedNodes(\n slotName = '', flatten = false, selector = '') {\n return (protoOrDescriptor: Object|ClassElement,\n // tslint:disable-next-line:no-any decorator\n name?: PropertyKey): any => {\n const descriptor = {\n get(this: LitElement) {\n const slotSelector =\n `slot${slotName ? `[name=${slotName}]` : ':not([name])'}`;\n const slot = this.renderRoot.querySelector(slotSelector);\n let nodes = slot && (slot as HTMLSlotElement).assignedNodes({flatten});\n if (nodes && selector) {\n nodes = nodes.filter(\n (node) => node.nodeType === Node.ELEMENT_NODE &&\n (node as Element).matches ?\n (node as Element).matches(selector) :\n legacyMatches.call(node as Element, selector));\n }\n return nodes;\n },\n enumerable: true,\n configurable: true,\n };\n return (name !== undefined) ?\n legacyQuery(descriptor, protoOrDescriptor as Object, name) :\n standardQuery(descriptor, protoOrDescriptor as ClassElement);\n };\n}\n","/**\n@license\nCopyright (c) 2019 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at\nhttp://polymer.github.io/LICENSE.txt The complete set of authors may be found at\nhttp://polymer.github.io/AUTHORS.txt The complete set of contributors may be\nfound at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as\npart of the polymer project is also subject to an additional IP rights grant\nfound at http://polymer.github.io/PATENTS.txt\n*/\n\n/**\n * Whether the current browser supports `adoptedStyleSheets`.\n */\nexport const supportsAdoptingStyleSheets = (window.ShadowRoot) &&\n (window.ShadyCSS === undefined || window.ShadyCSS.nativeShadow) &&\n ('adoptedStyleSheets' in Document.prototype) &&\n ('replace' in CSSStyleSheet.prototype);\n\nconst constructionToken = Symbol();\n\nexport class CSSResult {\n _styleSheet?: CSSStyleSheet|null;\n\n readonly cssText: string;\n\n constructor(cssText: string, safeToken: symbol) {\n if (safeToken !== constructionToken) {\n throw new Error(\n 'CSSResult is not constructable. Use `unsafeCSS` or `css` instead.');\n }\n\n this.cssText = cssText;\n }\n\n // Note, this is a getter so that it's lazy. In practice, this means\n // stylesheets are not created until the first element instance is made.\n get styleSheet(): CSSStyleSheet|null {\n if (this._styleSheet === undefined) {\n // Note, if `supportsAdoptingStyleSheets` is true then we assume\n // CSSStyleSheet is constructable.\n if (supportsAdoptingStyleSheets) {\n this._styleSheet = new CSSStyleSheet();\n this._styleSheet.replaceSync(this.cssText);\n } else {\n this._styleSheet = null;\n }\n }\n return this._styleSheet;\n }\n\n toString(): string {\n return this.cssText;\n }\n}\n\n/**\n * Wrap a value for interpolation in a [[`css`]] tagged template literal.\n *\n * This is unsafe because untrusted CSS text can be used to phone home\n * or exfiltrate data to an attacker controlled site. Take care to only use\n * this with trusted input.\n */\nexport const unsafeCSS = (value: unknown) => {\n return new CSSResult(String(value), constructionToken);\n};\n\nconst textFromCSSResult = (value: CSSResult|number) => {\n if (value instanceof CSSResult) {\n return value.cssText;\n } else if (typeof value === 'number') {\n return value;\n } else {\n throw new Error(\n `Value passed to 'css' function must be a 'css' function result: ${\n value}. Use 'unsafeCSS' to pass non-literal values, but\n take care to ensure page security.`);\n }\n};\n\n/**\n * Template tag which which can be used with LitElement's [[LitElement.styles |\n * `styles`]] property to set element styles. For security reasons, only literal\n * string values may be used. To incorporate non-literal values [[`unsafeCSS`]]\n * may be used inside a template string part.\n */\nexport const css =\n (strings: TemplateStringsArray, ...values: (CSSResult|number)[]) => {\n const cssText = values.reduce(\n (acc, v, idx) => acc + textFromCSSResult(v) + strings[idx + 1],\n strings[0]);\n return new CSSResult(cssText, constructionToken);\n };\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * The main LitElement module, which defines the [[`LitElement`]] base class and\n * related APIs.\n *\n * LitElement components can define a template and a set of observed\n * properties. Changing an observed property triggers a re-render of the\n * element.\n *\n * Import [[`LitElement`]] and [[`html`]] from this module to create a\n * component:\n *\n * ```js\n * import {LitElement, html} from 'lit-element';\n *\n * class MyElement extends LitElement {\n *\n * // Declare observed properties\n * static get properties() {\n * return {\n * adjective: {}\n * }\n * }\n *\n * constructor() {\n * this.adjective = 'awesome';\n * }\n *\n * // Define the element's template\n * render() {\n * return html`<p>your ${adjective} template here</p>`;\n * }\n * }\n *\n * customElements.define('my-element', MyElement);\n * ```\n *\n * `LitElement` extends [[`UpdatingElement`]] and adds lit-html templating.\n * The `UpdatingElement` class is provided for users that want to build\n * their own custom element base classes that don't use lit-html.\n *\n * @packageDocumentation\n */\nimport {render, ShadyRenderOptions} from 'lit-html/lib/shady-render.js';\n\nimport {PropertyValues, UpdatingElement} from './lib/updating-element.js';\n\nexport * from './lib/updating-element.js';\nexport * from './lib/decorators.js';\nexport {html, svg, TemplateResult, SVGTemplateResult} from 'lit-html/lit-html.js';\nimport {supportsAdoptingStyleSheets, CSSResult, unsafeCSS} from './lib/css-tag.js';\nexport * from './lib/css-tag.js';\n\ndeclare global {\n interface Window {\n litElementVersions: string[];\n }\n}\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for LitElement usage.\n// TODO(justinfagnani): inject version number at build time\n(window['litElementVersions'] || (window['litElementVersions'] = []))\n .push('2.4.0');\n\nexport type CSSResultOrNative = CSSResult|CSSStyleSheet;\n\nexport interface CSSResultArray extends\n Array<CSSResultOrNative|CSSResultArray> {}\n\n/**\n * Sentinal value used to avoid calling lit-html's render function when\n * subclasses do not implement `render`\n */\nconst renderNotImplemented = {};\n\n/**\n * Base element class that manages element properties and attributes, and\n * renders a lit-html template.\n *\n * To define a component, subclass `LitElement` and implement a\n * `render` method to provide the component's template. Define properties\n * using the [[`properties`]] property or the [[`property`]] decorator.\n */\nexport class LitElement extends UpdatingElement {\n /**\n * Ensure this class is marked as `finalized` as an optimization ensuring\n * it will not needlessly try to `finalize`.\n *\n * Note this property name is a string to prevent breaking Closure JS Compiler\n * optimizations. See updating-element.ts for more information.\n */\n protected static['finalized'] = true;\n\n /**\n * Reference to the underlying library method used to render the element's\n * DOM. By default, points to the `render` method from lit-html's shady-render\n * module.\n *\n * **Most users will never need to touch this property.**\n *\n * This property should not be confused with the `render` instance method,\n * which should be overridden to define a template for the element.\n *\n * Advanced users creating a new base class based on LitElement can override\n * this property to point to a custom render method with a signature that\n * matches [shady-render's `render`\n * method](https://lit-html.polymer-project.org/api/modules/shady_render.html#render).\n *\n * @nocollapse\n */\n static render:\n (result: unknown, container: Element|DocumentFragment,\n options: ShadyRenderOptions) => void = render;\n\n /**\n * Array of styles to apply to the element. The styles should be defined\n * using the [[`css`]] tag function or via constructible stylesheets.\n */\n static styles?: CSSResultOrNative|CSSResultArray;\n\n private static _styles: Array<CSSResultOrNative|CSSResult>|undefined;\n\n /**\n * Return the array of styles to apply to the element.\n * Override this method to integrate into a style management system.\n *\n * @nocollapse\n */\n static getStyles(): CSSResultOrNative|CSSResultArray|undefined {\n return this.styles;\n }\n\n /** @nocollapse */\n private static _getUniqueStyles() {\n // Only gather styles once per class\n if (this.hasOwnProperty(JSCompiler_renameProperty('_styles', this))) {\n return;\n }\n // Take care not to call `this.getStyles()` multiple times since this\n // generates new CSSResults each time.\n // TODO(sorvell): Since we do not cache CSSResults by input, any\n // shared styles will generate new stylesheet objects, which is wasteful.\n // This should be addressed when a browser ships constructable\n // stylesheets.\n const userStyles = this.getStyles();\n\n if (Array.isArray(userStyles)) {\n // De-duplicate styles preserving the _last_ instance in the set.\n // This is a performance optimization to avoid duplicated styles that can\n // occur especially when composing via subclassing.\n // The last item is kept to try to preserve the cascade order with the\n // assumption that it's most important that last added styles override\n // previous styles.\n const addStyles = (styles: CSSResultArray, set: Set<CSSResultOrNative>):\n Set<CSSResultOrNative> => styles.reduceRight(\n (set: Set<CSSResultOrNative>, s) =>\n // Note: On IE set.add() does not return the set\n Array.isArray(s) ? addStyles(s, set) : (set.add(s), set),\n set);\n // Array.from does not work on Set in IE, otherwise return\n // Array.from(addStyles(userStyles, new Set<CSSResult>())).reverse()\n const set = addStyles(userStyles, new Set<CSSResultOrNative>());\n const styles: CSSResultOrNative[] = [];\n set.forEach((v) => styles.unshift(v));\n this._styles = styles;\n } else {\n this._styles = userStyles === undefined ? [] : [userStyles];\n }\n\n // Ensure that there are no invalid CSSStyleSheet instances here. They are\n // invalid in two conditions.\n // (1) the sheet is non-constructible (`sheet` of a HTMLStyleElement), but\n // this is impossible to check except via .replaceSync or use\n // (2) the ShadyCSS polyfill is enabled (:. supportsAdoptingStyleSheets is\n // false)\n this._styles = this._styles.map((s) => {\n if (s instanceof CSSStyleSheet && !supportsAdoptingStyleSheets) {\n // Flatten the cssText from the passed constructible stylesheet (or\n // undetectable non-constructible stylesheet). The user might have\n // expected to update their stylesheets over time, but the alternative\n // is a crash.\n const cssText = Array.prototype.slice.call(s.cssRules)\n .reduce((css, rule) => css + rule.cssText, '');\n return unsafeCSS(cssText);\n }\n return s;\n });\n }\n\n private _needsShimAdoptedStyleSheets?: boolean;\n\n /**\n * Node or ShadowRoot into which element DOM should be rendered. Defaults\n * to an open shadowRoot.\n */\n readonly renderRoot!: Element|DocumentFragment;\n\n /**\n * Performs element initialization. By default this calls\n * [[`createRenderRoot`]] to create the element [[`renderRoot`]] node and\n * captures any pre-set values for registered properties.\n */\n protected initialize() {\n super.initialize();\n (this.constructor as typeof LitElement)._getUniqueStyles();\n (this as {\n renderRoot: Element|DocumentFragment;\n }).renderRoot = this.createRenderRoot();\n // Note, if renderRoot is not a shadowRoot, styles would/could apply to the\n // element's getRootNode(). While this could be done, we're choosing not to\n // support this now since it would require different logic around de-duping.\n if (window.ShadowRoot && this.renderRoot instanceof window.ShadowRoot) {\n this.adoptStyles();\n }\n }\n\n /**\n * Returns the node into which the element should render and by default\n * creates and returns an open shadowRoot. Implement to customize where the\n * element's DOM is rendered. For example, to render into the element's\n * childNodes, return `this`.\n * @returns {Element|DocumentFragment} Returns a node into which to render.\n */\n protected createRenderRoot(): Element|ShadowRoot {\n return this.attachShadow({mode: 'open'});\n }\n\n /**\n * Applies styling to the element shadowRoot using the [[`styles`]]\n * property. Styling will apply using `shadowRoot.adoptedStyleSheets` where\n * available and will fallback otherwise. When Shadow DOM is polyfilled,\n * ShadyCSS scopes styles and adds them to the document. When Shadow DOM\n * is available but `adoptedStyleSheets` is not, styles are appended to the\n * end of the `shadowRoot` to [mimic spec\n * behavior](https://wicg.github.io/construct-stylesheets/#using-constructed-stylesheets).\n */\n protected adoptStyles() {\n const styles = (this.constructor as typeof LitElement)._styles!;\n if (styles.length === 0) {\n return;\n }\n // There are three separate cases here based on Shadow DOM support.\n // (1) shadowRoot polyfilled: use ShadyCSS\n // (2) shadowRoot.adoptedStyleSheets available: use it\n // (3) shadowRoot.adoptedStyleSheets polyfilled: append styles after\n // rendering\n if (window.ShadyCSS !== undefined && !window.ShadyCSS.nativeShadow) {\n window.ShadyCSS.ScopingShim!.prepareAdoptedCssText(\n styles.map((s) => s.cssText), this.localName);\n } else if (supportsAdoptingStyleSheets) {\n (this.renderRoot as ShadowRoot).adoptedStyleSheets =\n styles.map((s) => s instanceof CSSStyleSheet ? s : s.styleSheet!);\n } else {\n // This must be done after rendering so the actual style insertion is done\n // in `update`.\n this._needsShimAdoptedStyleSheets = true;\n }\n }\n\n connectedCallback() {\n super.connectedCallback();\n // Note, first update/render handles styleElement so we only call this if\n // connected after first update.\n if (this.hasUpdated && window.ShadyCSS !== undefined) {\n window.ShadyCSS.styleElement(this);\n }\n }\n\n /**\n * Updates the element. This method reflects property values to attributes\n * and calls `render` to render DOM via lit-html. Setting properties inside\n * this method will *not* trigger another update.\n * @param _changedProperties Map of changed properties with old values\n */\n protected update(changedProperties: PropertyValues) {\n // Setting properties in `render` should not trigger an update. Since\n // updates are allowed after super.update, it's important to call `render`\n // before that.\n const templateResult = this.render();\n super.update(changedProperties);\n // If render is not implemented by the component, don't call lit-html render\n if (templateResult !== renderNotImplemented) {\n (this.constructor as typeof LitElement)\n .render(\n templateResult,\n this.renderRoot,\n {scopeName: this.localName, eventContext: this});\n }\n // When native Shadow DOM is used but adoptedStyles are not supported,\n // insert styling after rendering to ensure adoptedStyles have highest\n // priority.\n if (this._needsShimAdoptedStyleSheets) {\n this._needsShimAdoptedStyleSheets = false;\n (this.constructor as typeof LitElement)._styles!.forEach((s) => {\n const style = document.createElement('style');\n style.textContent = s.cssText;\n this.renderRoot.appendChild(style);\n });\n }\n }\n\n /**\n * Invoked on each update to perform rendering tasks. This method may return\n * any value renderable by lit-html's `NodePart` - typically a\n * `TemplateResult`. Setting properties inside this method will *not* trigger\n * the element to update.\n */\n protected render(): unknown {\n return renderNotImplemented;\n }\n}\n",null,null,null,null,"//! moment.js\n//! version : 2.29.1\n//! authors : Tim Wood, Iskren Chernev, Moment.js contributors\n//! license : MIT\n//! momentjs.com\n\n;(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n global.moment = factory()\n}(this, (function () { 'use strict';\n\n var hookCallback;\n\n function hooks() {\n return hookCallback.apply(null, arguments);\n }\n\n // This is done to register the method called with moment()\n // without creating circular dependencies.\n function setHookCallback(callback) {\n hookCallback = callback;\n }\n\n function isArray(input) {\n return (\n input instanceof Array ||\n Object.prototype.toString.call(input) === '[object Array]'\n );\n }\n\n function isObject(input) {\n // IE8 will treat undefined and null as object if it wasn't for\n // input != null\n return (\n input != null &&\n Object.prototype.toString.call(input) === '[object Object]'\n );\n }\n\n function hasOwnProp(a, b) {\n return Object.prototype.hasOwnProperty.call(a, b);\n }\n\n function isObjectEmpty(obj) {\n if (Object.getOwnPropertyNames) {\n return Object.getOwnPropertyNames(obj).length === 0;\n } else {\n var k;\n for (k in obj) {\n if (hasOwnProp(obj, k)) {\n return false;\n }\n }\n return true;\n }\n }\n\n function isUndefined(input) {\n return input === void 0;\n }\n\n function isNumber(input) {\n return (\n typeof input === 'number' ||\n Object.prototype.toString.call(input) === '[object Number]'\n );\n }\n\n function isDate(input) {\n return (\n input instanceof Date ||\n Object.prototype.toString.call(input) === '[object Date]'\n );\n }\n\n function map(arr, fn) {\n var res = [],\n i;\n for (i = 0; i < arr.length; ++i) {\n res.push(fn(arr[i], i));\n }\n return res;\n }\n\n function extend(a, b) {\n for (var i in b) {\n if (hasOwnProp(b, i)) {\n a[i] = b[i];\n }\n }\n\n if (hasOwnProp(b, 'toString')) {\n a.toString = b.toString;\n }\n\n if (hasOwnProp(b, 'valueOf')) {\n a.valueOf = b.valueOf;\n }\n\n return a;\n }\n\n function createUTC(input, format, locale, strict) {\n return createLocalOrUTC(input, format, locale, strict, true).utc();\n }\n\n function defaultParsingFlags() {\n // We need to deep clone this object.\n return {\n empty: false,\n unusedTokens: [],\n unusedInput: [],\n overflow: -2,\n charsLeftOver: 0,\n nullInput: false,\n invalidEra: null,\n invalidMonth: null,\n invalidFormat: false,\n userInvalidated: false,\n iso: false,\n parsedDateParts: [],\n era: null,\n meridiem: null,\n rfc2822: false,\n weekdayMismatch: false,\n };\n }\n\n function getParsingFlags(m) {\n if (m._pf == null) {\n m._pf = defaultParsingFlags();\n }\n return m._pf;\n }\n\n var some;\n if (Array.prototype.some) {\n some = Array.prototype.some;\n } else {\n some = function (fun) {\n var t = Object(this),\n len = t.length >>> 0,\n i;\n\n for (i = 0; i < len; i++) {\n if (i in t && fun.call(this, t[i], i, t)) {\n return true;\n }\n }\n\n return false;\n };\n }\n\n function isValid(m) {\n if (m._isValid == null) {\n var flags = getParsingFlags(m),\n parsedParts = some.call(flags.parsedDateParts, function (i) {\n return i != null;\n }),\n isNowValid =\n !isNaN(m._d.getTime()) &&\n flags.overflow < 0 &&\n !flags.empty &&\n !flags.invalidEra &&\n !flags.invalidMonth &&\n !flags.invalidWeekday &&\n !flags.weekdayMismatch &&\n !flags.nullInput &&\n !flags.invalidFormat &&\n !flags.userInvalidated &&\n (!flags.meridiem || (flags.meridiem && parsedParts));\n\n if (m._strict) {\n isNowValid =\n isNowValid &&\n flags.charsLeftOver === 0 &&\n flags.unusedTokens.length === 0 &&\n flags.bigHour === undefined;\n }\n\n if (Object.isFrozen == null || !Object.isFrozen(m)) {\n m._isValid = isNowValid;\n } else {\n return isNowValid;\n }\n }\n return m._isValid;\n }\n\n function createInvalid(flags) {\n var m = createUTC(NaN);\n if (flags != null) {\n extend(getParsingFlags(m), flags);\n } else {\n getParsingFlags(m).userInvalidated = true;\n }\n\n return m;\n }\n\n // Plugins that add properties should also add the key here (null value),\n // so we can properly clone ourselves.\n var momentProperties = (hooks.momentProperties = []),\n updateInProgress = false;\n\n function copyConfig(to, from) {\n var i, prop, val;\n\n if (!isUndefined(from._isAMomentObject)) {\n to._isAMomentObject = from._isAMomentObject;\n }\n if (!isUndefined(from._i)) {\n to._i = from._i;\n }\n if (!isUndefined(from._f)) {\n to._f = from._f;\n }\n if (!isUndefined(from._l)) {\n to._l = from._l;\n }\n if (!isUndefined(from._strict)) {\n to._strict = from._strict;\n }\n if (!isUndefined(from._tzm)) {\n to._tzm = from._tzm;\n }\n if (!isUndefined(from._isUTC)) {\n to._isUTC = from._isUTC;\n }\n if (!isUndefined(from._offset)) {\n to._offset = from._offset;\n }\n if (!isUndefined(from._pf)) {\n to._pf = getParsingFlags(from);\n }\n if (!isUndefined(from._locale)) {\n to._locale = from._locale;\n }\n\n if (momentProperties.length > 0) {\n for (i = 0; i < momentProperties.length; i++) {\n prop = momentProperties[i];\n val = from[prop];\n if (!isUndefined(val)) {\n to[prop] = val;\n }\n }\n }\n\n return to;\n }\n\n // Moment prototype object\n function Moment(config) {\n copyConfig(this, config);\n this._d = new Date(config._d != null ? config._d.getTime() : NaN);\n if (!this.isValid()) {\n this._d = new Date(NaN);\n }\n // Prevent infinite loop in case updateOffset creates new moment\n // objects.\n if (updateInProgress === false) {\n updateInProgress = true;\n hooks.updateOffset(this);\n updateInProgress = false;\n }\n }\n\n function isMoment(obj) {\n return (\n obj instanceof Moment || (obj != null && obj._isAMomentObject != null)\n );\n }\n\n function warn(msg) {\n if (\n hooks.suppressDeprecationWarnings === false &&\n typeof console !== 'undefined' &&\n console.warn\n ) {\n console.warn('Deprecation warning: ' + msg);\n }\n }\n\n function deprecate(msg, fn) {\n var firstTime = true;\n\n return extend(function () {\n if (hooks.deprecationHandler != null) {\n hooks.deprecationHandler(null, msg);\n }\n if (firstTime) {\n var args = [],\n arg,\n i,\n key;\n for (i = 0; i < arguments.length; i++) {\n arg = '';\n if (typeof arguments[i] === 'object') {\n arg += '\\n[' + i + '] ';\n for (key in arguments[0]) {\n if (hasOwnProp(arguments[0], key)) {\n arg += key + ': ' + arguments[0][key] + ', ';\n }\n }\n arg = arg.slice(0, -2); // Remove trailing comma and space\n } else {\n arg = arguments[i];\n }\n args.push(arg);\n }\n warn(\n msg +\n '\\nArguments: ' +\n Array.prototype.slice.call(args).join('') +\n '\\n' +\n new Error().stack\n );\n firstTime = false;\n }\n return fn.apply(this, arguments);\n }, fn);\n }\n\n var deprecations = {};\n\n function deprecateSimple(name, msg) {\n if (hooks.deprecationHandler != null) {\n hooks.deprecationHandler(name, msg);\n }\n if (!deprecations[name]) {\n warn(msg);\n deprecations[name] = true;\n }\n }\n\n hooks.suppressDeprecationWarnings = false;\n hooks.deprecationHandler = null;\n\n function isFunction(input) {\n return (\n (typeof Function !== 'undefined' && input instanceof Function) ||\n Object.prototype.toString.call(input) === '[object Function]'\n );\n }\n\n function set(config) {\n var prop, i;\n for (i in config) {\n if (hasOwnProp(config, i)) {\n prop = config[i];\n if (isFunction(prop)) {\n this[i] = prop;\n } else {\n this['_' + i] = prop;\n }\n }\n }\n this._config = config;\n // Lenient ordinal parsing accepts just a number in addition to\n // number + (possibly) stuff coming from _dayOfMonthOrdinalParse.\n // TODO: Remove \"ordinalParse\" fallback in next major release.\n this._dayOfMonthOrdinalParseLenient = new RegExp(\n (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) +\n '|' +\n /\\d{1,2}/.source\n );\n }\n\n function mergeConfigs(parentConfig, childConfig) {\n var res = extend({}, parentConfig),\n prop;\n for (prop in childConfig) {\n if (hasOwnProp(childConfig, prop)) {\n if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {\n res[prop] = {};\n extend(res[prop], parentConfig[prop]);\n extend(res[prop], childConfig[prop]);\n } else if (childConfig[prop] != null) {\n res[prop] = childConfig[prop];\n } else {\n delete res[prop];\n }\n }\n }\n for (prop in parentConfig) {\n if (\n hasOwnProp(parentConfig, prop) &&\n !hasOwnProp(childConfig, prop) &&\n isObject(parentConfig[prop])\n ) {\n // make sure changes to properties don't modify parent config\n res[prop] = extend({}, res[prop]);\n }\n }\n return res;\n }\n\n function Locale(config) {\n if (config != null) {\n this.set(config);\n }\n }\n\n var keys;\n\n if (Object.keys) {\n keys = Object.keys;\n } else {\n keys = function (obj) {\n var i,\n res = [];\n for (i in obj) {\n if (hasOwnProp(obj, i)) {\n res.push(i);\n }\n }\n return res;\n };\n }\n\n var defaultCalendar = {\n sameDay: '[Today at] LT',\n nextDay: '[Tomorrow at] LT',\n nextWeek: 'dddd [at] LT',\n lastDay: '[Yesterday at] LT',\n lastWeek: '[Last] dddd [at] LT',\n sameElse: 'L',\n };\n\n function calendar(key, mom, now) {\n var output = this._calendar[key] || this._calendar['sameElse'];\n return isFunction(output) ? output.call(mom, now) : output;\n }\n\n function zeroFill(number, targetLength, forceSign) {\n var absNumber = '' + Math.abs(number),\n zerosToFill = targetLength - absNumber.length,\n sign = number >= 0;\n return (\n (sign ? (forceSign ? '+' : '') : '-') +\n Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) +\n absNumber\n );\n }\n\n var formattingTokens = /(\\[[^\\[]*\\])|(\\\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,\n localFormattingTokens = /(\\[[^\\[]*\\])|(\\\\)?(LTS|LT|LL?L?L?|l{1,4})/g,\n formatFunctions = {},\n formatTokenFunctions = {};\n\n // token: 'M'\n // padded: ['MM', 2]\n // ordinal: 'Mo'\n // callback: function () { this.month() + 1 }\n function addFormatToken(token, padded, ordinal, callback) {\n var func = callback;\n if (typeof callback === 'string') {\n func = function () {\n return this[callback]();\n };\n }\n if (token) {\n formatTokenFunctions[token] = func;\n }\n if (padded) {\n formatTokenFunctions[padded[0]] = function () {\n return zeroFill(func.apply(this, arguments), padded[1], padded[2]);\n };\n }\n if (ordinal) {\n formatTokenFunctions[ordinal] = function () {\n return this.localeData().ordinal(\n func.apply(this, arguments),\n token\n );\n };\n }\n }\n\n function removeFormattingTokens(input) {\n if (input.match(/\\[[\\s\\S]/)) {\n return input.replace(/^\\[|\\]$/g, '');\n }\n return input.replace(/\\\\/g, '');\n }\n\n function makeFormatFunction(format) {\n var array = format.match(formattingTokens),\n i,\n length;\n\n for (i = 0, length = array.length; i < length; i++) {\n if (formatTokenFunctions[array[i]]) {\n array[i] = formatTokenFunctions[array[i]];\n } else {\n array[i] = removeFormattingTokens(array[i]);\n }\n }\n\n return function (mom) {\n var output = '',\n i;\n for (i = 0; i < length; i++) {\n output += isFunction(array[i])\n ? array[i].call(mom, format)\n : array[i];\n }\n return output;\n };\n }\n\n // format date using native date object\n function formatMoment(m, format) {\n if (!m.isValid()) {\n return m.localeData().invalidDate();\n }\n\n format = expandFormat(format, m.localeData());\n formatFunctions[format] =\n formatFunctions[format] || makeFormatFunction(format);\n\n return formatFunctions[format](m);\n }\n\n function expandFormat(format, locale) {\n var i = 5;\n\n function replaceLongDateFormatTokens(input) {\n return locale.longDateFormat(input) || input;\n }\n\n localFormattingTokens.lastIndex = 0;\n while (i >= 0 && localFormattingTokens.test(format)) {\n format = format.replace(\n localFormattingTokens,\n replaceLongDateFormatTokens\n );\n localFormattingTokens.lastIndex = 0;\n i -= 1;\n }\n\n return format;\n }\n\n var defaultLongDateFormat = {\n LTS: 'h:mm:ss A',\n LT: 'h:mm A',\n L: 'MM/DD/YYYY',\n LL: 'MMMM D, YYYY',\n LLL: 'MMMM D, YYYY h:mm A',\n LLLL: 'dddd, MMMM D, YYYY h:mm A',\n };\n\n function longDateFormat(key) {\n var format = this._longDateFormat[key],\n formatUpper = this._longDateFormat[key.toUpperCase()];\n\n if (format || !formatUpper) {\n return format;\n }\n\n this._longDateFormat[key] = formatUpper\n .match(formattingTokens)\n .map(function (tok) {\n if (\n tok === 'MMMM' ||\n tok === 'MM' ||\n tok === 'DD' ||\n tok === 'dddd'\n ) {\n return tok.slice(1);\n }\n return tok;\n })\n .join('');\n\n return this._longDateFormat[key];\n }\n\n var defaultInvalidDate = 'Invalid date';\n\n function invalidDate() {\n return this._invalidDate;\n }\n\n var defaultOrdinal = '%d',\n defaultDayOfMonthOrdinalParse = /\\d{1,2}/;\n\n function ordinal(number) {\n return this._ordinal.replace('%d', number);\n }\n\n var defaultRelativeTime = {\n future: 'in %s',\n past: '%s ago',\n s: 'a few seconds',\n ss: '%d seconds',\n m: 'a minute',\n mm: '%d minutes',\n h: 'an hour',\n hh: '%d hours',\n d: 'a day',\n dd: '%d days',\n w: 'a week',\n ww: '%d weeks',\n M: 'a month',\n MM: '%d months',\n y: 'a year',\n yy: '%d years',\n };\n\n function relativeTime(number, withoutSuffix, string, isFuture) {\n var output = this._relativeTime[string];\n return isFunction(output)\n ? output(number, withoutSuffix, string, isFuture)\n : output.replace(/%d/i, number);\n }\n\n function pastFuture(diff, output) {\n var format = this._relativeTime[diff > 0 ? 'future' : 'past'];\n return isFunction(format) ? format(output) : format.replace(/%s/i, output);\n }\n\n var aliases = {};\n\n function addUnitAlias(unit, shorthand) {\n var lowerCase = unit.toLowerCase();\n aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;\n }\n\n function normalizeUnits(units) {\n return typeof units === 'string'\n ? aliases[units] || aliases[units.toLowerCase()]\n : undefined;\n }\n\n function normalizeObjectUnits(inputObject) {\n var normalizedInput = {},\n normalizedProp,\n prop;\n\n for (prop in inputObject) {\n if (hasOwnProp(inputObject, prop)) {\n normalizedProp = normalizeUnits(prop);\n if (normalizedProp) {\n normalizedInput[normalizedProp] = inputObject[prop];\n }\n }\n }\n\n return normalizedInput;\n }\n\n var priorities = {};\n\n function addUnitPriority(unit, priority) {\n priorities[unit] = priority;\n }\n\n function getPrioritizedUnits(unitsObj) {\n var units = [],\n u;\n for (u in unitsObj) {\n if (hasOwnProp(unitsObj, u)) {\n units.push({ unit: u, priority: priorities[u] });\n }\n }\n units.sort(function (a, b) {\n return a.priority - b.priority;\n });\n return units;\n }\n\n function isLeapYear(year) {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n }\n\n function absFloor(number) {\n if (number < 0) {\n // -0 -> 0\n return Math.ceil(number) || 0;\n } else {\n return Math.floor(number);\n }\n }\n\n function toInt(argumentForCoercion) {\n var coercedNumber = +argumentForCoercion,\n value = 0;\n\n if (coercedNumber !== 0 && isFinite(coercedNumber)) {\n value = absFloor(coercedNumber);\n }\n\n return value;\n }\n\n function makeGetSet(unit, keepTime) {\n return function (value) {\n if (value != null) {\n set$1(this, unit, value);\n hooks.updateOffset(this, keepTime);\n return this;\n } else {\n return get(this, unit);\n }\n };\n }\n\n function get(mom, unit) {\n return mom.isValid()\n ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]()\n : NaN;\n }\n\n function set$1(mom, unit, value) {\n if (mom.isValid() && !isNaN(value)) {\n if (\n unit === 'FullYear' &&\n isLeapYear(mom.year()) &&\n mom.month() === 1 &&\n mom.date() === 29\n ) {\n value = toInt(value);\n mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](\n value,\n mom.month(),\n daysInMonth(value, mom.month())\n );\n } else {\n mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);\n }\n }\n }\n\n // MOMENTS\n\n function stringGet(units) {\n units = normalizeUnits(units);\n if (isFunction(this[units])) {\n return this[units]();\n }\n return this;\n }\n\n function stringSet(units, value) {\n if (typeof units === 'object') {\n units = normalizeObjectUnits(units);\n var prioritized = getPrioritizedUnits(units),\n i;\n for (i = 0; i < prioritized.length; i++) {\n this[prioritized[i].unit](units[prioritized[i].unit]);\n }\n } else {\n units = normalizeUnits(units);\n if (isFunction(this[units])) {\n return this[units](value);\n }\n }\n return this;\n }\n\n var match1 = /\\d/, // 0 - 9\n match2 = /\\d\\d/, // 00 - 99\n match3 = /\\d{3}/, // 000 - 999\n match4 = /\\d{4}/, // 0000 - 9999\n match6 = /[+-]?\\d{6}/, // -999999 - 999999\n match1to2 = /\\d\\d?/, // 0 - 99\n match3to4 = /\\d\\d\\d\\d?/, // 999 - 9999\n match5to6 = /\\d\\d\\d\\d\\d\\d?/, // 99999 - 999999\n match1to3 = /\\d{1,3}/, // 0 - 999\n match1to4 = /\\d{1,4}/, // 0 - 9999\n match1to6 = /[+-]?\\d{1,6}/, // -999999 - 999999\n matchUnsigned = /\\d+/, // 0 - inf\n matchSigned = /[+-]?\\d+/, // -inf - inf\n matchOffset = /Z|[+-]\\d\\d:?\\d\\d/gi, // +00:00 -00:00 +0000 -0000 or Z\n matchShortOffset = /Z|[+-]\\d\\d(?::?\\d\\d)?/gi, // +00 -00 +00:00 -00:00 +0000 -0000 or Z\n matchTimestamp = /[+-]?\\d+(\\.\\d{1,3})?/, // 123456789 123456789.123\n // any word (or two) characters or numbers including two/three word month in arabic.\n // includes scottish gaelic two word and hyphenated months\n matchWord = /[0-9]{0,256}['a-z\\u00A0-\\u05FF\\u0700-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFF07\\uFF10-\\uFFEF]{1,256}|[\\u0600-\\u06FF\\/]{1,256}(\\s*?[\\u0600-\\u06FF]{1,256}){1,2}/i,\n regexes;\n\n regexes = {};\n\n function addRegexToken(token, regex, strictRegex) {\n regexes[token] = isFunction(regex)\n ? regex\n : function (isStrict, localeData) {\n return isStrict && strictRegex ? strictRegex : regex;\n };\n }\n\n function getParseRegexForToken(token, config) {\n if (!hasOwnProp(regexes, token)) {\n return new RegExp(unescapeFormat(token));\n }\n\n return regexes[token](config._strict, config._locale);\n }\n\n // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript\n function unescapeFormat(s) {\n return regexEscape(\n s\n .replace('\\\\', '')\n .replace(/\\\\(\\[)|\\\\(\\])|\\[([^\\]\\[]*)\\]|\\\\(.)/g, function (\n matched,\n p1,\n p2,\n p3,\n p4\n ) {\n return p1 || p2 || p3 || p4;\n })\n );\n }\n\n function regexEscape(s) {\n return s.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n }\n\n var tokens = {};\n\n function addParseToken(token, callback) {\n var i,\n func = callback;\n if (typeof token === 'string') {\n token = [token];\n }\n if (isNumber(callback)) {\n func = function (input, array) {\n array[callback] = toInt(input);\n };\n }\n for (i = 0; i < token.length; i++) {\n tokens[token[i]] = func;\n }\n }\n\n function addWeekParseToken(token, callback) {\n addParseToken(token, function (input, array, config, token) {\n config._w = config._w || {};\n callback(input, config._w, config, token);\n });\n }\n\n function addTimeToArrayFromToken(token, input, config) {\n if (input != null && hasOwnProp(tokens, token)) {\n tokens[token](input, config._a, config, token);\n }\n }\n\n var YEAR = 0,\n MONTH = 1,\n DATE = 2,\n HOUR = 3,\n MINUTE = 4,\n SECOND = 5,\n MILLISECOND = 6,\n WEEK = 7,\n WEEKDAY = 8;\n\n function mod(n, x) {\n return ((n % x) + x) % x;\n }\n\n var indexOf;\n\n if (Array.prototype.indexOf) {\n indexOf = Array.prototype.indexOf;\n } else {\n indexOf = function (o) {\n // I know\n var i;\n for (i = 0; i < this.length; ++i) {\n if (this[i] === o) {\n return i;\n }\n }\n return -1;\n };\n }\n\n function daysInMonth(year, month) {\n if (isNaN(year) || isNaN(month)) {\n return NaN;\n }\n var modMonth = mod(month, 12);\n year += (month - modMonth) / 12;\n return modMonth === 1\n ? isLeapYear(year)\n ? 29\n : 28\n : 31 - ((modMonth % 7) % 2);\n }\n\n // FORMATTING\n\n addFormatToken('M', ['MM', 2], 'Mo', function () {\n return this.month() + 1;\n });\n\n addFormatToken('MMM', 0, 0, function (format) {\n return this.localeData().monthsShort(this, format);\n });\n\n addFormatToken('MMMM', 0, 0, function (format) {\n return this.localeData().months(this, format);\n });\n\n // ALIASES\n\n addUnitAlias('month', 'M');\n\n // PRIORITY\n\n addUnitPriority('month', 8);\n\n // PARSING\n\n addRegexToken('M', match1to2);\n addRegexToken('MM', match1to2, match2);\n addRegexToken('MMM', function (isStrict, locale) {\n return locale.monthsShortRegex(isStrict);\n });\n addRegexToken('MMMM', function (isStrict, locale) {\n return locale.monthsRegex(isStrict);\n });\n\n addParseToken(['M', 'MM'], function (input, array) {\n array[MONTH] = toInt(input) - 1;\n });\n\n addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {\n var month = config._locale.monthsParse(input, token, config._strict);\n // if we didn't find a month name, mark the date as invalid.\n if (month != null) {\n array[MONTH] = month;\n } else {\n getParsingFlags(config).invalidMonth = input;\n }\n });\n\n // LOCALES\n\n var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split(\n '_'\n ),\n defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split(\n '_'\n ),\n MONTHS_IN_FORMAT = /D[oD]?(\\[[^\\[\\]]*\\]|\\s)+MMMM?/,\n defaultMonthsShortRegex = matchWord,\n defaultMonthsRegex = matchWord;\n\n function localeMonths(m, format) {\n if (!m) {\n return isArray(this._months)\n ? this._months\n : this._months['standalone'];\n }\n return isArray(this._months)\n ? this._months[m.month()]\n : this._months[\n (this._months.isFormat || MONTHS_IN_FORMAT).test(format)\n ? 'format'\n : 'standalone'\n ][m.month()];\n }\n\n function localeMonthsShort(m, format) {\n if (!m) {\n return isArray(this._monthsShort)\n ? this._monthsShort\n : this._monthsShort['standalone'];\n }\n return isArray(this._monthsShort)\n ? this._monthsShort[m.month()]\n : this._monthsShort[\n MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'\n ][m.month()];\n }\n\n function handleStrictParse(monthName, format, strict) {\n var i,\n ii,\n mom,\n llc = monthName.toLocaleLowerCase();\n if (!this._monthsParse) {\n // this is not used\n this._monthsParse = [];\n this._longMonthsParse = [];\n this._shortMonthsParse = [];\n for (i = 0; i < 12; ++i) {\n mom = createUTC([2000, i]);\n this._shortMonthsParse[i] = this.monthsShort(\n mom,\n ''\n ).toLocaleLowerCase();\n this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();\n }\n }\n\n if (strict) {\n if (format === 'MMM') {\n ii = indexOf.call(this._shortMonthsParse, llc);\n return ii !== -1 ? ii : null;\n } else {\n ii = indexOf.call(this._longMonthsParse, llc);\n return ii !== -1 ? ii : null;\n }\n } else {\n if (format === 'MMM') {\n ii = indexOf.call(this._shortMonthsParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._longMonthsParse, llc);\n return ii !== -1 ? ii : null;\n } else {\n ii = indexOf.call(this._longMonthsParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._shortMonthsParse, llc);\n return ii !== -1 ? ii : null;\n }\n }\n }\n\n function localeMonthsParse(monthName, format, strict) {\n var i, mom, regex;\n\n if (this._monthsParseExact) {\n return handleStrictParse.call(this, monthName, format, strict);\n }\n\n if (!this._monthsParse) {\n this._monthsParse = [];\n this._longMonthsParse = [];\n this._shortMonthsParse = [];\n }\n\n // TODO: add sorting\n // Sorting makes sure if one month (or abbr) is a prefix of another\n // see sorting in computeMonthsParse\n for (i = 0; i < 12; i++) {\n // make the regex if we don't have it already\n mom = createUTC([2000, i]);\n if (strict && !this._longMonthsParse[i]) {\n this._longMonthsParse[i] = new RegExp(\n '^' + this.months(mom, '').replace('.', '') + '$',\n 'i'\n );\n this._shortMonthsParse[i] = new RegExp(\n '^' + this.monthsShort(mom, '').replace('.', '') + '$',\n 'i'\n );\n }\n if (!strict && !this._monthsParse[i]) {\n regex =\n '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');\n this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');\n }\n // test the regex\n if (\n strict &&\n format === 'MMMM' &&\n this._longMonthsParse[i].test(monthName)\n ) {\n return i;\n } else if (\n strict &&\n format === 'MMM' &&\n this._shortMonthsParse[i].test(monthName)\n ) {\n return i;\n } else if (!strict && this._monthsParse[i].test(monthName)) {\n return i;\n }\n }\n }\n\n // MOMENTS\n\n function setMonth(mom, value) {\n var dayOfMonth;\n\n if (!mom.isValid()) {\n // No op\n return mom;\n }\n\n if (typeof value === 'string') {\n if (/^\\d+$/.test(value)) {\n value = toInt(value);\n } else {\n value = mom.localeData().monthsParse(value);\n // TODO: Another silent failure?\n if (!isNumber(value)) {\n return mom;\n }\n }\n }\n\n dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));\n mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);\n return mom;\n }\n\n function getSetMonth(value) {\n if (value != null) {\n setMonth(this, value);\n hooks.updateOffset(this, true);\n return this;\n } else {\n return get(this, 'Month');\n }\n }\n\n function getDaysInMonth() {\n return daysInMonth(this.year(), this.month());\n }\n\n function monthsShortRegex(isStrict) {\n if (this._monthsParseExact) {\n if (!hasOwnProp(this, '_monthsRegex')) {\n computeMonthsParse.call(this);\n }\n if (isStrict) {\n return this._monthsShortStrictRegex;\n } else {\n return this._monthsShortRegex;\n }\n } else {\n if (!hasOwnProp(this, '_monthsShortRegex')) {\n this._monthsShortRegex = defaultMonthsShortRegex;\n }\n return this._monthsShortStrictRegex && isStrict\n ? this._monthsShortStrictRegex\n : this._monthsShortRegex;\n }\n }\n\n function monthsRegex(isStrict) {\n if (this._monthsParseExact) {\n if (!hasOwnProp(this, '_monthsRegex')) {\n computeMonthsParse.call(this);\n }\n if (isStrict) {\n return this._monthsStrictRegex;\n } else {\n return this._monthsRegex;\n }\n } else {\n if (!hasOwnProp(this, '_monthsRegex')) {\n this._monthsRegex = defaultMonthsRegex;\n }\n return this._monthsStrictRegex && isStrict\n ? this._monthsStrictRegex\n : this._monthsRegex;\n }\n }\n\n function computeMonthsParse() {\n function cmpLenRev(a, b) {\n return b.length - a.length;\n }\n\n var shortPieces = [],\n longPieces = [],\n mixedPieces = [],\n i,\n mom;\n for (i = 0; i < 12; i++) {\n // make the regex if we don't have it already\n mom = createUTC([2000, i]);\n shortPieces.push(this.monthsShort(mom, ''));\n longPieces.push(this.months(mom, ''));\n mixedPieces.push(this.months(mom, ''));\n mixedPieces.push(this.monthsShort(mom, ''));\n }\n // Sorting makes sure if one month (or abbr) is a prefix of another it\n // will match the longer piece.\n shortPieces.sort(cmpLenRev);\n longPieces.sort(cmpLenRev);\n mixedPieces.sort(cmpLenRev);\n for (i = 0; i < 12; i++) {\n shortPieces[i] = regexEscape(shortPieces[i]);\n longPieces[i] = regexEscape(longPieces[i]);\n }\n for (i = 0; i < 24; i++) {\n mixedPieces[i] = regexEscape(mixedPieces[i]);\n }\n\n this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');\n this._monthsShortRegex = this._monthsRegex;\n this._monthsStrictRegex = new RegExp(\n '^(' + longPieces.join('|') + ')',\n 'i'\n );\n this._monthsShortStrictRegex = new RegExp(\n '^(' + shortPieces.join('|') + ')',\n 'i'\n );\n }\n\n // FORMATTING\n\n addFormatToken('Y', 0, 0, function () {\n var y = this.year();\n return y <= 9999 ? zeroFill(y, 4) : '+' + y;\n });\n\n addFormatToken(0, ['YY', 2], 0, function () {\n return this.year() % 100;\n });\n\n addFormatToken(0, ['YYYY', 4], 0, 'year');\n addFormatToken(0, ['YYYYY', 5], 0, 'year');\n addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');\n\n // ALIASES\n\n addUnitAlias('year', 'y');\n\n // PRIORITIES\n\n addUnitPriority('year', 1);\n\n // PARSING\n\n addRegexToken('Y', matchSigned);\n addRegexToken('YY', match1to2, match2);\n addRegexToken('YYYY', match1to4, match4);\n addRegexToken('YYYYY', match1to6, match6);\n addRegexToken('YYYYYY', match1to6, match6);\n\n addParseToken(['YYYYY', 'YYYYYY'], YEAR);\n addParseToken('YYYY', function (input, array) {\n array[YEAR] =\n input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);\n });\n addParseToken('YY', function (input, array) {\n array[YEAR] = hooks.parseTwoDigitYear(input);\n });\n addParseToken('Y', function (input, array) {\n array[YEAR] = parseInt(input, 10);\n });\n\n // HELPERS\n\n function daysInYear(year) {\n return isLeapYear(year) ? 366 : 365;\n }\n\n // HOOKS\n\n hooks.parseTwoDigitYear = function (input) {\n return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);\n };\n\n // MOMENTS\n\n var getSetYear = makeGetSet('FullYear', true);\n\n function getIsLeapYear() {\n return isLeapYear(this.year());\n }\n\n function createDate(y, m, d, h, M, s, ms) {\n // can't just apply() to create a date:\n // https://stackoverflow.com/q/181348\n var date;\n // the date constructor remaps years 0-99 to 1900-1999\n if (y < 100 && y >= 0) {\n // preserve leap years using a full 400 year cycle, then reset\n date = new Date(y + 400, m, d, h, M, s, ms);\n if (isFinite(date.getFullYear())) {\n date.setFullYear(y);\n }\n } else {\n date = new Date(y, m, d, h, M, s, ms);\n }\n\n return date;\n }\n\n function createUTCDate(y) {\n var date, args;\n // the Date.UTC function remaps years 0-99 to 1900-1999\n if (y < 100 && y >= 0) {\n args = Array.prototype.slice.call(arguments);\n // preserve leap years using a full 400 year cycle, then reset\n args[0] = y + 400;\n date = new Date(Date.UTC.apply(null, args));\n if (isFinite(date.getUTCFullYear())) {\n date.setUTCFullYear(y);\n }\n } else {\n date = new Date(Date.UTC.apply(null, arguments));\n }\n\n return date;\n }\n\n // start-of-first-week - start-of-year\n function firstWeekOffset(year, dow, doy) {\n var // first-week day -- which january is always in the first week (4 for iso, 1 for other)\n fwd = 7 + dow - doy,\n // first-week day local weekday -- which local weekday is fwd\n fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;\n\n return -fwdlw + fwd - 1;\n }\n\n // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday\n function dayOfYearFromWeeks(year, week, weekday, dow, doy) {\n var localWeekday = (7 + weekday - dow) % 7,\n weekOffset = firstWeekOffset(year, dow, doy),\n dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,\n resYear,\n resDayOfYear;\n\n if (dayOfYear <= 0) {\n resYear = year - 1;\n resDayOfYear = daysInYear(resYear) + dayOfYear;\n } else if (dayOfYear > daysInYear(year)) {\n resYear = year + 1;\n resDayOfYear = dayOfYear - daysInYear(year);\n } else {\n resYear = year;\n resDayOfYear = dayOfYear;\n }\n\n return {\n year: resYear,\n dayOfYear: resDayOfYear,\n };\n }\n\n function weekOfYear(mom, dow, doy) {\n var weekOffset = firstWeekOffset(mom.year(), dow, doy),\n week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,\n resWeek,\n resYear;\n\n if (week < 1) {\n resYear = mom.year() - 1;\n resWeek = week + weeksInYear(resYear, dow, doy);\n } else if (week > weeksInYear(mom.year(), dow, doy)) {\n resWeek = week - weeksInYear(mom.year(), dow, doy);\n resYear = mom.year() + 1;\n } else {\n resYear = mom.year();\n resWeek = week;\n }\n\n return {\n week: resWeek,\n year: resYear,\n };\n }\n\n function weeksInYear(year, dow, doy) {\n var weekOffset = firstWeekOffset(year, dow, doy),\n weekOffsetNext = firstWeekOffset(year + 1, dow, doy);\n return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;\n }\n\n // FORMATTING\n\n addFormatToken('w', ['ww', 2], 'wo', 'week');\n addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');\n\n // ALIASES\n\n addUnitAlias('week', 'w');\n addUnitAlias('isoWeek', 'W');\n\n // PRIORITIES\n\n addUnitPriority('week', 5);\n addUnitPriority('isoWeek', 5);\n\n // PARSING\n\n addRegexToken('w', match1to2);\n addRegexToken('ww', match1to2, match2);\n addRegexToken('W', match1to2);\n addRegexToken('WW', match1to2, match2);\n\n addWeekParseToken(['w', 'ww', 'W', 'WW'], function (\n input,\n week,\n config,\n token\n ) {\n week[token.substr(0, 1)] = toInt(input);\n });\n\n // HELPERS\n\n // LOCALES\n\n function localeWeek(mom) {\n return weekOfYear(mom, this._week.dow, this._week.doy).week;\n }\n\n var defaultLocaleWeek = {\n dow: 0, // Sunday is the first day of the week.\n doy: 6, // The week that contains Jan 6th is the first week of the year.\n };\n\n function localeFirstDayOfWeek() {\n return this._week.dow;\n }\n\n function localeFirstDayOfYear() {\n return this._week.doy;\n }\n\n // MOMENTS\n\n function getSetWeek(input) {\n var week = this.localeData().week(this);\n return input == null ? week : this.add((input - week) * 7, 'd');\n }\n\n function getSetISOWeek(input) {\n var week = weekOfYear(this, 1, 4).week;\n return input == null ? week : this.add((input - week) * 7, 'd');\n }\n\n // FORMATTING\n\n addFormatToken('d', 0, 'do', 'day');\n\n addFormatToken('dd', 0, 0, function (format) {\n return this.localeData().weekdaysMin(this, format);\n });\n\n addFormatToken('ddd', 0, 0, function (format) {\n return this.localeData().weekdaysShort(this, format);\n });\n\n addFormatToken('dddd', 0, 0, function (format) {\n return this.localeData().weekdays(this, format);\n });\n\n addFormatToken('e', 0, 0, 'weekday');\n addFormatToken('E', 0, 0, 'isoWeekday');\n\n // ALIASES\n\n addUnitAlias('day', 'd');\n addUnitAlias('weekday', 'e');\n addUnitAlias('isoWeekday', 'E');\n\n // PRIORITY\n addUnitPriority('day', 11);\n addUnitPriority('weekday', 11);\n addUnitPriority('isoWeekday', 11);\n\n // PARSING\n\n addRegexToken('d', match1to2);\n addRegexToken('e', match1to2);\n addRegexToken('E', match1to2);\n addRegexToken('dd', function (isStrict, locale) {\n return locale.weekdaysMinRegex(isStrict);\n });\n addRegexToken('ddd', function (isStrict, locale) {\n return locale.weekdaysShortRegex(isStrict);\n });\n addRegexToken('dddd', function (isStrict, locale) {\n return locale.weekdaysRegex(isStrict);\n });\n\n addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {\n var weekday = config._locale.weekdaysParse(input, token, config._strict);\n // if we didn't get a weekday name, mark the date as invalid\n if (weekday != null) {\n week.d = weekday;\n } else {\n getParsingFlags(config).invalidWeekday = input;\n }\n });\n\n addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {\n week[token] = toInt(input);\n });\n\n // HELPERS\n\n function parseWeekday(input, locale) {\n if (typeof input !== 'string') {\n return input;\n }\n\n if (!isNaN(input)) {\n return parseInt(input, 10);\n }\n\n input = locale.weekdaysParse(input);\n if (typeof input === 'number') {\n return input;\n }\n\n return null;\n }\n\n function parseIsoWeekday(input, locale) {\n if (typeof input === 'string') {\n return locale.weekdaysParse(input) % 7 || 7;\n }\n return isNaN(input) ? null : input;\n }\n\n // LOCALES\n function shiftWeekdays(ws, n) {\n return ws.slice(n, 7).concat(ws.slice(0, n));\n }\n\n var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split(\n '_'\n ),\n defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),\n defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),\n defaultWeekdaysRegex = matchWord,\n defaultWeekdaysShortRegex = matchWord,\n defaultWeekdaysMinRegex = matchWord;\n\n function localeWeekdays(m, format) {\n var weekdays = isArray(this._weekdays)\n ? this._weekdays\n : this._weekdays[\n m && m !== true && this._weekdays.isFormat.test(format)\n ? 'format'\n : 'standalone'\n ];\n return m === true\n ? shiftWeekdays(weekdays, this._week.dow)\n : m\n ? weekdays[m.day()]\n : weekdays;\n }\n\n function localeWeekdaysShort(m) {\n return m === true\n ? shiftWeekdays(this._weekdaysShort, this._week.dow)\n : m\n ? this._weekdaysShort[m.day()]\n : this._weekdaysShort;\n }\n\n function localeWeekdaysMin(m) {\n return m === true\n ? shiftWeekdays(this._weekdaysMin, this._week.dow)\n : m\n ? this._weekdaysMin[m.day()]\n : this._weekdaysMin;\n }\n\n function handleStrictParse$1(weekdayName, format, strict) {\n var i,\n ii,\n mom,\n llc = weekdayName.toLocaleLowerCase();\n if (!this._weekdaysParse) {\n this._weekdaysParse = [];\n this._shortWeekdaysParse = [];\n this._minWeekdaysParse = [];\n\n for (i = 0; i < 7; ++i) {\n mom = createUTC([2000, 1]).day(i);\n this._minWeekdaysParse[i] = this.weekdaysMin(\n mom,\n ''\n ).toLocaleLowerCase();\n this._shortWeekdaysParse[i] = this.weekdaysShort(\n mom,\n ''\n ).toLocaleLowerCase();\n this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();\n }\n }\n\n if (strict) {\n if (format === 'dddd') {\n ii = indexOf.call(this._weekdaysParse, llc);\n return ii !== -1 ? ii : null;\n } else if (format === 'ddd') {\n ii = indexOf.call(this._shortWeekdaysParse, llc);\n return ii !== -1 ? ii : null;\n } else {\n ii = indexOf.call(this._minWeekdaysParse, llc);\n return ii !== -1 ? ii : null;\n }\n } else {\n if (format === 'dddd') {\n ii = indexOf.call(this._weekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._shortWeekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._minWeekdaysParse, llc);\n return ii !== -1 ? ii : null;\n } else if (format === 'ddd') {\n ii = indexOf.call(this._shortWeekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._weekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._minWeekdaysParse, llc);\n return ii !== -1 ? ii : null;\n } else {\n ii = indexOf.call(this._minWeekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._weekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._shortWeekdaysParse, llc);\n return ii !== -1 ? ii : null;\n }\n }\n }\n\n function localeWeekdaysParse(weekdayName, format, strict) {\n var i, mom, regex;\n\n if (this._weekdaysParseExact) {\n return handleStrictParse$1.call(this, weekdayName, format, strict);\n }\n\n if (!this._weekdaysParse) {\n this._weekdaysParse = [];\n this._minWeekdaysParse = [];\n this._shortWeekdaysParse = [];\n this._fullWeekdaysParse = [];\n }\n\n for (i = 0; i < 7; i++) {\n // make the regex if we don't have it already\n\n mom = createUTC([2000, 1]).day(i);\n if (strict && !this._fullWeekdaysParse[i]) {\n this._fullWeekdaysParse[i] = new RegExp(\n '^' + this.weekdays(mom, '').replace('.', '\\\\.?') + '$',\n 'i'\n );\n this._shortWeekdaysParse[i] = new RegExp(\n '^' + this.weekdaysShort(mom, '').replace('.', '\\\\.?') + '$',\n 'i'\n );\n this._minWeekdaysParse[i] = new RegExp(\n '^' + this.weekdaysMin(mom, '').replace('.', '\\\\.?') + '$',\n 'i'\n );\n }\n if (!this._weekdaysParse[i]) {\n regex =\n '^' +\n this.weekdays(mom, '') +\n '|^' +\n this.weekdaysShort(mom, '') +\n '|^' +\n this.weekdaysMin(mom, '');\n this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');\n }\n // test the regex\n if (\n strict &&\n format === 'dddd' &&\n this._fullWeekdaysParse[i].test(weekdayName)\n ) {\n return i;\n } else if (\n strict &&\n format === 'ddd' &&\n this._shortWeekdaysParse[i].test(weekdayName)\n ) {\n return i;\n } else if (\n strict &&\n format === 'dd' &&\n this._minWeekdaysParse[i].test(weekdayName)\n ) {\n return i;\n } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {\n return i;\n }\n }\n }\n\n // MOMENTS\n\n function getSetDayOfWeek(input) {\n if (!this.isValid()) {\n return input != null ? this : NaN;\n }\n var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();\n if (input != null) {\n input = parseWeekday(input, this.localeData());\n return this.add(input - day, 'd');\n } else {\n return day;\n }\n }\n\n function getSetLocaleDayOfWeek(input) {\n if (!this.isValid()) {\n return input != null ? this : NaN;\n }\n var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;\n return input == null ? weekday : this.add(input - weekday, 'd');\n }\n\n function getSetISODayOfWeek(input) {\n if (!this.isValid()) {\n return input != null ? this : NaN;\n }\n\n // behaves the same as moment#day except\n // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)\n // as a setter, sunday should belong to the previous week.\n\n if (input != null) {\n var weekday = parseIsoWeekday(input, this.localeData());\n return this.day(this.day() % 7 ? weekday : weekday - 7);\n } else {\n return this.day() || 7;\n }\n }\n\n function weekdaysRegex(isStrict) {\n if (this._weekdaysParseExact) {\n if (!hasOwnProp(this, '_weekdaysRegex')) {\n computeWeekdaysParse.call(this);\n }\n if (isStrict) {\n return this._weekdaysStrictRegex;\n } else {\n return this._weekdaysRegex;\n }\n } else {\n if (!hasOwnProp(this, '_weekdaysRegex')) {\n this._weekdaysRegex = defaultWeekdaysRegex;\n }\n return this._weekdaysStrictRegex && isStrict\n ? this._weekdaysStrictRegex\n : this._weekdaysRegex;\n }\n }\n\n function weekdaysShortRegex(isStrict) {\n if (this._weekdaysParseExact) {\n if (!hasOwnProp(this, '_weekdaysRegex')) {\n computeWeekdaysParse.call(this);\n }\n if (isStrict) {\n return this._weekdaysShortStrictRegex;\n } else {\n return this._weekdaysShortRegex;\n }\n } else {\n if (!hasOwnProp(this, '_weekdaysShortRegex')) {\n this._weekdaysShortRegex = defaultWeekdaysShortRegex;\n }\n return this._weekdaysShortStrictRegex && isStrict\n ? this._weekdaysShortStrictRegex\n : this._weekdaysShortRegex;\n }\n }\n\n function weekdaysMinRegex(isStrict) {\n if (this._weekdaysParseExact) {\n if (!hasOwnProp(this, '_weekdaysRegex')) {\n computeWeekdaysParse.call(this);\n }\n if (isStrict) {\n return this._weekdaysMinStrictRegex;\n } else {\n return this._weekdaysMinRegex;\n }\n } else {\n if (!hasOwnProp(this, '_weekdaysMinRegex')) {\n this._weekdaysMinRegex = defaultWeekdaysMinRegex;\n }\n return this._weekdaysMinStrictRegex && isStrict\n ? this._weekdaysMinStrictRegex\n : this._weekdaysMinRegex;\n }\n }\n\n function computeWeekdaysParse() {\n function cmpLenRev(a, b) {\n return b.length - a.length;\n }\n\n var minPieces = [],\n shortPieces = [],\n longPieces = [],\n mixedPieces = [],\n i,\n mom,\n minp,\n shortp,\n longp;\n for (i = 0; i < 7; i++) {\n // make the regex if we don't have it already\n mom = createUTC([2000, 1]).day(i);\n minp = regexEscape(this.weekdaysMin(mom, ''));\n shortp = regexEscape(this.weekdaysShort(mom, ''));\n longp = regexEscape(this.weekdays(mom, ''));\n minPieces.push(minp);\n shortPieces.push(shortp);\n longPieces.push(longp);\n mixedPieces.push(minp);\n mixedPieces.push(shortp);\n mixedPieces.push(longp);\n }\n // Sorting makes sure if one weekday (or abbr) is a prefix of another it\n // will match the longer piece.\n minPieces.sort(cmpLenRev);\n shortPieces.sort(cmpLenRev);\n longPieces.sort(cmpLenRev);\n mixedPieces.sort(cmpLenRev);\n\n this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');\n this._weekdaysShortRegex = this._weekdaysRegex;\n this._weekdaysMinRegex = this._weekdaysRegex;\n\n this._weekdaysStrictRegex = new RegExp(\n '^(' + longPieces.join('|') + ')',\n 'i'\n );\n this._weekdaysShortStrictRegex = new RegExp(\n '^(' + shortPieces.join('|') + ')',\n 'i'\n );\n this._weekdaysMinStrictRegex = new RegExp(\n '^(' + minPieces.join('|') + ')',\n 'i'\n );\n }\n\n // FORMATTING\n\n function hFormat() {\n return this.hours() % 12 || 12;\n }\n\n function kFormat() {\n return this.hours() || 24;\n }\n\n addFormatToken('H', ['HH', 2], 0, 'hour');\n addFormatToken('h', ['hh', 2], 0, hFormat);\n addFormatToken('k', ['kk', 2], 0, kFormat);\n\n addFormatToken('hmm', 0, 0, function () {\n return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);\n });\n\n addFormatToken('hmmss', 0, 0, function () {\n return (\n '' +\n hFormat.apply(this) +\n zeroFill(this.minutes(), 2) +\n zeroFill(this.seconds(), 2)\n );\n });\n\n addFormatToken('Hmm', 0, 0, function () {\n return '' + this.hours() + zeroFill(this.minutes(), 2);\n });\n\n addFormatToken('Hmmss', 0, 0, function () {\n return (\n '' +\n this.hours() +\n zeroFill(this.minutes(), 2) +\n zeroFill(this.seconds(), 2)\n );\n });\n\n function meridiem(token, lowercase) {\n addFormatToken(token, 0, 0, function () {\n return this.localeData().meridiem(\n this.hours(),\n this.minutes(),\n lowercase\n );\n });\n }\n\n meridiem('a', true);\n meridiem('A', false);\n\n // ALIASES\n\n addUnitAlias('hour', 'h');\n\n // PRIORITY\n addUnitPriority('hour', 13);\n\n // PARSING\n\n function matchMeridiem(isStrict, locale) {\n return locale._meridiemParse;\n }\n\n addRegexToken('a', matchMeridiem);\n addRegexToken('A', matchMeridiem);\n addRegexToken('H', match1to2);\n addRegexToken('h', match1to2);\n addRegexToken('k', match1to2);\n addRegexToken('HH', match1to2, match2);\n addRegexToken('hh', match1to2, match2);\n addRegexToken('kk', match1to2, match2);\n\n addRegexToken('hmm', match3to4);\n addRegexToken('hmmss', match5to6);\n addRegexToken('Hmm', match3to4);\n addRegexToken('Hmmss', match5to6);\n\n addParseToken(['H', 'HH'], HOUR);\n addParseToken(['k', 'kk'], function (input, array, config) {\n var kInput = toInt(input);\n array[HOUR] = kInput === 24 ? 0 : kInput;\n });\n addParseToken(['a', 'A'], function (input, array, config) {\n config._isPm = config._locale.isPM(input);\n config._meridiem = input;\n });\n addParseToken(['h', 'hh'], function (input, array, config) {\n array[HOUR] = toInt(input);\n getParsingFlags(config).bigHour = true;\n });\n addParseToken('hmm', function (input, array, config) {\n var pos = input.length - 2;\n array[HOUR] = toInt(input.substr(0, pos));\n array[MINUTE] = toInt(input.substr(pos));\n getParsingFlags(config).bigHour = true;\n });\n addParseToken('hmmss', function (input, array, config) {\n var pos1 = input.length - 4,\n pos2 = input.length - 2;\n array[HOUR] = toInt(input.substr(0, pos1));\n array[MINUTE] = toInt(input.substr(pos1, 2));\n array[SECOND] = toInt(input.substr(pos2));\n getParsingFlags(config).bigHour = true;\n });\n addParseToken('Hmm', function (input, array, config) {\n var pos = input.length - 2;\n array[HOUR] = toInt(input.substr(0, pos));\n array[MINUTE] = toInt(input.substr(pos));\n });\n addParseToken('Hmmss', function (input, array, config) {\n var pos1 = input.length - 4,\n pos2 = input.length - 2;\n array[HOUR] = toInt(input.substr(0, pos1));\n array[MINUTE] = toInt(input.substr(pos1, 2));\n array[SECOND] = toInt(input.substr(pos2));\n });\n\n // LOCALES\n\n function localeIsPM(input) {\n // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays\n // Using charAt should be more compatible.\n return (input + '').toLowerCase().charAt(0) === 'p';\n }\n\n var defaultLocaleMeridiemParse = /[ap]\\.?m?\\.?/i,\n // Setting the hour should keep the time, because the user explicitly\n // specified which hour they want. So trying to maintain the same hour (in\n // a new timezone) makes sense. Adding/subtracting hours does not follow\n // this rule.\n getSetHour = makeGetSet('Hours', true);\n\n function localeMeridiem(hours, minutes, isLower) {\n if (hours > 11) {\n return isLower ? 'pm' : 'PM';\n } else {\n return isLower ? 'am' : 'AM';\n }\n }\n\n var baseConfig = {\n calendar: defaultCalendar,\n longDateFormat: defaultLongDateFormat,\n invalidDate: defaultInvalidDate,\n ordinal: defaultOrdinal,\n dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,\n relativeTime: defaultRelativeTime,\n\n months: defaultLocaleMonths,\n monthsShort: defaultLocaleMonthsShort,\n\n week: defaultLocaleWeek,\n\n weekdays: defaultLocaleWeekdays,\n weekdaysMin: defaultLocaleWeekdaysMin,\n weekdaysShort: defaultLocaleWeekdaysShort,\n\n meridiemParse: defaultLocaleMeridiemParse,\n };\n\n // internal storage for locale config files\n var locales = {},\n localeFamilies = {},\n globalLocale;\n\n function commonPrefix(arr1, arr2) {\n var i,\n minl = Math.min(arr1.length, arr2.length);\n for (i = 0; i < minl; i += 1) {\n if (arr1[i] !== arr2[i]) {\n return i;\n }\n }\n return minl;\n }\n\n function normalizeLocale(key) {\n return key ? key.toLowerCase().replace('_', '-') : key;\n }\n\n // pick the locale from the array\n // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each\n // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root\n function chooseLocale(names) {\n var i = 0,\n j,\n next,\n locale,\n split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (\n next &&\n next.length >= j &&\n commonPrefix(split, next) >= j - 1\n ) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return globalLocale;\n }\n\n function loadLocale(name) {\n var oldLocale = null,\n aliasedRequire;\n // TODO: Find a better way to register and load all the locales in Node\n if (\n locales[name] === undefined &&\n typeof module !== 'undefined' &&\n module &&\n module.exports\n ) {\n try {\n oldLocale = globalLocale._abbr;\n aliasedRequire = require;\n aliasedRequire('./locale/' + name);\n getSetGlobalLocale(oldLocale);\n } catch (e) {\n // mark as not found to avoid repeating expensive file require call causing high CPU\n // when trying to find en-US, en_US, en-us for every format call\n locales[name] = null; // null means not found\n }\n }\n return locales[name];\n }\n\n // This function will load locale and then set the global locale. If\n // no arguments are passed in, it will simply return the current global\n // locale key.\n function getSetGlobalLocale(key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n } else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n } else {\n if (typeof console !== 'undefined' && console.warn) {\n //warn user if arguments are passed but the locale could not be set\n console.warn(\n 'Locale ' + key + ' not found. Did you forget to load it?'\n );\n }\n }\n }\n\n return globalLocale._abbr;\n }\n\n function defineLocale(name, config) {\n if (config !== null) {\n var locale,\n parentConfig = baseConfig;\n config.abbr = name;\n if (locales[name] != null) {\n deprecateSimple(\n 'defineLocaleOverride',\n 'use moment.updateLocale(localeName, config) to change ' +\n 'an existing locale. moment.defineLocale(localeName, ' +\n 'config) should only be used for creating a new locale ' +\n 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'\n );\n parentConfig = locales[name]._config;\n } else if (config.parentLocale != null) {\n if (locales[config.parentLocale] != null) {\n parentConfig = locales[config.parentLocale]._config;\n } else {\n locale = loadLocale(config.parentLocale);\n if (locale != null) {\n parentConfig = locale._config;\n } else {\n if (!localeFamilies[config.parentLocale]) {\n localeFamilies[config.parentLocale] = [];\n }\n localeFamilies[config.parentLocale].push({\n name: name,\n config: config,\n });\n return null;\n }\n }\n }\n locales[name] = new Locale(mergeConfigs(parentConfig, config));\n\n if (localeFamilies[name]) {\n localeFamilies[name].forEach(function (x) {\n defineLocale(x.name, x.config);\n });\n }\n\n // backwards compat for now: also set the locale\n // make sure we set the locale AFTER all child locales have been\n // created, so we won't end up with the child locale set.\n getSetGlobalLocale(name);\n\n return locales[name];\n } else {\n // useful for testing\n delete locales[name];\n return null;\n }\n }\n\n function updateLocale(name, config) {\n if (config != null) {\n var locale,\n tmpLocale,\n parentConfig = baseConfig;\n\n if (locales[name] != null && locales[name].parentLocale != null) {\n // Update existing child locale in-place to avoid memory-leaks\n locales[name].set(mergeConfigs(locales[name]._config, config));\n } else {\n // MERGE\n tmpLocale = loadLocale(name);\n if (tmpLocale != null) {\n parentConfig = tmpLocale._config;\n }\n config = mergeConfigs(parentConfig, config);\n if (tmpLocale == null) {\n // updateLocale is called for creating a new locale\n // Set abbr so it will have a name (getters return\n // undefined otherwise).\n config.abbr = name;\n }\n locale = new Locale(config);\n locale.parentLocale = locales[name];\n locales[name] = locale;\n }\n\n // backwards compat for now: also set the locale\n getSetGlobalLocale(name);\n } else {\n // pass null for config to unupdate, useful for tests\n if (locales[name] != null) {\n if (locales[name].parentLocale != null) {\n locales[name] = locales[name].parentLocale;\n if (name === getSetGlobalLocale()) {\n getSetGlobalLocale(name);\n }\n } else if (locales[name] != null) {\n delete locales[name];\n }\n }\n }\n return locales[name];\n }\n\n // returns locale data\n function getLocale(key) {\n var locale;\n\n if (key && key._locale && key._locale._abbr) {\n key = key._locale._abbr;\n }\n\n if (!key) {\n return globalLocale;\n }\n\n if (!isArray(key)) {\n //short-circuit everything else\n locale = loadLocale(key);\n if (locale) {\n return locale;\n }\n key = [key];\n }\n\n return chooseLocale(key);\n }\n\n function listLocales() {\n return keys(locales);\n }\n\n function checkOverflow(m) {\n var overflow,\n a = m._a;\n\n if (a && getParsingFlags(m).overflow === -2) {\n overflow =\n a[MONTH] < 0 || a[MONTH] > 11\n ? MONTH\n : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH])\n ? DATE\n : a[HOUR] < 0 ||\n a[HOUR] > 24 ||\n (a[HOUR] === 24 &&\n (a[MINUTE] !== 0 ||\n a[SECOND] !== 0 ||\n a[MILLISECOND] !== 0))\n ? HOUR\n : a[MINUTE] < 0 || a[MINUTE] > 59\n ? MINUTE\n : a[SECOND] < 0 || a[SECOND] > 59\n ? SECOND\n : a[MILLISECOND] < 0 || a[MILLISECOND] > 999\n ? MILLISECOND\n : -1;\n\n if (\n getParsingFlags(m)._overflowDayOfYear &&\n (overflow < YEAR || overflow > DATE)\n ) {\n overflow = DATE;\n }\n if (getParsingFlags(m)._overflowWeeks && overflow === -1) {\n overflow = WEEK;\n }\n if (getParsingFlags(m)._overflowWeekday && overflow === -1) {\n overflow = WEEKDAY;\n }\n\n getParsingFlags(m).overflow = overflow;\n }\n\n return m;\n }\n\n // iso 8601 regex\n // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)\n var extendedIsoRegex = /^\\s*((?:[+-]\\d{6}|\\d{4})-(?:\\d\\d-\\d\\d|W\\d\\d-\\d|W\\d\\d|\\d\\d\\d|\\d\\d))(?:(T| )(\\d\\d(?::\\d\\d(?::\\d\\d(?:[.,]\\d+)?)?)?)([+-]\\d\\d(?::?\\d\\d)?|\\s*Z)?)?$/,\n basicIsoRegex = /^\\s*((?:[+-]\\d{6}|\\d{4})(?:\\d\\d\\d\\d|W\\d\\d\\d|W\\d\\d|\\d\\d\\d|\\d\\d|))(?:(T| )(\\d\\d(?:\\d\\d(?:\\d\\d(?:[.,]\\d+)?)?)?)([+-]\\d\\d(?::?\\d\\d)?|\\s*Z)?)?$/,\n tzRegex = /Z|[+-]\\d\\d(?::?\\d\\d)?/,\n isoDates = [\n ['YYYYYY-MM-DD', /[+-]\\d{6}-\\d\\d-\\d\\d/],\n ['YYYY-MM-DD', /\\d{4}-\\d\\d-\\d\\d/],\n ['GGGG-[W]WW-E', /\\d{4}-W\\d\\d-\\d/],\n ['GGGG-[W]WW', /\\d{4}-W\\d\\d/, false],\n ['YYYY-DDD', /\\d{4}-\\d{3}/],\n ['YYYY-MM', /\\d{4}-\\d\\d/, false],\n ['YYYYYYMMDD', /[+-]\\d{10}/],\n ['YYYYMMDD', /\\d{8}/],\n ['GGGG[W]WWE', /\\d{4}W\\d{3}/],\n ['GGGG[W]WW', /\\d{4}W\\d{2}/, false],\n ['YYYYDDD', /\\d{7}/],\n ['YYYYMM', /\\d{6}/, false],\n ['YYYY', /\\d{4}/, false],\n ],\n // iso time formats and regexes\n isoTimes = [\n ['HH:mm:ss.SSSS', /\\d\\d:\\d\\d:\\d\\d\\.\\d+/],\n ['HH:mm:ss,SSSS', /\\d\\d:\\d\\d:\\d\\d,\\d+/],\n ['HH:mm:ss', /\\d\\d:\\d\\d:\\d\\d/],\n ['HH:mm', /\\d\\d:\\d\\d/],\n ['HHmmss.SSSS', /\\d\\d\\d\\d\\d\\d\\.\\d+/],\n ['HHmmss,SSSS', /\\d\\d\\d\\d\\d\\d,\\d+/],\n ['HHmmss', /\\d\\d\\d\\d\\d\\d/],\n ['HHmm', /\\d\\d\\d\\d/],\n ['HH', /\\d\\d/],\n ],\n aspNetJsonRegex = /^\\/?Date\\((-?\\d+)/i,\n // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3\n rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\\s)?(\\d{1,2})\\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\s(\\d{2,4})\\s(\\d\\d):(\\d\\d)(?::(\\d\\d))?\\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\\d{4}))$/,\n obsOffsets = {\n UT: 0,\n GMT: 0,\n EDT: -4 * 60,\n EST: -5 * 60,\n CDT: -5 * 60,\n CST: -6 * 60,\n MDT: -6 * 60,\n MST: -7 * 60,\n PDT: -7 * 60,\n PST: -8 * 60,\n };\n\n // date from iso format\n function configFromISO(config) {\n var i,\n l,\n string = config._i,\n match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),\n allowTime,\n dateFormat,\n timeFormat,\n tzFormat;\n\n if (match) {\n getParsingFlags(config).iso = true;\n\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(match[1])) {\n dateFormat = isoDates[i][0];\n allowTime = isoDates[i][2] !== false;\n break;\n }\n }\n if (dateFormat == null) {\n config._isValid = false;\n return;\n }\n if (match[3]) {\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(match[3])) {\n // match[2] should be 'T' or space\n timeFormat = (match[2] || ' ') + isoTimes[i][0];\n break;\n }\n }\n if (timeFormat == null) {\n config._isValid = false;\n return;\n }\n }\n if (!allowTime && timeFormat != null) {\n config._isValid = false;\n return;\n }\n if (match[4]) {\n if (tzRegex.exec(match[4])) {\n tzFormat = 'Z';\n } else {\n config._isValid = false;\n return;\n }\n }\n config._f = dateFormat + (timeFormat || '') + (tzFormat || '');\n configFromStringAndFormat(config);\n } else {\n config._isValid = false;\n }\n }\n\n function extractFromRFC2822Strings(\n yearStr,\n monthStr,\n dayStr,\n hourStr,\n minuteStr,\n secondStr\n ) {\n var result = [\n untruncateYear(yearStr),\n defaultLocaleMonthsShort.indexOf(monthStr),\n parseInt(dayStr, 10),\n parseInt(hourStr, 10),\n parseInt(minuteStr, 10),\n ];\n\n if (secondStr) {\n result.push(parseInt(secondStr, 10));\n }\n\n return result;\n }\n\n function untruncateYear(yearStr) {\n var year = parseInt(yearStr, 10);\n if (year <= 49) {\n return 2000 + year;\n } else if (year <= 999) {\n return 1900 + year;\n }\n return year;\n }\n\n function preprocessRFC2822(s) {\n // Remove comments and folding whitespace and replace multiple-spaces with a single space\n return s\n .replace(/\\([^)]*\\)|[\\n\\t]/g, ' ')\n .replace(/(\\s\\s+)/g, ' ')\n .replace(/^\\s\\s*/, '')\n .replace(/\\s\\s*$/, '');\n }\n\n function checkWeekday(weekdayStr, parsedInput, config) {\n if (weekdayStr) {\n // TODO: Replace the vanilla JS Date object with an independent day-of-week check.\n var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),\n weekdayActual = new Date(\n parsedInput[0],\n parsedInput[1],\n parsedInput[2]\n ).getDay();\n if (weekdayProvided !== weekdayActual) {\n getParsingFlags(config).weekdayMismatch = true;\n config._isValid = false;\n return false;\n }\n }\n return true;\n }\n\n function calculateOffset(obsOffset, militaryOffset, numOffset) {\n if (obsOffset) {\n return obsOffsets[obsOffset];\n } else if (militaryOffset) {\n // the only allowed military tz is Z\n return 0;\n } else {\n var hm = parseInt(numOffset, 10),\n m = hm % 100,\n h = (hm - m) / 100;\n return h * 60 + m;\n }\n }\n\n // date and time from ref 2822 format\n function configFromRFC2822(config) {\n var match = rfc2822.exec(preprocessRFC2822(config._i)),\n parsedArray;\n if (match) {\n parsedArray = extractFromRFC2822Strings(\n match[4],\n match[3],\n match[2],\n match[5],\n match[6],\n match[7]\n );\n if (!checkWeekday(match[1], parsedArray, config)) {\n return;\n }\n\n config._a = parsedArray;\n config._tzm = calculateOffset(match[8], match[9], match[10]);\n\n config._d = createUTCDate.apply(null, config._a);\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n\n getParsingFlags(config).rfc2822 = true;\n } else {\n config._isValid = false;\n }\n }\n\n // date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict\n function configFromString(config) {\n var matched = aspNetJsonRegex.exec(config._i);\n if (matched !== null) {\n config._d = new Date(+matched[1]);\n return;\n }\n\n configFromISO(config);\n if (config._isValid === false) {\n delete config._isValid;\n } else {\n return;\n }\n\n configFromRFC2822(config);\n if (config._isValid === false) {\n delete config._isValid;\n } else {\n return;\n }\n\n if (config._strict) {\n config._isValid = false;\n } else {\n // Final attempt, use Input Fallback\n hooks.createFromInputFallback(config);\n }\n }\n\n hooks.createFromInputFallback = deprecate(\n 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +\n 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +\n 'discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.',\n function (config) {\n config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));\n }\n );\n\n // Pick the first defined of two or three arguments.\n function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n }\n\n function currentDateArray(config) {\n // hooks is actually the exported moment object\n var nowValue = new Date(hooks.now());\n if (config._useUTC) {\n return [\n nowValue.getUTCFullYear(),\n nowValue.getUTCMonth(),\n nowValue.getUTCDate(),\n ];\n }\n return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];\n }\n\n // convert an array to a date.\n // the array should mirror the parameters below\n // note: all values past the year are optional and will default to the lowest possible value.\n // [year, month, day , hour, minute, second, millisecond]\n function configFromArray(config) {\n var i,\n date,\n input = [],\n currentDate,\n expectedWeekday,\n yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear != null) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (\n config._dayOfYear > daysInYear(yearToUse) ||\n config._dayOfYear === 0\n ) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] =\n config._a[i] == null ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (\n config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0\n ) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(\n null,\n input\n );\n expectedWeekday = config._useUTC\n ? config._d.getUTCDay()\n : config._d.getDay();\n\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n\n // check for mismatching day of week\n if (\n config._w &&\n typeof config._w.d !== 'undefined' &&\n config._w.d !== expectedWeekday\n ) {\n getParsingFlags(config).weekdayMismatch = true;\n }\n }\n\n function dayOfYearFromWeekInfo(config) {\n var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek;\n\n w = config._w;\n if (w.GG != null || w.W != null || w.E != null) {\n dow = 1;\n doy = 4;\n\n // TODO: We need to take the current isoWeekYear, but that depends on\n // how we interpret now (local, utc, fixed offset). So create\n // a now version of current config (take local/utc/offset flags, and\n // create now).\n weekYear = defaults(\n w.GG,\n config._a[YEAR],\n weekOfYear(createLocal(), 1, 4).year\n );\n week = defaults(w.W, 1);\n weekday = defaults(w.E, 1);\n if (weekday < 1 || weekday > 7) {\n weekdayOverflow = true;\n }\n } else {\n dow = config._locale._week.dow;\n doy = config._locale._week.doy;\n\n curWeek = weekOfYear(createLocal(), dow, doy);\n\n weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);\n\n // Default to current week.\n week = defaults(w.w, curWeek.week);\n\n if (w.d != null) {\n // weekday -- low day numbers are considered next week\n weekday = w.d;\n if (weekday < 0 || weekday > 6) {\n weekdayOverflow = true;\n }\n } else if (w.e != null) {\n // local weekday -- counting starts from beginning of week\n weekday = w.e + dow;\n if (w.e < 0 || w.e > 6) {\n weekdayOverflow = true;\n }\n } else {\n // default to beginning of week\n weekday = dow;\n }\n }\n if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {\n getParsingFlags(config)._overflowWeeks = true;\n } else if (weekdayOverflow != null) {\n getParsingFlags(config)._overflowWeekday = true;\n } else {\n temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);\n config._a[YEAR] = temp.year;\n config._dayOfYear = temp.dayOfYear;\n }\n }\n\n // constant that refers to the ISO standard\n hooks.ISO_8601 = function () {};\n\n // constant that refers to the RFC 2822 form\n hooks.RFC_2822 = function () {};\n\n // date from string and format string\n function configFromStringAndFormat(config) {\n // TODO: Move this to another part of the creation flow to prevent circular deps\n if (config._f === hooks.ISO_8601) {\n configFromISO(config);\n return;\n }\n if (config._f === hooks.RFC_2822) {\n configFromRFC2822(config);\n return;\n }\n config._a = [];\n getParsingFlags(config).empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i,\n parsedInput,\n tokens,\n token,\n skipped,\n stringLength = string.length,\n totalParsedInputLength = 0,\n era;\n\n tokens =\n expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) ||\n [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n getParsingFlags(config).unusedInput.push(skipped);\n }\n string = string.slice(\n string.indexOf(parsedInput) + parsedInput.length\n );\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n getParsingFlags(config).empty = false;\n } else {\n getParsingFlags(config).unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n } else if (config._strict && !parsedInput) {\n getParsingFlags(config).unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n getParsingFlags(config).charsLeftOver =\n stringLength - totalParsedInputLength;\n if (string.length > 0) {\n getParsingFlags(config).unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (\n config._a[HOUR] <= 12 &&\n getParsingFlags(config).bigHour === true &&\n config._a[HOUR] > 0\n ) {\n getParsingFlags(config).bigHour = undefined;\n }\n\n getParsingFlags(config).parsedDateParts = config._a.slice(0);\n getParsingFlags(config).meridiem = config._meridiem;\n // handle meridiem\n config._a[HOUR] = meridiemFixWrap(\n config._locale,\n config._a[HOUR],\n config._meridiem\n );\n\n // handle era\n era = getParsingFlags(config).era;\n if (era !== null) {\n config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]);\n }\n\n configFromArray(config);\n checkOverflow(config);\n }\n\n function meridiemFixWrap(locale, hour, meridiem) {\n var isPm;\n\n if (meridiem == null) {\n // nothing to do\n return hour;\n }\n if (locale.meridiemHour != null) {\n return locale.meridiemHour(hour, meridiem);\n } else if (locale.isPM != null) {\n // Fallback\n isPm = locale.isPM(meridiem);\n if (isPm && hour < 12) {\n hour += 12;\n }\n if (!isPm && hour === 12) {\n hour = 0;\n }\n return hour;\n } else {\n // this is not supposed to happen\n return hour;\n }\n }\n\n // date from string and array of format strings\n function configFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n scoreToBeat,\n i,\n currentScore,\n validFormatFound,\n bestFormatIsValid = false;\n\n if (config._f.length === 0) {\n getParsingFlags(config).invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n validFormatFound = false;\n tempConfig = copyConfig({}, config);\n if (config._useUTC != null) {\n tempConfig._useUTC = config._useUTC;\n }\n tempConfig._f = config._f[i];\n configFromStringAndFormat(tempConfig);\n\n if (isValid(tempConfig)) {\n validFormatFound = true;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += getParsingFlags(tempConfig).charsLeftOver;\n\n //or tokens\n currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;\n\n getParsingFlags(tempConfig).score = currentScore;\n\n if (!bestFormatIsValid) {\n if (\n scoreToBeat == null ||\n currentScore < scoreToBeat ||\n validFormatFound\n ) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n if (validFormatFound) {\n bestFormatIsValid = true;\n }\n }\n } else {\n if (currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }\n\n function configFromObject(config) {\n if (config._d) {\n return;\n }\n\n var i = normalizeObjectUnits(config._i),\n dayOrDate = i.day === undefined ? i.date : i.day;\n config._a = map(\n [i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond],\n function (obj) {\n return obj && parseInt(obj, 10);\n }\n );\n\n configFromArray(config);\n }\n\n function createFromConfig(config) {\n var res = new Moment(checkOverflow(prepareConfig(config)));\n if (res._nextDay) {\n // Adding is smart enough around DST\n res.add(1, 'd');\n res._nextDay = undefined;\n }\n\n return res;\n }\n\n function prepareConfig(config) {\n var input = config._i,\n format = config._f;\n\n config._locale = config._locale || getLocale(config._l);\n\n if (input === null || (format === undefined && input === '')) {\n return createInvalid({ nullInput: true });\n }\n\n if (typeof input === 'string') {\n config._i = input = config._locale.preparse(input);\n }\n\n if (isMoment(input)) {\n return new Moment(checkOverflow(input));\n } else if (isDate(input)) {\n config._d = input;\n } else if (isArray(format)) {\n configFromStringAndArray(config);\n } else if (format) {\n configFromStringAndFormat(config);\n } else {\n configFromInput(config);\n }\n\n if (!isValid(config)) {\n config._d = null;\n }\n\n return config;\n }\n\n function configFromInput(config) {\n var input = config._i;\n if (isUndefined(input)) {\n config._d = new Date(hooks.now());\n } else if (isDate(input)) {\n config._d = new Date(input.valueOf());\n } else if (typeof input === 'string') {\n configFromString(config);\n } else if (isArray(input)) {\n config._a = map(input.slice(0), function (obj) {\n return parseInt(obj, 10);\n });\n configFromArray(config);\n } else if (isObject(input)) {\n configFromObject(config);\n } else if (isNumber(input)) {\n // from milliseconds\n config._d = new Date(input);\n } else {\n hooks.createFromInputFallback(config);\n }\n }\n\n function createLocalOrUTC(input, format, locale, strict, isUTC) {\n var c = {};\n\n if (format === true || format === false) {\n strict = format;\n format = undefined;\n }\n\n if (locale === true || locale === false) {\n strict = locale;\n locale = undefined;\n }\n\n if (\n (isObject(input) && isObjectEmpty(input)) ||\n (isArray(input) && input.length === 0)\n ) {\n input = undefined;\n }\n // object construction must be done this way.\n // https://github.com/moment/moment/issues/1423\n c._isAMomentObject = true;\n c._useUTC = c._isUTC = isUTC;\n c._l = locale;\n c._i = input;\n c._f = format;\n c._strict = strict;\n\n return createFromConfig(c);\n }\n\n function createLocal(input, format, locale, strict) {\n return createLocalOrUTC(input, format, locale, strict, false);\n }\n\n var prototypeMin = deprecate(\n 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',\n function () {\n var other = createLocal.apply(null, arguments);\n if (this.isValid() && other.isValid()) {\n return other < this ? this : other;\n } else {\n return createInvalid();\n }\n }\n ),\n prototypeMax = deprecate(\n 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',\n function () {\n var other = createLocal.apply(null, arguments);\n if (this.isValid() && other.isValid()) {\n return other > this ? this : other;\n } else {\n return createInvalid();\n }\n }\n );\n\n // Pick a moment m from moments so that m[fn](other) is true for all\n // other. This relies on the function fn to be transitive.\n //\n // moments should either be an array of moment objects or an array, whose\n // first element is an array of moment objects.\n function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }\n\n // TODO: Use [].sort instead?\n function min() {\n var args = [].slice.call(arguments, 0);\n\n return pickBy('isBefore', args);\n }\n\n function max() {\n var args = [].slice.call(arguments, 0);\n\n return pickBy('isAfter', args);\n }\n\n var now = function () {\n return Date.now ? Date.now() : +new Date();\n };\n\n var ordering = [\n 'year',\n 'quarter',\n 'month',\n 'week',\n 'day',\n 'hour',\n 'minute',\n 'second',\n 'millisecond',\n ];\n\n function isDurationValid(m) {\n var key,\n unitHasDecimal = false,\n i;\n for (key in m) {\n if (\n hasOwnProp(m, key) &&\n !(\n indexOf.call(ordering, key) !== -1 &&\n (m[key] == null || !isNaN(m[key]))\n )\n ) {\n return false;\n }\n }\n\n for (i = 0; i < ordering.length; ++i) {\n if (m[ordering[i]]) {\n if (unitHasDecimal) {\n return false; // only allow non-integers for smallest unit\n }\n if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {\n unitHasDecimal = true;\n }\n }\n }\n\n return true;\n }\n\n function isValid$1() {\n return this._isValid;\n }\n\n function createInvalid$1() {\n return createDuration(NaN);\n }\n\n function Duration(duration) {\n var normalizedInput = normalizeObjectUnits(duration),\n years = normalizedInput.year || 0,\n quarters = normalizedInput.quarter || 0,\n months = normalizedInput.month || 0,\n weeks = normalizedInput.week || normalizedInput.isoWeek || 0,\n days = normalizedInput.day || 0,\n hours = normalizedInput.hour || 0,\n minutes = normalizedInput.minute || 0,\n seconds = normalizedInput.second || 0,\n milliseconds = normalizedInput.millisecond || 0;\n\n this._isValid = isDurationValid(normalizedInput);\n\n // representation for dateAddRemove\n this._milliseconds =\n +milliseconds +\n seconds * 1e3 + // 1000\n minutes * 6e4 + // 1000 * 60\n hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978\n // Because of dateAddRemove treats 24 hours as different from a\n // day when working around DST, we need to store them separately\n this._days = +days + weeks * 7;\n // It is impossible to translate months into days without knowing\n // which months you are are talking about, so we have to store\n // it separately.\n this._months = +months + quarters * 3 + years * 12;\n\n this._data = {};\n\n this._locale = getLocale();\n\n this._bubble();\n }\n\n function isDuration(obj) {\n return obj instanceof Duration;\n }\n\n function absRound(number) {\n if (number < 0) {\n return Math.round(-1 * number) * -1;\n } else {\n return Math.round(number);\n }\n }\n\n // compare two arrays, return the number of differences\n function compareArrays(array1, array2, dontConvert) {\n var len = Math.min(array1.length, array2.length),\n lengthDiff = Math.abs(array1.length - array2.length),\n diffs = 0,\n i;\n for (i = 0; i < len; i++) {\n if (\n (dontConvert && array1[i] !== array2[i]) ||\n (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))\n ) {\n diffs++;\n }\n }\n return diffs + lengthDiff;\n }\n\n // FORMATTING\n\n function offset(token, separator) {\n addFormatToken(token, 0, 0, function () {\n var offset = this.utcOffset(),\n sign = '+';\n if (offset < 0) {\n offset = -offset;\n sign = '-';\n }\n return (\n sign +\n zeroFill(~~(offset / 60), 2) +\n separator +\n zeroFill(~~offset % 60, 2)\n );\n });\n }\n\n offset('Z', ':');\n offset('ZZ', '');\n\n // PARSING\n\n addRegexToken('Z', matchShortOffset);\n addRegexToken('ZZ', matchShortOffset);\n addParseToken(['Z', 'ZZ'], function (input, array, config) {\n config._useUTC = true;\n config._tzm = offsetFromString(matchShortOffset, input);\n });\n\n // HELPERS\n\n // timezone chunker\n // '+10:00' > ['10', '00']\n // '-1530' > ['-15', '30']\n var chunkOffset = /([\\+\\-]|\\d\\d)/gi;\n\n function offsetFromString(matcher, string) {\n var matches = (string || '').match(matcher),\n chunk,\n parts,\n minutes;\n\n if (matches === null) {\n return null;\n }\n\n chunk = matches[matches.length - 1] || [];\n parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];\n minutes = +(parts[1] * 60) + toInt(parts[2]);\n\n return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes;\n }\n\n // Return a moment from input, that is local/utc/zone equivalent to model.\n function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff =\n (isMoment(input) || isDate(input)\n ? input.valueOf()\n : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }\n\n function getDateOffset(m) {\n // On Firefox.24 Date#getTimezoneOffset returns a floating point.\n // https://github.com/moment/moment/pull/1871\n return -Math.round(m._d.getTimezoneOffset());\n }\n\n // HOOKS\n\n // This function will be called whenever a moment is mutated.\n // It is intended to keep the offset in sync with the timezone.\n hooks.updateOffset = function () {};\n\n // MOMENTS\n\n // keepLocalTime = true means only change the timezone, without\n // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->\n // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset\n // +0200, so we adjust the time as needed, to be valid.\n //\n // Keeping the time actually adds/subtracts (one hour)\n // from the actual represented time. That is why we call updateOffset\n // a second time. In case it wants us to change the offset again\n // _changeInProgress == true case, then we have to adjust, because\n // there is no such time in the given timezone.\n function getSetOffset(input, keepLocalTime, keepMinutes) {\n var offset = this._offset || 0,\n localAdjust;\n if (!this.isValid()) {\n return input != null ? this : NaN;\n }\n if (input != null) {\n if (typeof input === 'string') {\n input = offsetFromString(matchShortOffset, input);\n if (input === null) {\n return this;\n }\n } else if (Math.abs(input) < 16 && !keepMinutes) {\n input = input * 60;\n }\n if (!this._isUTC && keepLocalTime) {\n localAdjust = getDateOffset(this);\n }\n this._offset = input;\n this._isUTC = true;\n if (localAdjust != null) {\n this.add(localAdjust, 'm');\n }\n if (offset !== input) {\n if (!keepLocalTime || this._changeInProgress) {\n addSubtract(\n this,\n createDuration(input - offset, 'm'),\n 1,\n false\n );\n } else if (!this._changeInProgress) {\n this._changeInProgress = true;\n hooks.updateOffset(this, true);\n this._changeInProgress = null;\n }\n }\n return this;\n } else {\n return this._isUTC ? offset : getDateOffset(this);\n }\n }\n\n function getSetZone(input, keepLocalTime) {\n if (input != null) {\n if (typeof input !== 'string') {\n input = -input;\n }\n\n this.utcOffset(input, keepLocalTime);\n\n return this;\n } else {\n return -this.utcOffset();\n }\n }\n\n function setOffsetToUTC(keepLocalTime) {\n return this.utcOffset(0, keepLocalTime);\n }\n\n function setOffsetToLocal(keepLocalTime) {\n if (this._isUTC) {\n this.utcOffset(0, keepLocalTime);\n this._isUTC = false;\n\n if (keepLocalTime) {\n this.subtract(getDateOffset(this), 'm');\n }\n }\n return this;\n }\n\n function setOffsetToParsedOffset() {\n if (this._tzm != null) {\n this.utcOffset(this._tzm, false, true);\n } else if (typeof this._i === 'string') {\n var tZone = offsetFromString(matchOffset, this._i);\n if (tZone != null) {\n this.utcOffset(tZone);\n } else {\n this.utcOffset(0, true);\n }\n }\n return this;\n }\n\n function hasAlignedHourOffset(input) {\n if (!this.isValid()) {\n return false;\n }\n input = input ? createLocal(input).utcOffset() : 0;\n\n return (this.utcOffset() - input) % 60 === 0;\n }\n\n function isDaylightSavingTime() {\n return (\n this.utcOffset() > this.clone().month(0).utcOffset() ||\n this.utcOffset() > this.clone().month(5).utcOffset()\n );\n }\n\n function isDaylightSavingTimeShifted() {\n if (!isUndefined(this._isDSTShifted)) {\n return this._isDSTShifted;\n }\n\n var c = {},\n other;\n\n copyConfig(c, this);\n c = prepareConfig(c);\n\n if (c._a) {\n other = c._isUTC ? createUTC(c._a) : createLocal(c._a);\n this._isDSTShifted =\n this.isValid() && compareArrays(c._a, other.toArray()) > 0;\n } else {\n this._isDSTShifted = false;\n }\n\n return this._isDSTShifted;\n }\n\n function isLocal() {\n return this.isValid() ? !this._isUTC : false;\n }\n\n function isUtcOffset() {\n return this.isValid() ? this._isUTC : false;\n }\n\n function isUtc() {\n return this.isValid() ? this._isUTC && this._offset === 0 : false;\n }\n\n // ASP.NET json date format regex\n var aspNetRegex = /^(-|\\+)?(?:(\\d*)[. ])?(\\d+):(\\d+)(?::(\\d+)(\\.\\d*)?)?$/,\n // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html\n // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere\n // and further modified to allow for strings containing both week and day\n isoRegex = /^(-|\\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;\n\n function createDuration(input, key) {\n var duration = input,\n // matching against regexp is expensive, do it on demand\n match = null,\n sign,\n ret,\n diffRes;\n\n if (isDuration(input)) {\n duration = {\n ms: input._milliseconds,\n d: input._days,\n M: input._months,\n };\n } else if (isNumber(input) || !isNaN(+input)) {\n duration = {};\n if (key) {\n duration[key] = +input;\n } else {\n duration.milliseconds = +input;\n }\n } else if ((match = aspNetRegex.exec(input))) {\n sign = match[1] === '-' ? -1 : 1;\n duration = {\n y: 0,\n d: toInt(match[DATE]) * sign,\n h: toInt(match[HOUR]) * sign,\n m: toInt(match[MINUTE]) * sign,\n s: toInt(match[SECOND]) * sign,\n ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign, // the millisecond decimal point is included in the match\n };\n } else if ((match = isoRegex.exec(input))) {\n sign = match[1] === '-' ? -1 : 1;\n duration = {\n y: parseIso(match[2], sign),\n M: parseIso(match[3], sign),\n w: parseIso(match[4], sign),\n d: parseIso(match[5], sign),\n h: parseIso(match[6], sign),\n m: parseIso(match[7], sign),\n s: parseIso(match[8], sign),\n };\n } else if (duration == null) {\n // checks for null or undefined\n duration = {};\n } else if (\n typeof duration === 'object' &&\n ('from' in duration || 'to' in duration)\n ) {\n diffRes = momentsDifference(\n createLocal(duration.from),\n createLocal(duration.to)\n );\n\n duration = {};\n duration.ms = diffRes.milliseconds;\n duration.M = diffRes.months;\n }\n\n ret = new Duration(duration);\n\n if (isDuration(input) && hasOwnProp(input, '_locale')) {\n ret._locale = input._locale;\n }\n\n if (isDuration(input) && hasOwnProp(input, '_isValid')) {\n ret._isValid = input._isValid;\n }\n\n return ret;\n }\n\n createDuration.fn = Duration.prototype;\n createDuration.invalid = createInvalid$1;\n\n function parseIso(inp, sign) {\n // We'd normally use ~~inp for this, but unfortunately it also\n // converts floats to ints.\n // inp may be undefined, so careful calling replace on it.\n var res = inp && parseFloat(inp.replace(',', '.'));\n // apply sign while we're at it\n return (isNaN(res) ? 0 : res) * sign;\n }\n\n function positiveMomentsDifference(base, other) {\n var res = {};\n\n res.months =\n other.month() - base.month() + (other.year() - base.year()) * 12;\n if (base.clone().add(res.months, 'M').isAfter(other)) {\n --res.months;\n }\n\n res.milliseconds = +other - +base.clone().add(res.months, 'M');\n\n return res;\n }\n\n function momentsDifference(base, other) {\n var res;\n if (!(base.isValid() && other.isValid())) {\n return { milliseconds: 0, months: 0 };\n }\n\n other = cloneWithOffset(other, base);\n if (base.isBefore(other)) {\n res = positiveMomentsDifference(base, other);\n } else {\n res = positiveMomentsDifference(other, base);\n res.milliseconds = -res.milliseconds;\n res.months = -res.months;\n }\n\n return res;\n }\n\n // TODO: remove 'name' arg after deprecation is removed\n function createAdder(direction, name) {\n return function (val, period) {\n var dur, tmp;\n //invert the arguments, but complain about it\n if (period !== null && !isNaN(+period)) {\n deprecateSimple(\n name,\n 'moment().' +\n name +\n '(period, number) is deprecated. Please use moment().' +\n name +\n '(number, period). ' +\n 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'\n );\n tmp = val;\n val = period;\n period = tmp;\n }\n\n dur = createDuration(val, period);\n addSubtract(this, dur, direction);\n return this;\n };\n }\n\n function addSubtract(mom, duration, isAdding, updateOffset) {\n var milliseconds = duration._milliseconds,\n days = absRound(duration._days),\n months = absRound(duration._months);\n\n if (!mom.isValid()) {\n // No op\n return;\n }\n\n updateOffset = updateOffset == null ? true : updateOffset;\n\n if (months) {\n setMonth(mom, get(mom, 'Month') + months * isAdding);\n }\n if (days) {\n set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);\n }\n if (milliseconds) {\n mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);\n }\n if (updateOffset) {\n hooks.updateOffset(mom, days || months);\n }\n }\n\n var add = createAdder(1, 'add'),\n subtract = createAdder(-1, 'subtract');\n\n function isString(input) {\n return typeof input === 'string' || input instanceof String;\n }\n\n // type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | void; // null | undefined\n function isMomentInput(input) {\n return (\n isMoment(input) ||\n isDate(input) ||\n isString(input) ||\n isNumber(input) ||\n isNumberOrStringArray(input) ||\n isMomentInputObject(input) ||\n input === null ||\n input === undefined\n );\n }\n\n function isMomentInputObject(input) {\n var objectTest = isObject(input) && !isObjectEmpty(input),\n propertyTest = false,\n properties = [\n 'years',\n 'year',\n 'y',\n 'months',\n 'month',\n 'M',\n 'days',\n 'day',\n 'd',\n 'dates',\n 'date',\n 'D',\n 'hours',\n 'hour',\n 'h',\n 'minutes',\n 'minute',\n 'm',\n 'seconds',\n 'second',\n 's',\n 'milliseconds',\n 'millisecond',\n 'ms',\n ],\n i,\n property;\n\n for (i = 0; i < properties.length; i += 1) {\n property = properties[i];\n propertyTest = propertyTest || hasOwnProp(input, property);\n }\n\n return objectTest && propertyTest;\n }\n\n function isNumberOrStringArray(input) {\n var arrayTest = isArray(input),\n dataTypeTest = false;\n if (arrayTest) {\n dataTypeTest =\n input.filter(function (item) {\n return !isNumber(item) && isString(input);\n }).length === 0;\n }\n return arrayTest && dataTypeTest;\n }\n\n function isCalendarSpec(input) {\n var objectTest = isObject(input) && !isObjectEmpty(input),\n propertyTest = false,\n properties = [\n 'sameDay',\n 'nextDay',\n 'lastDay',\n 'nextWeek',\n 'lastWeek',\n 'sameElse',\n ],\n i,\n property;\n\n for (i = 0; i < properties.length; i += 1) {\n property = properties[i];\n propertyTest = propertyTest || hasOwnProp(input, property);\n }\n\n return objectTest && propertyTest;\n }\n\n function getCalendarFormat(myMoment, now) {\n var diff = myMoment.diff(now, 'days', true);\n return diff < -6\n ? 'sameElse'\n : diff < -1\n ? 'lastWeek'\n : diff < 0\n ? 'lastDay'\n : diff < 1\n ? 'sameDay'\n : diff < 2\n ? 'nextDay'\n : diff < 7\n ? 'nextWeek'\n : 'sameElse';\n }\n\n function calendar$1(time, formats) {\n // Support for single parameter, formats only overload to the calendar function\n if (arguments.length === 1) {\n if (!arguments[0]) {\n time = undefined;\n formats = undefined;\n } else if (isMomentInput(arguments[0])) {\n time = arguments[0];\n formats = undefined;\n } else if (isCalendarSpec(arguments[0])) {\n formats = arguments[0];\n time = undefined;\n }\n }\n // We want to compare the start of today, vs this.\n // Getting start-of-today depends on whether we're local/utc/offset or not.\n var now = time || createLocal(),\n sod = cloneWithOffset(now, this).startOf('day'),\n format = hooks.calendarFormat(this, sod) || 'sameElse',\n output =\n formats &&\n (isFunction(formats[format])\n ? formats[format].call(this, now)\n : formats[format]);\n\n return this.format(\n output || this.localeData().calendar(format, this, createLocal(now))\n );\n }\n\n function clone() {\n return new Moment(this);\n }\n\n function isAfter(input, units) {\n var localInput = isMoment(input) ? input : createLocal(input);\n if (!(this.isValid() && localInput.isValid())) {\n return false;\n }\n units = normalizeUnits(units) || 'millisecond';\n if (units === 'millisecond') {\n return this.valueOf() > localInput.valueOf();\n } else {\n return localInput.valueOf() < this.clone().startOf(units).valueOf();\n }\n }\n\n function isBefore(input, units) {\n var localInput = isMoment(input) ? input : createLocal(input);\n if (!(this.isValid() && localInput.isValid())) {\n return false;\n }\n units = normalizeUnits(units) || 'millisecond';\n if (units === 'millisecond') {\n return this.valueOf() < localInput.valueOf();\n } else {\n return this.clone().endOf(units).valueOf() < localInput.valueOf();\n }\n }\n\n function isBetween(from, to, units, inclusivity) {\n var localFrom = isMoment(from) ? from : createLocal(from),\n localTo = isMoment(to) ? to : createLocal(to);\n if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {\n return false;\n }\n inclusivity = inclusivity || '()';\n return (\n (inclusivity[0] === '('\n ? this.isAfter(localFrom, units)\n : !this.isBefore(localFrom, units)) &&\n (inclusivity[1] === ')'\n ? this.isBefore(localTo, units)\n : !this.isAfter(localTo, units))\n );\n }\n\n function isSame(input, units) {\n var localInput = isMoment(input) ? input : createLocal(input),\n inputMs;\n if (!(this.isValid() && localInput.isValid())) {\n return false;\n }\n units = normalizeUnits(units) || 'millisecond';\n if (units === 'millisecond') {\n return this.valueOf() === localInput.valueOf();\n } else {\n inputMs = localInput.valueOf();\n return (\n this.clone().startOf(units).valueOf() <= inputMs &&\n inputMs <= this.clone().endOf(units).valueOf()\n );\n }\n }\n\n function isSameOrAfter(input, units) {\n return this.isSame(input, units) || this.isAfter(input, units);\n }\n\n function isSameOrBefore(input, units) {\n return this.isSame(input, units) || this.isBefore(input, units);\n }\n\n function diff(input, units, asFloat) {\n var that, zoneDelta, output;\n\n if (!this.isValid()) {\n return NaN;\n }\n\n that = cloneWithOffset(input, this);\n\n if (!that.isValid()) {\n return NaN;\n }\n\n zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;\n\n units = normalizeUnits(units);\n\n switch (units) {\n case 'year':\n output = monthDiff(this, that) / 12;\n break;\n case 'month':\n output = monthDiff(this, that);\n break;\n case 'quarter':\n output = monthDiff(this, that) / 3;\n break;\n case 'second':\n output = (this - that) / 1e3;\n break; // 1000\n case 'minute':\n output = (this - that) / 6e4;\n break; // 1000 * 60\n case 'hour':\n output = (this - that) / 36e5;\n break; // 1000 * 60 * 60\n case 'day':\n output = (this - that - zoneDelta) / 864e5;\n break; // 1000 * 60 * 60 * 24, negate dst\n case 'week':\n output = (this - that - zoneDelta) / 6048e5;\n break; // 1000 * 60 * 60 * 24 * 7, negate dst\n default:\n output = this - that;\n }\n\n return asFloat ? output : absFloor(output);\n }\n\n function monthDiff(a, b) {\n if (a.date() < b.date()) {\n // end-of-month calculations work correct when the start month has more\n // days than the end month.\n return -monthDiff(b, a);\n }\n // difference in months\n var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()),\n // b is in (anchor - 1 month, anchor + 1 month)\n anchor = a.clone().add(wholeMonthDiff, 'months'),\n anchor2,\n adjust;\n\n if (b - anchor < 0) {\n anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');\n // linear across the month\n adjust = (b - anchor) / (anchor - anchor2);\n } else {\n anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');\n // linear across the month\n adjust = (b - anchor) / (anchor2 - anchor);\n }\n\n //check for negative zero, return zero if negative zero\n return -(wholeMonthDiff + adjust) || 0;\n }\n\n hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';\n hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';\n\n function toString() {\n return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');\n }\n\n function toISOString(keepOffset) {\n if (!this.isValid()) {\n return null;\n }\n var utc = keepOffset !== true,\n m = utc ? this.clone().utc() : this;\n if (m.year() < 0 || m.year() > 9999) {\n return formatMoment(\n m,\n utc\n ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'\n : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ'\n );\n }\n if (isFunction(Date.prototype.toISOString)) {\n // native implementation is ~50x faster, use it when we can\n if (utc) {\n return this.toDate().toISOString();\n } else {\n return new Date(this.valueOf() + this.utcOffset() * 60 * 1000)\n .toISOString()\n .replace('Z', formatMoment(m, 'Z'));\n }\n }\n return formatMoment(\n m,\n utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ'\n );\n }\n\n /**\n * Return a human readable representation of a moment that can\n * also be evaluated to get a new moment which is the same\n *\n * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects\n */\n function inspect() {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment',\n zone = '',\n prefix,\n year,\n datetime,\n suffix;\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n prefix = '[' + func + '(\"]';\n year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY';\n datetime = '-MM-DD[T]HH:mm:ss.SSS';\n suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }\n\n function format(inputString) {\n if (!inputString) {\n inputString = this.isUtc()\n ? hooks.defaultFormatUtc\n : hooks.defaultFormat;\n }\n var output = formatMoment(this, inputString);\n return this.localeData().postformat(output);\n }\n\n function from(time, withoutSuffix) {\n if (\n this.isValid() &&\n ((isMoment(time) && time.isValid()) || createLocal(time).isValid())\n ) {\n return createDuration({ to: this, from: time })\n .locale(this.locale())\n .humanize(!withoutSuffix);\n } else {\n return this.localeData().invalidDate();\n }\n }\n\n function fromNow(withoutSuffix) {\n return this.from(createLocal(), withoutSuffix);\n }\n\n function to(time, withoutSuffix) {\n if (\n this.isValid() &&\n ((isMoment(time) && time.isValid()) || createLocal(time).isValid())\n ) {\n return createDuration({ from: this, to: time })\n .locale(this.locale())\n .humanize(!withoutSuffix);\n } else {\n return this.localeData().invalidDate();\n }\n }\n\n function toNow(withoutSuffix) {\n return this.to(createLocal(), withoutSuffix);\n }\n\n // If passed a locale key, it will set the locale for this\n // instance. Otherwise, it will return the locale configuration\n // variables for this instance.\n function locale(key) {\n var newLocaleData;\n\n if (key === undefined) {\n return this._locale._abbr;\n } else {\n newLocaleData = getLocale(key);\n if (newLocaleData != null) {\n this._locale = newLocaleData;\n }\n return this;\n }\n }\n\n var lang = deprecate(\n 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',\n function (key) {\n if (key === undefined) {\n return this.localeData();\n } else {\n return this.locale(key);\n }\n }\n );\n\n function localeData() {\n return this._locale;\n }\n\n var MS_PER_SECOND = 1000,\n MS_PER_MINUTE = 60 * MS_PER_SECOND,\n MS_PER_HOUR = 60 * MS_PER_MINUTE,\n MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;\n\n // actual modulo - handles negative numbers (for dates before 1970):\n function mod$1(dividend, divisor) {\n return ((dividend % divisor) + divisor) % divisor;\n }\n\n function localStartOfDate(y, m, d) {\n // the date constructor remaps years 0-99 to 1900-1999\n if (y < 100 && y >= 0) {\n // preserve leap years using a full 400 year cycle, then reset\n return new Date(y + 400, m, d) - MS_PER_400_YEARS;\n } else {\n return new Date(y, m, d).valueOf();\n }\n }\n\n function utcStartOfDate(y, m, d) {\n // Date.UTC remaps years 0-99 to 1900-1999\n if (y < 100 && y >= 0) {\n // preserve leap years using a full 400 year cycle, then reset\n return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;\n } else {\n return Date.UTC(y, m, d);\n }\n }\n\n function startOf(units) {\n var time, startOfDate;\n units = normalizeUnits(units);\n if (units === undefined || units === 'millisecond' || !this.isValid()) {\n return this;\n }\n\n startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;\n\n switch (units) {\n case 'year':\n time = startOfDate(this.year(), 0, 1);\n break;\n case 'quarter':\n time = startOfDate(\n this.year(),\n this.month() - (this.month() % 3),\n 1\n );\n break;\n case 'month':\n time = startOfDate(this.year(), this.month(), 1);\n break;\n case 'week':\n time = startOfDate(\n this.year(),\n this.month(),\n this.date() - this.weekday()\n );\n break;\n case 'isoWeek':\n time = startOfDate(\n this.year(),\n this.month(),\n this.date() - (this.isoWeekday() - 1)\n );\n break;\n case 'day':\n case 'date':\n time = startOfDate(this.year(), this.month(), this.date());\n break;\n case 'hour':\n time = this._d.valueOf();\n time -= mod$1(\n time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),\n MS_PER_HOUR\n );\n break;\n case 'minute':\n time = this._d.valueOf();\n time -= mod$1(time, MS_PER_MINUTE);\n break;\n case 'second':\n time = this._d.valueOf();\n time -= mod$1(time, MS_PER_SECOND);\n break;\n }\n\n this._d.setTime(time);\n hooks.updateOffset(this, true);\n return this;\n }\n\n function endOf(units) {\n var time, startOfDate;\n units = normalizeUnits(units);\n if (units === undefined || units === 'millisecond' || !this.isValid()) {\n return this;\n }\n\n startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;\n\n switch (units) {\n case 'year':\n time = startOfDate(this.year() + 1, 0, 1) - 1;\n break;\n case 'quarter':\n time =\n startOfDate(\n this.year(),\n this.month() - (this.month() % 3) + 3,\n 1\n ) - 1;\n break;\n case 'month':\n time = startOfDate(this.year(), this.month() + 1, 1) - 1;\n break;\n case 'week':\n time =\n startOfDate(\n this.year(),\n this.month(),\n this.date() - this.weekday() + 7\n ) - 1;\n break;\n case 'isoWeek':\n time =\n startOfDate(\n this.year(),\n this.month(),\n this.date() - (this.isoWeekday() - 1) + 7\n ) - 1;\n break;\n case 'day':\n case 'date':\n time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;\n break;\n case 'hour':\n time = this._d.valueOf();\n time +=\n MS_PER_HOUR -\n mod$1(\n time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),\n MS_PER_HOUR\n ) -\n 1;\n break;\n case 'minute':\n time = this._d.valueOf();\n time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;\n break;\n case 'second':\n time = this._d.valueOf();\n time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;\n break;\n }\n\n this._d.setTime(time);\n hooks.updateOffset(this, true);\n return this;\n }\n\n function valueOf() {\n return this._d.valueOf() - (this._offset || 0) * 60000;\n }\n\n function unix() {\n return Math.floor(this.valueOf() / 1000);\n }\n\n function toDate() {\n return new Date(this.valueOf());\n }\n\n function toArray() {\n var m = this;\n return [\n m.year(),\n m.month(),\n m.date(),\n m.hour(),\n m.minute(),\n m.second(),\n m.millisecond(),\n ];\n }\n\n function toObject() {\n var m = this;\n return {\n years: m.year(),\n months: m.month(),\n date: m.date(),\n hours: m.hours(),\n minutes: m.minutes(),\n seconds: m.seconds(),\n milliseconds: m.milliseconds(),\n };\n }\n\n function toJSON() {\n // new Date(NaN).toJSON() === null\n return this.isValid() ? this.toISOString() : null;\n }\n\n function isValid$2() {\n return isValid(this);\n }\n\n function parsingFlags() {\n return extend({}, getParsingFlags(this));\n }\n\n function invalidAt() {\n return getParsingFlags(this).overflow;\n }\n\n function creationData() {\n return {\n input: this._i,\n format: this._f,\n locale: this._locale,\n isUTC: this._isUTC,\n strict: this._strict,\n };\n }\n\n addFormatToken('N', 0, 0, 'eraAbbr');\n addFormatToken('NN', 0, 0, 'eraAbbr');\n addFormatToken('NNN', 0, 0, 'eraAbbr');\n addFormatToken('NNNN', 0, 0, 'eraName');\n addFormatToken('NNNNN', 0, 0, 'eraNarrow');\n\n addFormatToken('y', ['y', 1], 'yo', 'eraYear');\n addFormatToken('y', ['yy', 2], 0, 'eraYear');\n addFormatToken('y', ['yyy', 3], 0, 'eraYear');\n addFormatToken('y', ['yyyy', 4], 0, 'eraYear');\n\n addRegexToken('N', matchEraAbbr);\n addRegexToken('NN', matchEraAbbr);\n addRegexToken('NNN', matchEraAbbr);\n addRegexToken('NNNN', matchEraName);\n addRegexToken('NNNNN', matchEraNarrow);\n\n addParseToken(['N', 'NN', 'NNN', 'NNNN', 'NNNNN'], function (\n input,\n array,\n config,\n token\n ) {\n var era = config._locale.erasParse(input, token, config._strict);\n if (era) {\n getParsingFlags(config).era = era;\n } else {\n getParsingFlags(config).invalidEra = input;\n }\n });\n\n addRegexToken('y', matchUnsigned);\n addRegexToken('yy', matchUnsigned);\n addRegexToken('yyy', matchUnsigned);\n addRegexToken('yyyy', matchUnsigned);\n addRegexToken('yo', matchEraYearOrdinal);\n\n addParseToken(['y', 'yy', 'yyy', 'yyyy'], YEAR);\n addParseToken(['yo'], function (input, array, config, token) {\n var match;\n if (config._locale._eraYearOrdinalRegex) {\n match = input.match(config._locale._eraYearOrdinalRegex);\n }\n\n if (config._locale.eraYearOrdinalParse) {\n array[YEAR] = config._locale.eraYearOrdinalParse(input, match);\n } else {\n array[YEAR] = parseInt(input, 10);\n }\n });\n\n function localeEras(m, format) {\n var i,\n l,\n date,\n eras = this._eras || getLocale('en')._eras;\n for (i = 0, l = eras.length; i < l; ++i) {\n switch (typeof eras[i].since) {\n case 'string':\n // truncate time\n date = hooks(eras[i].since).startOf('day');\n eras[i].since = date.valueOf();\n break;\n }\n\n switch (typeof eras[i].until) {\n case 'undefined':\n eras[i].until = +Infinity;\n break;\n case 'string':\n // truncate time\n date = hooks(eras[i].until).startOf('day').valueOf();\n eras[i].until = date.valueOf();\n break;\n }\n }\n return eras;\n }\n\n function localeErasParse(eraName, format, strict) {\n var i,\n l,\n eras = this.eras(),\n name,\n abbr,\n narrow;\n eraName = eraName.toUpperCase();\n\n for (i = 0, l = eras.length; i < l; ++i) {\n name = eras[i].name.toUpperCase();\n abbr = eras[i].abbr.toUpperCase();\n narrow = eras[i].narrow.toUpperCase();\n\n if (strict) {\n switch (format) {\n case 'N':\n case 'NN':\n case 'NNN':\n if (abbr === eraName) {\n return eras[i];\n }\n break;\n\n case 'NNNN':\n if (name === eraName) {\n return eras[i];\n }\n break;\n\n case 'NNNNN':\n if (narrow === eraName) {\n return eras[i];\n }\n break;\n }\n } else if ([name, abbr, narrow].indexOf(eraName) >= 0) {\n return eras[i];\n }\n }\n }\n\n function localeErasConvertYear(era, year) {\n var dir = era.since <= era.until ? +1 : -1;\n if (year === undefined) {\n return hooks(era.since).year();\n } else {\n return hooks(era.since).year() + (year - era.offset) * dir;\n }\n }\n\n function getEraName() {\n var i,\n l,\n val,\n eras = this.localeData().eras();\n for (i = 0, l = eras.length; i < l; ++i) {\n // truncate time\n val = this.clone().startOf('day').valueOf();\n\n if (eras[i].since <= val && val <= eras[i].until) {\n return eras[i].name;\n }\n if (eras[i].until <= val && val <= eras[i].since) {\n return eras[i].name;\n }\n }\n\n return '';\n }\n\n function getEraNarrow() {\n var i,\n l,\n val,\n eras = this.localeData().eras();\n for (i = 0, l = eras.length; i < l; ++i) {\n // truncate time\n val = this.clone().startOf('day').valueOf();\n\n if (eras[i].since <= val && val <= eras[i].until) {\n return eras[i].narrow;\n }\n if (eras[i].until <= val && val <= eras[i].since) {\n return eras[i].narrow;\n }\n }\n\n return '';\n }\n\n function getEraAbbr() {\n var i,\n l,\n val,\n eras = this.localeData().eras();\n for (i = 0, l = eras.length; i < l; ++i) {\n // truncate time\n val = this.clone().startOf('day').valueOf();\n\n if (eras[i].since <= val && val <= eras[i].until) {\n return eras[i].abbr;\n }\n if (eras[i].until <= val && val <= eras[i].since) {\n return eras[i].abbr;\n }\n }\n\n return '';\n }\n\n function getEraYear() {\n var i,\n l,\n dir,\n val,\n eras = this.localeData().eras();\n for (i = 0, l = eras.length; i < l; ++i) {\n dir = eras[i].since <= eras[i].until ? +1 : -1;\n\n // truncate time\n val = this.clone().startOf('day').valueOf();\n\n if (\n (eras[i].since <= val && val <= eras[i].until) ||\n (eras[i].until <= val && val <= eras[i].since)\n ) {\n return (\n (this.year() - hooks(eras[i].since).year()) * dir +\n eras[i].offset\n );\n }\n }\n\n return this.year();\n }\n\n function erasNameRegex(isStrict) {\n if (!hasOwnProp(this, '_erasNameRegex')) {\n computeErasParse.call(this);\n }\n return isStrict ? this._erasNameRegex : this._erasRegex;\n }\n\n function erasAbbrRegex(isStrict) {\n if (!hasOwnProp(this, '_erasAbbrRegex')) {\n computeErasParse.call(this);\n }\n return isStrict ? this._erasAbbrRegex : this._erasRegex;\n }\n\n function erasNarrowRegex(isStrict) {\n if (!hasOwnProp(this, '_erasNarrowRegex')) {\n computeErasParse.call(this);\n }\n return isStrict ? this._erasNarrowRegex : this._erasRegex;\n }\n\n function matchEraAbbr(isStrict, locale) {\n return locale.erasAbbrRegex(isStrict);\n }\n\n function matchEraName(isStrict, locale) {\n return locale.erasNameRegex(isStrict);\n }\n\n function matchEraNarrow(isStrict, locale) {\n return locale.erasNarrowRegex(isStrict);\n }\n\n function matchEraYearOrdinal(isStrict, locale) {\n return locale._eraYearOrdinalRegex || matchUnsigned;\n }\n\n function computeErasParse() {\n var abbrPieces = [],\n namePieces = [],\n narrowPieces = [],\n mixedPieces = [],\n i,\n l,\n eras = this.eras();\n\n for (i = 0, l = eras.length; i < l; ++i) {\n namePieces.push(regexEscape(eras[i].name));\n abbrPieces.push(regexEscape(eras[i].abbr));\n narrowPieces.push(regexEscape(eras[i].narrow));\n\n mixedPieces.push(regexEscape(eras[i].name));\n mixedPieces.push(regexEscape(eras[i].abbr));\n mixedPieces.push(regexEscape(eras[i].narrow));\n }\n\n this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');\n this._erasNameRegex = new RegExp('^(' + namePieces.join('|') + ')', 'i');\n this._erasAbbrRegex = new RegExp('^(' + abbrPieces.join('|') + ')', 'i');\n this._erasNarrowRegex = new RegExp(\n '^(' + narrowPieces.join('|') + ')',\n 'i'\n );\n }\n\n // FORMATTING\n\n addFormatToken(0, ['gg', 2], 0, function () {\n return this.weekYear() % 100;\n });\n\n addFormatToken(0, ['GG', 2], 0, function () {\n return this.isoWeekYear() % 100;\n });\n\n function addWeekYearFormatToken(token, getter) {\n addFormatToken(0, [token, token.length], 0, getter);\n }\n\n addWeekYearFormatToken('gggg', 'weekYear');\n addWeekYearFormatToken('ggggg', 'weekYear');\n addWeekYearFormatToken('GGGG', 'isoWeekYear');\n addWeekYearFormatToken('GGGGG', 'isoWeekYear');\n\n // ALIASES\n\n addUnitAlias('weekYear', 'gg');\n addUnitAlias('isoWeekYear', 'GG');\n\n // PRIORITY\n\n addUnitPriority('weekYear', 1);\n addUnitPriority('isoWeekYear', 1);\n\n // PARSING\n\n addRegexToken('G', matchSigned);\n addRegexToken('g', matchSigned);\n addRegexToken('GG', match1to2, match2);\n addRegexToken('gg', match1to2, match2);\n addRegexToken('GGGG', match1to4, match4);\n addRegexToken('gggg', match1to4, match4);\n addRegexToken('GGGGG', match1to6, match6);\n addRegexToken('ggggg', match1to6, match6);\n\n addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (\n input,\n week,\n config,\n token\n ) {\n week[token.substr(0, 2)] = toInt(input);\n });\n\n addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {\n week[token] = hooks.parseTwoDigitYear(input);\n });\n\n // MOMENTS\n\n function getSetWeekYear(input) {\n return getSetWeekYearHelper.call(\n this,\n input,\n this.week(),\n this.weekday(),\n this.localeData()._week.dow,\n this.localeData()._week.doy\n );\n }\n\n function getSetISOWeekYear(input) {\n return getSetWeekYearHelper.call(\n this,\n input,\n this.isoWeek(),\n this.isoWeekday(),\n 1,\n 4\n );\n }\n\n function getISOWeeksInYear() {\n return weeksInYear(this.year(), 1, 4);\n }\n\n function getISOWeeksInISOWeekYear() {\n return weeksInYear(this.isoWeekYear(), 1, 4);\n }\n\n function getWeeksInYear() {\n var weekInfo = this.localeData()._week;\n return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);\n }\n\n function getWeeksInWeekYear() {\n var weekInfo = this.localeData()._week;\n return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy);\n }\n\n function getSetWeekYearHelper(input, week, weekday, dow, doy) {\n var weeksTarget;\n if (input == null) {\n return weekOfYear(this, dow, doy).year;\n } else {\n weeksTarget = weeksInYear(input, dow, doy);\n if (week > weeksTarget) {\n week = weeksTarget;\n }\n return setWeekAll.call(this, input, week, weekday, dow, doy);\n }\n }\n\n function setWeekAll(weekYear, week, weekday, dow, doy) {\n var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),\n date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);\n\n this.year(date.getUTCFullYear());\n this.month(date.getUTCMonth());\n this.date(date.getUTCDate());\n return this;\n }\n\n // FORMATTING\n\n addFormatToken('Q', 0, 'Qo', 'quarter');\n\n // ALIASES\n\n addUnitAlias('quarter', 'Q');\n\n // PRIORITY\n\n addUnitPriority('quarter', 7);\n\n // PARSING\n\n addRegexToken('Q', match1);\n addParseToken('Q', function (input, array) {\n array[MONTH] = (toInt(input) - 1) * 3;\n });\n\n // MOMENTS\n\n function getSetQuarter(input) {\n return input == null\n ? Math.ceil((this.month() + 1) / 3)\n : this.month((input - 1) * 3 + (this.month() % 3));\n }\n\n // FORMATTING\n\n addFormatToken('D', ['DD', 2], 'Do', 'date');\n\n // ALIASES\n\n addUnitAlias('date', 'D');\n\n // PRIORITY\n addUnitPriority('date', 9);\n\n // PARSING\n\n addRegexToken('D', match1to2);\n addRegexToken('DD', match1to2, match2);\n addRegexToken('Do', function (isStrict, locale) {\n // TODO: Remove \"ordinalParse\" fallback in next major release.\n return isStrict\n ? locale._dayOfMonthOrdinalParse || locale._ordinalParse\n : locale._dayOfMonthOrdinalParseLenient;\n });\n\n addParseToken(['D', 'DD'], DATE);\n addParseToken('Do', function (input, array) {\n array[DATE] = toInt(input.match(match1to2)[0]);\n });\n\n // MOMENTS\n\n var getSetDayOfMonth = makeGetSet('Date', true);\n\n // FORMATTING\n\n addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');\n\n // ALIASES\n\n addUnitAlias('dayOfYear', 'DDD');\n\n // PRIORITY\n addUnitPriority('dayOfYear', 4);\n\n // PARSING\n\n addRegexToken('DDD', match1to3);\n addRegexToken('DDDD', match3);\n addParseToken(['DDD', 'DDDD'], function (input, array, config) {\n config._dayOfYear = toInt(input);\n });\n\n // HELPERS\n\n // MOMENTS\n\n function getSetDayOfYear(input) {\n var dayOfYear =\n Math.round(\n (this.clone().startOf('day') - this.clone().startOf('year')) / 864e5\n ) + 1;\n return input == null ? dayOfYear : this.add(input - dayOfYear, 'd');\n }\n\n // FORMATTING\n\n addFormatToken('m', ['mm', 2], 0, 'minute');\n\n // ALIASES\n\n addUnitAlias('minute', 'm');\n\n // PRIORITY\n\n addUnitPriority('minute', 14);\n\n // PARSING\n\n addRegexToken('m', match1to2);\n addRegexToken('mm', match1to2, match2);\n addParseToken(['m', 'mm'], MINUTE);\n\n // MOMENTS\n\n var getSetMinute = makeGetSet('Minutes', false);\n\n // FORMATTING\n\n addFormatToken('s', ['ss', 2], 0, 'second');\n\n // ALIASES\n\n addUnitAlias('second', 's');\n\n // PRIORITY\n\n addUnitPriority('second', 15);\n\n // PARSING\n\n addRegexToken('s', match1to2);\n addRegexToken('ss', match1to2, match2);\n addParseToken(['s', 'ss'], SECOND);\n\n // MOMENTS\n\n var getSetSecond = makeGetSet('Seconds', false);\n\n // FORMATTING\n\n addFormatToken('S', 0, 0, function () {\n return ~~(this.millisecond() / 100);\n });\n\n addFormatToken(0, ['SS', 2], 0, function () {\n return ~~(this.millisecond() / 10);\n });\n\n addFormatToken(0, ['SSS', 3], 0, 'millisecond');\n addFormatToken(0, ['SSSS', 4], 0, function () {\n return this.millisecond() * 10;\n });\n addFormatToken(0, ['SSSSS', 5], 0, function () {\n return this.millisecond() * 100;\n });\n addFormatToken(0, ['SSSSSS', 6], 0, function () {\n return this.millisecond() * 1000;\n });\n addFormatToken(0, ['SSSSSSS', 7], 0, function () {\n return this.millisecond() * 10000;\n });\n addFormatToken(0, ['SSSSSSSS', 8], 0, function () {\n return this.millisecond() * 100000;\n });\n addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {\n return this.millisecond() * 1000000;\n });\n\n // ALIASES\n\n addUnitAlias('millisecond', 'ms');\n\n // PRIORITY\n\n addUnitPriority('millisecond', 16);\n\n // PARSING\n\n addRegexToken('S', match1to3, match1);\n addRegexToken('SS', match1to3, match2);\n addRegexToken('SSS', match1to3, match3);\n\n var token, getSetMillisecond;\n for (token = 'SSSS'; token.length <= 9; token += 'S') {\n addRegexToken(token, matchUnsigned);\n }\n\n function parseMs(input, array) {\n array[MILLISECOND] = toInt(('0.' + input) * 1000);\n }\n\n for (token = 'S'; token.length <= 9; token += 'S') {\n addParseToken(token, parseMs);\n }\n\n getSetMillisecond = makeGetSet('Milliseconds', false);\n\n // FORMATTING\n\n addFormatToken('z', 0, 0, 'zoneAbbr');\n addFormatToken('zz', 0, 0, 'zoneName');\n\n // MOMENTS\n\n function getZoneAbbr() {\n return this._isUTC ? 'UTC' : '';\n }\n\n function getZoneName() {\n return this._isUTC ? 'Coordinated Universal Time' : '';\n }\n\n var proto = Moment.prototype;\n\n proto.add = add;\n proto.calendar = calendar$1;\n proto.clone = clone;\n proto.diff = diff;\n proto.endOf = endOf;\n proto.format = format;\n proto.from = from;\n proto.fromNow = fromNow;\n proto.to = to;\n proto.toNow = toNow;\n proto.get = stringGet;\n proto.invalidAt = invalidAt;\n proto.isAfter = isAfter;\n proto.isBefore = isBefore;\n proto.isBetween = isBetween;\n proto.isSame = isSame;\n proto.isSameOrAfter = isSameOrAfter;\n proto.isSameOrBefore = isSameOrBefore;\n proto.isValid = isValid$2;\n proto.lang = lang;\n proto.locale = locale;\n proto.localeData = localeData;\n proto.max = prototypeMax;\n proto.min = prototypeMin;\n proto.parsingFlags = parsingFlags;\n proto.set = stringSet;\n proto.startOf = startOf;\n proto.subtract = subtract;\n proto.toArray = toArray;\n proto.toObject = toObject;\n proto.toDate = toDate;\n proto.toISOString = toISOString;\n proto.inspect = inspect;\n if (typeof Symbol !== 'undefined' && Symbol.for != null) {\n proto[Symbol.for('nodejs.util.inspect.custom')] = function () {\n return 'Moment<' + this.format() + '>';\n };\n }\n proto.toJSON = toJSON;\n proto.toString = toString;\n proto.unix = unix;\n proto.valueOf = valueOf;\n proto.creationData = creationData;\n proto.eraName = getEraName;\n proto.eraNarrow = getEraNarrow;\n proto.eraAbbr = getEraAbbr;\n proto.eraYear = getEraYear;\n proto.year = getSetYear;\n proto.isLeapYear = getIsLeapYear;\n proto.weekYear = getSetWeekYear;\n proto.isoWeekYear = getSetISOWeekYear;\n proto.quarter = proto.quarters = getSetQuarter;\n proto.month = getSetMonth;\n proto.daysInMonth = getDaysInMonth;\n proto.week = proto.weeks = getSetWeek;\n proto.isoWeek = proto.isoWeeks = getSetISOWeek;\n proto.weeksInYear = getWeeksInYear;\n proto.weeksInWeekYear = getWeeksInWeekYear;\n proto.isoWeeksInYear = getISOWeeksInYear;\n proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear;\n proto.date = getSetDayOfMonth;\n proto.day = proto.days = getSetDayOfWeek;\n proto.weekday = getSetLocaleDayOfWeek;\n proto.isoWeekday = getSetISODayOfWeek;\n proto.dayOfYear = getSetDayOfYear;\n proto.hour = proto.hours = getSetHour;\n proto.minute = proto.minutes = getSetMinute;\n proto.second = proto.seconds = getSetSecond;\n proto.millisecond = proto.milliseconds = getSetMillisecond;\n proto.utcOffset = getSetOffset;\n proto.utc = setOffsetToUTC;\n proto.local = setOffsetToLocal;\n proto.parseZone = setOffsetToParsedOffset;\n proto.hasAlignedHourOffset = hasAlignedHourOffset;\n proto.isDST = isDaylightSavingTime;\n proto.isLocal = isLocal;\n proto.isUtcOffset = isUtcOffset;\n proto.isUtc = isUtc;\n proto.isUTC = isUtc;\n proto.zoneAbbr = getZoneAbbr;\n proto.zoneName = getZoneName;\n proto.dates = deprecate(\n 'dates accessor is deprecated. Use date instead.',\n getSetDayOfMonth\n );\n proto.months = deprecate(\n 'months accessor is deprecated. Use month instead',\n getSetMonth\n );\n proto.years = deprecate(\n 'years accessor is deprecated. Use year instead',\n getSetYear\n );\n proto.zone = deprecate(\n 'moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/',\n getSetZone\n );\n proto.isDSTShifted = deprecate(\n 'isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information',\n isDaylightSavingTimeShifted\n );\n\n function createUnix(input) {\n return createLocal(input * 1000);\n }\n\n function createInZone() {\n return createLocal.apply(null, arguments).parseZone();\n }\n\n function preParsePostFormat(string) {\n return string;\n }\n\n var proto$1 = Locale.prototype;\n\n proto$1.calendar = calendar;\n proto$1.longDateFormat = longDateFormat;\n proto$1.invalidDate = invalidDate;\n proto$1.ordinal = ordinal;\n proto$1.preparse = preParsePostFormat;\n proto$1.postformat = preParsePostFormat;\n proto$1.relativeTime = relativeTime;\n proto$1.pastFuture = pastFuture;\n proto$1.set = set;\n proto$1.eras = localeEras;\n proto$1.erasParse = localeErasParse;\n proto$1.erasConvertYear = localeErasConvertYear;\n proto$1.erasAbbrRegex = erasAbbrRegex;\n proto$1.erasNameRegex = erasNameRegex;\n proto$1.erasNarrowRegex = erasNarrowRegex;\n\n proto$1.months = localeMonths;\n proto$1.monthsShort = localeMonthsShort;\n proto$1.monthsParse = localeMonthsParse;\n proto$1.monthsRegex = monthsRegex;\n proto$1.monthsShortRegex = monthsShortRegex;\n proto$1.week = localeWeek;\n proto$1.firstDayOfYear = localeFirstDayOfYear;\n proto$1.firstDayOfWeek = localeFirstDayOfWeek;\n\n proto$1.weekdays = localeWeekdays;\n proto$1.weekdaysMin = localeWeekdaysMin;\n proto$1.weekdaysShort = localeWeekdaysShort;\n proto$1.weekdaysParse = localeWeekdaysParse;\n\n proto$1.weekdaysRegex = weekdaysRegex;\n proto$1.weekdaysShortRegex = weekdaysShortRegex;\n proto$1.weekdaysMinRegex = weekdaysMinRegex;\n\n proto$1.isPM = localeIsPM;\n proto$1.meridiem = localeMeridiem;\n\n function get$1(format, index, field, setter) {\n var locale = getLocale(),\n utc = createUTC().set(setter, index);\n return locale[field](utc, format);\n }\n\n function listMonthsImpl(format, index, field) {\n if (isNumber(format)) {\n index = format;\n format = undefined;\n }\n\n format = format || '';\n\n if (index != null) {\n return get$1(format, index, field, 'month');\n }\n\n var i,\n out = [];\n for (i = 0; i < 12; i++) {\n out[i] = get$1(format, i, field, 'month');\n }\n return out;\n }\n\n // ()\n // (5)\n // (fmt, 5)\n // (fmt)\n // (true)\n // (true, 5)\n // (true, fmt, 5)\n // (true, fmt)\n function listWeekdaysImpl(localeSorted, format, index, field) {\n if (typeof localeSorted === 'boolean') {\n if (isNumber(format)) {\n index = format;\n format = undefined;\n }\n\n format = format || '';\n } else {\n format = localeSorted;\n index = format;\n localeSorted = false;\n\n if (isNumber(format)) {\n index = format;\n format = undefined;\n }\n\n format = format || '';\n }\n\n var locale = getLocale(),\n shift = localeSorted ? locale._week.dow : 0,\n i,\n out = [];\n\n if (index != null) {\n return get$1(format, (index + shift) % 7, field, 'day');\n }\n\n for (i = 0; i < 7; i++) {\n out[i] = get$1(format, (i + shift) % 7, field, 'day');\n }\n return out;\n }\n\n function listMonths(format, index) {\n return listMonthsImpl(format, index, 'months');\n }\n\n function listMonthsShort(format, index) {\n return listMonthsImpl(format, index, 'monthsShort');\n }\n\n function listWeekdays(localeSorted, format, index) {\n return listWeekdaysImpl(localeSorted, format, index, 'weekdays');\n }\n\n function listWeekdaysShort(localeSorted, format, index) {\n return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');\n }\n\n function listWeekdaysMin(localeSorted, format, index) {\n return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');\n }\n\n getSetGlobalLocale('en', {\n eras: [\n {\n since: '0001-01-01',\n until: +Infinity,\n offset: 1,\n name: 'Anno Domini',\n narrow: 'AD',\n abbr: 'AD',\n },\n {\n since: '0000-12-31',\n until: -Infinity,\n offset: 1,\n name: 'Before Christ',\n narrow: 'BC',\n abbr: 'BC',\n },\n ],\n dayOfMonthOrdinalParse: /\\d{1,2}(th|st|nd|rd)/,\n ordinal: function (number) {\n var b = number % 10,\n output =\n toInt((number % 100) / 10) === 1\n ? 'th'\n : b === 1\n ? 'st'\n : b === 2\n ? 'nd'\n : b === 3\n ? 'rd'\n : 'th';\n return number + output;\n },\n });\n\n // Side effect imports\n\n hooks.lang = deprecate(\n 'moment.lang is deprecated. Use moment.locale instead.',\n getSetGlobalLocale\n );\n hooks.langData = deprecate(\n 'moment.langData is deprecated. Use moment.localeData instead.',\n getLocale\n );\n\n var mathAbs = Math.abs;\n\n function abs() {\n var data = this._data;\n\n this._milliseconds = mathAbs(this._milliseconds);\n this._days = mathAbs(this._days);\n this._months = mathAbs(this._months);\n\n data.milliseconds = mathAbs(data.milliseconds);\n data.seconds = mathAbs(data.seconds);\n data.minutes = mathAbs(data.minutes);\n data.hours = mathAbs(data.hours);\n data.months = mathAbs(data.months);\n data.years = mathAbs(data.years);\n\n return this;\n }\n\n function addSubtract$1(duration, input, value, direction) {\n var other = createDuration(input, value);\n\n duration._milliseconds += direction * other._milliseconds;\n duration._days += direction * other._days;\n duration._months += direction * other._months;\n\n return duration._bubble();\n }\n\n // supports only 2.0-style add(1, 's') or add(duration)\n function add$1(input, value) {\n return addSubtract$1(this, input, value, 1);\n }\n\n // supports only 2.0-style subtract(1, 's') or subtract(duration)\n function subtract$1(input, value) {\n return addSubtract$1(this, input, value, -1);\n }\n\n function absCeil(number) {\n if (number < 0) {\n return Math.floor(number);\n } else {\n return Math.ceil(number);\n }\n }\n\n function bubble() {\n var milliseconds = this._milliseconds,\n days = this._days,\n months = this._months,\n data = this._data,\n seconds,\n minutes,\n hours,\n years,\n monthsFromDays;\n\n // if we have a mix of positive and negative values, bubble down first\n // check: https://github.com/moment/moment/issues/2166\n if (\n !(\n (milliseconds >= 0 && days >= 0 && months >= 0) ||\n (milliseconds <= 0 && days <= 0 && months <= 0)\n )\n ) {\n milliseconds += absCeil(monthsToDays(months) + days) * 864e5;\n days = 0;\n months = 0;\n }\n\n // The following code bubbles up values, see the tests for\n // examples of what that means.\n data.milliseconds = milliseconds % 1000;\n\n seconds = absFloor(milliseconds / 1000);\n data.seconds = seconds % 60;\n\n minutes = absFloor(seconds / 60);\n data.minutes = minutes % 60;\n\n hours = absFloor(minutes / 60);\n data.hours = hours % 24;\n\n days += absFloor(hours / 24);\n\n // convert days to months\n monthsFromDays = absFloor(daysToMonths(days));\n months += monthsFromDays;\n days -= absCeil(monthsToDays(monthsFromDays));\n\n // 12 months -> 1 year\n years = absFloor(months / 12);\n months %= 12;\n\n data.days = days;\n data.months = months;\n data.years = years;\n\n return this;\n }\n\n function daysToMonths(days) {\n // 400 years have 146097 days (taking into account leap year rules)\n // 400 years have 12 months === 4800\n return (days * 4800) / 146097;\n }\n\n function monthsToDays(months) {\n // the reverse of daysToMonths\n return (months * 146097) / 4800;\n }\n\n function as(units) {\n if (!this.isValid()) {\n return NaN;\n }\n var days,\n months,\n milliseconds = this._milliseconds;\n\n units = normalizeUnits(units);\n\n if (units === 'month' || units === 'quarter' || units === 'year') {\n days = this._days + milliseconds / 864e5;\n months = this._months + daysToMonths(days);\n switch (units) {\n case 'month':\n return months;\n case 'quarter':\n return months / 3;\n case 'year':\n return months / 12;\n }\n } else {\n // handle milliseconds separately because of floating point math errors (issue #1867)\n days = this._days + Math.round(monthsToDays(this._months));\n switch (units) {\n case 'week':\n return days / 7 + milliseconds / 6048e5;\n case 'day':\n return days + milliseconds / 864e5;\n case 'hour':\n return days * 24 + milliseconds / 36e5;\n case 'minute':\n return days * 1440 + milliseconds / 6e4;\n case 'second':\n return days * 86400 + milliseconds / 1000;\n // Math.floor prevents floating point math errors here\n case 'millisecond':\n return Math.floor(days * 864e5) + milliseconds;\n default:\n throw new Error('Unknown unit ' + units);\n }\n }\n }\n\n // TODO: Use this.as('ms')?\n function valueOf$1() {\n if (!this.isValid()) {\n return NaN;\n }\n return (\n this._milliseconds +\n this._days * 864e5 +\n (this._months % 12) * 2592e6 +\n toInt(this._months / 12) * 31536e6\n );\n }\n\n function makeAs(alias) {\n return function () {\n return this.as(alias);\n };\n }\n\n var asMilliseconds = makeAs('ms'),\n asSeconds = makeAs('s'),\n asMinutes = makeAs('m'),\n asHours = makeAs('h'),\n asDays = makeAs('d'),\n asWeeks = makeAs('w'),\n asMonths = makeAs('M'),\n asQuarters = makeAs('Q'),\n asYears = makeAs('y');\n\n function clone$1() {\n return createDuration(this);\n }\n\n function get$2(units) {\n units = normalizeUnits(units);\n return this.isValid() ? this[units + 's']() : NaN;\n }\n\n function makeGetter(name) {\n return function () {\n return this.isValid() ? this._data[name] : NaN;\n };\n }\n\n var milliseconds = makeGetter('milliseconds'),\n seconds = makeGetter('seconds'),\n minutes = makeGetter('minutes'),\n hours = makeGetter('hours'),\n days = makeGetter('days'),\n months = makeGetter('months'),\n years = makeGetter('years');\n\n function weeks() {\n return absFloor(this.days() / 7);\n }\n\n var round = Math.round,\n thresholds = {\n ss: 44, // a few seconds to seconds\n s: 45, // seconds to minute\n m: 45, // minutes to hour\n h: 22, // hours to day\n d: 26, // days to month/week\n w: null, // weeks to month\n M: 11, // months to year\n };\n\n // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize\n function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {\n return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);\n }\n\n function relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) {\n var duration = createDuration(posNegDuration).abs(),\n seconds = round(duration.as('s')),\n minutes = round(duration.as('m')),\n hours = round(duration.as('h')),\n days = round(duration.as('d')),\n months = round(duration.as('M')),\n weeks = round(duration.as('w')),\n years = round(duration.as('y')),\n a =\n (seconds <= thresholds.ss && ['s', seconds]) ||\n (seconds < thresholds.s && ['ss', seconds]) ||\n (minutes <= 1 && ['m']) ||\n (minutes < thresholds.m && ['mm', minutes]) ||\n (hours <= 1 && ['h']) ||\n (hours < thresholds.h && ['hh', hours]) ||\n (days <= 1 && ['d']) ||\n (days < thresholds.d && ['dd', days]);\n\n if (thresholds.w != null) {\n a =\n a ||\n (weeks <= 1 && ['w']) ||\n (weeks < thresholds.w && ['ww', weeks]);\n }\n a = a ||\n (months <= 1 && ['M']) ||\n (months < thresholds.M && ['MM', months]) ||\n (years <= 1 && ['y']) || ['yy', years];\n\n a[2] = withoutSuffix;\n a[3] = +posNegDuration > 0;\n a[4] = locale;\n return substituteTimeAgo.apply(null, a);\n }\n\n // This function allows you to set the rounding function for relative time strings\n function getSetRelativeTimeRounding(roundingFunction) {\n if (roundingFunction === undefined) {\n return round;\n }\n if (typeof roundingFunction === 'function') {\n round = roundingFunction;\n return true;\n }\n return false;\n }\n\n // This function allows you to set a threshold for relative time strings\n function getSetRelativeTimeThreshold(threshold, limit) {\n if (thresholds[threshold] === undefined) {\n return false;\n }\n if (limit === undefined) {\n return thresholds[threshold];\n }\n thresholds[threshold] = limit;\n if (threshold === 's') {\n thresholds.ss = limit - 1;\n }\n return true;\n }\n\n function humanize(argWithSuffix, argThresholds) {\n if (!this.isValid()) {\n return this.localeData().invalidDate();\n }\n\n var withSuffix = false,\n th = thresholds,\n locale,\n output;\n\n if (typeof argWithSuffix === 'object') {\n argThresholds = argWithSuffix;\n argWithSuffix = false;\n }\n if (typeof argWithSuffix === 'boolean') {\n withSuffix = argWithSuffix;\n }\n if (typeof argThresholds === 'object') {\n th = Object.assign({}, thresholds, argThresholds);\n if (argThresholds.s != null && argThresholds.ss == null) {\n th.ss = argThresholds.s - 1;\n }\n }\n\n locale = this.localeData();\n output = relativeTime$1(this, !withSuffix, th, locale);\n\n if (withSuffix) {\n output = locale.pastFuture(+this, output);\n }\n\n return locale.postformat(output);\n }\n\n var abs$1 = Math.abs;\n\n function sign(x) {\n return (x > 0) - (x < 0) || +x;\n }\n\n function toISOString$1() {\n // for ISO strings we do not use the normal bubbling rules:\n // * milliseconds bubble up until they become hours\n // * days do not bubble at all\n // * months bubble up until they become years\n // This is because there is no context-free conversion between hours and days\n // (think of clock changes)\n // and also not between days and months (28-31 days per month)\n if (!this.isValid()) {\n return this.localeData().invalidDate();\n }\n\n var seconds = abs$1(this._milliseconds) / 1000,\n days = abs$1(this._days),\n months = abs$1(this._months),\n minutes,\n hours,\n years,\n s,\n total = this.asSeconds(),\n totalSign,\n ymSign,\n daysSign,\n hmsSign;\n\n if (!total) {\n // this is the same as C#'s (Noda) and python (isodate)...\n // but not other JS (goog.date)\n return 'P0D';\n }\n\n // 3600 seconds -> 60 minutes -> 1 hour\n minutes = absFloor(seconds / 60);\n hours = absFloor(minutes / 60);\n seconds %= 60;\n minutes %= 60;\n\n // 12 months -> 1 year\n years = absFloor(months / 12);\n months %= 12;\n\n // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js\n s = seconds ? seconds.toFixed(3).replace(/\\.?0+$/, '') : '';\n\n totalSign = total < 0 ? '-' : '';\n ymSign = sign(this._months) !== sign(total) ? '-' : '';\n daysSign = sign(this._days) !== sign(total) ? '-' : '';\n hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';\n\n return (\n totalSign +\n 'P' +\n (years ? ymSign + years + 'Y' : '') +\n (months ? ymSign + months + 'M' : '') +\n (days ? daysSign + days + 'D' : '') +\n (hours || minutes || seconds ? 'T' : '') +\n (hours ? hmsSign + hours + 'H' : '') +\n (minutes ? hmsSign + minutes + 'M' : '') +\n (seconds ? hmsSign + s + 'S' : '')\n );\n }\n\n var proto$2 = Duration.prototype;\n\n proto$2.isValid = isValid$1;\n proto$2.abs = abs;\n proto$2.add = add$1;\n proto$2.subtract = subtract$1;\n proto$2.as = as;\n proto$2.asMilliseconds = asMilliseconds;\n proto$2.asSeconds = asSeconds;\n proto$2.asMinutes = asMinutes;\n proto$2.asHours = asHours;\n proto$2.asDays = asDays;\n proto$2.asWeeks = asWeeks;\n proto$2.asMonths = asMonths;\n proto$2.asQuarters = asQuarters;\n proto$2.asYears = asYears;\n proto$2.valueOf = valueOf$1;\n proto$2._bubble = bubble;\n proto$2.clone = clone$1;\n proto$2.get = get$2;\n proto$2.milliseconds = milliseconds;\n proto$2.seconds = seconds;\n proto$2.minutes = minutes;\n proto$2.hours = hours;\n proto$2.days = days;\n proto$2.weeks = weeks;\n proto$2.months = months;\n proto$2.years = years;\n proto$2.humanize = humanize;\n proto$2.toISOString = toISOString$1;\n proto$2.toString = toISOString$1;\n proto$2.toJSON = toISOString$1;\n proto$2.locale = locale;\n proto$2.localeData = localeData;\n\n proto$2.toIsoString = deprecate(\n 'toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)',\n toISOString$1\n );\n proto$2.lang = lang;\n\n // FORMATTING\n\n addFormatToken('X', 0, 0, 'unix');\n addFormatToken('x', 0, 0, 'valueOf');\n\n // PARSING\n\n addRegexToken('x', matchSigned);\n addRegexToken('X', matchTimestamp);\n addParseToken('X', function (input, array, config) {\n config._d = new Date(parseFloat(input) * 1000);\n });\n addParseToken('x', function (input, array, config) {\n config._d = new Date(toInt(input));\n });\n\n //! moment.js\n\n hooks.version = '2.29.1';\n\n setHookCallback(createLocal);\n\n hooks.fn = proto;\n hooks.min = min;\n hooks.max = max;\n hooks.now = now;\n hooks.utc = createUTC;\n hooks.unix = createUnix;\n hooks.months = listMonths;\n hooks.isDate = isDate;\n hooks.locale = getSetGlobalLocale;\n hooks.invalid = createInvalid;\n hooks.duration = createDuration;\n hooks.isMoment = isMoment;\n hooks.weekdays = listWeekdays;\n hooks.parseZone = createInZone;\n hooks.localeData = getLocale;\n hooks.isDuration = isDuration;\n hooks.monthsShort = listMonthsShort;\n hooks.weekdaysMin = listWeekdaysMin;\n hooks.defineLocale = defineLocale;\n hooks.updateLocale = updateLocale;\n hooks.locales = listLocales;\n hooks.weekdaysShort = listWeekdaysShort;\n hooks.normalizeUnits = normalizeUnits;\n hooks.relativeTimeRounding = getSetRelativeTimeRounding;\n hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;\n hooks.calendarFormat = getCalendarFormat;\n hooks.prototype = proto;\n\n // currently HTML5 input type only supports 24-hour formats\n hooks.HTML5_FMT = {\n DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // <input type=\"datetime-local\" />\n DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // <input type=\"datetime-local\" step=\"1\" />\n DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // <input type=\"datetime-local\" step=\"0.001\" />\n DATE: 'YYYY-MM-DD', // <input type=\"date\" />\n TIME: 'HH:mm', // <input type=\"time\" />\n TIME_SECONDS: 'HH:mm:ss', // <input type=\"time\" step=\"1\" />\n TIME_MS: 'HH:mm:ss.SSS', // <input type=\"time\" step=\"0.001\" />\n WEEK: 'GGGG-[W]WW', // <input type=\"week\" />\n MONTH: 'YYYY-MM', // <input type=\"month\" />\n };\n\n return hooks;\n\n})));\n","/*!\n * Chart.js v2.9.4\n * https://www.chartjs.org\n * (c) 2020 Chart.js Contributors\n * Released under the MIT License\n */\n(function (global, factory) {\ntypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(function() { try { return require('moment'); } catch(e) { } }()) :\ntypeof define === 'function' && define.amd ? define(['require'], function(require) { return factory(function() { try { return require('moment'); } catch(e) { } }()); }) :\n(global = global || self, global.Chart = factory(global.moment));\n}(this, (function (moment) { 'use strict';\n\nmoment = moment && moment.hasOwnProperty('default') ? moment['default'] : moment;\n\nfunction createCommonjsModule(fn, module) {\n\treturn module = { exports: {} }, fn(module, module.exports), module.exports;\n}\n\nfunction getCjsExportFromNamespace (n) {\n\treturn n && n['default'] || n;\n}\n\nvar colorName = {\r\n\t\"aliceblue\": [240, 248, 255],\r\n\t\"antiquewhite\": [250, 235, 215],\r\n\t\"aqua\": [0, 255, 255],\r\n\t\"aquamarine\": [127, 255, 212],\r\n\t\"azure\": [240, 255, 255],\r\n\t\"beige\": [245, 245, 220],\r\n\t\"bisque\": [255, 228, 196],\r\n\t\"black\": [0, 0, 0],\r\n\t\"blanchedalmond\": [255, 235, 205],\r\n\t\"blue\": [0, 0, 255],\r\n\t\"blueviolet\": [138, 43, 226],\r\n\t\"brown\": [165, 42, 42],\r\n\t\"burlywood\": [222, 184, 135],\r\n\t\"cadetblue\": [95, 158, 160],\r\n\t\"chartreuse\": [127, 255, 0],\r\n\t\"chocolate\": [210, 105, 30],\r\n\t\"coral\": [255, 127, 80],\r\n\t\"cornflowerblue\": [100, 149, 237],\r\n\t\"cornsilk\": [255, 248, 220],\r\n\t\"crimson\": [220, 20, 60],\r\n\t\"cyan\": [0, 255, 255],\r\n\t\"darkblue\": [0, 0, 139],\r\n\t\"darkcyan\": [0, 139, 139],\r\n\t\"darkgoldenrod\": [184, 134, 11],\r\n\t\"darkgray\": [169, 169, 169],\r\n\t\"darkgreen\": [0, 100, 0],\r\n\t\"darkgrey\": [169, 169, 169],\r\n\t\"darkkhaki\": [189, 183, 107],\r\n\t\"darkmagenta\": [139, 0, 139],\r\n\t\"darkolivegreen\": [85, 107, 47],\r\n\t\"darkorange\": [255, 140, 0],\r\n\t\"darkorchid\": [153, 50, 204],\r\n\t\"darkred\": [139, 0, 0],\r\n\t\"darksalmon\": [233, 150, 122],\r\n\t\"darkseagreen\": [143, 188, 143],\r\n\t\"darkslateblue\": [72, 61, 139],\r\n\t\"darkslategray\": [47, 79, 79],\r\n\t\"darkslategrey\": [47, 79, 79],\r\n\t\"darkturquoise\": [0, 206, 209],\r\n\t\"darkviolet\": [148, 0, 211],\r\n\t\"deeppink\": [255, 20, 147],\r\n\t\"deepskyblue\": [0, 191, 255],\r\n\t\"dimgray\": [105, 105, 105],\r\n\t\"dimgrey\": [105, 105, 105],\r\n\t\"dodgerblue\": [30, 144, 255],\r\n\t\"firebrick\": [178, 34, 34],\r\n\t\"floralwhite\": [255, 250, 240],\r\n\t\"forestgreen\": [34, 139, 34],\r\n\t\"fuchsia\": [255, 0, 255],\r\n\t\"gainsboro\": [220, 220, 220],\r\n\t\"ghostwhite\": [248, 248, 255],\r\n\t\"gold\": [255, 215, 0],\r\n\t\"goldenrod\": [218, 165, 32],\r\n\t\"gray\": [128, 128, 128],\r\n\t\"green\": [0, 128, 0],\r\n\t\"greenyellow\": [173, 255, 47],\r\n\t\"grey\": [128, 128, 128],\r\n\t\"honeydew\": [240, 255, 240],\r\n\t\"hotpink\": [255, 105, 180],\r\n\t\"indianred\": [205, 92, 92],\r\n\t\"indigo\": [75, 0, 130],\r\n\t\"ivory\": [255, 255, 240],\r\n\t\"khaki\": [240, 230, 140],\r\n\t\"lavender\": [230, 230, 250],\r\n\t\"lavenderblush\": [255, 240, 245],\r\n\t\"lawngreen\": [124, 252, 0],\r\n\t\"lemonchiffon\": [255, 250, 205],\r\n\t\"lightblue\": [173, 216, 230],\r\n\t\"lightcoral\": [240, 128, 128],\r\n\t\"lightcyan\": [224, 255, 255],\r\n\t\"lightgoldenrodyellow\": [250, 250, 210],\r\n\t\"lightgray\": [211, 211, 211],\r\n\t\"lightgreen\": [144, 238, 144],\r\n\t\"lightgrey\": [211, 211, 211],\r\n\t\"lightpink\": [255, 182, 193],\r\n\t\"lightsalmon\": [255, 160, 122],\r\n\t\"lightseagreen\": [32, 178, 170],\r\n\t\"lightskyblue\": [135, 206, 250],\r\n\t\"lightslategray\": [119, 136, 153],\r\n\t\"lightslategrey\": [119, 136, 153],\r\n\t\"lightsteelblue\": [176, 196, 222],\r\n\t\"lightyellow\": [255, 255, 224],\r\n\t\"lime\": [0, 255, 0],\r\n\t\"limegreen\": [50, 205, 50],\r\n\t\"linen\": [250, 240, 230],\r\n\t\"magenta\": [255, 0, 255],\r\n\t\"maroon\": [128, 0, 0],\r\n\t\"mediumaquamarine\": [102, 205, 170],\r\n\t\"mediumblue\": [0, 0, 205],\r\n\t\"mediumorchid\": [186, 85, 211],\r\n\t\"mediumpurple\": [147, 112, 219],\r\n\t\"mediumseagreen\": [60, 179, 113],\r\n\t\"mediumslateblue\": [123, 104, 238],\r\n\t\"mediumspringgreen\": [0, 250, 154],\r\n\t\"mediumturquoise\": [72, 209, 204],\r\n\t\"mediumvioletred\": [199, 21, 133],\r\n\t\"midnightblue\": [25, 25, 112],\r\n\t\"mintcream\": [245, 255, 250],\r\n\t\"mistyrose\": [255, 228, 225],\r\n\t\"moccasin\": [255, 228, 181],\r\n\t\"navajowhite\": [255, 222, 173],\r\n\t\"navy\": [0, 0, 128],\r\n\t\"oldlace\": [253, 245, 230],\r\n\t\"olive\": [128, 128, 0],\r\n\t\"olivedrab\": [107, 142, 35],\r\n\t\"orange\": [255, 165, 0],\r\n\t\"orangered\": [255, 69, 0],\r\n\t\"orchid\": [218, 112, 214],\r\n\t\"palegoldenrod\": [238, 232, 170],\r\n\t\"palegreen\": [152, 251, 152],\r\n\t\"paleturquoise\": [175, 238, 238],\r\n\t\"palevioletred\": [219, 112, 147],\r\n\t\"papayawhip\": [255, 239, 213],\r\n\t\"peachpuff\": [255, 218, 185],\r\n\t\"peru\": [205, 133, 63],\r\n\t\"pink\": [255, 192, 203],\r\n\t\"plum\": [221, 160, 221],\r\n\t\"powderblue\": [176, 224, 230],\r\n\t\"purple\": [128, 0, 128],\r\n\t\"rebeccapurple\": [102, 51, 153],\r\n\t\"red\": [255, 0, 0],\r\n\t\"rosybrown\": [188, 143, 143],\r\n\t\"royalblue\": [65, 105, 225],\r\n\t\"saddlebrown\": [139, 69, 19],\r\n\t\"salmon\": [250, 128, 114],\r\n\t\"sandybrown\": [244, 164, 96],\r\n\t\"seagreen\": [46, 139, 87],\r\n\t\"seashell\": [255, 245, 238],\r\n\t\"sienna\": [160, 82, 45],\r\n\t\"silver\": [192, 192, 192],\r\n\t\"skyblue\": [135, 206, 235],\r\n\t\"slateblue\": [106, 90, 205],\r\n\t\"slategray\": [112, 128, 144],\r\n\t\"slategrey\": [112, 128, 144],\r\n\t\"snow\": [255, 250, 250],\r\n\t\"springgreen\": [0, 255, 127],\r\n\t\"steelblue\": [70, 130, 180],\r\n\t\"tan\": [210, 180, 140],\r\n\t\"teal\": [0, 128, 128],\r\n\t\"thistle\": [216, 191, 216],\r\n\t\"tomato\": [255, 99, 71],\r\n\t\"turquoise\": [64, 224, 208],\r\n\t\"violet\": [238, 130, 238],\r\n\t\"wheat\": [245, 222, 179],\r\n\t\"white\": [255, 255, 255],\r\n\t\"whitesmoke\": [245, 245, 245],\r\n\t\"yellow\": [255, 255, 0],\r\n\t\"yellowgreen\": [154, 205, 50]\r\n};\n\nvar conversions = createCommonjsModule(function (module) {\n/* MIT license */\n\n\n// NOTE: conversions should only return primitive values (i.e. arrays, or\n// values that give correct `typeof` results).\n// do not use box values types (i.e. Number(), String(), etc.)\n\nvar reverseKeywords = {};\nfor (var key in colorName) {\n\tif (colorName.hasOwnProperty(key)) {\n\t\treverseKeywords[colorName[key]] = key;\n\t}\n}\n\nvar convert = module.exports = {\n\trgb: {channels: 3, labels: 'rgb'},\n\thsl: {channels: 3, labels: 'hsl'},\n\thsv: {channels: 3, labels: 'hsv'},\n\thwb: {channels: 3, labels: 'hwb'},\n\tcmyk: {channels: 4, labels: 'cmyk'},\n\txyz: {channels: 3, labels: 'xyz'},\n\tlab: {channels: 3, labels: 'lab'},\n\tlch: {channels: 3, labels: 'lch'},\n\thex: {channels: 1, labels: ['hex']},\n\tkeyword: {channels: 1, labels: ['keyword']},\n\tansi16: {channels: 1, labels: ['ansi16']},\n\tansi256: {channels: 1, labels: ['ansi256']},\n\thcg: {channels: 3, labels: ['h', 'c', 'g']},\n\tapple: {channels: 3, labels: ['r16', 'g16', 'b16']},\n\tgray: {channels: 1, labels: ['gray']}\n};\n\n// hide .channels and .labels properties\nfor (var model in convert) {\n\tif (convert.hasOwnProperty(model)) {\n\t\tif (!('channels' in convert[model])) {\n\t\t\tthrow new Error('missing channels property: ' + model);\n\t\t}\n\n\t\tif (!('labels' in convert[model])) {\n\t\t\tthrow new Error('missing channel labels property: ' + model);\n\t\t}\n\n\t\tif (convert[model].labels.length !== convert[model].channels) {\n\t\t\tthrow new Error('channel and label counts mismatch: ' + model);\n\t\t}\n\n\t\tvar channels = convert[model].channels;\n\t\tvar labels = convert[model].labels;\n\t\tdelete convert[model].channels;\n\t\tdelete convert[model].labels;\n\t\tObject.defineProperty(convert[model], 'channels', {value: channels});\n\t\tObject.defineProperty(convert[model], 'labels', {value: labels});\n\t}\n}\n\nconvert.rgb.hsl = function (rgb) {\n\tvar r = rgb[0] / 255;\n\tvar g = rgb[1] / 255;\n\tvar b = rgb[2] / 255;\n\tvar min = Math.min(r, g, b);\n\tvar max = Math.max(r, g, b);\n\tvar delta = max - min;\n\tvar h;\n\tvar s;\n\tvar l;\n\n\tif (max === min) {\n\t\th = 0;\n\t} else if (r === max) {\n\t\th = (g - b) / delta;\n\t} else if (g === max) {\n\t\th = 2 + (b - r) / delta;\n\t} else if (b === max) {\n\t\th = 4 + (r - g) / delta;\n\t}\n\n\th = Math.min(h * 60, 360);\n\n\tif (h < 0) {\n\t\th += 360;\n\t}\n\n\tl = (min + max) / 2;\n\n\tif (max === min) {\n\t\ts = 0;\n\t} else if (l <= 0.5) {\n\t\ts = delta / (max + min);\n\t} else {\n\t\ts = delta / (2 - max - min);\n\t}\n\n\treturn [h, s * 100, l * 100];\n};\n\nconvert.rgb.hsv = function (rgb) {\n\tvar rdif;\n\tvar gdif;\n\tvar bdif;\n\tvar h;\n\tvar s;\n\n\tvar r = rgb[0] / 255;\n\tvar g = rgb[1] / 255;\n\tvar b = rgb[2] / 255;\n\tvar v = Math.max(r, g, b);\n\tvar diff = v - Math.min(r, g, b);\n\tvar diffc = function (c) {\n\t\treturn (v - c) / 6 / diff + 1 / 2;\n\t};\n\n\tif (diff === 0) {\n\t\th = s = 0;\n\t} else {\n\t\ts = diff / v;\n\t\trdif = diffc(r);\n\t\tgdif = diffc(g);\n\t\tbdif = diffc(b);\n\n\t\tif (r === v) {\n\t\t\th = bdif - gdif;\n\t\t} else if (g === v) {\n\t\t\th = (1 / 3) + rdif - bdif;\n\t\t} else if (b === v) {\n\t\t\th = (2 / 3) + gdif - rdif;\n\t\t}\n\t\tif (h < 0) {\n\t\t\th += 1;\n\t\t} else if (h > 1) {\n\t\t\th -= 1;\n\t\t}\n\t}\n\n\treturn [\n\t\th * 360,\n\t\ts * 100,\n\t\tv * 100\n\t];\n};\n\nconvert.rgb.hwb = function (rgb) {\n\tvar r = rgb[0];\n\tvar g = rgb[1];\n\tvar b = rgb[2];\n\tvar h = convert.rgb.hsl(rgb)[0];\n\tvar w = 1 / 255 * Math.min(r, Math.min(g, b));\n\n\tb = 1 - 1 / 255 * Math.max(r, Math.max(g, b));\n\n\treturn [h, w * 100, b * 100];\n};\n\nconvert.rgb.cmyk = function (rgb) {\n\tvar r = rgb[0] / 255;\n\tvar g = rgb[1] / 255;\n\tvar b = rgb[2] / 255;\n\tvar c;\n\tvar m;\n\tvar y;\n\tvar k;\n\n\tk = Math.min(1 - r, 1 - g, 1 - b);\n\tc = (1 - r - k) / (1 - k) || 0;\n\tm = (1 - g - k) / (1 - k) || 0;\n\ty = (1 - b - k) / (1 - k) || 0;\n\n\treturn [c * 100, m * 100, y * 100, k * 100];\n};\n\n/**\n * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance\n * */\nfunction comparativeDistance(x, y) {\n\treturn (\n\t\tMath.pow(x[0] - y[0], 2) +\n\t\tMath.pow(x[1] - y[1], 2) +\n\t\tMath.pow(x[2] - y[2], 2)\n\t);\n}\n\nconvert.rgb.keyword = function (rgb) {\n\tvar reversed = reverseKeywords[rgb];\n\tif (reversed) {\n\t\treturn reversed;\n\t}\n\n\tvar currentClosestDistance = Infinity;\n\tvar currentClosestKeyword;\n\n\tfor (var keyword in colorName) {\n\t\tif (colorName.hasOwnProperty(keyword)) {\n\t\t\tvar value = colorName[keyword];\n\n\t\t\t// Compute comparative distance\n\t\t\tvar distance = comparativeDistance(rgb, value);\n\n\t\t\t// Check if its less, if so set as closest\n\t\t\tif (distance < currentClosestDistance) {\n\t\t\t\tcurrentClosestDistance = distance;\n\t\t\t\tcurrentClosestKeyword = keyword;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn currentClosestKeyword;\n};\n\nconvert.keyword.rgb = function (keyword) {\n\treturn colorName[keyword];\n};\n\nconvert.rgb.xyz = function (rgb) {\n\tvar r = rgb[0] / 255;\n\tvar g = rgb[1] / 255;\n\tvar b = rgb[2] / 255;\n\n\t// assume sRGB\n\tr = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);\n\tg = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);\n\tb = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);\n\n\tvar x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);\n\tvar y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);\n\tvar z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);\n\n\treturn [x * 100, y * 100, z * 100];\n};\n\nconvert.rgb.lab = function (rgb) {\n\tvar xyz = convert.rgb.xyz(rgb);\n\tvar x = xyz[0];\n\tvar y = xyz[1];\n\tvar z = xyz[2];\n\tvar l;\n\tvar a;\n\tvar b;\n\n\tx /= 95.047;\n\ty /= 100;\n\tz /= 108.883;\n\n\tx = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);\n\ty = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);\n\tz = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);\n\n\tl = (116 * y) - 16;\n\ta = 500 * (x - y);\n\tb = 200 * (y - z);\n\n\treturn [l, a, b];\n};\n\nconvert.hsl.rgb = function (hsl) {\n\tvar h = hsl[0] / 360;\n\tvar s = hsl[1] / 100;\n\tvar l = hsl[2] / 100;\n\tvar t1;\n\tvar t2;\n\tvar t3;\n\tvar rgb;\n\tvar val;\n\n\tif (s === 0) {\n\t\tval = l * 255;\n\t\treturn [val, val, val];\n\t}\n\n\tif (l < 0.5) {\n\t\tt2 = l * (1 + s);\n\t} else {\n\t\tt2 = l + s - l * s;\n\t}\n\n\tt1 = 2 * l - t2;\n\n\trgb = [0, 0, 0];\n\tfor (var i = 0; i < 3; i++) {\n\t\tt3 = h + 1 / 3 * -(i - 1);\n\t\tif (t3 < 0) {\n\t\t\tt3++;\n\t\t}\n\t\tif (t3 > 1) {\n\t\t\tt3--;\n\t\t}\n\n\t\tif (6 * t3 < 1) {\n\t\t\tval = t1 + (t2 - t1) * 6 * t3;\n\t\t} else if (2 * t3 < 1) {\n\t\t\tval = t2;\n\t\t} else if (3 * t3 < 2) {\n\t\t\tval = t1 + (t2 - t1) * (2 / 3 - t3) * 6;\n\t\t} else {\n\t\t\tval = t1;\n\t\t}\n\n\t\trgb[i] = val * 255;\n\t}\n\n\treturn rgb;\n};\n\nconvert.hsl.hsv = function (hsl) {\n\tvar h = hsl[0];\n\tvar s = hsl[1] / 100;\n\tvar l = hsl[2] / 100;\n\tvar smin = s;\n\tvar lmin = Math.max(l, 0.01);\n\tvar sv;\n\tvar v;\n\n\tl *= 2;\n\ts *= (l <= 1) ? l : 2 - l;\n\tsmin *= lmin <= 1 ? lmin : 2 - lmin;\n\tv = (l + s) / 2;\n\tsv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);\n\n\treturn [h, sv * 100, v * 100];\n};\n\nconvert.hsv.rgb = function (hsv) {\n\tvar h = hsv[0] / 60;\n\tvar s = hsv[1] / 100;\n\tvar v = hsv[2] / 100;\n\tvar hi = Math.floor(h) % 6;\n\n\tvar f = h - Math.floor(h);\n\tvar p = 255 * v * (1 - s);\n\tvar q = 255 * v * (1 - (s * f));\n\tvar t = 255 * v * (1 - (s * (1 - f)));\n\tv *= 255;\n\n\tswitch (hi) {\n\t\tcase 0:\n\t\t\treturn [v, t, p];\n\t\tcase 1:\n\t\t\treturn [q, v, p];\n\t\tcase 2:\n\t\t\treturn [p, v, t];\n\t\tcase 3:\n\t\t\treturn [p, q, v];\n\t\tcase 4:\n\t\t\treturn [t, p, v];\n\t\tcase 5:\n\t\t\treturn [v, p, q];\n\t}\n};\n\nconvert.hsv.hsl = function (hsv) {\n\tvar h = hsv[0];\n\tvar s = hsv[1] / 100;\n\tvar v = hsv[2] / 100;\n\tvar vmin = Math.max(v, 0.01);\n\tvar lmin;\n\tvar sl;\n\tvar l;\n\n\tl = (2 - s) * v;\n\tlmin = (2 - s) * vmin;\n\tsl = s * vmin;\n\tsl /= (lmin <= 1) ? lmin : 2 - lmin;\n\tsl = sl || 0;\n\tl /= 2;\n\n\treturn [h, sl * 100, l * 100];\n};\n\n// http://dev.w3.org/csswg/css-color/#hwb-to-rgb\nconvert.hwb.rgb = function (hwb) {\n\tvar h = hwb[0] / 360;\n\tvar wh = hwb[1] / 100;\n\tvar bl = hwb[2] / 100;\n\tvar ratio = wh + bl;\n\tvar i;\n\tvar v;\n\tvar f;\n\tvar n;\n\n\t// wh + bl cant be > 1\n\tif (ratio > 1) {\n\t\twh /= ratio;\n\t\tbl /= ratio;\n\t}\n\n\ti = Math.floor(6 * h);\n\tv = 1 - bl;\n\tf = 6 * h - i;\n\n\tif ((i & 0x01) !== 0) {\n\t\tf = 1 - f;\n\t}\n\n\tn = wh + f * (v - wh); // linear interpolation\n\n\tvar r;\n\tvar g;\n\tvar b;\n\tswitch (i) {\n\t\tdefault:\n\t\tcase 6:\n\t\tcase 0: r = v; g = n; b = wh; break;\n\t\tcase 1: r = n; g = v; b = wh; break;\n\t\tcase 2: r = wh; g = v; b = n; break;\n\t\tcase 3: r = wh; g = n; b = v; break;\n\t\tcase 4: r = n; g = wh; b = v; break;\n\t\tcase 5: r = v; g = wh; b = n; break;\n\t}\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.cmyk.rgb = function (cmyk) {\n\tvar c = cmyk[0] / 100;\n\tvar m = cmyk[1] / 100;\n\tvar y = cmyk[2] / 100;\n\tvar k = cmyk[3] / 100;\n\tvar r;\n\tvar g;\n\tvar b;\n\n\tr = 1 - Math.min(1, c * (1 - k) + k);\n\tg = 1 - Math.min(1, m * (1 - k) + k);\n\tb = 1 - Math.min(1, y * (1 - k) + k);\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.xyz.rgb = function (xyz) {\n\tvar x = xyz[0] / 100;\n\tvar y = xyz[1] / 100;\n\tvar z = xyz[2] / 100;\n\tvar r;\n\tvar g;\n\tvar b;\n\n\tr = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);\n\tg = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);\n\tb = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);\n\n\t// assume sRGB\n\tr = r > 0.0031308\n\t\t? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)\n\t\t: r * 12.92;\n\n\tg = g > 0.0031308\n\t\t? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)\n\t\t: g * 12.92;\n\n\tb = b > 0.0031308\n\t\t? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)\n\t\t: b * 12.92;\n\n\tr = Math.min(Math.max(0, r), 1);\n\tg = Math.min(Math.max(0, g), 1);\n\tb = Math.min(Math.max(0, b), 1);\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.xyz.lab = function (xyz) {\n\tvar x = xyz[0];\n\tvar y = xyz[1];\n\tvar z = xyz[2];\n\tvar l;\n\tvar a;\n\tvar b;\n\n\tx /= 95.047;\n\ty /= 100;\n\tz /= 108.883;\n\n\tx = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);\n\ty = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);\n\tz = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);\n\n\tl = (116 * y) - 16;\n\ta = 500 * (x - y);\n\tb = 200 * (y - z);\n\n\treturn [l, a, b];\n};\n\nconvert.lab.xyz = function (lab) {\n\tvar l = lab[0];\n\tvar a = lab[1];\n\tvar b = lab[2];\n\tvar x;\n\tvar y;\n\tvar z;\n\n\ty = (l + 16) / 116;\n\tx = a / 500 + y;\n\tz = y - b / 200;\n\n\tvar y2 = Math.pow(y, 3);\n\tvar x2 = Math.pow(x, 3);\n\tvar z2 = Math.pow(z, 3);\n\ty = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;\n\tx = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;\n\tz = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;\n\n\tx *= 95.047;\n\ty *= 100;\n\tz *= 108.883;\n\n\treturn [x, y, z];\n};\n\nconvert.lab.lch = function (lab) {\n\tvar l = lab[0];\n\tvar a = lab[1];\n\tvar b = lab[2];\n\tvar hr;\n\tvar h;\n\tvar c;\n\n\thr = Math.atan2(b, a);\n\th = hr * 360 / 2 / Math.PI;\n\n\tif (h < 0) {\n\t\th += 360;\n\t}\n\n\tc = Math.sqrt(a * a + b * b);\n\n\treturn [l, c, h];\n};\n\nconvert.lch.lab = function (lch) {\n\tvar l = lch[0];\n\tvar c = lch[1];\n\tvar h = lch[2];\n\tvar a;\n\tvar b;\n\tvar hr;\n\n\thr = h / 360 * 2 * Math.PI;\n\ta = c * Math.cos(hr);\n\tb = c * Math.sin(hr);\n\n\treturn [l, a, b];\n};\n\nconvert.rgb.ansi16 = function (args) {\n\tvar r = args[0];\n\tvar g = args[1];\n\tvar b = args[2];\n\tvar value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization\n\n\tvalue = Math.round(value / 50);\n\n\tif (value === 0) {\n\t\treturn 30;\n\t}\n\n\tvar ansi = 30\n\t\t+ ((Math.round(b / 255) << 2)\n\t\t| (Math.round(g / 255) << 1)\n\t\t| Math.round(r / 255));\n\n\tif (value === 2) {\n\t\tansi += 60;\n\t}\n\n\treturn ansi;\n};\n\nconvert.hsv.ansi16 = function (args) {\n\t// optimization here; we already know the value and don't need to get\n\t// it converted for us.\n\treturn convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);\n};\n\nconvert.rgb.ansi256 = function (args) {\n\tvar r = args[0];\n\tvar g = args[1];\n\tvar b = args[2];\n\n\t// we use the extended greyscale palette here, with the exception of\n\t// black and white. normal palette only has 4 greyscale shades.\n\tif (r === g && g === b) {\n\t\tif (r < 8) {\n\t\t\treturn 16;\n\t\t}\n\n\t\tif (r > 248) {\n\t\t\treturn 231;\n\t\t}\n\n\t\treturn Math.round(((r - 8) / 247) * 24) + 232;\n\t}\n\n\tvar ansi = 16\n\t\t+ (36 * Math.round(r / 255 * 5))\n\t\t+ (6 * Math.round(g / 255 * 5))\n\t\t+ Math.round(b / 255 * 5);\n\n\treturn ansi;\n};\n\nconvert.ansi16.rgb = function (args) {\n\tvar color = args % 10;\n\n\t// handle greyscale\n\tif (color === 0 || color === 7) {\n\t\tif (args > 50) {\n\t\t\tcolor += 3.5;\n\t\t}\n\n\t\tcolor = color / 10.5 * 255;\n\n\t\treturn [color, color, color];\n\t}\n\n\tvar mult = (~~(args > 50) + 1) * 0.5;\n\tvar r = ((color & 1) * mult) * 255;\n\tvar g = (((color >> 1) & 1) * mult) * 255;\n\tvar b = (((color >> 2) & 1) * mult) * 255;\n\n\treturn [r, g, b];\n};\n\nconvert.ansi256.rgb = function (args) {\n\t// handle greyscale\n\tif (args >= 232) {\n\t\tvar c = (args - 232) * 10 + 8;\n\t\treturn [c, c, c];\n\t}\n\n\targs -= 16;\n\n\tvar rem;\n\tvar r = Math.floor(args / 36) / 5 * 255;\n\tvar g = Math.floor((rem = args % 36) / 6) / 5 * 255;\n\tvar b = (rem % 6) / 5 * 255;\n\n\treturn [r, g, b];\n};\n\nconvert.rgb.hex = function (args) {\n\tvar integer = ((Math.round(args[0]) & 0xFF) << 16)\n\t\t+ ((Math.round(args[1]) & 0xFF) << 8)\n\t\t+ (Math.round(args[2]) & 0xFF);\n\n\tvar string = integer.toString(16).toUpperCase();\n\treturn '000000'.substring(string.length) + string;\n};\n\nconvert.hex.rgb = function (args) {\n\tvar match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);\n\tif (!match) {\n\t\treturn [0, 0, 0];\n\t}\n\n\tvar colorString = match[0];\n\n\tif (match[0].length === 3) {\n\t\tcolorString = colorString.split('').map(function (char) {\n\t\t\treturn char + char;\n\t\t}).join('');\n\t}\n\n\tvar integer = parseInt(colorString, 16);\n\tvar r = (integer >> 16) & 0xFF;\n\tvar g = (integer >> 8) & 0xFF;\n\tvar b = integer & 0xFF;\n\n\treturn [r, g, b];\n};\n\nconvert.rgb.hcg = function (rgb) {\n\tvar r = rgb[0] / 255;\n\tvar g = rgb[1] / 255;\n\tvar b = rgb[2] / 255;\n\tvar max = Math.max(Math.max(r, g), b);\n\tvar min = Math.min(Math.min(r, g), b);\n\tvar chroma = (max - min);\n\tvar grayscale;\n\tvar hue;\n\n\tif (chroma < 1) {\n\t\tgrayscale = min / (1 - chroma);\n\t} else {\n\t\tgrayscale = 0;\n\t}\n\n\tif (chroma <= 0) {\n\t\thue = 0;\n\t} else\n\tif (max === r) {\n\t\thue = ((g - b) / chroma) % 6;\n\t} else\n\tif (max === g) {\n\t\thue = 2 + (b - r) / chroma;\n\t} else {\n\t\thue = 4 + (r - g) / chroma + 4;\n\t}\n\n\thue /= 6;\n\thue %= 1;\n\n\treturn [hue * 360, chroma * 100, grayscale * 100];\n};\n\nconvert.hsl.hcg = function (hsl) {\n\tvar s = hsl[1] / 100;\n\tvar l = hsl[2] / 100;\n\tvar c = 1;\n\tvar f = 0;\n\n\tif (l < 0.5) {\n\t\tc = 2.0 * s * l;\n\t} else {\n\t\tc = 2.0 * s * (1.0 - l);\n\t}\n\n\tif (c < 1.0) {\n\t\tf = (l - 0.5 * c) / (1.0 - c);\n\t}\n\n\treturn [hsl[0], c * 100, f * 100];\n};\n\nconvert.hsv.hcg = function (hsv) {\n\tvar s = hsv[1] / 100;\n\tvar v = hsv[2] / 100;\n\n\tvar c = s * v;\n\tvar f = 0;\n\n\tif (c < 1.0) {\n\t\tf = (v - c) / (1 - c);\n\t}\n\n\treturn [hsv[0], c * 100, f * 100];\n};\n\nconvert.hcg.rgb = function (hcg) {\n\tvar h = hcg[0] / 360;\n\tvar c = hcg[1] / 100;\n\tvar g = hcg[2] / 100;\n\n\tif (c === 0.0) {\n\t\treturn [g * 255, g * 255, g * 255];\n\t}\n\n\tvar pure = [0, 0, 0];\n\tvar hi = (h % 1) * 6;\n\tvar v = hi % 1;\n\tvar w = 1 - v;\n\tvar mg = 0;\n\n\tswitch (Math.floor(hi)) {\n\t\tcase 0:\n\t\t\tpure[0] = 1; pure[1] = v; pure[2] = 0; break;\n\t\tcase 1:\n\t\t\tpure[0] = w; pure[1] = 1; pure[2] = 0; break;\n\t\tcase 2:\n\t\t\tpure[0] = 0; pure[1] = 1; pure[2] = v; break;\n\t\tcase 3:\n\t\t\tpure[0] = 0; pure[1] = w; pure[2] = 1; break;\n\t\tcase 4:\n\t\t\tpure[0] = v; pure[1] = 0; pure[2] = 1; break;\n\t\tdefault:\n\t\t\tpure[0] = 1; pure[1] = 0; pure[2] = w;\n\t}\n\n\tmg = (1.0 - c) * g;\n\n\treturn [\n\t\t(c * pure[0] + mg) * 255,\n\t\t(c * pure[1] + mg) * 255,\n\t\t(c * pure[2] + mg) * 255\n\t];\n};\n\nconvert.hcg.hsv = function (hcg) {\n\tvar c = hcg[1] / 100;\n\tvar g = hcg[2] / 100;\n\n\tvar v = c + g * (1.0 - c);\n\tvar f = 0;\n\n\tif (v > 0.0) {\n\t\tf = c / v;\n\t}\n\n\treturn [hcg[0], f * 100, v * 100];\n};\n\nconvert.hcg.hsl = function (hcg) {\n\tvar c = hcg[1] / 100;\n\tvar g = hcg[2] / 100;\n\n\tvar l = g * (1.0 - c) + 0.5 * c;\n\tvar s = 0;\n\n\tif (l > 0.0 && l < 0.5) {\n\t\ts = c / (2 * l);\n\t} else\n\tif (l >= 0.5 && l < 1.0) {\n\t\ts = c / (2 * (1 - l));\n\t}\n\n\treturn [hcg[0], s * 100, l * 100];\n};\n\nconvert.hcg.hwb = function (hcg) {\n\tvar c = hcg[1] / 100;\n\tvar g = hcg[2] / 100;\n\tvar v = c + g * (1.0 - c);\n\treturn [hcg[0], (v - c) * 100, (1 - v) * 100];\n};\n\nconvert.hwb.hcg = function (hwb) {\n\tvar w = hwb[1] / 100;\n\tvar b = hwb[2] / 100;\n\tvar v = 1 - b;\n\tvar c = v - w;\n\tvar g = 0;\n\n\tif (c < 1) {\n\t\tg = (v - c) / (1 - c);\n\t}\n\n\treturn [hwb[0], c * 100, g * 100];\n};\n\nconvert.apple.rgb = function (apple) {\n\treturn [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];\n};\n\nconvert.rgb.apple = function (rgb) {\n\treturn [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];\n};\n\nconvert.gray.rgb = function (args) {\n\treturn [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];\n};\n\nconvert.gray.hsl = convert.gray.hsv = function (args) {\n\treturn [0, 0, args[0]];\n};\n\nconvert.gray.hwb = function (gray) {\n\treturn [0, 100, gray[0]];\n};\n\nconvert.gray.cmyk = function (gray) {\n\treturn [0, 0, 0, gray[0]];\n};\n\nconvert.gray.lab = function (gray) {\n\treturn [gray[0], 0, 0];\n};\n\nconvert.gray.hex = function (gray) {\n\tvar val = Math.round(gray[0] / 100 * 255) & 0xFF;\n\tvar integer = (val << 16) + (val << 8) + val;\n\n\tvar string = integer.toString(16).toUpperCase();\n\treturn '000000'.substring(string.length) + string;\n};\n\nconvert.rgb.gray = function (rgb) {\n\tvar val = (rgb[0] + rgb[1] + rgb[2]) / 3;\n\treturn [val / 255 * 100];\n};\n});\nvar conversions_1 = conversions.rgb;\nvar conversions_2 = conversions.hsl;\nvar conversions_3 = conversions.hsv;\nvar conversions_4 = conversions.hwb;\nvar conversions_5 = conversions.cmyk;\nvar conversions_6 = conversions.xyz;\nvar conversions_7 = conversions.lab;\nvar conversions_8 = conversions.lch;\nvar conversions_9 = conversions.hex;\nvar conversions_10 = conversions.keyword;\nvar conversions_11 = conversions.ansi16;\nvar conversions_12 = conversions.ansi256;\nvar conversions_13 = conversions.hcg;\nvar conversions_14 = conversions.apple;\nvar conversions_15 = conversions.gray;\n\n/*\n\tthis function routes a model to all other models.\n\n\tall functions that are routed have a property `.conversion` attached\n\tto the returned synthetic function. This property is an array\n\tof strings, each with the steps in between the 'from' and 'to'\n\tcolor models (inclusive).\n\n\tconversions that are not possible simply are not included.\n*/\n\nfunction buildGraph() {\n\tvar graph = {};\n\t// https://jsperf.com/object-keys-vs-for-in-with-closure/3\n\tvar models = Object.keys(conversions);\n\n\tfor (var len = models.length, i = 0; i < len; i++) {\n\t\tgraph[models[i]] = {\n\t\t\t// http://jsperf.com/1-vs-infinity\n\t\t\t// micro-opt, but this is simple.\n\t\t\tdistance: -1,\n\t\t\tparent: null\n\t\t};\n\t}\n\n\treturn graph;\n}\n\n// https://en.wikipedia.org/wiki/Breadth-first_search\nfunction deriveBFS(fromModel) {\n\tvar graph = buildGraph();\n\tvar queue = [fromModel]; // unshift -> queue -> pop\n\n\tgraph[fromModel].distance = 0;\n\n\twhile (queue.length) {\n\t\tvar current = queue.pop();\n\t\tvar adjacents = Object.keys(conversions[current]);\n\n\t\tfor (var len = adjacents.length, i = 0; i < len; i++) {\n\t\t\tvar adjacent = adjacents[i];\n\t\t\tvar node = graph[adjacent];\n\n\t\t\tif (node.distance === -1) {\n\t\t\t\tnode.distance = graph[current].distance + 1;\n\t\t\t\tnode.parent = current;\n\t\t\t\tqueue.unshift(adjacent);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn graph;\n}\n\nfunction link(from, to) {\n\treturn function (args) {\n\t\treturn to(from(args));\n\t};\n}\n\nfunction wrapConversion(toModel, graph) {\n\tvar path = [graph[toModel].parent, toModel];\n\tvar fn = conversions[graph[toModel].parent][toModel];\n\n\tvar cur = graph[toModel].parent;\n\twhile (graph[cur].parent) {\n\t\tpath.unshift(graph[cur].parent);\n\t\tfn = link(conversions[graph[cur].parent][cur], fn);\n\t\tcur = graph[cur].parent;\n\t}\n\n\tfn.conversion = path;\n\treturn fn;\n}\n\nvar route = function (fromModel) {\n\tvar graph = deriveBFS(fromModel);\n\tvar conversion = {};\n\n\tvar models = Object.keys(graph);\n\tfor (var len = models.length, i = 0; i < len; i++) {\n\t\tvar toModel = models[i];\n\t\tvar node = graph[toModel];\n\n\t\tif (node.parent === null) {\n\t\t\t// no possible conversion, or this node is the source model.\n\t\t\tcontinue;\n\t\t}\n\n\t\tconversion[toModel] = wrapConversion(toModel, graph);\n\t}\n\n\treturn conversion;\n};\n\nvar convert = {};\n\nvar models = Object.keys(conversions);\n\nfunction wrapRaw(fn) {\n\tvar wrappedFn = function (args) {\n\t\tif (args === undefined || args === null) {\n\t\t\treturn args;\n\t\t}\n\n\t\tif (arguments.length > 1) {\n\t\t\targs = Array.prototype.slice.call(arguments);\n\t\t}\n\n\t\treturn fn(args);\n\t};\n\n\t// preserve .conversion property if there is one\n\tif ('conversion' in fn) {\n\t\twrappedFn.conversion = fn.conversion;\n\t}\n\n\treturn wrappedFn;\n}\n\nfunction wrapRounded(fn) {\n\tvar wrappedFn = function (args) {\n\t\tif (args === undefined || args === null) {\n\t\t\treturn args;\n\t\t}\n\n\t\tif (arguments.length > 1) {\n\t\t\targs = Array.prototype.slice.call(arguments);\n\t\t}\n\n\t\tvar result = fn(args);\n\n\t\t// we're assuming the result is an array here.\n\t\t// see notice in conversions.js; don't use box types\n\t\t// in conversion functions.\n\t\tif (typeof result === 'object') {\n\t\t\tfor (var len = result.length, i = 0; i < len; i++) {\n\t\t\t\tresult[i] = Math.round(result[i]);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t};\n\n\t// preserve .conversion property if there is one\n\tif ('conversion' in fn) {\n\t\twrappedFn.conversion = fn.conversion;\n\t}\n\n\treturn wrappedFn;\n}\n\nmodels.forEach(function (fromModel) {\n\tconvert[fromModel] = {};\n\n\tObject.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});\n\tObject.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});\n\n\tvar routes = route(fromModel);\n\tvar routeModels = Object.keys(routes);\n\n\trouteModels.forEach(function (toModel) {\n\t\tvar fn = routes[toModel];\n\n\t\tconvert[fromModel][toModel] = wrapRounded(fn);\n\t\tconvert[fromModel][toModel].raw = wrapRaw(fn);\n\t});\n});\n\nvar colorConvert = convert;\n\nvar colorName$1 = {\r\n\t\"aliceblue\": [240, 248, 255],\r\n\t\"antiquewhite\": [250, 235, 215],\r\n\t\"aqua\": [0, 255, 255],\r\n\t\"aquamarine\": [127, 255, 212],\r\n\t\"azure\": [240, 255, 255],\r\n\t\"beige\": [245, 245, 220],\r\n\t\"bisque\": [255, 228, 196],\r\n\t\"black\": [0, 0, 0],\r\n\t\"blanchedalmond\": [255, 235, 205],\r\n\t\"blue\": [0, 0, 255],\r\n\t\"blueviolet\": [138, 43, 226],\r\n\t\"brown\": [165, 42, 42],\r\n\t\"burlywood\": [222, 184, 135],\r\n\t\"cadetblue\": [95, 158, 160],\r\n\t\"chartreuse\": [127, 255, 0],\r\n\t\"chocolate\": [210, 105, 30],\r\n\t\"coral\": [255, 127, 80],\r\n\t\"cornflowerblue\": [100, 149, 237],\r\n\t\"cornsilk\": [255, 248, 220],\r\n\t\"crimson\": [220, 20, 60],\r\n\t\"cyan\": [0, 255, 255],\r\n\t\"darkblue\": [0, 0, 139],\r\n\t\"darkcyan\": [0, 139, 139],\r\n\t\"darkgoldenrod\": [184, 134, 11],\r\n\t\"darkgray\": [169, 169, 169],\r\n\t\"darkgreen\": [0, 100, 0],\r\n\t\"darkgrey\": [169, 169, 169],\r\n\t\"darkkhaki\": [189, 183, 107],\r\n\t\"darkmagenta\": [139, 0, 139],\r\n\t\"darkolivegreen\": [85, 107, 47],\r\n\t\"darkorange\": [255, 140, 0],\r\n\t\"darkorchid\": [153, 50, 204],\r\n\t\"darkred\": [139, 0, 0],\r\n\t\"darksalmon\": [233, 150, 122],\r\n\t\"darkseagreen\": [143, 188, 143],\r\n\t\"darkslateblue\": [72, 61, 139],\r\n\t\"darkslategray\": [47, 79, 79],\r\n\t\"darkslategrey\": [47, 79, 79],\r\n\t\"darkturquoise\": [0, 206, 209],\r\n\t\"darkviolet\": [148, 0, 211],\r\n\t\"deeppink\": [255, 20, 147],\r\n\t\"deepskyblue\": [0, 191, 255],\r\n\t\"dimgray\": [105, 105, 105],\r\n\t\"dimgrey\": [105, 105, 105],\r\n\t\"dodgerblue\": [30, 144, 255],\r\n\t\"firebrick\": [178, 34, 34],\r\n\t\"floralwhite\": [255, 250, 240],\r\n\t\"forestgreen\": [34, 139, 34],\r\n\t\"fuchsia\": [255, 0, 255],\r\n\t\"gainsboro\": [220, 220, 220],\r\n\t\"ghostwhite\": [248, 248, 255],\r\n\t\"gold\": [255, 215, 0],\r\n\t\"goldenrod\": [218, 165, 32],\r\n\t\"gray\": [128, 128, 128],\r\n\t\"green\": [0, 128, 0],\r\n\t\"greenyellow\": [173, 255, 47],\r\n\t\"grey\": [128, 128, 128],\r\n\t\"honeydew\": [240, 255, 240],\r\n\t\"hotpink\": [255, 105, 180],\r\n\t\"indianred\": [205, 92, 92],\r\n\t\"indigo\": [75, 0, 130],\r\n\t\"ivory\": [255, 255, 240],\r\n\t\"khaki\": [240, 230, 140],\r\n\t\"lavender\": [230, 230, 250],\r\n\t\"lavenderblush\": [255, 240, 245],\r\n\t\"lawngreen\": [124, 252, 0],\r\n\t\"lemonchiffon\": [255, 250, 205],\r\n\t\"lightblue\": [173, 216, 230],\r\n\t\"lightcoral\": [240, 128, 128],\r\n\t\"lightcyan\": [224, 255, 255],\r\n\t\"lightgoldenrodyellow\": [250, 250, 210],\r\n\t\"lightgray\": [211, 211, 211],\r\n\t\"lightgreen\": [144, 238, 144],\r\n\t\"lightgrey\": [211, 211, 211],\r\n\t\"lightpink\": [255, 182, 193],\r\n\t\"lightsalmon\": [255, 160, 122],\r\n\t\"lightseagreen\": [32, 178, 170],\r\n\t\"lightskyblue\": [135, 206, 250],\r\n\t\"lightslategray\": [119, 136, 153],\r\n\t\"lightslategrey\": [119, 136, 153],\r\n\t\"lightsteelblue\": [176, 196, 222],\r\n\t\"lightyellow\": [255, 255, 224],\r\n\t\"lime\": [0, 255, 0],\r\n\t\"limegreen\": [50, 205, 50],\r\n\t\"linen\": [250, 240, 230],\r\n\t\"magenta\": [255, 0, 255],\r\n\t\"maroon\": [128, 0, 0],\r\n\t\"mediumaquamarine\": [102, 205, 170],\r\n\t\"mediumblue\": [0, 0, 205],\r\n\t\"mediumorchid\": [186, 85, 211],\r\n\t\"mediumpurple\": [147, 112, 219],\r\n\t\"mediumseagreen\": [60, 179, 113],\r\n\t\"mediumslateblue\": [123, 104, 238],\r\n\t\"mediumspringgreen\": [0, 250, 154],\r\n\t\"mediumturquoise\": [72, 209, 204],\r\n\t\"mediumvioletred\": [199, 21, 133],\r\n\t\"midnightblue\": [25, 25, 112],\r\n\t\"mintcream\": [245, 255, 250],\r\n\t\"mistyrose\": [255, 228, 225],\r\n\t\"moccasin\": [255, 228, 181],\r\n\t\"navajowhite\": [255, 222, 173],\r\n\t\"navy\": [0, 0, 128],\r\n\t\"oldlace\": [253, 245, 230],\r\n\t\"olive\": [128, 128, 0],\r\n\t\"olivedrab\": [107, 142, 35],\r\n\t\"orange\": [255, 165, 0],\r\n\t\"orangered\": [255, 69, 0],\r\n\t\"orchid\": [218, 112, 214],\r\n\t\"palegoldenrod\": [238, 232, 170],\r\n\t\"palegreen\": [152, 251, 152],\r\n\t\"paleturquoise\": [175, 238, 238],\r\n\t\"palevioletred\": [219, 112, 147],\r\n\t\"papayawhip\": [255, 239, 213],\r\n\t\"peachpuff\": [255, 218, 185],\r\n\t\"peru\": [205, 133, 63],\r\n\t\"pink\": [255, 192, 203],\r\n\t\"plum\": [221, 160, 221],\r\n\t\"powderblue\": [176, 224, 230],\r\n\t\"purple\": [128, 0, 128],\r\n\t\"rebeccapurple\": [102, 51, 153],\r\n\t\"red\": [255, 0, 0],\r\n\t\"rosybrown\": [188, 143, 143],\r\n\t\"royalblue\": [65, 105, 225],\r\n\t\"saddlebrown\": [139, 69, 19],\r\n\t\"salmon\": [250, 128, 114],\r\n\t\"sandybrown\": [244, 164, 96],\r\n\t\"seagreen\": [46, 139, 87],\r\n\t\"seashell\": [255, 245, 238],\r\n\t\"sienna\": [160, 82, 45],\r\n\t\"silver\": [192, 192, 192],\r\n\t\"skyblue\": [135, 206, 235],\r\n\t\"slateblue\": [106, 90, 205],\r\n\t\"slategray\": [112, 128, 144],\r\n\t\"slategrey\": [112, 128, 144],\r\n\t\"snow\": [255, 250, 250],\r\n\t\"springgreen\": [0, 255, 127],\r\n\t\"steelblue\": [70, 130, 180],\r\n\t\"tan\": [210, 180, 140],\r\n\t\"teal\": [0, 128, 128],\r\n\t\"thistle\": [216, 191, 216],\r\n\t\"tomato\": [255, 99, 71],\r\n\t\"turquoise\": [64, 224, 208],\r\n\t\"violet\": [238, 130, 238],\r\n\t\"wheat\": [245, 222, 179],\r\n\t\"white\": [255, 255, 255],\r\n\t\"whitesmoke\": [245, 245, 245],\r\n\t\"yellow\": [255, 255, 0],\r\n\t\"yellowgreen\": [154, 205, 50]\r\n};\n\n/* MIT license */\n\n\nvar colorString = {\n getRgba: getRgba,\n getHsla: getHsla,\n getRgb: getRgb,\n getHsl: getHsl,\n getHwb: getHwb,\n getAlpha: getAlpha,\n\n hexString: hexString,\n rgbString: rgbString,\n rgbaString: rgbaString,\n percentString: percentString,\n percentaString: percentaString,\n hslString: hslString,\n hslaString: hslaString,\n hwbString: hwbString,\n keyword: keyword\n};\n\nfunction getRgba(string) {\n if (!string) {\n return;\n }\n var abbr = /^#([a-fA-F0-9]{3,4})$/i,\n hex = /^#([a-fA-F0-9]{6}([a-fA-F0-9]{2})?)$/i,\n rgba = /^rgba?\\(\\s*([+-]?\\d+)\\s*,\\s*([+-]?\\d+)\\s*,\\s*([+-]?\\d+)\\s*(?:,\\s*([+-]?[\\d\\.]+)\\s*)?\\)$/i,\n per = /^rgba?\\(\\s*([+-]?[\\d\\.]+)\\%\\s*,\\s*([+-]?[\\d\\.]+)\\%\\s*,\\s*([+-]?[\\d\\.]+)\\%\\s*(?:,\\s*([+-]?[\\d\\.]+)\\s*)?\\)$/i,\n keyword = /(\\w+)/;\n\n var rgb = [0, 0, 0],\n a = 1,\n match = string.match(abbr),\n hexAlpha = \"\";\n if (match) {\n match = match[1];\n hexAlpha = match[3];\n for (var i = 0; i < rgb.length; i++) {\n rgb[i] = parseInt(match[i] + match[i], 16);\n }\n if (hexAlpha) {\n a = Math.round((parseInt(hexAlpha + hexAlpha, 16) / 255) * 100) / 100;\n }\n }\n else if (match = string.match(hex)) {\n hexAlpha = match[2];\n match = match[1];\n for (var i = 0; i < rgb.length; i++) {\n rgb[i] = parseInt(match.slice(i * 2, i * 2 + 2), 16);\n }\n if (hexAlpha) {\n a = Math.round((parseInt(hexAlpha, 16) / 255) * 100) / 100;\n }\n }\n else if (match = string.match(rgba)) {\n for (var i = 0; i < rgb.length; i++) {\n rgb[i] = parseInt(match[i + 1]);\n }\n a = parseFloat(match[4]);\n }\n else if (match = string.match(per)) {\n for (var i = 0; i < rgb.length; i++) {\n rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);\n }\n a = parseFloat(match[4]);\n }\n else if (match = string.match(keyword)) {\n if (match[1] == \"transparent\") {\n return [0, 0, 0, 0];\n }\n rgb = colorName$1[match[1]];\n if (!rgb) {\n return;\n }\n }\n\n for (var i = 0; i < rgb.length; i++) {\n rgb[i] = scale(rgb[i], 0, 255);\n }\n if (!a && a != 0) {\n a = 1;\n }\n else {\n a = scale(a, 0, 1);\n }\n rgb[3] = a;\n return rgb;\n}\n\nfunction getHsla(string) {\n if (!string) {\n return;\n }\n var hsl = /^hsla?\\(\\s*([+-]?\\d+)(?:deg)?\\s*,\\s*([+-]?[\\d\\.]+)%\\s*,\\s*([+-]?[\\d\\.]+)%\\s*(?:,\\s*([+-]?[\\d\\.]+)\\s*)?\\)/;\n var match = string.match(hsl);\n if (match) {\n var alpha = parseFloat(match[4]);\n var h = scale(parseInt(match[1]), 0, 360),\n s = scale(parseFloat(match[2]), 0, 100),\n l = scale(parseFloat(match[3]), 0, 100),\n a = scale(isNaN(alpha) ? 1 : alpha, 0, 1);\n return [h, s, l, a];\n }\n}\n\nfunction getHwb(string) {\n if (!string) {\n return;\n }\n var hwb = /^hwb\\(\\s*([+-]?\\d+)(?:deg)?\\s*,\\s*([+-]?[\\d\\.]+)%\\s*,\\s*([+-]?[\\d\\.]+)%\\s*(?:,\\s*([+-]?[\\d\\.]+)\\s*)?\\)/;\n var match = string.match(hwb);\n if (match) {\n var alpha = parseFloat(match[4]);\n var h = scale(parseInt(match[1]), 0, 360),\n w = scale(parseFloat(match[2]), 0, 100),\n b = scale(parseFloat(match[3]), 0, 100),\n a = scale(isNaN(alpha) ? 1 : alpha, 0, 1);\n return [h, w, b, a];\n }\n}\n\nfunction getRgb(string) {\n var rgba = getRgba(string);\n return rgba && rgba.slice(0, 3);\n}\n\nfunction getHsl(string) {\n var hsla = getHsla(string);\n return hsla && hsla.slice(0, 3);\n}\n\nfunction getAlpha(string) {\n var vals = getRgba(string);\n if (vals) {\n return vals[3];\n }\n else if (vals = getHsla(string)) {\n return vals[3];\n }\n else if (vals = getHwb(string)) {\n return vals[3];\n }\n}\n\n// generators\nfunction hexString(rgba, a) {\n var a = (a !== undefined && rgba.length === 3) ? a : rgba[3];\n return \"#\" + hexDouble(rgba[0]) \n + hexDouble(rgba[1])\n + hexDouble(rgba[2])\n + (\n (a >= 0 && a < 1)\n ? hexDouble(Math.round(a * 255))\n : \"\"\n );\n}\n\nfunction rgbString(rgba, alpha) {\n if (alpha < 1 || (rgba[3] && rgba[3] < 1)) {\n return rgbaString(rgba, alpha);\n }\n return \"rgb(\" + rgba[0] + \", \" + rgba[1] + \", \" + rgba[2] + \")\";\n}\n\nfunction rgbaString(rgba, alpha) {\n if (alpha === undefined) {\n alpha = (rgba[3] !== undefined ? rgba[3] : 1);\n }\n return \"rgba(\" + rgba[0] + \", \" + rgba[1] + \", \" + rgba[2]\n + \", \" + alpha + \")\";\n}\n\nfunction percentString(rgba, alpha) {\n if (alpha < 1 || (rgba[3] && rgba[3] < 1)) {\n return percentaString(rgba, alpha);\n }\n var r = Math.round(rgba[0]/255 * 100),\n g = Math.round(rgba[1]/255 * 100),\n b = Math.round(rgba[2]/255 * 100);\n\n return \"rgb(\" + r + \"%, \" + g + \"%, \" + b + \"%)\";\n}\n\nfunction percentaString(rgba, alpha) {\n var r = Math.round(rgba[0]/255 * 100),\n g = Math.round(rgba[1]/255 * 100),\n b = Math.round(rgba[2]/255 * 100);\n return \"rgba(\" + r + \"%, \" + g + \"%, \" + b + \"%, \" + (alpha || rgba[3] || 1) + \")\";\n}\n\nfunction hslString(hsla, alpha) {\n if (alpha < 1 || (hsla[3] && hsla[3] < 1)) {\n return hslaString(hsla, alpha);\n }\n return \"hsl(\" + hsla[0] + \", \" + hsla[1] + \"%, \" + hsla[2] + \"%)\";\n}\n\nfunction hslaString(hsla, alpha) {\n if (alpha === undefined) {\n alpha = (hsla[3] !== undefined ? hsla[3] : 1);\n }\n return \"hsla(\" + hsla[0] + \", \" + hsla[1] + \"%, \" + hsla[2] + \"%, \"\n + alpha + \")\";\n}\n\n// hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax\n// (hwb have alpha optional & 1 is default value)\nfunction hwbString(hwb, alpha) {\n if (alpha === undefined) {\n alpha = (hwb[3] !== undefined ? hwb[3] : 1);\n }\n return \"hwb(\" + hwb[0] + \", \" + hwb[1] + \"%, \" + hwb[2] + \"%\"\n + (alpha !== undefined && alpha !== 1 ? \", \" + alpha : \"\") + \")\";\n}\n\nfunction keyword(rgb) {\n return reverseNames[rgb.slice(0, 3)];\n}\n\n// helpers\nfunction scale(num, min, max) {\n return Math.min(Math.max(min, num), max);\n}\n\nfunction hexDouble(num) {\n var str = num.toString(16).toUpperCase();\n return (str.length < 2) ? \"0\" + str : str;\n}\n\n\n//create a list of reverse color names\nvar reverseNames = {};\nfor (var name in colorName$1) {\n reverseNames[colorName$1[name]] = name;\n}\n\n/* MIT license */\n\n\n\nvar Color = function (obj) {\n\tif (obj instanceof Color) {\n\t\treturn obj;\n\t}\n\tif (!(this instanceof Color)) {\n\t\treturn new Color(obj);\n\t}\n\n\tthis.valid = false;\n\tthis.values = {\n\t\trgb: [0, 0, 0],\n\t\thsl: [0, 0, 0],\n\t\thsv: [0, 0, 0],\n\t\thwb: [0, 0, 0],\n\t\tcmyk: [0, 0, 0, 0],\n\t\talpha: 1\n\t};\n\n\t// parse Color() argument\n\tvar vals;\n\tif (typeof obj === 'string') {\n\t\tvals = colorString.getRgba(obj);\n\t\tif (vals) {\n\t\t\tthis.setValues('rgb', vals);\n\t\t} else if (vals = colorString.getHsla(obj)) {\n\t\t\tthis.setValues('hsl', vals);\n\t\t} else if (vals = colorString.getHwb(obj)) {\n\t\t\tthis.setValues('hwb', vals);\n\t\t}\n\t} else if (typeof obj === 'object') {\n\t\tvals = obj;\n\t\tif (vals.r !== undefined || vals.red !== undefined) {\n\t\t\tthis.setValues('rgb', vals);\n\t\t} else if (vals.l !== undefined || vals.lightness !== undefined) {\n\t\t\tthis.setValues('hsl', vals);\n\t\t} else if (vals.v !== undefined || vals.value !== undefined) {\n\t\t\tthis.setValues('hsv', vals);\n\t\t} else if (vals.w !== undefined || vals.whiteness !== undefined) {\n\t\t\tthis.setValues('hwb', vals);\n\t\t} else if (vals.c !== undefined || vals.cyan !== undefined) {\n\t\t\tthis.setValues('cmyk', vals);\n\t\t}\n\t}\n};\n\nColor.prototype = {\n\tisValid: function () {\n\t\treturn this.valid;\n\t},\n\trgb: function () {\n\t\treturn this.setSpace('rgb', arguments);\n\t},\n\thsl: function () {\n\t\treturn this.setSpace('hsl', arguments);\n\t},\n\thsv: function () {\n\t\treturn this.setSpace('hsv', arguments);\n\t},\n\thwb: function () {\n\t\treturn this.setSpace('hwb', arguments);\n\t},\n\tcmyk: function () {\n\t\treturn this.setSpace('cmyk', arguments);\n\t},\n\n\trgbArray: function () {\n\t\treturn this.values.rgb;\n\t},\n\thslArray: function () {\n\t\treturn this.values.hsl;\n\t},\n\thsvArray: function () {\n\t\treturn this.values.hsv;\n\t},\n\thwbArray: function () {\n\t\tvar values = this.values;\n\t\tif (values.alpha !== 1) {\n\t\t\treturn values.hwb.concat([values.alpha]);\n\t\t}\n\t\treturn values.hwb;\n\t},\n\tcmykArray: function () {\n\t\treturn this.values.cmyk;\n\t},\n\trgbaArray: function () {\n\t\tvar values = this.values;\n\t\treturn values.rgb.concat([values.alpha]);\n\t},\n\thslaArray: function () {\n\t\tvar values = this.values;\n\t\treturn values.hsl.concat([values.alpha]);\n\t},\n\talpha: function (val) {\n\t\tif (val === undefined) {\n\t\t\treturn this.values.alpha;\n\t\t}\n\t\tthis.setValues('alpha', val);\n\t\treturn this;\n\t},\n\n\tred: function (val) {\n\t\treturn this.setChannel('rgb', 0, val);\n\t},\n\tgreen: function (val) {\n\t\treturn this.setChannel('rgb', 1, val);\n\t},\n\tblue: function (val) {\n\t\treturn this.setChannel('rgb', 2, val);\n\t},\n\thue: function (val) {\n\t\tif (val) {\n\t\t\tval %= 360;\n\t\t\tval = val < 0 ? 360 + val : val;\n\t\t}\n\t\treturn this.setChannel('hsl', 0, val);\n\t},\n\tsaturation: function (val) {\n\t\treturn this.setChannel('hsl', 1, val);\n\t},\n\tlightness: function (val) {\n\t\treturn this.setChannel('hsl', 2, val);\n\t},\n\tsaturationv: function (val) {\n\t\treturn this.setChannel('hsv', 1, val);\n\t},\n\twhiteness: function (val) {\n\t\treturn this.setChannel('hwb', 1, val);\n\t},\n\tblackness: function (val) {\n\t\treturn this.setChannel('hwb', 2, val);\n\t},\n\tvalue: function (val) {\n\t\treturn this.setChannel('hsv', 2, val);\n\t},\n\tcyan: function (val) {\n\t\treturn this.setChannel('cmyk', 0, val);\n\t},\n\tmagenta: function (val) {\n\t\treturn this.setChannel('cmyk', 1, val);\n\t},\n\tyellow: function (val) {\n\t\treturn this.setChannel('cmyk', 2, val);\n\t},\n\tblack: function (val) {\n\t\treturn this.setChannel('cmyk', 3, val);\n\t},\n\n\thexString: function () {\n\t\treturn colorString.hexString(this.values.rgb);\n\t},\n\trgbString: function () {\n\t\treturn colorString.rgbString(this.values.rgb, this.values.alpha);\n\t},\n\trgbaString: function () {\n\t\treturn colorString.rgbaString(this.values.rgb, this.values.alpha);\n\t},\n\tpercentString: function () {\n\t\treturn colorString.percentString(this.values.rgb, this.values.alpha);\n\t},\n\thslString: function () {\n\t\treturn colorString.hslString(this.values.hsl, this.values.alpha);\n\t},\n\thslaString: function () {\n\t\treturn colorString.hslaString(this.values.hsl, this.values.alpha);\n\t},\n\thwbString: function () {\n\t\treturn colorString.hwbString(this.values.hwb, this.values.alpha);\n\t},\n\tkeyword: function () {\n\t\treturn colorString.keyword(this.values.rgb, this.values.alpha);\n\t},\n\n\trgbNumber: function () {\n\t\tvar rgb = this.values.rgb;\n\t\treturn (rgb[0] << 16) | (rgb[1] << 8) | rgb[2];\n\t},\n\n\tluminosity: function () {\n\t\t// http://www.w3.org/TR/WCAG20/#relativeluminancedef\n\t\tvar rgb = this.values.rgb;\n\t\tvar lum = [];\n\t\tfor (var i = 0; i < rgb.length; i++) {\n\t\t\tvar chan = rgb[i] / 255;\n\t\t\tlum[i] = (chan <= 0.03928) ? chan / 12.92 : Math.pow(((chan + 0.055) / 1.055), 2.4);\n\t\t}\n\t\treturn 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];\n\t},\n\n\tcontrast: function (color2) {\n\t\t// http://www.w3.org/TR/WCAG20/#contrast-ratiodef\n\t\tvar lum1 = this.luminosity();\n\t\tvar lum2 = color2.luminosity();\n\t\tif (lum1 > lum2) {\n\t\t\treturn (lum1 + 0.05) / (lum2 + 0.05);\n\t\t}\n\t\treturn (lum2 + 0.05) / (lum1 + 0.05);\n\t},\n\n\tlevel: function (color2) {\n\t\tvar contrastRatio = this.contrast(color2);\n\t\tif (contrastRatio >= 7.1) {\n\t\t\treturn 'AAA';\n\t\t}\n\n\t\treturn (contrastRatio >= 4.5) ? 'AA' : '';\n\t},\n\n\tdark: function () {\n\t\t// YIQ equation from http://24ways.org/2010/calculating-color-contrast\n\t\tvar rgb = this.values.rgb;\n\t\tvar yiq = (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000;\n\t\treturn yiq < 128;\n\t},\n\n\tlight: function () {\n\t\treturn !this.dark();\n\t},\n\n\tnegate: function () {\n\t\tvar rgb = [];\n\t\tfor (var i = 0; i < 3; i++) {\n\t\t\trgb[i] = 255 - this.values.rgb[i];\n\t\t}\n\t\tthis.setValues('rgb', rgb);\n\t\treturn this;\n\t},\n\n\tlighten: function (ratio) {\n\t\tvar hsl = this.values.hsl;\n\t\thsl[2] += hsl[2] * ratio;\n\t\tthis.setValues('hsl', hsl);\n\t\treturn this;\n\t},\n\n\tdarken: function (ratio) {\n\t\tvar hsl = this.values.hsl;\n\t\thsl[2] -= hsl[2] * ratio;\n\t\tthis.setValues('hsl', hsl);\n\t\treturn this;\n\t},\n\n\tsaturate: function (ratio) {\n\t\tvar hsl = this.values.hsl;\n\t\thsl[1] += hsl[1] * ratio;\n\t\tthis.setValues('hsl', hsl);\n\t\treturn this;\n\t},\n\n\tdesaturate: function (ratio) {\n\t\tvar hsl = this.values.hsl;\n\t\thsl[1] -= hsl[1] * ratio;\n\t\tthis.setValues('hsl', hsl);\n\t\treturn this;\n\t},\n\n\twhiten: function (ratio) {\n\t\tvar hwb = this.values.hwb;\n\t\thwb[1] += hwb[1] * ratio;\n\t\tthis.setValues('hwb', hwb);\n\t\treturn this;\n\t},\n\n\tblacken: function (ratio) {\n\t\tvar hwb = this.values.hwb;\n\t\thwb[2] += hwb[2] * ratio;\n\t\tthis.setValues('hwb', hwb);\n\t\treturn this;\n\t},\n\n\tgreyscale: function () {\n\t\tvar rgb = this.values.rgb;\n\t\t// http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale\n\t\tvar val = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;\n\t\tthis.setValues('rgb', [val, val, val]);\n\t\treturn this;\n\t},\n\n\tclearer: function (ratio) {\n\t\tvar alpha = this.values.alpha;\n\t\tthis.setValues('alpha', alpha - (alpha * ratio));\n\t\treturn this;\n\t},\n\n\topaquer: function (ratio) {\n\t\tvar alpha = this.values.alpha;\n\t\tthis.setValues('alpha', alpha + (alpha * ratio));\n\t\treturn this;\n\t},\n\n\trotate: function (degrees) {\n\t\tvar hsl = this.values.hsl;\n\t\tvar hue = (hsl[0] + degrees) % 360;\n\t\thsl[0] = hue < 0 ? 360 + hue : hue;\n\t\tthis.setValues('hsl', hsl);\n\t\treturn this;\n\t},\n\n\t/**\n\t * Ported from sass implementation in C\n\t * https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209\n\t */\n\tmix: function (mixinColor, weight) {\n\t\tvar color1 = this;\n\t\tvar color2 = mixinColor;\n\t\tvar p = weight === undefined ? 0.5 : weight;\n\n\t\tvar w = 2 * p - 1;\n\t\tvar a = color1.alpha() - color2.alpha();\n\n\t\tvar w1 = (((w * a === -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;\n\t\tvar w2 = 1 - w1;\n\n\t\treturn this\n\t\t\t.rgb(\n\t\t\t\tw1 * color1.red() + w2 * color2.red(),\n\t\t\t\tw1 * color1.green() + w2 * color2.green(),\n\t\t\t\tw1 * color1.blue() + w2 * color2.blue()\n\t\t\t)\n\t\t\t.alpha(color1.alpha() * p + color2.alpha() * (1 - p));\n\t},\n\n\ttoJSON: function () {\n\t\treturn this.rgb();\n\t},\n\n\tclone: function () {\n\t\t// NOTE(SB): using node-clone creates a dependency to Buffer when using browserify,\n\t\t// making the final build way to big to embed in Chart.js. So let's do it manually,\n\t\t// assuming that values to clone are 1 dimension arrays containing only numbers,\n\t\t// except 'alpha' which is a number.\n\t\tvar result = new Color();\n\t\tvar source = this.values;\n\t\tvar target = result.values;\n\t\tvar value, type;\n\n\t\tfor (var prop in source) {\n\t\t\tif (source.hasOwnProperty(prop)) {\n\t\t\t\tvalue = source[prop];\n\t\t\t\ttype = ({}).toString.call(value);\n\t\t\t\tif (type === '[object Array]') {\n\t\t\t\t\ttarget[prop] = value.slice(0);\n\t\t\t\t} else if (type === '[object Number]') {\n\t\t\t\t\ttarget[prop] = value;\n\t\t\t\t} else {\n\t\t\t\t\tconsole.error('unexpected color value:', value);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n};\n\nColor.prototype.spaces = {\n\trgb: ['red', 'green', 'blue'],\n\thsl: ['hue', 'saturation', 'lightness'],\n\thsv: ['hue', 'saturation', 'value'],\n\thwb: ['hue', 'whiteness', 'blackness'],\n\tcmyk: ['cyan', 'magenta', 'yellow', 'black']\n};\n\nColor.prototype.maxes = {\n\trgb: [255, 255, 255],\n\thsl: [360, 100, 100],\n\thsv: [360, 100, 100],\n\thwb: [360, 100, 100],\n\tcmyk: [100, 100, 100, 100]\n};\n\nColor.prototype.getValues = function (space) {\n\tvar values = this.values;\n\tvar vals = {};\n\n\tfor (var i = 0; i < space.length; i++) {\n\t\tvals[space.charAt(i)] = values[space][i];\n\t}\n\n\tif (values.alpha !== 1) {\n\t\tvals.a = values.alpha;\n\t}\n\n\t// {r: 255, g: 255, b: 255, a: 0.4}\n\treturn vals;\n};\n\nColor.prototype.setValues = function (space, vals) {\n\tvar values = this.values;\n\tvar spaces = this.spaces;\n\tvar maxes = this.maxes;\n\tvar alpha = 1;\n\tvar i;\n\n\tthis.valid = true;\n\n\tif (space === 'alpha') {\n\t\talpha = vals;\n\t} else if (vals.length) {\n\t\t// [10, 10, 10]\n\t\tvalues[space] = vals.slice(0, space.length);\n\t\talpha = vals[space.length];\n\t} else if (vals[space.charAt(0)] !== undefined) {\n\t\t// {r: 10, g: 10, b: 10}\n\t\tfor (i = 0; i < space.length; i++) {\n\t\t\tvalues[space][i] = vals[space.charAt(i)];\n\t\t}\n\n\t\talpha = vals.a;\n\t} else if (vals[spaces[space][0]] !== undefined) {\n\t\t// {red: 10, green: 10, blue: 10}\n\t\tvar chans = spaces[space];\n\n\t\tfor (i = 0; i < space.length; i++) {\n\t\t\tvalues[space][i] = vals[chans[i]];\n\t\t}\n\n\t\talpha = vals.alpha;\n\t}\n\n\tvalues.alpha = Math.max(0, Math.min(1, (alpha === undefined ? values.alpha : alpha)));\n\n\tif (space === 'alpha') {\n\t\treturn false;\n\t}\n\n\tvar capped;\n\n\t// cap values of the space prior converting all values\n\tfor (i = 0; i < space.length; i++) {\n\t\tcapped = Math.max(0, Math.min(maxes[space][i], values[space][i]));\n\t\tvalues[space][i] = Math.round(capped);\n\t}\n\n\t// convert to all the other color spaces\n\tfor (var sname in spaces) {\n\t\tif (sname !== space) {\n\t\t\tvalues[sname] = colorConvert[space][sname](values[space]);\n\t\t}\n\t}\n\n\treturn true;\n};\n\nColor.prototype.setSpace = function (space, args) {\n\tvar vals = args[0];\n\n\tif (vals === undefined) {\n\t\t// color.rgb()\n\t\treturn this.getValues(space);\n\t}\n\n\t// color.rgb(10, 10, 10)\n\tif (typeof vals === 'number') {\n\t\tvals = Array.prototype.slice.call(args);\n\t}\n\n\tthis.setValues(space, vals);\n\treturn this;\n};\n\nColor.prototype.setChannel = function (space, index, val) {\n\tvar svalues = this.values[space];\n\tif (val === undefined) {\n\t\t// color.red()\n\t\treturn svalues[index];\n\t} else if (val === svalues[index]) {\n\t\t// color.red(color.red())\n\t\treturn this;\n\t}\n\n\t// color.red(100)\n\tsvalues[index] = val;\n\tthis.setValues(space, svalues);\n\n\treturn this;\n};\n\nif (typeof window !== 'undefined') {\n\twindow.Color = Color;\n}\n\nvar chartjsColor = Color;\n\nfunction isValidKey(key) {\r\n\treturn ['__proto__', 'prototype', 'constructor'].indexOf(key) === -1;\r\n}\r\n\r\n/**\r\n * @namespace Chart.helpers\r\n */\r\nvar helpers = {\r\n\t/**\r\n\t * An empty function that can be used, for example, for optional callback.\r\n\t */\r\n\tnoop: function() {},\r\n\r\n\t/**\r\n\t * Returns a unique id, sequentially generated from a global variable.\r\n\t * @returns {number}\r\n\t * @function\r\n\t */\r\n\tuid: (function() {\r\n\t\tvar id = 0;\r\n\t\treturn function() {\r\n\t\t\treturn id++;\r\n\t\t};\r\n\t}()),\r\n\r\n\t/**\r\n\t * Returns true if `value` is neither null nor undefined, else returns false.\r\n\t * @param {*} value - The value to test.\r\n\t * @returns {boolean}\r\n\t * @since 2.7.0\r\n\t */\r\n\tisNullOrUndef: function(value) {\r\n\t\treturn value === null || typeof value === 'undefined';\r\n\t},\r\n\r\n\t/**\r\n\t * Returns true if `value` is an array (including typed arrays), else returns false.\r\n\t * @param {*} value - The value to test.\r\n\t * @returns {boolean}\r\n\t * @function\r\n\t */\r\n\tisArray: function(value) {\r\n\t\tif (Array.isArray && Array.isArray(value)) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tvar type = Object.prototype.toString.call(value);\r\n\t\tif (type.substr(0, 7) === '[object' && type.substr(-6) === 'Array]') {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t},\r\n\r\n\t/**\r\n\t * Returns true if `value` is an object (excluding null), else returns false.\r\n\t * @param {*} value - The value to test.\r\n\t * @returns {boolean}\r\n\t * @since 2.7.0\r\n\t */\r\n\tisObject: function(value) {\r\n\t\treturn value !== null && Object.prototype.toString.call(value) === '[object Object]';\r\n\t},\r\n\r\n\t/**\r\n\t * Returns true if `value` is a finite number, else returns false\r\n\t * @param {*} value - The value to test.\r\n\t * @returns {boolean}\r\n\t */\r\n\tisFinite: function(value) {\r\n\t\treturn (typeof value === 'number' || value instanceof Number) && isFinite(value);\r\n\t},\r\n\r\n\t/**\r\n\t * Returns `value` if defined, else returns `defaultValue`.\r\n\t * @param {*} value - The value to return if defined.\r\n\t * @param {*} defaultValue - The value to return if `value` is undefined.\r\n\t * @returns {*}\r\n\t */\r\n\tvalueOrDefault: function(value, defaultValue) {\r\n\t\treturn typeof value === 'undefined' ? defaultValue : value;\r\n\t},\r\n\r\n\t/**\r\n\t * Returns value at the given `index` in array if defined, else returns `defaultValue`.\r\n\t * @param {Array} value - The array to lookup for value at `index`.\r\n\t * @param {number} index - The index in `value` to lookup for value.\r\n\t * @param {*} defaultValue - The value to return if `value[index]` is undefined.\r\n\t * @returns {*}\r\n\t */\r\n\tvalueAtIndexOrDefault: function(value, index, defaultValue) {\r\n\t\treturn helpers.valueOrDefault(helpers.isArray(value) ? value[index] : value, defaultValue);\r\n\t},\r\n\r\n\t/**\r\n\t * Calls `fn` with the given `args` in the scope defined by `thisArg` and returns the\r\n\t * value returned by `fn`. If `fn` is not a function, this method returns undefined.\r\n\t * @param {function} fn - The function to call.\r\n\t * @param {Array|undefined|null} args - The arguments with which `fn` should be called.\r\n\t * @param {object} [thisArg] - The value of `this` provided for the call to `fn`.\r\n\t * @returns {*}\r\n\t */\r\n\tcallback: function(fn, args, thisArg) {\r\n\t\tif (fn && typeof fn.call === 'function') {\r\n\t\t\treturn fn.apply(thisArg, args);\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Note(SB) for performance sake, this method should only be used when loopable type\r\n\t * is unknown or in none intensive code (not called often and small loopable). Else\r\n\t * it's preferable to use a regular for() loop and save extra function calls.\r\n\t * @param {object|Array} loopable - The object or array to be iterated.\r\n\t * @param {function} fn - The function to call for each item.\r\n\t * @param {object} [thisArg] - The value of `this` provided for the call to `fn`.\r\n\t * @param {boolean} [reverse] - If true, iterates backward on the loopable.\r\n\t */\r\n\teach: function(loopable, fn, thisArg, reverse) {\r\n\t\tvar i, len, keys;\r\n\t\tif (helpers.isArray(loopable)) {\r\n\t\t\tlen = loopable.length;\r\n\t\t\tif (reverse) {\r\n\t\t\t\tfor (i = len - 1; i >= 0; i--) {\r\n\t\t\t\t\tfn.call(thisArg, loopable[i], i);\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tfor (i = 0; i < len; i++) {\r\n\t\t\t\t\tfn.call(thisArg, loopable[i], i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else if (helpers.isObject(loopable)) {\r\n\t\t\tkeys = Object.keys(loopable);\r\n\t\t\tlen = keys.length;\r\n\t\t\tfor (i = 0; i < len; i++) {\r\n\t\t\t\tfn.call(thisArg, loopable[keys[i]], keys[i]);\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Returns true if the `a0` and `a1` arrays have the same content, else returns false.\r\n\t * @see https://stackoverflow.com/a/14853974\r\n\t * @param {Array} a0 - The array to compare\r\n\t * @param {Array} a1 - The array to compare\r\n\t * @returns {boolean}\r\n\t */\r\n\tarrayEquals: function(a0, a1) {\r\n\t\tvar i, ilen, v0, v1;\r\n\r\n\t\tif (!a0 || !a1 || a0.length !== a1.length) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tfor (i = 0, ilen = a0.length; i < ilen; ++i) {\r\n\t\t\tv0 = a0[i];\r\n\t\t\tv1 = a1[i];\r\n\r\n\t\t\tif (v0 instanceof Array && v1 instanceof Array) {\r\n\t\t\t\tif (!helpers.arrayEquals(v0, v1)) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t} else if (v0 !== v1) {\r\n\t\t\t\t// NOTE: two different object instances will never be equal: {x:20} != {x:20}\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\t},\r\n\r\n\t/**\r\n\t * Returns a deep copy of `source` without keeping references on objects and arrays.\r\n\t * @param {*} source - The value to clone.\r\n\t * @returns {*}\r\n\t */\r\n\tclone: function(source) {\r\n\t\tif (helpers.isArray(source)) {\r\n\t\t\treturn source.map(helpers.clone);\r\n\t\t}\r\n\r\n\t\tif (helpers.isObject(source)) {\r\n\t\t\tvar target = Object.create(source);\r\n\t\t\tvar keys = Object.keys(source);\r\n\t\t\tvar klen = keys.length;\r\n\t\t\tvar k = 0;\r\n\r\n\t\t\tfor (; k < klen; ++k) {\r\n\t\t\t\ttarget[keys[k]] = helpers.clone(source[keys[k]]);\r\n\t\t\t}\r\n\r\n\t\t\treturn target;\r\n\t\t}\r\n\r\n\t\treturn source;\r\n\t},\r\n\r\n\t/**\r\n\t * The default merger when Chart.helpers.merge is called without merger option.\r\n\t * Note(SB): also used by mergeConfig and mergeScaleConfig as fallback.\r\n\t * @private\r\n\t */\r\n\t_merger: function(key, target, source, options) {\r\n\t\tif (!isValidKey(key)) {\r\n\t\t\t// We want to ensure we do not copy prototypes over\r\n\t\t\t// as this can pollute global namespaces\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tvar tval = target[key];\r\n\t\tvar sval = source[key];\r\n\r\n\t\tif (helpers.isObject(tval) && helpers.isObject(sval)) {\r\n\t\t\thelpers.merge(tval, sval, options);\r\n\t\t} else {\r\n\t\t\ttarget[key] = helpers.clone(sval);\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Merges source[key] in target[key] only if target[key] is undefined.\r\n\t * @private\r\n\t */\r\n\t_mergerIf: function(key, target, source) {\r\n\t\tif (!isValidKey(key)) {\r\n\t\t\t// We want to ensure we do not copy prototypes over\r\n\t\t\t// as this can pollute global namespaces\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tvar tval = target[key];\r\n\t\tvar sval = source[key];\r\n\r\n\t\tif (helpers.isObject(tval) && helpers.isObject(sval)) {\r\n\t\t\thelpers.mergeIf(tval, sval);\r\n\t\t} else if (!target.hasOwnProperty(key)) {\r\n\t\t\ttarget[key] = helpers.clone(sval);\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Recursively deep copies `source` properties into `target` with the given `options`.\r\n\t * IMPORTANT: `target` is not cloned and will be updated with `source` properties.\r\n\t * @param {object} target - The target object in which all sources are merged into.\r\n\t * @param {object|object[]} source - Object(s) to merge into `target`.\r\n\t * @param {object} [options] - Merging options:\r\n\t * @param {function} [options.merger] - The merge method (key, target, source, options)\r\n\t * @returns {object} The `target` object.\r\n\t */\r\n\tmerge: function(target, source, options) {\r\n\t\tvar sources = helpers.isArray(source) ? source : [source];\r\n\t\tvar ilen = sources.length;\r\n\t\tvar merge, i, keys, klen, k;\r\n\r\n\t\tif (!helpers.isObject(target)) {\r\n\t\t\treturn target;\r\n\t\t}\r\n\r\n\t\toptions = options || {};\r\n\t\tmerge = options.merger || helpers._merger;\r\n\r\n\t\tfor (i = 0; i < ilen; ++i) {\r\n\t\t\tsource = sources[i];\r\n\t\t\tif (!helpers.isObject(source)) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\tkeys = Object.keys(source);\r\n\t\t\tfor (k = 0, klen = keys.length; k < klen; ++k) {\r\n\t\t\t\tmerge(keys[k], target, source, options);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn target;\r\n\t},\r\n\r\n\t/**\r\n\t * Recursively deep copies `source` properties into `target` *only* if not defined in target.\r\n\t * IMPORTANT: `target` is not cloned and will be updated with `source` properties.\r\n\t * @param {object} target - The target object in which all sources are merged into.\r\n\t * @param {object|object[]} source - Object(s) to merge into `target`.\r\n\t * @returns {object} The `target` object.\r\n\t */\r\n\tmergeIf: function(target, source) {\r\n\t\treturn helpers.merge(target, source, {merger: helpers._mergerIf});\r\n\t},\r\n\r\n\t/**\r\n\t * Applies the contents of two or more objects together into the first object.\r\n\t * @param {object} target - The target object in which all objects are merged into.\r\n\t * @param {object} arg1 - Object containing additional properties to merge in target.\r\n\t * @param {object} argN - Additional objects containing properties to merge in target.\r\n\t * @returns {object} The `target` object.\r\n\t */\r\n\textend: Object.assign || function(target) {\r\n\t\treturn helpers.merge(target, [].slice.call(arguments, 1), {\r\n\t\t\tmerger: function(key, dst, src) {\r\n\t\t\t\tdst[key] = src[key];\r\n\t\t\t}\r\n\t\t});\r\n\t},\r\n\r\n\t/**\r\n\t * Basic javascript inheritance based on the model created in Backbone.js\r\n\t */\r\n\tinherits: function(extensions) {\r\n\t\tvar me = this;\r\n\t\tvar ChartElement = (extensions && extensions.hasOwnProperty('constructor')) ? extensions.constructor : function() {\r\n\t\t\treturn me.apply(this, arguments);\r\n\t\t};\r\n\r\n\t\tvar Surrogate = function() {\r\n\t\t\tthis.constructor = ChartElement;\r\n\t\t};\r\n\r\n\t\tSurrogate.prototype = me.prototype;\r\n\t\tChartElement.prototype = new Surrogate();\r\n\t\tChartElement.extend = helpers.inherits;\r\n\r\n\t\tif (extensions) {\r\n\t\t\thelpers.extend(ChartElement.prototype, extensions);\r\n\t\t}\r\n\r\n\t\tChartElement.__super__ = me.prototype;\r\n\t\treturn ChartElement;\r\n\t},\r\n\r\n\t_deprecated: function(scope, value, previous, current) {\r\n\t\tif (value !== undefined) {\r\n\t\t\tconsole.warn(scope + ': \"' + previous +\r\n\t\t\t\t'\" is deprecated. Please use \"' + current + '\" instead');\r\n\t\t}\r\n\t}\r\n};\r\n\r\nvar helpers_core = helpers;\r\n\r\n// DEPRECATIONS\r\n\r\n/**\r\n * Provided for backward compatibility, use Chart.helpers.callback instead.\r\n * @function Chart.helpers.callCallback\r\n * @deprecated since version 2.6.0\r\n * @todo remove at version 3\r\n * @private\r\n */\r\nhelpers.callCallback = helpers.callback;\r\n\r\n/**\r\n * Provided for backward compatibility, use Array.prototype.indexOf instead.\r\n * Array.prototype.indexOf compatibility: Chrome, Opera, Safari, FF1.5+, IE9+\r\n * @function Chart.helpers.indexOf\r\n * @deprecated since version 2.7.0\r\n * @todo remove at version 3\r\n * @private\r\n */\r\nhelpers.indexOf = function(array, item, fromIndex) {\r\n\treturn Array.prototype.indexOf.call(array, item, fromIndex);\r\n};\r\n\r\n/**\r\n * Provided for backward compatibility, use Chart.helpers.valueOrDefault instead.\r\n * @function Chart.helpers.getValueOrDefault\r\n * @deprecated since version 2.7.0\r\n * @todo remove at version 3\r\n * @private\r\n */\r\nhelpers.getValueOrDefault = helpers.valueOrDefault;\r\n\r\n/**\r\n * Provided for backward compatibility, use Chart.helpers.valueAtIndexOrDefault instead.\r\n * @function Chart.helpers.getValueAtIndexOrDefault\r\n * @deprecated since version 2.7.0\r\n * @todo remove at version 3\r\n * @private\r\n */\r\nhelpers.getValueAtIndexOrDefault = helpers.valueAtIndexOrDefault;\n\n/**\r\n * Easing functions adapted from Robert Penner's easing equations.\r\n * @namespace Chart.helpers.easingEffects\r\n * @see http://www.robertpenner.com/easing/\r\n */\r\nvar effects = {\r\n\tlinear: function(t) {\r\n\t\treturn t;\r\n\t},\r\n\r\n\teaseInQuad: function(t) {\r\n\t\treturn t * t;\r\n\t},\r\n\r\n\teaseOutQuad: function(t) {\r\n\t\treturn -t * (t - 2);\r\n\t},\r\n\r\n\teaseInOutQuad: function(t) {\r\n\t\tif ((t /= 0.5) < 1) {\r\n\t\t\treturn 0.5 * t * t;\r\n\t\t}\r\n\t\treturn -0.5 * ((--t) * (t - 2) - 1);\r\n\t},\r\n\r\n\teaseInCubic: function(t) {\r\n\t\treturn t * t * t;\r\n\t},\r\n\r\n\teaseOutCubic: function(t) {\r\n\t\treturn (t = t - 1) * t * t + 1;\r\n\t},\r\n\r\n\teaseInOutCubic: function(t) {\r\n\t\tif ((t /= 0.5) < 1) {\r\n\t\t\treturn 0.5 * t * t * t;\r\n\t\t}\r\n\t\treturn 0.5 * ((t -= 2) * t * t + 2);\r\n\t},\r\n\r\n\teaseInQuart: function(t) {\r\n\t\treturn t * t * t * t;\r\n\t},\r\n\r\n\teaseOutQuart: function(t) {\r\n\t\treturn -((t = t - 1) * t * t * t - 1);\r\n\t},\r\n\r\n\teaseInOutQuart: function(t) {\r\n\t\tif ((t /= 0.5) < 1) {\r\n\t\t\treturn 0.5 * t * t * t * t;\r\n\t\t}\r\n\t\treturn -0.5 * ((t -= 2) * t * t * t - 2);\r\n\t},\r\n\r\n\teaseInQuint: function(t) {\r\n\t\treturn t * t * t * t * t;\r\n\t},\r\n\r\n\teaseOutQuint: function(t) {\r\n\t\treturn (t = t - 1) * t * t * t * t + 1;\r\n\t},\r\n\r\n\teaseInOutQuint: function(t) {\r\n\t\tif ((t /= 0.5) < 1) {\r\n\t\t\treturn 0.5 * t * t * t * t * t;\r\n\t\t}\r\n\t\treturn 0.5 * ((t -= 2) * t * t * t * t + 2);\r\n\t},\r\n\r\n\teaseInSine: function(t) {\r\n\t\treturn -Math.cos(t * (Math.PI / 2)) + 1;\r\n\t},\r\n\r\n\teaseOutSine: function(t) {\r\n\t\treturn Math.sin(t * (Math.PI / 2));\r\n\t},\r\n\r\n\teaseInOutSine: function(t) {\r\n\t\treturn -0.5 * (Math.cos(Math.PI * t) - 1);\r\n\t},\r\n\r\n\teaseInExpo: function(t) {\r\n\t\treturn (t === 0) ? 0 : Math.pow(2, 10 * (t - 1));\r\n\t},\r\n\r\n\teaseOutExpo: function(t) {\r\n\t\treturn (t === 1) ? 1 : -Math.pow(2, -10 * t) + 1;\r\n\t},\r\n\r\n\teaseInOutExpo: function(t) {\r\n\t\tif (t === 0) {\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t\tif (t === 1) {\r\n\t\t\treturn 1;\r\n\t\t}\r\n\t\tif ((t /= 0.5) < 1) {\r\n\t\t\treturn 0.5 * Math.pow(2, 10 * (t - 1));\r\n\t\t}\r\n\t\treturn 0.5 * (-Math.pow(2, -10 * --t) + 2);\r\n\t},\r\n\r\n\teaseInCirc: function(t) {\r\n\t\tif (t >= 1) {\r\n\t\t\treturn t;\r\n\t\t}\r\n\t\treturn -(Math.sqrt(1 - t * t) - 1);\r\n\t},\r\n\r\n\teaseOutCirc: function(t) {\r\n\t\treturn Math.sqrt(1 - (t = t - 1) * t);\r\n\t},\r\n\r\n\teaseInOutCirc: function(t) {\r\n\t\tif ((t /= 0.5) < 1) {\r\n\t\t\treturn -0.5 * (Math.sqrt(1 - t * t) - 1);\r\n\t\t}\r\n\t\treturn 0.5 * (Math.sqrt(1 - (t -= 2) * t) + 1);\r\n\t},\r\n\r\n\teaseInElastic: function(t) {\r\n\t\tvar s = 1.70158;\r\n\t\tvar p = 0;\r\n\t\tvar a = 1;\r\n\t\tif (t === 0) {\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t\tif (t === 1) {\r\n\t\t\treturn 1;\r\n\t\t}\r\n\t\tif (!p) {\r\n\t\t\tp = 0.3;\r\n\t\t}\r\n\t\tif (a < 1) {\r\n\t\t\ta = 1;\r\n\t\t\ts = p / 4;\r\n\t\t} else {\r\n\t\t\ts = p / (2 * Math.PI) * Math.asin(1 / a);\r\n\t\t}\r\n\t\treturn -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * (2 * Math.PI) / p));\r\n\t},\r\n\r\n\teaseOutElastic: function(t) {\r\n\t\tvar s = 1.70158;\r\n\t\tvar p = 0;\r\n\t\tvar a = 1;\r\n\t\tif (t === 0) {\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t\tif (t === 1) {\r\n\t\t\treturn 1;\r\n\t\t}\r\n\t\tif (!p) {\r\n\t\t\tp = 0.3;\r\n\t\t}\r\n\t\tif (a < 1) {\r\n\t\t\ta = 1;\r\n\t\t\ts = p / 4;\r\n\t\t} else {\r\n\t\t\ts = p / (2 * Math.PI) * Math.asin(1 / a);\r\n\t\t}\r\n\t\treturn a * Math.pow(2, -10 * t) * Math.sin((t - s) * (2 * Math.PI) / p) + 1;\r\n\t},\r\n\r\n\teaseInOutElastic: function(t) {\r\n\t\tvar s = 1.70158;\r\n\t\tvar p = 0;\r\n\t\tvar a = 1;\r\n\t\tif (t === 0) {\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t\tif ((t /= 0.5) === 2) {\r\n\t\t\treturn 1;\r\n\t\t}\r\n\t\tif (!p) {\r\n\t\t\tp = 0.45;\r\n\t\t}\r\n\t\tif (a < 1) {\r\n\t\t\ta = 1;\r\n\t\t\ts = p / 4;\r\n\t\t} else {\r\n\t\t\ts = p / (2 * Math.PI) * Math.asin(1 / a);\r\n\t\t}\r\n\t\tif (t < 1) {\r\n\t\t\treturn -0.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * (2 * Math.PI) / p));\r\n\t\t}\r\n\t\treturn a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t - s) * (2 * Math.PI) / p) * 0.5 + 1;\r\n\t},\r\n\teaseInBack: function(t) {\r\n\t\tvar s = 1.70158;\r\n\t\treturn t * t * ((s + 1) * t - s);\r\n\t},\r\n\r\n\teaseOutBack: function(t) {\r\n\t\tvar s = 1.70158;\r\n\t\treturn (t = t - 1) * t * ((s + 1) * t + s) + 1;\r\n\t},\r\n\r\n\teaseInOutBack: function(t) {\r\n\t\tvar s = 1.70158;\r\n\t\tif ((t /= 0.5) < 1) {\r\n\t\t\treturn 0.5 * (t * t * (((s *= (1.525)) + 1) * t - s));\r\n\t\t}\r\n\t\treturn 0.5 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2);\r\n\t},\r\n\r\n\teaseInBounce: function(t) {\r\n\t\treturn 1 - effects.easeOutBounce(1 - t);\r\n\t},\r\n\r\n\teaseOutBounce: function(t) {\r\n\t\tif (t < (1 / 2.75)) {\r\n\t\t\treturn 7.5625 * t * t;\r\n\t\t}\r\n\t\tif (t < (2 / 2.75)) {\r\n\t\t\treturn 7.5625 * (t -= (1.5 / 2.75)) * t + 0.75;\r\n\t\t}\r\n\t\tif (t < (2.5 / 2.75)) {\r\n\t\t\treturn 7.5625 * (t -= (2.25 / 2.75)) * t + 0.9375;\r\n\t\t}\r\n\t\treturn 7.5625 * (t -= (2.625 / 2.75)) * t + 0.984375;\r\n\t},\r\n\r\n\teaseInOutBounce: function(t) {\r\n\t\tif (t < 0.5) {\r\n\t\t\treturn effects.easeInBounce(t * 2) * 0.5;\r\n\t\t}\r\n\t\treturn effects.easeOutBounce(t * 2 - 1) * 0.5 + 0.5;\r\n\t}\r\n};\r\n\r\nvar helpers_easing = {\r\n\teffects: effects\r\n};\r\n\r\n// DEPRECATIONS\r\n\r\n/**\r\n * Provided for backward compatibility, use Chart.helpers.easing.effects instead.\r\n * @function Chart.helpers.easingEffects\r\n * @deprecated since version 2.7.0\r\n * @todo remove at version 3\r\n * @private\r\n */\r\nhelpers_core.easingEffects = effects;\n\nvar PI = Math.PI;\r\nvar RAD_PER_DEG = PI / 180;\r\nvar DOUBLE_PI = PI * 2;\r\nvar HALF_PI = PI / 2;\r\nvar QUARTER_PI = PI / 4;\r\nvar TWO_THIRDS_PI = PI * 2 / 3;\r\n\r\n/**\r\n * @namespace Chart.helpers.canvas\r\n */\r\nvar exports$1 = {\r\n\t/**\r\n\t * Clears the entire canvas associated to the given `chart`.\r\n\t * @param {Chart} chart - The chart for which to clear the canvas.\r\n\t */\r\n\tclear: function(chart) {\r\n\t\tchart.ctx.clearRect(0, 0, chart.width, chart.height);\r\n\t},\r\n\r\n\t/**\r\n\t * Creates a \"path\" for a rectangle with rounded corners at position (x, y) with a\r\n\t * given size (width, height) and the same `radius` for all corners.\r\n\t * @param {CanvasRenderingContext2D} ctx - The canvas 2D Context.\r\n\t * @param {number} x - The x axis of the coordinate for the rectangle starting point.\r\n\t * @param {number} y - The y axis of the coordinate for the rectangle starting point.\r\n\t * @param {number} width - The rectangle's width.\r\n\t * @param {number} height - The rectangle's height.\r\n\t * @param {number} radius - The rounded amount (in pixels) for the four corners.\r\n\t * @todo handle `radius` as top-left, top-right, bottom-right, bottom-left array/object?\r\n\t */\r\n\troundedRect: function(ctx, x, y, width, height, radius) {\r\n\t\tif (radius) {\r\n\t\t\tvar r = Math.min(radius, height / 2, width / 2);\r\n\t\t\tvar left = x + r;\r\n\t\t\tvar top = y + r;\r\n\t\t\tvar right = x + width - r;\r\n\t\t\tvar bottom = y + height - r;\r\n\r\n\t\t\tctx.moveTo(x, top);\r\n\t\t\tif (left < right && top < bottom) {\r\n\t\t\t\tctx.arc(left, top, r, -PI, -HALF_PI);\r\n\t\t\t\tctx.arc(right, top, r, -HALF_PI, 0);\r\n\t\t\t\tctx.arc(right, bottom, r, 0, HALF_PI);\r\n\t\t\t\tctx.arc(left, bottom, r, HALF_PI, PI);\r\n\t\t\t} else if (left < right) {\r\n\t\t\t\tctx.moveTo(left, y);\r\n\t\t\t\tctx.arc(right, top, r, -HALF_PI, HALF_PI);\r\n\t\t\t\tctx.arc(left, top, r, HALF_PI, PI + HALF_PI);\r\n\t\t\t} else if (top < bottom) {\r\n\t\t\t\tctx.arc(left, top, r, -PI, 0);\r\n\t\t\t\tctx.arc(left, bottom, r, 0, PI);\r\n\t\t\t} else {\r\n\t\t\t\tctx.arc(left, top, r, -PI, PI);\r\n\t\t\t}\r\n\t\t\tctx.closePath();\r\n\t\t\tctx.moveTo(x, y);\r\n\t\t} else {\r\n\t\t\tctx.rect(x, y, width, height);\r\n\t\t}\r\n\t},\r\n\r\n\tdrawPoint: function(ctx, style, radius, x, y, rotation) {\r\n\t\tvar type, xOffset, yOffset, size, cornerRadius;\r\n\t\tvar rad = (rotation || 0) * RAD_PER_DEG;\r\n\r\n\t\tif (style && typeof style === 'object') {\r\n\t\t\ttype = style.toString();\r\n\t\t\tif (type === '[object HTMLImageElement]' || type === '[object HTMLCanvasElement]') {\r\n\t\t\t\tctx.save();\r\n\t\t\t\tctx.translate(x, y);\r\n\t\t\t\tctx.rotate(rad);\r\n\t\t\t\tctx.drawImage(style, -style.width / 2, -style.height / 2, style.width, style.height);\r\n\t\t\t\tctx.restore();\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (isNaN(radius) || radius <= 0) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tctx.beginPath();\r\n\r\n\t\tswitch (style) {\r\n\t\t// Default includes circle\r\n\t\tdefault:\r\n\t\t\tctx.arc(x, y, radius, 0, DOUBLE_PI);\r\n\t\t\tctx.closePath();\r\n\t\t\tbreak;\r\n\t\tcase 'triangle':\r\n\t\t\tctx.moveTo(x + Math.sin(rad) * radius, y - Math.cos(rad) * radius);\r\n\t\t\trad += TWO_THIRDS_PI;\r\n\t\t\tctx.lineTo(x + Math.sin(rad) * radius, y - Math.cos(rad) * radius);\r\n\t\t\trad += TWO_THIRDS_PI;\r\n\t\t\tctx.lineTo(x + Math.sin(rad) * radius, y - Math.cos(rad) * radius);\r\n\t\t\tctx.closePath();\r\n\t\t\tbreak;\r\n\t\tcase 'rectRounded':\r\n\t\t\t// NOTE: the rounded rect implementation changed to use `arc` instead of\r\n\t\t\t// `quadraticCurveTo` since it generates better results when rect is\r\n\t\t\t// almost a circle. 0.516 (instead of 0.5) produces results with visually\r\n\t\t\t// closer proportion to the previous impl and it is inscribed in the\r\n\t\t\t// circle with `radius`. For more details, see the following PRs:\r\n\t\t\t// https://github.com/chartjs/Chart.js/issues/5597\r\n\t\t\t// https://github.com/chartjs/Chart.js/issues/5858\r\n\t\t\tcornerRadius = radius * 0.516;\r\n\t\t\tsize = radius - cornerRadius;\r\n\t\t\txOffset = Math.cos(rad + QUARTER_PI) * size;\r\n\t\t\tyOffset = Math.sin(rad + QUARTER_PI) * size;\r\n\t\t\tctx.arc(x - xOffset, y - yOffset, cornerRadius, rad - PI, rad - HALF_PI);\r\n\t\t\tctx.arc(x + yOffset, y - xOffset, cornerRadius, rad - HALF_PI, rad);\r\n\t\t\tctx.arc(x + xOffset, y + yOffset, cornerRadius, rad, rad + HALF_PI);\r\n\t\t\tctx.arc(x - yOffset, y + xOffset, cornerRadius, rad + HALF_PI, rad + PI);\r\n\t\t\tctx.closePath();\r\n\t\t\tbreak;\r\n\t\tcase 'rect':\r\n\t\t\tif (!rotation) {\r\n\t\t\t\tsize = Math.SQRT1_2 * radius;\r\n\t\t\t\tctx.rect(x - size, y - size, 2 * size, 2 * size);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\trad += QUARTER_PI;\r\n\t\t\t/* falls through */\r\n\t\tcase 'rectRot':\r\n\t\t\txOffset = Math.cos(rad) * radius;\r\n\t\t\tyOffset = Math.sin(rad) * radius;\r\n\t\t\tctx.moveTo(x - xOffset, y - yOffset);\r\n\t\t\tctx.lineTo(x + yOffset, y - xOffset);\r\n\t\t\tctx.lineTo(x + xOffset, y + yOffset);\r\n\t\t\tctx.lineTo(x - yOffset, y + xOffset);\r\n\t\t\tctx.closePath();\r\n\t\t\tbreak;\r\n\t\tcase 'crossRot':\r\n\t\t\trad += QUARTER_PI;\r\n\t\t\t/* falls through */\r\n\t\tcase 'cross':\r\n\t\t\txOffset = Math.cos(rad) * radius;\r\n\t\t\tyOffset = Math.sin(rad) * radius;\r\n\t\t\tctx.moveTo(x - xOffset, y - yOffset);\r\n\t\t\tctx.lineTo(x + xOffset, y + yOffset);\r\n\t\t\tctx.moveTo(x + yOffset, y - xOffset);\r\n\t\t\tctx.lineTo(x - yOffset, y + xOffset);\r\n\t\t\tbreak;\r\n\t\tcase 'star':\r\n\t\t\txOffset = Math.cos(rad) * radius;\r\n\t\t\tyOffset = Math.sin(rad) * radius;\r\n\t\t\tctx.moveTo(x - xOffset, y - yOffset);\r\n\t\t\tctx.lineTo(x + xOffset, y + yOffset);\r\n\t\t\tctx.moveTo(x + yOffset, y - xOffset);\r\n\t\t\tctx.lineTo(x - yOffset, y + xOffset);\r\n\t\t\trad += QUARTER_PI;\r\n\t\t\txOffset = Math.cos(rad) * radius;\r\n\t\t\tyOffset = Math.sin(rad) * radius;\r\n\t\t\tctx.moveTo(x - xOffset, y - yOffset);\r\n\t\t\tctx.lineTo(x + xOffset, y + yOffset);\r\n\t\t\tctx.moveTo(x + yOffset, y - xOffset);\r\n\t\t\tctx.lineTo(x - yOffset, y + xOffset);\r\n\t\t\tbreak;\r\n\t\tcase 'line':\r\n\t\t\txOffset = Math.cos(rad) * radius;\r\n\t\t\tyOffset = Math.sin(rad) * radius;\r\n\t\t\tctx.moveTo(x - xOffset, y - yOffset);\r\n\t\t\tctx.lineTo(x + xOffset, y + yOffset);\r\n\t\t\tbreak;\r\n\t\tcase 'dash':\r\n\t\t\tctx.moveTo(x, y);\r\n\t\t\tctx.lineTo(x + Math.cos(rad) * radius, y + Math.sin(rad) * radius);\r\n\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\tctx.fill();\r\n\t\tctx.stroke();\r\n\t},\r\n\r\n\t/**\r\n\t * Returns true if the point is inside the rectangle\r\n\t * @param {object} point - The point to test\r\n\t * @param {object} area - The rectangle\r\n\t * @returns {boolean}\r\n\t * @private\r\n\t */\r\n\t_isPointInArea: function(point, area) {\r\n\t\tvar epsilon = 1e-6; // 1e-6 is margin in pixels for accumulated error.\r\n\r\n\t\treturn point.x > area.left - epsilon && point.x < area.right + epsilon &&\r\n\t\t\tpoint.y > area.top - epsilon && point.y < area.bottom + epsilon;\r\n\t},\r\n\r\n\tclipArea: function(ctx, area) {\r\n\t\tctx.save();\r\n\t\tctx.beginPath();\r\n\t\tctx.rect(area.left, area.top, area.right - area.left, area.bottom - area.top);\r\n\t\tctx.clip();\r\n\t},\r\n\r\n\tunclipArea: function(ctx) {\r\n\t\tctx.restore();\r\n\t},\r\n\r\n\tlineTo: function(ctx, previous, target, flip) {\r\n\t\tvar stepped = target.steppedLine;\r\n\t\tif (stepped) {\r\n\t\t\tif (stepped === 'middle') {\r\n\t\t\t\tvar midpoint = (previous.x + target.x) / 2.0;\r\n\t\t\t\tctx.lineTo(midpoint, flip ? target.y : previous.y);\r\n\t\t\t\tctx.lineTo(midpoint, flip ? previous.y : target.y);\r\n\t\t\t} else if ((stepped === 'after' && !flip) || (stepped !== 'after' && flip)) {\r\n\t\t\t\tctx.lineTo(previous.x, target.y);\r\n\t\t\t} else {\r\n\t\t\t\tctx.lineTo(target.x, previous.y);\r\n\t\t\t}\r\n\t\t\tctx.lineTo(target.x, target.y);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (!target.tension) {\r\n\t\t\tctx.lineTo(target.x, target.y);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tctx.bezierCurveTo(\r\n\t\t\tflip ? previous.controlPointPreviousX : previous.controlPointNextX,\r\n\t\t\tflip ? previous.controlPointPreviousY : previous.controlPointNextY,\r\n\t\t\tflip ? target.controlPointNextX : target.controlPointPreviousX,\r\n\t\t\tflip ? target.controlPointNextY : target.controlPointPreviousY,\r\n\t\t\ttarget.x,\r\n\t\t\ttarget.y);\r\n\t}\r\n};\r\n\r\nvar helpers_canvas = exports$1;\r\n\r\n// DEPRECATIONS\r\n\r\n/**\r\n * Provided for backward compatibility, use Chart.helpers.canvas.clear instead.\r\n * @namespace Chart.helpers.clear\r\n * @deprecated since version 2.7.0\r\n * @todo remove at version 3\r\n * @private\r\n */\r\nhelpers_core.clear = exports$1.clear;\r\n\r\n/**\r\n * Provided for backward compatibility, use Chart.helpers.canvas.roundedRect instead.\r\n * @namespace Chart.helpers.drawRoundedRectangle\r\n * @deprecated since version 2.7.0\r\n * @todo remove at version 3\r\n * @private\r\n */\r\nhelpers_core.drawRoundedRectangle = function(ctx) {\r\n\tctx.beginPath();\r\n\texports$1.roundedRect.apply(exports$1, arguments);\r\n};\n\nvar defaults = {\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_set: function(scope, values) {\r\n\t\treturn helpers_core.merge(this[scope] || (this[scope] = {}), values);\r\n\t}\r\n};\r\n\r\n// TODO(v3): remove 'global' from namespace. all default are global and\r\n// there's inconsistency around which options are under 'global'\r\ndefaults._set('global', {\r\n\tdefaultColor: 'rgba(0,0,0,0.1)',\r\n\tdefaultFontColor: '#666',\r\n\tdefaultFontFamily: \"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif\",\r\n\tdefaultFontSize: 12,\r\n\tdefaultFontStyle: 'normal',\r\n\tdefaultLineHeight: 1.2,\r\n\tshowLines: true\r\n});\r\n\r\nvar core_defaults = defaults;\n\nvar valueOrDefault = helpers_core.valueOrDefault;\r\n\r\n/**\r\n * Converts the given font object into a CSS font string.\r\n * @param {object} font - A font object.\r\n * @return {string} The CSS font string. See https://developer.mozilla.org/en-US/docs/Web/CSS/font\r\n * @private\r\n */\r\nfunction toFontString(font) {\r\n\tif (!font || helpers_core.isNullOrUndef(font.size) || helpers_core.isNullOrUndef(font.family)) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\treturn (font.style ? font.style + ' ' : '')\r\n\t\t+ (font.weight ? font.weight + ' ' : '')\r\n\t\t+ font.size + 'px '\r\n\t\t+ font.family;\r\n}\r\n\r\n/**\r\n * @alias Chart.helpers.options\r\n * @namespace\r\n */\r\nvar helpers_options = {\r\n\t/**\r\n\t * Converts the given line height `value` in pixels for a specific font `size`.\r\n\t * @param {number|string} value - The lineHeight to parse (eg. 1.6, '14px', '75%', '1.6em').\r\n\t * @param {number} size - The font size (in pixels) used to resolve relative `value`.\r\n\t * @returns {number} The effective line height in pixels (size * 1.2 if value is invalid).\r\n\t * @see https://developer.mozilla.org/en-US/docs/Web/CSS/line-height\r\n\t * @since 2.7.0\r\n\t */\r\n\ttoLineHeight: function(value, size) {\r\n\t\tvar matches = ('' + value).match(/^(normal|(\\d+(?:\\.\\d+)?)(px|em|%)?)$/);\r\n\t\tif (!matches || matches[1] === 'normal') {\r\n\t\t\treturn size * 1.2;\r\n\t\t}\r\n\r\n\t\tvalue = +matches[2];\r\n\r\n\t\tswitch (matches[3]) {\r\n\t\tcase 'px':\r\n\t\t\treturn value;\r\n\t\tcase '%':\r\n\t\t\tvalue /= 100;\r\n\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\treturn size * value;\r\n\t},\r\n\r\n\t/**\r\n\t * Converts the given value into a padding object with pre-computed width/height.\r\n\t * @param {number|object} value - If a number, set the value to all TRBL component,\r\n\t * else, if and object, use defined properties and sets undefined ones to 0.\r\n\t * @returns {object} The padding values (top, right, bottom, left, width, height)\r\n\t * @since 2.7.0\r\n\t */\r\n\ttoPadding: function(value) {\r\n\t\tvar t, r, b, l;\r\n\r\n\t\tif (helpers_core.isObject(value)) {\r\n\t\t\tt = +value.top || 0;\r\n\t\t\tr = +value.right || 0;\r\n\t\t\tb = +value.bottom || 0;\r\n\t\t\tl = +value.left || 0;\r\n\t\t} else {\r\n\t\t\tt = r = b = l = +value || 0;\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\ttop: t,\r\n\t\t\tright: r,\r\n\t\t\tbottom: b,\r\n\t\t\tleft: l,\r\n\t\t\theight: t + b,\r\n\t\t\twidth: l + r\r\n\t\t};\r\n\t},\r\n\r\n\t/**\r\n\t * Parses font options and returns the font object.\r\n\t * @param {object} options - A object that contains font options to be parsed.\r\n\t * @return {object} The font object.\r\n\t * @todo Support font.* options and renamed to toFont().\r\n\t * @private\r\n\t */\r\n\t_parseFont: function(options) {\r\n\t\tvar globalDefaults = core_defaults.global;\r\n\t\tvar size = valueOrDefault(options.fontSize, globalDefaults.defaultFontSize);\r\n\t\tvar font = {\r\n\t\t\tfamily: valueOrDefault(options.fontFamily, globalDefaults.defaultFontFamily),\r\n\t\t\tlineHeight: helpers_core.options.toLineHeight(valueOrDefault(options.lineHeight, globalDefaults.defaultLineHeight), size),\r\n\t\t\tsize: size,\r\n\t\t\tstyle: valueOrDefault(options.fontStyle, globalDefaults.defaultFontStyle),\r\n\t\t\tweight: null,\r\n\t\t\tstring: ''\r\n\t\t};\r\n\r\n\t\tfont.string = toFontString(font);\r\n\t\treturn font;\r\n\t},\r\n\r\n\t/**\r\n\t * Evaluates the given `inputs` sequentially and returns the first defined value.\r\n\t * @param {Array} inputs - An array of values, falling back to the last value.\r\n\t * @param {object} [context] - If defined and the current value is a function, the value\r\n\t * is called with `context` as first argument and the result becomes the new input.\r\n\t * @param {number} [index] - If defined and the current value is an array, the value\r\n\t * at `index` become the new input.\r\n\t * @param {object} [info] - object to return information about resolution in\r\n\t * @param {boolean} [info.cacheable] - Will be set to `false` if option is not cacheable.\r\n\t * @since 2.7.0\r\n\t */\r\n\tresolve: function(inputs, context, index, info) {\r\n\t\tvar cacheable = true;\r\n\t\tvar i, ilen, value;\r\n\r\n\t\tfor (i = 0, ilen = inputs.length; i < ilen; ++i) {\r\n\t\t\tvalue = inputs[i];\r\n\t\t\tif (value === undefined) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tif (context !== undefined && typeof value === 'function') {\r\n\t\t\t\tvalue = value(context);\r\n\t\t\t\tcacheable = false;\r\n\t\t\t}\r\n\t\t\tif (index !== undefined && helpers_core.isArray(value)) {\r\n\t\t\t\tvalue = value[index];\r\n\t\t\t\tcacheable = false;\r\n\t\t\t}\r\n\t\t\tif (value !== undefined) {\r\n\t\t\t\tif (info && !cacheable) {\r\n\t\t\t\t\tinfo.cacheable = false;\r\n\t\t\t\t}\r\n\t\t\t\treturn value;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\n\n/**\r\n * @alias Chart.helpers.math\r\n * @namespace\r\n */\r\nvar exports$2 = {\r\n\t/**\r\n\t * Returns an array of factors sorted from 1 to sqrt(value)\r\n\t * @private\r\n\t */\r\n\t_factorize: function(value) {\r\n\t\tvar result = [];\r\n\t\tvar sqrt = Math.sqrt(value);\r\n\t\tvar i;\r\n\r\n\t\tfor (i = 1; i < sqrt; i++) {\r\n\t\t\tif (value % i === 0) {\r\n\t\t\t\tresult.push(i);\r\n\t\t\t\tresult.push(value / i);\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (sqrt === (sqrt | 0)) { // if value is a square number\r\n\t\t\tresult.push(sqrt);\r\n\t\t}\r\n\r\n\t\tresult.sort(function(a, b) {\r\n\t\t\treturn a - b;\r\n\t\t}).pop();\r\n\t\treturn result;\r\n\t},\r\n\r\n\tlog10: Math.log10 || function(x) {\r\n\t\tvar exponent = Math.log(x) * Math.LOG10E; // Math.LOG10E = 1 / Math.LN10.\r\n\t\t// Check for whole powers of 10,\r\n\t\t// which due to floating point rounding error should be corrected.\r\n\t\tvar powerOf10 = Math.round(exponent);\r\n\t\tvar isPowerOf10 = x === Math.pow(10, powerOf10);\r\n\r\n\t\treturn isPowerOf10 ? powerOf10 : exponent;\r\n\t}\r\n};\r\n\r\nvar helpers_math = exports$2;\r\n\r\n// DEPRECATIONS\r\n\r\n/**\r\n * Provided for backward compatibility, use Chart.helpers.math.log10 instead.\r\n * @namespace Chart.helpers.log10\r\n * @deprecated since version 2.9.0\r\n * @todo remove at version 3\r\n * @private\r\n */\r\nhelpers_core.log10 = exports$2.log10;\n\nvar getRtlAdapter = function(rectX, width) {\r\n\treturn {\r\n\t\tx: function(x) {\r\n\t\t\treturn rectX + rectX + width - x;\r\n\t\t},\r\n\t\tsetWidth: function(w) {\r\n\t\t\twidth = w;\r\n\t\t},\r\n\t\ttextAlign: function(align) {\r\n\t\t\tif (align === 'center') {\r\n\t\t\t\treturn align;\r\n\t\t\t}\r\n\t\t\treturn align === 'right' ? 'left' : 'right';\r\n\t\t},\r\n\t\txPlus: function(x, value) {\r\n\t\t\treturn x - value;\r\n\t\t},\r\n\t\tleftForLtr: function(x, itemWidth) {\r\n\t\t\treturn x - itemWidth;\r\n\t\t},\r\n\t};\r\n};\r\n\r\nvar getLtrAdapter = function() {\r\n\treturn {\r\n\t\tx: function(x) {\r\n\t\t\treturn x;\r\n\t\t},\r\n\t\tsetWidth: function(w) { // eslint-disable-line no-unused-vars\r\n\t\t},\r\n\t\ttextAlign: function(align) {\r\n\t\t\treturn align;\r\n\t\t},\r\n\t\txPlus: function(x, value) {\r\n\t\t\treturn x + value;\r\n\t\t},\r\n\t\tleftForLtr: function(x, _itemWidth) { // eslint-disable-line no-unused-vars\r\n\t\t\treturn x;\r\n\t\t},\r\n\t};\r\n};\r\n\r\nvar getAdapter = function(rtl, rectX, width) {\r\n\treturn rtl ? getRtlAdapter(rectX, width) : getLtrAdapter();\r\n};\r\n\r\nvar overrideTextDirection = function(ctx, direction) {\r\n\tvar style, original;\r\n\tif (direction === 'ltr' || direction === 'rtl') {\r\n\t\tstyle = ctx.canvas.style;\r\n\t\toriginal = [\r\n\t\t\tstyle.getPropertyValue('direction'),\r\n\t\t\tstyle.getPropertyPriority('direction'),\r\n\t\t];\r\n\r\n\t\tstyle.setProperty('direction', direction, 'important');\r\n\t\tctx.prevTextDirection = original;\r\n\t}\r\n};\r\n\r\nvar restoreTextDirection = function(ctx) {\r\n\tvar original = ctx.prevTextDirection;\r\n\tif (original !== undefined) {\r\n\t\tdelete ctx.prevTextDirection;\r\n\t\tctx.canvas.style.setProperty('direction', original[0], original[1]);\r\n\t}\r\n};\r\n\r\nvar helpers_rtl = {\r\n\tgetRtlAdapter: getAdapter,\r\n\toverrideTextDirection: overrideTextDirection,\r\n\trestoreTextDirection: restoreTextDirection,\r\n};\n\nvar helpers$1 = helpers_core;\r\nvar easing = helpers_easing;\r\nvar canvas = helpers_canvas;\r\nvar options = helpers_options;\r\nvar math = helpers_math;\r\nvar rtl = helpers_rtl;\nhelpers$1.easing = easing;\nhelpers$1.canvas = canvas;\nhelpers$1.options = options;\nhelpers$1.math = math;\nhelpers$1.rtl = rtl;\n\nfunction interpolate(start, view, model, ease) {\r\n\tvar keys = Object.keys(model);\r\n\tvar i, ilen, key, actual, origin, target, type, c0, c1;\r\n\r\n\tfor (i = 0, ilen = keys.length; i < ilen; ++i) {\r\n\t\tkey = keys[i];\r\n\r\n\t\ttarget = model[key];\r\n\r\n\t\t// if a value is added to the model after pivot() has been called, the view\r\n\t\t// doesn't contain it, so let's initialize the view to the target value.\r\n\t\tif (!view.hasOwnProperty(key)) {\r\n\t\t\tview[key] = target;\r\n\t\t}\r\n\r\n\t\tactual = view[key];\r\n\r\n\t\tif (actual === target || key[0] === '_') {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\r\n\t\tif (!start.hasOwnProperty(key)) {\r\n\t\t\tstart[key] = actual;\r\n\t\t}\r\n\r\n\t\torigin = start[key];\r\n\r\n\t\ttype = typeof target;\r\n\r\n\t\tif (type === typeof origin) {\r\n\t\t\tif (type === 'string') {\r\n\t\t\t\tc0 = chartjsColor(origin);\r\n\t\t\t\tif (c0.valid) {\r\n\t\t\t\t\tc1 = chartjsColor(target);\r\n\t\t\t\t\tif (c1.valid) {\r\n\t\t\t\t\t\tview[key] = c1.mix(c0, ease).rgbString();\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else if (helpers$1.isFinite(origin) && helpers$1.isFinite(target)) {\r\n\t\t\t\tview[key] = origin + (target - origin) * ease;\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tview[key] = target;\r\n\t}\r\n}\r\n\r\nvar Element = function(configuration) {\r\n\thelpers$1.extend(this, configuration);\r\n\tthis.initialize.apply(this, arguments);\r\n};\r\n\r\nhelpers$1.extend(Element.prototype, {\r\n\t_type: undefined,\r\n\r\n\tinitialize: function() {\r\n\t\tthis.hidden = false;\r\n\t},\r\n\r\n\tpivot: function() {\r\n\t\tvar me = this;\r\n\t\tif (!me._view) {\r\n\t\t\tme._view = helpers$1.extend({}, me._model);\r\n\t\t}\r\n\t\tme._start = {};\r\n\t\treturn me;\r\n\t},\r\n\r\n\ttransition: function(ease) {\r\n\t\tvar me = this;\r\n\t\tvar model = me._model;\r\n\t\tvar start = me._start;\r\n\t\tvar view = me._view;\r\n\r\n\t\t// No animation -> No Transition\r\n\t\tif (!model || ease === 1) {\r\n\t\t\tme._view = helpers$1.extend({}, model);\r\n\t\t\tme._start = null;\r\n\t\t\treturn me;\r\n\t\t}\r\n\r\n\t\tif (!view) {\r\n\t\t\tview = me._view = {};\r\n\t\t}\r\n\r\n\t\tif (!start) {\r\n\t\t\tstart = me._start = {};\r\n\t\t}\r\n\r\n\t\tinterpolate(start, view, model, ease);\r\n\r\n\t\treturn me;\r\n\t},\r\n\r\n\ttooltipPosition: function() {\r\n\t\treturn {\r\n\t\t\tx: this._model.x,\r\n\t\t\ty: this._model.y\r\n\t\t};\r\n\t},\r\n\r\n\thasValue: function() {\r\n\t\treturn helpers$1.isNumber(this._model.x) && helpers$1.isNumber(this._model.y);\r\n\t}\r\n});\r\n\r\nElement.extend = helpers$1.inherits;\r\n\r\nvar core_element = Element;\n\nvar exports$3 = core_element.extend({\r\n\tchart: null, // the animation associated chart instance\r\n\tcurrentStep: 0, // the current animation step\r\n\tnumSteps: 60, // default number of steps\r\n\teasing: '', // the easing to use for this animation\r\n\trender: null, // render function used by the animation service\r\n\r\n\tonAnimationProgress: null, // user specified callback to fire on each step of the animation\r\n\tonAnimationComplete: null, // user specified callback to fire when the animation finishes\r\n});\r\n\r\nvar core_animation = exports$3;\r\n\r\n// DEPRECATIONS\r\n\r\n/**\r\n * Provided for backward compatibility, use Chart.Animation instead\r\n * @prop Chart.Animation#animationObject\r\n * @deprecated since version 2.6.0\r\n * @todo remove at version 3\r\n */\r\nObject.defineProperty(exports$3.prototype, 'animationObject', {\r\n\tget: function() {\r\n\t\treturn this;\r\n\t}\r\n});\r\n\r\n/**\r\n * Provided for backward compatibility, use Chart.Animation#chart instead\r\n * @prop Chart.Animation#chartInstance\r\n * @deprecated since version 2.6.0\r\n * @todo remove at version 3\r\n */\r\nObject.defineProperty(exports$3.prototype, 'chartInstance', {\r\n\tget: function() {\r\n\t\treturn this.chart;\r\n\t},\r\n\tset: function(value) {\r\n\t\tthis.chart = value;\r\n\t}\r\n});\n\ncore_defaults._set('global', {\r\n\tanimation: {\r\n\t\tduration: 1000,\r\n\t\teasing: 'easeOutQuart',\r\n\t\tonProgress: helpers$1.noop,\r\n\t\tonComplete: helpers$1.noop\r\n\t}\r\n});\r\n\r\nvar core_animations = {\r\n\tanimations: [],\r\n\trequest: null,\r\n\r\n\t/**\r\n\t * @param {Chart} chart - The chart to animate.\r\n\t * @param {Chart.Animation} animation - The animation that we will animate.\r\n\t * @param {number} duration - The animation duration in ms.\r\n\t * @param {boolean} lazy - if true, the chart is not marked as animating to enable more responsive interactions\r\n\t */\r\n\taddAnimation: function(chart, animation, duration, lazy) {\r\n\t\tvar animations = this.animations;\r\n\t\tvar i, ilen;\r\n\r\n\t\tanimation.chart = chart;\r\n\t\tanimation.startTime = Date.now();\r\n\t\tanimation.duration = duration;\r\n\r\n\t\tif (!lazy) {\r\n\t\t\tchart.animating = true;\r\n\t\t}\r\n\r\n\t\tfor (i = 0, ilen = animations.length; i < ilen; ++i) {\r\n\t\t\tif (animations[i].chart === chart) {\r\n\t\t\t\tanimations[i] = animation;\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tanimations.push(animation);\r\n\r\n\t\t// If there are no animations queued, manually kickstart a digest, for lack of a better word\r\n\t\tif (animations.length === 1) {\r\n\t\t\tthis.requestAnimationFrame();\r\n\t\t}\r\n\t},\r\n\r\n\tcancelAnimation: function(chart) {\r\n\t\tvar index = helpers$1.findIndex(this.animations, function(animation) {\r\n\t\t\treturn animation.chart === chart;\r\n\t\t});\r\n\r\n\t\tif (index !== -1) {\r\n\t\t\tthis.animations.splice(index, 1);\r\n\t\t\tchart.animating = false;\r\n\t\t}\r\n\t},\r\n\r\n\trequestAnimationFrame: function() {\r\n\t\tvar me = this;\r\n\t\tif (me.request === null) {\r\n\t\t\t// Skip animation frame requests until the active one is executed.\r\n\t\t\t// This can happen when processing mouse events, e.g. 'mousemove'\r\n\t\t\t// and 'mouseout' events will trigger multiple renders.\r\n\t\t\tme.request = helpers$1.requestAnimFrame.call(window, function() {\r\n\t\t\t\tme.request = null;\r\n\t\t\t\tme.startDigest();\r\n\t\t\t});\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\tstartDigest: function() {\r\n\t\tvar me = this;\r\n\r\n\t\tme.advance();\r\n\r\n\t\t// Do we have more stuff to animate?\r\n\t\tif (me.animations.length > 0) {\r\n\t\t\tme.requestAnimationFrame();\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\tadvance: function() {\r\n\t\tvar animations = this.animations;\r\n\t\tvar animation, chart, numSteps, nextStep;\r\n\t\tvar i = 0;\r\n\r\n\t\t// 1 animation per chart, so we are looping charts here\r\n\t\twhile (i < animations.length) {\r\n\t\t\tanimation = animations[i];\r\n\t\t\tchart = animation.chart;\r\n\t\t\tnumSteps = animation.numSteps;\r\n\r\n\t\t\t// Make sure that currentStep starts at 1\r\n\t\t\t// https://github.com/chartjs/Chart.js/issues/6104\r\n\t\t\tnextStep = Math.floor((Date.now() - animation.startTime) / animation.duration * numSteps) + 1;\r\n\t\t\tanimation.currentStep = Math.min(nextStep, numSteps);\r\n\r\n\t\t\thelpers$1.callback(animation.render, [chart, animation], chart);\r\n\t\t\thelpers$1.callback(animation.onAnimationProgress, [animation], chart);\r\n\r\n\t\t\tif (animation.currentStep >= numSteps) {\r\n\t\t\t\thelpers$1.callback(animation.onAnimationComplete, [animation], chart);\r\n\t\t\t\tchart.animating = false;\r\n\t\t\t\tanimations.splice(i, 1);\r\n\t\t\t} else {\r\n\t\t\t\t++i;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\n\nvar resolve = helpers$1.options.resolve;\r\n\r\nvar arrayEvents = ['push', 'pop', 'shift', 'splice', 'unshift'];\r\n\r\n/**\r\n * Hooks the array methods that add or remove values ('push', pop', 'shift', 'splice',\r\n * 'unshift') and notify the listener AFTER the array has been altered. Listeners are\r\n * called on the 'onData*' callbacks (e.g. onDataPush, etc.) with same arguments.\r\n */\r\nfunction listenArrayEvents(array, listener) {\r\n\tif (array._chartjs) {\r\n\t\tarray._chartjs.listeners.push(listener);\r\n\t\treturn;\r\n\t}\r\n\r\n\tObject.defineProperty(array, '_chartjs', {\r\n\t\tconfigurable: true,\r\n\t\tenumerable: false,\r\n\t\tvalue: {\r\n\t\t\tlisteners: [listener]\r\n\t\t}\r\n\t});\r\n\r\n\tarrayEvents.forEach(function(key) {\r\n\t\tvar method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\r\n\t\tvar base = array[key];\r\n\r\n\t\tObject.defineProperty(array, key, {\r\n\t\t\tconfigurable: true,\r\n\t\t\tenumerable: false,\r\n\t\t\tvalue: function() {\r\n\t\t\t\tvar args = Array.prototype.slice.call(arguments);\r\n\t\t\t\tvar res = base.apply(this, args);\r\n\r\n\t\t\t\thelpers$1.each(array._chartjs.listeners, function(object) {\r\n\t\t\t\t\tif (typeof object[method] === 'function') {\r\n\t\t\t\t\t\tobject[method].apply(object, args);\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\r\n\t\t\t\treturn res;\r\n\t\t\t}\r\n\t\t});\r\n\t});\r\n}\r\n\r\n/**\r\n * Removes the given array event listener and cleanup extra attached properties (such as\r\n * the _chartjs stub and overridden methods) if array doesn't have any more listeners.\r\n */\r\nfunction unlistenArrayEvents(array, listener) {\r\n\tvar stub = array._chartjs;\r\n\tif (!stub) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tvar listeners = stub.listeners;\r\n\tvar index = listeners.indexOf(listener);\r\n\tif (index !== -1) {\r\n\t\tlisteners.splice(index, 1);\r\n\t}\r\n\r\n\tif (listeners.length > 0) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tarrayEvents.forEach(function(key) {\r\n\t\tdelete array[key];\r\n\t});\r\n\r\n\tdelete array._chartjs;\r\n}\r\n\r\n// Base class for all dataset controllers (line, bar, etc)\r\nvar DatasetController = function(chart, datasetIndex) {\r\n\tthis.initialize(chart, datasetIndex);\r\n};\r\n\r\nhelpers$1.extend(DatasetController.prototype, {\r\n\r\n\t/**\r\n\t * Element type used to generate a meta dataset (e.g. Chart.element.Line).\r\n\t * @type {Chart.core.element}\r\n\t */\r\n\tdatasetElementType: null,\r\n\r\n\t/**\r\n\t * Element type used to generate a meta data (e.g. Chart.element.Point).\r\n\t * @type {Chart.core.element}\r\n\t */\r\n\tdataElementType: null,\r\n\r\n\t/**\r\n\t * Dataset element option keys to be resolved in _resolveDatasetElementOptions.\r\n\t * A derived controller may override this to resolve controller-specific options.\r\n\t * The keys defined here are for backward compatibility for legend styles.\r\n\t * @private\r\n\t */\r\n\t_datasetElementOptions: [\r\n\t\t'backgroundColor',\r\n\t\t'borderCapStyle',\r\n\t\t'borderColor',\r\n\t\t'borderDash',\r\n\t\t'borderDashOffset',\r\n\t\t'borderJoinStyle',\r\n\t\t'borderWidth'\r\n\t],\r\n\r\n\t/**\r\n\t * Data element option keys to be resolved in _resolveDataElementOptions.\r\n\t * A derived controller may override this to resolve controller-specific options.\r\n\t * The keys defined here are for backward compatibility for legend styles.\r\n\t * @private\r\n\t */\r\n\t_dataElementOptions: [\r\n\t\t'backgroundColor',\r\n\t\t'borderColor',\r\n\t\t'borderWidth',\r\n\t\t'pointStyle'\r\n\t],\r\n\r\n\tinitialize: function(chart, datasetIndex) {\r\n\t\tvar me = this;\r\n\t\tme.chart = chart;\r\n\t\tme.index = datasetIndex;\r\n\t\tme.linkScales();\r\n\t\tme.addElements();\r\n\t\tme._type = me.getMeta().type;\r\n\t},\r\n\r\n\tupdateIndex: function(datasetIndex) {\r\n\t\tthis.index = datasetIndex;\r\n\t},\r\n\r\n\tlinkScales: function() {\r\n\t\tvar me = this;\r\n\t\tvar meta = me.getMeta();\r\n\t\tvar chart = me.chart;\r\n\t\tvar scales = chart.scales;\r\n\t\tvar dataset = me.getDataset();\r\n\t\tvar scalesOpts = chart.options.scales;\r\n\r\n\t\tif (meta.xAxisID === null || !(meta.xAxisID in scales) || dataset.xAxisID) {\r\n\t\t\tmeta.xAxisID = dataset.xAxisID || scalesOpts.xAxes[0].id;\r\n\t\t}\r\n\t\tif (meta.yAxisID === null || !(meta.yAxisID in scales) || dataset.yAxisID) {\r\n\t\t\tmeta.yAxisID = dataset.yAxisID || scalesOpts.yAxes[0].id;\r\n\t\t}\r\n\t},\r\n\r\n\tgetDataset: function() {\r\n\t\treturn this.chart.data.datasets[this.index];\r\n\t},\r\n\r\n\tgetMeta: function() {\r\n\t\treturn this.chart.getDatasetMeta(this.index);\r\n\t},\r\n\r\n\tgetScaleForId: function(scaleID) {\r\n\t\treturn this.chart.scales[scaleID];\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_getValueScaleId: function() {\r\n\t\treturn this.getMeta().yAxisID;\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_getIndexScaleId: function() {\r\n\t\treturn this.getMeta().xAxisID;\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_getValueScale: function() {\r\n\t\treturn this.getScaleForId(this._getValueScaleId());\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_getIndexScale: function() {\r\n\t\treturn this.getScaleForId(this._getIndexScaleId());\r\n\t},\r\n\r\n\treset: function() {\r\n\t\tthis._update(true);\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\tdestroy: function() {\r\n\t\tif (this._data) {\r\n\t\t\tunlistenArrayEvents(this._data, this);\r\n\t\t}\r\n\t},\r\n\r\n\tcreateMetaDataset: function() {\r\n\t\tvar me = this;\r\n\t\tvar type = me.datasetElementType;\r\n\t\treturn type && new type({\r\n\t\t\t_chart: me.chart,\r\n\t\t\t_datasetIndex: me.index\r\n\t\t});\r\n\t},\r\n\r\n\tcreateMetaData: function(index) {\r\n\t\tvar me = this;\r\n\t\tvar type = me.dataElementType;\r\n\t\treturn type && new type({\r\n\t\t\t_chart: me.chart,\r\n\t\t\t_datasetIndex: me.index,\r\n\t\t\t_index: index\r\n\t\t});\r\n\t},\r\n\r\n\taddElements: function() {\r\n\t\tvar me = this;\r\n\t\tvar meta = me.getMeta();\r\n\t\tvar data = me.getDataset().data || [];\r\n\t\tvar metaData = meta.data;\r\n\t\tvar i, ilen;\r\n\r\n\t\tfor (i = 0, ilen = data.length; i < ilen; ++i) {\r\n\t\t\tmetaData[i] = metaData[i] || me.createMetaData(i);\r\n\t\t}\r\n\r\n\t\tmeta.dataset = meta.dataset || me.createMetaDataset();\r\n\t},\r\n\r\n\taddElementAndReset: function(index) {\r\n\t\tvar element = this.createMetaData(index);\r\n\t\tthis.getMeta().data.splice(index, 0, element);\r\n\t\tthis.updateElement(element, index, true);\r\n\t},\r\n\r\n\tbuildOrUpdateElements: function() {\r\n\t\tvar me = this;\r\n\t\tvar dataset = me.getDataset();\r\n\t\tvar data = dataset.data || (dataset.data = []);\r\n\r\n\t\t// In order to correctly handle data addition/deletion animation (an thus simulate\r\n\t\t// real-time charts), we need to monitor these data modifications and synchronize\r\n\t\t// the internal meta data accordingly.\r\n\t\tif (me._data !== data) {\r\n\t\t\tif (me._data) {\r\n\t\t\t\t// This case happens when the user replaced the data array instance.\r\n\t\t\t\tunlistenArrayEvents(me._data, me);\r\n\t\t\t}\r\n\r\n\t\t\tif (data && Object.isExtensible(data)) {\r\n\t\t\t\tlistenArrayEvents(data, me);\r\n\t\t\t}\r\n\t\t\tme._data = data;\r\n\t\t}\r\n\r\n\t\t// Re-sync meta data in case the user replaced the data array or if we missed\r\n\t\t// any updates and so make sure that we handle number of datapoints changing.\r\n\t\tme.resyncElements();\r\n\t},\r\n\r\n\t/**\r\n\t * Returns the merged user-supplied and default dataset-level options\r\n\t * @private\r\n\t */\r\n\t_configure: function() {\r\n\t\tvar me = this;\r\n\t\tme._config = helpers$1.merge(Object.create(null), [\r\n\t\t\tme.chart.options.datasets[me._type],\r\n\t\t\tme.getDataset(),\r\n\t\t], {\r\n\t\t\tmerger: function(key, target, source) {\r\n\t\t\t\tif (key !== '_meta' && key !== 'data') {\r\n\t\t\t\t\thelpers$1._merger(key, target, source);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t},\r\n\r\n\t_update: function(reset) {\r\n\t\tvar me = this;\r\n\t\tme._configure();\r\n\t\tme._cachedDataOpts = null;\r\n\t\tme.update(reset);\r\n\t},\r\n\r\n\tupdate: helpers$1.noop,\r\n\r\n\ttransition: function(easingValue) {\r\n\t\tvar meta = this.getMeta();\r\n\t\tvar elements = meta.data || [];\r\n\t\tvar ilen = elements.length;\r\n\t\tvar i = 0;\r\n\r\n\t\tfor (; i < ilen; ++i) {\r\n\t\t\telements[i].transition(easingValue);\r\n\t\t}\r\n\r\n\t\tif (meta.dataset) {\r\n\t\t\tmeta.dataset.transition(easingValue);\r\n\t\t}\r\n\t},\r\n\r\n\tdraw: function() {\r\n\t\tvar meta = this.getMeta();\r\n\t\tvar elements = meta.data || [];\r\n\t\tvar ilen = elements.length;\r\n\t\tvar i = 0;\r\n\r\n\t\tif (meta.dataset) {\r\n\t\t\tmeta.dataset.draw();\r\n\t\t}\r\n\r\n\t\tfor (; i < ilen; ++i) {\r\n\t\t\telements[i].draw();\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Returns a set of predefined style properties that should be used to represent the dataset\r\n\t * or the data if the index is specified\r\n\t * @param {number} index - data index\r\n\t * @return {IStyleInterface} style object\r\n\t */\r\n\tgetStyle: function(index) {\r\n\t\tvar me = this;\r\n\t\tvar meta = me.getMeta();\r\n\t\tvar dataset = meta.dataset;\r\n\t\tvar style;\r\n\r\n\t\tme._configure();\r\n\t\tif (dataset && index === undefined) {\r\n\t\t\tstyle = me._resolveDatasetElementOptions(dataset || {});\r\n\t\t} else {\r\n\t\t\tindex = index || 0;\r\n\t\t\tstyle = me._resolveDataElementOptions(meta.data[index] || {}, index);\r\n\t\t}\r\n\r\n\t\tif (style.fill === false || style.fill === null) {\r\n\t\t\tstyle.backgroundColor = style.borderColor;\r\n\t\t}\r\n\r\n\t\treturn style;\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_resolveDatasetElementOptions: function(element, hover) {\r\n\t\tvar me = this;\r\n\t\tvar chart = me.chart;\r\n\t\tvar datasetOpts = me._config;\r\n\t\tvar custom = element.custom || {};\r\n\t\tvar options = chart.options.elements[me.datasetElementType.prototype._type] || {};\r\n\t\tvar elementOptions = me._datasetElementOptions;\r\n\t\tvar values = {};\r\n\t\tvar i, ilen, key, readKey;\r\n\r\n\t\t// Scriptable options\r\n\t\tvar context = {\r\n\t\t\tchart: chart,\r\n\t\t\tdataset: me.getDataset(),\r\n\t\t\tdatasetIndex: me.index,\r\n\t\t\thover: hover\r\n\t\t};\r\n\r\n\t\tfor (i = 0, ilen = elementOptions.length; i < ilen; ++i) {\r\n\t\t\tkey = elementOptions[i];\r\n\t\t\treadKey = hover ? 'hover' + key.charAt(0).toUpperCase() + key.slice(1) : key;\r\n\t\t\tvalues[key] = resolve([\r\n\t\t\t\tcustom[readKey],\r\n\t\t\t\tdatasetOpts[readKey],\r\n\t\t\t\toptions[readKey]\r\n\t\t\t], context);\r\n\t\t}\r\n\r\n\t\treturn values;\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_resolveDataElementOptions: function(element, index) {\r\n\t\tvar me = this;\r\n\t\tvar custom = element && element.custom;\r\n\t\tvar cached = me._cachedDataOpts;\r\n\t\tif (cached && !custom) {\r\n\t\t\treturn cached;\r\n\t\t}\r\n\t\tvar chart = me.chart;\r\n\t\tvar datasetOpts = me._config;\r\n\t\tvar options = chart.options.elements[me.dataElementType.prototype._type] || {};\r\n\t\tvar elementOptions = me._dataElementOptions;\r\n\t\tvar values = {};\r\n\r\n\t\t// Scriptable options\r\n\t\tvar context = {\r\n\t\t\tchart: chart,\r\n\t\t\tdataIndex: index,\r\n\t\t\tdataset: me.getDataset(),\r\n\t\t\tdatasetIndex: me.index\r\n\t\t};\r\n\r\n\t\t// `resolve` sets cacheable to `false` if any option is indexed or scripted\r\n\t\tvar info = {cacheable: !custom};\r\n\r\n\t\tvar keys, i, ilen, key;\r\n\r\n\t\tcustom = custom || {};\r\n\r\n\t\tif (helpers$1.isArray(elementOptions)) {\r\n\t\t\tfor (i = 0, ilen = elementOptions.length; i < ilen; ++i) {\r\n\t\t\t\tkey = elementOptions[i];\r\n\t\t\t\tvalues[key] = resolve([\r\n\t\t\t\t\tcustom[key],\r\n\t\t\t\t\tdatasetOpts[key],\r\n\t\t\t\t\toptions[key]\r\n\t\t\t\t], context, index, info);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tkeys = Object.keys(elementOptions);\r\n\t\t\tfor (i = 0, ilen = keys.length; i < ilen; ++i) {\r\n\t\t\t\tkey = keys[i];\r\n\t\t\t\tvalues[key] = resolve([\r\n\t\t\t\t\tcustom[key],\r\n\t\t\t\t\tdatasetOpts[elementOptions[key]],\r\n\t\t\t\t\tdatasetOpts[key],\r\n\t\t\t\t\toptions[key]\r\n\t\t\t\t], context, index, info);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (info.cacheable) {\r\n\t\t\tme._cachedDataOpts = Object.freeze(values);\r\n\t\t}\r\n\r\n\t\treturn values;\r\n\t},\r\n\r\n\tremoveHoverStyle: function(element) {\r\n\t\thelpers$1.merge(element._model, element.$previousStyle || {});\r\n\t\tdelete element.$previousStyle;\r\n\t},\r\n\r\n\tsetHoverStyle: function(element) {\r\n\t\tvar dataset = this.chart.data.datasets[element._datasetIndex];\r\n\t\tvar index = element._index;\r\n\t\tvar custom = element.custom || {};\r\n\t\tvar model = element._model;\r\n\t\tvar getHoverColor = helpers$1.getHoverColor;\r\n\r\n\t\telement.$previousStyle = {\r\n\t\t\tbackgroundColor: model.backgroundColor,\r\n\t\t\tborderColor: model.borderColor,\r\n\t\t\tborderWidth: model.borderWidth\r\n\t\t};\r\n\r\n\t\tmodel.backgroundColor = resolve([custom.hoverBackgroundColor, dataset.hoverBackgroundColor, getHoverColor(model.backgroundColor)], undefined, index);\r\n\t\tmodel.borderColor = resolve([custom.hoverBorderColor, dataset.hoverBorderColor, getHoverColor(model.borderColor)], undefined, index);\r\n\t\tmodel.borderWidth = resolve([custom.hoverBorderWidth, dataset.hoverBorderWidth, model.borderWidth], undefined, index);\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_removeDatasetHoverStyle: function() {\r\n\t\tvar element = this.getMeta().dataset;\r\n\r\n\t\tif (element) {\r\n\t\t\tthis.removeHoverStyle(element);\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_setDatasetHoverStyle: function() {\r\n\t\tvar element = this.getMeta().dataset;\r\n\t\tvar prev = {};\r\n\t\tvar i, ilen, key, keys, hoverOptions, model;\r\n\r\n\t\tif (!element) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tmodel = element._model;\r\n\t\thoverOptions = this._resolveDatasetElementOptions(element, true);\r\n\r\n\t\tkeys = Object.keys(hoverOptions);\r\n\t\tfor (i = 0, ilen = keys.length; i < ilen; ++i) {\r\n\t\t\tkey = keys[i];\r\n\t\t\tprev[key] = model[key];\r\n\t\t\tmodel[key] = hoverOptions[key];\r\n\t\t}\r\n\r\n\t\telement.$previousStyle = prev;\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\tresyncElements: function() {\r\n\t\tvar me = this;\r\n\t\tvar meta = me.getMeta();\r\n\t\tvar data = me.getDataset().data;\r\n\t\tvar numMeta = meta.data.length;\r\n\t\tvar numData = data.length;\r\n\r\n\t\tif (numData < numMeta) {\r\n\t\t\tmeta.data.splice(numData, numMeta - numData);\r\n\t\t} else if (numData > numMeta) {\r\n\t\t\tme.insertElements(numMeta, numData - numMeta);\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\tinsertElements: function(start, count) {\r\n\t\tfor (var i = 0; i < count; ++i) {\r\n\t\t\tthis.addElementAndReset(start + i);\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\tonDataPush: function() {\r\n\t\tvar count = arguments.length;\r\n\t\tthis.insertElements(this.getDataset().data.length - count, count);\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\tonDataPop: function() {\r\n\t\tthis.getMeta().data.pop();\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\tonDataShift: function() {\r\n\t\tthis.getMeta().data.shift();\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\tonDataSplice: function(start, count) {\r\n\t\tthis.getMeta().data.splice(start, count);\r\n\t\tthis.insertElements(start, arguments.length - 2);\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\tonDataUnshift: function() {\r\n\t\tthis.insertElements(0, arguments.length);\r\n\t}\r\n});\r\n\r\nDatasetController.extend = helpers$1.inherits;\r\n\r\nvar core_datasetController = DatasetController;\n\nvar TAU = Math.PI * 2;\r\n\r\ncore_defaults._set('global', {\r\n\telements: {\r\n\t\tarc: {\r\n\t\t\tbackgroundColor: core_defaults.global.defaultColor,\r\n\t\t\tborderColor: '#fff',\r\n\t\t\tborderWidth: 2,\r\n\t\t\tborderAlign: 'center'\r\n\t\t}\r\n\t}\r\n});\r\n\r\nfunction clipArc(ctx, arc) {\r\n\tvar startAngle = arc.startAngle;\r\n\tvar endAngle = arc.endAngle;\r\n\tvar pixelMargin = arc.pixelMargin;\r\n\tvar angleMargin = pixelMargin / arc.outerRadius;\r\n\tvar x = arc.x;\r\n\tvar y = arc.y;\r\n\r\n\t// Draw an inner border by cliping the arc and drawing a double-width border\r\n\t// Enlarge the clipping arc by 0.33 pixels to eliminate glitches between borders\r\n\tctx.beginPath();\r\n\tctx.arc(x, y, arc.outerRadius, startAngle - angleMargin, endAngle + angleMargin);\r\n\tif (arc.innerRadius > pixelMargin) {\r\n\t\tangleMargin = pixelMargin / arc.innerRadius;\r\n\t\tctx.arc(x, y, arc.innerRadius - pixelMargin, endAngle + angleMargin, startAngle - angleMargin, true);\r\n\t} else {\r\n\t\tctx.arc(x, y, pixelMargin, endAngle + Math.PI / 2, startAngle - Math.PI / 2);\r\n\t}\r\n\tctx.closePath();\r\n\tctx.clip();\r\n}\r\n\r\nfunction drawFullCircleBorders(ctx, vm, arc, inner) {\r\n\tvar endAngle = arc.endAngle;\r\n\tvar i;\r\n\r\n\tif (inner) {\r\n\t\tarc.endAngle = arc.startAngle + TAU;\r\n\t\tclipArc(ctx, arc);\r\n\t\tarc.endAngle = endAngle;\r\n\t\tif (arc.endAngle === arc.startAngle && arc.fullCircles) {\r\n\t\t\tarc.endAngle += TAU;\r\n\t\t\tarc.fullCircles--;\r\n\t\t}\r\n\t}\r\n\r\n\tctx.beginPath();\r\n\tctx.arc(arc.x, arc.y, arc.innerRadius, arc.startAngle + TAU, arc.startAngle, true);\r\n\tfor (i = 0; i < arc.fullCircles; ++i) {\r\n\t\tctx.stroke();\r\n\t}\r\n\r\n\tctx.beginPath();\r\n\tctx.arc(arc.x, arc.y, vm.outerRadius, arc.startAngle, arc.startAngle + TAU);\r\n\tfor (i = 0; i < arc.fullCircles; ++i) {\r\n\t\tctx.stroke();\r\n\t}\r\n}\r\n\r\nfunction drawBorder(ctx, vm, arc) {\r\n\tvar inner = vm.borderAlign === 'inner';\r\n\r\n\tif (inner) {\r\n\t\tctx.lineWidth = vm.borderWidth * 2;\r\n\t\tctx.lineJoin = 'round';\r\n\t} else {\r\n\t\tctx.lineWidth = vm.borderWidth;\r\n\t\tctx.lineJoin = 'bevel';\r\n\t}\r\n\r\n\tif (arc.fullCircles) {\r\n\t\tdrawFullCircleBorders(ctx, vm, arc, inner);\r\n\t}\r\n\r\n\tif (inner) {\r\n\t\tclipArc(ctx, arc);\r\n\t}\r\n\r\n\tctx.beginPath();\r\n\tctx.arc(arc.x, arc.y, vm.outerRadius, arc.startAngle, arc.endAngle);\r\n\tctx.arc(arc.x, arc.y, arc.innerRadius, arc.endAngle, arc.startAngle, true);\r\n\tctx.closePath();\r\n\tctx.stroke();\r\n}\r\n\r\nvar element_arc = core_element.extend({\r\n\t_type: 'arc',\r\n\r\n\tinLabelRange: function(mouseX) {\r\n\t\tvar vm = this._view;\r\n\r\n\t\tif (vm) {\r\n\t\t\treturn (Math.pow(mouseX - vm.x, 2) < Math.pow(vm.radius + vm.hoverRadius, 2));\r\n\t\t}\r\n\t\treturn false;\r\n\t},\r\n\r\n\tinRange: function(chartX, chartY) {\r\n\t\tvar vm = this._view;\r\n\r\n\t\tif (vm) {\r\n\t\t\tvar pointRelativePosition = helpers$1.getAngleFromPoint(vm, {x: chartX, y: chartY});\r\n\t\t\tvar angle = pointRelativePosition.angle;\r\n\t\t\tvar distance = pointRelativePosition.distance;\r\n\r\n\t\t\t// Sanitise angle range\r\n\t\t\tvar startAngle = vm.startAngle;\r\n\t\t\tvar endAngle = vm.endAngle;\r\n\t\t\twhile (endAngle < startAngle) {\r\n\t\t\t\tendAngle += TAU;\r\n\t\t\t}\r\n\t\t\twhile (angle > endAngle) {\r\n\t\t\t\tangle -= TAU;\r\n\t\t\t}\r\n\t\t\twhile (angle < startAngle) {\r\n\t\t\t\tangle += TAU;\r\n\t\t\t}\r\n\r\n\t\t\t// Check if within the range of the open/close angle\r\n\t\t\tvar betweenAngles = (angle >= startAngle && angle <= endAngle);\r\n\t\t\tvar withinRadius = (distance >= vm.innerRadius && distance <= vm.outerRadius);\r\n\r\n\t\t\treturn (betweenAngles && withinRadius);\r\n\t\t}\r\n\t\treturn false;\r\n\t},\r\n\r\n\tgetCenterPoint: function() {\r\n\t\tvar vm = this._view;\r\n\t\tvar halfAngle = (vm.startAngle + vm.endAngle) / 2;\r\n\t\tvar halfRadius = (vm.innerRadius + vm.outerRadius) / 2;\r\n\t\treturn {\r\n\t\t\tx: vm.x + Math.cos(halfAngle) * halfRadius,\r\n\t\t\ty: vm.y + Math.sin(halfAngle) * halfRadius\r\n\t\t};\r\n\t},\r\n\r\n\tgetArea: function() {\r\n\t\tvar vm = this._view;\r\n\t\treturn Math.PI * ((vm.endAngle - vm.startAngle) / (2 * Math.PI)) * (Math.pow(vm.outerRadius, 2) - Math.pow(vm.innerRadius, 2));\r\n\t},\r\n\r\n\ttooltipPosition: function() {\r\n\t\tvar vm = this._view;\r\n\t\tvar centreAngle = vm.startAngle + ((vm.endAngle - vm.startAngle) / 2);\r\n\t\tvar rangeFromCentre = (vm.outerRadius - vm.innerRadius) / 2 + vm.innerRadius;\r\n\r\n\t\treturn {\r\n\t\t\tx: vm.x + (Math.cos(centreAngle) * rangeFromCentre),\r\n\t\t\ty: vm.y + (Math.sin(centreAngle) * rangeFromCentre)\r\n\t\t};\r\n\t},\r\n\r\n\tdraw: function() {\r\n\t\tvar ctx = this._chart.ctx;\r\n\t\tvar vm = this._view;\r\n\t\tvar pixelMargin = (vm.borderAlign === 'inner') ? 0.33 : 0;\r\n\t\tvar arc = {\r\n\t\t\tx: vm.x,\r\n\t\t\ty: vm.y,\r\n\t\t\tinnerRadius: vm.innerRadius,\r\n\t\t\touterRadius: Math.max(vm.outerRadius - pixelMargin, 0),\r\n\t\t\tpixelMargin: pixelMargin,\r\n\t\t\tstartAngle: vm.startAngle,\r\n\t\t\tendAngle: vm.endAngle,\r\n\t\t\tfullCircles: Math.floor(vm.circumference / TAU)\r\n\t\t};\r\n\t\tvar i;\r\n\r\n\t\tctx.save();\r\n\r\n\t\tctx.fillStyle = vm.backgroundColor;\r\n\t\tctx.strokeStyle = vm.borderColor;\r\n\r\n\t\tif (arc.fullCircles) {\r\n\t\t\tarc.endAngle = arc.startAngle + TAU;\r\n\t\t\tctx.beginPath();\r\n\t\t\tctx.arc(arc.x, arc.y, arc.outerRadius, arc.startAngle, arc.endAngle);\r\n\t\t\tctx.arc(arc.x, arc.y, arc.innerRadius, arc.endAngle, arc.startAngle, true);\r\n\t\t\tctx.closePath();\r\n\t\t\tfor (i = 0; i < arc.fullCircles; ++i) {\r\n\t\t\t\tctx.fill();\r\n\t\t\t}\r\n\t\t\tarc.endAngle = arc.startAngle + vm.circumference % TAU;\r\n\t\t}\r\n\r\n\t\tctx.beginPath();\r\n\t\tctx.arc(arc.x, arc.y, arc.outerRadius, arc.startAngle, arc.endAngle);\r\n\t\tctx.arc(arc.x, arc.y, arc.innerRadius, arc.endAngle, arc.startAngle, true);\r\n\t\tctx.closePath();\r\n\t\tctx.fill();\r\n\r\n\t\tif (vm.borderWidth) {\r\n\t\t\tdrawBorder(ctx, vm, arc);\r\n\t\t}\r\n\r\n\t\tctx.restore();\r\n\t}\r\n});\n\nvar valueOrDefault$1 = helpers$1.valueOrDefault;\r\n\r\nvar defaultColor = core_defaults.global.defaultColor;\r\n\r\ncore_defaults._set('global', {\r\n\telements: {\r\n\t\tline: {\r\n\t\t\ttension: 0.4,\r\n\t\t\tbackgroundColor: defaultColor,\r\n\t\t\tborderWidth: 3,\r\n\t\t\tborderColor: defaultColor,\r\n\t\t\tborderCapStyle: 'butt',\r\n\t\t\tborderDash: [],\r\n\t\t\tborderDashOffset: 0.0,\r\n\t\t\tborderJoinStyle: 'miter',\r\n\t\t\tcapBezierPoints: true,\r\n\t\t\tfill: true, // do we fill in the area between the line and its base axis\r\n\t\t}\r\n\t}\r\n});\r\n\r\nvar element_line = core_element.extend({\r\n\t_type: 'line',\r\n\r\n\tdraw: function() {\r\n\t\tvar me = this;\r\n\t\tvar vm = me._view;\r\n\t\tvar ctx = me._chart.ctx;\r\n\t\tvar spanGaps = vm.spanGaps;\r\n\t\tvar points = me._children.slice(); // clone array\r\n\t\tvar globalDefaults = core_defaults.global;\r\n\t\tvar globalOptionLineElements = globalDefaults.elements.line;\r\n\t\tvar lastDrawnIndex = -1;\r\n\t\tvar closePath = me._loop;\r\n\t\tvar index, previous, currentVM;\r\n\r\n\t\tif (!points.length) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (me._loop) {\r\n\t\t\tfor (index = 0; index < points.length; ++index) {\r\n\t\t\t\tprevious = helpers$1.previousItem(points, index);\r\n\t\t\t\t// If the line has an open path, shift the point array\r\n\t\t\t\tif (!points[index]._view.skip && previous._view.skip) {\r\n\t\t\t\t\tpoints = points.slice(index).concat(points.slice(0, index));\r\n\t\t\t\t\tclosePath = spanGaps;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// If the line has a close path, add the first point again\r\n\t\t\tif (closePath) {\r\n\t\t\t\tpoints.push(points[0]);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tctx.save();\r\n\r\n\t\t// Stroke Line Options\r\n\t\tctx.lineCap = vm.borderCapStyle || globalOptionLineElements.borderCapStyle;\r\n\r\n\t\t// IE 9 and 10 do not support line dash\r\n\t\tif (ctx.setLineDash) {\r\n\t\t\tctx.setLineDash(vm.borderDash || globalOptionLineElements.borderDash);\r\n\t\t}\r\n\r\n\t\tctx.lineDashOffset = valueOrDefault$1(vm.borderDashOffset, globalOptionLineElements.borderDashOffset);\r\n\t\tctx.lineJoin = vm.borderJoinStyle || globalOptionLineElements.borderJoinStyle;\r\n\t\tctx.lineWidth = valueOrDefault$1(vm.borderWidth, globalOptionLineElements.borderWidth);\r\n\t\tctx.strokeStyle = vm.borderColor || globalDefaults.defaultColor;\r\n\r\n\t\t// Stroke Line\r\n\t\tctx.beginPath();\r\n\r\n\t\t// First point moves to it's starting position no matter what\r\n\t\tcurrentVM = points[0]._view;\r\n\t\tif (!currentVM.skip) {\r\n\t\t\tctx.moveTo(currentVM.x, currentVM.y);\r\n\t\t\tlastDrawnIndex = 0;\r\n\t\t}\r\n\r\n\t\tfor (index = 1; index < points.length; ++index) {\r\n\t\t\tcurrentVM = points[index]._view;\r\n\t\t\tprevious = lastDrawnIndex === -1 ? helpers$1.previousItem(points, index) : points[lastDrawnIndex];\r\n\r\n\t\t\tif (!currentVM.skip) {\r\n\t\t\t\tif ((lastDrawnIndex !== (index - 1) && !spanGaps) || lastDrawnIndex === -1) {\r\n\t\t\t\t\t// There was a gap and this is the first point after the gap\r\n\t\t\t\t\tctx.moveTo(currentVM.x, currentVM.y);\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// Line to next point\r\n\t\t\t\t\thelpers$1.canvas.lineTo(ctx, previous._view, currentVM);\r\n\t\t\t\t}\r\n\t\t\t\tlastDrawnIndex = index;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (closePath) {\r\n\t\t\tctx.closePath();\r\n\t\t}\r\n\r\n\t\tctx.stroke();\r\n\t\tctx.restore();\r\n\t}\r\n});\n\nvar valueOrDefault$2 = helpers$1.valueOrDefault;\r\n\r\nvar defaultColor$1 = core_defaults.global.defaultColor;\r\n\r\ncore_defaults._set('global', {\r\n\telements: {\r\n\t\tpoint: {\r\n\t\t\tradius: 3,\r\n\t\t\tpointStyle: 'circle',\r\n\t\t\tbackgroundColor: defaultColor$1,\r\n\t\t\tborderColor: defaultColor$1,\r\n\t\t\tborderWidth: 1,\r\n\t\t\t// Hover\r\n\t\t\thitRadius: 1,\r\n\t\t\thoverRadius: 4,\r\n\t\t\thoverBorderWidth: 1\r\n\t\t}\r\n\t}\r\n});\r\n\r\nfunction xRange(mouseX) {\r\n\tvar vm = this._view;\r\n\treturn vm ? (Math.abs(mouseX - vm.x) < vm.radius + vm.hitRadius) : false;\r\n}\r\n\r\nfunction yRange(mouseY) {\r\n\tvar vm = this._view;\r\n\treturn vm ? (Math.abs(mouseY - vm.y) < vm.radius + vm.hitRadius) : false;\r\n}\r\n\r\nvar element_point = core_element.extend({\r\n\t_type: 'point',\r\n\r\n\tinRange: function(mouseX, mouseY) {\r\n\t\tvar vm = this._view;\r\n\t\treturn vm ? ((Math.pow(mouseX - vm.x, 2) + Math.pow(mouseY - vm.y, 2)) < Math.pow(vm.hitRadius + vm.radius, 2)) : false;\r\n\t},\r\n\r\n\tinLabelRange: xRange,\r\n\tinXRange: xRange,\r\n\tinYRange: yRange,\r\n\r\n\tgetCenterPoint: function() {\r\n\t\tvar vm = this._view;\r\n\t\treturn {\r\n\t\t\tx: vm.x,\r\n\t\t\ty: vm.y\r\n\t\t};\r\n\t},\r\n\r\n\tgetArea: function() {\r\n\t\treturn Math.PI * Math.pow(this._view.radius, 2);\r\n\t},\r\n\r\n\ttooltipPosition: function() {\r\n\t\tvar vm = this._view;\r\n\t\treturn {\r\n\t\t\tx: vm.x,\r\n\t\t\ty: vm.y,\r\n\t\t\tpadding: vm.radius + vm.borderWidth\r\n\t\t};\r\n\t},\r\n\r\n\tdraw: function(chartArea) {\r\n\t\tvar vm = this._view;\r\n\t\tvar ctx = this._chart.ctx;\r\n\t\tvar pointStyle = vm.pointStyle;\r\n\t\tvar rotation = vm.rotation;\r\n\t\tvar radius = vm.radius;\r\n\t\tvar x = vm.x;\r\n\t\tvar y = vm.y;\r\n\t\tvar globalDefaults = core_defaults.global;\r\n\t\tvar defaultColor = globalDefaults.defaultColor; // eslint-disable-line no-shadow\r\n\r\n\t\tif (vm.skip) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Clipping for Points.\r\n\t\tif (chartArea === undefined || helpers$1.canvas._isPointInArea(vm, chartArea)) {\r\n\t\t\tctx.strokeStyle = vm.borderColor || defaultColor;\r\n\t\t\tctx.lineWidth = valueOrDefault$2(vm.borderWidth, globalDefaults.elements.point.borderWidth);\r\n\t\t\tctx.fillStyle = vm.backgroundColor || defaultColor;\r\n\t\t\thelpers$1.canvas.drawPoint(ctx, pointStyle, radius, x, y, rotation);\r\n\t\t}\r\n\t}\r\n});\n\nvar defaultColor$2 = core_defaults.global.defaultColor;\r\n\r\ncore_defaults._set('global', {\r\n\telements: {\r\n\t\trectangle: {\r\n\t\t\tbackgroundColor: defaultColor$2,\r\n\t\t\tborderColor: defaultColor$2,\r\n\t\t\tborderSkipped: 'bottom',\r\n\t\t\tborderWidth: 0\r\n\t\t}\r\n\t}\r\n});\r\n\r\nfunction isVertical(vm) {\r\n\treturn vm && vm.width !== undefined;\r\n}\r\n\r\n/**\r\n * Helper function to get the bounds of the bar regardless of the orientation\r\n * @param bar {Chart.Element.Rectangle} the bar\r\n * @return {Bounds} bounds of the bar\r\n * @private\r\n */\r\nfunction getBarBounds(vm) {\r\n\tvar x1, x2, y1, y2, half;\r\n\r\n\tif (isVertical(vm)) {\r\n\t\thalf = vm.width / 2;\r\n\t\tx1 = vm.x - half;\r\n\t\tx2 = vm.x + half;\r\n\t\ty1 = Math.min(vm.y, vm.base);\r\n\t\ty2 = Math.max(vm.y, vm.base);\r\n\t} else {\r\n\t\thalf = vm.height / 2;\r\n\t\tx1 = Math.min(vm.x, vm.base);\r\n\t\tx2 = Math.max(vm.x, vm.base);\r\n\t\ty1 = vm.y - half;\r\n\t\ty2 = vm.y + half;\r\n\t}\r\n\r\n\treturn {\r\n\t\tleft: x1,\r\n\t\ttop: y1,\r\n\t\tright: x2,\r\n\t\tbottom: y2\r\n\t};\r\n}\r\n\r\nfunction swap(orig, v1, v2) {\r\n\treturn orig === v1 ? v2 : orig === v2 ? v1 : orig;\r\n}\r\n\r\nfunction parseBorderSkipped(vm) {\r\n\tvar edge = vm.borderSkipped;\r\n\tvar res = {};\r\n\r\n\tif (!edge) {\r\n\t\treturn res;\r\n\t}\r\n\r\n\tif (vm.horizontal) {\r\n\t\tif (vm.base > vm.x) {\r\n\t\t\tedge = swap(edge, 'left', 'right');\r\n\t\t}\r\n\t} else if (vm.base < vm.y) {\r\n\t\tedge = swap(edge, 'bottom', 'top');\r\n\t}\r\n\r\n\tres[edge] = true;\r\n\treturn res;\r\n}\r\n\r\nfunction parseBorderWidth(vm, maxW, maxH) {\r\n\tvar value = vm.borderWidth;\r\n\tvar skip = parseBorderSkipped(vm);\r\n\tvar t, r, b, l;\r\n\r\n\tif (helpers$1.isObject(value)) {\r\n\t\tt = +value.top || 0;\r\n\t\tr = +value.right || 0;\r\n\t\tb = +value.bottom || 0;\r\n\t\tl = +value.left || 0;\r\n\t} else {\r\n\t\tt = r = b = l = +value || 0;\r\n\t}\r\n\r\n\treturn {\r\n\t\tt: skip.top || (t < 0) ? 0 : t > maxH ? maxH : t,\r\n\t\tr: skip.right || (r < 0) ? 0 : r > maxW ? maxW : r,\r\n\t\tb: skip.bottom || (b < 0) ? 0 : b > maxH ? maxH : b,\r\n\t\tl: skip.left || (l < 0) ? 0 : l > maxW ? maxW : l\r\n\t};\r\n}\r\n\r\nfunction boundingRects(vm) {\r\n\tvar bounds = getBarBounds(vm);\r\n\tvar width = bounds.right - bounds.left;\r\n\tvar height = bounds.bottom - bounds.top;\r\n\tvar border = parseBorderWidth(vm, width / 2, height / 2);\r\n\r\n\treturn {\r\n\t\touter: {\r\n\t\t\tx: bounds.left,\r\n\t\t\ty: bounds.top,\r\n\t\t\tw: width,\r\n\t\t\th: height\r\n\t\t},\r\n\t\tinner: {\r\n\t\t\tx: bounds.left + border.l,\r\n\t\t\ty: bounds.top + border.t,\r\n\t\t\tw: width - border.l - border.r,\r\n\t\t\th: height - border.t - border.b\r\n\t\t}\r\n\t};\r\n}\r\n\r\nfunction inRange(vm, x, y) {\r\n\tvar skipX = x === null;\r\n\tvar skipY = y === null;\r\n\tvar bounds = !vm || (skipX && skipY) ? false : getBarBounds(vm);\r\n\r\n\treturn bounds\r\n\t\t&& (skipX || x >= bounds.left && x <= bounds.right)\r\n\t\t&& (skipY || y >= bounds.top && y <= bounds.bottom);\r\n}\r\n\r\nvar element_rectangle = core_element.extend({\r\n\t_type: 'rectangle',\r\n\r\n\tdraw: function() {\r\n\t\tvar ctx = this._chart.ctx;\r\n\t\tvar vm = this._view;\r\n\t\tvar rects = boundingRects(vm);\r\n\t\tvar outer = rects.outer;\r\n\t\tvar inner = rects.inner;\r\n\r\n\t\tctx.fillStyle = vm.backgroundColor;\r\n\t\tctx.fillRect(outer.x, outer.y, outer.w, outer.h);\r\n\r\n\t\tif (outer.w === inner.w && outer.h === inner.h) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tctx.save();\r\n\t\tctx.beginPath();\r\n\t\tctx.rect(outer.x, outer.y, outer.w, outer.h);\r\n\t\tctx.clip();\r\n\t\tctx.fillStyle = vm.borderColor;\r\n\t\tctx.rect(inner.x, inner.y, inner.w, inner.h);\r\n\t\tctx.fill('evenodd');\r\n\t\tctx.restore();\r\n\t},\r\n\r\n\theight: function() {\r\n\t\tvar vm = this._view;\r\n\t\treturn vm.base - vm.y;\r\n\t},\r\n\r\n\tinRange: function(mouseX, mouseY) {\r\n\t\treturn inRange(this._view, mouseX, mouseY);\r\n\t},\r\n\r\n\tinLabelRange: function(mouseX, mouseY) {\r\n\t\tvar vm = this._view;\r\n\t\treturn isVertical(vm)\r\n\t\t\t? inRange(vm, mouseX, null)\r\n\t\t\t: inRange(vm, null, mouseY);\r\n\t},\r\n\r\n\tinXRange: function(mouseX) {\r\n\t\treturn inRange(this._view, mouseX, null);\r\n\t},\r\n\r\n\tinYRange: function(mouseY) {\r\n\t\treturn inRange(this._view, null, mouseY);\r\n\t},\r\n\r\n\tgetCenterPoint: function() {\r\n\t\tvar vm = this._view;\r\n\t\tvar x, y;\r\n\t\tif (isVertical(vm)) {\r\n\t\t\tx = vm.x;\r\n\t\t\ty = (vm.y + vm.base) / 2;\r\n\t\t} else {\r\n\t\t\tx = (vm.x + vm.base) / 2;\r\n\t\t\ty = vm.y;\r\n\t\t}\r\n\r\n\t\treturn {x: x, y: y};\r\n\t},\r\n\r\n\tgetArea: function() {\r\n\t\tvar vm = this._view;\r\n\r\n\t\treturn isVertical(vm)\r\n\t\t\t? vm.width * Math.abs(vm.y - vm.base)\r\n\t\t\t: vm.height * Math.abs(vm.x - vm.base);\r\n\t},\r\n\r\n\ttooltipPosition: function() {\r\n\t\tvar vm = this._view;\r\n\t\treturn {\r\n\t\t\tx: vm.x,\r\n\t\t\ty: vm.y\r\n\t\t};\r\n\t}\r\n});\n\nvar elements = {};\r\nvar Arc = element_arc;\r\nvar Line = element_line;\r\nvar Point = element_point;\r\nvar Rectangle = element_rectangle;\nelements.Arc = Arc;\nelements.Line = Line;\nelements.Point = Point;\nelements.Rectangle = Rectangle;\n\nvar deprecated = helpers$1._deprecated;\r\nvar valueOrDefault$3 = helpers$1.valueOrDefault;\r\n\r\ncore_defaults._set('bar', {\r\n\thover: {\r\n\t\tmode: 'label'\r\n\t},\r\n\r\n\tscales: {\r\n\t\txAxes: [{\r\n\t\t\ttype: 'category',\r\n\t\t\toffset: true,\r\n\t\t\tgridLines: {\r\n\t\t\t\toffsetGridLines: true\r\n\t\t\t}\r\n\t\t}],\r\n\r\n\t\tyAxes: [{\r\n\t\t\ttype: 'linear'\r\n\t\t}]\r\n\t}\r\n});\r\n\r\ncore_defaults._set('global', {\r\n\tdatasets: {\r\n\t\tbar: {\r\n\t\t\tcategoryPercentage: 0.8,\r\n\t\t\tbarPercentage: 0.9\r\n\t\t}\r\n\t}\r\n});\r\n\r\n/**\r\n * Computes the \"optimal\" sample size to maintain bars equally sized while preventing overlap.\r\n * @private\r\n */\r\nfunction computeMinSampleSize(scale, pixels) {\r\n\tvar min = scale._length;\r\n\tvar prev, curr, i, ilen;\r\n\r\n\tfor (i = 1, ilen = pixels.length; i < ilen; ++i) {\r\n\t\tmin = Math.min(min, Math.abs(pixels[i] - pixels[i - 1]));\r\n\t}\r\n\r\n\tfor (i = 0, ilen = scale.getTicks().length; i < ilen; ++i) {\r\n\t\tcurr = scale.getPixelForTick(i);\r\n\t\tmin = i > 0 ? Math.min(min, Math.abs(curr - prev)) : min;\r\n\t\tprev = curr;\r\n\t}\r\n\r\n\treturn min;\r\n}\r\n\r\n/**\r\n * Computes an \"ideal\" category based on the absolute bar thickness or, if undefined or null,\r\n * uses the smallest interval (see computeMinSampleSize) that prevents bar overlapping. This\r\n * mode currently always generates bars equally sized (until we introduce scriptable options?).\r\n * @private\r\n */\r\nfunction computeFitCategoryTraits(index, ruler, options) {\r\n\tvar thickness = options.barThickness;\r\n\tvar count = ruler.stackCount;\r\n\tvar curr = ruler.pixels[index];\r\n\tvar min = helpers$1.isNullOrUndef(thickness)\r\n\t\t? computeMinSampleSize(ruler.scale, ruler.pixels)\r\n\t\t: -1;\r\n\tvar size, ratio;\r\n\r\n\tif (helpers$1.isNullOrUndef(thickness)) {\r\n\t\tsize = min * options.categoryPercentage;\r\n\t\tratio = options.barPercentage;\r\n\t} else {\r\n\t\t// When bar thickness is enforced, category and bar percentages are ignored.\r\n\t\t// Note(SB): we could add support for relative bar thickness (e.g. barThickness: '50%')\r\n\t\t// and deprecate barPercentage since this value is ignored when thickness is absolute.\r\n\t\tsize = thickness * count;\r\n\t\tratio = 1;\r\n\t}\r\n\r\n\treturn {\r\n\t\tchunk: size / count,\r\n\t\tratio: ratio,\r\n\t\tstart: curr - (size / 2)\r\n\t};\r\n}\r\n\r\n/**\r\n * Computes an \"optimal\" category that globally arranges bars side by side (no gap when\r\n * percentage options are 1), based on the previous and following categories. This mode\r\n * generates bars with different widths when data are not evenly spaced.\r\n * @private\r\n */\r\nfunction computeFlexCategoryTraits(index, ruler, options) {\r\n\tvar pixels = ruler.pixels;\r\n\tvar curr = pixels[index];\r\n\tvar prev = index > 0 ? pixels[index - 1] : null;\r\n\tvar next = index < pixels.length - 1 ? pixels[index + 1] : null;\r\n\tvar percent = options.categoryPercentage;\r\n\tvar start, size;\r\n\r\n\tif (prev === null) {\r\n\t\t// first data: its size is double based on the next point or,\r\n\t\t// if it's also the last data, we use the scale size.\r\n\t\tprev = curr - (next === null ? ruler.end - ruler.start : next - curr);\r\n\t}\r\n\r\n\tif (next === null) {\r\n\t\t// last data: its size is also double based on the previous point.\r\n\t\tnext = curr + curr - prev;\r\n\t}\r\n\r\n\tstart = curr - (curr - Math.min(prev, next)) / 2 * percent;\r\n\tsize = Math.abs(next - prev) / 2 * percent;\r\n\r\n\treturn {\r\n\t\tchunk: size / ruler.stackCount,\r\n\t\tratio: options.barPercentage,\r\n\t\tstart: start\r\n\t};\r\n}\r\n\r\nvar controller_bar = core_datasetController.extend({\r\n\r\n\tdataElementType: elements.Rectangle,\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_dataElementOptions: [\r\n\t\t'backgroundColor',\r\n\t\t'borderColor',\r\n\t\t'borderSkipped',\r\n\t\t'borderWidth',\r\n\t\t'barPercentage',\r\n\t\t'barThickness',\r\n\t\t'categoryPercentage',\r\n\t\t'maxBarThickness',\r\n\t\t'minBarLength'\r\n\t],\r\n\r\n\tinitialize: function() {\r\n\t\tvar me = this;\r\n\t\tvar meta, scaleOpts;\r\n\r\n\t\tcore_datasetController.prototype.initialize.apply(me, arguments);\r\n\r\n\t\tmeta = me.getMeta();\r\n\t\tmeta.stack = me.getDataset().stack;\r\n\t\tmeta.bar = true;\r\n\r\n\t\tscaleOpts = me._getIndexScale().options;\r\n\t\tdeprecated('bar chart', scaleOpts.barPercentage, 'scales.[x/y]Axes.barPercentage', 'dataset.barPercentage');\r\n\t\tdeprecated('bar chart', scaleOpts.barThickness, 'scales.[x/y]Axes.barThickness', 'dataset.barThickness');\r\n\t\tdeprecated('bar chart', scaleOpts.categoryPercentage, 'scales.[x/y]Axes.categoryPercentage', 'dataset.categoryPercentage');\r\n\t\tdeprecated('bar chart', me._getValueScale().options.minBarLength, 'scales.[x/y]Axes.minBarLength', 'dataset.minBarLength');\r\n\t\tdeprecated('bar chart', scaleOpts.maxBarThickness, 'scales.[x/y]Axes.maxBarThickness', 'dataset.maxBarThickness');\r\n\t},\r\n\r\n\tupdate: function(reset) {\r\n\t\tvar me = this;\r\n\t\tvar rects = me.getMeta().data;\r\n\t\tvar i, ilen;\r\n\r\n\t\tme._ruler = me.getRuler();\r\n\r\n\t\tfor (i = 0, ilen = rects.length; i < ilen; ++i) {\r\n\t\t\tme.updateElement(rects[i], i, reset);\r\n\t\t}\r\n\t},\r\n\r\n\tupdateElement: function(rectangle, index, reset) {\r\n\t\tvar me = this;\r\n\t\tvar meta = me.getMeta();\r\n\t\tvar dataset = me.getDataset();\r\n\t\tvar options = me._resolveDataElementOptions(rectangle, index);\r\n\r\n\t\trectangle._xScale = me.getScaleForId(meta.xAxisID);\r\n\t\trectangle._yScale = me.getScaleForId(meta.yAxisID);\r\n\t\trectangle._datasetIndex = me.index;\r\n\t\trectangle._index = index;\r\n\t\trectangle._model = {\r\n\t\t\tbackgroundColor: options.backgroundColor,\r\n\t\t\tborderColor: options.borderColor,\r\n\t\t\tborderSkipped: options.borderSkipped,\r\n\t\t\tborderWidth: options.borderWidth,\r\n\t\t\tdatasetLabel: dataset.label,\r\n\t\t\tlabel: me.chart.data.labels[index]\r\n\t\t};\r\n\r\n\t\tif (helpers$1.isArray(dataset.data[index])) {\r\n\t\t\trectangle._model.borderSkipped = null;\r\n\t\t}\r\n\r\n\t\tme._updateElementGeometry(rectangle, index, reset, options);\r\n\r\n\t\trectangle.pivot();\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_updateElementGeometry: function(rectangle, index, reset, options) {\r\n\t\tvar me = this;\r\n\t\tvar model = rectangle._model;\r\n\t\tvar vscale = me._getValueScale();\r\n\t\tvar base = vscale.getBasePixel();\r\n\t\tvar horizontal = vscale.isHorizontal();\r\n\t\tvar ruler = me._ruler || me.getRuler();\r\n\t\tvar vpixels = me.calculateBarValuePixels(me.index, index, options);\r\n\t\tvar ipixels = me.calculateBarIndexPixels(me.index, index, ruler, options);\r\n\r\n\t\tmodel.horizontal = horizontal;\r\n\t\tmodel.base = reset ? base : vpixels.base;\r\n\t\tmodel.x = horizontal ? reset ? base : vpixels.head : ipixels.center;\r\n\t\tmodel.y = horizontal ? ipixels.center : reset ? base : vpixels.head;\r\n\t\tmodel.height = horizontal ? ipixels.size : undefined;\r\n\t\tmodel.width = horizontal ? undefined : ipixels.size;\r\n\t},\r\n\r\n\t/**\r\n\t * Returns the stacks based on groups and bar visibility.\r\n\t * @param {number} [last] - The dataset index\r\n\t * @returns {string[]} The list of stack IDs\r\n\t * @private\r\n\t */\r\n\t_getStacks: function(last) {\r\n\t\tvar me = this;\r\n\t\tvar scale = me._getIndexScale();\r\n\t\tvar metasets = scale._getMatchingVisibleMetas(me._type);\r\n\t\tvar stacked = scale.options.stacked;\r\n\t\tvar ilen = metasets.length;\r\n\t\tvar stacks = [];\r\n\t\tvar i, meta;\r\n\r\n\t\tfor (i = 0; i < ilen; ++i) {\r\n\t\t\tmeta = metasets[i];\r\n\t\t\t// stacked | meta.stack\r\n\t\t\t// | found | not found | undefined\r\n\t\t\t// false | x | x | x\r\n\t\t\t// true | | x |\r\n\t\t\t// undefined | | x | x\r\n\t\t\tif (stacked === false || stacks.indexOf(meta.stack) === -1 ||\r\n\t\t\t\t(stacked === undefined && meta.stack === undefined)) {\r\n\t\t\t\tstacks.push(meta.stack);\r\n\t\t\t}\r\n\t\t\tif (meta.index === last) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn stacks;\r\n\t},\r\n\r\n\t/**\r\n\t * Returns the effective number of stacks based on groups and bar visibility.\r\n\t * @private\r\n\t */\r\n\tgetStackCount: function() {\r\n\t\treturn this._getStacks().length;\r\n\t},\r\n\r\n\t/**\r\n\t * Returns the stack index for the given dataset based on groups and bar visibility.\r\n\t * @param {number} [datasetIndex] - The dataset index\r\n\t * @param {string} [name] - The stack name to find\r\n\t * @returns {number} The stack index\r\n\t * @private\r\n\t */\r\n\tgetStackIndex: function(datasetIndex, name) {\r\n\t\tvar stacks = this._getStacks(datasetIndex);\r\n\t\tvar index = (name !== undefined)\r\n\t\t\t? stacks.indexOf(name)\r\n\t\t\t: -1; // indexOf returns -1 if element is not present\r\n\r\n\t\treturn (index === -1)\r\n\t\t\t? stacks.length - 1\r\n\t\t\t: index;\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\tgetRuler: function() {\r\n\t\tvar me = this;\r\n\t\tvar scale = me._getIndexScale();\r\n\t\tvar pixels = [];\r\n\t\tvar i, ilen;\r\n\r\n\t\tfor (i = 0, ilen = me.getMeta().data.length; i < ilen; ++i) {\r\n\t\t\tpixels.push(scale.getPixelForValue(null, i, me.index));\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\tpixels: pixels,\r\n\t\t\tstart: scale._startPixel,\r\n\t\t\tend: scale._endPixel,\r\n\t\t\tstackCount: me.getStackCount(),\r\n\t\t\tscale: scale\r\n\t\t};\r\n\t},\r\n\r\n\t/**\r\n\t * Note: pixel values are not clamped to the scale area.\r\n\t * @private\r\n\t */\r\n\tcalculateBarValuePixels: function(datasetIndex, index, options) {\r\n\t\tvar me = this;\r\n\t\tvar chart = me.chart;\r\n\t\tvar scale = me._getValueScale();\r\n\t\tvar isHorizontal = scale.isHorizontal();\r\n\t\tvar datasets = chart.data.datasets;\r\n\t\tvar metasets = scale._getMatchingVisibleMetas(me._type);\r\n\t\tvar value = scale._parseValue(datasets[datasetIndex].data[index]);\r\n\t\tvar minBarLength = options.minBarLength;\r\n\t\tvar stacked = scale.options.stacked;\r\n\t\tvar stack = me.getMeta().stack;\r\n\t\tvar start = value.start === undefined ? 0 : value.max >= 0 && value.min >= 0 ? value.min : value.max;\r\n\t\tvar length = value.start === undefined ? value.end : value.max >= 0 && value.min >= 0 ? value.max - value.min : value.min - value.max;\r\n\t\tvar ilen = metasets.length;\r\n\t\tvar i, imeta, ivalue, base, head, size, stackLength;\r\n\r\n\t\tif (stacked || (stacked === undefined && stack !== undefined)) {\r\n\t\t\tfor (i = 0; i < ilen; ++i) {\r\n\t\t\t\timeta = metasets[i];\r\n\r\n\t\t\t\tif (imeta.index === datasetIndex) {\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (imeta.stack === stack) {\r\n\t\t\t\t\tstackLength = scale._parseValue(datasets[imeta.index].data[index]);\r\n\t\t\t\t\tivalue = stackLength.start === undefined ? stackLength.end : stackLength.min >= 0 && stackLength.max >= 0 ? stackLength.max : stackLength.min;\r\n\r\n\t\t\t\t\tif ((value.min < 0 && ivalue < 0) || (value.max >= 0 && ivalue > 0)) {\r\n\t\t\t\t\t\tstart += ivalue;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tbase = scale.getPixelForValue(start);\r\n\t\thead = scale.getPixelForValue(start + length);\r\n\t\tsize = head - base;\r\n\r\n\t\tif (minBarLength !== undefined && Math.abs(size) < minBarLength) {\r\n\t\t\tsize = minBarLength;\r\n\t\t\tif (length >= 0 && !isHorizontal || length < 0 && isHorizontal) {\r\n\t\t\t\thead = base - minBarLength;\r\n\t\t\t} else {\r\n\t\t\t\thead = base + minBarLength;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\tsize: size,\r\n\t\t\tbase: base,\r\n\t\t\thead: head,\r\n\t\t\tcenter: head + size / 2\r\n\t\t};\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\tcalculateBarIndexPixels: function(datasetIndex, index, ruler, options) {\r\n\t\tvar me = this;\r\n\t\tvar range = options.barThickness === 'flex'\r\n\t\t\t? computeFlexCategoryTraits(index, ruler, options)\r\n\t\t\t: computeFitCategoryTraits(index, ruler, options);\r\n\r\n\t\tvar stackIndex = me.getStackIndex(datasetIndex, me.getMeta().stack);\r\n\t\tvar center = range.start + (range.chunk * stackIndex) + (range.chunk / 2);\r\n\t\tvar size = Math.min(\r\n\t\t\tvalueOrDefault$3(options.maxBarThickness, Infinity),\r\n\t\t\trange.chunk * range.ratio);\r\n\r\n\t\treturn {\r\n\t\t\tbase: center - size / 2,\r\n\t\t\thead: center + size / 2,\r\n\t\t\tcenter: center,\r\n\t\t\tsize: size\r\n\t\t};\r\n\t},\r\n\r\n\tdraw: function() {\r\n\t\tvar me = this;\r\n\t\tvar chart = me.chart;\r\n\t\tvar scale = me._getValueScale();\r\n\t\tvar rects = me.getMeta().data;\r\n\t\tvar dataset = me.getDataset();\r\n\t\tvar ilen = rects.length;\r\n\t\tvar i = 0;\r\n\r\n\t\thelpers$1.canvas.clipArea(chart.ctx, chart.chartArea);\r\n\r\n\t\tfor (; i < ilen; ++i) {\r\n\t\t\tvar val = scale._parseValue(dataset.data[i]);\r\n\t\t\tif (!isNaN(val.min) && !isNaN(val.max)) {\r\n\t\t\t\trects[i].draw();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\thelpers$1.canvas.unclipArea(chart.ctx);\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_resolveDataElementOptions: function() {\r\n\t\tvar me = this;\r\n\t\tvar values = helpers$1.extend({}, core_datasetController.prototype._resolveDataElementOptions.apply(me, arguments));\r\n\t\tvar indexOpts = me._getIndexScale().options;\r\n\t\tvar valueOpts = me._getValueScale().options;\r\n\r\n\t\tvalues.barPercentage = valueOrDefault$3(indexOpts.barPercentage, values.barPercentage);\r\n\t\tvalues.barThickness = valueOrDefault$3(indexOpts.barThickness, values.barThickness);\r\n\t\tvalues.categoryPercentage = valueOrDefault$3(indexOpts.categoryPercentage, values.categoryPercentage);\r\n\t\tvalues.maxBarThickness = valueOrDefault$3(indexOpts.maxBarThickness, values.maxBarThickness);\r\n\t\tvalues.minBarLength = valueOrDefault$3(valueOpts.minBarLength, values.minBarLength);\r\n\r\n\t\treturn values;\r\n\t}\r\n\r\n});\n\nvar valueOrDefault$4 = helpers$1.valueOrDefault;\r\nvar resolve$1 = helpers$1.options.resolve;\r\n\r\ncore_defaults._set('bubble', {\r\n\thover: {\r\n\t\tmode: 'single'\r\n\t},\r\n\r\n\tscales: {\r\n\t\txAxes: [{\r\n\t\t\ttype: 'linear', // bubble should probably use a linear scale by default\r\n\t\t\tposition: 'bottom',\r\n\t\t\tid: 'x-axis-0' // need an ID so datasets can reference the scale\r\n\t\t}],\r\n\t\tyAxes: [{\r\n\t\t\ttype: 'linear',\r\n\t\t\tposition: 'left',\r\n\t\t\tid: 'y-axis-0'\r\n\t\t}]\r\n\t},\r\n\r\n\ttooltips: {\r\n\t\tcallbacks: {\r\n\t\t\ttitle: function() {\r\n\t\t\t\t// Title doesn't make sense for scatter since we format the data as a point\r\n\t\t\t\treturn '';\r\n\t\t\t},\r\n\t\t\tlabel: function(item, data) {\r\n\t\t\t\tvar datasetLabel = data.datasets[item.datasetIndex].label || '';\r\n\t\t\t\tvar dataPoint = data.datasets[item.datasetIndex].data[item.index];\r\n\t\t\t\treturn datasetLabel + ': (' + item.xLabel + ', ' + item.yLabel + ', ' + dataPoint.r + ')';\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n});\r\n\r\nvar controller_bubble = core_datasetController.extend({\r\n\t/**\r\n\t * @protected\r\n\t */\r\n\tdataElementType: elements.Point,\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_dataElementOptions: [\r\n\t\t'backgroundColor',\r\n\t\t'borderColor',\r\n\t\t'borderWidth',\r\n\t\t'hoverBackgroundColor',\r\n\t\t'hoverBorderColor',\r\n\t\t'hoverBorderWidth',\r\n\t\t'hoverRadius',\r\n\t\t'hitRadius',\r\n\t\t'pointStyle',\r\n\t\t'rotation'\r\n\t],\r\n\r\n\t/**\r\n\t * @protected\r\n\t */\r\n\tupdate: function(reset) {\r\n\t\tvar me = this;\r\n\t\tvar meta = me.getMeta();\r\n\t\tvar points = meta.data;\r\n\r\n\t\t// Update Points\r\n\t\thelpers$1.each(points, function(point, index) {\r\n\t\t\tme.updateElement(point, index, reset);\r\n\t\t});\r\n\t},\r\n\r\n\t/**\r\n\t * @protected\r\n\t */\r\n\tupdateElement: function(point, index, reset) {\r\n\t\tvar me = this;\r\n\t\tvar meta = me.getMeta();\r\n\t\tvar custom = point.custom || {};\r\n\t\tvar xScale = me.getScaleForId(meta.xAxisID);\r\n\t\tvar yScale = me.getScaleForId(meta.yAxisID);\r\n\t\tvar options = me._resolveDataElementOptions(point, index);\r\n\t\tvar data = me.getDataset().data[index];\r\n\t\tvar dsIndex = me.index;\r\n\r\n\t\tvar x = reset ? xScale.getPixelForDecimal(0.5) : xScale.getPixelForValue(typeof data === 'object' ? data : NaN, index, dsIndex);\r\n\t\tvar y = reset ? yScale.getBasePixel() : yScale.getPixelForValue(data, index, dsIndex);\r\n\r\n\t\tpoint._xScale = xScale;\r\n\t\tpoint._yScale = yScale;\r\n\t\tpoint._options = options;\r\n\t\tpoint._datasetIndex = dsIndex;\r\n\t\tpoint._index = index;\r\n\t\tpoint._model = {\r\n\t\t\tbackgroundColor: options.backgroundColor,\r\n\t\t\tborderColor: options.borderColor,\r\n\t\t\tborderWidth: options.borderWidth,\r\n\t\t\thitRadius: options.hitRadius,\r\n\t\t\tpointStyle: options.pointStyle,\r\n\t\t\trotation: options.rotation,\r\n\t\t\tradius: reset ? 0 : options.radius,\r\n\t\t\tskip: custom.skip || isNaN(x) || isNaN(y),\r\n\t\t\tx: x,\r\n\t\t\ty: y,\r\n\t\t};\r\n\r\n\t\tpoint.pivot();\r\n\t},\r\n\r\n\t/**\r\n\t * @protected\r\n\t */\r\n\tsetHoverStyle: function(point) {\r\n\t\tvar model = point._model;\r\n\t\tvar options = point._options;\r\n\t\tvar getHoverColor = helpers$1.getHoverColor;\r\n\r\n\t\tpoint.$previousStyle = {\r\n\t\t\tbackgroundColor: model.backgroundColor,\r\n\t\t\tborderColor: model.borderColor,\r\n\t\t\tborderWidth: model.borderWidth,\r\n\t\t\tradius: model.radius\r\n\t\t};\r\n\r\n\t\tmodel.backgroundColor = valueOrDefault$4(options.hoverBackgroundColor, getHoverColor(options.backgroundColor));\r\n\t\tmodel.borderColor = valueOrDefault$4(options.hoverBorderColor, getHoverColor(options.borderColor));\r\n\t\tmodel.borderWidth = valueOrDefault$4(options.hoverBorderWidth, options.borderWidth);\r\n\t\tmodel.radius = options.radius + options.hoverRadius;\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_resolveDataElementOptions: function(point, index) {\r\n\t\tvar me = this;\r\n\t\tvar chart = me.chart;\r\n\t\tvar dataset = me.getDataset();\r\n\t\tvar custom = point.custom || {};\r\n\t\tvar data = dataset.data[index] || {};\r\n\t\tvar values = core_datasetController.prototype._resolveDataElementOptions.apply(me, arguments);\r\n\r\n\t\t// Scriptable options\r\n\t\tvar context = {\r\n\t\t\tchart: chart,\r\n\t\t\tdataIndex: index,\r\n\t\t\tdataset: dataset,\r\n\t\t\tdatasetIndex: me.index\r\n\t\t};\r\n\r\n\t\t// In case values were cached (and thus frozen), we need to clone the values\r\n\t\tif (me._cachedDataOpts === values) {\r\n\t\t\tvalues = helpers$1.extend({}, values);\r\n\t\t}\r\n\r\n\t\t// Custom radius resolution\r\n\t\tvalues.radius = resolve$1([\r\n\t\t\tcustom.radius,\r\n\t\t\tdata.r,\r\n\t\t\tme._config.radius,\r\n\t\t\tchart.options.elements.point.radius\r\n\t\t], context, index);\r\n\r\n\t\treturn values;\r\n\t}\r\n});\n\nvar valueOrDefault$5 = helpers$1.valueOrDefault;\r\n\r\nvar PI$1 = Math.PI;\r\nvar DOUBLE_PI$1 = PI$1 * 2;\r\nvar HALF_PI$1 = PI$1 / 2;\r\n\r\ncore_defaults._set('doughnut', {\r\n\tanimation: {\r\n\t\t// Boolean - Whether we animate the rotation of the Doughnut\r\n\t\tanimateRotate: true,\r\n\t\t// Boolean - Whether we animate scaling the Doughnut from the centre\r\n\t\tanimateScale: false\r\n\t},\r\n\thover: {\r\n\t\tmode: 'single'\r\n\t},\r\n\tlegendCallback: function(chart) {\r\n\t\tvar list = document.createElement('ul');\r\n\t\tvar data = chart.data;\r\n\t\tvar datasets = data.datasets;\r\n\t\tvar labels = data.labels;\r\n\t\tvar i, ilen, listItem, listItemSpan;\r\n\r\n\t\tlist.setAttribute('class', chart.id + '-legend');\r\n\t\tif (datasets.length) {\r\n\t\t\tfor (i = 0, ilen = datasets[0].data.length; i < ilen; ++i) {\r\n\t\t\t\tlistItem = list.appendChild(document.createElement('li'));\r\n\t\t\t\tlistItemSpan = listItem.appendChild(document.createElement('span'));\r\n\t\t\t\tlistItemSpan.style.backgroundColor = datasets[0].backgroundColor[i];\r\n\t\t\t\tif (labels[i]) {\r\n\t\t\t\t\tlistItem.appendChild(document.createTextNode(labels[i]));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn list.outerHTML;\r\n\t},\r\n\tlegend: {\r\n\t\tlabels: {\r\n\t\t\tgenerateLabels: function(chart) {\r\n\t\t\t\tvar data = chart.data;\r\n\t\t\t\tif (data.labels.length && data.datasets.length) {\r\n\t\t\t\t\treturn data.labels.map(function(label, i) {\r\n\t\t\t\t\t\tvar meta = chart.getDatasetMeta(0);\r\n\t\t\t\t\t\tvar style = meta.controller.getStyle(i);\r\n\r\n\t\t\t\t\t\treturn {\r\n\t\t\t\t\t\t\ttext: label,\r\n\t\t\t\t\t\t\tfillStyle: style.backgroundColor,\r\n\t\t\t\t\t\t\tstrokeStyle: style.borderColor,\r\n\t\t\t\t\t\t\tlineWidth: style.borderWidth,\r\n\t\t\t\t\t\t\thidden: isNaN(data.datasets[0].data[i]) || meta.data[i].hidden,\r\n\r\n\t\t\t\t\t\t\t// Extra data used for toggling the correct item\r\n\t\t\t\t\t\t\tindex: i\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\treturn [];\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\tonClick: function(e, legendItem) {\r\n\t\t\tvar index = legendItem.index;\r\n\t\t\tvar chart = this.chart;\r\n\t\t\tvar i, ilen, meta;\r\n\r\n\t\t\tfor (i = 0, ilen = (chart.data.datasets || []).length; i < ilen; ++i) {\r\n\t\t\t\tmeta = chart.getDatasetMeta(i);\r\n\t\t\t\t// toggle visibility of index if exists\r\n\t\t\t\tif (meta.data[index]) {\r\n\t\t\t\t\tmeta.data[index].hidden = !meta.data[index].hidden;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tchart.update();\r\n\t\t}\r\n\t},\r\n\r\n\t// The percentage of the chart that we cut out of the middle.\r\n\tcutoutPercentage: 50,\r\n\r\n\t// The rotation of the chart, where the first data arc begins.\r\n\trotation: -HALF_PI$1,\r\n\r\n\t// The total circumference of the chart.\r\n\tcircumference: DOUBLE_PI$1,\r\n\r\n\t// Need to override these to give a nice default\r\n\ttooltips: {\r\n\t\tcallbacks: {\r\n\t\t\ttitle: function() {\r\n\t\t\t\treturn '';\r\n\t\t\t},\r\n\t\t\tlabel: function(tooltipItem, data) {\r\n\t\t\t\tvar dataLabel = data.labels[tooltipItem.index];\r\n\t\t\t\tvar value = ': ' + data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index];\r\n\r\n\t\t\t\tif (helpers$1.isArray(dataLabel)) {\r\n\t\t\t\t\t// show value on first line of multiline label\r\n\t\t\t\t\t// need to clone because we are changing the value\r\n\t\t\t\t\tdataLabel = dataLabel.slice();\r\n\t\t\t\t\tdataLabel[0] += value;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tdataLabel += value;\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn dataLabel;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n});\r\n\r\nvar controller_doughnut = core_datasetController.extend({\r\n\r\n\tdataElementType: elements.Arc,\r\n\r\n\tlinkScales: helpers$1.noop,\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_dataElementOptions: [\r\n\t\t'backgroundColor',\r\n\t\t'borderColor',\r\n\t\t'borderWidth',\r\n\t\t'borderAlign',\r\n\t\t'hoverBackgroundColor',\r\n\t\t'hoverBorderColor',\r\n\t\t'hoverBorderWidth',\r\n\t],\r\n\r\n\t// Get index of the dataset in relation to the visible datasets. This allows determining the inner and outer radius correctly\r\n\tgetRingIndex: function(datasetIndex) {\r\n\t\tvar ringIndex = 0;\r\n\r\n\t\tfor (var j = 0; j < datasetIndex; ++j) {\r\n\t\t\tif (this.chart.isDatasetVisible(j)) {\r\n\t\t\t\t++ringIndex;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn ringIndex;\r\n\t},\r\n\r\n\tupdate: function(reset) {\r\n\t\tvar me = this;\r\n\t\tvar chart = me.chart;\r\n\t\tvar chartArea = chart.chartArea;\r\n\t\tvar opts = chart.options;\r\n\t\tvar ratioX = 1;\r\n\t\tvar ratioY = 1;\r\n\t\tvar offsetX = 0;\r\n\t\tvar offsetY = 0;\r\n\t\tvar meta = me.getMeta();\r\n\t\tvar arcs = meta.data;\r\n\t\tvar cutout = opts.cutoutPercentage / 100 || 0;\r\n\t\tvar circumference = opts.circumference;\r\n\t\tvar chartWeight = me._getRingWeight(me.index);\r\n\t\tvar maxWidth, maxHeight, i, ilen;\r\n\r\n\t\t// If the chart's circumference isn't a full circle, calculate size as a ratio of the width/height of the arc\r\n\t\tif (circumference < DOUBLE_PI$1) {\r\n\t\t\tvar startAngle = opts.rotation % DOUBLE_PI$1;\r\n\t\t\tstartAngle += startAngle >= PI$1 ? -DOUBLE_PI$1 : startAngle < -PI$1 ? DOUBLE_PI$1 : 0;\r\n\t\t\tvar endAngle = startAngle + circumference;\r\n\t\t\tvar startX = Math.cos(startAngle);\r\n\t\t\tvar startY = Math.sin(startAngle);\r\n\t\t\tvar endX = Math.cos(endAngle);\r\n\t\t\tvar endY = Math.sin(endAngle);\r\n\t\t\tvar contains0 = (startAngle <= 0 && endAngle >= 0) || endAngle >= DOUBLE_PI$1;\r\n\t\t\tvar contains90 = (startAngle <= HALF_PI$1 && endAngle >= HALF_PI$1) || endAngle >= DOUBLE_PI$1 + HALF_PI$1;\r\n\t\t\tvar contains180 = startAngle === -PI$1 || endAngle >= PI$1;\r\n\t\t\tvar contains270 = (startAngle <= -HALF_PI$1 && endAngle >= -HALF_PI$1) || endAngle >= PI$1 + HALF_PI$1;\r\n\t\t\tvar minX = contains180 ? -1 : Math.min(startX, startX * cutout, endX, endX * cutout);\r\n\t\t\tvar minY = contains270 ? -1 : Math.min(startY, startY * cutout, endY, endY * cutout);\r\n\t\t\tvar maxX = contains0 ? 1 : Math.max(startX, startX * cutout, endX, endX * cutout);\r\n\t\t\tvar maxY = contains90 ? 1 : Math.max(startY, startY * cutout, endY, endY * cutout);\r\n\t\t\tratioX = (maxX - minX) / 2;\r\n\t\t\tratioY = (maxY - minY) / 2;\r\n\t\t\toffsetX = -(maxX + minX) / 2;\r\n\t\t\toffsetY = -(maxY + minY) / 2;\r\n\t\t}\r\n\r\n\t\tfor (i = 0, ilen = arcs.length; i < ilen; ++i) {\r\n\t\t\tarcs[i]._options = me._resolveDataElementOptions(arcs[i], i);\r\n\t\t}\r\n\r\n\t\tchart.borderWidth = me.getMaxBorderWidth();\r\n\t\tmaxWidth = (chartArea.right - chartArea.left - chart.borderWidth) / ratioX;\r\n\t\tmaxHeight = (chartArea.bottom - chartArea.top - chart.borderWidth) / ratioY;\r\n\t\tchart.outerRadius = Math.max(Math.min(maxWidth, maxHeight) / 2, 0);\r\n\t\tchart.innerRadius = Math.max(chart.outerRadius * cutout, 0);\r\n\t\tchart.radiusLength = (chart.outerRadius - chart.innerRadius) / (me._getVisibleDatasetWeightTotal() || 1);\r\n\t\tchart.offsetX = offsetX * chart.outerRadius;\r\n\t\tchart.offsetY = offsetY * chart.outerRadius;\r\n\r\n\t\tmeta.total = me.calculateTotal();\r\n\r\n\t\tme.outerRadius = chart.outerRadius - chart.radiusLength * me._getRingWeightOffset(me.index);\r\n\t\tme.innerRadius = Math.max(me.outerRadius - chart.radiusLength * chartWeight, 0);\r\n\r\n\t\tfor (i = 0, ilen = arcs.length; i < ilen; ++i) {\r\n\t\t\tme.updateElement(arcs[i], i, reset);\r\n\t\t}\r\n\t},\r\n\r\n\tupdateElement: function(arc, index, reset) {\r\n\t\tvar me = this;\r\n\t\tvar chart = me.chart;\r\n\t\tvar chartArea = chart.chartArea;\r\n\t\tvar opts = chart.options;\r\n\t\tvar animationOpts = opts.animation;\r\n\t\tvar centerX = (chartArea.left + chartArea.right) / 2;\r\n\t\tvar centerY = (chartArea.top + chartArea.bottom) / 2;\r\n\t\tvar startAngle = opts.rotation; // non reset case handled later\r\n\t\tvar endAngle = opts.rotation; // non reset case handled later\r\n\t\tvar dataset = me.getDataset();\r\n\t\tvar circumference = reset && animationOpts.animateRotate ? 0 : arc.hidden ? 0 : me.calculateCircumference(dataset.data[index]) * (opts.circumference / DOUBLE_PI$1);\r\n\t\tvar innerRadius = reset && animationOpts.animateScale ? 0 : me.innerRadius;\r\n\t\tvar outerRadius = reset && animationOpts.animateScale ? 0 : me.outerRadius;\r\n\t\tvar options = arc._options || {};\r\n\r\n\t\thelpers$1.extend(arc, {\r\n\t\t\t// Utility\r\n\t\t\t_datasetIndex: me.index,\r\n\t\t\t_index: index,\r\n\r\n\t\t\t// Desired view properties\r\n\t\t\t_model: {\r\n\t\t\t\tbackgroundColor: options.backgroundColor,\r\n\t\t\t\tborderColor: options.borderColor,\r\n\t\t\t\tborderWidth: options.borderWidth,\r\n\t\t\t\tborderAlign: options.borderAlign,\r\n\t\t\t\tx: centerX + chart.offsetX,\r\n\t\t\t\ty: centerY + chart.offsetY,\r\n\t\t\t\tstartAngle: startAngle,\r\n\t\t\t\tendAngle: endAngle,\r\n\t\t\t\tcircumference: circumference,\r\n\t\t\t\touterRadius: outerRadius,\r\n\t\t\t\tinnerRadius: innerRadius,\r\n\t\t\t\tlabel: helpers$1.valueAtIndexOrDefault(dataset.label, index, chart.data.labels[index])\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tvar model = arc._model;\r\n\r\n\t\t// Set correct angles if not resetting\r\n\t\tif (!reset || !animationOpts.animateRotate) {\r\n\t\t\tif (index === 0) {\r\n\t\t\t\tmodel.startAngle = opts.rotation;\r\n\t\t\t} else {\r\n\t\t\t\tmodel.startAngle = me.getMeta().data[index - 1]._model.endAngle;\r\n\t\t\t}\r\n\r\n\t\t\tmodel.endAngle = model.startAngle + model.circumference;\r\n\t\t}\r\n\r\n\t\tarc.pivot();\r\n\t},\r\n\r\n\tcalculateTotal: function() {\r\n\t\tvar dataset = this.getDataset();\r\n\t\tvar meta = this.getMeta();\r\n\t\tvar total = 0;\r\n\t\tvar value;\r\n\r\n\t\thelpers$1.each(meta.data, function(element, index) {\r\n\t\t\tvalue = dataset.data[index];\r\n\t\t\tif (!isNaN(value) && !element.hidden) {\r\n\t\t\t\ttotal += Math.abs(value);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t/* if (total === 0) {\r\n\t\t\ttotal = NaN;\r\n\t\t}*/\r\n\r\n\t\treturn total;\r\n\t},\r\n\r\n\tcalculateCircumference: function(value) {\r\n\t\tvar total = this.getMeta().total;\r\n\t\tif (total > 0 && !isNaN(value)) {\r\n\t\t\treturn DOUBLE_PI$1 * (Math.abs(value) / total);\r\n\t\t}\r\n\t\treturn 0;\r\n\t},\r\n\r\n\t// gets the max border or hover width to properly scale pie charts\r\n\tgetMaxBorderWidth: function(arcs) {\r\n\t\tvar me = this;\r\n\t\tvar max = 0;\r\n\t\tvar chart = me.chart;\r\n\t\tvar i, ilen, meta, arc, controller, options, borderWidth, hoverWidth;\r\n\r\n\t\tif (!arcs) {\r\n\t\t\t// Find the outmost visible dataset\r\n\t\t\tfor (i = 0, ilen = chart.data.datasets.length; i < ilen; ++i) {\r\n\t\t\t\tif (chart.isDatasetVisible(i)) {\r\n\t\t\t\t\tmeta = chart.getDatasetMeta(i);\r\n\t\t\t\t\tarcs = meta.data;\r\n\t\t\t\t\tif (i !== me.index) {\r\n\t\t\t\t\t\tcontroller = meta.controller;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (!arcs) {\r\n\t\t\treturn 0;\r\n\t\t}\r\n\r\n\t\tfor (i = 0, ilen = arcs.length; i < ilen; ++i) {\r\n\t\t\tarc = arcs[i];\r\n\t\t\tif (controller) {\r\n\t\t\t\tcontroller._configure();\r\n\t\t\t\toptions = controller._resolveDataElementOptions(arc, i);\r\n\t\t\t} else {\r\n\t\t\t\toptions = arc._options;\r\n\t\t\t}\r\n\t\t\tif (options.borderAlign !== 'inner') {\r\n\t\t\t\tborderWidth = options.borderWidth;\r\n\t\t\t\thoverWidth = options.hoverBorderWidth;\r\n\r\n\t\t\t\tmax = borderWidth > max ? borderWidth : max;\r\n\t\t\t\tmax = hoverWidth > max ? hoverWidth : max;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn max;\r\n\t},\r\n\r\n\t/**\r\n\t * @protected\r\n\t */\r\n\tsetHoverStyle: function(arc) {\r\n\t\tvar model = arc._model;\r\n\t\tvar options = arc._options;\r\n\t\tvar getHoverColor = helpers$1.getHoverColor;\r\n\r\n\t\tarc.$previousStyle = {\r\n\t\t\tbackgroundColor: model.backgroundColor,\r\n\t\t\tborderColor: model.borderColor,\r\n\t\t\tborderWidth: model.borderWidth,\r\n\t\t};\r\n\r\n\t\tmodel.backgroundColor = valueOrDefault$5(options.hoverBackgroundColor, getHoverColor(options.backgroundColor));\r\n\t\tmodel.borderColor = valueOrDefault$5(options.hoverBorderColor, getHoverColor(options.borderColor));\r\n\t\tmodel.borderWidth = valueOrDefault$5(options.hoverBorderWidth, options.borderWidth);\r\n\t},\r\n\r\n\t/**\r\n\t * Get radius length offset of the dataset in relation to the visible datasets weights. This allows determining the inner and outer radius correctly\r\n\t * @private\r\n\t */\r\n\t_getRingWeightOffset: function(datasetIndex) {\r\n\t\tvar ringWeightOffset = 0;\r\n\r\n\t\tfor (var i = 0; i < datasetIndex; ++i) {\r\n\t\t\tif (this.chart.isDatasetVisible(i)) {\r\n\t\t\t\tringWeightOffset += this._getRingWeight(i);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn ringWeightOffset;\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_getRingWeight: function(dataSetIndex) {\r\n\t\treturn Math.max(valueOrDefault$5(this.chart.data.datasets[dataSetIndex].weight, 1), 0);\r\n\t},\r\n\r\n\t/**\r\n\t * Returns the sum of all visibile data set weights. This value can be 0.\r\n\t * @private\r\n\t */\r\n\t_getVisibleDatasetWeightTotal: function() {\r\n\t\treturn this._getRingWeightOffset(this.chart.data.datasets.length);\r\n\t}\r\n});\n\ncore_defaults._set('horizontalBar', {\r\n\thover: {\r\n\t\tmode: 'index',\r\n\t\taxis: 'y'\r\n\t},\r\n\r\n\tscales: {\r\n\t\txAxes: [{\r\n\t\t\ttype: 'linear',\r\n\t\t\tposition: 'bottom'\r\n\t\t}],\r\n\r\n\t\tyAxes: [{\r\n\t\t\ttype: 'category',\r\n\t\t\tposition: 'left',\r\n\t\t\toffset: true,\r\n\t\t\tgridLines: {\r\n\t\t\t\toffsetGridLines: true\r\n\t\t\t}\r\n\t\t}]\r\n\t},\r\n\r\n\telements: {\r\n\t\trectangle: {\r\n\t\t\tborderSkipped: 'left'\r\n\t\t}\r\n\t},\r\n\r\n\ttooltips: {\r\n\t\tmode: 'index',\r\n\t\taxis: 'y'\r\n\t}\r\n});\r\n\r\ncore_defaults._set('global', {\r\n\tdatasets: {\r\n\t\thorizontalBar: {\r\n\t\t\tcategoryPercentage: 0.8,\r\n\t\t\tbarPercentage: 0.9\r\n\t\t}\r\n\t}\r\n});\r\n\r\nvar controller_horizontalBar = controller_bar.extend({\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_getValueScaleId: function() {\r\n\t\treturn this.getMeta().xAxisID;\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_getIndexScaleId: function() {\r\n\t\treturn this.getMeta().yAxisID;\r\n\t}\r\n});\n\nvar valueOrDefault$6 = helpers$1.valueOrDefault;\r\nvar resolve$2 = helpers$1.options.resolve;\r\nvar isPointInArea = helpers$1.canvas._isPointInArea;\r\n\r\ncore_defaults._set('line', {\r\n\tshowLines: true,\r\n\tspanGaps: false,\r\n\r\n\thover: {\r\n\t\tmode: 'label'\r\n\t},\r\n\r\n\tscales: {\r\n\t\txAxes: [{\r\n\t\t\ttype: 'category',\r\n\t\t\tid: 'x-axis-0'\r\n\t\t}],\r\n\t\tyAxes: [{\r\n\t\t\ttype: 'linear',\r\n\t\t\tid: 'y-axis-0'\r\n\t\t}]\r\n\t}\r\n});\r\n\r\nfunction scaleClip(scale, halfBorderWidth) {\r\n\tvar tickOpts = scale && scale.options.ticks || {};\r\n\tvar reverse = tickOpts.reverse;\r\n\tvar min = tickOpts.min === undefined ? halfBorderWidth : 0;\r\n\tvar max = tickOpts.max === undefined ? halfBorderWidth : 0;\r\n\treturn {\r\n\t\tstart: reverse ? max : min,\r\n\t\tend: reverse ? min : max\r\n\t};\r\n}\r\n\r\nfunction defaultClip(xScale, yScale, borderWidth) {\r\n\tvar halfBorderWidth = borderWidth / 2;\r\n\tvar x = scaleClip(xScale, halfBorderWidth);\r\n\tvar y = scaleClip(yScale, halfBorderWidth);\r\n\r\n\treturn {\r\n\t\ttop: y.end,\r\n\t\tright: x.end,\r\n\t\tbottom: y.start,\r\n\t\tleft: x.start\r\n\t};\r\n}\r\n\r\nfunction toClip(value) {\r\n\tvar t, r, b, l;\r\n\r\n\tif (helpers$1.isObject(value)) {\r\n\t\tt = value.top;\r\n\t\tr = value.right;\r\n\t\tb = value.bottom;\r\n\t\tl = value.left;\r\n\t} else {\r\n\t\tt = r = b = l = value;\r\n\t}\r\n\r\n\treturn {\r\n\t\ttop: t,\r\n\t\tright: r,\r\n\t\tbottom: b,\r\n\t\tleft: l\r\n\t};\r\n}\r\n\r\n\r\nvar controller_line = core_datasetController.extend({\r\n\r\n\tdatasetElementType: elements.Line,\r\n\r\n\tdataElementType: elements.Point,\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_datasetElementOptions: [\r\n\t\t'backgroundColor',\r\n\t\t'borderCapStyle',\r\n\t\t'borderColor',\r\n\t\t'borderDash',\r\n\t\t'borderDashOffset',\r\n\t\t'borderJoinStyle',\r\n\t\t'borderWidth',\r\n\t\t'cubicInterpolationMode',\r\n\t\t'fill'\r\n\t],\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_dataElementOptions: {\r\n\t\tbackgroundColor: 'pointBackgroundColor',\r\n\t\tborderColor: 'pointBorderColor',\r\n\t\tborderWidth: 'pointBorderWidth',\r\n\t\thitRadius: 'pointHitRadius',\r\n\t\thoverBackgroundColor: 'pointHoverBackgroundColor',\r\n\t\thoverBorderColor: 'pointHoverBorderColor',\r\n\t\thoverBorderWidth: 'pointHoverBorderWidth',\r\n\t\thoverRadius: 'pointHoverRadius',\r\n\t\tpointStyle: 'pointStyle',\r\n\t\tradius: 'pointRadius',\r\n\t\trotation: 'pointRotation'\r\n\t},\r\n\r\n\tupdate: function(reset) {\r\n\t\tvar me = this;\r\n\t\tvar meta = me.getMeta();\r\n\t\tvar line = meta.dataset;\r\n\t\tvar points = meta.data || [];\r\n\t\tvar options = me.chart.options;\r\n\t\tvar config = me._config;\r\n\t\tvar showLine = me._showLine = valueOrDefault$6(config.showLine, options.showLines);\r\n\t\tvar i, ilen;\r\n\r\n\t\tme._xScale = me.getScaleForId(meta.xAxisID);\r\n\t\tme._yScale = me.getScaleForId(meta.yAxisID);\r\n\r\n\t\t// Update Line\r\n\t\tif (showLine) {\r\n\t\t\t// Compatibility: If the properties are defined with only the old name, use those values\r\n\t\t\tif (config.tension !== undefined && config.lineTension === undefined) {\r\n\t\t\t\tconfig.lineTension = config.tension;\r\n\t\t\t}\r\n\r\n\t\t\t// Utility\r\n\t\t\tline._scale = me._yScale;\r\n\t\t\tline._datasetIndex = me.index;\r\n\t\t\t// Data\r\n\t\t\tline._children = points;\r\n\t\t\t// Model\r\n\t\t\tline._model = me._resolveDatasetElementOptions(line);\r\n\r\n\t\t\tline.pivot();\r\n\t\t}\r\n\r\n\t\t// Update Points\r\n\t\tfor (i = 0, ilen = points.length; i < ilen; ++i) {\r\n\t\t\tme.updateElement(points[i], i, reset);\r\n\t\t}\r\n\r\n\t\tif (showLine && line._model.tension !== 0) {\r\n\t\t\tme.updateBezierControlPoints();\r\n\t\t}\r\n\r\n\t\t// Now pivot the point for animation\r\n\t\tfor (i = 0, ilen = points.length; i < ilen; ++i) {\r\n\t\t\tpoints[i].pivot();\r\n\t\t}\r\n\t},\r\n\r\n\tupdateElement: function(point, index, reset) {\r\n\t\tvar me = this;\r\n\t\tvar meta = me.getMeta();\r\n\t\tvar custom = point.custom || {};\r\n\t\tvar dataset = me.getDataset();\r\n\t\tvar datasetIndex = me.index;\r\n\t\tvar value = dataset.data[index];\r\n\t\tvar xScale = me._xScale;\r\n\t\tvar yScale = me._yScale;\r\n\t\tvar lineModel = meta.dataset._model;\r\n\t\tvar x, y;\r\n\r\n\t\tvar options = me._resolveDataElementOptions(point, index);\r\n\r\n\t\tx = xScale.getPixelForValue(typeof value === 'object' ? value : NaN, index, datasetIndex);\r\n\t\ty = reset ? yScale.getBasePixel() : me.calculatePointY(value, index, datasetIndex);\r\n\r\n\t\t// Utility\r\n\t\tpoint._xScale = xScale;\r\n\t\tpoint._yScale = yScale;\r\n\t\tpoint._options = options;\r\n\t\tpoint._datasetIndex = datasetIndex;\r\n\t\tpoint._index = index;\r\n\r\n\t\t// Desired view properties\r\n\t\tpoint._model = {\r\n\t\t\tx: x,\r\n\t\t\ty: y,\r\n\t\t\tskip: custom.skip || isNaN(x) || isNaN(y),\r\n\t\t\t// Appearance\r\n\t\t\tradius: options.radius,\r\n\t\t\tpointStyle: options.pointStyle,\r\n\t\t\trotation: options.rotation,\r\n\t\t\tbackgroundColor: options.backgroundColor,\r\n\t\t\tborderColor: options.borderColor,\r\n\t\t\tborderWidth: options.borderWidth,\r\n\t\t\ttension: valueOrDefault$6(custom.tension, lineModel ? lineModel.tension : 0),\r\n\t\t\tsteppedLine: lineModel ? lineModel.steppedLine : false,\r\n\t\t\t// Tooltip\r\n\t\t\thitRadius: options.hitRadius\r\n\t\t};\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_resolveDatasetElementOptions: function(element) {\r\n\t\tvar me = this;\r\n\t\tvar config = me._config;\r\n\t\tvar custom = element.custom || {};\r\n\t\tvar options = me.chart.options;\r\n\t\tvar lineOptions = options.elements.line;\r\n\t\tvar values = core_datasetController.prototype._resolveDatasetElementOptions.apply(me, arguments);\r\n\r\n\t\t// The default behavior of lines is to break at null values, according\r\n\t\t// to https://github.com/chartjs/Chart.js/issues/2435#issuecomment-216718158\r\n\t\t// This option gives lines the ability to span gaps\r\n\t\tvalues.spanGaps = valueOrDefault$6(config.spanGaps, options.spanGaps);\r\n\t\tvalues.tension = valueOrDefault$6(config.lineTension, lineOptions.tension);\r\n\t\tvalues.steppedLine = resolve$2([custom.steppedLine, config.steppedLine, lineOptions.stepped]);\r\n\t\tvalues.clip = toClip(valueOrDefault$6(config.clip, defaultClip(me._xScale, me._yScale, values.borderWidth)));\r\n\r\n\t\treturn values;\r\n\t},\r\n\r\n\tcalculatePointY: function(value, index, datasetIndex) {\r\n\t\tvar me = this;\r\n\t\tvar chart = me.chart;\r\n\t\tvar yScale = me._yScale;\r\n\t\tvar sumPos = 0;\r\n\t\tvar sumNeg = 0;\r\n\t\tvar i, ds, dsMeta, stackedRightValue, rightValue, metasets, ilen;\r\n\r\n\t\tif (yScale.options.stacked) {\r\n\t\t\trightValue = +yScale.getRightValue(value);\r\n\t\t\tmetasets = chart._getSortedVisibleDatasetMetas();\r\n\t\t\tilen = metasets.length;\r\n\r\n\t\t\tfor (i = 0; i < ilen; ++i) {\r\n\t\t\t\tdsMeta = metasets[i];\r\n\t\t\t\tif (dsMeta.index === datasetIndex) {\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tds = chart.data.datasets[dsMeta.index];\r\n\t\t\t\tif (dsMeta.type === 'line' && dsMeta.yAxisID === yScale.id) {\r\n\t\t\t\t\tstackedRightValue = +yScale.getRightValue(ds.data[index]);\r\n\t\t\t\t\tif (stackedRightValue < 0) {\r\n\t\t\t\t\t\tsumNeg += stackedRightValue || 0;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tsumPos += stackedRightValue || 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (rightValue < 0) {\r\n\t\t\t\treturn yScale.getPixelForValue(sumNeg + rightValue);\r\n\t\t\t}\r\n\t\t\treturn yScale.getPixelForValue(sumPos + rightValue);\r\n\t\t}\r\n\t\treturn yScale.getPixelForValue(value);\r\n\t},\r\n\r\n\tupdateBezierControlPoints: function() {\r\n\t\tvar me = this;\r\n\t\tvar chart = me.chart;\r\n\t\tvar meta = me.getMeta();\r\n\t\tvar lineModel = meta.dataset._model;\r\n\t\tvar area = chart.chartArea;\r\n\t\tvar points = meta.data || [];\r\n\t\tvar i, ilen, model, controlPoints;\r\n\r\n\t\t// Only consider points that are drawn in case the spanGaps option is used\r\n\t\tif (lineModel.spanGaps) {\r\n\t\t\tpoints = points.filter(function(pt) {\r\n\t\t\t\treturn !pt._model.skip;\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tfunction capControlPoint(pt, min, max) {\r\n\t\t\treturn Math.max(Math.min(pt, max), min);\r\n\t\t}\r\n\r\n\t\tif (lineModel.cubicInterpolationMode === 'monotone') {\r\n\t\t\thelpers$1.splineCurveMonotone(points);\r\n\t\t} else {\r\n\t\t\tfor (i = 0, ilen = points.length; i < ilen; ++i) {\r\n\t\t\t\tmodel = points[i]._model;\r\n\t\t\t\tcontrolPoints = helpers$1.splineCurve(\r\n\t\t\t\t\thelpers$1.previousItem(points, i)._model,\r\n\t\t\t\t\tmodel,\r\n\t\t\t\t\thelpers$1.nextItem(points, i)._model,\r\n\t\t\t\t\tlineModel.tension\r\n\t\t\t\t);\r\n\t\t\t\tmodel.controlPointPreviousX = controlPoints.previous.x;\r\n\t\t\t\tmodel.controlPointPreviousY = controlPoints.previous.y;\r\n\t\t\t\tmodel.controlPointNextX = controlPoints.next.x;\r\n\t\t\t\tmodel.controlPointNextY = controlPoints.next.y;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (chart.options.elements.line.capBezierPoints) {\r\n\t\t\tfor (i = 0, ilen = points.length; i < ilen; ++i) {\r\n\t\t\t\tmodel = points[i]._model;\r\n\t\t\t\tif (isPointInArea(model, area)) {\r\n\t\t\t\t\tif (i > 0 && isPointInArea(points[i - 1]._model, area)) {\r\n\t\t\t\t\t\tmodel.controlPointPreviousX = capControlPoint(model.controlPointPreviousX, area.left, area.right);\r\n\t\t\t\t\t\tmodel.controlPointPreviousY = capControlPoint(model.controlPointPreviousY, area.top, area.bottom);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (i < points.length - 1 && isPointInArea(points[i + 1]._model, area)) {\r\n\t\t\t\t\t\tmodel.controlPointNextX = capControlPoint(model.controlPointNextX, area.left, area.right);\r\n\t\t\t\t\t\tmodel.controlPointNextY = capControlPoint(model.controlPointNextY, area.top, area.bottom);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tdraw: function() {\r\n\t\tvar me = this;\r\n\t\tvar chart = me.chart;\r\n\t\tvar meta = me.getMeta();\r\n\t\tvar points = meta.data || [];\r\n\t\tvar area = chart.chartArea;\r\n\t\tvar canvas = chart.canvas;\r\n\t\tvar i = 0;\r\n\t\tvar ilen = points.length;\r\n\t\tvar clip;\r\n\r\n\t\tif (me._showLine) {\r\n\t\t\tclip = meta.dataset._model.clip;\r\n\r\n\t\t\thelpers$1.canvas.clipArea(chart.ctx, {\r\n\t\t\t\tleft: clip.left === false ? 0 : area.left - clip.left,\r\n\t\t\t\tright: clip.right === false ? canvas.width : area.right + clip.right,\r\n\t\t\t\ttop: clip.top === false ? 0 : area.top - clip.top,\r\n\t\t\t\tbottom: clip.bottom === false ? canvas.height : area.bottom + clip.bottom\r\n\t\t\t});\r\n\r\n\t\t\tmeta.dataset.draw();\r\n\r\n\t\t\thelpers$1.canvas.unclipArea(chart.ctx);\r\n\t\t}\r\n\r\n\t\t// Draw the points\r\n\t\tfor (; i < ilen; ++i) {\r\n\t\t\tpoints[i].draw(area);\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * @protected\r\n\t */\r\n\tsetHoverStyle: function(point) {\r\n\t\tvar model = point._model;\r\n\t\tvar options = point._options;\r\n\t\tvar getHoverColor = helpers$1.getHoverColor;\r\n\r\n\t\tpoint.$previousStyle = {\r\n\t\t\tbackgroundColor: model.backgroundColor,\r\n\t\t\tborderColor: model.borderColor,\r\n\t\t\tborderWidth: model.borderWidth,\r\n\t\t\tradius: model.radius\r\n\t\t};\r\n\r\n\t\tmodel.backgroundColor = valueOrDefault$6(options.hoverBackgroundColor, getHoverColor(options.backgroundColor));\r\n\t\tmodel.borderColor = valueOrDefault$6(options.hoverBorderColor, getHoverColor(options.borderColor));\r\n\t\tmodel.borderWidth = valueOrDefault$6(options.hoverBorderWidth, options.borderWidth);\r\n\t\tmodel.radius = valueOrDefault$6(options.hoverRadius, options.radius);\r\n\t},\r\n});\n\nvar resolve$3 = helpers$1.options.resolve;\r\n\r\ncore_defaults._set('polarArea', {\r\n\tscale: {\r\n\t\ttype: 'radialLinear',\r\n\t\tangleLines: {\r\n\t\t\tdisplay: false\r\n\t\t},\r\n\t\tgridLines: {\r\n\t\t\tcircular: true\r\n\t\t},\r\n\t\tpointLabels: {\r\n\t\t\tdisplay: false\r\n\t\t},\r\n\t\tticks: {\r\n\t\t\tbeginAtZero: true\r\n\t\t}\r\n\t},\r\n\r\n\t// Boolean - Whether to animate the rotation of the chart\r\n\tanimation: {\r\n\t\tanimateRotate: true,\r\n\t\tanimateScale: true\r\n\t},\r\n\r\n\tstartAngle: -0.5 * Math.PI,\r\n\tlegendCallback: function(chart) {\r\n\t\tvar list = document.createElement('ul');\r\n\t\tvar data = chart.data;\r\n\t\tvar datasets = data.datasets;\r\n\t\tvar labels = data.labels;\r\n\t\tvar i, ilen, listItem, listItemSpan;\r\n\r\n\t\tlist.setAttribute('class', chart.id + '-legend');\r\n\t\tif (datasets.length) {\r\n\t\t\tfor (i = 0, ilen = datasets[0].data.length; i < ilen; ++i) {\r\n\t\t\t\tlistItem = list.appendChild(document.createElement('li'));\r\n\t\t\t\tlistItemSpan = listItem.appendChild(document.createElement('span'));\r\n\t\t\t\tlistItemSpan.style.backgroundColor = datasets[0].backgroundColor[i];\r\n\t\t\t\tif (labels[i]) {\r\n\t\t\t\t\tlistItem.appendChild(document.createTextNode(labels[i]));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn list.outerHTML;\r\n\t},\r\n\tlegend: {\r\n\t\tlabels: {\r\n\t\t\tgenerateLabels: function(chart) {\r\n\t\t\t\tvar data = chart.data;\r\n\t\t\t\tif (data.labels.length && data.datasets.length) {\r\n\t\t\t\t\treturn data.labels.map(function(label, i) {\r\n\t\t\t\t\t\tvar meta = chart.getDatasetMeta(0);\r\n\t\t\t\t\t\tvar style = meta.controller.getStyle(i);\r\n\r\n\t\t\t\t\t\treturn {\r\n\t\t\t\t\t\t\ttext: label,\r\n\t\t\t\t\t\t\tfillStyle: style.backgroundColor,\r\n\t\t\t\t\t\t\tstrokeStyle: style.borderColor,\r\n\t\t\t\t\t\t\tlineWidth: style.borderWidth,\r\n\t\t\t\t\t\t\thidden: isNaN(data.datasets[0].data[i]) || meta.data[i].hidden,\r\n\r\n\t\t\t\t\t\t\t// Extra data used for toggling the correct item\r\n\t\t\t\t\t\t\tindex: i\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\treturn [];\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\tonClick: function(e, legendItem) {\r\n\t\t\tvar index = legendItem.index;\r\n\t\t\tvar chart = this.chart;\r\n\t\t\tvar i, ilen, meta;\r\n\r\n\t\t\tfor (i = 0, ilen = (chart.data.datasets || []).length; i < ilen; ++i) {\r\n\t\t\t\tmeta = chart.getDatasetMeta(i);\r\n\t\t\t\tmeta.data[index].hidden = !meta.data[index].hidden;\r\n\t\t\t}\r\n\r\n\t\t\tchart.update();\r\n\t\t}\r\n\t},\r\n\r\n\t// Need to override these to give a nice default\r\n\ttooltips: {\r\n\t\tcallbacks: {\r\n\t\t\ttitle: function() {\r\n\t\t\t\treturn '';\r\n\t\t\t},\r\n\t\t\tlabel: function(item, data) {\r\n\t\t\t\treturn data.labels[item.index] + ': ' + item.yLabel;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n});\r\n\r\nvar controller_polarArea = core_datasetController.extend({\r\n\r\n\tdataElementType: elements.Arc,\r\n\r\n\tlinkScales: helpers$1.noop,\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_dataElementOptions: [\r\n\t\t'backgroundColor',\r\n\t\t'borderColor',\r\n\t\t'borderWidth',\r\n\t\t'borderAlign',\r\n\t\t'hoverBackgroundColor',\r\n\t\t'hoverBorderColor',\r\n\t\t'hoverBorderWidth',\r\n\t],\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_getIndexScaleId: function() {\r\n\t\treturn this.chart.scale.id;\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_getValueScaleId: function() {\r\n\t\treturn this.chart.scale.id;\r\n\t},\r\n\r\n\tupdate: function(reset) {\r\n\t\tvar me = this;\r\n\t\tvar dataset = me.getDataset();\r\n\t\tvar meta = me.getMeta();\r\n\t\tvar start = me.chart.options.startAngle || 0;\r\n\t\tvar starts = me._starts = [];\r\n\t\tvar angles = me._angles = [];\r\n\t\tvar arcs = meta.data;\r\n\t\tvar i, ilen, angle;\r\n\r\n\t\tme._updateRadius();\r\n\r\n\t\tmeta.count = me.countVisibleElements();\r\n\r\n\t\tfor (i = 0, ilen = dataset.data.length; i < ilen; i++) {\r\n\t\t\tstarts[i] = start;\r\n\t\t\tangle = me._computeAngle(i);\r\n\t\t\tangles[i] = angle;\r\n\t\t\tstart += angle;\r\n\t\t}\r\n\r\n\t\tfor (i = 0, ilen = arcs.length; i < ilen; ++i) {\r\n\t\t\tarcs[i]._options = me._resolveDataElementOptions(arcs[i], i);\r\n\t\t\tme.updateElement(arcs[i], i, reset);\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_updateRadius: function() {\r\n\t\tvar me = this;\r\n\t\tvar chart = me.chart;\r\n\t\tvar chartArea = chart.chartArea;\r\n\t\tvar opts = chart.options;\r\n\t\tvar minSize = Math.min(chartArea.right - chartArea.left, chartArea.bottom - chartArea.top);\r\n\r\n\t\tchart.outerRadius = Math.max(minSize / 2, 0);\r\n\t\tchart.innerRadius = Math.max(opts.cutoutPercentage ? (chart.outerRadius / 100) * (opts.cutoutPercentage) : 1, 0);\r\n\t\tchart.radiusLength = (chart.outerRadius - chart.innerRadius) / chart.getVisibleDatasetCount();\r\n\r\n\t\tme.outerRadius = chart.outerRadius - (chart.radiusLength * me.index);\r\n\t\tme.innerRadius = me.outerRadius - chart.radiusLength;\r\n\t},\r\n\r\n\tupdateElement: function(arc, index, reset) {\r\n\t\tvar me = this;\r\n\t\tvar chart = me.chart;\r\n\t\tvar dataset = me.getDataset();\r\n\t\tvar opts = chart.options;\r\n\t\tvar animationOpts = opts.animation;\r\n\t\tvar scale = chart.scale;\r\n\t\tvar labels = chart.data.labels;\r\n\r\n\t\tvar centerX = scale.xCenter;\r\n\t\tvar centerY = scale.yCenter;\r\n\r\n\t\t// var negHalfPI = -0.5 * Math.PI;\r\n\t\tvar datasetStartAngle = opts.startAngle;\r\n\t\tvar distance = arc.hidden ? 0 : scale.getDistanceFromCenterForValue(dataset.data[index]);\r\n\t\tvar startAngle = me._starts[index];\r\n\t\tvar endAngle = startAngle + (arc.hidden ? 0 : me._angles[index]);\r\n\r\n\t\tvar resetRadius = animationOpts.animateScale ? 0 : scale.getDistanceFromCenterForValue(dataset.data[index]);\r\n\t\tvar options = arc._options || {};\r\n\r\n\t\thelpers$1.extend(arc, {\r\n\t\t\t// Utility\r\n\t\t\t_datasetIndex: me.index,\r\n\t\t\t_index: index,\r\n\t\t\t_scale: scale,\r\n\r\n\t\t\t// Desired view properties\r\n\t\t\t_model: {\r\n\t\t\t\tbackgroundColor: options.backgroundColor,\r\n\t\t\t\tborderColor: options.borderColor,\r\n\t\t\t\tborderWidth: options.borderWidth,\r\n\t\t\t\tborderAlign: options.borderAlign,\r\n\t\t\t\tx: centerX,\r\n\t\t\t\ty: centerY,\r\n\t\t\t\tinnerRadius: 0,\r\n\t\t\t\touterRadius: reset ? resetRadius : distance,\r\n\t\t\t\tstartAngle: reset && animationOpts.animateRotate ? datasetStartAngle : startAngle,\r\n\t\t\t\tendAngle: reset && animationOpts.animateRotate ? datasetStartAngle : endAngle,\r\n\t\t\t\tlabel: helpers$1.valueAtIndexOrDefault(labels, index, labels[index])\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tarc.pivot();\r\n\t},\r\n\r\n\tcountVisibleElements: function() {\r\n\t\tvar dataset = this.getDataset();\r\n\t\tvar meta = this.getMeta();\r\n\t\tvar count = 0;\r\n\r\n\t\thelpers$1.each(meta.data, function(element, index) {\r\n\t\t\tif (!isNaN(dataset.data[index]) && !element.hidden) {\r\n\t\t\t\tcount++;\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\treturn count;\r\n\t},\r\n\r\n\t/**\r\n\t * @protected\r\n\t */\r\n\tsetHoverStyle: function(arc) {\r\n\t\tvar model = arc._model;\r\n\t\tvar options = arc._options;\r\n\t\tvar getHoverColor = helpers$1.getHoverColor;\r\n\t\tvar valueOrDefault = helpers$1.valueOrDefault;\r\n\r\n\t\tarc.$previousStyle = {\r\n\t\t\tbackgroundColor: model.backgroundColor,\r\n\t\t\tborderColor: model.borderColor,\r\n\t\t\tborderWidth: model.borderWidth,\r\n\t\t};\r\n\r\n\t\tmodel.backgroundColor = valueOrDefault(options.hoverBackgroundColor, getHoverColor(options.backgroundColor));\r\n\t\tmodel.borderColor = valueOrDefault(options.hoverBorderColor, getHoverColor(options.borderColor));\r\n\t\tmodel.borderWidth = valueOrDefault(options.hoverBorderWidth, options.borderWidth);\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_computeAngle: function(index) {\r\n\t\tvar me = this;\r\n\t\tvar count = this.getMeta().count;\r\n\t\tvar dataset = me.getDataset();\r\n\t\tvar meta = me.getMeta();\r\n\r\n\t\tif (isNaN(dataset.data[index]) || meta.data[index].hidden) {\r\n\t\t\treturn 0;\r\n\t\t}\r\n\r\n\t\t// Scriptable options\r\n\t\tvar context = {\r\n\t\t\tchart: me.chart,\r\n\t\t\tdataIndex: index,\r\n\t\t\tdataset: dataset,\r\n\t\t\tdatasetIndex: me.index\r\n\t\t};\r\n\r\n\t\treturn resolve$3([\r\n\t\t\tme.chart.options.elements.arc.angle,\r\n\t\t\t(2 * Math.PI) / count\r\n\t\t], context, index);\r\n\t}\r\n});\n\ncore_defaults._set('pie', helpers$1.clone(core_defaults.doughnut));\r\ncore_defaults._set('pie', {\r\n\tcutoutPercentage: 0\r\n});\r\n\r\n// Pie charts are Doughnut chart with different defaults\r\nvar controller_pie = controller_doughnut;\n\nvar valueOrDefault$7 = helpers$1.valueOrDefault;\r\n\r\ncore_defaults._set('radar', {\r\n\tspanGaps: false,\r\n\tscale: {\r\n\t\ttype: 'radialLinear'\r\n\t},\r\n\telements: {\r\n\t\tline: {\r\n\t\t\tfill: 'start',\r\n\t\t\ttension: 0 // no bezier in radar\r\n\t\t}\r\n\t}\r\n});\r\n\r\nvar controller_radar = core_datasetController.extend({\r\n\tdatasetElementType: elements.Line,\r\n\r\n\tdataElementType: elements.Point,\r\n\r\n\tlinkScales: helpers$1.noop,\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_datasetElementOptions: [\r\n\t\t'backgroundColor',\r\n\t\t'borderWidth',\r\n\t\t'borderColor',\r\n\t\t'borderCapStyle',\r\n\t\t'borderDash',\r\n\t\t'borderDashOffset',\r\n\t\t'borderJoinStyle',\r\n\t\t'fill'\r\n\t],\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_dataElementOptions: {\r\n\t\tbackgroundColor: 'pointBackgroundColor',\r\n\t\tborderColor: 'pointBorderColor',\r\n\t\tborderWidth: 'pointBorderWidth',\r\n\t\thitRadius: 'pointHitRadius',\r\n\t\thoverBackgroundColor: 'pointHoverBackgroundColor',\r\n\t\thoverBorderColor: 'pointHoverBorderColor',\r\n\t\thoverBorderWidth: 'pointHoverBorderWidth',\r\n\t\thoverRadius: 'pointHoverRadius',\r\n\t\tpointStyle: 'pointStyle',\r\n\t\tradius: 'pointRadius',\r\n\t\trotation: 'pointRotation'\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_getIndexScaleId: function() {\r\n\t\treturn this.chart.scale.id;\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_getValueScaleId: function() {\r\n\t\treturn this.chart.scale.id;\r\n\t},\r\n\r\n\tupdate: function(reset) {\r\n\t\tvar me = this;\r\n\t\tvar meta = me.getMeta();\r\n\t\tvar line = meta.dataset;\r\n\t\tvar points = meta.data || [];\r\n\t\tvar scale = me.chart.scale;\r\n\t\tvar config = me._config;\r\n\t\tvar i, ilen;\r\n\r\n\t\t// Compatibility: If the properties are defined with only the old name, use those values\r\n\t\tif (config.tension !== undefined && config.lineTension === undefined) {\r\n\t\t\tconfig.lineTension = config.tension;\r\n\t\t}\r\n\r\n\t\t// Utility\r\n\t\tline._scale = scale;\r\n\t\tline._datasetIndex = me.index;\r\n\t\t// Data\r\n\t\tline._children = points;\r\n\t\tline._loop = true;\r\n\t\t// Model\r\n\t\tline._model = me._resolveDatasetElementOptions(line);\r\n\r\n\t\tline.pivot();\r\n\r\n\t\t// Update Points\r\n\t\tfor (i = 0, ilen = points.length; i < ilen; ++i) {\r\n\t\t\tme.updateElement(points[i], i, reset);\r\n\t\t}\r\n\r\n\t\t// Update bezier control points\r\n\t\tme.updateBezierControlPoints();\r\n\r\n\t\t// Now pivot the point for animation\r\n\t\tfor (i = 0, ilen = points.length; i < ilen; ++i) {\r\n\t\t\tpoints[i].pivot();\r\n\t\t}\r\n\t},\r\n\r\n\tupdateElement: function(point, index, reset) {\r\n\t\tvar me = this;\r\n\t\tvar custom = point.custom || {};\r\n\t\tvar dataset = me.getDataset();\r\n\t\tvar scale = me.chart.scale;\r\n\t\tvar pointPosition = scale.getPointPositionForValue(index, dataset.data[index]);\r\n\t\tvar options = me._resolveDataElementOptions(point, index);\r\n\t\tvar lineModel = me.getMeta().dataset._model;\r\n\t\tvar x = reset ? scale.xCenter : pointPosition.x;\r\n\t\tvar y = reset ? scale.yCenter : pointPosition.y;\r\n\r\n\t\t// Utility\r\n\t\tpoint._scale = scale;\r\n\t\tpoint._options = options;\r\n\t\tpoint._datasetIndex = me.index;\r\n\t\tpoint._index = index;\r\n\r\n\t\t// Desired view properties\r\n\t\tpoint._model = {\r\n\t\t\tx: x, // value not used in dataset scale, but we want a consistent API between scales\r\n\t\t\ty: y,\r\n\t\t\tskip: custom.skip || isNaN(x) || isNaN(y),\r\n\t\t\t// Appearance\r\n\t\t\tradius: options.radius,\r\n\t\t\tpointStyle: options.pointStyle,\r\n\t\t\trotation: options.rotation,\r\n\t\t\tbackgroundColor: options.backgroundColor,\r\n\t\t\tborderColor: options.borderColor,\r\n\t\t\tborderWidth: options.borderWidth,\r\n\t\t\ttension: valueOrDefault$7(custom.tension, lineModel ? lineModel.tension : 0),\r\n\r\n\t\t\t// Tooltip\r\n\t\t\thitRadius: options.hitRadius\r\n\t\t};\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_resolveDatasetElementOptions: function() {\r\n\t\tvar me = this;\r\n\t\tvar config = me._config;\r\n\t\tvar options = me.chart.options;\r\n\t\tvar values = core_datasetController.prototype._resolveDatasetElementOptions.apply(me, arguments);\r\n\r\n\t\tvalues.spanGaps = valueOrDefault$7(config.spanGaps, options.spanGaps);\r\n\t\tvalues.tension = valueOrDefault$7(config.lineTension, options.elements.line.tension);\r\n\r\n\t\treturn values;\r\n\t},\r\n\r\n\tupdateBezierControlPoints: function() {\r\n\t\tvar me = this;\r\n\t\tvar meta = me.getMeta();\r\n\t\tvar area = me.chart.chartArea;\r\n\t\tvar points = meta.data || [];\r\n\t\tvar i, ilen, model, controlPoints;\r\n\r\n\t\t// Only consider points that are drawn in case the spanGaps option is used\r\n\t\tif (meta.dataset._model.spanGaps) {\r\n\t\t\tpoints = points.filter(function(pt) {\r\n\t\t\t\treturn !pt._model.skip;\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tfunction capControlPoint(pt, min, max) {\r\n\t\t\treturn Math.max(Math.min(pt, max), min);\r\n\t\t}\r\n\r\n\t\tfor (i = 0, ilen = points.length; i < ilen; ++i) {\r\n\t\t\tmodel = points[i]._model;\r\n\t\t\tcontrolPoints = helpers$1.splineCurve(\r\n\t\t\t\thelpers$1.previousItem(points, i, true)._model,\r\n\t\t\t\tmodel,\r\n\t\t\t\thelpers$1.nextItem(points, i, true)._model,\r\n\t\t\t\tmodel.tension\r\n\t\t\t);\r\n\r\n\t\t\t// Prevent the bezier going outside of the bounds of the graph\r\n\t\t\tmodel.controlPointPreviousX = capControlPoint(controlPoints.previous.x, area.left, area.right);\r\n\t\t\tmodel.controlPointPreviousY = capControlPoint(controlPoints.previous.y, area.top, area.bottom);\r\n\t\t\tmodel.controlPointNextX = capControlPoint(controlPoints.next.x, area.left, area.right);\r\n\t\t\tmodel.controlPointNextY = capControlPoint(controlPoints.next.y, area.top, area.bottom);\r\n\t\t}\r\n\t},\r\n\r\n\tsetHoverStyle: function(point) {\r\n\t\tvar model = point._model;\r\n\t\tvar options = point._options;\r\n\t\tvar getHoverColor = helpers$1.getHoverColor;\r\n\r\n\t\tpoint.$previousStyle = {\r\n\t\t\tbackgroundColor: model.backgroundColor,\r\n\t\t\tborderColor: model.borderColor,\r\n\t\t\tborderWidth: model.borderWidth,\r\n\t\t\tradius: model.radius\r\n\t\t};\r\n\r\n\t\tmodel.backgroundColor = valueOrDefault$7(options.hoverBackgroundColor, getHoverColor(options.backgroundColor));\r\n\t\tmodel.borderColor = valueOrDefault$7(options.hoverBorderColor, getHoverColor(options.borderColor));\r\n\t\tmodel.borderWidth = valueOrDefault$7(options.hoverBorderWidth, options.borderWidth);\r\n\t\tmodel.radius = valueOrDefault$7(options.hoverRadius, options.radius);\r\n\t}\r\n});\n\ncore_defaults._set('scatter', {\r\n\thover: {\r\n\t\tmode: 'single'\r\n\t},\r\n\r\n\tscales: {\r\n\t\txAxes: [{\r\n\t\t\tid: 'x-axis-1', // need an ID so datasets can reference the scale\r\n\t\t\ttype: 'linear', // scatter should not use a category axis\r\n\t\t\tposition: 'bottom'\r\n\t\t}],\r\n\t\tyAxes: [{\r\n\t\t\tid: 'y-axis-1',\r\n\t\t\ttype: 'linear',\r\n\t\t\tposition: 'left'\r\n\t\t}]\r\n\t},\r\n\r\n\ttooltips: {\r\n\t\tcallbacks: {\r\n\t\t\ttitle: function() {\r\n\t\t\t\treturn ''; // doesn't make sense for scatter since data are formatted as a point\r\n\t\t\t},\r\n\t\t\tlabel: function(item) {\r\n\t\t\t\treturn '(' + item.xLabel + ', ' + item.yLabel + ')';\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n});\r\n\r\ncore_defaults._set('global', {\r\n\tdatasets: {\r\n\t\tscatter: {\r\n\t\t\tshowLine: false\r\n\t\t}\r\n\t}\r\n});\r\n\r\n// Scatter charts use line controllers\r\nvar controller_scatter = controller_line;\n\n// NOTE export a map in which the key represents the controller type, not\r\n// the class, and so must be CamelCase in order to be correctly retrieved\r\n// by the controller in core.controller.js (`controllers[meta.type]`).\r\n\r\nvar controllers = {\r\n\tbar: controller_bar,\r\n\tbubble: controller_bubble,\r\n\tdoughnut: controller_doughnut,\r\n\thorizontalBar: controller_horizontalBar,\r\n\tline: controller_line,\r\n\tpolarArea: controller_polarArea,\r\n\tpie: controller_pie,\r\n\tradar: controller_radar,\r\n\tscatter: controller_scatter\r\n};\n\n/**\r\n * Helper function to get relative position for an event\r\n * @param {Event|IEvent} event - The event to get the position for\r\n * @param {Chart} chart - The chart\r\n * @returns {object} the event position\r\n */\r\nfunction getRelativePosition(e, chart) {\r\n\tif (e.native) {\r\n\t\treturn {\r\n\t\t\tx: e.x,\r\n\t\t\ty: e.y\r\n\t\t};\r\n\t}\r\n\r\n\treturn helpers$1.getRelativePosition(e, chart);\r\n}\r\n\r\n/**\r\n * Helper function to traverse all of the visible elements in the chart\r\n * @param {Chart} chart - the chart\r\n * @param {function} handler - the callback to execute for each visible item\r\n */\r\nfunction parseVisibleItems(chart, handler) {\r\n\tvar metasets = chart._getSortedVisibleDatasetMetas();\r\n\tvar metadata, i, j, ilen, jlen, element;\r\n\r\n\tfor (i = 0, ilen = metasets.length; i < ilen; ++i) {\r\n\t\tmetadata = metasets[i].data;\r\n\t\tfor (j = 0, jlen = metadata.length; j < jlen; ++j) {\r\n\t\t\telement = metadata[j];\r\n\t\t\tif (!element._view.skip) {\r\n\t\t\t\thandler(element);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Helper function to get the items that intersect the event position\r\n * @param {ChartElement[]} items - elements to filter\r\n * @param {object} position - the point to be nearest to\r\n * @return {ChartElement[]} the nearest items\r\n */\r\nfunction getIntersectItems(chart, position) {\r\n\tvar elements = [];\r\n\r\n\tparseVisibleItems(chart, function(element) {\r\n\t\tif (element.inRange(position.x, position.y)) {\r\n\t\t\telements.push(element);\r\n\t\t}\r\n\t});\r\n\r\n\treturn elements;\r\n}\r\n\r\n/**\r\n * Helper function to get the items nearest to the event position considering all visible items in teh chart\r\n * @param {Chart} chart - the chart to look at elements from\r\n * @param {object} position - the point to be nearest to\r\n * @param {boolean} intersect - if true, only consider items that intersect the position\r\n * @param {function} distanceMetric - function to provide the distance between points\r\n * @return {ChartElement[]} the nearest items\r\n */\r\nfunction getNearestItems(chart, position, intersect, distanceMetric) {\r\n\tvar minDistance = Number.POSITIVE_INFINITY;\r\n\tvar nearestItems = [];\r\n\r\n\tparseVisibleItems(chart, function(element) {\r\n\t\tif (intersect && !element.inRange(position.x, position.y)) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tvar center = element.getCenterPoint();\r\n\t\tvar distance = distanceMetric(position, center);\r\n\t\tif (distance < minDistance) {\r\n\t\t\tnearestItems = [element];\r\n\t\t\tminDistance = distance;\r\n\t\t} else if (distance === minDistance) {\r\n\t\t\t// Can have multiple items at the same distance in which case we sort by size\r\n\t\t\tnearestItems.push(element);\r\n\t\t}\r\n\t});\r\n\r\n\treturn nearestItems;\r\n}\r\n\r\n/**\r\n * Get a distance metric function for two points based on the\r\n * axis mode setting\r\n * @param {string} axis - the axis mode. x|y|xy\r\n */\r\nfunction getDistanceMetricForAxis(axis) {\r\n\tvar useX = axis.indexOf('x') !== -1;\r\n\tvar useY = axis.indexOf('y') !== -1;\r\n\r\n\treturn function(pt1, pt2) {\r\n\t\tvar deltaX = useX ? Math.abs(pt1.x - pt2.x) : 0;\r\n\t\tvar deltaY = useY ? Math.abs(pt1.y - pt2.y) : 0;\r\n\t\treturn Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2));\r\n\t};\r\n}\r\n\r\nfunction indexMode(chart, e, options) {\r\n\tvar position = getRelativePosition(e, chart);\r\n\t// Default axis for index mode is 'x' to match old behaviour\r\n\toptions.axis = options.axis || 'x';\r\n\tvar distanceMetric = getDistanceMetricForAxis(options.axis);\r\n\tvar items = options.intersect ? getIntersectItems(chart, position) : getNearestItems(chart, position, false, distanceMetric);\r\n\tvar elements = [];\r\n\r\n\tif (!items.length) {\r\n\t\treturn [];\r\n\t}\r\n\r\n\tchart._getSortedVisibleDatasetMetas().forEach(function(meta) {\r\n\t\tvar element = meta.data[items[0]._index];\r\n\r\n\t\t// don't count items that are skipped (null data)\r\n\t\tif (element && !element._view.skip) {\r\n\t\t\telements.push(element);\r\n\t\t}\r\n\t});\r\n\r\n\treturn elements;\r\n}\r\n\r\n/**\r\n * @interface IInteractionOptions\r\n */\r\n/**\r\n * If true, only consider items that intersect the point\r\n * @name IInterfaceOptions#boolean\r\n * @type Boolean\r\n */\r\n\r\n/**\r\n * Contains interaction related functions\r\n * @namespace Chart.Interaction\r\n */\r\nvar core_interaction = {\r\n\t// Helper function for different modes\r\n\tmodes: {\r\n\t\tsingle: function(chart, e) {\r\n\t\t\tvar position = getRelativePosition(e, chart);\r\n\t\t\tvar elements = [];\r\n\r\n\t\t\tparseVisibleItems(chart, function(element) {\r\n\t\t\t\tif (element.inRange(position.x, position.y)) {\r\n\t\t\t\t\telements.push(element);\r\n\t\t\t\t\treturn elements;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\treturn elements.slice(0, 1);\r\n\t\t},\r\n\r\n\t\t/**\r\n\t\t * @function Chart.Interaction.modes.label\r\n\t\t * @deprecated since version 2.4.0\r\n\t\t * @todo remove at version 3\r\n\t\t * @private\r\n\t\t */\r\n\t\tlabel: indexMode,\r\n\r\n\t\t/**\r\n\t\t * Returns items at the same index. If the options.intersect parameter is true, we only return items if we intersect something\r\n\t\t * If the options.intersect mode is false, we find the nearest item and return the items at the same index as that item\r\n\t\t * @function Chart.Interaction.modes.index\r\n\t\t * @since v2.4.0\r\n\t\t * @param {Chart} chart - the chart we are returning items from\r\n\t\t * @param {Event} e - the event we are find things at\r\n\t\t * @param {IInteractionOptions} options - options to use during interaction\r\n\t\t * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned\r\n\t\t */\r\n\t\tindex: indexMode,\r\n\r\n\t\t/**\r\n\t\t * Returns items in the same dataset. If the options.intersect parameter is true, we only return items if we intersect something\r\n\t\t * If the options.intersect is false, we find the nearest item and return the items in that dataset\r\n\t\t * @function Chart.Interaction.modes.dataset\r\n\t\t * @param {Chart} chart - the chart we are returning items from\r\n\t\t * @param {Event} e - the event we are find things at\r\n\t\t * @param {IInteractionOptions} options - options to use during interaction\r\n\t\t * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned\r\n\t\t */\r\n\t\tdataset: function(chart, e, options) {\r\n\t\t\tvar position = getRelativePosition(e, chart);\r\n\t\t\toptions.axis = options.axis || 'xy';\r\n\t\t\tvar distanceMetric = getDistanceMetricForAxis(options.axis);\r\n\t\t\tvar items = options.intersect ? getIntersectItems(chart, position) : getNearestItems(chart, position, false, distanceMetric);\r\n\r\n\t\t\tif (items.length > 0) {\r\n\t\t\t\titems = chart.getDatasetMeta(items[0]._datasetIndex).data;\r\n\t\t\t}\r\n\r\n\t\t\treturn items;\r\n\t\t},\r\n\r\n\t\t/**\r\n\t\t * @function Chart.Interaction.modes.x-axis\r\n\t\t * @deprecated since version 2.4.0. Use index mode and intersect == true\r\n\t\t * @todo remove at version 3\r\n\t\t * @private\r\n\t\t */\r\n\t\t'x-axis': function(chart, e) {\r\n\t\t\treturn indexMode(chart, e, {intersect: false});\r\n\t\t},\r\n\r\n\t\t/**\r\n\t\t * Point mode returns all elements that hit test based on the event position\r\n\t\t * of the event\r\n\t\t * @function Chart.Interaction.modes.intersect\r\n\t\t * @param {Chart} chart - the chart we are returning items from\r\n\t\t * @param {Event} e - the event we are find things at\r\n\t\t * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned\r\n\t\t */\r\n\t\tpoint: function(chart, e) {\r\n\t\t\tvar position = getRelativePosition(e, chart);\r\n\t\t\treturn getIntersectItems(chart, position);\r\n\t\t},\r\n\r\n\t\t/**\r\n\t\t * nearest mode returns the element closest to the point\r\n\t\t * @function Chart.Interaction.modes.intersect\r\n\t\t * @param {Chart} chart - the chart we are returning items from\r\n\t\t * @param {Event} e - the event we are find things at\r\n\t\t * @param {IInteractionOptions} options - options to use\r\n\t\t * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned\r\n\t\t */\r\n\t\tnearest: function(chart, e, options) {\r\n\t\t\tvar position = getRelativePosition(e, chart);\r\n\t\t\toptions.axis = options.axis || 'xy';\r\n\t\t\tvar distanceMetric = getDistanceMetricForAxis(options.axis);\r\n\t\t\treturn getNearestItems(chart, position, options.intersect, distanceMetric);\r\n\t\t},\r\n\r\n\t\t/**\r\n\t\t * x mode returns the elements that hit-test at the current x coordinate\r\n\t\t * @function Chart.Interaction.modes.x\r\n\t\t * @param {Chart} chart - the chart we are returning items from\r\n\t\t * @param {Event} e - the event we are find things at\r\n\t\t * @param {IInteractionOptions} options - options to use\r\n\t\t * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned\r\n\t\t */\r\n\t\tx: function(chart, e, options) {\r\n\t\t\tvar position = getRelativePosition(e, chart);\r\n\t\t\tvar items = [];\r\n\t\t\tvar intersectsItem = false;\r\n\r\n\t\t\tparseVisibleItems(chart, function(element) {\r\n\t\t\t\tif (element.inXRange(position.x)) {\r\n\t\t\t\t\titems.push(element);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (element.inRange(position.x, position.y)) {\r\n\t\t\t\t\tintersectsItem = true;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\t// If we want to trigger on an intersect and we don't have any items\r\n\t\t\t// that intersect the position, return nothing\r\n\t\t\tif (options.intersect && !intersectsItem) {\r\n\t\t\t\titems = [];\r\n\t\t\t}\r\n\t\t\treturn items;\r\n\t\t},\r\n\r\n\t\t/**\r\n\t\t * y mode returns the elements that hit-test at the current y coordinate\r\n\t\t * @function Chart.Interaction.modes.y\r\n\t\t * @param {Chart} chart - the chart we are returning items from\r\n\t\t * @param {Event} e - the event we are find things at\r\n\t\t * @param {IInteractionOptions} options - options to use\r\n\t\t * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned\r\n\t\t */\r\n\t\ty: function(chart, e, options) {\r\n\t\t\tvar position = getRelativePosition(e, chart);\r\n\t\t\tvar items = [];\r\n\t\t\tvar intersectsItem = false;\r\n\r\n\t\t\tparseVisibleItems(chart, function(element) {\r\n\t\t\t\tif (element.inYRange(position.y)) {\r\n\t\t\t\t\titems.push(element);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (element.inRange(position.x, position.y)) {\r\n\t\t\t\t\tintersectsItem = true;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\t// If we want to trigger on an intersect and we don't have any items\r\n\t\t\t// that intersect the position, return nothing\r\n\t\t\tif (options.intersect && !intersectsItem) {\r\n\t\t\t\titems = [];\r\n\t\t\t}\r\n\t\t\treturn items;\r\n\t\t}\r\n\t}\r\n};\n\nvar extend = helpers$1.extend;\r\n\r\nfunction filterByPosition(array, position) {\r\n\treturn helpers$1.where(array, function(v) {\r\n\t\treturn v.pos === position;\r\n\t});\r\n}\r\n\r\nfunction sortByWeight(array, reverse) {\r\n\treturn array.sort(function(a, b) {\r\n\t\tvar v0 = reverse ? b : a;\r\n\t\tvar v1 = reverse ? a : b;\r\n\t\treturn v0.weight === v1.weight ?\r\n\t\t\tv0.index - v1.index :\r\n\t\t\tv0.weight - v1.weight;\r\n\t});\r\n}\r\n\r\nfunction wrapBoxes(boxes) {\r\n\tvar layoutBoxes = [];\r\n\tvar i, ilen, box;\r\n\r\n\tfor (i = 0, ilen = (boxes || []).length; i < ilen; ++i) {\r\n\t\tbox = boxes[i];\r\n\t\tlayoutBoxes.push({\r\n\t\t\tindex: i,\r\n\t\t\tbox: box,\r\n\t\t\tpos: box.position,\r\n\t\t\thorizontal: box.isHorizontal(),\r\n\t\t\tweight: box.weight\r\n\t\t});\r\n\t}\r\n\treturn layoutBoxes;\r\n}\r\n\r\nfunction setLayoutDims(layouts, params) {\r\n\tvar i, ilen, layout;\r\n\tfor (i = 0, ilen = layouts.length; i < ilen; ++i) {\r\n\t\tlayout = layouts[i];\r\n\t\t// store width used instead of chartArea.w in fitBoxes\r\n\t\tlayout.width = layout.horizontal\r\n\t\t\t? layout.box.fullWidth && params.availableWidth\r\n\t\t\t: params.vBoxMaxWidth;\r\n\t\t// store height used instead of chartArea.h in fitBoxes\r\n\t\tlayout.height = layout.horizontal && params.hBoxMaxHeight;\r\n\t}\r\n}\r\n\r\nfunction buildLayoutBoxes(boxes) {\r\n\tvar layoutBoxes = wrapBoxes(boxes);\r\n\tvar left = sortByWeight(filterByPosition(layoutBoxes, 'left'), true);\r\n\tvar right = sortByWeight(filterByPosition(layoutBoxes, 'right'));\r\n\tvar top = sortByWeight(filterByPosition(layoutBoxes, 'top'), true);\r\n\tvar bottom = sortByWeight(filterByPosition(layoutBoxes, 'bottom'));\r\n\r\n\treturn {\r\n\t\tleftAndTop: left.concat(top),\r\n\t\trightAndBottom: right.concat(bottom),\r\n\t\tchartArea: filterByPosition(layoutBoxes, 'chartArea'),\r\n\t\tvertical: left.concat(right),\r\n\t\thorizontal: top.concat(bottom)\r\n\t};\r\n}\r\n\r\nfunction getCombinedMax(maxPadding, chartArea, a, b) {\r\n\treturn Math.max(maxPadding[a], chartArea[a]) + Math.max(maxPadding[b], chartArea[b]);\r\n}\r\n\r\nfunction updateDims(chartArea, params, layout) {\r\n\tvar box = layout.box;\r\n\tvar maxPadding = chartArea.maxPadding;\r\n\tvar newWidth, newHeight;\r\n\r\n\tif (layout.size) {\r\n\t\t// this layout was already counted for, lets first reduce old size\r\n\t\tchartArea[layout.pos] -= layout.size;\r\n\t}\r\n\tlayout.size = layout.horizontal ? box.height : box.width;\r\n\tchartArea[layout.pos] += layout.size;\r\n\r\n\tif (box.getPadding) {\r\n\t\tvar boxPadding = box.getPadding();\r\n\t\tmaxPadding.top = Math.max(maxPadding.top, boxPadding.top);\r\n\t\tmaxPadding.left = Math.max(maxPadding.left, boxPadding.left);\r\n\t\tmaxPadding.bottom = Math.max(maxPadding.bottom, boxPadding.bottom);\r\n\t\tmaxPadding.right = Math.max(maxPadding.right, boxPadding.right);\r\n\t}\r\n\r\n\tnewWidth = params.outerWidth - getCombinedMax(maxPadding, chartArea, 'left', 'right');\r\n\tnewHeight = params.outerHeight - getCombinedMax(maxPadding, chartArea, 'top', 'bottom');\r\n\r\n\tif (newWidth !== chartArea.w || newHeight !== chartArea.h) {\r\n\t\tchartArea.w = newWidth;\r\n\t\tchartArea.h = newHeight;\r\n\r\n\t\t// return true if chart area changed in layout's direction\r\n\t\tvar sizes = layout.horizontal ? [newWidth, chartArea.w] : [newHeight, chartArea.h];\r\n\t\treturn sizes[0] !== sizes[1] && (!isNaN(sizes[0]) || !isNaN(sizes[1]));\r\n\t}\r\n}\r\n\r\nfunction handleMaxPadding(chartArea) {\r\n\tvar maxPadding = chartArea.maxPadding;\r\n\r\n\tfunction updatePos(pos) {\r\n\t\tvar change = Math.max(maxPadding[pos] - chartArea[pos], 0);\r\n\t\tchartArea[pos] += change;\r\n\t\treturn change;\r\n\t}\r\n\tchartArea.y += updatePos('top');\r\n\tchartArea.x += updatePos('left');\r\n\tupdatePos('right');\r\n\tupdatePos('bottom');\r\n}\r\n\r\nfunction getMargins(horizontal, chartArea) {\r\n\tvar maxPadding = chartArea.maxPadding;\r\n\r\n\tfunction marginForPositions(positions) {\r\n\t\tvar margin = {left: 0, top: 0, right: 0, bottom: 0};\r\n\t\tpositions.forEach(function(pos) {\r\n\t\t\tmargin[pos] = Math.max(chartArea[pos], maxPadding[pos]);\r\n\t\t});\r\n\t\treturn margin;\r\n\t}\r\n\r\n\treturn horizontal\r\n\t\t? marginForPositions(['left', 'right'])\r\n\t\t: marginForPositions(['top', 'bottom']);\r\n}\r\n\r\nfunction fitBoxes(boxes, chartArea, params) {\r\n\tvar refitBoxes = [];\r\n\tvar i, ilen, layout, box, refit, changed;\r\n\r\n\tfor (i = 0, ilen = boxes.length; i < ilen; ++i) {\r\n\t\tlayout = boxes[i];\r\n\t\tbox = layout.box;\r\n\r\n\t\tbox.update(\r\n\t\t\tlayout.width || chartArea.w,\r\n\t\t\tlayout.height || chartArea.h,\r\n\t\t\tgetMargins(layout.horizontal, chartArea)\r\n\t\t);\r\n\t\tif (updateDims(chartArea, params, layout)) {\r\n\t\t\tchanged = true;\r\n\t\t\tif (refitBoxes.length) {\r\n\t\t\t\t// Dimensions changed and there were non full width boxes before this\r\n\t\t\t\t// -> we have to refit those\r\n\t\t\t\trefit = true;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (!box.fullWidth) { // fullWidth boxes don't need to be re-fitted in any case\r\n\t\t\trefitBoxes.push(layout);\r\n\t\t}\r\n\t}\r\n\r\n\treturn refit ? fitBoxes(refitBoxes, chartArea, params) || changed : changed;\r\n}\r\n\r\nfunction placeBoxes(boxes, chartArea, params) {\r\n\tvar userPadding = params.padding;\r\n\tvar x = chartArea.x;\r\n\tvar y = chartArea.y;\r\n\tvar i, ilen, layout, box;\r\n\r\n\tfor (i = 0, ilen = boxes.length; i < ilen; ++i) {\r\n\t\tlayout = boxes[i];\r\n\t\tbox = layout.box;\r\n\t\tif (layout.horizontal) {\r\n\t\t\tbox.left = box.fullWidth ? userPadding.left : chartArea.left;\r\n\t\t\tbox.right = box.fullWidth ? params.outerWidth - userPadding.right : chartArea.left + chartArea.w;\r\n\t\t\tbox.top = y;\r\n\t\t\tbox.bottom = y + box.height;\r\n\t\t\tbox.width = box.right - box.left;\r\n\t\t\ty = box.bottom;\r\n\t\t} else {\r\n\t\t\tbox.left = x;\r\n\t\t\tbox.right = x + box.width;\r\n\t\t\tbox.top = chartArea.top;\r\n\t\t\tbox.bottom = chartArea.top + chartArea.h;\r\n\t\t\tbox.height = box.bottom - box.top;\r\n\t\t\tx = box.right;\r\n\t\t}\r\n\t}\r\n\r\n\tchartArea.x = x;\r\n\tchartArea.y = y;\r\n}\r\n\r\ncore_defaults._set('global', {\r\n\tlayout: {\r\n\t\tpadding: {\r\n\t\t\ttop: 0,\r\n\t\t\tright: 0,\r\n\t\t\tbottom: 0,\r\n\t\t\tleft: 0\r\n\t\t}\r\n\t}\r\n});\r\n\r\n/**\r\n * @interface ILayoutItem\r\n * @prop {string} position - The position of the item in the chart layout. Possible values are\r\n * 'left', 'top', 'right', 'bottom', and 'chartArea'\r\n * @prop {number} weight - The weight used to sort the item. Higher weights are further away from the chart area\r\n * @prop {boolean} fullWidth - if true, and the item is horizontal, then push vertical boxes down\r\n * @prop {function} isHorizontal - returns true if the layout item is horizontal (ie. top or bottom)\r\n * @prop {function} update - Takes two parameters: width and height. Returns size of item\r\n * @prop {function} getPadding - Returns an object with padding on the edges\r\n * @prop {number} width - Width of item. Must be valid after update()\r\n * @prop {number} height - Height of item. Must be valid after update()\r\n * @prop {number} left - Left edge of the item. Set by layout system and cannot be used in update\r\n * @prop {number} top - Top edge of the item. Set by layout system and cannot be used in update\r\n * @prop {number} right - Right edge of the item. Set by layout system and cannot be used in update\r\n * @prop {number} bottom - Bottom edge of the item. Set by layout system and cannot be used in update\r\n */\r\n\r\n// The layout service is very self explanatory. It's responsible for the layout within a chart.\r\n// Scales, Legends and Plugins all rely on the layout service and can easily register to be placed anywhere they need\r\n// It is this service's responsibility of carrying out that layout.\r\nvar core_layouts = {\r\n\tdefaults: {},\r\n\r\n\t/**\r\n\t * Register a box to a chart.\r\n\t * A box is simply a reference to an object that requires layout. eg. Scales, Legend, Title.\r\n\t * @param {Chart} chart - the chart to use\r\n\t * @param {ILayoutItem} item - the item to add to be layed out\r\n\t */\r\n\taddBox: function(chart, item) {\r\n\t\tif (!chart.boxes) {\r\n\t\t\tchart.boxes = [];\r\n\t\t}\r\n\r\n\t\t// initialize item with default values\r\n\t\titem.fullWidth = item.fullWidth || false;\r\n\t\titem.position = item.position || 'top';\r\n\t\titem.weight = item.weight || 0;\r\n\t\titem._layers = item._layers || function() {\r\n\t\t\treturn [{\r\n\t\t\t\tz: 0,\r\n\t\t\t\tdraw: function() {\r\n\t\t\t\t\titem.draw.apply(item, arguments);\r\n\t\t\t\t}\r\n\t\t\t}];\r\n\t\t};\r\n\r\n\t\tchart.boxes.push(item);\r\n\t},\r\n\r\n\t/**\r\n\t * Remove a layoutItem from a chart\r\n\t * @param {Chart} chart - the chart to remove the box from\r\n\t * @param {ILayoutItem} layoutItem - the item to remove from the layout\r\n\t */\r\n\tremoveBox: function(chart, layoutItem) {\r\n\t\tvar index = chart.boxes ? chart.boxes.indexOf(layoutItem) : -1;\r\n\t\tif (index !== -1) {\r\n\t\t\tchart.boxes.splice(index, 1);\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Sets (or updates) options on the given `item`.\r\n\t * @param {Chart} chart - the chart in which the item lives (or will be added to)\r\n\t * @param {ILayoutItem} item - the item to configure with the given options\r\n\t * @param {object} options - the new item options.\r\n\t */\r\n\tconfigure: function(chart, item, options) {\r\n\t\tvar props = ['fullWidth', 'position', 'weight'];\r\n\t\tvar ilen = props.length;\r\n\t\tvar i = 0;\r\n\t\tvar prop;\r\n\r\n\t\tfor (; i < ilen; ++i) {\r\n\t\t\tprop = props[i];\r\n\t\t\tif (options.hasOwnProperty(prop)) {\r\n\t\t\t\titem[prop] = options[prop];\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Fits boxes of the given chart into the given size by having each box measure itself\r\n\t * then running a fitting algorithm\r\n\t * @param {Chart} chart - the chart\r\n\t * @param {number} width - the width to fit into\r\n\t * @param {number} height - the height to fit into\r\n\t */\r\n\tupdate: function(chart, width, height) {\r\n\t\tif (!chart) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tvar layoutOptions = chart.options.layout || {};\r\n\t\tvar padding = helpers$1.options.toPadding(layoutOptions.padding);\r\n\r\n\t\tvar availableWidth = width - padding.width;\r\n\t\tvar availableHeight = height - padding.height;\r\n\t\tvar boxes = buildLayoutBoxes(chart.boxes);\r\n\t\tvar verticalBoxes = boxes.vertical;\r\n\t\tvar horizontalBoxes = boxes.horizontal;\r\n\r\n\t\t// Essentially we now have any number of boxes on each of the 4 sides.\r\n\t\t// Our canvas looks like the following.\r\n\t\t// The areas L1 and L2 are the left axes. R1 is the right axis, T1 is the top axis and\r\n\t\t// B1 is the bottom axis\r\n\t\t// There are also 4 quadrant-like locations (left to right instead of clockwise) reserved for chart overlays\r\n\t\t// These locations are single-box locations only, when trying to register a chartArea location that is already taken,\r\n\t\t// an error will be thrown.\r\n\t\t//\r\n\t\t// |----------------------------------------------------|\r\n\t\t// | T1 (Full Width) |\r\n\t\t// |----------------------------------------------------|\r\n\t\t// | | | T2 | |\r\n\t\t// | |----|-------------------------------------|----|\r\n\t\t// | | | C1 | | C2 | |\r\n\t\t// | | |----| |----| |\r\n\t\t// | | | | |\r\n\t\t// | L1 | L2 | ChartArea (C0) | R1 |\r\n\t\t// | | | | |\r\n\t\t// | | |----| |----| |\r\n\t\t// | | | C3 | | C4 | |\r\n\t\t// | |----|-------------------------------------|----|\r\n\t\t// | | | B1 | |\r\n\t\t// |----------------------------------------------------|\r\n\t\t// | B2 (Full Width) |\r\n\t\t// |----------------------------------------------------|\r\n\t\t//\r\n\r\n\t\tvar params = Object.freeze({\r\n\t\t\touterWidth: width,\r\n\t\t\touterHeight: height,\r\n\t\t\tpadding: padding,\r\n\t\t\tavailableWidth: availableWidth,\r\n\t\t\tvBoxMaxWidth: availableWidth / 2 / verticalBoxes.length,\r\n\t\t\thBoxMaxHeight: availableHeight / 2\r\n\t\t});\r\n\t\tvar chartArea = extend({\r\n\t\t\tmaxPadding: extend({}, padding),\r\n\t\t\tw: availableWidth,\r\n\t\t\th: availableHeight,\r\n\t\t\tx: padding.left,\r\n\t\t\ty: padding.top\r\n\t\t}, padding);\r\n\r\n\t\tsetLayoutDims(verticalBoxes.concat(horizontalBoxes), params);\r\n\r\n\t\t// First fit vertical boxes\r\n\t\tfitBoxes(verticalBoxes, chartArea, params);\r\n\r\n\t\t// Then fit horizontal boxes\r\n\t\tif (fitBoxes(horizontalBoxes, chartArea, params)) {\r\n\t\t\t// if the area changed, re-fit vertical boxes\r\n\t\t\tfitBoxes(verticalBoxes, chartArea, params);\r\n\t\t}\r\n\r\n\t\thandleMaxPadding(chartArea);\r\n\r\n\t\t// Finally place the boxes to correct coordinates\r\n\t\tplaceBoxes(boxes.leftAndTop, chartArea, params);\r\n\r\n\t\t// Move to opposite side of chart\r\n\t\tchartArea.x += chartArea.w;\r\n\t\tchartArea.y += chartArea.h;\r\n\r\n\t\tplaceBoxes(boxes.rightAndBottom, chartArea, params);\r\n\r\n\t\tchart.chartArea = {\r\n\t\t\tleft: chartArea.left,\r\n\t\t\ttop: chartArea.top,\r\n\t\t\tright: chartArea.left + chartArea.w,\r\n\t\t\tbottom: chartArea.top + chartArea.h\r\n\t\t};\r\n\r\n\t\t// Finally update boxes in chartArea (radial scale for example)\r\n\t\thelpers$1.each(boxes.chartArea, function(layout) {\r\n\t\t\tvar box = layout.box;\r\n\t\t\textend(box, chart.chartArea);\r\n\t\t\tbox.update(chartArea.w, chartArea.h);\r\n\t\t});\r\n\t}\r\n};\n\n/**\r\n * Platform fallback implementation (minimal).\r\n * @see https://github.com/chartjs/Chart.js/pull/4591#issuecomment-319575939\r\n */\r\n\r\nvar platform_basic = {\r\n\tacquireContext: function(item) {\r\n\t\tif (item && item.canvas) {\r\n\t\t\t// Support for any object associated to a canvas (including a context2d)\r\n\t\t\titem = item.canvas;\r\n\t\t}\r\n\r\n\t\treturn item && item.getContext('2d') || null;\r\n\t}\r\n};\n\nvar platform_dom = \"/*\\r\\n * DOM element rendering detection\\r\\n * https://davidwalsh.name/detect-node-insertion\\r\\n */\\r\\n@keyframes chartjs-render-animation {\\r\\n\\tfrom { opacity: 0.99; }\\r\\n\\tto { opacity: 1; }\\r\\n}\\r\\n\\r\\n.chartjs-render-monitor {\\r\\n\\tanimation: chartjs-render-animation 0.001s;\\r\\n}\\r\\n\\r\\n/*\\r\\n * DOM element resizing detection\\r\\n * https://github.com/marcj/css-element-queries\\r\\n */\\r\\n.chartjs-size-monitor,\\r\\n.chartjs-size-monitor-expand,\\r\\n.chartjs-size-monitor-shrink {\\r\\n\\tposition: absolute;\\r\\n\\tdirection: ltr;\\r\\n\\tleft: 0;\\r\\n\\ttop: 0;\\r\\n\\tright: 0;\\r\\n\\tbottom: 0;\\r\\n\\toverflow: hidden;\\r\\n\\tpointer-events: none;\\r\\n\\tvisibility: hidden;\\r\\n\\tz-index: -1;\\r\\n}\\r\\n\\r\\n.chartjs-size-monitor-expand > div {\\r\\n\\tposition: absolute;\\r\\n\\twidth: 1000000px;\\r\\n\\theight: 1000000px;\\r\\n\\tleft: 0;\\r\\n\\ttop: 0;\\r\\n}\\r\\n\\r\\n.chartjs-size-monitor-shrink > div {\\r\\n\\tposition: absolute;\\r\\n\\twidth: 200%;\\r\\n\\theight: 200%;\\r\\n\\tleft: 0;\\r\\n\\ttop: 0;\\r\\n}\\r\\n\";\n\nvar platform_dom$1 = /*#__PURE__*/Object.freeze({\n__proto__: null,\n'default': platform_dom\n});\n\nvar stylesheet = getCjsExportFromNamespace(platform_dom$1);\n\nvar EXPANDO_KEY = '$chartjs';\r\nvar CSS_PREFIX = 'chartjs-';\r\nvar CSS_SIZE_MONITOR = CSS_PREFIX + 'size-monitor';\r\nvar CSS_RENDER_MONITOR = CSS_PREFIX + 'render-monitor';\r\nvar CSS_RENDER_ANIMATION = CSS_PREFIX + 'render-animation';\r\nvar ANIMATION_START_EVENTS = ['animationstart', 'webkitAnimationStart'];\r\n\r\n/**\r\n * DOM event types -> Chart.js event types.\r\n * Note: only events with different types are mapped.\r\n * @see https://developer.mozilla.org/en-US/docs/Web/Events\r\n */\r\nvar EVENT_TYPES = {\r\n\ttouchstart: 'mousedown',\r\n\ttouchmove: 'mousemove',\r\n\ttouchend: 'mouseup',\r\n\tpointerenter: 'mouseenter',\r\n\tpointerdown: 'mousedown',\r\n\tpointermove: 'mousemove',\r\n\tpointerup: 'mouseup',\r\n\tpointerleave: 'mouseout',\r\n\tpointerout: 'mouseout'\r\n};\r\n\r\n/**\r\n * The \"used\" size is the final value of a dimension property after all calculations have\r\n * been performed. This method uses the computed style of `element` but returns undefined\r\n * if the computed style is not expressed in pixels. That can happen in some cases where\r\n * `element` has a size relative to its parent and this last one is not yet displayed,\r\n * for example because of `display: none` on a parent node.\r\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/used_value\r\n * @returns {number} Size in pixels or undefined if unknown.\r\n */\r\nfunction readUsedSize(element, property) {\r\n\tvar value = helpers$1.getStyle(element, property);\r\n\tvar matches = value && value.match(/^(\\d+)(\\.\\d+)?px$/);\r\n\treturn matches ? Number(matches[1]) : undefined;\r\n}\r\n\r\n/**\r\n * Initializes the canvas style and render size without modifying the canvas display size,\r\n * since responsiveness is handled by the controller.resize() method. The config is used\r\n * to determine the aspect ratio to apply in case no explicit height has been specified.\r\n */\r\nfunction initCanvas(canvas, config) {\r\n\tvar style = canvas.style;\r\n\r\n\t// NOTE(SB) canvas.getAttribute('width') !== canvas.width: in the first case it\r\n\t// returns null or '' if no explicit value has been set to the canvas attribute.\r\n\tvar renderHeight = canvas.getAttribute('height');\r\n\tvar renderWidth = canvas.getAttribute('width');\r\n\r\n\t// Chart.js modifies some canvas values that we want to restore on destroy\r\n\tcanvas[EXPANDO_KEY] = {\r\n\t\tinitial: {\r\n\t\t\theight: renderHeight,\r\n\t\t\twidth: renderWidth,\r\n\t\t\tstyle: {\r\n\t\t\t\tdisplay: style.display,\r\n\t\t\t\theight: style.height,\r\n\t\t\t\twidth: style.width\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\t// Force canvas to display as block to avoid extra space caused by inline\r\n\t// elements, which would interfere with the responsive resize process.\r\n\t// https://github.com/chartjs/Chart.js/issues/2538\r\n\tstyle.display = style.display || 'block';\r\n\r\n\tif (renderWidth === null || renderWidth === '') {\r\n\t\tvar displayWidth = readUsedSize(canvas, 'width');\r\n\t\tif (displayWidth !== undefined) {\r\n\t\t\tcanvas.width = displayWidth;\r\n\t\t}\r\n\t}\r\n\r\n\tif (renderHeight === null || renderHeight === '') {\r\n\t\tif (canvas.style.height === '') {\r\n\t\t\t// If no explicit render height and style height, let's apply the aspect ratio,\r\n\t\t\t// which one can be specified by the user but also by charts as default option\r\n\t\t\t// (i.e. options.aspectRatio). If not specified, use canvas aspect ratio of 2.\r\n\t\t\tcanvas.height = canvas.width / (config.options.aspectRatio || 2);\r\n\t\t} else {\r\n\t\t\tvar displayHeight = readUsedSize(canvas, 'height');\r\n\t\t\tif (displayWidth !== undefined) {\r\n\t\t\t\tcanvas.height = displayHeight;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn canvas;\r\n}\r\n\r\n/**\r\n * Detects support for options object argument in addEventListener.\r\n * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Safely_detecting_option_support\r\n * @private\r\n */\r\nvar supportsEventListenerOptions = (function() {\r\n\tvar supports = false;\r\n\ttry {\r\n\t\tvar options = Object.defineProperty({}, 'passive', {\r\n\t\t\t// eslint-disable-next-line getter-return\r\n\t\t\tget: function() {\r\n\t\t\t\tsupports = true;\r\n\t\t\t}\r\n\t\t});\r\n\t\twindow.addEventListener('e', null, options);\r\n\t} catch (e) {\r\n\t\t// continue regardless of error\r\n\t}\r\n\treturn supports;\r\n}());\r\n\r\n// Default passive to true as expected by Chrome for 'touchstart' and 'touchend' events.\r\n// https://github.com/chartjs/Chart.js/issues/4287\r\nvar eventListenerOptions = supportsEventListenerOptions ? {passive: true} : false;\r\n\r\nfunction addListener(node, type, listener) {\r\n\tnode.addEventListener(type, listener, eventListenerOptions);\r\n}\r\n\r\nfunction removeListener(node, type, listener) {\r\n\tnode.removeEventListener(type, listener, eventListenerOptions);\r\n}\r\n\r\nfunction createEvent(type, chart, x, y, nativeEvent) {\r\n\treturn {\r\n\t\ttype: type,\r\n\t\tchart: chart,\r\n\t\tnative: nativeEvent || null,\r\n\t\tx: x !== undefined ? x : null,\r\n\t\ty: y !== undefined ? y : null,\r\n\t};\r\n}\r\n\r\nfunction fromNativeEvent(event, chart) {\r\n\tvar type = EVENT_TYPES[event.type] || event.type;\r\n\tvar pos = helpers$1.getRelativePosition(event, chart);\r\n\treturn createEvent(type, chart, pos.x, pos.y, event);\r\n}\r\n\r\nfunction throttled(fn, thisArg) {\r\n\tvar ticking = false;\r\n\tvar args = [];\r\n\r\n\treturn function() {\r\n\t\targs = Array.prototype.slice.call(arguments);\r\n\t\tthisArg = thisArg || this;\r\n\r\n\t\tif (!ticking) {\r\n\t\t\tticking = true;\r\n\t\t\thelpers$1.requestAnimFrame.call(window, function() {\r\n\t\t\t\tticking = false;\r\n\t\t\t\tfn.apply(thisArg, args);\r\n\t\t\t});\r\n\t\t}\r\n\t};\r\n}\r\n\r\nfunction createDiv(cls) {\r\n\tvar el = document.createElement('div');\r\n\tel.className = cls || '';\r\n\treturn el;\r\n}\r\n\r\n// Implementation based on https://github.com/marcj/css-element-queries\r\nfunction createResizer(handler) {\r\n\tvar maxSize = 1000000;\r\n\r\n\t// NOTE(SB) Don't use innerHTML because it could be considered unsafe.\r\n\t// https://github.com/chartjs/Chart.js/issues/5902\r\n\tvar resizer = createDiv(CSS_SIZE_MONITOR);\r\n\tvar expand = createDiv(CSS_SIZE_MONITOR + '-expand');\r\n\tvar shrink = createDiv(CSS_SIZE_MONITOR + '-shrink');\r\n\r\n\texpand.appendChild(createDiv());\r\n\tshrink.appendChild(createDiv());\r\n\r\n\tresizer.appendChild(expand);\r\n\tresizer.appendChild(shrink);\r\n\tresizer._reset = function() {\r\n\t\texpand.scrollLeft = maxSize;\r\n\t\texpand.scrollTop = maxSize;\r\n\t\tshrink.scrollLeft = maxSize;\r\n\t\tshrink.scrollTop = maxSize;\r\n\t};\r\n\r\n\tvar onScroll = function() {\r\n\t\tresizer._reset();\r\n\t\thandler();\r\n\t};\r\n\r\n\taddListener(expand, 'scroll', onScroll.bind(expand, 'expand'));\r\n\taddListener(shrink, 'scroll', onScroll.bind(shrink, 'shrink'));\r\n\r\n\treturn resizer;\r\n}\r\n\r\n// https://davidwalsh.name/detect-node-insertion\r\nfunction watchForRender(node, handler) {\r\n\tvar expando = node[EXPANDO_KEY] || (node[EXPANDO_KEY] = {});\r\n\tvar proxy = expando.renderProxy = function(e) {\r\n\t\tif (e.animationName === CSS_RENDER_ANIMATION) {\r\n\t\t\thandler();\r\n\t\t}\r\n\t};\r\n\r\n\thelpers$1.each(ANIMATION_START_EVENTS, function(type) {\r\n\t\taddListener(node, type, proxy);\r\n\t});\r\n\r\n\t// #4737: Chrome might skip the CSS animation when the CSS_RENDER_MONITOR class\r\n\t// is removed then added back immediately (same animation frame?). Accessing the\r\n\t// `offsetParent` property will force a reflow and re-evaluate the CSS animation.\r\n\t// https://gist.github.com/paulirish/5d52fb081b3570c81e3a#box-metrics\r\n\t// https://github.com/chartjs/Chart.js/issues/4737\r\n\texpando.reflow = !!node.offsetParent;\r\n\r\n\tnode.classList.add(CSS_RENDER_MONITOR);\r\n}\r\n\r\nfunction unwatchForRender(node) {\r\n\tvar expando = node[EXPANDO_KEY] || {};\r\n\tvar proxy = expando.renderProxy;\r\n\r\n\tif (proxy) {\r\n\t\thelpers$1.each(ANIMATION_START_EVENTS, function(type) {\r\n\t\t\tremoveListener(node, type, proxy);\r\n\t\t});\r\n\r\n\t\tdelete expando.renderProxy;\r\n\t}\r\n\r\n\tnode.classList.remove(CSS_RENDER_MONITOR);\r\n}\r\n\r\nfunction addResizeListener(node, listener, chart) {\r\n\tvar expando = node[EXPANDO_KEY] || (node[EXPANDO_KEY] = {});\r\n\r\n\t// Let's keep track of this added resizer and thus avoid DOM query when removing it.\r\n\tvar resizer = expando.resizer = createResizer(throttled(function() {\r\n\t\tif (expando.resizer) {\r\n\t\t\tvar container = chart.options.maintainAspectRatio && node.parentNode;\r\n\t\t\tvar w = container ? container.clientWidth : 0;\r\n\t\t\tlistener(createEvent('resize', chart));\r\n\t\t\tif (container && container.clientWidth < w && chart.canvas) {\r\n\t\t\t\t// If the container size shrank during chart resize, let's assume\r\n\t\t\t\t// scrollbar appeared. So we resize again with the scrollbar visible -\r\n\t\t\t\t// effectively making chart smaller and the scrollbar hidden again.\r\n\t\t\t\t// Because we are inside `throttled`, and currently `ticking`, scroll\r\n\t\t\t\t// events are ignored during this whole 2 resize process.\r\n\t\t\t\t// If we assumed wrong and something else happened, we are resizing\r\n\t\t\t\t// twice in a frame (potential performance issue)\r\n\t\t\t\tlistener(createEvent('resize', chart));\r\n\t\t\t}\r\n\t\t}\r\n\t}));\r\n\r\n\t// The resizer needs to be attached to the node parent, so we first need to be\r\n\t// sure that `node` is attached to the DOM before injecting the resizer element.\r\n\twatchForRender(node, function() {\r\n\t\tif (expando.resizer) {\r\n\t\t\tvar container = node.parentNode;\r\n\t\t\tif (container && container !== resizer.parentNode) {\r\n\t\t\t\tcontainer.insertBefore(resizer, container.firstChild);\r\n\t\t\t}\r\n\r\n\t\t\t// The container size might have changed, let's reset the resizer state.\r\n\t\t\tresizer._reset();\r\n\t\t}\r\n\t});\r\n}\r\n\r\nfunction removeResizeListener(node) {\r\n\tvar expando = node[EXPANDO_KEY] || {};\r\n\tvar resizer = expando.resizer;\r\n\r\n\tdelete expando.resizer;\r\n\tunwatchForRender(node);\r\n\r\n\tif (resizer && resizer.parentNode) {\r\n\t\tresizer.parentNode.removeChild(resizer);\r\n\t}\r\n}\r\n\r\n/**\r\n * Injects CSS styles inline if the styles are not already present.\r\n * @param {HTMLDocument|ShadowRoot} rootNode - the node to contain the <style>.\r\n * @param {string} css - the CSS to be injected.\r\n */\r\nfunction injectCSS(rootNode, css) {\r\n\t// https://stackoverflow.com/q/3922139\r\n\tvar expando = rootNode[EXPANDO_KEY] || (rootNode[EXPANDO_KEY] = {});\r\n\tif (!expando.containsStyles) {\r\n\t\texpando.containsStyles = true;\r\n\t\tcss = '/* Chart.js */\\n' + css;\r\n\t\tvar style = document.createElement('style');\r\n\t\tstyle.setAttribute('type', 'text/css');\r\n\t\tstyle.appendChild(document.createTextNode(css));\r\n\t\trootNode.appendChild(style);\r\n\t}\r\n}\r\n\r\nvar platform_dom$2 = {\r\n\t/**\r\n\t * When `true`, prevents the automatic injection of the stylesheet required to\r\n\t * correctly detect when the chart is added to the DOM and then resized. This\r\n\t * switch has been added to allow external stylesheet (`dist/Chart(.min)?.js`)\r\n\t * to be manually imported to make this library compatible with any CSP.\r\n\t * See https://github.com/chartjs/Chart.js/issues/5208\r\n\t */\r\n\tdisableCSSInjection: false,\r\n\r\n\t/**\r\n\t * This property holds whether this platform is enabled for the current environment.\r\n\t * Currently used by platform.js to select the proper implementation.\r\n\t * @private\r\n\t */\r\n\t_enabled: typeof window !== 'undefined' && typeof document !== 'undefined',\r\n\r\n\t/**\r\n\t * Initializes resources that depend on platform options.\r\n\t * @param {HTMLCanvasElement} canvas - The Canvas element.\r\n\t * @private\r\n\t */\r\n\t_ensureLoaded: function(canvas) {\r\n\t\tif (!this.disableCSSInjection) {\r\n\t\t\t// If the canvas is in a shadow DOM, then the styles must also be inserted\r\n\t\t\t// into the same shadow DOM.\r\n\t\t\t// https://github.com/chartjs/Chart.js/issues/5763\r\n\t\t\tvar root = canvas.getRootNode ? canvas.getRootNode() : document;\r\n\t\t\tvar targetNode = root.host ? root : document.head;\r\n\t\t\tinjectCSS(targetNode, stylesheet);\r\n\t\t}\r\n\t},\r\n\r\n\tacquireContext: function(item, config) {\r\n\t\tif (typeof item === 'string') {\r\n\t\t\titem = document.getElementById(item);\r\n\t\t} else if (item.length) {\r\n\t\t\t// Support for array based queries (such as jQuery)\r\n\t\t\titem = item[0];\r\n\t\t}\r\n\r\n\t\tif (item && item.canvas) {\r\n\t\t\t// Support for any object associated to a canvas (including a context2d)\r\n\t\t\titem = item.canvas;\r\n\t\t}\r\n\r\n\t\t// To prevent canvas fingerprinting, some add-ons undefine the getContext\r\n\t\t// method, for example: https://github.com/kkapsner/CanvasBlocker\r\n\t\t// https://github.com/chartjs/Chart.js/issues/2807\r\n\t\tvar context = item && item.getContext && item.getContext('2d');\r\n\r\n\t\t// `instanceof HTMLCanvasElement/CanvasRenderingContext2D` fails when the item is\r\n\t\t// inside an iframe or when running in a protected environment. We could guess the\r\n\t\t// types from their toString() value but let's keep things flexible and assume it's\r\n\t\t// a sufficient condition if the item has a context2D which has item as `canvas`.\r\n\t\t// https://github.com/chartjs/Chart.js/issues/3887\r\n\t\t// https://github.com/chartjs/Chart.js/issues/4102\r\n\t\t// https://github.com/chartjs/Chart.js/issues/4152\r\n\t\tif (context && context.canvas === item) {\r\n\t\t\t// Load platform resources on first chart creation, to make it possible to\r\n\t\t\t// import the library before setting platform options.\r\n\t\t\tthis._ensureLoaded(item);\r\n\t\t\tinitCanvas(item, config);\r\n\t\t\treturn context;\r\n\t\t}\r\n\r\n\t\treturn null;\r\n\t},\r\n\r\n\treleaseContext: function(context) {\r\n\t\tvar canvas = context.canvas;\r\n\t\tif (!canvas[EXPANDO_KEY]) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tvar initial = canvas[EXPANDO_KEY].initial;\r\n\t\t['height', 'width'].forEach(function(prop) {\r\n\t\t\tvar value = initial[prop];\r\n\t\t\tif (helpers$1.isNullOrUndef(value)) {\r\n\t\t\t\tcanvas.removeAttribute(prop);\r\n\t\t\t} else {\r\n\t\t\t\tcanvas.setAttribute(prop, value);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\thelpers$1.each(initial.style || {}, function(value, key) {\r\n\t\t\tcanvas.style[key] = value;\r\n\t\t});\r\n\r\n\t\t// The canvas render size might have been changed (and thus the state stack discarded),\r\n\t\t// we can't use save() and restore() to restore the initial state. So make sure that at\r\n\t\t// least the canvas context is reset to the default state by setting the canvas width.\r\n\t\t// https://www.w3.org/TR/2011/WD-html5-20110525/the-canvas-element.html\r\n\t\t// eslint-disable-next-line no-self-assign\r\n\t\tcanvas.width = canvas.width;\r\n\r\n\t\tdelete canvas[EXPANDO_KEY];\r\n\t},\r\n\r\n\taddEventListener: function(chart, type, listener) {\r\n\t\tvar canvas = chart.canvas;\r\n\t\tif (type === 'resize') {\r\n\t\t\t// Note: the resize event is not supported on all browsers.\r\n\t\t\taddResizeListener(canvas, listener, chart);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tvar expando = listener[EXPANDO_KEY] || (listener[EXPANDO_KEY] = {});\r\n\t\tvar proxies = expando.proxies || (expando.proxies = {});\r\n\t\tvar proxy = proxies[chart.id + '_' + type] = function(event) {\r\n\t\t\tlistener(fromNativeEvent(event, chart));\r\n\t\t};\r\n\r\n\t\taddListener(canvas, type, proxy);\r\n\t},\r\n\r\n\tremoveEventListener: function(chart, type, listener) {\r\n\t\tvar canvas = chart.canvas;\r\n\t\tif (type === 'resize') {\r\n\t\t\t// Note: the resize event is not supported on all browsers.\r\n\t\t\tremoveResizeListener(canvas);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tvar expando = listener[EXPANDO_KEY] || {};\r\n\t\tvar proxies = expando.proxies || {};\r\n\t\tvar proxy = proxies[chart.id + '_' + type];\r\n\t\tif (!proxy) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tremoveListener(canvas, type, proxy);\r\n\t}\r\n};\r\n\r\n// DEPRECATIONS\r\n\r\n/**\r\n * Provided for backward compatibility, use EventTarget.addEventListener instead.\r\n * EventTarget.addEventListener compatibility: Chrome, Opera 7, Safari, FF1.5+, IE9+\r\n * @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener\r\n * @function Chart.helpers.addEvent\r\n * @deprecated since version 2.7.0\r\n * @todo remove at version 3\r\n * @private\r\n */\r\nhelpers$1.addEvent = addListener;\r\n\r\n/**\r\n * Provided for backward compatibility, use EventTarget.removeEventListener instead.\r\n * EventTarget.removeEventListener compatibility: Chrome, Opera 7, Safari, FF1.5+, IE9+\r\n * @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener\r\n * @function Chart.helpers.removeEvent\r\n * @deprecated since version 2.7.0\r\n * @todo remove at version 3\r\n * @private\r\n */\r\nhelpers$1.removeEvent = removeListener;\n\n// @TODO Make possible to select another platform at build time.\r\nvar implementation = platform_dom$2._enabled ? platform_dom$2 : platform_basic;\r\n\r\n/**\r\n * @namespace Chart.platform\r\n * @see https://chartjs.gitbooks.io/proposals/content/Platform.html\r\n * @since 2.4.0\r\n */\r\nvar platform = helpers$1.extend({\r\n\t/**\r\n\t * @since 2.7.0\r\n\t */\r\n\tinitialize: function() {},\r\n\r\n\t/**\r\n\t * Called at chart construction time, returns a context2d instance implementing\r\n\t * the [W3C Canvas 2D Context API standard]{@link https://www.w3.org/TR/2dcontext/}.\r\n\t * @param {*} item - The native item from which to acquire context (platform specific)\r\n\t * @param {object} options - The chart options\r\n\t * @returns {CanvasRenderingContext2D} context2d instance\r\n\t */\r\n\tacquireContext: function() {},\r\n\r\n\t/**\r\n\t * Called at chart destruction time, releases any resources associated to the context\r\n\t * previously returned by the acquireContext() method.\r\n\t * @param {CanvasRenderingContext2D} context - The context2d instance\r\n\t * @returns {boolean} true if the method succeeded, else false\r\n\t */\r\n\treleaseContext: function() {},\r\n\r\n\t/**\r\n\t * Registers the specified listener on the given chart.\r\n\t * @param {Chart} chart - Chart from which to listen for event\r\n\t * @param {string} type - The ({@link IEvent}) type to listen for\r\n\t * @param {function} listener - Receives a notification (an object that implements\r\n\t * the {@link IEvent} interface) when an event of the specified type occurs.\r\n\t */\r\n\taddEventListener: function() {},\r\n\r\n\t/**\r\n\t * Removes the specified listener previously registered with addEventListener.\r\n\t * @param {Chart} chart - Chart from which to remove the listener\r\n\t * @param {string} type - The ({@link IEvent}) type to remove\r\n\t * @param {function} listener - The listener function to remove from the event target.\r\n\t */\r\n\tremoveEventListener: function() {}\r\n\r\n}, implementation);\n\ncore_defaults._set('global', {\r\n\tplugins: {}\r\n});\r\n\r\n/**\r\n * The plugin service singleton\r\n * @namespace Chart.plugins\r\n * @since 2.1.0\r\n */\r\nvar core_plugins = {\r\n\t/**\r\n\t * Globally registered plugins.\r\n\t * @private\r\n\t */\r\n\t_plugins: [],\r\n\r\n\t/**\r\n\t * This identifier is used to invalidate the descriptors cache attached to each chart\r\n\t * when a global plugin is registered or unregistered. In this case, the cache ID is\r\n\t * incremented and descriptors are regenerated during following API calls.\r\n\t * @private\r\n\t */\r\n\t_cacheId: 0,\r\n\r\n\t/**\r\n\t * Registers the given plugin(s) if not already registered.\r\n\t * @param {IPlugin[]|IPlugin} plugins plugin instance(s).\r\n\t */\r\n\tregister: function(plugins) {\r\n\t\tvar p = this._plugins;\r\n\t\t([]).concat(plugins).forEach(function(plugin) {\r\n\t\t\tif (p.indexOf(plugin) === -1) {\r\n\t\t\t\tp.push(plugin);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tthis._cacheId++;\r\n\t},\r\n\r\n\t/**\r\n\t * Unregisters the given plugin(s) only if registered.\r\n\t * @param {IPlugin[]|IPlugin} plugins plugin instance(s).\r\n\t */\r\n\tunregister: function(plugins) {\r\n\t\tvar p = this._plugins;\r\n\t\t([]).concat(plugins).forEach(function(plugin) {\r\n\t\t\tvar idx = p.indexOf(plugin);\r\n\t\t\tif (idx !== -1) {\r\n\t\t\t\tp.splice(idx, 1);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tthis._cacheId++;\r\n\t},\r\n\r\n\t/**\r\n\t * Remove all registered plugins.\r\n\t * @since 2.1.5\r\n\t */\r\n\tclear: function() {\r\n\t\tthis._plugins = [];\r\n\t\tthis._cacheId++;\r\n\t},\r\n\r\n\t/**\r\n\t * Returns the number of registered plugins?\r\n\t * @returns {number}\r\n\t * @since 2.1.5\r\n\t */\r\n\tcount: function() {\r\n\t\treturn this._plugins.length;\r\n\t},\r\n\r\n\t/**\r\n\t * Returns all registered plugin instances.\r\n\t * @returns {IPlugin[]} array of plugin objects.\r\n\t * @since 2.1.5\r\n\t */\r\n\tgetAll: function() {\r\n\t\treturn this._plugins;\r\n\t},\r\n\r\n\t/**\r\n\t * Calls enabled plugins for `chart` on the specified hook and with the given args.\r\n\t * This method immediately returns as soon as a plugin explicitly returns false. The\r\n\t * returned value can be used, for instance, to interrupt the current action.\r\n\t * @param {Chart} chart - The chart instance for which plugins should be called.\r\n\t * @param {string} hook - The name of the plugin method to call (e.g. 'beforeUpdate').\r\n\t * @param {Array} [args] - Extra arguments to apply to the hook call.\r\n\t * @returns {boolean} false if any of the plugins return false, else returns true.\r\n\t */\r\n\tnotify: function(chart, hook, args) {\r\n\t\tvar descriptors = this.descriptors(chart);\r\n\t\tvar ilen = descriptors.length;\r\n\t\tvar i, descriptor, plugin, params, method;\r\n\r\n\t\tfor (i = 0; i < ilen; ++i) {\r\n\t\t\tdescriptor = descriptors[i];\r\n\t\t\tplugin = descriptor.plugin;\r\n\t\t\tmethod = plugin[hook];\r\n\t\t\tif (typeof method === 'function') {\r\n\t\t\t\tparams = [chart].concat(args || []);\r\n\t\t\t\tparams.push(descriptor.options);\r\n\t\t\t\tif (method.apply(plugin, params) === false) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\t},\r\n\r\n\t/**\r\n\t * Returns descriptors of enabled plugins for the given chart.\r\n\t * @returns {object[]} [{ plugin, options }]\r\n\t * @private\r\n\t */\r\n\tdescriptors: function(chart) {\r\n\t\tvar cache = chart.$plugins || (chart.$plugins = {});\r\n\t\tif (cache.id === this._cacheId) {\r\n\t\t\treturn cache.descriptors;\r\n\t\t}\r\n\r\n\t\tvar plugins = [];\r\n\t\tvar descriptors = [];\r\n\t\tvar config = (chart && chart.config) || {};\r\n\t\tvar options = (config.options && config.options.plugins) || {};\r\n\r\n\t\tthis._plugins.concat(config.plugins || []).forEach(function(plugin) {\r\n\t\t\tvar idx = plugins.indexOf(plugin);\r\n\t\t\tif (idx !== -1) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tvar id = plugin.id;\r\n\t\t\tvar opts = options[id];\r\n\t\t\tif (opts === false) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tif (opts === true) {\r\n\t\t\t\topts = helpers$1.clone(core_defaults.global.plugins[id]);\r\n\t\t\t}\r\n\r\n\t\t\tplugins.push(plugin);\r\n\t\t\tdescriptors.push({\r\n\t\t\t\tplugin: plugin,\r\n\t\t\t\toptions: opts || {}\r\n\t\t\t});\r\n\t\t});\r\n\r\n\t\tcache.descriptors = descriptors;\r\n\t\tcache.id = this._cacheId;\r\n\t\treturn descriptors;\r\n\t},\r\n\r\n\t/**\r\n\t * Invalidates cache for the given chart: descriptors hold a reference on plugin option,\r\n\t * but in some cases, this reference can be changed by the user when updating options.\r\n\t * https://github.com/chartjs/Chart.js/issues/5111#issuecomment-355934167\r\n\t * @private\r\n\t */\r\n\t_invalidate: function(chart) {\r\n\t\tdelete chart.$plugins;\r\n\t}\r\n};\n\nvar core_scaleService = {\r\n\t// Scale registration object. Extensions can register new scale types (such as log or DB scales) and then\r\n\t// use the new chart options to grab the correct scale\r\n\tconstructors: {},\r\n\t// Use a registration function so that we can move to an ES6 map when we no longer need to support\r\n\t// old browsers\r\n\r\n\t// Scale config defaults\r\n\tdefaults: {},\r\n\tregisterScaleType: function(type, scaleConstructor, scaleDefaults) {\r\n\t\tthis.constructors[type] = scaleConstructor;\r\n\t\tthis.defaults[type] = helpers$1.clone(scaleDefaults);\r\n\t},\r\n\tgetScaleConstructor: function(type) {\r\n\t\treturn this.constructors.hasOwnProperty(type) ? this.constructors[type] : undefined;\r\n\t},\r\n\tgetScaleDefaults: function(type) {\r\n\t\t// Return the scale defaults merged with the global settings so that we always use the latest ones\r\n\t\treturn this.defaults.hasOwnProperty(type) ? helpers$1.merge(Object.create(null), [core_defaults.scale, this.defaults[type]]) : {};\r\n\t},\r\n\tupdateScaleDefaults: function(type, additions) {\r\n\t\tvar me = this;\r\n\t\tif (me.defaults.hasOwnProperty(type)) {\r\n\t\t\tme.defaults[type] = helpers$1.extend(me.defaults[type], additions);\r\n\t\t}\r\n\t},\r\n\taddScalesToLayout: function(chart) {\r\n\t\t// Adds each scale to the chart.boxes array to be sized accordingly\r\n\t\thelpers$1.each(chart.scales, function(scale) {\r\n\t\t\t// Set ILayoutItem parameters for backwards compatibility\r\n\t\t\tscale.fullWidth = scale.options.fullWidth;\r\n\t\t\tscale.position = scale.options.position;\r\n\t\t\tscale.weight = scale.options.weight;\r\n\t\t\tcore_layouts.addBox(chart, scale);\r\n\t\t});\r\n\t}\r\n};\n\nvar valueOrDefault$8 = helpers$1.valueOrDefault;\r\nvar getRtlHelper = helpers$1.rtl.getRtlAdapter;\r\n\r\ncore_defaults._set('global', {\r\n\ttooltips: {\r\n\t\tenabled: true,\r\n\t\tcustom: null,\r\n\t\tmode: 'nearest',\r\n\t\tposition: 'average',\r\n\t\tintersect: true,\r\n\t\tbackgroundColor: 'rgba(0,0,0,0.8)',\r\n\t\ttitleFontStyle: 'bold',\r\n\t\ttitleSpacing: 2,\r\n\t\ttitleMarginBottom: 6,\r\n\t\ttitleFontColor: '#fff',\r\n\t\ttitleAlign: 'left',\r\n\t\tbodySpacing: 2,\r\n\t\tbodyFontColor: '#fff',\r\n\t\tbodyAlign: 'left',\r\n\t\tfooterFontStyle: 'bold',\r\n\t\tfooterSpacing: 2,\r\n\t\tfooterMarginTop: 6,\r\n\t\tfooterFontColor: '#fff',\r\n\t\tfooterAlign: 'left',\r\n\t\tyPadding: 6,\r\n\t\txPadding: 6,\r\n\t\tcaretPadding: 2,\r\n\t\tcaretSize: 5,\r\n\t\tcornerRadius: 6,\r\n\t\tmultiKeyBackground: '#fff',\r\n\t\tdisplayColors: true,\r\n\t\tborderColor: 'rgba(0,0,0,0)',\r\n\t\tborderWidth: 0,\r\n\t\tcallbacks: {\r\n\t\t\t// Args are: (tooltipItems, data)\r\n\t\t\tbeforeTitle: helpers$1.noop,\r\n\t\t\ttitle: function(tooltipItems, data) {\r\n\t\t\t\tvar title = '';\r\n\t\t\t\tvar labels = data.labels;\r\n\t\t\t\tvar labelCount = labels ? labels.length : 0;\r\n\r\n\t\t\t\tif (tooltipItems.length > 0) {\r\n\t\t\t\t\tvar item = tooltipItems[0];\r\n\t\t\t\t\tif (item.label) {\r\n\t\t\t\t\t\ttitle = item.label;\r\n\t\t\t\t\t} else if (item.xLabel) {\r\n\t\t\t\t\t\ttitle = item.xLabel;\r\n\t\t\t\t\t} else if (labelCount > 0 && item.index < labelCount) {\r\n\t\t\t\t\t\ttitle = labels[item.index];\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn title;\r\n\t\t\t},\r\n\t\t\tafterTitle: helpers$1.noop,\r\n\r\n\t\t\t// Args are: (tooltipItems, data)\r\n\t\t\tbeforeBody: helpers$1.noop,\r\n\r\n\t\t\t// Args are: (tooltipItem, data)\r\n\t\t\tbeforeLabel: helpers$1.noop,\r\n\t\t\tlabel: function(tooltipItem, data) {\r\n\t\t\t\tvar label = data.datasets[tooltipItem.datasetIndex].label || '';\r\n\r\n\t\t\t\tif (label) {\r\n\t\t\t\t\tlabel += ': ';\r\n\t\t\t\t}\r\n\t\t\t\tif (!helpers$1.isNullOrUndef(tooltipItem.value)) {\r\n\t\t\t\t\tlabel += tooltipItem.value;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tlabel += tooltipItem.yLabel;\r\n\t\t\t\t}\r\n\t\t\t\treturn label;\r\n\t\t\t},\r\n\t\t\tlabelColor: function(tooltipItem, chart) {\r\n\t\t\t\tvar meta = chart.getDatasetMeta(tooltipItem.datasetIndex);\r\n\t\t\t\tvar activeElement = meta.data[tooltipItem.index];\r\n\t\t\t\tvar view = activeElement._view;\r\n\t\t\t\treturn {\r\n\t\t\t\t\tborderColor: view.borderColor,\r\n\t\t\t\t\tbackgroundColor: view.backgroundColor\r\n\t\t\t\t};\r\n\t\t\t},\r\n\t\t\tlabelTextColor: function() {\r\n\t\t\t\treturn this._options.bodyFontColor;\r\n\t\t\t},\r\n\t\t\tafterLabel: helpers$1.noop,\r\n\r\n\t\t\t// Args are: (tooltipItems, data)\r\n\t\t\tafterBody: helpers$1.noop,\r\n\r\n\t\t\t// Args are: (tooltipItems, data)\r\n\t\t\tbeforeFooter: helpers$1.noop,\r\n\t\t\tfooter: helpers$1.noop,\r\n\t\t\tafterFooter: helpers$1.noop\r\n\t\t}\r\n\t}\r\n});\r\n\r\nvar positioners = {\r\n\t/**\r\n\t * Average mode places the tooltip at the average position of the elements shown\r\n\t * @function Chart.Tooltip.positioners.average\r\n\t * @param elements {ChartElement[]} the elements being displayed in the tooltip\r\n\t * @returns {object} tooltip position\r\n\t */\r\n\taverage: function(elements) {\r\n\t\tif (!elements.length) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tvar i, len;\r\n\t\tvar x = 0;\r\n\t\tvar y = 0;\r\n\t\tvar count = 0;\r\n\r\n\t\tfor (i = 0, len = elements.length; i < len; ++i) {\r\n\t\t\tvar el = elements[i];\r\n\t\t\tif (el && el.hasValue()) {\r\n\t\t\t\tvar pos = el.tooltipPosition();\r\n\t\t\t\tx += pos.x;\r\n\t\t\t\ty += pos.y;\r\n\t\t\t\t++count;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\tx: x / count,\r\n\t\t\ty: y / count\r\n\t\t};\r\n\t},\r\n\r\n\t/**\r\n\t * Gets the tooltip position nearest of the item nearest to the event position\r\n\t * @function Chart.Tooltip.positioners.nearest\r\n\t * @param elements {Chart.Element[]} the tooltip elements\r\n\t * @param eventPosition {object} the position of the event in canvas coordinates\r\n\t * @returns {object} the tooltip position\r\n\t */\r\n\tnearest: function(elements, eventPosition) {\r\n\t\tvar x = eventPosition.x;\r\n\t\tvar y = eventPosition.y;\r\n\t\tvar minDistance = Number.POSITIVE_INFINITY;\r\n\t\tvar i, len, nearestElement;\r\n\r\n\t\tfor (i = 0, len = elements.length; i < len; ++i) {\r\n\t\t\tvar el = elements[i];\r\n\t\t\tif (el && el.hasValue()) {\r\n\t\t\t\tvar center = el.getCenterPoint();\r\n\t\t\t\tvar d = helpers$1.distanceBetweenPoints(eventPosition, center);\r\n\r\n\t\t\t\tif (d < minDistance) {\r\n\t\t\t\t\tminDistance = d;\r\n\t\t\t\t\tnearestElement = el;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (nearestElement) {\r\n\t\t\tvar tp = nearestElement.tooltipPosition();\r\n\t\t\tx = tp.x;\r\n\t\t\ty = tp.y;\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\tx: x,\r\n\t\t\ty: y\r\n\t\t};\r\n\t}\r\n};\r\n\r\n// Helper to push or concat based on if the 2nd parameter is an array or not\r\nfunction pushOrConcat(base, toPush) {\r\n\tif (toPush) {\r\n\t\tif (helpers$1.isArray(toPush)) {\r\n\t\t\t// base = base.concat(toPush);\r\n\t\t\tArray.prototype.push.apply(base, toPush);\r\n\t\t} else {\r\n\t\t\tbase.push(toPush);\r\n\t\t}\r\n\t}\r\n\r\n\treturn base;\r\n}\r\n\r\n/**\r\n * Returns array of strings split by newline\r\n * @param {string} value - The value to split by newline.\r\n * @returns {string[]} value if newline present - Returned from String split() method\r\n * @function\r\n */\r\nfunction splitNewlines(str) {\r\n\tif ((typeof str === 'string' || str instanceof String) && str.indexOf('\\n') > -1) {\r\n\t\treturn str.split('\\n');\r\n\t}\r\n\treturn str;\r\n}\r\n\r\n\r\n/**\r\n * Private helper to create a tooltip item model\r\n * @param element - the chart element (point, arc, bar) to create the tooltip item for\r\n * @return new tooltip item\r\n */\r\nfunction createTooltipItem(element) {\r\n\tvar xScale = element._xScale;\r\n\tvar yScale = element._yScale || element._scale; // handle radar || polarArea charts\r\n\tvar index = element._index;\r\n\tvar datasetIndex = element._datasetIndex;\r\n\tvar controller = element._chart.getDatasetMeta(datasetIndex).controller;\r\n\tvar indexScale = controller._getIndexScale();\r\n\tvar valueScale = controller._getValueScale();\r\n\r\n\treturn {\r\n\t\txLabel: xScale ? xScale.getLabelForIndex(index, datasetIndex) : '',\r\n\t\tyLabel: yScale ? yScale.getLabelForIndex(index, datasetIndex) : '',\r\n\t\tlabel: indexScale ? '' + indexScale.getLabelForIndex(index, datasetIndex) : '',\r\n\t\tvalue: valueScale ? '' + valueScale.getLabelForIndex(index, datasetIndex) : '',\r\n\t\tindex: index,\r\n\t\tdatasetIndex: datasetIndex,\r\n\t\tx: element._model.x,\r\n\t\ty: element._model.y\r\n\t};\r\n}\r\n\r\n/**\r\n * Helper to get the reset model for the tooltip\r\n * @param tooltipOpts {object} the tooltip options\r\n */\r\nfunction getBaseModel(tooltipOpts) {\r\n\tvar globalDefaults = core_defaults.global;\r\n\r\n\treturn {\r\n\t\t// Positioning\r\n\t\txPadding: tooltipOpts.xPadding,\r\n\t\tyPadding: tooltipOpts.yPadding,\r\n\t\txAlign: tooltipOpts.xAlign,\r\n\t\tyAlign: tooltipOpts.yAlign,\r\n\r\n\t\t// Drawing direction and text direction\r\n\t\trtl: tooltipOpts.rtl,\r\n\t\ttextDirection: tooltipOpts.textDirection,\r\n\r\n\t\t// Body\r\n\t\tbodyFontColor: tooltipOpts.bodyFontColor,\r\n\t\t_bodyFontFamily: valueOrDefault$8(tooltipOpts.bodyFontFamily, globalDefaults.defaultFontFamily),\r\n\t\t_bodyFontStyle: valueOrDefault$8(tooltipOpts.bodyFontStyle, globalDefaults.defaultFontStyle),\r\n\t\t_bodyAlign: tooltipOpts.bodyAlign,\r\n\t\tbodyFontSize: valueOrDefault$8(tooltipOpts.bodyFontSize, globalDefaults.defaultFontSize),\r\n\t\tbodySpacing: tooltipOpts.bodySpacing,\r\n\r\n\t\t// Title\r\n\t\ttitleFontColor: tooltipOpts.titleFontColor,\r\n\t\t_titleFontFamily: valueOrDefault$8(tooltipOpts.titleFontFamily, globalDefaults.defaultFontFamily),\r\n\t\t_titleFontStyle: valueOrDefault$8(tooltipOpts.titleFontStyle, globalDefaults.defaultFontStyle),\r\n\t\ttitleFontSize: valueOrDefault$8(tooltipOpts.titleFontSize, globalDefaults.defaultFontSize),\r\n\t\t_titleAlign: tooltipOpts.titleAlign,\r\n\t\ttitleSpacing: tooltipOpts.titleSpacing,\r\n\t\ttitleMarginBottom: tooltipOpts.titleMarginBottom,\r\n\r\n\t\t// Footer\r\n\t\tfooterFontColor: tooltipOpts.footerFontColor,\r\n\t\t_footerFontFamily: valueOrDefault$8(tooltipOpts.footerFontFamily, globalDefaults.defaultFontFamily),\r\n\t\t_footerFontStyle: valueOrDefault$8(tooltipOpts.footerFontStyle, globalDefaults.defaultFontStyle),\r\n\t\tfooterFontSize: valueOrDefault$8(tooltipOpts.footerFontSize, globalDefaults.defaultFontSize),\r\n\t\t_footerAlign: tooltipOpts.footerAlign,\r\n\t\tfooterSpacing: tooltipOpts.footerSpacing,\r\n\t\tfooterMarginTop: tooltipOpts.footerMarginTop,\r\n\r\n\t\t// Appearance\r\n\t\tcaretSize: tooltipOpts.caretSize,\r\n\t\tcornerRadius: tooltipOpts.cornerRadius,\r\n\t\tbackgroundColor: tooltipOpts.backgroundColor,\r\n\t\topacity: 0,\r\n\t\tlegendColorBackground: tooltipOpts.multiKeyBackground,\r\n\t\tdisplayColors: tooltipOpts.displayColors,\r\n\t\tborderColor: tooltipOpts.borderColor,\r\n\t\tborderWidth: tooltipOpts.borderWidth\r\n\t};\r\n}\r\n\r\n/**\r\n * Get the size of the tooltip\r\n */\r\nfunction getTooltipSize(tooltip, model) {\r\n\tvar ctx = tooltip._chart.ctx;\r\n\r\n\tvar height = model.yPadding * 2; // Tooltip Padding\r\n\tvar width = 0;\r\n\r\n\t// Count of all lines in the body\r\n\tvar body = model.body;\r\n\tvar combinedBodyLength = body.reduce(function(count, bodyItem) {\r\n\t\treturn count + bodyItem.before.length + bodyItem.lines.length + bodyItem.after.length;\r\n\t}, 0);\r\n\tcombinedBodyLength += model.beforeBody.length + model.afterBody.length;\r\n\r\n\tvar titleLineCount = model.title.length;\r\n\tvar footerLineCount = model.footer.length;\r\n\tvar titleFontSize = model.titleFontSize;\r\n\tvar bodyFontSize = model.bodyFontSize;\r\n\tvar footerFontSize = model.footerFontSize;\r\n\r\n\theight += titleLineCount * titleFontSize; // Title Lines\r\n\theight += titleLineCount ? (titleLineCount - 1) * model.titleSpacing : 0; // Title Line Spacing\r\n\theight += titleLineCount ? model.titleMarginBottom : 0; // Title's bottom Margin\r\n\theight += combinedBodyLength * bodyFontSize; // Body Lines\r\n\theight += combinedBodyLength ? (combinedBodyLength - 1) * model.bodySpacing : 0; // Body Line Spacing\r\n\theight += footerLineCount ? model.footerMarginTop : 0; // Footer Margin\r\n\theight += footerLineCount * (footerFontSize); // Footer Lines\r\n\theight += footerLineCount ? (footerLineCount - 1) * model.footerSpacing : 0; // Footer Line Spacing\r\n\r\n\t// Title width\r\n\tvar widthPadding = 0;\r\n\tvar maxLineWidth = function(line) {\r\n\t\twidth = Math.max(width, ctx.measureText(line).width + widthPadding);\r\n\t};\r\n\r\n\tctx.font = helpers$1.fontString(titleFontSize, model._titleFontStyle, model._titleFontFamily);\r\n\thelpers$1.each(model.title, maxLineWidth);\r\n\r\n\t// Body width\r\n\tctx.font = helpers$1.fontString(bodyFontSize, model._bodyFontStyle, model._bodyFontFamily);\r\n\thelpers$1.each(model.beforeBody.concat(model.afterBody), maxLineWidth);\r\n\r\n\t// Body lines may include some extra width due to the color box\r\n\twidthPadding = model.displayColors ? (bodyFontSize + 2) : 0;\r\n\thelpers$1.each(body, function(bodyItem) {\r\n\t\thelpers$1.each(bodyItem.before, maxLineWidth);\r\n\t\thelpers$1.each(bodyItem.lines, maxLineWidth);\r\n\t\thelpers$1.each(bodyItem.after, maxLineWidth);\r\n\t});\r\n\r\n\t// Reset back to 0\r\n\twidthPadding = 0;\r\n\r\n\t// Footer width\r\n\tctx.font = helpers$1.fontString(footerFontSize, model._footerFontStyle, model._footerFontFamily);\r\n\thelpers$1.each(model.footer, maxLineWidth);\r\n\r\n\t// Add padding\r\n\twidth += 2 * model.xPadding;\r\n\r\n\treturn {\r\n\t\twidth: width,\r\n\t\theight: height\r\n\t};\r\n}\r\n\r\n/**\r\n * Helper to get the alignment of a tooltip given the size\r\n */\r\nfunction determineAlignment(tooltip, size) {\r\n\tvar model = tooltip._model;\r\n\tvar chart = tooltip._chart;\r\n\tvar chartArea = tooltip._chart.chartArea;\r\n\tvar xAlign = 'center';\r\n\tvar yAlign = 'center';\r\n\r\n\tif (model.y < size.height) {\r\n\t\tyAlign = 'top';\r\n\t} else if (model.y > (chart.height - size.height)) {\r\n\t\tyAlign = 'bottom';\r\n\t}\r\n\r\n\tvar lf, rf; // functions to determine left, right alignment\r\n\tvar olf, orf; // functions to determine if left/right alignment causes tooltip to go outside chart\r\n\tvar yf; // function to get the y alignment if the tooltip goes outside of the left or right edges\r\n\tvar midX = (chartArea.left + chartArea.right) / 2;\r\n\tvar midY = (chartArea.top + chartArea.bottom) / 2;\r\n\r\n\tif (yAlign === 'center') {\r\n\t\tlf = function(x) {\r\n\t\t\treturn x <= midX;\r\n\t\t};\r\n\t\trf = function(x) {\r\n\t\t\treturn x > midX;\r\n\t\t};\r\n\t} else {\r\n\t\tlf = function(x) {\r\n\t\t\treturn x <= (size.width / 2);\r\n\t\t};\r\n\t\trf = function(x) {\r\n\t\t\treturn x >= (chart.width - (size.width / 2));\r\n\t\t};\r\n\t}\r\n\r\n\tolf = function(x) {\r\n\t\treturn x + size.width + model.caretSize + model.caretPadding > chart.width;\r\n\t};\r\n\torf = function(x) {\r\n\t\treturn x - size.width - model.caretSize - model.caretPadding < 0;\r\n\t};\r\n\tyf = function(y) {\r\n\t\treturn y <= midY ? 'top' : 'bottom';\r\n\t};\r\n\r\n\tif (lf(model.x)) {\r\n\t\txAlign = 'left';\r\n\r\n\t\t// Is tooltip too wide and goes over the right side of the chart.?\r\n\t\tif (olf(model.x)) {\r\n\t\t\txAlign = 'center';\r\n\t\t\tyAlign = yf(model.y);\r\n\t\t}\r\n\t} else if (rf(model.x)) {\r\n\t\txAlign = 'right';\r\n\r\n\t\t// Is tooltip too wide and goes outside left edge of canvas?\r\n\t\tif (orf(model.x)) {\r\n\t\t\txAlign = 'center';\r\n\t\t\tyAlign = yf(model.y);\r\n\t\t}\r\n\t}\r\n\r\n\tvar opts = tooltip._options;\r\n\treturn {\r\n\t\txAlign: opts.xAlign ? opts.xAlign : xAlign,\r\n\t\tyAlign: opts.yAlign ? opts.yAlign : yAlign\r\n\t};\r\n}\r\n\r\n/**\r\n * Helper to get the location a tooltip needs to be placed at given the initial position (via the vm) and the size and alignment\r\n */\r\nfunction getBackgroundPoint(vm, size, alignment, chart) {\r\n\t// Background Position\r\n\tvar x = vm.x;\r\n\tvar y = vm.y;\r\n\r\n\tvar caretSize = vm.caretSize;\r\n\tvar caretPadding = vm.caretPadding;\r\n\tvar cornerRadius = vm.cornerRadius;\r\n\tvar xAlign = alignment.xAlign;\r\n\tvar yAlign = alignment.yAlign;\r\n\tvar paddingAndSize = caretSize + caretPadding;\r\n\tvar radiusAndPadding = cornerRadius + caretPadding;\r\n\r\n\tif (xAlign === 'right') {\r\n\t\tx -= size.width;\r\n\t} else if (xAlign === 'center') {\r\n\t\tx -= (size.width / 2);\r\n\t\tif (x + size.width > chart.width) {\r\n\t\t\tx = chart.width - size.width;\r\n\t\t}\r\n\t\tif (x < 0) {\r\n\t\t\tx = 0;\r\n\t\t}\r\n\t}\r\n\r\n\tif (yAlign === 'top') {\r\n\t\ty += paddingAndSize;\r\n\t} else if (yAlign === 'bottom') {\r\n\t\ty -= size.height + paddingAndSize;\r\n\t} else {\r\n\t\ty -= (size.height / 2);\r\n\t}\r\n\r\n\tif (yAlign === 'center') {\r\n\t\tif (xAlign === 'left') {\r\n\t\t\tx += paddingAndSize;\r\n\t\t} else if (xAlign === 'right') {\r\n\t\t\tx -= paddingAndSize;\r\n\t\t}\r\n\t} else if (xAlign === 'left') {\r\n\t\tx -= radiusAndPadding;\r\n\t} else if (xAlign === 'right') {\r\n\t\tx += radiusAndPadding;\r\n\t}\r\n\r\n\treturn {\r\n\t\tx: x,\r\n\t\ty: y\r\n\t};\r\n}\r\n\r\nfunction getAlignedX(vm, align) {\r\n\treturn align === 'center'\r\n\t\t? vm.x + vm.width / 2\r\n\t\t: align === 'right'\r\n\t\t\t? vm.x + vm.width - vm.xPadding\r\n\t\t\t: vm.x + vm.xPadding;\r\n}\r\n\r\n/**\r\n * Helper to build before and after body lines\r\n */\r\nfunction getBeforeAfterBodyLines(callback) {\r\n\treturn pushOrConcat([], splitNewlines(callback));\r\n}\r\n\r\nvar exports$4 = core_element.extend({\r\n\tinitialize: function() {\r\n\t\tthis._model = getBaseModel(this._options);\r\n\t\tthis._lastActive = [];\r\n\t},\r\n\r\n\t// Get the title\r\n\t// Args are: (tooltipItem, data)\r\n\tgetTitle: function() {\r\n\t\tvar me = this;\r\n\t\tvar opts = me._options;\r\n\t\tvar callbacks = opts.callbacks;\r\n\r\n\t\tvar beforeTitle = callbacks.beforeTitle.apply(me, arguments);\r\n\t\tvar title = callbacks.title.apply(me, arguments);\r\n\t\tvar afterTitle = callbacks.afterTitle.apply(me, arguments);\r\n\r\n\t\tvar lines = [];\r\n\t\tlines = pushOrConcat(lines, splitNewlines(beforeTitle));\r\n\t\tlines = pushOrConcat(lines, splitNewlines(title));\r\n\t\tlines = pushOrConcat(lines, splitNewlines(afterTitle));\r\n\r\n\t\treturn lines;\r\n\t},\r\n\r\n\t// Args are: (tooltipItem, data)\r\n\tgetBeforeBody: function() {\r\n\t\treturn getBeforeAfterBodyLines(this._options.callbacks.beforeBody.apply(this, arguments));\r\n\t},\r\n\r\n\t// Args are: (tooltipItem, data)\r\n\tgetBody: function(tooltipItems, data) {\r\n\t\tvar me = this;\r\n\t\tvar callbacks = me._options.callbacks;\r\n\t\tvar bodyItems = [];\r\n\r\n\t\thelpers$1.each(tooltipItems, function(tooltipItem) {\r\n\t\t\tvar bodyItem = {\r\n\t\t\t\tbefore: [],\r\n\t\t\t\tlines: [],\r\n\t\t\t\tafter: []\r\n\t\t\t};\r\n\t\t\tpushOrConcat(bodyItem.before, splitNewlines(callbacks.beforeLabel.call(me, tooltipItem, data)));\r\n\t\t\tpushOrConcat(bodyItem.lines, callbacks.label.call(me, tooltipItem, data));\r\n\t\t\tpushOrConcat(bodyItem.after, splitNewlines(callbacks.afterLabel.call(me, tooltipItem, data)));\r\n\r\n\t\t\tbodyItems.push(bodyItem);\r\n\t\t});\r\n\r\n\t\treturn bodyItems;\r\n\t},\r\n\r\n\t// Args are: (tooltipItem, data)\r\n\tgetAfterBody: function() {\r\n\t\treturn getBeforeAfterBodyLines(this._options.callbacks.afterBody.apply(this, arguments));\r\n\t},\r\n\r\n\t// Get the footer and beforeFooter and afterFooter lines\r\n\t// Args are: (tooltipItem, data)\r\n\tgetFooter: function() {\r\n\t\tvar me = this;\r\n\t\tvar callbacks = me._options.callbacks;\r\n\r\n\t\tvar beforeFooter = callbacks.beforeFooter.apply(me, arguments);\r\n\t\tvar footer = callbacks.footer.apply(me, arguments);\r\n\t\tvar afterFooter = callbacks.afterFooter.apply(me, arguments);\r\n\r\n\t\tvar lines = [];\r\n\t\tlines = pushOrConcat(lines, splitNewlines(beforeFooter));\r\n\t\tlines = pushOrConcat(lines, splitNewlines(footer));\r\n\t\tlines = pushOrConcat(lines, splitNewlines(afterFooter));\r\n\r\n\t\treturn lines;\r\n\t},\r\n\r\n\tupdate: function(changed) {\r\n\t\tvar me = this;\r\n\t\tvar opts = me._options;\r\n\r\n\t\t// Need to regenerate the model because its faster than using extend and it is necessary due to the optimization in Chart.Element.transition\r\n\t\t// that does _view = _model if ease === 1. This causes the 2nd tooltip update to set properties in both the view and model at the same time\r\n\t\t// which breaks any animations.\r\n\t\tvar existingModel = me._model;\r\n\t\tvar model = me._model = getBaseModel(opts);\r\n\t\tvar active = me._active;\r\n\r\n\t\tvar data = me._data;\r\n\r\n\t\t// In the case where active.length === 0 we need to keep these at existing values for good animations\r\n\t\tvar alignment = {\r\n\t\t\txAlign: existingModel.xAlign,\r\n\t\t\tyAlign: existingModel.yAlign\r\n\t\t};\r\n\t\tvar backgroundPoint = {\r\n\t\t\tx: existingModel.x,\r\n\t\t\ty: existingModel.y\r\n\t\t};\r\n\t\tvar tooltipSize = {\r\n\t\t\twidth: existingModel.width,\r\n\t\t\theight: existingModel.height\r\n\t\t};\r\n\t\tvar tooltipPosition = {\r\n\t\t\tx: existingModel.caretX,\r\n\t\t\ty: existingModel.caretY\r\n\t\t};\r\n\r\n\t\tvar i, len;\r\n\r\n\t\tif (active.length) {\r\n\t\t\tmodel.opacity = 1;\r\n\r\n\t\t\tvar labelColors = [];\r\n\t\t\tvar labelTextColors = [];\r\n\t\t\ttooltipPosition = positioners[opts.position].call(me, active, me._eventPosition);\r\n\r\n\t\t\tvar tooltipItems = [];\r\n\t\t\tfor (i = 0, len = active.length; i < len; ++i) {\r\n\t\t\t\ttooltipItems.push(createTooltipItem(active[i]));\r\n\t\t\t}\r\n\r\n\t\t\t// If the user provided a filter function, use it to modify the tooltip items\r\n\t\t\tif (opts.filter) {\r\n\t\t\t\ttooltipItems = tooltipItems.filter(function(a) {\r\n\t\t\t\t\treturn opts.filter(a, data);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\t// If the user provided a sorting function, use it to modify the tooltip items\r\n\t\t\tif (opts.itemSort) {\r\n\t\t\t\ttooltipItems = tooltipItems.sort(function(a, b) {\r\n\t\t\t\t\treturn opts.itemSort(a, b, data);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\t// Determine colors for boxes\r\n\t\t\thelpers$1.each(tooltipItems, function(tooltipItem) {\r\n\t\t\t\tlabelColors.push(opts.callbacks.labelColor.call(me, tooltipItem, me._chart));\r\n\t\t\t\tlabelTextColors.push(opts.callbacks.labelTextColor.call(me, tooltipItem, me._chart));\r\n\t\t\t});\r\n\r\n\r\n\t\t\t// Build the Text Lines\r\n\t\t\tmodel.title = me.getTitle(tooltipItems, data);\r\n\t\t\tmodel.beforeBody = me.getBeforeBody(tooltipItems, data);\r\n\t\t\tmodel.body = me.getBody(tooltipItems, data);\r\n\t\t\tmodel.afterBody = me.getAfterBody(tooltipItems, data);\r\n\t\t\tmodel.footer = me.getFooter(tooltipItems, data);\r\n\r\n\t\t\t// Initial positioning and colors\r\n\t\t\tmodel.x = tooltipPosition.x;\r\n\t\t\tmodel.y = tooltipPosition.y;\r\n\t\t\tmodel.caretPadding = opts.caretPadding;\r\n\t\t\tmodel.labelColors = labelColors;\r\n\t\t\tmodel.labelTextColors = labelTextColors;\r\n\r\n\t\t\t// data points\r\n\t\t\tmodel.dataPoints = tooltipItems;\r\n\r\n\t\t\t// We need to determine alignment of the tooltip\r\n\t\t\ttooltipSize = getTooltipSize(this, model);\r\n\t\t\talignment = determineAlignment(this, tooltipSize);\r\n\t\t\t// Final Size and Position\r\n\t\t\tbackgroundPoint = getBackgroundPoint(model, tooltipSize, alignment, me._chart);\r\n\t\t} else {\r\n\t\t\tmodel.opacity = 0;\r\n\t\t}\r\n\r\n\t\tmodel.xAlign = alignment.xAlign;\r\n\t\tmodel.yAlign = alignment.yAlign;\r\n\t\tmodel.x = backgroundPoint.x;\r\n\t\tmodel.y = backgroundPoint.y;\r\n\t\tmodel.width = tooltipSize.width;\r\n\t\tmodel.height = tooltipSize.height;\r\n\r\n\t\t// Point where the caret on the tooltip points to\r\n\t\tmodel.caretX = tooltipPosition.x;\r\n\t\tmodel.caretY = tooltipPosition.y;\r\n\r\n\t\tme._model = model;\r\n\r\n\t\tif (changed && opts.custom) {\r\n\t\t\topts.custom.call(me, model);\r\n\t\t}\r\n\r\n\t\treturn me;\r\n\t},\r\n\r\n\tdrawCaret: function(tooltipPoint, size) {\r\n\t\tvar ctx = this._chart.ctx;\r\n\t\tvar vm = this._view;\r\n\t\tvar caretPosition = this.getCaretPosition(tooltipPoint, size, vm);\r\n\r\n\t\tctx.lineTo(caretPosition.x1, caretPosition.y1);\r\n\t\tctx.lineTo(caretPosition.x2, caretPosition.y2);\r\n\t\tctx.lineTo(caretPosition.x3, caretPosition.y3);\r\n\t},\r\n\tgetCaretPosition: function(tooltipPoint, size, vm) {\r\n\t\tvar x1, x2, x3, y1, y2, y3;\r\n\t\tvar caretSize = vm.caretSize;\r\n\t\tvar cornerRadius = vm.cornerRadius;\r\n\t\tvar xAlign = vm.xAlign;\r\n\t\tvar yAlign = vm.yAlign;\r\n\t\tvar ptX = tooltipPoint.x;\r\n\t\tvar ptY = tooltipPoint.y;\r\n\t\tvar width = size.width;\r\n\t\tvar height = size.height;\r\n\r\n\t\tif (yAlign === 'center') {\r\n\t\t\ty2 = ptY + (height / 2);\r\n\r\n\t\t\tif (xAlign === 'left') {\r\n\t\t\t\tx1 = ptX;\r\n\t\t\t\tx2 = x1 - caretSize;\r\n\t\t\t\tx3 = x1;\r\n\r\n\t\t\t\ty1 = y2 + caretSize;\r\n\t\t\t\ty3 = y2 - caretSize;\r\n\t\t\t} else {\r\n\t\t\t\tx1 = ptX + width;\r\n\t\t\t\tx2 = x1 + caretSize;\r\n\t\t\t\tx3 = x1;\r\n\r\n\t\t\t\ty1 = y2 - caretSize;\r\n\t\t\t\ty3 = y2 + caretSize;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (xAlign === 'left') {\r\n\t\t\t\tx2 = ptX + cornerRadius + (caretSize);\r\n\t\t\t\tx1 = x2 - caretSize;\r\n\t\t\t\tx3 = x2 + caretSize;\r\n\t\t\t} else if (xAlign === 'right') {\r\n\t\t\t\tx2 = ptX + width - cornerRadius - caretSize;\r\n\t\t\t\tx1 = x2 - caretSize;\r\n\t\t\t\tx3 = x2 + caretSize;\r\n\t\t\t} else {\r\n\t\t\t\tx2 = vm.caretX;\r\n\t\t\t\tx1 = x2 - caretSize;\r\n\t\t\t\tx3 = x2 + caretSize;\r\n\t\t\t}\r\n\t\t\tif (yAlign === 'top') {\r\n\t\t\t\ty1 = ptY;\r\n\t\t\t\ty2 = y1 - caretSize;\r\n\t\t\t\ty3 = y1;\r\n\t\t\t} else {\r\n\t\t\t\ty1 = ptY + height;\r\n\t\t\t\ty2 = y1 + caretSize;\r\n\t\t\t\ty3 = y1;\r\n\t\t\t\t// invert drawing order\r\n\t\t\t\tvar tmp = x3;\r\n\t\t\t\tx3 = x1;\r\n\t\t\t\tx1 = tmp;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn {x1: x1, x2: x2, x3: x3, y1: y1, y2: y2, y3: y3};\r\n\t},\r\n\r\n\tdrawTitle: function(pt, vm, ctx) {\r\n\t\tvar title = vm.title;\r\n\t\tvar length = title.length;\r\n\t\tvar titleFontSize, titleSpacing, i;\r\n\r\n\t\tif (length) {\r\n\t\t\tvar rtlHelper = getRtlHelper(vm.rtl, vm.x, vm.width);\r\n\r\n\t\t\tpt.x = getAlignedX(vm, vm._titleAlign);\r\n\r\n\t\t\tctx.textAlign = rtlHelper.textAlign(vm._titleAlign);\r\n\t\t\tctx.textBaseline = 'middle';\r\n\r\n\t\t\ttitleFontSize = vm.titleFontSize;\r\n\t\t\ttitleSpacing = vm.titleSpacing;\r\n\r\n\t\t\tctx.fillStyle = vm.titleFontColor;\r\n\t\t\tctx.font = helpers$1.fontString(titleFontSize, vm._titleFontStyle, vm._titleFontFamily);\r\n\r\n\t\t\tfor (i = 0; i < length; ++i) {\r\n\t\t\t\tctx.fillText(title[i], rtlHelper.x(pt.x), pt.y + titleFontSize / 2);\r\n\t\t\t\tpt.y += titleFontSize + titleSpacing; // Line Height and spacing\r\n\r\n\t\t\t\tif (i + 1 === length) {\r\n\t\t\t\t\tpt.y += vm.titleMarginBottom - titleSpacing; // If Last, add margin, remove spacing\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tdrawBody: function(pt, vm, ctx) {\r\n\t\tvar bodyFontSize = vm.bodyFontSize;\r\n\t\tvar bodySpacing = vm.bodySpacing;\r\n\t\tvar bodyAlign = vm._bodyAlign;\r\n\t\tvar body = vm.body;\r\n\t\tvar drawColorBoxes = vm.displayColors;\r\n\t\tvar xLinePadding = 0;\r\n\t\tvar colorX = drawColorBoxes ? getAlignedX(vm, 'left') : 0;\r\n\r\n\t\tvar rtlHelper = getRtlHelper(vm.rtl, vm.x, vm.width);\r\n\r\n\t\tvar fillLineOfText = function(line) {\r\n\t\t\tctx.fillText(line, rtlHelper.x(pt.x + xLinePadding), pt.y + bodyFontSize / 2);\r\n\t\t\tpt.y += bodyFontSize + bodySpacing;\r\n\t\t};\r\n\r\n\t\tvar bodyItem, textColor, labelColors, lines, i, j, ilen, jlen;\r\n\t\tvar bodyAlignForCalculation = rtlHelper.textAlign(bodyAlign);\r\n\r\n\t\tctx.textAlign = bodyAlign;\r\n\t\tctx.textBaseline = 'middle';\r\n\t\tctx.font = helpers$1.fontString(bodyFontSize, vm._bodyFontStyle, vm._bodyFontFamily);\r\n\r\n\t\tpt.x = getAlignedX(vm, bodyAlignForCalculation);\r\n\r\n\t\t// Before body lines\r\n\t\tctx.fillStyle = vm.bodyFontColor;\r\n\t\thelpers$1.each(vm.beforeBody, fillLineOfText);\r\n\r\n\t\txLinePadding = drawColorBoxes && bodyAlignForCalculation !== 'right'\r\n\t\t\t? bodyAlign === 'center' ? (bodyFontSize / 2 + 1) : (bodyFontSize + 2)\r\n\t\t\t: 0;\r\n\r\n\t\t// Draw body lines now\r\n\t\tfor (i = 0, ilen = body.length; i < ilen; ++i) {\r\n\t\t\tbodyItem = body[i];\r\n\t\t\ttextColor = vm.labelTextColors[i];\r\n\t\t\tlabelColors = vm.labelColors[i];\r\n\r\n\t\t\tctx.fillStyle = textColor;\r\n\t\t\thelpers$1.each(bodyItem.before, fillLineOfText);\r\n\r\n\t\t\tlines = bodyItem.lines;\r\n\t\t\tfor (j = 0, jlen = lines.length; j < jlen; ++j) {\r\n\t\t\t\t// Draw Legend-like boxes if needed\r\n\t\t\t\tif (drawColorBoxes) {\r\n\t\t\t\t\tvar rtlColorX = rtlHelper.x(colorX);\r\n\r\n\t\t\t\t\t// Fill a white rect so that colours merge nicely if the opacity is < 1\r\n\t\t\t\t\tctx.fillStyle = vm.legendColorBackground;\r\n\t\t\t\t\tctx.fillRect(rtlHelper.leftForLtr(rtlColorX, bodyFontSize), pt.y, bodyFontSize, bodyFontSize);\r\n\r\n\t\t\t\t\t// Border\r\n\t\t\t\t\tctx.lineWidth = 1;\r\n\t\t\t\t\tctx.strokeStyle = labelColors.borderColor;\r\n\t\t\t\t\tctx.strokeRect(rtlHelper.leftForLtr(rtlColorX, bodyFontSize), pt.y, bodyFontSize, bodyFontSize);\r\n\r\n\t\t\t\t\t// Inner square\r\n\t\t\t\t\tctx.fillStyle = labelColors.backgroundColor;\r\n\t\t\t\t\tctx.fillRect(rtlHelper.leftForLtr(rtlHelper.xPlus(rtlColorX, 1), bodyFontSize - 2), pt.y + 1, bodyFontSize - 2, bodyFontSize - 2);\r\n\t\t\t\t\tctx.fillStyle = textColor;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfillLineOfText(lines[j]);\r\n\t\t\t}\r\n\r\n\t\t\thelpers$1.each(bodyItem.after, fillLineOfText);\r\n\t\t}\r\n\r\n\t\t// Reset back to 0 for after body\r\n\t\txLinePadding = 0;\r\n\r\n\t\t// After body lines\r\n\t\thelpers$1.each(vm.afterBody, fillLineOfText);\r\n\t\tpt.y -= bodySpacing; // Remove last body spacing\r\n\t},\r\n\r\n\tdrawFooter: function(pt, vm, ctx) {\r\n\t\tvar footer = vm.footer;\r\n\t\tvar length = footer.length;\r\n\t\tvar footerFontSize, i;\r\n\r\n\t\tif (length) {\r\n\t\t\tvar rtlHelper = getRtlHelper(vm.rtl, vm.x, vm.width);\r\n\r\n\t\t\tpt.x = getAlignedX(vm, vm._footerAlign);\r\n\t\t\tpt.y += vm.footerMarginTop;\r\n\r\n\t\t\tctx.textAlign = rtlHelper.textAlign(vm._footerAlign);\r\n\t\t\tctx.textBaseline = 'middle';\r\n\r\n\t\t\tfooterFontSize = vm.footerFontSize;\r\n\r\n\t\t\tctx.fillStyle = vm.footerFontColor;\r\n\t\t\tctx.font = helpers$1.fontString(footerFontSize, vm._footerFontStyle, vm._footerFontFamily);\r\n\r\n\t\t\tfor (i = 0; i < length; ++i) {\r\n\t\t\t\tctx.fillText(footer[i], rtlHelper.x(pt.x), pt.y + footerFontSize / 2);\r\n\t\t\t\tpt.y += footerFontSize + vm.footerSpacing;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tdrawBackground: function(pt, vm, ctx, tooltipSize) {\r\n\t\tctx.fillStyle = vm.backgroundColor;\r\n\t\tctx.strokeStyle = vm.borderColor;\r\n\t\tctx.lineWidth = vm.borderWidth;\r\n\t\tvar xAlign = vm.xAlign;\r\n\t\tvar yAlign = vm.yAlign;\r\n\t\tvar x = pt.x;\r\n\t\tvar y = pt.y;\r\n\t\tvar width = tooltipSize.width;\r\n\t\tvar height = tooltipSize.height;\r\n\t\tvar radius = vm.cornerRadius;\r\n\r\n\t\tctx.beginPath();\r\n\t\tctx.moveTo(x + radius, y);\r\n\t\tif (yAlign === 'top') {\r\n\t\t\tthis.drawCaret(pt, tooltipSize);\r\n\t\t}\r\n\t\tctx.lineTo(x + width - radius, y);\r\n\t\tctx.quadraticCurveTo(x + width, y, x + width, y + radius);\r\n\t\tif (yAlign === 'center' && xAlign === 'right') {\r\n\t\t\tthis.drawCaret(pt, tooltipSize);\r\n\t\t}\r\n\t\tctx.lineTo(x + width, y + height - radius);\r\n\t\tctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);\r\n\t\tif (yAlign === 'bottom') {\r\n\t\t\tthis.drawCaret(pt, tooltipSize);\r\n\t\t}\r\n\t\tctx.lineTo(x + radius, y + height);\r\n\t\tctx.quadraticCurveTo(x, y + height, x, y + height - radius);\r\n\t\tif (yAlign === 'center' && xAlign === 'left') {\r\n\t\t\tthis.drawCaret(pt, tooltipSize);\r\n\t\t}\r\n\t\tctx.lineTo(x, y + radius);\r\n\t\tctx.quadraticCurveTo(x, y, x + radius, y);\r\n\t\tctx.closePath();\r\n\r\n\t\tctx.fill();\r\n\r\n\t\tif (vm.borderWidth > 0) {\r\n\t\t\tctx.stroke();\r\n\t\t}\r\n\t},\r\n\r\n\tdraw: function() {\r\n\t\tvar ctx = this._chart.ctx;\r\n\t\tvar vm = this._view;\r\n\r\n\t\tif (vm.opacity === 0) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tvar tooltipSize = {\r\n\t\t\twidth: vm.width,\r\n\t\t\theight: vm.height\r\n\t\t};\r\n\t\tvar pt = {\r\n\t\t\tx: vm.x,\r\n\t\t\ty: vm.y\r\n\t\t};\r\n\r\n\t\t// IE11/Edge does not like very small opacities, so snap to 0\r\n\t\tvar opacity = Math.abs(vm.opacity < 1e-3) ? 0 : vm.opacity;\r\n\r\n\t\t// Truthy/falsey value for empty tooltip\r\n\t\tvar hasTooltipContent = vm.title.length || vm.beforeBody.length || vm.body.length || vm.afterBody.length || vm.footer.length;\r\n\r\n\t\tif (this._options.enabled && hasTooltipContent) {\r\n\t\t\tctx.save();\r\n\t\t\tctx.globalAlpha = opacity;\r\n\r\n\t\t\t// Draw Background\r\n\t\t\tthis.drawBackground(pt, vm, ctx, tooltipSize);\r\n\r\n\t\t\t// Draw Title, Body, and Footer\r\n\t\t\tpt.y += vm.yPadding;\r\n\r\n\t\t\thelpers$1.rtl.overrideTextDirection(ctx, vm.textDirection);\r\n\r\n\t\t\t// Titles\r\n\t\t\tthis.drawTitle(pt, vm, ctx);\r\n\r\n\t\t\t// Body\r\n\t\t\tthis.drawBody(pt, vm, ctx);\r\n\r\n\t\t\t// Footer\r\n\t\t\tthis.drawFooter(pt, vm, ctx);\r\n\r\n\t\t\thelpers$1.rtl.restoreTextDirection(ctx, vm.textDirection);\r\n\r\n\t\t\tctx.restore();\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Handle an event\r\n\t * @private\r\n\t * @param {IEvent} event - The event to handle\r\n\t * @returns {boolean} true if the tooltip changed\r\n\t */\r\n\thandleEvent: function(e) {\r\n\t\tvar me = this;\r\n\t\tvar options = me._options;\r\n\t\tvar changed = false;\r\n\r\n\t\tme._lastActive = me._lastActive || [];\r\n\r\n\t\t// Find Active Elements for tooltips\r\n\t\tif (e.type === 'mouseout') {\r\n\t\t\tme._active = [];\r\n\t\t} else {\r\n\t\t\tme._active = me._chart.getElementsAtEventForMode(e, options.mode, options);\r\n\t\t\tif (options.reverse) {\r\n\t\t\t\tme._active.reverse();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Remember Last Actives\r\n\t\tchanged = !helpers$1.arrayEquals(me._active, me._lastActive);\r\n\r\n\t\t// Only handle target event on tooltip change\r\n\t\tif (changed) {\r\n\t\t\tme._lastActive = me._active;\r\n\r\n\t\t\tif (options.enabled || options.custom) {\r\n\t\t\t\tme._eventPosition = {\r\n\t\t\t\t\tx: e.x,\r\n\t\t\t\t\ty: e.y\r\n\t\t\t\t};\r\n\r\n\t\t\t\tme.update(true);\r\n\t\t\t\tme.pivot();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn changed;\r\n\t}\r\n});\r\n\r\n/**\r\n * @namespace Chart.Tooltip.positioners\r\n */\r\nvar positioners_1 = positioners;\r\n\r\nvar core_tooltip = exports$4;\ncore_tooltip.positioners = positioners_1;\n\nvar valueOrDefault$9 = helpers$1.valueOrDefault;\r\n\r\ncore_defaults._set('global', {\r\n\telements: {},\r\n\tevents: [\r\n\t\t'mousemove',\r\n\t\t'mouseout',\r\n\t\t'click',\r\n\t\t'touchstart',\r\n\t\t'touchmove'\r\n\t],\r\n\thover: {\r\n\t\tonHover: null,\r\n\t\tmode: 'nearest',\r\n\t\tintersect: true,\r\n\t\tanimationDuration: 400\r\n\t},\r\n\tonClick: null,\r\n\tmaintainAspectRatio: true,\r\n\tresponsive: true,\r\n\tresponsiveAnimationDuration: 0\r\n});\r\n\r\n/**\r\n * Recursively merge the given config objects representing the `scales` option\r\n * by incorporating scale defaults in `xAxes` and `yAxes` array items, then\r\n * returns a deep copy of the result, thus doesn't alter inputs.\r\n */\r\nfunction mergeScaleConfig(/* config objects ... */) {\r\n\treturn helpers$1.merge(Object.create(null), [].slice.call(arguments), {\r\n\t\tmerger: function(key, target, source, options) {\r\n\t\t\tif (key === 'xAxes' || key === 'yAxes') {\r\n\t\t\t\tvar slen = source[key].length;\r\n\t\t\t\tvar i, type, scale;\r\n\r\n\t\t\t\tif (!target[key]) {\r\n\t\t\t\t\ttarget[key] = [];\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor (i = 0; i < slen; ++i) {\r\n\t\t\t\t\tscale = source[key][i];\r\n\t\t\t\t\ttype = valueOrDefault$9(scale.type, key === 'xAxes' ? 'category' : 'linear');\r\n\r\n\t\t\t\t\tif (i >= target[key].length) {\r\n\t\t\t\t\t\ttarget[key].push({});\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (!target[key][i].type || (scale.type && scale.type !== target[key][i].type)) {\r\n\t\t\t\t\t\t// new/untyped scale or type changed: let's apply the new defaults\r\n\t\t\t\t\t\t// then merge source scale to correctly overwrite the defaults.\r\n\t\t\t\t\t\thelpers$1.merge(target[key][i], [core_scaleService.getScaleDefaults(type), scale]);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// scales type are the same\r\n\t\t\t\t\t\thelpers$1.merge(target[key][i], scale);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\thelpers$1._merger(key, target, source, options);\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n}\r\n\r\n/**\r\n * Recursively merge the given config objects as the root options by handling\r\n * default scale options for the `scales` and `scale` properties, then returns\r\n * a deep copy of the result, thus doesn't alter inputs.\r\n */\r\nfunction mergeConfig(/* config objects ... */) {\r\n\treturn helpers$1.merge(Object.create(null), [].slice.call(arguments), {\r\n\t\tmerger: function(key, target, source, options) {\r\n\t\t\tvar tval = target[key] || Object.create(null);\r\n\t\t\tvar sval = source[key];\r\n\r\n\t\t\tif (key === 'scales') {\r\n\t\t\t\t// scale config merging is complex. Add our own function here for that\r\n\t\t\t\ttarget[key] = mergeScaleConfig(tval, sval);\r\n\t\t\t} else if (key === 'scale') {\r\n\t\t\t\t// used in polar area & radar charts since there is only one scale\r\n\t\t\t\ttarget[key] = helpers$1.merge(tval, [core_scaleService.getScaleDefaults(sval.type), sval]);\r\n\t\t\t} else {\r\n\t\t\t\thelpers$1._merger(key, target, source, options);\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n}\r\n\r\nfunction initConfig(config) {\r\n\tconfig = config || Object.create(null);\r\n\r\n\t// Do NOT use mergeConfig for the data object because this method merges arrays\r\n\t// and so would change references to labels and datasets, preventing data updates.\r\n\tvar data = config.data = config.data || {};\r\n\tdata.datasets = data.datasets || [];\r\n\tdata.labels = data.labels || [];\r\n\r\n\tconfig.options = mergeConfig(\r\n\t\tcore_defaults.global,\r\n\t\tcore_defaults[config.type],\r\n\t\tconfig.options || {});\r\n\r\n\treturn config;\r\n}\r\n\r\nfunction updateConfig(chart) {\r\n\tvar newOptions = chart.options;\r\n\r\n\thelpers$1.each(chart.scales, function(scale) {\r\n\t\tcore_layouts.removeBox(chart, scale);\r\n\t});\r\n\r\n\tnewOptions = mergeConfig(\r\n\t\tcore_defaults.global,\r\n\t\tcore_defaults[chart.config.type],\r\n\t\tnewOptions);\r\n\r\n\tchart.options = chart.config.options = newOptions;\r\n\tchart.ensureScalesHaveIDs();\r\n\tchart.buildOrUpdateScales();\r\n\r\n\t// Tooltip\r\n\tchart.tooltip._options = newOptions.tooltips;\r\n\tchart.tooltip.initialize();\r\n}\r\n\r\nfunction nextAvailableScaleId(axesOpts, prefix, index) {\r\n\tvar id;\r\n\tvar hasId = function(obj) {\r\n\t\treturn obj.id === id;\r\n\t};\r\n\r\n\tdo {\r\n\t\tid = prefix + index++;\r\n\t} while (helpers$1.findIndex(axesOpts, hasId) >= 0);\r\n\r\n\treturn id;\r\n}\r\n\r\nfunction positionIsHorizontal(position) {\r\n\treturn position === 'top' || position === 'bottom';\r\n}\r\n\r\nfunction compare2Level(l1, l2) {\r\n\treturn function(a, b) {\r\n\t\treturn a[l1] === b[l1]\r\n\t\t\t? a[l2] - b[l2]\r\n\t\t\t: a[l1] - b[l1];\r\n\t};\r\n}\r\n\r\nvar Chart = function(item, config) {\r\n\tthis.construct(item, config);\r\n\treturn this;\r\n};\r\n\r\nhelpers$1.extend(Chart.prototype, /** @lends Chart */ {\r\n\t/**\r\n\t * @private\r\n\t */\r\n\tconstruct: function(item, config) {\r\n\t\tvar me = this;\r\n\r\n\t\tconfig = initConfig(config);\r\n\r\n\t\tvar context = platform.acquireContext(item, config);\r\n\t\tvar canvas = context && context.canvas;\r\n\t\tvar height = canvas && canvas.height;\r\n\t\tvar width = canvas && canvas.width;\r\n\r\n\t\tme.id = helpers$1.uid();\r\n\t\tme.ctx = context;\r\n\t\tme.canvas = canvas;\r\n\t\tme.config = config;\r\n\t\tme.width = width;\r\n\t\tme.height = height;\r\n\t\tme.aspectRatio = height ? width / height : null;\r\n\t\tme.options = config.options;\r\n\t\tme._bufferedRender = false;\r\n\t\tme._layers = [];\r\n\r\n\t\t/**\r\n\t\t * Provided for backward compatibility, Chart and Chart.Controller have been merged,\r\n\t\t * the \"instance\" still need to be defined since it might be called from plugins.\r\n\t\t * @prop Chart#chart\r\n\t\t * @deprecated since version 2.6.0\r\n\t\t * @todo remove at version 3\r\n\t\t * @private\r\n\t\t */\r\n\t\tme.chart = me;\r\n\t\tme.controller = me; // chart.chart.controller #inception\r\n\r\n\t\t// Add the chart instance to the global namespace\r\n\t\tChart.instances[me.id] = me;\r\n\r\n\t\t// Define alias to the config data: `chart.data === chart.config.data`\r\n\t\tObject.defineProperty(me, 'data', {\r\n\t\t\tget: function() {\r\n\t\t\t\treturn me.config.data;\r\n\t\t\t},\r\n\t\t\tset: function(value) {\r\n\t\t\t\tme.config.data = value;\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tif (!context || !canvas) {\r\n\t\t\t// The given item is not a compatible context2d element, let's return before finalizing\r\n\t\t\t// the chart initialization but after setting basic chart / controller properties that\r\n\t\t\t// can help to figure out that the chart is not valid (e.g chart.canvas !== null);\r\n\t\t\t// https://github.com/chartjs/Chart.js/issues/2807\r\n\t\t\tconsole.error(\"Failed to create chart: can't acquire context from the given item\");\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tme.initialize();\r\n\t\tme.update();\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\tinitialize: function() {\r\n\t\tvar me = this;\r\n\r\n\t\t// Before init plugin notification\r\n\t\tcore_plugins.notify(me, 'beforeInit');\r\n\r\n\t\thelpers$1.retinaScale(me, me.options.devicePixelRatio);\r\n\r\n\t\tme.bindEvents();\r\n\r\n\t\tif (me.options.responsive) {\r\n\t\t\t// Initial resize before chart draws (must be silent to preserve initial animations).\r\n\t\t\tme.resize(true);\r\n\t\t}\r\n\r\n\t\tme.initToolTip();\r\n\r\n\t\t// After init plugin notification\r\n\t\tcore_plugins.notify(me, 'afterInit');\r\n\r\n\t\treturn me;\r\n\t},\r\n\r\n\tclear: function() {\r\n\t\thelpers$1.canvas.clear(this);\r\n\t\treturn this;\r\n\t},\r\n\r\n\tstop: function() {\r\n\t\t// Stops any current animation loop occurring\r\n\t\tcore_animations.cancelAnimation(this);\r\n\t\treturn this;\r\n\t},\r\n\r\n\tresize: function(silent) {\r\n\t\tvar me = this;\r\n\t\tvar options = me.options;\r\n\t\tvar canvas = me.canvas;\r\n\t\tvar aspectRatio = (options.maintainAspectRatio && me.aspectRatio) || null;\r\n\r\n\t\t// the canvas render width and height will be casted to integers so make sure that\r\n\t\t// the canvas display style uses the same integer values to avoid blurring effect.\r\n\r\n\t\t// Set to 0 instead of canvas.size because the size defaults to 300x150 if the element is collapsed\r\n\t\tvar newWidth = Math.max(0, Math.floor(helpers$1.getMaximumWidth(canvas)));\r\n\t\tvar newHeight = Math.max(0, Math.floor(aspectRatio ? newWidth / aspectRatio : helpers$1.getMaximumHeight(canvas)));\r\n\r\n\t\tif (me.width === newWidth && me.height === newHeight) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tcanvas.width = me.width = newWidth;\r\n\t\tcanvas.height = me.height = newHeight;\r\n\t\tcanvas.style.width = newWidth + 'px';\r\n\t\tcanvas.style.height = newHeight + 'px';\r\n\r\n\t\thelpers$1.retinaScale(me, options.devicePixelRatio);\r\n\r\n\t\tif (!silent) {\r\n\t\t\t// Notify any plugins about the resize\r\n\t\t\tvar newSize = {width: newWidth, height: newHeight};\r\n\t\t\tcore_plugins.notify(me, 'resize', [newSize]);\r\n\r\n\t\t\t// Notify of resize\r\n\t\t\tif (options.onResize) {\r\n\t\t\t\toptions.onResize(me, newSize);\r\n\t\t\t}\r\n\r\n\t\t\tme.stop();\r\n\t\t\tme.update({\r\n\t\t\t\tduration: options.responsiveAnimationDuration\r\n\t\t\t});\r\n\t\t}\r\n\t},\r\n\r\n\tensureScalesHaveIDs: function() {\r\n\t\tvar options = this.options;\r\n\t\tvar scalesOptions = options.scales || {};\r\n\t\tvar scaleOptions = options.scale;\r\n\r\n\t\thelpers$1.each(scalesOptions.xAxes, function(xAxisOptions, index) {\r\n\t\t\tif (!xAxisOptions.id) {\r\n\t\t\t\txAxisOptions.id = nextAvailableScaleId(scalesOptions.xAxes, 'x-axis-', index);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\thelpers$1.each(scalesOptions.yAxes, function(yAxisOptions, index) {\r\n\t\t\tif (!yAxisOptions.id) {\r\n\t\t\t\tyAxisOptions.id = nextAvailableScaleId(scalesOptions.yAxes, 'y-axis-', index);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tif (scaleOptions) {\r\n\t\t\tscaleOptions.id = scaleOptions.id || 'scale';\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Builds a map of scale ID to scale object for future lookup.\r\n\t */\r\n\tbuildOrUpdateScales: function() {\r\n\t\tvar me = this;\r\n\t\tvar options = me.options;\r\n\t\tvar scales = me.scales || {};\r\n\t\tvar items = [];\r\n\t\tvar updated = Object.keys(scales).reduce(function(obj, id) {\r\n\t\t\tobj[id] = false;\r\n\t\t\treturn obj;\r\n\t\t}, {});\r\n\r\n\t\tif (options.scales) {\r\n\t\t\titems = items.concat(\r\n\t\t\t\t(options.scales.xAxes || []).map(function(xAxisOptions) {\r\n\t\t\t\t\treturn {options: xAxisOptions, dtype: 'category', dposition: 'bottom'};\r\n\t\t\t\t}),\r\n\t\t\t\t(options.scales.yAxes || []).map(function(yAxisOptions) {\r\n\t\t\t\t\treturn {options: yAxisOptions, dtype: 'linear', dposition: 'left'};\r\n\t\t\t\t})\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tif (options.scale) {\r\n\t\t\titems.push({\r\n\t\t\t\toptions: options.scale,\r\n\t\t\t\tdtype: 'radialLinear',\r\n\t\t\t\tisDefault: true,\r\n\t\t\t\tdposition: 'chartArea'\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\thelpers$1.each(items, function(item) {\r\n\t\t\tvar scaleOptions = item.options;\r\n\t\t\tvar id = scaleOptions.id;\r\n\t\t\tvar scaleType = valueOrDefault$9(scaleOptions.type, item.dtype);\r\n\r\n\t\t\tif (positionIsHorizontal(scaleOptions.position) !== positionIsHorizontal(item.dposition)) {\r\n\t\t\t\tscaleOptions.position = item.dposition;\r\n\t\t\t}\r\n\r\n\t\t\tupdated[id] = true;\r\n\t\t\tvar scale = null;\r\n\t\t\tif (id in scales && scales[id].type === scaleType) {\r\n\t\t\t\tscale = scales[id];\r\n\t\t\t\tscale.options = scaleOptions;\r\n\t\t\t\tscale.ctx = me.ctx;\r\n\t\t\t\tscale.chart = me;\r\n\t\t\t} else {\r\n\t\t\t\tvar scaleClass = core_scaleService.getScaleConstructor(scaleType);\r\n\t\t\t\tif (!scaleClass) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\tscale = new scaleClass({\r\n\t\t\t\t\tid: id,\r\n\t\t\t\t\ttype: scaleType,\r\n\t\t\t\t\toptions: scaleOptions,\r\n\t\t\t\t\tctx: me.ctx,\r\n\t\t\t\t\tchart: me\r\n\t\t\t\t});\r\n\t\t\t\tscales[scale.id] = scale;\r\n\t\t\t}\r\n\r\n\t\t\tscale.mergeTicksOptions();\r\n\r\n\t\t\t// TODO(SB): I think we should be able to remove this custom case (options.scale)\r\n\t\t\t// and consider it as a regular scale part of the \"scales\"\" map only! This would\r\n\t\t\t// make the logic easier and remove some useless? custom code.\r\n\t\t\tif (item.isDefault) {\r\n\t\t\t\tme.scale = scale;\r\n\t\t\t}\r\n\t\t});\r\n\t\t// clear up discarded scales\r\n\t\thelpers$1.each(updated, function(hasUpdated, id) {\r\n\t\t\tif (!hasUpdated) {\r\n\t\t\t\tdelete scales[id];\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tme.scales = scales;\r\n\r\n\t\tcore_scaleService.addScalesToLayout(this);\r\n\t},\r\n\r\n\tbuildOrUpdateControllers: function() {\r\n\t\tvar me = this;\r\n\t\tvar newControllers = [];\r\n\t\tvar datasets = me.data.datasets;\r\n\t\tvar i, ilen;\r\n\r\n\t\tfor (i = 0, ilen = datasets.length; i < ilen; i++) {\r\n\t\t\tvar dataset = datasets[i];\r\n\t\t\tvar meta = me.getDatasetMeta(i);\r\n\t\t\tvar type = dataset.type || me.config.type;\r\n\r\n\t\t\tif (meta.type && meta.type !== type) {\r\n\t\t\t\tme.destroyDatasetMeta(i);\r\n\t\t\t\tmeta = me.getDatasetMeta(i);\r\n\t\t\t}\r\n\t\t\tmeta.type = type;\r\n\t\t\tmeta.order = dataset.order || 0;\r\n\t\t\tmeta.index = i;\r\n\r\n\t\t\tif (meta.controller) {\r\n\t\t\t\tmeta.controller.updateIndex(i);\r\n\t\t\t\tmeta.controller.linkScales();\r\n\t\t\t} else {\r\n\t\t\t\tvar ControllerClass = controllers[meta.type];\r\n\t\t\t\tif (ControllerClass === undefined) {\r\n\t\t\t\t\tthrow new Error('\"' + meta.type + '\" is not a chart type.');\r\n\t\t\t\t}\r\n\r\n\t\t\t\tmeta.controller = new ControllerClass(me, i);\r\n\t\t\t\tnewControllers.push(meta.controller);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn newControllers;\r\n\t},\r\n\r\n\t/**\r\n\t * Reset the elements of all datasets\r\n\t * @private\r\n\t */\r\n\tresetElements: function() {\r\n\t\tvar me = this;\r\n\t\thelpers$1.each(me.data.datasets, function(dataset, datasetIndex) {\r\n\t\t\tme.getDatasetMeta(datasetIndex).controller.reset();\r\n\t\t}, me);\r\n\t},\r\n\r\n\t/**\r\n\t* Resets the chart back to it's state before the initial animation\r\n\t*/\r\n\treset: function() {\r\n\t\tthis.resetElements();\r\n\t\tthis.tooltip.initialize();\r\n\t},\r\n\r\n\tupdate: function(config) {\r\n\t\tvar me = this;\r\n\t\tvar i, ilen;\r\n\r\n\t\tif (!config || typeof config !== 'object') {\r\n\t\t\t// backwards compatibility\r\n\t\t\tconfig = {\r\n\t\t\t\tduration: config,\r\n\t\t\t\tlazy: arguments[1]\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\tupdateConfig(me);\r\n\r\n\t\t// plugins options references might have change, let's invalidate the cache\r\n\t\t// https://github.com/chartjs/Chart.js/issues/5111#issuecomment-355934167\r\n\t\tcore_plugins._invalidate(me);\r\n\r\n\t\tif (core_plugins.notify(me, 'beforeUpdate') === false) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// In case the entire data object changed\r\n\t\tme.tooltip._data = me.data;\r\n\r\n\t\t// Make sure dataset controllers are updated and new controllers are reset\r\n\t\tvar newControllers = me.buildOrUpdateControllers();\r\n\r\n\t\t// Make sure all dataset controllers have correct meta data counts\r\n\t\tfor (i = 0, ilen = me.data.datasets.length; i < ilen; i++) {\r\n\t\t\tme.getDatasetMeta(i).controller.buildOrUpdateElements();\r\n\t\t}\r\n\r\n\t\tme.updateLayout();\r\n\r\n\t\t// Can only reset the new controllers after the scales have been updated\r\n\t\tif (me.options.animation && me.options.animation.duration) {\r\n\t\t\thelpers$1.each(newControllers, function(controller) {\r\n\t\t\t\tcontroller.reset();\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tme.updateDatasets();\r\n\r\n\t\t// Need to reset tooltip in case it is displayed with elements that are removed\r\n\t\t// after update.\r\n\t\tme.tooltip.initialize();\r\n\r\n\t\t// Last active contains items that were previously in the tooltip.\r\n\t\t// When we reset the tooltip, we need to clear it\r\n\t\tme.lastActive = [];\r\n\r\n\t\t// Do this before render so that any plugins that need final scale updates can use it\r\n\t\tcore_plugins.notify(me, 'afterUpdate');\r\n\r\n\t\tme._layers.sort(compare2Level('z', '_idx'));\r\n\r\n\t\tif (me._bufferedRender) {\r\n\t\t\tme._bufferedRequest = {\r\n\t\t\t\tduration: config.duration,\r\n\t\t\t\teasing: config.easing,\r\n\t\t\t\tlazy: config.lazy\r\n\t\t\t};\r\n\t\t} else {\r\n\t\t\tme.render(config);\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Updates the chart layout unless a plugin returns `false` to the `beforeLayout`\r\n\t * hook, in which case, plugins will not be called on `afterLayout`.\r\n\t * @private\r\n\t */\r\n\tupdateLayout: function() {\r\n\t\tvar me = this;\r\n\r\n\t\tif (core_plugins.notify(me, 'beforeLayout') === false) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tcore_layouts.update(this, this.width, this.height);\r\n\r\n\t\tme._layers = [];\r\n\t\thelpers$1.each(me.boxes, function(box) {\r\n\t\t\t// _configure is called twice, once in core.scale.update and once here.\r\n\t\t\t// Here the boxes are fully updated and at their final positions.\r\n\t\t\tif (box._configure) {\r\n\t\t\t\tbox._configure();\r\n\t\t\t}\r\n\t\t\tme._layers.push.apply(me._layers, box._layers());\r\n\t\t}, me);\r\n\r\n\t\tme._layers.forEach(function(item, index) {\r\n\t\t\titem._idx = index;\r\n\t\t});\r\n\r\n\t\t/**\r\n\t\t * Provided for backward compatibility, use `afterLayout` instead.\r\n\t\t * @method IPlugin#afterScaleUpdate\r\n\t\t * @deprecated since version 2.5.0\r\n\t\t * @todo remove at version 3\r\n\t\t * @private\r\n\t\t */\r\n\t\tcore_plugins.notify(me, 'afterScaleUpdate');\r\n\t\tcore_plugins.notify(me, 'afterLayout');\r\n\t},\r\n\r\n\t/**\r\n\t * Updates all datasets unless a plugin returns `false` to the `beforeDatasetsUpdate`\r\n\t * hook, in which case, plugins will not be called on `afterDatasetsUpdate`.\r\n\t * @private\r\n\t */\r\n\tupdateDatasets: function() {\r\n\t\tvar me = this;\r\n\r\n\t\tif (core_plugins.notify(me, 'beforeDatasetsUpdate') === false) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tfor (var i = 0, ilen = me.data.datasets.length; i < ilen; ++i) {\r\n\t\t\tme.updateDataset(i);\r\n\t\t}\r\n\r\n\t\tcore_plugins.notify(me, 'afterDatasetsUpdate');\r\n\t},\r\n\r\n\t/**\r\n\t * Updates dataset at index unless a plugin returns `false` to the `beforeDatasetUpdate`\r\n\t * hook, in which case, plugins will not be called on `afterDatasetUpdate`.\r\n\t * @private\r\n\t */\r\n\tupdateDataset: function(index) {\r\n\t\tvar me = this;\r\n\t\tvar meta = me.getDatasetMeta(index);\r\n\t\tvar args = {\r\n\t\t\tmeta: meta,\r\n\t\t\tindex: index\r\n\t\t};\r\n\r\n\t\tif (core_plugins.notify(me, 'beforeDatasetUpdate', [args]) === false) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tmeta.controller._update();\r\n\r\n\t\tcore_plugins.notify(me, 'afterDatasetUpdate', [args]);\r\n\t},\r\n\r\n\trender: function(config) {\r\n\t\tvar me = this;\r\n\r\n\t\tif (!config || typeof config !== 'object') {\r\n\t\t\t// backwards compatibility\r\n\t\t\tconfig = {\r\n\t\t\t\tduration: config,\r\n\t\t\t\tlazy: arguments[1]\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\tvar animationOptions = me.options.animation;\r\n\t\tvar duration = valueOrDefault$9(config.duration, animationOptions && animationOptions.duration);\r\n\t\tvar lazy = config.lazy;\r\n\r\n\t\tif (core_plugins.notify(me, 'beforeRender') === false) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tvar onComplete = function(animation) {\r\n\t\t\tcore_plugins.notify(me, 'afterRender');\r\n\t\t\thelpers$1.callback(animationOptions && animationOptions.onComplete, [animation], me);\r\n\t\t};\r\n\r\n\t\tif (animationOptions && duration) {\r\n\t\t\tvar animation = new core_animation({\r\n\t\t\t\tnumSteps: duration / 16.66, // 60 fps\r\n\t\t\t\teasing: config.easing || animationOptions.easing,\r\n\r\n\t\t\t\trender: function(chart, animationObject) {\r\n\t\t\t\t\tvar easingFunction = helpers$1.easing.effects[animationObject.easing];\r\n\t\t\t\t\tvar currentStep = animationObject.currentStep;\r\n\t\t\t\t\tvar stepDecimal = currentStep / animationObject.numSteps;\r\n\r\n\t\t\t\t\tchart.draw(easingFunction(stepDecimal), stepDecimal, currentStep);\r\n\t\t\t\t},\r\n\r\n\t\t\t\tonAnimationProgress: animationOptions.onProgress,\r\n\t\t\t\tonAnimationComplete: onComplete\r\n\t\t\t});\r\n\r\n\t\t\tcore_animations.addAnimation(me, animation, duration, lazy);\r\n\t\t} else {\r\n\t\t\tme.draw();\r\n\r\n\t\t\t// See https://github.com/chartjs/Chart.js/issues/3781\r\n\t\t\tonComplete(new core_animation({numSteps: 0, chart: me}));\r\n\t\t}\r\n\r\n\t\treturn me;\r\n\t},\r\n\r\n\tdraw: function(easingValue) {\r\n\t\tvar me = this;\r\n\t\tvar i, layers;\r\n\r\n\t\tme.clear();\r\n\r\n\t\tif (helpers$1.isNullOrUndef(easingValue)) {\r\n\t\t\teasingValue = 1;\r\n\t\t}\r\n\r\n\t\tme.transition(easingValue);\r\n\r\n\t\tif (me.width <= 0 || me.height <= 0) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (core_plugins.notify(me, 'beforeDraw', [easingValue]) === false) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Because of plugin hooks (before/afterDatasetsDraw), datasets can't\r\n\t\t// currently be part of layers. Instead, we draw\r\n\t\t// layers <= 0 before(default, backward compat), and the rest after\r\n\t\tlayers = me._layers;\r\n\t\tfor (i = 0; i < layers.length && layers[i].z <= 0; ++i) {\r\n\t\t\tlayers[i].draw(me.chartArea);\r\n\t\t}\r\n\r\n\t\tme.drawDatasets(easingValue);\r\n\r\n\t\t// Rest of layers\r\n\t\tfor (; i < layers.length; ++i) {\r\n\t\t\tlayers[i].draw(me.chartArea);\r\n\t\t}\r\n\r\n\t\tme._drawTooltip(easingValue);\r\n\r\n\t\tcore_plugins.notify(me, 'afterDraw', [easingValue]);\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\ttransition: function(easingValue) {\r\n\t\tvar me = this;\r\n\r\n\t\tfor (var i = 0, ilen = (me.data.datasets || []).length; i < ilen; ++i) {\r\n\t\t\tif (me.isDatasetVisible(i)) {\r\n\t\t\t\tme.getDatasetMeta(i).controller.transition(easingValue);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tme.tooltip.transition(easingValue);\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_getSortedDatasetMetas: function(filterVisible) {\r\n\t\tvar me = this;\r\n\t\tvar datasets = me.data.datasets || [];\r\n\t\tvar result = [];\r\n\t\tvar i, ilen;\r\n\r\n\t\tfor (i = 0, ilen = datasets.length; i < ilen; ++i) {\r\n\t\t\tif (!filterVisible || me.isDatasetVisible(i)) {\r\n\t\t\t\tresult.push(me.getDatasetMeta(i));\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tresult.sort(compare2Level('order', 'index'));\r\n\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_getSortedVisibleDatasetMetas: function() {\r\n\t\treturn this._getSortedDatasetMetas(true);\r\n\t},\r\n\r\n\t/**\r\n\t * Draws all datasets unless a plugin returns `false` to the `beforeDatasetsDraw`\r\n\t * hook, in which case, plugins will not be called on `afterDatasetsDraw`.\r\n\t * @private\r\n\t */\r\n\tdrawDatasets: function(easingValue) {\r\n\t\tvar me = this;\r\n\t\tvar metasets, i;\r\n\r\n\t\tif (core_plugins.notify(me, 'beforeDatasetsDraw', [easingValue]) === false) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tmetasets = me._getSortedVisibleDatasetMetas();\r\n\t\tfor (i = metasets.length - 1; i >= 0; --i) {\r\n\t\t\tme.drawDataset(metasets[i], easingValue);\r\n\t\t}\r\n\r\n\t\tcore_plugins.notify(me, 'afterDatasetsDraw', [easingValue]);\r\n\t},\r\n\r\n\t/**\r\n\t * Draws dataset at index unless a plugin returns `false` to the `beforeDatasetDraw`\r\n\t * hook, in which case, plugins will not be called on `afterDatasetDraw`.\r\n\t * @private\r\n\t */\r\n\tdrawDataset: function(meta, easingValue) {\r\n\t\tvar me = this;\r\n\t\tvar args = {\r\n\t\t\tmeta: meta,\r\n\t\t\tindex: meta.index,\r\n\t\t\teasingValue: easingValue\r\n\t\t};\r\n\r\n\t\tif (core_plugins.notify(me, 'beforeDatasetDraw', [args]) === false) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tmeta.controller.draw(easingValue);\r\n\r\n\t\tcore_plugins.notify(me, 'afterDatasetDraw', [args]);\r\n\t},\r\n\r\n\t/**\r\n\t * Draws tooltip unless a plugin returns `false` to the `beforeTooltipDraw`\r\n\t * hook, in which case, plugins will not be called on `afterTooltipDraw`.\r\n\t * @private\r\n\t */\r\n\t_drawTooltip: function(easingValue) {\r\n\t\tvar me = this;\r\n\t\tvar tooltip = me.tooltip;\r\n\t\tvar args = {\r\n\t\t\ttooltip: tooltip,\r\n\t\t\teasingValue: easingValue\r\n\t\t};\r\n\r\n\t\tif (core_plugins.notify(me, 'beforeTooltipDraw', [args]) === false) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\ttooltip.draw();\r\n\r\n\t\tcore_plugins.notify(me, 'afterTooltipDraw', [args]);\r\n\t},\r\n\r\n\t/**\r\n\t * Get the single element that was clicked on\r\n\t * @return An object containing the dataset index and element index of the matching element. Also contains the rectangle that was draw\r\n\t */\r\n\tgetElementAtEvent: function(e) {\r\n\t\treturn core_interaction.modes.single(this, e);\r\n\t},\r\n\r\n\tgetElementsAtEvent: function(e) {\r\n\t\treturn core_interaction.modes.label(this, e, {intersect: true});\r\n\t},\r\n\r\n\tgetElementsAtXAxis: function(e) {\r\n\t\treturn core_interaction.modes['x-axis'](this, e, {intersect: true});\r\n\t},\r\n\r\n\tgetElementsAtEventForMode: function(e, mode, options) {\r\n\t\tvar method = core_interaction.modes[mode];\r\n\t\tif (typeof method === 'function') {\r\n\t\t\treturn method(this, e, options);\r\n\t\t}\r\n\r\n\t\treturn [];\r\n\t},\r\n\r\n\tgetDatasetAtEvent: function(e) {\r\n\t\treturn core_interaction.modes.dataset(this, e, {intersect: true});\r\n\t},\r\n\r\n\tgetDatasetMeta: function(datasetIndex) {\r\n\t\tvar me = this;\r\n\t\tvar dataset = me.data.datasets[datasetIndex];\r\n\t\tif (!dataset._meta) {\r\n\t\t\tdataset._meta = {};\r\n\t\t}\r\n\r\n\t\tvar meta = dataset._meta[me.id];\r\n\t\tif (!meta) {\r\n\t\t\tmeta = dataset._meta[me.id] = {\r\n\t\t\t\ttype: null,\r\n\t\t\t\tdata: [],\r\n\t\t\t\tdataset: null,\r\n\t\t\t\tcontroller: null,\r\n\t\t\t\thidden: null,\t\t\t// See isDatasetVisible() comment\r\n\t\t\t\txAxisID: null,\r\n\t\t\t\tyAxisID: null,\r\n\t\t\t\torder: dataset.order || 0,\r\n\t\t\t\tindex: datasetIndex\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\treturn meta;\r\n\t},\r\n\r\n\tgetVisibleDatasetCount: function() {\r\n\t\tvar count = 0;\r\n\t\tfor (var i = 0, ilen = this.data.datasets.length; i < ilen; ++i) {\r\n\t\t\tif (this.isDatasetVisible(i)) {\r\n\t\t\t\tcount++;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn count;\r\n\t},\r\n\r\n\tisDatasetVisible: function(datasetIndex) {\r\n\t\tvar meta = this.getDatasetMeta(datasetIndex);\r\n\r\n\t\t// meta.hidden is a per chart dataset hidden flag override with 3 states: if true or false,\r\n\t\t// the dataset.hidden value is ignored, else if null, the dataset hidden state is returned.\r\n\t\treturn typeof meta.hidden === 'boolean' ? !meta.hidden : !this.data.datasets[datasetIndex].hidden;\r\n\t},\r\n\r\n\tgenerateLegend: function() {\r\n\t\treturn this.options.legendCallback(this);\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\tdestroyDatasetMeta: function(datasetIndex) {\r\n\t\tvar id = this.id;\r\n\t\tvar dataset = this.data.datasets[datasetIndex];\r\n\t\tvar meta = dataset._meta && dataset._meta[id];\r\n\r\n\t\tif (meta) {\r\n\t\t\tmeta.controller.destroy();\r\n\t\t\tdelete dataset._meta[id];\r\n\t\t}\r\n\t},\r\n\r\n\tdestroy: function() {\r\n\t\tvar me = this;\r\n\t\tvar canvas = me.canvas;\r\n\t\tvar i, ilen;\r\n\r\n\t\tme.stop();\r\n\r\n\t\t// dataset controllers need to cleanup associated data\r\n\t\tfor (i = 0, ilen = me.data.datasets.length; i < ilen; ++i) {\r\n\t\t\tme.destroyDatasetMeta(i);\r\n\t\t}\r\n\r\n\t\tif (canvas) {\r\n\t\t\tme.unbindEvents();\r\n\t\t\thelpers$1.canvas.clear(me);\r\n\t\t\tplatform.releaseContext(me.ctx);\r\n\t\t\tme.canvas = null;\r\n\t\t\tme.ctx = null;\r\n\t\t}\r\n\r\n\t\tcore_plugins.notify(me, 'destroy');\r\n\r\n\t\tdelete Chart.instances[me.id];\r\n\t},\r\n\r\n\ttoBase64Image: function() {\r\n\t\treturn this.canvas.toDataURL.apply(this.canvas, arguments);\r\n\t},\r\n\r\n\tinitToolTip: function() {\r\n\t\tvar me = this;\r\n\t\tme.tooltip = new core_tooltip({\r\n\t\t\t_chart: me,\r\n\t\t\t_chartInstance: me, // deprecated, backward compatibility\r\n\t\t\t_data: me.data,\r\n\t\t\t_options: me.options.tooltips\r\n\t\t}, me);\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\tbindEvents: function() {\r\n\t\tvar me = this;\r\n\t\tvar listeners = me._listeners = {};\r\n\t\tvar listener = function() {\r\n\t\t\tme.eventHandler.apply(me, arguments);\r\n\t\t};\r\n\r\n\t\thelpers$1.each(me.options.events, function(type) {\r\n\t\t\tplatform.addEventListener(me, type, listener);\r\n\t\t\tlisteners[type] = listener;\r\n\t\t});\r\n\r\n\t\t// Elements used to detect size change should not be injected for non responsive charts.\r\n\t\t// See https://github.com/chartjs/Chart.js/issues/2210\r\n\t\tif (me.options.responsive) {\r\n\t\t\tlistener = function() {\r\n\t\t\t\tme.resize();\r\n\t\t\t};\r\n\r\n\t\t\tplatform.addEventListener(me, 'resize', listener);\r\n\t\t\tlisteners.resize = listener;\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\tunbindEvents: function() {\r\n\t\tvar me = this;\r\n\t\tvar listeners = me._listeners;\r\n\t\tif (!listeners) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tdelete me._listeners;\r\n\t\thelpers$1.each(listeners, function(listener, type) {\r\n\t\t\tplatform.removeEventListener(me, type, listener);\r\n\t\t});\r\n\t},\r\n\r\n\tupdateHoverStyle: function(elements, mode, enabled) {\r\n\t\tvar prefix = enabled ? 'set' : 'remove';\r\n\t\tvar element, i, ilen;\r\n\r\n\t\tfor (i = 0, ilen = elements.length; i < ilen; ++i) {\r\n\t\t\telement = elements[i];\r\n\t\t\tif (element) {\r\n\t\t\t\tthis.getDatasetMeta(element._datasetIndex).controller[prefix + 'HoverStyle'](element);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (mode === 'dataset') {\r\n\t\t\tthis.getDatasetMeta(elements[0]._datasetIndex).controller['_' + prefix + 'DatasetHoverStyle']();\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\teventHandler: function(e) {\r\n\t\tvar me = this;\r\n\t\tvar tooltip = me.tooltip;\r\n\r\n\t\tif (core_plugins.notify(me, 'beforeEvent', [e]) === false) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Buffer any update calls so that renders do not occur\r\n\t\tme._bufferedRender = true;\r\n\t\tme._bufferedRequest = null;\r\n\r\n\t\tvar changed = me.handleEvent(e);\r\n\t\t// for smooth tooltip animations issue #4989\r\n\t\t// the tooltip should be the source of change\r\n\t\t// Animation check workaround:\r\n\t\t// tooltip._start will be null when tooltip isn't animating\r\n\t\tif (tooltip) {\r\n\t\t\tchanged = tooltip._start\r\n\t\t\t\t? tooltip.handleEvent(e)\r\n\t\t\t\t: changed | tooltip.handleEvent(e);\r\n\t\t}\r\n\r\n\t\tcore_plugins.notify(me, 'afterEvent', [e]);\r\n\r\n\t\tvar bufferedRequest = me._bufferedRequest;\r\n\t\tif (bufferedRequest) {\r\n\t\t\t// If we have an update that was triggered, we need to do a normal render\r\n\t\t\tme.render(bufferedRequest);\r\n\t\t} else if (changed && !me.animating) {\r\n\t\t\t// If entering, leaving, or changing elements, animate the change via pivot\r\n\t\t\tme.stop();\r\n\r\n\t\t\t// We only need to render at this point. Updating will cause scales to be\r\n\t\t\t// recomputed generating flicker & using more memory than necessary.\r\n\t\t\tme.render({\r\n\t\t\t\tduration: me.options.hover.animationDuration,\r\n\t\t\t\tlazy: true\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tme._bufferedRender = false;\r\n\t\tme._bufferedRequest = null;\r\n\r\n\t\treturn me;\r\n\t},\r\n\r\n\t/**\r\n\t * Handle an event\r\n\t * @private\r\n\t * @param {IEvent} event the event to handle\r\n\t * @return {boolean} true if the chart needs to re-render\r\n\t */\r\n\thandleEvent: function(e) {\r\n\t\tvar me = this;\r\n\t\tvar options = me.options || {};\r\n\t\tvar hoverOptions = options.hover;\r\n\t\tvar changed = false;\r\n\r\n\t\tme.lastActive = me.lastActive || [];\r\n\r\n\t\t// Find Active Elements for hover and tooltips\r\n\t\tif (e.type === 'mouseout') {\r\n\t\t\tme.active = [];\r\n\t\t} else {\r\n\t\t\tme.active = me.getElementsAtEventForMode(e, hoverOptions.mode, hoverOptions);\r\n\t\t}\r\n\r\n\t\t// Invoke onHover hook\r\n\t\t// Need to call with native event here to not break backwards compatibility\r\n\t\thelpers$1.callback(options.onHover || options.hover.onHover, [e.native, me.active], me);\r\n\r\n\t\tif (e.type === 'mouseup' || e.type === 'click') {\r\n\t\t\tif (options.onClick) {\r\n\t\t\t\t// Use e.native here for backwards compatibility\r\n\t\t\t\toptions.onClick.call(me, e.native, me.active);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Remove styling for last active (even if it may still be active)\r\n\t\tif (me.lastActive.length) {\r\n\t\t\tme.updateHoverStyle(me.lastActive, hoverOptions.mode, false);\r\n\t\t}\r\n\r\n\t\t// Built in hover styling\r\n\t\tif (me.active.length && hoverOptions.mode) {\r\n\t\t\tme.updateHoverStyle(me.active, hoverOptions.mode, true);\r\n\t\t}\r\n\r\n\t\tchanged = !helpers$1.arrayEquals(me.active, me.lastActive);\r\n\r\n\t\t// Remember Last Actives\r\n\t\tme.lastActive = me.active;\r\n\r\n\t\treturn changed;\r\n\t}\r\n});\r\n\r\n/**\r\n * NOTE(SB) We actually don't use this container anymore but we need to keep it\r\n * for backward compatibility. Though, it can still be useful for plugins that\r\n * would need to work on multiple charts?!\r\n */\r\nChart.instances = {};\r\n\r\nvar core_controller = Chart;\r\n\r\n// DEPRECATIONS\r\n\r\n/**\r\n * Provided for backward compatibility, use Chart instead.\r\n * @class Chart.Controller\r\n * @deprecated since version 2.6\r\n * @todo remove at version 3\r\n * @private\r\n */\r\nChart.Controller = Chart;\r\n\r\n/**\r\n * Provided for backward compatibility, not available anymore.\r\n * @namespace Chart\r\n * @deprecated since version 2.8\r\n * @todo remove at version 3\r\n * @private\r\n */\r\nChart.types = {};\r\n\r\n/**\r\n * Provided for backward compatibility, not available anymore.\r\n * @namespace Chart.helpers.configMerge\r\n * @deprecated since version 2.8.0\r\n * @todo remove at version 3\r\n * @private\r\n */\r\nhelpers$1.configMerge = mergeConfig;\r\n\r\n/**\r\n * Provided for backward compatibility, not available anymore.\r\n * @namespace Chart.helpers.scaleMerge\r\n * @deprecated since version 2.8.0\r\n * @todo remove at version 3\r\n * @private\r\n */\r\nhelpers$1.scaleMerge = mergeScaleConfig;\n\nvar core_helpers = function() {\r\n\r\n\t// -- Basic js utility methods\r\n\r\n\thelpers$1.where = function(collection, filterCallback) {\r\n\t\tif (helpers$1.isArray(collection) && Array.prototype.filter) {\r\n\t\t\treturn collection.filter(filterCallback);\r\n\t\t}\r\n\t\tvar filtered = [];\r\n\r\n\t\thelpers$1.each(collection, function(item) {\r\n\t\t\tif (filterCallback(item)) {\r\n\t\t\t\tfiltered.push(item);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\treturn filtered;\r\n\t};\r\n\thelpers$1.findIndex = Array.prototype.findIndex ?\r\n\t\tfunction(array, callback, scope) {\r\n\t\t\treturn array.findIndex(callback, scope);\r\n\t\t} :\r\n\t\tfunction(array, callback, scope) {\r\n\t\t\tscope = scope === undefined ? array : scope;\r\n\t\t\tfor (var i = 0, ilen = array.length; i < ilen; ++i) {\r\n\t\t\t\tif (callback.call(scope, array[i], i, array)) {\r\n\t\t\t\t\treturn i;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn -1;\r\n\t\t};\r\n\thelpers$1.findNextWhere = function(arrayToSearch, filterCallback, startIndex) {\r\n\t\t// Default to start of the array\r\n\t\tif (helpers$1.isNullOrUndef(startIndex)) {\r\n\t\t\tstartIndex = -1;\r\n\t\t}\r\n\t\tfor (var i = startIndex + 1; i < arrayToSearch.length; i++) {\r\n\t\t\tvar currentItem = arrayToSearch[i];\r\n\t\t\tif (filterCallback(currentItem)) {\r\n\t\t\t\treturn currentItem;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\thelpers$1.findPreviousWhere = function(arrayToSearch, filterCallback, startIndex) {\r\n\t\t// Default to end of the array\r\n\t\tif (helpers$1.isNullOrUndef(startIndex)) {\r\n\t\t\tstartIndex = arrayToSearch.length;\r\n\t\t}\r\n\t\tfor (var i = startIndex - 1; i >= 0; i--) {\r\n\t\t\tvar currentItem = arrayToSearch[i];\r\n\t\t\tif (filterCallback(currentItem)) {\r\n\t\t\t\treturn currentItem;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\t// -- Math methods\r\n\thelpers$1.isNumber = function(n) {\r\n\t\treturn !isNaN(parseFloat(n)) && isFinite(n);\r\n\t};\r\n\thelpers$1.almostEquals = function(x, y, epsilon) {\r\n\t\treturn Math.abs(x - y) < epsilon;\r\n\t};\r\n\thelpers$1.almostWhole = function(x, epsilon) {\r\n\t\tvar rounded = Math.round(x);\r\n\t\treturn ((rounded - epsilon) <= x) && ((rounded + epsilon) >= x);\r\n\t};\r\n\thelpers$1.max = function(array) {\r\n\t\treturn array.reduce(function(max, value) {\r\n\t\t\tif (!isNaN(value)) {\r\n\t\t\t\treturn Math.max(max, value);\r\n\t\t\t}\r\n\t\t\treturn max;\r\n\t\t}, Number.NEGATIVE_INFINITY);\r\n\t};\r\n\thelpers$1.min = function(array) {\r\n\t\treturn array.reduce(function(min, value) {\r\n\t\t\tif (!isNaN(value)) {\r\n\t\t\t\treturn Math.min(min, value);\r\n\t\t\t}\r\n\t\t\treturn min;\r\n\t\t}, Number.POSITIVE_INFINITY);\r\n\t};\r\n\thelpers$1.sign = Math.sign ?\r\n\t\tfunction(x) {\r\n\t\t\treturn Math.sign(x);\r\n\t\t} :\r\n\t\tfunction(x) {\r\n\t\t\tx = +x; // convert to a number\r\n\t\t\tif (x === 0 || isNaN(x)) {\r\n\t\t\t\treturn x;\r\n\t\t\t}\r\n\t\t\treturn x > 0 ? 1 : -1;\r\n\t\t};\r\n\thelpers$1.toRadians = function(degrees) {\r\n\t\treturn degrees * (Math.PI / 180);\r\n\t};\r\n\thelpers$1.toDegrees = function(radians) {\r\n\t\treturn radians * (180 / Math.PI);\r\n\t};\r\n\r\n\t/**\r\n\t * Returns the number of decimal places\r\n\t * i.e. the number of digits after the decimal point, of the value of this Number.\r\n\t * @param {number} x - A number.\r\n\t * @returns {number} The number of decimal places.\r\n\t * @private\r\n\t */\r\n\thelpers$1._decimalPlaces = function(x) {\r\n\t\tif (!helpers$1.isFinite(x)) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tvar e = 1;\r\n\t\tvar p = 0;\r\n\t\twhile (Math.round(x * e) / e !== x) {\r\n\t\t\te *= 10;\r\n\t\t\tp++;\r\n\t\t}\r\n\t\treturn p;\r\n\t};\r\n\r\n\t// Gets the angle from vertical upright to the point about a centre.\r\n\thelpers$1.getAngleFromPoint = function(centrePoint, anglePoint) {\r\n\t\tvar distanceFromXCenter = anglePoint.x - centrePoint.x;\r\n\t\tvar distanceFromYCenter = anglePoint.y - centrePoint.y;\r\n\t\tvar radialDistanceFromCenter = Math.sqrt(distanceFromXCenter * distanceFromXCenter + distanceFromYCenter * distanceFromYCenter);\r\n\r\n\t\tvar angle = Math.atan2(distanceFromYCenter, distanceFromXCenter);\r\n\r\n\t\tif (angle < (-0.5 * Math.PI)) {\r\n\t\t\tangle += 2.0 * Math.PI; // make sure the returned angle is in the range of (-PI/2, 3PI/2]\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\tangle: angle,\r\n\t\t\tdistance: radialDistanceFromCenter\r\n\t\t};\r\n\t};\r\n\thelpers$1.distanceBetweenPoints = function(pt1, pt2) {\r\n\t\treturn Math.sqrt(Math.pow(pt2.x - pt1.x, 2) + Math.pow(pt2.y - pt1.y, 2));\r\n\t};\r\n\r\n\t/**\r\n\t * Provided for backward compatibility, not available anymore\r\n\t * @function Chart.helpers.aliasPixel\r\n\t * @deprecated since version 2.8.0\r\n\t * @todo remove at version 3\r\n\t */\r\n\thelpers$1.aliasPixel = function(pixelWidth) {\r\n\t\treturn (pixelWidth % 2 === 0) ? 0 : 0.5;\r\n\t};\r\n\r\n\t/**\r\n\t * Returns the aligned pixel value to avoid anti-aliasing blur\r\n\t * @param {Chart} chart - The chart instance.\r\n\t * @param {number} pixel - A pixel value.\r\n\t * @param {number} width - The width of the element.\r\n\t * @returns {number} The aligned pixel value.\r\n\t * @private\r\n\t */\r\n\thelpers$1._alignPixel = function(chart, pixel, width) {\r\n\t\tvar devicePixelRatio = chart.currentDevicePixelRatio;\r\n\t\tvar halfWidth = width / 2;\r\n\t\treturn Math.round((pixel - halfWidth) * devicePixelRatio) / devicePixelRatio + halfWidth;\r\n\t};\r\n\r\n\thelpers$1.splineCurve = function(firstPoint, middlePoint, afterPoint, t) {\r\n\t\t// Props to Rob Spencer at scaled innovation for his post on splining between points\r\n\t\t// http://scaledinnovation.com/analytics/splines/aboutSplines.html\r\n\r\n\t\t// This function must also respect \"skipped\" points\r\n\r\n\t\tvar previous = firstPoint.skip ? middlePoint : firstPoint;\r\n\t\tvar current = middlePoint;\r\n\t\tvar next = afterPoint.skip ? middlePoint : afterPoint;\r\n\r\n\t\tvar d01 = Math.sqrt(Math.pow(current.x - previous.x, 2) + Math.pow(current.y - previous.y, 2));\r\n\t\tvar d12 = Math.sqrt(Math.pow(next.x - current.x, 2) + Math.pow(next.y - current.y, 2));\r\n\r\n\t\tvar s01 = d01 / (d01 + d12);\r\n\t\tvar s12 = d12 / (d01 + d12);\r\n\r\n\t\t// If all points are the same, s01 & s02 will be inf\r\n\t\ts01 = isNaN(s01) ? 0 : s01;\r\n\t\ts12 = isNaN(s12) ? 0 : s12;\r\n\r\n\t\tvar fa = t * s01; // scaling factor for triangle Ta\r\n\t\tvar fb = t * s12;\r\n\r\n\t\treturn {\r\n\t\t\tprevious: {\r\n\t\t\t\tx: current.x - fa * (next.x - previous.x),\r\n\t\t\t\ty: current.y - fa * (next.y - previous.y)\r\n\t\t\t},\r\n\t\t\tnext: {\r\n\t\t\t\tx: current.x + fb * (next.x - previous.x),\r\n\t\t\t\ty: current.y + fb * (next.y - previous.y)\r\n\t\t\t}\r\n\t\t};\r\n\t};\r\n\thelpers$1.EPSILON = Number.EPSILON || 1e-14;\r\n\thelpers$1.splineCurveMonotone = function(points) {\r\n\t\t// This function calculates Bézier control points in a similar way than |splineCurve|,\r\n\t\t// but preserves monotonicity of the provided data and ensures no local extremums are added\r\n\t\t// between the dataset discrete points due to the interpolation.\r\n\t\t// See : https://en.wikipedia.org/wiki/Monotone_cubic_interpolation\r\n\r\n\t\tvar pointsWithTangents = (points || []).map(function(point) {\r\n\t\t\treturn {\r\n\t\t\t\tmodel: point._model,\r\n\t\t\t\tdeltaK: 0,\r\n\t\t\t\tmK: 0\r\n\t\t\t};\r\n\t\t});\r\n\r\n\t\t// Calculate slopes (deltaK) and initialize tangents (mK)\r\n\t\tvar pointsLen = pointsWithTangents.length;\r\n\t\tvar i, pointBefore, pointCurrent, pointAfter;\r\n\t\tfor (i = 0; i < pointsLen; ++i) {\r\n\t\t\tpointCurrent = pointsWithTangents[i];\r\n\t\t\tif (pointCurrent.model.skip) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\tpointBefore = i > 0 ? pointsWithTangents[i - 1] : null;\r\n\t\t\tpointAfter = i < pointsLen - 1 ? pointsWithTangents[i + 1] : null;\r\n\t\t\tif (pointAfter && !pointAfter.model.skip) {\r\n\t\t\t\tvar slopeDeltaX = (pointAfter.model.x - pointCurrent.model.x);\r\n\r\n\t\t\t\t// In the case of two points that appear at the same x pixel, slopeDeltaX is 0\r\n\t\t\t\tpointCurrent.deltaK = slopeDeltaX !== 0 ? (pointAfter.model.y - pointCurrent.model.y) / slopeDeltaX : 0;\r\n\t\t\t}\r\n\r\n\t\t\tif (!pointBefore || pointBefore.model.skip) {\r\n\t\t\t\tpointCurrent.mK = pointCurrent.deltaK;\r\n\t\t\t} else if (!pointAfter || pointAfter.model.skip) {\r\n\t\t\t\tpointCurrent.mK = pointBefore.deltaK;\r\n\t\t\t} else if (this.sign(pointBefore.deltaK) !== this.sign(pointCurrent.deltaK)) {\r\n\t\t\t\tpointCurrent.mK = 0;\r\n\t\t\t} else {\r\n\t\t\t\tpointCurrent.mK = (pointBefore.deltaK + pointCurrent.deltaK) / 2;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Adjust tangents to ensure monotonic properties\r\n\t\tvar alphaK, betaK, tauK, squaredMagnitude;\r\n\t\tfor (i = 0; i < pointsLen - 1; ++i) {\r\n\t\t\tpointCurrent = pointsWithTangents[i];\r\n\t\t\tpointAfter = pointsWithTangents[i + 1];\r\n\t\t\tif (pointCurrent.model.skip || pointAfter.model.skip) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\tif (helpers$1.almostEquals(pointCurrent.deltaK, 0, this.EPSILON)) {\r\n\t\t\t\tpointCurrent.mK = pointAfter.mK = 0;\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\talphaK = pointCurrent.mK / pointCurrent.deltaK;\r\n\t\t\tbetaK = pointAfter.mK / pointCurrent.deltaK;\r\n\t\t\tsquaredMagnitude = Math.pow(alphaK, 2) + Math.pow(betaK, 2);\r\n\t\t\tif (squaredMagnitude <= 9) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\ttauK = 3 / Math.sqrt(squaredMagnitude);\r\n\t\t\tpointCurrent.mK = alphaK * tauK * pointCurrent.deltaK;\r\n\t\t\tpointAfter.mK = betaK * tauK * pointCurrent.deltaK;\r\n\t\t}\r\n\r\n\t\t// Compute control points\r\n\t\tvar deltaX;\r\n\t\tfor (i = 0; i < pointsLen; ++i) {\r\n\t\t\tpointCurrent = pointsWithTangents[i];\r\n\t\t\tif (pointCurrent.model.skip) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\tpointBefore = i > 0 ? pointsWithTangents[i - 1] : null;\r\n\t\t\tpointAfter = i < pointsLen - 1 ? pointsWithTangents[i + 1] : null;\r\n\t\t\tif (pointBefore && !pointBefore.model.skip) {\r\n\t\t\t\tdeltaX = (pointCurrent.model.x - pointBefore.model.x) / 3;\r\n\t\t\t\tpointCurrent.model.controlPointPreviousX = pointCurrent.model.x - deltaX;\r\n\t\t\t\tpointCurrent.model.controlPointPreviousY = pointCurrent.model.y - deltaX * pointCurrent.mK;\r\n\t\t\t}\r\n\t\t\tif (pointAfter && !pointAfter.model.skip) {\r\n\t\t\t\tdeltaX = (pointAfter.model.x - pointCurrent.model.x) / 3;\r\n\t\t\t\tpointCurrent.model.controlPointNextX = pointCurrent.model.x + deltaX;\r\n\t\t\t\tpointCurrent.model.controlPointNextY = pointCurrent.model.y + deltaX * pointCurrent.mK;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\thelpers$1.nextItem = function(collection, index, loop) {\r\n\t\tif (loop) {\r\n\t\t\treturn index >= collection.length - 1 ? collection[0] : collection[index + 1];\r\n\t\t}\r\n\t\treturn index >= collection.length - 1 ? collection[collection.length - 1] : collection[index + 1];\r\n\t};\r\n\thelpers$1.previousItem = function(collection, index, loop) {\r\n\t\tif (loop) {\r\n\t\t\treturn index <= 0 ? collection[collection.length - 1] : collection[index - 1];\r\n\t\t}\r\n\t\treturn index <= 0 ? collection[0] : collection[index - 1];\r\n\t};\r\n\t// Implementation of the nice number algorithm used in determining where axis labels will go\r\n\thelpers$1.niceNum = function(range, round) {\r\n\t\tvar exponent = Math.floor(helpers$1.log10(range));\r\n\t\tvar fraction = range / Math.pow(10, exponent);\r\n\t\tvar niceFraction;\r\n\r\n\t\tif (round) {\r\n\t\t\tif (fraction < 1.5) {\r\n\t\t\t\tniceFraction = 1;\r\n\t\t\t} else if (fraction < 3) {\r\n\t\t\t\tniceFraction = 2;\r\n\t\t\t} else if (fraction < 7) {\r\n\t\t\t\tniceFraction = 5;\r\n\t\t\t} else {\r\n\t\t\t\tniceFraction = 10;\r\n\t\t\t}\r\n\t\t} else if (fraction <= 1.0) {\r\n\t\t\tniceFraction = 1;\r\n\t\t} else if (fraction <= 2) {\r\n\t\t\tniceFraction = 2;\r\n\t\t} else if (fraction <= 5) {\r\n\t\t\tniceFraction = 5;\r\n\t\t} else {\r\n\t\t\tniceFraction = 10;\r\n\t\t}\r\n\r\n\t\treturn niceFraction * Math.pow(10, exponent);\r\n\t};\r\n\t// Request animation polyfill - https://www.paulirish.com/2011/requestanimationframe-for-smart-animating/\r\n\thelpers$1.requestAnimFrame = (function() {\r\n\t\tif (typeof window === 'undefined') {\r\n\t\t\treturn function(callback) {\r\n\t\t\t\tcallback();\r\n\t\t\t};\r\n\t\t}\r\n\t\treturn window.requestAnimationFrame ||\r\n\t\t\twindow.webkitRequestAnimationFrame ||\r\n\t\t\twindow.mozRequestAnimationFrame ||\r\n\t\t\twindow.oRequestAnimationFrame ||\r\n\t\t\twindow.msRequestAnimationFrame ||\r\n\t\t\tfunction(callback) {\r\n\t\t\t\treturn window.setTimeout(callback, 1000 / 60);\r\n\t\t\t};\r\n\t}());\r\n\t// -- DOM methods\r\n\thelpers$1.getRelativePosition = function(evt, chart) {\r\n\t\tvar mouseX, mouseY;\r\n\t\tvar e = evt.originalEvent || evt;\r\n\t\tvar canvas = evt.target || evt.srcElement;\r\n\t\tvar boundingRect = canvas.getBoundingClientRect();\r\n\r\n\t\tvar touches = e.touches;\r\n\t\tif (touches && touches.length > 0) {\r\n\t\t\tmouseX = touches[0].clientX;\r\n\t\t\tmouseY = touches[0].clientY;\r\n\r\n\t\t} else {\r\n\t\t\tmouseX = e.clientX;\r\n\t\t\tmouseY = e.clientY;\r\n\t\t}\r\n\r\n\t\t// Scale mouse coordinates into canvas coordinates\r\n\t\t// by following the pattern laid out by 'jerryj' in the comments of\r\n\t\t// https://www.html5canvastutorials.com/advanced/html5-canvas-mouse-coordinates/\r\n\t\tvar paddingLeft = parseFloat(helpers$1.getStyle(canvas, 'padding-left'));\r\n\t\tvar paddingTop = parseFloat(helpers$1.getStyle(canvas, 'padding-top'));\r\n\t\tvar paddingRight = parseFloat(helpers$1.getStyle(canvas, 'padding-right'));\r\n\t\tvar paddingBottom = parseFloat(helpers$1.getStyle(canvas, 'padding-bottom'));\r\n\t\tvar width = boundingRect.right - boundingRect.left - paddingLeft - paddingRight;\r\n\t\tvar height = boundingRect.bottom - boundingRect.top - paddingTop - paddingBottom;\r\n\r\n\t\t// We divide by the current device pixel ratio, because the canvas is scaled up by that amount in each direction. However\r\n\t\t// the backend model is in unscaled coordinates. Since we are going to deal with our model coordinates, we go back here\r\n\t\tmouseX = Math.round((mouseX - boundingRect.left - paddingLeft) / (width) * canvas.width / chart.currentDevicePixelRatio);\r\n\t\tmouseY = Math.round((mouseY - boundingRect.top - paddingTop) / (height) * canvas.height / chart.currentDevicePixelRatio);\r\n\r\n\t\treturn {\r\n\t\t\tx: mouseX,\r\n\t\t\ty: mouseY\r\n\t\t};\r\n\r\n\t};\r\n\r\n\t// Private helper function to convert max-width/max-height values that may be percentages into a number\r\n\tfunction parseMaxStyle(styleValue, node, parentProperty) {\r\n\t\tvar valueInPixels;\r\n\t\tif (typeof styleValue === 'string') {\r\n\t\t\tvalueInPixels = parseInt(styleValue, 10);\r\n\r\n\t\t\tif (styleValue.indexOf('%') !== -1) {\r\n\t\t\t\t// percentage * size in dimension\r\n\t\t\t\tvalueInPixels = valueInPixels / 100 * node.parentNode[parentProperty];\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tvalueInPixels = styleValue;\r\n\t\t}\r\n\r\n\t\treturn valueInPixels;\r\n\t}\r\n\r\n\t/**\r\n\t * Returns if the given value contains an effective constraint.\r\n\t * @private\r\n\t */\r\n\tfunction isConstrainedValue(value) {\r\n\t\treturn value !== undefined && value !== null && value !== 'none';\r\n\t}\r\n\r\n\t/**\r\n\t * Returns the max width or height of the given DOM node in a cross-browser compatible fashion\r\n\t * @param {HTMLElement} domNode - the node to check the constraint on\r\n\t * @param {string} maxStyle - the style that defines the maximum for the direction we are using ('max-width' / 'max-height')\r\n\t * @param {string} percentageProperty - property of parent to use when calculating width as a percentage\r\n\t * @see {@link https://www.nathanaeljones.com/blog/2013/reading-max-width-cross-browser}\r\n\t */\r\n\tfunction getConstraintDimension(domNode, maxStyle, percentageProperty) {\r\n\t\tvar view = document.defaultView;\r\n\t\tvar parentNode = helpers$1._getParentNode(domNode);\r\n\t\tvar constrainedNode = view.getComputedStyle(domNode)[maxStyle];\r\n\t\tvar constrainedContainer = view.getComputedStyle(parentNode)[maxStyle];\r\n\t\tvar hasCNode = isConstrainedValue(constrainedNode);\r\n\t\tvar hasCContainer = isConstrainedValue(constrainedContainer);\r\n\t\tvar infinity = Number.POSITIVE_INFINITY;\r\n\r\n\t\tif (hasCNode || hasCContainer) {\r\n\t\t\treturn Math.min(\r\n\t\t\t\thasCNode ? parseMaxStyle(constrainedNode, domNode, percentageProperty) : infinity,\r\n\t\t\t\thasCContainer ? parseMaxStyle(constrainedContainer, parentNode, percentageProperty) : infinity);\r\n\t\t}\r\n\r\n\t\treturn 'none';\r\n\t}\r\n\t// returns Number or undefined if no constraint\r\n\thelpers$1.getConstraintWidth = function(domNode) {\r\n\t\treturn getConstraintDimension(domNode, 'max-width', 'clientWidth');\r\n\t};\r\n\t// returns Number or undefined if no constraint\r\n\thelpers$1.getConstraintHeight = function(domNode) {\r\n\t\treturn getConstraintDimension(domNode, 'max-height', 'clientHeight');\r\n\t};\r\n\t/**\r\n\t * @private\r\n \t */\r\n\thelpers$1._calculatePadding = function(container, padding, parentDimension) {\r\n\t\tpadding = helpers$1.getStyle(container, padding);\r\n\r\n\t\treturn padding.indexOf('%') > -1 ? parentDimension * parseInt(padding, 10) / 100 : parseInt(padding, 10);\r\n\t};\r\n\t/**\r\n\t * @private\r\n\t */\r\n\thelpers$1._getParentNode = function(domNode) {\r\n\t\tvar parent = domNode.parentNode;\r\n\t\tif (parent && parent.toString() === '[object ShadowRoot]') {\r\n\t\t\tparent = parent.host;\r\n\t\t}\r\n\t\treturn parent;\r\n\t};\r\n\thelpers$1.getMaximumWidth = function(domNode) {\r\n\t\tvar container = helpers$1._getParentNode(domNode);\r\n\t\tif (!container) {\r\n\t\t\treturn domNode.clientWidth;\r\n\t\t}\r\n\r\n\t\tvar clientWidth = container.clientWidth;\r\n\t\tvar paddingLeft = helpers$1._calculatePadding(container, 'padding-left', clientWidth);\r\n\t\tvar paddingRight = helpers$1._calculatePadding(container, 'padding-right', clientWidth);\r\n\r\n\t\tvar w = clientWidth - paddingLeft - paddingRight;\r\n\t\tvar cw = helpers$1.getConstraintWidth(domNode);\r\n\t\treturn isNaN(cw) ? w : Math.min(w, cw);\r\n\t};\r\n\thelpers$1.getMaximumHeight = function(domNode) {\r\n\t\tvar container = helpers$1._getParentNode(domNode);\r\n\t\tif (!container) {\r\n\t\t\treturn domNode.clientHeight;\r\n\t\t}\r\n\r\n\t\tvar clientHeight = container.clientHeight;\r\n\t\tvar paddingTop = helpers$1._calculatePadding(container, 'padding-top', clientHeight);\r\n\t\tvar paddingBottom = helpers$1._calculatePadding(container, 'padding-bottom', clientHeight);\r\n\r\n\t\tvar h = clientHeight - paddingTop - paddingBottom;\r\n\t\tvar ch = helpers$1.getConstraintHeight(domNode);\r\n\t\treturn isNaN(ch) ? h : Math.min(h, ch);\r\n\t};\r\n\thelpers$1.getStyle = function(el, property) {\r\n\t\treturn el.currentStyle ?\r\n\t\t\tel.currentStyle[property] :\r\n\t\t\tdocument.defaultView.getComputedStyle(el, null).getPropertyValue(property);\r\n\t};\r\n\thelpers$1.retinaScale = function(chart, forceRatio) {\r\n\t\tvar pixelRatio = chart.currentDevicePixelRatio = forceRatio || (typeof window !== 'undefined' && window.devicePixelRatio) || 1;\r\n\t\tif (pixelRatio === 1) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tvar canvas = chart.canvas;\r\n\t\tvar height = chart.height;\r\n\t\tvar width = chart.width;\r\n\r\n\t\tcanvas.height = height * pixelRatio;\r\n\t\tcanvas.width = width * pixelRatio;\r\n\t\tchart.ctx.scale(pixelRatio, pixelRatio);\r\n\r\n\t\t// If no style has been set on the canvas, the render size is used as display size,\r\n\t\t// making the chart visually bigger, so let's enforce it to the \"correct\" values.\r\n\t\t// See https://github.com/chartjs/Chart.js/issues/3575\r\n\t\tif (!canvas.style.height && !canvas.style.width) {\r\n\t\t\tcanvas.style.height = height + 'px';\r\n\t\t\tcanvas.style.width = width + 'px';\r\n\t\t}\r\n\t};\r\n\t// -- Canvas methods\r\n\thelpers$1.fontString = function(pixelSize, fontStyle, fontFamily) {\r\n\t\treturn fontStyle + ' ' + pixelSize + 'px ' + fontFamily;\r\n\t};\r\n\thelpers$1.longestText = function(ctx, font, arrayOfThings, cache) {\r\n\t\tcache = cache || {};\r\n\t\tvar data = cache.data = cache.data || {};\r\n\t\tvar gc = cache.garbageCollect = cache.garbageCollect || [];\r\n\r\n\t\tif (cache.font !== font) {\r\n\t\t\tdata = cache.data = {};\r\n\t\t\tgc = cache.garbageCollect = [];\r\n\t\t\tcache.font = font;\r\n\t\t}\r\n\r\n\t\tctx.font = font;\r\n\t\tvar longest = 0;\r\n\t\tvar ilen = arrayOfThings.length;\r\n\t\tvar i, j, jlen, thing, nestedThing;\r\n\t\tfor (i = 0; i < ilen; i++) {\r\n\t\t\tthing = arrayOfThings[i];\r\n\r\n\t\t\t// Undefined strings and arrays should not be measured\r\n\t\t\tif (thing !== undefined && thing !== null && helpers$1.isArray(thing) !== true) {\r\n\t\t\t\tlongest = helpers$1.measureText(ctx, data, gc, longest, thing);\r\n\t\t\t} else if (helpers$1.isArray(thing)) {\r\n\t\t\t\t// if it is an array lets measure each element\r\n\t\t\t\t// to do maybe simplify this function a bit so we can do this more recursively?\r\n\t\t\t\tfor (j = 0, jlen = thing.length; j < jlen; j++) {\r\n\t\t\t\t\tnestedThing = thing[j];\r\n\t\t\t\t\t// Undefined strings and arrays should not be measured\r\n\t\t\t\t\tif (nestedThing !== undefined && nestedThing !== null && !helpers$1.isArray(nestedThing)) {\r\n\t\t\t\t\t\tlongest = helpers$1.measureText(ctx, data, gc, longest, nestedThing);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar gcLen = gc.length / 2;\r\n\t\tif (gcLen > arrayOfThings.length) {\r\n\t\t\tfor (i = 0; i < gcLen; i++) {\r\n\t\t\t\tdelete data[gc[i]];\r\n\t\t\t}\r\n\t\t\tgc.splice(0, gcLen);\r\n\t\t}\r\n\t\treturn longest;\r\n\t};\r\n\thelpers$1.measureText = function(ctx, data, gc, longest, string) {\r\n\t\tvar textWidth = data[string];\r\n\t\tif (!textWidth) {\r\n\t\t\ttextWidth = data[string] = ctx.measureText(string).width;\r\n\t\t\tgc.push(string);\r\n\t\t}\r\n\t\tif (textWidth > longest) {\r\n\t\t\tlongest = textWidth;\r\n\t\t}\r\n\t\treturn longest;\r\n\t};\r\n\r\n\t/**\r\n\t * @deprecated\r\n\t */\r\n\thelpers$1.numberOfLabelLines = function(arrayOfThings) {\r\n\t\tvar numberOfLines = 1;\r\n\t\thelpers$1.each(arrayOfThings, function(thing) {\r\n\t\t\tif (helpers$1.isArray(thing)) {\r\n\t\t\t\tif (thing.length > numberOfLines) {\r\n\t\t\t\t\tnumberOfLines = thing.length;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t\treturn numberOfLines;\r\n\t};\r\n\r\n\thelpers$1.color = !chartjsColor ?\r\n\t\tfunction(value) {\r\n\t\t\tconsole.error('Color.js not found!');\r\n\t\t\treturn value;\r\n\t\t} :\r\n\t\tfunction(value) {\r\n\t\t\t/* global CanvasGradient */\r\n\t\t\tif (value instanceof CanvasGradient) {\r\n\t\t\t\tvalue = core_defaults.global.defaultColor;\r\n\t\t\t}\r\n\r\n\t\t\treturn chartjsColor(value);\r\n\t\t};\r\n\r\n\thelpers$1.getHoverColor = function(colorValue) {\r\n\t\t/* global CanvasPattern */\r\n\t\treturn (colorValue instanceof CanvasPattern || colorValue instanceof CanvasGradient) ?\r\n\t\t\tcolorValue :\r\n\t\t\thelpers$1.color(colorValue).saturate(0.5).darken(0.1).rgbString();\r\n\t};\r\n};\n\nfunction abstract() {\r\n\tthrow new Error(\r\n\t\t'This method is not implemented: either no adapter can ' +\r\n\t\t'be found or an incomplete integration was provided.'\r\n\t);\r\n}\r\n\r\n/**\r\n * Date adapter (current used by the time scale)\r\n * @namespace Chart._adapters._date\r\n * @memberof Chart._adapters\r\n * @private\r\n */\r\n\r\n/**\r\n * Currently supported unit string values.\r\n * @typedef {('millisecond'|'second'|'minute'|'hour'|'day'|'week'|'month'|'quarter'|'year')}\r\n * @memberof Chart._adapters._date\r\n * @name Unit\r\n */\r\n\r\n/**\r\n * @class\r\n */\r\nfunction DateAdapter(options) {\r\n\tthis.options = options || {};\r\n}\r\n\r\nhelpers$1.extend(DateAdapter.prototype, /** @lends DateAdapter */ {\r\n\t/**\r\n\t * Returns a map of time formats for the supported formatting units defined\r\n\t * in Unit as well as 'datetime' representing a detailed date/time string.\r\n\t * @returns {{string: string}}\r\n\t */\r\n\tformats: abstract,\r\n\r\n\t/**\r\n\t * Parses the given `value` and return the associated timestamp.\r\n\t * @param {any} value - the value to parse (usually comes from the data)\r\n\t * @param {string} [format] - the expected data format\r\n\t * @returns {(number|null)}\r\n\t * @function\r\n\t */\r\n\tparse: abstract,\r\n\r\n\t/**\r\n\t * Returns the formatted date in the specified `format` for a given `timestamp`.\r\n\t * @param {number} timestamp - the timestamp to format\r\n\t * @param {string} format - the date/time token\r\n\t * @return {string}\r\n\t * @function\r\n\t */\r\n\tformat: abstract,\r\n\r\n\t/**\r\n\t * Adds the specified `amount` of `unit` to the given `timestamp`.\r\n\t * @param {number} timestamp - the input timestamp\r\n\t * @param {number} amount - the amount to add\r\n\t * @param {Unit} unit - the unit as string\r\n\t * @return {number}\r\n\t * @function\r\n\t */\r\n\tadd: abstract,\r\n\r\n\t/**\r\n\t * Returns the number of `unit` between the given timestamps.\r\n\t * @param {number} max - the input timestamp (reference)\r\n\t * @param {number} min - the timestamp to substract\r\n\t * @param {Unit} unit - the unit as string\r\n\t * @return {number}\r\n\t * @function\r\n\t */\r\n\tdiff: abstract,\r\n\r\n\t/**\r\n\t * Returns start of `unit` for the given `timestamp`.\r\n\t * @param {number} timestamp - the input timestamp\r\n\t * @param {Unit} unit - the unit as string\r\n\t * @param {number} [weekday] - the ISO day of the week with 1 being Monday\r\n\t * and 7 being Sunday (only needed if param *unit* is `isoWeek`).\r\n\t * @function\r\n\t */\r\n\tstartOf: abstract,\r\n\r\n\t/**\r\n\t * Returns end of `unit` for the given `timestamp`.\r\n\t * @param {number} timestamp - the input timestamp\r\n\t * @param {Unit} unit - the unit as string\r\n\t * @function\r\n\t */\r\n\tendOf: abstract,\r\n\r\n\t// DEPRECATIONS\r\n\r\n\t/**\r\n\t * Provided for backward compatibility for scale.getValueForPixel(),\r\n\t * this method should be overridden only by the moment adapter.\r\n\t * @deprecated since version 2.8.0\r\n\t * @todo remove at version 3\r\n\t * @private\r\n\t */\r\n\t_create: function(value) {\r\n\t\treturn value;\r\n\t}\r\n});\r\n\r\nDateAdapter.override = function(members) {\r\n\thelpers$1.extend(DateAdapter.prototype, members);\r\n};\r\n\r\nvar _date = DateAdapter;\n\nvar core_adapters = {\n\t_date: _date\n};\n\n/**\r\n * Namespace to hold static tick generation functions\r\n * @namespace Chart.Ticks\r\n */\r\nvar core_ticks = {\r\n\t/**\r\n\t * Namespace to hold formatters for different types of ticks\r\n\t * @namespace Chart.Ticks.formatters\r\n\t */\r\n\tformatters: {\r\n\t\t/**\r\n\t\t * Formatter for value labels\r\n\t\t * @method Chart.Ticks.formatters.values\r\n\t\t * @param value the value to display\r\n\t\t * @return {string|string[]} the label to display\r\n\t\t */\r\n\t\tvalues: function(value) {\r\n\t\t\treturn helpers$1.isArray(value) ? value : '' + value;\r\n\t\t},\r\n\r\n\t\t/**\r\n\t\t * Formatter for linear numeric ticks\r\n\t\t * @method Chart.Ticks.formatters.linear\r\n\t\t * @param tickValue {number} the value to be formatted\r\n\t\t * @param index {number} the position of the tickValue parameter in the ticks array\r\n\t\t * @param ticks {number[]} the list of ticks being converted\r\n\t\t * @return {string} string representation of the tickValue parameter\r\n\t\t */\r\n\t\tlinear: function(tickValue, index, ticks) {\r\n\t\t\t// If we have lots of ticks, don't use the ones\r\n\t\t\tvar delta = ticks.length > 3 ? ticks[2] - ticks[1] : ticks[1] - ticks[0];\r\n\r\n\t\t\t// If we have a number like 2.5 as the delta, figure out how many decimal places we need\r\n\t\t\tif (Math.abs(delta) > 1) {\r\n\t\t\t\tif (tickValue !== Math.floor(tickValue)) {\r\n\t\t\t\t\t// not an integer\r\n\t\t\t\t\tdelta = tickValue - Math.floor(tickValue);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tvar logDelta = helpers$1.log10(Math.abs(delta));\r\n\t\t\tvar tickString = '';\r\n\r\n\t\t\tif (tickValue !== 0) {\r\n\t\t\t\tvar maxTick = Math.max(Math.abs(ticks[0]), Math.abs(ticks[ticks.length - 1]));\r\n\t\t\t\tif (maxTick < 1e-4) { // all ticks are small numbers; use scientific notation\r\n\t\t\t\t\tvar logTick = helpers$1.log10(Math.abs(tickValue));\r\n\t\t\t\t\tvar numExponential = Math.floor(logTick) - Math.floor(logDelta);\r\n\t\t\t\t\tnumExponential = Math.max(Math.min(numExponential, 20), 0);\r\n\t\t\t\t\ttickString = tickValue.toExponential(numExponential);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvar numDecimal = -1 * Math.floor(logDelta);\r\n\t\t\t\t\tnumDecimal = Math.max(Math.min(numDecimal, 20), 0); // toFixed has a max of 20 decimal places\r\n\t\t\t\t\ttickString = tickValue.toFixed(numDecimal);\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\ttickString = '0'; // never show decimal places for 0\r\n\t\t\t}\r\n\r\n\t\t\treturn tickString;\r\n\t\t},\r\n\r\n\t\tlogarithmic: function(tickValue, index, ticks) {\r\n\t\t\tvar remain = tickValue / (Math.pow(10, Math.floor(helpers$1.log10(tickValue))));\r\n\r\n\t\t\tif (tickValue === 0) {\r\n\t\t\t\treturn '0';\r\n\t\t\t} else if (remain === 1 || remain === 2 || remain === 5 || index === 0 || index === ticks.length - 1) {\r\n\t\t\t\treturn tickValue.toExponential();\r\n\t\t\t}\r\n\t\t\treturn '';\r\n\t\t}\r\n\t}\r\n};\n\nvar isArray = helpers$1.isArray;\r\nvar isNullOrUndef = helpers$1.isNullOrUndef;\r\nvar valueOrDefault$a = helpers$1.valueOrDefault;\r\nvar valueAtIndexOrDefault = helpers$1.valueAtIndexOrDefault;\r\n\r\ncore_defaults._set('scale', {\r\n\tdisplay: true,\r\n\tposition: 'left',\r\n\toffset: false,\r\n\r\n\t// grid line settings\r\n\tgridLines: {\r\n\t\tdisplay: true,\r\n\t\tcolor: 'rgba(0,0,0,0.1)',\r\n\t\tlineWidth: 1,\r\n\t\tdrawBorder: true,\r\n\t\tdrawOnChartArea: true,\r\n\t\tdrawTicks: true,\r\n\t\ttickMarkLength: 10,\r\n\t\tzeroLineWidth: 1,\r\n\t\tzeroLineColor: 'rgba(0,0,0,0.25)',\r\n\t\tzeroLineBorderDash: [],\r\n\t\tzeroLineBorderDashOffset: 0.0,\r\n\t\toffsetGridLines: false,\r\n\t\tborderDash: [],\r\n\t\tborderDashOffset: 0.0\r\n\t},\r\n\r\n\t// scale label\r\n\tscaleLabel: {\r\n\t\t// display property\r\n\t\tdisplay: false,\r\n\r\n\t\t// actual label\r\n\t\tlabelString: '',\r\n\r\n\t\t// top/bottom padding\r\n\t\tpadding: {\r\n\t\t\ttop: 4,\r\n\t\t\tbottom: 4\r\n\t\t}\r\n\t},\r\n\r\n\t// label settings\r\n\tticks: {\r\n\t\tbeginAtZero: false,\r\n\t\tminRotation: 0,\r\n\t\tmaxRotation: 50,\r\n\t\tmirror: false,\r\n\t\tpadding: 0,\r\n\t\treverse: false,\r\n\t\tdisplay: true,\r\n\t\tautoSkip: true,\r\n\t\tautoSkipPadding: 0,\r\n\t\tlabelOffset: 0,\r\n\t\t// We pass through arrays to be rendered as multiline labels, we convert Others to strings here.\r\n\t\tcallback: core_ticks.formatters.values,\r\n\t\tminor: {},\r\n\t\tmajor: {}\r\n\t}\r\n});\r\n\r\n/** Returns a new array containing numItems from arr */\r\nfunction sample(arr, numItems) {\r\n\tvar result = [];\r\n\tvar increment = arr.length / numItems;\r\n\tvar i = 0;\r\n\tvar len = arr.length;\r\n\r\n\tfor (; i < len; i += increment) {\r\n\t\tresult.push(arr[Math.floor(i)]);\r\n\t}\r\n\treturn result;\r\n}\r\n\r\nfunction getPixelForGridLine(scale, index, offsetGridLines) {\r\n\tvar length = scale.getTicks().length;\r\n\tvar validIndex = Math.min(index, length - 1);\r\n\tvar lineValue = scale.getPixelForTick(validIndex);\r\n\tvar start = scale._startPixel;\r\n\tvar end = scale._endPixel;\r\n\tvar epsilon = 1e-6; // 1e-6 is margin in pixels for accumulated error.\r\n\tvar offset;\r\n\r\n\tif (offsetGridLines) {\r\n\t\tif (length === 1) {\r\n\t\t\toffset = Math.max(lineValue - start, end - lineValue);\r\n\t\t} else if (index === 0) {\r\n\t\t\toffset = (scale.getPixelForTick(1) - lineValue) / 2;\r\n\t\t} else {\r\n\t\t\toffset = (lineValue - scale.getPixelForTick(validIndex - 1)) / 2;\r\n\t\t}\r\n\t\tlineValue += validIndex < index ? offset : -offset;\r\n\r\n\t\t// Return undefined if the pixel is out of the range\r\n\t\tif (lineValue < start - epsilon || lineValue > end + epsilon) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t}\r\n\treturn lineValue;\r\n}\r\n\r\nfunction garbageCollect(caches, length) {\r\n\thelpers$1.each(caches, function(cache) {\r\n\t\tvar gc = cache.gc;\r\n\t\tvar gcLen = gc.length / 2;\r\n\t\tvar i;\r\n\t\tif (gcLen > length) {\r\n\t\t\tfor (i = 0; i < gcLen; ++i) {\r\n\t\t\t\tdelete cache.data[gc[i]];\r\n\t\t\t}\r\n\t\t\tgc.splice(0, gcLen);\r\n\t\t}\r\n\t});\r\n}\r\n\r\n/**\r\n * Returns {width, height, offset} objects for the first, last, widest, highest tick\r\n * labels where offset indicates the anchor point offset from the top in pixels.\r\n */\r\nfunction computeLabelSizes(ctx, tickFonts, ticks, caches) {\r\n\tvar length = ticks.length;\r\n\tvar widths = [];\r\n\tvar heights = [];\r\n\tvar offsets = [];\r\n\tvar widestLabelSize = 0;\r\n\tvar highestLabelSize = 0;\r\n\tvar i, j, jlen, label, tickFont, fontString, cache, lineHeight, width, height, nestedLabel, widest, highest;\r\n\r\n\tfor (i = 0; i < length; ++i) {\r\n\t\tlabel = ticks[i].label;\r\n\t\ttickFont = ticks[i].major ? tickFonts.major : tickFonts.minor;\r\n\t\tctx.font = fontString = tickFont.string;\r\n\t\tcache = caches[fontString] = caches[fontString] || {data: {}, gc: []};\r\n\t\tlineHeight = tickFont.lineHeight;\r\n\t\twidth = height = 0;\r\n\t\t// Undefined labels and arrays should not be measured\r\n\t\tif (!isNullOrUndef(label) && !isArray(label)) {\r\n\t\t\twidth = helpers$1.measureText(ctx, cache.data, cache.gc, width, label);\r\n\t\t\theight = lineHeight;\r\n\t\t} else if (isArray(label)) {\r\n\t\t\t// if it is an array let's measure each element\r\n\t\t\tfor (j = 0, jlen = label.length; j < jlen; ++j) {\r\n\t\t\t\tnestedLabel = label[j];\r\n\t\t\t\t// Undefined labels and arrays should not be measured\r\n\t\t\t\tif (!isNullOrUndef(nestedLabel) && !isArray(nestedLabel)) {\r\n\t\t\t\t\twidth = helpers$1.measureText(ctx, cache.data, cache.gc, width, nestedLabel);\r\n\t\t\t\t\theight += lineHeight;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\twidths.push(width);\r\n\t\theights.push(height);\r\n\t\toffsets.push(lineHeight / 2);\r\n\t\twidestLabelSize = Math.max(width, widestLabelSize);\r\n\t\thighestLabelSize = Math.max(height, highestLabelSize);\r\n\t}\r\n\tgarbageCollect(caches, length);\r\n\r\n\twidest = widths.indexOf(widestLabelSize);\r\n\thighest = heights.indexOf(highestLabelSize);\r\n\r\n\tfunction valueAt(idx) {\r\n\t\treturn {\r\n\t\t\twidth: widths[idx] || 0,\r\n\t\t\theight: heights[idx] || 0,\r\n\t\t\toffset: offsets[idx] || 0\r\n\t\t};\r\n\t}\r\n\r\n\treturn {\r\n\t\tfirst: valueAt(0),\r\n\t\tlast: valueAt(length - 1),\r\n\t\twidest: valueAt(widest),\r\n\t\thighest: valueAt(highest)\r\n\t};\r\n}\r\n\r\nfunction getTickMarkLength(options) {\r\n\treturn options.drawTicks ? options.tickMarkLength : 0;\r\n}\r\n\r\nfunction getScaleLabelHeight(options) {\r\n\tvar font, padding;\r\n\r\n\tif (!options.display) {\r\n\t\treturn 0;\r\n\t}\r\n\r\n\tfont = helpers$1.options._parseFont(options);\r\n\tpadding = helpers$1.options.toPadding(options.padding);\r\n\r\n\treturn font.lineHeight + padding.height;\r\n}\r\n\r\nfunction parseFontOptions(options, nestedOpts) {\r\n\treturn helpers$1.extend(helpers$1.options._parseFont({\r\n\t\tfontFamily: valueOrDefault$a(nestedOpts.fontFamily, options.fontFamily),\r\n\t\tfontSize: valueOrDefault$a(nestedOpts.fontSize, options.fontSize),\r\n\t\tfontStyle: valueOrDefault$a(nestedOpts.fontStyle, options.fontStyle),\r\n\t\tlineHeight: valueOrDefault$a(nestedOpts.lineHeight, options.lineHeight)\r\n\t}), {\r\n\t\tcolor: helpers$1.options.resolve([nestedOpts.fontColor, options.fontColor, core_defaults.global.defaultFontColor])\r\n\t});\r\n}\r\n\r\nfunction parseTickFontOptions(options) {\r\n\tvar minor = parseFontOptions(options, options.minor);\r\n\tvar major = options.major.enabled ? parseFontOptions(options, options.major) : minor;\r\n\r\n\treturn {minor: minor, major: major};\r\n}\r\n\r\nfunction nonSkipped(ticksToFilter) {\r\n\tvar filtered = [];\r\n\tvar item, index, len;\r\n\tfor (index = 0, len = ticksToFilter.length; index < len; ++index) {\r\n\t\titem = ticksToFilter[index];\r\n\t\tif (typeof item._index !== 'undefined') {\r\n\t\t\tfiltered.push(item);\r\n\t\t}\r\n\t}\r\n\treturn filtered;\r\n}\r\n\r\nfunction getEvenSpacing(arr) {\r\n\tvar len = arr.length;\r\n\tvar i, diff;\r\n\r\n\tif (len < 2) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tfor (diff = arr[0], i = 1; i < len; ++i) {\r\n\t\tif (arr[i] - arr[i - 1] !== diff) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\treturn diff;\r\n}\r\n\r\nfunction calculateSpacing(majorIndices, ticks, axisLength, ticksLimit) {\r\n\tvar evenMajorSpacing = getEvenSpacing(majorIndices);\r\n\tvar spacing = (ticks.length - 1) / ticksLimit;\r\n\tvar factors, factor, i, ilen;\r\n\r\n\t// If the major ticks are evenly spaced apart, place the minor ticks\r\n\t// so that they divide the major ticks into even chunks\r\n\tif (!evenMajorSpacing) {\r\n\t\treturn Math.max(spacing, 1);\r\n\t}\r\n\r\n\tfactors = helpers$1.math._factorize(evenMajorSpacing);\r\n\tfor (i = 0, ilen = factors.length - 1; i < ilen; i++) {\r\n\t\tfactor = factors[i];\r\n\t\tif (factor > spacing) {\r\n\t\t\treturn factor;\r\n\t\t}\r\n\t}\r\n\treturn Math.max(spacing, 1);\r\n}\r\n\r\nfunction getMajorIndices(ticks) {\r\n\tvar result = [];\r\n\tvar i, ilen;\r\n\tfor (i = 0, ilen = ticks.length; i < ilen; i++) {\r\n\t\tif (ticks[i].major) {\r\n\t\t\tresult.push(i);\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n}\r\n\r\nfunction skipMajors(ticks, majorIndices, spacing) {\r\n\tvar count = 0;\r\n\tvar next = majorIndices[0];\r\n\tvar i, tick;\r\n\r\n\tspacing = Math.ceil(spacing);\r\n\tfor (i = 0; i < ticks.length; i++) {\r\n\t\ttick = ticks[i];\r\n\t\tif (i === next) {\r\n\t\t\ttick._index = i;\r\n\t\t\tcount++;\r\n\t\t\tnext = majorIndices[count * spacing];\r\n\t\t} else {\r\n\t\t\tdelete tick.label;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nfunction skip(ticks, spacing, majorStart, majorEnd) {\r\n\tvar start = valueOrDefault$a(majorStart, 0);\r\n\tvar end = Math.min(valueOrDefault$a(majorEnd, ticks.length), ticks.length);\r\n\tvar count = 0;\r\n\tvar length, i, tick, next;\r\n\r\n\tspacing = Math.ceil(spacing);\r\n\tif (majorEnd) {\r\n\t\tlength = majorEnd - majorStart;\r\n\t\tspacing = length / Math.floor(length / spacing);\r\n\t}\r\n\r\n\tnext = start;\r\n\r\n\twhile (next < 0) {\r\n\t\tcount++;\r\n\t\tnext = Math.round(start + count * spacing);\r\n\t}\r\n\r\n\tfor (i = Math.max(start, 0); i < end; i++) {\r\n\t\ttick = ticks[i];\r\n\t\tif (i === next) {\r\n\t\t\ttick._index = i;\r\n\t\t\tcount++;\r\n\t\t\tnext = Math.round(start + count * spacing);\r\n\t\t} else {\r\n\t\t\tdelete tick.label;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvar Scale = core_element.extend({\r\n\r\n\tzeroLineIndex: 0,\r\n\r\n\t/**\r\n\t * Get the padding needed for the scale\r\n\t * @method getPadding\r\n\t * @private\r\n\t * @returns {Padding} the necessary padding\r\n\t */\r\n\tgetPadding: function() {\r\n\t\tvar me = this;\r\n\t\treturn {\r\n\t\t\tleft: me.paddingLeft || 0,\r\n\t\t\ttop: me.paddingTop || 0,\r\n\t\t\tright: me.paddingRight || 0,\r\n\t\t\tbottom: me.paddingBottom || 0\r\n\t\t};\r\n\t},\r\n\r\n\t/**\r\n\t * Returns the scale tick objects ({label, major})\r\n\t * @since 2.7\r\n\t */\r\n\tgetTicks: function() {\r\n\t\treturn this._ticks;\r\n\t},\r\n\r\n\t/**\r\n\t* @private\r\n\t*/\r\n\t_getLabels: function() {\r\n\t\tvar data = this.chart.data;\r\n\t\treturn this.options.labels || (this.isHorizontal() ? data.xLabels : data.yLabels) || data.labels || [];\r\n\t},\r\n\r\n\t// These methods are ordered by lifecyle. Utilities then follow.\r\n\t// Any function defined here is inherited by all scale types.\r\n\t// Any function can be extended by the scale type\r\n\r\n\t/**\r\n\t * Provided for backward compatibility, not available anymore\r\n\t * @function Chart.Scale.mergeTicksOptions\r\n\t * @deprecated since version 2.8.0\r\n\t * @todo remove at version 3\r\n\t */\r\n\tmergeTicksOptions: function() {\r\n\t\t// noop\r\n\t},\r\n\r\n\tbeforeUpdate: function() {\r\n\t\thelpers$1.callback(this.options.beforeUpdate, [this]);\r\n\t},\r\n\r\n\t/**\r\n\t * @param {number} maxWidth - the max width in pixels\r\n\t * @param {number} maxHeight - the max height in pixels\r\n\t * @param {object} margins - the space between the edge of the other scales and edge of the chart\r\n\t * This space comes from two sources:\r\n\t * - padding - space that's required to show the labels at the edges of the scale\r\n\t * - thickness of scales or legends in another orientation\r\n\t */\r\n\tupdate: function(maxWidth, maxHeight, margins) {\r\n\t\tvar me = this;\r\n\t\tvar tickOpts = me.options.ticks;\r\n\t\tvar sampleSize = tickOpts.sampleSize;\r\n\t\tvar i, ilen, labels, ticks, samplingEnabled;\r\n\r\n\t\t// Update Lifecycle - Probably don't want to ever extend or overwrite this function ;)\r\n\t\tme.beforeUpdate();\r\n\r\n\t\t// Absorb the master measurements\r\n\t\tme.maxWidth = maxWidth;\r\n\t\tme.maxHeight = maxHeight;\r\n\t\tme.margins = helpers$1.extend({\r\n\t\t\tleft: 0,\r\n\t\t\tright: 0,\r\n\t\t\ttop: 0,\r\n\t\t\tbottom: 0\r\n\t\t}, margins);\r\n\r\n\t\tme._ticks = null;\r\n\t\tme.ticks = null;\r\n\t\tme._labelSizes = null;\r\n\t\tme._maxLabelLines = 0;\r\n\t\tme.longestLabelWidth = 0;\r\n\t\tme.longestTextCache = me.longestTextCache || {};\r\n\t\tme._gridLineItems = null;\r\n\t\tme._labelItems = null;\r\n\r\n\t\t// Dimensions\r\n\t\tme.beforeSetDimensions();\r\n\t\tme.setDimensions();\r\n\t\tme.afterSetDimensions();\r\n\r\n\t\t// Data min/max\r\n\t\tme.beforeDataLimits();\r\n\t\tme.determineDataLimits();\r\n\t\tme.afterDataLimits();\r\n\r\n\t\t// Ticks - `this.ticks` is now DEPRECATED!\r\n\t\t// Internal ticks are now stored as objects in the PRIVATE `this._ticks` member\r\n\t\t// and must not be accessed directly from outside this class. `this.ticks` being\r\n\t\t// around for long time and not marked as private, we can't change its structure\r\n\t\t// without unexpected breaking changes. If you need to access the scale ticks,\r\n\t\t// use scale.getTicks() instead.\r\n\r\n\t\tme.beforeBuildTicks();\r\n\r\n\t\t// New implementations should return an array of objects but for BACKWARD COMPAT,\r\n\t\t// we still support no return (`this.ticks` internally set by calling this method).\r\n\t\tticks = me.buildTicks() || [];\r\n\r\n\t\t// Allow modification of ticks in callback.\r\n\t\tticks = me.afterBuildTicks(ticks) || ticks;\r\n\r\n\t\t// Ensure ticks contains ticks in new tick format\r\n\t\tif ((!ticks || !ticks.length) && me.ticks) {\r\n\t\t\tticks = [];\r\n\t\t\tfor (i = 0, ilen = me.ticks.length; i < ilen; ++i) {\r\n\t\t\t\tticks.push({\r\n\t\t\t\t\tvalue: me.ticks[i],\r\n\t\t\t\t\tmajor: false\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tme._ticks = ticks;\r\n\r\n\t\t// Compute tick rotation and fit using a sampled subset of labels\r\n\t\t// We generally don't need to compute the size of every single label for determining scale size\r\n\t\tsamplingEnabled = sampleSize < ticks.length;\r\n\t\tlabels = me._convertTicksToLabels(samplingEnabled ? sample(ticks, sampleSize) : ticks);\r\n\r\n\t\t// _configure is called twice, once here, once from core.controller.updateLayout.\r\n\t\t// Here we haven't been positioned yet, but dimensions are correct.\r\n\t\t// Variables set in _configure are needed for calculateTickRotation, and\r\n\t\t// it's ok that coordinates are not correct there, only dimensions matter.\r\n\t\tme._configure();\r\n\r\n\t\t// Tick Rotation\r\n\t\tme.beforeCalculateTickRotation();\r\n\t\tme.calculateTickRotation();\r\n\t\tme.afterCalculateTickRotation();\r\n\r\n\t\tme.beforeFit();\r\n\t\tme.fit();\r\n\t\tme.afterFit();\r\n\r\n\t\t// Auto-skip\r\n\t\tme._ticksToDraw = tickOpts.display && (tickOpts.autoSkip || tickOpts.source === 'auto') ? me._autoSkip(ticks) : ticks;\r\n\r\n\t\tif (samplingEnabled) {\r\n\t\t\t// Generate labels using all non-skipped ticks\r\n\t\t\tlabels = me._convertTicksToLabels(me._ticksToDraw);\r\n\t\t}\r\n\r\n\t\tme.ticks = labels; // BACKWARD COMPATIBILITY\r\n\r\n\t\t// IMPORTANT: after this point, we consider that `this.ticks` will NEVER change!\r\n\r\n\t\tme.afterUpdate();\r\n\r\n\t\t// TODO(v3): remove minSize as a public property and return value from all layout boxes. It is unused\r\n\t\t// make maxWidth and maxHeight private\r\n\t\treturn me.minSize;\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_configure: function() {\r\n\t\tvar me = this;\r\n\t\tvar reversePixels = me.options.ticks.reverse;\r\n\t\tvar startPixel, endPixel;\r\n\r\n\t\tif (me.isHorizontal()) {\r\n\t\t\tstartPixel = me.left;\r\n\t\t\tendPixel = me.right;\r\n\t\t} else {\r\n\t\t\tstartPixel = me.top;\r\n\t\t\tendPixel = me.bottom;\r\n\t\t\t// by default vertical scales are from bottom to top, so pixels are reversed\r\n\t\t\treversePixels = !reversePixels;\r\n\t\t}\r\n\t\tme._startPixel = startPixel;\r\n\t\tme._endPixel = endPixel;\r\n\t\tme._reversePixels = reversePixels;\r\n\t\tme._length = endPixel - startPixel;\r\n\t},\r\n\r\n\tafterUpdate: function() {\r\n\t\thelpers$1.callback(this.options.afterUpdate, [this]);\r\n\t},\r\n\r\n\t//\r\n\r\n\tbeforeSetDimensions: function() {\r\n\t\thelpers$1.callback(this.options.beforeSetDimensions, [this]);\r\n\t},\r\n\tsetDimensions: function() {\r\n\t\tvar me = this;\r\n\t\t// Set the unconstrained dimension before label rotation\r\n\t\tif (me.isHorizontal()) {\r\n\t\t\t// Reset position before calculating rotation\r\n\t\t\tme.width = me.maxWidth;\r\n\t\t\tme.left = 0;\r\n\t\t\tme.right = me.width;\r\n\t\t} else {\r\n\t\t\tme.height = me.maxHeight;\r\n\r\n\t\t\t// Reset position before calculating rotation\r\n\t\t\tme.top = 0;\r\n\t\t\tme.bottom = me.height;\r\n\t\t}\r\n\r\n\t\t// Reset padding\r\n\t\tme.paddingLeft = 0;\r\n\t\tme.paddingTop = 0;\r\n\t\tme.paddingRight = 0;\r\n\t\tme.paddingBottom = 0;\r\n\t},\r\n\tafterSetDimensions: function() {\r\n\t\thelpers$1.callback(this.options.afterSetDimensions, [this]);\r\n\t},\r\n\r\n\t// Data limits\r\n\tbeforeDataLimits: function() {\r\n\t\thelpers$1.callback(this.options.beforeDataLimits, [this]);\r\n\t},\r\n\tdetermineDataLimits: helpers$1.noop,\r\n\tafterDataLimits: function() {\r\n\t\thelpers$1.callback(this.options.afterDataLimits, [this]);\r\n\t},\r\n\r\n\t//\r\n\tbeforeBuildTicks: function() {\r\n\t\thelpers$1.callback(this.options.beforeBuildTicks, [this]);\r\n\t},\r\n\tbuildTicks: helpers$1.noop,\r\n\tafterBuildTicks: function(ticks) {\r\n\t\tvar me = this;\r\n\t\t// ticks is empty for old axis implementations here\r\n\t\tif (isArray(ticks) && ticks.length) {\r\n\t\t\treturn helpers$1.callback(me.options.afterBuildTicks, [me, ticks]);\r\n\t\t}\r\n\t\t// Support old implementations (that modified `this.ticks` directly in buildTicks)\r\n\t\tme.ticks = helpers$1.callback(me.options.afterBuildTicks, [me, me.ticks]) || me.ticks;\r\n\t\treturn ticks;\r\n\t},\r\n\r\n\tbeforeTickToLabelConversion: function() {\r\n\t\thelpers$1.callback(this.options.beforeTickToLabelConversion, [this]);\r\n\t},\r\n\tconvertTicksToLabels: function() {\r\n\t\tvar me = this;\r\n\t\t// Convert ticks to strings\r\n\t\tvar tickOpts = me.options.ticks;\r\n\t\tme.ticks = me.ticks.map(tickOpts.userCallback || tickOpts.callback, this);\r\n\t},\r\n\tafterTickToLabelConversion: function() {\r\n\t\thelpers$1.callback(this.options.afterTickToLabelConversion, [this]);\r\n\t},\r\n\r\n\t//\r\n\r\n\tbeforeCalculateTickRotation: function() {\r\n\t\thelpers$1.callback(this.options.beforeCalculateTickRotation, [this]);\r\n\t},\r\n\tcalculateTickRotation: function() {\r\n\t\tvar me = this;\r\n\t\tvar options = me.options;\r\n\t\tvar tickOpts = options.ticks;\r\n\t\tvar numTicks = me.getTicks().length;\r\n\t\tvar minRotation = tickOpts.minRotation || 0;\r\n\t\tvar maxRotation = tickOpts.maxRotation;\r\n\t\tvar labelRotation = minRotation;\r\n\t\tvar labelSizes, maxLabelWidth, maxLabelHeight, maxWidth, tickWidth, maxHeight, maxLabelDiagonal;\r\n\r\n\t\tif (!me._isVisible() || !tickOpts.display || minRotation >= maxRotation || numTicks <= 1 || !me.isHorizontal()) {\r\n\t\t\tme.labelRotation = minRotation;\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlabelSizes = me._getLabelSizes();\r\n\t\tmaxLabelWidth = labelSizes.widest.width;\r\n\t\tmaxLabelHeight = labelSizes.highest.height - labelSizes.highest.offset;\r\n\r\n\t\t// Estimate the width of each grid based on the canvas width, the maximum\r\n\t\t// label width and the number of tick intervals\r\n\t\tmaxWidth = Math.min(me.maxWidth, me.chart.width - maxLabelWidth);\r\n\t\ttickWidth = options.offset ? me.maxWidth / numTicks : maxWidth / (numTicks - 1);\r\n\r\n\t\t// Allow 3 pixels x2 padding either side for label readability\r\n\t\tif (maxLabelWidth + 6 > tickWidth) {\r\n\t\t\ttickWidth = maxWidth / (numTicks - (options.offset ? 0.5 : 1));\r\n\t\t\tmaxHeight = me.maxHeight - getTickMarkLength(options.gridLines)\r\n\t\t\t\t- tickOpts.padding - getScaleLabelHeight(options.scaleLabel);\r\n\t\t\tmaxLabelDiagonal = Math.sqrt(maxLabelWidth * maxLabelWidth + maxLabelHeight * maxLabelHeight);\r\n\t\t\tlabelRotation = helpers$1.toDegrees(Math.min(\r\n\t\t\t\tMath.asin(Math.min((labelSizes.highest.height + 6) / tickWidth, 1)),\r\n\t\t\t\tMath.asin(Math.min(maxHeight / maxLabelDiagonal, 1)) - Math.asin(maxLabelHeight / maxLabelDiagonal)\r\n\t\t\t));\r\n\t\t\tlabelRotation = Math.max(minRotation, Math.min(maxRotation, labelRotation));\r\n\t\t}\r\n\r\n\t\tme.labelRotation = labelRotation;\r\n\t},\r\n\tafterCalculateTickRotation: function() {\r\n\t\thelpers$1.callback(this.options.afterCalculateTickRotation, [this]);\r\n\t},\r\n\r\n\t//\r\n\r\n\tbeforeFit: function() {\r\n\t\thelpers$1.callback(this.options.beforeFit, [this]);\r\n\t},\r\n\tfit: function() {\r\n\t\tvar me = this;\r\n\t\t// Reset\r\n\t\tvar minSize = me.minSize = {\r\n\t\t\twidth: 0,\r\n\t\t\theight: 0\r\n\t\t};\r\n\r\n\t\tvar chart = me.chart;\r\n\t\tvar opts = me.options;\r\n\t\tvar tickOpts = opts.ticks;\r\n\t\tvar scaleLabelOpts = opts.scaleLabel;\r\n\t\tvar gridLineOpts = opts.gridLines;\r\n\t\tvar display = me._isVisible();\r\n\t\tvar isBottom = opts.position === 'bottom';\r\n\t\tvar isHorizontal = me.isHorizontal();\r\n\r\n\t\t// Width\r\n\t\tif (isHorizontal) {\r\n\t\t\tminSize.width = me.maxWidth;\r\n\t\t} else if (display) {\r\n\t\t\tminSize.width = getTickMarkLength(gridLineOpts) + getScaleLabelHeight(scaleLabelOpts);\r\n\t\t}\r\n\r\n\t\t// height\r\n\t\tif (!isHorizontal) {\r\n\t\t\tminSize.height = me.maxHeight; // fill all the height\r\n\t\t} else if (display) {\r\n\t\t\tminSize.height = getTickMarkLength(gridLineOpts) + getScaleLabelHeight(scaleLabelOpts);\r\n\t\t}\r\n\r\n\t\t// Don't bother fitting the ticks if we are not showing the labels\r\n\t\tif (tickOpts.display && display) {\r\n\t\t\tvar tickFonts = parseTickFontOptions(tickOpts);\r\n\t\t\tvar labelSizes = me._getLabelSizes();\r\n\t\t\tvar firstLabelSize = labelSizes.first;\r\n\t\t\tvar lastLabelSize = labelSizes.last;\r\n\t\t\tvar widestLabelSize = labelSizes.widest;\r\n\t\t\tvar highestLabelSize = labelSizes.highest;\r\n\t\t\tvar lineSpace = tickFonts.minor.lineHeight * 0.4;\r\n\t\t\tvar tickPadding = tickOpts.padding;\r\n\r\n\t\t\tif (isHorizontal) {\r\n\t\t\t\t// A horizontal axis is more constrained by the height.\r\n\t\t\t\tvar isRotated = me.labelRotation !== 0;\r\n\t\t\t\tvar angleRadians = helpers$1.toRadians(me.labelRotation);\r\n\t\t\t\tvar cosRotation = Math.cos(angleRadians);\r\n\t\t\t\tvar sinRotation = Math.sin(angleRadians);\r\n\r\n\t\t\t\tvar labelHeight = sinRotation * widestLabelSize.width\r\n\t\t\t\t\t+ cosRotation * (highestLabelSize.height - (isRotated ? highestLabelSize.offset : 0))\r\n\t\t\t\t\t+ (isRotated ? 0 : lineSpace); // padding\r\n\r\n\t\t\t\tminSize.height = Math.min(me.maxHeight, minSize.height + labelHeight + tickPadding);\r\n\r\n\t\t\t\tvar offsetLeft = me.getPixelForTick(0) - me.left;\r\n\t\t\t\tvar offsetRight = me.right - me.getPixelForTick(me.getTicks().length - 1);\r\n\t\t\t\tvar paddingLeft, paddingRight;\r\n\r\n\t\t\t\t// Ensure that our ticks are always inside the canvas. When rotated, ticks are right aligned\r\n\t\t\t\t// which means that the right padding is dominated by the font height\r\n\t\t\t\tif (isRotated) {\r\n\t\t\t\t\tpaddingLeft = isBottom ?\r\n\t\t\t\t\t\tcosRotation * firstLabelSize.width + sinRotation * firstLabelSize.offset :\r\n\t\t\t\t\t\tsinRotation * (firstLabelSize.height - firstLabelSize.offset);\r\n\t\t\t\t\tpaddingRight = isBottom ?\r\n\t\t\t\t\t\tsinRotation * (lastLabelSize.height - lastLabelSize.offset) :\r\n\t\t\t\t\t\tcosRotation * lastLabelSize.width + sinRotation * lastLabelSize.offset;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tpaddingLeft = firstLabelSize.width / 2;\r\n\t\t\t\t\tpaddingRight = lastLabelSize.width / 2;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Adjust padding taking into account changes in offsets\r\n\t\t\t\t// and add 3 px to move away from canvas edges\r\n\t\t\t\tme.paddingLeft = Math.max((paddingLeft - offsetLeft) * me.width / (me.width - offsetLeft), 0) + 3;\r\n\t\t\t\tme.paddingRight = Math.max((paddingRight - offsetRight) * me.width / (me.width - offsetRight), 0) + 3;\r\n\t\t\t} else {\r\n\t\t\t\t// A vertical axis is more constrained by the width. Labels are the\r\n\t\t\t\t// dominant factor here, so get that length first and account for padding\r\n\t\t\t\tvar labelWidth = tickOpts.mirror ? 0 :\r\n\t\t\t\t\t// use lineSpace for consistency with horizontal axis\r\n\t\t\t\t\t// tickPadding is not implemented for horizontal\r\n\t\t\t\t\twidestLabelSize.width + tickPadding + lineSpace;\r\n\r\n\t\t\t\tminSize.width = Math.min(me.maxWidth, minSize.width + labelWidth);\r\n\r\n\t\t\t\tme.paddingTop = firstLabelSize.height / 2;\r\n\t\t\t\tme.paddingBottom = lastLabelSize.height / 2;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tme.handleMargins();\r\n\r\n\t\tif (isHorizontal) {\r\n\t\t\tme.width = me._length = chart.width - me.margins.left - me.margins.right;\r\n\t\t\tme.height = minSize.height;\r\n\t\t} else {\r\n\t\t\tme.width = minSize.width;\r\n\t\t\tme.height = me._length = chart.height - me.margins.top - me.margins.bottom;\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Handle margins and padding interactions\r\n\t * @private\r\n\t */\r\n\thandleMargins: function() {\r\n\t\tvar me = this;\r\n\t\tif (me.margins) {\r\n\t\t\tme.margins.left = Math.max(me.paddingLeft, me.margins.left);\r\n\t\t\tme.margins.top = Math.max(me.paddingTop, me.margins.top);\r\n\t\t\tme.margins.right = Math.max(me.paddingRight, me.margins.right);\r\n\t\t\tme.margins.bottom = Math.max(me.paddingBottom, me.margins.bottom);\r\n\t\t}\r\n\t},\r\n\r\n\tafterFit: function() {\r\n\t\thelpers$1.callback(this.options.afterFit, [this]);\r\n\t},\r\n\r\n\t// Shared Methods\r\n\tisHorizontal: function() {\r\n\t\tvar pos = this.options.position;\r\n\t\treturn pos === 'top' || pos === 'bottom';\r\n\t},\r\n\tisFullWidth: function() {\r\n\t\treturn this.options.fullWidth;\r\n\t},\r\n\r\n\t// Get the correct value. NaN bad inputs, If the value type is object get the x or y based on whether we are horizontal or not\r\n\tgetRightValue: function(rawValue) {\r\n\t\t// Null and undefined values first\r\n\t\tif (isNullOrUndef(rawValue)) {\r\n\t\t\treturn NaN;\r\n\t\t}\r\n\t\t// isNaN(object) returns true, so make sure NaN is checking for a number; Discard Infinite values\r\n\t\tif ((typeof rawValue === 'number' || rawValue instanceof Number) && !isFinite(rawValue)) {\r\n\t\t\treturn NaN;\r\n\t\t}\r\n\r\n\t\t// If it is in fact an object, dive in one more level\r\n\t\tif (rawValue) {\r\n\t\t\tif (this.isHorizontal()) {\r\n\t\t\t\tif (rawValue.x !== undefined) {\r\n\t\t\t\t\treturn this.getRightValue(rawValue.x);\r\n\t\t\t\t}\r\n\t\t\t} else if (rawValue.y !== undefined) {\r\n\t\t\t\treturn this.getRightValue(rawValue.y);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Value is good, return it\r\n\t\treturn rawValue;\r\n\t},\r\n\r\n\t_convertTicksToLabels: function(ticks) {\r\n\t\tvar me = this;\r\n\t\tvar labels, i, ilen;\r\n\r\n\t\tme.ticks = ticks.map(function(tick) {\r\n\t\t\treturn tick.value;\r\n\t\t});\r\n\r\n\t\tme.beforeTickToLabelConversion();\r\n\r\n\t\t// New implementations should return the formatted tick labels but for BACKWARD\r\n\t\t// COMPAT, we still support no return (`this.ticks` internally changed by calling\r\n\t\t// this method and supposed to contain only string values).\r\n\t\tlabels = me.convertTicksToLabels(ticks) || me.ticks;\r\n\r\n\t\tme.afterTickToLabelConversion();\r\n\r\n\t\t// BACKWARD COMPAT: synchronize `_ticks` with labels (so potentially `this.ticks`)\r\n\t\tfor (i = 0, ilen = ticks.length; i < ilen; ++i) {\r\n\t\t\tticks[i].label = labels[i];\r\n\t\t}\r\n\r\n\t\treturn labels;\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_getLabelSizes: function() {\r\n\t\tvar me = this;\r\n\t\tvar labelSizes = me._labelSizes;\r\n\r\n\t\tif (!labelSizes) {\r\n\t\t\tme._labelSizes = labelSizes = computeLabelSizes(me.ctx, parseTickFontOptions(me.options.ticks), me.getTicks(), me.longestTextCache);\r\n\t\t\tme.longestLabelWidth = labelSizes.widest.width;\r\n\t\t}\r\n\r\n\t\treturn labelSizes;\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_parseValue: function(value) {\r\n\t\tvar start, end, min, max;\r\n\r\n\t\tif (isArray(value)) {\r\n\t\t\tstart = +this.getRightValue(value[0]);\r\n\t\t\tend = +this.getRightValue(value[1]);\r\n\t\t\tmin = Math.min(start, end);\r\n\t\t\tmax = Math.max(start, end);\r\n\t\t} else {\r\n\t\t\tvalue = +this.getRightValue(value);\r\n\t\t\tstart = undefined;\r\n\t\t\tend = value;\r\n\t\t\tmin = value;\r\n\t\t\tmax = value;\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\tmin: min,\r\n\t\t\tmax: max,\r\n\t\t\tstart: start,\r\n\t\t\tend: end\r\n\t\t};\r\n\t},\r\n\r\n\t/**\r\n\t* @private\r\n\t*/\r\n\t_getScaleLabel: function(rawValue) {\r\n\t\tvar v = this._parseValue(rawValue);\r\n\t\tif (v.start !== undefined) {\r\n\t\t\treturn '[' + v.start + ', ' + v.end + ']';\r\n\t\t}\r\n\r\n\t\treturn +this.getRightValue(rawValue);\r\n\t},\r\n\r\n\t/**\r\n\t * Used to get the value to display in the tooltip for the data at the given index\r\n\t * @param index\r\n\t * @param datasetIndex\r\n\t */\r\n\tgetLabelForIndex: helpers$1.noop,\r\n\r\n\t/**\r\n\t * Returns the location of the given data point. Value can either be an index or a numerical value\r\n\t * The coordinate (0, 0) is at the upper-left corner of the canvas\r\n\t * @param value\r\n\t * @param index\r\n\t * @param datasetIndex\r\n\t */\r\n\tgetPixelForValue: helpers$1.noop,\r\n\r\n\t/**\r\n\t * Used to get the data value from a given pixel. This is the inverse of getPixelForValue\r\n\t * The coordinate (0, 0) is at the upper-left corner of the canvas\r\n\t * @param pixel\r\n\t */\r\n\tgetValueForPixel: helpers$1.noop,\r\n\r\n\t/**\r\n\t * Returns the location of the tick at the given index\r\n\t * The coordinate (0, 0) is at the upper-left corner of the canvas\r\n\t */\r\n\tgetPixelForTick: function(index) {\r\n\t\tvar me = this;\r\n\t\tvar offset = me.options.offset;\r\n\t\tvar numTicks = me._ticks.length;\r\n\t\tvar tickWidth = 1 / Math.max(numTicks - (offset ? 0 : 1), 1);\r\n\r\n\t\treturn index < 0 || index > numTicks - 1\r\n\t\t\t? null\r\n\t\t\t: me.getPixelForDecimal(index * tickWidth + (offset ? tickWidth / 2 : 0));\r\n\t},\r\n\r\n\t/**\r\n\t * Utility for getting the pixel location of a percentage of scale\r\n\t * The coordinate (0, 0) is at the upper-left corner of the canvas\r\n\t */\r\n\tgetPixelForDecimal: function(decimal) {\r\n\t\tvar me = this;\r\n\r\n\t\tif (me._reversePixels) {\r\n\t\t\tdecimal = 1 - decimal;\r\n\t\t}\r\n\r\n\t\treturn me._startPixel + decimal * me._length;\r\n\t},\r\n\r\n\tgetDecimalForPixel: function(pixel) {\r\n\t\tvar decimal = (pixel - this._startPixel) / this._length;\r\n\t\treturn this._reversePixels ? 1 - decimal : decimal;\r\n\t},\r\n\r\n\t/**\r\n\t * Returns the pixel for the minimum chart value\r\n\t * The coordinate (0, 0) is at the upper-left corner of the canvas\r\n\t */\r\n\tgetBasePixel: function() {\r\n\t\treturn this.getPixelForValue(this.getBaseValue());\r\n\t},\r\n\r\n\tgetBaseValue: function() {\r\n\t\tvar me = this;\r\n\t\tvar min = me.min;\r\n\t\tvar max = me.max;\r\n\r\n\t\treturn me.beginAtZero ? 0 :\r\n\t\t\tmin < 0 && max < 0 ? max :\r\n\t\t\tmin > 0 && max > 0 ? min :\r\n\t\t\t0;\r\n\t},\r\n\r\n\t/**\r\n\t * Returns a subset of ticks to be plotted to avoid overlapping labels.\r\n\t * @private\r\n\t */\r\n\t_autoSkip: function(ticks) {\r\n\t\tvar me = this;\r\n\t\tvar tickOpts = me.options.ticks;\r\n\t\tvar axisLength = me._length;\r\n\t\tvar ticksLimit = tickOpts.maxTicksLimit || axisLength / me._tickSize() + 1;\r\n\t\tvar majorIndices = tickOpts.major.enabled ? getMajorIndices(ticks) : [];\r\n\t\tvar numMajorIndices = majorIndices.length;\r\n\t\tvar first = majorIndices[0];\r\n\t\tvar last = majorIndices[numMajorIndices - 1];\r\n\t\tvar i, ilen, spacing, avgMajorSpacing;\r\n\r\n\t\t// If there are too many major ticks to display them all\r\n\t\tif (numMajorIndices > ticksLimit) {\r\n\t\t\tskipMajors(ticks, majorIndices, numMajorIndices / ticksLimit);\r\n\t\t\treturn nonSkipped(ticks);\r\n\t\t}\r\n\r\n\t\tspacing = calculateSpacing(majorIndices, ticks, axisLength, ticksLimit);\r\n\r\n\t\tif (numMajorIndices > 0) {\r\n\t\t\tfor (i = 0, ilen = numMajorIndices - 1; i < ilen; i++) {\r\n\t\t\t\tskip(ticks, spacing, majorIndices[i], majorIndices[i + 1]);\r\n\t\t\t}\r\n\t\t\tavgMajorSpacing = numMajorIndices > 1 ? (last - first) / (numMajorIndices - 1) : null;\r\n\t\t\tskip(ticks, spacing, helpers$1.isNullOrUndef(avgMajorSpacing) ? 0 : first - avgMajorSpacing, first);\r\n\t\t\tskip(ticks, spacing, last, helpers$1.isNullOrUndef(avgMajorSpacing) ? ticks.length : last + avgMajorSpacing);\r\n\t\t\treturn nonSkipped(ticks);\r\n\t\t}\r\n\t\tskip(ticks, spacing);\r\n\t\treturn nonSkipped(ticks);\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_tickSize: function() {\r\n\t\tvar me = this;\r\n\t\tvar optionTicks = me.options.ticks;\r\n\r\n\t\t// Calculate space needed by label in axis direction.\r\n\t\tvar rot = helpers$1.toRadians(me.labelRotation);\r\n\t\tvar cos = Math.abs(Math.cos(rot));\r\n\t\tvar sin = Math.abs(Math.sin(rot));\r\n\r\n\t\tvar labelSizes = me._getLabelSizes();\r\n\t\tvar padding = optionTicks.autoSkipPadding || 0;\r\n\t\tvar w = labelSizes ? labelSizes.widest.width + padding : 0;\r\n\t\tvar h = labelSizes ? labelSizes.highest.height + padding : 0;\r\n\r\n\t\t// Calculate space needed for 1 tick in axis direction.\r\n\t\treturn me.isHorizontal()\r\n\t\t\t? h * cos > w * sin ? w / cos : h / sin\r\n\t\t\t: h * sin < w * cos ? h / cos : w / sin;\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_isVisible: function() {\r\n\t\tvar me = this;\r\n\t\tvar chart = me.chart;\r\n\t\tvar display = me.options.display;\r\n\t\tvar i, ilen, meta;\r\n\r\n\t\tif (display !== 'auto') {\r\n\t\t\treturn !!display;\r\n\t\t}\r\n\r\n\t\t// When 'auto', the scale is visible if at least one associated dataset is visible.\r\n\t\tfor (i = 0, ilen = chart.data.datasets.length; i < ilen; ++i) {\r\n\t\t\tif (chart.isDatasetVisible(i)) {\r\n\t\t\t\tmeta = chart.getDatasetMeta(i);\r\n\t\t\t\tif (meta.xAxisID === me.id || meta.yAxisID === me.id) {\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_computeGridLineItems: function(chartArea) {\r\n\t\tvar me = this;\r\n\t\tvar chart = me.chart;\r\n\t\tvar options = me.options;\r\n\t\tvar gridLines = options.gridLines;\r\n\t\tvar position = options.position;\r\n\t\tvar offsetGridLines = gridLines.offsetGridLines;\r\n\t\tvar isHorizontal = me.isHorizontal();\r\n\t\tvar ticks = me._ticksToDraw;\r\n\t\tvar ticksLength = ticks.length + (offsetGridLines ? 1 : 0);\r\n\r\n\t\tvar tl = getTickMarkLength(gridLines);\r\n\t\tvar items = [];\r\n\t\tvar axisWidth = gridLines.drawBorder ? valueAtIndexOrDefault(gridLines.lineWidth, 0, 0) : 0;\r\n\t\tvar axisHalfWidth = axisWidth / 2;\r\n\t\tvar alignPixel = helpers$1._alignPixel;\r\n\t\tvar alignBorderValue = function(pixel) {\r\n\t\t\treturn alignPixel(chart, pixel, axisWidth);\r\n\t\t};\r\n\t\tvar borderValue, i, tick, lineValue, alignedLineValue;\r\n\t\tvar tx1, ty1, tx2, ty2, x1, y1, x2, y2, lineWidth, lineColor, borderDash, borderDashOffset;\r\n\r\n\t\tif (position === 'top') {\r\n\t\t\tborderValue = alignBorderValue(me.bottom);\r\n\t\t\tty1 = me.bottom - tl;\r\n\t\t\tty2 = borderValue - axisHalfWidth;\r\n\t\t\ty1 = alignBorderValue(chartArea.top) + axisHalfWidth;\r\n\t\t\ty2 = chartArea.bottom;\r\n\t\t} else if (position === 'bottom') {\r\n\t\t\tborderValue = alignBorderValue(me.top);\r\n\t\t\ty1 = chartArea.top;\r\n\t\t\ty2 = alignBorderValue(chartArea.bottom) - axisHalfWidth;\r\n\t\t\tty1 = borderValue + axisHalfWidth;\r\n\t\t\tty2 = me.top + tl;\r\n\t\t} else if (position === 'left') {\r\n\t\t\tborderValue = alignBorderValue(me.right);\r\n\t\t\ttx1 = me.right - tl;\r\n\t\t\ttx2 = borderValue - axisHalfWidth;\r\n\t\t\tx1 = alignBorderValue(chartArea.left) + axisHalfWidth;\r\n\t\t\tx2 = chartArea.right;\r\n\t\t} else {\r\n\t\t\tborderValue = alignBorderValue(me.left);\r\n\t\t\tx1 = chartArea.left;\r\n\t\t\tx2 = alignBorderValue(chartArea.right) - axisHalfWidth;\r\n\t\t\ttx1 = borderValue + axisHalfWidth;\r\n\t\t\ttx2 = me.left + tl;\r\n\t\t}\r\n\r\n\t\tfor (i = 0; i < ticksLength; ++i) {\r\n\t\t\ttick = ticks[i] || {};\r\n\r\n\t\t\t// autoskipper skipped this tick (#4635)\r\n\t\t\tif (isNullOrUndef(tick.label) && i < ticks.length) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\tif (i === me.zeroLineIndex && options.offset === offsetGridLines) {\r\n\t\t\t\t// Draw the first index specially\r\n\t\t\t\tlineWidth = gridLines.zeroLineWidth;\r\n\t\t\t\tlineColor = gridLines.zeroLineColor;\r\n\t\t\t\tborderDash = gridLines.zeroLineBorderDash || [];\r\n\t\t\t\tborderDashOffset = gridLines.zeroLineBorderDashOffset || 0.0;\r\n\t\t\t} else {\r\n\t\t\t\tlineWidth = valueAtIndexOrDefault(gridLines.lineWidth, i, 1);\r\n\t\t\t\tlineColor = valueAtIndexOrDefault(gridLines.color, i, 'rgba(0,0,0,0.1)');\r\n\t\t\t\tborderDash = gridLines.borderDash || [];\r\n\t\t\t\tborderDashOffset = gridLines.borderDashOffset || 0.0;\r\n\t\t\t}\r\n\r\n\t\t\tlineValue = getPixelForGridLine(me, tick._index || i, offsetGridLines);\r\n\r\n\t\t\t// Skip if the pixel is out of the range\r\n\t\t\tif (lineValue === undefined) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\talignedLineValue = alignPixel(chart, lineValue, lineWidth);\r\n\r\n\t\t\tif (isHorizontal) {\r\n\t\t\t\ttx1 = tx2 = x1 = x2 = alignedLineValue;\r\n\t\t\t} else {\r\n\t\t\t\tty1 = ty2 = y1 = y2 = alignedLineValue;\r\n\t\t\t}\r\n\r\n\t\t\titems.push({\r\n\t\t\t\ttx1: tx1,\r\n\t\t\t\tty1: ty1,\r\n\t\t\t\ttx2: tx2,\r\n\t\t\t\tty2: ty2,\r\n\t\t\t\tx1: x1,\r\n\t\t\t\ty1: y1,\r\n\t\t\t\tx2: x2,\r\n\t\t\t\ty2: y2,\r\n\t\t\t\twidth: lineWidth,\r\n\t\t\t\tcolor: lineColor,\r\n\t\t\t\tborderDash: borderDash,\r\n\t\t\t\tborderDashOffset: borderDashOffset,\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\titems.ticksLength = ticksLength;\r\n\t\titems.borderValue = borderValue;\r\n\r\n\t\treturn items;\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_computeLabelItems: function() {\r\n\t\tvar me = this;\r\n\t\tvar options = me.options;\r\n\t\tvar optionTicks = options.ticks;\r\n\t\tvar position = options.position;\r\n\t\tvar isMirrored = optionTicks.mirror;\r\n\t\tvar isHorizontal = me.isHorizontal();\r\n\t\tvar ticks = me._ticksToDraw;\r\n\t\tvar fonts = parseTickFontOptions(optionTicks);\r\n\t\tvar tickPadding = optionTicks.padding;\r\n\t\tvar tl = getTickMarkLength(options.gridLines);\r\n\t\tvar rotation = -helpers$1.toRadians(me.labelRotation);\r\n\t\tvar items = [];\r\n\t\tvar i, ilen, tick, label, x, y, textAlign, pixel, font, lineHeight, lineCount, textOffset;\r\n\r\n\t\tif (position === 'top') {\r\n\t\t\ty = me.bottom - tl - tickPadding;\r\n\t\t\ttextAlign = !rotation ? 'center' : 'left';\r\n\t\t} else if (position === 'bottom') {\r\n\t\t\ty = me.top + tl + tickPadding;\r\n\t\t\ttextAlign = !rotation ? 'center' : 'right';\r\n\t\t} else if (position === 'left') {\r\n\t\t\tx = me.right - (isMirrored ? 0 : tl) - tickPadding;\r\n\t\t\ttextAlign = isMirrored ? 'left' : 'right';\r\n\t\t} else {\r\n\t\t\tx = me.left + (isMirrored ? 0 : tl) + tickPadding;\r\n\t\t\ttextAlign = isMirrored ? 'right' : 'left';\r\n\t\t}\r\n\r\n\t\tfor (i = 0, ilen = ticks.length; i < ilen; ++i) {\r\n\t\t\ttick = ticks[i];\r\n\t\t\tlabel = tick.label;\r\n\r\n\t\t\t// autoskipper skipped this tick (#4635)\r\n\t\t\tif (isNullOrUndef(label)) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\tpixel = me.getPixelForTick(tick._index || i) + optionTicks.labelOffset;\r\n\t\t\tfont = tick.major ? fonts.major : fonts.minor;\r\n\t\t\tlineHeight = font.lineHeight;\r\n\t\t\tlineCount = isArray(label) ? label.length : 1;\r\n\r\n\t\t\tif (isHorizontal) {\r\n\t\t\t\tx = pixel;\r\n\t\t\t\ttextOffset = position === 'top'\r\n\t\t\t\t\t? ((!rotation ? 0.5 : 1) - lineCount) * lineHeight\r\n\t\t\t\t\t: (!rotation ? 0.5 : 0) * lineHeight;\r\n\t\t\t} else {\r\n\t\t\t\ty = pixel;\r\n\t\t\t\ttextOffset = (1 - lineCount) * lineHeight / 2;\r\n\t\t\t}\r\n\r\n\t\t\titems.push({\r\n\t\t\t\tx: x,\r\n\t\t\t\ty: y,\r\n\t\t\t\trotation: rotation,\r\n\t\t\t\tlabel: label,\r\n\t\t\t\tfont: font,\r\n\t\t\t\ttextOffset: textOffset,\r\n\t\t\t\ttextAlign: textAlign\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\treturn items;\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_drawGrid: function(chartArea) {\r\n\t\tvar me = this;\r\n\t\tvar gridLines = me.options.gridLines;\r\n\r\n\t\tif (!gridLines.display) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tvar ctx = me.ctx;\r\n\t\tvar chart = me.chart;\r\n\t\tvar alignPixel = helpers$1._alignPixel;\r\n\t\tvar axisWidth = gridLines.drawBorder ? valueAtIndexOrDefault(gridLines.lineWidth, 0, 0) : 0;\r\n\t\tvar items = me._gridLineItems || (me._gridLineItems = me._computeGridLineItems(chartArea));\r\n\t\tvar width, color, i, ilen, item;\r\n\r\n\t\tfor (i = 0, ilen = items.length; i < ilen; ++i) {\r\n\t\t\titem = items[i];\r\n\t\t\twidth = item.width;\r\n\t\t\tcolor = item.color;\r\n\r\n\t\t\tif (width && color) {\r\n\t\t\t\tctx.save();\r\n\t\t\t\tctx.lineWidth = width;\r\n\t\t\t\tctx.strokeStyle = color;\r\n\t\t\t\tif (ctx.setLineDash) {\r\n\t\t\t\t\tctx.setLineDash(item.borderDash);\r\n\t\t\t\t\tctx.lineDashOffset = item.borderDashOffset;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tctx.beginPath();\r\n\r\n\t\t\t\tif (gridLines.drawTicks) {\r\n\t\t\t\t\tctx.moveTo(item.tx1, item.ty1);\r\n\t\t\t\t\tctx.lineTo(item.tx2, item.ty2);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (gridLines.drawOnChartArea) {\r\n\t\t\t\t\tctx.moveTo(item.x1, item.y1);\r\n\t\t\t\t\tctx.lineTo(item.x2, item.y2);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tctx.stroke();\r\n\t\t\t\tctx.restore();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (axisWidth) {\r\n\t\t\t// Draw the line at the edge of the axis\r\n\t\t\tvar firstLineWidth = axisWidth;\r\n\t\t\tvar lastLineWidth = valueAtIndexOrDefault(gridLines.lineWidth, items.ticksLength - 1, 1);\r\n\t\t\tvar borderValue = items.borderValue;\r\n\t\t\tvar x1, x2, y1, y2;\r\n\r\n\t\t\tif (me.isHorizontal()) {\r\n\t\t\t\tx1 = alignPixel(chart, me.left, firstLineWidth) - firstLineWidth / 2;\r\n\t\t\t\tx2 = alignPixel(chart, me.right, lastLineWidth) + lastLineWidth / 2;\r\n\t\t\t\ty1 = y2 = borderValue;\r\n\t\t\t} else {\r\n\t\t\t\ty1 = alignPixel(chart, me.top, firstLineWidth) - firstLineWidth / 2;\r\n\t\t\t\ty2 = alignPixel(chart, me.bottom, lastLineWidth) + lastLineWidth / 2;\r\n\t\t\t\tx1 = x2 = borderValue;\r\n\t\t\t}\r\n\r\n\t\t\tctx.lineWidth = axisWidth;\r\n\t\t\tctx.strokeStyle = valueAtIndexOrDefault(gridLines.color, 0);\r\n\t\t\tctx.beginPath();\r\n\t\t\tctx.moveTo(x1, y1);\r\n\t\t\tctx.lineTo(x2, y2);\r\n\t\t\tctx.stroke();\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_drawLabels: function() {\r\n\t\tvar me = this;\r\n\t\tvar optionTicks = me.options.ticks;\r\n\r\n\t\tif (!optionTicks.display) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tvar ctx = me.ctx;\r\n\t\tvar items = me._labelItems || (me._labelItems = me._computeLabelItems());\r\n\t\tvar i, j, ilen, jlen, item, tickFont, label, y;\r\n\r\n\t\tfor (i = 0, ilen = items.length; i < ilen; ++i) {\r\n\t\t\titem = items[i];\r\n\t\t\ttickFont = item.font;\r\n\r\n\t\t\t// Make sure we draw text in the correct color and font\r\n\t\t\tctx.save();\r\n\t\t\tctx.translate(item.x, item.y);\r\n\t\t\tctx.rotate(item.rotation);\r\n\t\t\tctx.font = tickFont.string;\r\n\t\t\tctx.fillStyle = tickFont.color;\r\n\t\t\tctx.textBaseline = 'middle';\r\n\t\t\tctx.textAlign = item.textAlign;\r\n\r\n\t\t\tlabel = item.label;\r\n\t\t\ty = item.textOffset;\r\n\t\t\tif (isArray(label)) {\r\n\t\t\t\tfor (j = 0, jlen = label.length; j < jlen; ++j) {\r\n\t\t\t\t\t// We just make sure the multiline element is a string here..\r\n\t\t\t\t\tctx.fillText('' + label[j], 0, y);\r\n\t\t\t\t\ty += tickFont.lineHeight;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tctx.fillText(label, 0, y);\r\n\t\t\t}\r\n\t\t\tctx.restore();\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_drawTitle: function() {\r\n\t\tvar me = this;\r\n\t\tvar ctx = me.ctx;\r\n\t\tvar options = me.options;\r\n\t\tvar scaleLabel = options.scaleLabel;\r\n\r\n\t\tif (!scaleLabel.display) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tvar scaleLabelFontColor = valueOrDefault$a(scaleLabel.fontColor, core_defaults.global.defaultFontColor);\r\n\t\tvar scaleLabelFont = helpers$1.options._parseFont(scaleLabel);\r\n\t\tvar scaleLabelPadding = helpers$1.options.toPadding(scaleLabel.padding);\r\n\t\tvar halfLineHeight = scaleLabelFont.lineHeight / 2;\r\n\t\tvar position = options.position;\r\n\t\tvar rotation = 0;\r\n\t\tvar scaleLabelX, scaleLabelY;\r\n\r\n\t\tif (me.isHorizontal()) {\r\n\t\t\tscaleLabelX = me.left + me.width / 2; // midpoint of the width\r\n\t\t\tscaleLabelY = position === 'bottom'\r\n\t\t\t\t? me.bottom - halfLineHeight - scaleLabelPadding.bottom\r\n\t\t\t\t: me.top + halfLineHeight + scaleLabelPadding.top;\r\n\t\t} else {\r\n\t\t\tvar isLeft = position === 'left';\r\n\t\t\tscaleLabelX = isLeft\r\n\t\t\t\t? me.left + halfLineHeight + scaleLabelPadding.top\r\n\t\t\t\t: me.right - halfLineHeight - scaleLabelPadding.top;\r\n\t\t\tscaleLabelY = me.top + me.height / 2;\r\n\t\t\trotation = isLeft ? -0.5 * Math.PI : 0.5 * Math.PI;\r\n\t\t}\r\n\r\n\t\tctx.save();\r\n\t\tctx.translate(scaleLabelX, scaleLabelY);\r\n\t\tctx.rotate(rotation);\r\n\t\tctx.textAlign = 'center';\r\n\t\tctx.textBaseline = 'middle';\r\n\t\tctx.fillStyle = scaleLabelFontColor; // render in correct colour\r\n\t\tctx.font = scaleLabelFont.string;\r\n\t\tctx.fillText(scaleLabel.labelString, 0, 0);\r\n\t\tctx.restore();\r\n\t},\r\n\r\n\tdraw: function(chartArea) {\r\n\t\tvar me = this;\r\n\r\n\t\tif (!me._isVisible()) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tme._drawGrid(chartArea);\r\n\t\tme._drawTitle();\r\n\t\tme._drawLabels();\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_layers: function() {\r\n\t\tvar me = this;\r\n\t\tvar opts = me.options;\r\n\t\tvar tz = opts.ticks && opts.ticks.z || 0;\r\n\t\tvar gz = opts.gridLines && opts.gridLines.z || 0;\r\n\r\n\t\tif (!me._isVisible() || tz === gz || me.draw !== me._draw) {\r\n\t\t\t// backward compatibility: draw has been overridden by custom scale\r\n\t\t\treturn [{\r\n\t\t\t\tz: tz,\r\n\t\t\t\tdraw: function() {\r\n\t\t\t\t\tme.draw.apply(me, arguments);\r\n\t\t\t\t}\r\n\t\t\t}];\r\n\t\t}\r\n\r\n\t\treturn [{\r\n\t\t\tz: gz,\r\n\t\t\tdraw: function() {\r\n\t\t\t\tme._drawGrid.apply(me, arguments);\r\n\t\t\t\tme._drawTitle.apply(me, arguments);\r\n\t\t\t}\r\n\t\t}, {\r\n\t\t\tz: tz,\r\n\t\t\tdraw: function() {\r\n\t\t\t\tme._drawLabels.apply(me, arguments);\r\n\t\t\t}\r\n\t\t}];\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_getMatchingVisibleMetas: function(type) {\r\n\t\tvar me = this;\r\n\t\tvar isHorizontal = me.isHorizontal();\r\n\t\treturn me.chart._getSortedVisibleDatasetMetas()\r\n\t\t\t.filter(function(meta) {\r\n\t\t\t\treturn (!type || meta.type === type)\r\n\t\t\t\t\t&& (isHorizontal ? meta.xAxisID === me.id : meta.yAxisID === me.id);\r\n\t\t\t});\r\n\t}\r\n});\r\n\r\nScale.prototype._draw = Scale.prototype.draw;\r\n\r\nvar core_scale = Scale;\n\nvar isNullOrUndef$1 = helpers$1.isNullOrUndef;\r\n\r\nvar defaultConfig = {\r\n\tposition: 'bottom'\r\n};\r\n\r\nvar scale_category = core_scale.extend({\r\n\tdetermineDataLimits: function() {\r\n\t\tvar me = this;\r\n\t\tvar labels = me._getLabels();\r\n\t\tvar ticksOpts = me.options.ticks;\r\n\t\tvar min = ticksOpts.min;\r\n\t\tvar max = ticksOpts.max;\r\n\t\tvar minIndex = 0;\r\n\t\tvar maxIndex = labels.length - 1;\r\n\t\tvar findIndex;\r\n\r\n\t\tif (min !== undefined) {\r\n\t\t\t// user specified min value\r\n\t\t\tfindIndex = labels.indexOf(min);\r\n\t\t\tif (findIndex >= 0) {\r\n\t\t\t\tminIndex = findIndex;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (max !== undefined) {\r\n\t\t\t// user specified max value\r\n\t\t\tfindIndex = labels.indexOf(max);\r\n\t\t\tif (findIndex >= 0) {\r\n\t\t\t\tmaxIndex = findIndex;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tme.minIndex = minIndex;\r\n\t\tme.maxIndex = maxIndex;\r\n\t\tme.min = labels[minIndex];\r\n\t\tme.max = labels[maxIndex];\r\n\t},\r\n\r\n\tbuildTicks: function() {\r\n\t\tvar me = this;\r\n\t\tvar labels = me._getLabels();\r\n\t\tvar minIndex = me.minIndex;\r\n\t\tvar maxIndex = me.maxIndex;\r\n\r\n\t\t// If we are viewing some subset of labels, slice the original array\r\n\t\tme.ticks = (minIndex === 0 && maxIndex === labels.length - 1) ? labels : labels.slice(minIndex, maxIndex + 1);\r\n\t},\r\n\r\n\tgetLabelForIndex: function(index, datasetIndex) {\r\n\t\tvar me = this;\r\n\t\tvar chart = me.chart;\r\n\r\n\t\tif (chart.getDatasetMeta(datasetIndex).controller._getValueScaleId() === me.id) {\r\n\t\t\treturn me.getRightValue(chart.data.datasets[datasetIndex].data[index]);\r\n\t\t}\r\n\r\n\t\treturn me._getLabels()[index];\r\n\t},\r\n\r\n\t_configure: function() {\r\n\t\tvar me = this;\r\n\t\tvar offset = me.options.offset;\r\n\t\tvar ticks = me.ticks;\r\n\r\n\t\tcore_scale.prototype._configure.call(me);\r\n\r\n\t\tif (!me.isHorizontal()) {\r\n\t\t\t// For backward compatibility, vertical category scale reverse is inverted.\r\n\t\t\tme._reversePixels = !me._reversePixels;\r\n\t\t}\r\n\r\n\t\tif (!ticks) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tme._startValue = me.minIndex - (offset ? 0.5 : 0);\r\n\t\tme._valueRange = Math.max(ticks.length - (offset ? 0 : 1), 1);\r\n\t},\r\n\r\n\t// Used to get data value locations. Value can either be an index or a numerical value\r\n\tgetPixelForValue: function(value, index, datasetIndex) {\r\n\t\tvar me = this;\r\n\t\tvar valueCategory, labels, idx;\r\n\r\n\t\tif (!isNullOrUndef$1(index) && !isNullOrUndef$1(datasetIndex)) {\r\n\t\t\tvalue = me.chart.data.datasets[datasetIndex].data[index];\r\n\t\t}\r\n\r\n\t\t// If value is a data object, then index is the index in the data array,\r\n\t\t// not the index of the scale. We need to change that.\r\n\t\tif (!isNullOrUndef$1(value)) {\r\n\t\t\tvalueCategory = me.isHorizontal() ? value.x : value.y;\r\n\t\t}\r\n\t\tif (valueCategory !== undefined || (value !== undefined && isNaN(index))) {\r\n\t\t\tlabels = me._getLabels();\r\n\t\t\tvalue = helpers$1.valueOrDefault(valueCategory, value);\r\n\t\t\tidx = labels.indexOf(value);\r\n\t\t\tindex = idx !== -1 ? idx : index;\r\n\t\t\tif (isNaN(index)) {\r\n\t\t\t\tindex = value;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn me.getPixelForDecimal((index - me._startValue) / me._valueRange);\r\n\t},\r\n\r\n\tgetPixelForTick: function(index) {\r\n\t\tvar ticks = this.ticks;\r\n\t\treturn index < 0 || index > ticks.length - 1\r\n\t\t\t? null\r\n\t\t\t: this.getPixelForValue(ticks[index], index + this.minIndex);\r\n\t},\r\n\r\n\tgetValueForPixel: function(pixel) {\r\n\t\tvar me = this;\r\n\t\tvar value = Math.round(me._startValue + me.getDecimalForPixel(pixel) * me._valueRange);\r\n\t\treturn Math.min(Math.max(value, 0), me.ticks.length - 1);\r\n\t},\r\n\r\n\tgetBasePixel: function() {\r\n\t\treturn this.bottom;\r\n\t}\r\n});\r\n\r\n// INTERNAL: static default options, registered in src/index.js\r\nvar _defaults = defaultConfig;\nscale_category._defaults = _defaults;\n\nvar noop = helpers$1.noop;\r\nvar isNullOrUndef$2 = helpers$1.isNullOrUndef;\r\n\r\n/**\r\n * Generate a set of linear ticks\r\n * @param generationOptions the options used to generate the ticks\r\n * @param dataRange the range of the data\r\n * @returns {number[]} array of tick values\r\n */\r\nfunction generateTicks(generationOptions, dataRange) {\r\n\tvar ticks = [];\r\n\t// To get a \"nice\" value for the tick spacing, we will use the appropriately named\r\n\t// \"nice number\" algorithm. See https://stackoverflow.com/questions/8506881/nice-label-algorithm-for-charts-with-minimum-ticks\r\n\t// for details.\r\n\r\n\tvar MIN_SPACING = 1e-14;\r\n\tvar stepSize = generationOptions.stepSize;\r\n\tvar unit = stepSize || 1;\r\n\tvar maxNumSpaces = generationOptions.maxTicks - 1;\r\n\tvar min = generationOptions.min;\r\n\tvar max = generationOptions.max;\r\n\tvar precision = generationOptions.precision;\r\n\tvar rmin = dataRange.min;\r\n\tvar rmax = dataRange.max;\r\n\tvar spacing = helpers$1.niceNum((rmax - rmin) / maxNumSpaces / unit) * unit;\r\n\tvar factor, niceMin, niceMax, numSpaces;\r\n\r\n\t// Beyond MIN_SPACING floating point numbers being to lose precision\r\n\t// such that we can't do the math necessary to generate ticks\r\n\tif (spacing < MIN_SPACING && isNullOrUndef$2(min) && isNullOrUndef$2(max)) {\r\n\t\treturn [rmin, rmax];\r\n\t}\r\n\r\n\tnumSpaces = Math.ceil(rmax / spacing) - Math.floor(rmin / spacing);\r\n\tif (numSpaces > maxNumSpaces) {\r\n\t\t// If the calculated num of spaces exceeds maxNumSpaces, recalculate it\r\n\t\tspacing = helpers$1.niceNum(numSpaces * spacing / maxNumSpaces / unit) * unit;\r\n\t}\r\n\r\n\tif (stepSize || isNullOrUndef$2(precision)) {\r\n\t\t// If a precision is not specified, calculate factor based on spacing\r\n\t\tfactor = Math.pow(10, helpers$1._decimalPlaces(spacing));\r\n\t} else {\r\n\t\t// If the user specified a precision, round to that number of decimal places\r\n\t\tfactor = Math.pow(10, precision);\r\n\t\tspacing = Math.ceil(spacing * factor) / factor;\r\n\t}\r\n\r\n\tniceMin = Math.floor(rmin / spacing) * spacing;\r\n\tniceMax = Math.ceil(rmax / spacing) * spacing;\r\n\r\n\t// If min, max and stepSize is set and they make an evenly spaced scale use it.\r\n\tif (stepSize) {\r\n\t\t// If very close to our whole number, use it.\r\n\t\tif (!isNullOrUndef$2(min) && helpers$1.almostWhole(min / spacing, spacing / 1000)) {\r\n\t\t\tniceMin = min;\r\n\t\t}\r\n\t\tif (!isNullOrUndef$2(max) && helpers$1.almostWhole(max / spacing, spacing / 1000)) {\r\n\t\t\tniceMax = max;\r\n\t\t}\r\n\t}\r\n\r\n\tnumSpaces = (niceMax - niceMin) / spacing;\r\n\t// If very close to our rounded value, use it.\r\n\tif (helpers$1.almostEquals(numSpaces, Math.round(numSpaces), spacing / 1000)) {\r\n\t\tnumSpaces = Math.round(numSpaces);\r\n\t} else {\r\n\t\tnumSpaces = Math.ceil(numSpaces);\r\n\t}\r\n\r\n\tniceMin = Math.round(niceMin * factor) / factor;\r\n\tniceMax = Math.round(niceMax * factor) / factor;\r\n\tticks.push(isNullOrUndef$2(min) ? niceMin : min);\r\n\tfor (var j = 1; j < numSpaces; ++j) {\r\n\t\tticks.push(Math.round((niceMin + j * spacing) * factor) / factor);\r\n\t}\r\n\tticks.push(isNullOrUndef$2(max) ? niceMax : max);\r\n\r\n\treturn ticks;\r\n}\r\n\r\nvar scale_linearbase = core_scale.extend({\r\n\tgetRightValue: function(value) {\r\n\t\tif (typeof value === 'string') {\r\n\t\t\treturn +value;\r\n\t\t}\r\n\t\treturn core_scale.prototype.getRightValue.call(this, value);\r\n\t},\r\n\r\n\thandleTickRangeOptions: function() {\r\n\t\tvar me = this;\r\n\t\tvar opts = me.options;\r\n\t\tvar tickOpts = opts.ticks;\r\n\r\n\t\t// If we are forcing it to begin at 0, but 0 will already be rendered on the chart,\r\n\t\t// do nothing since that would make the chart weird. If the user really wants a weird chart\r\n\t\t// axis, they can manually override it\r\n\t\tif (tickOpts.beginAtZero) {\r\n\t\t\tvar minSign = helpers$1.sign(me.min);\r\n\t\t\tvar maxSign = helpers$1.sign(me.max);\r\n\r\n\t\t\tif (minSign < 0 && maxSign < 0) {\r\n\t\t\t\t// move the top up to 0\r\n\t\t\t\tme.max = 0;\r\n\t\t\t} else if (minSign > 0 && maxSign > 0) {\r\n\t\t\t\t// move the bottom down to 0\r\n\t\t\t\tme.min = 0;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar setMin = tickOpts.min !== undefined || tickOpts.suggestedMin !== undefined;\r\n\t\tvar setMax = tickOpts.max !== undefined || tickOpts.suggestedMax !== undefined;\r\n\r\n\t\tif (tickOpts.min !== undefined) {\r\n\t\t\tme.min = tickOpts.min;\r\n\t\t} else if (tickOpts.suggestedMin !== undefined) {\r\n\t\t\tif (me.min === null) {\r\n\t\t\t\tme.min = tickOpts.suggestedMin;\r\n\t\t\t} else {\r\n\t\t\t\tme.min = Math.min(me.min, tickOpts.suggestedMin);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (tickOpts.max !== undefined) {\r\n\t\t\tme.max = tickOpts.max;\r\n\t\t} else if (tickOpts.suggestedMax !== undefined) {\r\n\t\t\tif (me.max === null) {\r\n\t\t\t\tme.max = tickOpts.suggestedMax;\r\n\t\t\t} else {\r\n\t\t\t\tme.max = Math.max(me.max, tickOpts.suggestedMax);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (setMin !== setMax) {\r\n\t\t\t// We set the min or the max but not both.\r\n\t\t\t// So ensure that our range is good\r\n\t\t\t// Inverted or 0 length range can happen when\r\n\t\t\t// ticks.min is set, and no datasets are visible\r\n\t\t\tif (me.min >= me.max) {\r\n\t\t\t\tif (setMin) {\r\n\t\t\t\t\tme.max = me.min + 1;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tme.min = me.max - 1;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (me.min === me.max) {\r\n\t\t\tme.max++;\r\n\r\n\t\t\tif (!tickOpts.beginAtZero) {\r\n\t\t\t\tme.min--;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tgetTickLimit: function() {\r\n\t\tvar me = this;\r\n\t\tvar tickOpts = me.options.ticks;\r\n\t\tvar stepSize = tickOpts.stepSize;\r\n\t\tvar maxTicksLimit = tickOpts.maxTicksLimit;\r\n\t\tvar maxTicks;\r\n\r\n\t\tif (stepSize) {\r\n\t\t\tmaxTicks = Math.ceil(me.max / stepSize) - Math.floor(me.min / stepSize) + 1;\r\n\t\t} else {\r\n\t\t\tmaxTicks = me._computeTickLimit();\r\n\t\t\tmaxTicksLimit = maxTicksLimit || 11;\r\n\t\t}\r\n\r\n\t\tif (maxTicksLimit) {\r\n\t\t\tmaxTicks = Math.min(maxTicksLimit, maxTicks);\r\n\t\t}\r\n\r\n\t\treturn maxTicks;\r\n\t},\r\n\r\n\t_computeTickLimit: function() {\r\n\t\treturn Number.POSITIVE_INFINITY;\r\n\t},\r\n\r\n\thandleDirectionalChanges: noop,\r\n\r\n\tbuildTicks: function() {\r\n\t\tvar me = this;\r\n\t\tvar opts = me.options;\r\n\t\tvar tickOpts = opts.ticks;\r\n\r\n\t\t// Figure out what the max number of ticks we can support it is based on the size of\r\n\t\t// the axis area. For now, we say that the minimum tick spacing in pixels must be 40\r\n\t\t// We also limit the maximum number of ticks to 11 which gives a nice 10 squares on\r\n\t\t// the graph. Make sure we always have at least 2 ticks\r\n\t\tvar maxTicks = me.getTickLimit();\r\n\t\tmaxTicks = Math.max(2, maxTicks);\r\n\r\n\t\tvar numericGeneratorOptions = {\r\n\t\t\tmaxTicks: maxTicks,\r\n\t\t\tmin: tickOpts.min,\r\n\t\t\tmax: tickOpts.max,\r\n\t\t\tprecision: tickOpts.precision,\r\n\t\t\tstepSize: helpers$1.valueOrDefault(tickOpts.fixedStepSize, tickOpts.stepSize)\r\n\t\t};\r\n\t\tvar ticks = me.ticks = generateTicks(numericGeneratorOptions, me);\r\n\r\n\t\tme.handleDirectionalChanges();\r\n\r\n\t\t// At this point, we need to update our max and min given the tick values since we have expanded the\r\n\t\t// range of the scale\r\n\t\tme.max = helpers$1.max(ticks);\r\n\t\tme.min = helpers$1.min(ticks);\r\n\r\n\t\tif (tickOpts.reverse) {\r\n\t\t\tticks.reverse();\r\n\r\n\t\t\tme.start = me.max;\r\n\t\t\tme.end = me.min;\r\n\t\t} else {\r\n\t\t\tme.start = me.min;\r\n\t\t\tme.end = me.max;\r\n\t\t}\r\n\t},\r\n\r\n\tconvertTicksToLabels: function() {\r\n\t\tvar me = this;\r\n\t\tme.ticksAsNumbers = me.ticks.slice();\r\n\t\tme.zeroLineIndex = me.ticks.indexOf(0);\r\n\r\n\t\tcore_scale.prototype.convertTicksToLabels.call(me);\r\n\t},\r\n\r\n\t_configure: function() {\r\n\t\tvar me = this;\r\n\t\tvar ticks = me.getTicks();\r\n\t\tvar start = me.min;\r\n\t\tvar end = me.max;\r\n\t\tvar offset;\r\n\r\n\t\tcore_scale.prototype._configure.call(me);\r\n\r\n\t\tif (me.options.offset && ticks.length) {\r\n\t\t\toffset = (end - start) / Math.max(ticks.length - 1, 1) / 2;\r\n\t\t\tstart -= offset;\r\n\t\t\tend += offset;\r\n\t\t}\r\n\t\tme._startValue = start;\r\n\t\tme._endValue = end;\r\n\t\tme._valueRange = end - start;\r\n\t}\r\n});\n\nvar defaultConfig$1 = {\r\n\tposition: 'left',\r\n\tticks: {\r\n\t\tcallback: core_ticks.formatters.linear\r\n\t}\r\n};\r\n\r\nvar DEFAULT_MIN = 0;\r\nvar DEFAULT_MAX = 1;\r\n\r\nfunction getOrCreateStack(stacks, stacked, meta) {\r\n\tvar key = [\r\n\t\tmeta.type,\r\n\t\t// we have a separate stack for stack=undefined datasets when the opts.stacked is undefined\r\n\t\tstacked === undefined && meta.stack === undefined ? meta.index : '',\r\n\t\tmeta.stack\r\n\t].join('.');\r\n\r\n\tif (stacks[key] === undefined) {\r\n\t\tstacks[key] = {\r\n\t\t\tpos: [],\r\n\t\t\tneg: []\r\n\t\t};\r\n\t}\r\n\r\n\treturn stacks[key];\r\n}\r\n\r\nfunction stackData(scale, stacks, meta, data) {\r\n\tvar opts = scale.options;\r\n\tvar stacked = opts.stacked;\r\n\tvar stack = getOrCreateStack(stacks, stacked, meta);\r\n\tvar pos = stack.pos;\r\n\tvar neg = stack.neg;\r\n\tvar ilen = data.length;\r\n\tvar i, value;\r\n\r\n\tfor (i = 0; i < ilen; ++i) {\r\n\t\tvalue = scale._parseValue(data[i]);\r\n\t\tif (isNaN(value.min) || isNaN(value.max) || meta.data[i].hidden) {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\r\n\t\tpos[i] = pos[i] || 0;\r\n\t\tneg[i] = neg[i] || 0;\r\n\r\n\t\tif (opts.relativePoints) {\r\n\t\t\tpos[i] = 100;\r\n\t\t} else if (value.min < 0 || value.max < 0) {\r\n\t\t\tneg[i] += value.min;\r\n\t\t} else {\r\n\t\t\tpos[i] += value.max;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nfunction updateMinMax(scale, meta, data) {\r\n\tvar ilen = data.length;\r\n\tvar i, value;\r\n\r\n\tfor (i = 0; i < ilen; ++i) {\r\n\t\tvalue = scale._parseValue(data[i]);\r\n\t\tif (isNaN(value.min) || isNaN(value.max) || meta.data[i].hidden) {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\r\n\t\tscale.min = Math.min(scale.min, value.min);\r\n\t\tscale.max = Math.max(scale.max, value.max);\r\n\t}\r\n}\r\n\r\nvar scale_linear = scale_linearbase.extend({\r\n\tdetermineDataLimits: function() {\r\n\t\tvar me = this;\r\n\t\tvar opts = me.options;\r\n\t\tvar chart = me.chart;\r\n\t\tvar datasets = chart.data.datasets;\r\n\t\tvar metasets = me._getMatchingVisibleMetas();\r\n\t\tvar hasStacks = opts.stacked;\r\n\t\tvar stacks = {};\r\n\t\tvar ilen = metasets.length;\r\n\t\tvar i, meta, data, values;\r\n\r\n\t\tme.min = Number.POSITIVE_INFINITY;\r\n\t\tme.max = Number.NEGATIVE_INFINITY;\r\n\r\n\t\tif (hasStacks === undefined) {\r\n\t\t\tfor (i = 0; !hasStacks && i < ilen; ++i) {\r\n\t\t\t\tmeta = metasets[i];\r\n\t\t\t\thasStacks = meta.stack !== undefined;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor (i = 0; i < ilen; ++i) {\r\n\t\t\tmeta = metasets[i];\r\n\t\t\tdata = datasets[meta.index].data;\r\n\t\t\tif (hasStacks) {\r\n\t\t\t\tstackData(me, stacks, meta, data);\r\n\t\t\t} else {\r\n\t\t\t\tupdateMinMax(me, meta, data);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\thelpers$1.each(stacks, function(stackValues) {\r\n\t\t\tvalues = stackValues.pos.concat(stackValues.neg);\r\n\t\t\tme.min = Math.min(me.min, helpers$1.min(values));\r\n\t\t\tme.max = Math.max(me.max, helpers$1.max(values));\r\n\t\t});\r\n\r\n\t\tme.min = helpers$1.isFinite(me.min) && !isNaN(me.min) ? me.min : DEFAULT_MIN;\r\n\t\tme.max = helpers$1.isFinite(me.max) && !isNaN(me.max) ? me.max : DEFAULT_MAX;\r\n\r\n\t\t// Common base implementation to handle ticks.min, ticks.max, ticks.beginAtZero\r\n\t\tme.handleTickRangeOptions();\r\n\t},\r\n\r\n\t// Returns the maximum number of ticks based on the scale dimension\r\n\t_computeTickLimit: function() {\r\n\t\tvar me = this;\r\n\t\tvar tickFont;\r\n\r\n\t\tif (me.isHorizontal()) {\r\n\t\t\treturn Math.ceil(me.width / 40);\r\n\t\t}\r\n\t\ttickFont = helpers$1.options._parseFont(me.options.ticks);\r\n\t\treturn Math.ceil(me.height / tickFont.lineHeight);\r\n\t},\r\n\r\n\t// Called after the ticks are built. We need\r\n\thandleDirectionalChanges: function() {\r\n\t\tif (!this.isHorizontal()) {\r\n\t\t\t// We are in a vertical orientation. The top value is the highest. So reverse the array\r\n\t\t\tthis.ticks.reverse();\r\n\t\t}\r\n\t},\r\n\r\n\tgetLabelForIndex: function(index, datasetIndex) {\r\n\t\treturn this._getScaleLabel(this.chart.data.datasets[datasetIndex].data[index]);\r\n\t},\r\n\r\n\t// Utils\r\n\tgetPixelForValue: function(value) {\r\n\t\tvar me = this;\r\n\t\treturn me.getPixelForDecimal((+me.getRightValue(value) - me._startValue) / me._valueRange);\r\n\t},\r\n\r\n\tgetValueForPixel: function(pixel) {\r\n\t\treturn this._startValue + this.getDecimalForPixel(pixel) * this._valueRange;\r\n\t},\r\n\r\n\tgetPixelForTick: function(index) {\r\n\t\tvar ticks = this.ticksAsNumbers;\r\n\t\tif (index < 0 || index > ticks.length - 1) {\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\treturn this.getPixelForValue(ticks[index]);\r\n\t}\r\n});\r\n\r\n// INTERNAL: static default options, registered in src/index.js\r\nvar _defaults$1 = defaultConfig$1;\nscale_linear._defaults = _defaults$1;\n\nvar valueOrDefault$b = helpers$1.valueOrDefault;\r\nvar log10 = helpers$1.math.log10;\r\n\r\n/**\r\n * Generate a set of logarithmic ticks\r\n * @param generationOptions the options used to generate the ticks\r\n * @param dataRange the range of the data\r\n * @returns {number[]} array of tick values\r\n */\r\nfunction generateTicks$1(generationOptions, dataRange) {\r\n\tvar ticks = [];\r\n\r\n\tvar tickVal = valueOrDefault$b(generationOptions.min, Math.pow(10, Math.floor(log10(dataRange.min))));\r\n\r\n\tvar endExp = Math.floor(log10(dataRange.max));\r\n\tvar endSignificand = Math.ceil(dataRange.max / Math.pow(10, endExp));\r\n\tvar exp, significand;\r\n\r\n\tif (tickVal === 0) {\r\n\t\texp = Math.floor(log10(dataRange.minNotZero));\r\n\t\tsignificand = Math.floor(dataRange.minNotZero / Math.pow(10, exp));\r\n\r\n\t\tticks.push(tickVal);\r\n\t\ttickVal = significand * Math.pow(10, exp);\r\n\t} else {\r\n\t\texp = Math.floor(log10(tickVal));\r\n\t\tsignificand = Math.floor(tickVal / Math.pow(10, exp));\r\n\t}\r\n\tvar precision = exp < 0 ? Math.pow(10, Math.abs(exp)) : 1;\r\n\r\n\tdo {\r\n\t\tticks.push(tickVal);\r\n\r\n\t\t++significand;\r\n\t\tif (significand === 10) {\r\n\t\t\tsignificand = 1;\r\n\t\t\t++exp;\r\n\t\t\tprecision = exp >= 0 ? 1 : precision;\r\n\t\t}\r\n\r\n\t\ttickVal = Math.round(significand * Math.pow(10, exp) * precision) / precision;\r\n\t} while (exp < endExp || (exp === endExp && significand < endSignificand));\r\n\r\n\tvar lastTick = valueOrDefault$b(generationOptions.max, tickVal);\r\n\tticks.push(lastTick);\r\n\r\n\treturn ticks;\r\n}\r\n\r\nvar defaultConfig$2 = {\r\n\tposition: 'left',\r\n\r\n\t// label settings\r\n\tticks: {\r\n\t\tcallback: core_ticks.formatters.logarithmic\r\n\t}\r\n};\r\n\r\n// TODO(v3): change this to positiveOrDefault\r\nfunction nonNegativeOrDefault(value, defaultValue) {\r\n\treturn helpers$1.isFinite(value) && value >= 0 ? value : defaultValue;\r\n}\r\n\r\nvar scale_logarithmic = core_scale.extend({\r\n\tdetermineDataLimits: function() {\r\n\t\tvar me = this;\r\n\t\tvar opts = me.options;\r\n\t\tvar chart = me.chart;\r\n\t\tvar datasets = chart.data.datasets;\r\n\t\tvar isHorizontal = me.isHorizontal();\r\n\t\tfunction IDMatches(meta) {\r\n\t\t\treturn isHorizontal ? meta.xAxisID === me.id : meta.yAxisID === me.id;\r\n\t\t}\r\n\t\tvar datasetIndex, meta, value, data, i, ilen;\r\n\r\n\t\t// Calculate Range\r\n\t\tme.min = Number.POSITIVE_INFINITY;\r\n\t\tme.max = Number.NEGATIVE_INFINITY;\r\n\t\tme.minNotZero = Number.POSITIVE_INFINITY;\r\n\r\n\t\tvar hasStacks = opts.stacked;\r\n\t\tif (hasStacks === undefined) {\r\n\t\t\tfor (datasetIndex = 0; datasetIndex < datasets.length; datasetIndex++) {\r\n\t\t\t\tmeta = chart.getDatasetMeta(datasetIndex);\r\n\t\t\t\tif (chart.isDatasetVisible(datasetIndex) && IDMatches(meta) &&\r\n\t\t\t\t\tmeta.stack !== undefined) {\r\n\t\t\t\t\thasStacks = true;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (opts.stacked || hasStacks) {\r\n\t\t\tvar valuesPerStack = {};\r\n\r\n\t\t\tfor (datasetIndex = 0; datasetIndex < datasets.length; datasetIndex++) {\r\n\t\t\t\tmeta = chart.getDatasetMeta(datasetIndex);\r\n\t\t\t\tvar key = [\r\n\t\t\t\t\tmeta.type,\r\n\t\t\t\t\t// we have a separate stack for stack=undefined datasets when the opts.stacked is undefined\r\n\t\t\t\t\t((opts.stacked === undefined && meta.stack === undefined) ? datasetIndex : ''),\r\n\t\t\t\t\tmeta.stack\r\n\t\t\t\t].join('.');\r\n\r\n\t\t\t\tif (chart.isDatasetVisible(datasetIndex) && IDMatches(meta)) {\r\n\t\t\t\t\tif (valuesPerStack[key] === undefined) {\r\n\t\t\t\t\t\tvaluesPerStack[key] = [];\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tdata = datasets[datasetIndex].data;\r\n\t\t\t\t\tfor (i = 0, ilen = data.length; i < ilen; i++) {\r\n\t\t\t\t\t\tvar values = valuesPerStack[key];\r\n\t\t\t\t\t\tvalue = me._parseValue(data[i]);\r\n\t\t\t\t\t\t// invalid, hidden and negative values are ignored\r\n\t\t\t\t\t\tif (isNaN(value.min) || isNaN(value.max) || meta.data[i].hidden || value.min < 0 || value.max < 0) {\r\n\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tvalues[i] = values[i] || 0;\r\n\t\t\t\t\t\tvalues[i] += value.max;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\thelpers$1.each(valuesPerStack, function(valuesForType) {\r\n\t\t\t\tif (valuesForType.length > 0) {\r\n\t\t\t\t\tvar minVal = helpers$1.min(valuesForType);\r\n\t\t\t\t\tvar maxVal = helpers$1.max(valuesForType);\r\n\t\t\t\t\tme.min = Math.min(me.min, minVal);\r\n\t\t\t\t\tme.max = Math.max(me.max, maxVal);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t} else {\r\n\t\t\tfor (datasetIndex = 0; datasetIndex < datasets.length; datasetIndex++) {\r\n\t\t\t\tmeta = chart.getDatasetMeta(datasetIndex);\r\n\t\t\t\tif (chart.isDatasetVisible(datasetIndex) && IDMatches(meta)) {\r\n\t\t\t\t\tdata = datasets[datasetIndex].data;\r\n\t\t\t\t\tfor (i = 0, ilen = data.length; i < ilen; i++) {\r\n\t\t\t\t\t\tvalue = me._parseValue(data[i]);\r\n\t\t\t\t\t\t// invalid, hidden and negative values are ignored\r\n\t\t\t\t\t\tif (isNaN(value.min) || isNaN(value.max) || meta.data[i].hidden || value.min < 0 || value.max < 0) {\r\n\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tme.min = Math.min(value.min, me.min);\r\n\t\t\t\t\t\tme.max = Math.max(value.max, me.max);\r\n\r\n\t\t\t\t\t\tif (value.min !== 0) {\r\n\t\t\t\t\t\t\tme.minNotZero = Math.min(value.min, me.minNotZero);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tme.min = helpers$1.isFinite(me.min) ? me.min : null;\r\n\t\tme.max = helpers$1.isFinite(me.max) ? me.max : null;\r\n\t\tme.minNotZero = helpers$1.isFinite(me.minNotZero) ? me.minNotZero : null;\r\n\r\n\t\t// Common base implementation to handle ticks.min, ticks.max\r\n\t\tthis.handleTickRangeOptions();\r\n\t},\r\n\r\n\thandleTickRangeOptions: function() {\r\n\t\tvar me = this;\r\n\t\tvar tickOpts = me.options.ticks;\r\n\t\tvar DEFAULT_MIN = 1;\r\n\t\tvar DEFAULT_MAX = 10;\r\n\r\n\t\tme.min = nonNegativeOrDefault(tickOpts.min, me.min);\r\n\t\tme.max = nonNegativeOrDefault(tickOpts.max, me.max);\r\n\r\n\t\tif (me.min === me.max) {\r\n\t\t\tif (me.min !== 0 && me.min !== null) {\r\n\t\t\t\tme.min = Math.pow(10, Math.floor(log10(me.min)) - 1);\r\n\t\t\t\tme.max = Math.pow(10, Math.floor(log10(me.max)) + 1);\r\n\t\t\t} else {\r\n\t\t\t\tme.min = DEFAULT_MIN;\r\n\t\t\t\tme.max = DEFAULT_MAX;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (me.min === null) {\r\n\t\t\tme.min = Math.pow(10, Math.floor(log10(me.max)) - 1);\r\n\t\t}\r\n\t\tif (me.max === null) {\r\n\t\t\tme.max = me.min !== 0\r\n\t\t\t\t? Math.pow(10, Math.floor(log10(me.min)) + 1)\r\n\t\t\t\t: DEFAULT_MAX;\r\n\t\t}\r\n\t\tif (me.minNotZero === null) {\r\n\t\t\tif (me.min > 0) {\r\n\t\t\t\tme.minNotZero = me.min;\r\n\t\t\t} else if (me.max < 1) {\r\n\t\t\t\tme.minNotZero = Math.pow(10, Math.floor(log10(me.max)));\r\n\t\t\t} else {\r\n\t\t\t\tme.minNotZero = DEFAULT_MIN;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tbuildTicks: function() {\r\n\t\tvar me = this;\r\n\t\tvar tickOpts = me.options.ticks;\r\n\t\tvar reverse = !me.isHorizontal();\r\n\r\n\t\tvar generationOptions = {\r\n\t\t\tmin: nonNegativeOrDefault(tickOpts.min),\r\n\t\t\tmax: nonNegativeOrDefault(tickOpts.max)\r\n\t\t};\r\n\t\tvar ticks = me.ticks = generateTicks$1(generationOptions, me);\r\n\r\n\t\t// At this point, we need to update our max and min given the tick values since we have expanded the\r\n\t\t// range of the scale\r\n\t\tme.max = helpers$1.max(ticks);\r\n\t\tme.min = helpers$1.min(ticks);\r\n\r\n\t\tif (tickOpts.reverse) {\r\n\t\t\treverse = !reverse;\r\n\t\t\tme.start = me.max;\r\n\t\t\tme.end = me.min;\r\n\t\t} else {\r\n\t\t\tme.start = me.min;\r\n\t\t\tme.end = me.max;\r\n\t\t}\r\n\t\tif (reverse) {\r\n\t\t\tticks.reverse();\r\n\t\t}\r\n\t},\r\n\r\n\tconvertTicksToLabels: function() {\r\n\t\tthis.tickValues = this.ticks.slice();\r\n\r\n\t\tcore_scale.prototype.convertTicksToLabels.call(this);\r\n\t},\r\n\r\n\t// Get the correct tooltip label\r\n\tgetLabelForIndex: function(index, datasetIndex) {\r\n\t\treturn this._getScaleLabel(this.chart.data.datasets[datasetIndex].data[index]);\r\n\t},\r\n\r\n\tgetPixelForTick: function(index) {\r\n\t\tvar ticks = this.tickValues;\r\n\t\tif (index < 0 || index > ticks.length - 1) {\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\treturn this.getPixelForValue(ticks[index]);\r\n\t},\r\n\r\n\t/**\r\n\t * Returns the value of the first tick.\r\n\t * @param {number} value - The minimum not zero value.\r\n\t * @return {number} The first tick value.\r\n\t * @private\r\n\t */\r\n\t_getFirstTickValue: function(value) {\r\n\t\tvar exp = Math.floor(log10(value));\r\n\t\tvar significand = Math.floor(value / Math.pow(10, exp));\r\n\r\n\t\treturn significand * Math.pow(10, exp);\r\n\t},\r\n\r\n\t_configure: function() {\r\n\t\tvar me = this;\r\n\t\tvar start = me.min;\r\n\t\tvar offset = 0;\r\n\r\n\t\tcore_scale.prototype._configure.call(me);\r\n\r\n\t\tif (start === 0) {\r\n\t\t\tstart = me._getFirstTickValue(me.minNotZero);\r\n\t\t\toffset = valueOrDefault$b(me.options.ticks.fontSize, core_defaults.global.defaultFontSize) / me._length;\r\n\t\t}\r\n\r\n\t\tme._startValue = log10(start);\r\n\t\tme._valueOffset = offset;\r\n\t\tme._valueRange = (log10(me.max) - log10(start)) / (1 - offset);\r\n\t},\r\n\r\n\tgetPixelForValue: function(value) {\r\n\t\tvar me = this;\r\n\t\tvar decimal = 0;\r\n\r\n\t\tvalue = +me.getRightValue(value);\r\n\r\n\t\tif (value > me.min && value > 0) {\r\n\t\t\tdecimal = (log10(value) - me._startValue) / me._valueRange + me._valueOffset;\r\n\t\t}\r\n\t\treturn me.getPixelForDecimal(decimal);\r\n\t},\r\n\r\n\tgetValueForPixel: function(pixel) {\r\n\t\tvar me = this;\r\n\t\tvar decimal = me.getDecimalForPixel(pixel);\r\n\t\treturn decimal === 0 && me.min === 0\r\n\t\t\t? 0\r\n\t\t\t: Math.pow(10, me._startValue + (decimal - me._valueOffset) * me._valueRange);\r\n\t}\r\n});\r\n\r\n// INTERNAL: static default options, registered in src/index.js\r\nvar _defaults$2 = defaultConfig$2;\nscale_logarithmic._defaults = _defaults$2;\n\nvar valueOrDefault$c = helpers$1.valueOrDefault;\r\nvar valueAtIndexOrDefault$1 = helpers$1.valueAtIndexOrDefault;\r\nvar resolve$4 = helpers$1.options.resolve;\r\n\r\nvar defaultConfig$3 = {\r\n\tdisplay: true,\r\n\r\n\t// Boolean - Whether to animate scaling the chart from the centre\r\n\tanimate: true,\r\n\tposition: 'chartArea',\r\n\r\n\tangleLines: {\r\n\t\tdisplay: true,\r\n\t\tcolor: 'rgba(0,0,0,0.1)',\r\n\t\tlineWidth: 1,\r\n\t\tborderDash: [],\r\n\t\tborderDashOffset: 0.0\r\n\t},\r\n\r\n\tgridLines: {\r\n\t\tcircular: false\r\n\t},\r\n\r\n\t// label settings\r\n\tticks: {\r\n\t\t// Boolean - Show a backdrop to the scale label\r\n\t\tshowLabelBackdrop: true,\r\n\r\n\t\t// String - The colour of the label backdrop\r\n\t\tbackdropColor: 'rgba(255,255,255,0.75)',\r\n\r\n\t\t// Number - The backdrop padding above & below the label in pixels\r\n\t\tbackdropPaddingY: 2,\r\n\r\n\t\t// Number - The backdrop padding to the side of the label in pixels\r\n\t\tbackdropPaddingX: 2,\r\n\r\n\t\tcallback: core_ticks.formatters.linear\r\n\t},\r\n\r\n\tpointLabels: {\r\n\t\t// Boolean - if true, show point labels\r\n\t\tdisplay: true,\r\n\r\n\t\t// Number - Point label font size in pixels\r\n\t\tfontSize: 10,\r\n\r\n\t\t// Function - Used to convert point labels\r\n\t\tcallback: function(label) {\r\n\t\t\treturn label;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nfunction getTickBackdropHeight(opts) {\r\n\tvar tickOpts = opts.ticks;\r\n\r\n\tif (tickOpts.display && opts.display) {\r\n\t\treturn valueOrDefault$c(tickOpts.fontSize, core_defaults.global.defaultFontSize) + tickOpts.backdropPaddingY * 2;\r\n\t}\r\n\treturn 0;\r\n}\r\n\r\nfunction measureLabelSize(ctx, lineHeight, label) {\r\n\tif (helpers$1.isArray(label)) {\r\n\t\treturn {\r\n\t\t\tw: helpers$1.longestText(ctx, ctx.font, label),\r\n\t\t\th: label.length * lineHeight\r\n\t\t};\r\n\t}\r\n\r\n\treturn {\r\n\t\tw: ctx.measureText(label).width,\r\n\t\th: lineHeight\r\n\t};\r\n}\r\n\r\nfunction determineLimits(angle, pos, size, min, max) {\r\n\tif (angle === min || angle === max) {\r\n\t\treturn {\r\n\t\t\tstart: pos - (size / 2),\r\n\t\t\tend: pos + (size / 2)\r\n\t\t};\r\n\t} else if (angle < min || angle > max) {\r\n\t\treturn {\r\n\t\t\tstart: pos - size,\r\n\t\t\tend: pos\r\n\t\t};\r\n\t}\r\n\r\n\treturn {\r\n\t\tstart: pos,\r\n\t\tend: pos + size\r\n\t};\r\n}\r\n\r\n/**\r\n * Helper function to fit a radial linear scale with point labels\r\n */\r\nfunction fitWithPointLabels(scale) {\r\n\r\n\t// Right, this is really confusing and there is a lot of maths going on here\r\n\t// The gist of the problem is here: https://gist.github.com/nnnick/696cc9c55f4b0beb8fe9\r\n\t//\r\n\t// Reaction: https://dl.dropboxusercontent.com/u/34601363/toomuchscience.gif\r\n\t//\r\n\t// Solution:\r\n\t//\r\n\t// We assume the radius of the polygon is half the size of the canvas at first\r\n\t// at each index we check if the text overlaps.\r\n\t//\r\n\t// Where it does, we store that angle and that index.\r\n\t//\r\n\t// After finding the largest index and angle we calculate how much we need to remove\r\n\t// from the shape radius to move the point inwards by that x.\r\n\t//\r\n\t// We average the left and right distances to get the maximum shape radius that can fit in the box\r\n\t// along with labels.\r\n\t//\r\n\t// Once we have that, we can find the centre point for the chart, by taking the x text protrusion\r\n\t// on each side, removing that from the size, halving it and adding the left x protrusion width.\r\n\t//\r\n\t// This will mean we have a shape fitted to the canvas, as large as it can be with the labels\r\n\t// and position it in the most space efficient manner\r\n\t//\r\n\t// https://dl.dropboxusercontent.com/u/34601363/yeahscience.gif\r\n\r\n\tvar plFont = helpers$1.options._parseFont(scale.options.pointLabels);\r\n\r\n\t// Get maximum radius of the polygon. Either half the height (minus the text width) or half the width.\r\n\t// Use this to calculate the offset + change. - Make sure L/R protrusion is at least 0 to stop issues with centre points\r\n\tvar furthestLimits = {\r\n\t\tl: 0,\r\n\t\tr: scale.width,\r\n\t\tt: 0,\r\n\t\tb: scale.height - scale.paddingTop\r\n\t};\r\n\tvar furthestAngles = {};\r\n\tvar i, textSize, pointPosition;\r\n\r\n\tscale.ctx.font = plFont.string;\r\n\tscale._pointLabelSizes = [];\r\n\r\n\tvar valueCount = scale.chart.data.labels.length;\r\n\tfor (i = 0; i < valueCount; i++) {\r\n\t\tpointPosition = scale.getPointPosition(i, scale.drawingArea + 5);\r\n\t\ttextSize = measureLabelSize(scale.ctx, plFont.lineHeight, scale.pointLabels[i]);\r\n\t\tscale._pointLabelSizes[i] = textSize;\r\n\r\n\t\t// Add quarter circle to make degree 0 mean top of circle\r\n\t\tvar angleRadians = scale.getIndexAngle(i);\r\n\t\tvar angle = helpers$1.toDegrees(angleRadians) % 360;\r\n\t\tvar hLimits = determineLimits(angle, pointPosition.x, textSize.w, 0, 180);\r\n\t\tvar vLimits = determineLimits(angle, pointPosition.y, textSize.h, 90, 270);\r\n\r\n\t\tif (hLimits.start < furthestLimits.l) {\r\n\t\t\tfurthestLimits.l = hLimits.start;\r\n\t\t\tfurthestAngles.l = angleRadians;\r\n\t\t}\r\n\r\n\t\tif (hLimits.end > furthestLimits.r) {\r\n\t\t\tfurthestLimits.r = hLimits.end;\r\n\t\t\tfurthestAngles.r = angleRadians;\r\n\t\t}\r\n\r\n\t\tif (vLimits.start < furthestLimits.t) {\r\n\t\t\tfurthestLimits.t = vLimits.start;\r\n\t\t\tfurthestAngles.t = angleRadians;\r\n\t\t}\r\n\r\n\t\tif (vLimits.end > furthestLimits.b) {\r\n\t\t\tfurthestLimits.b = vLimits.end;\r\n\t\t\tfurthestAngles.b = angleRadians;\r\n\t\t}\r\n\t}\r\n\r\n\tscale.setReductions(scale.drawingArea, furthestLimits, furthestAngles);\r\n}\r\n\r\nfunction getTextAlignForAngle(angle) {\r\n\tif (angle === 0 || angle === 180) {\r\n\t\treturn 'center';\r\n\t} else if (angle < 180) {\r\n\t\treturn 'left';\r\n\t}\r\n\r\n\treturn 'right';\r\n}\r\n\r\nfunction fillText(ctx, text, position, lineHeight) {\r\n\tvar y = position.y + lineHeight / 2;\r\n\tvar i, ilen;\r\n\r\n\tif (helpers$1.isArray(text)) {\r\n\t\tfor (i = 0, ilen = text.length; i < ilen; ++i) {\r\n\t\t\tctx.fillText(text[i], position.x, y);\r\n\t\t\ty += lineHeight;\r\n\t\t}\r\n\t} else {\r\n\t\tctx.fillText(text, position.x, y);\r\n\t}\r\n}\r\n\r\nfunction adjustPointPositionForLabelHeight(angle, textSize, position) {\r\n\tif (angle === 90 || angle === 270) {\r\n\t\tposition.y -= (textSize.h / 2);\r\n\t} else if (angle > 270 || angle < 90) {\r\n\t\tposition.y -= textSize.h;\r\n\t}\r\n}\r\n\r\nfunction drawPointLabels(scale) {\r\n\tvar ctx = scale.ctx;\r\n\tvar opts = scale.options;\r\n\tvar pointLabelOpts = opts.pointLabels;\r\n\tvar tickBackdropHeight = getTickBackdropHeight(opts);\r\n\tvar outerDistance = scale.getDistanceFromCenterForValue(opts.ticks.reverse ? scale.min : scale.max);\r\n\tvar plFont = helpers$1.options._parseFont(pointLabelOpts);\r\n\r\n\tctx.save();\r\n\r\n\tctx.font = plFont.string;\r\n\tctx.textBaseline = 'middle';\r\n\r\n\tfor (var i = scale.chart.data.labels.length - 1; i >= 0; i--) {\r\n\t\t// Extra pixels out for some label spacing\r\n\t\tvar extra = (i === 0 ? tickBackdropHeight / 2 : 0);\r\n\t\tvar pointLabelPosition = scale.getPointPosition(i, outerDistance + extra + 5);\r\n\r\n\t\t// Keep this in loop since we may support array properties here\r\n\t\tvar pointLabelFontColor = valueAtIndexOrDefault$1(pointLabelOpts.fontColor, i, core_defaults.global.defaultFontColor);\r\n\t\tctx.fillStyle = pointLabelFontColor;\r\n\r\n\t\tvar angleRadians = scale.getIndexAngle(i);\r\n\t\tvar angle = helpers$1.toDegrees(angleRadians);\r\n\t\tctx.textAlign = getTextAlignForAngle(angle);\r\n\t\tadjustPointPositionForLabelHeight(angle, scale._pointLabelSizes[i], pointLabelPosition);\r\n\t\tfillText(ctx, scale.pointLabels[i], pointLabelPosition, plFont.lineHeight);\r\n\t}\r\n\tctx.restore();\r\n}\r\n\r\nfunction drawRadiusLine(scale, gridLineOpts, radius, index) {\r\n\tvar ctx = scale.ctx;\r\n\tvar circular = gridLineOpts.circular;\r\n\tvar valueCount = scale.chart.data.labels.length;\r\n\tvar lineColor = valueAtIndexOrDefault$1(gridLineOpts.color, index - 1);\r\n\tvar lineWidth = valueAtIndexOrDefault$1(gridLineOpts.lineWidth, index - 1);\r\n\tvar pointPosition;\r\n\r\n\tif ((!circular && !valueCount) || !lineColor || !lineWidth) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tctx.save();\r\n\tctx.strokeStyle = lineColor;\r\n\tctx.lineWidth = lineWidth;\r\n\tif (ctx.setLineDash) {\r\n\t\tctx.setLineDash(gridLineOpts.borderDash || []);\r\n\t\tctx.lineDashOffset = gridLineOpts.borderDashOffset || 0.0;\r\n\t}\r\n\r\n\tctx.beginPath();\r\n\tif (circular) {\r\n\t\t// Draw circular arcs between the points\r\n\t\tctx.arc(scale.xCenter, scale.yCenter, radius, 0, Math.PI * 2);\r\n\t} else {\r\n\t\t// Draw straight lines connecting each index\r\n\t\tpointPosition = scale.getPointPosition(0, radius);\r\n\t\tctx.moveTo(pointPosition.x, pointPosition.y);\r\n\r\n\t\tfor (var i = 1; i < valueCount; i++) {\r\n\t\t\tpointPosition = scale.getPointPosition(i, radius);\r\n\t\t\tctx.lineTo(pointPosition.x, pointPosition.y);\r\n\t\t}\r\n\t}\r\n\tctx.closePath();\r\n\tctx.stroke();\r\n\tctx.restore();\r\n}\r\n\r\nfunction numberOrZero(param) {\r\n\treturn helpers$1.isNumber(param) ? param : 0;\r\n}\r\n\r\nvar scale_radialLinear = scale_linearbase.extend({\r\n\tsetDimensions: function() {\r\n\t\tvar me = this;\r\n\r\n\t\t// Set the unconstrained dimension before label rotation\r\n\t\tme.width = me.maxWidth;\r\n\t\tme.height = me.maxHeight;\r\n\t\tme.paddingTop = getTickBackdropHeight(me.options) / 2;\r\n\t\tme.xCenter = Math.floor(me.width / 2);\r\n\t\tme.yCenter = Math.floor((me.height - me.paddingTop) / 2);\r\n\t\tme.drawingArea = Math.min(me.height - me.paddingTop, me.width) / 2;\r\n\t},\r\n\r\n\tdetermineDataLimits: function() {\r\n\t\tvar me = this;\r\n\t\tvar chart = me.chart;\r\n\t\tvar min = Number.POSITIVE_INFINITY;\r\n\t\tvar max = Number.NEGATIVE_INFINITY;\r\n\r\n\t\thelpers$1.each(chart.data.datasets, function(dataset, datasetIndex) {\r\n\t\t\tif (chart.isDatasetVisible(datasetIndex)) {\r\n\t\t\t\tvar meta = chart.getDatasetMeta(datasetIndex);\r\n\r\n\t\t\t\thelpers$1.each(dataset.data, function(rawValue, index) {\r\n\t\t\t\t\tvar value = +me.getRightValue(rawValue);\r\n\t\t\t\t\tif (isNaN(value) || meta.data[index].hidden) {\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tmin = Math.min(value, min);\r\n\t\t\t\t\tmax = Math.max(value, max);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tme.min = (min === Number.POSITIVE_INFINITY ? 0 : min);\r\n\t\tme.max = (max === Number.NEGATIVE_INFINITY ? 0 : max);\r\n\r\n\t\t// Common base implementation to handle ticks.min, ticks.max, ticks.beginAtZero\r\n\t\tme.handleTickRangeOptions();\r\n\t},\r\n\r\n\t// Returns the maximum number of ticks based on the scale dimension\r\n\t_computeTickLimit: function() {\r\n\t\treturn Math.ceil(this.drawingArea / getTickBackdropHeight(this.options));\r\n\t},\r\n\r\n\tconvertTicksToLabels: function() {\r\n\t\tvar me = this;\r\n\r\n\t\tscale_linearbase.prototype.convertTicksToLabels.call(me);\r\n\r\n\t\t// Point labels\r\n\t\tme.pointLabels = me.chart.data.labels.map(function() {\r\n\t\t\tvar label = helpers$1.callback(me.options.pointLabels.callback, arguments, me);\r\n\t\t\treturn label || label === 0 ? label : '';\r\n\t\t});\r\n\t},\r\n\r\n\tgetLabelForIndex: function(index, datasetIndex) {\r\n\t\treturn +this.getRightValue(this.chart.data.datasets[datasetIndex].data[index]);\r\n\t},\r\n\r\n\tfit: function() {\r\n\t\tvar me = this;\r\n\t\tvar opts = me.options;\r\n\r\n\t\tif (opts.display && opts.pointLabels.display) {\r\n\t\t\tfitWithPointLabels(me);\r\n\t\t} else {\r\n\t\t\tme.setCenterPoint(0, 0, 0, 0);\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Set radius reductions and determine new radius and center point\r\n\t * @private\r\n\t */\r\n\tsetReductions: function(largestPossibleRadius, furthestLimits, furthestAngles) {\r\n\t\tvar me = this;\r\n\t\tvar radiusReductionLeft = furthestLimits.l / Math.sin(furthestAngles.l);\r\n\t\tvar radiusReductionRight = Math.max(furthestLimits.r - me.width, 0) / Math.sin(furthestAngles.r);\r\n\t\tvar radiusReductionTop = -furthestLimits.t / Math.cos(furthestAngles.t);\r\n\t\tvar radiusReductionBottom = -Math.max(furthestLimits.b - (me.height - me.paddingTop), 0) / Math.cos(furthestAngles.b);\r\n\r\n\t\tradiusReductionLeft = numberOrZero(radiusReductionLeft);\r\n\t\tradiusReductionRight = numberOrZero(radiusReductionRight);\r\n\t\tradiusReductionTop = numberOrZero(radiusReductionTop);\r\n\t\tradiusReductionBottom = numberOrZero(radiusReductionBottom);\r\n\r\n\t\tme.drawingArea = Math.min(\r\n\t\t\tMath.floor(largestPossibleRadius - (radiusReductionLeft + radiusReductionRight) / 2),\r\n\t\t\tMath.floor(largestPossibleRadius - (radiusReductionTop + radiusReductionBottom) / 2));\r\n\t\tme.setCenterPoint(radiusReductionLeft, radiusReductionRight, radiusReductionTop, radiusReductionBottom);\r\n\t},\r\n\r\n\tsetCenterPoint: function(leftMovement, rightMovement, topMovement, bottomMovement) {\r\n\t\tvar me = this;\r\n\t\tvar maxRight = me.width - rightMovement - me.drawingArea;\r\n\t\tvar maxLeft = leftMovement + me.drawingArea;\r\n\t\tvar maxTop = topMovement + me.drawingArea;\r\n\t\tvar maxBottom = (me.height - me.paddingTop) - bottomMovement - me.drawingArea;\r\n\r\n\t\tme.xCenter = Math.floor(((maxLeft + maxRight) / 2) + me.left);\r\n\t\tme.yCenter = Math.floor(((maxTop + maxBottom) / 2) + me.top + me.paddingTop);\r\n\t},\r\n\r\n\tgetIndexAngle: function(index) {\r\n\t\tvar chart = this.chart;\r\n\t\tvar angleMultiplier = 360 / chart.data.labels.length;\r\n\t\tvar options = chart.options || {};\r\n\t\tvar startAngle = options.startAngle || 0;\r\n\r\n\t\t// Start from the top instead of right, so remove a quarter of the circle\r\n\t\tvar angle = (index * angleMultiplier + startAngle) % 360;\r\n\r\n\t\treturn (angle < 0 ? angle + 360 : angle) * Math.PI * 2 / 360;\r\n\t},\r\n\r\n\tgetDistanceFromCenterForValue: function(value) {\r\n\t\tvar me = this;\r\n\r\n\t\tif (helpers$1.isNullOrUndef(value)) {\r\n\t\t\treturn NaN;\r\n\t\t}\r\n\r\n\t\t// Take into account half font size + the yPadding of the top value\r\n\t\tvar scalingFactor = me.drawingArea / (me.max - me.min);\r\n\t\tif (me.options.ticks.reverse) {\r\n\t\t\treturn (me.max - value) * scalingFactor;\r\n\t\t}\r\n\t\treturn (value - me.min) * scalingFactor;\r\n\t},\r\n\r\n\tgetPointPosition: function(index, distanceFromCenter) {\r\n\t\tvar me = this;\r\n\t\tvar thisAngle = me.getIndexAngle(index) - (Math.PI / 2);\r\n\t\treturn {\r\n\t\t\tx: Math.cos(thisAngle) * distanceFromCenter + me.xCenter,\r\n\t\t\ty: Math.sin(thisAngle) * distanceFromCenter + me.yCenter\r\n\t\t};\r\n\t},\r\n\r\n\tgetPointPositionForValue: function(index, value) {\r\n\t\treturn this.getPointPosition(index, this.getDistanceFromCenterForValue(value));\r\n\t},\r\n\r\n\tgetBasePosition: function(index) {\r\n\t\tvar me = this;\r\n\t\tvar min = me.min;\r\n\t\tvar max = me.max;\r\n\r\n\t\treturn me.getPointPositionForValue(index || 0,\r\n\t\t\tme.beginAtZero ? 0 :\r\n\t\t\tmin < 0 && max < 0 ? max :\r\n\t\t\tmin > 0 && max > 0 ? min :\r\n\t\t\t0);\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_drawGrid: function() {\r\n\t\tvar me = this;\r\n\t\tvar ctx = me.ctx;\r\n\t\tvar opts = me.options;\r\n\t\tvar gridLineOpts = opts.gridLines;\r\n\t\tvar angleLineOpts = opts.angleLines;\r\n\t\tvar lineWidth = valueOrDefault$c(angleLineOpts.lineWidth, gridLineOpts.lineWidth);\r\n\t\tvar lineColor = valueOrDefault$c(angleLineOpts.color, gridLineOpts.color);\r\n\t\tvar i, offset, position;\r\n\r\n\t\tif (opts.pointLabels.display) {\r\n\t\t\tdrawPointLabels(me);\r\n\t\t}\r\n\r\n\t\tif (gridLineOpts.display) {\r\n\t\t\thelpers$1.each(me.ticks, function(label, index) {\r\n\t\t\t\tif (index !== 0) {\r\n\t\t\t\t\toffset = me.getDistanceFromCenterForValue(me.ticksAsNumbers[index]);\r\n\t\t\t\t\tdrawRadiusLine(me, gridLineOpts, offset, index);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tif (angleLineOpts.display && lineWidth && lineColor) {\r\n\t\t\tctx.save();\r\n\t\t\tctx.lineWidth = lineWidth;\r\n\t\t\tctx.strokeStyle = lineColor;\r\n\t\t\tif (ctx.setLineDash) {\r\n\t\t\t\tctx.setLineDash(resolve$4([angleLineOpts.borderDash, gridLineOpts.borderDash, []]));\r\n\t\t\t\tctx.lineDashOffset = resolve$4([angleLineOpts.borderDashOffset, gridLineOpts.borderDashOffset, 0.0]);\r\n\t\t\t}\r\n\r\n\t\t\tfor (i = me.chart.data.labels.length - 1; i >= 0; i--) {\r\n\t\t\t\toffset = me.getDistanceFromCenterForValue(opts.ticks.reverse ? me.min : me.max);\r\n\t\t\t\tposition = me.getPointPosition(i, offset);\r\n\t\t\t\tctx.beginPath();\r\n\t\t\t\tctx.moveTo(me.xCenter, me.yCenter);\r\n\t\t\t\tctx.lineTo(position.x, position.y);\r\n\t\t\t\tctx.stroke();\r\n\t\t\t}\r\n\r\n\t\t\tctx.restore();\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_drawLabels: function() {\r\n\t\tvar me = this;\r\n\t\tvar ctx = me.ctx;\r\n\t\tvar opts = me.options;\r\n\t\tvar tickOpts = opts.ticks;\r\n\r\n\t\tif (!tickOpts.display) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tvar startAngle = me.getIndexAngle(0);\r\n\t\tvar tickFont = helpers$1.options._parseFont(tickOpts);\r\n\t\tvar tickFontColor = valueOrDefault$c(tickOpts.fontColor, core_defaults.global.defaultFontColor);\r\n\t\tvar offset, width;\r\n\r\n\t\tctx.save();\r\n\t\tctx.font = tickFont.string;\r\n\t\tctx.translate(me.xCenter, me.yCenter);\r\n\t\tctx.rotate(startAngle);\r\n\t\tctx.textAlign = 'center';\r\n\t\tctx.textBaseline = 'middle';\r\n\r\n\t\thelpers$1.each(me.ticks, function(label, index) {\r\n\t\t\tif (index === 0 && !tickOpts.reverse) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\toffset = me.getDistanceFromCenterForValue(me.ticksAsNumbers[index]);\r\n\r\n\t\t\tif (tickOpts.showLabelBackdrop) {\r\n\t\t\t\twidth = ctx.measureText(label).width;\r\n\t\t\t\tctx.fillStyle = tickOpts.backdropColor;\r\n\r\n\t\t\t\tctx.fillRect(\r\n\t\t\t\t\t-width / 2 - tickOpts.backdropPaddingX,\r\n\t\t\t\t\t-offset - tickFont.size / 2 - tickOpts.backdropPaddingY,\r\n\t\t\t\t\twidth + tickOpts.backdropPaddingX * 2,\r\n\t\t\t\t\ttickFont.size + tickOpts.backdropPaddingY * 2\r\n\t\t\t\t);\r\n\t\t\t}\r\n\r\n\t\t\tctx.fillStyle = tickFontColor;\r\n\t\t\tctx.fillText(label, 0, -offset);\r\n\t\t});\r\n\r\n\t\tctx.restore();\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_drawTitle: helpers$1.noop\r\n});\r\n\r\n// INTERNAL: static default options, registered in src/index.js\r\nvar _defaults$3 = defaultConfig$3;\nscale_radialLinear._defaults = _defaults$3;\n\nvar deprecated$1 = helpers$1._deprecated;\r\nvar resolve$5 = helpers$1.options.resolve;\r\nvar valueOrDefault$d = helpers$1.valueOrDefault;\r\n\r\n// Integer constants are from the ES6 spec.\r\nvar MIN_INTEGER = Number.MIN_SAFE_INTEGER || -9007199254740991;\r\nvar MAX_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;\r\n\r\nvar INTERVALS = {\r\n\tmillisecond: {\r\n\t\tcommon: true,\r\n\t\tsize: 1,\r\n\t\tsteps: 1000\r\n\t},\r\n\tsecond: {\r\n\t\tcommon: true,\r\n\t\tsize: 1000,\r\n\t\tsteps: 60\r\n\t},\r\n\tminute: {\r\n\t\tcommon: true,\r\n\t\tsize: 60000,\r\n\t\tsteps: 60\r\n\t},\r\n\thour: {\r\n\t\tcommon: true,\r\n\t\tsize: 3600000,\r\n\t\tsteps: 24\r\n\t},\r\n\tday: {\r\n\t\tcommon: true,\r\n\t\tsize: 86400000,\r\n\t\tsteps: 30\r\n\t},\r\n\tweek: {\r\n\t\tcommon: false,\r\n\t\tsize: 604800000,\r\n\t\tsteps: 4\r\n\t},\r\n\tmonth: {\r\n\t\tcommon: true,\r\n\t\tsize: 2.628e9,\r\n\t\tsteps: 12\r\n\t},\r\n\tquarter: {\r\n\t\tcommon: false,\r\n\t\tsize: 7.884e9,\r\n\t\tsteps: 4\r\n\t},\r\n\tyear: {\r\n\t\tcommon: true,\r\n\t\tsize: 3.154e10\r\n\t}\r\n};\r\n\r\nvar UNITS = Object.keys(INTERVALS);\r\n\r\nfunction sorter(a, b) {\r\n\treturn a - b;\r\n}\r\n\r\nfunction arrayUnique(items) {\r\n\tvar hash = {};\r\n\tvar out = [];\r\n\tvar i, ilen, item;\r\n\r\n\tfor (i = 0, ilen = items.length; i < ilen; ++i) {\r\n\t\titem = items[i];\r\n\t\tif (!hash[item]) {\r\n\t\t\thash[item] = true;\r\n\t\t\tout.push(item);\r\n\t\t}\r\n\t}\r\n\r\n\treturn out;\r\n}\r\n\r\nfunction getMin(options) {\r\n\treturn helpers$1.valueOrDefault(options.time.min, options.ticks.min);\r\n}\r\n\r\nfunction getMax(options) {\r\n\treturn helpers$1.valueOrDefault(options.time.max, options.ticks.max);\r\n}\r\n\r\n/**\r\n * Returns an array of {time, pos} objects used to interpolate a specific `time` or position\r\n * (`pos`) on the scale, by searching entries before and after the requested value. `pos` is\r\n * a decimal between 0 and 1: 0 being the start of the scale (left or top) and 1 the other\r\n * extremity (left + width or top + height). Note that it would be more optimized to directly\r\n * store pre-computed pixels, but the scale dimensions are not guaranteed at the time we need\r\n * to create the lookup table. The table ALWAYS contains at least two items: min and max.\r\n *\r\n * @param {number[]} timestamps - timestamps sorted from lowest to highest.\r\n * @param {string} distribution - If 'linear', timestamps will be spread linearly along the min\r\n * and max range, so basically, the table will contains only two items: {min, 0} and {max, 1}.\r\n * If 'series', timestamps will be positioned at the same distance from each other. In this\r\n * case, only timestamps that break the time linearity are registered, meaning that in the\r\n * best case, all timestamps are linear, the table contains only min and max.\r\n */\r\nfunction buildLookupTable(timestamps, min, max, distribution) {\r\n\tif (distribution === 'linear' || !timestamps.length) {\r\n\t\treturn [\r\n\t\t\t{time: min, pos: 0},\r\n\t\t\t{time: max, pos: 1}\r\n\t\t];\r\n\t}\r\n\r\n\tvar table = [];\r\n\tvar items = [min];\r\n\tvar i, ilen, prev, curr, next;\r\n\r\n\tfor (i = 0, ilen = timestamps.length; i < ilen; ++i) {\r\n\t\tcurr = timestamps[i];\r\n\t\tif (curr > min && curr < max) {\r\n\t\t\titems.push(curr);\r\n\t\t}\r\n\t}\r\n\r\n\titems.push(max);\r\n\r\n\tfor (i = 0, ilen = items.length; i < ilen; ++i) {\r\n\t\tnext = items[i + 1];\r\n\t\tprev = items[i - 1];\r\n\t\tcurr = items[i];\r\n\r\n\t\t// only add points that breaks the scale linearity\r\n\t\tif (prev === undefined || next === undefined || Math.round((next + prev) / 2) !== curr) {\r\n\t\t\ttable.push({time: curr, pos: i / (ilen - 1)});\r\n\t\t}\r\n\t}\r\n\r\n\treturn table;\r\n}\r\n\r\n// @see adapted from https://www.anujgakhar.com/2014/03/01/binary-search-in-javascript/\r\nfunction lookup(table, key, value) {\r\n\tvar lo = 0;\r\n\tvar hi = table.length - 1;\r\n\tvar mid, i0, i1;\r\n\r\n\twhile (lo >= 0 && lo <= hi) {\r\n\t\tmid = (lo + hi) >> 1;\r\n\t\ti0 = table[mid - 1] || null;\r\n\t\ti1 = table[mid];\r\n\r\n\t\tif (!i0) {\r\n\t\t\t// given value is outside table (before first item)\r\n\t\t\treturn {lo: null, hi: i1};\r\n\t\t} else if (i1[key] < value) {\r\n\t\t\tlo = mid + 1;\r\n\t\t} else if (i0[key] > value) {\r\n\t\t\thi = mid - 1;\r\n\t\t} else {\r\n\t\t\treturn {lo: i0, hi: i1};\r\n\t\t}\r\n\t}\r\n\r\n\t// given value is outside table (after last item)\r\n\treturn {lo: i1, hi: null};\r\n}\r\n\r\n/**\r\n * Linearly interpolates the given source `value` using the table items `skey` values and\r\n * returns the associated `tkey` value. For example, interpolate(table, 'time', 42, 'pos')\r\n * returns the position for a timestamp equal to 42. If value is out of bounds, values at\r\n * index [0, 1] or [n - 1, n] are used for the interpolation.\r\n */\r\nfunction interpolate$1(table, skey, sval, tkey) {\r\n\tvar range = lookup(table, skey, sval);\r\n\r\n\t// Note: the lookup table ALWAYS contains at least 2 items (min and max)\r\n\tvar prev = !range.lo ? table[0] : !range.hi ? table[table.length - 2] : range.lo;\r\n\tvar next = !range.lo ? table[1] : !range.hi ? table[table.length - 1] : range.hi;\r\n\r\n\tvar span = next[skey] - prev[skey];\r\n\tvar ratio = span ? (sval - prev[skey]) / span : 0;\r\n\tvar offset = (next[tkey] - prev[tkey]) * ratio;\r\n\r\n\treturn prev[tkey] + offset;\r\n}\r\n\r\nfunction toTimestamp(scale, input) {\r\n\tvar adapter = scale._adapter;\r\n\tvar options = scale.options.time;\r\n\tvar parser = options.parser;\r\n\tvar format = parser || options.format;\r\n\tvar value = input;\r\n\r\n\tif (typeof parser === 'function') {\r\n\t\tvalue = parser(value);\r\n\t}\r\n\r\n\t// Only parse if its not a timestamp already\r\n\tif (!helpers$1.isFinite(value)) {\r\n\t\tvalue = typeof format === 'string'\r\n\t\t\t? adapter.parse(value, format)\r\n\t\t\t: adapter.parse(value);\r\n\t}\r\n\r\n\tif (value !== null) {\r\n\t\treturn +value;\r\n\t}\r\n\r\n\t// Labels are in an incompatible format and no `parser` has been provided.\r\n\t// The user might still use the deprecated `format` option for parsing.\r\n\tif (!parser && typeof format === 'function') {\r\n\t\tvalue = format(input);\r\n\r\n\t\t// `format` could return something else than a timestamp, if so, parse it\r\n\t\tif (!helpers$1.isFinite(value)) {\r\n\t\t\tvalue = adapter.parse(value);\r\n\t\t}\r\n\t}\r\n\r\n\treturn value;\r\n}\r\n\r\nfunction parse(scale, input) {\r\n\tif (helpers$1.isNullOrUndef(input)) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\tvar options = scale.options.time;\r\n\tvar value = toTimestamp(scale, scale.getRightValue(input));\r\n\tif (value === null) {\r\n\t\treturn value;\r\n\t}\r\n\r\n\tif (options.round) {\r\n\t\tvalue = +scale._adapter.startOf(value, options.round);\r\n\t}\r\n\r\n\treturn value;\r\n}\r\n\r\n/**\r\n * Figures out what unit results in an appropriate number of auto-generated ticks\r\n */\r\nfunction determineUnitForAutoTicks(minUnit, min, max, capacity) {\r\n\tvar ilen = UNITS.length;\r\n\tvar i, interval, factor;\r\n\r\n\tfor (i = UNITS.indexOf(minUnit); i < ilen - 1; ++i) {\r\n\t\tinterval = INTERVALS[UNITS[i]];\r\n\t\tfactor = interval.steps ? interval.steps : MAX_INTEGER;\r\n\r\n\t\tif (interval.common && Math.ceil((max - min) / (factor * interval.size)) <= capacity) {\r\n\t\t\treturn UNITS[i];\r\n\t\t}\r\n\t}\r\n\r\n\treturn UNITS[ilen - 1];\r\n}\r\n\r\n/**\r\n * Figures out what unit to format a set of ticks with\r\n */\r\nfunction determineUnitForFormatting(scale, numTicks, minUnit, min, max) {\r\n\tvar i, unit;\r\n\r\n\tfor (i = UNITS.length - 1; i >= UNITS.indexOf(minUnit); i--) {\r\n\t\tunit = UNITS[i];\r\n\t\tif (INTERVALS[unit].common && scale._adapter.diff(max, min, unit) >= numTicks - 1) {\r\n\t\t\treturn unit;\r\n\t\t}\r\n\t}\r\n\r\n\treturn UNITS[minUnit ? UNITS.indexOf(minUnit) : 0];\r\n}\r\n\r\nfunction determineMajorUnit(unit) {\r\n\tfor (var i = UNITS.indexOf(unit) + 1, ilen = UNITS.length; i < ilen; ++i) {\r\n\t\tif (INTERVALS[UNITS[i]].common) {\r\n\t\t\treturn UNITS[i];\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Generates a maximum of `capacity` timestamps between min and max, rounded to the\r\n * `minor` unit using the given scale time `options`.\r\n * Important: this method can return ticks outside the min and max range, it's the\r\n * responsibility of the calling code to clamp values if needed.\r\n */\r\nfunction generate(scale, min, max, capacity) {\r\n\tvar adapter = scale._adapter;\r\n\tvar options = scale.options;\r\n\tvar timeOpts = options.time;\r\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\r\n\tvar stepSize = resolve$5([timeOpts.stepSize, timeOpts.unitStepSize, 1]);\r\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\r\n\tvar first = min;\r\n\tvar ticks = [];\r\n\tvar time;\r\n\r\n\t// For 'week' unit, handle the first day of week option\r\n\tif (weekday) {\r\n\t\tfirst = +adapter.startOf(first, 'isoWeek', weekday);\r\n\t}\r\n\r\n\t// Align first ticks on unit\r\n\tfirst = +adapter.startOf(first, weekday ? 'day' : minor);\r\n\r\n\t// Prevent browser from freezing in case user options request millions of milliseconds\r\n\tif (adapter.diff(max, min, minor) > 100000 * stepSize) {\r\n\t\tthrow min + ' and ' + max + ' are too far apart with stepSize of ' + stepSize + ' ' + minor;\r\n\t}\r\n\r\n\tfor (time = first; time < max; time = +adapter.add(time, stepSize, minor)) {\r\n\t\tticks.push(time);\r\n\t}\r\n\r\n\tif (time === max || options.bounds === 'ticks') {\r\n\t\tticks.push(time);\r\n\t}\r\n\r\n\treturn ticks;\r\n}\r\n\r\n/**\r\n * Returns the start and end offsets from edges in the form of {start, end}\r\n * where each value is a relative width to the scale and ranges between 0 and 1.\r\n * They add extra margins on the both sides by scaling down the original scale.\r\n * Offsets are added when the `offset` option is true.\r\n */\r\nfunction computeOffsets(table, ticks, min, max, options) {\r\n\tvar start = 0;\r\n\tvar end = 0;\r\n\tvar first, last;\r\n\r\n\tif (options.offset && ticks.length) {\r\n\t\tfirst = interpolate$1(table, 'time', ticks[0], 'pos');\r\n\t\tif (ticks.length === 1) {\r\n\t\t\tstart = 1 - first;\r\n\t\t} else {\r\n\t\t\tstart = (interpolate$1(table, 'time', ticks[1], 'pos') - first) / 2;\r\n\t\t}\r\n\t\tlast = interpolate$1(table, 'time', ticks[ticks.length - 1], 'pos');\r\n\t\tif (ticks.length === 1) {\r\n\t\t\tend = last;\r\n\t\t} else {\r\n\t\t\tend = (last - interpolate$1(table, 'time', ticks[ticks.length - 2], 'pos')) / 2;\r\n\t\t}\r\n\t}\r\n\r\n\treturn {start: start, end: end, factor: 1 / (start + 1 + end)};\r\n}\r\n\r\nfunction setMajorTicks(scale, ticks, map, majorUnit) {\r\n\tvar adapter = scale._adapter;\r\n\tvar first = +adapter.startOf(ticks[0].value, majorUnit);\r\n\tvar last = ticks[ticks.length - 1].value;\r\n\tvar major, index;\r\n\r\n\tfor (major = first; major <= last; major = +adapter.add(major, 1, majorUnit)) {\r\n\t\tindex = map[major];\r\n\t\tif (index >= 0) {\r\n\t\t\tticks[index].major = true;\r\n\t\t}\r\n\t}\r\n\treturn ticks;\r\n}\r\n\r\nfunction ticksFromTimestamps(scale, values, majorUnit) {\r\n\tvar ticks = [];\r\n\tvar map = {};\r\n\tvar ilen = values.length;\r\n\tvar i, value;\r\n\r\n\tfor (i = 0; i < ilen; ++i) {\r\n\t\tvalue = values[i];\r\n\t\tmap[value] = i;\r\n\r\n\t\tticks.push({\r\n\t\t\tvalue: value,\r\n\t\t\tmajor: false\r\n\t\t});\r\n\t}\r\n\r\n\t// We set the major ticks separately from the above loop because calling startOf for every tick\r\n\t// is expensive when there is a large number of ticks\r\n\treturn (ilen === 0 || !majorUnit) ? ticks : setMajorTicks(scale, ticks, map, majorUnit);\r\n}\r\n\r\nvar defaultConfig$4 = {\r\n\tposition: 'bottom',\r\n\r\n\t/**\r\n\t * Data distribution along the scale:\r\n\t * - 'linear': data are spread according to their time (distances can vary),\r\n\t * - 'series': data are spread at the same distance from each other.\r\n\t * @see https://github.com/chartjs/Chart.js/pull/4507\r\n\t * @since 2.7.0\r\n\t */\r\n\tdistribution: 'linear',\r\n\r\n\t/**\r\n\t * Scale boundary strategy (bypassed by min/max time options)\r\n\t * - `data`: make sure data are fully visible, ticks outside are removed\r\n\t * - `ticks`: make sure ticks are fully visible, data outside are truncated\r\n\t * @see https://github.com/chartjs/Chart.js/pull/4556\r\n\t * @since 2.7.0\r\n\t */\r\n\tbounds: 'data',\r\n\r\n\tadapters: {},\r\n\ttime: {\r\n\t\tparser: false, // false == a pattern string from https://momentjs.com/docs/#/parsing/string-format/ or a custom callback that converts its argument to a moment\r\n\t\tunit: false, // false == automatic or override with week, month, year, etc.\r\n\t\tround: false, // none, or override with week, month, year, etc.\r\n\t\tdisplayFormat: false, // DEPRECATED\r\n\t\tisoWeekday: false, // override week start day - see https://momentjs.com/docs/#/get-set/iso-weekday/\r\n\t\tminUnit: 'millisecond',\r\n\t\tdisplayFormats: {}\r\n\t},\r\n\tticks: {\r\n\t\tautoSkip: false,\r\n\r\n\t\t/**\r\n\t\t * Ticks generation input values:\r\n\t\t * - 'auto': generates \"optimal\" ticks based on scale size and time options.\r\n\t\t * - 'data': generates ticks from data (including labels from data {t|x|y} objects).\r\n\t\t * - 'labels': generates ticks from user given `data.labels` values ONLY.\r\n\t\t * @see https://github.com/chartjs/Chart.js/pull/4507\r\n\t\t * @since 2.7.0\r\n\t\t */\r\n\t\tsource: 'auto',\r\n\r\n\t\tmajor: {\r\n\t\t\tenabled: false\r\n\t\t}\r\n\t}\r\n};\r\n\r\nvar scale_time = core_scale.extend({\r\n\tinitialize: function() {\r\n\t\tthis.mergeTicksOptions();\r\n\t\tcore_scale.prototype.initialize.call(this);\r\n\t},\r\n\r\n\tupdate: function() {\r\n\t\tvar me = this;\r\n\t\tvar options = me.options;\r\n\t\tvar time = options.time || (options.time = {});\r\n\t\tvar adapter = me._adapter = new core_adapters._date(options.adapters.date);\r\n\r\n\t\t// DEPRECATIONS: output a message only one time per update\r\n\t\tdeprecated$1('time scale', time.format, 'time.format', 'time.parser');\r\n\t\tdeprecated$1('time scale', time.min, 'time.min', 'ticks.min');\r\n\t\tdeprecated$1('time scale', time.max, 'time.max', 'ticks.max');\r\n\r\n\t\t// Backward compatibility: before introducing adapter, `displayFormats` was\r\n\t\t// supposed to contain *all* unit/string pairs but this can't be resolved\r\n\t\t// when loading the scale (adapters are loaded afterward), so let's populate\r\n\t\t// missing formats on update\r\n\t\thelpers$1.mergeIf(time.displayFormats, adapter.formats());\r\n\r\n\t\treturn core_scale.prototype.update.apply(me, arguments);\r\n\t},\r\n\r\n\t/**\r\n\t * Allows data to be referenced via 't' attribute\r\n\t */\r\n\tgetRightValue: function(rawValue) {\r\n\t\tif (rawValue && rawValue.t !== undefined) {\r\n\t\t\trawValue = rawValue.t;\r\n\t\t}\r\n\t\treturn core_scale.prototype.getRightValue.call(this, rawValue);\r\n\t},\r\n\r\n\tdetermineDataLimits: function() {\r\n\t\tvar me = this;\r\n\t\tvar chart = me.chart;\r\n\t\tvar adapter = me._adapter;\r\n\t\tvar options = me.options;\r\n\t\tvar unit = options.time.unit || 'day';\r\n\t\tvar min = MAX_INTEGER;\r\n\t\tvar max = MIN_INTEGER;\r\n\t\tvar timestamps = [];\r\n\t\tvar datasets = [];\r\n\t\tvar labels = [];\r\n\t\tvar i, j, ilen, jlen, data, timestamp, labelsAdded;\r\n\t\tvar dataLabels = me._getLabels();\r\n\r\n\t\tfor (i = 0, ilen = dataLabels.length; i < ilen; ++i) {\r\n\t\t\tlabels.push(parse(me, dataLabels[i]));\r\n\t\t}\r\n\r\n\t\tfor (i = 0, ilen = (chart.data.datasets || []).length; i < ilen; ++i) {\r\n\t\t\tif (chart.isDatasetVisible(i)) {\r\n\t\t\t\tdata = chart.data.datasets[i].data;\r\n\r\n\t\t\t\t// Let's consider that all data have the same format.\r\n\t\t\t\tif (helpers$1.isObject(data[0])) {\r\n\t\t\t\t\tdatasets[i] = [];\r\n\r\n\t\t\t\t\tfor (j = 0, jlen = data.length; j < jlen; ++j) {\r\n\t\t\t\t\t\ttimestamp = parse(me, data[j]);\r\n\t\t\t\t\t\ttimestamps.push(timestamp);\r\n\t\t\t\t\t\tdatasets[i][j] = timestamp;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tdatasets[i] = labels.slice(0);\r\n\t\t\t\t\tif (!labelsAdded) {\r\n\t\t\t\t\t\ttimestamps = timestamps.concat(labels);\r\n\t\t\t\t\t\tlabelsAdded = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tdatasets[i] = [];\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (labels.length) {\r\n\t\t\tmin = Math.min(min, labels[0]);\r\n\t\t\tmax = Math.max(max, labels[labels.length - 1]);\r\n\t\t}\r\n\r\n\t\tif (timestamps.length) {\r\n\t\t\ttimestamps = ilen > 1 ? arrayUnique(timestamps).sort(sorter) : timestamps.sort(sorter);\r\n\t\t\tmin = Math.min(min, timestamps[0]);\r\n\t\t\tmax = Math.max(max, timestamps[timestamps.length - 1]);\r\n\t\t}\r\n\r\n\t\tmin = parse(me, getMin(options)) || min;\r\n\t\tmax = parse(me, getMax(options)) || max;\r\n\r\n\t\t// In case there is no valid min/max, set limits based on unit time option\r\n\t\tmin = min === MAX_INTEGER ? +adapter.startOf(Date.now(), unit) : min;\r\n\t\tmax = max === MIN_INTEGER ? +adapter.endOf(Date.now(), unit) + 1 : max;\r\n\r\n\t\t// Make sure that max is strictly higher than min (required by the lookup table)\r\n\t\tme.min = Math.min(min, max);\r\n\t\tme.max = Math.max(min + 1, max);\r\n\r\n\t\t// PRIVATE\r\n\t\tme._table = [];\r\n\t\tme._timestamps = {\r\n\t\t\tdata: timestamps,\r\n\t\t\tdatasets: datasets,\r\n\t\t\tlabels: labels\r\n\t\t};\r\n\t},\r\n\r\n\tbuildTicks: function() {\r\n\t\tvar me = this;\r\n\t\tvar min = me.min;\r\n\t\tvar max = me.max;\r\n\t\tvar options = me.options;\r\n\t\tvar tickOpts = options.ticks;\r\n\t\tvar timeOpts = options.time;\r\n\t\tvar timestamps = me._timestamps;\r\n\t\tvar ticks = [];\r\n\t\tvar capacity = me.getLabelCapacity(min);\r\n\t\tvar source = tickOpts.source;\r\n\t\tvar distribution = options.distribution;\r\n\t\tvar i, ilen, timestamp;\r\n\r\n\t\tif (source === 'data' || (source === 'auto' && distribution === 'series')) {\r\n\t\t\ttimestamps = timestamps.data;\r\n\t\t} else if (source === 'labels') {\r\n\t\t\ttimestamps = timestamps.labels;\r\n\t\t} else {\r\n\t\t\ttimestamps = generate(me, min, max, capacity);\r\n\t\t}\r\n\r\n\t\tif (options.bounds === 'ticks' && timestamps.length) {\r\n\t\t\tmin = timestamps[0];\r\n\t\t\tmax = timestamps[timestamps.length - 1];\r\n\t\t}\r\n\r\n\t\t// Enforce limits with user min/max options\r\n\t\tmin = parse(me, getMin(options)) || min;\r\n\t\tmax = parse(me, getMax(options)) || max;\r\n\r\n\t\t// Remove ticks outside the min/max range\r\n\t\tfor (i = 0, ilen = timestamps.length; i < ilen; ++i) {\r\n\t\t\ttimestamp = timestamps[i];\r\n\t\t\tif (timestamp >= min && timestamp <= max) {\r\n\t\t\t\tticks.push(timestamp);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tme.min = min;\r\n\t\tme.max = max;\r\n\r\n\t\t// PRIVATE\r\n\t\t// determineUnitForFormatting relies on the number of ticks so we don't use it when\r\n\t\t// autoSkip is enabled because we don't yet know what the final number of ticks will be\r\n\t\tme._unit = timeOpts.unit || (tickOpts.autoSkip\r\n\t\t\t? determineUnitForAutoTicks(timeOpts.minUnit, me.min, me.max, capacity)\r\n\t\t\t: determineUnitForFormatting(me, ticks.length, timeOpts.minUnit, me.min, me.max));\r\n\t\tme._majorUnit = !tickOpts.major.enabled || me._unit === 'year' ? undefined\r\n\t\t\t: determineMajorUnit(me._unit);\r\n\t\tme._table = buildLookupTable(me._timestamps.data, min, max, distribution);\r\n\t\tme._offsets = computeOffsets(me._table, ticks, min, max, options);\r\n\r\n\t\tif (tickOpts.reverse) {\r\n\t\t\tticks.reverse();\r\n\t\t}\r\n\r\n\t\treturn ticksFromTimestamps(me, ticks, me._majorUnit);\r\n\t},\r\n\r\n\tgetLabelForIndex: function(index, datasetIndex) {\r\n\t\tvar me = this;\r\n\t\tvar adapter = me._adapter;\r\n\t\tvar data = me.chart.data;\r\n\t\tvar timeOpts = me.options.time;\r\n\t\tvar label = data.labels && index < data.labels.length ? data.labels[index] : '';\r\n\t\tvar value = data.datasets[datasetIndex].data[index];\r\n\r\n\t\tif (helpers$1.isObject(value)) {\r\n\t\t\tlabel = me.getRightValue(value);\r\n\t\t}\r\n\t\tif (timeOpts.tooltipFormat) {\r\n\t\t\treturn adapter.format(toTimestamp(me, label), timeOpts.tooltipFormat);\r\n\t\t}\r\n\t\tif (typeof label === 'string') {\r\n\t\t\treturn label;\r\n\t\t}\r\n\t\treturn adapter.format(toTimestamp(me, label), timeOpts.displayFormats.datetime);\r\n\t},\r\n\r\n\t/**\r\n\t * Function to format an individual tick mark\r\n\t * @private\r\n\t */\r\n\ttickFormatFunction: function(time, index, ticks, format) {\r\n\t\tvar me = this;\r\n\t\tvar adapter = me._adapter;\r\n\t\tvar options = me.options;\r\n\t\tvar formats = options.time.displayFormats;\r\n\t\tvar minorFormat = formats[me._unit];\r\n\t\tvar majorUnit = me._majorUnit;\r\n\t\tvar majorFormat = formats[majorUnit];\r\n\t\tvar tick = ticks[index];\r\n\t\tvar tickOpts = options.ticks;\r\n\t\tvar major = majorUnit && majorFormat && tick && tick.major;\r\n\t\tvar label = adapter.format(time, format ? format : major ? majorFormat : minorFormat);\r\n\t\tvar nestedTickOpts = major ? tickOpts.major : tickOpts.minor;\r\n\t\tvar formatter = resolve$5([\r\n\t\t\tnestedTickOpts.callback,\r\n\t\t\tnestedTickOpts.userCallback,\r\n\t\t\ttickOpts.callback,\r\n\t\t\ttickOpts.userCallback\r\n\t\t]);\r\n\r\n\t\treturn formatter ? formatter(label, index, ticks) : label;\r\n\t},\r\n\r\n\tconvertTicksToLabels: function(ticks) {\r\n\t\tvar labels = [];\r\n\t\tvar i, ilen;\r\n\r\n\t\tfor (i = 0, ilen = ticks.length; i < ilen; ++i) {\r\n\t\t\tlabels.push(this.tickFormatFunction(ticks[i].value, i, ticks));\r\n\t\t}\r\n\r\n\t\treturn labels;\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\tgetPixelForOffset: function(time) {\r\n\t\tvar me = this;\r\n\t\tvar offsets = me._offsets;\r\n\t\tvar pos = interpolate$1(me._table, 'time', time, 'pos');\r\n\t\treturn me.getPixelForDecimal((offsets.start + pos) * offsets.factor);\r\n\t},\r\n\r\n\tgetPixelForValue: function(value, index, datasetIndex) {\r\n\t\tvar me = this;\r\n\t\tvar time = null;\r\n\r\n\t\tif (index !== undefined && datasetIndex !== undefined) {\r\n\t\t\ttime = me._timestamps.datasets[datasetIndex][index];\r\n\t\t}\r\n\r\n\t\tif (time === null) {\r\n\t\t\ttime = parse(me, value);\r\n\t\t}\r\n\r\n\t\tif (time !== null) {\r\n\t\t\treturn me.getPixelForOffset(time);\r\n\t\t}\r\n\t},\r\n\r\n\tgetPixelForTick: function(index) {\r\n\t\tvar ticks = this.getTicks();\r\n\t\treturn index >= 0 && index < ticks.length ?\r\n\t\t\tthis.getPixelForOffset(ticks[index].value) :\r\n\t\t\tnull;\r\n\t},\r\n\r\n\tgetValueForPixel: function(pixel) {\r\n\t\tvar me = this;\r\n\t\tvar offsets = me._offsets;\r\n\t\tvar pos = me.getDecimalForPixel(pixel) / offsets.factor - offsets.end;\r\n\t\tvar time = interpolate$1(me._table, 'pos', pos, 'time');\r\n\r\n\t\t// DEPRECATION, we should return time directly\r\n\t\treturn me._adapter._create(time);\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_getLabelSize: function(label) {\r\n\t\tvar me = this;\r\n\t\tvar ticksOpts = me.options.ticks;\r\n\t\tvar tickLabelWidth = me.ctx.measureText(label).width;\r\n\t\tvar angle = helpers$1.toRadians(me.isHorizontal() ? ticksOpts.maxRotation : ticksOpts.minRotation);\r\n\t\tvar cosRotation = Math.cos(angle);\r\n\t\tvar sinRotation = Math.sin(angle);\r\n\t\tvar tickFontSize = valueOrDefault$d(ticksOpts.fontSize, core_defaults.global.defaultFontSize);\r\n\r\n\t\treturn {\r\n\t\t\tw: (tickLabelWidth * cosRotation) + (tickFontSize * sinRotation),\r\n\t\t\th: (tickLabelWidth * sinRotation) + (tickFontSize * cosRotation)\r\n\t\t};\r\n\t},\r\n\r\n\t/**\r\n\t * Crude approximation of what the label width might be\r\n\t * @private\r\n\t */\r\n\tgetLabelWidth: function(label) {\r\n\t\treturn this._getLabelSize(label).w;\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\tgetLabelCapacity: function(exampleTime) {\r\n\t\tvar me = this;\r\n\t\tvar timeOpts = me.options.time;\r\n\t\tvar displayFormats = timeOpts.displayFormats;\r\n\r\n\t\t// pick the longest format (milliseconds) for guestimation\r\n\t\tvar format = displayFormats[timeOpts.unit] || displayFormats.millisecond;\r\n\t\tvar exampleLabel = me.tickFormatFunction(exampleTime, 0, ticksFromTimestamps(me, [exampleTime], me._majorUnit), format);\r\n\t\tvar size = me._getLabelSize(exampleLabel);\r\n\t\tvar capacity = Math.floor(me.isHorizontal() ? me.width / size.w : me.height / size.h);\r\n\r\n\t\tif (me.options.offset) {\r\n\t\t\tcapacity--;\r\n\t\t}\r\n\r\n\t\treturn capacity > 0 ? capacity : 1;\r\n\t}\r\n});\r\n\r\n// INTERNAL: static default options, registered in src/index.js\r\nvar _defaults$4 = defaultConfig$4;\nscale_time._defaults = _defaults$4;\n\nvar scales = {\r\n\tcategory: scale_category,\r\n\tlinear: scale_linear,\r\n\tlogarithmic: scale_logarithmic,\r\n\tradialLinear: scale_radialLinear,\r\n\ttime: scale_time\r\n};\n\nvar FORMATS = {\r\n\tdatetime: 'MMM D, YYYY, h:mm:ss a',\r\n\tmillisecond: 'h:mm:ss.SSS a',\r\n\tsecond: 'h:mm:ss a',\r\n\tminute: 'h:mm a',\r\n\thour: 'hA',\r\n\tday: 'MMM D',\r\n\tweek: 'll',\r\n\tmonth: 'MMM YYYY',\r\n\tquarter: '[Q]Q - YYYY',\r\n\tyear: 'YYYY'\r\n};\r\n\r\ncore_adapters._date.override(typeof moment === 'function' ? {\r\n\t_id: 'moment', // DEBUG ONLY\r\n\r\n\tformats: function() {\r\n\t\treturn FORMATS;\r\n\t},\r\n\r\n\tparse: function(value, format) {\r\n\t\tif (typeof value === 'string' && typeof format === 'string') {\r\n\t\t\tvalue = moment(value, format);\r\n\t\t} else if (!(value instanceof moment)) {\r\n\t\t\tvalue = moment(value);\r\n\t\t}\r\n\t\treturn value.isValid() ? value.valueOf() : null;\r\n\t},\r\n\r\n\tformat: function(time, format) {\r\n\t\treturn moment(time).format(format);\r\n\t},\r\n\r\n\tadd: function(time, amount, unit) {\r\n\t\treturn moment(time).add(amount, unit).valueOf();\r\n\t},\r\n\r\n\tdiff: function(max, min, unit) {\r\n\t\treturn moment(max).diff(moment(min), unit);\r\n\t},\r\n\r\n\tstartOf: function(time, unit, weekday) {\r\n\t\ttime = moment(time);\r\n\t\tif (unit === 'isoWeek') {\r\n\t\t\treturn time.isoWeekday(weekday).valueOf();\r\n\t\t}\r\n\t\treturn time.startOf(unit).valueOf();\r\n\t},\r\n\r\n\tendOf: function(time, unit) {\r\n\t\treturn moment(time).endOf(unit).valueOf();\r\n\t},\r\n\r\n\t// DEPRECATIONS\r\n\r\n\t/**\r\n\t * Provided for backward compatibility with scale.getValueForPixel().\r\n\t * @deprecated since version 2.8.0\r\n\t * @todo remove at version 3\r\n\t * @private\r\n\t */\r\n\t_create: function(time) {\r\n\t\treturn moment(time);\r\n\t},\r\n} : {});\n\ncore_defaults._set('global', {\r\n\tplugins: {\r\n\t\tfiller: {\r\n\t\t\tpropagate: true\r\n\t\t}\r\n\t}\r\n});\r\n\r\nvar mappers = {\r\n\tdataset: function(source) {\r\n\t\tvar index = source.fill;\r\n\t\tvar chart = source.chart;\r\n\t\tvar meta = chart.getDatasetMeta(index);\r\n\t\tvar visible = meta && chart.isDatasetVisible(index);\r\n\t\tvar points = (visible && meta.dataset._children) || [];\r\n\t\tvar length = points.length || 0;\r\n\r\n\t\treturn !length ? null : function(point, i) {\r\n\t\t\treturn (i < length && points[i]._view) || null;\r\n\t\t};\r\n\t},\r\n\r\n\tboundary: function(source) {\r\n\t\tvar boundary = source.boundary;\r\n\t\tvar x = boundary ? boundary.x : null;\r\n\t\tvar y = boundary ? boundary.y : null;\r\n\r\n\t\tif (helpers$1.isArray(boundary)) {\r\n\t\t\treturn function(point, i) {\r\n\t\t\t\treturn boundary[i];\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\treturn function(point) {\r\n\t\t\treturn {\r\n\t\t\t\tx: x === null ? point.x : x,\r\n\t\t\t\ty: y === null ? point.y : y,\r\n\t\t\t};\r\n\t\t};\r\n\t}\r\n};\r\n\r\n// @todo if (fill[0] === '#')\r\nfunction decodeFill(el, index, count) {\r\n\tvar model = el._model || {};\r\n\tvar fill = model.fill;\r\n\tvar target;\r\n\r\n\tif (fill === undefined) {\r\n\t\tfill = !!model.backgroundColor;\r\n\t}\r\n\r\n\tif (fill === false || fill === null) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tif (fill === true) {\r\n\t\treturn 'origin';\r\n\t}\r\n\r\n\ttarget = parseFloat(fill, 10);\r\n\tif (isFinite(target) && Math.floor(target) === target) {\r\n\t\tif (fill[0] === '-' || fill[0] === '+') {\r\n\t\t\ttarget = index + target;\r\n\t\t}\r\n\r\n\t\tif (target === index || target < 0 || target >= count) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\treturn target;\r\n\t}\r\n\r\n\tswitch (fill) {\r\n\t// compatibility\r\n\tcase 'bottom':\r\n\t\treturn 'start';\r\n\tcase 'top':\r\n\t\treturn 'end';\r\n\tcase 'zero':\r\n\t\treturn 'origin';\r\n\t// supported boundaries\r\n\tcase 'origin':\r\n\tcase 'start':\r\n\tcase 'end':\r\n\t\treturn fill;\r\n\t// invalid fill values\r\n\tdefault:\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nfunction computeLinearBoundary(source) {\r\n\tvar model = source.el._model || {};\r\n\tvar scale = source.el._scale || {};\r\n\tvar fill = source.fill;\r\n\tvar target = null;\r\n\tvar horizontal;\r\n\r\n\tif (isFinite(fill)) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\t// Backward compatibility: until v3, we still need to support boundary values set on\r\n\t// the model (scaleTop, scaleBottom and scaleZero) because some external plugins and\r\n\t// controllers might still use it (e.g. the Smith chart).\r\n\r\n\tif (fill === 'start') {\r\n\t\ttarget = model.scaleBottom === undefined ? scale.bottom : model.scaleBottom;\r\n\t} else if (fill === 'end') {\r\n\t\ttarget = model.scaleTop === undefined ? scale.top : model.scaleTop;\r\n\t} else if (model.scaleZero !== undefined) {\r\n\t\ttarget = model.scaleZero;\r\n\t} else if (scale.getBasePixel) {\r\n\t\ttarget = scale.getBasePixel();\r\n\t}\r\n\r\n\tif (target !== undefined && target !== null) {\r\n\t\tif (target.x !== undefined && target.y !== undefined) {\r\n\t\t\treturn target;\r\n\t\t}\r\n\r\n\t\tif (helpers$1.isFinite(target)) {\r\n\t\t\thorizontal = scale.isHorizontal();\r\n\t\t\treturn {\r\n\t\t\t\tx: horizontal ? target : null,\r\n\t\t\t\ty: horizontal ? null : target\r\n\t\t\t};\r\n\t\t}\r\n\t}\r\n\r\n\treturn null;\r\n}\r\n\r\nfunction computeCircularBoundary(source) {\r\n\tvar scale = source.el._scale;\r\n\tvar options = scale.options;\r\n\tvar length = scale.chart.data.labels.length;\r\n\tvar fill = source.fill;\r\n\tvar target = [];\r\n\tvar start, end, center, i, point;\r\n\r\n\tif (!length) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\tstart = options.ticks.reverse ? scale.max : scale.min;\r\n\tend = options.ticks.reverse ? scale.min : scale.max;\r\n\tcenter = scale.getPointPositionForValue(0, start);\r\n\tfor (i = 0; i < length; ++i) {\r\n\t\tpoint = fill === 'start' || fill === 'end'\r\n\t\t\t? scale.getPointPositionForValue(i, fill === 'start' ? start : end)\r\n\t\t\t: scale.getBasePosition(i);\r\n\t\tif (options.gridLines.circular) {\r\n\t\t\tpoint.cx = center.x;\r\n\t\t\tpoint.cy = center.y;\r\n\t\t\tpoint.angle = scale.getIndexAngle(i) - Math.PI / 2;\r\n\t\t}\r\n\t\ttarget.push(point);\r\n\t}\r\n\treturn target;\r\n}\r\n\r\nfunction computeBoundary(source) {\r\n\tvar scale = source.el._scale || {};\r\n\r\n\tif (scale.getPointPositionForValue) {\r\n\t\treturn computeCircularBoundary(source);\r\n\t}\r\n\treturn computeLinearBoundary(source);\r\n}\r\n\r\nfunction resolveTarget(sources, index, propagate) {\r\n\tvar source = sources[index];\r\n\tvar fill = source.fill;\r\n\tvar visited = [index];\r\n\tvar target;\r\n\r\n\tif (!propagate) {\r\n\t\treturn fill;\r\n\t}\r\n\r\n\twhile (fill !== false && visited.indexOf(fill) === -1) {\r\n\t\tif (!isFinite(fill)) {\r\n\t\t\treturn fill;\r\n\t\t}\r\n\r\n\t\ttarget = sources[fill];\r\n\t\tif (!target) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tif (target.visible) {\r\n\t\t\treturn fill;\r\n\t\t}\r\n\r\n\t\tvisited.push(fill);\r\n\t\tfill = target.fill;\r\n\t}\r\n\r\n\treturn false;\r\n}\r\n\r\nfunction createMapper(source) {\r\n\tvar fill = source.fill;\r\n\tvar type = 'dataset';\r\n\r\n\tif (fill === false) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\tif (!isFinite(fill)) {\r\n\t\ttype = 'boundary';\r\n\t}\r\n\r\n\treturn mappers[type](source);\r\n}\r\n\r\nfunction isDrawable(point) {\r\n\treturn point && !point.skip;\r\n}\r\n\r\nfunction drawArea(ctx, curve0, curve1, len0, len1) {\r\n\tvar i, cx, cy, r;\r\n\r\n\tif (!len0 || !len1) {\r\n\t\treturn;\r\n\t}\r\n\r\n\t// building first area curve (normal)\r\n\tctx.moveTo(curve0[0].x, curve0[0].y);\r\n\tfor (i = 1; i < len0; ++i) {\r\n\t\thelpers$1.canvas.lineTo(ctx, curve0[i - 1], curve0[i]);\r\n\t}\r\n\r\n\tif (curve1[0].angle !== undefined) {\r\n\t\tcx = curve1[0].cx;\r\n\t\tcy = curve1[0].cy;\r\n\t\tr = Math.sqrt(Math.pow(curve1[0].x - cx, 2) + Math.pow(curve1[0].y - cy, 2));\r\n\t\tfor (i = len1 - 1; i > 0; --i) {\r\n\t\t\tctx.arc(cx, cy, r, curve1[i].angle, curve1[i - 1].angle, true);\r\n\t\t}\r\n\t\treturn;\r\n\t}\r\n\r\n\t// joining the two area curves\r\n\tctx.lineTo(curve1[len1 - 1].x, curve1[len1 - 1].y);\r\n\r\n\t// building opposite area curve (reverse)\r\n\tfor (i = len1 - 1; i > 0; --i) {\r\n\t\thelpers$1.canvas.lineTo(ctx, curve1[i], curve1[i - 1], true);\r\n\t}\r\n}\r\n\r\nfunction doFill(ctx, points, mapper, view, color, loop) {\r\n\tvar count = points.length;\r\n\tvar span = view.spanGaps;\r\n\tvar curve0 = [];\r\n\tvar curve1 = [];\r\n\tvar len0 = 0;\r\n\tvar len1 = 0;\r\n\tvar i, ilen, index, p0, p1, d0, d1, loopOffset;\r\n\r\n\tctx.beginPath();\r\n\r\n\tfor (i = 0, ilen = count; i < ilen; ++i) {\r\n\t\tindex = i % count;\r\n\t\tp0 = points[index]._view;\r\n\t\tp1 = mapper(p0, index, view);\r\n\t\td0 = isDrawable(p0);\r\n\t\td1 = isDrawable(p1);\r\n\r\n\t\tif (loop && loopOffset === undefined && d0) {\r\n\t\t\tloopOffset = i + 1;\r\n\t\t\tilen = count + loopOffset;\r\n\t\t}\r\n\r\n\t\tif (d0 && d1) {\r\n\t\t\tlen0 = curve0.push(p0);\r\n\t\t\tlen1 = curve1.push(p1);\r\n\t\t} else if (len0 && len1) {\r\n\t\t\tif (!span) {\r\n\t\t\t\tdrawArea(ctx, curve0, curve1, len0, len1);\r\n\t\t\t\tlen0 = len1 = 0;\r\n\t\t\t\tcurve0 = [];\r\n\t\t\t\tcurve1 = [];\r\n\t\t\t} else {\r\n\t\t\t\tif (d0) {\r\n\t\t\t\t\tcurve0.push(p0);\r\n\t\t\t\t}\r\n\t\t\t\tif (d1) {\r\n\t\t\t\t\tcurve1.push(p1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tdrawArea(ctx, curve0, curve1, len0, len1);\r\n\r\n\tctx.closePath();\r\n\tctx.fillStyle = color;\r\n\tctx.fill();\r\n}\r\n\r\nvar plugin_filler = {\r\n\tid: 'filler',\r\n\r\n\tafterDatasetsUpdate: function(chart, options) {\r\n\t\tvar count = (chart.data.datasets || []).length;\r\n\t\tvar propagate = options.propagate;\r\n\t\tvar sources = [];\r\n\t\tvar meta, i, el, source;\r\n\r\n\t\tfor (i = 0; i < count; ++i) {\r\n\t\t\tmeta = chart.getDatasetMeta(i);\r\n\t\t\tel = meta.dataset;\r\n\t\t\tsource = null;\r\n\r\n\t\t\tif (el && el._model && el instanceof elements.Line) {\r\n\t\t\t\tsource = {\r\n\t\t\t\t\tvisible: chart.isDatasetVisible(i),\r\n\t\t\t\t\tfill: decodeFill(el, i, count),\r\n\t\t\t\t\tchart: chart,\r\n\t\t\t\t\tel: el\r\n\t\t\t\t};\r\n\t\t\t}\r\n\r\n\t\t\tmeta.$filler = source;\r\n\t\t\tsources.push(source);\r\n\t\t}\r\n\r\n\t\tfor (i = 0; i < count; ++i) {\r\n\t\t\tsource = sources[i];\r\n\t\t\tif (!source) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\tsource.fill = resolveTarget(sources, i, propagate);\r\n\t\t\tsource.boundary = computeBoundary(source);\r\n\t\t\tsource.mapper = createMapper(source);\r\n\t\t}\r\n\t},\r\n\r\n\tbeforeDatasetsDraw: function(chart) {\r\n\t\tvar metasets = chart._getSortedVisibleDatasetMetas();\r\n\t\tvar ctx = chart.ctx;\r\n\t\tvar meta, i, el, view, points, mapper, color;\r\n\r\n\t\tfor (i = metasets.length - 1; i >= 0; --i) {\r\n\t\t\tmeta = metasets[i].$filler;\r\n\r\n\t\t\tif (!meta || !meta.visible) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\tel = meta.el;\r\n\t\t\tview = el._view;\r\n\t\t\tpoints = el._children || [];\r\n\t\t\tmapper = meta.mapper;\r\n\t\t\tcolor = view.backgroundColor || core_defaults.global.defaultColor;\r\n\r\n\t\t\tif (mapper && color && points.length) {\r\n\t\t\t\thelpers$1.canvas.clipArea(ctx, chart.chartArea);\r\n\t\t\t\tdoFill(ctx, points, mapper, view, color, el._loop);\r\n\t\t\t\thelpers$1.canvas.unclipArea(ctx);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\n\nvar getRtlHelper$1 = helpers$1.rtl.getRtlAdapter;\r\nvar noop$1 = helpers$1.noop;\r\nvar valueOrDefault$e = helpers$1.valueOrDefault;\r\n\r\ncore_defaults._set('global', {\r\n\tlegend: {\r\n\t\tdisplay: true,\r\n\t\tposition: 'top',\r\n\t\talign: 'center',\r\n\t\tfullWidth: true,\r\n\t\treverse: false,\r\n\t\tweight: 1000,\r\n\r\n\t\t// a callback that will handle\r\n\t\tonClick: function(e, legendItem) {\r\n\t\t\tvar index = legendItem.datasetIndex;\r\n\t\t\tvar ci = this.chart;\r\n\t\t\tvar meta = ci.getDatasetMeta(index);\r\n\r\n\t\t\t// See controller.isDatasetVisible comment\r\n\t\t\tmeta.hidden = meta.hidden === null ? !ci.data.datasets[index].hidden : null;\r\n\r\n\t\t\t// We hid a dataset ... rerender the chart\r\n\t\t\tci.update();\r\n\t\t},\r\n\r\n\t\tonHover: null,\r\n\t\tonLeave: null,\r\n\r\n\t\tlabels: {\r\n\t\t\tboxWidth: 40,\r\n\t\t\tpadding: 10,\r\n\t\t\t// Generates labels shown in the legend\r\n\t\t\t// Valid properties to return:\r\n\t\t\t// text : text to display\r\n\t\t\t// fillStyle : fill of coloured box\r\n\t\t\t// strokeStyle: stroke of coloured box\r\n\t\t\t// hidden : if this legend item refers to a hidden item\r\n\t\t\t// lineCap : cap style for line\r\n\t\t\t// lineDash\r\n\t\t\t// lineDashOffset :\r\n\t\t\t// lineJoin :\r\n\t\t\t// lineWidth :\r\n\t\t\tgenerateLabels: function(chart) {\r\n\t\t\t\tvar datasets = chart.data.datasets;\r\n\t\t\t\tvar options = chart.options.legend || {};\r\n\t\t\t\tvar usePointStyle = options.labels && options.labels.usePointStyle;\r\n\r\n\t\t\t\treturn chart._getSortedDatasetMetas().map(function(meta) {\r\n\t\t\t\t\tvar style = meta.controller.getStyle(usePointStyle ? 0 : undefined);\r\n\r\n\t\t\t\t\treturn {\r\n\t\t\t\t\t\ttext: datasets[meta.index].label,\r\n\t\t\t\t\t\tfillStyle: style.backgroundColor,\r\n\t\t\t\t\t\thidden: !chart.isDatasetVisible(meta.index),\r\n\t\t\t\t\t\tlineCap: style.borderCapStyle,\r\n\t\t\t\t\t\tlineDash: style.borderDash,\r\n\t\t\t\t\t\tlineDashOffset: style.borderDashOffset,\r\n\t\t\t\t\t\tlineJoin: style.borderJoinStyle,\r\n\t\t\t\t\t\tlineWidth: style.borderWidth,\r\n\t\t\t\t\t\tstrokeStyle: style.borderColor,\r\n\t\t\t\t\t\tpointStyle: style.pointStyle,\r\n\t\t\t\t\t\trotation: style.rotation,\r\n\r\n\t\t\t\t\t\t// Below is extra data used for toggling the datasets\r\n\t\t\t\t\t\tdatasetIndex: meta.index\r\n\t\t\t\t\t};\r\n\t\t\t\t}, this);\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tlegendCallback: function(chart) {\r\n\t\tvar list = document.createElement('ul');\r\n\t\tvar datasets = chart.data.datasets;\r\n\t\tvar i, ilen, listItem, listItemSpan;\r\n\r\n\t\tlist.setAttribute('class', chart.id + '-legend');\r\n\r\n\t\tfor (i = 0, ilen = datasets.length; i < ilen; i++) {\r\n\t\t\tlistItem = list.appendChild(document.createElement('li'));\r\n\t\t\tlistItemSpan = listItem.appendChild(document.createElement('span'));\r\n\t\t\tlistItemSpan.style.backgroundColor = datasets[i].backgroundColor;\r\n\t\t\tif (datasets[i].label) {\r\n\t\t\t\tlistItem.appendChild(document.createTextNode(datasets[i].label));\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn list.outerHTML;\r\n\t}\r\n});\r\n\r\n/**\r\n * Helper function to get the box width based on the usePointStyle option\r\n * @param {object} labelopts - the label options on the legend\r\n * @param {number} fontSize - the label font size\r\n * @return {number} width of the color box area\r\n */\r\nfunction getBoxWidth(labelOpts, fontSize) {\r\n\treturn labelOpts.usePointStyle && labelOpts.boxWidth > fontSize ?\r\n\t\tfontSize :\r\n\t\tlabelOpts.boxWidth;\r\n}\r\n\r\n/**\r\n * IMPORTANT: this class is exposed publicly as Chart.Legend, backward compatibility required!\r\n */\r\nvar Legend = core_element.extend({\r\n\r\n\tinitialize: function(config) {\r\n\t\tvar me = this;\r\n\t\thelpers$1.extend(me, config);\r\n\r\n\t\t// Contains hit boxes for each dataset (in dataset order)\r\n\t\tme.legendHitBoxes = [];\r\n\r\n\t\t/**\r\n \t\t * @private\r\n \t\t */\r\n\t\tme._hoveredItem = null;\r\n\r\n\t\t// Are we in doughnut mode which has a different data type\r\n\t\tme.doughnutMode = false;\r\n\t},\r\n\r\n\t// These methods are ordered by lifecycle. Utilities then follow.\r\n\t// Any function defined here is inherited by all legend types.\r\n\t// Any function can be extended by the legend type\r\n\r\n\tbeforeUpdate: noop$1,\r\n\tupdate: function(maxWidth, maxHeight, margins) {\r\n\t\tvar me = this;\r\n\r\n\t\t// Update Lifecycle - Probably don't want to ever extend or overwrite this function ;)\r\n\t\tme.beforeUpdate();\r\n\r\n\t\t// Absorb the master measurements\r\n\t\tme.maxWidth = maxWidth;\r\n\t\tme.maxHeight = maxHeight;\r\n\t\tme.margins = margins;\r\n\r\n\t\t// Dimensions\r\n\t\tme.beforeSetDimensions();\r\n\t\tme.setDimensions();\r\n\t\tme.afterSetDimensions();\r\n\t\t// Labels\r\n\t\tme.beforeBuildLabels();\r\n\t\tme.buildLabels();\r\n\t\tme.afterBuildLabels();\r\n\r\n\t\t// Fit\r\n\t\tme.beforeFit();\r\n\t\tme.fit();\r\n\t\tme.afterFit();\r\n\t\t//\r\n\t\tme.afterUpdate();\r\n\r\n\t\treturn me.minSize;\r\n\t},\r\n\tafterUpdate: noop$1,\r\n\r\n\t//\r\n\r\n\tbeforeSetDimensions: noop$1,\r\n\tsetDimensions: function() {\r\n\t\tvar me = this;\r\n\t\t// Set the unconstrained dimension before label rotation\r\n\t\tif (me.isHorizontal()) {\r\n\t\t\t// Reset position before calculating rotation\r\n\t\t\tme.width = me.maxWidth;\r\n\t\t\tme.left = 0;\r\n\t\t\tme.right = me.width;\r\n\t\t} else {\r\n\t\t\tme.height = me.maxHeight;\r\n\r\n\t\t\t// Reset position before calculating rotation\r\n\t\t\tme.top = 0;\r\n\t\t\tme.bottom = me.height;\r\n\t\t}\r\n\r\n\t\t// Reset padding\r\n\t\tme.paddingLeft = 0;\r\n\t\tme.paddingTop = 0;\r\n\t\tme.paddingRight = 0;\r\n\t\tme.paddingBottom = 0;\r\n\r\n\t\t// Reset minSize\r\n\t\tme.minSize = {\r\n\t\t\twidth: 0,\r\n\t\t\theight: 0\r\n\t\t};\r\n\t},\r\n\tafterSetDimensions: noop$1,\r\n\r\n\t//\r\n\r\n\tbeforeBuildLabels: noop$1,\r\n\tbuildLabels: function() {\r\n\t\tvar me = this;\r\n\t\tvar labelOpts = me.options.labels || {};\r\n\t\tvar legendItems = helpers$1.callback(labelOpts.generateLabels, [me.chart], me) || [];\r\n\r\n\t\tif (labelOpts.filter) {\r\n\t\t\tlegendItems = legendItems.filter(function(item) {\r\n\t\t\t\treturn labelOpts.filter(item, me.chart.data);\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tif (me.options.reverse) {\r\n\t\t\tlegendItems.reverse();\r\n\t\t}\r\n\r\n\t\tme.legendItems = legendItems;\r\n\t},\r\n\tafterBuildLabels: noop$1,\r\n\r\n\t//\r\n\r\n\tbeforeFit: noop$1,\r\n\tfit: function() {\r\n\t\tvar me = this;\r\n\t\tvar opts = me.options;\r\n\t\tvar labelOpts = opts.labels;\r\n\t\tvar display = opts.display;\r\n\r\n\t\tvar ctx = me.ctx;\r\n\r\n\t\tvar labelFont = helpers$1.options._parseFont(labelOpts);\r\n\t\tvar fontSize = labelFont.size;\r\n\r\n\t\t// Reset hit boxes\r\n\t\tvar hitboxes = me.legendHitBoxes = [];\r\n\r\n\t\tvar minSize = me.minSize;\r\n\t\tvar isHorizontal = me.isHorizontal();\r\n\r\n\t\tif (isHorizontal) {\r\n\t\t\tminSize.width = me.maxWidth; // fill all the width\r\n\t\t\tminSize.height = display ? 10 : 0;\r\n\t\t} else {\r\n\t\t\tminSize.width = display ? 10 : 0;\r\n\t\t\tminSize.height = me.maxHeight; // fill all the height\r\n\t\t}\r\n\r\n\t\t// Increase sizes here\r\n\t\tif (!display) {\r\n\t\t\tme.width = minSize.width = me.height = minSize.height = 0;\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tctx.font = labelFont.string;\r\n\r\n\t\tif (isHorizontal) {\r\n\t\t\t// Labels\r\n\r\n\t\t\t// Width of each line of legend boxes. Labels wrap onto multiple lines when there are too many to fit on one\r\n\t\t\tvar lineWidths = me.lineWidths = [0];\r\n\t\t\tvar totalHeight = 0;\r\n\r\n\t\t\tctx.textAlign = 'left';\r\n\t\t\tctx.textBaseline = 'middle';\r\n\r\n\t\t\thelpers$1.each(me.legendItems, function(legendItem, i) {\r\n\t\t\t\tvar boxWidth = getBoxWidth(labelOpts, fontSize);\r\n\t\t\t\tvar width = boxWidth + (fontSize / 2) + ctx.measureText(legendItem.text).width;\r\n\r\n\t\t\t\tif (i === 0 || lineWidths[lineWidths.length - 1] + width + 2 * labelOpts.padding > minSize.width) {\r\n\t\t\t\t\ttotalHeight += fontSize + labelOpts.padding;\r\n\t\t\t\t\tlineWidths[lineWidths.length - (i > 0 ? 0 : 1)] = 0;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Store the hitbox width and height here. Final position will be updated in `draw`\r\n\t\t\t\thitboxes[i] = {\r\n\t\t\t\t\tleft: 0,\r\n\t\t\t\t\ttop: 0,\r\n\t\t\t\t\twidth: width,\r\n\t\t\t\t\theight: fontSize\r\n\t\t\t\t};\r\n\r\n\t\t\t\tlineWidths[lineWidths.length - 1] += width + labelOpts.padding;\r\n\t\t\t});\r\n\r\n\t\t\tminSize.height += totalHeight;\r\n\r\n\t\t} else {\r\n\t\t\tvar vPadding = labelOpts.padding;\r\n\t\t\tvar columnWidths = me.columnWidths = [];\r\n\t\t\tvar columnHeights = me.columnHeights = [];\r\n\t\t\tvar totalWidth = labelOpts.padding;\r\n\t\t\tvar currentColWidth = 0;\r\n\t\t\tvar currentColHeight = 0;\r\n\r\n\t\t\thelpers$1.each(me.legendItems, function(legendItem, i) {\r\n\t\t\t\tvar boxWidth = getBoxWidth(labelOpts, fontSize);\r\n\t\t\t\tvar itemWidth = boxWidth + (fontSize / 2) + ctx.measureText(legendItem.text).width;\r\n\r\n\t\t\t\t// If too tall, go to new column\r\n\t\t\t\tif (i > 0 && currentColHeight + fontSize + 2 * vPadding > minSize.height) {\r\n\t\t\t\t\ttotalWidth += currentColWidth + labelOpts.padding;\r\n\t\t\t\t\tcolumnWidths.push(currentColWidth); // previous column width\r\n\t\t\t\t\tcolumnHeights.push(currentColHeight);\r\n\t\t\t\t\tcurrentColWidth = 0;\r\n\t\t\t\t\tcurrentColHeight = 0;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Get max width\r\n\t\t\t\tcurrentColWidth = Math.max(currentColWidth, itemWidth);\r\n\t\t\t\tcurrentColHeight += fontSize + vPadding;\r\n\r\n\t\t\t\t// Store the hitbox width and height here. Final position will be updated in `draw`\r\n\t\t\t\thitboxes[i] = {\r\n\t\t\t\t\tleft: 0,\r\n\t\t\t\t\ttop: 0,\r\n\t\t\t\t\twidth: itemWidth,\r\n\t\t\t\t\theight: fontSize\r\n\t\t\t\t};\r\n\t\t\t});\r\n\r\n\t\t\ttotalWidth += currentColWidth;\r\n\t\t\tcolumnWidths.push(currentColWidth);\r\n\t\t\tcolumnHeights.push(currentColHeight);\r\n\t\t\tminSize.width += totalWidth;\r\n\t\t}\r\n\r\n\t\tme.width = minSize.width;\r\n\t\tme.height = minSize.height;\r\n\t},\r\n\tafterFit: noop$1,\r\n\r\n\t// Shared Methods\r\n\tisHorizontal: function() {\r\n\t\treturn this.options.position === 'top' || this.options.position === 'bottom';\r\n\t},\r\n\r\n\t// Actually draw the legend on the canvas\r\n\tdraw: function() {\r\n\t\tvar me = this;\r\n\t\tvar opts = me.options;\r\n\t\tvar labelOpts = opts.labels;\r\n\t\tvar globalDefaults = core_defaults.global;\r\n\t\tvar defaultColor = globalDefaults.defaultColor;\r\n\t\tvar lineDefault = globalDefaults.elements.line;\r\n\t\tvar legendHeight = me.height;\r\n\t\tvar columnHeights = me.columnHeights;\r\n\t\tvar legendWidth = me.width;\r\n\t\tvar lineWidths = me.lineWidths;\r\n\r\n\t\tif (!opts.display) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tvar rtlHelper = getRtlHelper$1(opts.rtl, me.left, me.minSize.width);\r\n\t\tvar ctx = me.ctx;\r\n\t\tvar fontColor = valueOrDefault$e(labelOpts.fontColor, globalDefaults.defaultFontColor);\r\n\t\tvar labelFont = helpers$1.options._parseFont(labelOpts);\r\n\t\tvar fontSize = labelFont.size;\r\n\t\tvar cursor;\r\n\r\n\t\t// Canvas setup\r\n\t\tctx.textAlign = rtlHelper.textAlign('left');\r\n\t\tctx.textBaseline = 'middle';\r\n\t\tctx.lineWidth = 0.5;\r\n\t\tctx.strokeStyle = fontColor; // for strikethrough effect\r\n\t\tctx.fillStyle = fontColor; // render in correct colour\r\n\t\tctx.font = labelFont.string;\r\n\r\n\t\tvar boxWidth = getBoxWidth(labelOpts, fontSize);\r\n\t\tvar hitboxes = me.legendHitBoxes;\r\n\r\n\t\t// current position\r\n\t\tvar drawLegendBox = function(x, y, legendItem) {\r\n\t\t\tif (isNaN(boxWidth) || boxWidth <= 0) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\t// Set the ctx for the box\r\n\t\t\tctx.save();\r\n\r\n\t\t\tvar lineWidth = valueOrDefault$e(legendItem.lineWidth, lineDefault.borderWidth);\r\n\t\t\tctx.fillStyle = valueOrDefault$e(legendItem.fillStyle, defaultColor);\r\n\t\t\tctx.lineCap = valueOrDefault$e(legendItem.lineCap, lineDefault.borderCapStyle);\r\n\t\t\tctx.lineDashOffset = valueOrDefault$e(legendItem.lineDashOffset, lineDefault.borderDashOffset);\r\n\t\t\tctx.lineJoin = valueOrDefault$e(legendItem.lineJoin, lineDefault.borderJoinStyle);\r\n\t\t\tctx.lineWidth = lineWidth;\r\n\t\t\tctx.strokeStyle = valueOrDefault$e(legendItem.strokeStyle, defaultColor);\r\n\r\n\t\t\tif (ctx.setLineDash) {\r\n\t\t\t\t// IE 9 and 10 do not support line dash\r\n\t\t\t\tctx.setLineDash(valueOrDefault$e(legendItem.lineDash, lineDefault.borderDash));\r\n\t\t\t}\r\n\r\n\t\t\tif (labelOpts && labelOpts.usePointStyle) {\r\n\t\t\t\t// Recalculate x and y for drawPoint() because its expecting\r\n\t\t\t\t// x and y to be center of figure (instead of top left)\r\n\t\t\t\tvar radius = boxWidth * Math.SQRT2 / 2;\r\n\t\t\t\tvar centerX = rtlHelper.xPlus(x, boxWidth / 2);\r\n\t\t\t\tvar centerY = y + fontSize / 2;\r\n\r\n\t\t\t\t// Draw pointStyle as legend symbol\r\n\t\t\t\thelpers$1.canvas.drawPoint(ctx, legendItem.pointStyle, radius, centerX, centerY, legendItem.rotation);\r\n\t\t\t} else {\r\n\t\t\t\t// Draw box as legend symbol\r\n\t\t\t\tctx.fillRect(rtlHelper.leftForLtr(x, boxWidth), y, boxWidth, fontSize);\r\n\t\t\t\tif (lineWidth !== 0) {\r\n\t\t\t\t\tctx.strokeRect(rtlHelper.leftForLtr(x, boxWidth), y, boxWidth, fontSize);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tctx.restore();\r\n\t\t};\r\n\r\n\t\tvar fillText = function(x, y, legendItem, textWidth) {\r\n\t\t\tvar halfFontSize = fontSize / 2;\r\n\t\t\tvar xLeft = rtlHelper.xPlus(x, boxWidth + halfFontSize);\r\n\t\t\tvar yMiddle = y + halfFontSize;\r\n\r\n\t\t\tctx.fillText(legendItem.text, xLeft, yMiddle);\r\n\r\n\t\t\tif (legendItem.hidden) {\r\n\t\t\t\t// Strikethrough the text if hidden\r\n\t\t\t\tctx.beginPath();\r\n\t\t\t\tctx.lineWidth = 2;\r\n\t\t\t\tctx.moveTo(xLeft, yMiddle);\r\n\t\t\t\tctx.lineTo(rtlHelper.xPlus(xLeft, textWidth), yMiddle);\r\n\t\t\t\tctx.stroke();\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tvar alignmentOffset = function(dimension, blockSize) {\r\n\t\t\tswitch (opts.align) {\r\n\t\t\tcase 'start':\r\n\t\t\t\treturn labelOpts.padding;\r\n\t\t\tcase 'end':\r\n\t\t\t\treturn dimension - blockSize;\r\n\t\t\tdefault: // center\r\n\t\t\t\treturn (dimension - blockSize + labelOpts.padding) / 2;\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\t// Horizontal\r\n\t\tvar isHorizontal = me.isHorizontal();\r\n\t\tif (isHorizontal) {\r\n\t\t\tcursor = {\r\n\t\t\t\tx: me.left + alignmentOffset(legendWidth, lineWidths[0]),\r\n\t\t\t\ty: me.top + labelOpts.padding,\r\n\t\t\t\tline: 0\r\n\t\t\t};\r\n\t\t} else {\r\n\t\t\tcursor = {\r\n\t\t\t\tx: me.left + labelOpts.padding,\r\n\t\t\t\ty: me.top + alignmentOffset(legendHeight, columnHeights[0]),\r\n\t\t\t\tline: 0\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\thelpers$1.rtl.overrideTextDirection(me.ctx, opts.textDirection);\r\n\r\n\t\tvar itemHeight = fontSize + labelOpts.padding;\r\n\t\thelpers$1.each(me.legendItems, function(legendItem, i) {\r\n\t\t\tvar textWidth = ctx.measureText(legendItem.text).width;\r\n\t\t\tvar width = boxWidth + (fontSize / 2) + textWidth;\r\n\t\t\tvar x = cursor.x;\r\n\t\t\tvar y = cursor.y;\r\n\r\n\t\t\trtlHelper.setWidth(me.minSize.width);\r\n\r\n\t\t\t// Use (me.left + me.minSize.width) and (me.top + me.minSize.height)\r\n\t\t\t// instead of me.right and me.bottom because me.width and me.height\r\n\t\t\t// may have been changed since me.minSize was calculated\r\n\t\t\tif (isHorizontal) {\r\n\t\t\t\tif (i > 0 && x + width + labelOpts.padding > me.left + me.minSize.width) {\r\n\t\t\t\t\ty = cursor.y += itemHeight;\r\n\t\t\t\t\tcursor.line++;\r\n\t\t\t\t\tx = cursor.x = me.left + alignmentOffset(legendWidth, lineWidths[cursor.line]);\r\n\t\t\t\t}\r\n\t\t\t} else if (i > 0 && y + itemHeight > me.top + me.minSize.height) {\r\n\t\t\t\tx = cursor.x = x + me.columnWidths[cursor.line] + labelOpts.padding;\r\n\t\t\t\tcursor.line++;\r\n\t\t\t\ty = cursor.y = me.top + alignmentOffset(legendHeight, columnHeights[cursor.line]);\r\n\t\t\t}\r\n\r\n\t\t\tvar realX = rtlHelper.x(x);\r\n\r\n\t\t\tdrawLegendBox(realX, y, legendItem);\r\n\r\n\t\t\thitboxes[i].left = rtlHelper.leftForLtr(realX, hitboxes[i].width);\r\n\t\t\thitboxes[i].top = y;\r\n\r\n\t\t\t// Fill the actual label\r\n\t\t\tfillText(realX, y, legendItem, textWidth);\r\n\r\n\t\t\tif (isHorizontal) {\r\n\t\t\t\tcursor.x += width + labelOpts.padding;\r\n\t\t\t} else {\r\n\t\t\t\tcursor.y += itemHeight;\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\thelpers$1.rtl.restoreTextDirection(me.ctx, opts.textDirection);\r\n\t},\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_getLegendItemAt: function(x, y) {\r\n\t\tvar me = this;\r\n\t\tvar i, hitBox, lh;\r\n\r\n\t\tif (x >= me.left && x <= me.right && y >= me.top && y <= me.bottom) {\r\n\t\t\t// See if we are touching one of the dataset boxes\r\n\t\t\tlh = me.legendHitBoxes;\r\n\t\t\tfor (i = 0; i < lh.length; ++i) {\r\n\t\t\t\thitBox = lh[i];\r\n\r\n\t\t\t\tif (x >= hitBox.left && x <= hitBox.left + hitBox.width && y >= hitBox.top && y <= hitBox.top + hitBox.height) {\r\n\t\t\t\t\t// Touching an element\r\n\t\t\t\t\treturn me.legendItems[i];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn null;\r\n\t},\r\n\r\n\t/**\r\n\t * Handle an event\r\n\t * @private\r\n\t * @param {IEvent} event - The event to handle\r\n\t */\r\n\thandleEvent: function(e) {\r\n\t\tvar me = this;\r\n\t\tvar opts = me.options;\r\n\t\tvar type = e.type === 'mouseup' ? 'click' : e.type;\r\n\t\tvar hoveredItem;\r\n\r\n\t\tif (type === 'mousemove') {\r\n\t\t\tif (!opts.onHover && !opts.onLeave) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t} else if (type === 'click') {\r\n\t\t\tif (!opts.onClick) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Chart event already has relative position in it\r\n\t\thoveredItem = me._getLegendItemAt(e.x, e.y);\r\n\r\n\t\tif (type === 'click') {\r\n\t\t\tif (hoveredItem && opts.onClick) {\r\n\t\t\t\t// use e.native for backwards compatibility\r\n\t\t\t\topts.onClick.call(me, e.native, hoveredItem);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (opts.onLeave && hoveredItem !== me._hoveredItem) {\r\n\t\t\t\tif (me._hoveredItem) {\r\n\t\t\t\t\topts.onLeave.call(me, e.native, me._hoveredItem);\r\n\t\t\t\t}\r\n\t\t\t\tme._hoveredItem = hoveredItem;\r\n\t\t\t}\r\n\r\n\t\t\tif (opts.onHover && hoveredItem) {\r\n\t\t\t\t// use e.native for backwards compatibility\r\n\t\t\t\topts.onHover.call(me, e.native, hoveredItem);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n});\r\n\r\nfunction createNewLegendAndAttach(chart, legendOpts) {\r\n\tvar legend = new Legend({\r\n\t\tctx: chart.ctx,\r\n\t\toptions: legendOpts,\r\n\t\tchart: chart\r\n\t});\r\n\r\n\tcore_layouts.configure(chart, legend, legendOpts);\r\n\tcore_layouts.addBox(chart, legend);\r\n\tchart.legend = legend;\r\n}\r\n\r\nvar plugin_legend = {\r\n\tid: 'legend',\r\n\r\n\t/**\r\n\t * Backward compatibility: since 2.1.5, the legend is registered as a plugin, making\r\n\t * Chart.Legend obsolete. To avoid a breaking change, we export the Legend as part of\r\n\t * the plugin, which one will be re-exposed in the chart.js file.\r\n\t * https://github.com/chartjs/Chart.js/pull/2640\r\n\t * @private\r\n\t */\r\n\t_element: Legend,\r\n\r\n\tbeforeInit: function(chart) {\r\n\t\tvar legendOpts = chart.options.legend;\r\n\r\n\t\tif (legendOpts) {\r\n\t\t\tcreateNewLegendAndAttach(chart, legendOpts);\r\n\t\t}\r\n\t},\r\n\r\n\tbeforeUpdate: function(chart) {\r\n\t\tvar legendOpts = chart.options.legend;\r\n\t\tvar legend = chart.legend;\r\n\r\n\t\tif (legendOpts) {\r\n\t\t\thelpers$1.mergeIf(legendOpts, core_defaults.global.legend);\r\n\r\n\t\t\tif (legend) {\r\n\t\t\t\tcore_layouts.configure(chart, legend, legendOpts);\r\n\t\t\t\tlegend.options = legendOpts;\r\n\t\t\t} else {\r\n\t\t\t\tcreateNewLegendAndAttach(chart, legendOpts);\r\n\t\t\t}\r\n\t\t} else if (legend) {\r\n\t\t\tcore_layouts.removeBox(chart, legend);\r\n\t\t\tdelete chart.legend;\r\n\t\t}\r\n\t},\r\n\r\n\tafterEvent: function(chart, e) {\r\n\t\tvar legend = chart.legend;\r\n\t\tif (legend) {\r\n\t\t\tlegend.handleEvent(e);\r\n\t\t}\r\n\t}\r\n};\n\nvar noop$2 = helpers$1.noop;\r\n\r\ncore_defaults._set('global', {\r\n\ttitle: {\r\n\t\tdisplay: false,\r\n\t\tfontStyle: 'bold',\r\n\t\tfullWidth: true,\r\n\t\tpadding: 10,\r\n\t\tposition: 'top',\r\n\t\ttext: '',\r\n\t\tweight: 2000 // by default greater than legend (1000) to be above\r\n\t}\r\n});\r\n\r\n/**\r\n * IMPORTANT: this class is exposed publicly as Chart.Legend, backward compatibility required!\r\n */\r\nvar Title = core_element.extend({\r\n\tinitialize: function(config) {\r\n\t\tvar me = this;\r\n\t\thelpers$1.extend(me, config);\r\n\r\n\t\t// Contains hit boxes for each dataset (in dataset order)\r\n\t\tme.legendHitBoxes = [];\r\n\t},\r\n\r\n\t// These methods are ordered by lifecycle. Utilities then follow.\r\n\r\n\tbeforeUpdate: noop$2,\r\n\tupdate: function(maxWidth, maxHeight, margins) {\r\n\t\tvar me = this;\r\n\r\n\t\t// Update Lifecycle - Probably don't want to ever extend or overwrite this function ;)\r\n\t\tme.beforeUpdate();\r\n\r\n\t\t// Absorb the master measurements\r\n\t\tme.maxWidth = maxWidth;\r\n\t\tme.maxHeight = maxHeight;\r\n\t\tme.margins = margins;\r\n\r\n\t\t// Dimensions\r\n\t\tme.beforeSetDimensions();\r\n\t\tme.setDimensions();\r\n\t\tme.afterSetDimensions();\r\n\t\t// Labels\r\n\t\tme.beforeBuildLabels();\r\n\t\tme.buildLabels();\r\n\t\tme.afterBuildLabels();\r\n\r\n\t\t// Fit\r\n\t\tme.beforeFit();\r\n\t\tme.fit();\r\n\t\tme.afterFit();\r\n\t\t//\r\n\t\tme.afterUpdate();\r\n\r\n\t\treturn me.minSize;\r\n\r\n\t},\r\n\tafterUpdate: noop$2,\r\n\r\n\t//\r\n\r\n\tbeforeSetDimensions: noop$2,\r\n\tsetDimensions: function() {\r\n\t\tvar me = this;\r\n\t\t// Set the unconstrained dimension before label rotation\r\n\t\tif (me.isHorizontal()) {\r\n\t\t\t// Reset position before calculating rotation\r\n\t\t\tme.width = me.maxWidth;\r\n\t\t\tme.left = 0;\r\n\t\t\tme.right = me.width;\r\n\t\t} else {\r\n\t\t\tme.height = me.maxHeight;\r\n\r\n\t\t\t// Reset position before calculating rotation\r\n\t\t\tme.top = 0;\r\n\t\t\tme.bottom = me.height;\r\n\t\t}\r\n\r\n\t\t// Reset padding\r\n\t\tme.paddingLeft = 0;\r\n\t\tme.paddingTop = 0;\r\n\t\tme.paddingRight = 0;\r\n\t\tme.paddingBottom = 0;\r\n\r\n\t\t// Reset minSize\r\n\t\tme.minSize = {\r\n\t\t\twidth: 0,\r\n\t\t\theight: 0\r\n\t\t};\r\n\t},\r\n\tafterSetDimensions: noop$2,\r\n\r\n\t//\r\n\r\n\tbeforeBuildLabels: noop$2,\r\n\tbuildLabels: noop$2,\r\n\tafterBuildLabels: noop$2,\r\n\r\n\t//\r\n\r\n\tbeforeFit: noop$2,\r\n\tfit: function() {\r\n\t\tvar me = this;\r\n\t\tvar opts = me.options;\r\n\t\tvar minSize = me.minSize = {};\r\n\t\tvar isHorizontal = me.isHorizontal();\r\n\t\tvar lineCount, textSize;\r\n\r\n\t\tif (!opts.display) {\r\n\t\t\tme.width = minSize.width = me.height = minSize.height = 0;\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlineCount = helpers$1.isArray(opts.text) ? opts.text.length : 1;\r\n\t\ttextSize = lineCount * helpers$1.options._parseFont(opts).lineHeight + opts.padding * 2;\r\n\r\n\t\tme.width = minSize.width = isHorizontal ? me.maxWidth : textSize;\r\n\t\tme.height = minSize.height = isHorizontal ? textSize : me.maxHeight;\r\n\t},\r\n\tafterFit: noop$2,\r\n\r\n\t// Shared Methods\r\n\tisHorizontal: function() {\r\n\t\tvar pos = this.options.position;\r\n\t\treturn pos === 'top' || pos === 'bottom';\r\n\t},\r\n\r\n\t// Actually draw the title block on the canvas\r\n\tdraw: function() {\r\n\t\tvar me = this;\r\n\t\tvar ctx = me.ctx;\r\n\t\tvar opts = me.options;\r\n\r\n\t\tif (!opts.display) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tvar fontOpts = helpers$1.options._parseFont(opts);\r\n\t\tvar lineHeight = fontOpts.lineHeight;\r\n\t\tvar offset = lineHeight / 2 + opts.padding;\r\n\t\tvar rotation = 0;\r\n\t\tvar top = me.top;\r\n\t\tvar left = me.left;\r\n\t\tvar bottom = me.bottom;\r\n\t\tvar right = me.right;\r\n\t\tvar maxWidth, titleX, titleY;\r\n\r\n\t\tctx.fillStyle = helpers$1.valueOrDefault(opts.fontColor, core_defaults.global.defaultFontColor); // render in correct colour\r\n\t\tctx.font = fontOpts.string;\r\n\r\n\t\t// Horizontal\r\n\t\tif (me.isHorizontal()) {\r\n\t\t\ttitleX = left + ((right - left) / 2); // midpoint of the width\r\n\t\t\ttitleY = top + offset;\r\n\t\t\tmaxWidth = right - left;\r\n\t\t} else {\r\n\t\t\ttitleX = opts.position === 'left' ? left + offset : right - offset;\r\n\t\t\ttitleY = top + ((bottom - top) / 2);\r\n\t\t\tmaxWidth = bottom - top;\r\n\t\t\trotation = Math.PI * (opts.position === 'left' ? -0.5 : 0.5);\r\n\t\t}\r\n\r\n\t\tctx.save();\r\n\t\tctx.translate(titleX, titleY);\r\n\t\tctx.rotate(rotation);\r\n\t\tctx.textAlign = 'center';\r\n\t\tctx.textBaseline = 'middle';\r\n\r\n\t\tvar text = opts.text;\r\n\t\tif (helpers$1.isArray(text)) {\r\n\t\t\tvar y = 0;\r\n\t\t\tfor (var i = 0; i < text.length; ++i) {\r\n\t\t\t\tctx.fillText(text[i], 0, y, maxWidth);\r\n\t\t\t\ty += lineHeight;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tctx.fillText(text, 0, 0, maxWidth);\r\n\t\t}\r\n\r\n\t\tctx.restore();\r\n\t}\r\n});\r\n\r\nfunction createNewTitleBlockAndAttach(chart, titleOpts) {\r\n\tvar title = new Title({\r\n\t\tctx: chart.ctx,\r\n\t\toptions: titleOpts,\r\n\t\tchart: chart\r\n\t});\r\n\r\n\tcore_layouts.configure(chart, title, titleOpts);\r\n\tcore_layouts.addBox(chart, title);\r\n\tchart.titleBlock = title;\r\n}\r\n\r\nvar plugin_title = {\r\n\tid: 'title',\r\n\r\n\t/**\r\n\t * Backward compatibility: since 2.1.5, the title is registered as a plugin, making\r\n\t * Chart.Title obsolete. To avoid a breaking change, we export the Title as part of\r\n\t * the plugin, which one will be re-exposed in the chart.js file.\r\n\t * https://github.com/chartjs/Chart.js/pull/2640\r\n\t * @private\r\n\t */\r\n\t_element: Title,\r\n\r\n\tbeforeInit: function(chart) {\r\n\t\tvar titleOpts = chart.options.title;\r\n\r\n\t\tif (titleOpts) {\r\n\t\t\tcreateNewTitleBlockAndAttach(chart, titleOpts);\r\n\t\t}\r\n\t},\r\n\r\n\tbeforeUpdate: function(chart) {\r\n\t\tvar titleOpts = chart.options.title;\r\n\t\tvar titleBlock = chart.titleBlock;\r\n\r\n\t\tif (titleOpts) {\r\n\t\t\thelpers$1.mergeIf(titleOpts, core_defaults.global.title);\r\n\r\n\t\t\tif (titleBlock) {\r\n\t\t\t\tcore_layouts.configure(chart, titleBlock, titleOpts);\r\n\t\t\t\ttitleBlock.options = titleOpts;\r\n\t\t\t} else {\r\n\t\t\t\tcreateNewTitleBlockAndAttach(chart, titleOpts);\r\n\t\t\t}\r\n\t\t} else if (titleBlock) {\r\n\t\t\tcore_layouts.removeBox(chart, titleBlock);\r\n\t\t\tdelete chart.titleBlock;\r\n\t\t}\r\n\t}\r\n};\n\nvar plugins = {};\r\nvar filler = plugin_filler;\r\nvar legend = plugin_legend;\r\nvar title = plugin_title;\nplugins.filler = filler;\nplugins.legend = legend;\nplugins.title = title;\n\n/**\r\n * @namespace Chart\r\n */\r\n\r\n\r\ncore_controller.helpers = helpers$1;\r\n\r\n// @todo dispatch these helpers into appropriated helpers/helpers.* file and write unit tests!\r\ncore_helpers();\r\n\r\ncore_controller._adapters = core_adapters;\r\ncore_controller.Animation = core_animation;\r\ncore_controller.animationService = core_animations;\r\ncore_controller.controllers = controllers;\r\ncore_controller.DatasetController = core_datasetController;\r\ncore_controller.defaults = core_defaults;\r\ncore_controller.Element = core_element;\r\ncore_controller.elements = elements;\r\ncore_controller.Interaction = core_interaction;\r\ncore_controller.layouts = core_layouts;\r\ncore_controller.platform = platform;\r\ncore_controller.plugins = core_plugins;\r\ncore_controller.Scale = core_scale;\r\ncore_controller.scaleService = core_scaleService;\r\ncore_controller.Ticks = core_ticks;\r\ncore_controller.Tooltip = core_tooltip;\r\n\r\n// Register built-in scales\r\n\r\ncore_controller.helpers.each(scales, function(scale, type) {\r\n\tcore_controller.scaleService.registerScaleType(type, scale, scale._defaults);\r\n});\r\n\r\n// Load to register built-in adapters (as side effects)\r\n\r\n\r\n// Loading built-in plugins\r\n\r\nfor (var k in plugins) {\r\n\tif (plugins.hasOwnProperty(k)) {\r\n\t\tcore_controller.plugins.register(plugins[k]);\r\n\t}\r\n}\r\n\r\ncore_controller.platform.initialize();\r\n\r\nvar src = core_controller;\r\nif (typeof window !== 'undefined') {\r\n\twindow.Chart = core_controller;\r\n}\r\n\r\n// DEPRECATIONS\r\n\r\n/**\r\n * Provided for backward compatibility, not available anymore\r\n * @namespace Chart.Chart\r\n * @deprecated since version 2.8.0\r\n * @todo remove at version 3\r\n * @private\r\n */\r\ncore_controller.Chart = core_controller;\r\n\r\n/**\r\n * Provided for backward compatibility, not available anymore\r\n * @namespace Chart.Legend\r\n * @deprecated since version 2.1.5\r\n * @todo remove at version 3\r\n * @private\r\n */\r\ncore_controller.Legend = plugins.legend._element;\r\n\r\n/**\r\n * Provided for backward compatibility, not available anymore\r\n * @namespace Chart.Title\r\n * @deprecated since version 2.1.5\r\n * @todo remove at version 3\r\n * @private\r\n */\r\ncore_controller.Title = plugins.title._element;\r\n\r\n/**\r\n * Provided for backward compatibility, use Chart.plugins instead\r\n * @namespace Chart.pluginService\r\n * @deprecated since version 2.1.5\r\n * @todo remove at version 3\r\n * @private\r\n */\r\ncore_controller.pluginService = core_controller.plugins;\r\n\r\n/**\r\n * Provided for backward compatibility, inheriting from Chart.PlugingBase has no\r\n * effect, instead simply create/register plugins via plain JavaScript objects.\r\n * @interface Chart.PluginBase\r\n * @deprecated since version 2.5.0\r\n * @todo remove at version 3\r\n * @private\r\n */\r\ncore_controller.PluginBase = core_controller.Element.extend({});\r\n\r\n/**\r\n * Provided for backward compatibility, use Chart.helpers.canvas instead.\r\n * @namespace Chart.canvasHelpers\r\n * @deprecated since version 2.6.0\r\n * @todo remove at version 3\r\n * @private\r\n */\r\ncore_controller.canvasHelpers = core_controller.helpers.canvas;\r\n\r\n/**\r\n * Provided for backward compatibility, use Chart.layouts instead.\r\n * @namespace Chart.layoutService\r\n * @deprecated since version 2.7.3\r\n * @todo remove at version 3\r\n * @private\r\n */\r\ncore_controller.layoutService = core_controller.layouts;\r\n\r\n/**\r\n * Provided for backward compatibility, not available anymore.\r\n * @namespace Chart.LinearScaleBase\r\n * @deprecated since version 2.8\r\n * @todo remove at version 3\r\n * @private\r\n */\r\ncore_controller.LinearScaleBase = scale_linearbase;\r\n\r\n/**\r\n * Provided for backward compatibility, instead we should create a new Chart\r\n * by setting the type in the config (`new Chart(id, {type: '{chart-type}'}`).\r\n * @deprecated since version 2.8.0\r\n * @todo remove at version 3\r\n */\r\ncore_controller.helpers.each(\r\n\t[\r\n\t\t'Bar',\r\n\t\t'Bubble',\r\n\t\t'Doughnut',\r\n\t\t'Line',\r\n\t\t'PolarArea',\r\n\t\t'Radar',\r\n\t\t'Scatter'\r\n\t],\r\n\tfunction(klass) {\r\n\t\tcore_controller[klass] = function(ctx, cfg) {\r\n\t\t\treturn new core_controller(ctx, core_controller.helpers.merge(cfg || {}, {\r\n\t\t\t\ttype: klass.charAt(0).toLowerCase() + klass.slice(1)\r\n\t\t\t}));\r\n\t\t};\r\n\t}\r\n);\n\nreturn src;\n\n})));\n",null,"// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n\n// This is CodeMirror (https://codemirror.net), a code editor\n// implemented in JavaScript on top of the browser's DOM.\n//\n// You can find some technical background for some of the code below\n// at http://marijnhaverbeke.nl/blog/#cm-internals .\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global = global || self, global.CodeMirror = factory());\n}(this, (function () { 'use strict';\n\n // Kludges for bugs and behavior differences that can't be feature\n // detected are enabled based on userAgent etc sniffing.\n var userAgent = navigator.userAgent;\n var platform = navigator.platform;\n\n var gecko = /gecko\\/\\d/i.test(userAgent);\n var ie_upto10 = /MSIE \\d/.test(userAgent);\n var ie_11up = /Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(userAgent);\n var edge = /Edge\\/(\\d+)/.exec(userAgent);\n var ie = ie_upto10 || ie_11up || edge;\n var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1]);\n var webkit = !edge && /WebKit\\//.test(userAgent);\n var qtwebkit = webkit && /Qt\\/\\d+\\.\\d+/.test(userAgent);\n var chrome = !edge && /Chrome\\//.test(userAgent);\n var presto = /Opera\\//.test(userAgent);\n var safari = /Apple Computer/.test(navigator.vendor);\n var mac_geMountainLion = /Mac OS X 1\\d\\D([8-9]|\\d\\d)\\D/.test(userAgent);\n var phantom = /PhantomJS/.test(userAgent);\n\n var ios = !edge && /AppleWebKit/.test(userAgent) && /Mobile\\/\\w+/.test(userAgent);\n var android = /Android/.test(userAgent);\n // This is woefully incomplete. Suggestions for alternative methods welcome.\n var mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);\n var mac = ios || /Mac/.test(platform);\n var chromeOS = /\\bCrOS\\b/.test(userAgent);\n var windows = /win/i.test(platform);\n\n var presto_version = presto && userAgent.match(/Version\\/(\\d*\\.\\d*)/);\n if (presto_version) { presto_version = Number(presto_version[1]); }\n if (presto_version && presto_version >= 15) { presto = false; webkit = true; }\n // Some browsers use the wrong event properties to signal cmd/ctrl on OS X\n var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11));\n var captureRightClick = gecko || (ie && ie_version >= 9);\n\n function classTest(cls) { return new RegExp(\"(^|\\\\s)\" + cls + \"(?:$|\\\\s)\\\\s*\") }\n\n var rmClass = function(node, cls) {\n var current = node.className;\n var match = classTest(cls).exec(current);\n if (match) {\n var after = current.slice(match.index + match[0].length);\n node.className = current.slice(0, match.index) + (after ? match[1] + after : \"\");\n }\n };\n\n function removeChildren(e) {\n for (var count = e.childNodes.length; count > 0; --count)\n { e.removeChild(e.firstChild); }\n return e\n }\n\n function removeChildrenAndAdd(parent, e) {\n return removeChildren(parent).appendChild(e)\n }\n\n function elt(tag, content, className, style) {\n var e = document.createElement(tag);\n if (className) { e.className = className; }\n if (style) { e.style.cssText = style; }\n if (typeof content == \"string\") { e.appendChild(document.createTextNode(content)); }\n else if (content) { for (var i = 0; i < content.length; ++i) { e.appendChild(content[i]); } }\n return e\n }\n // wrapper for elt, which removes the elt from the accessibility tree\n function eltP(tag, content, className, style) {\n var e = elt(tag, content, className, style);\n e.setAttribute(\"role\", \"presentation\");\n return e\n }\n\n var range;\n if (document.createRange) { range = function(node, start, end, endNode) {\n var r = document.createRange();\n r.setEnd(endNode || node, end);\n r.setStart(node, start);\n return r\n }; }\n else { range = function(node, start, end) {\n var r = document.body.createTextRange();\n try { r.moveToElementText(node.parentNode); }\n catch(e) { return r }\n r.collapse(true);\n r.moveEnd(\"character\", end);\n r.moveStart(\"character\", start);\n return r\n }; }\n\n function contains(parent, child) {\n if (child.nodeType == 3) // Android browser always returns false when child is a textnode\n { child = child.parentNode; }\n if (parent.contains)\n { return parent.contains(child) }\n do {\n if (child.nodeType == 11) { child = child.host; }\n if (child == parent) { return true }\n } while (child = child.parentNode)\n }\n\n function activeElt() {\n // IE and Edge may throw an \"Unspecified Error\" when accessing document.activeElement.\n // IE < 10 will throw when accessed while the page is loading or in an iframe.\n // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.\n var activeElement;\n try {\n activeElement = document.activeElement;\n } catch(e) {\n activeElement = document.body || null;\n }\n while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement)\n { activeElement = activeElement.shadowRoot.activeElement; }\n return activeElement\n }\n\n function addClass(node, cls) {\n var current = node.className;\n if (!classTest(cls).test(current)) { node.className += (current ? \" \" : \"\") + cls; }\n }\n function joinClasses(a, b) {\n var as = a.split(\" \");\n for (var i = 0; i < as.length; i++)\n { if (as[i] && !classTest(as[i]).test(b)) { b += \" \" + as[i]; } }\n return b\n }\n\n var selectInput = function(node) { node.select(); };\n if (ios) // Mobile Safari apparently has a bug where select() is broken.\n { selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length; }; }\n else if (ie) // Suppress mysterious IE10 errors\n { selectInput = function(node) { try { node.select(); } catch(_e) {} }; }\n\n function bind(f) {\n var args = Array.prototype.slice.call(arguments, 1);\n return function(){return f.apply(null, args)}\n }\n\n function copyObj(obj, target, overwrite) {\n if (!target) { target = {}; }\n for (var prop in obj)\n { if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))\n { target[prop] = obj[prop]; } }\n return target\n }\n\n // Counts the column offset in a string, taking tabs into account.\n // Used mostly to find indentation.\n function countColumn(string, end, tabSize, startIndex, startValue) {\n if (end == null) {\n end = string.search(/[^\\s\\u00a0]/);\n if (end == -1) { end = string.length; }\n }\n for (var i = startIndex || 0, n = startValue || 0;;) {\n var nextTab = string.indexOf(\"\\t\", i);\n if (nextTab < 0 || nextTab >= end)\n { return n + (end - i) }\n n += nextTab - i;\n n += tabSize - (n % tabSize);\n i = nextTab + 1;\n }\n }\n\n var Delayed = function() {\n this.id = null;\n this.f = null;\n this.time = 0;\n this.handler = bind(this.onTimeout, this);\n };\n Delayed.prototype.onTimeout = function (self) {\n self.id = 0;\n if (self.time <= +new Date) {\n self.f();\n } else {\n setTimeout(self.handler, self.time - +new Date);\n }\n };\n Delayed.prototype.set = function (ms, f) {\n this.f = f;\n var time = +new Date + ms;\n if (!this.id || time < this.time) {\n clearTimeout(this.id);\n this.id = setTimeout(this.handler, ms);\n this.time = time;\n }\n };\n\n function indexOf(array, elt) {\n for (var i = 0; i < array.length; ++i)\n { if (array[i] == elt) { return i } }\n return -1\n }\n\n // Number of pixels added to scroller and sizer to hide scrollbar\n var scrollerGap = 50;\n\n // Returned or thrown by various protocols to signal 'I'm not\n // handling this'.\n var Pass = {toString: function(){return \"CodeMirror.Pass\"}};\n\n // Reused option objects for setSelection & friends\n var sel_dontScroll = {scroll: false}, sel_mouse = {origin: \"*mouse\"}, sel_move = {origin: \"+move\"};\n\n // The inverse of countColumn -- find the offset that corresponds to\n // a particular column.\n function findColumn(string, goal, tabSize) {\n for (var pos = 0, col = 0;;) {\n var nextTab = string.indexOf(\"\\t\", pos);\n if (nextTab == -1) { nextTab = string.length; }\n var skipped = nextTab - pos;\n if (nextTab == string.length || col + skipped >= goal)\n { return pos + Math.min(skipped, goal - col) }\n col += nextTab - pos;\n col += tabSize - (col % tabSize);\n pos = nextTab + 1;\n if (col >= goal) { return pos }\n }\n }\n\n var spaceStrs = [\"\"];\n function spaceStr(n) {\n while (spaceStrs.length <= n)\n { spaceStrs.push(lst(spaceStrs) + \" \"); }\n return spaceStrs[n]\n }\n\n function lst(arr) { return arr[arr.length-1] }\n\n function map(array, f) {\n var out = [];\n for (var i = 0; i < array.length; i++) { out[i] = f(array[i], i); }\n return out\n }\n\n function insertSorted(array, value, score) {\n var pos = 0, priority = score(value);\n while (pos < array.length && score(array[pos]) <= priority) { pos++; }\n array.splice(pos, 0, value);\n }\n\n function nothing() {}\n\n function createObj(base, props) {\n var inst;\n if (Object.create) {\n inst = Object.create(base);\n } else {\n nothing.prototype = base;\n inst = new nothing();\n }\n if (props) { copyObj(props, inst); }\n return inst\n }\n\n var nonASCIISingleCaseWordChar = /[\\u00df\\u0587\\u0590-\\u05f4\\u0600-\\u06ff\\u3040-\\u309f\\u30a0-\\u30ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\uac00-\\ud7af]/;\n function isWordCharBasic(ch) {\n return /\\w/.test(ch) || ch > \"\\x80\" &&\n (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch))\n }\n function isWordChar(ch, helper) {\n if (!helper) { return isWordCharBasic(ch) }\n if (helper.source.indexOf(\"\\\\w\") > -1 && isWordCharBasic(ch)) { return true }\n return helper.test(ch)\n }\n\n function isEmpty(obj) {\n for (var n in obj) { if (obj.hasOwnProperty(n) && obj[n]) { return false } }\n return true\n }\n\n // Extending unicode characters. A series of a non-extending char +\n // any number of extending chars is treated as a single unit as far\n // as editing and measuring is concerned. This is not fully correct,\n // since some scripts/fonts/browsers also treat other configurations\n // of code points as a group.\n var extendingChars = /[\\u0300-\\u036f\\u0483-\\u0489\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u064b-\\u065e\\u0670\\u06d6-\\u06dc\\u06de-\\u06e4\\u06e7\\u06e8\\u06ea-\\u06ed\\u0711\\u0730-\\u074a\\u07a6-\\u07b0\\u07eb-\\u07f3\\u0816-\\u0819\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0900-\\u0902\\u093c\\u0941-\\u0948\\u094d\\u0951-\\u0955\\u0962\\u0963\\u0981\\u09bc\\u09be\\u09c1-\\u09c4\\u09cd\\u09d7\\u09e2\\u09e3\\u0a01\\u0a02\\u0a3c\\u0a41\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a70\\u0a71\\u0a75\\u0a81\\u0a82\\u0abc\\u0ac1-\\u0ac5\\u0ac7\\u0ac8\\u0acd\\u0ae2\\u0ae3\\u0b01\\u0b3c\\u0b3e\\u0b3f\\u0b41-\\u0b44\\u0b4d\\u0b56\\u0b57\\u0b62\\u0b63\\u0b82\\u0bbe\\u0bc0\\u0bcd\\u0bd7\\u0c3e-\\u0c40\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62\\u0c63\\u0cbc\\u0cbf\\u0cc2\\u0cc6\\u0ccc\\u0ccd\\u0cd5\\u0cd6\\u0ce2\\u0ce3\\u0d3e\\u0d41-\\u0d44\\u0d4d\\u0d57\\u0d62\\u0d63\\u0dca\\u0dcf\\u0dd2-\\u0dd4\\u0dd6\\u0ddf\\u0e31\\u0e34-\\u0e3a\\u0e47-\\u0e4e\\u0eb1\\u0eb4-\\u0eb9\\u0ebb\\u0ebc\\u0ec8-\\u0ecd\\u0f18\\u0f19\\u0f35\\u0f37\\u0f39\\u0f71-\\u0f7e\\u0f80-\\u0f84\\u0f86\\u0f87\\u0f90-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u102d-\\u1030\\u1032-\\u1037\\u1039\\u103a\\u103d\\u103e\\u1058\\u1059\\u105e-\\u1060\\u1071-\\u1074\\u1082\\u1085\\u1086\\u108d\\u109d\\u135f\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17b7-\\u17bd\\u17c6\\u17c9-\\u17d3\\u17dd\\u180b-\\u180d\\u18a9\\u1920-\\u1922\\u1927\\u1928\\u1932\\u1939-\\u193b\\u1a17\\u1a18\\u1a56\\u1a58-\\u1a5e\\u1a60\\u1a62\\u1a65-\\u1a6c\\u1a73-\\u1a7c\\u1a7f\\u1b00-\\u1b03\\u1b34\\u1b36-\\u1b3a\\u1b3c\\u1b42\\u1b6b-\\u1b73\\u1b80\\u1b81\\u1ba2-\\u1ba5\\u1ba8\\u1ba9\\u1c2c-\\u1c33\\u1c36\\u1c37\\u1cd0-\\u1cd2\\u1cd4-\\u1ce0\\u1ce2-\\u1ce8\\u1ced\\u1dc0-\\u1de6\\u1dfd-\\u1dff\\u200c\\u200d\\u20d0-\\u20f0\\u2cef-\\u2cf1\\u2de0-\\u2dff\\u302a-\\u302f\\u3099\\u309a\\ua66f-\\ua672\\ua67c\\ua67d\\ua6f0\\ua6f1\\ua802\\ua806\\ua80b\\ua825\\ua826\\ua8c4\\ua8e0-\\ua8f1\\ua926-\\ua92d\\ua947-\\ua951\\ua980-\\ua982\\ua9b3\\ua9b6-\\ua9b9\\ua9bc\\uaa29-\\uaa2e\\uaa31\\uaa32\\uaa35\\uaa36\\uaa43\\uaa4c\\uaab0\\uaab2-\\uaab4\\uaab7\\uaab8\\uaabe\\uaabf\\uaac1\\uabe5\\uabe8\\uabed\\udc00-\\udfff\\ufb1e\\ufe00-\\ufe0f\\ufe20-\\ufe26\\uff9e\\uff9f]/;\n function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch) }\n\n // Returns a number from the range [`0`; `str.length`] unless `pos` is outside that range.\n function skipExtendingChars(str, pos, dir) {\n while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) { pos += dir; }\n return pos\n }\n\n // Returns the value from the range [`from`; `to`] that satisfies\n // `pred` and is closest to `from`. Assumes that at least `to`\n // satisfies `pred`. Supports `from` being greater than `to`.\n function findFirst(pred, from, to) {\n // At any point we are certain `to` satisfies `pred`, don't know\n // whether `from` does.\n var dir = from > to ? -1 : 1;\n for (;;) {\n if (from == to) { return from }\n var midF = (from + to) / 2, mid = dir < 0 ? Math.ceil(midF) : Math.floor(midF);\n if (mid == from) { return pred(mid) ? from : to }\n if (pred(mid)) { to = mid; }\n else { from = mid + dir; }\n }\n }\n\n // BIDI HELPERS\n\n function iterateBidiSections(order, from, to, f) {\n if (!order) { return f(from, to, \"ltr\", 0) }\n var found = false;\n for (var i = 0; i < order.length; ++i) {\n var part = order[i];\n if (part.from < to && part.to > from || from == to && part.to == from) {\n f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? \"rtl\" : \"ltr\", i);\n found = true;\n }\n }\n if (!found) { f(from, to, \"ltr\"); }\n }\n\n var bidiOther = null;\n function getBidiPartAt(order, ch, sticky) {\n var found;\n bidiOther = null;\n for (var i = 0; i < order.length; ++i) {\n var cur = order[i];\n if (cur.from < ch && cur.to > ch) { return i }\n if (cur.to == ch) {\n if (cur.from != cur.to && sticky == \"before\") { found = i; }\n else { bidiOther = i; }\n }\n if (cur.from == ch) {\n if (cur.from != cur.to && sticky != \"before\") { found = i; }\n else { bidiOther = i; }\n }\n }\n return found != null ? found : bidiOther\n }\n\n // Bidirectional ordering algorithm\n // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm\n // that this (partially) implements.\n\n // One-char codes used for character types:\n // L (L): Left-to-Right\n // R (R): Right-to-Left\n // r (AL): Right-to-Left Arabic\n // 1 (EN): European Number\n // + (ES): European Number Separator\n // % (ET): European Number Terminator\n // n (AN): Arabic Number\n // , (CS): Common Number Separator\n // m (NSM): Non-Spacing Mark\n // b (BN): Boundary Neutral\n // s (B): Paragraph Separator\n // t (S): Segment Separator\n // w (WS): Whitespace\n // N (ON): Other Neutrals\n\n // Returns null if characters are ordered as they appear\n // (left-to-right), or an array of sections ({from, to, level}\n // objects) in the order in which they occur visually.\n var bidiOrdering = (function() {\n // Character types for codepoints 0 to 0xff\n var lowTypes = \"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN\";\n // Character types for codepoints 0x600 to 0x6f9\n var arabicTypes = \"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111\";\n function charType(code) {\n if (code <= 0xf7) { return lowTypes.charAt(code) }\n else if (0x590 <= code && code <= 0x5f4) { return \"R\" }\n else if (0x600 <= code && code <= 0x6f9) { return arabicTypes.charAt(code - 0x600) }\n else if (0x6ee <= code && code <= 0x8ac) { return \"r\" }\n else if (0x2000 <= code && code <= 0x200b) { return \"w\" }\n else if (code == 0x200c) { return \"b\" }\n else { return \"L\" }\n }\n\n var bidiRE = /[\\u0590-\\u05f4\\u0600-\\u06ff\\u0700-\\u08ac]/;\n var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/;\n\n function BidiSpan(level, from, to) {\n this.level = level;\n this.from = from; this.to = to;\n }\n\n return function(str, direction) {\n var outerType = direction == \"ltr\" ? \"L\" : \"R\";\n\n if (str.length == 0 || direction == \"ltr\" && !bidiRE.test(str)) { return false }\n var len = str.length, types = [];\n for (var i = 0; i < len; ++i)\n { types.push(charType(str.charCodeAt(i))); }\n\n // W1. Examine each non-spacing mark (NSM) in the level run, and\n // change the type of the NSM to the type of the previous\n // character. If the NSM is at the start of the level run, it will\n // get the type of sor.\n for (var i$1 = 0, prev = outerType; i$1 < len; ++i$1) {\n var type = types[i$1];\n if (type == \"m\") { types[i$1] = prev; }\n else { prev = type; }\n }\n\n // W2. Search backwards from each instance of a European number\n // until the first strong type (R, L, AL, or sor) is found. If an\n // AL is found, change the type of the European number to Arabic\n // number.\n // W3. Change all ALs to R.\n for (var i$2 = 0, cur = outerType; i$2 < len; ++i$2) {\n var type$1 = types[i$2];\n if (type$1 == \"1\" && cur == \"r\") { types[i$2] = \"n\"; }\n else if (isStrong.test(type$1)) { cur = type$1; if (type$1 == \"r\") { types[i$2] = \"R\"; } }\n }\n\n // W4. A single European separator between two European numbers\n // changes to a European number. A single common separator between\n // two numbers of the same type changes to that type.\n for (var i$3 = 1, prev$1 = types[0]; i$3 < len - 1; ++i$3) {\n var type$2 = types[i$3];\n if (type$2 == \"+\" && prev$1 == \"1\" && types[i$3+1] == \"1\") { types[i$3] = \"1\"; }\n else if (type$2 == \",\" && prev$1 == types[i$3+1] &&\n (prev$1 == \"1\" || prev$1 == \"n\")) { types[i$3] = prev$1; }\n prev$1 = type$2;\n }\n\n // W5. A sequence of European terminators adjacent to European\n // numbers changes to all European numbers.\n // W6. Otherwise, separators and terminators change to Other\n // Neutral.\n for (var i$4 = 0; i$4 < len; ++i$4) {\n var type$3 = types[i$4];\n if (type$3 == \",\") { types[i$4] = \"N\"; }\n else if (type$3 == \"%\") {\n var end = (void 0);\n for (end = i$4 + 1; end < len && types[end] == \"%\"; ++end) {}\n var replace = (i$4 && types[i$4-1] == \"!\") || (end < len && types[end] == \"1\") ? \"1\" : \"N\";\n for (var j = i$4; j < end; ++j) { types[j] = replace; }\n i$4 = end - 1;\n }\n }\n\n // W7. Search backwards from each instance of a European number\n // until the first strong type (R, L, or sor) is found. If an L is\n // found, then change the type of the European number to L.\n for (var i$5 = 0, cur$1 = outerType; i$5 < len; ++i$5) {\n var type$4 = types[i$5];\n if (cur$1 == \"L\" && type$4 == \"1\") { types[i$5] = \"L\"; }\n else if (isStrong.test(type$4)) { cur$1 = type$4; }\n }\n\n // N1. A sequence of neutrals takes the direction of the\n // surrounding strong text if the text on both sides has the same\n // direction. European and Arabic numbers act as if they were R in\n // terms of their influence on neutrals. Start-of-level-run (sor)\n // and end-of-level-run (eor) are used at level run boundaries.\n // N2. Any remaining neutrals take the embedding direction.\n for (var i$6 = 0; i$6 < len; ++i$6) {\n if (isNeutral.test(types[i$6])) {\n var end$1 = (void 0);\n for (end$1 = i$6 + 1; end$1 < len && isNeutral.test(types[end$1]); ++end$1) {}\n var before = (i$6 ? types[i$6-1] : outerType) == \"L\";\n var after = (end$1 < len ? types[end$1] : outerType) == \"L\";\n var replace$1 = before == after ? (before ? \"L\" : \"R\") : outerType;\n for (var j$1 = i$6; j$1 < end$1; ++j$1) { types[j$1] = replace$1; }\n i$6 = end$1 - 1;\n }\n }\n\n // Here we depart from the documented algorithm, in order to avoid\n // building up an actual levels array. Since there are only three\n // levels (0, 1, 2) in an implementation that doesn't take\n // explicit embedding into account, we can build up the order on\n // the fly, without following the level-based algorithm.\n var order = [], m;\n for (var i$7 = 0; i$7 < len;) {\n if (countsAsLeft.test(types[i$7])) {\n var start = i$7;\n for (++i$7; i$7 < len && countsAsLeft.test(types[i$7]); ++i$7) {}\n order.push(new BidiSpan(0, start, i$7));\n } else {\n var pos = i$7, at = order.length, isRTL = direction == \"rtl\" ? 1 : 0;\n for (++i$7; i$7 < len && types[i$7] != \"L\"; ++i$7) {}\n for (var j$2 = pos; j$2 < i$7;) {\n if (countsAsNum.test(types[j$2])) {\n if (pos < j$2) { order.splice(at, 0, new BidiSpan(1, pos, j$2)); at += isRTL; }\n var nstart = j$2;\n for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {}\n order.splice(at, 0, new BidiSpan(2, nstart, j$2));\n at += isRTL;\n pos = j$2;\n } else { ++j$2; }\n }\n if (pos < i$7) { order.splice(at, 0, new BidiSpan(1, pos, i$7)); }\n }\n }\n if (direction == \"ltr\") {\n if (order[0].level == 1 && (m = str.match(/^\\s+/))) {\n order[0].from = m[0].length;\n order.unshift(new BidiSpan(0, 0, m[0].length));\n }\n if (lst(order).level == 1 && (m = str.match(/\\s+$/))) {\n lst(order).to -= m[0].length;\n order.push(new BidiSpan(0, len - m[0].length, len));\n }\n }\n\n return direction == \"rtl\" ? order.reverse() : order\n }\n })();\n\n // Get the bidi ordering for the given line (and cache it). Returns\n // false for lines that are fully left-to-right, and an array of\n // BidiSpan objects otherwise.\n function getOrder(line, direction) {\n var order = line.order;\n if (order == null) { order = line.order = bidiOrdering(line.text, direction); }\n return order\n }\n\n // EVENT HANDLING\n\n // Lightweight event framework. on/off also work on DOM nodes,\n // registering native DOM handlers.\n\n var noHandlers = [];\n\n var on = function(emitter, type, f) {\n if (emitter.addEventListener) {\n emitter.addEventListener(type, f, false);\n } else if (emitter.attachEvent) {\n emitter.attachEvent(\"on\" + type, f);\n } else {\n var map = emitter._handlers || (emitter._handlers = {});\n map[type] = (map[type] || noHandlers).concat(f);\n }\n };\n\n function getHandlers(emitter, type) {\n return emitter._handlers && emitter._handlers[type] || noHandlers\n }\n\n function off(emitter, type, f) {\n if (emitter.removeEventListener) {\n emitter.removeEventListener(type, f, false);\n } else if (emitter.detachEvent) {\n emitter.detachEvent(\"on\" + type, f);\n } else {\n var map = emitter._handlers, arr = map && map[type];\n if (arr) {\n var index = indexOf(arr, f);\n if (index > -1)\n { map[type] = arr.slice(0, index).concat(arr.slice(index + 1)); }\n }\n }\n }\n\n function signal(emitter, type /*, values...*/) {\n var handlers = getHandlers(emitter, type);\n if (!handlers.length) { return }\n var args = Array.prototype.slice.call(arguments, 2);\n for (var i = 0; i < handlers.length; ++i) { handlers[i].apply(null, args); }\n }\n\n // The DOM events that CodeMirror handles can be overridden by\n // registering a (non-DOM) handler on the editor for the event name,\n // and preventDefault-ing the event in that handler.\n function signalDOMEvent(cm, e, override) {\n if (typeof e == \"string\")\n { e = {type: e, preventDefault: function() { this.defaultPrevented = true; }}; }\n signal(cm, override || e.type, cm, e);\n return e_defaultPrevented(e) || e.codemirrorIgnore\n }\n\n function signalCursorActivity(cm) {\n var arr = cm._handlers && cm._handlers.cursorActivity;\n if (!arr) { return }\n var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []);\n for (var i = 0; i < arr.length; ++i) { if (indexOf(set, arr[i]) == -1)\n { set.push(arr[i]); } }\n }\n\n function hasHandler(emitter, type) {\n return getHandlers(emitter, type).length > 0\n }\n\n // Add on and off methods to a constructor's prototype, to make\n // registering events on such objects more convenient.\n function eventMixin(ctor) {\n ctor.prototype.on = function(type, f) {on(this, type, f);};\n ctor.prototype.off = function(type, f) {off(this, type, f);};\n }\n\n // Due to the fact that we still support jurassic IE versions, some\n // compatibility wrappers are needed.\n\n function e_preventDefault(e) {\n if (e.preventDefault) { e.preventDefault(); }\n else { e.returnValue = false; }\n }\n function e_stopPropagation(e) {\n if (e.stopPropagation) { e.stopPropagation(); }\n else { e.cancelBubble = true; }\n }\n function e_defaultPrevented(e) {\n return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false\n }\n function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);}\n\n function e_target(e) {return e.target || e.srcElement}\n function e_button(e) {\n var b = e.which;\n if (b == null) {\n if (e.button & 1) { b = 1; }\n else if (e.button & 2) { b = 3; }\n else if (e.button & 4) { b = 2; }\n }\n if (mac && e.ctrlKey && b == 1) { b = 3; }\n return b\n }\n\n // Detect drag-and-drop\n var dragAndDrop = function() {\n // There is *some* kind of drag-and-drop support in IE6-8, but I\n // couldn't get it to work yet.\n if (ie && ie_version < 9) { return false }\n var div = elt('div');\n return \"draggable\" in div || \"dragDrop\" in div\n }();\n\n var zwspSupported;\n function zeroWidthElement(measure) {\n if (zwspSupported == null) {\n var test = elt(\"span\", \"\\u200b\");\n removeChildrenAndAdd(measure, elt(\"span\", [test, document.createTextNode(\"x\")]));\n if (measure.firstChild.offsetHeight != 0)\n { zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8); }\n }\n var node = zwspSupported ? elt(\"span\", \"\\u200b\") :\n elt(\"span\", \"\\u00a0\", null, \"display: inline-block; width: 1px; margin-right: -1px\");\n node.setAttribute(\"cm-text\", \"\");\n return node\n }\n\n // Feature-detect IE's crummy client rect reporting for bidi text\n var badBidiRects;\n function hasBadBidiRects(measure) {\n if (badBidiRects != null) { return badBidiRects }\n var txt = removeChildrenAndAdd(measure, document.createTextNode(\"A\\u062eA\"));\n var r0 = range(txt, 0, 1).getBoundingClientRect();\n var r1 = range(txt, 1, 2).getBoundingClientRect();\n removeChildren(measure);\n if (!r0 || r0.left == r0.right) { return false } // Safari returns null in some cases (#2780)\n return badBidiRects = (r1.right - r0.right < 3)\n }\n\n // See if \"\".split is the broken IE version, if so, provide an\n // alternative way to split lines.\n var splitLinesAuto = \"\\n\\nb\".split(/\\n/).length != 3 ? function (string) {\n var pos = 0, result = [], l = string.length;\n while (pos <= l) {\n var nl = string.indexOf(\"\\n\", pos);\n if (nl == -1) { nl = string.length; }\n var line = string.slice(pos, string.charAt(nl - 1) == \"\\r\" ? nl - 1 : nl);\n var rt = line.indexOf(\"\\r\");\n if (rt != -1) {\n result.push(line.slice(0, rt));\n pos += rt + 1;\n } else {\n result.push(line);\n pos = nl + 1;\n }\n }\n return result\n } : function (string) { return string.split(/\\r\\n?|\\n/); };\n\n var hasSelection = window.getSelection ? function (te) {\n try { return te.selectionStart != te.selectionEnd }\n catch(e) { return false }\n } : function (te) {\n var range;\n try {range = te.ownerDocument.selection.createRange();}\n catch(e) {}\n if (!range || range.parentElement() != te) { return false }\n return range.compareEndPoints(\"StartToEnd\", range) != 0\n };\n\n var hasCopyEvent = (function () {\n var e = elt(\"div\");\n if (\"oncopy\" in e) { return true }\n e.setAttribute(\"oncopy\", \"return;\");\n return typeof e.oncopy == \"function\"\n })();\n\n var badZoomedRects = null;\n function hasBadZoomedRects(measure) {\n if (badZoomedRects != null) { return badZoomedRects }\n var node = removeChildrenAndAdd(measure, elt(\"span\", \"x\"));\n var normal = node.getBoundingClientRect();\n var fromRange = range(node, 0, 1).getBoundingClientRect();\n return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1\n }\n\n // Known modes, by name and by MIME\n var modes = {}, mimeModes = {};\n\n // Extra arguments are stored as the mode's dependencies, which is\n // used by (legacy) mechanisms like loadmode.js to automatically\n // load a mode. (Preferred mechanism is the require/define calls.)\n function defineMode(name, mode) {\n if (arguments.length > 2)\n { mode.dependencies = Array.prototype.slice.call(arguments, 2); }\n modes[name] = mode;\n }\n\n function defineMIME(mime, spec) {\n mimeModes[mime] = spec;\n }\n\n // Given a MIME type, a {name, ...options} config object, or a name\n // string, return a mode config object.\n function resolveMode(spec) {\n if (typeof spec == \"string\" && mimeModes.hasOwnProperty(spec)) {\n spec = mimeModes[spec];\n } else if (spec && typeof spec.name == \"string\" && mimeModes.hasOwnProperty(spec.name)) {\n var found = mimeModes[spec.name];\n if (typeof found == \"string\") { found = {name: found}; }\n spec = createObj(found, spec);\n spec.name = found.name;\n } else if (typeof spec == \"string\" && /^[\\w\\-]+\\/[\\w\\-]+\\+xml$/.test(spec)) {\n return resolveMode(\"application/xml\")\n } else if (typeof spec == \"string\" && /^[\\w\\-]+\\/[\\w\\-]+\\+json$/.test(spec)) {\n return resolveMode(\"application/json\")\n }\n if (typeof spec == \"string\") { return {name: spec} }\n else { return spec || {name: \"null\"} }\n }\n\n // Given a mode spec (anything that resolveMode accepts), find and\n // initialize an actual mode object.\n function getMode(options, spec) {\n spec = resolveMode(spec);\n var mfactory = modes[spec.name];\n if (!mfactory) { return getMode(options, \"text/plain\") }\n var modeObj = mfactory(options, spec);\n if (modeExtensions.hasOwnProperty(spec.name)) {\n var exts = modeExtensions[spec.name];\n for (var prop in exts) {\n if (!exts.hasOwnProperty(prop)) { continue }\n if (modeObj.hasOwnProperty(prop)) { modeObj[\"_\" + prop] = modeObj[prop]; }\n modeObj[prop] = exts[prop];\n }\n }\n modeObj.name = spec.name;\n if (spec.helperType) { modeObj.helperType = spec.helperType; }\n if (spec.modeProps) { for (var prop$1 in spec.modeProps)\n { modeObj[prop$1] = spec.modeProps[prop$1]; } }\n\n return modeObj\n }\n\n // This can be used to attach properties to mode objects from\n // outside the actual mode definition.\n var modeExtensions = {};\n function extendMode(mode, properties) {\n var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});\n copyObj(properties, exts);\n }\n\n function copyState(mode, state) {\n if (state === true) { return state }\n if (mode.copyState) { return mode.copyState(state) }\n var nstate = {};\n for (var n in state) {\n var val = state[n];\n if (val instanceof Array) { val = val.concat([]); }\n nstate[n] = val;\n }\n return nstate\n }\n\n // Given a mode and a state (for that mode), find the inner mode and\n // state at the position that the state refers to.\n function innerMode(mode, state) {\n var info;\n while (mode.innerMode) {\n info = mode.innerMode(state);\n if (!info || info.mode == mode) { break }\n state = info.state;\n mode = info.mode;\n }\n return info || {mode: mode, state: state}\n }\n\n function startState(mode, a1, a2) {\n return mode.startState ? mode.startState(a1, a2) : true\n }\n\n // STRING STREAM\n\n // Fed to the mode parsers, provides helper functions to make\n // parsers more succinct.\n\n var StringStream = function(string, tabSize, lineOracle) {\n this.pos = this.start = 0;\n this.string = string;\n this.tabSize = tabSize || 8;\n this.lastColumnPos = this.lastColumnValue = 0;\n this.lineStart = 0;\n this.lineOracle = lineOracle;\n };\n\n StringStream.prototype.eol = function () {return this.pos >= this.string.length};\n StringStream.prototype.sol = function () {return this.pos == this.lineStart};\n StringStream.prototype.peek = function () {return this.string.charAt(this.pos) || undefined};\n StringStream.prototype.next = function () {\n if (this.pos < this.string.length)\n { return this.string.charAt(this.pos++) }\n };\n StringStream.prototype.eat = function (match) {\n var ch = this.string.charAt(this.pos);\n var ok;\n if (typeof match == \"string\") { ok = ch == match; }\n else { ok = ch && (match.test ? match.test(ch) : match(ch)); }\n if (ok) {++this.pos; return ch}\n };\n StringStream.prototype.eatWhile = function (match) {\n var start = this.pos;\n while (this.eat(match)){}\n return this.pos > start\n };\n StringStream.prototype.eatSpace = function () {\n var start = this.pos;\n while (/[\\s\\u00a0]/.test(this.string.charAt(this.pos))) { ++this.pos; }\n return this.pos > start\n };\n StringStream.prototype.skipToEnd = function () {this.pos = this.string.length;};\n StringStream.prototype.skipTo = function (ch) {\n var found = this.string.indexOf(ch, this.pos);\n if (found > -1) {this.pos = found; return true}\n };\n StringStream.prototype.backUp = function (n) {this.pos -= n;};\n StringStream.prototype.column = function () {\n if (this.lastColumnPos < this.start) {\n this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);\n this.lastColumnPos = this.start;\n }\n return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)\n };\n StringStream.prototype.indentation = function () {\n return countColumn(this.string, null, this.tabSize) -\n (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)\n };\n StringStream.prototype.match = function (pattern, consume, caseInsensitive) {\n if (typeof pattern == \"string\") {\n var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; };\n var substr = this.string.substr(this.pos, pattern.length);\n if (cased(substr) == cased(pattern)) {\n if (consume !== false) { this.pos += pattern.length; }\n return true\n }\n } else {\n var match = this.string.slice(this.pos).match(pattern);\n if (match && match.index > 0) { return null }\n if (match && consume !== false) { this.pos += match[0].length; }\n return match\n }\n };\n StringStream.prototype.current = function (){return this.string.slice(this.start, this.pos)};\n StringStream.prototype.hideFirstChars = function (n, inner) {\n this.lineStart += n;\n try { return inner() }\n finally { this.lineStart -= n; }\n };\n StringStream.prototype.lookAhead = function (n) {\n var oracle = this.lineOracle;\n return oracle && oracle.lookAhead(n)\n };\n StringStream.prototype.baseToken = function () {\n var oracle = this.lineOracle;\n return oracle && oracle.baseToken(this.pos)\n };\n\n // Find the line object corresponding to the given line number.\n function getLine(doc, n) {\n n -= doc.first;\n if (n < 0 || n >= doc.size) { throw new Error(\"There is no line \" + (n + doc.first) + \" in the document.\") }\n var chunk = doc;\n while (!chunk.lines) {\n for (var i = 0;; ++i) {\n var child = chunk.children[i], sz = child.chunkSize();\n if (n < sz) { chunk = child; break }\n n -= sz;\n }\n }\n return chunk.lines[n]\n }\n\n // Get the part of a document between two positions, as an array of\n // strings.\n function getBetween(doc, start, end) {\n var out = [], n = start.line;\n doc.iter(start.line, end.line + 1, function (line) {\n var text = line.text;\n if (n == end.line) { text = text.slice(0, end.ch); }\n if (n == start.line) { text = text.slice(start.ch); }\n out.push(text);\n ++n;\n });\n return out\n }\n // Get the lines between from and to, as array of strings.\n function getLines(doc, from, to) {\n var out = [];\n doc.iter(from, to, function (line) { out.push(line.text); }); // iter aborts when callback returns truthy value\n return out\n }\n\n // Update the height of a line, propagating the height change\n // upwards to parent nodes.\n function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }\n\n // Given a line object, find its line number by walking up through\n // its parent links.\n function lineNo(line) {\n if (line.parent == null) { return null }\n var cur = line.parent, no = indexOf(cur.lines, line);\n for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {\n for (var i = 0;; ++i) {\n if (chunk.children[i] == cur) { break }\n no += chunk.children[i].chunkSize();\n }\n }\n return no + cur.first\n }\n\n // Find the line at the given vertical position, using the height\n // information in the document tree.\n function lineAtHeight(chunk, h) {\n var n = chunk.first;\n outer: do {\n for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) {\n var child = chunk.children[i$1], ch = child.height;\n if (h < ch) { chunk = child; continue outer }\n h -= ch;\n n += child.chunkSize();\n }\n return n\n } while (!chunk.lines)\n var i = 0;\n for (; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i], lh = line.height;\n if (h < lh) { break }\n h -= lh;\n }\n return n + i\n }\n\n function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size}\n\n function lineNumberFor(options, i) {\n return String(options.lineNumberFormatter(i + options.firstLineNumber))\n }\n\n // A Pos instance represents a position within the text.\n function Pos(line, ch, sticky) {\n if ( sticky === void 0 ) sticky = null;\n\n if (!(this instanceof Pos)) { return new Pos(line, ch, sticky) }\n this.line = line;\n this.ch = ch;\n this.sticky = sticky;\n }\n\n // Compare two positions, return 0 if they are the same, a negative\n // number when a is less, and a positive number otherwise.\n function cmp(a, b) { return a.line - b.line || a.ch - b.ch }\n\n function equalCursorPos(a, b) { return a.sticky == b.sticky && cmp(a, b) == 0 }\n\n function copyPos(x) {return Pos(x.line, x.ch)}\n function maxPos(a, b) { return cmp(a, b) < 0 ? b : a }\n function minPos(a, b) { return cmp(a, b) < 0 ? a : b }\n\n // Most of the external API clips given positions to make sure they\n // actually exist within the document.\n function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))}\n function clipPos(doc, pos) {\n if (pos.line < doc.first) { return Pos(doc.first, 0) }\n var last = doc.first + doc.size - 1;\n if (pos.line > last) { return Pos(last, getLine(doc, last).text.length) }\n return clipToLen(pos, getLine(doc, pos.line).text.length)\n }\n function clipToLen(pos, linelen) {\n var ch = pos.ch;\n if (ch == null || ch > linelen) { return Pos(pos.line, linelen) }\n else if (ch < 0) { return Pos(pos.line, 0) }\n else { return pos }\n }\n function clipPosArray(doc, array) {\n var out = [];\n for (var i = 0; i < array.length; i++) { out[i] = clipPos(doc, array[i]); }\n return out\n }\n\n var SavedContext = function(state, lookAhead) {\n this.state = state;\n this.lookAhead = lookAhead;\n };\n\n var Context = function(doc, state, line, lookAhead) {\n this.state = state;\n this.doc = doc;\n this.line = line;\n this.maxLookAhead = lookAhead || 0;\n this.baseTokens = null;\n this.baseTokenPos = 1;\n };\n\n Context.prototype.lookAhead = function (n) {\n var line = this.doc.getLine(this.line + n);\n if (line != null && n > this.maxLookAhead) { this.maxLookAhead = n; }\n return line\n };\n\n Context.prototype.baseToken = function (n) {\n if (!this.baseTokens) { return null }\n while (this.baseTokens[this.baseTokenPos] <= n)\n { this.baseTokenPos += 2; }\n var type = this.baseTokens[this.baseTokenPos + 1];\n return {type: type && type.replace(/( |^)overlay .*/, \"\"),\n size: this.baseTokens[this.baseTokenPos] - n}\n };\n\n Context.prototype.nextLine = function () {\n this.line++;\n if (this.maxLookAhead > 0) { this.maxLookAhead--; }\n };\n\n Context.fromSaved = function (doc, saved, line) {\n if (saved instanceof SavedContext)\n { return new Context(doc, copyState(doc.mode, saved.state), line, saved.lookAhead) }\n else\n { return new Context(doc, copyState(doc.mode, saved), line) }\n };\n\n Context.prototype.save = function (copy) {\n var state = copy !== false ? copyState(this.doc.mode, this.state) : this.state;\n return this.maxLookAhead > 0 ? new SavedContext(state, this.maxLookAhead) : state\n };\n\n\n // Compute a style array (an array starting with a mode generation\n // -- for invalidation -- followed by pairs of end positions and\n // style strings), which is used to highlight the tokens on the\n // line.\n function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n }\n\n function getLineStyles(cm, line, updateFrontier) {\n if (!line.styles || line.styles[0] != cm.state.modeGen) {\n var context = getContextBefore(cm, lineNo(line));\n var resetState = line.text.length > cm.options.maxHighlightLength && copyState(cm.doc.mode, context.state);\n var result = highlightLine(cm, line, context);\n if (resetState) { context.state = resetState; }\n line.stateAfter = context.save(!resetState);\n line.styles = result.styles;\n if (result.classes) { line.styleClasses = result.classes; }\n else if (line.styleClasses) { line.styleClasses = null; }\n if (updateFrontier === cm.doc.highlightFrontier)\n { cm.doc.modeFrontier = Math.max(cm.doc.modeFrontier, ++cm.doc.highlightFrontier); }\n }\n return line.styles\n }\n\n function getContextBefore(cm, n, precise) {\n var doc = cm.doc, display = cm.display;\n if (!doc.mode.startState) { return new Context(doc, true, n) }\n var start = findStartLine(cm, n, precise);\n var saved = start > doc.first && getLine(doc, start - 1).stateAfter;\n var context = saved ? Context.fromSaved(doc, saved, start) : new Context(doc, startState(doc.mode), start);\n\n doc.iter(start, n, function (line) {\n processLine(cm, line.text, context);\n var pos = context.line;\n line.stateAfter = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo ? context.save() : null;\n context.nextLine();\n });\n if (precise) { doc.modeFrontier = context.line; }\n return context\n }\n\n // Lightweight form of highlight -- proceed over this line and\n // update state, but don't save a style array. Used for lines that\n // aren't currently visible.\n function processLine(cm, text, context, startAt) {\n var mode = cm.doc.mode;\n var stream = new StringStream(text, cm.options.tabSize, context);\n stream.start = stream.pos = startAt || 0;\n if (text == \"\") { callBlankLine(mode, context.state); }\n while (!stream.eol()) {\n readToken(mode, stream, context.state);\n stream.start = stream.pos;\n }\n }\n\n function callBlankLine(mode, state) {\n if (mode.blankLine) { return mode.blankLine(state) }\n if (!mode.innerMode) { return }\n var inner = innerMode(mode, state);\n if (inner.mode.blankLine) { return inner.mode.blankLine(inner.state) }\n }\n\n function readToken(mode, stream, state, inner) {\n for (var i = 0; i < 10; i++) {\n if (inner) { inner[0] = innerMode(mode, state).mode; }\n var style = mode.token(stream, state);\n if (stream.pos > stream.start) { return style }\n }\n throw new Error(\"Mode \" + mode.name + \" failed to advance stream.\")\n }\n\n var Token = function(stream, type, state) {\n this.start = stream.start; this.end = stream.pos;\n this.string = stream.current();\n this.type = type || null;\n this.state = state;\n };\n\n // Utility for getTokenAt and getLineTokens\n function takeToken(cm, pos, precise, asArray) {\n var doc = cm.doc, mode = doc.mode, style;\n pos = clipPos(doc, pos);\n var line = getLine(doc, pos.line), context = getContextBefore(cm, pos.line, precise);\n var stream = new StringStream(line.text, cm.options.tabSize, context), tokens;\n if (asArray) { tokens = []; }\n while ((asArray || stream.pos < pos.ch) && !stream.eol()) {\n stream.start = stream.pos;\n style = readToken(mode, stream, context.state);\n if (asArray) { tokens.push(new Token(stream, style, copyState(doc.mode, context.state))); }\n }\n return asArray ? tokens : new Token(stream, style, context.state)\n }\n\n function extractLineClasses(type, output) {\n if (type) { for (;;) {\n var lineClass = type.match(/(?:^|\\s+)line-(background-)?(\\S+)/);\n if (!lineClass) { break }\n type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length);\n var prop = lineClass[1] ? \"bgClass\" : \"textClass\";\n if (output[prop] == null)\n { output[prop] = lineClass[2]; }\n else if (!(new RegExp(\"(?:^|\\\\s)\" + lineClass[2] + \"(?:$|\\\\s)\")).test(output[prop]))\n { output[prop] += \" \" + lineClass[2]; }\n } }\n return type\n }\n\n // Run the given mode's parser over a line, calling f for each token.\n function runMode(cm, text, mode, context, f, lineClasses, forceToEnd) {\n var flattenSpans = mode.flattenSpans;\n if (flattenSpans == null) { flattenSpans = cm.options.flattenSpans; }\n var curStart = 0, curStyle = null;\n var stream = new StringStream(text, cm.options.tabSize, context), style;\n var inner = cm.options.addModeClass && [null];\n if (text == \"\") { extractLineClasses(callBlankLine(mode, context.state), lineClasses); }\n while (!stream.eol()) {\n if (stream.pos > cm.options.maxHighlightLength) {\n flattenSpans = false;\n if (forceToEnd) { processLine(cm, text, context, stream.pos); }\n stream.pos = text.length;\n style = null;\n } else {\n style = extractLineClasses(readToken(mode, stream, context.state, inner), lineClasses);\n }\n if (inner) {\n var mName = inner[0].name;\n if (mName) { style = \"m-\" + (style ? mName + \" \" + style : mName); }\n }\n if (!flattenSpans || curStyle != style) {\n while (curStart < stream.start) {\n curStart = Math.min(stream.start, curStart + 5000);\n f(curStart, curStyle);\n }\n curStyle = style;\n }\n stream.start = stream.pos;\n }\n while (curStart < stream.pos) {\n // Webkit seems to refuse to render text nodes longer than 57444\n // characters, and returns inaccurate measurements in nodes\n // starting around 5000 chars.\n var pos = Math.min(stream.pos, curStart + 5000);\n f(pos, curStyle);\n curStart = pos;\n }\n }\n\n // Finds the line to start with when starting a parse. Tries to\n // find a line with a stateAfter, so that it can start with a\n // valid state. If that fails, it returns the line with the\n // smallest indentation, which tends to need the least context to\n // parse correctly.\n function findStartLine(cm, n, precise) {\n var minindent, minline, doc = cm.doc;\n var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);\n for (var search = n; search > lim; --search) {\n if (search <= doc.first) { return doc.first }\n var line = getLine(doc, search - 1), after = line.stateAfter;\n if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier))\n { return search }\n var indented = countColumn(line.text, null, cm.options.tabSize);\n if (minline == null || minindent > indented) {\n minline = search - 1;\n minindent = indented;\n }\n }\n return minline\n }\n\n function retreatFrontier(doc, n) {\n doc.modeFrontier = Math.min(doc.modeFrontier, n);\n if (doc.highlightFrontier < n - 10) { return }\n var start = doc.first;\n for (var line = n - 1; line > start; line--) {\n var saved = getLine(doc, line).stateAfter;\n // change is on 3\n // state on line 1 looked ahead 2 -- so saw 3\n // test 1 + 2 < 3 should cover this\n if (saved && (!(saved instanceof SavedContext) || line + saved.lookAhead < n)) {\n start = line + 1;\n break\n }\n }\n doc.highlightFrontier = Math.min(doc.highlightFrontier, start);\n }\n\n // Optimize some code when these features are not used.\n var sawReadOnlySpans = false, sawCollapsedSpans = false;\n\n function seeReadOnlySpans() {\n sawReadOnlySpans = true;\n }\n\n function seeCollapsedSpans() {\n sawCollapsedSpans = true;\n }\n\n // TEXTMARKER SPANS\n\n function MarkedSpan(marker, from, to) {\n this.marker = marker;\n this.from = from; this.to = to;\n }\n\n // Search an array of spans for a span matching the given marker.\n function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n }\n // Remove a span from an array, returning undefined if no spans are\n // left (we don't store arrays for lines without spans).\n function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }\n // Add a span to a line.\n function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }\n\n // Used for the algorithm that adjusts markers for a change in the\n // document. These functions cut an array of spans at a given\n // character position, returning an array of remaining chunks (or\n // undefined if nothing remains).\n function markedSpansBefore(old, startCh, isInsert) {\n var nw;\n if (old) { for (var i = 0; i < old.length; ++i) {\n var span = old[i], marker = span.marker;\n var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);\n if (startsBefore || span.from == startCh && marker.type == \"bookmark\" && (!isInsert || !span.marker.insertLeft)) {\n var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh)\n ;(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to));\n }\n } }\n return nw\n }\n function markedSpansAfter(old, endCh, isInsert) {\n var nw;\n if (old) { for (var i = 0; i < old.length; ++i) {\n var span = old[i], marker = span.marker;\n var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);\n if (endsAfter || span.from == endCh && marker.type == \"bookmark\" && (!isInsert || span.marker.insertLeft)) {\n var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh)\n ;(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,\n span.to == null ? null : span.to - endCh));\n }\n } }\n return nw\n }\n\n // Given a change object, compute the new set of marker spans that\n // cover the line in which the change took place. Removes spans\n // entirely within the change, reconnects spans belonging to the\n // same marker that appear on both sides of the change, and cuts off\n // spans partially within the change. Returns an array of span\n // arrays with one element for each line in (after) the change.\n function stretchSpansOverChange(doc, change) {\n if (change.full) { return null }\n var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;\n var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;\n if (!oldFirst && !oldLast) { return null }\n\n var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;\n // Get the spans that 'stick out' on both sides\n var first = markedSpansBefore(oldFirst, startCh, isInsert);\n var last = markedSpansAfter(oldLast, endCh, isInsert);\n\n // Next, merge those two ends\n var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);\n if (first) {\n // Fix up .to properties of first\n for (var i = 0; i < first.length; ++i) {\n var span = first[i];\n if (span.to == null) {\n var found = getMarkedSpanFor(last, span.marker);\n if (!found) { span.to = startCh; }\n else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }\n }\n }\n }\n if (last) {\n // Fix up .from in last (or move them into first in case of sameLine)\n for (var i$1 = 0; i$1 < last.length; ++i$1) {\n var span$1 = last[i$1];\n if (span$1.to != null) { span$1.to += offset; }\n if (span$1.from == null) {\n var found$1 = getMarkedSpanFor(first, span$1.marker);\n if (!found$1) {\n span$1.from = offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n } else {\n span$1.from += offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n }\n }\n // Make sure we didn't create any zero-length spans\n if (first) { first = clearEmptySpans(first); }\n if (last && last != first) { last = clearEmptySpans(last); }\n\n var newMarkers = [first];\n if (!sameLine) {\n // Fill gap with whole-line-spans\n var gap = change.text.length - 2, gapMarkers;\n if (gap > 0 && first)\n { for (var i$2 = 0; i$2 < first.length; ++i$2)\n { if (first[i$2].to == null)\n { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }\n for (var i$3 = 0; i$3 < gap; ++i$3)\n { newMarkers.push(gapMarkers); }\n newMarkers.push(last);\n }\n return newMarkers\n }\n\n // Remove spans that are empty and don't have a clearWhenEmpty\n // option of false.\n function clearEmptySpans(spans) {\n for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)\n { spans.splice(i--, 1); }\n }\n if (!spans.length) { return null }\n return spans\n }\n\n // Used to 'clip' out readOnly ranges when making a change.\n function removeReadOnlyRanges(doc, from, to) {\n var markers = null;\n doc.iter(from.line, to.line + 1, function (line) {\n if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {\n var mark = line.markedSpans[i].marker;\n if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))\n { (markers || (markers = [])).push(mark); }\n } }\n });\n if (!markers) { return null }\n var parts = [{from: from, to: to}];\n for (var i = 0; i < markers.length; ++i) {\n var mk = markers[i], m = mk.find(0);\n for (var j = 0; j < parts.length; ++j) {\n var p = parts[j];\n if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) { continue }\n var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to);\n if (dfrom < 0 || !mk.inclusiveLeft && !dfrom)\n { newParts.push({from: p.from, to: m.from}); }\n if (dto > 0 || !mk.inclusiveRight && !dto)\n { newParts.push({from: m.to, to: p.to}); }\n parts.splice.apply(parts, newParts);\n j += newParts.length - 3;\n }\n }\n return parts\n }\n\n // Connect or disconnect spans from a line.\n function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }\n function attachMarkedSpans(line, spans) {\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.attachLine(line); }\n line.markedSpans = spans;\n }\n\n // Helpers used when computing which overlapping collapsed span\n // counts as the larger one.\n function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0 }\n function extraRight(marker) { return marker.inclusiveRight ? 1 : 0 }\n\n // Returns a number indicating which of two overlapping collapsed\n // spans is larger (and thus includes the other). Falls back to\n // comparing ids when the spans cover exactly the same range.\n function compareCollapsedMarkers(a, b) {\n var lenDiff = a.lines.length - b.lines.length;\n if (lenDiff != 0) { return lenDiff }\n var aPos = a.find(), bPos = b.find();\n var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);\n if (fromCmp) { return -fromCmp }\n var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b);\n if (toCmp) { return toCmp }\n return b.id - a.id\n }\n\n // Find out whether a line ends or starts in a collapsed span. If\n // so, return the marker for that span.\n function collapsedSpanAtSide(line, start) {\n var sps = sawCollapsedSpans && line.markedSpans, found;\n if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {\n sp = sps[i];\n if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&\n (!found || compareCollapsedMarkers(found, sp.marker) < 0))\n { found = sp.marker; }\n } }\n return found\n }\n function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true) }\n function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false) }\n\n function collapsedSpanAround(line, ch) {\n var sps = sawCollapsedSpans && line.markedSpans, found;\n if (sps) { for (var i = 0; i < sps.length; ++i) {\n var sp = sps[i];\n if (sp.marker.collapsed && (sp.from == null || sp.from < ch) && (sp.to == null || sp.to > ch) &&\n (!found || compareCollapsedMarkers(found, sp.marker) < 0)) { found = sp.marker; }\n } }\n return found\n }\n\n // Test whether there exists a collapsed span that partially\n // overlaps (covers the start or end, but not both) of a new span.\n // Such overlap is not allowed.\n function conflictingCollapsedRange(doc, lineNo, from, to, marker) {\n var line = getLine(doc, lineNo);\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) { for (var i = 0; i < sps.length; ++i) {\n var sp = sps[i];\n if (!sp.marker.collapsed) { continue }\n var found = sp.marker.find(0);\n var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);\n var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);\n if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }\n if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||\n fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))\n { return true }\n } }\n }\n\n // A visual line is a line as drawn on the screen. Folding, for\n // example, can cause multiple logical lines to appear on the same\n // visual line. This finds the start of the visual line that the\n // given line is part of (usually that is the line itself).\n function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n }\n\n function visualLineEnd(line) {\n var merged;\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return line\n }\n\n // Returns an array of logical lines that continue the visual line\n // started by the argument, or undefined if there are no such lines.\n function visualLineContinued(line) {\n var merged, lines;\n while (merged = collapsedSpanAtEnd(line)) {\n line = merged.find(1, true).line\n ;(lines || (lines = [])).push(line);\n }\n return lines\n }\n\n // Get the line number of the start of the visual line that the\n // given line number is part of.\n function visualLineNo(doc, lineN) {\n var line = getLine(doc, lineN), vis = visualLine(line);\n if (line == vis) { return lineN }\n return lineNo(vis)\n }\n\n // Get the line number of the start of the next visual line after\n // the given line.\n function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }\n\n // Compute whether a line is hidden. Lines count as hidden when they\n // are part of a visual line that starts with another line, or when\n // they are entirely covered by collapsed, non-widget span.\n function lineIsHidden(doc, line) {\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {\n sp = sps[i];\n if (!sp.marker.collapsed) { continue }\n if (sp.from == null) { return true }\n if (sp.marker.widgetNode) { continue }\n if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))\n { return true }\n } }\n }\n function lineIsHiddenInner(doc, line, span) {\n if (span.to == null) {\n var end = span.marker.find(1, true);\n return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker))\n }\n if (span.marker.inclusiveRight && span.to == line.text.length)\n { return true }\n for (var sp = (void 0), i = 0; i < line.markedSpans.length; ++i) {\n sp = line.markedSpans[i];\n if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&\n (sp.to == null || sp.to != span.from) &&\n (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&\n lineIsHiddenInner(doc, line, sp)) { return true }\n }\n }\n\n // Find the height above the given line.\n function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }\n\n // Compute the character length of a line, taking into account\n // collapsed ranges (see markText) that might hide parts, and join\n // other lines onto it.\n function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n }\n\n // Find the longest line in the document.\n function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function (line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n }\n\n // LINE DATA STRUCTURE\n\n // Line objects. These hold state related to a line, including\n // highlighting info (the styles array).\n var Line = function(text, markedSpans, estimateHeight) {\n this.text = text;\n attachMarkedSpans(this, markedSpans);\n this.height = estimateHeight ? estimateHeight(this) : 1;\n };\n\n Line.prototype.lineNo = function () { return lineNo(this) };\n eventMixin(Line);\n\n // Change the content (text, markers) of a line. Automatically\n // invalidates cached information and tries to re-estimate the\n // line's height.\n function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text;\n if (line.stateAfter) { line.stateAfter = null; }\n if (line.styles) { line.styles = null; }\n if (line.order != null) { line.order = null; }\n detachMarkedSpans(line);\n attachMarkedSpans(line, markedSpans);\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\n if (estHeight != line.height) { updateLineHeight(line, estHeight); }\n }\n\n // Detach a line from the document tree and its markers.\n function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }\n\n // Convert a style as returned by a mode (either null, or a string\n // containing one or more styles) to a CSS style. This is cached,\n // and also looks for line-wide styles.\n var styleToClassCache = {}, styleToClassCacheWithMode = {};\n function interpretTokenStyle(style, options) {\n if (!style || /^\\s*$/.test(style)) { return null }\n var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache;\n return cache[style] ||\n (cache[style] = style.replace(/\\S+/g, \"cm-$&\"))\n }\n\n // Render the DOM representation of the text of a line. Also builds\n // up a 'line map', which points at the DOM nodes that represent\n // specific stretches of text, and is used by the measuring code.\n // The returned object contains the DOM node, this map, and\n // information about line-wide styles that were set by the mode.\n function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }\n\n function defaultSpecialCharPlaceholder(ch) {\n var token = elt(\"span\", \"\\u2022\", \"cm-invalidchar\");\n token.title = \"\\\\u\" + ch.charCodeAt(0).toString(16);\n token.setAttribute(\"aria-label\", token.title);\n return token\n }\n\n // Build up the DOM representation for a single token, and add it to\n // the line map. Takes care to render special characters separately.\n function buildToken(builder, text, style, startStyle, endStyle, css, attributes) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css || attributes) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (attributes) {\n for (var attr in attributes) { if (attributes.hasOwnProperty(attr) && attr != \"style\" && attr != \"class\")\n { token.setAttribute(attr, attributes[attr]); } }\n }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n }\n\n // Change some spaces to NBSP to prevent the browser from collapsing\n // trailing spaces at the end of a line when rendering text (issue #1362).\n function splitSpaces(text, trailingBefore) {\n if (text.length > 1 && !/ /.test(text)) { return text }\n var spaceBefore = trailingBefore, result = \"\";\n for (var i = 0; i < text.length; i++) {\n var ch = text.charAt(i);\n if (ch == \" \" && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32))\n { ch = \"\\u00a0\"; }\n result += ch;\n spaceBefore = ch == \" \";\n }\n return result\n }\n\n // Work around nonsense dimensions being reported for stretches of\n // right-to-left text.\n function buildTokenBadBidi(inner, order) {\n return function (builder, text, style, startStyle, endStyle, css, attributes) {\n style = style ? style + \" cm-force-border\" : \"cm-force-border\";\n var start = builder.pos, end = start + text.length;\n for (;;) {\n // Find the part that overlaps with the start of this text\n var part = (void 0);\n for (var i = 0; i < order.length; i++) {\n part = order[i];\n if (part.to > start && part.from <= start) { break }\n }\n if (part.to >= end) { return inner(builder, text, style, startStyle, endStyle, css, attributes) }\n inner(builder, text.slice(0, part.to - start), style, startStyle, null, css, attributes);\n startStyle = null;\n text = text.slice(part.to - start);\n start = part.to;\n }\n }\n }\n\n function buildCollapsedSpan(builder, size, marker, ignoreWidget) {\n var widget = !ignoreWidget && marker.widgetNode;\n if (widget) { builder.map.push(builder.pos, builder.pos + size, widget); }\n if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {\n if (!widget)\n { widget = builder.content.appendChild(document.createElement(\"span\")); }\n widget.setAttribute(\"cm-marker\", marker.id);\n }\n if (widget) {\n builder.cm.display.input.setUneditable(widget);\n builder.content.appendChild(widget);\n }\n builder.pos += size;\n builder.trailingSpace = false;\n }\n\n // Outputs a number of spans to make up a line, taking highlighting\n // and marked text into account.\n function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = css = \"\";\n attributes = null;\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n // support for the old title property\n // https://github.com/codemirror/CodeMirror/pull/5673\n if (m.title) { (attributes || (attributes = {})).title = m.title; }\n if (m.attributes) {\n for (var attr in m.attributes)\n { (attributes || (attributes = {}))[attr] = m.attributes[attr]; }\n }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", css, attributes);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }\n\n\n // These objects are used to represent the visible (currently drawn)\n // part of the document. A LineView may correspond to multiple\n // logical lines, if those are connected by collapsed ranges.\n function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }\n\n // Create a range of LineView objects for the given lines.\n function buildViewArray(cm, from, to) {\n var array = [], nextPos;\n for (var pos = from; pos < to; pos = nextPos) {\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n nextPos = pos + view.size;\n array.push(view);\n }\n return array\n }\n\n var operationGroup = null;\n\n function pushOperation(op) {\n if (operationGroup) {\n operationGroup.ops.push(op);\n } else {\n op.ownsGroup = operationGroup = {\n ops: [op],\n delayedCallbacks: []\n };\n }\n }\n\n function fireCallbacksForOps(group) {\n // Calls delayed callbacks and cursorActivity handlers until no\n // new ones appear\n var callbacks = group.delayedCallbacks, i = 0;\n do {\n for (; i < callbacks.length; i++)\n { callbacks[i].call(null); }\n for (var j = 0; j < group.ops.length; j++) {\n var op = group.ops[j];\n if (op.cursorActivityHandlers)\n { while (op.cursorActivityCalled < op.cursorActivityHandlers.length)\n { op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm); } }\n }\n } while (i < callbacks.length)\n }\n\n function finishOperation(op, endCb) {\n var group = op.ownsGroup;\n if (!group) { return }\n\n try { fireCallbacksForOps(group); }\n finally {\n operationGroup = null;\n endCb(group);\n }\n }\n\n var orphanDelayedCallbacks = null;\n\n // Often, we want to signal events at a point where we are in the\n // middle of some work, but don't want the handler to start calling\n // other methods on the editor, which might be in an inconsistent\n // state or simply not expect any other events to happen.\n // signalLater looks whether there are any handlers, and schedules\n // them to be executed when the last operation ends, or, if no\n // operation is active, when a timeout fires.\n function signalLater(emitter, type /*, values...*/) {\n var arr = getHandlers(emitter, type);\n if (!arr.length) { return }\n var args = Array.prototype.slice.call(arguments, 2), list;\n if (operationGroup) {\n list = operationGroup.delayedCallbacks;\n } else if (orphanDelayedCallbacks) {\n list = orphanDelayedCallbacks;\n } else {\n list = orphanDelayedCallbacks = [];\n setTimeout(fireOrphanDelayed, 0);\n }\n var loop = function ( i ) {\n list.push(function () { return arr[i].apply(null, args); });\n };\n\n for (var i = 0; i < arr.length; ++i)\n loop( i );\n }\n\n function fireOrphanDelayed() {\n var delayed = orphanDelayedCallbacks;\n orphanDelayedCallbacks = null;\n for (var i = 0; i < delayed.length; ++i) { delayed[i](); }\n }\n\n // When an aspect of a line changes, a string is added to\n // lineView.changes. This updates the relevant part of the line's\n // DOM structure.\n function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n }\n\n // Lines with gutter elements, widgets or a background class need to\n // be wrapped, and have the extra elements added to the wrapper div\n function ensureLineWrapped(lineView) {\n if (lineView.node == lineView.text) {\n lineView.node = elt(\"div\", null, null, \"position: relative\");\n if (lineView.text.parentNode)\n { lineView.text.parentNode.replaceChild(lineView.node, lineView.text); }\n lineView.node.appendChild(lineView.text);\n if (ie && ie_version < 8) { lineView.node.style.zIndex = 2; }\n }\n return lineView.node\n }\n\n function updateLineBackground(cm, lineView) {\n var cls = lineView.bgClass ? lineView.bgClass + \" \" + (lineView.line.bgClass || \"\") : lineView.line.bgClass;\n if (cls) { cls += \" CodeMirror-linebackground\"; }\n if (lineView.background) {\n if (cls) { lineView.background.className = cls; }\n else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null; }\n } else if (cls) {\n var wrap = ensureLineWrapped(lineView);\n lineView.background = wrap.insertBefore(elt(\"div\", null, cls), wrap.firstChild);\n cm.display.input.setUneditable(lineView.background);\n }\n }\n\n // Wrapper around buildLineContent which will reuse the structure\n // in display.externalMeasured when possible.\n function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }\n\n // Redraw the line's text. Interacts with the background and text\n // classes because the mode may output tokens that influence these\n // classes.\n function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }\n\n function updateLineClasses(cm, lineView) {\n updateLineBackground(cm, lineView);\n if (lineView.line.wrapClass)\n { ensureLineWrapped(lineView).className = lineView.line.wrapClass; }\n else if (lineView.node != lineView.text)\n { lineView.node.className = \"\"; }\n var textClass = lineView.textClass ? lineView.textClass + \" \" + (lineView.line.textClass || \"\") : lineView.line.textClass;\n lineView.text.className = textClass || \"\";\n }\n\n function updateLineGutter(cm, lineView, lineN, dims) {\n if (lineView.gutter) {\n lineView.node.removeChild(lineView.gutter);\n lineView.gutter = null;\n }\n if (lineView.gutterBackground) {\n lineView.node.removeChild(lineView.gutterBackground);\n lineView.gutterBackground = null;\n }\n if (lineView.line.gutterClass) {\n var wrap = ensureLineWrapped(lineView);\n lineView.gutterBackground = elt(\"div\", null, \"CodeMirror-gutter-background \" + lineView.line.gutterClass,\n (\"left: \" + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + \"px; width: \" + (dims.gutterTotalWidth) + \"px\"));\n cm.display.input.setUneditable(lineView.gutterBackground);\n wrap.insertBefore(lineView.gutterBackground, lineView.text);\n }\n var markers = lineView.line.gutterMarkers;\n if (cm.options.lineNumbers || markers) {\n var wrap$1 = ensureLineWrapped(lineView);\n var gutterWrap = lineView.gutter = elt(\"div\", null, \"CodeMirror-gutter-wrapper\", (\"left: \" + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + \"px\"));\n cm.display.input.setUneditable(gutterWrap);\n wrap$1.insertBefore(gutterWrap, lineView.text);\n if (lineView.line.gutterClass)\n { gutterWrap.className += \" \" + lineView.line.gutterClass; }\n if (cm.options.lineNumbers && (!markers || !markers[\"CodeMirror-linenumbers\"]))\n { lineView.lineNumber = gutterWrap.appendChild(\n elt(\"div\", lineNumberFor(cm.options, lineN),\n \"CodeMirror-linenumber CodeMirror-gutter-elt\",\n (\"left: \" + (dims.gutterLeft[\"CodeMirror-linenumbers\"]) + \"px; width: \" + (cm.display.lineNumInnerWidth) + \"px\"))); }\n if (markers) { for (var k = 0; k < cm.display.gutterSpecs.length; ++k) {\n var id = cm.display.gutterSpecs[k].className, found = markers.hasOwnProperty(id) && markers[id];\n if (found)\n { gutterWrap.appendChild(elt(\"div\", [found], \"CodeMirror-gutter-elt\",\n (\"left: \" + (dims.gutterLeft[id]) + \"px; width: \" + (dims.gutterWidth[id]) + \"px\"))); }\n } }\n }\n }\n\n function updateLineWidgets(cm, lineView, dims) {\n if (lineView.alignable) { lineView.alignable = null; }\n var isWidget = classTest(\"CodeMirror-linewidget\");\n for (var node = lineView.node.firstChild, next = (void 0); node; node = next) {\n next = node.nextSibling;\n if (isWidget.test(node.className)) { lineView.node.removeChild(node); }\n }\n insertLineWidgets(cm, lineView, dims);\n }\n\n // Build a line's DOM representation from scratch\n function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n }\n\n // A lineView may contain multiple logical lines (when merged by\n // collapsed spans). The widgets for all of them need to be drawn.\n function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n }\n\n function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {\n if (!line.widgets) { return }\n var wrap = ensureLineWrapped(lineView);\n for (var i = 0, ws = line.widgets; i < ws.length; ++i) {\n var widget = ws[i], node = elt(\"div\", [widget.node], \"CodeMirror-linewidget\" + (widget.className ? \" \" + widget.className : \"\"));\n if (!widget.handleMouseEvents) { node.setAttribute(\"cm-ignore-events\", \"true\"); }\n positionLineWidget(widget, node, lineView, dims);\n cm.display.input.setUneditable(node);\n if (allowAbove && widget.above)\n { wrap.insertBefore(node, lineView.gutter || lineView.text); }\n else\n { wrap.appendChild(node); }\n signalLater(widget, \"redraw\");\n }\n }\n\n function positionLineWidget(widget, node, lineView, dims) {\n if (widget.noHScroll) {\n (lineView.alignable || (lineView.alignable = [])).push(node);\n var width = dims.wrapperWidth;\n node.style.left = dims.fixedPos + \"px\";\n if (!widget.coverGutter) {\n width -= dims.gutterTotalWidth;\n node.style.paddingLeft = dims.gutterTotalWidth + \"px\";\n }\n node.style.width = width + \"px\";\n }\n if (widget.coverGutter) {\n node.style.zIndex = 5;\n node.style.position = \"relative\";\n if (!widget.noHScroll) { node.style.marginLeft = -dims.gutterTotalWidth + \"px\"; }\n }\n }\n\n function widgetHeight(widget) {\n if (widget.height != null) { return widget.height }\n var cm = widget.doc.cm;\n if (!cm) { return 0 }\n if (!contains(document.body, widget.node)) {\n var parentStyle = \"position: relative;\";\n if (widget.coverGutter)\n { parentStyle += \"margin-left: -\" + cm.display.gutters.offsetWidth + \"px;\"; }\n if (widget.noHScroll)\n { parentStyle += \"width: \" + cm.display.wrapper.clientWidth + \"px;\"; }\n removeChildrenAndAdd(cm.display.measure, elt(\"div\", [widget.node], null, parentStyle));\n }\n return widget.height = widget.node.parentNode.offsetHeight\n }\n\n // Return true when the given mouse event happened in a widget\n function eventInWidget(display, e) {\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n (n.parentNode == display.sizer && n != display.mover))\n { return true }\n }\n }\n\n // POSITION MEASUREMENT\n\n function paddingTop(display) {return display.lineSpace.offsetTop}\n function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight}\n function paddingH(display) {\n if (display.cachedPaddingH) { return display.cachedPaddingH }\n var e = removeChildrenAndAdd(display.measure, elt(\"pre\", \"x\", \"CodeMirror-line-like\"));\n var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle;\n var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)};\n if (!isNaN(data.left) && !isNaN(data.right)) { display.cachedPaddingH = data; }\n return data\n }\n\n function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth }\n function displayWidth(cm) {\n return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth\n }\n function displayHeight(cm) {\n return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight\n }\n\n // Ensure the lineView.wrapping.heights array is populated. This is\n // an array of bottom offsets for the lines that make up a drawn\n // line. When lineWrapping is on, there might be more than one\n // height.\n function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping;\n var curWidth = wrapping && displayWidth(cm);\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = [];\n if (wrapping) {\n lineView.measure.width = curWidth;\n var rects = lineView.text.firstChild.getClientRects();\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i], next = rects[i + 1];\n if (Math.abs(cur.bottom - next.bottom) > 2)\n { heights.push((cur.bottom + next.top) / 2 - rect.top); }\n }\n }\n heights.push(rect.bottom - rect.top);\n }\n }\n\n // Find a line map (mapping character offsets to text nodes) and a\n // measurement cache for the given line number. (A line view might\n // contain multiple lines when collapsed ranges are present.)\n function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n { return {map: lineView.measure.map, cache: lineView.measure.cache} }\n for (var i = 0; i < lineView.rest.length; i++)\n { if (lineView.rest[i] == line)\n { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\n { if (lineNo(lineView.rest[i$1]) > lineN)\n { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }\n }\n\n // Render a line into the hidden node display.externalMeasured. Used\n // when measurement is needed for a line that's not in the viewport.\n function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n }\n\n // Get a {top, bottom, left, right} box (in line-local coordinates)\n // for a given character.\n function measureChar(cm, line, ch, bias) {\n return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias)\n }\n\n // Find a line view that corresponds to the given line number.\n function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n }\n\n // Measurement can be split in two steps, the set-up work that\n // applies to the whole line, and the measurement of the actual\n // character. Functions like coordsChar, that need to do a lot of\n // measurements in a row, can thus ensure that the set-up work is\n // only done once.\n function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text) {\n view = null;\n } else if (view && view.changes) {\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n cm.curOp.forceUpdate = true;\n }\n if (!view)\n { view = updateExternalMeasurement(cm, line); }\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n }\n }\n\n // Given a prepared measurement object, measures the position of an\n // actual character (or fetches it from the cache).\n function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) { ch = -1; }\n var key = ch + (bias || \"\"), found;\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key];\n } else {\n if (!prepared.rect)\n { prepared.rect = prepared.view.text.getBoundingClientRect(); }\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect);\n prepared.hasHeights = true;\n }\n found = measureCharInner(cm, prepared, ch, bias);\n if (!found.bogus) { prepared.cache[key] = found; }\n }\n return {left: found.left, right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom}\n }\n\n var nullRect = {left: 0, right: 0, top: 0, bottom: 0};\n\n function nodeAndOffsetInLineMap(map, ch, bias) {\n var node, start, end, collapse, mStart, mEnd;\n // First, search the line map for the text node corresponding to,\n // or closest to, the target character.\n for (var i = 0; i < map.length; i += 3) {\n mStart = map[i];\n mEnd = map[i + 1];\n if (ch < mStart) {\n start = 0; end = 1;\n collapse = \"left\";\n } else if (ch < mEnd) {\n start = ch - mStart;\n end = start + 1;\n } else if (i == map.length - 3 || ch == mEnd && map[i + 3] > ch) {\n end = mEnd - mStart;\n start = end - 1;\n if (ch >= mEnd) { collapse = \"right\"; }\n }\n if (start != null) {\n node = map[i + 2];\n if (mStart == mEnd && bias == (node.insertLeft ? \"left\" : \"right\"))\n { collapse = bias; }\n if (bias == \"left\" && start == 0)\n { while (i && map[i - 2] == map[i - 3] && map[i - 1].insertLeft) {\n node = map[(i -= 3) + 2];\n collapse = \"left\";\n } }\n if (bias == \"right\" && start == mEnd - mStart)\n { while (i < map.length - 3 && map[i + 3] == map[i + 4] && !map[i + 5].insertLeft) {\n node = map[(i += 3) + 2];\n collapse = \"right\";\n } }\n break\n }\n }\n return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd}\n }\n\n function getUsefulRect(rects, bias) {\n var rect = nullRect;\n if (bias == \"left\") { for (var i = 0; i < rects.length; i++) {\n if ((rect = rects[i]).left != rect.right) { break }\n } } else { for (var i$1 = rects.length - 1; i$1 >= 0; i$1--) {\n if ((rect = rects[i$1]).left != rect.right) { break }\n } }\n return rect\n }\n\n function measureCharInner(cm, prepared, ch, bias) {\n var place = nodeAndOffsetInLineMap(prepared.map, ch, bias);\n var node = place.node, start = place.start, end = place.end, collapse = place.collapse;\n\n var rect;\n if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.\n for (var i$1 = 0; i$1 < 4; i$1++) { // Retry a maximum of 4 times when nonsense rectangles are returned\n while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) { --start; }\n while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) { ++end; }\n if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart)\n { rect = node.parentNode.getBoundingClientRect(); }\n else\n { rect = getUsefulRect(range(node, start, end).getClientRects(), bias); }\n if (rect.left || rect.right || start == 0) { break }\n end = start;\n start = start - 1;\n collapse = \"right\";\n }\n if (ie && ie_version < 11) { rect = maybeUpdateRectForZooming(cm.display.measure, rect); }\n } else { // If it is a widget, simply get the box for the whole widget.\n if (start > 0) { collapse = bias = \"right\"; }\n var rects;\n if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1)\n { rect = rects[bias == \"right\" ? rects.length - 1 : 0]; }\n else\n { rect = node.getBoundingClientRect(); }\n }\n if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {\n var rSpan = node.parentNode.getClientRects()[0];\n if (rSpan)\n { rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom}; }\n else\n { rect = nullRect; }\n }\n\n var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top;\n var mid = (rtop + rbot) / 2;\n var heights = prepared.view.measure.heights;\n var i = 0;\n for (; i < heights.length - 1; i++)\n { if (mid < heights[i]) { break } }\n var top = i ? heights[i - 1] : 0, bot = heights[i];\n var result = {left: (collapse == \"right\" ? rect.right : rect.left) - prepared.rect.left,\n right: (collapse == \"left\" ? rect.left : rect.right) - prepared.rect.left,\n top: top, bottom: bot};\n if (!rect.left && !rect.right) { result.bogus = true; }\n if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot; }\n\n return result\n }\n\n // Work around problem with bounding client rects on ranges being\n // returned incorrectly when zoomed on IE10 and below.\n function maybeUpdateRectForZooming(measure, rect) {\n if (!window.screen || screen.logicalXDPI == null ||\n screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure))\n { return rect }\n var scaleX = screen.logicalXDPI / screen.deviceXDPI;\n var scaleY = screen.logicalYDPI / screen.deviceYDPI;\n return {left: rect.left * scaleX, right: rect.right * scaleX,\n top: rect.top * scaleY, bottom: rect.bottom * scaleY}\n }\n\n function clearLineMeasurementCacheFor(lineView) {\n if (lineView.measure) {\n lineView.measure.cache = {};\n lineView.measure.heights = null;\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { lineView.measure.caches[i] = {}; } }\n }\n }\n\n function clearLineMeasurementCache(cm) {\n cm.display.externalMeasure = null;\n removeChildren(cm.display.lineMeasure);\n for (var i = 0; i < cm.display.view.length; i++)\n { clearLineMeasurementCacheFor(cm.display.view[i]); }\n }\n\n function clearCaches(cm) {\n clearLineMeasurementCache(cm);\n cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null;\n if (!cm.options.lineWrapping) { cm.display.maxLineChanged = true; }\n cm.display.lineNumChars = null;\n }\n\n function pageScrollX() {\n // Work around https://bugs.chromium.org/p/chromium/issues/detail?id=489206\n // which causes page_Offset and bounding client rects to use\n // different reference viewports and invalidate our calculations.\n if (chrome && android) { return -(document.body.getBoundingClientRect().left - parseInt(getComputedStyle(document.body).marginLeft)) }\n return window.pageXOffset || (document.documentElement || document.body).scrollLeft\n }\n function pageScrollY() {\n if (chrome && android) { return -(document.body.getBoundingClientRect().top - parseInt(getComputedStyle(document.body).marginTop)) }\n return window.pageYOffset || (document.documentElement || document.body).scrollTop\n }\n\n function widgetTopHeight(lineObj) {\n var height = 0;\n if (lineObj.widgets) { for (var i = 0; i < lineObj.widgets.length; ++i) { if (lineObj.widgets[i].above)\n { height += widgetHeight(lineObj.widgets[i]); } } }\n return height\n }\n\n // Converts a {top, bottom, left, right} box from line-local\n // coordinates into another coordinate system. Context may be one of\n // \"line\", \"div\" (display.lineDiv), \"local\"./null (editor), \"window\",\n // or \"page\".\n function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {\n if (!includeWidgets) {\n var height = widgetTopHeight(lineObj);\n rect.top += height; rect.bottom += height;\n }\n if (context == \"line\") { return rect }\n if (!context) { context = \"local\"; }\n var yOff = heightAtLine(lineObj);\n if (context == \"local\") { yOff += paddingTop(cm.display); }\n else { yOff -= cm.display.viewOffset; }\n if (context == \"page\" || context == \"window\") {\n var lOff = cm.display.lineSpace.getBoundingClientRect();\n yOff += lOff.top + (context == \"window\" ? 0 : pageScrollY());\n var xOff = lOff.left + (context == \"window\" ? 0 : pageScrollX());\n rect.left += xOff; rect.right += xOff;\n }\n rect.top += yOff; rect.bottom += yOff;\n return rect\n }\n\n // Coverts a box from \"div\" coords to another coordinate system.\n // Context may be \"window\", \"page\", \"div\", or \"local\"./null.\n function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") { return coords }\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}\n }\n\n function charCoords(cm, pos, context, lineObj, bias) {\n if (!lineObj) { lineObj = getLine(cm.doc, pos.line); }\n return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context)\n }\n\n // Returns a box for a given cursor position, which may have an\n // 'other' property containing the position of the secondary cursor\n // on a bidi boundary.\n // A cursor Pos(line, char, \"before\") is on the same visual line as `char - 1`\n // and after `char - 1` in writing order of `char - 1`\n // A cursor Pos(line, char, \"after\") is on the same visual line as `char`\n // and before `char` in writing order of `char`\n // Examples (upper-case letters are RTL, lower-case are LTR):\n // Pos(0, 1, ...)\n // before after\n // ab a|b a|b\n // aB a|B aB|\n // Ab |Ab A|b\n // AB B|A B|A\n // Every position after the last character on a line is considered to stick\n // to the last character on the line.\n function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }\n\n // Used to cheaply estimate the coordinates for a position. Used for\n // intermediate scroll updates.\n function estimateCoords(cm, pos) {\n var left = 0;\n pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height}\n }\n\n // Positions returned by coordsChar contain some extra information.\n // xRel is the relative x position of the input coordinates compared\n // to the found position (so xRel > 0 means the coordinates are to\n // the right of the character position, for example). When outside\n // is true, that means the coordinates lie outside the line's\n // vertical range.\n function PosWithInfo(line, ch, sticky, outside, xRel) {\n var pos = Pos(line, ch, sticky);\n pos.xRel = xRel;\n if (outside) { pos.outside = outside; }\n return pos\n }\n\n // Compute the character position closest to the given coordinates.\n // Input must be lineSpace-local (\"div\" coordinate system).\n function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }\n\n function wrappedLineExtent(cm, lineObj, preparedMeasure, y) {\n y -= widgetTopHeight(lineObj);\n var end = lineObj.text.length;\n var begin = findFirst(function (ch) { return measureCharPrepared(cm, preparedMeasure, ch - 1).bottom <= y; }, end, 0);\n end = findFirst(function (ch) { return measureCharPrepared(cm, preparedMeasure, ch).top > y; }, begin, end);\n return {begin: begin, end: end}\n }\n\n function wrappedLineExtentChar(cm, lineObj, preparedMeasure, target) {\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n var targetTop = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, target), \"line\").top;\n return wrappedLineExtent(cm, lineObj, preparedMeasure, targetTop)\n }\n\n // Returns true if the given side of a box is after the given\n // coordinates, in top-to-bottom, left-to-right order.\n function boxIsAfter(box, x, y, left) {\n return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x\n }\n\n function coordsCharInner(cm, lineObj, lineNo, x, y) {\n // Move y into line-local coordinate space\n y -= heightAtLine(lineObj);\n var preparedMeasure = prepareMeasureForLine(cm, lineObj);\n // When directly calling `measureCharPrepared`, we have to adjust\n // for the widgets at this line.\n var widgetHeight = widgetTopHeight(lineObj);\n var begin = 0, end = lineObj.text.length, ltr = true;\n\n var order = getOrder(lineObj, cm.doc.direction);\n // If the line isn't plain left-to-right text, first figure out\n // which bidi section the coordinates fall into.\n if (order) {\n var part = (cm.options.lineWrapping ? coordsBidiPartWrapped : coordsBidiPart)\n (cm, lineObj, lineNo, preparedMeasure, order, x, y);\n ltr = part.level != 1;\n // The awkward -1 offsets are needed because findFirst (called\n // on these below) will treat its first bound as inclusive,\n // second as exclusive, but we want to actually address the\n // characters in the part's range\n begin = ltr ? part.from : part.to - 1;\n end = ltr ? part.to : part.from - 1;\n }\n\n // A binary search to find the first character whose bounding box\n // starts after the coordinates. If we run across any whose box wrap\n // the coordinates, store that.\n var chAround = null, boxAround = null;\n var ch = findFirst(function (ch) {\n var box = measureCharPrepared(cm, preparedMeasure, ch);\n box.top += widgetHeight; box.bottom += widgetHeight;\n if (!boxIsAfter(box, x, y, false)) { return false }\n if (box.top <= y && box.left <= x) {\n chAround = ch;\n boxAround = box;\n }\n return true\n }, begin, end);\n\n var baseX, sticky, outside = false;\n // If a box around the coordinates was found, use that\n if (boxAround) {\n // Distinguish coordinates nearer to the left or right side of the box\n var atLeft = x - boxAround.left < boxAround.right - x, atStart = atLeft == ltr;\n ch = chAround + (atStart ? 0 : 1);\n sticky = atStart ? \"after\" : \"before\";\n baseX = atLeft ? boxAround.left : boxAround.right;\n } else {\n // (Adjust for extended bound, if necessary.)\n if (!ltr && (ch == end || ch == begin)) { ch++; }\n // To determine which side to associate with, get the box to the\n // left of the character and compare it's vertical position to the\n // coordinates\n sticky = ch == 0 ? \"after\" : ch == lineObj.text.length ? \"before\" :\n (measureCharPrepared(cm, preparedMeasure, ch - (ltr ? 1 : 0)).bottom + widgetHeight <= y) == ltr ?\n \"after\" : \"before\";\n // Now get accurate coordinates for this place, in order to get a\n // base X position\n var coords = cursorCoords(cm, Pos(lineNo, ch, sticky), \"line\", lineObj, preparedMeasure);\n baseX = coords.left;\n outside = y < coords.top ? -1 : y >= coords.bottom ? 1 : 0;\n }\n\n ch = skipExtendingChars(lineObj.text, ch, 1);\n return PosWithInfo(lineNo, ch, sticky, outside, x - baseX)\n }\n\n function coordsBidiPart(cm, lineObj, lineNo, preparedMeasure, order, x, y) {\n // Bidi parts are sorted left-to-right, and in a non-line-wrapping\n // situation, we can take this ordering to correspond to the visual\n // ordering. This finds the first part whose end is after the given\n // coordinates.\n var index = findFirst(function (i) {\n var part = order[i], ltr = part.level != 1;\n return boxIsAfter(cursorCoords(cm, Pos(lineNo, ltr ? part.to : part.from, ltr ? \"before\" : \"after\"),\n \"line\", lineObj, preparedMeasure), x, y, true)\n }, 0, order.length - 1);\n var part = order[index];\n // If this isn't the first part, the part's start is also after\n // the coordinates, and the coordinates aren't on the same line as\n // that start, move one part back.\n if (index > 0) {\n var ltr = part.level != 1;\n var start = cursorCoords(cm, Pos(lineNo, ltr ? part.from : part.to, ltr ? \"after\" : \"before\"),\n \"line\", lineObj, preparedMeasure);\n if (boxIsAfter(start, x, y, true) && start.top > y)\n { part = order[index - 1]; }\n }\n return part\n }\n\n function coordsBidiPartWrapped(cm, lineObj, _lineNo, preparedMeasure, order, x, y) {\n // In a wrapped line, rtl text on wrapping boundaries can do things\n // that don't correspond to the ordering in our `order` array at\n // all, so a binary search doesn't work, and we want to return a\n // part that only spans one line so that the binary search in\n // coordsCharInner is safe. As such, we first find the extent of the\n // wrapped line, and then do a flat search in which we discard any\n // spans that aren't on the line.\n var ref = wrappedLineExtent(cm, lineObj, preparedMeasure, y);\n var begin = ref.begin;\n var end = ref.end;\n if (/\\s/.test(lineObj.text.charAt(end - 1))) { end--; }\n var part = null, closestDist = null;\n for (var i = 0; i < order.length; i++) {\n var p = order[i];\n if (p.from >= end || p.to <= begin) { continue }\n var ltr = p.level != 1;\n var endX = measureCharPrepared(cm, preparedMeasure, ltr ? Math.min(end, p.to) - 1 : Math.max(begin, p.from)).right;\n // Weigh against spans ending before this, so that they are only\n // picked if nothing ends after\n var dist = endX < x ? x - endX + 1e9 : endX - x;\n if (!part || closestDist > dist) {\n part = p;\n closestDist = dist;\n }\n }\n if (!part) { part = order[order.length - 1]; }\n // Clip the part to the wrapped line.\n if (part.from < begin) { part = {from: begin, to: part.to, level: part.level}; }\n if (part.to > end) { part = {from: part.from, to: end, level: part.level}; }\n return part\n }\n\n var measureText;\n // Compute the default text height.\n function textHeight(display) {\n if (display.cachedTextHeight != null) { return display.cachedTextHeight }\n if (measureText == null) {\n measureText = elt(\"pre\", null, \"CodeMirror-line-like\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) { display.cachedTextHeight = height; }\n removeChildren(display.measure);\n return height || 1\n }\n\n // Compute the default character width.\n function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor], \"CodeMirror-line-like\");\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n }\n\n // Do a bulk-read of the DOM positions and sizes needed to draw the\n // view, so that we don't interleave reading and writing to the DOM.\n function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n var id = cm.display.gutterSpecs[i].className;\n left[id] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[id] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth}\n }\n\n // Computes display.scroller.scrollLeft + display.gutters.offsetWidth,\n // but using getBoundingClientRect to get a sub-pixel-accurate\n // result.\n function compensateForHScroll(display) {\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left\n }\n\n // Returns a function that estimates the height of a line, to use as\n // first approximation until the line becomes visible (and is thus\n // properly measurable).\n function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n }\n\n function estimateLineHeights(cm) {\n var doc = cm.doc, est = estimateHeight(cm);\n doc.iter(function (line) {\n var estHeight = est(line);\n if (estHeight != line.height) { updateLineHeight(line, estHeight); }\n });\n }\n\n // Given a mouse event, find the corresponding position. If liberal\n // is false, it checks whether a gutter or scrollbar was clicked,\n // and returns null if it was. forRect is used by rectangular\n // selections, and tries to estimate a character position even for\n // coordinates beyond the right of the text.\n function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e$1) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }\n\n // Find the view element corresponding to a given line. Return null\n // when the line isn't visible.\n function findViewIndex(cm, n) {\n if (n >= cm.display.viewTo) { return null }\n n -= cm.display.viewFrom;\n if (n < 0) { return null }\n var view = cm.display.view;\n for (var i = 0; i < view.length; i++) {\n n -= view[i].size;\n if (n < 0) { return i }\n }\n }\n\n // Updates the display.view data structure for a given change to the\n // document. From and to are in pre-change coordinates. Lendiff is\n // the amount of lines added or subtracted by the change. This is\n // used for changes that span multiple lines, or change the way\n // lines are divided into visual lines. regLineChange (below)\n // registers single-line changes.\n function regChange(cm, from, to, lendiff) {\n if (from == null) { from = cm.doc.first; }\n if (to == null) { to = cm.doc.first + cm.doc.size; }\n if (!lendiff) { lendiff = 0; }\n\n var display = cm.display;\n if (lendiff && to < display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers > from))\n { display.updateLineNumbers = from; }\n\n cm.curOp.viewChanged = true;\n\n if (from >= display.viewTo) { // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n { resetView(cm); }\n } else if (to <= display.viewFrom) { // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm);\n } else {\n display.viewFrom += lendiff;\n display.viewTo += lendiff;\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n resetView(cm);\n } else if (from <= display.viewFrom) { // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cut) {\n display.view = display.view.slice(cut.index);\n display.viewFrom = cut.lineN;\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n } else if (to >= display.viewTo) { // Bottom overlap\n var cut$1 = viewCuttingPoint(cm, from, from, -1);\n if (cut$1) {\n display.view = display.view.slice(0, cut$1.index);\n display.viewTo = cut$1.lineN;\n } else {\n resetView(cm);\n }\n } else { // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1);\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index)\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n .concat(display.view.slice(cutBot.index));\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n }\n\n var ext = display.externalMeasured;\n if (ext) {\n if (to < ext.lineN)\n { ext.lineN += lendiff; }\n else if (from < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n }\n }\n\n // Register a change to a single line. Type must be one of \"text\",\n // \"gutter\", \"class\", \"widget\"\n function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n\n if (line < display.viewFrom || line >= display.viewTo) { return }\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) { return }\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) { arr.push(type); }\n }\n\n // Clear the view.\n function resetView(cm) {\n cm.display.viewFrom = cm.display.viewTo = cm.doc.first;\n cm.display.view = [];\n cm.display.viewOffset = 0;\n }\n\n function viewCuttingPoint(cm, oldN, newN, dir) {\n var index = findViewIndex(cm, oldN), diff, view = cm.display.view;\n if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size)\n { return {index: index, lineN: newN} }\n var n = cm.display.viewFrom;\n for (var i = 0; i < index; i++)\n { n += view[i].size; }\n if (n != oldN) {\n if (dir > 0) {\n if (index == view.length - 1) { return null }\n diff = (n + view[index].size) - oldN;\n index++;\n } else {\n diff = n - oldN;\n }\n oldN += diff; newN += diff;\n }\n while (visualLineNo(cm.doc, newN) != newN) {\n if (index == (dir < 0 ? 0 : view.length - 1)) { return null }\n newN += dir * view[index - (dir < 0 ? 1 : 0)].size;\n index += dir;\n }\n return {index: index, lineN: newN}\n }\n\n // Force the view to cover a given range, adding empty view element\n // or clipping off existing ones as needed.\n function adjustView(cm, from, to) {\n var display = cm.display, view = display.view;\n if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {\n display.view = buildViewArray(cm, from, to);\n display.viewFrom = from;\n } else {\n if (display.viewFrom > from)\n { display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view); }\n else if (display.viewFrom < from)\n { display.view = display.view.slice(findViewIndex(cm, from)); }\n display.viewFrom = from;\n if (display.viewTo < to)\n { display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)); }\n else if (display.viewTo > to)\n { display.view = display.view.slice(0, findViewIndex(cm, to)); }\n }\n display.viewTo = to;\n }\n\n // Count the number of lines in the view whose DOM representation is\n // out of date (or nonexistent).\n function countDirtyView(cm) {\n var view = cm.display.view, dirty = 0;\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }\n }\n return dirty\n }\n\n function updateSelection(cm) {\n cm.display.input.showSelection(cm.display.input.prepareSelection());\n }\n\n function prepareSelection(cm, primary) {\n if ( primary === void 0 ) primary = true;\n\n var doc = cm.doc, result = {};\n var curFragment = result.cursors = document.createDocumentFragment();\n var selFragment = result.selection = document.createDocumentFragment();\n\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n if (!primary && i == doc.sel.primIndex) { continue }\n var range = doc.sel.ranges[i];\n if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) { continue }\n var collapsed = range.empty();\n if (collapsed || cm.options.showCursorWhenSelecting)\n { drawSelectionCursor(cm, range.head, curFragment); }\n if (!collapsed)\n { drawSelectionRange(cm, range, selFragment); }\n }\n return result\n }\n\n // Draws a cursor for the given range\n function drawSelectionCursor(cm, head, output) {\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }\n\n function cmpCoords(a, b) { return a.top - b.top || a.left - b.left }\n\n // Draws the given range as a highlighted selection\n function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range.from(), sTo = range.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n }\n\n // Cursor-blinking\n function restartBlink(cm) {\n if (!cm.state.focused) { return }\n var display = cm.display;\n clearInterval(display.blinker);\n var on = true;\n display.cursorDiv.style.visibility = \"\";\n if (cm.options.cursorBlinkRate > 0)\n { display.blinker = setInterval(function () {\n if (!cm.hasFocus()) { onBlur(cm); }\n display.cursorDiv.style.visibility = (on = !on) ? \"\" : \"hidden\";\n }, cm.options.cursorBlinkRate); }\n else if (cm.options.cursorBlinkRate < 0)\n { display.cursorDiv.style.visibility = \"hidden\"; }\n }\n\n function ensureFocus(cm) {\n if (!cm.hasFocus()) {\n cm.display.input.focus();\n if (!cm.state.focused) { onFocus(cm); }\n }\n }\n\n function delayBlurEvent(cm) {\n cm.state.delayingBlurEvent = true;\n setTimeout(function () { if (cm.state.delayingBlurEvent) {\n cm.state.delayingBlurEvent = false;\n if (cm.state.focused) { onBlur(cm); }\n } }, 100);\n }\n\n function onFocus(cm, e) {\n if (cm.state.delayingBlurEvent && !cm.state.draggingText) { cm.state.delayingBlurEvent = false; }\n\n if (cm.options.readOnly == \"nocursor\") { return }\n if (!cm.state.focused) {\n signal(cm, \"focus\", cm, e);\n cm.state.focused = true;\n addClass(cm.display.wrapper, \"CodeMirror-focused\");\n // This test prevents this from firing when a context\n // menu is closed (since the input reset would kill the\n // select-all detection hack)\n if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {\n cm.display.input.reset();\n if (webkit) { setTimeout(function () { return cm.display.input.reset(true); }, 20); } // Issue #1730\n }\n cm.display.input.receivedFocus();\n }\n restartBlink(cm);\n }\n function onBlur(cm, e) {\n if (cm.state.delayingBlurEvent) { return }\n\n if (cm.state.focused) {\n signal(cm, \"blur\", cm, e);\n cm.state.focused = false;\n rmClass(cm.display.wrapper, \"CodeMirror-focused\");\n }\n clearInterval(cm.display.blinker);\n setTimeout(function () { if (!cm.state.focused) { cm.display.shift = false; } }, 150);\n }\n\n // Read the actual heights of the rendered lines, and update their\n // stored heights to match.\n function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i], wrapping = cm.options.lineWrapping;\n var height = (void 0), width = 0;\n if (cur.hidden) { continue }\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top;\n // Check that lines don't extend past the right of the current\n // editor width\n if (!wrapping && cur.text.firstChild)\n { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }\n }\n var diff = cur.line.height - height;\n if (diff > .005 || diff < -.005) {\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)\n { updateWidgetHeight(cur.rest[j]); } }\n }\n if (width > cm.display.sizerWidth) {\n var chWidth = Math.ceil(width / charWidth(cm.display));\n if (chWidth > cm.display.maxLineLength) {\n cm.display.maxLineLength = chWidth;\n cm.display.maxLine = cur.line;\n cm.display.maxLineChanged = true;\n }\n }\n }\n }\n\n // Read and store the height of line widgets associated with the\n // given line.\n function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n }\n\n // Compute the lines that are visible in a given viewport (defaults\n // the the current scroll position). viewport may contain top,\n // height, and ensure (see op.scrollToPos) properties.\n function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }\n\n // SCROLLING THINGS INTO VIEW\n\n // If an editor sits on the top or bottom of the window, partially\n // scrolled out of view, this ensures that the cursor is visible.\n function maybeScrollWindow(cm, rect) {\n if (signalDOMEvent(cm, \"scrollCursorIntoView\")) { return }\n\n var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;\n if (rect.top + box.top < 0) { doScroll = true; }\n else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false; }\n if (doScroll != null && !phantom) {\n var scrollNode = elt(\"div\", \"\\u200b\", null, (\"position: absolute;\\n top: \" + (rect.top - display.viewOffset - paddingTop(cm.display)) + \"px;\\n height: \" + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + \"px;\\n left: \" + (rect.left) + \"px; width: \" + (Math.max(2, rect.right - rect.left)) + \"px;\"));\n cm.display.lineSpace.appendChild(scrollNode);\n scrollNode.scrollIntoView(doScroll);\n cm.display.lineSpace.removeChild(scrollNode);\n }\n }\n\n // Scroll a given position into view (immediately), verifying that\n // it actually became visible (as line heights are accurately\n // measured, the position of something may 'drift' during drawing).\n function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n }\n\n // Scroll a given set of coordinates into view (immediately).\n function scrollIntoView(cm, rect) {\n var scrollPos = calculateScrollPos(cm, rect);\n if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }\n if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }\n }\n\n // Calculate a new scroll position needed to scroll the given\n // rectangle into view. Returns an object with scrollTop and\n // scrollLeft properties. When these are undefined, the\n // vertical/horizontal position does not need to be adjusted.\n function calculateScrollPos(cm, rect) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (rect.top < 0) { rect.top = 0; }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n if (newTop != screentop) { result.scrollTop = newTop; }\n }\n\n var gutterSpace = cm.options.fixedGutter ? 0 : display.gutters.offsetWidth;\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft - gutterSpace;\n var screenw = displayWidth(cm) - display.gutters.offsetWidth;\n var tooWide = rect.right - rect.left > screenw;\n if (tooWide) { rect.right = rect.left + screenw; }\n if (rect.left < 10)\n { result.scrollLeft = 0; }\n else if (rect.left < screenleft)\n { result.scrollLeft = Math.max(0, rect.left + gutterSpace - (tooWide ? 0 : 10)); }\n else if (rect.right > screenw + screenleft - 3)\n { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }\n return result\n }\n\n // Store a relative adjustment to the scroll position in the current\n // operation (to be applied when the operation finishes).\n function addToScrollTop(cm, top) {\n if (top == null) { return }\n resolveScrollToPos(cm);\n cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n }\n\n // Make sure that at the end of the operation the current cursor is\n // shown.\n function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n }\n\n function scrollToCoords(cm, x, y) {\n if (x != null || y != null) { resolveScrollToPos(cm); }\n if (x != null) { cm.curOp.scrollLeft = x; }\n if (y != null) { cm.curOp.scrollTop = y; }\n }\n\n function scrollToRange(cm, range) {\n resolveScrollToPos(cm);\n cm.curOp.scrollToPos = range;\n }\n\n // When an operation has its scrollToPos property set, and another\n // scroll action is applied before the end of the operation, this\n // 'simulates' scrolling that position into view in a cheap way, so\n // that the effect of intermediate scroll commands is not ignored.\n function resolveScrollToPos(cm) {\n var range = cm.curOp.scrollToPos;\n if (range) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);\n scrollToCoordsRange(cm, from, to, range.margin);\n }\n }\n\n function scrollToCoordsRange(cm, from, to, margin) {\n var sPos = calculateScrollPos(cm, {\n left: Math.min(from.left, to.left),\n top: Math.min(from.top, to.top) - margin,\n right: Math.max(from.right, to.right),\n bottom: Math.max(from.bottom, to.bottom) + margin\n });\n scrollToCoords(cm, sPos.scrollLeft, sPos.scrollTop);\n }\n\n // Sync the scrollable area and scrollbars, ensure the viewport\n // covers the visible area.\n function updateScrollTop(cm, val) {\n if (Math.abs(cm.doc.scrollTop - val) < 2) { return }\n if (!gecko) { updateDisplaySimple(cm, {top: val}); }\n setScrollTop(cm, val, true);\n if (gecko) { updateDisplaySimple(cm); }\n startWorker(cm, 100);\n }\n\n function setScrollTop(cm, val, forceScroll) {\n val = Math.max(0, Math.min(cm.display.scroller.scrollHeight - cm.display.scroller.clientHeight, val));\n if (cm.display.scroller.scrollTop == val && !forceScroll) { return }\n cm.doc.scrollTop = val;\n cm.display.scrollbars.setScrollTop(val);\n if (cm.display.scroller.scrollTop != val) { cm.display.scroller.scrollTop = val; }\n }\n\n // Sync scroller and scrollbar, ensure the gutter elements are\n // aligned.\n function setScrollLeft(cm, val, isScroller, forceScroll) {\n val = Math.max(0, Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth));\n if ((isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) && !forceScroll) { return }\n cm.doc.scrollLeft = val;\n alignHorizontally(cm);\n if (cm.display.scroller.scrollLeft != val) { cm.display.scroller.scrollLeft = val; }\n cm.display.scrollbars.setScrollLeft(val);\n }\n\n // SCROLLBARS\n\n // Prepare DOM reads needed to update the scrollbars. Done in one\n // shot to minimize update/measure roundtrips.\n function measureForScrollbars(cm) {\n var d = cm.display, gutterW = d.gutters.offsetWidth;\n var docH = Math.round(cm.doc.height + paddingVert(cm.display));\n return {\n clientHeight: d.scroller.clientHeight,\n viewHeight: d.wrapper.clientHeight,\n scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,\n viewWidth: d.wrapper.clientWidth,\n barLeft: cm.options.fixedGutter ? gutterW : 0,\n docHeight: docH,\n scrollHeight: docH + scrollGap(cm) + d.barHeight,\n nativeBarWidth: d.nativeBarWidth,\n gutterWidth: gutterW\n }\n }\n\n var NativeScrollbars = function(place, scroll, cm) {\n this.cm = cm;\n var vert = this.vert = elt(\"div\", [elt(\"div\", null, null, \"min-width: 1px\")], \"CodeMirror-vscrollbar\");\n var horiz = this.horiz = elt(\"div\", [elt(\"div\", null, null, \"height: 100%; min-height: 1px\")], \"CodeMirror-hscrollbar\");\n vert.tabIndex = horiz.tabIndex = -1;\n place(vert); place(horiz);\n\n on(vert, \"scroll\", function () {\n if (vert.clientHeight) { scroll(vert.scrollTop, \"vertical\"); }\n });\n on(horiz, \"scroll\", function () {\n if (horiz.clientWidth) { scroll(horiz.scrollLeft, \"horizontal\"); }\n });\n\n this.checkedZeroWidth = false;\n // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).\n if (ie && ie_version < 8) { this.horiz.style.minHeight = this.vert.style.minWidth = \"18px\"; }\n };\n\n NativeScrollbars.prototype.update = function (measure) {\n var needsH = measure.scrollWidth > measure.clientWidth + 1;\n var needsV = measure.scrollHeight > measure.clientHeight + 1;\n var sWidth = measure.nativeBarWidth;\n\n if (needsV) {\n this.vert.style.display = \"block\";\n this.vert.style.bottom = needsH ? sWidth + \"px\" : \"0\";\n var totalHeight = measure.viewHeight - (needsH ? sWidth : 0);\n // A bug in IE8 can cause this value to be negative, so guard it.\n this.vert.firstChild.style.height =\n Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + \"px\";\n } else {\n this.vert.style.display = \"\";\n this.vert.firstChild.style.height = \"0\";\n }\n\n if (needsH) {\n this.horiz.style.display = \"block\";\n this.horiz.style.right = needsV ? sWidth + \"px\" : \"0\";\n this.horiz.style.left = measure.barLeft + \"px\";\n var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0);\n this.horiz.firstChild.style.width =\n Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + \"px\";\n } else {\n this.horiz.style.display = \"\";\n this.horiz.firstChild.style.width = \"0\";\n }\n\n if (!this.checkedZeroWidth && measure.clientHeight > 0) {\n if (sWidth == 0) { this.zeroWidthHack(); }\n this.checkedZeroWidth = true;\n }\n\n return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0}\n };\n\n NativeScrollbars.prototype.setScrollLeft = function (pos) {\n if (this.horiz.scrollLeft != pos) { this.horiz.scrollLeft = pos; }\n if (this.disableHoriz) { this.enableZeroWidthBar(this.horiz, this.disableHoriz, \"horiz\"); }\n };\n\n NativeScrollbars.prototype.setScrollTop = function (pos) {\n if (this.vert.scrollTop != pos) { this.vert.scrollTop = pos; }\n if (this.disableVert) { this.enableZeroWidthBar(this.vert, this.disableVert, \"vert\"); }\n };\n\n NativeScrollbars.prototype.zeroWidthHack = function () {\n var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\";\n this.horiz.style.height = this.vert.style.width = w;\n this.horiz.style.pointerEvents = this.vert.style.pointerEvents = \"none\";\n this.disableHoriz = new Delayed;\n this.disableVert = new Delayed;\n };\n\n NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay, type) {\n bar.style.pointerEvents = \"auto\";\n function maybeDisable() {\n // To find out whether the scrollbar is still visible, we\n // check whether the element under the pixel in the bottom\n // right corner of the scrollbar box is the scrollbar box\n // itself (when the bar is still visible) or its filler child\n // (when the bar is hidden). If it is still visible, we keep\n // it enabled, if it's hidden, we disable pointer events.\n var box = bar.getBoundingClientRect();\n var elt = type == \"vert\" ? document.elementFromPoint(box.right - 1, (box.top + box.bottom) / 2)\n : document.elementFromPoint((box.right + box.left) / 2, box.bottom - 1);\n if (elt != bar) { bar.style.pointerEvents = \"none\"; }\n else { delay.set(1000, maybeDisable); }\n }\n delay.set(1000, maybeDisable);\n };\n\n NativeScrollbars.prototype.clear = function () {\n var parent = this.horiz.parentNode;\n parent.removeChild(this.horiz);\n parent.removeChild(this.vert);\n };\n\n var NullScrollbars = function () {};\n\n NullScrollbars.prototype.update = function () { return {bottom: 0, right: 0} };\n NullScrollbars.prototype.setScrollLeft = function () {};\n NullScrollbars.prototype.setScrollTop = function () {};\n NullScrollbars.prototype.clear = function () {};\n\n function updateScrollbars(cm, measure) {\n if (!measure) { measure = measureForScrollbars(cm); }\n var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight;\n updateScrollbarsInner(cm, measure);\n for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {\n if (startWidth != cm.display.barWidth && cm.options.lineWrapping)\n { updateHeightsInViewport(cm); }\n updateScrollbarsInner(cm, measureForScrollbars(cm));\n startWidth = cm.display.barWidth; startHeight = cm.display.barHeight;\n }\n }\n\n // Re-synchronize the fake scrollbars with the actual size of the\n // content.\n function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }\n\n var scrollbarModel = {\"native\": NativeScrollbars, \"null\": NullScrollbars};\n\n function initScrollbars(cm) {\n if (cm.display.scrollbars) {\n cm.display.scrollbars.clear();\n if (cm.display.scrollbars.addClass)\n { rmClass(cm.display.wrapper, cm.display.scrollbars.addClass); }\n }\n\n cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](function (node) {\n cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller);\n // Prevent clicks in the scrollbars from killing focus\n on(node, \"mousedown\", function () {\n if (cm.state.focused) { setTimeout(function () { return cm.display.input.focus(); }, 0); }\n });\n node.setAttribute(\"cm-not-content\", \"true\");\n }, function (pos, axis) {\n if (axis == \"horizontal\") { setScrollLeft(cm, pos); }\n else { updateScrollTop(cm, pos); }\n }, cm);\n if (cm.display.scrollbars.addClass)\n { addClass(cm.display.wrapper, cm.display.scrollbars.addClass); }\n }\n\n // Operations are used to wrap a series of changes to the editor\n // state in such a way that each change won't have to update the\n // cursor and display (which would be awkward, slow, and\n // error-prone). Instead, display updates are batched and then all\n // combined and executed at once.\n\n var nextOpId = 0;\n // Start a new operation.\n function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: 0, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n focus: false,\n id: ++nextOpId // Unique ID\n };\n pushOperation(cm.curOp);\n }\n\n // Finish an operation, updating the display and signalling delayed events\n function endOperation(cm) {\n var op = cm.curOp;\n if (op) { finishOperation(op, function (group) {\n for (var i = 0; i < group.ops.length; i++)\n { group.ops[i].cm.curOp = null; }\n endOperations(group);\n }); }\n }\n\n // The DOM updates done when an operation finishes are batched so\n // that the minimum number of relayouts are required.\n function endOperations(group) {\n var ops = group.ops;\n for (var i = 0; i < ops.length; i++) // Read DOM\n { endOperation_R1(ops[i]); }\n for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe)\n { endOperation_W1(ops[i$1]); }\n for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM\n { endOperation_R2(ops[i$2]); }\n for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe)\n { endOperation_W2(ops[i$3]); }\n for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM\n { endOperation_finish(ops[i$4]); }\n }\n\n function endOperation_R1(op) {\n var cm = op.cm, display = cm.display;\n maybeClipScrollbars(cm);\n if (op.updateMaxLine) { findMaxLine(cm); }\n\n op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||\n op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||\n op.scrollToPos.to.line >= display.viewTo) ||\n display.maxLineChanged && cm.options.lineWrapping;\n op.update = op.mustUpdate &&\n new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate);\n }\n\n function endOperation_W1(op) {\n op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update);\n }\n\n function endOperation_R2(op) {\n var cm = op.cm, display = cm.display;\n if (op.updatedDisplay) { updateHeightsInViewport(cm); }\n\n op.barMeasure = measureForScrollbars(cm);\n\n // If the max line changed since it was last measured, measure it,\n // and ensure the document's width matches it.\n // updateDisplay_W2 will use these properties to do the actual resizing\n if (display.maxLineChanged && !cm.options.lineWrapping) {\n op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3;\n cm.display.sizerWidth = op.adjustWidthTo;\n op.barMeasure.scrollWidth =\n Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth);\n op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm));\n }\n\n if (op.updatedDisplay || op.selectionChanged)\n { op.preparedSelection = display.input.prepareSelection(); }\n }\n\n function endOperation_W2(op) {\n var cm = op.cm;\n\n if (op.adjustWidthTo != null) {\n cm.display.sizer.style.minWidth = op.adjustWidthTo + \"px\";\n if (op.maxScrollLeft < cm.doc.scrollLeft)\n { setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true); }\n cm.display.maxLineChanged = false;\n }\n\n var takeFocus = op.focus && op.focus == activeElt();\n if (op.preparedSelection)\n { cm.display.input.showSelection(op.preparedSelection, takeFocus); }\n if (op.updatedDisplay || op.startHeight != cm.doc.height)\n { updateScrollbars(cm, op.barMeasure); }\n if (op.updatedDisplay)\n { setDocumentHeight(cm, op.barMeasure); }\n\n if (op.selectionChanged) { restartBlink(cm); }\n\n if (cm.state.focused && op.updateInput)\n { cm.display.input.reset(op.typing); }\n if (takeFocus) { ensureFocus(op.cm); }\n }\n\n function endOperation_finish(op) {\n var cm = op.cm, display = cm.display, doc = cm.doc;\n\n if (op.updatedDisplay) { postUpdateDisplay(cm, op.update); }\n\n // Abort mouse wheel delta measurement, when scrolling explicitly\n if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))\n { display.wheelStartX = display.wheelStartY = null; }\n\n // Propagate the scroll position to the actual DOM scroller\n if (op.scrollTop != null) { setScrollTop(cm, op.scrollTop, op.forceScroll); }\n\n if (op.scrollLeft != null) { setScrollLeft(cm, op.scrollLeft, true, true); }\n // If we need to scroll a specific position into view, do so.\n if (op.scrollToPos) {\n var rect = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),\n clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin);\n maybeScrollWindow(cm, rect);\n }\n\n // Fire events for markers that are hidden/unidden by editing or\n // undoing\n var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;\n if (hidden) { for (var i = 0; i < hidden.length; ++i)\n { if (!hidden[i].lines.length) { signal(hidden[i], \"hide\"); } } }\n if (unhidden) { for (var i$1 = 0; i$1 < unhidden.length; ++i$1)\n { if (unhidden[i$1].lines.length) { signal(unhidden[i$1], \"unhide\"); } } }\n\n if (display.wrapper.offsetHeight)\n { doc.scrollTop = cm.display.scroller.scrollTop; }\n\n // Fire change events, and delayed event handlers\n if (op.changeObjs)\n { signal(cm, \"changes\", cm, op.changeObjs); }\n if (op.update)\n { op.update.finish(); }\n }\n\n // Run the given function in an operation\n function runInOp(cm, f) {\n if (cm.curOp) { return f() }\n startOperation(cm);\n try { return f() }\n finally { endOperation(cm); }\n }\n // Wraps a function in an operation. Returns the wrapped function.\n function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n }\n // Used to add methods to editor and doc instances, wrapping them in\n // operations.\n function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n }\n function docMethodOp(f) {\n return function() {\n var cm = this.cm;\n if (!cm || cm.curOp) { return f.apply(this, arguments) }\n startOperation(cm);\n try { return f.apply(this, arguments) }\n finally { endOperation(cm); }\n }\n }\n\n // HIGHLIGHT WORKER\n\n function startWorker(cm, time) {\n if (cm.doc.highlightFrontier < cm.display.viewTo)\n { cm.state.highlight.set(time, bind(highlightWorker, cm)); }\n }\n\n function highlightWorker(cm) {\n var doc = cm.doc;\n if (doc.highlightFrontier >= cm.display.viewTo) { return }\n var end = +new Date + cm.options.workTime;\n var context = getContextBefore(cm, doc.highlightFrontier);\n var changedLines = [];\n\n doc.iter(context.line, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function (line) {\n if (context.line >= cm.display.viewFrom) { // Visible\n var oldStyles = line.styles;\n var resetState = line.text.length > cm.options.maxHighlightLength ? copyState(doc.mode, context.state) : null;\n var highlighted = highlightLine(cm, line, context, true);\n if (resetState) { context.state = resetState; }\n line.styles = highlighted.styles;\n var oldCls = line.styleClasses, newCls = highlighted.classes;\n if (newCls) { line.styleClasses = newCls; }\n else if (oldCls) { line.styleClasses = null; }\n var ischange = !oldStyles || oldStyles.length != line.styles.length ||\n oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass);\n for (var i = 0; !ischange && i < oldStyles.length; ++i) { ischange = oldStyles[i] != line.styles[i]; }\n if (ischange) { changedLines.push(context.line); }\n line.stateAfter = context.save();\n context.nextLine();\n } else {\n if (line.text.length <= cm.options.maxHighlightLength)\n { processLine(cm, line.text, context); }\n line.stateAfter = context.line % 5 == 0 ? context.save() : null;\n context.nextLine();\n }\n if (+new Date > end) {\n startWorker(cm, cm.options.workDelay);\n return true\n }\n });\n doc.highlightFrontier = context.line;\n doc.modeFrontier = Math.max(doc.modeFrontier, context.line);\n if (changedLines.length) { runInOp(cm, function () {\n for (var i = 0; i < changedLines.length; i++)\n { regLineChange(cm, changedLines[i], \"text\"); }\n }); }\n }\n\n // DISPLAY DRAWING\n\n var DisplayUpdate = function(cm, viewport, force) {\n var display = cm.display;\n\n this.viewport = viewport;\n // Store some values that we'll need later (but don't want to force a relayout for)\n this.visible = visibleLines(display, cm.doc, viewport);\n this.editorIsHidden = !display.wrapper.offsetWidth;\n this.wrapperHeight = display.wrapper.clientHeight;\n this.wrapperWidth = display.wrapper.clientWidth;\n this.oldDisplayWidth = displayWidth(cm);\n this.force = force;\n this.dims = getDimensions(cm);\n this.events = [];\n };\n\n DisplayUpdate.prototype.signal = function (emitter, type) {\n if (hasHandler(emitter, type))\n { this.events.push(arguments); }\n };\n DisplayUpdate.prototype.finish = function () {\n for (var i = 0; i < this.events.length; i++)\n { signal.apply(null, this.events[i]); }\n };\n\n function maybeClipScrollbars(cm) {\n var display = cm.display;\n if (!display.scrollbarsClipped && display.scroller.offsetWidth) {\n display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth;\n display.heightForcer.style.height = scrollGap(cm) + \"px\";\n display.sizer.style.marginBottom = -display.nativeBarWidth + \"px\";\n display.sizer.style.borderRightWidth = scrollGap(cm) + \"px\";\n display.scrollbarsClipped = true;\n }\n }\n\n function selectionSnapshot(cm) {\n if (cm.hasFocus()) { return null }\n var active = activeElt();\n if (!active || !contains(cm.display.lineDiv, active)) { return null }\n var result = {activeElt: active};\n if (window.getSelection) {\n var sel = window.getSelection();\n if (sel.anchorNode && sel.extend && contains(cm.display.lineDiv, sel.anchorNode)) {\n result.anchorNode = sel.anchorNode;\n result.anchorOffset = sel.anchorOffset;\n result.focusNode = sel.focusNode;\n result.focusOffset = sel.focusOffset;\n }\n }\n return result\n }\n\n function restoreSelection(snapshot) {\n if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt()) { return }\n snapshot.activeElt.focus();\n if (!/^(INPUT|TEXTAREA)$/.test(snapshot.activeElt.nodeName) &&\n snapshot.anchorNode && contains(document.body, snapshot.anchorNode) && contains(document.body, snapshot.focusNode)) {\n var sel = window.getSelection(), range = document.createRange();\n range.setEnd(snapshot.anchorNode, snapshot.anchorOffset);\n range.collapse(false);\n sel.removeAllRanges();\n sel.addRange(range);\n sel.extend(snapshot.focusNode, snapshot.focusOffset);\n }\n }\n\n // Does the actual updating of the line display. Bails out\n // (returning false) when there is nothing to be done and forced is\n // false.\n function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }\n\n function postUpdateDisplay(cm, update) {\n var viewport = update.viewport;\n\n for (var first = true;; first = false) {\n if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {\n // Clip forced viewport to actual scrollable area.\n if (viewport && viewport.top != null)\n { viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)}; }\n // Updated line heights might result in the drawn area not\n // actually covering the viewport. Keep looping until it does.\n update.visible = visibleLines(cm.display, cm.doc, viewport);\n if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo)\n { break }\n } else if (first) {\n update.visible = visibleLines(cm.display, cm.doc, viewport);\n }\n if (!updateDisplayIfNeeded(cm, update)) { break }\n updateHeightsInViewport(cm);\n var barMeasure = measureForScrollbars(cm);\n updateSelection(cm);\n updateScrollbars(cm, barMeasure);\n setDocumentHeight(cm, barMeasure);\n update.force = false;\n }\n\n update.signal(cm, \"update\", cm);\n if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {\n update.signal(cm, \"viewportChange\", cm, cm.display.viewFrom, cm.display.viewTo);\n cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo;\n }\n }\n\n function updateDisplaySimple(cm, viewport) {\n var update = new DisplayUpdate(cm, viewport);\n if (updateDisplayIfNeeded(cm, update)) {\n updateHeightsInViewport(cm);\n postUpdateDisplay(cm, update);\n var barMeasure = measureForScrollbars(cm);\n updateSelection(cm);\n updateScrollbars(cm, barMeasure);\n setDocumentHeight(cm, barMeasure);\n update.finish();\n }\n }\n\n // Sync the actual display DOM structure with display.view, removing\n // nodes for lines that are no longer in view, and creating the ones\n // that are not there yet, and updating the ones that are out of\n // date.\n function patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display, lineNumbers = cm.options.lineNumbers;\n var container = display.lineDiv, cur = container.firstChild;\n\n function rm(node) {\n var next = node.nextSibling;\n // Works around a throw-scroll bug in OS X Webkit\n if (webkit && mac && cm.display.currentWheelTarget == node)\n { node.style.display = \"none\"; }\n else\n { node.parentNode.removeChild(node); }\n return next\n }\n\n var view = display.view, lineN = display.viewFrom;\n // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (lineView.hidden) ; else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims);\n container.insertBefore(node, cur);\n } else { // Already drawn\n while (cur != lineView.node) { cur = rm(cur); }\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\n updateNumbersFrom <= lineN && lineView.lineNumber;\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) { updateNumber = false; }\n updateLineForChanges(cm, lineView, lineN, dims);\n }\n if (updateNumber) {\n removeChildren(lineView.lineNumber);\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n }\n cur = lineView.node.nextSibling;\n }\n lineN += lineView.size;\n }\n while (cur) { cur = rm(cur); }\n }\n\n function updateGutterSpace(display) {\n var width = display.gutters.offsetWidth;\n display.sizer.style.marginLeft = width + \"px\";\n }\n\n function setDocumentHeight(cm, measure) {\n cm.display.sizer.style.minHeight = measure.docHeight + \"px\";\n cm.display.heightForcer.style.top = measure.docHeight + \"px\";\n cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + \"px\";\n }\n\n // Re-align line numbers and gutter marks to compensate for\n // horizontal scrolling.\n function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }\n\n // Used to ensure that the line number gutter is still the right\n // size for the current document size. Returns true when an update\n // is needed.\n function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm.display);\n return true\n }\n return false\n }\n\n function getGutters(gutters, lineNumbers) {\n var result = [], sawLineNumbers = false;\n for (var i = 0; i < gutters.length; i++) {\n var name = gutters[i], style = null;\n if (typeof name != \"string\") { style = name.style; name = name.className; }\n if (name == \"CodeMirror-linenumbers\") {\n if (!lineNumbers) { continue }\n else { sawLineNumbers = true; }\n }\n result.push({className: name, style: style});\n }\n if (lineNumbers && !sawLineNumbers) { result.push({className: \"CodeMirror-linenumbers\", style: null}); }\n return result\n }\n\n // Rebuild the gutter elements, ensure the margin to the left of the\n // code matches their width.\n function renderGutters(display) {\n var gutters = display.gutters, specs = display.gutterSpecs;\n removeChildren(gutters);\n display.lineGutter = null;\n for (var i = 0; i < specs.length; ++i) {\n var ref = specs[i];\n var className = ref.className;\n var style = ref.style;\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + className));\n if (style) { gElt.style.cssText = style; }\n if (className == \"CodeMirror-linenumbers\") {\n display.lineGutter = gElt;\n gElt.style.width = (display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = specs.length ? \"\" : \"none\";\n updateGutterSpace(display);\n }\n\n function updateGutters(cm) {\n renderGutters(cm.display);\n regChange(cm);\n alignHorizontally(cm);\n }\n\n // The display handles the DOM integration, both for input reading\n // and content drawing. It holds references to DOM nodes and\n // display-related state.\n\n function Display(place, doc, input, options) {\n var d = this;\n this.input = input;\n\n // Covers bottom-right square when both scrollbars are present.\n d.scrollbarFiller = elt(\"div\", null, \"CodeMirror-scrollbar-filler\");\n d.scrollbarFiller.setAttribute(\"cm-not-content\", \"true\");\n // Covers bottom of gutter when coverGutterNextToScrollbar is on\n // and h scrollbar is present.\n d.gutterFiller = elt(\"div\", null, \"CodeMirror-gutter-filler\");\n d.gutterFiller.setAttribute(\"cm-not-content\", \"true\");\n // Will contain the actual code, positioned to cover the viewport.\n d.lineDiv = eltP(\"div\", null, \"CodeMirror-code\");\n // Elements are added to these to represent selection and cursors.\n d.selectionDiv = elt(\"div\", null, null, \"position: relative; z-index: 1\");\n d.cursorDiv = elt(\"div\", null, \"CodeMirror-cursors\");\n // A visibility: hidden element used to find the size of things.\n d.measure = elt(\"div\", null, \"CodeMirror-measure\");\n // When lines outside of the viewport are measured, they are drawn in this.\n d.lineMeasure = elt(\"div\", null, \"CodeMirror-measure\");\n // Wraps everything that needs to exist inside the vertically-padded coordinate system\n d.lineSpace = eltP(\"div\", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],\n null, \"position: relative; outline: none\");\n var lines = eltP(\"div\", [d.lineSpace], \"CodeMirror-lines\");\n // Moved around its parent to cover visible view.\n d.mover = elt(\"div\", [lines], null, \"position: relative\");\n // Set to the height of the document, allowing scrolling.\n d.sizer = elt(\"div\", [d.mover], \"CodeMirror-sizer\");\n d.sizerWidth = null;\n // Behavior of elts with overflow: auto and padding is\n // inconsistent across browsers. This is used to ensure the\n // scrollable area is big enough.\n d.heightForcer = elt(\"div\", null, null, \"position: absolute; height: \" + scrollerGap + \"px; width: 1px;\");\n // Will contain the gutters, if any.\n d.gutters = elt(\"div\", null, \"CodeMirror-gutters\");\n d.lineGutter = null;\n // Actual scrollable element.\n d.scroller = elt(\"div\", [d.sizer, d.heightForcer, d.gutters], \"CodeMirror-scroll\");\n d.scroller.setAttribute(\"tabIndex\", \"-1\");\n // The element in which the editor lives.\n d.wrapper = elt(\"div\", [d.scrollbarFiller, d.gutterFiller, d.scroller], \"CodeMirror\");\n\n // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)\n if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }\n if (!webkit && !(gecko && mobile)) { d.scroller.draggable = true; }\n\n if (place) {\n if (place.appendChild) { place.appendChild(d.wrapper); }\n else { place(d.wrapper); }\n }\n\n // Current rendered range (may be bigger than the view window).\n d.viewFrom = d.viewTo = doc.first;\n d.reportedViewFrom = d.reportedViewTo = doc.first;\n // Information about the rendered lines.\n d.view = [];\n d.renderedView = null;\n // Holds info about a single rendered line when it was rendered\n // for measurement, while not in view.\n d.externalMeasured = null;\n // Empty space (in pixels) above the view\n d.viewOffset = 0;\n d.lastWrapHeight = d.lastWrapWidth = 0;\n d.updateLineNumbers = null;\n\n d.nativeBarWidth = d.barHeight = d.barWidth = 0;\n d.scrollbarsClipped = false;\n\n // Used to only resize the line number gutter when necessary (when\n // the amount of lines crosses a boundary that makes its width change)\n d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;\n // Set to true when a non-horizontal-scrolling line widget is\n // added. As an optimization, line widget aligning is skipped when\n // this is false.\n d.alignWidgets = false;\n\n d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;\n\n // Tracks the maximum line length so that the horizontal scrollbar\n // can be kept static when scrolling.\n d.maxLine = null;\n d.maxLineLength = 0;\n d.maxLineChanged = false;\n\n // Used for measuring wheel scrolling granularity\n d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;\n\n // True when shift is held down.\n d.shift = false;\n\n // Used to track whether anything happened since the context menu\n // was opened.\n d.selForContextMenu = null;\n\n d.activeTouch = null;\n\n d.gutterSpecs = getGutters(options.gutters, options.lineNumbers);\n renderGutters(d);\n\n input.init(d);\n }\n\n // Since the delta values reported on mouse wheel events are\n // unstandardized between browsers and even browser versions, and\n // generally horribly unpredictable, this code starts by measuring\n // the scroll effect that the first few mouse wheel events have,\n // and, from that, detects the way it can convert deltas to pixel\n // offsets afterwards.\n //\n // The reason we want to know the amount a wheel event will scroll\n // is that it gives us a chance to update the display before the\n // actual scrolling happens, reducing flickering.\n\n var wheelSamples = 0, wheelPixelsPerUnit = null;\n // Fill in a browser-detected starting value on browsers where we\n // know one. These don't have to be accurate -- the result of them\n // being wrong would just be a slight flicker on the first wheel\n // scroll (if it is large enough).\n if (ie) { wheelPixelsPerUnit = -.53; }\n else if (gecko) { wheelPixelsPerUnit = 15; }\n else if (chrome) { wheelPixelsPerUnit = -.7; }\n else if (safari) { wheelPixelsPerUnit = -1/3; }\n\n function wheelEventDelta(e) {\n var dx = e.wheelDeltaX, dy = e.wheelDeltaY;\n if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) { dx = e.detail; }\n if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) { dy = e.detail; }\n else if (dy == null) { dy = e.wheelDelta; }\n return {x: dx, y: dy}\n }\n function wheelEventPixels(e) {\n var delta = wheelEventDelta(e);\n delta.x *= wheelPixelsPerUnit;\n delta.y *= wheelPixelsPerUnit;\n return delta\n }\n\n function onScrollWheel(cm, e) {\n var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;\n\n var display = cm.display, scroll = display.scroller;\n // Quit if there's nothing to scroll here\n var canScrollX = scroll.scrollWidth > scroll.clientWidth;\n var canScrollY = scroll.scrollHeight > scroll.clientHeight;\n if (!(dx && canScrollX || dy && canScrollY)) { return }\n\n // Webkit browsers on OS X abort momentum scrolls when the target\n // of the scroll event is removed from the scrollable element.\n // This hack (see related code in patchDisplay) makes sure the\n // element is kept around.\n if (dy && mac && webkit) {\n outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {\n for (var i = 0; i < view.length; i++) {\n if (view[i].node == cur) {\n cm.display.currentWheelTarget = cur;\n break outer\n }\n }\n }\n }\n\n // On some browsers, horizontal scrolling will cause redraws to\n // happen before the gutter has been realigned, causing it to\n // wriggle around in a most unseemly way. When we have an\n // estimated pixels/delta value, we just handle horizontal\n // scrolling entirely here. It'll be slightly off from native, but\n // better than glitching out.\n if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {\n if (dy && canScrollY)\n { updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * wheelPixelsPerUnit)); }\n setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * wheelPixelsPerUnit));\n // Only prevent default scrolling if vertical scrolling is\n // actually possible. Otherwise, it causes vertical scroll\n // jitter on OSX trackpads when deltaX is small and deltaY\n // is large (issue #3579)\n if (!dy || (dy && canScrollY))\n { e_preventDefault(e); }\n display.wheelStartX = null; // Abort measurement, if in progress\n return\n }\n\n // 'Project' the visible viewport to cover the area that is being\n // scrolled into view (if we know enough to estimate it).\n if (dy && wheelPixelsPerUnit != null) {\n var pixels = dy * wheelPixelsPerUnit;\n var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;\n if (pixels < 0) { top = Math.max(0, top + pixels - 50); }\n else { bot = Math.min(cm.doc.height, bot + pixels + 50); }\n updateDisplaySimple(cm, {top: top, bottom: bot});\n }\n\n if (wheelSamples < 20) {\n if (display.wheelStartX == null) {\n display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;\n display.wheelDX = dx; display.wheelDY = dy;\n setTimeout(function () {\n if (display.wheelStartX == null) { return }\n var movedX = scroll.scrollLeft - display.wheelStartX;\n var movedY = scroll.scrollTop - display.wheelStartY;\n var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||\n (movedX && display.wheelDX && movedX / display.wheelDX);\n display.wheelStartX = display.wheelStartY = null;\n if (!sample) { return }\n wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);\n ++wheelSamples;\n }, 200);\n } else {\n display.wheelDX += dx; display.wheelDY += dy;\n }\n }\n }\n\n // Selection objects are immutable. A new one is created every time\n // the selection changes. A selection is one or more non-overlapping\n // (and non-touching) ranges, sorted, and an integer that indicates\n // which one is the primary selection (the one that's scrolled into\n // view, that getCursor returns, etc).\n var Selection = function(ranges, primIndex) {\n this.ranges = ranges;\n this.primIndex = primIndex;\n };\n\n Selection.prototype.primary = function () { return this.ranges[this.primIndex] };\n\n Selection.prototype.equals = function (other) {\n if (other == this) { return true }\n if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) { return false }\n for (var i = 0; i < this.ranges.length; i++) {\n var here = this.ranges[i], there = other.ranges[i];\n if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) { return false }\n }\n return true\n };\n\n Selection.prototype.deepCopy = function () {\n var out = [];\n for (var i = 0; i < this.ranges.length; i++)\n { out[i] = new Range(copyPos(this.ranges[i].anchor), copyPos(this.ranges[i].head)); }\n return new Selection(out, this.primIndex)\n };\n\n Selection.prototype.somethingSelected = function () {\n for (var i = 0; i < this.ranges.length; i++)\n { if (!this.ranges[i].empty()) { return true } }\n return false\n };\n\n Selection.prototype.contains = function (pos, end) {\n if (!end) { end = pos; }\n for (var i = 0; i < this.ranges.length; i++) {\n var range = this.ranges[i];\n if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)\n { return i }\n }\n return -1\n };\n\n var Range = function(anchor, head) {\n this.anchor = anchor; this.head = head;\n };\n\n Range.prototype.from = function () { return minPos(this.anchor, this.head) };\n Range.prototype.to = function () { return maxPos(this.anchor, this.head) };\n Range.prototype.empty = function () { return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch };\n\n // Take an unsorted, potentially overlapping set of ranges, and\n // build a selection out of it. 'Consumes' ranges array (modifying\n // it).\n function normalizeSelection(cm, ranges, primIndex) {\n var mayTouch = cm && cm.options.selectionsMayTouch;\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n var diff = cmp(prev.to(), cur.from());\n if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n }\n\n function simpleSelection(anchor, head) {\n return new Selection([new Range(anchor, head || anchor)], 0)\n }\n\n // Compute the position of the end of a change (its 'to' property\n // refers to the pre-change end).\n function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n }\n\n // Adjust a position to refer to the post-change position of the\n // same text, or the end of the change if the change covers it.\n function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n }\n\n function computeSelAfterChange(doc, change) {\n var out = [];\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n var range = doc.sel.ranges[i];\n out.push(new Range(adjustForChange(range.anchor, change),\n adjustForChange(range.head, change)));\n }\n return normalizeSelection(doc.cm, out, doc.sel.primIndex)\n }\n\n function offsetPos(pos, old, nw) {\n if (pos.line == old.line)\n { return Pos(nw.line, pos.ch - old.ch + nw.ch) }\n else\n { return Pos(nw.line + (pos.line - old.line), pos.ch) }\n }\n\n // Used by replaceSelections to allow moving the selection to the\n // start or around the replaced test. Hint may be \"start\" or \"around\".\n function computeReplacedSel(doc, changes, hint) {\n var out = [];\n var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;\n for (var i = 0; i < changes.length; i++) {\n var change = changes[i];\n var from = offsetPos(change.from, oldPrev, newPrev);\n var to = offsetPos(changeEnd(change), oldPrev, newPrev);\n oldPrev = change.to;\n newPrev = to;\n if (hint == \"around\") {\n var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;\n out[i] = new Range(inv ? to : from, inv ? from : to);\n } else {\n out[i] = new Range(from, from);\n }\n }\n return new Selection(out, doc.sel.primIndex)\n }\n\n // Used to get the editor into a consistent state again when options change.\n\n function loadMode(cm) {\n cm.doc.mode = getMode(cm.options, cm.doc.modeOption);\n resetModeState(cm);\n }\n\n function resetModeState(cm) {\n cm.doc.iter(function (line) {\n if (line.stateAfter) { line.stateAfter = null; }\n if (line.styles) { line.styles = null; }\n });\n cm.doc.modeFrontier = cm.doc.highlightFrontier = cm.doc.first;\n startWorker(cm, 100);\n cm.state.modeGen++;\n if (cm.curOp) { regChange(cm); }\n }\n\n // DOCUMENT DATA STRUCTURE\n\n // By default, updates that start and end at the beginning of a line\n // are treated specially, in order to make the association of line\n // widgets and marker elements with the text behave more intuitive.\n function isWholeLineUpdate(doc, change) {\n return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == \"\" &&\n (!doc.cm || doc.cm.options.wholeLineUpdateBefore)\n }\n\n // Perform a change on the document data structure.\n function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }\n\n // Call f for all linked documents.\n function linkedDocs(doc, f, sharedHistOnly) {\n function propagate(doc, skip, sharedHist) {\n if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {\n var rel = doc.linked[i];\n if (rel.doc == skip) { continue }\n var shared = sharedHist && rel.sharedHist;\n if (sharedHistOnly && !shared) { continue }\n f(rel.doc, shared);\n propagate(rel.doc, doc, shared);\n } }\n }\n propagate(doc, null, true);\n }\n\n // Attach a document to an editor.\n function attachDoc(cm, doc) {\n if (doc.cm) { throw new Error(\"This document is already in use.\") }\n cm.doc = doc;\n doc.cm = cm;\n estimateLineHeights(cm);\n loadMode(cm);\n setDirectionClass(cm);\n if (!cm.options.lineWrapping) { findMaxLine(cm); }\n cm.options.mode = doc.modeOption;\n regChange(cm);\n }\n\n function setDirectionClass(cm) {\n (cm.doc.direction == \"rtl\" ? addClass : rmClass)(cm.display.lineDiv, \"CodeMirror-rtl\");\n }\n\n function directionChanged(cm) {\n runInOp(cm, function () {\n setDirectionClass(cm);\n regChange(cm);\n });\n }\n\n function History(startGen) {\n // Arrays of change events and selections. Doing something adds an\n // event to done and clears undo. Undoing moves events from done\n // to undone, redoing moves them in the other direction.\n this.done = []; this.undone = [];\n this.undoDepth = Infinity;\n // Used to track when changes can be merged into a single undo\n // event\n this.lastModTime = this.lastSelTime = 0;\n this.lastOp = this.lastSelOp = null;\n this.lastOrigin = this.lastSelOrigin = null;\n // Used by the isClean() method\n this.generation = this.maxGeneration = startGen || 1;\n }\n\n // Create a history change event from an updateDoc-style change\n // object.\n function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }\n\n // Pop all selection events off the end of a history array. Stop at\n // a change event.\n function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) { array.pop(); }\n else { break }\n }\n }\n\n // Find the top change event in the history. Pop off selection\n // events that are in the way.\n function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n }\n\n // Register a change in the history. Merges changes that are within\n // a single operation, or are close together with an origin that\n // allows merging (starting with \"+\") into a single event.\n function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n var last;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n { pushSelectionToHistory(doc.sel, hist.done); }\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) { hist.done.shift(); }\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) { signal(doc, \"historyAdded\"); }\n }\n\n function selectionEventCanBeMerged(doc, origin, prev, sel) {\n var ch = origin.charAt(0);\n return ch == \"*\" ||\n ch == \"+\" &&\n prev.ranges.length == sel.ranges.length &&\n prev.somethingSelected() == sel.somethingSelected() &&\n new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500)\n }\n\n // Called whenever the selection changes, sets the new selection as\n // the pending selection in the history, and pushes the old pending\n // selection into the 'done' array when it was significantly\n // different (in number of selected ranges, emptiness, or time).\n function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n }\n\n function pushSelectionToHistory(sel, dest) {\n var top = lst(dest);\n if (!(top && top.ranges && top.equals(sel)))\n { dest.push(sel); }\n }\n\n // Used to store marked span information in the history.\n function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }\n\n // When un/re-doing restores text containing marked spans, those\n // that have been explicitly cleared should not be restored.\n function removeClearedSpans(spans) {\n if (!spans) { return null }\n var out;\n for (var i = 0; i < spans.length; ++i) {\n if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i); } }\n else if (out) { out.push(spans[i]); }\n }\n return !out ? spans : out.length ? out : null\n }\n\n // Retrieve and filter the old marked spans stored in a change event.\n function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n }\n\n // Used for un/re-doing changes from the history. Combines the\n // result of computing the existing spans with the set of spans that\n // existed in the history (so that deleting around a span and then\n // undoing brings back the span).\n function mergeOldSpans(doc, change) {\n var old = getOldSpans(doc, change);\n var stretched = stretchSpansOverChange(doc, change);\n if (!old) { return stretched }\n if (!stretched) { return old }\n\n for (var i = 0; i < old.length; ++i) {\n var oldCur = old[i], stretchCur = stretched[i];\n if (oldCur && stretchCur) {\n spans: for (var j = 0; j < stretchCur.length; ++j) {\n var span = stretchCur[j];\n for (var k = 0; k < oldCur.length; ++k)\n { if (oldCur[k].marker == span.marker) { continue spans } }\n oldCur.push(span);\n }\n } else if (stretchCur) {\n old[i] = stretchCur;\n }\n }\n return old\n }\n\n // Used both to provide a JSON-safe object in .getHistory, and, when\n // detaching a document, to split the history in two\n function copyHistoryArray(events, newGroup, instantiateSel) {\n var copy = [];\n for (var i = 0; i < events.length; ++i) {\n var event = events[i];\n if (event.ranges) {\n copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n continue\n }\n var changes = event.changes, newChanges = [];\n copy.push({changes: newChanges});\n for (var j = 0; j < changes.length; ++j) {\n var change = changes[j], m = (void 0);\n newChanges.push({from: change.from, to: change.to, text: change.text});\n if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\\d+)$/)) {\n if (indexOf(newGroup, Number(m[1])) > -1) {\n lst(newChanges)[prop] = change[prop];\n delete change[prop];\n }\n } } }\n }\n }\n return copy\n }\n\n // The 'scroll' parameter given to many of these indicated whether\n // the new cursor position should be scrolled into view after\n // modifying the selection.\n\n // If shift is held or the extend flag is set, extends a range to\n // include a given position (and optionally a second position).\n // Otherwise, simply returns the range between the given positions.\n // Used for cursor motion and such.\n function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n }\n\n // Extend the primary selection range, discard the rest.\n function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }\n\n // Extend all selections (pos is an array of selections with length\n // equal the number of selections)\n function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }\n\n // Updates a single range in the selection.\n function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);\n }\n\n // Reset the selection to a single range.\n function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n }\n\n // Give beforeSelectionChange handlers a change to influence a\n // selection update.\n function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n { this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head)); }\n },\n origin: options && options.origin\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj); }\n if (obj.ranges != sel.ranges) { return normalizeSelection(doc.cm, obj.ranges, obj.ranges.length - 1) }\n else { return sel }\n }\n\n function setSelectionReplaceHistory(doc, sel, options) {\n var done = doc.history.done, last = lst(done);\n if (last && last.ranges) {\n done[done.length - 1] = sel;\n setSelectionNoUndo(doc, sel, options);\n } else {\n setSelection(doc, sel, options);\n }\n }\n\n // Set a new selection.\n function setSelection(doc, sel, options) {\n setSelectionNoUndo(doc, sel, options);\n addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\n }\n\n function setSelectionNoUndo(doc, sel, options) {\n if (hasHandler(doc, \"beforeSelectionChange\") || doc.cm && hasHandler(doc.cm, \"beforeSelectionChange\"))\n { sel = filterSelectionChange(doc, sel, options); }\n\n var bias = options && options.bias ||\n (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1);\n setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true));\n\n if (!(options && options.scroll === false) && doc.cm)\n { ensureCursorVisible(doc.cm); }\n }\n\n function setSelectionInner(doc, sel) {\n if (sel.equals(doc.sel)) { return }\n\n doc.sel = sel;\n\n if (doc.cm) {\n doc.cm.curOp.updateInput = 1;\n doc.cm.curOp.selectionChanged = true;\n signalCursorActivity(doc.cm);\n }\n signalLater(doc, \"cursorActivity\", doc);\n }\n\n // Verify that the selection does not partially select any atomic\n // marked ranges.\n function reCheckSelection(doc) {\n setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false));\n }\n\n // Return a selection that does not partially select any atomic\n // ranges.\n function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel\n }\n\n function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {\n var line = getLine(doc, pos.line);\n if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {\n var sp = line.markedSpans[i], m = sp.marker;\n\n // Determine if we should prevent the cursor being placed to the left/right of an atomic marker\n // Historically this was determined using the inclusiveLeft/Right option, but the new way to control it\n // is with selectLeft/Right\n var preventCursorLeft = (\"selectLeft\" in m) ? !m.selectLeft : m.inclusiveLeft;\n var preventCursorRight = (\"selectRight\" in m) ? !m.selectRight : m.inclusiveRight;\n\n if ((sp.from == null || (preventCursorLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&\n (sp.to == null || (preventCursorRight ? sp.to >= pos.ch : sp.to > pos.ch))) {\n if (mayClear) {\n signal(m, \"beforeCursorEnter\");\n if (m.explicitlyCleared) {\n if (!line.markedSpans) { break }\n else {--i; continue}\n }\n }\n if (!m.atomic) { continue }\n\n if (oldPos) {\n var near = m.find(dir < 0 ? 1 : -1), diff = (void 0);\n if (dir < 0 ? preventCursorRight : preventCursorLeft)\n { near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null); }\n if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))\n { return skipAtomicInner(doc, near, pos, dir, mayClear) }\n }\n\n var far = m.find(dir < 0 ? -1 : 1);\n if (dir < 0 ? preventCursorLeft : preventCursorRight)\n { far = movePos(doc, far, dir, far.line == pos.line ? line : null); }\n return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null\n }\n } }\n return pos\n }\n\n // Ensure a given position is not inside an atomic range.\n function skipAtomic(doc, pos, oldPos, bias, mayClear) {\n var dir = bias || 1;\n var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||\n (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||\n skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||\n (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true));\n if (!found) {\n doc.cantEdit = true;\n return Pos(doc.first, 0)\n }\n return found\n }\n\n function movePos(doc, pos, dir, line) {\n if (dir < 0 && pos.ch == 0) {\n if (pos.line > doc.first) { return clipPos(doc, Pos(pos.line - 1)) }\n else { return null }\n } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {\n if (pos.line < doc.first + doc.size - 1) { return Pos(pos.line + 1, 0) }\n else { return null }\n } else {\n return new Pos(pos.line, pos.ch + dir)\n }\n }\n\n function selectAll(cm) {\n cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll);\n }\n\n // UPDATING\n\n // Allow \"beforeChange\" event handlers to influence a change\n function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) {\n if (doc.cm) { doc.cm.curOp.updateInput = 2; }\n return null\n }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n }\n\n // Apply a change to a document, and add it to the document's\n // history, and propagating it to all linked documents.\n function makeChange(doc, change, ignoreReadOnly) {\n if (doc.cm) {\n if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) }\n if (doc.cm.state.suppressEdits) { return }\n }\n\n if (hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\")) {\n change = filterChange(doc, change, true);\n if (!change) { return }\n }\n\n // Possibly split or suppress the update based on the presence\n // of read-only spans in its range.\n var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);\n if (split) {\n for (var i = split.length - 1; i >= 0; --i)\n { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [\"\"] : change.text, origin: change.origin}); }\n } else {\n makeChangeInner(doc, change);\n }\n }\n\n function makeChangeInner(doc, change) {\n if (change.text.length == 1 && change.text[0] == \"\" && cmp(change.from, change.to) == 0) { return }\n var selAfter = computeSelAfterChange(doc, change);\n addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN);\n\n makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change));\n var rebased = [];\n\n linkedDocs(doc, function (doc, sharedHist) {\n if (!sharedHist && indexOf(rebased, doc.history) == -1) {\n rebaseHist(doc.history, change);\n rebased.push(doc.history);\n }\n makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change));\n });\n }\n\n // Revert a change stored in a document's history.\n function makeChangeFromHistory(doc, type, allowSelectionOnly) {\n var suppress = doc.cm && doc.cm.state.suppressEdits;\n if (suppress && !allowSelectionOnly) { return }\n\n var hist = doc.history, event, selAfter = doc.sel;\n var source = type == \"undo\" ? hist.done : hist.undone, dest = type == \"undo\" ? hist.undone : hist.done;\n\n // Verify that there is a useable event (so that ctrl-z won't\n // needlessly clear selection events)\n var i = 0;\n for (; i < source.length; i++) {\n event = source[i];\n if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)\n { break }\n }\n if (i == source.length) { return }\n hist.lastOrigin = hist.lastSelOrigin = null;\n\n for (;;) {\n event = source.pop();\n if (event.ranges) {\n pushSelectionToHistory(event, dest);\n if (allowSelectionOnly && !event.equals(doc.sel)) {\n setSelection(doc, event, {clearRedo: false});\n return\n }\n selAfter = event;\n } else if (suppress) {\n source.push(event);\n return\n } else { break }\n }\n\n // Build up a reverse change object to add to the opposite history\n // stack (redo when undoing, and vice versa).\n var antiChanges = [];\n pushSelectionToHistory(selAfter, dest);\n dest.push({changes: antiChanges, generation: hist.generation});\n hist.generation = event.generation || ++hist.maxGeneration;\n\n var filter = hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\");\n\n var loop = function ( i ) {\n var change = event.changes[i];\n change.origin = type;\n if (filter && !filterChange(doc, change, false)) {\n source.length = 0;\n return {}\n }\n\n antiChanges.push(historyChangeFromChange(doc, change));\n\n var after = i ? computeSelAfterChange(doc, change) : lst(source);\n makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));\n if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}); }\n var rebased = [];\n\n // Propagate to the linked documents\n linkedDocs(doc, function (doc, sharedHist) {\n if (!sharedHist && indexOf(rebased, doc.history) == -1) {\n rebaseHist(doc.history, change);\n rebased.push(doc.history);\n }\n makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));\n });\n };\n\n for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) {\n var returned = loop( i$1 );\n\n if ( returned ) return returned.v;\n }\n }\n\n // Sub-views need their line numbers shifted when text is added\n // above or below them in the parent document.\n function shiftDoc(doc, distance) {\n if (distance == 0) { return }\n doc.first += distance;\n doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range(\n Pos(range.anchor.line + distance, range.anchor.ch),\n Pos(range.head.line + distance, range.head.ch)\n ); }), doc.sel.primIndex);\n if (doc.cm) {\n regChange(doc.cm, doc.first, doc.first - distance, distance);\n for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++)\n { regLineChange(doc.cm, l, \"gutter\"); }\n }\n }\n\n // More lower-level change function, handling only a single document\n // (not linked ones).\n function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n else { updateDoc(doc, change, spans); }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n\n if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0)))\n { doc.cantEdit = false; }\n }\n\n // Handle the interaction of a change to a document with the editor\n // that this document is part of.\n function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n { signalCursorActivity(cm); }\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\n }\n\n retreatFrontier(doc, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n { regChange(cm); }\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n { regLineChange(cm, from.line, \"text\"); }\n else\n { regChange(cm, from.line, to.line + 1, lendiff); }\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\n }\n cm.display.selForContextMenu = null;\n }\n\n function replaceRange(doc, code, from, to, origin) {\n var assign;\n\n if (!to) { to = from; }\n if (cmp(to, from) < 0) { (assign = [to, from], from = assign[0], to = assign[1]); }\n if (typeof code == \"string\") { code = doc.splitLines(code); }\n makeChange(doc, {from: from, to: to, text: code, origin: origin});\n }\n\n // Rebasing/resetting history to deal with externally-sourced changes\n\n function rebaseHistSelSingle(pos, from, to, diff) {\n if (to < pos.line) {\n pos.line += diff;\n } else if (from < pos.line) {\n pos.line = from;\n pos.ch = 0;\n }\n }\n\n // Tries to rebase an array of history events given a change in the\n // document. If the change touches the same lines as the event, the\n // event, and everything 'behind' it, is discarded. If the change is\n // before the event, the event's positions are updated. Uses a\n // copy-on-write scheme for the positions, to avoid having to\n // reallocate them all on every rebase, but also avoid problems with\n // shared position objects being unsafely updated.\n function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n if (sub.ranges) {\n if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n for (var j = 0; j < sub.ranges.length; j++) {\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n }\n continue\n }\n for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {\n var cur = sub.changes[j$1];\n if (to < cur.from.line) {\n cur.from = Pos(cur.from.line + diff, cur.from.ch);\n cur.to = Pos(cur.to.line + diff, cur.to.ch);\n } else if (from <= cur.to.line) {\n ok = false;\n break\n }\n }\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n }\n }\n }\n\n function rebaseHist(hist, change) {\n var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1;\n rebaseHistArray(hist.done, from, to, diff);\n rebaseHistArray(hist.undone, from, to, diff);\n }\n\n // Utility for applying a change to a line by handle or number,\n // returning the number and optionally registering the line as\n // changed.\n function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n }\n\n // The document is represented as a BTree consisting of leaves, with\n // chunk of lines in them, and branches, with up to ten leaves or\n // other branch nodes below them. The top node is always a branch\n // node, and is the document object itself (meaning it has\n // additional methods and properties).\n //\n // All nodes have parent links. The tree is used both to go from\n // line numbers to line objects, and to go from objects to numbers.\n // It also indexes by height, and is used to convert between height\n // and line object, and to find the total height of the document.\n //\n // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html\n\n function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }\n\n LeafChunk.prototype = {\n chunkSize: function() { return this.lines.length },\n\n // Remove the n lines at offset 'at'.\n removeInner: function(at, n) {\n for (var i = at, e = at + n; i < e; ++i) {\n var line = this.lines[i];\n this.height -= line.height;\n cleanUpLine(line);\n signalLater(line, \"delete\");\n }\n this.lines.splice(at, n);\n },\n\n // Helper used to collapse a small branch into a single leaf.\n collapse: function(lines) {\n lines.push.apply(lines, this.lines);\n },\n\n // Insert the given array of lines at offset 'at', count them as\n // having the given height.\n insertInner: function(at, lines, height) {\n this.height += height;\n this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));\n for (var i = 0; i < lines.length; ++i) { lines[i].parent = this; }\n },\n\n // Used to iterate over a part of the tree.\n iterN: function(at, n, op) {\n for (var e = at + n; at < e; ++at)\n { if (op(this.lines[at])) { return true } }\n }\n };\n\n function BranchChunk(children) {\n this.children = children;\n var size = 0, height = 0;\n for (var i = 0; i < children.length; ++i) {\n var ch = children[i];\n size += ch.chunkSize(); height += ch.height;\n ch.parent = this;\n }\n this.size = size;\n this.height = height;\n this.parent = null;\n }\n\n BranchChunk.prototype = {\n chunkSize: function() { return this.size },\n\n removeInner: function(at, n) {\n this.size -= n;\n for (var i = 0; i < this.children.length; ++i) {\n var child = this.children[i], sz = child.chunkSize();\n if (at < sz) {\n var rm = Math.min(n, sz - at), oldHeight = child.height;\n child.removeInner(at, rm);\n this.height -= oldHeight - child.height;\n if (sz == rm) { this.children.splice(i--, 1); child.parent = null; }\n if ((n -= rm) == 0) { break }\n at = 0;\n } else { at -= sz; }\n }\n // If the result is smaller than 25 lines, ensure that it is a\n // single leaf node.\n if (this.size - n < 25 &&\n (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {\n var lines = [];\n this.collapse(lines);\n this.children = [new LeafChunk(lines)];\n this.children[0].parent = this;\n }\n },\n\n collapse: function(lines) {\n for (var i = 0; i < this.children.length; ++i) { this.children[i].collapse(lines); }\n },\n\n insertInner: function(at, lines, height) {\n this.size += lines.length;\n this.height += height;\n for (var i = 0; i < this.children.length; ++i) {\n var child = this.children[i], sz = child.chunkSize();\n if (at <= sz) {\n child.insertInner(at, lines, height);\n if (child.lines && child.lines.length > 50) {\n // To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced.\n // Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest.\n var remaining = child.lines.length % 25 + 25;\n for (var pos = remaining; pos < child.lines.length;) {\n var leaf = new LeafChunk(child.lines.slice(pos, pos += 25));\n child.height -= leaf.height;\n this.children.splice(++i, 0, leaf);\n leaf.parent = this;\n }\n child.lines = child.lines.slice(0, remaining);\n this.maybeSpill();\n }\n break\n }\n at -= sz;\n }\n },\n\n // When a node has grown, check whether it should be split.\n maybeSpill: function() {\n if (this.children.length <= 10) { return }\n var me = this;\n do {\n var spilled = me.children.splice(me.children.length - 5, 5);\n var sibling = new BranchChunk(spilled);\n if (!me.parent) { // Become the parent node\n var copy = new BranchChunk(me.children);\n copy.parent = me;\n me.children = [copy, sibling];\n me = copy;\n } else {\n me.size -= sibling.size;\n me.height -= sibling.height;\n var myIndex = indexOf(me.parent.children, me);\n me.parent.children.splice(myIndex + 1, 0, sibling);\n }\n sibling.parent = me.parent;\n } while (me.children.length > 10)\n me.parent.maybeSpill();\n },\n\n iterN: function(at, n, op) {\n for (var i = 0; i < this.children.length; ++i) {\n var child = this.children[i], sz = child.chunkSize();\n if (at < sz) {\n var used = Math.min(n, sz - at);\n if (child.iterN(at, used, op)) { return true }\n if ((n -= used) == 0) { break }\n at = 0;\n } else { at -= sz; }\n }\n }\n };\n\n // Line widgets are block elements displayed above or below a line.\n\n var LineWidget = function(doc, node, options) {\n if (options) { for (var opt in options) { if (options.hasOwnProperty(opt))\n { this[opt] = options[opt]; } } }\n this.doc = doc;\n this.node = node;\n };\n\n LineWidget.prototype.clear = function () {\n var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line);\n if (no == null || !ws) { return }\n for (var i = 0; i < ws.length; ++i) { if (ws[i] == this) { ws.splice(i--, 1); } }\n if (!ws.length) { line.widgets = null; }\n var height = widgetHeight(this);\n updateLineHeight(line, Math.max(0, line.height - height));\n if (cm) {\n runInOp(cm, function () {\n adjustScrollWhenAboveVisible(cm, line, -height);\n regLineChange(cm, no, \"widget\");\n });\n signalLater(cm, \"lineWidgetCleared\", cm, this, no);\n }\n };\n\n LineWidget.prototype.changed = function () {\n var this$1 = this;\n\n var oldH = this.height, cm = this.doc.cm, line = this.line;\n this.height = null;\n var diff = widgetHeight(this) - oldH;\n if (!diff) { return }\n if (!lineIsHidden(this.doc, line)) { updateLineHeight(line, line.height + diff); }\n if (cm) {\n runInOp(cm, function () {\n cm.curOp.forceUpdate = true;\n adjustScrollWhenAboveVisible(cm, line, diff);\n signalLater(cm, \"lineWidgetChanged\", cm, this$1, lineNo(line));\n });\n }\n };\n eventMixin(LineWidget);\n\n function adjustScrollWhenAboveVisible(cm, line, diff) {\n if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop))\n { addToScrollTop(cm, diff); }\n }\n\n function addLineWidget(doc, handle, node, options) {\n var widget = new LineWidget(doc, node, options);\n var cm = doc.cm;\n if (cm && widget.noHScroll) { cm.display.alignWidgets = true; }\n changeLine(doc, handle, \"widget\", function (line) {\n var widgets = line.widgets || (line.widgets = []);\n if (widget.insertAt == null) { widgets.push(widget); }\n else { widgets.splice(Math.min(widgets.length, Math.max(0, widget.insertAt)), 0, widget); }\n widget.line = line;\n if (cm && !lineIsHidden(doc, line)) {\n var aboveVisible = heightAtLine(line) < doc.scrollTop;\n updateLineHeight(line, line.height + widgetHeight(widget));\n if (aboveVisible) { addToScrollTop(cm, widget.height); }\n cm.curOp.forceUpdate = true;\n }\n return true\n });\n if (cm) { signalLater(cm, \"lineWidgetAdded\", cm, widget, typeof handle == \"number\" ? handle : lineNo(handle)); }\n return widget\n }\n\n // TEXTMARKERS\n\n // Created with markText and setBookmark methods. A TextMarker is a\n // handle that can be used to clear or find a marked position in the\n // document. Line objects hold arrays (markedSpans) containing\n // {from, to, marker} object pointing to such marker objects, and\n // indicating that such a marker is present on that line. Multiple\n // lines may point to the same marker when it spans across lines.\n // The spans will have null for their from/to properties when the\n // marker continues beyond the start/end of the line. Markers have\n // links back to the lines they currently touch.\n\n // Collapsed markers have unique ids, in order to be able to order\n // them, which is needed for uniquely determining an outer marker\n // when they overlap (they may nest, but not partially overlap).\n var nextMarkerId = 0;\n\n var TextMarker = function(doc, type) {\n this.lines = [];\n this.type = type;\n this.doc = doc;\n this.id = ++nextMarkerId;\n };\n\n // Clear the marker.\n TextMarker.prototype.clear = function () {\n if (this.explicitlyCleared) { return }\n var cm = this.doc.cm, withOp = cm && !cm.curOp;\n if (withOp) { startOperation(cm); }\n if (hasHandler(this, \"clear\")) {\n var found = this.find();\n if (found) { signalLater(this, \"clear\", found.from, found.to); }\n }\n var min = null, max = null;\n for (var i = 0; i < this.lines.length; ++i) {\n var line = this.lines[i];\n var span = getMarkedSpanFor(line.markedSpans, this);\n if (cm && !this.collapsed) { regLineChange(cm, lineNo(line), \"text\"); }\n else if (cm) {\n if (span.to != null) { max = lineNo(line); }\n if (span.from != null) { min = lineNo(line); }\n }\n line.markedSpans = removeMarkedSpan(line.markedSpans, span);\n if (span.from == null && this.collapsed && !lineIsHidden(this.doc, line) && cm)\n { updateLineHeight(line, textHeight(cm.display)); }\n }\n if (cm && this.collapsed && !cm.options.lineWrapping) { for (var i$1 = 0; i$1 < this.lines.length; ++i$1) {\n var visual = visualLine(this.lines[i$1]), len = lineLength(visual);\n if (len > cm.display.maxLineLength) {\n cm.display.maxLine = visual;\n cm.display.maxLineLength = len;\n cm.display.maxLineChanged = true;\n }\n } }\n\n if (min != null && cm && this.collapsed) { regChange(cm, min, max + 1); }\n this.lines.length = 0;\n this.explicitlyCleared = true;\n if (this.atomic && this.doc.cantEdit) {\n this.doc.cantEdit = false;\n if (cm) { reCheckSelection(cm.doc); }\n }\n if (cm) { signalLater(cm, \"markerCleared\", cm, this, min, max); }\n if (withOp) { endOperation(cm); }\n if (this.parent) { this.parent.clear(); }\n };\n\n // Find the position of the marker in the document. Returns a {from,\n // to} object by default. Side can be passed to get a specific side\n // -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the\n // Pos objects returned contain a line object, rather than a line\n // number (used to prevent looking up the same line twice).\n TextMarker.prototype.find = function (side, lineObj) {\n if (side == null && this.type == \"bookmark\") { side = 1; }\n var from, to;\n for (var i = 0; i < this.lines.length; ++i) {\n var line = this.lines[i];\n var span = getMarkedSpanFor(line.markedSpans, this);\n if (span.from != null) {\n from = Pos(lineObj ? line : lineNo(line), span.from);\n if (side == -1) { return from }\n }\n if (span.to != null) {\n to = Pos(lineObj ? line : lineNo(line), span.to);\n if (side == 1) { return to }\n }\n }\n return from && {from: from, to: to}\n };\n\n // Signals that the marker's widget changed, and surrounding layout\n // should be recomputed.\n TextMarker.prototype.changed = function () {\n var this$1 = this;\n\n var pos = this.find(-1, true), widget = this, cm = this.doc.cm;\n if (!pos || !cm) { return }\n runInOp(cm, function () {\n var line = pos.line, lineN = lineNo(pos.line);\n var view = findViewForLine(cm, lineN);\n if (view) {\n clearLineMeasurementCacheFor(view);\n cm.curOp.selectionChanged = cm.curOp.forceUpdate = true;\n }\n cm.curOp.updateMaxLine = true;\n if (!lineIsHidden(widget.doc, line) && widget.height != null) {\n var oldHeight = widget.height;\n widget.height = null;\n var dHeight = widgetHeight(widget) - oldHeight;\n if (dHeight)\n { updateLineHeight(line, line.height + dHeight); }\n }\n signalLater(cm, \"markerChanged\", cm, this$1);\n });\n };\n\n TextMarker.prototype.attachLine = function (line) {\n if (!this.lines.length && this.doc.cm) {\n var op = this.doc.cm.curOp;\n if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)\n { (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this); }\n }\n this.lines.push(line);\n };\n\n TextMarker.prototype.detachLine = function (line) {\n this.lines.splice(indexOf(this.lines, line), 1);\n if (!this.lines.length && this.doc.cm) {\n var op = this.doc.cm.curOp\n ;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this);\n }\n };\n eventMixin(TextMarker);\n\n // Create a marker, wire it up to the right lines, and\n function markText(doc, from, to, options, type) {\n // Shared markers (across linked documents) are handled separately\n // (markTextShared will call out to this again, once per\n // document).\n if (options && options.shared) { return markTextShared(doc, from, to, options, type) }\n // Ensure we are in an operation.\n if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, markText)(doc, from, to, options, type) }\n\n var marker = new TextMarker(doc, type), diff = cmp(from, to);\n if (options) { copyObj(options, marker, false); }\n // Don't connect empty markers unless clearWhenEmpty is false\n if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)\n { return marker }\n if (marker.replacedWith) {\n // Showing up as a widget implies collapsed (widget replaces text)\n marker.collapsed = true;\n marker.widgetNode = eltP(\"span\", [marker.replacedWith], \"CodeMirror-widget\");\n if (!options.handleMouseEvents) { marker.widgetNode.setAttribute(\"cm-ignore-events\", \"true\"); }\n if (options.insertLeft) { marker.widgetNode.insertLeft = true; }\n }\n if (marker.collapsed) {\n if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||\n from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))\n { throw new Error(\"Inserting collapsed marker partially overlapping an existing one\") }\n seeCollapsedSpans();\n }\n\n if (marker.addToHistory)\n { addChangeToHistory(doc, {from: from, to: to, origin: \"markText\"}, doc.sel, NaN); }\n\n var curLine = from.line, cm = doc.cm, updateMaxLine;\n doc.iter(curLine, to.line + 1, function (line) {\n if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine)\n { updateMaxLine = true; }\n if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0); }\n addMarkedSpan(line, new MarkedSpan(marker,\n curLine == from.line ? from.ch : null,\n curLine == to.line ? to.ch : null));\n ++curLine;\n });\n // lineIsHidden depends on the presence of the spans, so needs a second pass\n if (marker.collapsed) { doc.iter(from.line, to.line + 1, function (line) {\n if (lineIsHidden(doc, line)) { updateLineHeight(line, 0); }\n }); }\n\n if (marker.clearOnEnter) { on(marker, \"beforeCursorEnter\", function () { return marker.clear(); }); }\n\n if (marker.readOnly) {\n seeReadOnlySpans();\n if (doc.history.done.length || doc.history.undone.length)\n { doc.clearHistory(); }\n }\n if (marker.collapsed) {\n marker.id = ++nextMarkerId;\n marker.atomic = true;\n }\n if (cm) {\n // Sync editor state\n if (updateMaxLine) { cm.curOp.updateMaxLine = true; }\n if (marker.collapsed)\n { regChange(cm, from.line, to.line + 1); }\n else if (marker.className || marker.startStyle || marker.endStyle || marker.css ||\n marker.attributes || marker.title)\n { for (var i = from.line; i <= to.line; i++) { regLineChange(cm, i, \"text\"); } }\n if (marker.atomic) { reCheckSelection(cm.doc); }\n signalLater(cm, \"markerAdded\", cm, marker);\n }\n return marker\n }\n\n // SHARED TEXTMARKERS\n\n // A shared marker spans multiple linked documents. It is\n // implemented as a meta-marker-object controlling multiple normal\n // markers.\n var SharedTextMarker = function(markers, primary) {\n this.markers = markers;\n this.primary = primary;\n for (var i = 0; i < markers.length; ++i)\n { markers[i].parent = this; }\n };\n\n SharedTextMarker.prototype.clear = function () {\n if (this.explicitlyCleared) { return }\n this.explicitlyCleared = true;\n for (var i = 0; i < this.markers.length; ++i)\n { this.markers[i].clear(); }\n signalLater(this, \"clear\");\n };\n\n SharedTextMarker.prototype.find = function (side, lineObj) {\n return this.primary.find(side, lineObj)\n };\n eventMixin(SharedTextMarker);\n\n function markTextShared(doc, from, to, options, type) {\n options = copyObj(options);\n options.shared = false;\n var markers = [markText(doc, from, to, options, type)], primary = markers[0];\n var widget = options.widgetNode;\n linkedDocs(doc, function (doc) {\n if (widget) { options.widgetNode = widget.cloneNode(true); }\n markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type));\n for (var i = 0; i < doc.linked.length; ++i)\n { if (doc.linked[i].isParent) { return } }\n primary = lst(markers);\n });\n return new SharedTextMarker(markers, primary)\n }\n\n function findSharedMarkers(doc) {\n return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), function (m) { return m.parent; })\n }\n\n function copySharedMarkers(doc, markers) {\n for (var i = 0; i < markers.length; i++) {\n var marker = markers[i], pos = marker.find();\n var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to);\n if (cmp(mFrom, mTo)) {\n var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type);\n marker.markers.push(subMark);\n subMark.parent = marker;\n }\n }\n }\n\n function detachSharedMarkers(markers) {\n var loop = function ( i ) {\n var marker = markers[i], linked = [marker.primary.doc];\n linkedDocs(marker.primary.doc, function (d) { return linked.push(d); });\n for (var j = 0; j < marker.markers.length; j++) {\n var subMarker = marker.markers[j];\n if (indexOf(linked, subMarker.doc) == -1) {\n subMarker.parent = null;\n marker.markers.splice(j--, 1);\n }\n }\n };\n\n for (var i = 0; i < markers.length; i++) loop( i );\n }\n\n var nextDocId = 0;\n var Doc = function(text, mode, firstLine, lineSep, direction) {\n if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep, direction) }\n if (firstLine == null) { firstLine = 0; }\n\n BranchChunk.call(this, [new LeafChunk([new Line(\"\", null)])]);\n this.first = firstLine;\n this.scrollTop = this.scrollLeft = 0;\n this.cantEdit = false;\n this.cleanGeneration = 1;\n this.modeFrontier = this.highlightFrontier = firstLine;\n var start = Pos(firstLine, 0);\n this.sel = simpleSelection(start);\n this.history = new History(null);\n this.id = ++nextDocId;\n this.modeOption = mode;\n this.lineSep = lineSep;\n this.direction = (direction == \"rtl\") ? \"rtl\" : \"ltr\";\n this.extend = false;\n\n if (typeof text == \"string\") { text = this.splitLines(text); }\n updateDoc(this, {from: start, to: start, text: text});\n setSelection(this, simpleSelection(start), sel_dontScroll);\n };\n\n Doc.prototype = createObj(BranchChunk.prototype, {\n constructor: Doc,\n // Iterate over the document. Supports two forms -- with only one\n // argument, it calls that for each line in the document. With\n // three, it iterates over the range given by the first two (with\n // the second being non-inclusive).\n iter: function(from, to, op) {\n if (op) { this.iterN(from - this.first, to - from, op); }\n else { this.iterN(this.first, this.first + this.size, from); }\n },\n\n // Non-public interface for adding and removing lines.\n insert: function(at, lines) {\n var height = 0;\n for (var i = 0; i < lines.length; ++i) { height += lines[i].height; }\n this.insertInner(at - this.first, lines, height);\n },\n remove: function(at, n) { this.removeInner(at - this.first, n); },\n\n // From here, the methods are part of the public interface. Most\n // are also available from CodeMirror (editor) instances.\n\n getValue: function(lineSep) {\n var lines = getLines(this, this.first, this.first + this.size);\n if (lineSep === false) { return lines }\n return lines.join(lineSep || this.lineSeparator())\n },\n setValue: docMethodOp(function(code) {\n var top = Pos(this.first, 0), last = this.first + this.size - 1;\n makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),\n text: this.splitLines(code), origin: \"setValue\", full: true}, true);\n if (this.cm) { scrollToCoords(this.cm, 0, 0); }\n setSelection(this, simpleSelection(top), sel_dontScroll);\n }),\n replaceRange: function(code, from, to, origin) {\n from = clipPos(this, from);\n to = to ? clipPos(this, to) : from;\n replaceRange(this, code, from, to, origin);\n },\n getRange: function(from, to, lineSep) {\n var lines = getBetween(this, clipPos(this, from), clipPos(this, to));\n if (lineSep === false) { return lines }\n return lines.join(lineSep || this.lineSeparator())\n },\n\n getLine: function(line) {var l = this.getLineHandle(line); return l && l.text},\n\n getLineHandle: function(line) {if (isLine(this, line)) { return getLine(this, line) }},\n getLineNumber: function(line) {return lineNo(line)},\n\n getLineHandleVisualStart: function(line) {\n if (typeof line == \"number\") { line = getLine(this, line); }\n return visualLine(line)\n },\n\n lineCount: function() {return this.size},\n firstLine: function() {return this.first},\n lastLine: function() {return this.first + this.size - 1},\n\n clipPos: function(pos) {return clipPos(this, pos)},\n\n getCursor: function(start) {\n var range = this.sel.primary(), pos;\n if (start == null || start == \"head\") { pos = range.head; }\n else if (start == \"anchor\") { pos = range.anchor; }\n else if (start == \"end\" || start == \"to\" || start === false) { pos = range.to(); }\n else { pos = range.from(); }\n return pos\n },\n listSelections: function() { return this.sel.ranges },\n somethingSelected: function() {return this.sel.somethingSelected()},\n\n setCursor: docMethodOp(function(line, ch, options) {\n setSimpleSelection(this, clipPos(this, typeof line == \"number\" ? Pos(line, ch || 0) : line), null, options);\n }),\n setSelection: docMethodOp(function(anchor, head, options) {\n setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options);\n }),\n extendSelection: docMethodOp(function(head, other, options) {\n extendSelection(this, clipPos(this, head), other && clipPos(this, other), options);\n }),\n extendSelections: docMethodOp(function(heads, options) {\n extendSelections(this, clipPosArray(this, heads), options);\n }),\n extendSelectionsBy: docMethodOp(function(f, options) {\n var heads = map(this.sel.ranges, f);\n extendSelections(this, clipPosArray(this, heads), options);\n }),\n setSelections: docMethodOp(function(ranges, primary, options) {\n if (!ranges.length) { return }\n var out = [];\n for (var i = 0; i < ranges.length; i++)\n { out[i] = new Range(clipPos(this, ranges[i].anchor),\n clipPos(this, ranges[i].head)); }\n if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex); }\n setSelection(this, normalizeSelection(this.cm, out, primary), options);\n }),\n addSelection: docMethodOp(function(anchor, head, options) {\n var ranges = this.sel.ranges.slice(0);\n ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)));\n setSelection(this, normalizeSelection(this.cm, ranges, ranges.length - 1), options);\n }),\n\n getSelection: function(lineSep) {\n var ranges = this.sel.ranges, lines;\n for (var i = 0; i < ranges.length; i++) {\n var sel = getBetween(this, ranges[i].from(), ranges[i].to());\n lines = lines ? lines.concat(sel) : sel;\n }\n if (lineSep === false) { return lines }\n else { return lines.join(lineSep || this.lineSeparator()) }\n },\n getSelections: function(lineSep) {\n var parts = [], ranges = this.sel.ranges;\n for (var i = 0; i < ranges.length; i++) {\n var sel = getBetween(this, ranges[i].from(), ranges[i].to());\n if (lineSep !== false) { sel = sel.join(lineSep || this.lineSeparator()); }\n parts[i] = sel;\n }\n return parts\n },\n replaceSelection: function(code, collapse, origin) {\n var dup = [];\n for (var i = 0; i < this.sel.ranges.length; i++)\n { dup[i] = code; }\n this.replaceSelections(dup, collapse, origin || \"+input\");\n },\n replaceSelections: docMethodOp(function(code, collapse, origin) {\n var changes = [], sel = this.sel;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n changes[i] = {from: range.from(), to: range.to(), text: this.splitLines(code[i]), origin: origin};\n }\n var newSel = collapse && collapse != \"end\" && computeReplacedSel(this, changes, collapse);\n for (var i$1 = changes.length - 1; i$1 >= 0; i$1--)\n { makeChange(this, changes[i$1]); }\n if (newSel) { setSelectionReplaceHistory(this, newSel); }\n else if (this.cm) { ensureCursorVisible(this.cm); }\n }),\n undo: docMethodOp(function() {makeChangeFromHistory(this, \"undo\");}),\n redo: docMethodOp(function() {makeChangeFromHistory(this, \"redo\");}),\n undoSelection: docMethodOp(function() {makeChangeFromHistory(this, \"undo\", true);}),\n redoSelection: docMethodOp(function() {makeChangeFromHistory(this, \"redo\", true);}),\n\n setExtending: function(val) {this.extend = val;},\n getExtending: function() {return this.extend},\n\n historySize: function() {\n var hist = this.history, done = 0, undone = 0;\n for (var i = 0; i < hist.done.length; i++) { if (!hist.done[i].ranges) { ++done; } }\n for (var i$1 = 0; i$1 < hist.undone.length; i$1++) { if (!hist.undone[i$1].ranges) { ++undone; } }\n return {undo: done, redo: undone}\n },\n clearHistory: function() {\n var this$1 = this;\n\n this.history = new History(this.history.maxGeneration);\n linkedDocs(this, function (doc) { return doc.history = this$1.history; }, true);\n },\n\n markClean: function() {\n this.cleanGeneration = this.changeGeneration(true);\n },\n changeGeneration: function(forceSplit) {\n if (forceSplit)\n { this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null; }\n return this.history.generation\n },\n isClean: function (gen) {\n return this.history.generation == (gen || this.cleanGeneration)\n },\n\n getHistory: function() {\n return {done: copyHistoryArray(this.history.done),\n undone: copyHistoryArray(this.history.undone)}\n },\n setHistory: function(histData) {\n var hist = this.history = new History(this.history.maxGeneration);\n hist.done = copyHistoryArray(histData.done.slice(0), null, true);\n hist.undone = copyHistoryArray(histData.undone.slice(0), null, true);\n },\n\n setGutterMarker: docMethodOp(function(line, gutterID, value) {\n return changeLine(this, line, \"gutter\", function (line) {\n var markers = line.gutterMarkers || (line.gutterMarkers = {});\n markers[gutterID] = value;\n if (!value && isEmpty(markers)) { line.gutterMarkers = null; }\n return true\n })\n }),\n\n clearGutter: docMethodOp(function(gutterID) {\n var this$1 = this;\n\n this.iter(function (line) {\n if (line.gutterMarkers && line.gutterMarkers[gutterID]) {\n changeLine(this$1, line, \"gutter\", function () {\n line.gutterMarkers[gutterID] = null;\n if (isEmpty(line.gutterMarkers)) { line.gutterMarkers = null; }\n return true\n });\n }\n });\n }),\n\n lineInfo: function(line) {\n var n;\n if (typeof line == \"number\") {\n if (!isLine(this, line)) { return null }\n n = line;\n line = getLine(this, line);\n if (!line) { return null }\n } else {\n n = lineNo(line);\n if (n == null) { return null }\n }\n return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,\n textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,\n widgets: line.widgets}\n },\n\n addLineClass: docMethodOp(function(handle, where, cls) {\n return changeLine(this, handle, where == \"gutter\" ? \"gutter\" : \"class\", function (line) {\n var prop = where == \"text\" ? \"textClass\"\n : where == \"background\" ? \"bgClass\"\n : where == \"gutter\" ? \"gutterClass\" : \"wrapClass\";\n if (!line[prop]) { line[prop] = cls; }\n else if (classTest(cls).test(line[prop])) { return false }\n else { line[prop] += \" \" + cls; }\n return true\n })\n }),\n removeLineClass: docMethodOp(function(handle, where, cls) {\n return changeLine(this, handle, where == \"gutter\" ? \"gutter\" : \"class\", function (line) {\n var prop = where == \"text\" ? \"textClass\"\n : where == \"background\" ? \"bgClass\"\n : where == \"gutter\" ? \"gutterClass\" : \"wrapClass\";\n var cur = line[prop];\n if (!cur) { return false }\n else if (cls == null) { line[prop] = null; }\n else {\n var found = cur.match(classTest(cls));\n if (!found) { return false }\n var end = found.index + found[0].length;\n line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? \"\" : \" \") + cur.slice(end) || null;\n }\n return true\n })\n }),\n\n addLineWidget: docMethodOp(function(handle, node, options) {\n return addLineWidget(this, handle, node, options)\n }),\n removeLineWidget: function(widget) { widget.clear(); },\n\n markText: function(from, to, options) {\n return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || \"range\")\n },\n setBookmark: function(pos, options) {\n var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options),\n insertLeft: options && options.insertLeft,\n clearWhenEmpty: false, shared: options && options.shared,\n handleMouseEvents: options && options.handleMouseEvents};\n pos = clipPos(this, pos);\n return markText(this, pos, pos, realOpts, \"bookmark\")\n },\n findMarksAt: function(pos) {\n pos = clipPos(this, pos);\n var markers = [], spans = getLine(this, pos.line).markedSpans;\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if ((span.from == null || span.from <= pos.ch) &&\n (span.to == null || span.to >= pos.ch))\n { markers.push(span.marker.parent || span.marker); }\n } }\n return markers\n },\n findMarks: function(from, to, filter) {\n from = clipPos(this, from); to = clipPos(this, to);\n var found = [], lineNo = from.line;\n this.iter(from.line, to.line + 1, function (line) {\n var spans = line.markedSpans;\n if (spans) { for (var i = 0; i < spans.length; i++) {\n var span = spans[i];\n if (!(span.to != null && lineNo == from.line && from.ch >= span.to ||\n span.from == null && lineNo != from.line ||\n span.from != null && lineNo == to.line && span.from >= to.ch) &&\n (!filter || filter(span.marker)))\n { found.push(span.marker.parent || span.marker); }\n } }\n ++lineNo;\n });\n return found\n },\n getAllMarks: function() {\n var markers = [];\n this.iter(function (line) {\n var sps = line.markedSpans;\n if (sps) { for (var i = 0; i < sps.length; ++i)\n { if (sps[i].from != null) { markers.push(sps[i].marker); } } }\n });\n return markers\n },\n\n posFromIndex: function(off) {\n var ch, lineNo = this.first, sepSize = this.lineSeparator().length;\n this.iter(function (line) {\n var sz = line.text.length + sepSize;\n if (sz > off) { ch = off; return true }\n off -= sz;\n ++lineNo;\n });\n return clipPos(this, Pos(lineNo, ch))\n },\n indexFromPos: function (coords) {\n coords = clipPos(this, coords);\n var index = coords.ch;\n if (coords.line < this.first || coords.ch < 0) { return 0 }\n var sepSize = this.lineSeparator().length;\n this.iter(this.first, coords.line, function (line) { // iter aborts when callback returns a truthy value\n index += line.text.length + sepSize;\n });\n return index\n },\n\n copy: function(copyHistory) {\n var doc = new Doc(getLines(this, this.first, this.first + this.size),\n this.modeOption, this.first, this.lineSep, this.direction);\n doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft;\n doc.sel = this.sel;\n doc.extend = false;\n if (copyHistory) {\n doc.history.undoDepth = this.history.undoDepth;\n doc.setHistory(this.getHistory());\n }\n return doc\n },\n\n linkedDoc: function(options) {\n if (!options) { options = {}; }\n var from = this.first, to = this.first + this.size;\n if (options.from != null && options.from > from) { from = options.from; }\n if (options.to != null && options.to < to) { to = options.to; }\n var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep, this.direction);\n if (options.sharedHist) { copy.history = this.history\n ; }(this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist});\n copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}];\n copySharedMarkers(copy, findSharedMarkers(this));\n return copy\n },\n unlinkDoc: function(other) {\n if (other instanceof CodeMirror) { other = other.doc; }\n if (this.linked) { for (var i = 0; i < this.linked.length; ++i) {\n var link = this.linked[i];\n if (link.doc != other) { continue }\n this.linked.splice(i, 1);\n other.unlinkDoc(this);\n detachSharedMarkers(findSharedMarkers(this));\n break\n } }\n // If the histories were shared, split them again\n if (other.history == this.history) {\n var splitIds = [other.id];\n linkedDocs(other, function (doc) { return splitIds.push(doc.id); }, true);\n other.history = new History(null);\n other.history.done = copyHistoryArray(this.history.done, splitIds);\n other.history.undone = copyHistoryArray(this.history.undone, splitIds);\n }\n },\n iterLinkedDocs: function(f) {linkedDocs(this, f);},\n\n getMode: function() {return this.mode},\n getEditor: function() {return this.cm},\n\n splitLines: function(str) {\n if (this.lineSep) { return str.split(this.lineSep) }\n return splitLinesAuto(str)\n },\n lineSeparator: function() { return this.lineSep || \"\\n\" },\n\n setDirection: docMethodOp(function (dir) {\n if (dir != \"rtl\") { dir = \"ltr\"; }\n if (dir == this.direction) { return }\n this.direction = dir;\n this.iter(function (line) { return line.order = null; });\n if (this.cm) { directionChanged(this.cm); }\n })\n });\n\n // Public alias.\n Doc.prototype.eachLine = Doc.prototype.iter;\n\n // Kludge to work around strange IE behavior where it'll sometimes\n // re-fire a series of drag-related events right after the drop (#1551)\n var lastDrop = 0;\n\n function onDrop(e) {\n var cm = this;\n clearDragCursor(cm);\n if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))\n { return }\n e_preventDefault(e);\n if (ie) { lastDrop = +new Date; }\n var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;\n if (!pos || cm.isReadOnly()) { return }\n // Might be a file drop, in which case we simply extract the text\n // and insert it.\n if (files && files.length && window.FileReader && window.File) {\n var n = files.length, text = Array(n), read = 0;\n var markAsReadAndPasteIfAllFilesAreRead = function () {\n if (++read == n) {\n operation(cm, function () {\n pos = clipPos(cm.doc, pos);\n var change = {from: pos, to: pos,\n text: cm.doc.splitLines(\n text.filter(function (t) { return t != null; }).join(cm.doc.lineSeparator())),\n origin: \"paste\"};\n makeChange(cm.doc, change);\n setSelectionReplaceHistory(cm.doc, simpleSelection(clipPos(cm.doc, pos), clipPos(cm.doc, changeEnd(change))));\n })();\n }\n };\n var readTextFromFile = function (file, i) {\n if (cm.options.allowDropFileTypes &&\n indexOf(cm.options.allowDropFileTypes, file.type) == -1) {\n markAsReadAndPasteIfAllFilesAreRead();\n return\n }\n var reader = new FileReader;\n reader.onerror = function () { return markAsReadAndPasteIfAllFilesAreRead(); };\n reader.onload = function () {\n var content = reader.result;\n if (/[\\x00-\\x08\\x0e-\\x1f]{2}/.test(content)) {\n markAsReadAndPasteIfAllFilesAreRead();\n return\n }\n text[i] = content;\n markAsReadAndPasteIfAllFilesAreRead();\n };\n reader.readAsText(file);\n };\n for (var i = 0; i < files.length; i++) { readTextFromFile(files[i], i); }\n } else { // Normal drop\n // Don't do a replace if the drop happened inside of the selected text.\n if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {\n cm.state.draggingText(e);\n // Ensure the editor is re-focused\n setTimeout(function () { return cm.display.input.focus(); }, 20);\n return\n }\n try {\n var text$1 = e.dataTransfer.getData(\"Text\");\n if (text$1) {\n var selected;\n if (cm.state.draggingText && !cm.state.draggingText.copy)\n { selected = cm.listSelections(); }\n setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));\n if (selected) { for (var i$1 = 0; i$1 < selected.length; ++i$1)\n { replaceRange(cm.doc, \"\", selected[i$1].anchor, selected[i$1].head, \"drag\"); } }\n cm.replaceSelection(text$1, \"around\", \"paste\");\n cm.display.input.focus();\n }\n }\n catch(e$1){}\n }\n }\n\n function onDragStart(cm, e) {\n if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return }\n if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) { return }\n\n e.dataTransfer.setData(\"Text\", cm.getSelection());\n e.dataTransfer.effectAllowed = \"copyMove\";\n\n // Use dummy image instead of default browsers image.\n // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.\n if (e.dataTransfer.setDragImage && !safari) {\n var img = elt(\"img\", null, null, \"position: fixed; left: 0; top: 0;\");\n img.src = \"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\";\n if (presto) {\n img.width = img.height = 1;\n cm.display.wrapper.appendChild(img);\n // Force a relayout, or Opera won't use our image for some obscure reason\n img._top = img.offsetTop;\n }\n e.dataTransfer.setDragImage(img, 0, 0);\n if (presto) { img.parentNode.removeChild(img); }\n }\n }\n\n function onDragOver(cm, e) {\n var pos = posFromMouse(cm, e);\n if (!pos) { return }\n var frag = document.createDocumentFragment();\n drawSelectionCursor(cm, pos, frag);\n if (!cm.display.dragCursor) {\n cm.display.dragCursor = elt(\"div\", null, \"CodeMirror-cursors CodeMirror-dragcursors\");\n cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv);\n }\n removeChildrenAndAdd(cm.display.dragCursor, frag);\n }\n\n function clearDragCursor(cm) {\n if (cm.display.dragCursor) {\n cm.display.lineSpace.removeChild(cm.display.dragCursor);\n cm.display.dragCursor = null;\n }\n }\n\n // These must be handled carefully, because naively registering a\n // handler for each editor will cause the editors to never be\n // garbage collected.\n\n function forEachCodeMirror(f) {\n if (!document.getElementsByClassName) { return }\n var byClass = document.getElementsByClassName(\"CodeMirror\"), editors = [];\n for (var i = 0; i < byClass.length; i++) {\n var cm = byClass[i].CodeMirror;\n if (cm) { editors.push(cm); }\n }\n if (editors.length) { editors[0].operation(function () {\n for (var i = 0; i < editors.length; i++) { f(editors[i]); }\n }); }\n }\n\n var globalsRegistered = false;\n function ensureGlobalHandlers() {\n if (globalsRegistered) { return }\n registerGlobalHandlers();\n globalsRegistered = true;\n }\n function registerGlobalHandlers() {\n // When the window resizes, we need to refresh active editors.\n var resizeTimer;\n on(window, \"resize\", function () {\n if (resizeTimer == null) { resizeTimer = setTimeout(function () {\n resizeTimer = null;\n forEachCodeMirror(onResize);\n }, 100); }\n });\n // When the window loses focus, we want to show the editor as blurred\n on(window, \"blur\", function () { return forEachCodeMirror(onBlur); });\n }\n // Called when the window resizes\n function onResize(cm) {\n var d = cm.display;\n // Might be a text scaling operation, clear size caches.\n d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;\n d.scrollbarsClipped = false;\n cm.setSize();\n }\n\n var keyNames = {\n 3: \"Pause\", 8: \"Backspace\", 9: \"Tab\", 13: \"Enter\", 16: \"Shift\", 17: \"Ctrl\", 18: \"Alt\",\n 19: \"Pause\", 20: \"CapsLock\", 27: \"Esc\", 32: \"Space\", 33: \"PageUp\", 34: \"PageDown\", 35: \"End\",\n 36: \"Home\", 37: \"Left\", 38: \"Up\", 39: \"Right\", 40: \"Down\", 44: \"PrintScrn\", 45: \"Insert\",\n 46: \"Delete\", 59: \";\", 61: \"=\", 91: \"Mod\", 92: \"Mod\", 93: \"Mod\",\n 106: \"*\", 107: \"=\", 109: \"-\", 110: \".\", 111: \"/\", 145: \"ScrollLock\",\n 173: \"-\", 186: \";\", 187: \"=\", 188: \",\", 189: \"-\", 190: \".\", 191: \"/\", 192: \"`\", 219: \"[\", 220: \"\\\\\",\n 221: \"]\", 222: \"'\", 224: \"Mod\", 63232: \"Up\", 63233: \"Down\", 63234: \"Left\", 63235: \"Right\", 63272: \"Delete\",\n 63273: \"Home\", 63275: \"End\", 63276: \"PageUp\", 63277: \"PageDown\", 63302: \"Insert\"\n };\n\n // Number keys\n for (var i = 0; i < 10; i++) { keyNames[i + 48] = keyNames[i + 96] = String(i); }\n // Alphabetic keys\n for (var i$1 = 65; i$1 <= 90; i$1++) { keyNames[i$1] = String.fromCharCode(i$1); }\n // Function keys\n for (var i$2 = 1; i$2 <= 12; i$2++) { keyNames[i$2 + 111] = keyNames[i$2 + 63235] = \"F\" + i$2; }\n\n var keyMap = {};\n\n keyMap.basic = {\n \"Left\": \"goCharLeft\", \"Right\": \"goCharRight\", \"Up\": \"goLineUp\", \"Down\": \"goLineDown\",\n \"End\": \"goLineEnd\", \"Home\": \"goLineStartSmart\", \"PageUp\": \"goPageUp\", \"PageDown\": \"goPageDown\",\n \"Delete\": \"delCharAfter\", \"Backspace\": \"delCharBefore\", \"Shift-Backspace\": \"delCharBefore\",\n \"Tab\": \"defaultTab\", \"Shift-Tab\": \"indentAuto\",\n \"Enter\": \"newlineAndIndent\", \"Insert\": \"toggleOverwrite\",\n \"Esc\": \"singleSelection\"\n };\n // Note that the save and find-related commands aren't defined by\n // default. User code or addons can define them. Unknown commands\n // are simply ignored.\n keyMap.pcDefault = {\n \"Ctrl-A\": \"selectAll\", \"Ctrl-D\": \"deleteLine\", \"Ctrl-Z\": \"undo\", \"Shift-Ctrl-Z\": \"redo\", \"Ctrl-Y\": \"redo\",\n \"Ctrl-Home\": \"goDocStart\", \"Ctrl-End\": \"goDocEnd\", \"Ctrl-Up\": \"goLineUp\", \"Ctrl-Down\": \"goLineDown\",\n \"Ctrl-Left\": \"goGroupLeft\", \"Ctrl-Right\": \"goGroupRight\", \"Alt-Left\": \"goLineStart\", \"Alt-Right\": \"goLineEnd\",\n \"Ctrl-Backspace\": \"delGroupBefore\", \"Ctrl-Delete\": \"delGroupAfter\", \"Ctrl-S\": \"save\", \"Ctrl-F\": \"find\",\n \"Ctrl-G\": \"findNext\", \"Shift-Ctrl-G\": \"findPrev\", \"Shift-Ctrl-F\": \"replace\", \"Shift-Ctrl-R\": \"replaceAll\",\n \"Ctrl-[\": \"indentLess\", \"Ctrl-]\": \"indentMore\",\n \"Ctrl-U\": \"undoSelection\", \"Shift-Ctrl-U\": \"redoSelection\", \"Alt-U\": \"redoSelection\",\n \"fallthrough\": \"basic\"\n };\n // Very basic readline/emacs-style bindings, which are standard on Mac.\n keyMap.emacsy = {\n \"Ctrl-F\": \"goCharRight\", \"Ctrl-B\": \"goCharLeft\", \"Ctrl-P\": \"goLineUp\", \"Ctrl-N\": \"goLineDown\",\n \"Alt-F\": \"goWordRight\", \"Alt-B\": \"goWordLeft\", \"Ctrl-A\": \"goLineStart\", \"Ctrl-E\": \"goLineEnd\",\n \"Ctrl-V\": \"goPageDown\", \"Shift-Ctrl-V\": \"goPageUp\", \"Ctrl-D\": \"delCharAfter\", \"Ctrl-H\": \"delCharBefore\",\n \"Alt-D\": \"delWordAfter\", \"Alt-Backspace\": \"delWordBefore\", \"Ctrl-K\": \"killLine\", \"Ctrl-T\": \"transposeChars\",\n \"Ctrl-O\": \"openLine\"\n };\n keyMap.macDefault = {\n \"Cmd-A\": \"selectAll\", \"Cmd-D\": \"deleteLine\", \"Cmd-Z\": \"undo\", \"Shift-Cmd-Z\": \"redo\", \"Cmd-Y\": \"redo\",\n \"Cmd-Home\": \"goDocStart\", \"Cmd-Up\": \"goDocStart\", \"Cmd-End\": \"goDocEnd\", \"Cmd-Down\": \"goDocEnd\", \"Alt-Left\": \"goGroupLeft\",\n \"Alt-Right\": \"goGroupRight\", \"Cmd-Left\": \"goLineLeft\", \"Cmd-Right\": \"goLineRight\", \"Alt-Backspace\": \"delGroupBefore\",\n \"Ctrl-Alt-Backspace\": \"delGroupAfter\", \"Alt-Delete\": \"delGroupAfter\", \"Cmd-S\": \"save\", \"Cmd-F\": \"find\",\n \"Cmd-G\": \"findNext\", \"Shift-Cmd-G\": \"findPrev\", \"Cmd-Alt-F\": \"replace\", \"Shift-Cmd-Alt-F\": \"replaceAll\",\n \"Cmd-[\": \"indentLess\", \"Cmd-]\": \"indentMore\", \"Cmd-Backspace\": \"delWrappedLineLeft\", \"Cmd-Delete\": \"delWrappedLineRight\",\n \"Cmd-U\": \"undoSelection\", \"Shift-Cmd-U\": \"redoSelection\", \"Ctrl-Up\": \"goDocStart\", \"Ctrl-Down\": \"goDocEnd\",\n \"fallthrough\": [\"basic\", \"emacsy\"]\n };\n keyMap[\"default\"] = mac ? keyMap.macDefault : keyMap.pcDefault;\n\n // KEYMAP DISPATCH\n\n function normalizeKeyName(name) {\n var parts = name.split(/-(?!$)/);\n name = parts[parts.length - 1];\n var alt, ctrl, shift, cmd;\n for (var i = 0; i < parts.length - 1; i++) {\n var mod = parts[i];\n if (/^(cmd|meta|m)$/i.test(mod)) { cmd = true; }\n else if (/^a(lt)?$/i.test(mod)) { alt = true; }\n else if (/^(c|ctrl|control)$/i.test(mod)) { ctrl = true; }\n else if (/^s(hift)?$/i.test(mod)) { shift = true; }\n else { throw new Error(\"Unrecognized modifier name: \" + mod) }\n }\n if (alt) { name = \"Alt-\" + name; }\n if (ctrl) { name = \"Ctrl-\" + name; }\n if (cmd) { name = \"Cmd-\" + name; }\n if (shift) { name = \"Shift-\" + name; }\n return name\n }\n\n // This is a kludge to keep keymaps mostly working as raw objects\n // (backwards compatibility) while at the same time support features\n // like normalization and multi-stroke key bindings. It compiles a\n // new normalized keymap, and then updates the old object to reflect\n // this.\n function normalizeKeyMap(keymap) {\n var copy = {};\n for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {\n var value = keymap[keyname];\n if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }\n if (value == \"...\") { delete keymap[keyname]; continue }\n\n var keys = map(keyname.split(\" \"), normalizeKeyName);\n for (var i = 0; i < keys.length; i++) {\n var val = (void 0), name = (void 0);\n if (i == keys.length - 1) {\n name = keys.join(\" \");\n val = value;\n } else {\n name = keys.slice(0, i + 1).join(\" \");\n val = \"...\";\n }\n var prev = copy[name];\n if (!prev) { copy[name] = val; }\n else if (prev != val) { throw new Error(\"Inconsistent bindings for \" + name) }\n }\n delete keymap[keyname];\n } }\n for (var prop in copy) { keymap[prop] = copy[prop]; }\n return keymap\n }\n\n function lookupKey(key, map, handle, context) {\n map = getKeyMap(map);\n var found = map.call ? map.call(key, context) : map[key];\n if (found === false) { return \"nothing\" }\n if (found === \"...\") { return \"multi\" }\n if (found != null && handle(found)) { return \"handled\" }\n\n if (map.fallthrough) {\n if (Object.prototype.toString.call(map.fallthrough) != \"[object Array]\")\n { return lookupKey(key, map.fallthrough, handle, context) }\n for (var i = 0; i < map.fallthrough.length; i++) {\n var result = lookupKey(key, map.fallthrough[i], handle, context);\n if (result) { return result }\n }\n }\n }\n\n // Modifier key presses don't count as 'real' key presses for the\n // purpose of keymap fallthrough.\n function isModifierKey(value) {\n var name = typeof value == \"string\" ? value : keyNames[value.keyCode];\n return name == \"Ctrl\" || name == \"Alt\" || name == \"Shift\" || name == \"Mod\"\n }\n\n function addModifierNames(name, event, noShift) {\n var base = name;\n if (event.altKey && base != \"Alt\") { name = \"Alt-\" + name; }\n if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != \"Ctrl\") { name = \"Ctrl-\" + name; }\n if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != \"Mod\") { name = \"Cmd-\" + name; }\n if (!noShift && event.shiftKey && base != \"Shift\") { name = \"Shift-\" + name; }\n return name\n }\n\n // Look up the name of a key as indicated by an event object.\n function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n if (event.keyCode == 3 && event.code) { name = event.code; }\n return addModifierNames(name, event, noShift)\n }\n\n function getKeyMap(val) {\n return typeof val == \"string\" ? keyMap[val] : val\n }\n\n // Helper for deleting text near the selection(s), used to implement\n // backspace, delete, and similar functionality.\n function deleteNearSelection(cm, compute) {\n var ranges = cm.doc.sel.ranges, kill = [];\n // Build up a set of ranges to kill first, merging overlapping\n // ranges.\n for (var i = 0; i < ranges.length; i++) {\n var toKill = compute(ranges[i]);\n while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\n var replaced = kill.pop();\n if (cmp(replaced.from, toKill.from) < 0) {\n toKill.from = replaced.from;\n break\n }\n }\n kill.push(toKill);\n }\n // Next, remove those actual ranges.\n runInOp(cm, function () {\n for (var i = kill.length - 1; i >= 0; i--)\n { replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\"); }\n ensureCursorVisible(cm);\n });\n }\n\n function moveCharLogically(line, ch, dir) {\n var target = skipExtendingChars(line.text, ch + dir, dir);\n return target < 0 || target > line.text.length ? null : target\n }\n\n function moveLogically(line, start, dir) {\n var ch = moveCharLogically(line, start.ch, dir);\n return ch == null ? null : new Pos(start.line, ch, dir < 0 ? \"after\" : \"before\")\n }\n\n function endOfLine(visually, cm, lineObj, lineNo, dir) {\n if (visually) {\n if (cm.doc.direction == \"rtl\") { dir = -dir; }\n var order = getOrder(lineObj, cm.doc.direction);\n if (order) {\n var part = dir < 0 ? lst(order) : order[0];\n var moveInStorageOrder = (dir < 0) == (part.level == 1);\n var sticky = moveInStorageOrder ? \"after\" : \"before\";\n var ch;\n // With a wrapped rtl chunk (possibly spanning multiple bidi parts),\n // it could be that the last bidi part is not on the last visual line,\n // since visual lines contain content order-consecutive chunks.\n // Thus, in rtl, we are looking for the first (content-order) character\n // in the rtl chunk that is on the last line (that is, the same line\n // as the last (content-order) character).\n if (part.level > 0 || cm.doc.direction == \"rtl\") {\n var prep = prepareMeasureForLine(cm, lineObj);\n ch = dir < 0 ? lineObj.text.length - 1 : 0;\n var targetTop = measureCharPrepared(cm, prep, ch).top;\n ch = findFirst(function (ch) { return measureCharPrepared(cm, prep, ch).top == targetTop; }, (dir < 0) == (part.level == 1) ? part.from : part.to - 1, ch);\n if (sticky == \"before\") { ch = moveCharLogically(lineObj, ch, 1); }\n } else { ch = dir < 0 ? part.to : part.from; }\n return new Pos(lineNo, ch, sticky)\n }\n }\n return new Pos(lineNo, dir < 0 ? lineObj.text.length : 0, dir < 0 ? \"before\" : \"after\")\n }\n\n function moveVisually(cm, line, start, dir) {\n var bidi = getOrder(line, cm.doc.direction);\n if (!bidi) { return moveLogically(line, start, dir) }\n if (start.ch >= line.text.length) {\n start.ch = line.text.length;\n start.sticky = \"before\";\n } else if (start.ch <= 0) {\n start.ch = 0;\n start.sticky = \"after\";\n }\n var partPos = getBidiPartAt(bidi, start.ch, start.sticky), part = bidi[partPos];\n if (cm.doc.direction == \"ltr\" && part.level % 2 == 0 && (dir > 0 ? part.to > start.ch : part.from < start.ch)) {\n // Case 1: We move within an ltr part in an ltr editor. Even with wrapped lines,\n // nothing interesting happens.\n return moveLogically(line, start, dir)\n }\n\n var mv = function (pos, dir) { return moveCharLogically(line, pos instanceof Pos ? pos.ch : pos, dir); };\n var prep;\n var getWrappedLineExtent = function (ch) {\n if (!cm.options.lineWrapping) { return {begin: 0, end: line.text.length} }\n prep = prep || prepareMeasureForLine(cm, line);\n return wrappedLineExtentChar(cm, line, prep, ch)\n };\n var wrappedLineExtent = getWrappedLineExtent(start.sticky == \"before\" ? mv(start, -1) : start.ch);\n\n if (cm.doc.direction == \"rtl\" || part.level == 1) {\n var moveInStorageOrder = (part.level == 1) == (dir < 0);\n var ch = mv(start, moveInStorageOrder ? 1 : -1);\n if (ch != null && (!moveInStorageOrder ? ch >= part.from && ch >= wrappedLineExtent.begin : ch <= part.to && ch <= wrappedLineExtent.end)) {\n // Case 2: We move within an rtl part or in an rtl editor on the same visual line\n var sticky = moveInStorageOrder ? \"before\" : \"after\";\n return new Pos(start.line, ch, sticky)\n }\n }\n\n // Case 3: Could not move within this bidi part in this visual line, so leave\n // the current bidi part\n\n var searchInVisualLine = function (partPos, dir, wrappedLineExtent) {\n var getRes = function (ch, moveInStorageOrder) { return moveInStorageOrder\n ? new Pos(start.line, mv(ch, 1), \"before\")\n : new Pos(start.line, ch, \"after\"); };\n\n for (; partPos >= 0 && partPos < bidi.length; partPos += dir) {\n var part = bidi[partPos];\n var moveInStorageOrder = (dir > 0) == (part.level != 1);\n var ch = moveInStorageOrder ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1);\n if (part.from <= ch && ch < part.to) { return getRes(ch, moveInStorageOrder) }\n ch = moveInStorageOrder ? part.from : mv(part.to, -1);\n if (wrappedLineExtent.begin <= ch && ch < wrappedLineExtent.end) { return getRes(ch, moveInStorageOrder) }\n }\n };\n\n // Case 3a: Look for other bidi parts on the same visual line\n var res = searchInVisualLine(partPos + dir, dir, wrappedLineExtent);\n if (res) { return res }\n\n // Case 3b: Look for other bidi parts on the next visual line\n var nextCh = dir > 0 ? wrappedLineExtent.end : mv(wrappedLineExtent.begin, -1);\n if (nextCh != null && !(dir > 0 && nextCh == line.text.length)) {\n res = searchInVisualLine(dir > 0 ? 0 : bidi.length - 1, dir, getWrappedLineExtent(nextCh));\n if (res) { return res }\n }\n\n // Case 4: Nowhere to move\n return null\n }\n\n // Commands are parameter-less actions that can be performed on an\n // editor, mostly used for keybindings.\n var commands = {\n selectAll: selectAll,\n singleSelection: function (cm) { return cm.setSelection(cm.getCursor(\"anchor\"), cm.getCursor(\"head\"), sel_dontScroll); },\n killLine: function (cm) { return deleteNearSelection(cm, function (range) {\n if (range.empty()) {\n var len = getLine(cm.doc, range.head.line).text.length;\n if (range.head.ch == len && range.head.line < cm.lastLine())\n { return {from: range.head, to: Pos(range.head.line + 1, 0)} }\n else\n { return {from: range.head, to: Pos(range.head.line, len)} }\n } else {\n return {from: range.from(), to: range.to()}\n }\n }); },\n deleteLine: function (cm) { return deleteNearSelection(cm, function (range) { return ({\n from: Pos(range.from().line, 0),\n to: clipPos(cm.doc, Pos(range.to().line + 1, 0))\n }); }); },\n delLineLeft: function (cm) { return deleteNearSelection(cm, function (range) { return ({\n from: Pos(range.from().line, 0), to: range.from()\n }); }); },\n delWrappedLineLeft: function (cm) { return deleteNearSelection(cm, function (range) {\n var top = cm.charCoords(range.head, \"div\").top + 5;\n var leftPos = cm.coordsChar({left: 0, top: top}, \"div\");\n return {from: leftPos, to: range.from()}\n }); },\n delWrappedLineRight: function (cm) { return deleteNearSelection(cm, function (range) {\n var top = cm.charCoords(range.head, \"div\").top + 5;\n var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, \"div\");\n return {from: range.from(), to: rightPos }\n }); },\n undo: function (cm) { return cm.undo(); },\n redo: function (cm) { return cm.redo(); },\n undoSelection: function (cm) { return cm.undoSelection(); },\n redoSelection: function (cm) { return cm.redoSelection(); },\n goDocStart: function (cm) { return cm.extendSelection(Pos(cm.firstLine(), 0)); },\n goDocEnd: function (cm) { return cm.extendSelection(Pos(cm.lastLine())); },\n goLineStart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStart(cm, range.head.line); },\n {origin: \"+move\", bias: 1}\n ); },\n goLineStartSmart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStartSmart(cm, range.head); },\n {origin: \"+move\", bias: 1}\n ); },\n goLineEnd: function (cm) { return cm.extendSelectionsBy(function (range) { return lineEnd(cm, range.head.line); },\n {origin: \"+move\", bias: -1}\n ); },\n goLineRight: function (cm) { return cm.extendSelectionsBy(function (range) {\n var top = cm.cursorCoords(range.head, \"div\").top + 5;\n return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, \"div\")\n }, sel_move); },\n goLineLeft: function (cm) { return cm.extendSelectionsBy(function (range) {\n var top = cm.cursorCoords(range.head, \"div\").top + 5;\n return cm.coordsChar({left: 0, top: top}, \"div\")\n }, sel_move); },\n goLineLeftSmart: function (cm) { return cm.extendSelectionsBy(function (range) {\n var top = cm.cursorCoords(range.head, \"div\").top + 5;\n var pos = cm.coordsChar({left: 0, top: top}, \"div\");\n if (pos.ch < cm.getLine(pos.line).search(/\\S/)) { return lineStartSmart(cm, range.head) }\n return pos\n }, sel_move); },\n goLineUp: function (cm) { return cm.moveV(-1, \"line\"); },\n goLineDown: function (cm) { return cm.moveV(1, \"line\"); },\n goPageUp: function (cm) { return cm.moveV(-1, \"page\"); },\n goPageDown: function (cm) { return cm.moveV(1, \"page\"); },\n goCharLeft: function (cm) { return cm.moveH(-1, \"char\"); },\n goCharRight: function (cm) { return cm.moveH(1, \"char\"); },\n goColumnLeft: function (cm) { return cm.moveH(-1, \"column\"); },\n goColumnRight: function (cm) { return cm.moveH(1, \"column\"); },\n goWordLeft: function (cm) { return cm.moveH(-1, \"word\"); },\n goGroupRight: function (cm) { return cm.moveH(1, \"group\"); },\n goGroupLeft: function (cm) { return cm.moveH(-1, \"group\"); },\n goWordRight: function (cm) { return cm.moveH(1, \"word\"); },\n delCharBefore: function (cm) { return cm.deleteH(-1, \"codepoint\"); },\n delCharAfter: function (cm) { return cm.deleteH(1, \"char\"); },\n delWordBefore: function (cm) { return cm.deleteH(-1, \"word\"); },\n delWordAfter: function (cm) { return cm.deleteH(1, \"word\"); },\n delGroupBefore: function (cm) { return cm.deleteH(-1, \"group\"); },\n delGroupAfter: function (cm) { return cm.deleteH(1, \"group\"); },\n indentAuto: function (cm) { return cm.indentSelection(\"smart\"); },\n indentMore: function (cm) { return cm.indentSelection(\"add\"); },\n indentLess: function (cm) { return cm.indentSelection(\"subtract\"); },\n insertTab: function (cm) { return cm.replaceSelection(\"\\t\"); },\n insertSoftTab: function (cm) {\n var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize;\n for (var i = 0; i < ranges.length; i++) {\n var pos = ranges[i].from();\n var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize);\n spaces.push(spaceStr(tabSize - col % tabSize));\n }\n cm.replaceSelections(spaces);\n },\n defaultTab: function (cm) {\n if (cm.somethingSelected()) { cm.indentSelection(\"add\"); }\n else { cm.execCommand(\"insertTab\"); }\n },\n // Swap the two chars left and right of each selection's head.\n // Move cursor behind the two swapped characters afterwards.\n //\n // Doesn't consider line feeds a character.\n // Doesn't scan more than one line above to find a character.\n // Doesn't do anything on an empty line.\n // Doesn't do anything with non-empty selections.\n transposeChars: function (cm) { return runInOp(cm, function () {\n var ranges = cm.listSelections(), newSel = [];\n for (var i = 0; i < ranges.length; i++) {\n if (!ranges[i].empty()) { continue }\n var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text;\n if (line) {\n if (cur.ch == line.length) { cur = new Pos(cur.line, cur.ch - 1); }\n if (cur.ch > 0) {\n cur = new Pos(cur.line, cur.ch + 1);\n cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2),\n Pos(cur.line, cur.ch - 2), cur, \"+transpose\");\n } else if (cur.line > cm.doc.first) {\n var prev = getLine(cm.doc, cur.line - 1).text;\n if (prev) {\n cur = new Pos(cur.line, 1);\n cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() +\n prev.charAt(prev.length - 1),\n Pos(cur.line - 1, prev.length - 1), cur, \"+transpose\");\n }\n }\n }\n newSel.push(new Range(cur, cur));\n }\n cm.setSelections(newSel);\n }); },\n newlineAndIndent: function (cm) { return runInOp(cm, function () {\n var sels = cm.listSelections();\n for (var i = sels.length - 1; i >= 0; i--)\n { cm.replaceRange(cm.doc.lineSeparator(), sels[i].anchor, sels[i].head, \"+input\"); }\n sels = cm.listSelections();\n for (var i$1 = 0; i$1 < sels.length; i$1++)\n { cm.indentLine(sels[i$1].from().line, null, true); }\n ensureCursorVisible(cm);\n }); },\n openLine: function (cm) { return cm.replaceSelection(\"\\n\", \"start\"); },\n toggleOverwrite: function (cm) { return cm.toggleOverwrite(); }\n };\n\n\n function lineStart(cm, lineN) {\n var line = getLine(cm.doc, lineN);\n var visual = visualLine(line);\n if (visual != line) { lineN = lineNo(visual); }\n return endOfLine(true, cm, visual, lineN, 1)\n }\n function lineEnd(cm, lineN) {\n var line = getLine(cm.doc, lineN);\n var visual = visualLineEnd(line);\n if (visual != line) { lineN = lineNo(visual); }\n return endOfLine(true, cm, line, lineN, -1)\n }\n function lineStartSmart(cm, pos) {\n var start = lineStart(cm, pos.line);\n var line = getLine(cm.doc, start.line);\n var order = getOrder(line, cm.doc.direction);\n if (!order || order[0].level == 0) {\n var firstNonWS = Math.max(start.ch, line.text.search(/\\S/));\n var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch;\n return Pos(start.line, inWS ? 0 : firstNonWS, start.sticky)\n }\n return start\n }\n\n // Run a handler that was bound to a key.\n function doHandleBinding(cm, bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n if (!bound) { return false }\n }\n // Ensure previous input has been read, so that the handler sees a\n // consistent view of the document\n cm.display.input.ensurePolled();\n var prevShift = cm.display.shift, done = false;\n try {\n if (cm.isReadOnly()) { cm.state.suppressEdits = true; }\n if (dropShift) { cm.display.shift = false; }\n done = bound(cm) != Pass;\n } finally {\n cm.display.shift = prevShift;\n cm.state.suppressEdits = false;\n }\n return done\n }\n\n function lookupKeyForEditor(cm, name, handle) {\n for (var i = 0; i < cm.state.keyMaps.length; i++) {\n var result = lookupKey(name, cm.state.keyMaps[i], handle, cm);\n if (result) { return result }\n }\n return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm))\n || lookupKey(name, cm.options.keyMap, handle, cm)\n }\n\n // Note that, despite the name, this function is also used to check\n // for bound mouse clicks.\n\n var stopSeq = new Delayed;\n\n function dispatchKey(cm, name, e, handle) {\n var seq = cm.state.keySeq;\n if (seq) {\n if (isModifierKey(name)) { return \"handled\" }\n if (/\\'$/.test(name))\n { cm.state.keySeq = null; }\n else\n { stopSeq.set(50, function () {\n if (cm.state.keySeq == seq) {\n cm.state.keySeq = null;\n cm.display.input.reset();\n }\n }); }\n if (dispatchKeyInner(cm, seq + \" \" + name, e, handle)) { return true }\n }\n return dispatchKeyInner(cm, name, e, handle)\n }\n\n function dispatchKeyInner(cm, name, e, handle) {\n var result = lookupKeyForEditor(cm, name, handle);\n\n if (result == \"multi\")\n { cm.state.keySeq = name; }\n if (result == \"handled\")\n { signalLater(cm, \"keyHandled\", cm, name, e); }\n\n if (result == \"handled\" || result == \"multi\") {\n e_preventDefault(e);\n restartBlink(cm);\n }\n\n return !!result\n }\n\n // Handle a key from the keydown event.\n function handleKeyBinding(cm, e) {\n var name = keyName(e, true);\n if (!name) { return false }\n\n if (e.shiftKey && !cm.state.keySeq) {\n // First try to resolve full name (including 'Shift-'). Failing\n // that, see if there is a cursor-motion command (starting with\n // 'go') bound to the keyname without 'Shift-'.\n return dispatchKey(cm, \"Shift-\" + name, e, function (b) { return doHandleBinding(cm, b, true); })\n || dispatchKey(cm, name, e, function (b) {\n if (typeof b == \"string\" ? /^go[A-Z]/.test(b) : b.motion)\n { return doHandleBinding(cm, b) }\n })\n } else {\n return dispatchKey(cm, name, e, function (b) { return doHandleBinding(cm, b); })\n }\n }\n\n // Handle a key from the keypress event\n function handleCharBinding(cm, e, ch) {\n return dispatchKey(cm, \"'\" + ch + \"'\", e, function (b) { return doHandleBinding(cm, b, true); })\n }\n\n var lastStoppedKey = null;\n function onKeyDown(e) {\n var cm = this;\n if (e.target && e.target != cm.display.input.getField()) { return }\n cm.curOp.focus = activeElt();\n if (signalDOMEvent(cm, e)) { return }\n // IE does strange things with escape.\n if (ie && ie_version < 11 && e.keyCode == 27) { e.returnValue = false; }\n var code = e.keyCode;\n cm.display.shift = code == 16 || e.shiftKey;\n var handled = handleKeyBinding(cm, e);\n if (presto) {\n lastStoppedKey = handled ? code : null;\n // Opera has no cut event... we try to at least catch the key combo\n if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))\n { cm.replaceSelection(\"\", null, \"cut\"); }\n }\n if (gecko && !mac && !handled && code == 46 && e.shiftKey && !e.ctrlKey && document.execCommand)\n { document.execCommand(\"cut\"); }\n\n // Turn mouse into crosshair when Alt is held on Mac.\n if (code == 18 && !/\\bCodeMirror-crosshair\\b/.test(cm.display.lineDiv.className))\n { showCrossHair(cm); }\n }\n\n function showCrossHair(cm) {\n var lineDiv = cm.display.lineDiv;\n addClass(lineDiv, \"CodeMirror-crosshair\");\n\n function up(e) {\n if (e.keyCode == 18 || !e.altKey) {\n rmClass(lineDiv, \"CodeMirror-crosshair\");\n off(document, \"keyup\", up);\n off(document, \"mouseover\", up);\n }\n }\n on(document, \"keyup\", up);\n on(document, \"mouseover\", up);\n }\n\n function onKeyUp(e) {\n if (e.keyCode == 16) { this.doc.sel.shift = false; }\n signalDOMEvent(this, e);\n }\n\n function onKeyPress(e) {\n var cm = this;\n if (e.target && e.target != cm.display.input.getField()) { return }\n if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) { return }\n var keyCode = e.keyCode, charCode = e.charCode;\n if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return}\n if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) { return }\n var ch = String.fromCharCode(charCode == null ? keyCode : charCode);\n // Some browsers fire keypress events for backspace\n if (ch == \"\\x08\") { return }\n if (handleCharBinding(cm, e, ch)) { return }\n cm.display.input.onKeyPress(e);\n }\n\n var DOUBLECLICK_DELAY = 400;\n\n var PastClick = function(time, pos, button) {\n this.time = time;\n this.pos = pos;\n this.button = button;\n };\n\n PastClick.prototype.compare = function (time, pos, button) {\n return this.time + DOUBLECLICK_DELAY > time &&\n cmp(pos, this.pos) == 0 && button == this.button\n };\n\n var lastClick, lastDoubleClick;\n function clickRepeat(pos, button) {\n var now = +new Date;\n if (lastDoubleClick && lastDoubleClick.compare(now, pos, button)) {\n lastClick = lastDoubleClick = null;\n return \"triple\"\n } else if (lastClick && lastClick.compare(now, pos, button)) {\n lastDoubleClick = new PastClick(now, pos, button);\n lastClick = null;\n return \"double\"\n } else {\n lastClick = new PastClick(now, pos, button);\n lastDoubleClick = null;\n return \"single\"\n }\n }\n\n // A mouse down can be a single click, double click, triple click,\n // start of selection drag, start of text drag, new cursor\n // (ctrl-click), rectangle drag (alt-drag), or xwin\n // middle-click-paste. Or it might be a click on something we should\n // not interfere with, such as a scrollbar or widget.\n function onMouseDown(e) {\n var cm = this, display = cm.display;\n if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }\n display.input.ensurePolled();\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function () { return display.scroller.draggable = true; }, 100);\n }\n return\n }\n if (clickInGutter(cm, e)) { return }\n var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : \"single\";\n window.focus();\n\n // #3261: make sure, that we're not starting a second selection\n if (button == 1 && cm.state.selectingText)\n { cm.state.selectingText(e); }\n\n if (pos && handleMappedButton(cm, button, pos, repeat, e)) { return }\n\n if (button == 1) {\n if (pos) { leftButtonDown(cm, pos, repeat, e); }\n else if (e_target(e) == display.scroller) { e_preventDefault(e); }\n } else if (button == 2) {\n if (pos) { extendSelection(cm.doc, pos); }\n setTimeout(function () { return display.input.focus(); }, 20);\n } else if (button == 3) {\n if (captureRightClick) { cm.display.input.onContextMenu(e); }\n else { delayBlurEvent(cm); }\n }\n }\n\n function handleMappedButton(cm, button, pos, repeat, event) {\n var name = \"Click\";\n if (repeat == \"double\") { name = \"Double\" + name; }\n else if (repeat == \"triple\") { name = \"Triple\" + name; }\n name = (button == 1 ? \"Left\" : button == 2 ? \"Middle\" : \"Right\") + name;\n\n return dispatchKey(cm, addModifierNames(name, event), event, function (bound) {\n if (typeof bound == \"string\") { bound = commands[bound]; }\n if (!bound) { return false }\n var done = false;\n try {\n if (cm.isReadOnly()) { cm.state.suppressEdits = true; }\n done = bound(cm, pos) != Pass;\n } finally {\n cm.state.suppressEdits = false;\n }\n return done\n })\n }\n\n function configureMouse(cm, repeat, event) {\n var option = cm.getOption(\"configureMouse\");\n var value = option ? option(cm, repeat, event) : {};\n if (value.unit == null) {\n var rect = chromeOS ? event.shiftKey && event.metaKey : event.altKey;\n value.unit = rect ? \"rectangle\" : repeat == \"single\" ? \"char\" : repeat == \"double\" ? \"word\" : \"line\";\n }\n if (value.extend == null || cm.doc.extend) { value.extend = cm.doc.extend || event.shiftKey; }\n if (value.addNew == null) { value.addNew = mac ? event.metaKey : event.ctrlKey; }\n if (value.moveOnDrag == null) { value.moveOnDrag = !(mac ? event.altKey : event.ctrlKey); }\n return value\n }\n\n function leftButtonDown(cm, pos, repeat, event) {\n if (ie) { setTimeout(bind(ensureFocus, cm), 0); }\n else { cm.curOp.focus = activeElt(); }\n\n var behavior = configureMouse(cm, repeat, event);\n\n var sel = cm.doc.sel, contained;\n if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() &&\n repeat == \"single\" && (contained = sel.contains(pos)) > -1 &&\n (cmp((contained = sel.ranges[contained]).from(), pos) < 0 || pos.xRel > 0) &&\n (cmp(contained.to(), pos) > 0 || pos.xRel < 0))\n { leftButtonStartDrag(cm, event, pos, behavior); }\n else\n { leftButtonSelect(cm, event, pos, behavior); }\n }\n\n // Start a text drag. When it ends, see if any dragging actually\n // happen, and treat as a click if it didn't.\n function leftButtonStartDrag(cm, event, pos, behavior) {\n var display = cm.display, moved = false;\n var dragEnd = operation(cm, function (e) {\n if (webkit) { display.scroller.draggable = false; }\n cm.state.draggingText = false;\n if (cm.state.delayingBlurEvent) {\n if (cm.hasFocus()) { cm.state.delayingBlurEvent = false; }\n else { delayBlurEvent(cm); }\n }\n off(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n off(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n off(display.scroller, \"dragstart\", dragStart);\n off(display.scroller, \"drop\", dragEnd);\n if (!moved) {\n e_preventDefault(e);\n if (!behavior.addNew)\n { extendSelection(cm.doc, pos, null, null, behavior.extend); }\n // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n if ((webkit && !safari) || ie && ie_version == 9)\n { setTimeout(function () {display.wrapper.ownerDocument.body.focus({preventScroll: true}); display.input.focus();}, 20); }\n else\n { display.input.focus(); }\n }\n });\n var mouseMove = function(e2) {\n moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10;\n };\n var dragStart = function () { return moved = true; };\n // Let the drag handler handle this.\n if (webkit) { display.scroller.draggable = true; }\n cm.state.draggingText = dragEnd;\n dragEnd.copy = !behavior.moveOnDrag;\n on(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n on(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n on(display.scroller, \"dragstart\", dragStart);\n on(display.scroller, \"drop\", dragEnd);\n\n cm.state.delayingBlurEvent = true;\n setTimeout(function () { return display.input.focus(); }, 20);\n // IE's approach to draggable\n if (display.scroller.dragDrop) { display.scroller.dragDrop(); }\n }\n\n function rangeForUnit(cm, pos, unit) {\n if (unit == \"char\") { return new Range(pos, pos) }\n if (unit == \"word\") { return cm.findWordAt(pos) }\n if (unit == \"line\") { return new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))) }\n var result = unit(cm, pos);\n return new Range(result.from, result.to)\n }\n\n // Normal selection, as opposed to text dragging.\n function leftButtonSelect(cm, event, start, behavior) {\n if (ie) { delayBlurEvent(cm); }\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range.anchor, range.head, behavior.extend); }\n else\n { ourRange = range; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n // If e is null or undefined we interpret this as someone trying\n // to explicitly cancel the selection rather than the user\n // letting go of the mouse button.\n if (e) {\n e_preventDefault(e);\n display.input.focus();\n }\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (e.buttons === 0 || !e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n }\n\n // Used when mouse-selecting to adjust the anchor to the proper side\n // of a bidi jump depending on the visual position of the head.\n function bidiSimplify(cm, range) {\n var anchor = range.anchor;\n var head = range.head;\n var anchorLine = getLine(cm.doc, anchor.line);\n if (cmp(anchor, head) == 0 && anchor.sticky == head.sticky) { return range }\n var order = getOrder(anchorLine);\n if (!order) { return range }\n var index = getBidiPartAt(order, anchor.ch, anchor.sticky), part = order[index];\n if (part.from != anchor.ch && part.to != anchor.ch) { return range }\n var boundary = index + ((part.from == anchor.ch) == (part.level != 1) ? 0 : 1);\n if (boundary == 0 || boundary == order.length) { return range }\n\n // Compute the relative visual position of the head compared to the\n // anchor (<0 is to the left, >0 to the right)\n var leftSide;\n if (head.line != anchor.line) {\n leftSide = (head.line - anchor.line) * (cm.doc.direction == \"ltr\" ? 1 : -1) > 0;\n } else {\n var headIndex = getBidiPartAt(order, head.ch, head.sticky);\n var dir = headIndex - index || (head.ch - anchor.ch) * (part.level == 1 ? -1 : 1);\n if (headIndex == boundary - 1 || headIndex == boundary)\n { leftSide = dir < 0; }\n else\n { leftSide = dir > 0; }\n }\n\n var usePart = order[boundary + (leftSide ? -1 : 0)];\n var from = leftSide == (usePart.level == 1);\n var ch = from ? usePart.from : usePart.to, sticky = from ? \"after\" : \"before\";\n return anchor.ch == ch && anchor.sticky == sticky ? range : new Range(new Pos(anchor.line, ch, sticky), head)\n }\n\n\n // Determines whether an event happened in the gutter, and fires the\n // handlers for the corresponding event.\n function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try { mX = e.clientX; mY = e.clientY; }\n catch(e$1) { return false }\n }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e); }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.display.gutterSpecs.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.display.gutterSpecs[i];\n signal(cm, type, cm, line, gutter.className, e);\n return e_defaultPrevented(e)\n }\n }\n }\n\n function clickInGutter(cm, e) {\n return gutterEvent(cm, e, \"gutterClick\", true)\n }\n\n // CONTEXT MENU HANDLING\n\n // To make the context menu work, we need to briefly unhide the\n // textarea (making it as unobtrusive as possible) to let the\n // right-click take effect on it.\n function onContextMenu(cm, e) {\n if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) { return }\n if (signalDOMEvent(cm, e, \"contextmenu\")) { return }\n if (!captureRightClick) { cm.display.input.onContextMenu(e); }\n }\n\n function contextMenuInGutter(cm, e) {\n if (!hasHandler(cm, \"gutterContextMenu\")) { return false }\n return gutterEvent(cm, e, \"gutterContextMenu\", false)\n }\n\n function themeChanged(cm) {\n cm.display.wrapper.className = cm.display.wrapper.className.replace(/\\s*cm-s-\\S+/g, \"\") +\n cm.options.theme.replace(/(^|\\s)\\s*/g, \" cm-s-\");\n clearCaches(cm);\n }\n\n var Init = {toString: function(){return \"CodeMirror.Init\"}};\n\n var defaults = {};\n var optionHandlers = {};\n\n function defineOptions(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n function option(name, deflt, handle, notOnInit) {\n CodeMirror.defaults[name] = deflt;\n if (handle) { optionHandlers[name] =\n notOnInit ? function (cm, val, old) {if (old != Init) { handle(cm, val, old); }} : handle; }\n }\n\n CodeMirror.defineOption = option;\n\n // Passed to option handlers when there is no old value.\n CodeMirror.Init = Init;\n\n // These two are, on init, called from the constructor because they\n // have to be initialized before the editor can start at all.\n option(\"value\", \"\", function (cm, val) { return cm.setValue(val); }, true);\n option(\"mode\", null, function (cm, val) {\n cm.doc.modeOption = val;\n loadMode(cm);\n }, true);\n\n option(\"indentUnit\", 2, loadMode, true);\n option(\"indentWithTabs\", false);\n option(\"smartIndent\", true);\n option(\"tabSize\", 4, function (cm) {\n resetModeState(cm);\n clearCaches(cm);\n regChange(cm);\n }, true);\n\n option(\"lineSeparator\", null, function (cm, val) {\n cm.doc.lineSep = val;\n if (!val) { return }\n var newBreaks = [], lineNo = cm.doc.first;\n cm.doc.iter(function (line) {\n for (var pos = 0;;) {\n var found = line.text.indexOf(val, pos);\n if (found == -1) { break }\n pos = found + val.length;\n newBreaks.push(Pos(lineNo, found));\n }\n lineNo++;\n });\n for (var i = newBreaks.length - 1; i >= 0; i--)\n { replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)); }\n });\n option(\"specialChars\", /[\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u061c\\u200b-\\u200c\\u200e\\u200f\\u2028\\u2029\\ufeff\\ufff9-\\ufffc]/g, function (cm, val, old) {\n cm.state.specialChars = new RegExp(val.source + (val.test(\"\\t\") ? \"\" : \"|\\t\"), \"g\");\n if (old != Init) { cm.refresh(); }\n });\n option(\"specialCharPlaceholder\", defaultSpecialCharPlaceholder, function (cm) { return cm.refresh(); }, true);\n option(\"electricChars\", true);\n option(\"inputStyle\", mobile ? \"contenteditable\" : \"textarea\", function () {\n throw new Error(\"inputStyle can not (yet) be changed in a running editor\") // FIXME\n }, true);\n option(\"spellcheck\", false, function (cm, val) { return cm.getInputField().spellcheck = val; }, true);\n option(\"autocorrect\", false, function (cm, val) { return cm.getInputField().autocorrect = val; }, true);\n option(\"autocapitalize\", false, function (cm, val) { return cm.getInputField().autocapitalize = val; }, true);\n option(\"rtlMoveVisually\", !windows);\n option(\"wholeLineUpdateBefore\", true);\n\n option(\"theme\", \"default\", function (cm) {\n themeChanged(cm);\n updateGutters(cm);\n }, true);\n option(\"keyMap\", \"default\", function (cm, val, old) {\n var next = getKeyMap(val);\n var prev = old != Init && getKeyMap(old);\n if (prev && prev.detach) { prev.detach(cm, next); }\n if (next.attach) { next.attach(cm, prev || null); }\n });\n option(\"extraKeys\", null);\n option(\"configureMouse\", null);\n\n option(\"lineWrapping\", false, wrappingChanged, true);\n option(\"gutters\", [], function (cm, val) {\n cm.display.gutterSpecs = getGutters(val, cm.options.lineNumbers);\n updateGutters(cm);\n }, true);\n option(\"fixedGutter\", true, function (cm, val) {\n cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + \"px\" : \"0\";\n cm.refresh();\n }, true);\n option(\"coverGutterNextToScrollbar\", false, function (cm) { return updateScrollbars(cm); }, true);\n option(\"scrollbarStyle\", \"native\", function (cm) {\n initScrollbars(cm);\n updateScrollbars(cm);\n cm.display.scrollbars.setScrollTop(cm.doc.scrollTop);\n cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft);\n }, true);\n option(\"lineNumbers\", false, function (cm, val) {\n cm.display.gutterSpecs = getGutters(cm.options.gutters, val);\n updateGutters(cm);\n }, true);\n option(\"firstLineNumber\", 1, updateGutters, true);\n option(\"lineNumberFormatter\", function (integer) { return integer; }, updateGutters, true);\n option(\"showCursorWhenSelecting\", false, updateSelection, true);\n\n option(\"resetSelectionOnContextMenu\", true);\n option(\"lineWiseCopyCut\", true);\n option(\"pasteLinesPerSelection\", true);\n option(\"selectionsMayTouch\", false);\n\n option(\"readOnly\", false, function (cm, val) {\n if (val == \"nocursor\") {\n onBlur(cm);\n cm.display.input.blur();\n }\n cm.display.input.readOnlyChanged(val);\n });\n\n option(\"screenReaderLabel\", null, function (cm, val) {\n val = (val === '') ? null : val;\n cm.display.input.screenReaderLabelChanged(val);\n });\n\n option(\"disableInput\", false, function (cm, val) {if (!val) { cm.display.input.reset(); }}, true);\n option(\"dragDrop\", true, dragDropChanged);\n option(\"allowDropFileTypes\", null);\n\n option(\"cursorBlinkRate\", 530);\n option(\"cursorScrollMargin\", 0);\n option(\"cursorHeight\", 1, updateSelection, true);\n option(\"singleCursorHeightPerLine\", true, updateSelection, true);\n option(\"workTime\", 100);\n option(\"workDelay\", 100);\n option(\"flattenSpans\", true, resetModeState, true);\n option(\"addModeClass\", false, resetModeState, true);\n option(\"pollInterval\", 100);\n option(\"undoDepth\", 200, function (cm, val) { return cm.doc.history.undoDepth = val; });\n option(\"historyEventDelay\", 1250);\n option(\"viewportMargin\", 10, function (cm) { return cm.refresh(); }, true);\n option(\"maxHighlightLength\", 10000, resetModeState, true);\n option(\"moveInputWithCursor\", true, function (cm, val) {\n if (!val) { cm.display.input.resetPosition(); }\n });\n\n option(\"tabindex\", null, function (cm, val) { return cm.display.input.getField().tabIndex = val || \"\"; });\n option(\"autofocus\", null);\n option(\"direction\", \"ltr\", function (cm, val) { return cm.doc.setDirection(val); }, true);\n option(\"phrases\", null);\n }\n\n function dragDropChanged(cm, value, old) {\n var wasOn = old && old != Init;\n if (!value != !wasOn) {\n var funcs = cm.display.dragFunctions;\n var toggle = value ? on : off;\n toggle(cm.display.scroller, \"dragstart\", funcs.start);\n toggle(cm.display.scroller, \"dragenter\", funcs.enter);\n toggle(cm.display.scroller, \"dragover\", funcs.over);\n toggle(cm.display.scroller, \"dragleave\", funcs.leave);\n toggle(cm.display.scroller, \"drop\", funcs.drop);\n }\n }\n\n function wrappingChanged(cm) {\n if (cm.options.lineWrapping) {\n addClass(cm.display.wrapper, \"CodeMirror-wrap\");\n cm.display.sizer.style.minWidth = \"\";\n cm.display.sizerWidth = null;\n } else {\n rmClass(cm.display.wrapper, \"CodeMirror-wrap\");\n findMaxLine(cm);\n }\n estimateLineHeights(cm);\n regChange(cm);\n clearCaches(cm);\n setTimeout(function () { return updateScrollbars(cm); }, 100);\n }\n\n // A CodeMirror instance represents an editor. This is the object\n // that user code is usually dealing with.\n\n function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(function () {\n if (this$1.hasFocus() && !this$1.state.focused) { onFocus(this$1); }\n }, 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }\n\n // The default configuration options.\n CodeMirror.defaults = defaults;\n // Functions to run when options are changed.\n CodeMirror.optionHandlers = optionHandlers;\n\n // Attach the necessary event handlers when initializing the editor\n function registerEventHandlers(cm) {\n var d = cm.display;\n on(d.scroller, \"mousedown\", operation(cm, onMouseDown));\n // Older IE's will not fire a second mousedown for a double click\n if (ie && ie_version < 11)\n { on(d.scroller, \"dblclick\", operation(cm, function (e) {\n if (signalDOMEvent(cm, e)) { return }\n var pos = posFromMouse(cm, e);\n if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) { return }\n e_preventDefault(e);\n var word = cm.findWordAt(pos);\n extendSelection(cm.doc, word.anchor, word.head);\n })); }\n else\n { on(d.scroller, \"dblclick\", function (e) { return signalDOMEvent(cm, e) || e_preventDefault(e); }); }\n // Some browsers fire contextmenu *after* opening the menu, at\n // which point we can't mess with it anymore. Context menu is\n // handled in onMouseDown for these browsers.\n on(d.scroller, \"contextmenu\", function (e) { return onContextMenu(cm, e); });\n on(d.input.getField(), \"contextmenu\", function (e) {\n if (!d.scroller.contains(e.target)) { onContextMenu(cm, e); }\n });\n\n // Used to suppress mouse event handling when a touch happens\n var touchFinished, prevTouch = {end: 0};\n function finishTouch() {\n if (d.activeTouch) {\n touchFinished = setTimeout(function () { return d.activeTouch = null; }, 1000);\n prevTouch = d.activeTouch;\n prevTouch.end = +new Date;\n }\n }\n function isMouseLikeTouchEvent(e) {\n if (e.touches.length != 1) { return false }\n var touch = e.touches[0];\n return touch.radiusX <= 1 && touch.radiusY <= 1\n }\n function farAway(touch, other) {\n if (other.left == null) { return true }\n var dx = other.left - touch.left, dy = other.top - touch.top;\n return dx * dx + dy * dy > 20 * 20\n }\n on(d.scroller, \"touchstart\", function (e) {\n if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e) && !clickInGutter(cm, e)) {\n d.input.ensurePolled();\n clearTimeout(touchFinished);\n var now = +new Date;\n d.activeTouch = {start: now, moved: false,\n prev: now - prevTouch.end <= 300 ? prevTouch : null};\n if (e.touches.length == 1) {\n d.activeTouch.left = e.touches[0].pageX;\n d.activeTouch.top = e.touches[0].pageY;\n }\n }\n });\n on(d.scroller, \"touchmove\", function () {\n if (d.activeTouch) { d.activeTouch.moved = true; }\n });\n on(d.scroller, \"touchend\", function (e) {\n var touch = d.activeTouch;\n if (touch && !eventInWidget(d, e) && touch.left != null &&\n !touch.moved && new Date - touch.start < 300) {\n var pos = cm.coordsChar(d.activeTouch, \"page\"), range;\n if (!touch.prev || farAway(touch, touch.prev)) // Single tap\n { range = new Range(pos, pos); }\n else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap\n { range = cm.findWordAt(pos); }\n else // Triple tap\n { range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))); }\n cm.setSelection(range.anchor, range.head);\n cm.focus();\n e_preventDefault(e);\n }\n finishTouch();\n });\n on(d.scroller, \"touchcancel\", finishTouch);\n\n // Sync scrolling between fake scrollbars and real scrollable\n // area, ensure viewport is updated when scrolling.\n on(d.scroller, \"scroll\", function () {\n if (d.scroller.clientHeight) {\n updateScrollTop(cm, d.scroller.scrollTop);\n setScrollLeft(cm, d.scroller.scrollLeft, true);\n signal(cm, \"scroll\", cm);\n }\n });\n\n // Listen to wheel events in order to try and update the viewport on time.\n on(d.scroller, \"mousewheel\", function (e) { return onScrollWheel(cm, e); });\n on(d.scroller, \"DOMMouseScroll\", function (e) { return onScrollWheel(cm, e); });\n\n // Prevent wrapper from ever scrolling\n on(d.wrapper, \"scroll\", function () { return d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });\n\n d.dragFunctions = {\n enter: function (e) {if (!signalDOMEvent(cm, e)) { e_stop(e); }},\n over: function (e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }},\n start: function (e) { return onDragStart(cm, e); },\n drop: operation(cm, onDrop),\n leave: function (e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm); }}\n };\n\n var inp = d.input.getField();\n on(inp, \"keyup\", function (e) { return onKeyUp.call(cm, e); });\n on(inp, \"keydown\", operation(cm, onKeyDown));\n on(inp, \"keypress\", operation(cm, onKeyPress));\n on(inp, \"focus\", function (e) { return onFocus(cm, e); });\n on(inp, \"blur\", function (e) { return onBlur(cm, e); });\n }\n\n var initHooks = [];\n CodeMirror.defineInitHook = function (f) { return initHooks.push(f); };\n\n // Indent the given line. The how parameter can be \"smart\",\n // \"add\"/null, \"subtract\", or \"prev\". When aggressive is false\n // (typically set to true for forced single-line indents), empty\n // lines are not indented, and places where the mode returns Pass\n // are left alone.\n function indentLine(cm, n, how, aggressive) {\n var doc = cm.doc, state;\n if (how == null) { how = \"add\"; }\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!doc.mode.indent) { how = \"prev\"; }\n else { state = getContextBefore(cm, n).state; }\n }\n\n var tabSize = cm.options.tabSize;\n var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n if (line.stateAfter) { line.stateAfter = null; }\n var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (!aggressive && !/\\S/.test(line.text)) {\n indentation = 0;\n how = \"not\";\n } else if (how == \"smart\") {\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n if (indentation == Pass || indentation > 150) {\n if (!aggressive) { return }\n how = \"prev\";\n }\n }\n if (how == \"prev\") {\n if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); }\n else { indentation = 0; }\n } else if (how == \"add\") {\n indentation = curSpace + cm.options.indentUnit;\n } else if (how == \"subtract\") {\n indentation = curSpace - cm.options.indentUnit;\n } else if (typeof how == \"number\") {\n indentation = curSpace + how;\n }\n indentation = Math.max(0, indentation);\n\n var indentString = \"\", pos = 0;\n if (cm.options.indentWithTabs)\n { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";} }\n if (pos < indentation) { indentString += spaceStr(indentation - pos); }\n\n if (indentString != curSpaceString) {\n replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n line.stateAfter = null;\n return true\n } else {\n // Ensure that, if the cursor was in the whitespace at the start\n // of the line, it is moved to the end of that space.\n for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {\n var range = doc.sel.ranges[i$1];\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\n var pos$1 = Pos(n, curSpaceString.length);\n replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));\n break\n }\n }\n }\n }\n\n // This will be set to a {lineWise: bool, text: [string]} object, so\n // that, when pasting, we know what kind of selections the copied\n // text was made out of.\n var lastCopied = null;\n\n function setLastCopied(newLastCopied) {\n lastCopied = newLastCopied;\n }\n\n function applyTextInput(cm, inserted, deleted, sel, origin) {\n var doc = cm.doc;\n cm.display.shift = false;\n if (!sel) { sel = doc.sel; }\n\n var recent = +new Date - 200;\n var paste = origin == \"paste\" || cm.state.pasteIncoming > recent;\n var textLines = splitLinesAuto(inserted), multiPaste = null;\n // When pasting N lines into N selections, insert one line per selection\n if (paste && sel.ranges.length > 1) {\n if (lastCopied && lastCopied.text.join(\"\\n\") == inserted) {\n if (sel.ranges.length % lastCopied.text.length == 0) {\n multiPaste = [];\n for (var i = 0; i < lastCopied.text.length; i++)\n { multiPaste.push(doc.splitLines(lastCopied.text[i])); }\n }\n } else if (textLines.length == sel.ranges.length && cm.options.pasteLinesPerSelection) {\n multiPaste = map(textLines, function (l) { return [l]; });\n }\n }\n\n var updateInput = cm.curOp.updateInput;\n // Normal behavior is to insert the new text into every selection\n for (var i$1 = sel.ranges.length - 1; i$1 >= 0; i$1--) {\n var range = sel.ranges[i$1];\n var from = range.from(), to = range.to();\n if (range.empty()) {\n if (deleted && deleted > 0) // Handle deletion\n { from = Pos(from.line, from.ch - deleted); }\n else if (cm.state.overwrite && !paste) // Handle overwrite\n { to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length)); }\n else if (paste && lastCopied && lastCopied.lineWise && lastCopied.text.join(\"\\n\") == textLines.join(\"\\n\"))\n { from = to = Pos(from.line, 0); }\n }\n var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i$1 % multiPaste.length] : textLines,\n origin: origin || (paste ? \"paste\" : cm.state.cutIncoming > recent ? \"cut\" : \"+input\")};\n makeChange(cm.doc, changeEvent);\n signalLater(cm, \"inputRead\", cm, changeEvent);\n }\n if (inserted && !paste)\n { triggerElectric(cm, inserted); }\n\n ensureCursorVisible(cm);\n if (cm.curOp.updateInput < 2) { cm.curOp.updateInput = updateInput; }\n cm.curOp.typing = true;\n cm.state.pasteIncoming = cm.state.cutIncoming = -1;\n }\n\n function handlePaste(e, cm) {\n var pasted = e.clipboardData && e.clipboardData.getData(\"Text\");\n if (pasted) {\n e.preventDefault();\n if (!cm.isReadOnly() && !cm.options.disableInput)\n { runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, \"paste\"); }); }\n return true\n }\n }\n\n function triggerElectric(cm, inserted) {\n // When an 'electric' character is inserted, immediately trigger a reindent\n if (!cm.options.electricChars || !cm.options.smartIndent) { return }\n var sel = cm.doc.sel;\n\n for (var i = sel.ranges.length - 1; i >= 0; i--) {\n var range = sel.ranges[i];\n if (range.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range.head.line)) { continue }\n var mode = cm.getModeAt(range.head);\n var indented = false;\n if (mode.electricChars) {\n for (var j = 0; j < mode.electricChars.length; j++)\n { if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {\n indented = indentLine(cm, range.head.line, \"smart\");\n break\n } }\n } else if (mode.electricInput) {\n if (mode.electricInput.test(getLine(cm.doc, range.head.line).text.slice(0, range.head.ch)))\n { indented = indentLine(cm, range.head.line, \"smart\"); }\n }\n if (indented) { signalLater(cm, \"electricInput\", cm, range.head.line); }\n }\n }\n\n function copyableRanges(cm) {\n var text = [], ranges = [];\n for (var i = 0; i < cm.doc.sel.ranges.length; i++) {\n var line = cm.doc.sel.ranges[i].head.line;\n var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};\n ranges.push(lineRange);\n text.push(cm.getRange(lineRange.anchor, lineRange.head));\n }\n return {text: text, ranges: ranges}\n }\n\n function disableBrowserMagic(field, spellcheck, autocorrect, autocapitalize) {\n field.setAttribute(\"autocorrect\", autocorrect ? \"\" : \"off\");\n field.setAttribute(\"autocapitalize\", autocapitalize ? \"\" : \"off\");\n field.setAttribute(\"spellcheck\", !!spellcheck);\n }\n\n function hiddenTextarea() {\n var te = elt(\"textarea\", null, null, \"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none\");\n var div = elt(\"div\", [te], null, \"overflow: hidden; position: relative; width: 3px; height: 0px;\");\n // The textarea is kept positioned near the cursor to prevent the\n // fact that it'll be scrolled into view on input from scrolling\n // our fake cursor out of view. On webkit, when wrap=off, paste is\n // very slow. So make the area wide instead.\n if (webkit) { te.style.width = \"1000px\"; }\n else { te.setAttribute(\"wrap\", \"off\"); }\n // If border: 0; -- iOS fails to open keyboard (issue #1287)\n if (ios) { te.style.border = \"1px solid black\"; }\n disableBrowserMagic(te);\n return div\n }\n\n // The publicly visible API. Note that methodOp(f) means\n // 'wrap f in an operation, performed on its `this` parameter'.\n\n // This is not the complete set of editor methods. Most of the\n // methods defined on the Doc type are also injected into\n // CodeMirror.prototype, for backwards compatibility and\n // convenience.\n\n function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map));\n },\n removeKeyMap: function(map) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map || maps[i].name == map) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this.state.modeGen++;\n regChange(this);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (!range.empty()) {\n var from = range.from(), to = range.to();\n var start = Math.max(end, from.line);\n end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this, j, how); }\n var newRanges = this.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range.head.line > end) {\n indentLine(this, range.head.line, how, true);\n end = range.head.line;\n if (i == this.doc.sel.primIndex) { ensureCursorVisible(this); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range = this.doc.sel.primary();\n if (start == null) { pos = range.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range.from() : range.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range) {\n if (this$1.display.shift || this$1.doc.extend || range.empty())\n { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range.from() : range.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range) {\n var other = findPosH(doc, range.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range) {\n if (collapse)\n { return dir < 0 ? range.from() : range.to() }\n var headPos = cursorCoords(this$1, range.head, \"div\");\n if (range.goalColumn != null) { headPos.left = range.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range, margin) {\n if (range == null) {\n range = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range == \"number\") {\n range = {from: Pos(range, 0), to: null};\n } else if (range.from == null) {\n range = {from: range, to: null};\n }\n if (!range.to) { range.to = range.from; }\n range.margin = margin || 0;\n\n if (range.from.line != null) {\n scrollToRange(this, range);\n } else {\n scrollToCoordsRange(this, range.from, range.to, range.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo = this.display.viewFrom;\n this.doc.iter(lineNo, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, \"widget\"); break } } }\n ++lineNo;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5 || this.options.lineWrapping)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n // Cancel the current text selection if any (#5821)\n if (this.state.selectingText) { this.state.selectingText(); }\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }\n\n // Used for horizontal relative motion. Dir is -1 or 1 (left or\n // right), unit can be \"codepoint\", \"char\", \"column\" (like char, but\n // doesn't cross line boundaries), \"word\" (across next word), or\n // \"group\" (to the start of next group of word or\n // non-word-non-whitespace chars). The visually param controls\n // whether, in right-to-left text, direction 1 means to move towards\n // the next index in the string, or towards the character to the right\n // of the current position. The resulting position will have a\n // hitSide=true property if it reached the end of the document.\n function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n var lineDir = visually && doc.direction == \"rtl\" ? -dir : dir;\n function findNextLine() {\n var l = pos.line + lineDir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (unit == \"codepoint\") {\n var ch = lineObj.text.charCodeAt(pos.ch + (unit > 0 ? 0 : -1));\n if (isNaN(ch)) { next = null; }\n else { next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (ch >= 0xD800 && ch < 0xDC00 ? 2 : 1))),\n -dir); }\n } else if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\" || unit == \"codepoint\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n }\n\n // For relative vertical movement. Dir may be -1 or 1. Unit can be\n // \"page\" or \"line\". The resulting position will have a hitSide=true\n // property if it reached the end of the document.\n function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n }\n\n // CONTENTEDITABLE INPUT STYLE\n\n var ContentEditableInput = function(cm) {\n this.cm = cm;\n this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null;\n this.polling = new Delayed();\n this.composing = null;\n this.gracePeriod = false;\n this.readDOMTimeout = null;\n };\n\n ContentEditableInput.prototype.init = function (display) {\n var this$1 = this;\n\n var input = this, cm = input.cm;\n var div = input.div = display.lineDiv;\n disableBrowserMagic(div, cm.options.spellcheck, cm.options.autocorrect, cm.options.autocapitalize);\n\n function belongsToInput(e) {\n for (var t = e.target; t; t = t.parentNode) {\n if (t == div) { return true }\n if (/\\bCodeMirror-(?:line)?widget\\b/.test(t.className)) { break }\n }\n return false\n }\n\n on(div, \"paste\", function (e) {\n if (!belongsToInput(e) || signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }\n // IE doesn't fire input events, so we schedule a read for the pasted content in this way\n if (ie_version <= 11) { setTimeout(operation(cm, function () { return this$1.updateFromDOM(); }), 20); }\n });\n\n on(div, \"compositionstart\", function (e) {\n this$1.composing = {data: e.data, done: false};\n });\n on(div, \"compositionupdate\", function (e) {\n if (!this$1.composing) { this$1.composing = {data: e.data, done: false}; }\n });\n on(div, \"compositionend\", function (e) {\n if (this$1.composing) {\n if (e.data != this$1.composing.data) { this$1.readFromDOMSoon(); }\n this$1.composing.done = true;\n }\n });\n\n on(div, \"touchstart\", function () { return input.forceCompositionEnd(); });\n\n on(div, \"input\", function () {\n if (!this$1.composing) { this$1.readFromDOMSoon(); }\n });\n\n function onCopyCut(e) {\n if (!belongsToInput(e) || signalDOMEvent(cm, e)) { return }\n if (cm.somethingSelected()) {\n setLastCopied({lineWise: false, text: cm.getSelections()});\n if (e.type == \"cut\") { cm.replaceSelection(\"\", null, \"cut\"); }\n } else if (!cm.options.lineWiseCopyCut) {\n return\n } else {\n var ranges = copyableRanges(cm);\n setLastCopied({lineWise: true, text: ranges.text});\n if (e.type == \"cut\") {\n cm.operation(function () {\n cm.setSelections(ranges.ranges, 0, sel_dontScroll);\n cm.replaceSelection(\"\", null, \"cut\");\n });\n }\n }\n if (e.clipboardData) {\n e.clipboardData.clearData();\n var content = lastCopied.text.join(\"\\n\");\n // iOS exposes the clipboard API, but seems to discard content inserted into it\n e.clipboardData.setData(\"Text\", content);\n if (e.clipboardData.getData(\"Text\") == content) {\n e.preventDefault();\n return\n }\n }\n // Old-fashioned briefly-focus-a-textarea hack\n var kludge = hiddenTextarea(), te = kludge.firstChild;\n cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);\n te.value = lastCopied.text.join(\"\\n\");\n var hadFocus = document.activeElement;\n selectInput(te);\n setTimeout(function () {\n cm.display.lineSpace.removeChild(kludge);\n hadFocus.focus();\n if (hadFocus == div) { input.showPrimarySelection(); }\n }, 50);\n }\n on(div, \"copy\", onCopyCut);\n on(div, \"cut\", onCopyCut);\n };\n\n ContentEditableInput.prototype.screenReaderLabelChanged = function (label) {\n // Label for screenreaders, accessibility\n if(label) {\n this.div.setAttribute('aria-label', label);\n } else {\n this.div.removeAttribute('aria-label');\n }\n };\n\n ContentEditableInput.prototype.prepareSelection = function () {\n var result = prepareSelection(this.cm, false);\n result.focus = document.activeElement == this.div;\n return result\n };\n\n ContentEditableInput.prototype.showSelection = function (info, takeFocus) {\n if (!info || !this.cm.display.view.length) { return }\n if (info.focus || takeFocus) { this.showPrimarySelection(); }\n this.showMultipleSelections(info);\n };\n\n ContentEditableInput.prototype.getSelection = function () {\n return this.cm.display.wrapper.ownerDocument.getSelection()\n };\n\n ContentEditableInput.prototype.showPrimarySelection = function () {\n var sel = this.getSelection(), cm = this.cm, prim = cm.doc.sel.primary();\n var from = prim.from(), to = prim.to();\n\n if (cm.display.viewTo == cm.display.viewFrom || from.line >= cm.display.viewTo || to.line < cm.display.viewFrom) {\n sel.removeAllRanges();\n return\n }\n\n var curAnchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);\n var curFocus = domToPos(cm, sel.focusNode, sel.focusOffset);\n if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad &&\n cmp(minPos(curAnchor, curFocus), from) == 0 &&\n cmp(maxPos(curAnchor, curFocus), to) == 0)\n { return }\n\n var view = cm.display.view;\n var start = (from.line >= cm.display.viewFrom && posToDOM(cm, from)) ||\n {node: view[0].measure.map[2], offset: 0};\n var end = to.line < cm.display.viewTo && posToDOM(cm, to);\n if (!end) {\n var measure = view[view.length - 1].measure;\n var map = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map;\n end = {node: map[map.length - 1], offset: map[map.length - 2] - map[map.length - 3]};\n }\n\n if (!start || !end) {\n sel.removeAllRanges();\n return\n }\n\n var old = sel.rangeCount && sel.getRangeAt(0), rng;\n try { rng = range(start.node, start.offset, end.offset, end.node); }\n catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible\n if (rng) {\n if (!gecko && cm.state.focused) {\n sel.collapse(start.node, start.offset);\n if (!rng.collapsed) {\n sel.removeAllRanges();\n sel.addRange(rng);\n }\n } else {\n sel.removeAllRanges();\n sel.addRange(rng);\n }\n if (old && sel.anchorNode == null) { sel.addRange(old); }\n else if (gecko) { this.startGracePeriod(); }\n }\n this.rememberSelection();\n };\n\n ContentEditableInput.prototype.startGracePeriod = function () {\n var this$1 = this;\n\n clearTimeout(this.gracePeriod);\n this.gracePeriod = setTimeout(function () {\n this$1.gracePeriod = false;\n if (this$1.selectionChanged())\n { this$1.cm.operation(function () { return this$1.cm.curOp.selectionChanged = true; }); }\n }, 20);\n };\n\n ContentEditableInput.prototype.showMultipleSelections = function (info) {\n removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors);\n removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection);\n };\n\n ContentEditableInput.prototype.rememberSelection = function () {\n var sel = this.getSelection();\n this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset;\n this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset;\n };\n\n ContentEditableInput.prototype.selectionInEditor = function () {\n var sel = this.getSelection();\n if (!sel.rangeCount) { return false }\n var node = sel.getRangeAt(0).commonAncestorContainer;\n return contains(this.div, node)\n };\n\n ContentEditableInput.prototype.focus = function () {\n if (this.cm.options.readOnly != \"nocursor\") {\n if (!this.selectionInEditor() || document.activeElement != this.div)\n { this.showSelection(this.prepareSelection(), true); }\n this.div.focus();\n }\n };\n ContentEditableInput.prototype.blur = function () { this.div.blur(); };\n ContentEditableInput.prototype.getField = function () { return this.div };\n\n ContentEditableInput.prototype.supportsTouch = function () { return true };\n\n ContentEditableInput.prototype.receivedFocus = function () {\n var input = this;\n if (this.selectionInEditor())\n { this.pollSelection(); }\n else\n { runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }); }\n\n function poll() {\n if (input.cm.state.focused) {\n input.pollSelection();\n input.polling.set(input.cm.options.pollInterval, poll);\n }\n }\n this.polling.set(this.cm.options.pollInterval, poll);\n };\n\n ContentEditableInput.prototype.selectionChanged = function () {\n var sel = this.getSelection();\n return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset ||\n sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset\n };\n\n ContentEditableInput.prototype.pollSelection = function () {\n if (this.readDOMTimeout != null || this.gracePeriod || !this.selectionChanged()) { return }\n var sel = this.getSelection(), cm = this.cm;\n // On Android Chrome (version 56, at least), backspacing into an\n // uneditable block element will put the cursor in that element,\n // and then, because it's not editable, hide the virtual keyboard.\n // Because Android doesn't allow us to actually detect backspace\n // presses in a sane way, this code checks for when that happens\n // and simulates a backspace press in this case.\n if (android && chrome && this.cm.display.gutterSpecs.length && isInGutter(sel.anchorNode)) {\n this.cm.triggerOnKeyDown({type: \"keydown\", keyCode: 8, preventDefault: Math.abs});\n this.blur();\n this.focus();\n return\n }\n if (this.composing) { return }\n this.rememberSelection();\n var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);\n var head = domToPos(cm, sel.focusNode, sel.focusOffset);\n if (anchor && head) { runInOp(cm, function () {\n setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll);\n if (anchor.bad || head.bad) { cm.curOp.selectionChanged = true; }\n }); }\n };\n\n ContentEditableInput.prototype.pollContent = function () {\n if (this.readDOMTimeout != null) {\n clearTimeout(this.readDOMTimeout);\n this.readDOMTimeout = null;\n }\n\n var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary();\n var from = sel.from(), to = sel.to();\n if (from.ch == 0 && from.line > cm.firstLine())\n { from = Pos(from.line - 1, getLine(cm.doc, from.line - 1).length); }\n if (to.ch == getLine(cm.doc, to.line).text.length && to.line < cm.lastLine())\n { to = Pos(to.line + 1, 0); }\n if (from.line < display.viewFrom || to.line > display.viewTo - 1) { return false }\n\n var fromIndex, fromLine, fromNode;\n if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) {\n fromLine = lineNo(display.view[0].line);\n fromNode = display.view[0].node;\n } else {\n fromLine = lineNo(display.view[fromIndex].line);\n fromNode = display.view[fromIndex - 1].node.nextSibling;\n }\n var toIndex = findViewIndex(cm, to.line);\n var toLine, toNode;\n if (toIndex == display.view.length - 1) {\n toLine = display.viewTo - 1;\n toNode = display.lineDiv.lastChild;\n } else {\n toLine = lineNo(display.view[toIndex + 1].line) - 1;\n toNode = display.view[toIndex + 1].node.previousSibling;\n }\n\n if (!fromNode) { return false }\n var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine));\n var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length));\n while (newText.length > 1 && oldText.length > 1) {\n if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine--; }\n else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++; }\n else { break }\n }\n\n var cutFront = 0, cutEnd = 0;\n var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length);\n while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront))\n { ++cutFront; }\n var newBot = lst(newText), oldBot = lst(oldText);\n var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0),\n oldBot.length - (oldText.length == 1 ? cutFront : 0));\n while (cutEnd < maxCutEnd &&\n newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1))\n { ++cutEnd; }\n // Try to move start of change to start of selection if ambiguous\n if (newText.length == 1 && oldText.length == 1 && fromLine == from.line) {\n while (cutFront && cutFront > from.ch &&\n newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) {\n cutFront--;\n cutEnd++;\n }\n }\n\n newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd).replace(/^\\u200b+/, \"\");\n newText[0] = newText[0].slice(cutFront).replace(/\\u200b+$/, \"\");\n\n var chFrom = Pos(fromLine, cutFront);\n var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0);\n if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) {\n replaceRange(cm.doc, newText, chFrom, chTo, \"+input\");\n return true\n }\n };\n\n ContentEditableInput.prototype.ensurePolled = function () {\n this.forceCompositionEnd();\n };\n ContentEditableInput.prototype.reset = function () {\n this.forceCompositionEnd();\n };\n ContentEditableInput.prototype.forceCompositionEnd = function () {\n if (!this.composing) { return }\n clearTimeout(this.readDOMTimeout);\n this.composing = null;\n this.updateFromDOM();\n this.div.blur();\n this.div.focus();\n };\n ContentEditableInput.prototype.readFromDOMSoon = function () {\n var this$1 = this;\n\n if (this.readDOMTimeout != null) { return }\n this.readDOMTimeout = setTimeout(function () {\n this$1.readDOMTimeout = null;\n if (this$1.composing) {\n if (this$1.composing.done) { this$1.composing = null; }\n else { return }\n }\n this$1.updateFromDOM();\n }, 80);\n };\n\n ContentEditableInput.prototype.updateFromDOM = function () {\n var this$1 = this;\n\n if (this.cm.isReadOnly() || !this.pollContent())\n { runInOp(this.cm, function () { return regChange(this$1.cm); }); }\n };\n\n ContentEditableInput.prototype.setUneditable = function (node) {\n node.contentEditable = \"false\";\n };\n\n ContentEditableInput.prototype.onKeyPress = function (e) {\n if (e.charCode == 0 || this.composing) { return }\n e.preventDefault();\n if (!this.cm.isReadOnly())\n { operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0); }\n };\n\n ContentEditableInput.prototype.readOnlyChanged = function (val) {\n this.div.contentEditable = String(val != \"nocursor\");\n };\n\n ContentEditableInput.prototype.onContextMenu = function () {};\n ContentEditableInput.prototype.resetPosition = function () {};\n\n ContentEditableInput.prototype.needsContentAttribute = true;\n\n function posToDOM(cm, pos) {\n var view = findViewForLine(cm, pos.line);\n if (!view || view.hidden) { return null }\n var line = getLine(cm.doc, pos.line);\n var info = mapFromLineView(view, line, pos.line);\n\n var order = getOrder(line, cm.doc.direction), side = \"left\";\n if (order) {\n var partPos = getBidiPartAt(order, pos.ch);\n side = partPos % 2 ? \"right\" : \"left\";\n }\n var result = nodeAndOffsetInLineMap(info.map, pos.ch, side);\n result.offset = result.collapse == \"right\" ? result.end : result.start;\n return result\n }\n\n function isInGutter(node) {\n for (var scan = node; scan; scan = scan.parentNode)\n { if (/CodeMirror-gutter-wrapper/.test(scan.className)) { return true } }\n return false\n }\n\n function badPos(pos, bad) { if (bad) { pos.bad = true; } return pos }\n\n function domTextBetween(cm, from, to, fromLine, toLine) {\n var text = \"\", closing = false, lineSep = cm.doc.lineSeparator(), extraLinebreak = false;\n function recognizeMarker(id) { return function (marker) { return marker.id == id; } }\n function close() {\n if (closing) {\n text += lineSep;\n if (extraLinebreak) { text += lineSep; }\n closing = extraLinebreak = false;\n }\n }\n function addText(str) {\n if (str) {\n close();\n text += str;\n }\n }\n function walk(node) {\n if (node.nodeType == 1) {\n var cmText = node.getAttribute(\"cm-text\");\n if (cmText) {\n addText(cmText);\n return\n }\n var markerID = node.getAttribute(\"cm-marker\"), range;\n if (markerID) {\n var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID));\n if (found.length && (range = found[0].find(0)))\n { addText(getBetween(cm.doc, range.from, range.to).join(lineSep)); }\n return\n }\n if (node.getAttribute(\"contenteditable\") == \"false\") { return }\n var isBlock = /^(pre|div|p|li|table|br)$/i.test(node.nodeName);\n if (!/^br$/i.test(node.nodeName) && node.textContent.length == 0) { return }\n\n if (isBlock) { close(); }\n for (var i = 0; i < node.childNodes.length; i++)\n { walk(node.childNodes[i]); }\n\n if (/^(pre|p)$/i.test(node.nodeName)) { extraLinebreak = true; }\n if (isBlock) { closing = true; }\n } else if (node.nodeType == 3) {\n addText(node.nodeValue.replace(/\\u200b/g, \"\").replace(/\\u00a0/g, \" \"));\n }\n }\n for (;;) {\n walk(from);\n if (from == to) { break }\n from = from.nextSibling;\n extraLinebreak = false;\n }\n return text\n }\n\n function domToPos(cm, node, offset) {\n var lineNode;\n if (node == cm.display.lineDiv) {\n lineNode = cm.display.lineDiv.childNodes[offset];\n if (!lineNode) { return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true) }\n node = null; offset = 0;\n } else {\n for (lineNode = node;; lineNode = lineNode.parentNode) {\n if (!lineNode || lineNode == cm.display.lineDiv) { return null }\n if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) { break }\n }\n }\n for (var i = 0; i < cm.display.view.length; i++) {\n var lineView = cm.display.view[i];\n if (lineView.node == lineNode)\n { return locateNodeInLineView(lineView, node, offset) }\n }\n }\n\n function locateNodeInLineView(lineView, node, offset) {\n var wrapper = lineView.text.firstChild, bad = false;\n if (!node || !contains(wrapper, node)) { return badPos(Pos(lineNo(lineView.line), 0), true) }\n if (node == wrapper) {\n bad = true;\n node = wrapper.childNodes[offset];\n offset = 0;\n if (!node) {\n var line = lineView.rest ? lst(lineView.rest) : lineView.line;\n return badPos(Pos(lineNo(line), line.text.length), bad)\n }\n }\n\n var textNode = node.nodeType == 3 ? node : null, topNode = node;\n if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {\n textNode = node.firstChild;\n if (offset) { offset = textNode.nodeValue.length; }\n }\n while (topNode.parentNode != wrapper) { topNode = topNode.parentNode; }\n var measure = lineView.measure, maps = measure.maps;\n\n function find(textNode, topNode, offset) {\n for (var i = -1; i < (maps ? maps.length : 0); i++) {\n var map = i < 0 ? measure.map : maps[i];\n for (var j = 0; j < map.length; j += 3) {\n var curNode = map[j + 2];\n if (curNode == textNode || curNode == topNode) {\n var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]);\n var ch = map[j] + offset;\n if (offset < 0 || curNode != textNode) { ch = map[j + (offset ? 1 : 0)]; }\n return Pos(line, ch)\n }\n }\n }\n }\n var found = find(textNode, topNode, offset);\n if (found) { return badPos(found, bad) }\n\n // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems\n for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) {\n found = find(after, after.firstChild, 0);\n if (found)\n { return badPos(Pos(found.line, found.ch - dist), bad) }\n else\n { dist += after.textContent.length; }\n }\n for (var before = topNode.previousSibling, dist$1 = offset; before; before = before.previousSibling) {\n found = find(before, before.firstChild, -1);\n if (found)\n { return badPos(Pos(found.line, found.ch + dist$1), bad) }\n else\n { dist$1 += before.textContent.length; }\n }\n }\n\n // TEXTAREA INPUT STYLE\n\n var TextareaInput = function(cm) {\n this.cm = cm;\n // See input.poll and input.reset\n this.prevInput = \"\";\n\n // Flag that indicates whether we expect input to appear real soon\n // now (after some event like 'keypress' or 'input') and are\n // polling intensively.\n this.pollingFast = false;\n // Self-resetting timeout for the poller\n this.polling = new Delayed();\n // Used to work around IE issue with selection being forgotten when focus moves away from textarea\n this.hasSelection = false;\n this.composing = null;\n };\n\n TextareaInput.prototype.init = function (display) {\n var this$1 = this;\n\n var input = this, cm = this.cm;\n this.createField(display);\n var te = this.textarea;\n\n display.wrapper.insertBefore(this.wrapper, display.wrapper.firstChild);\n\n // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)\n if (ios) { te.style.width = \"0px\"; }\n\n on(te, \"input\", function () {\n if (ie && ie_version >= 9 && this$1.hasSelection) { this$1.hasSelection = null; }\n input.poll();\n });\n\n on(te, \"paste\", function (e) {\n if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }\n\n cm.state.pasteIncoming = +new Date;\n input.fastPoll();\n });\n\n function prepareCopyCut(e) {\n if (signalDOMEvent(cm, e)) { return }\n if (cm.somethingSelected()) {\n setLastCopied({lineWise: false, text: cm.getSelections()});\n } else if (!cm.options.lineWiseCopyCut) {\n return\n } else {\n var ranges = copyableRanges(cm);\n setLastCopied({lineWise: true, text: ranges.text});\n if (e.type == \"cut\") {\n cm.setSelections(ranges.ranges, null, sel_dontScroll);\n } else {\n input.prevInput = \"\";\n te.value = ranges.text.join(\"\\n\");\n selectInput(te);\n }\n }\n if (e.type == \"cut\") { cm.state.cutIncoming = +new Date; }\n }\n on(te, \"cut\", prepareCopyCut);\n on(te, \"copy\", prepareCopyCut);\n\n on(display.scroller, \"paste\", function (e) {\n if (eventInWidget(display, e) || signalDOMEvent(cm, e)) { return }\n if (!te.dispatchEvent) {\n cm.state.pasteIncoming = +new Date;\n input.focus();\n return\n }\n\n // Pass the `paste` event to the textarea so it's handled by its event listener.\n var event = new Event(\"paste\");\n event.clipboardData = e.clipboardData;\n te.dispatchEvent(event);\n });\n\n // Prevent normal selection in the editor (we handle our own)\n on(display.lineSpace, \"selectstart\", function (e) {\n if (!eventInWidget(display, e)) { e_preventDefault(e); }\n });\n\n on(te, \"compositionstart\", function () {\n var start = cm.getCursor(\"from\");\n if (input.composing) { input.composing.range.clear(); }\n input.composing = {\n start: start,\n range: cm.markText(start, cm.getCursor(\"to\"), {className: \"CodeMirror-composing\"})\n };\n });\n on(te, \"compositionend\", function () {\n if (input.composing) {\n input.poll();\n input.composing.range.clear();\n input.composing = null;\n }\n });\n };\n\n TextareaInput.prototype.createField = function (_display) {\n // Wraps and hides input textarea\n this.wrapper = hiddenTextarea();\n // The semihidden textarea that is focused when the editor is\n // focused, and receives input.\n this.textarea = this.wrapper.firstChild;\n };\n\n TextareaInput.prototype.screenReaderLabelChanged = function (label) {\n // Label for screenreaders, accessibility\n if(label) {\n this.textarea.setAttribute('aria-label', label);\n } else {\n this.textarea.removeAttribute('aria-label');\n }\n };\n\n TextareaInput.prototype.prepareSelection = function () {\n // Redraw the selection and/or cursor\n var cm = this.cm, display = cm.display, doc = cm.doc;\n var result = prepareSelection(cm);\n\n // Move the hidden textarea near the cursor to prevent scrolling artifacts\n if (cm.options.moveInputWithCursor) {\n var headPos = cursorCoords(cm, doc.sel.primary().head, \"div\");\n var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect();\n result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10,\n headPos.top + lineOff.top - wrapOff.top));\n result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10,\n headPos.left + lineOff.left - wrapOff.left));\n }\n\n return result\n };\n\n TextareaInput.prototype.showSelection = function (drawn) {\n var cm = this.cm, display = cm.display;\n removeChildrenAndAdd(display.cursorDiv, drawn.cursors);\n removeChildrenAndAdd(display.selectionDiv, drawn.selection);\n if (drawn.teTop != null) {\n this.wrapper.style.top = drawn.teTop + \"px\";\n this.wrapper.style.left = drawn.teLeft + \"px\";\n }\n };\n\n // Reset the input to correspond to the selection (or to be empty,\n // when not typing and nothing is selected)\n TextareaInput.prototype.reset = function (typing) {\n if (this.contextMenuPending || this.composing) { return }\n var cm = this.cm;\n if (cm.somethingSelected()) {\n this.prevInput = \"\";\n var content = cm.getSelection();\n this.textarea.value = content;\n if (cm.state.focused) { selectInput(this.textarea); }\n if (ie && ie_version >= 9) { this.hasSelection = content; }\n } else if (!typing) {\n this.prevInput = this.textarea.value = \"\";\n if (ie && ie_version >= 9) { this.hasSelection = null; }\n }\n };\n\n TextareaInput.prototype.getField = function () { return this.textarea };\n\n TextareaInput.prototype.supportsTouch = function () { return false };\n\n TextareaInput.prototype.focus = function () {\n if (this.cm.options.readOnly != \"nocursor\" && (!mobile || activeElt() != this.textarea)) {\n try { this.textarea.focus(); }\n catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM\n }\n };\n\n TextareaInput.prototype.blur = function () { this.textarea.blur(); };\n\n TextareaInput.prototype.resetPosition = function () {\n this.wrapper.style.top = this.wrapper.style.left = 0;\n };\n\n TextareaInput.prototype.receivedFocus = function () { this.slowPoll(); };\n\n // Poll for input changes, using the normal rate of polling. This\n // runs as long as the editor is focused.\n TextareaInput.prototype.slowPoll = function () {\n var this$1 = this;\n\n if (this.pollingFast) { return }\n this.polling.set(this.cm.options.pollInterval, function () {\n this$1.poll();\n if (this$1.cm.state.focused) { this$1.slowPoll(); }\n });\n };\n\n // When an event has just come in that is likely to add or change\n // something in the input textarea, we poll faster, to ensure that\n // the change appears on the screen quickly.\n TextareaInput.prototype.fastPoll = function () {\n var missed = false, input = this;\n input.pollingFast = true;\n function p() {\n var changed = input.poll();\n if (!changed && !missed) {missed = true; input.polling.set(60, p);}\n else {input.pollingFast = false; input.slowPoll();}\n }\n input.polling.set(20, p);\n };\n\n // Read input from the textarea, and update the document to match.\n // When something is selected, it is present in the textarea, and\n // selected (unless it is huge, in which case a placeholder is\n // used). When nothing is selected, the cursor sits after previously\n // seen text (can be empty), which is stored in prevInput (we must\n // not reset the textarea when typing, because that breaks IME).\n TextareaInput.prototype.poll = function () {\n var this$1 = this;\n\n var cm = this.cm, input = this.textarea, prevInput = this.prevInput;\n // Since this is called a *lot*, try to bail out as cheaply as\n // possible when it is clear that nothing happened. hasSelection\n // will be the case when there is a lot of text in the textarea,\n // in which case reading its value would be expensive.\n if (this.contextMenuPending || !cm.state.focused ||\n (hasSelection(input) && !prevInput && !this.composing) ||\n cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq)\n { return false }\n\n var text = input.value;\n // If nothing changed, bail.\n if (text == prevInput && !cm.somethingSelected()) { return false }\n // Work around nonsensical selection resetting in IE9/10, and\n // inexplicable appearance of private area unicode characters on\n // some key combos in Mac (#2689).\n if (ie && ie_version >= 9 && this.hasSelection === text ||\n mac && /[\\uf700-\\uf7ff]/.test(text)) {\n cm.display.input.reset();\n return false\n }\n\n if (cm.doc.sel == cm.display.selForContextMenu) {\n var first = text.charCodeAt(0);\n if (first == 0x200b && !prevInput) { prevInput = \"\\u200b\"; }\n if (first == 0x21da) { this.reset(); return this.cm.execCommand(\"undo\") }\n }\n // Find the part of the input that is actually new\n var same = 0, l = Math.min(prevInput.length, text.length);\n while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) { ++same; }\n\n runInOp(cm, function () {\n applyTextInput(cm, text.slice(same), prevInput.length - same,\n null, this$1.composing ? \"*compose\" : null);\n\n // Don't leave long text in the textarea, since it makes further polling slow\n if (text.length > 1000 || text.indexOf(\"\\n\") > -1) { input.value = this$1.prevInput = \"\"; }\n else { this$1.prevInput = text; }\n\n if (this$1.composing) {\n this$1.composing.range.clear();\n this$1.composing.range = cm.markText(this$1.composing.start, cm.getCursor(\"to\"),\n {className: \"CodeMirror-composing\"});\n }\n });\n return true\n };\n\n TextareaInput.prototype.ensurePolled = function () {\n if (this.pollingFast && this.poll()) { this.pollingFast = false; }\n };\n\n TextareaInput.prototype.onKeyPress = function () {\n if (ie && ie_version >= 9) { this.hasSelection = null; }\n this.fastPoll();\n };\n\n TextareaInput.prototype.onContextMenu = function (e) {\n var input = this, cm = input.cm, display = cm.display, te = input.textarea;\n if (input.contextMenuPending) { input.contextMenuPending(); }\n var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;\n if (!pos || presto) { return } // Opera is difficult.\n\n // Reset the current text selection only if the click is done outside of the selection\n // and 'resetSelectionOnContextMenu' option is true.\n var reset = cm.options.resetSelectionOnContextMenu;\n if (reset && cm.doc.sel.contains(pos) == -1)\n { operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll); }\n\n var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText;\n var wrapperBox = input.wrapper.offsetParent.getBoundingClientRect();\n input.wrapper.style.cssText = \"position: static\";\n te.style.cssText = \"position: absolute; width: 30px; height: 30px;\\n top: \" + (e.clientY - wrapperBox.top - 5) + \"px; left: \" + (e.clientX - wrapperBox.left - 5) + \"px;\\n z-index: 1000; background: \" + (ie ? \"rgba(255, 255, 255, .05)\" : \"transparent\") + \";\\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);\";\n var oldScrollY;\n if (webkit) { oldScrollY = window.scrollY; } // Work around Chrome issue (#2712)\n display.input.focus();\n if (webkit) { window.scrollTo(null, oldScrollY); }\n display.input.reset();\n // Adds \"Select all\" to context menu in FF\n if (!cm.somethingSelected()) { te.value = input.prevInput = \" \"; }\n input.contextMenuPending = rehide;\n display.selForContextMenu = cm.doc.sel;\n clearTimeout(display.detectingSelectAll);\n\n // Select-all will be greyed out if there's nothing to select, so\n // this adds a zero-width space so that we can later check whether\n // it got selected.\n function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }\n function rehide() {\n if (input.contextMenuPending != rehide) { return }\n input.contextMenuPending = false;\n input.wrapper.style.cssText = oldWrapperCSS;\n te.style.cssText = oldCSS;\n if (ie && ie_version < 9) { display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos); }\n\n // Try to detect the user choosing select-all\n if (te.selectionStart != null) {\n if (!ie || (ie && ie_version < 9)) { prepareSelectAllHack(); }\n var i = 0, poll = function () {\n if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 &&\n te.selectionEnd > 0 && input.prevInput == \"\\u200b\") {\n operation(cm, selectAll)(cm);\n } else if (i++ < 10) {\n display.detectingSelectAll = setTimeout(poll, 500);\n } else {\n display.selForContextMenu = null;\n display.input.reset();\n }\n };\n display.detectingSelectAll = setTimeout(poll, 200);\n }\n }\n\n if (ie && ie_version >= 9) { prepareSelectAllHack(); }\n if (captureRightClick) {\n e_stop(e);\n var mouseup = function () {\n off(window, \"mouseup\", mouseup);\n setTimeout(rehide, 20);\n };\n on(window, \"mouseup\", mouseup);\n } else {\n setTimeout(rehide, 50);\n }\n };\n\n TextareaInput.prototype.readOnlyChanged = function (val) {\n if (!val) { this.reset(); }\n this.textarea.disabled = val == \"nocursor\";\n this.textarea.readOnly = !!val;\n };\n\n TextareaInput.prototype.setUneditable = function () {};\n\n TextareaInput.prototype.needsContentAttribute = false;\n\n function fromTextArea(textarea, options) {\n options = options ? copyObj(options) : {};\n options.value = textarea.value;\n if (!options.tabindex && textarea.tabIndex)\n { options.tabindex = textarea.tabIndex; }\n if (!options.placeholder && textarea.placeholder)\n { options.placeholder = textarea.placeholder; }\n // Set autofocus to true if this textarea is focused, or if it has\n // autofocus and no other element is focused.\n if (options.autofocus == null) {\n var hasFocus = activeElt();\n options.autofocus = hasFocus == textarea ||\n textarea.getAttribute(\"autofocus\") != null && hasFocus == document.body;\n }\n\n function save() {textarea.value = cm.getValue();}\n\n var realSubmit;\n if (textarea.form) {\n on(textarea.form, \"submit\", save);\n // Deplorable hack to make the submit method do the right thing.\n if (!options.leaveSubmitMethodAlone) {\n var form = textarea.form;\n realSubmit = form.submit;\n try {\n var wrappedSubmit = form.submit = function () {\n save();\n form.submit = realSubmit;\n form.submit();\n form.submit = wrappedSubmit;\n };\n } catch(e) {}\n }\n }\n\n options.finishInit = function (cm) {\n cm.save = save;\n cm.getTextArea = function () { return textarea; };\n cm.toTextArea = function () {\n cm.toTextArea = isNaN; // Prevent this from being ran twice\n save();\n textarea.parentNode.removeChild(cm.getWrapperElement());\n textarea.style.display = \"\";\n if (textarea.form) {\n off(textarea.form, \"submit\", save);\n if (!options.leaveSubmitMethodAlone && typeof textarea.form.submit == \"function\")\n { textarea.form.submit = realSubmit; }\n }\n };\n };\n\n textarea.style.display = \"none\";\n var cm = CodeMirror(function (node) { return textarea.parentNode.insertBefore(node, textarea.nextSibling); },\n options);\n return cm\n }\n\n function addLegacyProps(CodeMirror) {\n CodeMirror.off = off;\n CodeMirror.on = on;\n CodeMirror.wheelEventPixels = wheelEventPixels;\n CodeMirror.Doc = Doc;\n CodeMirror.splitLines = splitLinesAuto;\n CodeMirror.countColumn = countColumn;\n CodeMirror.findColumn = findColumn;\n CodeMirror.isWordChar = isWordCharBasic;\n CodeMirror.Pass = Pass;\n CodeMirror.signal = signal;\n CodeMirror.Line = Line;\n CodeMirror.changeEnd = changeEnd;\n CodeMirror.scrollbarModel = scrollbarModel;\n CodeMirror.Pos = Pos;\n CodeMirror.cmpPos = cmp;\n CodeMirror.modes = modes;\n CodeMirror.mimeModes = mimeModes;\n CodeMirror.resolveMode = resolveMode;\n CodeMirror.getMode = getMode;\n CodeMirror.modeExtensions = modeExtensions;\n CodeMirror.extendMode = extendMode;\n CodeMirror.copyState = copyState;\n CodeMirror.startState = startState;\n CodeMirror.innerMode = innerMode;\n CodeMirror.commands = commands;\n CodeMirror.keyMap = keyMap;\n CodeMirror.keyName = keyName;\n CodeMirror.isModifierKey = isModifierKey;\n CodeMirror.lookupKey = lookupKey;\n CodeMirror.normalizeKeyMap = normalizeKeyMap;\n CodeMirror.StringStream = StringStream;\n CodeMirror.SharedTextMarker = SharedTextMarker;\n CodeMirror.TextMarker = TextMarker;\n CodeMirror.LineWidget = LineWidget;\n CodeMirror.e_preventDefault = e_preventDefault;\n CodeMirror.e_stopPropagation = e_stopPropagation;\n CodeMirror.e_stop = e_stop;\n CodeMirror.addClass = addClass;\n CodeMirror.contains = contains;\n CodeMirror.rmClass = rmClass;\n CodeMirror.keyNames = keyNames;\n }\n\n // EDITOR CONSTRUCTOR\n\n defineOptions(CodeMirror);\n\n addEditorMethods(CodeMirror);\n\n // Set up methods on CodeMirror's prototype to redirect to the editor's document.\n var dontDelegate = \"iter insert remove copy getEditor constructor\".split(\" \");\n for (var prop in Doc.prototype) { if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)\n { CodeMirror.prototype[prop] = (function(method) {\n return function() {return method.apply(this.doc, arguments)}\n })(Doc.prototype[prop]); } }\n\n eventMixin(Doc);\n CodeMirror.inputStyles = {\"textarea\": TextareaInput, \"contenteditable\": ContentEditableInput};\n\n // Extra arguments are stored as the mode's dependencies, which is\n // used by (legacy) mechanisms like loadmode.js to automatically\n // load a mode. (Preferred mechanism is the require/define calls.)\n CodeMirror.defineMode = function(name/*, mode, …*/) {\n if (!CodeMirror.defaults.mode && name != \"null\") { CodeMirror.defaults.mode = name; }\n defineMode.apply(this, arguments);\n };\n\n CodeMirror.defineMIME = defineMIME;\n\n // Minimal default mode.\n CodeMirror.defineMode(\"null\", function () { return ({token: function (stream) { return stream.skipToEnd(); }}); });\n CodeMirror.defineMIME(\"text/plain\", \"null\");\n\n // EXTENSIONS\n\n CodeMirror.defineExtension = function (name, func) {\n CodeMirror.prototype[name] = func;\n };\n CodeMirror.defineDocExtension = function (name, func) {\n Doc.prototype[name] = func;\n };\n\n CodeMirror.fromTextArea = fromTextArea;\n\n addLegacyProps(CodeMirror);\n\n CodeMirror.version = \"5.58.3\";\n\n return CodeMirror;\n\n})));\n","// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"))\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod)\n else // Plain browser env\n mod(CodeMirror)\n})(function(CodeMirror) {\n \"use strict\"\n\n CodeMirror.defineOption(\"autoRefresh\", false, function(cm, val) {\n if (cm.state.autoRefresh) {\n stopListening(cm, cm.state.autoRefresh)\n cm.state.autoRefresh = null\n }\n if (val && cm.display.wrapper.offsetHeight == 0)\n startListening(cm, cm.state.autoRefresh = {delay: val.delay || 250})\n })\n\n function startListening(cm, state) {\n function check() {\n if (cm.display.wrapper.offsetHeight) {\n stopListening(cm, state)\n if (cm.display.lastWrapHeight != cm.display.wrapper.clientHeight)\n cm.refresh()\n } else {\n state.timeout = setTimeout(check, state.delay)\n }\n }\n state.timeout = setTimeout(check, state.delay)\n state.hurry = function() {\n clearTimeout(state.timeout)\n state.timeout = setTimeout(check, 50)\n }\n CodeMirror.on(window, \"mouseup\", state.hurry)\n CodeMirror.on(window, \"keyup\", state.hurry)\n }\n\n function stopListening(_cm, state) {\n clearTimeout(state.timeout)\n CodeMirror.off(window, \"mouseup\", state.hurry)\n CodeMirror.off(window, \"keyup\", state.hurry)\n }\n});\n","// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n\"use strict\";\n\nvar htmlConfig = {\n autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,\n 'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,\n 'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true,\n 'track': true, 'wbr': true, 'menuitem': true},\n implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true,\n 'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true,\n 'th': true, 'tr': true},\n contextGrabbers: {\n 'dd': {'dd': true, 'dt': true},\n 'dt': {'dd': true, 'dt': true},\n 'li': {'li': true},\n 'option': {'option': true, 'optgroup': true},\n 'optgroup': {'optgroup': true},\n 'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true,\n 'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true,\n 'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true,\n 'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true,\n 'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true},\n 'rp': {'rp': true, 'rt': true},\n 'rt': {'rp': true, 'rt': true},\n 'tbody': {'tbody': true, 'tfoot': true},\n 'td': {'td': true, 'th': true},\n 'tfoot': {'tbody': true},\n 'th': {'td': true, 'th': true},\n 'thead': {'tbody': true, 'tfoot': true},\n 'tr': {'tr': true}\n },\n doNotIndent: {\"pre\": true},\n allowUnquoted: true,\n allowMissing: true,\n caseFold: true\n}\n\nvar xmlConfig = {\n autoSelfClosers: {},\n implicitlyClosed: {},\n contextGrabbers: {},\n doNotIndent: {},\n allowUnquoted: false,\n allowMissing: false,\n allowMissingTagName: false,\n caseFold: false\n}\n\nCodeMirror.defineMode(\"xml\", function(editorConf, config_) {\n var indentUnit = editorConf.indentUnit\n var config = {}\n var defaults = config_.htmlMode ? htmlConfig : xmlConfig\n for (var prop in defaults) config[prop] = defaults[prop]\n for (var prop in config_) config[prop] = config_[prop]\n\n // Return variables for tokenizers\n var type, setStyle;\n\n function inText(stream, state) {\n function chain(parser) {\n state.tokenize = parser;\n return parser(stream, state);\n }\n\n var ch = stream.next();\n if (ch == \"<\") {\n if (stream.eat(\"!\")) {\n if (stream.eat(\"[\")) {\n if (stream.match(\"CDATA[\")) return chain(inBlock(\"atom\", \"]]>\"));\n else return null;\n } else if (stream.match(\"--\")) {\n return chain(inBlock(\"comment\", \"-->\"));\n } else if (stream.match(\"DOCTYPE\", true, true)) {\n stream.eatWhile(/[\\w\\._\\-]/);\n return chain(doctype(1));\n } else {\n return null;\n }\n } else if (stream.eat(\"?\")) {\n stream.eatWhile(/[\\w\\._\\-]/);\n state.tokenize = inBlock(\"meta\", \"?>\");\n return \"meta\";\n } else {\n type = stream.eat(\"/\") ? \"closeTag\" : \"openTag\";\n state.tokenize = inTag;\n return \"tag bracket\";\n }\n } else if (ch == \"&\") {\n var ok;\n if (stream.eat(\"#\")) {\n if (stream.eat(\"x\")) {\n ok = stream.eatWhile(/[a-fA-F\\d]/) && stream.eat(\";\");\n } else {\n ok = stream.eatWhile(/[\\d]/) && stream.eat(\";\");\n }\n } else {\n ok = stream.eatWhile(/[\\w\\.\\-:]/) && stream.eat(\";\");\n }\n return ok ? \"atom\" : \"error\";\n } else {\n stream.eatWhile(/[^&<]/);\n return null;\n }\n }\n inText.isInText = true;\n\n function inTag(stream, state) {\n var ch = stream.next();\n if (ch == \">\" || (ch == \"/\" && stream.eat(\">\"))) {\n state.tokenize = inText;\n type = ch == \">\" ? \"endTag\" : \"selfcloseTag\";\n return \"tag bracket\";\n } else if (ch == \"=\") {\n type = \"equals\";\n return null;\n } else if (ch == \"<\") {\n state.tokenize = inText;\n state.state = baseState;\n state.tagName = state.tagStart = null;\n var next = state.tokenize(stream, state);\n return next ? next + \" tag error\" : \"tag error\";\n } else if (/[\\'\\\"]/.test(ch)) {\n state.tokenize = inAttribute(ch);\n state.stringStartCol = stream.column();\n return state.tokenize(stream, state);\n } else {\n stream.match(/^[^\\s\\u00a0=<>\\\"\\']*[^\\s\\u00a0=<>\\\"\\'\\/]/);\n return \"word\";\n }\n }\n\n function inAttribute(quote) {\n var closure = function(stream, state) {\n while (!stream.eol()) {\n if (stream.next() == quote) {\n state.tokenize = inTag;\n break;\n }\n }\n return \"string\";\n };\n closure.isInAttribute = true;\n return closure;\n }\n\n function inBlock(style, terminator) {\n return function(stream, state) {\n while (!stream.eol()) {\n if (stream.match(terminator)) {\n state.tokenize = inText;\n break;\n }\n stream.next();\n }\n return style;\n }\n }\n\n function doctype(depth) {\n return function(stream, state) {\n var ch;\n while ((ch = stream.next()) != null) {\n if (ch == \"<\") {\n state.tokenize = doctype(depth + 1);\n return state.tokenize(stream, state);\n } else if (ch == \">\") {\n if (depth == 1) {\n state.tokenize = inText;\n break;\n } else {\n state.tokenize = doctype(depth - 1);\n return state.tokenize(stream, state);\n }\n }\n }\n return \"meta\";\n };\n }\n\n function Context(state, tagName, startOfLine) {\n this.prev = state.context;\n this.tagName = tagName || \"\";\n this.indent = state.indented;\n this.startOfLine = startOfLine;\n if (config.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent))\n this.noIndent = true;\n }\n function popContext(state) {\n if (state.context) state.context = state.context.prev;\n }\n function maybePopContext(state, nextTagName) {\n var parentTagName;\n while (true) {\n if (!state.context) {\n return;\n }\n parentTagName = state.context.tagName;\n if (!config.contextGrabbers.hasOwnProperty(parentTagName) ||\n !config.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {\n return;\n }\n popContext(state);\n }\n }\n\n function baseState(type, stream, state) {\n if (type == \"openTag\") {\n state.tagStart = stream.column();\n return tagNameState;\n } else if (type == \"closeTag\") {\n return closeTagNameState;\n } else {\n return baseState;\n }\n }\n function tagNameState(type, stream, state) {\n if (type == \"word\") {\n state.tagName = stream.current();\n setStyle = \"tag\";\n return attrState;\n } else if (config.allowMissingTagName && type == \"endTag\") {\n setStyle = \"tag bracket\";\n return attrState(type, stream, state);\n } else {\n setStyle = \"error\";\n return tagNameState;\n }\n }\n function closeTagNameState(type, stream, state) {\n if (type == \"word\") {\n var tagName = stream.current();\n if (state.context && state.context.tagName != tagName &&\n config.implicitlyClosed.hasOwnProperty(state.context.tagName))\n popContext(state);\n if ((state.context && state.context.tagName == tagName) || config.matchClosing === false) {\n setStyle = \"tag\";\n return closeState;\n } else {\n setStyle = \"tag error\";\n return closeStateErr;\n }\n } else if (config.allowMissingTagName && type == \"endTag\") {\n setStyle = \"tag bracket\";\n return closeState(type, stream, state);\n } else {\n setStyle = \"error\";\n return closeStateErr;\n }\n }\n\n function closeState(type, _stream, state) {\n if (type != \"endTag\") {\n setStyle = \"error\";\n return closeState;\n }\n popContext(state);\n return baseState;\n }\n function closeStateErr(type, stream, state) {\n setStyle = \"error\";\n return closeState(type, stream, state);\n }\n\n function attrState(type, _stream, state) {\n if (type == \"word\") {\n setStyle = \"attribute\";\n return attrEqState;\n } else if (type == \"endTag\" || type == \"selfcloseTag\") {\n var tagName = state.tagName, tagStart = state.tagStart;\n state.tagName = state.tagStart = null;\n if (type == \"selfcloseTag\" ||\n config.autoSelfClosers.hasOwnProperty(tagName)) {\n maybePopContext(state, tagName);\n } else {\n maybePopContext(state, tagName);\n state.context = new Context(state, tagName, tagStart == state.indented);\n }\n return baseState;\n }\n setStyle = \"error\";\n return attrState;\n }\n function attrEqState(type, stream, state) {\n if (type == \"equals\") return attrValueState;\n if (!config.allowMissing) setStyle = \"error\";\n return attrState(type, stream, state);\n }\n function attrValueState(type, stream, state) {\n if (type == \"string\") return attrContinuedState;\n if (type == \"word\" && config.allowUnquoted) {setStyle = \"string\"; return attrState;}\n setStyle = \"error\";\n return attrState(type, stream, state);\n }\n function attrContinuedState(type, stream, state) {\n if (type == \"string\") return attrContinuedState;\n return attrState(type, stream, state);\n }\n\n return {\n startState: function(baseIndent) {\n var state = {tokenize: inText,\n state: baseState,\n indented: baseIndent || 0,\n tagName: null, tagStart: null,\n context: null}\n if (baseIndent != null) state.baseIndent = baseIndent\n return state\n },\n\n token: function(stream, state) {\n if (!state.tagName && stream.sol())\n state.indented = stream.indentation();\n\n if (stream.eatSpace()) return null;\n type = null;\n var style = state.tokenize(stream, state);\n if ((style || type) && style != \"comment\") {\n setStyle = null;\n state.state = state.state(type || style, stream, state);\n if (setStyle)\n style = setStyle == \"error\" ? style + \" error\" : setStyle;\n }\n return style;\n },\n\n indent: function(state, textAfter, fullLine) {\n var context = state.context;\n // Indent multi-line strings (e.g. css).\n if (state.tokenize.isInAttribute) {\n if (state.tagStart == state.indented)\n return state.stringStartCol + 1;\n else\n return state.indented + indentUnit;\n }\n if (context && context.noIndent) return CodeMirror.Pass;\n if (state.tokenize != inTag && state.tokenize != inText)\n return fullLine ? fullLine.match(/^(\\s*)/)[0].length : 0;\n // Indent the starts of attribute names.\n if (state.tagName) {\n if (config.multilineTagIndentPastTag !== false)\n return state.tagStart + state.tagName.length + 2;\n else\n return state.tagStart + indentUnit * (config.multilineTagIndentFactor || 1);\n }\n if (config.alignCDATA && /<!\\[CDATA\\[/.test(textAfter)) return 0;\n var tagAfter = textAfter && /^<(\\/)?([\\w_:\\.-]*)/.exec(textAfter);\n if (tagAfter && tagAfter[1]) { // Closing tag spotted\n while (context) {\n if (context.tagName == tagAfter[2]) {\n context = context.prev;\n break;\n } else if (config.implicitlyClosed.hasOwnProperty(context.tagName)) {\n context = context.prev;\n } else {\n break;\n }\n }\n } else if (tagAfter) { // Opening tag spotted\n while (context) {\n var grabbers = config.contextGrabbers[context.tagName];\n if (grabbers && grabbers.hasOwnProperty(tagAfter[2]))\n context = context.prev;\n else\n break;\n }\n }\n while (context && context.prev && !context.startOfLine)\n context = context.prev;\n if (context) return context.indent + indentUnit;\n else return state.baseIndent || 0;\n },\n\n electricInput: /<\\/[\\s\\w:]+>$/,\n blockCommentStart: \"<!--\",\n blockCommentEnd: \"-->\",\n\n configuration: config.htmlMode ? \"html\" : \"xml\",\n helperType: config.htmlMode ? \"html\" : \"xml\",\n\n skipAttribute: function(state) {\n if (state.state == attrValueState)\n state.state = attrState\n },\n\n xmlCurrentTag: function(state) {\n return state.tagName ? {name: state.tagName, close: state.type == \"closeTag\"} : null\n },\n\n xmlCurrentContext: function(state) {\n var context = []\n for (var cx = state.context; cx; cx = cx.prev)\n context.push(cx.tagName)\n return context.reverse()\n }\n };\n});\n\nCodeMirror.defineMIME(\"text/xml\", \"xml\");\nCodeMirror.defineMIME(\"application/xml\", \"xml\");\nif (!CodeMirror.mimeModes.hasOwnProperty(\"text/html\"))\n CodeMirror.defineMIME(\"text/html\", {name: \"xml\", htmlMode: true});\n\n});\n","// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n\"use strict\";\n\nCodeMirror.defineMode(\"yaml\", function() {\n\n var cons = ['true', 'false', 'on', 'off', 'yes', 'no'];\n var keywordRegex = new RegExp(\"\\\\b((\"+cons.join(\")|(\")+\"))$\", 'i');\n\n return {\n token: function(stream, state) {\n var ch = stream.peek();\n var esc = state.escaped;\n state.escaped = false;\n /* comments */\n if (ch == \"#\" && (stream.pos == 0 || /\\s/.test(stream.string.charAt(stream.pos - 1)))) {\n stream.skipToEnd();\n return \"comment\";\n }\n\n if (stream.match(/^('([^']|\\\\.)*'?|\"([^\"]|\\\\.)*\"?)/))\n return \"string\";\n\n if (state.literal && stream.indentation() > state.keyCol) {\n stream.skipToEnd(); return \"string\";\n } else if (state.literal) { state.literal = false; }\n if (stream.sol()) {\n state.keyCol = 0;\n state.pair = false;\n state.pairStart = false;\n /* document start */\n if(stream.match(/---/)) { return \"def\"; }\n /* document end */\n if (stream.match(/\\.\\.\\./)) { return \"def\"; }\n /* array list item */\n if (stream.match(/\\s*-\\s+/)) { return 'meta'; }\n }\n /* inline pairs/lists */\n if (stream.match(/^(\\{|\\}|\\[|\\])/)) {\n if (ch == '{')\n state.inlinePairs++;\n else if (ch == '}')\n state.inlinePairs--;\n else if (ch == '[')\n state.inlineList++;\n else\n state.inlineList--;\n return 'meta';\n }\n\n /* list seperator */\n if (state.inlineList > 0 && !esc && ch == ',') {\n stream.next();\n return 'meta';\n }\n /* pairs seperator */\n if (state.inlinePairs > 0 && !esc && ch == ',') {\n state.keyCol = 0;\n state.pair = false;\n state.pairStart = false;\n stream.next();\n return 'meta';\n }\n\n /* start of value of a pair */\n if (state.pairStart) {\n /* block literals */\n if (stream.match(/^\\s*(\\||\\>)\\s*/)) { state.literal = true; return 'meta'; };\n /* references */\n if (stream.match(/^\\s*(\\&|\\*)[a-z0-9\\._-]+\\b/i)) { return 'variable-2'; }\n /* numbers */\n if (state.inlinePairs == 0 && stream.match(/^\\s*-?[0-9\\.\\,]+\\s?$/)) { return 'number'; }\n if (state.inlinePairs > 0 && stream.match(/^\\s*-?[0-9\\.\\,]+\\s?(?=(,|}))/)) { return 'number'; }\n /* keywords */\n if (stream.match(keywordRegex)) { return 'keyword'; }\n }\n\n /* pairs (associative arrays) -> key */\n if (!state.pair && stream.match(/^\\s*(?:[,\\[\\]{}&*!|>'\"%@`][^\\s'\":]|[^,\\[\\]{}#&*!|>'\"%@`])[^#]*?(?=\\s*:($|\\s))/)) {\n state.pair = true;\n state.keyCol = stream.indentation();\n return \"atom\";\n }\n if (state.pair && stream.match(/^:\\s*/)) { state.pairStart = true; return 'meta'; }\n\n /* nothing found, continue */\n state.pairStart = false;\n state.escaped = (ch == '\\\\');\n stream.next();\n return null;\n },\n startState: function() {\n return {\n pair: false,\n pairStart: false,\n keyCol: 0,\n inlinePairs: 0,\n inlineList: 0,\n literal: false,\n escaped: false\n };\n },\n lineComment: \"#\",\n fold: \"indent\"\n };\n});\n\nCodeMirror.defineMIME(\"text/x-yaml\", \"yaml\");\nCodeMirror.defineMIME(\"text/yaml\", \"yaml\");\n\n});\n","// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n \"use strict\";\n\n function wordRegexp(words) {\n return new RegExp(\"^((\" + words.join(\")|(\") + \"))\\\\b\");\n }\n\n var wordOperators = wordRegexp([\"and\", \"or\", \"not\", \"is\"]);\n var commonKeywords = [\"as\", \"assert\", \"break\", \"class\", \"continue\",\n \"def\", \"del\", \"elif\", \"else\", \"except\", \"finally\",\n \"for\", \"from\", \"global\", \"if\", \"import\",\n \"lambda\", \"pass\", \"raise\", \"return\",\n \"try\", \"while\", \"with\", \"yield\", \"in\"];\n var commonBuiltins = [\"abs\", \"all\", \"any\", \"bin\", \"bool\", \"bytearray\", \"callable\", \"chr\",\n \"classmethod\", \"compile\", \"complex\", \"delattr\", \"dict\", \"dir\", \"divmod\",\n \"enumerate\", \"eval\", \"filter\", \"float\", \"format\", \"frozenset\",\n \"getattr\", \"globals\", \"hasattr\", \"hash\", \"help\", \"hex\", \"id\",\n \"input\", \"int\", \"isinstance\", \"issubclass\", \"iter\", \"len\",\n \"list\", \"locals\", \"map\", \"max\", \"memoryview\", \"min\", \"next\",\n \"object\", \"oct\", \"open\", \"ord\", \"pow\", \"property\", \"range\",\n \"repr\", \"reversed\", \"round\", \"set\", \"setattr\", \"slice\",\n \"sorted\", \"staticmethod\", \"str\", \"sum\", \"super\", \"tuple\",\n \"type\", \"vars\", \"zip\", \"__import__\", \"NotImplemented\",\n \"Ellipsis\", \"__debug__\"];\n CodeMirror.registerHelper(\"hintWords\", \"python\", commonKeywords.concat(commonBuiltins));\n\n function top(state) {\n return state.scopes[state.scopes.length - 1];\n }\n\n CodeMirror.defineMode(\"python\", function(conf, parserConf) {\n var ERRORCLASS = \"error\";\n\n var delimiters = parserConf.delimiters || parserConf.singleDelimiters || /^[\\(\\)\\[\\]\\{\\}@,:`=;\\.\\\\]/;\n // (Backwards-compatibility with old, cumbersome config system)\n var operators = [parserConf.singleOperators, parserConf.doubleOperators, parserConf.doubleDelimiters, parserConf.tripleDelimiters,\n parserConf.operators || /^([-+*/%\\/&|^]=?|[<>=]+|\\/\\/=?|\\*\\*=?|!=|[~!@]|\\.\\.\\.)/]\n for (var i = 0; i < operators.length; i++) if (!operators[i]) operators.splice(i--, 1)\n\n var hangingIndent = parserConf.hangingIndent || conf.indentUnit;\n\n var myKeywords = commonKeywords, myBuiltins = commonBuiltins;\n if (parserConf.extra_keywords != undefined)\n myKeywords = myKeywords.concat(parserConf.extra_keywords);\n\n if (parserConf.extra_builtins != undefined)\n myBuiltins = myBuiltins.concat(parserConf.extra_builtins);\n\n var py3 = !(parserConf.version && Number(parserConf.version) < 3)\n if (py3) {\n // since http://legacy.python.org/dev/peps/pep-0465/ @ is also an operator\n var identifiers = parserConf.identifiers|| /^[_A-Za-z\\u00A1-\\uFFFF][_A-Za-z0-9\\u00A1-\\uFFFF]*/;\n myKeywords = myKeywords.concat([\"nonlocal\", \"False\", \"True\", \"None\", \"async\", \"await\"]);\n myBuiltins = myBuiltins.concat([\"ascii\", \"bytes\", \"exec\", \"print\"]);\n var stringPrefixes = new RegExp(\"^(([rbuf]|(br)|(fr))?('{3}|\\\"{3}|['\\\"]))\", \"i\");\n } else {\n var identifiers = parserConf.identifiers|| /^[_A-Za-z][_A-Za-z0-9]*/;\n myKeywords = myKeywords.concat([\"exec\", \"print\"]);\n myBuiltins = myBuiltins.concat([\"apply\", \"basestring\", \"buffer\", \"cmp\", \"coerce\", \"execfile\",\n \"file\", \"intern\", \"long\", \"raw_input\", \"reduce\", \"reload\",\n \"unichr\", \"unicode\", \"xrange\", \"False\", \"True\", \"None\"]);\n var stringPrefixes = new RegExp(\"^(([rubf]|(ur)|(br))?('{3}|\\\"{3}|['\\\"]))\", \"i\");\n }\n var keywords = wordRegexp(myKeywords);\n var builtins = wordRegexp(myBuiltins);\n\n // tokenizers\n function tokenBase(stream, state) {\n var sol = stream.sol() && state.lastToken != \"\\\\\"\n if (sol) state.indent = stream.indentation()\n // Handle scope changes\n if (sol && top(state).type == \"py\") {\n var scopeOffset = top(state).offset;\n if (stream.eatSpace()) {\n var lineOffset = stream.indentation();\n if (lineOffset > scopeOffset)\n pushPyScope(state);\n else if (lineOffset < scopeOffset && dedent(stream, state) && stream.peek() != \"#\")\n state.errorToken = true;\n return null;\n } else {\n var style = tokenBaseInner(stream, state);\n if (scopeOffset > 0 && dedent(stream, state))\n style += \" \" + ERRORCLASS;\n return style;\n }\n }\n return tokenBaseInner(stream, state);\n }\n\n function tokenBaseInner(stream, state, inFormat) {\n if (stream.eatSpace()) return null;\n\n // Handle Comments\n if (!inFormat && stream.match(/^#.*/)) return \"comment\";\n\n // Handle Number Literals\n if (stream.match(/^[0-9\\.]/, false)) {\n var floatLiteral = false;\n // Floats\n if (stream.match(/^[\\d_]*\\.\\d+(e[\\+\\-]?\\d+)?/i)) { floatLiteral = true; }\n if (stream.match(/^[\\d_]+\\.\\d*/)) { floatLiteral = true; }\n if (stream.match(/^\\.\\d+/)) { floatLiteral = true; }\n if (floatLiteral) {\n // Float literals may be \"imaginary\"\n stream.eat(/J/i);\n return \"number\";\n }\n // Integers\n var intLiteral = false;\n // Hex\n if (stream.match(/^0x[0-9a-f_]+/i)) intLiteral = true;\n // Binary\n if (stream.match(/^0b[01_]+/i)) intLiteral = true;\n // Octal\n if (stream.match(/^0o[0-7_]+/i)) intLiteral = true;\n // Decimal\n if (stream.match(/^[1-9][\\d_]*(e[\\+\\-]?[\\d_]+)?/)) {\n // Decimal literals may be \"imaginary\"\n stream.eat(/J/i);\n // TODO - Can you have imaginary longs?\n intLiteral = true;\n }\n // Zero by itself with no other piece of number.\n if (stream.match(/^0(?![\\dx])/i)) intLiteral = true;\n if (intLiteral) {\n // Integer literals may be \"long\"\n stream.eat(/L/i);\n return \"number\";\n }\n }\n\n // Handle Strings\n if (stream.match(stringPrefixes)) {\n var isFmtString = stream.current().toLowerCase().indexOf('f') !== -1;\n if (!isFmtString) {\n state.tokenize = tokenStringFactory(stream.current(), state.tokenize);\n return state.tokenize(stream, state);\n } else {\n state.tokenize = formatStringFactory(stream.current(), state.tokenize);\n return state.tokenize(stream, state);\n }\n }\n\n for (var i = 0; i < operators.length; i++)\n if (stream.match(operators[i])) return \"operator\"\n\n if (stream.match(delimiters)) return \"punctuation\";\n\n if (state.lastToken == \".\" && stream.match(identifiers))\n return \"property\";\n\n if (stream.match(keywords) || stream.match(wordOperators))\n return \"keyword\";\n\n if (stream.match(builtins))\n return \"builtin\";\n\n if (stream.match(/^(self|cls)\\b/))\n return \"variable-2\";\n\n if (stream.match(identifiers)) {\n if (state.lastToken == \"def\" || state.lastToken == \"class\")\n return \"def\";\n return \"variable\";\n }\n\n // Handle non-detected items\n stream.next();\n return inFormat ? null :ERRORCLASS;\n }\n\n function formatStringFactory(delimiter, tokenOuter) {\n while (\"rubf\".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)\n delimiter = delimiter.substr(1);\n\n var singleline = delimiter.length == 1;\n var OUTCLASS = \"string\";\n\n function tokenNestedExpr(depth) {\n return function(stream, state) {\n var inner = tokenBaseInner(stream, state, true)\n if (inner == \"punctuation\") {\n if (stream.current() == \"{\") {\n state.tokenize = tokenNestedExpr(depth + 1)\n } else if (stream.current() == \"}\") {\n if (depth > 1) state.tokenize = tokenNestedExpr(depth - 1)\n else state.tokenize = tokenString\n }\n }\n return inner\n }\n }\n\n function tokenString(stream, state) {\n while (!stream.eol()) {\n stream.eatWhile(/[^'\"\\{\\}\\\\]/);\n if (stream.eat(\"\\\\\")) {\n stream.next();\n if (singleline && stream.eol())\n return OUTCLASS;\n } else if (stream.match(delimiter)) {\n state.tokenize = tokenOuter;\n return OUTCLASS;\n } else if (stream.match('{{')) {\n // ignore {{ in f-str\n return OUTCLASS;\n } else if (stream.match('{', false)) {\n // switch to nested mode\n state.tokenize = tokenNestedExpr(0)\n if (stream.current()) return OUTCLASS;\n else return state.tokenize(stream, state)\n } else if (stream.match('}}')) {\n return OUTCLASS;\n } else if (stream.match('}')) {\n // single } in f-string is an error\n return ERRORCLASS;\n } else {\n stream.eat(/['\"]/);\n }\n }\n if (singleline) {\n if (parserConf.singleLineStringErrors)\n return ERRORCLASS;\n else\n state.tokenize = tokenOuter;\n }\n return OUTCLASS;\n }\n tokenString.isString = true;\n return tokenString;\n }\n\n function tokenStringFactory(delimiter, tokenOuter) {\n while (\"rubf\".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)\n delimiter = delimiter.substr(1);\n\n var singleline = delimiter.length == 1;\n var OUTCLASS = \"string\";\n\n function tokenString(stream, state) {\n while (!stream.eol()) {\n stream.eatWhile(/[^'\"\\\\]/);\n if (stream.eat(\"\\\\\")) {\n stream.next();\n if (singleline && stream.eol())\n return OUTCLASS;\n } else if (stream.match(delimiter)) {\n state.tokenize = tokenOuter;\n return OUTCLASS;\n } else {\n stream.eat(/['\"]/);\n }\n }\n if (singleline) {\n if (parserConf.singleLineStringErrors)\n return ERRORCLASS;\n else\n state.tokenize = tokenOuter;\n }\n return OUTCLASS;\n }\n tokenString.isString = true;\n return tokenString;\n }\n\n function pushPyScope(state) {\n while (top(state).type != \"py\") state.scopes.pop()\n state.scopes.push({offset: top(state).offset + conf.indentUnit,\n type: \"py\",\n align: null})\n }\n\n function pushBracketScope(stream, state, type) {\n var align = stream.match(/^([\\s\\[\\{\\(]|#.*)*$/, false) ? null : stream.column() + 1\n state.scopes.push({offset: state.indent + hangingIndent,\n type: type,\n align: align})\n }\n\n function dedent(stream, state) {\n var indented = stream.indentation();\n while (state.scopes.length > 1 && top(state).offset > indented) {\n if (top(state).type != \"py\") return true;\n state.scopes.pop();\n }\n return top(state).offset != indented;\n }\n\n function tokenLexer(stream, state) {\n if (stream.sol()) state.beginningOfLine = true;\n\n var style = state.tokenize(stream, state);\n var current = stream.current();\n\n // Handle decorators\n if (state.beginningOfLine && current == \"@\")\n return stream.match(identifiers, false) ? \"meta\" : py3 ? \"operator\" : ERRORCLASS;\n\n if (/\\S/.test(current)) state.beginningOfLine = false;\n\n if ((style == \"variable\" || style == \"builtin\")\n && state.lastToken == \"meta\")\n style = \"meta\";\n\n // Handle scope changes.\n if (current == \"pass\" || current == \"return\")\n state.dedent += 1;\n\n if (current == \"lambda\") state.lambda = true;\n if (current == \":\" && !state.lambda && top(state).type == \"py\")\n pushPyScope(state);\n\n if (current.length == 1 && !/string|comment/.test(style)) {\n var delimiter_index = \"[({\".indexOf(current);\n if (delimiter_index != -1)\n pushBracketScope(stream, state, \"])}\".slice(delimiter_index, delimiter_index+1));\n\n delimiter_index = \"])}\".indexOf(current);\n if (delimiter_index != -1) {\n if (top(state).type == current) state.indent = state.scopes.pop().offset - hangingIndent\n else return ERRORCLASS;\n }\n }\n if (state.dedent > 0 && stream.eol() && top(state).type == \"py\") {\n if (state.scopes.length > 1) state.scopes.pop();\n state.dedent -= 1;\n }\n\n return style;\n }\n\n var external = {\n startState: function(basecolumn) {\n return {\n tokenize: tokenBase,\n scopes: [{offset: basecolumn || 0, type: \"py\", align: null}],\n indent: basecolumn || 0,\n lastToken: null,\n lambda: false,\n dedent: 0\n };\n },\n\n token: function(stream, state) {\n var addErr = state.errorToken;\n if (addErr) state.errorToken = false;\n var style = tokenLexer(stream, state);\n\n if (style && style != \"comment\")\n state.lastToken = (style == \"keyword\" || style == \"punctuation\") ? stream.current() : style;\n if (style == \"punctuation\") style = null;\n\n if (stream.eol() && state.lambda)\n state.lambda = false;\n return addErr ? style + \" \" + ERRORCLASS : style;\n },\n\n indent: function(state, textAfter) {\n if (state.tokenize != tokenBase)\n return state.tokenize.isString ? CodeMirror.Pass : 0;\n\n var scope = top(state), closing = scope.type == textAfter.charAt(0)\n if (scope.align != null)\n return scope.align - (closing ? 1 : 0)\n else\n return scope.offset - (closing ? hangingIndent : 0)\n },\n\n electricInput: /^\\s*[\\}\\]\\)]$/,\n closeBrackets: {triples: \"'\\\"\"},\n lineComment: \"#\",\n fold: \"indent\"\n };\n return external;\n });\n\n CodeMirror.defineMIME(\"text/x-python\", \"python\");\n\n var words = function(str) { return str.split(\" \"); };\n\n CodeMirror.defineMIME(\"text/x-cython\", {\n name: \"python\",\n extra_keywords: words(\"by cdef cimport cpdef ctypedef enum except \"+\n \"extern gil include nogil property public \"+\n \"readonly struct union DEF IF ELIF ELSE\")\n });\n\n});\n",null,null,null,null,null,null,null,null,null,"import { User } from './user';\n\n/**\n * @inheritdoc\n */\nexport interface Session extends SessionContext {\n /** JSDoc */\n update(context?: SessionContext): void;\n\n /** JSDoc */\n close(status?: SessionStatus): void;\n\n /** JSDoc */\n toJSON(): {\n init: boolean;\n sid: string;\n did?: string;\n timestamp: string;\n started: string;\n duration: number;\n status: SessionStatus;\n errors: number;\n attrs?: {\n release?: string;\n environment?: string;\n user_agent?: string;\n ip_address?: string;\n };\n };\n}\n\n/**\n * Session Context\n */\nexport interface SessionContext {\n sid?: string;\n did?: string;\n timestamp?: number;\n started?: number;\n duration?: number;\n status?: SessionStatus;\n release?: string;\n environment?: string;\n userAgent?: string;\n ipAddress?: string;\n errors?: number;\n user?: User | null;\n}\n\n/**\n * Session Status\n */\nexport enum SessionStatus {\n /** JSDoc */\n Ok = 'ok',\n /** JSDoc */\n Exited = 'exited',\n /** JSDoc */\n Crashed = 'crashed',\n /** JSDoc */\n Abnormal = 'abnormal',\n}\n","/** JSDoc */\n// eslint-disable-next-line import/export\nexport enum Severity {\n /** JSDoc */\n Fatal = 'fatal',\n /** JSDoc */\n Error = 'error',\n /** JSDoc */\n Warning = 'warning',\n /** JSDoc */\n Log = 'log',\n /** JSDoc */\n Info = 'info',\n /** JSDoc */\n Debug = 'debug',\n /** JSDoc */\n Critical = 'critical',\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace, import/export\nexport namespace Severity {\n /**\n * Converts a string-based level into a {@link Severity}.\n *\n * @param level string representation of Severity\n * @returns Severity\n */\n export function fromString(level: string): Severity {\n switch (level) {\n case 'debug':\n return Severity.Debug;\n case 'info':\n return Severity.Info;\n case 'warn':\n case 'warning':\n return Severity.Warning;\n case 'error':\n return Severity.Error;\n case 'fatal':\n return Severity.Fatal;\n case 'critical':\n return Severity.Critical;\n case 'log':\n default:\n return Severity.Log;\n }\n }\n}\n","/** The status of an event. */\n// eslint-disable-next-line import/export\nexport enum Status {\n /** The status could not be determined. */\n Unknown = 'unknown',\n /** The event was skipped due to configuration or callbacks. */\n Skipped = 'skipped',\n /** The event was sent to Sentry successfully. */\n Success = 'success',\n /** The client is currently rate limited and will try again later. */\n RateLimit = 'rate_limit',\n /** The event could not be processed. */\n Invalid = 'invalid',\n /** A server-side error ocurred during submission. */\n Failed = 'failed',\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace, import/export\nexport namespace Status {\n /**\n * Converts a HTTP status code into a {@link Status}.\n *\n * @param code The HTTP response status code.\n * @returns The send status or {@link Status.Unknown}.\n */\n export function fromHttpCode(code: number): Status {\n if (code >= 200 && code < 300) {\n return Status.Success;\n }\n\n if (code === 429) {\n return Status.RateLimit;\n }\n\n if (code >= 400 && code < 500) {\n return Status.Invalid;\n }\n\n if (code >= 500) {\n return Status.Failed;\n }\n\n return Status.Unknown;\n }\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n/**\n * Checks whether given value's type is one of a few Error or Error-like\n * {@link isError}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isError(wat: any): boolean {\n switch (Object.prototype.toString.call(wat)) {\n case '[object Error]':\n return true;\n case '[object Exception]':\n return true;\n case '[object DOMException]':\n return true;\n default:\n return isInstanceOf(wat, Error);\n }\n}\n\n/**\n * Checks whether given value's type is ErrorEvent\n * {@link isErrorEvent}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isErrorEvent(wat: any): boolean {\n return Object.prototype.toString.call(wat) === '[object ErrorEvent]';\n}\n\n/**\n * Checks whether given value's type is DOMError\n * {@link isDOMError}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isDOMError(wat: any): boolean {\n return Object.prototype.toString.call(wat) === '[object DOMError]';\n}\n\n/**\n * Checks whether given value's type is DOMException\n * {@link isDOMException}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isDOMException(wat: any): boolean {\n return Object.prototype.toString.call(wat) === '[object DOMException]';\n}\n\n/**\n * Checks whether given value's type is a string\n * {@link isString}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isString(wat: any): boolean {\n return Object.prototype.toString.call(wat) === '[object String]';\n}\n\n/**\n * Checks whether given value's is a primitive (undefined, null, number, boolean, string)\n * {@link isPrimitive}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isPrimitive(wat: any): boolean {\n return wat === null || (typeof wat !== 'object' && typeof wat !== 'function');\n}\n\n/**\n * Checks whether given value's type is an object literal\n * {@link isPlainObject}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isPlainObject(wat: any): boolean {\n return Object.prototype.toString.call(wat) === '[object Object]';\n}\n\n/**\n * Checks whether given value's type is an Event instance\n * {@link isEvent}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isEvent(wat: any): boolean {\n return typeof Event !== 'undefined' && isInstanceOf(wat, Event);\n}\n\n/**\n * Checks whether given value's type is an Element instance\n * {@link isElement}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isElement(wat: any): boolean {\n return typeof Element !== 'undefined' && isInstanceOf(wat, Element);\n}\n\n/**\n * Checks whether given value's type is an regexp\n * {@link isRegExp}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isRegExp(wat: any): boolean {\n return Object.prototype.toString.call(wat) === '[object RegExp]';\n}\n\n/**\n * Checks whether given value has a then function.\n * @param wat A value to be checked.\n */\nexport function isThenable(wat: any): boolean {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return Boolean(wat && wat.then && typeof wat.then === 'function');\n}\n\n/**\n * Checks whether given value's type is a SyntheticEvent\n * {@link isSyntheticEvent}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isSyntheticEvent(wat: any): boolean {\n return isPlainObject(wat) && 'nativeEvent' in wat && 'preventDefault' in wat && 'stopPropagation' in wat;\n}\n/**\n * Checks whether given value's type is an instance of provided constructor.\n * {@link isInstanceOf}.\n *\n * @param wat A value to be checked.\n * @param base A constructor to be used in a check.\n * @returns A boolean representing the result.\n */\nexport function isInstanceOf(wat: any, base: any): boolean {\n try {\n return wat instanceof base;\n } catch (_e) {\n return false;\n }\n}\n","import { isString } from './is';\n\n/**\n * Given a child DOM element, returns a query-selector statement describing that\n * and its ancestors\n * e.g. [HTMLElement] => body > div > input#foo.btn[name=baz]\n * @returns generated DOM path\n */\nexport function htmlTreeAsString(elem: unknown): string {\n type SimpleNode = {\n parentNode: SimpleNode;\n } | null;\n\n // try/catch both:\n // - accessing event.target (see getsentry/raven-js#838, #768)\n // - `htmlTreeAsString` because it's complex, and just accessing the DOM incorrectly\n // - can throw an exception in some circumstances.\n try {\n let currentElem = elem as SimpleNode;\n const MAX_TRAVERSE_HEIGHT = 5;\n const MAX_OUTPUT_LEN = 80;\n const out = [];\n let height = 0;\n let len = 0;\n const separator = ' > ';\n const sepLength = separator.length;\n let nextStr;\n\n // eslint-disable-next-line no-plusplus\n while (currentElem && height++ < MAX_TRAVERSE_HEIGHT) {\n nextStr = _htmlElementAsString(currentElem);\n // bail out if\n // - nextStr is the 'html' element\n // - the length of the string that would be created exceeds MAX_OUTPUT_LEN\n // (ignore this limit if we are on the first iteration)\n if (nextStr === 'html' || (height > 1 && len + out.length * sepLength + nextStr.length >= MAX_OUTPUT_LEN)) {\n break;\n }\n\n out.push(nextStr);\n\n len += nextStr.length;\n currentElem = currentElem.parentNode;\n }\n\n return out.reverse().join(separator);\n } catch (_oO) {\n return '<unknown>';\n }\n}\n\n/**\n * Returns a simple, query-selector representation of a DOM element\n * e.g. [HTMLElement] => input#foo.btn[name=baz]\n * @returns generated DOM path\n */\nfunction _htmlElementAsString(el: unknown): string {\n const elem = el as {\n tagName?: string;\n id?: string;\n className?: string;\n getAttribute(key: string): string;\n };\n\n const out = [];\n let className;\n let classes;\n let key;\n let attr;\n let i;\n\n if (!elem || !elem.tagName) {\n return '';\n }\n\n out.push(elem.tagName.toLowerCase());\n if (elem.id) {\n out.push(`#${elem.id}`);\n }\n\n // eslint-disable-next-line prefer-const\n className = elem.className;\n if (className && isString(className)) {\n classes = className.split(/\\s+/);\n for (i = 0; i < classes.length; i++) {\n out.push(`.${classes[i]}`);\n }\n }\n const allowedAttrs = ['type', 'name', 'title', 'alt'];\n for (i = 0; i < allowedAttrs.length; i++) {\n key = allowedAttrs[i];\n attr = elem.getAttribute(key);\n if (attr) {\n out.push(`[${key}=\"${attr}\"]`);\n }\n }\n return out.join('');\n}\n","export const setPrototypeOf =\n Object.setPrototypeOf || ({ __proto__: [] } instanceof Array ? setProtoOf : mixinProperties);\n\n/**\n * setPrototypeOf polyfill using __proto__\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction setProtoOf<TTarget extends object, TProto>(obj: TTarget, proto: TProto): TTarget & TProto {\n // @ts-ignore __proto__ does not exist on obj\n obj.__proto__ = proto;\n return obj as TTarget & TProto;\n}\n\n/**\n * setPrototypeOf polyfill using mixin\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction mixinProperties<TTarget extends object, TProto>(obj: TTarget, proto: TProto): TTarget & TProto {\n for (const prop in proto) {\n // eslint-disable-next-line no-prototype-builtins\n if (!obj.hasOwnProperty(prop)) {\n // @ts-ignore typescript complains about indexing so we remove\n obj[prop] = proto[prop];\n }\n }\n\n return obj as TTarget & TProto;\n}\n","import { setPrototypeOf } from './polyfill';\n\n/** An error emitted by Sentry SDKs and related utilities. */\nexport class SentryError extends Error {\n /** Display name of this error instance. */\n public name: string;\n\n public constructor(public message: string) {\n super(message);\n\n this.name = new.target.prototype.constructor.name;\n setPrototypeOf(this, new.target.prototype);\n }\n}\n","import { DsnComponents, DsnLike, DsnProtocol } from '@sentry/types';\n\nimport { SentryError } from './error';\n\n/** Regular expression used to parse a Dsn. */\nconst DSN_REGEX = /^(?:(\\w+):)\\/\\/(?:(\\w+)(?::(\\w+))?@)([\\w.-]+)(?::(\\d+))?\\/(.+)/;\n\n/** Error message */\nconst ERROR_MESSAGE = 'Invalid Dsn';\n\n/** The Sentry Dsn, identifying a Sentry instance and project. */\nexport class Dsn implements DsnComponents {\n /** Protocol used to connect to Sentry. */\n public protocol!: DsnProtocol;\n /** Public authorization key. */\n public user!: string;\n /** Private authorization key (deprecated, optional). */\n public pass!: string;\n /** Hostname of the Sentry instance. */\n public host!: string;\n /** Port of the Sentry instance. */\n public port!: string;\n /** Path */\n public path!: string;\n /** Project ID */\n public projectId!: string;\n\n /** Creates a new Dsn component */\n public constructor(from: DsnLike) {\n if (typeof from === 'string') {\n this._fromString(from);\n } else {\n this._fromComponents(from);\n }\n\n this._validate();\n }\n\n /**\n * Renders the string representation of this Dsn.\n *\n * By default, this will render the public representation without the password\n * component. To get the deprecated private representation, set `withPassword`\n * to true.\n *\n * @param withPassword When set to true, the password will be included.\n */\n public toString(withPassword: boolean = false): string {\n const { host, path, pass, port, projectId, protocol, user } = this;\n return (\n `${protocol}://${user}${withPassword && pass ? `:${pass}` : ''}` +\n `@${host}${port ? `:${port}` : ''}/${path ? `${path}/` : path}${projectId}`\n );\n }\n\n /** Parses a string into this Dsn. */\n private _fromString(str: string): void {\n const match = DSN_REGEX.exec(str);\n\n if (!match) {\n throw new SentryError(ERROR_MESSAGE);\n }\n\n const [protocol, user, pass = '', host, port = '', lastPath] = match.slice(1);\n let path = '';\n let projectId = lastPath;\n\n const split = projectId.split('/');\n if (split.length > 1) {\n path = split.slice(0, -1).join('/');\n projectId = split.pop() as string;\n }\n\n if (projectId) {\n const projectMatch = projectId.match(/^\\d+/);\n if (projectMatch) {\n projectId = projectMatch[0];\n }\n }\n\n this._fromComponents({ host, pass, path, projectId, port, protocol: protocol as DsnProtocol, user });\n }\n\n /** Maps Dsn components into this instance. */\n private _fromComponents(components: DsnComponents): void {\n this.protocol = components.protocol;\n this.user = components.user;\n this.pass = components.pass || '';\n this.host = components.host;\n this.port = components.port || '';\n this.path = components.path || '';\n this.projectId = components.projectId;\n }\n\n /** Validates this Dsn and throws on error. */\n private _validate(): void {\n ['protocol', 'user', 'host', 'projectId'].forEach(component => {\n if (!this[component as keyof DsnComponents]) {\n throw new SentryError(`${ERROR_MESSAGE}: ${component} missing`);\n }\n });\n\n if (!this.projectId.match(/^\\d+$/)) {\n throw new SentryError(`${ERROR_MESSAGE}: Invalid projectId ${this.projectId}`);\n }\n\n if (this.protocol !== 'http' && this.protocol !== 'https') {\n throw new SentryError(`${ERROR_MESSAGE}: Invalid protocol ${this.protocol}`);\n }\n\n if (this.port && isNaN(parseInt(this.port, 10))) {\n throw new SentryError(`${ERROR_MESSAGE}: Invalid port ${this.port}`);\n }\n }\n}\n","/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n/**\n * Memo class used for decycle json objects. Uses WeakSet if available otherwise array.\n */\nexport class Memo {\n /** Determines if WeakSet is available */\n private readonly _hasWeakSet: boolean;\n /** Either WeakSet or Array */\n private readonly _inner: any;\n\n public constructor() {\n this._hasWeakSet = typeof WeakSet === 'function';\n this._inner = this._hasWeakSet ? new WeakSet() : [];\n }\n\n /**\n * Sets obj to remember.\n * @param obj Object to remember\n */\n public memoize(obj: any): boolean {\n if (this._hasWeakSet) {\n if (this._inner.has(obj)) {\n return true;\n }\n this._inner.add(obj);\n return false;\n }\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < this._inner.length; i++) {\n const value = this._inner[i];\n if (value === obj) {\n return true;\n }\n }\n this._inner.push(obj);\n return false;\n }\n\n /**\n * Removes object from internal storage.\n * @param obj Object to forget\n */\n public unmemoize(obj: any): void {\n if (this._hasWeakSet) {\n this._inner.delete(obj);\n } else {\n for (let i = 0; i < this._inner.length; i++) {\n if (this._inner[i] === obj) {\n this._inner.splice(i, 1);\n break;\n }\n }\n }\n }\n}\n","const defaultFunctionName = '<anonymous>';\n\n/**\n * Safely extract function name from itself\n */\nexport function getFunctionName(fn: unknown): string {\n try {\n if (!fn || typeof fn !== 'function') {\n return defaultFunctionName;\n }\n return fn.name || defaultFunctionName;\n } catch (e) {\n // Just accessing custom props in some Selenium environments\n // can cause a \"Permission denied\" exception (see raven-js#495).\n return defaultFunctionName;\n }\n}\n","import { isRegExp, isString } from './is';\n\n/**\n * Truncates given string to the maximum characters count\n *\n * @param str An object that contains serializable values\n * @param max Maximum number of characters in truncated string\n * @returns string Encoded\n */\nexport function truncate(str: string, max: number = 0): string {\n if (typeof str !== 'string' || max === 0) {\n return str;\n }\n return str.length <= max ? str : `${str.substr(0, max)}...`;\n}\n\n/**\n * This is basically just `trim_line` from\n * https://github.com/getsentry/sentry/blob/master/src/sentry/lang/javascript/processor.py#L67\n *\n * @param str An object that contains serializable values\n * @param max Maximum number of characters in truncated string\n * @returns string Encoded\n */\nexport function snipLine(line: string, colno: number): string {\n let newLine = line;\n const ll = newLine.length;\n if (ll <= 150) {\n return newLine;\n }\n if (colno > ll) {\n // eslint-disable-next-line no-param-reassign\n colno = ll;\n }\n\n let start = Math.max(colno - 60, 0);\n if (start < 5) {\n start = 0;\n }\n\n let end = Math.min(start + 140, ll);\n if (end > ll - 5) {\n end = ll;\n }\n if (end === ll) {\n start = Math.max(end - 140, 0);\n }\n\n newLine = newLine.slice(start, end);\n if (start > 0) {\n newLine = `'{snip} ${newLine}`;\n }\n if (end < ll) {\n newLine += ' {snip}';\n }\n\n return newLine;\n}\n\n/**\n * Join values in array\n * @param input array of values to be joined together\n * @param delimiter string to be placed in-between values\n * @returns Joined values\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function safeJoin(input: any[], delimiter?: string): string {\n if (!Array.isArray(input)) {\n return '';\n }\n\n const output = [];\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < input.length; i++) {\n const value = input[i];\n try {\n output.push(String(value));\n } catch (e) {\n output.push('[value cannot be serialized]');\n }\n }\n\n return output.join(delimiter);\n}\n\n/**\n * Checks if the value matches a regex or includes the string\n * @param value The string value to be checked against\n * @param pattern Either a regex or a string that must be contained in value\n */\nexport function isMatchingPattern(value: string, pattern: RegExp | string): boolean {\n if (!isString(value)) {\n return false;\n }\n\n if (isRegExp(pattern)) {\n return (pattern as RegExp).test(value);\n }\n if (typeof pattern === 'string') {\n return value.indexOf(pattern) !== -1;\n }\n return false;\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { ExtendedError, WrappedFunction } from '@sentry/types';\n\nimport { htmlTreeAsString } from './browser';\nimport { isElement, isError, isEvent, isInstanceOf, isPlainObject, isPrimitive, isSyntheticEvent } from './is';\nimport { Memo } from './memo';\nimport { getFunctionName } from './stacktrace';\nimport { truncate } from './string';\n\n/**\n * Wrap a given object method with a higher-order function\n *\n * @param source An object that contains a method to be wrapped.\n * @param name A name of method to be wrapped.\n * @param replacement A function that should be used to wrap a given method.\n * @returns void\n */\nexport function fill(source: { [key: string]: any }, name: string, replacement: (...args: any[]) => any): void {\n if (!(name in source)) {\n return;\n }\n\n const original = source[name] as () => any;\n const wrapped = replacement(original) as WrappedFunction;\n\n // Make sure it's a function first, as we need to attach an empty prototype for `defineProperties` to work\n // otherwise it'll throw \"TypeError: Object.defineProperties called on non-object\"\n if (typeof wrapped === 'function') {\n try {\n wrapped.prototype = wrapped.prototype || {};\n Object.defineProperties(wrapped, {\n __sentry_original__: {\n enumerable: false,\n value: original,\n },\n });\n } catch (_Oo) {\n // This can throw if multiple fill happens on a global object like XMLHttpRequest\n // Fixes https://github.com/getsentry/sentry-javascript/issues/2043\n }\n }\n\n source[name] = wrapped;\n}\n\n/**\n * Encodes given object into url-friendly format\n *\n * @param object An object that contains serializable values\n * @returns string Encoded\n */\nexport function urlEncode(object: { [key: string]: any }): string {\n return Object.keys(object)\n .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(object[key])}`)\n .join('&');\n}\n\n/**\n * Transforms any object into an object literal with all it's attributes\n * attached to it.\n *\n * @param value Initial source that we have to transform in order to be usable by the serializer\n */\nfunction getWalkSource(\n value: any,\n): {\n [key: string]: any;\n} {\n if (isError(value)) {\n const error = value as ExtendedError;\n const err: {\n [key: string]: any;\n stack: string | undefined;\n message: string;\n name: string;\n } = {\n message: error.message,\n name: error.name,\n stack: error.stack,\n };\n\n for (const i in error) {\n if (Object.prototype.hasOwnProperty.call(error, i)) {\n err[i] = error[i];\n }\n }\n\n return err;\n }\n\n if (isEvent(value)) {\n /**\n * Event-like interface that's usable in browser and node\n */\n interface SimpleEvent {\n [key: string]: unknown;\n type: string;\n target?: unknown;\n currentTarget?: unknown;\n }\n\n const event = value as SimpleEvent;\n\n const source: {\n [key: string]: any;\n } = {};\n\n source.type = event.type;\n\n // Accessing event.target can throw (see getsentry/raven-js#838, #768)\n try {\n source.target = isElement(event.target)\n ? htmlTreeAsString(event.target)\n : Object.prototype.toString.call(event.target);\n } catch (_oO) {\n source.target = '<unknown>';\n }\n\n try {\n source.currentTarget = isElement(event.currentTarget)\n ? htmlTreeAsString(event.currentTarget)\n : Object.prototype.toString.call(event.currentTarget);\n } catch (_oO) {\n source.currentTarget = '<unknown>';\n }\n\n if (typeof CustomEvent !== 'undefined' && isInstanceOf(value, CustomEvent)) {\n source.detail = event.detail;\n }\n\n for (const i in event) {\n if (Object.prototype.hasOwnProperty.call(event, i)) {\n source[i] = event;\n }\n }\n\n return source;\n }\n\n return value as {\n [key: string]: any;\n };\n}\n\n/** Calculates bytes size of input string */\nfunction utf8Length(value: string): number {\n // eslint-disable-next-line no-bitwise\n return ~-encodeURI(value).split(/%..|./).length;\n}\n\n/** Calculates bytes size of input object */\nfunction jsonSize(value: any): number {\n return utf8Length(JSON.stringify(value));\n}\n\n/** JSDoc */\nexport function normalizeToSize<T>(\n object: { [key: string]: any },\n // Default Node.js REPL depth\n depth: number = 3,\n // 100kB, as 200kB is max payload size, so half sounds reasonable\n maxSize: number = 100 * 1024,\n): T {\n const serialized = normalize(object, depth);\n\n if (jsonSize(serialized) > maxSize) {\n return normalizeToSize(object, depth - 1, maxSize);\n }\n\n return serialized as T;\n}\n\n/** Transforms any input value into a string form, either primitive value or a type of the input */\nfunction serializeValue(value: any): any {\n const type = Object.prototype.toString.call(value);\n\n // Node.js REPL notation\n if (typeof value === 'string') {\n return value;\n }\n if (type === '[object Object]') {\n return '[Object]';\n }\n if (type === '[object Array]') {\n return '[Array]';\n }\n\n const normalized = normalizeValue(value);\n return isPrimitive(normalized) ? normalized : type;\n}\n\n/**\n * normalizeValue()\n *\n * Takes unserializable input and make it serializable friendly\n *\n * - translates undefined/NaN values to \"[undefined]\"/\"[NaN]\" respectively,\n * - serializes Error objects\n * - filter global objects\n */\nfunction normalizeValue<T>(value: T, key?: any): T | string {\n if (key === 'domain' && value && typeof value === 'object' && ((value as unknown) as { _events: any })._events) {\n return '[Domain]';\n }\n\n if (key === 'domainEmitter') {\n return '[DomainEmitter]';\n }\n\n if (typeof (global as any) !== 'undefined' && (value as unknown) === global) {\n return '[Global]';\n }\n\n if (typeof (window as any) !== 'undefined' && (value as unknown) === window) {\n return '[Window]';\n }\n\n if (typeof (document as any) !== 'undefined' && (value as unknown) === document) {\n return '[Document]';\n }\n\n // React's SyntheticEvent thingy\n if (isSyntheticEvent(value)) {\n return '[SyntheticEvent]';\n }\n\n if (typeof value === 'number' && value !== value) {\n return '[NaN]';\n }\n\n if (value === void 0) {\n return '[undefined]';\n }\n\n if (typeof value === 'function') {\n return `[Function: ${getFunctionName(value)}]`;\n }\n\n return value;\n}\n\n/**\n * Walks an object to perform a normalization on it\n *\n * @param key of object that's walked in current iteration\n * @param value object to be walked\n * @param depth Optional number indicating how deep should walking be performed\n * @param memo Optional Memo class handling decycling\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function walk(key: string, value: any, depth: number = +Infinity, memo: Memo = new Memo()): any {\n // If we reach the maximum depth, serialize whatever has left\n if (depth === 0) {\n return serializeValue(value);\n }\n\n /* eslint-disable @typescript-eslint/no-unsafe-member-access */\n // If value implements `toJSON` method, call it and return early\n if (value !== null && value !== undefined && typeof value.toJSON === 'function') {\n return value.toJSON();\n }\n /* eslint-enable @typescript-eslint/no-unsafe-member-access */\n\n // If normalized value is a primitive, there are no branches left to walk, so we can just bail out, as theres no point in going down that branch any further\n const normalized = normalizeValue(value, key);\n if (isPrimitive(normalized)) {\n return normalized;\n }\n\n // Create source that we will use for next itterations, either objectified error object (Error type with extracted keys:value pairs) or the input itself\n const source = getWalkSource(value);\n\n // Create an accumulator that will act as a parent for all future itterations of that branch\n const acc = Array.isArray(value) ? [] : {};\n\n // If we already walked that branch, bail out, as it's circular reference\n if (memo.memoize(value)) {\n return '[Circular ~]';\n }\n\n // Walk all keys of the source\n for (const innerKey in source) {\n // Avoid iterating over fields in the prototype if they've somehow been exposed to enumeration.\n if (!Object.prototype.hasOwnProperty.call(source, innerKey)) {\n continue;\n }\n // Recursively walk through all the child nodes\n (acc as { [key: string]: any })[innerKey] = walk(innerKey, source[innerKey], depth - 1, memo);\n }\n\n // Once walked through all the branches, remove the parent from memo storage\n memo.unmemoize(value);\n\n // Return accumulated values\n return acc;\n}\n\n/**\n * normalize()\n *\n * - Creates a copy to prevent original input mutation\n * - Skip non-enumerablers\n * - Calls `toJSON` if implemented\n * - Removes circular references\n * - Translates non-serializeable values (undefined/NaN/Functions) to serializable format\n * - Translates known global objects/Classes to a string representations\n * - Takes care of Error objects serialization\n * - Optionally limit depth of final output\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function normalize(input: any, depth?: number): any {\n try {\n return JSON.parse(JSON.stringify(input, (key: string, value: any) => walk(key, value, depth)));\n } catch (_oO) {\n return '**non-serializable**';\n }\n}\n\n/**\n * Given any captured exception, extract its keys and create a sorted\n * and truncated list that will be used inside the event message.\n * eg. `Non-error exception captured with keys: foo, bar, baz`\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function extractExceptionKeysForMessage(exception: any, maxLength: number = 40): string {\n const keys = Object.keys(getWalkSource(exception));\n keys.sort();\n\n if (!keys.length) {\n return '[object has no keys]';\n }\n\n if (keys[0].length >= maxLength) {\n return truncate(keys[0], maxLength);\n }\n\n for (let includedKeys = keys.length; includedKeys > 0; includedKeys--) {\n const serialized = keys.slice(0, includedKeys).join(', ');\n if (serialized.length > maxLength) {\n continue;\n }\n if (includedKeys === keys.length) {\n return serialized;\n }\n return truncate(serialized, maxLength);\n }\n\n return '';\n}\n\n/**\n * Given any object, return the new object with removed keys that value was `undefined`.\n * Works recursively on objects and arrays.\n */\nexport function dropUndefinedKeys<T>(val: T): T {\n if (isPlainObject(val)) {\n const obj = val as { [key: string]: any };\n const rv: { [key: string]: any } = {};\n for (const key of Object.keys(obj)) {\n if (typeof obj[key] !== 'undefined') {\n rv[key] = dropUndefinedKeys(obj[key]);\n }\n }\n return rv as T;\n }\n\n if (Array.isArray(val)) {\n return val.map(dropUndefinedKeys) as any;\n }\n\n return val;\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { ExtractedNodeRequestData } from '@sentry/types';\n\nimport { isString } from './is';\nimport { normalize } from './object';\n\n/**\n * Checks whether we're in the Node.js or Browser environment\n *\n * @returns Answer to given question\n */\nexport function isNodeEnv(): boolean {\n return Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]';\n}\n\n/**\n * Requires a module which is protected against bundler minification.\n *\n * @param request The module path to resolve\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function dynamicRequire(mod: any, request: string): any {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return mod.require(request);\n}\n\n/** Default request keys that'll be used to extract data from the request */\nconst DEFAULT_REQUEST_KEYS = ['cookies', 'data', 'headers', 'method', 'query_string', 'url'];\n\n/**\n * Normalizes data from the request object, accounting for framework differences.\n *\n * @param req The request object from which to extract data\n * @param keys An optional array of keys to include in the normalized data. Defaults to DEFAULT_REQUEST_KEYS if not\n * provided.\n * @returns An object containing normalized request data\n */\nexport function extractNodeRequestData(\n req: { [key: string]: any },\n keys: string[] = DEFAULT_REQUEST_KEYS,\n): ExtractedNodeRequestData {\n // make sure we can safely use dynamicRequire below\n if (!isNodeEnv()) {\n throw new Error(\"Can't get node request data outside of a node environment\");\n }\n\n const requestData: { [key: string]: any } = {};\n\n // headers:\n // node, express: req.headers\n // koa: req.header\n const headers = (req.headers || req.header || {}) as {\n host?: string;\n cookie?: string;\n };\n // method:\n // node, express, koa: req.method\n const method = req.method;\n // host:\n // express: req.hostname in > 4 and req.host in < 4\n // koa: req.host\n // node: req.headers.host\n const host = req.hostname || req.host || headers.host || '<no host>';\n // protocol:\n // node: <n/a>\n // express, koa: req.protocol\n const protocol =\n req.protocol === 'https' || req.secure || ((req.socket || {}) as { encrypted?: boolean }).encrypted\n ? 'https'\n : 'http';\n // url (including path and query string):\n // node, express: req.originalUrl\n // koa: req.url\n const originalUrl = (req.originalUrl || req.url || '') as string;\n // absolute url\n const absoluteUrl = `${protocol}://${host}${originalUrl}`;\n\n keys.forEach(key => {\n switch (key) {\n case 'headers':\n requestData.headers = headers;\n break;\n case 'method':\n requestData.method = method;\n break;\n case 'url':\n requestData.url = absoluteUrl;\n break;\n case 'cookies':\n // cookies:\n // node, express, koa: req.headers.cookie\n // vercel, sails.js, express (w/ cookie middleware): req.cookies\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n requestData.cookies = req.cookies || dynamicRequire(module, 'cookie').parse(headers.cookie || '');\n break;\n case 'query_string':\n // query string:\n // node: req.url (raw)\n // express, koa: req.query\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n requestData.query_string = dynamicRequire(module, 'url').parse(originalUrl || '', false).query;\n break;\n case 'data':\n if (method === 'GET' || method === 'HEAD') {\n break;\n }\n // body data:\n // node, express, koa: req.body\n if (req.body !== undefined) {\n requestData.data = isString(req.body) ? req.body : JSON.stringify(normalize(req.body));\n }\n break;\n default:\n if ({}.hasOwnProperty.call(req, key)) {\n requestData[key] = (req as { [key: string]: any })[key];\n }\n }\n });\n\n return requestData;\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Event, Integration, StackFrame, WrappedFunction } from '@sentry/types';\n\nimport { isNodeEnv } from './node';\nimport { snipLine } from './string';\n\n/** Internal */\ninterface SentryGlobal {\n Sentry?: {\n Integrations?: Integration[];\n };\n SENTRY_ENVIRONMENT?: string;\n SENTRY_DSN?: string;\n SENTRY_RELEASE?: {\n id?: string;\n };\n __SENTRY__: {\n globalEventProcessors: any;\n hub: any;\n logger: any;\n };\n}\n\nconst fallbackGlobalObject = {};\n\n/**\n * Safely get global scope object\n *\n * @returns Global scope object\n */\nexport function getGlobalObject<T>(): T & SentryGlobal {\n return (isNodeEnv()\n ? global\n : typeof window !== 'undefined'\n ? window\n : typeof self !== 'undefined'\n ? self\n : fallbackGlobalObject) as T & SentryGlobal;\n}\n\n/**\n * Extended Window interface that allows for Crypto API usage in IE browsers\n */\ninterface MsCryptoWindow extends Window {\n msCrypto?: Crypto;\n}\n\n/**\n * UUID4 generator\n *\n * @returns string Generated UUID4.\n */\nexport function uuid4(): string {\n const global = getGlobalObject() as MsCryptoWindow;\n const crypto = global.crypto || global.msCrypto;\n\n if (!(crypto === void 0) && crypto.getRandomValues) {\n // Use window.crypto API if available\n const arr = new Uint16Array(8);\n crypto.getRandomValues(arr);\n\n // set 4 in byte 7\n // eslint-disable-next-line no-bitwise\n arr[3] = (arr[3] & 0xfff) | 0x4000;\n // set 2 most significant bits of byte 9 to '10'\n // eslint-disable-next-line no-bitwise\n arr[4] = (arr[4] & 0x3fff) | 0x8000;\n\n const pad = (num: number): string => {\n let v = num.toString(16);\n while (v.length < 4) {\n v = `0${v}`;\n }\n return v;\n };\n\n return (\n pad(arr[0]) + pad(arr[1]) + pad(arr[2]) + pad(arr[3]) + pad(arr[4]) + pad(arr[5]) + pad(arr[6]) + pad(arr[7])\n );\n }\n // http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#2117523\n return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, c => {\n // eslint-disable-next-line no-bitwise\n const r = (Math.random() * 16) | 0;\n // eslint-disable-next-line no-bitwise\n const v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\n\n/**\n * Parses string form of URL into an object\n * // borrowed from https://tools.ietf.org/html/rfc3986#appendix-B\n * // intentionally using regex and not <a/> href parsing trick because React Native and other\n * // environments where DOM might not be available\n * @returns parsed URL object\n */\nexport function parseUrl(\n url: string,\n): {\n host?: string;\n path?: string;\n protocol?: string;\n relative?: string;\n} {\n if (!url) {\n return {};\n }\n\n const match = url.match(/^(([^:/?#]+):)?(\\/\\/([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$/);\n\n if (!match) {\n return {};\n }\n\n // coerce to undefined values to empty string so we don't get 'undefined'\n const query = match[6] || '';\n const fragment = match[8] || '';\n return {\n host: match[4],\n path: match[5],\n protocol: match[2],\n relative: match[5] + query + fragment, // everything minus origin\n };\n}\n\n/**\n * Extracts either message or type+value from an event that can be used for user-facing logs\n * @returns event's description\n */\nexport function getEventDescription(event: Event): string {\n if (event.message) {\n return event.message;\n }\n if (event.exception && event.exception.values && event.exception.values[0]) {\n const exception = event.exception.values[0];\n\n if (exception.type && exception.value) {\n return `${exception.type}: ${exception.value}`;\n }\n return exception.type || exception.value || event.event_id || '<unknown>';\n }\n return event.event_id || '<unknown>';\n}\n\n/** JSDoc */\ninterface ExtensibleConsole extends Console {\n [key: string]: any;\n}\n\n/** JSDoc */\nexport function consoleSandbox(callback: () => any): any {\n const global = getGlobalObject<Window>();\n const levels = ['debug', 'info', 'warn', 'error', 'log', 'assert'];\n\n if (!('console' in global)) {\n return callback();\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const originalConsole = (global as any).console as ExtensibleConsole;\n const wrappedLevels: { [key: string]: any } = {};\n\n // Restore all wrapped console methods\n levels.forEach(level => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (level in (global as any).console && (originalConsole[level] as WrappedFunction).__sentry_original__) {\n wrappedLevels[level] = originalConsole[level] as WrappedFunction;\n originalConsole[level] = (originalConsole[level] as WrappedFunction).__sentry_original__;\n }\n });\n\n // Perform callback manipulations\n const result = callback();\n\n // Revert restoration to wrapped state\n Object.keys(wrappedLevels).forEach(level => {\n originalConsole[level] = wrappedLevels[level];\n });\n\n return result;\n}\n\n/**\n * Adds exception values, type and value to an synthetic Exception.\n * @param event The event to modify.\n * @param value Value of the exception.\n * @param type Type of the exception.\n * @hidden\n */\nexport function addExceptionTypeValue(event: Event, value?: string, type?: string): void {\n event.exception = event.exception || {};\n event.exception.values = event.exception.values || [];\n event.exception.values[0] = event.exception.values[0] || {};\n event.exception.values[0].value = event.exception.values[0].value || value || '';\n event.exception.values[0].type = event.exception.values[0].type || type || 'Error';\n}\n\n/**\n * Adds exception mechanism to a given event.\n * @param event The event to modify.\n * @param mechanism Mechanism of the mechanism.\n * @hidden\n */\nexport function addExceptionMechanism(\n event: Event,\n mechanism: {\n [key: string]: any;\n } = {},\n): void {\n // TODO: Use real type with `keyof Mechanism` thingy and maybe make it better?\n try {\n // @ts-ignore Type 'Mechanism | {}' is not assignable to type 'Mechanism | undefined'\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n event.exception!.values![0].mechanism = event.exception!.values![0].mechanism || {};\n Object.keys(mechanism).forEach(key => {\n // @ts-ignore Mechanism has no index signature\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n event.exception!.values![0].mechanism[key] = mechanism[key];\n });\n } catch (_oO) {\n // no-empty\n }\n}\n\n/**\n * A safe form of location.href\n */\nexport function getLocationHref(): string {\n try {\n return document.location.href;\n } catch (oO) {\n return '';\n }\n}\n\n// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string\nconst SEMVER_REGEXP = /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$/;\n\n/**\n * Represents Semantic Versioning object\n */\ninterface SemVer {\n major?: number;\n minor?: number;\n patch?: number;\n prerelease?: string;\n buildmetadata?: string;\n}\n\n/**\n * Parses input into a SemVer interface\n * @param input string representation of a semver version\n */\nexport function parseSemver(input: string): SemVer {\n const match = input.match(SEMVER_REGEXP) || [];\n const major = parseInt(match[1], 10);\n const minor = parseInt(match[2], 10);\n const patch = parseInt(match[3], 10);\n return {\n buildmetadata: match[5],\n major: isNaN(major) ? undefined : major,\n minor: isNaN(minor) ? undefined : minor,\n patch: isNaN(patch) ? undefined : patch,\n prerelease: match[4],\n };\n}\n\nconst defaultRetryAfter = 60 * 1000; // 60 seconds\n\n/**\n * Extracts Retry-After value from the request header or returns default value\n * @param now current unix timestamp\n * @param header string representation of 'Retry-After' header\n */\nexport function parseRetryAfterHeader(now: number, header?: string | number | null): number {\n if (!header) {\n return defaultRetryAfter;\n }\n\n const headerDelay = parseInt(`${header}`, 10);\n if (!isNaN(headerDelay)) {\n return headerDelay * 1000;\n }\n\n const headerDate = Date.parse(`${header}`);\n if (!isNaN(headerDate)) {\n return headerDate - now;\n }\n\n return defaultRetryAfter;\n}\n\n/**\n * This function adds context (pre/post/line) lines to the provided frame\n *\n * @param lines string[] containing all lines\n * @param frame StackFrame that will be mutated\n * @param linesOfContext number of context lines we want to add pre/post\n */\nexport function addContextToFrame(lines: string[], frame: StackFrame, linesOfContext: number = 5): void {\n const lineno = frame.lineno || 0;\n const maxLines = lines.length;\n const sourceLine = Math.max(Math.min(maxLines, lineno - 1), 0);\n\n frame.pre_context = lines\n .slice(Math.max(0, sourceLine - linesOfContext), sourceLine)\n .map((line: string) => snipLine(line, 0));\n\n frame.context_line = snipLine(lines[Math.min(maxLines - 1, sourceLine)], frame.colno || 0);\n\n frame.post_context = lines\n .slice(Math.min(sourceLine + 1, maxLines), sourceLine + 1 + linesOfContext)\n .map((line: string) => snipLine(line, 0));\n}\n\n/**\n * Strip the query string and fragment off of a given URL or path (if present)\n *\n * @param urlPath Full URL or path, including possible query string and/or fragment\n * @returns URL or path without query string or fragment\n */\nexport function stripUrlQueryAndFragment(urlPath: string): string {\n // eslint-disable-next-line no-useless-escape\n return urlPath.split(/[\\?#]/, 1)[0];\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { consoleSandbox, getGlobalObject } from './misc';\n\n// TODO: Implement different loggers for different environments\nconst global = getGlobalObject<Window | NodeJS.Global>();\n\n/** Prefix for logging strings */\nconst PREFIX = 'Sentry Logger ';\n\n/** JSDoc */\nclass Logger {\n /** JSDoc */\n private _enabled: boolean;\n\n /** JSDoc */\n public constructor() {\n this._enabled = false;\n }\n\n /** JSDoc */\n public disable(): void {\n this._enabled = false;\n }\n\n /** JSDoc */\n public enable(): void {\n this._enabled = true;\n }\n\n /** JSDoc */\n public log(...args: any[]): void {\n if (!this._enabled) {\n return;\n }\n consoleSandbox(() => {\n global.console.log(`${PREFIX}[Log]: ${args.join(' ')}`);\n });\n }\n\n /** JSDoc */\n public warn(...args: any[]): void {\n if (!this._enabled) {\n return;\n }\n consoleSandbox(() => {\n global.console.warn(`${PREFIX}[Warn]: ${args.join(' ')}`);\n });\n }\n\n /** JSDoc */\n public error(...args: any[]): void {\n if (!this._enabled) {\n return;\n }\n consoleSandbox(() => {\n global.console.error(`${PREFIX}[Error]: ${args.join(' ')}`);\n });\n }\n}\n\n// Ensure we only have a single logger instance, even if multiple versions of @sentry/utils are being used\nglobal.__SENTRY__ = global.__SENTRY__ || {};\nconst logger = (global.__SENTRY__.logger as Logger) || (global.__SENTRY__.logger = new Logger());\n\nexport { logger };\n","import { logger } from './logger';\nimport { getGlobalObject } from './misc';\n\n/**\n * Tells whether current environment supports ErrorEvent objects\n * {@link supportsErrorEvent}.\n *\n * @returns Answer to the given question.\n */\nexport function supportsErrorEvent(): boolean {\n try {\n new ErrorEvent('');\n return true;\n } catch (e) {\n return false;\n }\n}\n\n/**\n * Tells whether current environment supports DOMError objects\n * {@link supportsDOMError}.\n *\n * @returns Answer to the given question.\n */\nexport function supportsDOMError(): boolean {\n try {\n // Chrome: VM89:1 Uncaught TypeError: Failed to construct 'DOMError':\n // 1 argument required, but only 0 present.\n // @ts-ignore It really needs 1 argument, not 0.\n new DOMError('');\n return true;\n } catch (e) {\n return false;\n }\n}\n\n/**\n * Tells whether current environment supports DOMException objects\n * {@link supportsDOMException}.\n *\n * @returns Answer to the given question.\n */\nexport function supportsDOMException(): boolean {\n try {\n new DOMException('');\n return true;\n } catch (e) {\n return false;\n }\n}\n\n/**\n * Tells whether current environment supports Fetch API\n * {@link supportsFetch}.\n *\n * @returns Answer to the given question.\n */\nexport function supportsFetch(): boolean {\n if (!('fetch' in getGlobalObject<Window>())) {\n return false;\n }\n\n try {\n new Headers();\n new Request('');\n new Response();\n return true;\n } catch (e) {\n return false;\n }\n}\n/**\n * isNativeFetch checks if the given function is a native implementation of fetch()\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction isNativeFetch(func: Function): boolean {\n return func && /^function fetch\\(\\)\\s+\\{\\s+\\[native code\\]\\s+\\}$/.test(func.toString());\n}\n\n/**\n * Tells whether current environment supports Fetch API natively\n * {@link supportsNativeFetch}.\n *\n * @returns true if `window.fetch` is natively implemented, false otherwise\n */\nexport function supportsNativeFetch(): boolean {\n if (!supportsFetch()) {\n return false;\n }\n\n const global = getGlobalObject<Window>();\n\n // Fast path to avoid DOM I/O\n // eslint-disable-next-line @typescript-eslint/unbound-method\n if (isNativeFetch(global.fetch)) {\n return true;\n }\n\n // window.fetch is implemented, but is polyfilled or already wrapped (e.g: by a chrome extension)\n // so create a \"pure\" iframe to see if that has native fetch\n let result = false;\n const doc = global.document;\n // eslint-disable-next-line deprecation/deprecation\n if (doc && typeof (doc.createElement as unknown) === `function`) {\n try {\n const sandbox = doc.createElement('iframe');\n sandbox.hidden = true;\n doc.head.appendChild(sandbox);\n if (sandbox.contentWindow && sandbox.contentWindow.fetch) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n result = isNativeFetch(sandbox.contentWindow.fetch);\n }\n doc.head.removeChild(sandbox);\n } catch (err) {\n logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ', err);\n }\n }\n\n return result;\n}\n\n/**\n * Tells whether current environment supports ReportingObserver API\n * {@link supportsReportingObserver}.\n *\n * @returns Answer to the given question.\n */\nexport function supportsReportingObserver(): boolean {\n return 'ReportingObserver' in getGlobalObject();\n}\n\n/**\n * Tells whether current environment supports Referrer Policy API\n * {@link supportsReferrerPolicy}.\n *\n * @returns Answer to the given question.\n */\nexport function supportsReferrerPolicy(): boolean {\n // Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default\n // https://caniuse.com/#feat=referrer-policy\n // It doesn't. And it throw exception instead of ignoring this parameter...\n // REF: https://github.com/getsentry/raven-js/issues/1233\n\n if (!supportsFetch()) {\n return false;\n }\n\n try {\n new Request('_', {\n referrerPolicy: 'origin' as ReferrerPolicy,\n });\n return true;\n } catch (e) {\n return false;\n }\n}\n\n/**\n * Tells whether current environment supports History API\n * {@link supportsHistory}.\n *\n * @returns Answer to the given question.\n */\nexport function supportsHistory(): boolean {\n // NOTE: in Chrome App environment, touching history.pushState, *even inside\n // a try/catch block*, will cause Chrome to output an error to console.error\n // borrowed from: https://github.com/angular/angular.js/pull/13945/files\n const global = getGlobalObject<Window>();\n /* eslint-disable @typescript-eslint/no-unsafe-member-access */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const chrome = (global as any).chrome;\n const isChromePackagedApp = chrome && chrome.app && chrome.app.runtime;\n /* eslint-enable @typescript-eslint/no-unsafe-member-access */\n const hasHistoryApi = 'history' in global && !!global.history.pushState && !!global.history.replaceState;\n\n return !isChromePackagedApp && hasHistoryApi;\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/ban-types */\nimport { WrappedFunction } from '@sentry/types';\n\nimport { isInstanceOf, isString } from './is';\nimport { logger } from './logger';\nimport { getGlobalObject } from './misc';\nimport { fill } from './object';\nimport { getFunctionName } from './stacktrace';\nimport { supportsHistory, supportsNativeFetch } from './supports';\n\nconst global = getGlobalObject<Window>();\n\n/** Object describing handler that will be triggered for a given `type` of instrumentation */\ninterface InstrumentHandler {\n type: InstrumentHandlerType;\n callback: InstrumentHandlerCallback;\n}\ntype InstrumentHandlerType =\n | 'console'\n | 'dom'\n | 'fetch'\n | 'history'\n | 'sentry'\n | 'xhr'\n | 'error'\n | 'unhandledrejection';\ntype InstrumentHandlerCallback = (data: any) => void;\n\n/**\n * Instrument native APIs to call handlers that can be used to create breadcrumbs, APM spans etc.\n * - Console API\n * - Fetch API\n * - XHR API\n * - History API\n * - DOM API (click/typing)\n * - Error API\n * - UnhandledRejection API\n */\n\nconst handlers: { [key in InstrumentHandlerType]?: InstrumentHandlerCallback[] } = {};\nconst instrumented: { [key in InstrumentHandlerType]?: boolean } = {};\n\n/** Instruments given API */\nfunction instrument(type: InstrumentHandlerType): void {\n if (instrumented[type]) {\n return;\n }\n\n instrumented[type] = true;\n\n switch (type) {\n case 'console':\n instrumentConsole();\n break;\n case 'dom':\n instrumentDOM();\n break;\n case 'xhr':\n instrumentXHR();\n break;\n case 'fetch':\n instrumentFetch();\n break;\n case 'history':\n instrumentHistory();\n break;\n case 'error':\n instrumentError();\n break;\n case 'unhandledrejection':\n instrumentUnhandledRejection();\n break;\n default:\n logger.warn('unknown instrumentation type:', type);\n }\n}\n\n/**\n * Add handler that will be called when given type of instrumentation triggers.\n * Use at your own risk, this might break without changelog notice, only used internally.\n * @hidden\n */\nexport function addInstrumentationHandler(handler: InstrumentHandler): void {\n if (!handler || typeof handler.type !== 'string' || typeof handler.callback !== 'function') {\n return;\n }\n handlers[handler.type] = handlers[handler.type] || [];\n (handlers[handler.type] as InstrumentHandlerCallback[]).push(handler.callback);\n instrument(handler.type);\n}\n\n/** JSDoc */\nfunction triggerHandlers(type: InstrumentHandlerType, data: any): void {\n if (!type || !handlers[type]) {\n return;\n }\n\n for (const handler of handlers[type] || []) {\n try {\n handler(data);\n } catch (e) {\n logger.error(\n `Error while triggering instrumentation handler.\\nType: ${type}\\nName: ${getFunctionName(\n handler,\n )}\\nError: ${e}`,\n );\n }\n }\n}\n\n/** JSDoc */\nfunction instrumentConsole(): void {\n if (!('console' in global)) {\n return;\n }\n\n ['debug', 'info', 'warn', 'error', 'log', 'assert'].forEach(function(level: string): void {\n if (!(level in global.console)) {\n return;\n }\n\n fill(global.console, level, function(originalConsoleLevel: () => any): Function {\n return function(...args: any[]): void {\n triggerHandlers('console', { args, level });\n\n // this fails for some browsers. :(\n if (originalConsoleLevel) {\n Function.prototype.apply.call(originalConsoleLevel, global.console, args);\n }\n };\n });\n });\n}\n\n/** JSDoc */\nfunction instrumentFetch(): void {\n if (!supportsNativeFetch()) {\n return;\n }\n\n fill(global, 'fetch', function(originalFetch: () => void): () => void {\n return function(...args: any[]): void {\n const handlerData = {\n args,\n fetchData: {\n method: getFetchMethod(args),\n url: getFetchUrl(args),\n },\n startTimestamp: Date.now(),\n };\n\n triggerHandlers('fetch', {\n ...handlerData,\n });\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return originalFetch.apply(global, args).then(\n (response: Response) => {\n triggerHandlers('fetch', {\n ...handlerData,\n endTimestamp: Date.now(),\n response,\n });\n return response;\n },\n (error: Error) => {\n triggerHandlers('fetch', {\n ...handlerData,\n endTimestamp: Date.now(),\n error,\n });\n // NOTE: If you are a Sentry user, and you are seeing this stack frame,\n // it means the sentry.javascript SDK caught an error invoking your application code.\n // This is expected behavior and NOT indicative of a bug with sentry.javascript.\n throw error;\n },\n );\n };\n });\n}\n\ntype XHRSendInput = null | Blob | BufferSource | FormData | URLSearchParams | string;\n\n/** JSDoc */\ninterface SentryWrappedXMLHttpRequest extends XMLHttpRequest {\n [key: string]: any;\n __sentry_xhr__?: {\n method?: string;\n url?: string;\n status_code?: number;\n body?: XHRSendInput;\n };\n}\n\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/** Extract `method` from fetch call arguments */\nfunction getFetchMethod(fetchArgs: any[] = []): string {\n if ('Request' in global && isInstanceOf(fetchArgs[0], Request) && fetchArgs[0].method) {\n return String(fetchArgs[0].method).toUpperCase();\n }\n if (fetchArgs[1] && fetchArgs[1].method) {\n return String(fetchArgs[1].method).toUpperCase();\n }\n return 'GET';\n}\n\n/** Extract `url` from fetch call arguments */\nfunction getFetchUrl(fetchArgs: any[] = []): string {\n if (typeof fetchArgs[0] === 'string') {\n return fetchArgs[0];\n }\n if ('Request' in global && isInstanceOf(fetchArgs[0], Request)) {\n return fetchArgs[0].url;\n }\n return String(fetchArgs[0]);\n}\n/* eslint-enable @typescript-eslint/no-unsafe-member-access */\n\n/** JSDoc */\nfunction instrumentXHR(): void {\n if (!('XMLHttpRequest' in global)) {\n return;\n }\n\n // Poor man's implementation of ES6 `Map`, tracking and keeping in sync key and value separately.\n const requestKeys: XMLHttpRequest[] = [];\n const requestValues: Array<any>[] = [];\n const xhrproto = XMLHttpRequest.prototype;\n\n fill(xhrproto, 'open', function(originalOpen: () => void): () => void {\n return function(this: SentryWrappedXMLHttpRequest, ...args: any[]): void {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const xhr = this;\n const url = args[1];\n xhr.__sentry_xhr__ = {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n method: isString(args[0]) ? args[0].toUpperCase() : args[0],\n url: args[1],\n };\n\n // if Sentry key appears in URL, don't capture it as a request\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (isString(url) && xhr.__sentry_xhr__.method === 'POST' && url.match(/sentry_key/)) {\n xhr.__sentry_own_request__ = true;\n }\n\n const onreadystatechangeHandler = function(): void {\n if (xhr.readyState === 4) {\n try {\n // touching statusCode in some platforms throws\n // an exception\n if (xhr.__sentry_xhr__) {\n xhr.__sentry_xhr__.status_code = xhr.status;\n }\n } catch (e) {\n /* do nothing */\n }\n\n try {\n const requestPos = requestKeys.indexOf(xhr);\n if (requestPos !== -1) {\n // Make sure to pop both key and value to keep it in sync.\n requestKeys.splice(requestPos);\n const args = requestValues.splice(requestPos)[0];\n if (xhr.__sentry_xhr__ && args[0] !== undefined) {\n xhr.__sentry_xhr__.body = args[0] as XHRSendInput;\n }\n }\n } catch (e) {\n /* do nothing */\n }\n\n triggerHandlers('xhr', {\n args,\n endTimestamp: Date.now(),\n startTimestamp: Date.now(),\n xhr,\n });\n }\n };\n\n if ('onreadystatechange' in xhr && typeof xhr.onreadystatechange === 'function') {\n fill(xhr, 'onreadystatechange', function(original: WrappedFunction): Function {\n return function(...readyStateArgs: any[]): void {\n onreadystatechangeHandler();\n return original.apply(xhr, readyStateArgs);\n };\n });\n } else {\n xhr.addEventListener('readystatechange', onreadystatechangeHandler);\n }\n\n return originalOpen.apply(xhr, args);\n };\n });\n\n fill(xhrproto, 'send', function(originalSend: () => void): () => void {\n return function(this: SentryWrappedXMLHttpRequest, ...args: any[]): void {\n requestKeys.push(this);\n requestValues.push(args);\n\n triggerHandlers('xhr', {\n args,\n startTimestamp: Date.now(),\n xhr: this,\n });\n\n return originalSend.apply(this, args);\n };\n });\n}\n\nlet lastHref: string;\n\n/** JSDoc */\nfunction instrumentHistory(): void {\n if (!supportsHistory()) {\n return;\n }\n\n const oldOnPopState = global.onpopstate;\n global.onpopstate = function(this: WindowEventHandlers, ...args: any[]): any {\n const to = global.location.href;\n // keep track of the current URL state, as we always receive only the updated state\n const from = lastHref;\n lastHref = to;\n triggerHandlers('history', {\n from,\n to,\n });\n if (oldOnPopState) {\n return oldOnPopState.apply(this, args);\n }\n };\n\n /** @hidden */\n function historyReplacementFunction(originalHistoryFunction: () => void): () => void {\n return function(this: History, ...args: any[]): void {\n const url = args.length > 2 ? args[2] : undefined;\n if (url) {\n // coerce to string (this is what pushState does)\n const from = lastHref;\n const to = String(url);\n // keep track of the current URL state, as we always receive only the updated state\n lastHref = to;\n triggerHandlers('history', {\n from,\n to,\n });\n }\n return originalHistoryFunction.apply(this, args);\n };\n }\n\n fill(global.history, 'pushState', historyReplacementFunction);\n fill(global.history, 'replaceState', historyReplacementFunction);\n}\n\n/** JSDoc */\nfunction instrumentDOM(): void {\n if (!('document' in global)) {\n return;\n }\n\n // Capture breadcrumbs from any click that is unhandled / bubbled up all the way\n // to the document. Do this before we instrument addEventListener.\n global.document.addEventListener('click', domEventHandler('click', triggerHandlers.bind(null, 'dom')), false);\n global.document.addEventListener('keypress', keypressEventHandler(triggerHandlers.bind(null, 'dom')), false);\n\n // After hooking into document bubbled up click and keypresses events, we also hook into user handled click & keypresses.\n ['EventTarget', 'Node'].forEach((target: string) => {\n /* eslint-disable @typescript-eslint/no-unsafe-member-access */\n const proto = (global as any)[target] && (global as any)[target].prototype;\n\n // eslint-disable-next-line no-prototype-builtins\n if (!proto || !proto.hasOwnProperty || !proto.hasOwnProperty('addEventListener')) {\n return;\n }\n /* eslint-enable @typescript-eslint/no-unsafe-member-access */\n\n fill(proto, 'addEventListener', function(\n original: () => void,\n ): (\n eventName: string,\n fn: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions,\n ) => void {\n return function(\n this: any,\n eventName: string,\n fn: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions,\n ): (eventName: string, fn: EventListenerOrEventListenerObject, capture?: boolean, secure?: boolean) => void {\n if (fn && (fn as EventListenerObject).handleEvent) {\n if (eventName === 'click') {\n fill(fn, 'handleEvent', function(innerOriginal: () => void): (caughtEvent: Event) => void {\n return function(this: any, event: Event): (event: Event) => void {\n domEventHandler('click', triggerHandlers.bind(null, 'dom'))(event);\n return innerOriginal.call(this, event);\n };\n });\n }\n if (eventName === 'keypress') {\n fill(fn, 'handleEvent', function(innerOriginal: () => void): (caughtEvent: Event) => void {\n return function(this: any, event: Event): (event: Event) => void {\n keypressEventHandler(triggerHandlers.bind(null, 'dom'))(event);\n return innerOriginal.call(this, event);\n };\n });\n }\n } else {\n if (eventName === 'click') {\n domEventHandler('click', triggerHandlers.bind(null, 'dom'), true)(this);\n }\n if (eventName === 'keypress') {\n keypressEventHandler(triggerHandlers.bind(null, 'dom'))(this);\n }\n }\n\n return original.call(this, eventName, fn, options);\n };\n });\n\n fill(proto, 'removeEventListener', function(\n original: () => void,\n ): (\n this: any,\n eventName: string,\n fn: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions,\n ) => () => void {\n return function(\n this: any,\n eventName: string,\n fn: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions,\n ): () => void {\n try {\n original.call(this, eventName, ((fn as unknown) as WrappedFunction).__sentry_wrapped__, options);\n } catch (e) {\n // ignore, accessing __sentry_wrapped__ will throw in some Selenium environments\n }\n return original.call(this, eventName, fn, options);\n };\n });\n });\n}\n\nconst debounceDuration: number = 1000;\nlet debounceTimer: number = 0;\nlet keypressTimeout: number | undefined;\nlet lastCapturedEvent: Event | undefined;\n\n/**\n * Wraps addEventListener to capture UI breadcrumbs\n * @param name the event name (e.g. \"click\")\n * @param handler function that will be triggered\n * @param debounce decides whether it should wait till another event loop\n * @returns wrapped breadcrumb events handler\n * @hidden\n */\nfunction domEventHandler(name: string, handler: Function, debounce: boolean = false): (event: Event) => void {\n return (event: Event): void => {\n // reset keypress timeout; e.g. triggering a 'click' after\n // a 'keypress' will reset the keypress debounce so that a new\n // set of keypresses can be recorded\n keypressTimeout = undefined;\n // It's possible this handler might trigger multiple times for the same\n // event (e.g. event propagation through node ancestors). Ignore if we've\n // already captured the event.\n if (!event || lastCapturedEvent === event) {\n return;\n }\n\n lastCapturedEvent = event;\n\n if (debounceTimer) {\n clearTimeout(debounceTimer);\n }\n\n if (debounce) {\n debounceTimer = setTimeout(() => {\n handler({ event, name });\n });\n } else {\n handler({ event, name });\n }\n };\n}\n\n/**\n * Wraps addEventListener to capture keypress UI events\n * @param handler function that will be triggered\n * @returns wrapped keypress events handler\n * @hidden\n */\nfunction keypressEventHandler(handler: Function): (event: Event) => void {\n // TODO: if somehow user switches keypress target before\n // debounce timeout is triggered, we will only capture\n // a single breadcrumb from the FIRST target (acceptable?)\n return (event: Event): void => {\n let target;\n\n try {\n target = event.target;\n } catch (e) {\n // just accessing event properties can throw an exception in some rare circumstances\n // see: https://github.com/getsentry/raven-js/issues/838\n return;\n }\n\n const tagName = target && (target as HTMLElement).tagName;\n\n // only consider keypress events on actual input elements\n // this will disregard keypresses targeting body (e.g. tabbing\n // through elements, hotkeys, etc)\n if (!tagName || (tagName !== 'INPUT' && tagName !== 'TEXTAREA' && !(target as HTMLElement).isContentEditable)) {\n return;\n }\n\n // record first keypress in a series, but ignore subsequent\n // keypresses until debounce clears\n if (!keypressTimeout) {\n domEventHandler('input', handler)(event);\n }\n clearTimeout(keypressTimeout);\n\n keypressTimeout = (setTimeout(() => {\n keypressTimeout = undefined;\n }, debounceDuration) as any) as number;\n };\n}\n\nlet _oldOnErrorHandler: OnErrorEventHandler = null;\n/** JSDoc */\nfunction instrumentError(): void {\n _oldOnErrorHandler = global.onerror;\n\n global.onerror = function(msg: any, url: any, line: any, column: any, error: any): boolean {\n triggerHandlers('error', {\n column,\n error,\n line,\n msg,\n url,\n });\n\n if (_oldOnErrorHandler) {\n // eslint-disable-next-line prefer-rest-params\n return _oldOnErrorHandler.apply(this, arguments);\n }\n\n return false;\n };\n}\n\nlet _oldOnUnhandledRejectionHandler: ((e: any) => void) | null = null;\n/** JSDoc */\nfunction instrumentUnhandledRejection(): void {\n _oldOnUnhandledRejectionHandler = global.onunhandledrejection;\n\n global.onunhandledrejection = function(e: any): boolean {\n triggerHandlers('unhandledrejection', e);\n\n if (_oldOnUnhandledRejectionHandler) {\n // eslint-disable-next-line prefer-rest-params\n return _oldOnUnhandledRejectionHandler.apply(this, arguments);\n }\n\n return true;\n };\n}\n","/* eslint-disable @typescript-eslint/explicit-function-return-type */\n/* eslint-disable @typescript-eslint/typedef */\n/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { isThenable } from './is';\n\n/** SyncPromise internal states */\nenum States {\n /** Pending */\n PENDING = 'PENDING',\n /** Resolved / OK */\n RESOLVED = 'RESOLVED',\n /** Rejected / Error */\n REJECTED = 'REJECTED',\n}\n\n/**\n * Thenable class that behaves like a Promise and follows it's interface\n * but is not async internally\n */\nclass SyncPromise<T> implements PromiseLike<T> {\n private _state: States = States.PENDING;\n private _handlers: Array<{\n done: boolean;\n onfulfilled?: ((value: T) => T | PromiseLike<T>) | null;\n onrejected?: ((reason: any) => any) | null;\n }> = [];\n private _value: any;\n\n public constructor(\n executor: (resolve: (value?: T | PromiseLike<T> | null) => void, reject: (reason?: any) => void) => void,\n ) {\n try {\n executor(this._resolve, this._reject);\n } catch (e) {\n this._reject(e);\n }\n }\n\n /** JSDoc */\n public static resolve<T>(value: T | PromiseLike<T>): PromiseLike<T> {\n return new SyncPromise(resolve => {\n resolve(value);\n });\n }\n\n /** JSDoc */\n public static reject<T = never>(reason?: any): PromiseLike<T> {\n return new SyncPromise((_, reject) => {\n reject(reason);\n });\n }\n\n /** JSDoc */\n public static all<U = any>(collection: Array<U | PromiseLike<U>>): PromiseLike<U[]> {\n return new SyncPromise<U[]>((resolve, reject) => {\n if (!Array.isArray(collection)) {\n reject(new TypeError(`Promise.all requires an array as input.`));\n return;\n }\n\n if (collection.length === 0) {\n resolve([]);\n return;\n }\n\n let counter = collection.length;\n const resolvedCollection: U[] = [];\n\n collection.forEach((item, index) => {\n SyncPromise.resolve(item)\n .then(value => {\n resolvedCollection[index] = value;\n counter -= 1;\n\n if (counter !== 0) {\n return;\n }\n resolve(resolvedCollection);\n })\n .then(null, reject);\n });\n });\n }\n\n /** JSDoc */\n public then<TResult1 = T, TResult2 = never>(\n onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,\n onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null,\n ): PromiseLike<TResult1 | TResult2> {\n return new SyncPromise((resolve, reject) => {\n this._attachHandler({\n done: false,\n onfulfilled: result => {\n if (!onfulfilled) {\n // TODO: ¯\\_(ツ)_/¯\n // TODO: FIXME\n resolve(result as any);\n return;\n }\n try {\n resolve(onfulfilled(result));\n return;\n } catch (e) {\n reject(e);\n return;\n }\n },\n onrejected: reason => {\n if (!onrejected) {\n reject(reason);\n return;\n }\n try {\n resolve(onrejected(reason));\n return;\n } catch (e) {\n reject(e);\n return;\n }\n },\n });\n });\n }\n\n /** JSDoc */\n public catch<TResult = never>(\n onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null,\n ): PromiseLike<T | TResult> {\n return this.then(val => val, onrejected);\n }\n\n /** JSDoc */\n public finally<TResult>(onfinally?: (() => void) | null): PromiseLike<TResult> {\n return new SyncPromise<TResult>((resolve, reject) => {\n let val: TResult | any;\n let isRejected: boolean;\n\n return this.then(\n value => {\n isRejected = false;\n val = value;\n if (onfinally) {\n onfinally();\n }\n },\n reason => {\n isRejected = true;\n val = reason;\n if (onfinally) {\n onfinally();\n }\n },\n ).then(() => {\n if (isRejected) {\n reject(val);\n return;\n }\n\n resolve((val as unknown) as any);\n });\n });\n }\n\n /** JSDoc */\n public toString(): string {\n return '[object SyncPromise]';\n }\n\n /** JSDoc */\n private readonly _resolve = (value?: T | PromiseLike<T> | null) => {\n this._setResult(States.RESOLVED, value);\n };\n\n /** JSDoc */\n private readonly _reject = (reason?: any) => {\n this._setResult(States.REJECTED, reason);\n };\n\n /** JSDoc */\n private readonly _setResult = (state: States, value?: T | PromiseLike<T> | any) => {\n if (this._state !== States.PENDING) {\n return;\n }\n\n if (isThenable(value)) {\n (value as PromiseLike<T>).then(this._resolve, this._reject);\n return;\n }\n\n this._state = state;\n this._value = value;\n\n this._executeHandlers();\n };\n\n // TODO: FIXME\n /** JSDoc */\n private readonly _attachHandler = (handler: {\n /** JSDoc */\n done: boolean;\n /** JSDoc */\n onfulfilled?(value: T): any;\n /** JSDoc */\n onrejected?(reason: any): any;\n }) => {\n this._handlers = this._handlers.concat(handler);\n this._executeHandlers();\n };\n\n /** JSDoc */\n private readonly _executeHandlers = () => {\n if (this._state === States.PENDING) {\n return;\n }\n\n const cachedHandlers = this._handlers.slice();\n this._handlers = [];\n\n cachedHandlers.forEach(handler => {\n if (handler.done) {\n return;\n }\n\n if (this._state === States.RESOLVED) {\n if (handler.onfulfilled) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n handler.onfulfilled((this._value as unknown) as any);\n }\n }\n\n if (this._state === States.REJECTED) {\n if (handler.onrejected) {\n handler.onrejected(this._value);\n }\n }\n\n handler.done = true;\n });\n };\n}\n\nexport { SyncPromise };\n","import { SentryError } from './error';\nimport { SyncPromise } from './syncpromise';\n\n/** A simple queue that holds promises. */\nexport class PromiseBuffer<T> {\n /** Internal set of queued Promises */\n private readonly _buffer: Array<PromiseLike<T>> = [];\n\n public constructor(protected _limit?: number) {}\n\n /**\n * Says if the buffer is ready to take more requests\n */\n public isReady(): boolean {\n return this._limit === undefined || this.length() < this._limit;\n }\n\n /**\n * Add a promise to the queue.\n *\n * @param task Can be any PromiseLike<T>\n * @returns The original promise.\n */\n public add(task: PromiseLike<T>): PromiseLike<T> {\n if (!this.isReady()) {\n return SyncPromise.reject(new SentryError('Not adding Promise due to buffer limit reached.'));\n }\n if (this._buffer.indexOf(task) === -1) {\n this._buffer.push(task);\n }\n task\n .then(() => this.remove(task))\n .then(null, () =>\n this.remove(task).then(null, () => {\n // We have to add this catch here otherwise we have an unhandledPromiseRejection\n // because it's a new Promise chain.\n }),\n );\n return task;\n }\n\n /**\n * Remove a promise to the queue.\n *\n * @param task Can be any PromiseLike<T>\n * @returns Removed promise.\n */\n public remove(task: PromiseLike<T>): PromiseLike<T> {\n const removedTask = this._buffer.splice(this._buffer.indexOf(task), 1)[0];\n return removedTask;\n }\n\n /**\n * This function returns the number of unresolved promises in the queue.\n */\n public length(): number {\n return this._buffer.length;\n }\n\n /**\n * This will drain the whole queue, returns true if queue is empty or drained.\n * If timeout is provided and the queue takes longer to drain, the promise still resolves but with false.\n *\n * @param timeout Number in ms to wait until it resolves with false.\n */\n public drain(timeout?: number): PromiseLike<boolean> {\n return new SyncPromise<boolean>(resolve => {\n const capturedSetTimeout = setTimeout(() => {\n if (timeout && timeout > 0) {\n resolve(false);\n }\n }, timeout);\n SyncPromise.all(this._buffer)\n .then(() => {\n clearTimeout(capturedSetTimeout);\n resolve(true);\n })\n .then(null, () => {\n resolve(true);\n });\n });\n }\n}\n","import { getGlobalObject } from './misc';\nimport { dynamicRequire, isNodeEnv } from './node';\n\n/**\n * An object that can return the current timestamp in seconds since the UNIX epoch.\n */\ninterface TimestampSource {\n nowSeconds(): number;\n}\n\n/**\n * A TimestampSource implementation for environments that do not support the Performance Web API natively.\n *\n * Note that this TimestampSource does not use a monotonic clock. A call to `nowSeconds` may return a timestamp earlier\n * than a previously returned value. We do not try to emulate a monotonic behavior in order to facilitate debugging. It\n * is more obvious to explain \"why does my span have negative duration\" than \"why my spans have zero duration\".\n */\nconst dateTimestampSource: TimestampSource = {\n nowSeconds: () => Date.now() / 1000,\n};\n\n/**\n * A partial definition of the [Performance Web API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Performance}\n * for accessing a high resolution monotonic clock.\n */\ninterface Performance {\n /**\n * The millisecond timestamp at which measurement began, measured in Unix time.\n */\n timeOrigin: number;\n /**\n * Returns the current millisecond timestamp, where 0 represents the start of measurement.\n */\n now(): number;\n}\n\n/**\n * Returns a wrapper around the native Performance API browser implementation, or undefined for browsers that do not\n * support the API.\n *\n * Wrapping the native API works around differences in behavior from different browsers.\n */\nfunction getBrowserPerformance(): Performance | undefined {\n const { performance } = getGlobalObject<Window>();\n if (!performance || !performance.now) {\n return undefined;\n }\n\n // Replace performance.timeOrigin with our own timeOrigin based on Date.now().\n //\n // This is a partial workaround for browsers reporting performance.timeOrigin such that performance.timeOrigin +\n // performance.now() gives a date arbitrarily in the past.\n //\n // Additionally, computing timeOrigin in this way fills the gap for browsers where performance.timeOrigin is\n // undefined.\n //\n // The assumption that performance.timeOrigin + performance.now() ~= Date.now() is flawed, but we depend on it to\n // interact with data coming out of performance entries.\n //\n // Note that despite recommendations against it in the spec, browsers implement the Performance API with a clock that\n // might stop when the computer is asleep (and perhaps under other circumstances). Such behavior causes\n // performance.timeOrigin + performance.now() to have an arbitrary skew over Date.now(). In laptop computers, we have\n // observed skews that can be as long as days, weeks or months.\n //\n // See https://github.com/getsentry/sentry-javascript/issues/2590.\n //\n // BUG: despite our best intentions, this workaround has its limitations. It mostly addresses timings of pageload\n // transactions, but ignores the skew built up over time that can aversely affect timestamps of navigation\n // transactions of long-lived web pages.\n const timeOrigin = Date.now() - performance.now();\n\n return {\n now: () => performance.now(),\n timeOrigin,\n };\n}\n\n/**\n * Returns the native Performance API implementation from Node.js. Returns undefined in old Node.js versions that don't\n * implement the API.\n */\nfunction getNodePerformance(): Performance | undefined {\n try {\n const perfHooks = dynamicRequire(module, 'perf_hooks') as { performance: Performance };\n return perfHooks.performance;\n } catch (_) {\n return undefined;\n }\n}\n\n/**\n * The Performance API implementation for the current platform, if available.\n */\nconst platformPerformance: Performance | undefined = isNodeEnv() ? getNodePerformance() : getBrowserPerformance();\n\nconst timestampSource: TimestampSource =\n platformPerformance === undefined\n ? dateTimestampSource\n : {\n nowSeconds: () => (platformPerformance.timeOrigin + platformPerformance.now()) / 1000,\n };\n\n/**\n * Returns a timestamp in seconds since the UNIX epoch using the Date API.\n */\nexport const dateTimestampInSeconds = dateTimestampSource.nowSeconds.bind(dateTimestampSource);\n\n/**\n * Returns a timestamp in seconds since the UNIX epoch using either the Performance or Date APIs, depending on the\n * availability of the Performance API.\n *\n * See `usingPerformanceAPI` to test whether the Performance API is used.\n *\n * BUG: Note that because of how browsers implement the Performance API, the clock might stop when the computer is\n * asleep. This creates a skew between `dateTimestampInSeconds` and `timestampInSeconds`. The\n * skew can grow to arbitrary amounts like days, weeks or months.\n * See https://github.com/getsentry/sentry-javascript/issues/2590.\n */\nexport const timestampInSeconds = timestampSource.nowSeconds.bind(timestampSource);\n\n// Re-exported with an old name for backwards-compatibility.\nexport const timestampWithMs = timestampInSeconds;\n\n/**\n * A boolean that is true when timestampInSeconds uses the Performance API to produce monotonic timestamps.\n */\nexport const usingPerformanceAPI = platformPerformance !== undefined;\n\n/**\n * The number of milliseconds since the UNIX epoch. This value is only usable in a browser, and only when the\n * performance API is available.\n */\nexport const browserPerformanceTimeOrigin = ((): number | undefined => {\n const { performance } = getGlobalObject<Window>();\n if (!performance) {\n return undefined;\n }\n if (performance.timeOrigin) {\n return performance.timeOrigin;\n }\n // While performance.timing.navigationStart is deprecated in favor of performance.timeOrigin, performance.timeOrigin\n // is not as widely supported. Namely, performance.timeOrigin is undefined in Safari as of writing.\n // Also as of writing, performance.timing is not available in Web Workers in mainstream browsers, so it is not always\n // a valid fallback. In the absence of an initial time provided by the browser, fallback to the current time from the\n // Date API.\n // eslint-disable-next-line deprecation/deprecation\n return (performance.timing && performance.timing.navigationStart) || Date.now();\n})();\n","/* eslint-disable max-lines */\nimport {\n Breadcrumb,\n CaptureContext,\n Context,\n Contexts,\n Event,\n EventHint,\n EventProcessor,\n Extra,\n Extras,\n Scope as ScopeInterface,\n ScopeContext,\n Severity,\n Span,\n Transaction,\n User,\n} from '@sentry/types';\nimport { dateTimestampInSeconds, getGlobalObject, isPlainObject, isThenable, SyncPromise } from '@sentry/utils';\n\nimport { Session } from './session';\n\n/**\n * Holds additional event information. {@link Scope.applyToEvent} will be\n * called by the client before an event will be sent.\n */\nexport class Scope implements ScopeInterface {\n /** Flag if notifiying is happening. */\n protected _notifyingListeners: boolean = false;\n\n /** Callback for client to receive scope changes. */\n protected _scopeListeners: Array<(scope: Scope) => void> = [];\n\n /** Callback list that will be called after {@link applyToEvent}. */\n protected _eventProcessors: EventProcessor[] = [];\n\n /** Array of breadcrumbs. */\n protected _breadcrumbs: Breadcrumb[] = [];\n\n /** User */\n protected _user: User = {};\n\n /** Tags */\n protected _tags: { [key: string]: string } = {};\n\n /** Extra */\n protected _extra: Extras = {};\n\n /** Contexts */\n protected _contexts: Contexts = {};\n\n /** Fingerprint */\n protected _fingerprint?: string[];\n\n /** Severity */\n protected _level?: Severity;\n\n /** Transaction Name */\n protected _transactionName?: string;\n\n /** Span */\n protected _span?: Span;\n\n /** Session */\n protected _session?: Session;\n\n /**\n * Inherit values from the parent scope.\n * @param scope to clone.\n */\n public static clone(scope?: Scope): Scope {\n const newScope = new Scope();\n if (scope) {\n newScope._breadcrumbs = [...scope._breadcrumbs];\n newScope._tags = { ...scope._tags };\n newScope._extra = { ...scope._extra };\n newScope._contexts = { ...scope._contexts };\n newScope._user = scope._user;\n newScope._level = scope._level;\n newScope._span = scope._span;\n newScope._session = scope._session;\n newScope._transactionName = scope._transactionName;\n newScope._fingerprint = scope._fingerprint;\n newScope._eventProcessors = [...scope._eventProcessors];\n }\n return newScope;\n }\n\n /**\n * Add internal on change listener. Used for sub SDKs that need to store the scope.\n * @hidden\n */\n public addScopeListener(callback: (scope: Scope) => void): void {\n this._scopeListeners.push(callback);\n }\n\n /**\n * @inheritDoc\n */\n public addEventProcessor(callback: EventProcessor): this {\n this._eventProcessors.push(callback);\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public setUser(user: User | null): this {\n this._user = user || {};\n if (this._session) {\n this._session.update({ user });\n }\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public getUser(): User | undefined {\n return this._user;\n }\n\n /**\n * @inheritDoc\n */\n public setTags(tags: { [key: string]: string }): this {\n this._tags = {\n ...this._tags,\n ...tags,\n };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public setTag(key: string, value: string): this {\n this._tags = { ...this._tags, [key]: value };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public setExtras(extras: Extras): this {\n this._extra = {\n ...this._extra,\n ...extras,\n };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public setExtra(key: string, extra: Extra): this {\n this._extra = { ...this._extra, [key]: extra };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public setFingerprint(fingerprint: string[]): this {\n this._fingerprint = fingerprint;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public setLevel(level: Severity): this {\n this._level = level;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public setTransactionName(name?: string): this {\n this._transactionName = name;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Can be removed in major version.\n * @deprecated in favor of {@link this.setTransactionName}\n */\n public setTransaction(name?: string): this {\n return this.setTransactionName(name);\n }\n\n /**\n * @inheritDoc\n */\n public setContext(key: string, context: Context | null): this {\n if (context === null) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete this._contexts[key];\n } else {\n this._contexts = { ...this._contexts, [key]: context };\n }\n\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public setSpan(span?: Span): this {\n this._span = span;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public getSpan(): Span | undefined {\n return this._span;\n }\n\n /**\n * @inheritDoc\n */\n public getTransaction(): Transaction | undefined {\n // often, this span will be a transaction, but it's not guaranteed to be\n const span = this.getSpan() as undefined | (Span & { spanRecorder: { spans: Span[] } });\n\n // try it the new way first\n if (span?.transaction) {\n return span?.transaction;\n }\n\n // fallback to the old way (known bug: this only finds transactions with sampled = true)\n if (span?.spanRecorder?.spans[0]) {\n return span.spanRecorder.spans[0] as Transaction;\n }\n\n // neither way found a transaction\n return undefined;\n }\n\n /**\n * @inheritDoc\n */\n public setSession(session?: Session): this {\n if (!session) {\n delete this._session;\n } else {\n this._session = session;\n }\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public getSession(): Session | undefined {\n return this._session;\n }\n\n /**\n * @inheritDoc\n */\n public update(captureContext?: CaptureContext): this {\n if (!captureContext) {\n return this;\n }\n\n if (typeof captureContext === 'function') {\n const updatedScope = (captureContext as <T>(scope: T) => T)(this);\n return updatedScope instanceof Scope ? updatedScope : this;\n }\n\n if (captureContext instanceof Scope) {\n this._tags = { ...this._tags, ...captureContext._tags };\n this._extra = { ...this._extra, ...captureContext._extra };\n this._contexts = { ...this._contexts, ...captureContext._contexts };\n if (captureContext._user && Object.keys(captureContext._user).length) {\n this._user = captureContext._user;\n }\n if (captureContext._level) {\n this._level = captureContext._level;\n }\n if (captureContext._fingerprint) {\n this._fingerprint = captureContext._fingerprint;\n }\n } else if (isPlainObject(captureContext)) {\n // eslint-disable-next-line no-param-reassign\n captureContext = captureContext as ScopeContext;\n this._tags = { ...this._tags, ...captureContext.tags };\n this._extra = { ...this._extra, ...captureContext.extra };\n this._contexts = { ...this._contexts, ...captureContext.contexts };\n if (captureContext.user) {\n this._user = captureContext.user;\n }\n if (captureContext.level) {\n this._level = captureContext.level;\n }\n if (captureContext.fingerprint) {\n this._fingerprint = captureContext.fingerprint;\n }\n }\n\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public clear(): this {\n this._breadcrumbs = [];\n this._tags = {};\n this._extra = {};\n this._user = {};\n this._contexts = {};\n this._level = undefined;\n this._transactionName = undefined;\n this._fingerprint = undefined;\n this._span = undefined;\n this._session = undefined;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public addBreadcrumb(breadcrumb: Breadcrumb, maxBreadcrumbs?: number): this {\n const mergedBreadcrumb = {\n timestamp: dateTimestampInSeconds(),\n ...breadcrumb,\n };\n\n this._breadcrumbs =\n maxBreadcrumbs !== undefined && maxBreadcrumbs >= 0\n ? [...this._breadcrumbs, mergedBreadcrumb].slice(-maxBreadcrumbs)\n : [...this._breadcrumbs, mergedBreadcrumb];\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public clearBreadcrumbs(): this {\n this._breadcrumbs = [];\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Applies the current context and fingerprint to the event.\n * Note that breadcrumbs will be added by the client.\n * Also if the event has already breadcrumbs on it, we do not merge them.\n * @param event Event\n * @param hint May contain additional informartion about the original exception.\n * @hidden\n */\n public applyToEvent(event: Event, hint?: EventHint): PromiseLike<Event | null> {\n if (this._extra && Object.keys(this._extra).length) {\n event.extra = { ...this._extra, ...event.extra };\n }\n if (this._tags && Object.keys(this._tags).length) {\n event.tags = { ...this._tags, ...event.tags };\n }\n if (this._user && Object.keys(this._user).length) {\n event.user = { ...this._user, ...event.user };\n }\n if (this._contexts && Object.keys(this._contexts).length) {\n event.contexts = { ...this._contexts, ...event.contexts };\n }\n if (this._level) {\n event.level = this._level;\n }\n if (this._transactionName) {\n event.transaction = this._transactionName;\n }\n // We want to set the trace context for normal events only if there isn't already\n // a trace context on the event. There is a product feature in place where we link\n // errors with transaction and it relys on that.\n if (this._span) {\n event.contexts = { trace: this._span.getTraceContext(), ...event.contexts };\n const transactionName = this._span.transaction?.name;\n if (transactionName) {\n event.tags = { transaction: transactionName, ...event.tags };\n }\n }\n\n this._applyFingerprint(event);\n\n event.breadcrumbs = [...(event.breadcrumbs || []), ...this._breadcrumbs];\n event.breadcrumbs = event.breadcrumbs.length > 0 ? event.breadcrumbs : undefined;\n\n return this._notifyEventProcessors([...getGlobalEventProcessors(), ...this._eventProcessors], event, hint);\n }\n\n /**\n * This will be called after {@link applyToEvent} is finished.\n */\n protected _notifyEventProcessors(\n processors: EventProcessor[],\n event: Event | null,\n hint?: EventHint,\n index: number = 0,\n ): PromiseLike<Event | null> {\n return new SyncPromise<Event | null>((resolve, reject) => {\n const processor = processors[index];\n if (event === null || typeof processor !== 'function') {\n resolve(event);\n } else {\n const result = processor({ ...event }, hint) as Event | null;\n if (isThenable(result)) {\n (result as PromiseLike<Event | null>)\n .then(final => this._notifyEventProcessors(processors, final, hint, index + 1).then(resolve))\n .then(null, reject);\n } else {\n this._notifyEventProcessors(processors, result, hint, index + 1)\n .then(resolve)\n .then(null, reject);\n }\n }\n });\n }\n\n /**\n * This will be called on every set call.\n */\n protected _notifyScopeListeners(): void {\n // We need this check for this._notifyingListeners to be able to work on scope during updates\n // If this check is not here we'll produce endless recursion when something is done with the scope\n // during the callback.\n if (!this._notifyingListeners) {\n this._notifyingListeners = true;\n this._scopeListeners.forEach(callback => {\n callback(this);\n });\n this._notifyingListeners = false;\n }\n }\n\n /**\n * Applies fingerprint from the scope to the event if there's one,\n * uses message if there's one instead or get rid of empty fingerprint\n */\n private _applyFingerprint(event: Event): void {\n // Make sure it's an array first and we actually have something in place\n event.fingerprint = event.fingerprint\n ? Array.isArray(event.fingerprint)\n ? event.fingerprint\n : [event.fingerprint]\n : [];\n\n // If we have something on the scope, then merge it with event\n if (this._fingerprint) {\n event.fingerprint = event.fingerprint.concat(this._fingerprint);\n }\n\n // If we have no data at all, remove empty array default\n if (event.fingerprint && !event.fingerprint.length) {\n delete event.fingerprint;\n }\n }\n}\n\n/**\n * Retruns the global event processors.\n */\nfunction getGlobalEventProcessors(): EventProcessor[] {\n /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\n const global = getGlobalObject<any>();\n global.__SENTRY__ = global.__SENTRY__ || {};\n global.__SENTRY__.globalEventProcessors = global.__SENTRY__.globalEventProcessors || [];\n return global.__SENTRY__.globalEventProcessors;\n /* eslint-enable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\n}\n\n/**\n * Add a EventProcessor to be kept globally.\n * @param callback EventProcessor to add\n */\nexport function addGlobalEventProcessor(callback: EventProcessor): void {\n getGlobalEventProcessors().push(callback);\n}\n","import { Session as SessionInterface, SessionContext, SessionStatus } from '@sentry/types';\nimport { dropUndefinedKeys, uuid4 } from '@sentry/utils';\n\n/**\n * @inheritdoc\n */\nexport class Session implements SessionInterface {\n public userAgent?: string;\n public errors: number = 0;\n public release?: string;\n public sid: string = uuid4();\n public did?: string;\n public timestamp: number = Date.now();\n public started: number = Date.now();\n public duration: number = 0;\n public status: SessionStatus = SessionStatus.Ok;\n public environment?: string;\n public ipAddress?: string;\n\n constructor(context?: Omit<SessionContext, 'started' | 'status'>) {\n if (context) {\n this.update(context);\n }\n }\n\n /** JSDoc */\n // eslint-disable-next-line complexity\n update(context: SessionContext = {}): void {\n if (context.user) {\n if (context.user.ip_address) {\n this.ipAddress = context.user.ip_address;\n }\n\n if (!context.did) {\n this.did = context.user.id || context.user.email || context.user.username;\n }\n }\n\n this.timestamp = context.timestamp || Date.now();\n\n if (context.sid) {\n // Good enough uuid validation. — Kamil\n this.sid = context.sid.length === 32 ? context.sid : uuid4();\n }\n if (context.did) {\n this.did = `${context.did}`;\n }\n if (typeof context.started === 'number') {\n this.started = context.started;\n }\n if (typeof context.duration === 'number') {\n this.duration = context.duration;\n } else {\n this.duration = this.timestamp - this.started;\n }\n if (context.release) {\n this.release = context.release;\n }\n if (context.environment) {\n this.environment = context.environment;\n }\n if (context.ipAddress) {\n this.ipAddress = context.ipAddress;\n }\n if (context.userAgent) {\n this.userAgent = context.userAgent;\n }\n if (typeof context.errors === 'number') {\n this.errors = context.errors;\n }\n if (context.status) {\n this.status = context.status;\n }\n }\n\n /** JSDoc */\n close(status?: Exclude<SessionStatus, SessionStatus.Ok>): void {\n if (status) {\n this.update({ status });\n } else if (this.status === SessionStatus.Ok) {\n this.update({ status: SessionStatus.Exited });\n } else {\n this.update();\n }\n }\n\n /** JSDoc */\n toJSON(): {\n init: boolean;\n sid: string;\n did?: string;\n timestamp: string;\n started: string;\n duration: number;\n status: SessionStatus;\n errors: number;\n attrs?: {\n release?: string;\n environment?: string;\n user_agent?: string;\n ip_address?: string;\n };\n } {\n return dropUndefinedKeys({\n sid: `${this.sid}`,\n init: true,\n started: new Date(this.started).toISOString(),\n timestamp: new Date(this.timestamp).toISOString(),\n status: this.status,\n errors: this.errors,\n did: typeof this.did === 'number' || typeof this.did === 'string' ? `${this.did}` : undefined,\n duration: this.duration,\n attrs: dropUndefinedKeys({\n release: this.release,\n environment: this.environment,\n ip_address: this.ipAddress,\n user_agent: this.userAgent,\n }),\n });\n }\n}\n","/* eslint-disable max-lines */\nimport {\n Breadcrumb,\n BreadcrumbHint,\n Client,\n CustomSamplingContext,\n Event,\n EventHint,\n Extra,\n Extras,\n Hub as HubInterface,\n Integration,\n IntegrationClass,\n SessionContext,\n Severity,\n Span,\n SpanContext,\n Transaction,\n TransactionContext,\n User,\n} from '@sentry/types';\nimport { consoleSandbox, dateTimestampInSeconds, getGlobalObject, isNodeEnv, logger, uuid4 } from '@sentry/utils';\n\nimport { Carrier, DomainAsCarrier, Layer } from './interfaces';\nimport { Scope } from './scope';\nimport { Session } from './session';\n\n/**\n * API compatibility version of this hub.\n *\n * WARNING: This number should only be increased when the global interface\n * changes and new methods are introduced.\n *\n * @hidden\n */\nexport const API_VERSION = 3;\n\n/**\n * Default maximum number of breadcrumbs added to an event. Can be overwritten\n * with {@link Options.maxBreadcrumbs}.\n */\nconst DEFAULT_BREADCRUMBS = 100;\n\n/**\n * Absolute maximum number of breadcrumbs added to an event. The\n * `maxBreadcrumbs` option cannot be higher than this value.\n */\nconst MAX_BREADCRUMBS = 100;\n\n/**\n * @inheritDoc\n */\nexport class Hub implements HubInterface {\n /** Is a {@link Layer}[] containing the client and scope */\n private readonly _stack: Layer[] = [{}];\n\n /** Contains the last event id of a captured event. */\n private _lastEventId?: string;\n\n /**\n * Creates a new instance of the hub, will push one {@link Layer} into the\n * internal stack on creation.\n *\n * @param client bound to the hub.\n * @param scope bound to the hub.\n * @param version number, higher number means higher priority.\n */\n public constructor(client?: Client, scope: Scope = new Scope(), private readonly _version: number = API_VERSION) {\n this.getStackTop().scope = scope;\n this.bindClient(client);\n }\n\n /**\n * @inheritDoc\n */\n public isOlderThan(version: number): boolean {\n return this._version < version;\n }\n\n /**\n * @inheritDoc\n */\n public bindClient(client?: Client): void {\n const top = this.getStackTop();\n top.client = client;\n if (client && client.setupIntegrations) {\n client.setupIntegrations();\n }\n }\n\n /**\n * @inheritDoc\n */\n public pushScope(): Scope {\n // We want to clone the content of prev scope\n const scope = Scope.clone(this.getScope());\n this.getStack().push({\n client: this.getClient(),\n scope,\n });\n return scope;\n }\n\n /**\n * @inheritDoc\n */\n public popScope(): boolean {\n if (this.getStack().length <= 1) return false;\n return !!this.getStack().pop();\n }\n\n /**\n * @inheritDoc\n */\n public withScope(callback: (scope: Scope) => void): void {\n const scope = this.pushScope();\n try {\n callback(scope);\n } finally {\n this.popScope();\n }\n }\n\n /**\n * @inheritDoc\n */\n public getClient<C extends Client>(): C | undefined {\n return this.getStackTop().client as C;\n }\n\n /** Returns the scope of the top stack. */\n public getScope(): Scope | undefined {\n return this.getStackTop().scope;\n }\n\n /** Returns the scope stack for domains or the process. */\n public getStack(): Layer[] {\n return this._stack;\n }\n\n /** Returns the topmost scope layer in the order domain > local > process. */\n public getStackTop(): Layer {\n return this._stack[this._stack.length - 1];\n }\n\n /**\n * @inheritDoc\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n public captureException(exception: any, hint?: EventHint): string {\n const eventId = (this._lastEventId = uuid4());\n let finalHint = hint;\n\n // If there's no explicit hint provided, mimick the same thing that would happen\n // in the minimal itself to create a consistent behavior.\n // We don't do this in the client, as it's the lowest level API, and doing this,\n // would prevent user from having full control over direct calls.\n if (!hint) {\n let syntheticException: Error;\n try {\n throw new Error('Sentry syntheticException');\n } catch (exception) {\n syntheticException = exception as Error;\n }\n finalHint = {\n originalException: exception,\n syntheticException,\n };\n }\n\n this._invokeClient('captureException', exception, {\n ...finalHint,\n event_id: eventId,\n });\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n public captureMessage(message: string, level?: Severity, hint?: EventHint): string {\n const eventId = (this._lastEventId = uuid4());\n let finalHint = hint;\n\n // If there's no explicit hint provided, mimick the same thing that would happen\n // in the minimal itself to create a consistent behavior.\n // We don't do this in the client, as it's the lowest level API, and doing this,\n // would prevent user from having full control over direct calls.\n if (!hint) {\n let syntheticException: Error;\n try {\n throw new Error(message);\n } catch (exception) {\n syntheticException = exception as Error;\n }\n finalHint = {\n originalException: message,\n syntheticException,\n };\n }\n\n this._invokeClient('captureMessage', message, level, {\n ...finalHint,\n event_id: eventId,\n });\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n public captureEvent(event: Event, hint?: EventHint): string {\n const eventId = (this._lastEventId = uuid4());\n this._invokeClient('captureEvent', event, {\n ...hint,\n event_id: eventId,\n });\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n public lastEventId(): string | undefined {\n return this._lastEventId;\n }\n\n /**\n * @inheritDoc\n */\n public addBreadcrumb(breadcrumb: Breadcrumb, hint?: BreadcrumbHint): void {\n const { scope, client } = this.getStackTop();\n\n if (!scope || !client) return;\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const { beforeBreadcrumb = null, maxBreadcrumbs = DEFAULT_BREADCRUMBS } =\n (client.getOptions && client.getOptions()) || {};\n\n if (maxBreadcrumbs <= 0) return;\n\n const timestamp = dateTimestampInSeconds();\n const mergedBreadcrumb = { timestamp, ...breadcrumb };\n const finalBreadcrumb = beforeBreadcrumb\n ? (consoleSandbox(() => beforeBreadcrumb(mergedBreadcrumb, hint)) as Breadcrumb | null)\n : mergedBreadcrumb;\n\n if (finalBreadcrumb === null) return;\n\n scope.addBreadcrumb(finalBreadcrumb, Math.min(maxBreadcrumbs, MAX_BREADCRUMBS));\n }\n\n /**\n * @inheritDoc\n */\n public setUser(user: User | null): void {\n const scope = this.getScope();\n if (scope) scope.setUser(user);\n }\n\n /**\n * @inheritDoc\n */\n public setTags(tags: { [key: string]: string }): void {\n const scope = this.getScope();\n if (scope) scope.setTags(tags);\n }\n\n /**\n * @inheritDoc\n */\n public setExtras(extras: Extras): void {\n const scope = this.getScope();\n if (scope) scope.setExtras(extras);\n }\n\n /**\n * @inheritDoc\n */\n public setTag(key: string, value: string): void {\n const scope = this.getScope();\n if (scope) scope.setTag(key, value);\n }\n\n /**\n * @inheritDoc\n */\n public setExtra(key: string, extra: Extra): void {\n const scope = this.getScope();\n if (scope) scope.setExtra(key, extra);\n }\n\n /**\n * @inheritDoc\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public setContext(name: string, context: { [key: string]: any } | null): void {\n const scope = this.getScope();\n if (scope) scope.setContext(name, context);\n }\n\n /**\n * @inheritDoc\n */\n public configureScope(callback: (scope: Scope) => void): void {\n const { scope, client } = this.getStackTop();\n if (scope && client) {\n callback(scope);\n }\n }\n\n /**\n * @inheritDoc\n */\n public run(callback: (hub: Hub) => void): void {\n const oldHub = makeMain(this);\n try {\n callback(this);\n } finally {\n makeMain(oldHub);\n }\n }\n\n /**\n * @inheritDoc\n */\n public getIntegration<T extends Integration>(integration: IntegrationClass<T>): T | null {\n const client = this.getClient();\n if (!client) return null;\n try {\n return client.getIntegration(integration);\n } catch (_oO) {\n logger.warn(`Cannot retrieve integration ${integration.id} from the current Hub`);\n return null;\n }\n }\n\n /**\n * @inheritDoc\n */\n public startSpan(context: SpanContext): Span {\n return this._callExtensionMethod('startSpan', context);\n }\n\n /**\n * @inheritDoc\n */\n public startTransaction(context: TransactionContext, customSamplingContext?: CustomSamplingContext): Transaction {\n return this._callExtensionMethod('startTransaction', context, customSamplingContext);\n }\n\n /**\n * @inheritDoc\n */\n public traceHeaders(): { [key: string]: string } {\n return this._callExtensionMethod<{ [key: string]: string }>('traceHeaders');\n }\n\n /**\n * @inheritDoc\n */\n public startSession(context?: SessionContext): Session {\n // End existing session if there's one\n this.endSession();\n\n const { scope, client } = this.getStackTop();\n const { release, environment } = (client && client.getOptions()) || {};\n const session = new Session({\n release,\n environment,\n ...(scope && { user: scope.getUser() }),\n ...context,\n });\n if (scope) {\n scope.setSession(session);\n }\n return session;\n }\n\n /**\n * @inheritDoc\n */\n public endSession(): void {\n const { scope, client } = this.getStackTop();\n if (!scope) return;\n\n const session = scope.getSession && scope.getSession();\n if (session) {\n session.close();\n if (client && client.captureSession) {\n client.captureSession(session);\n }\n scope.setSession();\n }\n }\n\n /**\n * Internal helper function to call a method on the top client if it exists.\n *\n * @param method The method to call on the client.\n * @param args Arguments to pass to the client function.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _invokeClient<M extends keyof Client>(method: M, ...args: any[]): void {\n const { scope, client } = this.getStackTop();\n if (client && client[method]) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any\n (client as any)[method](...args, scope);\n }\n }\n\n /**\n * Calls global extension method and binding current instance to the function call\n */\n // @ts-ignore Function lacks ending return statement and return type does not include 'undefined'. ts(2366)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _callExtensionMethod<T>(method: string, ...args: any[]): T {\n const carrier = getMainCarrier();\n const sentry = carrier.__SENTRY__;\n if (sentry && sentry.extensions && typeof sentry.extensions[method] === 'function') {\n return sentry.extensions[method].apply(this, args);\n }\n logger.warn(`Extension method ${method} couldn't be found, doing nothing.`);\n }\n}\n\n/** Returns the global shim registry. */\nexport function getMainCarrier(): Carrier {\n const carrier = getGlobalObject();\n carrier.__SENTRY__ = carrier.__SENTRY__ || {\n extensions: {},\n hub: undefined,\n };\n return carrier;\n}\n\n/**\n * Replaces the current main hub with the passed one on the global object\n *\n * @returns The old replaced hub\n */\nexport function makeMain(hub: Hub): Hub {\n const registry = getMainCarrier();\n const oldHub = getHubFromCarrier(registry);\n setHubOnCarrier(registry, hub);\n return oldHub;\n}\n\n/**\n * Returns the default hub instance.\n *\n * If a hub is already registered in the global carrier but this module\n * contains a more recent version, it replaces the registered version.\n * Otherwise, the currently registered hub will be returned.\n */\nexport function getCurrentHub(): Hub {\n // Get main carrier (global for every environment)\n const registry = getMainCarrier();\n\n // If there's no hub, or its an old API, assign a new one\n if (!hasHubOnCarrier(registry) || getHubFromCarrier(registry).isOlderThan(API_VERSION)) {\n setHubOnCarrier(registry, new Hub());\n }\n\n // Prefer domains over global if they are there (applicable only to Node environment)\n if (isNodeEnv()) {\n return getHubFromActiveDomain(registry);\n }\n // Return hub that lives on a global object\n return getHubFromCarrier(registry);\n}\n\n/**\n * Returns the active domain, if one exists\n *\n * @returns The domain, or undefined if there is no active domain\n */\nexport function getActiveDomain(): DomainAsCarrier | undefined {\n const sentry = getMainCarrier().__SENTRY__;\n\n return sentry && sentry.extensions && sentry.extensions.domain && sentry.extensions.domain.active;\n}\n\n/**\n * Try to read the hub from an active domain, and fallback to the registry if one doesn't exist\n * @returns discovered hub\n */\nfunction getHubFromActiveDomain(registry: Carrier): Hub {\n try {\n const activeDomain = getActiveDomain();\n\n // If there's no active domain, just return global hub\n if (!activeDomain) {\n return getHubFromCarrier(registry);\n }\n\n // If there's no hub on current domain, or it's an old API, assign a new one\n if (!hasHubOnCarrier(activeDomain) || getHubFromCarrier(activeDomain).isOlderThan(API_VERSION)) {\n const registryHubTopStack = getHubFromCarrier(registry).getStackTop();\n setHubOnCarrier(activeDomain, new Hub(registryHubTopStack.client, Scope.clone(registryHubTopStack.scope)));\n }\n\n // Return hub that lives on a domain\n return getHubFromCarrier(activeDomain);\n } catch (_Oo) {\n // Return hub that lives on a global object\n return getHubFromCarrier(registry);\n }\n}\n\n/**\n * This will tell whether a carrier has a hub on it or not\n * @param carrier object\n */\nfunction hasHubOnCarrier(carrier: Carrier): boolean {\n return !!(carrier && carrier.__SENTRY__ && carrier.__SENTRY__.hub);\n}\n\n/**\n * This will create a new {@link Hub} and add to the passed object on\n * __SENTRY__.hub.\n * @param carrier object\n * @hidden\n */\nexport function getHubFromCarrier(carrier: Carrier): Hub {\n if (carrier && carrier.__SENTRY__ && carrier.__SENTRY__.hub) return carrier.__SENTRY__.hub;\n carrier.__SENTRY__ = carrier.__SENTRY__ || {};\n carrier.__SENTRY__.hub = new Hub();\n return carrier.__SENTRY__.hub;\n}\n\n/**\n * This will set passed {@link Hub} on the passed object's __SENTRY__.hub attribute\n * @param carrier object\n * @param hub Hub\n */\nexport function setHubOnCarrier(carrier: Carrier, hub: Hub): boolean {\n if (!carrier) return false;\n carrier.__SENTRY__ = carrier.__SENTRY__ || {};\n carrier.__SENTRY__.hub = hub;\n return true;\n}\n","import { getCurrentHub, Hub, Scope } from '@sentry/hub';\nimport {\n Breadcrumb,\n CaptureContext,\n CustomSamplingContext,\n Event,\n Extra,\n Extras,\n Severity,\n Transaction,\n TransactionContext,\n User,\n} from '@sentry/types';\n\n/**\n * This calls a function on the current hub.\n * @param method function to call on hub.\n * @param args to pass to function.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction callOnHub<T>(method: string, ...args: any[]): T {\n const hub = getCurrentHub();\n if (hub && hub[method as keyof Hub]) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (hub[method as keyof Hub] as any)(...args);\n }\n throw new Error(`No hub defined or ${method} was not found on the hub, please open a bug report.`);\n}\n\n/**\n * Captures an exception event and sends it to Sentry.\n *\n * @param exception An exception-like object.\n * @returns The generated eventId.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\nexport function captureException(exception: any, captureContext?: CaptureContext): string {\n let syntheticException: Error;\n try {\n throw new Error('Sentry syntheticException');\n } catch (exception) {\n syntheticException = exception as Error;\n }\n return callOnHub('captureException', exception, {\n captureContext,\n originalException: exception,\n syntheticException,\n });\n}\n\n/**\n * Captures a message event and sends it to Sentry.\n *\n * @param message The message to send to Sentry.\n * @param level Define the level of the message.\n * @returns The generated eventId.\n */\nexport function captureMessage(message: string, captureContext?: CaptureContext | Severity): string {\n let syntheticException: Error;\n try {\n throw new Error(message);\n } catch (exception) {\n syntheticException = exception as Error;\n }\n\n // This is necessary to provide explicit scopes upgrade, without changing the original\n // arity of the `captureMessage(message, level)` method.\n const level = typeof captureContext === 'string' ? captureContext : undefined;\n const context = typeof captureContext !== 'string' ? { captureContext } : undefined;\n\n return callOnHub('captureMessage', message, level, {\n originalException: message,\n syntheticException,\n ...context,\n });\n}\n\n/**\n * Captures a manually created event and sends it to Sentry.\n *\n * @param event The event to send to Sentry.\n * @returns The generated eventId.\n */\nexport function captureEvent(event: Event): string {\n return callOnHub('captureEvent', event);\n}\n\n/**\n * Callback to set context information onto the scope.\n * @param callback Callback function that receives Scope.\n */\nexport function configureScope(callback: (scope: Scope) => void): void {\n callOnHub<void>('configureScope', callback);\n}\n\n/**\n * Records a new breadcrumb which will be attached to future events.\n *\n * Breadcrumbs will be added to subsequent events to provide more context on\n * user's actions prior to an error or crash.\n *\n * @param breadcrumb The breadcrumb to record.\n */\nexport function addBreadcrumb(breadcrumb: Breadcrumb): void {\n callOnHub<void>('addBreadcrumb', breadcrumb);\n}\n\n/**\n * Sets context data with the given name.\n * @param name of the context\n * @param context Any kind of data. This data will be normalized.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function setContext(name: string, context: { [key: string]: any } | null): void {\n callOnHub<void>('setContext', name, context);\n}\n\n/**\n * Set an object that will be merged sent as extra data with the event.\n * @param extras Extras object to merge into current context.\n */\nexport function setExtras(extras: Extras): void {\n callOnHub<void>('setExtras', extras);\n}\n\n/**\n * Set an object that will be merged sent as tags data with the event.\n * @param tags Tags context object to merge into current context.\n */\nexport function setTags(tags: { [key: string]: string }): void {\n callOnHub<void>('setTags', tags);\n}\n\n/**\n * Set key:value that will be sent as extra data with the event.\n * @param key String of extra\n * @param extra Any kind of data. This data will be normalized.\n */\nexport function setExtra(key: string, extra: Extra): void {\n callOnHub<void>('setExtra', key, extra);\n}\n\n/**\n * Set key:value that will be sent as tags data with the event.\n * @param key String key of tag\n * @param value String value of tag\n */\nexport function setTag(key: string, value: string): void {\n callOnHub<void>('setTag', key, value);\n}\n\n/**\n * Updates user context information for future events.\n *\n * @param user User context object to be set in the current context. Pass `null` to unset the user.\n */\nexport function setUser(user: User | null): void {\n callOnHub<void>('setUser', user);\n}\n\n/**\n * Creates a new scope with and executes the given operation within.\n * The scope is automatically removed once the operation\n * finishes or throws.\n *\n * This is essentially a convenience function for:\n *\n * pushScope();\n * callback();\n * popScope();\n *\n * @param callback that will be enclosed into push/popScope.\n */\nexport function withScope(callback: (scope: Scope) => void): void {\n callOnHub<void>('withScope', callback);\n}\n\n/**\n * Calls a function on the latest client. Use this with caution, it's meant as\n * in \"internal\" helper so we don't need to expose every possible function in\n * the shim. It is not guaranteed that the client actually implements the\n * function.\n *\n * @param method The method to call on the client/client.\n * @param args Arguments to pass to the client/fontend.\n * @hidden\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function _callOnClient(method: string, ...args: any[]): void {\n callOnHub<void>('_invokeClient', method, ...args);\n}\n\n/**\n * Starts a new `Transaction` and returns it. This is the entry point to manual tracing instrumentation.\n *\n * A tree structure can be built by adding child spans to the transaction, and child spans to other spans. To start a\n * new child span within the transaction or any span, call the respective `.startChild()` method.\n *\n * Every child span must be finished before the transaction is finished, otherwise the unfinished spans are discarded.\n *\n * The transaction must be finished with a call to its `.finish()` method, at which point the transaction with all its\n * finished child spans will be sent to Sentry.\n *\n * @param context Properties of the new `Transaction`.\n * @param customSamplingContext Information given to the transaction sampling function (along with context-dependent\n * default values). See {@link Options.tracesSampler}.\n *\n * @returns The transaction which was just started\n */\nexport function startTransaction(\n context: TransactionContext,\n customSamplingContext?: CustomSamplingContext,\n): Transaction {\n return callOnHub('startTransaction', { ...context }, customSamplingContext);\n}\n","import { DsnLike } from '@sentry/types';\nimport { Dsn, urlEncode } from '@sentry/utils';\n\nconst SENTRY_API_VERSION = '7';\n\n/** Helper class to provide urls to different Sentry endpoints. */\nexport class API {\n /** The internally used Dsn object. */\n private readonly _dsnObject: Dsn;\n /** Create a new instance of API */\n public constructor(public dsn: DsnLike) {\n this._dsnObject = new Dsn(dsn);\n }\n\n /** Returns the Dsn object. */\n public getDsn(): Dsn {\n return this._dsnObject;\n }\n\n /** Returns the prefix to construct Sentry ingestion API endpoints. */\n public getBaseApiEndpoint(): string {\n const dsn = this._dsnObject;\n const protocol = dsn.protocol ? `${dsn.protocol}:` : '';\n const port = dsn.port ? `:${dsn.port}` : '';\n return `${protocol}//${dsn.host}${port}${dsn.path ? `/${dsn.path}` : ''}/api/`;\n }\n\n /** Returns the store endpoint URL. */\n public getStoreEndpoint(): string {\n return this._getIngestEndpoint('store');\n }\n\n /**\n * Returns the store endpoint URL with auth in the query string.\n *\n * Sending auth as part of the query string and not as custom HTTP headers avoids CORS preflight requests.\n */\n public getStoreEndpointWithUrlEncodedAuth(): string {\n return `${this.getStoreEndpoint()}?${this._encodedAuth()}`;\n }\n\n /**\n * Returns the envelope endpoint URL with auth in the query string.\n *\n * Sending auth as part of the query string and not as custom HTTP headers avoids CORS preflight requests.\n */\n public getEnvelopeEndpointWithUrlEncodedAuth(): string {\n return `${this._getEnvelopeEndpoint()}?${this._encodedAuth()}`;\n }\n\n /** Returns only the path component for the store endpoint. */\n public getStoreEndpointPath(): string {\n const dsn = this._dsnObject;\n return `${dsn.path ? `/${dsn.path}` : ''}/api/${dsn.projectId}/store/`;\n }\n\n /**\n * Returns an object that can be used in request headers.\n * This is needed for node and the old /store endpoint in sentry\n */\n public getRequestHeaders(clientName: string, clientVersion: string): { [key: string]: string } {\n const dsn = this._dsnObject;\n const header = [`Sentry sentry_version=${SENTRY_API_VERSION}`];\n header.push(`sentry_client=${clientName}/${clientVersion}`);\n header.push(`sentry_key=${dsn.user}`);\n if (dsn.pass) {\n header.push(`sentry_secret=${dsn.pass}`);\n }\n return {\n 'Content-Type': 'application/json',\n 'X-Sentry-Auth': header.join(', '),\n };\n }\n\n /** Returns the url to the report dialog endpoint. */\n public getReportDialogEndpoint(\n dialogOptions: {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n user?: { name?: string; email?: string };\n } = {},\n ): string {\n const dsn = this._dsnObject;\n const endpoint = `${this.getBaseApiEndpoint()}embed/error-page/`;\n\n const encodedOptions = [];\n encodedOptions.push(`dsn=${dsn.toString()}`);\n for (const key in dialogOptions) {\n if (key === 'user') {\n if (!dialogOptions.user) {\n continue;\n }\n if (dialogOptions.user.name) {\n encodedOptions.push(`name=${encodeURIComponent(dialogOptions.user.name)}`);\n }\n if (dialogOptions.user.email) {\n encodedOptions.push(`email=${encodeURIComponent(dialogOptions.user.email)}`);\n }\n } else {\n encodedOptions.push(`${encodeURIComponent(key)}=${encodeURIComponent(dialogOptions[key] as string)}`);\n }\n }\n if (encodedOptions.length) {\n return `${endpoint}?${encodedOptions.join('&')}`;\n }\n\n return endpoint;\n }\n\n /** Returns the envelope endpoint URL. */\n private _getEnvelopeEndpoint(): string {\n return this._getIngestEndpoint('envelope');\n }\n\n /** Returns the ingest API endpoint for target. */\n private _getIngestEndpoint(target: 'store' | 'envelope'): string {\n const base = this.getBaseApiEndpoint();\n const dsn = this._dsnObject;\n return `${base}${dsn.projectId}/${target}/`;\n }\n\n /** Returns a URL-encoded string with auth config suitable for a query string. */\n private _encodedAuth(): string {\n const dsn = this._dsnObject;\n const auth = {\n // We send only the minimum set of required information. See\n // https://github.com/getsentry/sentry-javascript/issues/2572.\n sentry_key: dsn.user,\n sentry_version: SENTRY_API_VERSION,\n };\n return urlEncode(auth);\n }\n}\n","import { addGlobalEventProcessor, getCurrentHub } from '@sentry/hub';\nimport { Integration, Options } from '@sentry/types';\nimport { logger } from '@sentry/utils';\n\nexport const installedIntegrations: string[] = [];\n\n/** Map of integrations assigned to a client */\nexport interface IntegrationIndex {\n [key: string]: Integration;\n}\n\n/** Gets integration to install */\nexport function getIntegrationsToSetup(options: Options): Integration[] {\n const defaultIntegrations = (options.defaultIntegrations && [...options.defaultIntegrations]) || [];\n const userIntegrations = options.integrations;\n let integrations: Integration[] = [];\n if (Array.isArray(userIntegrations)) {\n const userIntegrationsNames = userIntegrations.map(i => i.name);\n const pickedIntegrationsNames: string[] = [];\n\n // Leave only unique default integrations, that were not overridden with provided user integrations\n defaultIntegrations.forEach(defaultIntegration => {\n if (\n userIntegrationsNames.indexOf(defaultIntegration.name) === -1 &&\n pickedIntegrationsNames.indexOf(defaultIntegration.name) === -1\n ) {\n integrations.push(defaultIntegration);\n pickedIntegrationsNames.push(defaultIntegration.name);\n }\n });\n\n // Don't add same user integration twice\n userIntegrations.forEach(userIntegration => {\n if (pickedIntegrationsNames.indexOf(userIntegration.name) === -1) {\n integrations.push(userIntegration);\n pickedIntegrationsNames.push(userIntegration.name);\n }\n });\n } else if (typeof userIntegrations === 'function') {\n integrations = userIntegrations(defaultIntegrations);\n integrations = Array.isArray(integrations) ? integrations : [integrations];\n } else {\n integrations = [...defaultIntegrations];\n }\n\n // Make sure that if present, `Debug` integration will always run last\n const integrationsNames = integrations.map(i => i.name);\n const alwaysLastToRun = 'Debug';\n if (integrationsNames.indexOf(alwaysLastToRun) !== -1) {\n integrations.push(...integrations.splice(integrationsNames.indexOf(alwaysLastToRun), 1));\n }\n\n return integrations;\n}\n\n/** Setup given integration */\nexport function setupIntegration(integration: Integration): void {\n if (installedIntegrations.indexOf(integration.name) !== -1) {\n return;\n }\n integration.setupOnce(addGlobalEventProcessor, getCurrentHub);\n installedIntegrations.push(integration.name);\n logger.log(`Integration installed: ${integration.name}`);\n}\n\n/**\n * Given a list of integration instances this installs them all. When `withDefaults` is set to `true` then all default\n * integrations are added unless they were already provided before.\n * @param integrations array of integration instances\n * @param withDefault should enable default integrations\n */\nexport function setupIntegrations<O extends Options>(options: O): IntegrationIndex {\n const integrations: IntegrationIndex = {};\n getIntegrationsToSetup(options).forEach(integration => {\n integrations[integration.name] = integration;\n setupIntegration(integration);\n });\n return integrations;\n}\n","/* eslint-disable max-lines */\nimport { Scope, Session } from '@sentry/hub';\nimport {\n Client,\n Event,\n EventHint,\n Integration,\n IntegrationClass,\n Options,\n SessionStatus,\n Severity,\n} from '@sentry/types';\nimport {\n dateTimestampInSeconds,\n Dsn,\n isPrimitive,\n isThenable,\n logger,\n normalize,\n SentryError,\n SyncPromise,\n truncate,\n uuid4,\n} from '@sentry/utils';\n\nimport { Backend, BackendClass } from './basebackend';\nimport { IntegrationIndex, setupIntegrations } from './integration';\n\n/**\n * Base implementation for all JavaScript SDK clients.\n *\n * Call the constructor with the corresponding backend constructor and options\n * specific to the client subclass. To access these options later, use\n * {@link Client.getOptions}. Also, the Backend instance is available via\n * {@link Client.getBackend}.\n *\n * If a Dsn is specified in the options, it will be parsed and stored. Use\n * {@link Client.getDsn} to retrieve the Dsn at any moment. In case the Dsn is\n * invalid, the constructor will throw a {@link SentryException}. Note that\n * without a valid Dsn, the SDK will not send any events to Sentry.\n *\n * Before sending an event via the backend, it is passed through\n * {@link BaseClient.prepareEvent} to add SDK information and scope data\n * (breadcrumbs and context). To add more custom information, override this\n * method and extend the resulting prepared event.\n *\n * To issue automatically created events (e.g. via instrumentation), use\n * {@link Client.captureEvent}. It will prepare the event and pass it through\n * the callback lifecycle. To issue auto-breadcrumbs, use\n * {@link Client.addBreadcrumb}.\n *\n * @example\n * class NodeClient extends BaseClient<NodeBackend, NodeOptions> {\n * public constructor(options: NodeOptions) {\n * super(NodeBackend, options);\n * }\n *\n * // ...\n * }\n */\nexport abstract class BaseClient<B extends Backend, O extends Options> implements Client<O> {\n /**\n * The backend used to physically interact in the environment. Usually, this\n * will correspond to the client. When composing SDKs, however, the Backend\n * from the root SDK will be used.\n */\n protected readonly _backend: B;\n\n /** Options passed to the SDK. */\n protected readonly _options: O;\n\n /** The client Dsn, if specified in options. Without this Dsn, the SDK will be disabled. */\n protected readonly _dsn?: Dsn;\n\n /** Array of used integrations. */\n protected _integrations: IntegrationIndex = {};\n\n /** Number of call being processed */\n protected _processing: number = 0;\n\n /**\n * Initializes this client instance.\n *\n * @param backendClass A constructor function to create the backend.\n * @param options Options for the client.\n */\n protected constructor(backendClass: BackendClass<B, O>, options: O) {\n this._backend = new backendClass(options);\n this._options = options;\n\n if (options.dsn) {\n this._dsn = new Dsn(options.dsn);\n }\n }\n\n /**\n * @inheritDoc\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n public captureException(exception: any, hint?: EventHint, scope?: Scope): string | undefined {\n let eventId: string | undefined = hint && hint.event_id;\n\n this._process(\n this._getBackend()\n .eventFromException(exception, hint)\n .then(event => this._captureEvent(event, hint, scope))\n .then(result => {\n eventId = result;\n }),\n );\n\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n public captureMessage(message: string, level?: Severity, hint?: EventHint, scope?: Scope): string | undefined {\n let eventId: string | undefined = hint && hint.event_id;\n\n const promisedEvent = isPrimitive(message)\n ? this._getBackend().eventFromMessage(`${message}`, level, hint)\n : this._getBackend().eventFromException(message, hint);\n\n this._process(\n promisedEvent\n .then(event => this._captureEvent(event, hint, scope))\n .then(result => {\n eventId = result;\n }),\n );\n\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n public captureEvent(event: Event, hint?: EventHint, scope?: Scope): string | undefined {\n let eventId: string | undefined = hint && hint.event_id;\n\n this._process(\n this._captureEvent(event, hint, scope).then(result => {\n eventId = result;\n }),\n );\n\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n public captureSession(session: Session): void {\n if (!session.release) {\n logger.warn('Discarded session because of missing release');\n } else {\n this._sendSession(session);\n }\n }\n\n /**\n * @inheritDoc\n */\n public getDsn(): Dsn | undefined {\n return this._dsn;\n }\n\n /**\n * @inheritDoc\n */\n public getOptions(): O {\n return this._options;\n }\n\n /**\n * @inheritDoc\n */\n public flush(timeout?: number): PromiseLike<boolean> {\n return this._isClientProcessing(timeout).then(ready => {\n return this._getBackend()\n .getTransport()\n .close(timeout)\n .then(transportFlushed => ready && transportFlushed);\n });\n }\n\n /**\n * @inheritDoc\n */\n public close(timeout?: number): PromiseLike<boolean> {\n return this.flush(timeout).then(result => {\n this.getOptions().enabled = false;\n return result;\n });\n }\n\n /**\n * Sets up the integrations\n */\n public setupIntegrations(): void {\n if (this._isEnabled()) {\n this._integrations = setupIntegrations(this._options);\n }\n }\n\n /**\n * @inheritDoc\n */\n public getIntegration<T extends Integration>(integration: IntegrationClass<T>): T | null {\n try {\n return (this._integrations[integration.id] as T) || null;\n } catch (_oO) {\n logger.warn(`Cannot retrieve integration ${integration.id} from the current Client`);\n return null;\n }\n }\n\n /** Updates existing session based on the provided event */\n protected _updateSessionFromEvent(session: Session, event: Event): void {\n let crashed = false;\n let errored = false;\n let userAgent;\n const exceptions = event.exception && event.exception.values;\n\n if (exceptions) {\n errored = true;\n\n for (const ex of exceptions) {\n const mechanism = ex.mechanism;\n if (mechanism && mechanism.handled === false) {\n crashed = true;\n break;\n }\n }\n }\n\n const user = event.user;\n if (!session.userAgent) {\n const headers = event.request ? event.request.headers : {};\n for (const key in headers) {\n if (key.toLowerCase() === 'user-agent') {\n userAgent = headers[key];\n break;\n }\n }\n }\n\n session.update({\n ...(crashed && { status: SessionStatus.Crashed }),\n user,\n userAgent,\n errors: session.errors + Number(errored || crashed),\n });\n }\n\n /** Deliver captured session to Sentry */\n protected _sendSession(session: Session): void {\n this._getBackend().sendSession(session);\n }\n\n /** Waits for the client to be done with processing. */\n protected _isClientProcessing(timeout?: number): PromiseLike<boolean> {\n return new SyncPromise(resolve => {\n let ticked: number = 0;\n const tick: number = 1;\n\n const interval = setInterval(() => {\n if (this._processing == 0) {\n clearInterval(interval);\n resolve(true);\n } else {\n ticked += tick;\n if (timeout && ticked >= timeout) {\n clearInterval(interval);\n resolve(false);\n }\n }\n }, tick);\n });\n }\n\n /** Returns the current backend. */\n protected _getBackend(): B {\n return this._backend;\n }\n\n /** Determines whether this SDK is enabled and a valid Dsn is present. */\n protected _isEnabled(): boolean {\n return this.getOptions().enabled !== false && this._dsn !== undefined;\n }\n\n /**\n * Adds common information to events.\n *\n * The information includes release and environment from `options`,\n * breadcrumbs and context (extra, tags and user) from the scope.\n *\n * Information that is already present in the event is never overwritten. For\n * nested objects, such as the context, keys are merged.\n *\n * @param event The original event.\n * @param hint May contain additional information about the original exception.\n * @param scope A scope containing event metadata.\n * @returns A new event with more information.\n */\n protected _prepareEvent(event: Event, scope?: Scope, hint?: EventHint): PromiseLike<Event | null> {\n const { normalizeDepth = 3 } = this.getOptions();\n const prepared: Event = {\n ...event,\n event_id: event.event_id || (hint && hint.event_id ? hint.event_id : uuid4()),\n timestamp: event.timestamp || dateTimestampInSeconds(),\n };\n\n this._applyClientOptions(prepared);\n this._applyIntegrationsMetadata(prepared);\n\n // If we have scope given to us, use it as the base for further modifications.\n // This allows us to prevent unnecessary copying of data if `captureContext` is not provided.\n let finalScope = scope;\n if (hint && hint.captureContext) {\n finalScope = Scope.clone(finalScope).update(hint.captureContext);\n }\n\n // We prepare the result here with a resolved Event.\n let result = SyncPromise.resolve<Event | null>(prepared);\n\n // This should be the last thing called, since we want that\n // {@link Hub.addEventProcessor} gets the finished prepared event.\n if (finalScope) {\n // In case we have a hub we reassign it.\n result = finalScope.applyToEvent(prepared, hint);\n }\n\n return result.then(evt => {\n if (typeof normalizeDepth === 'number' && normalizeDepth > 0) {\n return this._normalizeEvent(evt, normalizeDepth);\n }\n return evt;\n });\n }\n\n /**\n * Applies `normalize` function on necessary `Event` attributes to make them safe for serialization.\n * Normalized keys:\n * - `breadcrumbs.data`\n * - `user`\n * - `contexts`\n * - `extra`\n * @param event Event\n * @returns Normalized event\n */\n protected _normalizeEvent(event: Event | null, depth: number): Event | null {\n if (!event) {\n return null;\n }\n\n const normalized = {\n ...event,\n ...(event.breadcrumbs && {\n breadcrumbs: event.breadcrumbs.map(b => ({\n ...b,\n ...(b.data && {\n data: normalize(b.data, depth),\n }),\n })),\n }),\n ...(event.user && {\n user: normalize(event.user, depth),\n }),\n ...(event.contexts && {\n contexts: normalize(event.contexts, depth),\n }),\n ...(event.extra && {\n extra: normalize(event.extra, depth),\n }),\n };\n // event.contexts.trace stores information about a Transaction. Similarly,\n // event.spans[] stores information about child Spans. Given that a\n // Transaction is conceptually a Span, normalization should apply to both\n // Transactions and Spans consistently.\n // For now the decision is to skip normalization of Transactions and Spans,\n // so this block overwrites the normalized event to add back the original\n // Transaction information prior to normalization.\n if (event.contexts && event.contexts.trace) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n normalized.contexts.trace = event.contexts.trace;\n }\n return normalized;\n }\n\n /**\n * Enhances event using the client configuration.\n * It takes care of all \"static\" values like environment, release and `dist`,\n * as well as truncating overly long values.\n * @param event event instance to be enhanced\n */\n protected _applyClientOptions(event: Event): void {\n const options = this.getOptions();\n const { environment, release, dist, maxValueLength = 250 } = options;\n\n if (!('environment' in event)) {\n event.environment = 'environment' in options ? environment : 'production';\n }\n\n if (event.release === undefined && release !== undefined) {\n event.release = release;\n }\n\n if (event.dist === undefined && dist !== undefined) {\n event.dist = dist;\n }\n\n if (event.message) {\n event.message = truncate(event.message, maxValueLength);\n }\n\n const exception = event.exception && event.exception.values && event.exception.values[0];\n if (exception && exception.value) {\n exception.value = truncate(exception.value, maxValueLength);\n }\n\n const request = event.request;\n if (request && request.url) {\n request.url = truncate(request.url, maxValueLength);\n }\n }\n\n /**\n * This function adds all used integrations to the SDK info in the event.\n * @param sdkInfo The sdkInfo of the event that will be filled with all integrations.\n */\n protected _applyIntegrationsMetadata(event: Event): void {\n const sdkInfo = event.sdk;\n const integrationsArray = Object.keys(this._integrations);\n if (sdkInfo && integrationsArray.length > 0) {\n sdkInfo.integrations = integrationsArray;\n }\n }\n\n /**\n * Tells the backend to send this event\n * @param event The Sentry event to send\n */\n protected _sendEvent(event: Event): void {\n this._getBackend().sendEvent(event);\n }\n\n /**\n * Processes the event and logs an error in case of rejection\n * @param event\n * @param hint\n * @param scope\n */\n protected _captureEvent(event: Event, hint?: EventHint, scope?: Scope): PromiseLike<string | undefined> {\n return this._processEvent(event, hint, scope).then(\n finalEvent => {\n return finalEvent.event_id;\n },\n reason => {\n logger.error(reason);\n return undefined;\n },\n );\n }\n\n /**\n * Processes an event (either error or message) and sends it to Sentry.\n *\n * This also adds breadcrumbs and context information to the event. However,\n * platform specific meta data (such as the User's IP address) must be added\n * by the SDK implementor.\n *\n *\n * @param event The event to send to Sentry.\n * @param hint May contain additional information about the original exception.\n * @param scope A scope containing event metadata.\n * @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send.\n */\n protected _processEvent(event: Event, hint?: EventHint, scope?: Scope): PromiseLike<Event> {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const { beforeSend, sampleRate } = this.getOptions();\n\n if (!this._isEnabled()) {\n return SyncPromise.reject(new SentryError('SDK not enabled, will not send event.'));\n }\n\n const isTransaction = event.type === 'transaction';\n // 1.0 === 100% events are sent\n // 0.0 === 0% events are sent\n // Sampling for transaction happens somewhere else\n if (!isTransaction && typeof sampleRate === 'number' && Math.random() > sampleRate) {\n return SyncPromise.reject(new SentryError('This event has been sampled, will not send event.'));\n }\n\n return this._prepareEvent(event, scope, hint)\n .then(prepared => {\n if (prepared === null) {\n throw new SentryError('An event processor returned null, will not send event.');\n }\n\n const isInternalException = hint && hint.data && (hint.data as { __sentry__: boolean }).__sentry__ === true;\n if (isInternalException || isTransaction || !beforeSend) {\n return prepared;\n }\n\n const beforeSendResult = beforeSend(prepared, hint);\n if (typeof beforeSendResult === 'undefined') {\n throw new SentryError('`beforeSend` method has to return `null` or a valid event.');\n } else if (isThenable(beforeSendResult)) {\n return (beforeSendResult as PromiseLike<Event | null>).then(\n event => event,\n e => {\n throw new SentryError(`beforeSend rejected with ${e}`);\n },\n );\n }\n return beforeSendResult;\n })\n .then(processedEvent => {\n if (processedEvent === null) {\n throw new SentryError('`beforeSend` returned `null`, will not send event.');\n }\n\n const session = scope && scope.getSession && scope.getSession();\n if (!isTransaction && session) {\n this._updateSessionFromEvent(session, processedEvent);\n }\n\n this._sendEvent(processedEvent);\n return processedEvent;\n })\n .then(null, reason => {\n if (reason instanceof SentryError) {\n throw reason;\n }\n\n this.captureException(reason, {\n data: {\n __sentry__: true,\n },\n originalException: reason as Error,\n });\n throw new SentryError(\n `Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\\nReason: ${reason}`,\n );\n });\n }\n\n /**\n * Occupies the client with processing and event\n */\n protected _process<T>(promise: PromiseLike<T>): void {\n this._processing += 1;\n promise.then(\n value => {\n this._processing -= 1;\n return value;\n },\n reason => {\n this._processing -= 1;\n return reason;\n },\n );\n }\n}\n","import { Integration, WrappedFunction } from '@sentry/types';\n\nlet originalFunctionToString: () => void;\n\n/** Patch toString calls to return proper name for wrapped functions */\nexport class FunctionToString implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'FunctionToString';\n\n /**\n * @inheritDoc\n */\n public name: string = FunctionToString.id;\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n originalFunctionToString = Function.prototype.toString;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Function.prototype.toString = function(this: WrappedFunction, ...args: any[]): string {\n const context = this.__sentry_original__ || this;\n return originalFunctionToString.apply(context, args);\n };\n }\n}\n","import { Event, Response, Status, Transport } from '@sentry/types';\nimport { SyncPromise } from '@sentry/utils';\n\n/** Noop transport */\nexport class NoopTransport implements Transport {\n /**\n * @inheritDoc\n */\n public sendEvent(_: Event): PromiseLike<Response> {\n return SyncPromise.resolve({\n reason: `NoopTransport: Event has been skipped because no Dsn is configured.`,\n status: Status.Skipped,\n });\n }\n\n /**\n * @inheritDoc\n */\n public close(_?: number): PromiseLike<boolean> {\n return SyncPromise.resolve(true);\n }\n}\n","import { Event, EventHint, Options, Session, Severity, Transport } from '@sentry/types';\nimport { logger, SentryError } from '@sentry/utils';\n\nimport { NoopTransport } from './transports/noop';\n\n/**\n * Internal platform-dependent Sentry SDK Backend.\n *\n * While {@link Client} contains business logic specific to an SDK, the\n * Backend offers platform specific implementations for low-level operations.\n * These are persisting and loading information, sending events, and hooking\n * into the environment.\n *\n * Backends receive a handle to the Client in their constructor. When a\n * Backend automatically generates events, it must pass them to\n * the Client for validation and processing first.\n *\n * Usually, the Client will be of corresponding type, e.g. NodeBackend\n * receives NodeClient. However, higher-level SDKs can choose to instantiate\n * multiple Backends and delegate tasks between them. In this case, an event\n * generated by one backend might very well be sent by another one.\n *\n * The client also provides access to options via {@link Client.getOptions}.\n * @hidden\n */\nexport interface Backend {\n /** Creates a {@link Event} from an exception. */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n eventFromException(exception: any, hint?: EventHint): PromiseLike<Event>;\n\n /** Creates a {@link Event} from a plain message. */\n eventFromMessage(message: string, level?: Severity, hint?: EventHint): PromiseLike<Event>;\n\n /** Submits the event to Sentry */\n sendEvent(event: Event): void;\n\n /** Submits the session to Sentry */\n sendSession(session: Session): void;\n\n /**\n * Returns the transport that is used by the backend.\n * Please note that the transport gets lazy initialized so it will only be there once the first event has been sent.\n *\n * @returns The transport.\n */\n getTransport(): Transport;\n}\n\n/**\n * A class object that can instantiate Backend objects.\n * @hidden\n */\nexport type BackendClass<B extends Backend, O extends Options> = new (options: O) => B;\n\n/**\n * This is the base implemention of a Backend.\n * @hidden\n */\nexport abstract class BaseBackend<O extends Options> implements Backend {\n /** Options passed to the SDK. */\n protected readonly _options: O;\n\n /** Cached transport used internally. */\n protected _transport: Transport;\n\n /** Creates a new backend instance. */\n public constructor(options: O) {\n this._options = options;\n if (!this._options.dsn) {\n logger.warn('No DSN provided, backend will not do anything.');\n }\n this._transport = this._setupTransport();\n }\n\n /**\n * @inheritDoc\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n public eventFromException(_exception: any, _hint?: EventHint): PromiseLike<Event> {\n throw new SentryError('Backend has to implement `eventFromException` method');\n }\n\n /**\n * @inheritDoc\n */\n public eventFromMessage(_message: string, _level?: Severity, _hint?: EventHint): PromiseLike<Event> {\n throw new SentryError('Backend has to implement `eventFromMessage` method');\n }\n\n /**\n * @inheritDoc\n */\n public sendEvent(event: Event): void {\n this._transport.sendEvent(event).then(null, reason => {\n logger.error(`Error while sending event: ${reason}`);\n });\n }\n\n /**\n * @inheritDoc\n */\n public sendSession(session: Session): void {\n if (!this._transport.sendSession) {\n logger.warn(\"Dropping session because custom transport doesn't implement sendSession\");\n return;\n }\n\n this._transport.sendSession(session).then(null, reason => {\n logger.error(`Error while sending session: ${reason}`);\n });\n }\n\n /**\n * @inheritDoc\n */\n public getTransport(): Transport {\n return this._transport;\n }\n\n /**\n * Sets up the transport so it can be used later to send requests.\n */\n protected _setupTransport(): Transport {\n return new NoopTransport();\n }\n}\n","import { Event, SentryRequest, Session } from '@sentry/types';\n\nimport { API } from './api';\n\n/** Creates a SentryRequest from an event. */\nexport function sessionToSentryRequest(session: Session, api: API): SentryRequest {\n const envelopeHeaders = JSON.stringify({\n sent_at: new Date().toISOString(),\n });\n const itemHeaders = JSON.stringify({\n type: 'session',\n });\n\n return {\n body: `${envelopeHeaders}\\n${itemHeaders}\\n${JSON.stringify(session)}`,\n type: 'session',\n url: api.getEnvelopeEndpointWithUrlEncodedAuth(),\n };\n}\n\n/** Creates a SentryRequest from an event. */\nexport function eventToSentryRequest(event: Event, api: API): SentryRequest {\n const useEnvelope = event.type === 'transaction';\n\n const req: SentryRequest = {\n body: JSON.stringify(event),\n type: event.type || 'event',\n url: useEnvelope ? api.getEnvelopeEndpointWithUrlEncodedAuth() : api.getStoreEndpointWithUrlEncodedAuth(),\n };\n\n // https://develop.sentry.dev/sdk/envelopes/\n\n // Since we don't need to manipulate envelopes nor store them, there is no\n // exported concept of an Envelope with operations including serialization and\n // deserialization. Instead, we only implement a minimal subset of the spec to\n // serialize events inline here.\n if (useEnvelope) {\n const envelopeHeaders = JSON.stringify({\n event_id: event.event_id,\n // We need to add * 1000 since we divide it by 1000 by default but JS works with ms precision\n // The reason we use timestampWithMs here is that all clocks across the SDK use the same clock\n sent_at: new Date().toISOString(),\n });\n const itemHeaders = JSON.stringify({\n type: event.type,\n // The content-type is assumed to be 'application/json' and not part of\n // the current spec for transaction items, so we don't bloat the request\n // body with it.\n //\n // content_type: 'application/json',\n //\n // The length is optional. It must be the number of bytes in req.Body\n // encoded as UTF-8. Since the server can figure this out and would\n // otherwise refuse events that report the length incorrectly, we decided\n // not to send the length to avoid problems related to reporting the wrong\n // size and to reduce request body size.\n //\n // length: new TextEncoder().encode(req.body).length,\n });\n // The trailing newline is optional. We intentionally don't send it to avoid\n // sending unnecessary bytes.\n //\n // const envelope = `${envelopeHeaders}\\n${itemHeaders}\\n${req.body}\\n`;\n const envelope = `${envelopeHeaders}\\n${itemHeaders}\\n${req.body}`;\n req.body = envelope;\n }\n\n return req;\n}\n","import { addGlobalEventProcessor, getCurrentHub } from '@sentry/hub';\nimport { Event, Integration } from '@sentry/types';\nimport { getEventDescription, isMatchingPattern, logger } from '@sentry/utils';\n\n// \"Script error.\" is hard coded into browsers for errors that it can't read.\n// this is the result of a script being pulled in from an external domain and CORS.\nconst DEFAULT_IGNORE_ERRORS = [/^Script error\\.?$/, /^Javascript error: Script error\\.? on line 0$/];\n\n/** JSDoc */\ninterface InboundFiltersOptions {\n allowUrls: Array<string | RegExp>;\n denyUrls: Array<string | RegExp>;\n ignoreErrors: Array<string | RegExp>;\n ignoreInternal: boolean;\n\n /** @deprecated use {@link InboundFiltersOptions.allowUrls} instead. */\n whitelistUrls: Array<string | RegExp>;\n /** @deprecated use {@link InboundFiltersOptions.denyUrls} instead. */\n blacklistUrls: Array<string | RegExp>;\n}\n\n/** Inbound filters configurable by the user */\nexport class InboundFilters implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'InboundFilters';\n\n /**\n * @inheritDoc\n */\n public name: string = InboundFilters.id;\n\n public constructor(private readonly _options: Partial<InboundFiltersOptions> = {}) {}\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n addGlobalEventProcessor((event: Event) => {\n const hub = getCurrentHub();\n if (!hub) {\n return event;\n }\n const self = hub.getIntegration(InboundFilters);\n if (self) {\n const client = hub.getClient();\n const clientOptions = client ? client.getOptions() : {};\n const options = self._mergeOptions(clientOptions);\n if (self._shouldDropEvent(event, options)) {\n return null;\n }\n }\n return event;\n });\n }\n\n /** JSDoc */\n private _shouldDropEvent(event: Event, options: Partial<InboundFiltersOptions>): boolean {\n if (this._isSentryError(event, options)) {\n logger.warn(`Event dropped due to being internal Sentry Error.\\nEvent: ${getEventDescription(event)}`);\n return true;\n }\n if (this._isIgnoredError(event, options)) {\n logger.warn(\n `Event dropped due to being matched by \\`ignoreErrors\\` option.\\nEvent: ${getEventDescription(event)}`,\n );\n return true;\n }\n if (this._isDeniedUrl(event, options)) {\n logger.warn(\n `Event dropped due to being matched by \\`denyUrls\\` option.\\nEvent: ${getEventDescription(\n event,\n )}.\\nUrl: ${this._getEventFilterUrl(event)}`,\n );\n return true;\n }\n if (!this._isAllowedUrl(event, options)) {\n logger.warn(\n `Event dropped due to not being matched by \\`allowUrls\\` option.\\nEvent: ${getEventDescription(\n event,\n )}.\\nUrl: ${this._getEventFilterUrl(event)}`,\n );\n return true;\n }\n return false;\n }\n\n /** JSDoc */\n private _isSentryError(event: Event, options: Partial<InboundFiltersOptions>): boolean {\n if (!options.ignoreInternal) {\n return false;\n }\n\n try {\n return (\n (event &&\n event.exception &&\n event.exception.values &&\n event.exception.values[0] &&\n event.exception.values[0].type === 'SentryError') ||\n false\n );\n } catch (_oO) {\n return false;\n }\n }\n\n /** JSDoc */\n private _isIgnoredError(event: Event, options: Partial<InboundFiltersOptions>): boolean {\n if (!options.ignoreErrors || !options.ignoreErrors.length) {\n return false;\n }\n\n return this._getPossibleEventMessages(event).some(message =>\n // Not sure why TypeScript complains here...\n (options.ignoreErrors as Array<RegExp | string>).some(pattern => isMatchingPattern(message, pattern)),\n );\n }\n\n /** JSDoc */\n private _isDeniedUrl(event: Event, options: Partial<InboundFiltersOptions>): boolean {\n // TODO: Use Glob instead?\n if (!options.denyUrls || !options.denyUrls.length) {\n return false;\n }\n const url = this._getEventFilterUrl(event);\n return !url ? false : options.denyUrls.some(pattern => isMatchingPattern(url, pattern));\n }\n\n /** JSDoc */\n private _isAllowedUrl(event: Event, options: Partial<InboundFiltersOptions>): boolean {\n // TODO: Use Glob instead?\n if (!options.allowUrls || !options.allowUrls.length) {\n return true;\n }\n const url = this._getEventFilterUrl(event);\n return !url ? true : options.allowUrls.some(pattern => isMatchingPattern(url, pattern));\n }\n\n /** JSDoc */\n private _mergeOptions(clientOptions: Partial<InboundFiltersOptions> = {}): Partial<InboundFiltersOptions> {\n return {\n allowUrls: [\n // eslint-disable-next-line deprecation/deprecation\n ...(this._options.whitelistUrls || []),\n ...(this._options.allowUrls || []),\n // eslint-disable-next-line deprecation/deprecation\n ...(clientOptions.whitelistUrls || []),\n ...(clientOptions.allowUrls || []),\n ],\n denyUrls: [\n // eslint-disable-next-line deprecation/deprecation\n ...(this._options.blacklistUrls || []),\n ...(this._options.denyUrls || []),\n // eslint-disable-next-line deprecation/deprecation\n ...(clientOptions.blacklistUrls || []),\n ...(clientOptions.denyUrls || []),\n ],\n ignoreErrors: [\n ...(this._options.ignoreErrors || []),\n ...(clientOptions.ignoreErrors || []),\n ...DEFAULT_IGNORE_ERRORS,\n ],\n ignoreInternal: typeof this._options.ignoreInternal !== 'undefined' ? this._options.ignoreInternal : true,\n };\n }\n\n /** JSDoc */\n private _getPossibleEventMessages(event: Event): string[] {\n if (event.message) {\n return [event.message];\n }\n if (event.exception) {\n try {\n const { type = '', value = '' } = (event.exception.values && event.exception.values[0]) || {};\n return [`${value}`, `${type}: ${value}`];\n } catch (oO) {\n logger.error(`Cannot extract message for event ${getEventDescription(event)}`);\n return [];\n }\n }\n return [];\n }\n\n /** JSDoc */\n private _getEventFilterUrl(event: Event): string | null {\n try {\n if (event.stacktrace) {\n const frames = event.stacktrace.frames;\n return (frames && frames[frames.length - 1].filename) || null;\n }\n if (event.exception) {\n const frames =\n event.exception.values && event.exception.values[0].stacktrace && event.exception.values[0].stacktrace.frames;\n return (frames && frames[frames.length - 1].filename) || null;\n }\n return null;\n } catch (oO) {\n logger.error(`Cannot extract url for event ${getEventDescription(event)}`);\n return null;\n }\n }\n}\n","/**\n * This was originally forked from https://github.com/occ/TraceKit, but has since been\n * largely modified and is now maintained as part of Sentry JS SDK.\n */\n\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n\n/**\n * An object representing a single stack frame.\n * {Object} StackFrame\n * {string} url The JavaScript or HTML file URL.\n * {string} func The function name, or empty for anonymous functions (if guessing did not work).\n * {string[]?} args The arguments passed to the function, if known.\n * {number=} line The line number, if known.\n * {number=} column The column number, if known.\n * {string[]} context An array of source code lines; the middle element corresponds to the correct line#.\n */\nexport interface StackFrame {\n url: string;\n func: string;\n args: string[];\n line: number | null;\n column: number | null;\n}\n\n/**\n * An object representing a JavaScript stack trace.\n * {Object} StackTrace\n * {string} name The name of the thrown exception.\n * {string} message The exception error message.\n * {TraceKit.StackFrame[]} stack An array of stack frames.\n */\nexport interface StackTrace {\n name: string;\n message: string;\n mechanism?: string;\n stack: StackFrame[];\n failed?: boolean;\n}\n\n// global reference to slice\nconst UNKNOWN_FUNCTION = '?';\n\n// Chromium based browsers: Chrome, Brave, new Opera, new Edge\nconst chrome = /^\\s*at (?:(.*?) ?\\()?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\\/).*?)(?::(\\d+))?(?::(\\d+))?\\)?\\s*$/i;\n// gecko regex: `(?:bundle|\\d+\\.js)`: `bundle` is for react native, `\\d+\\.js` also but specifically for ram bundles because it\n// generates filenames without a prefix like `file://` the filenames in the stacktrace are just 42.js\n// We need this specific case for now because we want no other regex to match.\nconst gecko = /^\\s*(.*?)(?:\\((.*?)\\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension|capacitor).*?:\\/.*?|\\[native code\\]|[^@]*(?:bundle|\\d+\\.js))(?::(\\d+))?(?::(\\d+))?\\s*$/i;\nconst winjs = /^\\s*at (?:((?:\\[object object\\])?.+) )?\\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\\d+)(?::(\\d+))?\\)?\\s*$/i;\nconst geckoEval = /(\\S+) line (\\d+)(?: > eval line \\d+)* > eval/i;\nconst chromeEval = /\\((\\S*)(?::(\\d+))(?::(\\d+))\\)/;\n// Based on our own mapping pattern - https://github.com/getsentry/sentry/blob/9f08305e09866c8bd6d0c24f5b0aabdd7dd6c59c/src/sentry/lang/javascript/errormapping.py#L83-L108\nconst reactMinifiedRegexp = /Minified React error #\\d+;/i;\n\n/** JSDoc */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\nexport function computeStackTrace(ex: any): StackTrace {\n let stack = null;\n let popSize = 0;\n\n if (ex) {\n if (typeof ex.framesToPop === 'number') {\n popSize = ex.framesToPop;\n } else if (reactMinifiedRegexp.test(ex.message)) {\n popSize = 1;\n }\n }\n\n try {\n // This must be tried first because Opera 10 *destroys*\n // its stacktrace property if you try to access the stack\n // property first!!\n stack = computeStackTraceFromStacktraceProp(ex);\n if (stack) {\n return popFrames(stack, popSize);\n }\n } catch (e) {\n // no-empty\n }\n\n try {\n stack = computeStackTraceFromStackProp(ex);\n if (stack) {\n return popFrames(stack, popSize);\n }\n } catch (e) {\n // no-empty\n }\n\n return {\n message: extractMessage(ex),\n name: ex && ex.name,\n stack: [],\n failed: true,\n };\n}\n\n/** JSDoc */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any, complexity\nfunction computeStackTraceFromStackProp(ex: any): StackTrace | null {\n if (!ex || !ex.stack) {\n return null;\n }\n\n const stack = [];\n const lines = ex.stack.split('\\n');\n let isEval;\n let submatch;\n let parts;\n let element;\n\n for (let i = 0; i < lines.length; ++i) {\n if ((parts = chrome.exec(lines[i]))) {\n const isNative = parts[2] && parts[2].indexOf('native') === 0; // start of line\n isEval = parts[2] && parts[2].indexOf('eval') === 0; // start of line\n if (isEval && (submatch = chromeEval.exec(parts[2]))) {\n // throw out eval line/column and use top-most line/column number\n parts[2] = submatch[1]; // url\n parts[3] = submatch[2]; // line\n parts[4] = submatch[3]; // column\n }\n element = {\n // working with the regexp above is super painful. it is quite a hack, but just stripping the `address at `\n // prefix here seems like the quickest solution for now.\n url: parts[2] && parts[2].indexOf('address at ') === 0 ? parts[2].substr('address at '.length) : parts[2],\n func: parts[1] || UNKNOWN_FUNCTION,\n args: isNative ? [parts[2]] : [],\n line: parts[3] ? +parts[3] : null,\n column: parts[4] ? +parts[4] : null,\n };\n } else if ((parts = winjs.exec(lines[i]))) {\n element = {\n url: parts[2],\n func: parts[1] || UNKNOWN_FUNCTION,\n args: [],\n line: +parts[3],\n column: parts[4] ? +parts[4] : null,\n };\n } else if ((parts = gecko.exec(lines[i]))) {\n isEval = parts[3] && parts[3].indexOf(' > eval') > -1;\n if (isEval && (submatch = geckoEval.exec(parts[3]))) {\n // throw out eval line/column and use top-most line number\n parts[1] = parts[1] || `eval`;\n parts[3] = submatch[1];\n parts[4] = submatch[2];\n parts[5] = ''; // no column when eval\n } else if (i === 0 && !parts[5] && ex.columnNumber !== void 0) {\n // FireFox uses this awesome columnNumber property for its top frame\n // Also note, Firefox's column number is 0-based and everything else expects 1-based,\n // so adding 1\n // NOTE: this hack doesn't work if top-most frame is eval\n stack[0].column = (ex.columnNumber as number) + 1;\n }\n element = {\n url: parts[3],\n func: parts[1] || UNKNOWN_FUNCTION,\n args: parts[2] ? parts[2].split(',') : [],\n line: parts[4] ? +parts[4] : null,\n column: parts[5] ? +parts[5] : null,\n };\n } else {\n continue;\n }\n\n if (!element.func && element.line) {\n element.func = UNKNOWN_FUNCTION;\n }\n\n stack.push(element);\n }\n\n if (!stack.length) {\n return null;\n }\n\n return {\n message: extractMessage(ex),\n name: ex.name,\n stack,\n };\n}\n\n/** JSDoc */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction computeStackTraceFromStacktraceProp(ex: any): StackTrace | null {\n if (!ex || !ex.stacktrace) {\n return null;\n }\n // Access and store the stacktrace property before doing ANYTHING\n // else to it because Opera is not very good at providing it\n // reliably in other circumstances.\n const stacktrace = ex.stacktrace;\n const opera10Regex = / line (\\d+).*script (?:in )?(\\S+)(?:: in function (\\S+))?$/i;\n const opera11Regex = / line (\\d+), column (\\d+)\\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\\((.*)\\))? in (.*):\\s*$/i;\n const lines = stacktrace.split('\\n');\n const stack = [];\n let parts;\n\n for (let line = 0; line < lines.length; line += 2) {\n let element = null;\n if ((parts = opera10Regex.exec(lines[line]))) {\n element = {\n url: parts[2],\n func: parts[3],\n args: [],\n line: +parts[1],\n column: null,\n };\n } else if ((parts = opera11Regex.exec(lines[line]))) {\n element = {\n url: parts[6],\n func: parts[3] || parts[4],\n args: parts[5] ? parts[5].split(',') : [],\n line: +parts[1],\n column: +parts[2],\n };\n }\n\n if (element) {\n if (!element.func && element.line) {\n element.func = UNKNOWN_FUNCTION;\n }\n stack.push(element);\n }\n }\n\n if (!stack.length) {\n return null;\n }\n\n return {\n message: extractMessage(ex),\n name: ex.name,\n stack,\n };\n}\n\n/** Remove N number of frames from the stack */\nfunction popFrames(stacktrace: StackTrace, popSize: number): StackTrace {\n try {\n return {\n ...stacktrace,\n stack: stacktrace.stack.slice(popSize),\n };\n } catch (e) {\n return stacktrace;\n }\n}\n\n/**\n * There are cases where stacktrace.message is an Event object\n * https://github.com/getsentry/sentry-javascript/issues/1949\n * In this specific case we try to extract stacktrace.message.error.message\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction extractMessage(ex: any): string {\n const message = ex && ex.message;\n if (!message) {\n return 'No error message';\n }\n if (message.error && typeof message.error.message === 'string') {\n return message.error.message;\n }\n return message;\n}\n","import { Event, Exception, StackFrame } from '@sentry/types';\nimport { extractExceptionKeysForMessage, isEvent, normalizeToSize } from '@sentry/utils';\n\nimport { computeStackTrace, StackFrame as TraceKitStackFrame, StackTrace as TraceKitStackTrace } from './tracekit';\n\nconst STACKTRACE_LIMIT = 50;\n\n/**\n * This function creates an exception from an TraceKitStackTrace\n * @param stacktrace TraceKitStackTrace that will be converted to an exception\n * @hidden\n */\nexport function exceptionFromStacktrace(stacktrace: TraceKitStackTrace): Exception {\n const frames = prepareFramesForEvent(stacktrace.stack);\n\n const exception: Exception = {\n type: stacktrace.name,\n value: stacktrace.message,\n };\n\n if (frames && frames.length) {\n exception.stacktrace = { frames };\n }\n\n if (exception.type === undefined && exception.value === '') {\n exception.value = 'Unrecoverable error caught';\n }\n\n return exception;\n}\n\n/**\n * @hidden\n */\nexport function eventFromPlainObject(\n exception: Record<string, unknown>,\n syntheticException?: Error,\n rejection?: boolean,\n): Event {\n const event: Event = {\n exception: {\n values: [\n {\n type: isEvent(exception) ? exception.constructor.name : rejection ? 'UnhandledRejection' : 'Error',\n value: `Non-Error ${\n rejection ? 'promise rejection' : 'exception'\n } captured with keys: ${extractExceptionKeysForMessage(exception)}`,\n },\n ],\n },\n extra: {\n __serialized__: normalizeToSize(exception),\n },\n };\n\n if (syntheticException) {\n const stacktrace = computeStackTrace(syntheticException);\n const frames = prepareFramesForEvent(stacktrace.stack);\n event.stacktrace = {\n frames,\n };\n }\n\n return event;\n}\n\n/**\n * @hidden\n */\nexport function eventFromStacktrace(stacktrace: TraceKitStackTrace): Event {\n const exception = exceptionFromStacktrace(stacktrace);\n\n return {\n exception: {\n values: [exception],\n },\n };\n}\n\n/**\n * @hidden\n */\nexport function prepareFramesForEvent(stack: TraceKitStackFrame[]): StackFrame[] {\n if (!stack || !stack.length) {\n return [];\n }\n\n let localStack = stack;\n\n const firstFrameFunction = localStack[0].func || '';\n const lastFrameFunction = localStack[localStack.length - 1].func || '';\n\n // If stack starts with one of our API calls, remove it (starts, meaning it's the top of the stack - aka last call)\n if (firstFrameFunction.indexOf('captureMessage') !== -1 || firstFrameFunction.indexOf('captureException') !== -1) {\n localStack = localStack.slice(1);\n }\n\n // If stack ends with one of our internal API calls, remove it (ends, meaning it's the bottom of the stack - aka top-most call)\n if (lastFrameFunction.indexOf('sentryWrapped') !== -1) {\n localStack = localStack.slice(0, -1);\n }\n\n // The frame where the crash happened, should be the last entry in the array\n return localStack\n .slice(0, STACKTRACE_LIMIT)\n .map(\n (frame: TraceKitStackFrame): StackFrame => ({\n colno: frame.column === null ? undefined : frame.column,\n filename: frame.url || localStack[0].url,\n function: frame.func || '?',\n in_app: true,\n lineno: frame.line === null ? undefined : frame.line,\n }),\n )\n .reverse();\n}\n","import { Event, EventHint, Options, Severity } from '@sentry/types';\nimport {\n addExceptionMechanism,\n addExceptionTypeValue,\n isDOMError,\n isDOMException,\n isError,\n isErrorEvent,\n isEvent,\n isPlainObject,\n SyncPromise,\n} from '@sentry/utils';\n\nimport { eventFromPlainObject, eventFromStacktrace, prepareFramesForEvent } from './parsers';\nimport { computeStackTrace } from './tracekit';\n\n/**\n * Builds and Event from a Exception\n * @hidden\n */\nexport function eventFromException(options: Options, exception: unknown, hint?: EventHint): PromiseLike<Event> {\n const syntheticException = (hint && hint.syntheticException) || undefined;\n const event = eventFromUnknownInput(exception, syntheticException, {\n attachStacktrace: options.attachStacktrace,\n });\n addExceptionMechanism(event, {\n handled: true,\n type: 'generic',\n });\n event.level = Severity.Error;\n if (hint && hint.event_id) {\n event.event_id = hint.event_id;\n }\n return SyncPromise.resolve(event);\n}\n\n/**\n * Builds and Event from a Message\n * @hidden\n */\nexport function eventFromMessage(\n options: Options,\n message: string,\n level: Severity = Severity.Info,\n hint?: EventHint,\n): PromiseLike<Event> {\n const syntheticException = (hint && hint.syntheticException) || undefined;\n const event = eventFromString(message, syntheticException, {\n attachStacktrace: options.attachStacktrace,\n });\n event.level = level;\n if (hint && hint.event_id) {\n event.event_id = hint.event_id;\n }\n return SyncPromise.resolve(event);\n}\n\n/**\n * @hidden\n */\nexport function eventFromUnknownInput(\n exception: unknown,\n syntheticException?: Error,\n options: {\n rejection?: boolean;\n attachStacktrace?: boolean;\n } = {},\n): Event {\n let event: Event;\n\n if (isErrorEvent(exception as ErrorEvent) && (exception as ErrorEvent).error) {\n // If it is an ErrorEvent with `error` property, extract it to get actual Error\n const errorEvent = exception as ErrorEvent;\n // eslint-disable-next-line no-param-reassign\n exception = errorEvent.error;\n event = eventFromStacktrace(computeStackTrace(exception as Error));\n return event;\n }\n if (isDOMError(exception as DOMError) || isDOMException(exception as DOMException)) {\n // If it is a DOMError or DOMException (which are legacy APIs, but still supported in some browsers)\n // then we just extract the name, code, and message, as they don't provide anything else\n // https://developer.mozilla.org/en-US/docs/Web/API/DOMError\n // https://developer.mozilla.org/en-US/docs/Web/API/DOMException\n const domException = exception as DOMException;\n const name = domException.name || (isDOMError(domException) ? 'DOMError' : 'DOMException');\n const message = domException.message ? `${name}: ${domException.message}` : name;\n\n event = eventFromString(message, syntheticException, options);\n addExceptionTypeValue(event, message);\n if ('code' in domException) {\n event.tags = { ...event.tags, 'DOMException.code': `${domException.code}` };\n }\n\n return event;\n }\n if (isError(exception as Error)) {\n // we have a real Error object, do nothing\n event = eventFromStacktrace(computeStackTrace(exception as Error));\n return event;\n }\n if (isPlainObject(exception) || isEvent(exception)) {\n // If it is plain Object or Event, serialize it manually and extract options\n // This will allow us to group events based on top-level keys\n // which is much better than creating new group when any key/value change\n const objectException = exception as Record<string, unknown>;\n event = eventFromPlainObject(objectException, syntheticException, options.rejection);\n addExceptionMechanism(event, {\n synthetic: true,\n });\n return event;\n }\n\n // If none of previous checks were valid, then it means that it's not:\n // - an instance of DOMError\n // - an instance of DOMException\n // - an instance of Event\n // - an instance of Error\n // - a valid ErrorEvent (one with an error property)\n // - a plain Object\n //\n // So bail out and capture it as a simple message:\n event = eventFromString(exception as string, syntheticException, options);\n addExceptionTypeValue(event, `${exception}`, undefined);\n addExceptionMechanism(event, {\n synthetic: true,\n });\n\n return event;\n}\n\n/**\n * @hidden\n */\nexport function eventFromString(\n input: string,\n syntheticException?: Error,\n options: {\n attachStacktrace?: boolean;\n } = {},\n): Event {\n const event: Event = {\n message: input,\n };\n\n if (options.attachStacktrace && syntheticException) {\n const stacktrace = computeStackTrace(syntheticException);\n const frames = prepareFramesForEvent(stacktrace.stack);\n event.stacktrace = {\n frames,\n };\n }\n\n return event;\n}\n","import { API } from '@sentry/core';\nimport {\n Event,\n Response as SentryResponse,\n SentryRequestType,\n Status,\n Transport,\n TransportOptions,\n} from '@sentry/types';\nimport { logger, parseRetryAfterHeader, PromiseBuffer, SentryError } from '@sentry/utils';\n\n/** Base Transport class implementation */\nexport abstract class BaseTransport implements Transport {\n /**\n * @deprecated\n */\n public url: string;\n\n /** Helper to get Sentry API endpoints. */\n protected readonly _api: API;\n\n /** A simple buffer holding all requests. */\n protected readonly _buffer: PromiseBuffer<SentryResponse> = new PromiseBuffer(30);\n\n /** Locks transport after receiving rate limits in a response */\n protected readonly _rateLimits: Record<string, Date> = {};\n\n public constructor(public options: TransportOptions) {\n this._api = new API(this.options.dsn);\n // eslint-disable-next-line deprecation/deprecation\n this.url = this._api.getStoreEndpointWithUrlEncodedAuth();\n }\n\n /**\n * @inheritDoc\n */\n public sendEvent(_: Event): PromiseLike<SentryResponse> {\n throw new SentryError('Transport Class has to implement `sendEvent` method');\n }\n\n /**\n * @inheritDoc\n */\n public close(timeout?: number): PromiseLike<boolean> {\n return this._buffer.drain(timeout);\n }\n\n /**\n * Handle Sentry repsonse for promise-based transports.\n */\n protected _handleResponse({\n requestType,\n response,\n headers,\n resolve,\n reject,\n }: {\n requestType: SentryRequestType;\n response: Response | XMLHttpRequest;\n headers: Record<string, string | null>;\n resolve: (value?: SentryResponse | PromiseLike<SentryResponse> | null | undefined) => void;\n reject: (reason?: unknown) => void;\n }): void {\n const status = Status.fromHttpCode(response.status);\n /**\n * \"The name is case-insensitive.\"\n * https://developer.mozilla.org/en-US/docs/Web/API/Headers/get\n */\n const limited = this._handleRateLimit(headers);\n if (limited) logger.warn(`Too many requests, backing off till: ${this._disabledUntil(requestType)}`);\n\n if (status === Status.Success) {\n resolve({ status });\n return;\n }\n\n reject(response);\n }\n\n /**\n * Gets the time that given category is disabled until for rate limiting\n */\n protected _disabledUntil(category: string): Date {\n return this._rateLimits[category] || this._rateLimits.all;\n }\n\n /**\n * Checks if a category is rate limited\n */\n protected _isRateLimited(category: string): boolean {\n return this._disabledUntil(category) > new Date(Date.now());\n }\n\n /**\n * Sets internal _rateLimits from incoming headers. Returns true if headers contains a non-empty rate limiting header.\n */\n protected _handleRateLimit(headers: Record<string, string | null>): boolean {\n const now = Date.now();\n const rlHeader = headers['x-sentry-rate-limits'];\n const raHeader = headers['retry-after'];\n\n if (rlHeader) {\n for (const limit of rlHeader.trim().split(',')) {\n const parameters = limit.split(':', 2);\n const headerDelay = parseInt(parameters[0], 10);\n const delay = (!isNaN(headerDelay) ? headerDelay : 60) * 1000; // 60sec default\n for (const category of parameters[1].split(';')) {\n this._rateLimits[category || 'all'] = new Date(now + delay);\n }\n }\n return true;\n } else if (raHeader) {\n this._rateLimits.all = new Date(now + parseRetryAfterHeader(now, raHeader));\n return true;\n }\n return false;\n }\n}\n","import { eventToSentryRequest, sessionToSentryRequest } from '@sentry/core';\nimport { Event, Response, SentryRequest, Session } from '@sentry/types';\nimport { getGlobalObject, supportsReferrerPolicy, SyncPromise } from '@sentry/utils';\n\nimport { BaseTransport } from './base';\n\nconst global = getGlobalObject<Window>();\n\n/** `fetch` based transport */\nexport class FetchTransport extends BaseTransport {\n /**\n * @inheritDoc\n */\n public sendEvent(event: Event): PromiseLike<Response> {\n return this._sendRequest(eventToSentryRequest(event, this._api), event);\n }\n\n /**\n * @inheritDoc\n */\n public sendSession(session: Session): PromiseLike<Response> {\n return this._sendRequest(sessionToSentryRequest(session, this._api), session);\n }\n\n /**\n * @param sentryRequest Prepared SentryRequest to be delivered\n * @param originalPayload Original payload used to create SentryRequest\n */\n private _sendRequest(sentryRequest: SentryRequest, originalPayload: Event | Session): PromiseLike<Response> {\n if (this._isRateLimited(sentryRequest.type)) {\n return Promise.reject({\n event: originalPayload,\n type: sentryRequest.type,\n reason: `Transport locked till ${this._disabledUntil(sentryRequest.type)} due to too many requests.`,\n status: 429,\n });\n }\n\n const options: RequestInit = {\n body: sentryRequest.body,\n method: 'POST',\n // Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default\n // https://caniuse.com/#feat=referrer-policy\n // It doesn't. And it throw exception instead of ignoring this parameter...\n // REF: https://github.com/getsentry/raven-js/issues/1233\n referrerPolicy: (supportsReferrerPolicy() ? 'origin' : '') as ReferrerPolicy,\n };\n if (this.options.fetchParameters !== undefined) {\n Object.assign(options, this.options.fetchParameters);\n }\n if (this.options.headers !== undefined) {\n options.headers = this.options.headers;\n }\n\n return this._buffer.add(\n new SyncPromise<Response>((resolve, reject) => {\n global\n .fetch(sentryRequest.url, options)\n .then(response => {\n const headers = {\n 'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),\n 'retry-after': response.headers.get('Retry-After'),\n };\n this._handleResponse({ requestType: sentryRequest.type, response, headers, resolve, reject });\n })\n .catch(reject);\n }),\n );\n }\n}\n","import { eventToSentryRequest, sessionToSentryRequest } from '@sentry/core';\nimport { Event, Response, SentryRequest, Session } from '@sentry/types';\nimport { SyncPromise } from '@sentry/utils';\n\nimport { BaseTransport } from './base';\n\n/** `XHR` based transport */\nexport class XHRTransport extends BaseTransport {\n /**\n * @inheritDoc\n */\n public sendEvent(event: Event): PromiseLike<Response> {\n return this._sendRequest(eventToSentryRequest(event, this._api), event);\n }\n\n /**\n * @inheritDoc\n */\n public sendSession(session: Session): PromiseLike<Response> {\n return this._sendRequest(sessionToSentryRequest(session, this._api), session);\n }\n\n /**\n * @param sentryRequest Prepared SentryRequest to be delivered\n * @param originalPayload Original payload used to create SentryRequest\n */\n private _sendRequest(sentryRequest: SentryRequest, originalPayload: Event | Session): PromiseLike<Response> {\n if (this._isRateLimited(sentryRequest.type)) {\n return Promise.reject({\n event: originalPayload,\n type: sentryRequest.type,\n reason: `Transport locked till ${this._disabledUntil(sentryRequest.type)} due to too many requests.`,\n status: 429,\n });\n }\n\n return this._buffer.add(\n new SyncPromise<Response>((resolve, reject) => {\n const request = new XMLHttpRequest();\n\n request.onreadystatechange = (): void => {\n if (request.readyState === 4) {\n const headers = {\n 'x-sentry-rate-limits': request.getResponseHeader('X-Sentry-Rate-Limits'),\n 'retry-after': request.getResponseHeader('Retry-After'),\n };\n this._handleResponse({ requestType: sentryRequest.type, response: request, headers, resolve, reject });\n }\n };\n\n request.open('POST', sentryRequest.url);\n for (const header in this.options.headers) {\n if (this.options.headers.hasOwnProperty(header)) {\n request.setRequestHeader(header, this.options.headers[header]);\n }\n }\n request.send(sentryRequest.body);\n }),\n );\n }\n}\n","import { BaseBackend } from '@sentry/core';\nimport { Event, EventHint, Options, Severity, Transport } from '@sentry/types';\nimport { supportsFetch } from '@sentry/utils';\n\nimport { eventFromException, eventFromMessage } from './eventbuilder';\nimport { FetchTransport, XHRTransport } from './transports';\n\n/**\n * Configuration options for the Sentry Browser SDK.\n * @see BrowserClient for more information.\n */\nexport interface BrowserOptions extends Options {\n /**\n * A pattern for error URLs which should exclusively be sent to Sentry.\n * This is the opposite of {@link Options.denyUrls}.\n * By default, all errors will be sent.\n */\n allowUrls?: Array<string | RegExp>;\n\n /**\n * A pattern for error URLs which should not be sent to Sentry.\n * To allow certain errors instead, use {@link Options.allowUrls}.\n * By default, all errors will be sent.\n */\n denyUrls?: Array<string | RegExp>;\n\n /** @deprecated use {@link Options.allowUrls} instead. */\n whitelistUrls?: Array<string | RegExp>;\n\n /** @deprecated use {@link Options.denyUrls} instead. */\n blacklistUrls?: Array<string | RegExp>;\n\n /**\n * A flag enabling Sessions Tracking feature.\n * By default Sessions Tracking is disabled.\n */\n autoSessionTracking?: boolean;\n}\n\n/**\n * The Sentry Browser SDK Backend.\n * @hidden\n */\nexport class BrowserBackend extends BaseBackend<BrowserOptions> {\n /**\n * @inheritDoc\n */\n public eventFromException(exception: unknown, hint?: EventHint): PromiseLike<Event> {\n return eventFromException(this._options, exception, hint);\n }\n /**\n * @inheritDoc\n */\n public eventFromMessage(message: string, level: Severity = Severity.Info, hint?: EventHint): PromiseLike<Event> {\n return eventFromMessage(this._options, message, level, hint);\n }\n\n /**\n * @inheritDoc\n */\n protected _setupTransport(): Transport {\n if (!this._options.dsn) {\n // We return the noop transport here in case there is no Dsn.\n return super._setupTransport();\n }\n\n const transportOptions = {\n ...this._options.transportOptions,\n dsn: this._options.dsn,\n };\n\n if (this._options.transport) {\n return new this._options.transport(transportOptions);\n }\n if (supportsFetch()) {\n return new FetchTransport(transportOptions);\n }\n return new XHRTransport(transportOptions);\n }\n}\n","import { API, captureException, withScope } from '@sentry/core';\nimport { DsnLike, Event as SentryEvent, Mechanism, Scope, WrappedFunction } from '@sentry/types';\nimport { addExceptionMechanism, addExceptionTypeValue, logger } from '@sentry/utils';\n\nlet ignoreOnError: number = 0;\n\n/**\n * @hidden\n */\nexport function shouldIgnoreOnError(): boolean {\n return ignoreOnError > 0;\n}\n\n/**\n * @hidden\n */\nexport function ignoreNextOnError(): void {\n // onerror should trigger before setTimeout\n ignoreOnError += 1;\n setTimeout(() => {\n ignoreOnError -= 1;\n });\n}\n\n/**\n * Instruments the given function and sends an event to Sentry every time the\n * function throws an exception.\n *\n * @param fn A function to wrap.\n * @returns The wrapped function.\n * @hidden\n */\nexport function wrap(\n fn: WrappedFunction,\n options: {\n mechanism?: Mechanism;\n } = {},\n before?: WrappedFunction,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): any {\n if (typeof fn !== 'function') {\n return fn;\n }\n\n try {\n // We don't wanna wrap it twice\n if (fn.__sentry__) {\n return fn;\n }\n\n // If this has already been wrapped in the past, return that wrapped function\n if (fn.__sentry_wrapped__) {\n return fn.__sentry_wrapped__;\n }\n } catch (e) {\n // Just accessing custom props in some Selenium environments\n // can cause a \"Permission denied\" exception (see raven-js#495).\n // Bail on wrapping and return the function as-is (defers to window.onerror).\n return fn;\n }\n\n /* eslint-disable prefer-rest-params */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const sentryWrapped: WrappedFunction = function(this: any): void {\n const args = Array.prototype.slice.call(arguments);\n\n try {\n if (before && typeof before === 'function') {\n before.apply(this, arguments);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n const wrappedArguments = args.map((arg: any) => wrap(arg, options));\n\n if (fn.handleEvent) {\n // Attempt to invoke user-land function\n // NOTE: If you are a Sentry user, and you are seeing this stack frame, it\n // means the sentry.javascript SDK caught an error invoking your application code. This\n // is expected behavior and NOT indicative of a bug with sentry.javascript.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return fn.handleEvent.apply(this, wrappedArguments);\n }\n // Attempt to invoke user-land function\n // NOTE: If you are a Sentry user, and you are seeing this stack frame, it\n // means the sentry.javascript SDK caught an error invoking your application code. This\n // is expected behavior and NOT indicative of a bug with sentry.javascript.\n return fn.apply(this, wrappedArguments);\n } catch (ex) {\n ignoreNextOnError();\n\n withScope((scope: Scope) => {\n scope.addEventProcessor((event: SentryEvent) => {\n const processedEvent = { ...event };\n\n if (options.mechanism) {\n addExceptionTypeValue(processedEvent, undefined, undefined);\n addExceptionMechanism(processedEvent, options.mechanism);\n }\n\n processedEvent.extra = {\n ...processedEvent.extra,\n arguments: args,\n };\n\n return processedEvent;\n });\n\n captureException(ex);\n });\n\n throw ex;\n }\n };\n /* eslint-enable prefer-rest-params */\n\n // Accessing some objects may throw\n // ref: https://github.com/getsentry/sentry-javascript/issues/1168\n try {\n for (const property in fn) {\n if (Object.prototype.hasOwnProperty.call(fn, property)) {\n sentryWrapped[property] = fn[property];\n }\n }\n } catch (_oO) {} // eslint-disable-line no-empty\n\n fn.prototype = fn.prototype || {};\n sentryWrapped.prototype = fn.prototype;\n\n Object.defineProperty(fn, '__sentry_wrapped__', {\n enumerable: false,\n value: sentryWrapped,\n });\n\n // Signal that this function has been wrapped/filled already\n // for both debugging and to prevent it to being wrapped/filled twice\n Object.defineProperties(sentryWrapped, {\n __sentry__: {\n enumerable: false,\n value: true,\n },\n __sentry_original__: {\n enumerable: false,\n value: fn,\n },\n });\n\n // Restore original function name (not all browsers allow that)\n try {\n const descriptor = Object.getOwnPropertyDescriptor(sentryWrapped, 'name') as PropertyDescriptor;\n if (descriptor.configurable) {\n Object.defineProperty(sentryWrapped, 'name', {\n get(): string {\n return fn.name;\n },\n });\n }\n // eslint-disable-next-line no-empty\n } catch (_oO) {}\n\n return sentryWrapped;\n}\n\n/**\n * All properties the report dialog supports\n */\nexport interface ReportDialogOptions {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n eventId?: string;\n dsn?: DsnLike;\n user?: {\n email?: string;\n name?: string;\n };\n lang?: string;\n title?: string;\n subtitle?: string;\n subtitle2?: string;\n labelName?: string;\n labelEmail?: string;\n labelComments?: string;\n labelClose?: string;\n labelSubmit?: string;\n errorGeneric?: string;\n errorFormEntry?: string;\n successMessage?: string;\n /** Callback after reportDialog showed up */\n onLoad?(): void;\n}\n\n/**\n * Injects the Report Dialog script\n * @hidden\n */\nexport function injectReportDialog(options: ReportDialogOptions = {}): void {\n if (!options.eventId) {\n logger.error(`Missing eventId option in showReportDialog call`);\n return;\n }\n if (!options.dsn) {\n logger.error(`Missing dsn option in showReportDialog call`);\n return;\n }\n\n const script = document.createElement('script');\n script.async = true;\n script.src = new API(options.dsn).getReportDialogEndpoint(options);\n\n if (options.onLoad) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n script.onload = options.onLoad;\n }\n\n (document.head || document.body).appendChild(script);\n}\n","/* eslint-disable @typescript-eslint/no-unsafe-member-access */\nimport { getCurrentHub } from '@sentry/core';\nimport { Event, Integration, Severity } from '@sentry/types';\nimport {\n addExceptionMechanism,\n addInstrumentationHandler,\n getLocationHref,\n isErrorEvent,\n isPrimitive,\n isString,\n logger,\n} from '@sentry/utils';\n\nimport { eventFromUnknownInput } from '../eventbuilder';\nimport { shouldIgnoreOnError } from '../helpers';\n\n/** JSDoc */\ninterface GlobalHandlersIntegrations {\n onerror: boolean;\n onunhandledrejection: boolean;\n}\n\n/** Global handlers */\nexport class GlobalHandlers implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'GlobalHandlers';\n\n /**\n * @inheritDoc\n */\n public name: string = GlobalHandlers.id;\n\n /** JSDoc */\n private readonly _options: GlobalHandlersIntegrations;\n\n /** JSDoc */\n private _onErrorHandlerInstalled: boolean = false;\n\n /** JSDoc */\n private _onUnhandledRejectionHandlerInstalled: boolean = false;\n\n /** JSDoc */\n public constructor(options?: GlobalHandlersIntegrations) {\n this._options = {\n onerror: true,\n onunhandledrejection: true,\n ...options,\n };\n }\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n Error.stackTraceLimit = 50;\n\n if (this._options.onerror) {\n logger.log('Global Handler attached: onerror');\n this._installGlobalOnErrorHandler();\n }\n\n if (this._options.onunhandledrejection) {\n logger.log('Global Handler attached: onunhandledrejection');\n this._installGlobalOnUnhandledRejectionHandler();\n }\n }\n\n /** JSDoc */\n private _installGlobalOnErrorHandler(): void {\n if (this._onErrorHandlerInstalled) {\n return;\n }\n\n addInstrumentationHandler({\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n callback: (data: { msg: any; url: any; line: any; column: any; error: any }) => {\n const error = data.error;\n const currentHub = getCurrentHub();\n const hasIntegration = currentHub.getIntegration(GlobalHandlers);\n const isFailedOwnDelivery = error && error.__sentry_own_request__ === true;\n\n if (!hasIntegration || shouldIgnoreOnError() || isFailedOwnDelivery) {\n return;\n }\n\n const client = currentHub.getClient();\n const event = isPrimitive(error)\n ? this._eventFromIncompleteOnError(data.msg, data.url, data.line, data.column)\n : this._enhanceEventWithInitialFrame(\n eventFromUnknownInput(error, undefined, {\n attachStacktrace: client && client.getOptions().attachStacktrace,\n rejection: false,\n }),\n data.url,\n data.line,\n data.column,\n );\n\n addExceptionMechanism(event, {\n handled: false,\n type: 'onerror',\n });\n\n currentHub.captureEvent(event, {\n originalException: error,\n });\n },\n type: 'error',\n });\n\n this._onErrorHandlerInstalled = true;\n }\n\n /** JSDoc */\n private _installGlobalOnUnhandledRejectionHandler(): void {\n if (this._onUnhandledRejectionHandlerInstalled) {\n return;\n }\n\n addInstrumentationHandler({\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n callback: (e: any) => {\n let error = e;\n\n // dig the object of the rejection out of known event types\n try {\n // PromiseRejectionEvents store the object of the rejection under 'reason'\n // see https://developer.mozilla.org/en-US/docs/Web/API/PromiseRejectionEvent\n if ('reason' in e) {\n error = e.reason;\n }\n // something, somewhere, (likely a browser extension) effectively casts PromiseRejectionEvents\n // to CustomEvents, moving the `promise` and `reason` attributes of the PRE into\n // the CustomEvent's `detail` attribute, since they're not part of CustomEvent's spec\n // see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent and\n // https://github.com/getsentry/sentry-javascript/issues/2380\n else if ('detail' in e && 'reason' in e.detail) {\n error = e.detail.reason;\n }\n } catch (_oO) {\n // no-empty\n }\n\n const currentHub = getCurrentHub();\n const hasIntegration = currentHub.getIntegration(GlobalHandlers);\n const isFailedOwnDelivery = error && error.__sentry_own_request__ === true;\n\n if (!hasIntegration || shouldIgnoreOnError() || isFailedOwnDelivery) {\n return true;\n }\n\n const client = currentHub.getClient();\n const event = isPrimitive(error)\n ? this._eventFromIncompleteRejection(error)\n : eventFromUnknownInput(error, undefined, {\n attachStacktrace: client && client.getOptions().attachStacktrace,\n rejection: true,\n });\n\n event.level = Severity.Error;\n\n addExceptionMechanism(event, {\n handled: false,\n type: 'onunhandledrejection',\n });\n\n currentHub.captureEvent(event, {\n originalException: error,\n });\n\n return;\n },\n type: 'unhandledrejection',\n });\n\n this._onUnhandledRejectionHandlerInstalled = true;\n }\n\n /**\n * This function creates a stack from an old, error-less onerror handler.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _eventFromIncompleteOnError(msg: any, url: any, line: any, column: any): Event {\n const ERROR_TYPES_RE = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;\n\n // If 'message' is ErrorEvent, get real message from inside\n let message = isErrorEvent(msg) ? msg.message : msg;\n let name;\n\n if (isString(message)) {\n const groups = message.match(ERROR_TYPES_RE);\n if (groups) {\n name = groups[1];\n message = groups[2];\n }\n }\n\n const event = {\n exception: {\n values: [\n {\n type: name || 'Error',\n value: message,\n },\n ],\n },\n };\n\n return this._enhanceEventWithInitialFrame(event, url, line, column);\n }\n\n /**\n * This function creates an Event from an TraceKitStackTrace that has part of it missing.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _eventFromIncompleteRejection(error: any): Event {\n return {\n exception: {\n values: [\n {\n type: 'UnhandledRejection',\n value: `Non-Error promise rejection captured with value: ${error}`,\n },\n ],\n },\n };\n }\n\n /** JSDoc */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _enhanceEventWithInitialFrame(event: Event, url: any, line: any, column: any): Event {\n event.exception = event.exception || {};\n event.exception.values = event.exception.values || [];\n event.exception.values[0] = event.exception.values[0] || {};\n event.exception.values[0].stacktrace = event.exception.values[0].stacktrace || {};\n event.exception.values[0].stacktrace.frames = event.exception.values[0].stacktrace.frames || [];\n\n const colno = isNaN(parseInt(column, 10)) ? undefined : column;\n const lineno = isNaN(parseInt(line, 10)) ? undefined : line;\n const filename = isString(url) && url.length > 0 ? url : getLocationHref();\n\n if (event.exception.values[0].stacktrace.frames.length === 0) {\n event.exception.values[0].stacktrace.frames.push({\n colno,\n filename,\n function: '?',\n in_app: true,\n lineno,\n });\n }\n\n return event;\n }\n}\n","/** The status of an Span. */\n// eslint-disable-next-line import/export\nexport enum SpanStatus {\n /** The operation completed successfully. */\n Ok = 'ok',\n /** Deadline expired before operation could complete. */\n DeadlineExceeded = 'deadline_exceeded',\n /** 401 Unauthorized (actually does mean unauthenticated according to RFC 7235) */\n Unauthenticated = 'unauthenticated',\n /** 403 Forbidden */\n PermissionDenied = 'permission_denied',\n /** 404 Not Found. Some requested entity (file or directory) was not found. */\n NotFound = 'not_found',\n /** 429 Too Many Requests */\n ResourceExhausted = 'resource_exhausted',\n /** Client specified an invalid argument. 4xx. */\n InvalidArgument = 'invalid_argument',\n /** 501 Not Implemented */\n Unimplemented = 'unimplemented',\n /** 503 Service Unavailable */\n Unavailable = 'unavailable',\n /** Other/generic 5xx. */\n InternalError = 'internal_error',\n /** Unknown. Any non-standard HTTP status code. */\n UnknownError = 'unknown_error',\n /** The operation was cancelled (typically by the user). */\n Cancelled = 'cancelled',\n /** Already exists (409) */\n AlreadyExists = 'already_exists',\n /** Operation was rejected because the system is not in a state required for the operation's */\n FailedPrecondition = 'failed_precondition',\n /** The operation was aborted, typically due to a concurrency issue. */\n Aborted = 'aborted',\n /** Operation was attempted past the valid range. */\n OutOfRange = 'out_of_range',\n /** Unrecoverable data loss or corruption */\n DataLoss = 'data_loss',\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace, import/export\nexport namespace SpanStatus {\n /**\n * Converts a HTTP status code into a {@link SpanStatus}.\n *\n * @param httpStatus The HTTP response status code.\n * @returns The span status or {@link SpanStatus.UnknownError}.\n */\n export function fromHttpCode(httpStatus: number): SpanStatus {\n if (httpStatus < 400) {\n return SpanStatus.Ok;\n }\n\n if (httpStatus >= 400 && httpStatus < 500) {\n switch (httpStatus) {\n case 401:\n return SpanStatus.Unauthenticated;\n case 403:\n return SpanStatus.PermissionDenied;\n case 404:\n return SpanStatus.NotFound;\n case 409:\n return SpanStatus.AlreadyExists;\n case 413:\n return SpanStatus.FailedPrecondition;\n case 429:\n return SpanStatus.ResourceExhausted;\n default:\n return SpanStatus.InvalidArgument;\n }\n }\n\n if (httpStatus >= 500 && httpStatus < 600) {\n switch (httpStatus) {\n case 501:\n return SpanStatus.Unimplemented;\n case 503:\n return SpanStatus.Unavailable;\n case 504:\n return SpanStatus.DeadlineExceeded;\n default:\n return SpanStatus.InternalError;\n }\n }\n\n return SpanStatus.UnknownError;\n }\n}\n","import { Integration, WrappedFunction } from '@sentry/types';\nimport { fill, getFunctionName, getGlobalObject } from '@sentry/utils';\n\nimport { wrap } from '../helpers';\n\nconst DEFAULT_EVENT_TARGET = [\n 'EventTarget',\n 'Window',\n 'Node',\n 'ApplicationCache',\n 'AudioTrackList',\n 'ChannelMergerNode',\n 'CryptoOperation',\n 'EventSource',\n 'FileReader',\n 'HTMLUnknownElement',\n 'IDBDatabase',\n 'IDBRequest',\n 'IDBTransaction',\n 'KeyOperation',\n 'MediaController',\n 'MessagePort',\n 'ModalWindow',\n 'Notification',\n 'SVGElementInstance',\n 'Screen',\n 'TextTrack',\n 'TextTrackCue',\n 'TextTrackList',\n 'WebSocket',\n 'WebSocketWorker',\n 'Worker',\n 'XMLHttpRequest',\n 'XMLHttpRequestEventTarget',\n 'XMLHttpRequestUpload',\n];\n\ntype XMLHttpRequestProp = 'onload' | 'onerror' | 'onprogress' | 'onreadystatechange';\n\n/** JSDoc */\ninterface TryCatchOptions {\n setTimeout: boolean;\n setInterval: boolean;\n requestAnimationFrame: boolean;\n XMLHttpRequest: boolean;\n eventTarget: boolean | string[];\n}\n\n/** Wrap timer functions and event targets to catch errors and provide better meta data */\nexport class TryCatch implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'TryCatch';\n\n /**\n * @inheritDoc\n */\n public name: string = TryCatch.id;\n\n /** JSDoc */\n private readonly _options: TryCatchOptions;\n\n /**\n * @inheritDoc\n */\n public constructor(options?: Partial<TryCatchOptions>) {\n this._options = {\n XMLHttpRequest: true,\n eventTarget: true,\n requestAnimationFrame: true,\n setInterval: true,\n setTimeout: true,\n ...options,\n };\n }\n\n /**\n * Wrap timer functions and event targets to catch errors\n * and provide better metadata.\n */\n public setupOnce(): void {\n const global = getGlobalObject();\n\n if (this._options.setTimeout) {\n fill(global, 'setTimeout', this._wrapTimeFunction.bind(this));\n }\n\n if (this._options.setInterval) {\n fill(global, 'setInterval', this._wrapTimeFunction.bind(this));\n }\n\n if (this._options.requestAnimationFrame) {\n fill(global, 'requestAnimationFrame', this._wrapRAF.bind(this));\n }\n\n if (this._options.XMLHttpRequest && 'XMLHttpRequest' in global) {\n fill(XMLHttpRequest.prototype, 'send', this._wrapXHR.bind(this));\n }\n\n if (this._options.eventTarget) {\n const eventTarget = Array.isArray(this._options.eventTarget) ? this._options.eventTarget : DEFAULT_EVENT_TARGET;\n eventTarget.forEach(this._wrapEventTarget.bind(this));\n }\n }\n\n /** JSDoc */\n private _wrapTimeFunction(original: () => void): () => number {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return function(this: any, ...args: any[]): number {\n const originalCallback = args[0];\n args[0] = wrap(originalCallback, {\n mechanism: {\n data: { function: getFunctionName(original) },\n handled: true,\n type: 'instrument',\n },\n });\n return original.apply(this, args);\n };\n }\n\n /** JSDoc */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _wrapRAF(original: any): (callback: () => void) => any {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return function(this: any, callback: () => void): () => void {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return original.call(\n this,\n wrap(callback, {\n mechanism: {\n data: {\n function: 'requestAnimationFrame',\n handler: getFunctionName(original),\n },\n handled: true,\n type: 'instrument',\n },\n }),\n );\n };\n }\n\n /** JSDoc */\n private _wrapEventTarget(target: string): void {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const global = getGlobalObject() as { [key: string]: any };\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const proto = global[target] && global[target].prototype;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (!proto || !proto.hasOwnProperty || !proto.hasOwnProperty('addEventListener')) {\n return;\n }\n\n fill(proto, 'addEventListener', function(\n original: () => void,\n ): (eventName: string, fn: EventListenerObject, options?: boolean | AddEventListenerOptions) => void {\n return function(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this: any,\n eventName: string,\n fn: EventListenerObject,\n options?: boolean | AddEventListenerOptions,\n ): (eventName: string, fn: EventListenerObject, capture?: boolean, secure?: boolean) => void {\n try {\n if (typeof fn.handleEvent === 'function') {\n fn.handleEvent = wrap(fn.handleEvent.bind(fn), {\n mechanism: {\n data: {\n function: 'handleEvent',\n handler: getFunctionName(fn),\n target,\n },\n handled: true,\n type: 'instrument',\n },\n });\n }\n } catch (err) {\n // can sometimes get 'Permission denied to access property \"handle Event'\n }\n\n return original.call(\n this,\n eventName,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n wrap((fn as any) as WrappedFunction, {\n mechanism: {\n data: {\n function: 'addEventListener',\n handler: getFunctionName(fn),\n target,\n },\n handled: true,\n type: 'instrument',\n },\n }),\n options,\n );\n };\n });\n\n fill(proto, 'removeEventListener', function(\n originalRemoveEventListener: () => void,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): (this: any, eventName: string, fn: EventListenerObject, options?: boolean | EventListenerOptions) => () => void {\n return function(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this: any,\n eventName: string,\n fn: EventListenerObject,\n options?: boolean | EventListenerOptions,\n ): () => void {\n /**\n * There are 2 possible scenarios here:\n *\n * 1. Someone passes a callback, which was attached prior to Sentry initialization, or by using unmodified\n * method, eg. `document.addEventListener.call(el, name, handler). In this case, we treat this function\n * as a pass-through, and call original `removeEventListener` with it.\n *\n * 2. Someone passes a callback, which was attached after Sentry was initialized, which means that it was using\n * our wrapped version of `addEventListener`, which internally calls `wrap` helper.\n * This helper \"wraps\" whole callback inside a try/catch statement, and attached appropriate metadata to it,\n * in order for us to make a distinction between wrapped/non-wrapped functions possible.\n * If a function was wrapped, it has additional property of `__sentry_wrapped__`, holding the handler.\n *\n * When someone adds a handler prior to initialization, and then do it again, but after,\n * then we have to detach both of them. Otherwise, if we'd detach only wrapped one, it'd be impossible\n * to get rid of the initial handler and it'd stick there forever.\n */\n const wrappedEventHandler = (fn as unknown) as WrappedFunction;\n try {\n const originalEventHandler = wrappedEventHandler?.__sentry_wrapped__;\n if (originalEventHandler) {\n originalRemoveEventListener.call(this, eventName, originalEventHandler, options);\n }\n } catch (e) {\n // ignore, accessing __sentry_wrapped__ will throw in some Selenium environments\n }\n return originalRemoveEventListener.call(this, eventName, wrappedEventHandler, options);\n };\n });\n }\n\n /** JSDoc */\n private _wrapXHR(originalSend: () => void): () => void {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return function(this: XMLHttpRequest, ...args: any[]): void {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const xhr = this;\n const xmlHttpRequestProps: XMLHttpRequestProp[] = ['onload', 'onerror', 'onprogress', 'onreadystatechange'];\n\n xmlHttpRequestProps.forEach(prop => {\n if (prop in xhr && typeof xhr[prop] === 'function') {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n fill(xhr, prop, function(original: WrappedFunction): () => any {\n const wrapOptions = {\n mechanism: {\n data: {\n function: prop,\n handler: getFunctionName(original),\n },\n handled: true,\n type: 'instrument',\n },\n };\n\n // If Instrument integration has been called before TryCatch, get the name of original function\n if (original.__sentry_original__) {\n wrapOptions.mechanism.data.handler = getFunctionName(original.__sentry_original__);\n }\n\n // Otherwise wrap directly\n return wrap(original, wrapOptions);\n });\n }\n });\n\n return originalSend.apply(this, args);\n };\n }\n}\n","/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable max-lines */\nimport { getCurrentHub } from '@sentry/core';\nimport { Event, Integration, Severity } from '@sentry/types';\nimport {\n addInstrumentationHandler,\n getEventDescription,\n getGlobalObject,\n htmlTreeAsString,\n parseUrl,\n safeJoin,\n} from '@sentry/utils';\n\n/** JSDoc */\ninterface BreadcrumbsOptions {\n console: boolean;\n dom: boolean;\n fetch: boolean;\n history: boolean;\n sentry: boolean;\n xhr: boolean;\n}\n\n/**\n * Default Breadcrumbs instrumentations\n * TODO: Deprecated - with v6, this will be renamed to `Instrument`\n */\nexport class Breadcrumbs implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'Breadcrumbs';\n\n /**\n * @inheritDoc\n */\n public name: string = Breadcrumbs.id;\n\n /** JSDoc */\n private readonly _options: BreadcrumbsOptions;\n\n /**\n * @inheritDoc\n */\n public constructor(options?: Partial<BreadcrumbsOptions>) {\n this._options = {\n console: true,\n dom: true,\n fetch: true,\n history: true,\n sentry: true,\n xhr: true,\n ...options,\n };\n }\n\n /**\n * Create a breadcrumb of `sentry` from the events themselves\n */\n public addSentryBreadcrumb(event: Event): void {\n if (!this._options.sentry) {\n return;\n }\n getCurrentHub().addBreadcrumb(\n {\n category: `sentry.${event.type === 'transaction' ? 'transaction' : 'event'}`,\n event_id: event.event_id,\n level: event.level,\n message: getEventDescription(event),\n },\n {\n event,\n },\n );\n }\n\n /**\n * Instrument browser built-ins w/ breadcrumb capturing\n * - Console API\n * - DOM API (click/typing)\n * - XMLHttpRequest API\n * - Fetch API\n * - History API\n */\n public setupOnce(): void {\n if (this._options.console) {\n addInstrumentationHandler({\n callback: (...args) => {\n this._consoleBreadcrumb(...args);\n },\n type: 'console',\n });\n }\n if (this._options.dom) {\n addInstrumentationHandler({\n callback: (...args) => {\n this._domBreadcrumb(...args);\n },\n type: 'dom',\n });\n }\n if (this._options.xhr) {\n addInstrumentationHandler({\n callback: (...args) => {\n this._xhrBreadcrumb(...args);\n },\n type: 'xhr',\n });\n }\n if (this._options.fetch) {\n addInstrumentationHandler({\n callback: (...args) => {\n this._fetchBreadcrumb(...args);\n },\n type: 'fetch',\n });\n }\n if (this._options.history) {\n addInstrumentationHandler({\n callback: (...args) => {\n this._historyBreadcrumb(...args);\n },\n type: 'history',\n });\n }\n }\n\n /**\n * Creates breadcrumbs from console API calls\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _consoleBreadcrumb(handlerData: { [key: string]: any }): void {\n const breadcrumb = {\n category: 'console',\n data: {\n arguments: handlerData.args,\n logger: 'console',\n },\n level: Severity.fromString(handlerData.level),\n message: safeJoin(handlerData.args, ' '),\n };\n\n if (handlerData.level === 'assert') {\n if (handlerData.args[0] === false) {\n breadcrumb.message = `Assertion failed: ${safeJoin(handlerData.args.slice(1), ' ') || 'console.assert'}`;\n breadcrumb.data.arguments = handlerData.args.slice(1);\n } else {\n // Don't capture a breadcrumb for passed assertions\n return;\n }\n }\n\n getCurrentHub().addBreadcrumb(breadcrumb, {\n input: handlerData.args,\n level: handlerData.level,\n });\n }\n\n /**\n * Creates breadcrumbs from DOM API calls\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _domBreadcrumb(handlerData: { [key: string]: any }): void {\n let target;\n\n // Accessing event.target can throw (see getsentry/raven-js#838, #768)\n try {\n target = handlerData.event.target\n ? htmlTreeAsString(handlerData.event.target as Node)\n : htmlTreeAsString((handlerData.event as unknown) as Node);\n } catch (e) {\n target = '<unknown>';\n }\n\n if (target.length === 0) {\n return;\n }\n\n getCurrentHub().addBreadcrumb(\n {\n category: `ui.${handlerData.name}`,\n message: target,\n },\n {\n event: handlerData.event,\n name: handlerData.name,\n },\n );\n }\n\n /**\n * Creates breadcrumbs from XHR API calls\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _xhrBreadcrumb(handlerData: { [key: string]: any }): void {\n if (handlerData.endTimestamp) {\n // We only capture complete, non-sentry requests\n if (handlerData.xhr.__sentry_own_request__) {\n return;\n }\n\n const { method, url, status_code, body } = handlerData.xhr.__sentry_xhr__ || {};\n\n getCurrentHub().addBreadcrumb(\n {\n category: 'xhr',\n data: {\n method,\n url,\n status_code,\n },\n type: 'http',\n },\n {\n xhr: handlerData.xhr,\n input: body,\n },\n );\n\n return;\n }\n }\n\n /**\n * Creates breadcrumbs from fetch API calls\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _fetchBreadcrumb(handlerData: { [key: string]: any }): void {\n // We only capture complete fetch requests\n if (!handlerData.endTimestamp) {\n return;\n }\n\n if (handlerData.fetchData.url.match(/sentry_key/) && handlerData.fetchData.method === 'POST') {\n // We will not create breadcrumbs for fetch requests that contain `sentry_key` (internal sentry requests)\n return;\n }\n\n if (handlerData.error) {\n getCurrentHub().addBreadcrumb(\n {\n category: 'fetch',\n data: handlerData.fetchData,\n level: Severity.Error,\n type: 'http',\n },\n {\n data: handlerData.error,\n input: handlerData.args,\n },\n );\n } else {\n getCurrentHub().addBreadcrumb(\n {\n category: 'fetch',\n data: {\n ...handlerData.fetchData,\n status_code: handlerData.response.status,\n },\n type: 'http',\n },\n {\n input: handlerData.args,\n response: handlerData.response,\n },\n );\n }\n }\n\n /**\n * Creates breadcrumbs from history API calls\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _historyBreadcrumb(handlerData: { [key: string]: any }): void {\n const global = getGlobalObject<Window>();\n let from = handlerData.from;\n let to = handlerData.to;\n const parsedLoc = parseUrl(global.location.href);\n let parsedFrom = parseUrl(from);\n const parsedTo = parseUrl(to);\n\n // Initial pushState doesn't provide `from` information\n if (!parsedFrom.path) {\n parsedFrom = parsedLoc;\n }\n\n // Use only the path component of the URL if the URL matches the current\n // document (almost all the time when using pushState)\n if (parsedLoc.protocol === parsedTo.protocol && parsedLoc.host === parsedTo.host) {\n to = parsedTo.relative;\n }\n if (parsedLoc.protocol === parsedFrom.protocol && parsedLoc.host === parsedFrom.host) {\n from = parsedFrom.relative;\n }\n\n getCurrentHub().addBreadcrumb({\n category: 'navigation',\n data: {\n from,\n to,\n },\n });\n }\n}\n","import { addGlobalEventProcessor, getCurrentHub } from '@sentry/core';\nimport { Event, EventHint, Exception, ExtendedError, Integration } from '@sentry/types';\nimport { isInstanceOf } from '@sentry/utils';\n\nimport { exceptionFromStacktrace } from '../parsers';\nimport { computeStackTrace } from '../tracekit';\n\nconst DEFAULT_KEY = 'cause';\nconst DEFAULT_LIMIT = 5;\n\n/** Adds SDK info to an event. */\nexport class LinkedErrors implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'LinkedErrors';\n\n /**\n * @inheritDoc\n */\n public readonly name: string = LinkedErrors.id;\n\n /**\n * @inheritDoc\n */\n private readonly _key: string;\n\n /**\n * @inheritDoc\n */\n private readonly _limit: number;\n\n /**\n * @inheritDoc\n */\n public constructor(options: { key?: string; limit?: number } = {}) {\n this._key = options.key || DEFAULT_KEY;\n this._limit = options.limit || DEFAULT_LIMIT;\n }\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n addGlobalEventProcessor((event: Event, hint?: EventHint) => {\n const self = getCurrentHub().getIntegration(LinkedErrors);\n if (self) {\n return self._handler(event, hint);\n }\n return event;\n });\n }\n\n /**\n * @inheritDoc\n */\n private _handler(event: Event, hint?: EventHint): Event | null {\n if (!event.exception || !event.exception.values || !hint || !isInstanceOf(hint.originalException, Error)) {\n return event;\n }\n const linkedErrors = this._walkErrorTree(hint.originalException as ExtendedError, this._key);\n event.exception.values = [...linkedErrors, ...event.exception.values];\n return event;\n }\n\n /**\n * @inheritDoc\n */\n private _walkErrorTree(error: ExtendedError, key: string, stack: Exception[] = []): Exception[] {\n if (!isInstanceOf(error[key], Error) || stack.length + 1 >= this._limit) {\n return stack;\n }\n const stacktrace = computeStackTrace(error[key]);\n const exception = exceptionFromStacktrace(stacktrace);\n return this._walkErrorTree(error[key], key, [exception, ...stack]);\n }\n}\n","import { addGlobalEventProcessor, getCurrentHub } from '@sentry/core';\nimport { Event, Integration } from '@sentry/types';\nimport { getGlobalObject } from '@sentry/utils';\n\nconst global = getGlobalObject<Window>();\n\n/** UserAgent */\nexport class UserAgent implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'UserAgent';\n\n /**\n * @inheritDoc\n */\n public name: string = UserAgent.id;\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n addGlobalEventProcessor((event: Event) => {\n if (getCurrentHub().getIntegration(UserAgent)) {\n // if none of the information we want exists, don't bother\n if (!global.navigator && !global.location && !global.document) {\n return event;\n }\n\n // grab as much info as exists and add it to the event\n const url = event.request?.url || global.location?.href;\n const { referrer } = global.document || {};\n const { userAgent } = global.navigator || {};\n\n const headers = {\n ...event.request?.headers,\n ...(referrer && { Referer: referrer }),\n ...(userAgent && { 'User-Agent': userAgent }),\n };\n const request = { ...(url && { url }), headers };\n\n return { ...event, request };\n }\n return event;\n });\n }\n}\n","import { BaseClient, Scope } from '@sentry/core';\nimport { Event, EventHint } from '@sentry/types';\nimport { getGlobalObject, logger } from '@sentry/utils';\n\nimport { BrowserBackend, BrowserOptions } from './backend';\nimport { injectReportDialog, ReportDialogOptions } from './helpers';\nimport { Breadcrumbs } from './integrations';\nimport { SDK_NAME, SDK_VERSION } from './version';\n\n/**\n * The Sentry Browser SDK Client.\n *\n * @see BrowserOptions for documentation on configuration options.\n * @see SentryClient for usage documentation.\n */\nexport class BrowserClient extends BaseClient<BrowserBackend, BrowserOptions> {\n /**\n * Creates a new Browser SDK instance.\n *\n * @param options Configuration options for this SDK.\n */\n public constructor(options: BrowserOptions = {}) {\n super(BrowserBackend, options);\n }\n\n /**\n * Show a report dialog to the user to send feedback to a specific event.\n *\n * @param options Set individual options for the dialog\n */\n public showReportDialog(options: ReportDialogOptions = {}): void {\n // doesn't work without a document (React Native)\n const document = getGlobalObject<Window>().document;\n if (!document) {\n return;\n }\n\n if (!this._isEnabled()) {\n logger.error('Trying to call showReportDialog with Sentry Client disabled');\n return;\n }\n\n injectReportDialog({\n ...options,\n dsn: options.dsn || this.getDsn(),\n });\n }\n\n /**\n * @inheritDoc\n */\n protected _prepareEvent(event: Event, scope?: Scope, hint?: EventHint): PromiseLike<Event | null> {\n event.platform = event.platform || 'javascript';\n event.sdk = {\n ...event.sdk,\n name: SDK_NAME,\n packages: [\n ...((event.sdk && event.sdk.packages) || []),\n {\n name: 'npm:@sentry/browser',\n version: SDK_VERSION,\n },\n ],\n version: SDK_VERSION,\n };\n\n return super._prepareEvent(event, scope, hint);\n }\n\n /**\n * @inheritDoc\n */\n protected _sendEvent(event: Event): void {\n const integration = this.getIntegration(Breadcrumbs);\n if (integration) {\n integration.addSentryBreadcrumb(event);\n }\n super._sendEvent(event);\n }\n}\n","export const SDK_NAME = 'sentry.javascript.browser';\nexport const SDK_VERSION = '5.27.6';\n","import { getCurrentHub, initAndBind, Integrations as CoreIntegrations } from '@sentry/core';\nimport { getGlobalObject, SyncPromise } from '@sentry/utils';\n\nimport { BrowserOptions } from './backend';\nimport { BrowserClient } from './client';\nimport { ReportDialogOptions, wrap as internalWrap } from './helpers';\nimport { Breadcrumbs, GlobalHandlers, LinkedErrors, TryCatch, UserAgent } from './integrations';\n\nexport const defaultIntegrations = [\n new CoreIntegrations.InboundFilters(),\n new CoreIntegrations.FunctionToString(),\n new TryCatch(),\n new Breadcrumbs(),\n new GlobalHandlers(),\n new LinkedErrors(),\n new UserAgent(),\n];\n\n/**\n * The Sentry Browser SDK Client.\n *\n * To use this SDK, call the {@link init} function as early as possible when\n * loading the web page. To set context information or send manual events, use\n * the provided methods.\n *\n * @example\n *\n * ```\n *\n * import { init } from '@sentry/browser';\n *\n * init({\n * dsn: '__DSN__',\n * // ...\n * });\n * ```\n *\n * @example\n * ```\n *\n * import { configureScope } from '@sentry/browser';\n * configureScope((scope: Scope) => {\n * scope.setExtra({ battery: 0.7 });\n * scope.setTag({ user_mode: 'admin' });\n * scope.setUser({ id: '4711' });\n * });\n * ```\n *\n * @example\n * ```\n *\n * import { addBreadcrumb } from '@sentry/browser';\n * addBreadcrumb({\n * message: 'My Breadcrumb',\n * // ...\n * });\n * ```\n *\n * @example\n *\n * ```\n *\n * import * as Sentry from '@sentry/browser';\n * Sentry.captureMessage('Hello, world!');\n * Sentry.captureException(new Error('Good bye'));\n * Sentry.captureEvent({\n * message: 'Manual',\n * stacktrace: [\n * // ...\n * ],\n * });\n * ```\n *\n * @see {@link BrowserOptions} for documentation on configuration options.\n */\nexport function init(options: BrowserOptions = {}): void {\n if (options.defaultIntegrations === undefined) {\n options.defaultIntegrations = defaultIntegrations;\n }\n if (options.release === undefined) {\n const window = getGlobalObject<Window>();\n // This supports the variable that sentry-webpack-plugin injects\n if (window.SENTRY_RELEASE && window.SENTRY_RELEASE.id) {\n options.release = window.SENTRY_RELEASE.id;\n }\n }\n if (options.autoSessionTracking === undefined) {\n options.autoSessionTracking = false;\n }\n\n initAndBind(BrowserClient, options);\n\n if (options.autoSessionTracking) {\n startSessionTracking();\n }\n}\n\n/**\n * Present the user with a report dialog.\n *\n * @param options Everything is optional, we try to fetch all info need from the global scope.\n */\nexport function showReportDialog(options: ReportDialogOptions = {}): void {\n if (!options.eventId) {\n options.eventId = getCurrentHub().lastEventId();\n }\n const client = getCurrentHub().getClient<BrowserClient>();\n if (client) {\n client.showReportDialog(options);\n }\n}\n\n/**\n * This is the getter for lastEventId.\n *\n * @returns The last event id of a captured event.\n */\nexport function lastEventId(): string | undefined {\n return getCurrentHub().lastEventId();\n}\n\n/**\n * This function is here to be API compatible with the loader.\n * @hidden\n */\nexport function forceLoad(): void {\n // Noop\n}\n\n/**\n * This function is here to be API compatible with the loader.\n * @hidden\n */\nexport function onLoad(callback: () => void): void {\n callback();\n}\n\n/**\n * A promise that resolves when all current events have been sent.\n * If you provide a timeout and the queue takes longer to drain the promise returns false.\n *\n * @param timeout Maximum time in ms the client should wait.\n */\nexport function flush(timeout?: number): PromiseLike<boolean> {\n const client = getCurrentHub().getClient<BrowserClient>();\n if (client) {\n return client.flush(timeout);\n }\n return SyncPromise.reject(false);\n}\n\n/**\n * A promise that resolves when all current events have been sent.\n * If you provide a timeout and the queue takes longer to drain the promise returns false.\n *\n * @param timeout Maximum time in ms the client should wait.\n */\nexport function close(timeout?: number): PromiseLike<boolean> {\n const client = getCurrentHub().getClient<BrowserClient>();\n if (client) {\n return client.close(timeout);\n }\n return SyncPromise.reject(false);\n}\n\n/**\n * Wrap code within a try/catch block so the SDK is able to capture errors.\n *\n * @param fn A function to wrap.\n *\n * @returns The result of wrapped function call.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function wrap(fn: (...args: any) => any): any {\n return internalWrap(fn)();\n}\n\n/**\n * Enable automatic Session Tracking for the initial page load.\n */\nfunction startSessionTracking(): void {\n const window = getGlobalObject<Window>();\n const hub = getCurrentHub();\n\n /**\n * We should be using `Promise.all([windowLoaded, firstContentfulPaint])` here,\n * but, as always, it's not available in the IE10-11. Thanks IE.\n */\n let loadResolved = document.readyState === 'complete';\n let fcpResolved = false;\n const possiblyEndSession = (): void => {\n if (fcpResolved && loadResolved) {\n hub.endSession();\n }\n };\n const resolveWindowLoaded = (): void => {\n loadResolved = true;\n possiblyEndSession();\n window.removeEventListener('load', resolveWindowLoaded);\n };\n\n hub.startSession();\n\n if (!loadResolved) {\n // IE doesn't support `{ once: true }` for event listeners, so we have to manually\n // attach and then detach it once completed.\n window.addEventListener('load', resolveWindowLoaded);\n }\n\n try {\n const po = new PerformanceObserver((entryList, po) => {\n entryList.getEntries().forEach(entry => {\n if (entry.name === 'first-contentful-paint' && entry.startTime < firstHiddenTime) {\n po.disconnect();\n fcpResolved = true;\n possiblyEndSession();\n }\n });\n });\n\n // There's no need to even attach this listener if `PerformanceObserver` constructor will fail,\n // so we do it below here.\n let firstHiddenTime = document.visibilityState === 'hidden' ? 0 : Infinity;\n document.addEventListener(\n 'visibilitychange',\n event => {\n firstHiddenTime = Math.min(firstHiddenTime, event.timeStamp);\n },\n { once: true },\n );\n\n po.observe({\n type: 'paint',\n buffered: true,\n });\n } catch (e) {\n fcpResolved = true;\n possiblyEndSession();\n }\n}\n","import { getCurrentHub } from '@sentry/hub';\nimport { Client, Options } from '@sentry/types';\nimport { logger } from '@sentry/utils';\n\n/** A class object that can instantiate Client objects. */\nexport type ClientClass<F extends Client, O extends Options> = new (options: O) => F;\n\n/**\n * Internal function to create a new SDK client instance. The client is\n * installed and then bound to the current scope.\n *\n * @param clientClass The client class to instantiate.\n * @param options Options to pass to the client.\n */\nexport function initAndBind<F extends Client, O extends Options>(clientClass: ClientClass<F, O>, options: O): void {\n if (options.debug === true) {\n logger.enable();\n }\n const hub = getCurrentHub();\n const client = new clientClass(options);\n hub.bindClient(client);\n}\n","import { getCurrentHub, Hub } from '@sentry/hub';\nimport { Options, TraceparentData, Transaction } from '@sentry/types';\n\nexport const TRACEPARENT_REGEXP = new RegExp(\n '^[ \\\\t]*' + // whitespace\n '([0-9a-f]{32})?' + // trace_id\n '-?([0-9a-f]{16})?' + // span_id\n '-?([01])?' + // sampled\n '[ \\\\t]*$', // whitespace\n);\n\n/**\n * Determines if tracing is currently enabled.\n *\n * Tracing is enabled when at least one of `tracesSampleRate` and `tracesSampler` is defined in the SDK config.\n */\nexport function hasTracingEnabled(options: Options): boolean {\n return 'tracesSampleRate' in options || 'tracesSampler' in options;\n}\n\n/**\n * Extract transaction context data from a `sentry-trace` header.\n *\n * @param traceparent Traceparent string\n *\n * @returns Object containing data from the header, or undefined if traceparent string is malformed\n */\nexport function extractTraceparentData(traceparent: string): TraceparentData | undefined {\n const matches = traceparent.match(TRACEPARENT_REGEXP);\n if (matches) {\n let parentSampled: boolean | undefined;\n if (matches[3] === '1') {\n parentSampled = true;\n } else if (matches[3] === '0') {\n parentSampled = false;\n }\n return {\n traceId: matches[1],\n parentSampled,\n parentSpanId: matches[2],\n };\n }\n return undefined;\n}\n\n/** Grabs active transaction off scope, if any */\nexport function getActiveTransaction<T extends Transaction>(hub: Hub = getCurrentHub()): T | undefined {\n return hub?.getScope()?.getTransaction() as T | undefined;\n}\n\n/**\n * Converts from milliseconds to seconds\n * @param time time in ms\n */\nexport function msToSec(time: number): number {\n return time / 1000;\n}\n\n/**\n * Converts from seconds to milliseconds\n * @param time time in seconds\n */\nexport function secToMs(time: number): number {\n return time * 1000;\n}\n\n// so it can be used in manual instrumentation without necessitating a hard dependency on @sentry/utils\nexport { stripUrlQueryAndFragment } from '@sentry/utils';\n","import { addInstrumentationHandler, logger } from '@sentry/utils';\n\nimport { SpanStatus } from './spanstatus';\nimport { getActiveTransaction } from './utils';\n\n/**\n * Configures global error listeners\n */\nexport function registerErrorInstrumentation(): void {\n addInstrumentationHandler({\n callback: errorCallback,\n type: 'error',\n });\n addInstrumentationHandler({\n callback: errorCallback,\n type: 'unhandledrejection',\n });\n}\n\n/**\n * If an error or unhandled promise occurs, we mark the active transaction as failed\n */\nfunction errorCallback(): void {\n const activeTransaction = getActiveTransaction();\n if (activeTransaction) {\n logger.log(`[Tracing] Transaction: ${SpanStatus.InternalError} -> Global error occured`);\n activeTransaction.setStatus(SpanStatus.InternalError);\n }\n}\n","/* eslint-disable max-lines */\nimport { Span as SpanInterface, SpanContext, Transaction } from '@sentry/types';\nimport { dropUndefinedKeys, timestampWithMs, uuid4 } from '@sentry/utils';\n\nimport { SpanStatus } from './spanstatus';\n\n/**\n * Keeps track of finished spans for a given transaction\n * @internal\n * @hideconstructor\n * @hidden\n */\nexport class SpanRecorder {\n public spans: Span[] = [];\n\n private readonly _maxlen: number;\n\n public constructor(maxlen: number = 1000) {\n this._maxlen = maxlen;\n }\n\n /**\n * This is just so that we don't run out of memory while recording a lot\n * of spans. At some point we just stop and flush out the start of the\n * trace tree (i.e.the first n spans with the smallest\n * start_timestamp).\n */\n public add(span: Span): void {\n if (this.spans.length > this._maxlen) {\n span.spanRecorder = undefined;\n } else {\n this.spans.push(span);\n }\n }\n}\n\n/**\n * Span contains all data about a span\n */\nexport class Span implements SpanInterface {\n /**\n * @inheritDoc\n */\n public traceId: string = uuid4();\n\n /**\n * @inheritDoc\n */\n public spanId: string = uuid4().substring(16);\n\n /**\n * @inheritDoc\n */\n public parentSpanId?: string;\n\n /**\n * Internal keeper of the status\n */\n public status?: SpanStatus | string;\n\n /**\n * @inheritDoc\n */\n public sampled?: boolean;\n\n /**\n * Timestamp in seconds when the span was created.\n */\n public startTimestamp: number = timestampWithMs();\n\n /**\n * Timestamp in seconds when the span ended.\n */\n public endTimestamp?: number;\n\n /**\n * @inheritDoc\n */\n public op?: string;\n\n /**\n * @inheritDoc\n */\n public description?: string;\n\n /**\n * @inheritDoc\n */\n public tags: { [key: string]: string } = {};\n\n /**\n * @inheritDoc\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public data: { [key: string]: any } = {};\n\n /**\n * List of spans that were finalized\n */\n public spanRecorder?: SpanRecorder;\n\n /**\n * @inheritDoc\n */\n public transaction?: Transaction;\n\n /**\n * You should never call the constructor manually, always use `Sentry.startTransaction()`\n * or call `startChild()` on an existing span.\n * @internal\n * @hideconstructor\n * @hidden\n */\n public constructor(spanContext?: SpanContext) {\n if (!spanContext) {\n return this;\n }\n if (spanContext.traceId) {\n this.traceId = spanContext.traceId;\n }\n if (spanContext.spanId) {\n this.spanId = spanContext.spanId;\n }\n if (spanContext.parentSpanId) {\n this.parentSpanId = spanContext.parentSpanId;\n }\n // We want to include booleans as well here\n if ('sampled' in spanContext) {\n this.sampled = spanContext.sampled;\n }\n if (spanContext.op) {\n this.op = spanContext.op;\n }\n if (spanContext.description) {\n this.description = spanContext.description;\n }\n if (spanContext.data) {\n this.data = spanContext.data;\n }\n if (spanContext.tags) {\n this.tags = spanContext.tags;\n }\n if (spanContext.status) {\n this.status = spanContext.status;\n }\n if (spanContext.startTimestamp) {\n this.startTimestamp = spanContext.startTimestamp;\n }\n if (spanContext.endTimestamp) {\n this.endTimestamp = spanContext.endTimestamp;\n }\n }\n\n /**\n * @inheritDoc\n * @deprecated\n */\n public child(\n spanContext?: Pick<SpanContext, Exclude<keyof SpanContext, 'spanId' | 'sampled' | 'traceId' | 'parentSpanId'>>,\n ): Span {\n return this.startChild(spanContext);\n }\n\n /**\n * @inheritDoc\n */\n public startChild(\n spanContext?: Pick<SpanContext, Exclude<keyof SpanContext, 'spanId' | 'sampled' | 'traceId' | 'parentSpanId'>>,\n ): Span {\n const childSpan = new Span({\n ...spanContext,\n parentSpanId: this.spanId,\n sampled: this.sampled,\n traceId: this.traceId,\n });\n\n childSpan.spanRecorder = this.spanRecorder;\n if (childSpan.spanRecorder) {\n childSpan.spanRecorder.add(childSpan);\n }\n\n childSpan.transaction = this.transaction;\n\n return childSpan;\n }\n\n /**\n * @inheritDoc\n */\n public setTag(key: string, value: string): this {\n this.tags = { ...this.tags, [key]: value };\n return this;\n }\n\n /**\n * @inheritDoc\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n public setData(key: string, value: any): this {\n this.data = { ...this.data, [key]: value };\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public setStatus(value: SpanStatus): this {\n this.status = value;\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public setHttpStatus(httpStatus: number): this {\n this.setTag('http.status_code', String(httpStatus));\n const spanStatus = SpanStatus.fromHttpCode(httpStatus);\n if (spanStatus !== SpanStatus.UnknownError) {\n this.setStatus(spanStatus);\n }\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public isSuccess(): boolean {\n return this.status === SpanStatus.Ok;\n }\n\n /**\n * @inheritDoc\n */\n public finish(endTimestamp?: number): void {\n this.endTimestamp = typeof endTimestamp === 'number' ? endTimestamp : timestampWithMs();\n }\n\n /**\n * @inheritDoc\n */\n public toTraceparent(): string {\n let sampledString = '';\n if (this.sampled !== undefined) {\n sampledString = this.sampled ? '-1' : '-0';\n }\n return `${this.traceId}-${this.spanId}${sampledString}`;\n }\n\n /**\n * @inheritDoc\n */\n public getTraceContext(): {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: { [key: string]: any };\n description?: string;\n op?: string;\n parent_span_id?: string;\n span_id: string;\n status?: string;\n tags?: { [key: string]: string };\n trace_id: string;\n } {\n return dropUndefinedKeys({\n data: Object.keys(this.data).length > 0 ? this.data : undefined,\n description: this.description,\n op: this.op,\n parent_span_id: this.parentSpanId,\n span_id: this.spanId,\n status: this.status,\n tags: Object.keys(this.tags).length > 0 ? this.tags : undefined,\n trace_id: this.traceId,\n });\n }\n\n /**\n * @inheritDoc\n */\n public toJSON(): {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: { [key: string]: any };\n description?: string;\n op?: string;\n parent_span_id?: string;\n span_id: string;\n start_timestamp: number;\n status?: string;\n tags?: { [key: string]: string };\n timestamp?: number;\n trace_id: string;\n } {\n return dropUndefinedKeys({\n data: Object.keys(this.data).length > 0 ? this.data : undefined,\n description: this.description,\n op: this.op,\n parent_span_id: this.parentSpanId,\n span_id: this.spanId,\n start_timestamp: this.startTimestamp,\n status: this.status,\n tags: Object.keys(this.tags).length > 0 ? this.tags : undefined,\n timestamp: this.endTimestamp,\n trace_id: this.traceId,\n });\n }\n}\n","import { getCurrentHub, Hub } from '@sentry/hub';\nimport { Event, Measurements, Transaction as TransactionInterface, TransactionContext } from '@sentry/types';\nimport { isInstanceOf, logger } from '@sentry/utils';\n\nimport { Span as SpanClass, SpanRecorder } from './span';\n\n/** JSDoc */\nexport class Transaction extends SpanClass implements TransactionInterface {\n public name: string;\n private _measurements: Measurements = {};\n\n /**\n * The reference to the current hub.\n */\n private readonly _hub: Hub = (getCurrentHub() as unknown) as Hub;\n\n private readonly _trimEnd?: boolean;\n\n /**\n * This constructor should never be called manually. Those instrumenting tracing should use\n * `Sentry.startTransaction()`, and internal methods should use `hub.startTransaction()`.\n * @internal\n * @hideconstructor\n * @hidden\n */\n public constructor(transactionContext: TransactionContext, hub?: Hub) {\n super(transactionContext);\n\n if (isInstanceOf(hub, Hub)) {\n this._hub = hub as Hub;\n }\n\n this.name = transactionContext.name ? transactionContext.name : '';\n\n this._trimEnd = transactionContext.trimEnd;\n\n // this is because transactions are also spans, and spans have a transaction pointer\n this.transaction = this;\n }\n\n /**\n * JSDoc\n */\n public setName(name: string): void {\n this.name = name;\n }\n\n /**\n * Attaches SpanRecorder to the span itself\n * @param maxlen maximum number of spans that can be recorded\n */\n public initSpanRecorder(maxlen: number = 1000): void {\n if (!this.spanRecorder) {\n this.spanRecorder = new SpanRecorder(maxlen);\n }\n this.spanRecorder.add(this);\n }\n\n /**\n * Set observed measurements for this transaction.\n * @hidden\n */\n public setMeasurements(measurements: Measurements): void {\n this._measurements = { ...measurements };\n }\n\n /**\n * @inheritDoc\n */\n public finish(endTimestamp?: number): string | undefined {\n // This transaction is already finished, so we should not flush it again.\n if (this.endTimestamp !== undefined) {\n return undefined;\n }\n\n if (!this.name) {\n logger.warn('Transaction has no name, falling back to `<unlabeled transaction>`.');\n this.name = '<unlabeled transaction>';\n }\n\n // just sets the end timestamp\n super.finish(endTimestamp);\n\n if (this.sampled !== true) {\n // At this point if `sampled !== true` we want to discard the transaction.\n logger.log('[Tracing] Discarding transaction because its trace was not chosen to be sampled.');\n return undefined;\n }\n\n const finishedSpans = this.spanRecorder ? this.spanRecorder.spans.filter(s => s !== this && s.endTimestamp) : [];\n\n if (this._trimEnd && finishedSpans.length > 0) {\n this.endTimestamp = finishedSpans.reduce((prev: SpanClass, current: SpanClass) => {\n if (prev.endTimestamp && current.endTimestamp) {\n return prev.endTimestamp > current.endTimestamp ? prev : current;\n }\n return prev;\n }).endTimestamp;\n }\n\n const transaction: Event = {\n contexts: {\n trace: this.getTraceContext(),\n },\n spans: finishedSpans,\n start_timestamp: this.startTimestamp,\n tags: this.tags,\n timestamp: this.endTimestamp,\n transaction: this.name,\n type: 'transaction',\n };\n\n const hasMeasurements = Object.keys(this._measurements).length > 0;\n\n if (hasMeasurements) {\n logger.log('[Measurements] Adding measurements to transaction', JSON.stringify(this._measurements, undefined, 2));\n transaction.measurements = this._measurements;\n }\n\n return this._hub.captureEvent(transaction);\n }\n}\n","import { Hub } from '@sentry/hub';\nimport { TransactionContext } from '@sentry/types';\nimport { logger, timestampWithMs } from '@sentry/utils';\n\nimport { Span, SpanRecorder } from './span';\nimport { SpanStatus } from './spanstatus';\nimport { Transaction } from './transaction';\n\nexport const DEFAULT_IDLE_TIMEOUT = 1000;\n\n/**\n * @inheritDoc\n */\nexport class IdleTransactionSpanRecorder extends SpanRecorder {\n public constructor(\n private readonly _pushActivity: (id: string) => void,\n private readonly _popActivity: (id: string) => void,\n public transactionSpanId: string = '',\n maxlen?: number,\n ) {\n super(maxlen);\n }\n\n /**\n * @inheritDoc\n */\n public add(span: Span): void {\n // We should make sure we do not push and pop activities for\n // the transaction that this span recorder belongs to.\n if (span.spanId !== this.transactionSpanId) {\n // We patch span.finish() to pop an activity after setting an endTimestamp.\n span.finish = (endTimestamp?: number) => {\n span.endTimestamp = typeof endTimestamp === 'number' ? endTimestamp : timestampWithMs();\n this._popActivity(span.spanId);\n };\n\n // We should only push new activities if the span does not have an end timestamp.\n if (span.endTimestamp === undefined) {\n this._pushActivity(span.spanId);\n }\n }\n\n super.add(span);\n }\n}\n\nexport type BeforeFinishCallback = (transactionSpan: IdleTransaction, endTimestamp: number) => void;\n\n/**\n * An IdleTransaction is a transaction that automatically finishes. It does this by tracking child spans as activities.\n * You can have multiple IdleTransactions active, but if the `onScope` option is specified, the idle transaction will\n * put itself on the scope on creation.\n */\nexport class IdleTransaction extends Transaction {\n // Activities store a list of active spans\n public activities: Record<string, boolean> = {};\n\n // Stores reference to the timeout that calls _beat().\n private _heartbeatTimer: number = 0;\n\n // Track state of activities in previous heartbeat\n private _prevHeartbeatString: string | undefined;\n\n // Amount of times heartbeat has counted. Will cause transaction to finish after 3 beats.\n private _heartbeatCounter: number = 0;\n\n // We should not use heartbeat if we finished a transaction\n private _finished: boolean = false;\n\n private readonly _beforeFinishCallbacks: BeforeFinishCallback[] = [];\n\n // If a transaction is created and no activities are added, we want to make sure that\n // it times out properly. This is cleared and not used when activities are added.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _initTimeout: any;\n\n public constructor(\n transactionContext: TransactionContext,\n private readonly _idleHub?: Hub,\n // The time to wait in ms until the idle transaction will be finished. Default: 1000\n private readonly _idleTimeout: number = DEFAULT_IDLE_TIMEOUT,\n // If an idle transaction should be put itself on and off the scope automatically.\n private readonly _onScope: boolean = false,\n ) {\n super(transactionContext, _idleHub);\n\n if (_idleHub && _onScope) {\n // There should only be one active transaction on the scope\n clearActiveTransaction(_idleHub);\n\n // We set the transaction here on the scope so error events pick up the trace\n // context and attach it to the error.\n logger.log(`Setting idle transaction on scope. Span ID: ${this.spanId}`);\n _idleHub.configureScope(scope => scope.setSpan(this));\n }\n }\n\n /** {@inheritDoc} */\n public finish(endTimestamp: number = timestampWithMs()): string | undefined {\n this._finished = true;\n this.activities = {};\n\n if (this.spanRecorder) {\n logger.log('[Tracing] finishing IdleTransaction', new Date(endTimestamp * 1000).toISOString(), this.op);\n\n for (const callback of this._beforeFinishCallbacks) {\n callback(this, endTimestamp);\n }\n\n this.spanRecorder.spans = this.spanRecorder.spans.filter((span: Span) => {\n // If we are dealing with the transaction itself, we just return it\n if (span.spanId === this.spanId) {\n return true;\n }\n\n // We cancel all pending spans with status \"cancelled\" to indicate the idle transaction was finished early\n if (!span.endTimestamp) {\n span.endTimestamp = endTimestamp;\n span.setStatus(SpanStatus.Cancelled);\n logger.log('[Tracing] cancelling span since transaction ended early', JSON.stringify(span, undefined, 2));\n }\n\n const keepSpan = span.startTimestamp < endTimestamp;\n if (!keepSpan) {\n logger.log(\n '[Tracing] discarding Span since it happened after Transaction was finished',\n JSON.stringify(span, undefined, 2),\n );\n }\n return keepSpan;\n });\n\n // this._onScope is true if the transaction was previously on the scope.\n if (this._onScope) {\n clearActiveTransaction(this._idleHub);\n }\n\n logger.log('[Tracing] flushing IdleTransaction');\n } else {\n logger.log('[Tracing] No active IdleTransaction');\n }\n\n return super.finish(endTimestamp);\n }\n\n /**\n * Register a callback function that gets excecuted before the transaction finishes.\n * Useful for cleanup or if you want to add any additional spans based on current context.\n *\n * This is exposed because users have no other way of running something before an idle transaction\n * finishes.\n */\n public registerBeforeFinishCallback(callback: BeforeFinishCallback): void {\n this._beforeFinishCallbacks.push(callback);\n }\n\n /**\n * @inheritDoc\n */\n public initSpanRecorder(maxlen?: number): void {\n if (!this.spanRecorder) {\n this._initTimeout = setTimeout(() => {\n if (!this._finished) {\n this.finish();\n }\n }, this._idleTimeout);\n\n const pushActivity = (id: string): void => {\n if (this._finished) {\n return;\n }\n this._pushActivity(id);\n };\n const popActivity = (id: string): void => {\n if (this._finished) {\n return;\n }\n this._popActivity(id);\n };\n\n this.spanRecorder = new IdleTransactionSpanRecorder(pushActivity, popActivity, this.spanId, maxlen);\n\n // Start heartbeat so that transactions do not run forever.\n logger.log('Starting heartbeat');\n this._pingHeartbeat();\n }\n this.spanRecorder.add(this);\n }\n\n /**\n * Start tracking a specific activity.\n * @param spanId The span id that represents the activity\n */\n private _pushActivity(spanId: string): void {\n if (this._initTimeout) {\n clearTimeout(this._initTimeout);\n this._initTimeout = undefined;\n }\n logger.log(`[Tracing] pushActivity: ${spanId}`);\n this.activities[spanId] = true;\n logger.log('[Tracing] new activities count', Object.keys(this.activities).length);\n }\n\n /**\n * Remove an activity from usage\n * @param spanId The span id that represents the activity\n */\n private _popActivity(spanId: string): void {\n if (this.activities[spanId]) {\n logger.log(`[Tracing] popActivity ${spanId}`);\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete this.activities[spanId];\n logger.log('[Tracing] new activities count', Object.keys(this.activities).length);\n }\n\n if (Object.keys(this.activities).length === 0) {\n const timeout = this._idleTimeout;\n // We need to add the timeout here to have the real endtimestamp of the transaction\n // Remember timestampWithMs is in seconds, timeout is in ms\n const end = timestampWithMs() + timeout / 1000;\n\n setTimeout(() => {\n if (!this._finished) {\n this.finish(end);\n }\n }, timeout);\n }\n }\n\n /**\n * Checks when entries of this.activities are not changing for 3 beats.\n * If this occurs we finish the transaction.\n */\n private _beat(): void {\n clearTimeout(this._heartbeatTimer);\n // We should not be running heartbeat if the idle transaction is finished.\n if (this._finished) {\n return;\n }\n\n const keys = Object.keys(this.activities);\n const heartbeatString = keys.length ? keys.reduce((prev: string, current: string) => prev + current) : '';\n\n if (heartbeatString === this._prevHeartbeatString) {\n this._heartbeatCounter += 1;\n } else {\n this._heartbeatCounter = 1;\n }\n\n this._prevHeartbeatString = heartbeatString;\n\n if (this._heartbeatCounter >= 3) {\n logger.log(`[Tracing] Transaction finished because of no change for 3 heart beats`);\n this.setStatus(SpanStatus.DeadlineExceeded);\n this.setTag('heartbeat', 'failed');\n this.finish();\n } else {\n this._pingHeartbeat();\n }\n }\n\n /**\n * Pings the heartbeat\n */\n private _pingHeartbeat(): void {\n logger.log(`pinging Heartbeat -> current counter: ${this._heartbeatCounter}`);\n this._heartbeatTimer = (setTimeout(() => {\n this._beat();\n }, 5000) as unknown) as number;\n }\n}\n\n/**\n * Reset active transaction on scope\n */\nfunction clearActiveTransaction(hub?: Hub): void {\n if (hub) {\n const scope = hub.getScope();\n if (scope) {\n const transaction = scope.getTransaction();\n if (transaction) {\n scope.setSpan(undefined);\n }\n }\n }\n}\n","import { getActiveDomain, getMainCarrier, Hub } from '@sentry/hub';\nimport { CustomSamplingContext, SamplingContext, TransactionContext } from '@sentry/types';\nimport {\n dynamicRequire,\n extractNodeRequestData,\n getGlobalObject,\n isInstanceOf,\n isNodeEnv,\n logger,\n} from '@sentry/utils';\n\nimport { registerErrorInstrumentation } from './errors';\nimport { IdleTransaction } from './idletransaction';\nimport { Transaction } from './transaction';\nimport { hasTracingEnabled } from './utils';\n\n/** Returns all trace headers that are currently on the top scope. */\nfunction traceHeaders(this: Hub): { [key: string]: string } {\n const scope = this.getScope();\n if (scope) {\n const span = scope.getSpan();\n if (span) {\n return {\n 'sentry-trace': span.toTraceparent(),\n };\n }\n }\n return {};\n}\n\n/**\n * Implements sampling inheritance and falls back to user-provided static rate if no parent decision is available.\n *\n * @param parentSampled: The parent transaction's sampling decision, if any.\n * @param givenRate: The rate to use if no parental decision is available.\n *\n * @returns The parent's sampling decision (if one exists), or the provided static rate\n */\nfunction _inheritOrUseGivenRate(parentSampled: boolean | undefined, givenRate: unknown): boolean | unknown {\n return parentSampled !== undefined ? parentSampled : givenRate;\n}\n\n/**\n * Makes a sampling decision for the given transaction and stores it on the transaction.\n *\n * Called every time a transaction is created. Only transactions which emerge with a `sampled` value of `true` will be\n * sent to Sentry.\n *\n * @param hub: The hub off of which to read config options\n * @param transaction: The transaction needing a sampling decision\n * @param samplingContext: Default and user-provided data which may be used to help make the decision\n *\n * @returns The given transaction with its `sampled` value set\n */\nfunction sample<T extends Transaction>(hub: Hub, transaction: T, samplingContext: SamplingContext): T {\n const client = hub.getClient();\n const options = (client && client.getOptions()) || {};\n\n // nothing to do if there's no client or if tracing is disabled\n if (!client || !hasTracingEnabled(options)) {\n transaction.sampled = false;\n return transaction;\n }\n\n // if the user has forced a sampling decision by passing a `sampled` value in their transaction context, go with that\n if (transaction.sampled !== undefined) {\n return transaction;\n }\n\n // we would have bailed already if neither `tracesSampler` nor `tracesSampleRate` were defined, so one of these should\n // work; prefer the hook if so\n const sampleRate =\n typeof options.tracesSampler === 'function'\n ? options.tracesSampler(samplingContext)\n : _inheritOrUseGivenRate(samplingContext.parentSampled, options.tracesSampleRate);\n\n // Since this is coming from the user (or from a function provided by the user), who knows what we might get. (The\n // only valid values are booleans or numbers between 0 and 1.)\n if (!isValidSampleRate(sampleRate)) {\n logger.warn(`[Tracing] Discarding transaction because of invalid sample rate.`);\n transaction.sampled = false;\n return transaction;\n }\n\n // if the function returned 0 (or false), or if `tracesSampleRate` is 0, it's a sign the transaction should be dropped\n if (!sampleRate) {\n logger.log(\n `[Tracing] Discarding transaction because ${\n typeof options.tracesSampler === 'function'\n ? 'tracesSampler returned 0 or false'\n : 'tracesSampleRate is set to 0'\n }`,\n );\n transaction.sampled = false;\n return transaction;\n }\n\n // Now we roll the dice. Math.random is inclusive of 0, but not of 1, so strict < is safe here. In case sampleRate is\n // a boolean, the < comparison will cause it to be automatically cast to 1 if it's true and 0 if it's false.\n transaction.sampled = Math.random() < (sampleRate as number | boolean);\n\n // if we're not going to keep it, we're done\n if (!transaction.sampled) {\n logger.log(\n `[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(\n sampleRate,\n )})`,\n );\n return transaction;\n }\n\n // at this point we know we're keeping the transaction, whether because of an inherited decision or because it got\n // lucky with the dice roll\n transaction.initSpanRecorder(options._experiments?.maxSpans as number);\n\n logger.log(`[Tracing] starting ${transaction.op} transaction - ${transaction.name}`);\n return transaction;\n}\n/**\n * Gets the correct context to pass to the tracesSampler, based on the environment (i.e., which SDK is being used)\n *\n * @returns The default sample context\n */\nfunction getDefaultSamplingContext(transactionContext: TransactionContext): SamplingContext {\n // promote parent sampling decision (if any) for easy access\n const { parentSampled } = transactionContext;\n const defaultSamplingContext: SamplingContext = { transactionContext, parentSampled };\n\n if (isNodeEnv()) {\n const domain = getActiveDomain();\n\n if (domain) {\n // for all node servers that we currently support, we store the incoming request object (which is an instance of\n // http.IncomingMessage) on the domain\n\n // the domain members are stored as an array, so our only way to find the request is to iterate through the array\n // and compare types\n\n const nodeHttpModule = dynamicRequire(module, 'http');\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const requestType = nodeHttpModule.IncomingMessage;\n\n const request = domain.members.find(member => isInstanceOf(member, requestType));\n if (request) {\n defaultSamplingContext.request = extractNodeRequestData(request);\n }\n }\n }\n\n // we must be in browser-js (or some derivative thereof)\n else {\n // we use `getGlobalObject()` rather than `window` since service workers also have a `location` property on `self`\n const globalObject = getGlobalObject<WindowOrWorkerGlobalScope>();\n\n if ('location' in globalObject) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any\n defaultSamplingContext.location = { ...(globalObject as any).location };\n }\n }\n\n return defaultSamplingContext;\n}\n\n/**\n * Checks the given sample rate to make sure it is valid type and value (a boolean, or a number between 0 and 1).\n */\nfunction isValidSampleRate(rate: unknown): boolean {\n // we need to check NaN explicitly because it's of type 'number' and therefore wouldn't get caught by this typecheck\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if (isNaN(rate as any) || !(typeof rate === 'number' || typeof rate === 'boolean')) {\n logger.warn(\n `[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(\n rate,\n )} of type ${JSON.stringify(typeof rate)}.`,\n );\n return false;\n }\n\n // in case sampleRate is a boolean, it will get automatically cast to 1 if it's true and 0 if it's false\n if (rate < 0 || rate > 1) {\n logger.warn(`[Tracing] Given sample rate is invalid. Sample rate must be between 0 and 1. Got ${rate}.`);\n return false;\n }\n return true;\n}\n\n/**\n * Creates a new transaction and adds a sampling decision if it doesn't yet have one.\n *\n * The Hub.startTransaction method delegates to this method to do its work, passing the Hub instance in as `this`, as if\n * it had been called on the hub directly. Exists as a separate function so that it can be injected into the class as an\n * \"extension method.\"\n *\n * @param this: The Hub starting the transaction\n * @param transactionContext: Data used to configure the transaction\n * @param CustomSamplingContext: Optional data to be provided to the `tracesSampler` function (if any)\n *\n * @returns The new transaction\n *\n * @see {@link Hub.startTransaction}\n */\nfunction _startTransaction(\n this: Hub,\n transactionContext: TransactionContext,\n customSamplingContext?: CustomSamplingContext,\n): Transaction {\n const transaction = new Transaction(transactionContext, this);\n return sample(this, transaction, {\n ...getDefaultSamplingContext(transactionContext),\n ...customSamplingContext,\n });\n}\n\n/**\n * Create new idle transaction.\n */\nexport function startIdleTransaction(\n hub: Hub,\n transactionContext: TransactionContext,\n idleTimeout?: number,\n onScope?: boolean,\n): IdleTransaction {\n const transaction = new IdleTransaction(transactionContext, hub, idleTimeout, onScope);\n return sample(hub, transaction, getDefaultSamplingContext(transactionContext));\n}\n\n/**\n * @private\n */\nexport function _addTracingExtensions(): void {\n const carrier = getMainCarrier();\n if (carrier.__SENTRY__) {\n carrier.__SENTRY__.extensions = carrier.__SENTRY__.extensions || {};\n if (!carrier.__SENTRY__.extensions.startTransaction) {\n carrier.__SENTRY__.extensions.startTransaction = _startTransaction;\n }\n if (!carrier.__SENTRY__.extensions.traceHeaders) {\n carrier.__SENTRY__.extensions.traceHeaders = traceHeaders;\n }\n }\n}\n\n/**\n * This patches the global object and injects the Tracing extensions methods\n */\nexport function addExtensionMethods(): void {\n _addTracingExtensions();\n\n // If an error happens globally, we should make sure transaction status is set to error.\n registerErrorInstrumentation();\n}\n","import { getGlobalObject, logger } from '@sentry/utils';\n\nimport { IdleTransaction } from '../idletransaction';\nimport { SpanStatus } from '../spanstatus';\nimport { getActiveTransaction } from '../utils';\n\nconst global = getGlobalObject<Window>();\n\n/**\n * Add a listener that cancels and finishes a transaction when the global\n * document is hidden.\n */\nexport function registerBackgroundTabDetection(): void {\n if (global && global.document) {\n global.document.addEventListener('visibilitychange', () => {\n const activeTransaction = getActiveTransaction() as IdleTransaction;\n if (global.document.hidden && activeTransaction) {\n logger.log(\n `[Tracing] Transaction: ${SpanStatus.Cancelled} -> since tab moved to the background, op: ${activeTransaction.op}`,\n );\n // We should not set status if it is already set, this prevent important statuses like\n // error or data loss from being overwritten on transaction.\n if (!activeTransaction.status) {\n activeTransaction.setStatus(SpanStatus.Cancelled);\n }\n activeTransaction.setTag('visibilitychange', 'document.hidden');\n activeTransaction.finish();\n }\n });\n } else {\n logger.warn('[Tracing] Could not set up background tab detection due to lack of global document');\n }\n}\n","/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Metric, ReportHandler } from '../types';\n\nexport const bindReporter = (\n callback: ReportHandler,\n metric: Metric,\n po: PerformanceObserver | undefined,\n observeAllUpdates?: boolean,\n): (() => void) => {\n let prevValue: number;\n return () => {\n if (po && metric.isFinal) {\n po.disconnect();\n }\n if (metric.value >= 0) {\n if (observeAllUpdates || metric.isFinal || document.visibilityState === 'hidden') {\n metric.delta = metric.value - (prevValue || 0);\n\n // Report the metric if there's a non-zero delta, if the metric is\n // final, or if no previous value exists (which can happen in the case\n // of the document becoming hidden when the metric value is 0).\n // See: https://github.com/GoogleChrome/web-vitals/issues/14\n if (metric.delta || metric.isFinal || prevValue === undefined) {\n callback(metric);\n prevValue = metric.value;\n }\n }\n }\n };\n};\n","/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { onHidden } from './onHidden';\n\nlet firstHiddenTime: number;\n\ntype HiddenType = {\n readonly timeStamp: number;\n};\n\nexport const getFirstHidden = (): HiddenType => {\n if (firstHiddenTime === undefined) {\n // If the document is hidden when this code runs, assume it was hidden\n // since navigation start. This isn't a perfect heuristic, but it's the\n // best we can do until an API is available to support querying past\n // visibilityState.\n firstHiddenTime = document.visibilityState === 'hidden' ? 0 : Infinity;\n\n // Update the time if/when the document becomes hidden.\n onHidden(({ timeStamp }) => (firstHiddenTime = timeStamp), true);\n }\n\n return {\n get timeStamp() {\n return firstHiddenTime;\n },\n };\n};\n","/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nlet inputPromise: Promise<Event>;\n\nexport const whenInput = (): Promise<Event> => {\n if (!inputPromise) {\n inputPromise = new Promise(r => {\n return ['scroll', 'keydown', 'pointerdown'].map(type => {\n addEventListener(type, r, {\n once: true,\n passive: true,\n capture: true,\n });\n });\n });\n }\n return inputPromise;\n};\n","/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Metric } from '../types';\nimport { generateUniqueID } from './generateUniqueID';\n\nexport const initMetric = (name: Metric['name'], value = -1): Metric => {\n return {\n name,\n value,\n delta: 0,\n entries: [],\n id: generateUniqueID(),\n isFinal: false,\n };\n};\n","/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Performantly generate a unique, 27-char string by combining the current\n * timestamp with a 13-digit random number.\n * @return {string}\n */\nexport const generateUniqueID = (): string => {\n return `${Date.now()}-${Math.floor(Math.random() * (9e12 - 1)) + 1e12}`;\n};\n","/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface PerformanceEntryHandler {\n (entry: PerformanceEntry): void;\n}\n\n/**\n * Takes a performance entry type and a callback function, and creates a\n * `PerformanceObserver` instance that will observe the specified entry type\n * with buffering enabled and call the callback _for each entry_.\n *\n * This function also feature-detects entry support and wraps the logic in a\n * try/catch to avoid errors in unsupporting browsers.\n */\nexport const observe = (type: string, callback: PerformanceEntryHandler): PerformanceObserver | undefined => {\n try {\n if (PerformanceObserver.supportedEntryTypes.includes(type)) {\n const po: PerformanceObserver = new PerformanceObserver(l => l.getEntries().map(callback));\n\n po.observe({ type, buffered: true });\n return po;\n }\n } catch (e) {\n // Do nothing.\n }\n return;\n};\n","/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface OnHiddenCallback {\n // TODO(philipwalton): add `isPersisted` if needed for bfcache.\n ({ timeStamp, isUnloading }: { timeStamp: number; isUnloading: boolean }): void;\n}\n\nlet isUnloading = false;\nlet listenersAdded = false;\n\nconst onPageHide = (event: PageTransitionEvent): void => {\n isUnloading = !event.persisted;\n};\n\nconst addListeners = (): void => {\n addEventListener('pagehide', onPageHide);\n\n // `beforeunload` is needed to fix this bug:\n // https://bugs.chromium.org/p/chromium/issues/detail?id=987409\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n addEventListener('beforeunload', () => {});\n};\n\nexport const onHidden = (cb: OnHiddenCallback, once = false): void => {\n if (!listenersAdded) {\n addListeners();\n listenersAdded = true;\n }\n\n addEventListener(\n 'visibilitychange',\n ({ timeStamp }) => {\n if (document.visibilityState === 'hidden') {\n cb({ timeStamp, isUnloading });\n }\n },\n { capture: true, once },\n );\n};\n","/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { bindReporter } from './lib/bindReporter';\nimport { getFirstHidden } from './lib/getFirstHidden';\nimport { initMetric } from './lib/initMetric';\nimport { observe, PerformanceEntryHandler } from './lib/observe';\nimport { onHidden } from './lib/onHidden';\nimport { whenInput } from './lib/whenInput';\nimport { ReportHandler } from './types';\n\nexport const getLCP = (onReport: ReportHandler, reportAllChanges = false): void => {\n const metric = initMetric('LCP');\n const firstHidden = getFirstHidden();\n\n let report: ReturnType<typeof bindReporter>;\n\n const entryHandler = (entry: PerformanceEntry): void => {\n // The startTime attribute returns the value of the renderTime if it is not 0,\n // and the value of the loadTime otherwise.\n const value = entry.startTime;\n\n // If the page was hidden prior to paint time of the entry,\n // ignore it and mark the metric as final, otherwise add the entry.\n if (value < firstHidden.timeStamp) {\n metric.value = value;\n metric.entries.push(entry);\n } else {\n metric.isFinal = true;\n }\n\n report();\n };\n\n const po = observe('largest-contentful-paint', entryHandler);\n\n if (po) {\n report = bindReporter(onReport, metric, po, reportAllChanges);\n\n const onFinal = (): void => {\n if (!metric.isFinal) {\n po.takeRecords().map(entryHandler as PerformanceEntryHandler);\n metric.isFinal = true;\n report();\n }\n };\n\n void whenInput().then(onFinal);\n onHidden(onFinal, true);\n }\n};\n","/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getGlobalObject } from '@sentry/utils';\n\nimport { initMetric } from './lib/initMetric';\nimport { ReportHandler } from './types';\n\nconst global = getGlobalObject<Window>();\n\ninterface NavigationEntryShim {\n // From `PerformanceNavigationTimingEntry`.\n entryType: string;\n startTime: number;\n\n // From `performance.timing`.\n connectEnd?: number;\n connectStart?: number;\n domComplete?: number;\n domContentLoadedEventEnd?: number;\n domContentLoadedEventStart?: number;\n domInteractive?: number;\n domainLookupEnd?: number;\n domainLookupStart?: number;\n fetchStart?: number;\n loadEventEnd?: number;\n loadEventStart?: number;\n redirectEnd?: number;\n redirectStart?: number;\n requestStart?: number;\n responseEnd?: number;\n responseStart?: number;\n secureConnectionStart?: number;\n unloadEventEnd?: number;\n unloadEventStart?: number;\n}\n\ntype PerformanceTimingKeys =\n | 'connectEnd'\n | 'connectStart'\n | 'domComplete'\n | 'domContentLoadedEventEnd'\n | 'domContentLoadedEventStart'\n | 'domInteractive'\n | 'domainLookupEnd'\n | 'domainLookupStart'\n | 'fetchStart'\n | 'loadEventEnd'\n | 'loadEventStart'\n | 'redirectEnd'\n | 'redirectStart'\n | 'requestStart'\n | 'responseEnd'\n | 'responseStart'\n | 'secureConnectionStart'\n | 'unloadEventEnd'\n | 'unloadEventStart';\n\nconst afterLoad = (callback: () => void): void => {\n if (document.readyState === 'complete') {\n // Queue a task so the callback runs after `loadEventEnd`.\n setTimeout(callback, 0);\n } else {\n // Use `pageshow` so the callback runs after `loadEventEnd`.\n addEventListener('pageshow', callback);\n }\n};\n\nconst getNavigationEntryFromPerformanceTiming = (): PerformanceNavigationTiming => {\n // Really annoying that TypeScript errors when using `PerformanceTiming`.\n // Note: browsers that do not support navigation entries will fall back to using performance.timing\n // (with the timestamps converted from epoch time to DOMHighResTimeStamp).\n // eslint-disable-next-line deprecation/deprecation\n const timing = global.performance.timing;\n\n const navigationEntry: NavigationEntryShim = {\n entryType: 'navigation',\n startTime: 0,\n };\n\n for (const key in timing) {\n if (key !== 'navigationStart' && key !== 'toJSON') {\n navigationEntry[key as PerformanceTimingKeys] = Math.max(\n timing[key as PerformanceTimingKeys] - timing.navigationStart,\n 0,\n );\n }\n }\n return navigationEntry as PerformanceNavigationTiming;\n};\n\nexport const getTTFB = (onReport: ReportHandler): void => {\n const metric = initMetric('TTFB');\n\n afterLoad(() => {\n try {\n // Use the NavigationTiming L2 entry if available.\n const navigationEntry =\n global.performance.getEntriesByType('navigation')[0] || getNavigationEntryFromPerformanceTiming();\n\n metric.value = metric.delta = (navigationEntry as PerformanceNavigationTiming).responseStart;\n\n metric.entries = [navigationEntry];\n metric.isFinal = true;\n\n onReport(metric);\n } catch (error) {\n // Do nothing.\n }\n });\n};\n","/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Measurements, SpanContext } from '@sentry/types';\nimport { browserPerformanceTimeOrigin, getGlobalObject, logger } from '@sentry/utils';\n\nimport { Span } from '../span';\nimport { Transaction } from '../transaction';\nimport { msToSec } from '../utils';\nimport { getCLS } from './web-vitals/getCLS';\nimport { getFID } from './web-vitals/getFID';\nimport { getLCP } from './web-vitals/getLCP';\nimport { getTTFB } from './web-vitals/getTTFB';\nimport { getFirstHidden } from './web-vitals/lib/getFirstHidden';\nimport { NavigatorDeviceMemory, NavigatorNetworkInformation } from './web-vitals/types';\n\nconst global = getGlobalObject<Window>();\n\n/** Class tracking metrics */\nexport class MetricsInstrumentation {\n private _measurements: Measurements = {};\n\n private _performanceCursor: number = 0;\n\n public constructor() {\n if (global && global.performance) {\n if (global.performance.mark) {\n global.performance.mark('sentry-tracing-init');\n }\n\n this._trackCLS();\n this._trackLCP();\n this._trackFID();\n this._trackTTFB();\n }\n }\n\n /** Add performance related spans to a transaction */\n public addPerformanceEntries(transaction: Transaction): void {\n if (!global || !global.performance || !global.performance.getEntries || !browserPerformanceTimeOrigin) {\n // Gatekeeper if performance API not available\n return;\n }\n\n logger.log('[Tracing] Adding & adjusting spans using Performance API');\n\n const timeOrigin = msToSec(browserPerformanceTimeOrigin);\n let entryScriptSrc: string | undefined;\n\n if (global.document) {\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < document.scripts.length; i++) {\n // We go through all scripts on the page and look for 'data-entry'\n // We remember the name and measure the time between this script finished loading and\n // our mark 'sentry-tracing-init'\n if (document.scripts[i].dataset.entry === 'true') {\n entryScriptSrc = document.scripts[i].src;\n break;\n }\n }\n }\n\n let entryScriptStartTimestamp: number | undefined;\n let tracingInitMarkStartTime: number | undefined;\n\n global.performance\n .getEntries()\n .slice(this._performanceCursor)\n .forEach((entry: Record<string, any>) => {\n const startTime = msToSec(entry.startTime as number);\n const duration = msToSec(entry.duration as number);\n\n if (transaction.op === 'navigation' && timeOrigin + startTime < transaction.startTimestamp) {\n return;\n }\n\n switch (entry.entryType) {\n case 'navigation':\n addNavigationSpans(transaction, entry, timeOrigin);\n break;\n case 'mark':\n case 'paint':\n case 'measure': {\n const startTimestamp = addMeasureSpans(transaction, entry, startTime, duration, timeOrigin);\n if (tracingInitMarkStartTime === undefined && entry.name === 'sentry-tracing-init') {\n tracingInitMarkStartTime = startTimestamp;\n }\n\n // capture web vitals\n\n const firstHidden = getFirstHidden();\n // Only report if the page wasn't hidden prior to the web vital.\n const shouldRecord = entry.startTime < firstHidden.timeStamp;\n\n if (entry.name === 'first-paint' && shouldRecord) {\n logger.log('[Measurements] Adding FP');\n this._measurements['fp'] = { value: entry.startTime };\n this._measurements['mark.fp'] = { value: startTimestamp };\n }\n\n if (entry.name === 'first-contentful-paint' && shouldRecord) {\n logger.log('[Measurements] Adding FCP');\n this._measurements['fcp'] = { value: entry.startTime };\n this._measurements['mark.fcp'] = { value: startTimestamp };\n }\n\n break;\n }\n case 'resource': {\n const resourceName = (entry.name as string).replace(window.location.origin, '');\n const endTimestamp = addResourceSpans(transaction, entry, resourceName, startTime, duration, timeOrigin);\n // We remember the entry script end time to calculate the difference to the first init mark\n if (entryScriptStartTimestamp === undefined && (entryScriptSrc || '').indexOf(resourceName) > -1) {\n entryScriptStartTimestamp = endTimestamp;\n }\n break;\n }\n default:\n // Ignore other entry types.\n }\n });\n\n if (entryScriptStartTimestamp !== undefined && tracingInitMarkStartTime !== undefined) {\n _startChild(transaction, {\n description: 'evaluation',\n endTimestamp: tracingInitMarkStartTime,\n op: 'script',\n startTimestamp: entryScriptStartTimestamp,\n });\n }\n\n this._performanceCursor = Math.max(performance.getEntries().length - 1, 0);\n\n this._trackNavigator(transaction);\n\n // Measurements are only available for pageload transactions\n if (transaction.op === 'pageload') {\n // normalize applicable web vital values to be relative to transaction.startTimestamp\n\n const timeOrigin = msToSec(performance.timeOrigin);\n\n ['fcp', 'fp', 'lcp', 'ttfb'].forEach(name => {\n if (!this._measurements[name] || timeOrigin >= transaction.startTimestamp) {\n return;\n }\n\n // The web vitals, fcp, fp, lcp, and ttfb, all measure relative to timeOrigin.\n // Unfortunately, timeOrigin is not captured within the transaction span data, so these web vitals will need\n // to be adjusted to be relative to transaction.startTimestamp.\n\n const oldValue = this._measurements[name].value;\n const measurementTimestamp = timeOrigin + msToSec(oldValue);\n // normalizedValue should be in milliseconds\n const normalizedValue = (measurementTimestamp - transaction.startTimestamp) * 1000;\n\n const delta = normalizedValue - oldValue;\n logger.log(\n `[Measurements] Normalized ${name} from ${this._measurements[name].value} to ${normalizedValue} (${delta})`,\n );\n\n this._measurements[name].value = normalizedValue;\n });\n\n if (this._measurements['mark.fid'] && this._measurements['fid']) {\n // create span for FID\n\n _startChild(transaction, {\n description: 'first input delay',\n endTimestamp: this._measurements['mark.fid'].value + msToSec(this._measurements['fid'].value),\n op: 'web.vitals',\n startTimestamp: this._measurements['mark.fid'].value,\n });\n }\n\n transaction.setMeasurements(this._measurements);\n }\n }\n\n /** Starts tracking the Cumulative Layout Shift on the current page. */\n private _trackCLS(): void {\n getCLS(metric => {\n const entry = metric.entries.pop();\n\n if (!entry) {\n return;\n }\n\n logger.log('[Measurements] Adding CLS');\n this._measurements['cls'] = { value: metric.value };\n });\n }\n\n /**\n * Capture the information of the user agent.\n */\n private _trackNavigator(transaction: Transaction): void {\n const navigator = global.navigator as null | (Navigator & NavigatorNetworkInformation & NavigatorDeviceMemory);\n\n if (!navigator) {\n return;\n }\n\n // track network connectivity\n\n const connection = navigator.connection;\n if (connection) {\n if (connection.effectiveType) {\n transaction.setTag('effectiveConnectionType', connection.effectiveType);\n }\n\n if (connection.type) {\n transaction.setTag('connectionType', connection.type);\n }\n\n if (isMeasurementValue(connection.rtt)) {\n this._measurements['connection.rtt'] = { value: connection.rtt as number };\n }\n\n if (isMeasurementValue(connection.downlink)) {\n this._measurements['connection.downlink'] = { value: connection.downlink as number };\n }\n }\n\n if (isMeasurementValue(navigator.deviceMemory)) {\n transaction.setTag('deviceMemory', String(navigator.deviceMemory));\n }\n\n if (isMeasurementValue(navigator.hardwareConcurrency)) {\n transaction.setTag('hardwareConcurrency', String(navigator.hardwareConcurrency));\n }\n }\n\n /** Starts tracking the Largest Contentful Paint on the current page. */\n private _trackLCP(): void {\n getLCP(metric => {\n const entry = metric.entries.pop();\n\n if (!entry) {\n return;\n }\n\n const timeOrigin = msToSec(performance.timeOrigin);\n const startTime = msToSec(entry.startTime as number);\n logger.log('[Measurements] Adding LCP');\n this._measurements['lcp'] = { value: metric.value };\n this._measurements['mark.lcp'] = { value: timeOrigin + startTime };\n });\n }\n\n /** Starts tracking the First Input Delay on the current page. */\n private _trackFID(): void {\n getFID(metric => {\n const entry = metric.entries.pop();\n\n if (!entry) {\n return;\n }\n\n const timeOrigin = msToSec(performance.timeOrigin);\n const startTime = msToSec(entry.startTime as number);\n logger.log('[Measurements] Adding FID');\n this._measurements['fid'] = { value: metric.value };\n this._measurements['mark.fid'] = { value: timeOrigin + startTime };\n });\n }\n\n /** Starts tracking the Time to First Byte on the current page. */\n private _trackTTFB(): void {\n getTTFB(metric => {\n const entry = metric.entries.pop();\n\n if (!entry) {\n return;\n }\n\n logger.log('[Measurements] Adding TTFB');\n this._measurements['ttfb'] = { value: metric.value };\n\n // Capture the time spent making the request and receiving the first byte of the response\n const requestTime = metric.value - ((metric.entries[0] ?? entry) as PerformanceNavigationTiming).requestStart;\n this._measurements['ttfb.requestTime'] = { value: requestTime };\n });\n }\n}\n\n/** Instrument navigation entries */\nfunction addNavigationSpans(transaction: Transaction, entry: Record<string, any>, timeOrigin: number): void {\n addPerformanceNavigationTiming(transaction, entry, 'unloadEvent', timeOrigin);\n addPerformanceNavigationTiming(transaction, entry, 'redirect', timeOrigin);\n addPerformanceNavigationTiming(transaction, entry, 'domContentLoadedEvent', timeOrigin);\n addPerformanceNavigationTiming(transaction, entry, 'loadEvent', timeOrigin);\n addPerformanceNavigationTiming(transaction, entry, 'connect', timeOrigin);\n addPerformanceNavigationTiming(transaction, entry, 'secureConnection', timeOrigin, 'connectEnd');\n addPerformanceNavigationTiming(transaction, entry, 'fetch', timeOrigin, 'domainLookupStart');\n addPerformanceNavigationTiming(transaction, entry, 'domainLookup', timeOrigin);\n addRequest(transaction, entry, timeOrigin);\n}\n\n/** Create measure related spans */\nfunction addMeasureSpans(\n transaction: Transaction,\n entry: Record<string, any>,\n startTime: number,\n duration: number,\n timeOrigin: number,\n): number {\n const measureStartTimestamp = timeOrigin + startTime;\n const measureEndTimestamp = measureStartTimestamp + duration;\n\n _startChild(transaction, {\n description: entry.name as string,\n endTimestamp: measureEndTimestamp,\n op: entry.entryType as string,\n startTimestamp: measureStartTimestamp,\n });\n\n return measureStartTimestamp;\n}\n\nexport interface ResourceEntry extends Record<string, unknown> {\n initiatorType?: string;\n transferSize?: number;\n encodedBodySize?: number;\n decodedBodySize?: number;\n}\n\n/** Create resource related spans */\nexport function addResourceSpans(\n transaction: Transaction,\n entry: ResourceEntry,\n resourceName: string,\n startTime: number,\n duration: number,\n timeOrigin: number,\n): number | undefined {\n // we already instrument based on fetch and xhr, so we don't need to\n // duplicate spans here.\n if (entry.initiatorType === 'xmlhttprequest' || entry.initiatorType === 'fetch') {\n return undefined;\n }\n\n const data: Record<string, any> = {};\n if ('transferSize' in entry) {\n data['Transfer Size'] = entry.transferSize;\n }\n if ('encodedBodySize' in entry) {\n data['Encoded Body Size'] = entry.encodedBodySize;\n }\n if ('decodedBodySize' in entry) {\n data['Decoded Body Size'] = entry.decodedBodySize;\n }\n\n const startTimestamp = timeOrigin + startTime;\n const endTimestamp = startTimestamp + duration;\n\n _startChild(transaction, {\n description: resourceName,\n endTimestamp,\n op: entry.initiatorType ? `resource.${entry.initiatorType}` : 'resource',\n startTimestamp,\n data,\n });\n\n return endTimestamp;\n}\n\n/** Create performance navigation related spans */\nfunction addPerformanceNavigationTiming(\n transaction: Transaction,\n entry: Record<string, any>,\n event: string,\n timeOrigin: number,\n eventEnd?: string,\n): void {\n const end = eventEnd ? (entry[eventEnd] as number | undefined) : (entry[`${event}End`] as number | undefined);\n const start = entry[`${event}Start`] as number | undefined;\n if (!start || !end) {\n return;\n }\n _startChild(transaction, {\n description: event,\n endTimestamp: timeOrigin + msToSec(end),\n op: 'browser',\n startTimestamp: timeOrigin + msToSec(start),\n });\n}\n\n/** Create request and response related spans */\nfunction addRequest(transaction: Transaction, entry: Record<string, any>, timeOrigin: number): void {\n _startChild(transaction, {\n description: 'request',\n endTimestamp: timeOrigin + msToSec(entry.responseEnd as number),\n op: 'browser',\n startTimestamp: timeOrigin + msToSec(entry.requestStart as number),\n });\n\n _startChild(transaction, {\n description: 'response',\n endTimestamp: timeOrigin + msToSec(entry.responseEnd as number),\n op: 'browser',\n startTimestamp: timeOrigin + msToSec(entry.responseStart as number),\n });\n}\n\n/**\n * Helper function to start child on transactions. This function will make sure that the transaction will\n * use the start timestamp of the created child span if it is earlier than the transactions actual\n * start timestamp.\n */\nexport function _startChild(transaction: Transaction, { startTimestamp, ...ctx }: SpanContext): Span {\n if (startTimestamp && transaction.startTimestamp > startTimestamp) {\n transaction.startTimestamp = startTimestamp;\n }\n\n return transaction.startChild({\n startTimestamp,\n ...ctx,\n });\n}\n\n/**\n * Checks if a given value is a valid measurement value.\n */\nfunction isMeasurementValue(value: any): boolean {\n return typeof value === 'number' && isFinite(value);\n}\n","/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { bindReporter } from './lib/bindReporter';\nimport { initMetric } from './lib/initMetric';\nimport { observe, PerformanceEntryHandler } from './lib/observe';\nimport { onHidden } from './lib/onHidden';\nimport { ReportHandler } from './types';\n\n// https://wicg.github.io/layout-instability/#sec-layout-shift\ninterface LayoutShift extends PerformanceEntry {\n value: number;\n hadRecentInput: boolean;\n}\n\nexport const getCLS = (onReport: ReportHandler, reportAllChanges = false): void => {\n const metric = initMetric('CLS', 0);\n\n let report: ReturnType<typeof bindReporter>;\n\n const entryHandler = (entry: LayoutShift): void => {\n // Only count layout shifts without recent user input.\n if (!entry.hadRecentInput) {\n (metric.value as number) += entry.value;\n metric.entries.push(entry);\n report();\n }\n };\n\n const po = observe('layout-shift', entryHandler as PerformanceEntryHandler);\n if (po) {\n report = bindReporter(onReport, metric, po, reportAllChanges);\n\n onHidden(({ isUnloading }) => {\n po.takeRecords().map(entryHandler as PerformanceEntryHandler);\n\n if (isUnloading) {\n metric.isFinal = true;\n }\n report();\n });\n }\n};\n","/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { bindReporter } from './lib/bindReporter';\nimport { getFirstHidden } from './lib/getFirstHidden';\nimport { initMetric } from './lib/initMetric';\nimport { observe, PerformanceEntryHandler } from './lib/observe';\nimport { onHidden } from './lib/onHidden';\nimport { ReportHandler } from './types';\n\ninterface FIDPolyfillCallback {\n (value: number, event: Event): void;\n}\n\ninterface FIDPolyfill {\n onFirstInputDelay: (onReport: FIDPolyfillCallback) => void;\n}\n\ndeclare global {\n interface Window {\n perfMetrics: FIDPolyfill;\n }\n}\n\n// https://wicg.github.io/event-timing/#sec-performance-event-timing\ninterface PerformanceEventTiming extends PerformanceEntry {\n processingStart: DOMHighResTimeStamp;\n cancelable?: boolean;\n target?: Element;\n}\n\nexport const getFID = (onReport: ReportHandler): void => {\n const metric = initMetric('FID');\n const firstHidden = getFirstHidden();\n\n const entryHandler = (entry: PerformanceEventTiming): void => {\n // Only report if the page wasn't hidden prior to the first input.\n if (entry.startTime < firstHidden.timeStamp) {\n metric.value = entry.processingStart - entry.startTime;\n metric.entries.push(entry);\n metric.isFinal = true;\n report();\n }\n };\n\n const po = observe('first-input', entryHandler as PerformanceEntryHandler);\n const report = bindReporter(onReport, metric, po);\n\n if (po) {\n onHidden(() => {\n po.takeRecords().map(entryHandler as PerformanceEntryHandler);\n po.disconnect();\n }, true);\n } else {\n if (window.perfMetrics && window.perfMetrics.onFirstInputDelay) {\n window.perfMetrics.onFirstInputDelay((value: number, event: Event) => {\n // Only report if the page wasn't hidden prior to the first input.\n if (event.timeStamp < firstHidden.timeStamp) {\n metric.value = value;\n metric.isFinal = true;\n metric.entries = [\n {\n entryType: 'first-input',\n name: event.type,\n target: event.target,\n cancelable: event.cancelable,\n startTime: event.timeStamp,\n processingStart: event.timeStamp + value,\n } as PerformanceEventTiming,\n ];\n report();\n }\n });\n }\n }\n};\n","import { getCurrentHub } from '@sentry/hub';\nimport { addInstrumentationHandler, isInstanceOf, isMatchingPattern } from '@sentry/utils';\n\nimport { Span } from '../span';\nimport { getActiveTransaction, hasTracingEnabled } from '../utils';\n\nexport const DEFAULT_TRACING_ORIGINS = ['localhost', /^\\//];\n\n/** Options for Request Instrumentation */\nexport interface RequestInstrumentationOptions {\n /**\n * List of strings / regex where the integration should create Spans out of. Additionally this will be used\n * to define which outgoing requests the `sentry-trace` header will be attached to.\n *\n * Default: ['localhost', /^\\//] {@see DEFAULT_TRACING_ORIGINS}\n */\n tracingOrigins: Array<string | RegExp>;\n\n /**\n * Flag to disable patching all together for fetch requests.\n *\n * Default: true\n */\n traceFetch: boolean;\n\n /**\n * Flag to disable patching all together for xhr requests.\n *\n * Default: true\n */\n traceXHR: boolean;\n\n /**\n * This function will be called before creating a span for a request with the given url.\n * Return false if you don't want a span for the given url.\n *\n * By default it uses the `tracingOrigins` options as a url match.\n */\n shouldCreateSpanForRequest?(url: string): boolean;\n}\n\n/** Data returned from fetch callback */\nexport interface FetchData {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n args: any[]; // the arguments passed to the fetch call itself\n fetchData?: {\n method: string;\n url: string;\n // span_id\n __span?: string;\n };\n\n // TODO Should this be unknown instead? If we vendor types, make it a Response\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n response?: any;\n\n startTimestamp: number;\n endTimestamp?: number;\n}\n\n/** Data returned from XHR request */\nexport interface XHRData {\n xhr?: {\n __sentry_xhr__?: {\n method: string;\n url: string;\n status_code: number;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: Record<string, any>;\n };\n __sentry_xhr_span_id__?: string;\n setRequestHeader?: (key: string, val: string) => void;\n __sentry_own_request__?: boolean;\n };\n startTimestamp: number;\n endTimestamp?: number;\n}\n\nexport const defaultRequestInstrumentationOptions: RequestInstrumentationOptions = {\n traceFetch: true,\n traceXHR: true,\n tracingOrigins: DEFAULT_TRACING_ORIGINS,\n};\n\n/** Registers span creators for xhr and fetch requests */\nexport function registerRequestInstrumentation(_options?: Partial<RequestInstrumentationOptions>): void {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const { traceFetch, traceXHR, tracingOrigins, shouldCreateSpanForRequest } = {\n ...defaultRequestInstrumentationOptions,\n ..._options,\n };\n\n // We should cache url -> decision so that we don't have to compute\n // regexp everytime we create a request.\n const urlMap: Record<string, boolean> = {};\n\n const defaultShouldCreateSpan = (url: string): boolean => {\n if (urlMap[url]) {\n return urlMap[url];\n }\n const origins = tracingOrigins;\n urlMap[url] =\n origins.some((origin: string | RegExp) => isMatchingPattern(url, origin)) &&\n !isMatchingPattern(url, 'sentry_key');\n return urlMap[url];\n };\n\n // We want that our users don't have to re-implement shouldCreateSpanForRequest themselves\n // That's why we filter out already unwanted Spans from tracingOrigins\n let shouldCreateSpan = defaultShouldCreateSpan;\n if (typeof shouldCreateSpanForRequest === 'function') {\n shouldCreateSpan = (url: string) => {\n return defaultShouldCreateSpan(url) && shouldCreateSpanForRequest(url);\n };\n }\n\n const spans: Record<string, Span> = {};\n\n if (traceFetch) {\n addInstrumentationHandler({\n callback: (handlerData: FetchData) => {\n fetchCallback(handlerData, shouldCreateSpan, spans);\n },\n type: 'fetch',\n });\n }\n\n if (traceXHR) {\n addInstrumentationHandler({\n callback: (handlerData: XHRData) => {\n xhrCallback(handlerData, shouldCreateSpan, spans);\n },\n type: 'xhr',\n });\n }\n}\n\n/**\n * Create and track fetch request spans\n */\nexport function fetchCallback(\n handlerData: FetchData,\n shouldCreateSpan: (url: string) => boolean,\n spans: Record<string, Span>,\n): void {\n const currentClientOptions = getCurrentHub()\n .getClient()\n ?.getOptions();\n if (\n !(currentClientOptions && hasTracingEnabled(currentClientOptions)) ||\n !(handlerData.fetchData && shouldCreateSpan(handlerData.fetchData.url))\n ) {\n return;\n }\n\n if (handlerData.endTimestamp && handlerData.fetchData.__span) {\n const span = spans[handlerData.fetchData.__span];\n if (span) {\n const response = handlerData.response;\n if (response) {\n // TODO (kmclb) remove this once types PR goes through\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n span.setHttpStatus(response.status);\n }\n span.finish();\n\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete spans[handlerData.fetchData.__span];\n }\n return;\n }\n\n const activeTransaction = getActiveTransaction();\n if (activeTransaction) {\n const span = activeTransaction.startChild({\n data: {\n ...handlerData.fetchData,\n type: 'fetch',\n },\n description: `${handlerData.fetchData.method} ${handlerData.fetchData.url}`,\n op: 'http',\n });\n\n handlerData.fetchData.__span = span.spanId;\n spans[span.spanId] = span;\n\n const request = (handlerData.args[0] = handlerData.args[0] as string | Request);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const options = (handlerData.args[1] = (handlerData.args[1] as { [key: string]: any }) || {});\n let headers = options.headers;\n if (isInstanceOf(request, Request)) {\n headers = (request as Request).headers;\n }\n if (headers) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (typeof headers.append === 'function') {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n headers.append('sentry-trace', span.toTraceparent());\n } else if (Array.isArray(headers)) {\n headers = [...headers, ['sentry-trace', span.toTraceparent()]];\n } else {\n headers = { ...headers, 'sentry-trace': span.toTraceparent() };\n }\n } else {\n headers = { 'sentry-trace': span.toTraceparent() };\n }\n options.headers = headers;\n }\n}\n\n/**\n * Create and track xhr request spans\n */\nexport function xhrCallback(\n handlerData: XHRData,\n shouldCreateSpan: (url: string) => boolean,\n spans: Record<string, Span>,\n): void {\n const currentClientOptions = getCurrentHub()\n .getClient()\n ?.getOptions();\n if (\n !(currentClientOptions && hasTracingEnabled(currentClientOptions)) ||\n !(handlerData.xhr && handlerData.xhr.__sentry_xhr__ && shouldCreateSpan(handlerData.xhr.__sentry_xhr__.url)) ||\n handlerData.xhr.__sentry_own_request__\n ) {\n return;\n }\n\n const xhr = handlerData.xhr.__sentry_xhr__;\n\n // check first if the request has finished and is tracked by an existing span which should now end\n if (handlerData.endTimestamp && handlerData.xhr.__sentry_xhr_span_id__) {\n const span = spans[handlerData.xhr.__sentry_xhr_span_id__];\n if (span) {\n span.setHttpStatus(xhr.status_code);\n span.finish();\n\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete spans[handlerData.xhr.__sentry_xhr_span_id__];\n }\n return;\n }\n\n // if not, create a new span to track it\n const activeTransaction = getActiveTransaction();\n if (activeTransaction) {\n const span = activeTransaction.startChild({\n data: {\n ...xhr.data,\n type: 'xhr',\n method: xhr.method,\n url: xhr.url,\n },\n description: `${xhr.method} ${xhr.url}`,\n op: 'http',\n });\n\n handlerData.xhr.__sentry_xhr_span_id__ = span.spanId;\n spans[handlerData.xhr.__sentry_xhr_span_id__] = span;\n\n if (handlerData.xhr.setRequestHeader) {\n try {\n handlerData.xhr.setRequestHeader('sentry-trace', span.toTraceparent());\n } catch (_) {\n // Error: InvalidStateError: Failed to execute 'setRequestHeader' on 'XMLHttpRequest': The object's state must be OPENED.\n }\n }\n }\n}\n","import { Transaction as TransactionType, TransactionContext } from '@sentry/types';\nimport { addInstrumentationHandler, getGlobalObject, logger } from '@sentry/utils';\n\nconst global = getGlobalObject<Window>();\n\n/**\n * Default function implementing pageload and navigation transactions\n */\nexport function defaultRoutingInstrumentation<T extends TransactionType>(\n startTransaction: (context: TransactionContext) => T | undefined,\n startTransactionOnPageLoad: boolean = true,\n startTransactionOnLocationChange: boolean = true,\n): void {\n if (!global || !global.location) {\n logger.warn('Could not initialize routing instrumentation due to invalid location');\n return;\n }\n\n let startingUrl: string | undefined = global.location.href;\n\n let activeTransaction: T | undefined;\n if (startTransactionOnPageLoad) {\n activeTransaction = startTransaction({ name: global.location.pathname, op: 'pageload' });\n }\n\n if (startTransactionOnLocationChange) {\n addInstrumentationHandler({\n callback: ({ to, from }: { to: string; from?: string }) => {\n /**\n * This early return is there to account for some cases where a navigation transaction starts right after\n * long-running pageload. We make sure that if `from` is undefined and a valid `startingURL` exists, we don't\n * create an uneccessary navigation transaction.\n *\n * This was hard to duplicate, but this behavior stopped as soon as this fix was applied. This issue might also\n * only be caused in certain development environments where the usage of a hot module reloader is causing\n * errors.\n */\n if (from === undefined && startingUrl && startingUrl.indexOf(to) !== -1) {\n startingUrl = undefined;\n return;\n }\n\n if (from !== to) {\n startingUrl = undefined;\n if (activeTransaction) {\n logger.log(`[Tracing] Finishing current transaction with op: ${activeTransaction.op}`);\n // If there's an open transaction on the scope, we need to finish it before creating an new one.\n activeTransaction.finish();\n }\n activeTransaction = startTransaction({ name: global.location.pathname, op: 'navigation' });\n }\n },\n type: 'history',\n });\n }\n}\n","import { Hub } from '@sentry/hub';\nimport { EventProcessor, Integration, Transaction as TransactionType, TransactionContext } from '@sentry/types';\nimport { logger } from '@sentry/utils';\n\nimport { startIdleTransaction } from '../hubextensions';\nimport { DEFAULT_IDLE_TIMEOUT, IdleTransaction } from '../idletransaction';\nimport { SpanStatus } from '../spanstatus';\nimport { extractTraceparentData, secToMs } from '../utils';\nimport { registerBackgroundTabDetection } from './backgroundtab';\nimport { MetricsInstrumentation } from './metrics';\nimport {\n defaultRequestInstrumentationOptions,\n registerRequestInstrumentation,\n RequestInstrumentationOptions,\n} from './request';\nimport { defaultRoutingInstrumentation } from './router';\n\nexport const DEFAULT_MAX_TRANSACTION_DURATION_SECONDS = 600;\n\n/** Options for Browser Tracing integration */\nexport interface BrowserTracingOptions extends RequestInstrumentationOptions {\n /**\n * The time to wait in ms until the transaction will be finished. The transaction will use the end timestamp of\n * the last finished span as the endtime for the transaction.\n * Time is in ms.\n *\n * Default: 1000\n */\n idleTimeout: number;\n\n /**\n * Flag to enable/disable creation of `navigation` transaction on history changes.\n *\n * Default: true\n */\n startTransactionOnLocationChange: boolean;\n\n /**\n * Flag to enable/disable creation of `pageload` transaction on first pageload.\n *\n * Default: true\n */\n startTransactionOnPageLoad: boolean;\n\n /**\n * The maximum duration of a transaction before it will be marked as \"deadline_exceeded\".\n * If you never want to mark a transaction set it to 0.\n * Time is in seconds.\n *\n * Default: 600\n */\n maxTransactionDuration: number;\n\n /**\n * Flag Transactions where tabs moved to background with \"cancelled\". Browser background tab timing is\n * not suited towards doing precise measurements of operations. By default, we recommend that this option\n * be enabled as background transactions can mess up your statistics in nondeterministic ways.\n *\n * Default: true\n */\n markBackgroundTransactions: boolean;\n\n /**\n * beforeNavigate is called before a pageload/navigation transaction is created and allows users to modify transaction\n * context data, or drop the transaction entirely (by setting `sampled = false` in the context).\n *\n * Note: For legacy reasons, transactions can also be dropped by returning `undefined`.\n *\n * @param context: The context data which will be passed to `startTransaction` by default\n *\n * @returns A (potentially) modified context object, with `sampled = false` if the transaction should be dropped.\n */\n beforeNavigate?(context: TransactionContext): TransactionContext | undefined;\n\n /**\n * Instrumentation that creates routing change transactions. By default creates\n * pageload and navigation transactions.\n */\n routingInstrumentation<T extends TransactionType>(\n startTransaction: (context: TransactionContext) => T | undefined,\n startTransactionOnPageLoad?: boolean,\n startTransactionOnLocationChange?: boolean,\n ): void;\n}\n\nconst DEFAULT_BROWSER_TRACING_OPTIONS = {\n idleTimeout: DEFAULT_IDLE_TIMEOUT,\n markBackgroundTransactions: true,\n maxTransactionDuration: DEFAULT_MAX_TRANSACTION_DURATION_SECONDS,\n routingInstrumentation: defaultRoutingInstrumentation,\n startTransactionOnLocationChange: true,\n startTransactionOnPageLoad: true,\n ...defaultRequestInstrumentationOptions,\n};\n\n/**\n * The Browser Tracing integration automatically instruments browser pageload/navigation\n * actions as transactions, and captures requests, metrics and errors as spans.\n *\n * The integration can be configured with a variety of options, and can be extended to use\n * any routing library. This integration uses {@see IdleTransaction} to create transactions.\n */\nexport class BrowserTracing implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'BrowserTracing';\n\n /** Browser Tracing integration options */\n public options: BrowserTracingOptions;\n\n /**\n * @inheritDoc\n */\n public name: string = BrowserTracing.id;\n\n private _getCurrentHub?: () => Hub;\n\n private readonly _metrics: MetricsInstrumentation = new MetricsInstrumentation();\n\n private readonly _emitOptionsWarning: boolean = false;\n\n public constructor(_options?: Partial<BrowserTracingOptions>) {\n let tracingOrigins = defaultRequestInstrumentationOptions.tracingOrigins;\n // NOTE: Logger doesn't work in constructors, as it's initialized after integrations instances\n if (\n _options &&\n _options.tracingOrigins &&\n Array.isArray(_options.tracingOrigins) &&\n _options.tracingOrigins.length !== 0\n ) {\n tracingOrigins = _options.tracingOrigins;\n } else {\n this._emitOptionsWarning = true;\n }\n\n this.options = {\n ...DEFAULT_BROWSER_TRACING_OPTIONS,\n ..._options,\n tracingOrigins,\n };\n }\n\n /**\n * @inheritDoc\n */\n public setupOnce(_: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void {\n this._getCurrentHub = getCurrentHub;\n\n if (this._emitOptionsWarning) {\n logger.warn(\n '[Tracing] You need to define `tracingOrigins` in the options. Set an array of urls or patterns to trace.',\n );\n logger.warn(\n `[Tracing] We added a reasonable default for you: ${defaultRequestInstrumentationOptions.tracingOrigins}`,\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const {\n routingInstrumentation,\n startTransactionOnLocationChange,\n startTransactionOnPageLoad,\n markBackgroundTransactions,\n traceFetch,\n traceXHR,\n tracingOrigins,\n shouldCreateSpanForRequest,\n } = this.options;\n\n routingInstrumentation(\n (context: TransactionContext) => this._createRouteTransaction(context),\n startTransactionOnPageLoad,\n startTransactionOnLocationChange,\n );\n\n if (markBackgroundTransactions) {\n registerBackgroundTabDetection();\n }\n\n registerRequestInstrumentation({ traceFetch, traceXHR, tracingOrigins, shouldCreateSpanForRequest });\n }\n\n /** Create routing idle transaction. */\n private _createRouteTransaction(context: TransactionContext): TransactionType | undefined {\n if (!this._getCurrentHub) {\n logger.warn(`[Tracing] Did not create ${context.op} transaction because _getCurrentHub is invalid.`);\n return undefined;\n }\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const { beforeNavigate, idleTimeout, maxTransactionDuration } = this.options;\n\n const parentContextFromHeader = context.op === 'pageload' ? getHeaderContext() : undefined;\n\n const expandedContext = {\n ...context,\n ...parentContextFromHeader,\n trimEnd: true,\n };\n const modifiedContext = typeof beforeNavigate === 'function' ? beforeNavigate(expandedContext) : expandedContext;\n\n // For backwards compatibility reasons, beforeNavigate can return undefined to \"drop\" the transaction (prevent it\n // from being sent to Sentry).\n const finalContext = modifiedContext === undefined ? { ...expandedContext, sampled: false } : modifiedContext;\n\n if (finalContext.sampled === false) {\n logger.log(`[Tracing] Will not send ${finalContext.op} transaction because of beforeNavigate.`);\n }\n\n const hub = this._getCurrentHub();\n const idleTransaction = startIdleTransaction(hub, finalContext, idleTimeout, true);\n logger.log(`[Tracing] Starting ${finalContext.op} transaction on scope`);\n idleTransaction.registerBeforeFinishCallback((transaction, endTimestamp) => {\n this._metrics.addPerformanceEntries(transaction);\n adjustTransactionDuration(secToMs(maxTransactionDuration), transaction, endTimestamp);\n });\n\n return idleTransaction as TransactionType;\n }\n}\n\n/**\n * Gets transaction context from a sentry-trace meta.\n *\n * @returns Transaction context data from the header or undefined if there's no header or the header is malformed\n */\nexport function getHeaderContext(): Partial<TransactionContext> | undefined {\n const header = getMetaContent('sentry-trace');\n if (header) {\n return extractTraceparentData(header);\n }\n\n return undefined;\n}\n\n/** Returns the value of a meta tag */\nexport function getMetaContent(metaName: string): string | null {\n const el = document.querySelector(`meta[name=${metaName}]`);\n return el ? el.getAttribute('content') : null;\n}\n\n/** Adjusts transaction value based on max transaction duration */\nfunction adjustTransactionDuration(maxDuration: number, transaction: IdleTransaction, endTimestamp: number): void {\n const diff = endTimestamp - transaction.startTimestamp;\n const isOutdatedTransaction = endTimestamp && (diff > maxDuration || diff < 0);\n if (isOutdatedTransaction) {\n transaction.setStatus(SpanStatus.DeadlineExceeded);\n transaction.setTag('maxTransactionDurationExceeded', 'true');\n }\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Integration, Transaction } from '@sentry/types';\nimport { logger } from '@sentry/utils';\n\n// Have to manually set types because we are using package-alias\ntype Method =\n | 'all'\n | 'get'\n | 'post'\n | 'put'\n | 'delete'\n | 'patch'\n | 'options'\n | 'head'\n | 'checkout'\n | 'copy'\n | 'lock'\n | 'merge'\n | 'mkactivity'\n | 'mkcol'\n | 'move'\n | 'm-search'\n | 'notify'\n | 'purge'\n | 'report'\n | 'search'\n | 'subscribe'\n | 'trace'\n | 'unlock'\n | 'unsubscribe';\n\ntype Application = {\n [method in Method | 'use']: (...args: any) => any;\n};\n\ntype ErrorRequestHandler = (...args: any) => any;\ntype RequestHandler = (...args: any) => any;\ntype NextFunction = (...args: any) => any;\n\ninterface Response {\n once(name: string, callback: () => void): void;\n}\n\n/**\n * Internal helper for `__sentry_transaction`\n * @hidden\n */\ninterface SentryTracingResponse {\n __sentry_transaction?: Transaction;\n}\n\n/**\n * Express integration\n *\n * Provides an request and error handler for Express framework\n * as well as tracing capabilities\n */\nexport class Express implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'Express';\n\n /**\n * @inheritDoc\n */\n public name: string = Express.id;\n\n /**\n * Express App instance\n */\n private readonly _app?: Application;\n private readonly _methods?: Method[];\n\n /**\n * @inheritDoc\n */\n public constructor(options: { app?: Application; methods?: Method[] } = {}) {\n this._app = options.app;\n this._methods = options.methods;\n }\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n if (!this._app) {\n logger.error('ExpressIntegration is missing an Express instance');\n return;\n }\n instrumentMiddlewares(this._app);\n routeMiddlewares(this._app, this._methods);\n }\n}\n\n/**\n * Wraps original middleware function in a tracing call, which stores the info about the call as a span,\n * and finishes it once the middleware is done invoking.\n *\n * Express middlewares have 3 various forms, thus we have to take care of all of them:\n * // sync\n * app.use(function (req, res) { ... })\n * // async\n * app.use(function (req, res, next) { ... })\n * // error handler\n * app.use(function (err, req, res, next) { ... })\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction wrap(fn: Function): RequestHandler | ErrorRequestHandler {\n const arity = fn.length;\n\n switch (arity) {\n case 2: {\n return function(this: NodeJS.Global, req: Request, res: Response & SentryTracingResponse): any {\n const transaction = res.__sentry_transaction;\n addExpressReqToTransaction(transaction, req);\n if (transaction) {\n const span = transaction.startChild({\n description: fn.name,\n op: 'middleware',\n });\n res.once('finish', () => {\n span.finish();\n });\n }\n // eslint-disable-next-line prefer-rest-params\n return fn.apply(this, arguments);\n };\n }\n case 3: {\n return function(\n this: NodeJS.Global,\n req: Request,\n res: Response & SentryTracingResponse,\n next: NextFunction,\n ): any {\n const transaction = res.__sentry_transaction;\n addExpressReqToTransaction(transaction, req);\n const span =\n transaction &&\n transaction.startChild({\n description: fn.name,\n op: 'middleware',\n });\n fn.call(this, req, res, function(this: NodeJS.Global): any {\n if (span) {\n span.finish();\n }\n // eslint-disable-next-line prefer-rest-params\n return next.apply(this, arguments);\n });\n };\n }\n case 4: {\n return function(\n this: NodeJS.Global,\n err: any,\n req: Request,\n res: Response & SentryTracingResponse,\n next: NextFunction,\n ): any {\n const transaction = res.__sentry_transaction;\n addExpressReqToTransaction(transaction, req);\n const span =\n transaction &&\n transaction.startChild({\n description: fn.name,\n op: 'middleware',\n });\n fn.call(this, err, req, res, function(this: NodeJS.Global): any {\n if (span) {\n span.finish();\n }\n // eslint-disable-next-line prefer-rest-params\n return next.apply(this, arguments);\n });\n };\n }\n default: {\n throw new Error(`Express middleware takes 2-4 arguments. Got: ${arity}`);\n }\n }\n}\n\n/**\n * Set parameterized as transaction name e.g.: `GET /users/:id`\n * Also adds more context data on the transaction from the request\n */\nfunction addExpressReqToTransaction(transaction: Transaction | undefined, req: any): void {\n /* eslint-disable @typescript-eslint/no-unsafe-member-access */\n if (transaction) {\n if (req.route && req.route.path) {\n transaction.name = `${req.method} ${req.route.path}`;\n }\n transaction.setData('url', req.originalUrl);\n transaction.setData('baseUrl', req.baseUrl);\n transaction.setData('query', req.query);\n }\n /* eslint-enable @typescript-eslint/no-unsafe-member-access */\n}\n\n/**\n * Takes all the function arguments passed to the original `app.use` call\n * and wraps every function, as well as array of functions with a call to our `wrap` method.\n * We have to take care of the arrays as well as iterate over all of the arguments,\n * as `app.use` can accept middlewares in few various forms.\n *\n * app.use([<path>], <fn>)\n * app.use([<path>], <fn>, ...<fn>)\n * app.use([<path>], ...<fn>[])\n */\nfunction wrapUseArgs(args: IArguments): unknown[] {\n return Array.from(args).map((arg: unknown) => {\n if (typeof arg === 'function') {\n return wrap(arg);\n }\n\n if (Array.isArray(arg)) {\n return arg.map((a: unknown) => {\n if (typeof a === 'function') {\n return wrap(a);\n }\n return a;\n });\n }\n\n return arg;\n });\n}\n\n/**\n * Patches original App to utilize our tracing functionality\n */\nfunction patchMiddleware(app: Application, method: Method | 'use'): Application {\n const originalAppCallback = app[method];\n\n app[method] = function(): any {\n // eslint-disable-next-line prefer-rest-params\n return originalAppCallback.apply(this, wrapUseArgs(arguments));\n };\n\n return app;\n}\n\n/**\n * Patches original app.use\n */\nfunction instrumentMiddlewares(app: Application): void {\n patchMiddleware(app, 'use');\n}\n\n/**\n * Patches original app.METHOD\n */\nfunction routeMiddlewares(app: Application, methods: Method[] = []): void {\n methods.forEach(function(method: Method) {\n patchMiddleware(app, method);\n });\n}\n","import { BrowserTracing } from './browser';\nimport { addExtensionMethods } from './hubextensions';\nimport * as TracingIntegrations from './integrations';\n\nconst Integrations = { ...TracingIntegrations, BrowserTracing };\n\nexport { Integrations };\nexport { Span } from './span';\nexport { Transaction } from './transaction';\n\nexport { SpanStatus } from './spanstatus';\n\n// We are patching the global object with our hub extension methods\naddExtensionMethods();\n\nexport { addExtensionMethods };\n\nexport { extractTraceparentData, getActiveTransaction, hasTracingEnabled, stripUrlQueryAndFragment } from './utils';\n",null,null,null,null,null,null,null,"/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {isPrimitive} from '../lib/parts.js';\nimport {directive, Part} from '../lit-html.js';\n\ninterface AsyncState {\n /**\n * The last rendered index of a call to until(). A value only renders if its\n * index is less than the `lastRenderedIndex`.\n */\n lastRenderedIndex: number;\n\n values: unknown[];\n}\n\nconst _state = new WeakMap<Part, AsyncState>();\n// Effectively infinity, but a SMI.\nconst _infinity = 0x7fffffff;\n\n/**\n * Renders one of a series of values, including Promises, to a Part.\n *\n * Values are rendered in priority order, with the first argument having the\n * highest priority and the last argument having the lowest priority. If a\n * value is a Promise, low-priority values will be rendered until it resolves.\n *\n * The priority of values can be used to create placeholder content for async\n * data. For example, a Promise with pending content can be the first,\n * highest-priority, argument, and a non_promise loading indicator template can\n * be used as the second, lower-priority, argument. The loading indicator will\n * render immediately, and the primary content will render when the Promise\n * resolves.\n *\n * Example:\n *\n * const content = fetch('./content.txt').then(r => r.text());\n * html`${until(content, html`<span>Loading...</span>`)}`\n */\nexport const until = directive((...args: unknown[]) => (part: Part) => {\n let state = _state.get(part)!;\n if (state === undefined) {\n state = {\n lastRenderedIndex: _infinity,\n values: [],\n };\n _state.set(part, state);\n }\n const previousValues = state.values;\n let previousLength = previousValues.length;\n state.values = args;\n\n for (let i = 0; i < args.length; i++) {\n // If we've rendered a higher-priority value already, stop.\n if (i > state.lastRenderedIndex) {\n break;\n }\n\n const value = args[i];\n\n // Render non-Promise values immediately\n if (isPrimitive(value) ||\n typeof (value as {then?: unknown}).then !== 'function') {\n part.setValue(value);\n state.lastRenderedIndex = i;\n // Since a lower-priority value will never overwrite a higher-priority\n // synchronous value, we can stop processing now.\n break;\n }\n\n // If this is a Promise we've already handled, skip it.\n if (i < previousLength && value === previousValues[i]) {\n continue;\n }\n\n // We have a Promise that we haven't seen before, so priorities may have\n // changed. Forget what we rendered before.\n state.lastRenderedIndex = _infinity;\n previousLength = 0;\n\n Promise.resolve(value).then((resolvedValue: unknown) => {\n const index = state.values.indexOf(value);\n // If state.values doesn't contain the value, we've re-rendered without\n // the value, so don't render it. Then, only render if the value is\n // higher-priority than what's already been rendered.\n if (index > -1 && index < state.lastRenderedIndex) {\n state.lastRenderedIndex = index;\n part.setValue(resolvedValue);\n part.commit();\n }\n });\n }\n});\n",null,null,null,null,null,null],"names":["document","hasShadyCss","window","ShadyCSS","nativeShadow","deferredStyleSheets","deferredDocumentStyleElements","adoptedSheetsRegistry","WeakMap","sheetMetadataRegistry","locationRegistry","observerRegistry","appliedActionsCursorRegistry","state","loaded","frame","body","CSSStyleSheet","OldCSSStyleSheet","importPattern","cssStyleSheetMethods","cssStyleSheetNewMethods","ConstructStyleSheet","basicStyleElement","createElement","appendChild","head","disabled","push","nativeStyleSheet","sheet","set","adopters","Map","actions","_proto","prototype","replace","contents","_this","this","sanitized","rejectImports","Promise","resolve","reject","has","get","innerHTML","updateAdopters","Error","replaceSync","Object","defineProperty","Symbol","hasInstance","configurable","value","instanceOfStyleSheet","updatePrototype","adoptedStyleSheetAccessors","sheets","oldSheets","container","locationType","Array","isArray","TypeError","every","uniqueSheets","filter","index","indexOf","checkAndPrepare","location","isDocumentLoading","isConnected","contains","requestAnimationFrame","adoptStyleSheets","getAdoptedStyleSheet","i","len","length","observer","styleElement","disconnect","parentNode","removeChild","observe","removeExcludedStyleSheets","Document","ShadowRoot","attachShadow","Element","apply","arguments","createObserver","initAdoptedStyleSheets","addEventListener","initPolyfill","instance","readyState","documentElement","imports","match","sheetContent","console","warn","forEach","_import","proto","methodKey","oldMethod","args","result","_sheetMetadataRegistr","_sheetMetadataRegistr2","newStyles","createDocumentFragment","elementToAdopt","cssText","insertBefore","firstChild","_i","_len","_adopters","adoptedStyleElement","cursor","_i2","_len2","_actions$_i","key","adoptAndRestoreStylesOnMutationCallback","mutations","_mutations$i","addedNodes","removedNodes","iter","createNodeIterator","NodeFilter","SHOW_ELEMENT","node","shadowRoot","adoptedStyleSheets","FILTER_ACCEPT","FILTER_REJECT","nextNode","MutationObserver","observerTool","childList","subtree","iframe","hidden","contentWindow","fragment","extendStatics","d","b","setPrototypeOf","__proto__","p","hasOwnProperty","call","__extends","__","constructor","create","__assign","assign","t","s","n","__decorate","decorators","target","desc","c","r","getOwnPropertyDescriptor","Reflect","decorate","__values","o","iterator","m","next","done","__read","e","ar","error","__spread","concat","isCEPolyfill","customElements","undefined","polyfillWrapFlushCallback","removeNodes","start","end","nextSibling","marker","String","Math","random","slice","nodeMarker","markerRegex","RegExp","Template","[object Object]","element","nodesToRemove","stack","walker","createTreeWalker","content","lastPartIndex","partIndex","strings","values","nodeType","hasAttributes","attributes","count","endsWith","name","stringForPart","lastAttributeNameRegex","exec","attributeLookupName","toLowerCase","attributeValue","getAttribute","removeAttribute","statics","split","parts","type","tagName","currentNode","data","parent","lastIndex","insert","createMarker","createTextNode","previousSibling","pop","str","suffix","isTemplatePartActive","part","createComment","removeNodesFromTemplate","template","nextActiveIndexInTemplateParts","nodeIndex","removeCount","nodesToRemoveInTemplate","currentRemovingNode","countNodes","startIndex","directives","isDirective","noChange","nothing","TemplateInstance","processor","options","__parts","setValue","commit","cloneNode","importNode","nodeName","handleTextExpression","insertAfterNode","handleAttributeExpressions","adoptNode","upgrade","policy","trustedTypes","createPolicy","createHTML","commentMarker","TemplateResult","l","html","isCommentBinding","commentOpen","lastIndexOf","attributeMatch","substr","getHTML","isPrimitive","isIterable","AttributeCommitter","_createPart","AttributePart","v","text","dirty","setAttribute","_getValue","committer","directive","NodePart","startNode","endNode","ref","__insert","__pendingValue","__commitText","__commitTemplateResult","Node","__commitNode","__commitIterable","clear","valueAsString","templateFactory","update","_clone","itemParts","itemPart","item","appendIntoPart","insertAfterPart","BooleanAttributePart","PropertyCommitter","super","single","PropertyPart","eventOptionsSupported","capture","removeEventListener","_e","EventPart","eventName","eventContext","__boundHandleEvent","handleEvent","newListener","oldListener","shouldRemoveListener","once","passive","shouldAddListener","__options","getOptions","event","templateCache","templateCaches","stringsArray","keyString","join","getTemplateElement","defaultTemplateProcessor","prefix","getTemplateCacheKey","scopeName","compatibleShadyCSSVersion","prepareTemplateDom","shadyTemplateFactory","cacheKey","TEMPLATE_TYPES","shadyRenderSet","Set","prepareTemplateStyles","renderedDOM","add","templateElement","styles","querySelectorAll","condensedStyle","style","textContent","templates","from","removeStylesFromLitTemplates","refNode","insertCount","walkerIndex","insertNodeIntoTemplate","querySelector","removes","JSCompiler_renameProperty","prop","_obj","defaultConverter","Boolean","JSON","stringify","Number","parse","notEqual","old","defaultPropertyDeclaration","attribute","converter","reflect","hasChanged","UpdatingElement","HTMLElement","initialize","observedAttributes","finalize","_classProperties","attr","_attributeNameForProperty","_attributeToPropertyMap","superProperties","getPrototypeOf","k","_ensureClassProperties","noAccessor","descriptor","getPropertyDescriptor","oldValue","requestUpdateInternal","enumerable","superCtor","props","properties","propKeys","getOwnPropertyNames","getOwnPropertySymbols","createProperty","fromAttribute","toAttribute","_updateState","_updatePromise","res","_enableUpdatingResolver","_changedProperties","_saveInstanceProperties","_v","_instanceProperties","enableUpdating","_attributeToProperty","ctor","attrValue","_propertyValueToAttribute","propName","getPropertyOptions","_propertyValueFromAttribute","shouldRequestUpdate","_valueHasChanged","_reflectingProperties","_hasRequestedUpdate","_enqueueUpdate","updateComplete","performUpdate","hasUpdated","_applyInstanceProperties","shouldUpdate","changedProperties","_markUpdated","firstUpdated","updated","_getUpdateComplete","size","_propertyToAttribute","customElement","classOrDescriptor","clazz","define","legacyCustomElement","kind","elements","standardCustomElement","standardProperty","placement","initializer","property","protoOrDescriptor","legacyProperty","supportsAdoptingStyleSheets","constructionToken","CSSResult","safeToken","styleSheet","_styleSheet","css","reduce","acc","idx","textFromCSSResult","renderNotImplemented","LitElement","userStyles","getStyles","addStyles","reduceRight","unshift","_styles","map","cssRules","rule","_getUniqueStyles","renderRoot","createRenderRoot","adoptStyles","mode","_needsShimAdoptedStyleSheets","ScopingShim","prepareAdoptedCssText","localName","connectedCallback","templateResult","render","hasRendered","needsScoping","host","firstScopeRender","renderContainer","appendInto","litRender","delete","ColorStyles","SpinnerButton","classList","GlobalsStyle","ButtonStyle","SpinnerStyle","isRunning","requestUpdate","statusClass","remove","setTimeout","form","submit","setLoading","toString","callAction","ActionButton","csrftoken","cookieValue","cookie","cookies","trim","substring","decodeURIComponent","getCookie","request","Request","url","headers","X-CSRFToken","fetch","method","then","json","setDone","catch","module","hookCallback","some","hooks","setHookCallback","callback","input","isObject","hasOwnProp","a","isObjectEmpty","obj","isUndefined","isNumber","isDate","Date","arr","fn","extend","valueOf","createUTC","format","locale","strict","createLocalOrUTC","utc","defaultParsingFlags","empty","unusedTokens","unusedInput","overflow","charsLeftOver","nullInput","invalidEra","invalidMonth","invalidFormat","userInvalidated","iso","parsedDateParts","era","meridiem","rfc2822","weekdayMismatch","getParsingFlags","_pf","isValid","_isValid","flags","parsedParts","isNowValid","isNaN","_d","getTime","invalidWeekday","_strict","bigHour","isFrozen","createInvalid","NaN","fun","momentProperties","updateInProgress","copyConfig","to","val","_isAMomentObject","_f","_l","_tzm","_isUTC","_offset","_locale","Moment","config","updateOffset","isMoment","msg","suppressDeprecationWarnings","deprecate","firstTime","deprecationHandler","arg","keys","deprecations","deprecateSimple","isFunction","Function","_config","_dayOfMonthOrdinalParseLenient","_dayOfMonthOrdinalParse","source","_ordinalParse","mergeConfigs","parentConfig","childConfig","Locale","defaultCalendar","sameDay","nextDay","nextWeek","lastDay","lastWeek","sameElse","calendar","mom","now","output","_calendar","zeroFill","number","targetLength","forceSign","absNumber","abs","zerosToFill","pow","max","formattingTokens","localFormattingTokens","formatFunctions","formatTokenFunctions","addFormatToken","token","padded","ordinal","func","localeData","removeFormattingTokens","makeFormatFunction","array","formatMoment","expandFormat","invalidDate","replaceLongDateFormatTokens","longDateFormat","test","defaultLongDateFormat","LTS","LT","L","LL","LLL","LLLL","_longDateFormat","formatUpper","toUpperCase","tok","defaultInvalidDate","_invalidDate","defaultOrdinal","defaultDayOfMonthOrdinalParse","_ordinal","defaultRelativeTime","future","past","ss","mm","h","hh","dd","w","ww","M","MM","y","yy","relativeTime","withoutSuffix","string","isFuture","_relativeTime","pastFuture","diff","aliases","addUnitAlias","unit","shorthand","lowerCase","normalizeUnits","units","normalizeObjectUnits","inputObject","normalizedProp","normalizedInput","priorities","addUnitPriority","priority","getPrioritizedUnits","unitsObj","u","sort","isLeapYear","year","absFloor","ceil","floor","toInt","argumentForCoercion","coercedNumber","isFinite","makeGetSet","keepTime","set$1","month","date","daysInMonth","stringGet","stringSet","prioritized","regexes","match1","match2","match3","match4","match6","match1to2","match3to4","match5to6","match1to3","match1to4","match1to6","matchUnsigned","matchSigned","matchOffset","matchShortOffset","matchTimestamp","matchWord","addRegexToken","regex","strictRegex","isStrict","getParseRegexForToken","unescapeFormat","regexEscape","matched","p1","p2","p3","p4","tokens","addParseToken","addWeekParseToken","_w","addTimeToArrayFromToken","_a","YEAR","MONTH","DATE","HOUR","MINUTE","SECOND","MILLISECOND","WEEK","WEEKDAY","mod","x","modMonth","monthsShort","months","monthsShortRegex","monthsRegex","monthsParse","defaultLocaleMonths","defaultLocaleMonthsShort","MONTHS_IN_FORMAT","defaultMonthsShortRegex","defaultMonthsRegex","localeMonths","_months","isFormat","localeMonthsShort","_monthsShort","handleStrictParse","monthName","ii","llc","toLocaleLowerCase","_monthsParse","_longMonthsParse","_shortMonthsParse","localeMonthsParse","_monthsParseExact","setMonth","dayOfMonth","min","getSetMonth","getDaysInMonth","computeMonthsParse","_monthsShortStrictRegex","_monthsShortRegex","_monthsStrictRegex","_monthsRegex","cmpLenRev","shortPieces","longPieces","mixedPieces","daysInYear","parseTwoDigitYear","parseInt","getSetYear","getIsLeapYear","createDate","ms","getFullYear","setFullYear","createUTCDate","UTC","getUTCFullYear","setUTCFullYear","firstWeekOffset","dow","doy","fwd","getUTCDay","dayOfYearFromWeeks","week","weekday","resYear","resDayOfYear","dayOfYear","weekOfYear","resWeek","weekOffset","weeksInYear","weekOffsetNext","localeWeek","_week","defaultLocaleWeek","localeFirstDayOfWeek","localeFirstDayOfYear","getSetWeek","getSetISOWeek","parseWeekday","weekdaysParse","parseIsoWeekday","shiftWeekdays","ws","weekdaysMin","weekdaysShort","weekdays","weekdaysMinRegex","weekdaysShortRegex","weekdaysRegex","defaultLocaleWeekdays","defaultLocaleWeekdaysShort","defaultLocaleWeekdaysMin","defaultWeekdaysRegex","defaultWeekdaysShortRegex","defaultWeekdaysMinRegex","localeWeekdays","_weekdays","day","localeWeekdaysShort","_weekdaysShort","localeWeekdaysMin","_weekdaysMin","handleStrictParse$1","weekdayName","_weekdaysParse","_shortWeekdaysParse","_minWeekdaysParse","localeWeekdaysParse","_weekdaysParseExact","_fullWeekdaysParse","getSetDayOfWeek","getDay","getSetLocaleDayOfWeek","getSetISODayOfWeek","computeWeekdaysParse","_weekdaysStrictRegex","_weekdaysRegex","_weekdaysShortStrictRegex","_weekdaysShortRegex","_weekdaysMinStrictRegex","_weekdaysMinRegex","minp","shortp","longp","minPieces","hFormat","hours","kFormat","lowercase","minutes","matchMeridiem","_meridiemParse","localeIsPM","charAt","seconds","kInput","_isPm","isPM","_meridiem","pos","pos1","pos2","defaultLocaleMeridiemParse","getSetHour","localeMeridiem","isLower","globalLocale","baseConfig","dayOfMonthOrdinalParse","meridiemParse","locales","localeFamilies","commonPrefix","arr1","arr2","minl","normalizeLocale","chooseLocale","names","j","loadLocale","oldLocale","exports","_abbr","require","getSetGlobalLocale","getLocale","defineLocale","abbr","parentLocale","updateLocale","tmpLocale","listLocales","checkOverflow","_overflowDayOfYear","_overflowWeeks","_overflowWeekday","extendedIsoRegex","basicIsoRegex","tzRegex","isoDates","isoTimes","aspNetJsonRegex","obsOffsets","UT","GMT","EDT","EST","CDT","CST","MDT","MST","PDT","PST","configFromISO","allowTime","dateFormat","timeFormat","tzFormat","configFromStringAndFormat","extractFromRFC2822Strings","yearStr","monthStr","dayStr","hourStr","minuteStr","secondStr","untruncateYear","preprocessRFC2822","checkWeekday","weekdayStr","parsedInput","calculateOffset","obsOffset","militaryOffset","numOffset","hm","configFromRFC2822","parsedArray","setUTCMinutes","getUTCMinutes","configFromString","createFromInputFallback","defaults","currentDateArray","nowValue","_useUTC","getUTCMonth","getUTCDate","getMonth","getDate","configFromArray","currentDate","expectedWeekday","yearToUse","dayOfYearFromWeekInfo","_dayOfYear","_nextDay","weekYear","temp","weekdayOverflow","curWeek","GG","W","E","createLocal","gg","ISO_8601","RFC_2822","skipped","stringLength","totalParsedInputLength","meridiemFixWrap","erasConvertYear","hour","isPm","meridiemHour","configFromStringAndArray","tempConfig","bestMoment","scoreToBeat","currentScore","validFormatFound","bestFormatIsValid","score","configFromObject","dayOrDate","minute","second","millisecond","createFromConfig","prepareConfig","preparse","configFromInput","isUTC","prototypeMin","other","prototypeMax","pickBy","moments","ordering","isDurationValid","unitHasDecimal","parseFloat","isValid$1","createInvalid$1","createDuration","Duration","duration","years","quarters","quarter","weeks","isoWeek","days","milliseconds","_milliseconds","_days","_data","_bubble","isDuration","absRound","round","compareArrays","array1","array2","dontConvert","lengthDiff","diffs","offset","separator","utcOffset","sign","offsetFromString","chunkOffset","matcher","matches","cloneWithOffset","model","clone","setTime","local","getDateOffset","getTimezoneOffset","getSetOffset","keepLocalTime","keepMinutes","localAdjust","_changeInProgress","addSubtract","getSetZone","setOffsetToUTC","setOffsetToLocal","subtract","setOffsetToParsedOffset","tZone","hasAlignedHourOffset","isDaylightSavingTime","isDaylightSavingTimeShifted","_isDSTShifted","toArray","isLocal","isUtcOffset","isUtc","aspNetRegex","isoRegex","ret","diffRes","parseIso","momentsDifference","inp","positiveMomentsDifference","base","isAfter","isBefore","createAdder","direction","period","tmp","isAdding","invalid","isString","isMomentInput","isNumberOrStringArray","isMomentInputObject","objectTest","propertyTest","arrayTest","dataTypeTest","isCalendarSpec","getCalendarFormat","myMoment","calendar$1","time","formats","sod","startOf","calendarFormat","localInput","endOf","isBetween","inclusivity","localFrom","localTo","isSame","inputMs","isSameOrAfter","isSameOrBefore","asFloat","that","zoneDelta","monthDiff","wholeMonthDiff","anchor","toISOString","keepOffset","toDate","inspect","datetime","zone","inputString","defaultFormatUtc","defaultFormat","postformat","humanize","fromNow","toNow","newLocaleData","lang","MS_PER_SECOND","MS_PER_MINUTE","MS_PER_HOUR","MS_PER_400_YEARS","mod$1","dividend","divisor","localStartOfDate","utcStartOfDate","startOfDate","isoWeekday","unix","toObject","toJSON","isValid$2","parsingFlags","invalidAt","creationData","localeEras","eras","_eras","since","until","localeErasParse","eraName","narrow","localeErasConvertYear","dir","getEraName","getEraNarrow","getEraAbbr","getEraYear","erasNameRegex","computeErasParse","_erasNameRegex","_erasRegex","erasAbbrRegex","_erasAbbrRegex","erasNarrowRegex","_erasNarrowRegex","matchEraAbbr","matchEraName","matchEraNarrow","matchEraYearOrdinal","_eraYearOrdinalRegex","abbrPieces","namePieces","narrowPieces","addWeekYearFormatToken","getter","getSetWeekYear","getSetWeekYearHelper","getSetISOWeekYear","getISOWeeksInYear","getISOWeeksInISOWeekYear","isoWeekYear","getWeeksInYear","weekInfo","getWeeksInWeekYear","weeksTarget","setWeekAll","dayOfYearData","getSetQuarter","erasParse","eraYearOrdinalParse","getSetDayOfMonth","getSetDayOfYear","getSetMinute","getSetMillisecond","getSetSecond","parseMs","getZoneAbbr","getZoneName","createUnix","createInZone","parseZone","preParsePostFormat","for","eraNarrow","eraAbbr","eraYear","isoWeeks","weeksInWeekYear","isoWeeksInYear","isoWeeksInISOWeekYear","isDST","zoneAbbr","zoneName","dates","isDSTShifted","proto$1","get$1","field","setter","listMonthsImpl","out","listWeekdaysImpl","localeSorted","shift","listMonths","listMonthsShort","listWeekdays","listWeekdaysShort","listWeekdaysMin","firstDayOfYear","firstDayOfWeek","langData","mathAbs","addSubtract$1","add$1","subtract$1","absCeil","bubble","monthsFromDays","monthsToDays","daysToMonths","as","valueOf$1","makeAs","alias","asMilliseconds","asSeconds","asMinutes","asHours","asDays","asWeeks","asMonths","asQuarters","asYears","clone$1","get$2","makeGetter","thresholds","substituteTimeAgo","relativeTime$1","posNegDuration","getSetRelativeTimeRounding","roundingFunction","getSetRelativeTimeThreshold","threshold","limit","argWithSuffix","argThresholds","withSuffix","th","abs$1","toISOString$1","totalSign","ymSign","daysSign","hmsSign","total","toFixed","proto$2","toIsoString","version","relativeTimeRounding","relativeTimeThreshold","HTML5_FMT","DATETIME_LOCAL","DATETIME_LOCAL_SECONDS","DATETIME_LOCAL_MS","TIME","TIME_SECONDS","TIME_MS","factory","moment","createCommonjsModule","getCjsExportFromNamespace","colorName","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","conversions","reverseKeywords","convert","rgb","channels","labels","hsl","hsv","hwb","cmyk","xyz","lab","lch","hex","keyword","ansi16","ansi256","hcg","apple","comparativeDistance","g","delta","rdif","gdif","bdif","diffc","reversed","currentClosestKeyword","currentClosestDistance","Infinity","distance","z","t1","t2","t3","smin","lmin","hi","f","q","sl","vmin","wh","bl","ratio","y2","x2","z2","atan2","PI","sqrt","hr","cos","sin","ansi","color","mult","rem","colorString","char","integer","hue","chroma","pure","mg","buildGraph","graph","models","deriveBFS","fromModel","queue","current","adjacents","adjacent","link","wrapConversion","toModel","path","cur","conversion","route","wrapRaw","wrappedFn","wrapRounded","routes","raw","colorConvert","colorName$1","getRgba","getHsla","getRgb","getHsl","getHwb","getAlpha","hexString","rgbString","rgbaString","percentString","percentaString","hslString","hslaString","hwbString","rgba","per","hexAlpha","scale","alpha","hsla","vals","hexDouble","reverseNames","num","Color","valid","setValues","lightness","whiteness","setSpace","rgbArray","hslArray","hsvArray","hwbArray","cmykArray","rgbaArray","hslaArray","setChannel","saturation","saturationv","blackness","rgbNumber","luminosity","lum","chan","contrast","color2","lum1","lum2","level","contrastRatio","dark","light","negate","lighten","darken","saturate","desaturate","whiten","blacken","greyscale","clearer","opaquer","rotate","degrees","mix","mixinColor","weight","color1","w1","w2","spaces","maxes","getValues","space","capped","chans","sname","svalues","chartjsColor","isValidKey","id","helpers","noop","uid","isNullOrUndef","valueOrDefault","defaultValue","valueAtIndexOrDefault","thisArg","each","loopable","reverse","arrayEquals","a0","a1","ilen","v0","v1","klen","_merger","tval","sval","merge","_mergerIf","mergeIf","sources","merger","dst","src","inherits","extensions","me","ChartElement","Surrogate","__super__","_deprecated","scope","previous","helpers_core","callCallback","fromIndex","getValueOrDefault","getValueAtIndexOrDefault","effects","linear","easeInQuad","easeOutQuad","easeInOutQuad","easeInCubic","easeOutCubic","easeInOutCubic","easeInQuart","easeOutQuart","easeInOutQuart","easeInQuint","easeOutQuint","easeInOutQuint","easeInSine","easeOutSine","easeInOutSine","easeInExpo","easeOutExpo","easeInOutExpo","easeInCirc","easeOutCirc","easeInOutCirc","easeInElastic","asin","easeOutElastic","easeInOutElastic","easeInBack","easeOutBack","easeInOutBack","easeInBounce","easeOutBounce","easeInOutBounce","helpers_easing","easingEffects","RAD_PER_DEG","DOUBLE_PI","HALF_PI","QUARTER_PI","TWO_THIRDS_PI","exports$1","chart","ctx","clearRect","width","height","roundedRect","radius","left","top","right","bottom","moveTo","arc","closePath","rect","drawPoint","rotation","xOffset","yOffset","cornerRadius","rad","save","translate","drawImage","restore","beginPath","lineTo","SQRT1_2","fill","stroke","_isPointInArea","point","area","epsilon","clipArea","clip","unclipArea","flip","stepped","steppedLine","midpoint","tension","bezierCurveTo","controlPointPreviousX","controlPointNextX","controlPointPreviousY","controlPointNextY","helpers_canvas","drawRoundedRectangle","_set","defaultColor","defaultFontColor","defaultFontFamily","defaultFontSize","defaultFontStyle","defaultLineHeight","showLines","core_defaults","toFontString","font","family","helpers_options","toLineHeight","toPadding","_parseFont","globalDefaults","global","fontSize","fontFamily","lineHeight","fontStyle","inputs","context","info","cacheable","exports$2","_factorize","log10","exponent","log","LOG10E","powerOf10","helpers_math","getRtlAdapter","rectX","setWidth","textAlign","align","xPlus","leftForLtr","itemWidth","getLtrAdapter","_itemWidth","helpers$1","easing","canvas","math","rtl","overrideTextDirection","original","getPropertyValue","getPropertyPriority","setProperty","prevTextDirection","restoreTextDirection","interpolate","view","ease","actual","origin","c0","c1","configuration","_type","pivot","_view","_model","_start","transition","tooltipPosition","hasValue","core_element","exports$3","currentStep","numSteps","onAnimationProgress","onAnimationComplete","core_animation","animation","onProgress","onComplete","core_animations","animations","addAnimation","lazy","startTime","animating","cancelAnimation","findIndex","splice","requestAnimFrame","startDigest","advance","nextStep","arrayEvents","listenArrayEvents","listener","_chartjs","listeners","object","unlistenArrayEvents","stub","DatasetController","datasetIndex","datasetElementType","dataElementType","_datasetElementOptions","_dataElementOptions","linkScales","addElements","getMeta","updateIndex","meta","scales","dataset","getDataset","scalesOpts","xAxisID","xAxes","yAxisID","yAxes","datasets","getDatasetMeta","getScaleForId","scaleID","_getValueScaleId","_getIndexScaleId","_getValueScale","_getIndexScale","reset","_update","destroy","createMetaDataset","_chart","_datasetIndex","createMetaData","_index","metaData","addElementAndReset","updateElement","buildOrUpdateElements","isExtensible","resyncElements","_configure","_cachedDataOpts","easingValue","draw","getStyle","_resolveDatasetElementOptions","_resolveDataElementOptions","backgroundColor","borderColor","hover","readKey","datasetOpts","custom","elementOptions","cached","dataIndex","freeze","removeHoverStyle","$previousStyle","setHoverStyle","getHoverColor","borderWidth","hoverBackgroundColor","hoverBorderColor","hoverBorderWidth","_removeDatasetHoverStyle","_setDatasetHoverStyle","hoverOptions","prev","numMeta","numData","insertElements","onDataPush","onDataPop","onDataShift","onDataSplice","onDataUnshift","core_datasetController","TAU","clipArc","startAngle","endAngle","pixelMargin","angleMargin","outerRadius","innerRadius","drawFullCircleBorders","vm","inner","fullCircles","drawBorder","borderAlign","lineWidth","lineJoin","element_arc","inLabelRange","mouseX","hoverRadius","inRange","chartX","chartY","pointRelativePosition","getAngleFromPoint","angle","betweenAngles","withinRadius","getCenterPoint","halfAngle","halfRadius","getArea","centreAngle","rangeFromCentre","circumference","fillStyle","strokeStyle","valueOrDefault$1","line","borderCapStyle","borderDash","borderDashOffset","borderJoinStyle","capBezierPoints","element_line","currentVM","spanGaps","points","_children","globalOptionLineElements","lastDrawnIndex","_loop","previousItem","skip","lineCap","setLineDash","lineDashOffset","valueOrDefault$2","defaultColor$1","xRange","hitRadius","yRange","mouseY","pointStyle","element_point","inXRange","inYRange","padding","chartArea","defaultColor$2","isVertical","getBarBounds","x1","y1","half","swap","orig","v2","parseBorderSkipped","edge","borderSkipped","horizontal","parseBorderWidth","maxW","maxH","boundingRects","bounds","border","outer","skipX","skipY","rectangle","element_rectangle","rects","fillRect","Arc","Line","Point","Rectangle","deprecated","valueOrDefault$3","computeMinSampleSize","pixels","curr","_length","getTicks","getPixelForTick","computeFitCategoryTraits","ruler","thickness","barThickness","stackCount","categoryPercentage","barPercentage","chunk","computeFlexCategoryTraits","percent","gridLines","offsetGridLines","bar","controller_bar","scaleOpts","minBarLength","maxBarThickness","_ruler","getRuler","_xScale","_yScale","datasetLabel","label","_updateElementGeometry","vscale","getBasePixel","isHorizontal","vpixels","calculateBarValuePixels","ipixels","calculateBarIndexPixels","center","_getStacks","last","metasets","_getMatchingVisibleMetas","stacked","stacks","getStackCount","getStackIndex","getPixelForValue","_startPixel","_endPixel","imeta","ivalue","stackLength","_parseValue","range","stackIndex","indexOpts","valueOpts","valueOrDefault$4","resolve$1","position","tooltips","callbacks","title","dataPoint","xLabel","yLabel","controller_bubble","xScale","yScale","dsIndex","getPixelForDecimal","_options","valueOrDefault$5","PI$1","DOUBLE_PI$1","HALF_PI$1","animateRotate","animateScale","legendCallback","listItem","list","outerHTML","legend","generateLabels","controller","onClick","legendItem","cutoutPercentage","tooltipItem","dataLabel","controller_doughnut","getRingIndex","ringIndex","isDatasetVisible","maxWidth","maxHeight","opts","ratioX","ratioY","offsetX","offsetY","arcs","cutout","chartWeight","_getRingWeight","startX","startY","endX","endY","contains0","contains90","contains270","minX","minY","maxX","maxY","getMaxBorderWidth","radiusLength","_getVisibleDatasetWeightTotal","calculateTotal","_getRingWeightOffset","animationOpts","centerX","centerY","calculateCircumference","hoverWidth","ringWeightOffset","dataSetIndex","axis","horizontalBar","controller_horizontalBar","valueOrDefault$6","resolve$2","isPointInArea","scaleClip","halfBorderWidth","tickOpts","ticks","defaultClip","toClip","controller_line","showLine","_showLine","lineTension","_scale","updateBezierControlPoints","lineModel","calculatePointY","lineOptions","ds","dsMeta","stackedRightValue","rightValue","sumPos","sumNeg","getRightValue","_getSortedVisibleDatasetMetas","controlPoints","capControlPoint","pt","cubicInterpolationMode","splineCurveMonotone","splineCurve","nextItem","resolve$3","angleLines","display","circular","pointLabels","beginAtZero","controller_polarArea","starts","_starts","angles","_angles","_updateRadius","countVisibleElements","_computeAngle","minSize","getVisibleDatasetCount","xCenter","yCenter","datasetStartAngle","getDistanceFromCenterForValue","resetRadius","doughnut","controller_pie","valueOrDefault$7","controller_radar","pointPosition","getPointPositionForValue","scatter","controllers","polarArea","pie","radar","getRelativePosition","native","parseVisibleItems","handler","metadata","jlen","getIntersectItems","getNearestItems","intersect","distanceMetric","minDistance","POSITIVE_INFINITY","nearestItems","getDistanceMetricForAxis","useX","useY","pt1","pt2","deltaX","deltaY","indexMode","items","core_interaction","modes","x-axis","nearest","intersectsItem","filterByPosition","where","sortByWeight","wrapBoxes","boxes","box","layoutBoxes","setLayoutDims","layouts","params","layout","fullWidth","availableWidth","vBoxMaxWidth","hBoxMaxHeight","buildLayoutBoxes","leftAndTop","rightAndBottom","vertical","getCombinedMax","maxPadding","updateDims","newWidth","newHeight","getPadding","boxPadding","outerWidth","outerHeight","sizes","handleMaxPadding","updatePos","change","getMargins","marginForPositions","positions","margin","fitBoxes","refit","changed","refitBoxes","placeBoxes","userPadding","core_layouts","addBox","_layers","removeBox","layoutItem","configure","layoutOptions","availableHeight","verticalBoxes","horizontalBoxes","platform_basic","acquireContext","getContext","platform_dom","stylesheet","default","EXPANDO_KEY","CSS_PREFIX","CSS_SIZE_MONITOR","CSS_RENDER_MONITOR","CSS_RENDER_ANIMATION","ANIMATION_START_EVENTS","EVENT_TYPES","touchstart","touchmove","touchend","pointerenter","pointerdown","pointermove","pointerup","pointerleave","pointerout","readUsedSize","initCanvas","renderHeight","renderWidth","initial","displayWidth","aspectRatio","displayHeight","eventListenerOptions","supports","addListener","removeListener","createEvent","nativeEvent","fromNativeEvent","throttled","ticking","createDiv","cls","el","className","createResizer","maxSize","resizer","expand","shrink","_reset","scrollLeft","scrollTop","onScroll","bind","watchForRender","expando","proxy","renderProxy","animationName","reflow","offsetParent","unwatchForRender","addResizeListener","maintainAspectRatio","clientWidth","removeResizeListener","injectCSS","rootNode","containsStyles","platform_dom$2","disableCSSInjection","_enabled","_ensureLoaded","root","getRootNode","getElementById","releaseContext","proxies","addEvent","removeEvent","implementation","platform","plugins","core_plugins","_plugins","_cacheId","register","plugin","unregister","getAll","notify","hook","descriptors","cache","$plugins","_invalidate","core_scaleService","constructors","registerScaleType","scaleConstructor","scaleDefaults","getScaleConstructor","getScaleDefaults","updateScaleDefaults","additions","addScalesToLayout","valueOrDefault$8","getRtlHelper","enabled","titleFontStyle","titleSpacing","titleMarginBottom","titleFontColor","titleAlign","bodySpacing","bodyFontColor","bodyAlign","footerFontStyle","footerSpacing","footerMarginTop","footerFontColor","footerAlign","yPadding","xPadding","caretPadding","caretSize","multiKeyBackground","displayColors","beforeTitle","tooltipItems","labelCount","afterTitle","beforeBody","beforeLabel","labelColor","labelTextColor","afterLabel","afterBody","beforeFooter","footer","afterFooter","positioners","average","eventPosition","nearestElement","distanceBetweenPoints","tp","pushOrConcat","toPush","splitNewlines","createTooltipItem","indexScale","valueScale","getLabelForIndex","getBaseModel","tooltipOpts","xAlign","yAlign","textDirection","_bodyFontFamily","bodyFontFamily","_bodyFontStyle","bodyFontStyle","_bodyAlign","bodyFontSize","_titleFontFamily","titleFontFamily","_titleFontStyle","titleFontSize","_titleAlign","_footerFontFamily","footerFontFamily","_footerFontStyle","footerFontSize","_footerAlign","opacity","legendColorBackground","getTooltipSize","tooltip","combinedBodyLength","bodyItem","before","lines","after","titleLineCount","footerLineCount","widthPadding","maxLineWidth","measureText","fontString","determineAlignment","lf","rf","olf","orf","yf","midX","midY","getBackgroundPoint","alignment","paddingAndSize","radiusAndPadding","getAlignedX","getBeforeAfterBodyLines","exports$4","_lastActive","getTitle","getBeforeBody","getBody","bodyItems","getAfterBody","getFooter","existingModel","active","_active","backgroundPoint","tooltipSize","caretX","caretY","labelColors","labelTextColors","_eventPosition","itemSort","dataPoints","drawCaret","tooltipPoint","caretPosition","getCaretPosition","x3","y3","ptX","ptY","drawTitle","rtlHelper","textBaseline","fillText","drawBody","textColor","drawColorBoxes","xLinePadding","colorX","fillLineOfText","bodyAlignForCalculation","rtlColorX","strokeRect","drawFooter","drawBackground","quadraticCurveTo","hasTooltipContent","globalAlpha","getElementsAtEventForMode","positioners_1","core_tooltip","valueOrDefault$9","mergeScaleConfig","slen","mergeConfig","initConfig","updateConfig","newOptions","ensureScalesHaveIDs","buildOrUpdateScales","nextAvailableScaleId","axesOpts","hasId","positionIsHorizontal","compare2Level","l1","l2","events","onHover","animationDuration","responsive","responsiveAnimationDuration","Chart","construct","_bufferedRender","instances","retinaScale","devicePixelRatio","bindEvents","resize","initToolTip","stop","silent","getMaximumWidth","getMaximumHeight","newSize","onResize","scalesOptions","scaleOptions","xAxisOptions","yAxisOptions","dtype","dposition","isDefault","scaleType","scaleClass","mergeTicksOptions","buildOrUpdateControllers","newControllers","destroyDatasetMeta","order","ControllerClass","resetElements","updateLayout","updateDatasets","lastActive","_bufferedRequest","_idx","updateDataset","animationOptions","animationObject","easingFunction","stepDecimal","layers","drawDatasets","_drawTooltip","_getSortedDatasetMetas","filterVisible","drawDataset","getElementAtEvent","getElementsAtEvent","getElementsAtXAxis","getDatasetAtEvent","_meta","generateLegend","unbindEvents","toBase64Image","toDataURL","_chartInstance","_listeners","eventHandler","updateHoverStyle","bufferedRequest","core_controller","Controller","types","configMerge","scaleMerge","core_helpers","parseMaxStyle","styleValue","parentProperty","valueInPixels","isConstrainedValue","getConstraintDimension","domNode","maxStyle","percentageProperty","defaultView","_getParentNode","constrainedNode","getComputedStyle","constrainedContainer","hasCNode","hasCContainer","infinity","collection","filterCallback","filtered","findNextWhere","arrayToSearch","currentItem","findPreviousWhere","almostEquals","almostWhole","rounded","NEGATIVE_INFINITY","toRadians","toDegrees","radians","_decimalPlaces","centrePoint","anglePoint","distanceFromXCenter","distanceFromYCenter","radialDistanceFromCenter","aliasPixel","pixelWidth","_alignPixel","pixel","currentDevicePixelRatio","halfWidth","firstPoint","middlePoint","afterPoint","d01","d12","s01","s12","fa","fb","EPSILON","pointBefore","pointCurrent","pointAfter","alphaK","betaK","tauK","squaredMagnitude","pointsWithTangents","deltaK","mK","pointsLen","slopeDeltaX","loop","niceNum","fraction","webkitRequestAnimationFrame","mozRequestAnimationFrame","oRequestAnimationFrame","msRequestAnimationFrame","evt","originalEvent","srcElement","boundingRect","getBoundingClientRect","touches","clientX","clientY","paddingLeft","paddingTop","paddingRight","paddingBottom","getConstraintWidth","getConstraintHeight","_calculatePadding","parentDimension","cw","clientHeight","ch","currentStyle","forceRatio","pixelRatio","pixelSize","longestText","arrayOfThings","gc","garbageCollect","thing","nestedThing","longest","gcLen","textWidth","numberOfLabelLines","numberOfLines","CanvasGradient","colorValue","CanvasPattern","abstract","DateAdapter","_create","override","members","core_adapters","_date","core_ticks","formatters","tickValue","logDelta","tickString","logTick","numExponential","toExponential","numDecimal","logarithmic","remain","valueOrDefault$a","sample","numItems","increment","getPixelForGridLine","validIndex","lineValue","caches","computeLabelSizes","tickFonts","tickFont","nestedLabel","widest","highest","widths","heights","offsets","widestLabelSize","highestLabelSize","major","minor","valueAt","first","getTickMarkLength","drawTicks","tickMarkLength","getScaleLabelHeight","parseFontOptions","nestedOpts","fontColor","parseTickFontOptions","nonSkipped","ticksToFilter","getEvenSpacing","calculateSpacing","majorIndices","axisLength","ticksLimit","factors","factor","evenMajorSpacing","spacing","getMajorIndices","skipMajors","tick","majorStart","majorEnd","drawOnChartArea","zeroLineWidth","zeroLineColor","zeroLineBorderDash","zeroLineBorderDashOffset","scaleLabel","labelString","minRotation","maxRotation","mirror","autoSkip","autoSkipPadding","labelOffset","Scale","zeroLineIndex","_ticks","_getLabels","xLabels","yLabels","beforeUpdate","margins","samplingEnabled","sampleSize","_labelSizes","_maxLabelLines","longestLabelWidth","longestTextCache","_gridLineItems","_labelItems","beforeSetDimensions","setDimensions","afterSetDimensions","beforeDataLimits","determineDataLimits","afterDataLimits","beforeBuildTicks","buildTicks","afterBuildTicks","_convertTicksToLabels","beforeCalculateTickRotation","calculateTickRotation","afterCalculateTickRotation","beforeFit","fit","afterFit","_ticksToDraw","_autoSkip","afterUpdate","startPixel","endPixel","reversePixels","_reversePixels","beforeTickToLabelConversion","convertTicksToLabels","userCallback","afterTickToLabelConversion","labelSizes","maxLabelWidth","maxLabelHeight","tickWidth","maxLabelDiagonal","numTicks","labelRotation","_isVisible","_getLabelSizes","scaleLabelOpts","gridLineOpts","isBottom","firstLabelSize","lastLabelSize","lineSpace","tickPadding","isRotated","angleRadians","cosRotation","sinRotation","labelHeight","offsetLeft","offsetRight","labelWidth","handleMargins","isFullWidth","rawValue","_getScaleLabel","getValueForPixel","decimal","getDecimalForPixel","getBaseValue","avgMajorSpacing","maxTicksLimit","_tickSize","numMajorIndices","optionTicks","rot","_computeGridLineItems","borderValue","alignedLineValue","tx1","ty1","tx2","ty2","lineColor","ticksLength","tl","axisWidth","axisHalfWidth","alignPixel","alignBorderValue","_computeLabelItems","lineCount","textOffset","isMirrored","fonts","_drawGrid","firstLineWidth","lastLineWidth","_drawLabels","_drawTitle","scaleLabelX","scaleLabelY","scaleLabelFontColor","scaleLabelFont","scaleLabelPadding","halfLineHeight","isLeft","tz","gz","_draw","core_scale","isNullOrUndef$1","defaultConfig","scale_category","ticksOpts","minIndex","maxIndex","_startValue","_valueRange","valueCategory","_defaults","isNullOrUndef$2","generateTicks","generationOptions","dataRange","niceMin","niceMax","numSpaces","MIN_SPACING","stepSize","maxNumSpaces","maxTicks","precision","rmin","rmax","scale_linearbase","handleTickRangeOptions","minSign","maxSign","setMin","suggestedMin","setMax","suggestedMax","getTickLimit","_computeTickLimit","handleDirectionalChanges","numericGeneratorOptions","fixedStepSize","ticksAsNumbers","_endValue","defaultConfig$1","DEFAULT_MIN","DEFAULT_MAX","getOrCreateStack","neg","stackData","relativePoints","updateMinMax","scale_linear","hasStacks","stackValues","_defaults$1","valueOrDefault$b","generateTicks$1","exp","significand","tickVal","endExp","endSignificand","minNotZero","lastTick","defaultConfig$2","nonNegativeOrDefault","scale_logarithmic","IDMatches","valuesPerStack","valuesForType","minVal","maxVal","tickValues","_getFirstTickValue","_valueOffset","_defaults$2","valueOrDefault$c","valueAtIndexOrDefault$1","resolve$4","defaultConfig$3","animate","showLabelBackdrop","backdropColor","backdropPaddingY","backdropPaddingX","getTickBackdropHeight","measureLabelSize","determineLimits","fitWithPointLabels","textSize","plFont","furthestLimits","furthestAngles","_pointLabelSizes","valueCount","getPointPosition","drawingArea","getIndexAngle","hLimits","vLimits","setReductions","getTextAlignForAngle","adjustPointPositionForLabelHeight","drawPointLabels","pointLabelOpts","tickBackdropHeight","outerDistance","extra","pointLabelPosition","pointLabelFontColor","drawRadiusLine","numberOrZero","param","scale_radialLinear","setCenterPoint","largestPossibleRadius","radiusReductionLeft","radiusReductionRight","radiusReductionTop","radiusReductionBottom","leftMovement","rightMovement","topMovement","bottomMovement","maxRight","maxLeft","maxTop","maxBottom","scalingFactor","distanceFromCenter","thisAngle","getBasePosition","angleLineOpts","tickFontColor","_defaults$3","deprecated$1","resolve$5","valueOrDefault$d","MIN_INTEGER","MIN_SAFE_INTEGER","MAX_INTEGER","MAX_SAFE_INTEGER","INTERVALS","common","steps","UNITS","sorter","arrayUnique","hash","getMin","getMax","buildLookupTable","timestamps","distribution","table","lookup","mid","i0","i1","lo","interpolate$1","skey","tkey","span","toTimestamp","adapter","_adapter","parser","determineUnitForAutoTicks","minUnit","capacity","interval","determineUnitForFormatting","determineMajorUnit","generate","timeOpts","unitStepSize","computeOffsets","setMajorTicks","majorUnit","ticksFromTimestamps","defaultConfig$4","adapters","displayFormat","displayFormats","scale_time","timestamp","labelsAdded","dataLabels","_table","_timestamps","getLabelCapacity","_unit","_majorUnit","_offsets","tooltipFormat","tickFormatFunction","minorFormat","majorFormat","nestedTickOpts","formatter","getPixelForOffset","_getLabelSize","tickLabelWidth","tickFontSize","getLabelWidth","exampleTime","exampleLabel","_defaults$4","category","radialLinear","FORMATS","_id","amount","filler","propagate","mappers","boundary","decodeFill","computeLinearBoundary","scaleBottom","scaleTop","scaleZero","computeCircularBoundary","cx","cy","computeBoundary","resolveTarget","visited","visible","createMapper","isDrawable","drawArea","curve0","curve1","len0","len1","doFill","mapper","p0","d0","d1","loopOffset","plugin_filler","afterDatasetsUpdate","$filler","beforeDatasetsDraw","getRtlHelper$1","noop$1","valueOrDefault$e","getBoxWidth","labelOpts","usePointStyle","boxWidth","ci","onLeave","lineDash","Legend","legendHitBoxes","_hoveredItem","doughnutMode","beforeBuildLabels","buildLabels","afterBuildLabels","legendItems","labelFont","hitboxes","lineWidths","totalHeight","vPadding","columnWidths","columnHeights","totalWidth","currentColWidth","currentColHeight","lineDefault","legendHeight","legendWidth","drawLegendBox","SQRT2","halfFontSize","xLeft","yMiddle","alignmentOffset","dimension","blockSize","itemHeight","realX","_getLegendItemAt","hitBox","lh","hoveredItem","createNewLegendAndAttach","legendOpts","plugin_legend","_element","beforeInit","afterEvent","noop$2","Title","titleX","titleY","fontOpts","createNewTitleBlockAndAttach","titleOpts","titleBlock","_adapters","Animation","animationService","Interaction","scaleService","Ticks","Tooltip","pluginService","PluginBase","canvasHelpers","layoutService","LinearScaleBase","klass","cfg","require$$0","AdminLoginsChart","logins_failed_per_1h","logins_per_1h","valueStamp","userAgent","navigator","gecko","ie_upto10","ie_11up","ie","ie_version","documentMode","webkit","qtwebkit","chrome","presto","safari","vendor","mac_geMountainLion","phantom","ios","android","mobile","mac","chromeOS","windows","presto_version","flipCtrlCmd","captureRightClick","classTest","rmClass","removeChildren","childNodes","removeChildrenAndAdd","elt","tag","eltP","child","activeElt","activeElement","addClass","joinClasses","createRange","setEnd","setStart","createTextRange","moveToElementText","collapse","moveEnd","moveStart","selectInput","select","copyObj","overwrite","countColumn","tabSize","startValue","search","nextTab","selectionStart","selectionEnd","Delayed","onTimeout","self","clearTimeout","scrollerGap","Pass","sel_dontScroll","scroll","sel_mouse","sel_move","findColumn","goal","col","spaceStrs","spaceStr","lst","insertSorted","createObj","inst","nonASCIISingleCaseWordChar","isWordCharBasic","isWordChar","helper","isEmpty","extendingChars","isExtendingChar","charCodeAt","skipExtendingChars","findFirst","pred","midF","iterateBidiSections","found","bidiOther","getBidiPartAt","sticky","bidiOrdering","lowTypes","arabicTypes","charType","code","bidiRE","isNeutral","isStrong","countsAsLeft","countsAsNum","BidiSpan","outerType","i$1","i$2","type$1","i$3","prev$1","type$2","i$4","type$3","i$5","cur$1","type$4","i$6","end$1","replace$1","j$1","i$7","at","isRTL","j$2","nstart","getOrder","noHandlers","on","emitter","attachEvent","_handlers","getHandlers","off","detachEvent","signal","handlers","signalDOMEvent","cm","preventDefault","defaultPrevented","e_defaultPrevented","codemirrorIgnore","signalCursorActivity","cursorActivity","curOp","cursorActivityHandlers","hasHandler","eventMixin","e_preventDefault","returnValue","e_stopPropagation","stopPropagation","cancelBubble","e_stop","e_target","e_button","which","button","ctrlKey","zwspSupported","badBidiRects","dragAndDrop","div","zeroWidthElement","measure","offsetHeight","offsetWidth","hasBadBidiRects","txt","r0","r1","splitLinesAuto","nl","rt","hasSelection","getSelection","te","ownerDocument","selection","parentElement","compareEndPoints","hasCopyEvent","oncopy","badZoomedRects","hasBadZoomedRects","normal","fromRange","mimeModes","defineMode","dependencies","defineMIME","mime","spec","resolveMode","getMode","mfactory","modeObj","modeExtensions","exts","helperType","modeProps","prop$1","extendMode","copyState","nstate","innerMode","startState","a2","StringStream","lineOracle","lastColumnPos","lastColumnValue","lineStart","getLine","doc","children","sz","chunkSize","getBetween","getLines","updateLineHeight","lineNo","no","lineAtHeight","isLine","lineNumberFor","lineNumberFormatter","firstLineNumber","Pos","cmp","equalCursorPos","copyPos","maxPos","minPos","clipLine","clipPos","clipToLen","linelen","clipPosArray","eol","sol","peek","eat","eatWhile","eatSpace","skipToEnd","skipTo","backUp","column","indentation","pattern","consume","caseInsensitive","cased","hideFirstChars","lookAhead","oracle","baseToken","SavedContext","Context","maxLookAhead","baseTokens","baseTokenPos","highlightLine","forceToEnd","st","modeGen","lineClasses","runMode","overlay","overlays","i_end","opaque","classes","bgClass","textClass","getLineStyles","updateFrontier","getContextBefore","resetState","maxHighlightLength","stateAfter","styleClasses","highlightFrontier","modeFrontier","precise","findStartLine","saved","fromSaved","processLine","viewFrom","viewTo","nextLine","startAt","stream","callBlankLine","readToken","blankLine","copy","Token","takeToken","asArray","extractLineClasses","lineClass","flattenSpans","curStart","curStyle","addModeClass","mName","minindent","minline","lim","indented","retreatFrontier","sawReadOnlySpans","sawCollapsedSpans","seeReadOnlySpans","seeCollapsedSpans","MarkedSpan","getMarkedSpanFor","spans","removeMarkedSpan","addMarkedSpan","markedSpans","attachLine","markedSpansBefore","startCh","isInsert","nw","inclusiveLeft","insertLeft","endsAfter","inclusiveRight","markedSpansAfter","endCh","startsBefore","stretchSpansOverChange","full","oldFirst","oldLast","sameLine","span$1","clearEmptySpans","newMarkers","gapMarkers","gap","clearWhenEmpty","removeReadOnlyRanges","markers","mark","readOnly","mk","find","newParts","dfrom","dto","detachMarkedSpans","detachLine","attachMarkedSpans","extraLeft","extraRight","compareCollapsedMarkers","lenDiff","aPos","bPos","fromCmp","toCmp","collapsedSpanAtSide","sps","sp","collapsed","collapsedSpanAtStart","collapsedSpanAtEnd","collapsedSpanAround","conflictingCollapsedRange","visualLine","merged","visualLineEnd","visualLineContinued","visualLineNo","lineN","vis","visualLineEndNo","lastLine","lineIsHidden","widgetNode","lineIsHiddenInner","heightAtLine","lineObj","lineLength","found$1","findMaxLine","maxLine","maxLineLength","maxLineChanged","estimateHeight","updateLine","estHeight","cleanUpLine","styleToClassCache","styleToClassCacheWithMode","interpretTokenStyle","buildLineContent","lineView","builder","pre","trailingSpace","splitSpaces","getOption","rest","addToken","buildToken","buildTokenBadBidi","insertLineContent","externalMeasured","maps","lastChild","defaultSpecialCharPlaceholder","startStyle","endStyle","displayText","special","specialChars","mustWrap","txt$1","tabWidth","specialCharPlaceholder","fullStyle","trailingBefore","spaceBefore","buildCollapsedSpan","ignoreWidget","widget","needsContentAttribute","setUneditable","allText","spanStyle","spanEndStyle","spanStartStyle","nextChange","foundBookmarks","endStyles","upto","tokenText","LineView","buildViewArray","nextPos","operationGroup","pushOperation","op","ops","ownsGroup","delayedCallbacks","fireCallbacksForOps","group","cursorActivityCalled","finishOperation","endCb","orphanDelayedCallbacks","signalLater","fireOrphanDelayed","delayed","updateLineForChanges","dims","changes","updateLineText","updateLineGutter","updateLineClasses","updateLineWidgets","ensureLineWrapped","replaceChild","zIndex","updateLineBackground","background","wrap","getLineContent","ext","built","wrapClass","gutter","gutterBackground","gutterClass","fixedGutter","fixedPos","gutterTotalWidth","gutterMarkers","lineNumbers","wrap$1","gutterWrap","lineNumber","gutterLeft","gutterSpecs","gutterWidth","alignable","isWidget","insertLineWidgets","buildLineElement","insertLineWidgetsFor","allowAbove","widgets","handleMouseEvents","positionLineWidget","above","noHScroll","wrapperWidth","coverGutter","marginLeft","widgetHeight","parentStyle","gutters","wrapper","eventInWidget","sizer","mover","offsetTop","paddingVert","paddingH","cachedPaddingH","scrollGap","nativeBarWidth","scroller","barWidth","barHeight","ensureLineHeights","wrapping","lineWrapping","curWidth","getClientRects","mapFromLineView","updateExternalMeasurement","lineMeasure","measureChar","bias","measureCharPrepared","prepareMeasureForLine","findViewForLine","findViewIndex","getDimensions","forceUpdate","hasHeights","prepared","varHeight","measureCharInner","bogus","rtop","rbottom","nullRect","nodeAndOffsetInLineMap","mStart","mEnd","coverStart","coverEnd","getUsefulRect","place","maybeUpdateRectForZooming","rSpan","charWidth","rbot","bot","singleCursorHeightPerLine","screen","logicalXDPI","deviceXDPI","scaleX","scaleY","logicalYDPI","deviceYDPI","clearLineMeasurementCacheFor","clearLineMeasurementCache","externalMeasure","clearCaches","cachedCharWidth","cachedTextHeight","lineNumChars","pageScrollX","pageXOffset","pageScrollY","marginTop","pageYOffset","widgetTopHeight","intoCoordSystem","includeWidgets","yOff","viewOffset","lOff","xOff","fromCoordSystem","coords","localBox","lineSpaceBox","charCoords","cursorCoords","preparedMeasure","getBidi","partPos","invert","estimateCoords","PosWithInfo","outside","xRel","coordsChar","coordsCharInner","rangeEnd","wrappedLineExtent","begin","wrappedLineExtentChar","boxIsAfter","ltr","coordsBidiPartWrapped","coordsBidiPart","baseX","chAround","boxAround","atLeft","atStart","_lineNo","closestDist","dist","textHeight","clientLeft","compensateForHScroll","perLine","widgetsHeight","estimateLineHeights","est","posFromMouse","liberal","forRect","e$1","colDiff","regChange","lendiff","updateLineNumbers","viewChanged","resetView","cut","viewCuttingPoint","cut$1","cutTop","cutBot","regLineChange","oldN","newN","adjustView","countDirtyView","updateSelection","showSelection","prepareSelection","primary","curFragment","cursors","selFragment","sel","ranges","primIndex","showCursorWhenSelecting","drawSelectionCursor","drawSelectionRange","cursorHeight","otherCursor","cmpCoords","leftSide","rightSide","sizerWidth","docLTR","drawForLine","fromArg","toArg","lineLen","wrapX","side","extent","fromPos","toPos","openStart","openEnd","openRight","topLeft","topRight","botLeft","botRight","sFrom","sTo","fromLine","toLine","singleVLine","leftEnd","rightStart","restartBlink","focused","clearInterval","blinker","cursorDiv","visibility","cursorBlinkRate","setInterval","hasFocus","onBlur","ensureFocus","focus","onFocus","delayBlurEvent","delayingBlurEvent","draggingText","selForContextMenu","receivedFocus","updateHeightsInViewport","prevBottom","lineDiv","updateWidgetHeight","chWidth","visibleLines","viewport","ensure","ensureFrom","ensureTo","maybeScrollWindow","doScroll","innerHeight","scrollNode","scrollIntoView","scrollPosIntoView","endCoords","scrollPos","calculateScrollPos","startTop","startLeft","updateScrollTop","setScrollLeft","snapMargin","screentop","docBottom","atTop","atBottom","newTop","gutterSpace","screenleft","screenw","tooWide","addToScrollTop","resolveScrollToPos","ensureCursorVisible","getCursor","scrollToPos","cursorScrollMargin","scrollToCoords","scrollToRange","scrollToCoordsRange","sPos","updateDisplaySimple","setScrollTop","startWorker","forceScroll","scrollHeight","scrollbars","isScroller","scrollWidth","alignHorizontally","measureForScrollbars","gutterW","docH","viewHeight","viewWidth","barLeft","docHeight","NativeScrollbars","vert","horiz","tabIndex","checkedZeroWidth","minHeight","minWidth","needsH","needsV","sWidth","zeroWidthHack","disableHoriz","enableZeroWidthBar","disableVert","pointerEvents","delay","maybeDisable","elementFromPoint","NullScrollbars","updateScrollbars","startWidth","startHeight","updateScrollbarsInner","heightForcer","borderBottom","scrollbarFiller","coverGutterNextToScrollbar","gutterFiller","scrollbarModel","null","initScrollbars","scrollbarStyle","nextOpId","startOperation","updateInput","typing","changeObjs","selectionChanged","updateMaxLine","endOperation","endOperations","endOperation_R1","endOperation_W1","endOperation_R2","endOperation_W2","endOperation_finish","maybeClipScrollbars","mustUpdate","DisplayUpdate","updatedDisplay","updateDisplayIfNeeded","barMeasure","adjustWidthTo","maxScrollLeft","preparedSelection","takeFocus","setDocumentHeight","postUpdateDisplay","wheelStartX","wheelStartY","maybeHiddenMarkers","unhidden","maybeUnhiddenMarkers","finish","runInOp","operation","methodOp","docMethodOp","highlight","highlightWorker","workTime","changedLines","oldStyles","highlighted","oldCls","newCls","ischange","workDelay","force","editorIsHidden","wrapperHeight","oldDisplayWidth","scrollbarsClipped","marginBottom","borderRightWidth","selectionSnapshot","anchorNode","anchorOffset","focusNode","focusOffset","restoreSelection","snapshot","removeAllRanges","addRange","renderedView","maybeUpdateLineNumberWidth","viewportMargin","different","lastWrapHeight","lastWrapWidth","toUpdate","selSnapshot","patchDisplay","selectionDiv","reportedViewFrom","reportedViewTo","updateNumbersFrom","rm","currentWheelTarget","updateNumber","updateGutterSpace","alignWidgets","comp","innerW","lineGutter","lineNumInnerWidth","lineNumWidth","getGutters","sawLineNumbers","renderGutters","specs","gElt","updateGutters","Display","draggable","wheelDX","wheelDY","activeTouch","init","wheelSamples","wheelPixelsPerUnit","wheelEventDelta","dx","wheelDeltaX","dy","wheelDeltaY","detail","HORIZONTAL_AXIS","VERTICAL_AXIS","wheelDelta","wheelEventPixels","onScrollWheel","canScrollX","canScrollY","movedX","movedY","Selection","equals","here","there","deepCopy","Range","somethingSelected","normalizeSelection","mayTouch","selectionsMayTouch","prim","inv","simpleSelection","changeEnd","adjustForChange","computeSelAfterChange","offsetPos","computeReplacedSel","hint","oldPrev","newPrev","loadMode","modeOption","resetModeState","isWholeLineUpdate","wholeLineUpdateBefore","updateDoc","spansFor","linesFor","firstLine","lastText","lastSpans","nlines","added","added$1","added$2","linkedDocs","sharedHistOnly","sharedHist","linked","rel","shared","attachDoc","setDirectionClass","directionChanged","History","startGen","undone","undoDepth","lastModTime","lastSelTime","lastOp","lastSelOp","lastOrigin","lastSelOrigin","generation","maxGeneration","historyChangeFromChange","histChange","attachLocalSpans","clearSelectionEvents","lastChangeEvent","hist","addChangeToHistory","selAfter","opId","history","historyEventDelay","pushSelectionToHistory","selectionEventCanBeMerged","addSelectionToHistory","clearRedo","dest","existing","removeClearedSpans","explicitlyCleared","getOldSpans","mergeOldSpans","stretched","oldCur","stretchCur","copyHistoryArray","newGroup","instantiateSel","newChanges","extendRange","posBefore","extendSelection","setSelection","extendSelections","heads","replaceOneSelection","setSimpleSelection","filterSelectionChange","setSelectionReplaceHistory","setSelectionNoUndo","setSelectionInner","skipAtomicInSelection","reCheckSelection","mayClear","newAnchor","skipAtomic","newHead","skipAtomicInner","oldPos","preventCursorLeft","selectLeft","preventCursorRight","selectRight","atomic","near","movePos","far","cantEdit","selectAll","filterChange","canceled","cancel","makeChange","ignoreReadOnly","suppressEdits","makeChangeInner","makeChangeSingleDoc","rebased","rebaseHist","makeChangeFromHistory","allowSelectionOnly","suppress","antiChanges","returned","shiftDoc","removed","makeChangeSingleDocInEditor","recomputeMaxLength","checkWidthStart","changesHandler","changeHandler","replaceRange","splitLines","rebaseHistSelSingle","rebaseHistArray","sub","ok","copied","changeLine","handle","changeType","LeafChunk","BranchChunk","removeInner","insertInner","iterN","oldHeight","remaining","leaf","maybeSpill","sibling","myIndex","used","LineWidget","opt","adjustScrollWhenAboveVisible","addLineWidget","insertAt","aboveVisible","this$1","oldH","nextMarkerId","TextMarker","markText","markTextShared","replacedWith","addToHistory","curLine","clearOnEnter","clearHistory","withOp","visual","dHeight","SharedTextMarker","isParent","findSharedMarkers","findMarks","copySharedMarkers","mFrom","mTo","subMark","detachSharedMarkers","subMarker","nextDocId","Doc","lineSep","cleanGeneration","getValue","lineSeparator","getRange","getLineHandle","getLineNumber","getLineHandleVisualStart","listSelections","setCursor","extendSelectionsBy","setSelections","addSelection","getSelections","replaceSelection","dup","replaceSelections","newSel","undo","redo","undoSelection","redoSelection","setExtending","getExtending","historySize","markClean","changeGeneration","forceSplit","isClean","gen","getHistory","setHistory","histData","setGutterMarker","gutterID","clearGutter","lineInfo","addLineClass","removeLineClass","removeLineWidget","setBookmark","realOpts","findMarksAt","getAllMarks","posFromIndex","sepSize","indexFromPos","copyHistory","linkedDoc","unlinkDoc","CodeMirror","splitIds","iterLinkedDocs","getEditor","setDirection","eachLine","lastDrop","onDrop","clearDragCursor","files","dataTransfer","isReadOnly","FileReader","File","read","markAsReadAndPasteIfAllFilesAreRead","readTextFromFile","file","allowDropFileTypes","reader","onerror","onload","readAsText","text$1","getData","selected","onDragStart","setData","effectAllowed","setDragImage","img","_top","onDragOver","frag","dragCursor","forEachCodeMirror","getElementsByClassName","byClass","editors","globalsRegistered","ensureGlobalHandlers","registerGlobalHandlers","resizeTimer","setSize","keyNames","3","8","9","13","16","17","18","19","20","27","32","33","34","35","36","37","38","39","40","44","45","46","59","61","91","92","93","106","107","109","110","111","145","173","186","187","188","189","190","191","192","219","220","221","222","224","63232","63233","63234","63235","63272","63273","63275","63276","63277","63302","fromCharCode","keyMap","normalizeKeyName","alt","ctrl","cmd","normalizeKeyMap","keymap","keyname","lookupKey","getKeyMap","fallthrough","isModifierKey","keyCode","addModifierNames","noShift","altKey","metaKey","shiftKey","keyName","altGraphKey","deleteNearSelection","compute","kill","toKill","replaced","moveCharLogically","moveLogically","endOfLine","visually","prep","targetTop","moveVisually","bidi","mv","getWrappedLineExtent","moveInStorageOrder","searchInVisualLine","getRes","nextCh","basic","Left","Right","Up","Down","End","Home","PageUp","PageDown","Delete","Backspace","Shift-Backspace","Tab","Shift-Tab","Enter","Insert","Esc","pcDefault","Ctrl-A","Ctrl-D","Ctrl-Z","Shift-Ctrl-Z","Ctrl-Y","Ctrl-Home","Ctrl-End","Ctrl-Up","Ctrl-Down","Ctrl-Left","Ctrl-Right","Alt-Left","Alt-Right","Ctrl-Backspace","Ctrl-Delete","Ctrl-S","Ctrl-F","Ctrl-G","Shift-Ctrl-G","Shift-Ctrl-F","Shift-Ctrl-R","Ctrl-[","Ctrl-]","Ctrl-U","Shift-Ctrl-U","Alt-U","emacsy","Ctrl-B","Ctrl-P","Ctrl-N","Alt-F","Alt-B","Ctrl-E","Ctrl-V","Shift-Ctrl-V","Ctrl-H","Alt-D","Alt-Backspace","Ctrl-K","Ctrl-T","Ctrl-O","macDefault","Cmd-A","Cmd-D","Cmd-Z","Shift-Cmd-Z","Cmd-Y","Cmd-Home","Cmd-Up","Cmd-End","Cmd-Down","Cmd-Left","Cmd-Right","Ctrl-Alt-Backspace","Alt-Delete","Cmd-S","Cmd-F","Cmd-G","Shift-Cmd-G","Cmd-Alt-F","Shift-Cmd-Alt-F","Cmd-[","Cmd-]","Cmd-Backspace","Cmd-Delete","Cmd-U","Shift-Cmd-U","commands","singleSelection","killLine","deleteLine","delLineLeft","delWrappedLineLeft","delWrappedLineRight","rightPos","goDocStart","goDocEnd","goLineStart","goLineStartSmart","lineStartSmart","goLineEnd","lineEnd","goLineRight","goLineLeft","goLineLeftSmart","goLineUp","moveV","goLineDown","goPageUp","goPageDown","goCharLeft","moveH","goCharRight","goColumnLeft","goColumnRight","goWordLeft","goGroupRight","goGroupLeft","goWordRight","delCharBefore","deleteH","delCharAfter","delWordBefore","delWordAfter","delGroupBefore","delGroupAfter","indentAuto","indentSelection","indentMore","indentLess","insertTab","insertSoftTab","defaultTab","execCommand","transposeChars","newlineAndIndent","sels","indentLine","openLine","toggleOverwrite","firstNonWS","inWS","doHandleBinding","bound","dropShift","ensurePolled","prevShift","lookupKeyForEditor","keyMaps","extraKeys","stopSeq","dispatchKey","seq","keySeq","dispatchKeyInner","handleKeyBinding","motion","handleCharBinding","lastStoppedKey","onKeyDown","getField","handled","showCrossHair","up","onKeyUp","onKeyPress","charCode","lastClick","lastDoubleClick","DOUBLECLICK_DELAY","PastClick","clickRepeat","compare","onMouseDown","supportsTouch","clickInGutter","repeat","selectingText","handleMappedButton","leftButtonDown","onContextMenu","configureMouse","option","addNew","moveOnDrag","contained","behavior","dragDrop","leftButtonStartDrag","leftButtonSelect","moved","dragEnd","mouseMove","dragStart","preventScroll","e2","rangeForUnit","findWordAt","ourRange","ourIndex","startSel","lastPos","extendTo","startCol","posCol","leftPos","oldRange","ranges$1","bidiSimplify","editorSize","counter","curCount","move","buttons","anchorLine","headIndex","usePart","gutterEvent","prevent","mX","mY","lineBox","contextMenuInGutter","themeChanged","theme","Init","optionHandlers","defineOptions","deflt","notOnInit","defineOption","newBreaks","refresh","getInputField","spellcheck","autocorrect","autocapitalize","detach","attach","wrappingChanged","blur","readOnlyChanged","screenReaderLabelChanged","dragDropChanged","resetPosition","funcs","dragFunctions","toggle","enter","over","leave","drop","inputStyles","inputStyle","pasteIncoming","cutIncoming","autofocus","registerEventHandlers","finishInit","initHooks","textRendering","word","touchFinished","prevTouch","finishTouch","isMouseLikeTouchEvent","touch","radiusX","radiusY","farAway","pageX","pageY","how","aggressive","indent","curSpace","curSpaceString","indentUnit","indentString","indentWithTabs","pos$1","defineInitHook","lastCopied","setLastCopied","newLastCopied","applyTextInput","inserted","deleted","recent","paste","textLines","multiPaste","pasteLinesPerSelection","lineWise","changeEvent","triggerElectric","handlePaste","pasted","clipboardData","disableInput","electricChars","smartIndent","getModeAt","electricInput","copyableRanges","lineRange","disableBrowserMagic","hiddenTextarea","addEditorMethods","setOption","getDoc","addKeyMap","removeKeyMap","addOverlay","modeSpec","removeOverlay","newRanges","getTokenAt","getLineTokens","getTokenTypeAt","getHelper","getHelpers","help","_global","getStateAfter","defaultTextHeight","defaultCharWidth","getViewport","addWidget","vspace","hspace","triggerOnKeyDown","triggerOnKeyPress","triggerOnKeyUp","triggerOnMouseDown","findPosH","hitSide","rtlMoveVisually","findPosV","goalColumn","goals","headPos","startChar","check","scrollTo","getScrollInfo","interpret","swapDoc","phrase","phraseText","phrases","getWrapperElement","getScrollerElement","getGutterElement","registerHelper","registerGlobalHelper","predicate","origDir","lineDir","findNextLine","moveOnce","boundToLine","sawType","pageSize","moveAmount","ContentEditableInput","lastAnchorNode","lastAnchorOffset","lastFocusNode","lastFocusOffset","polling","composing","gracePeriod","readDOMTimeout","posToDOM","isInGutter","scan","badPos","bad","domTextBetween","closing","extraLinebreak","recognizeMarker","close","addText","walk","cmText","markerID","isBlock","nodeValue","domToPos","lineNode","locateNodeInLineView","textNode","topNode","curNode","dist$1","belongsToInput","onCopyCut","lineWiseCopyCut","clearData","kludge","hadFocus","showPrimarySelection","updateFromDOM","readFromDOMSoon","forceCompositionEnd","showMultipleSelections","curAnchor","curFocus","rng","rangeCount","getRangeAt","startGracePeriod","rememberSelection","selectionInEditor","commonAncestorContainer","poll","pollSelection","pollInterval","pollContent","fromNode","toNode","toIndex","newText","oldText","cutFront","cutEnd","oldTop","maxCutFront","newBot","oldBot","maxCutEnd","chFrom","chTo","contentEditable","TextareaInput","prevInput","pollingFast","fromTextArea","textarea","tabindex","placeholder","realSubmit","leaveSubmitMethodAlone","wrappedSubmit","getTextArea","toTextArea","addLegacyProps","cmpPos","createField","prepareCopyCut","fastPoll","dispatchEvent","Event","_display","moveInputWithCursor","wrapOff","lineOff","teTop","teLeft","drawn","contextMenuPending","slowPoll","missed","same","resetSelectionOnContextMenu","oldScrollY","oldCSS","oldWrapperCSS","wrapperBox","scrollY","rehide","detectingSelectAll","prepareSelectAllHack","mouseup","extval","dontDelegate","contenteditable","defineExtension","defineDocExtension","startListening","stopListening","timeout","hurry","_cm","autoRefresh","htmlConfig","xmlConfig","autoSelfClosers","br","command","embed","keygen","track","wbr","menuitem","implicitlyClosed","li","optgroup","rp","tbody","td","tfoot","tr","contextGrabbers","dt","address","article","aside","blockquote","dl","fieldset","h1","h2","h3","h4","h5","h6","header","hgroup","menu","nav","ol","section","ul","thead","doNotIndent","allowUnquoted","allowMissing","caseFold","allowMissingTagName","editorConf","config_","setStyle","htmlMode","inText","chain","tokenize","inBlock","doctype","inTag","baseState","tagStart","inAttribute","stringStartCol","quote","closure","isInAttribute","terminator","depth","startOfLine","noIndent","popContext","maybePopContext","nextTagName","parentTagName","tagNameState","closeTagNameState","attrState","matchClosing","closeState","closeStateErr","_stream","attrEqState","attrValueState","attrContinuedState","isInText","baseIndent","textAfter","fullLine","multilineTagIndentPastTag","multilineTagIndentFactor","alignCDATA","tagAfter","grabbers","blockCommentStart","blockCommentEnd","skipAttribute","xmlCurrentTag","xmlCurrentContext","keywordRegex","esc","escaped","literal","keyCol","pair","pairStart","inlinePairs","inlineList","lineComment","fold","wordRegexp","words","wordOperators","commonKeywords","commonBuiltins","scopes","conf","parserConf","ERRORCLASS","delimiters","singleDelimiters","operators","singleOperators","doubleOperators","doubleDelimiters","tripleDelimiters","hangingIndent","myKeywords","myBuiltins","extra_keywords","extra_builtins","py3","identifiers","stringPrefixes","keywords","builtins","tokenBase","lastToken","scopeOffset","lineOffset","pushPyScope","dedent","errorToken","tokenBaseInner","inFormat","floatLiteral","intLiteral","formatStringFactory","tokenStringFactory","delimiter","tokenOuter","singleline","OUTCLASS","tokenNestedExpr","tokenString","singleLineStringErrors","pushBracketScope","tokenLexer","beginningOfLine","lambda","delimiter_index","basecolumn","addErr","closeBrackets","triples","CodeMirrorTextarea","editor","DropdownButton","btn","FetchFillSlot","slotName","comparisonOperatorsHash","<",">",">=","<=","==","!=","===","!==","selectedSlot","slot","comparison","dv","LEVEL_ICON_MAP","warning","success","Messages","connect","fetchMessages","wsUrl","protocol","messageSocket","WebSocket","debug","retryDelay","renderMessage","message","levelTag","level_tag","tags","ModalButton","open","ModalBoxStyle","BullseyeStyle","BackdropStyle","closest","slugField","formData","FormData","href","action","redirect","response","updateHandlers","CustomEvent","bubbles","sb","renderModal","NotFoundError","RequestError","DefaultClient","query","builtUrl","encodeURIComponent","finalUrl","makeUrl","status","statusText","SIDEBAR_ITEMS","condition","user","is_superuser","Sidebar","activePath","PageStyle","NavStyle","renderItem","SessionStatus","Severity","Status","isError","wat","isInstanceOf","isErrorEvent","isDOMError","isPlainObject","isEvent","isElement","isThenable","htmlTreeAsString","elem","currentElem","sepLength","nextStr","_htmlElementAsString","_oO","allowedAttrs","Debug","Info","Warning","Fatal","Critical","Log","Success","RateLimit","Invalid","Failed","Unknown","_super","_newTarget","DSN_REGEX","_fromString","_fromComponents","_validate","Dsn","withPassword","pass","port","projectId","SentryError","_b","_c","projectMatch","components","component","ERROR_MESSAGE","_hasWeakSet","WeakSet","_inner","Memo","getFunctionName","truncate","safeJoin","isMatchingPattern","replacement","wrapped","defineProperties","__sentry_original__","_Oo","getWalkSource","err","event_1","currentTarget","jsonSize","encodeURI","utf8Length","normalizeToSize","serialized","normalize","normalizeValue","_events","memo","normalized","serializeValue","memoize","innerKey","unmemoize","extractExceptionKeysForMessage","exception","maxLength","includedKeys","dropUndefinedKeys","rv","isNodeEnv","process","dynamicRequire","DEFAULT_REQUEST_KEYS","fallbackGlobalObject","getGlobalObject","uuid4","crypto","msCrypto","getRandomValues","Uint16Array","pad","parseUrl","relative","getEventDescription","event_id","consoleSandbox","originalConsole","wrappedLevels","addExceptionTypeValue","addExceptionMechanism","mechanism","PREFIX","Logger","__SENTRY__","logger","supportsFetch","Headers","Response","isNativeFetch","supportsReferrerPolicy","referrerPolicy","lastHref","instrumented","instrument","originalConsoleLevel","triggerHandlers","instrumentConsole","domEventHandler","keypressEventHandler","innerOriginal","__sentry_wrapped__","instrumentDOM","requestKeys","requestValues","xhrproto","XMLHttpRequest","originalOpen","xhr","__sentry_xhr__","__sentry_own_request__","onreadystatechangeHandler","status_code","requestPos","args_1","endTimestamp","startTimestamp","onreadystatechange","readyStateArgs","originalSend","instrumentXHR","sandbox","supportsNativeFetch","originalFetch","handlerData","fetchData","getFetchMethod","getFetchUrl","instrumentFetch","isChromePackagedApp","app","runtime","hasHistoryApi","pushState","replaceState","supportsHistory","oldOnPopState","onpopstate","historyReplacementFunction","originalHistoryFunction","instrumentHistory","_oldOnErrorHandler","_oldOnUnhandledRejectionHandler","onunhandledrejection","addInstrumentationHandler","fetchArgs","keypressTimeout","lastCapturedEvent","debounceTimer","debounce","isContentEditable","States","executor","PENDING","_setResult","RESOLVED","reason","REJECTED","_state","_resolve","_reject","_value","_executeHandlers","cachedHandlers","onfulfilled","onrejected","SyncPromise","_","resolvedCollection","_attachHandler","onfinally","isRejected","_limit","PromiseBuffer","task","isReady","_buffer","capturedSetTimeout","all","dateTimestampSource","nowSeconds","platformPerformance","performance","getNodePerformance","timeOrigin","getBrowserPerformance","timestampSource","dateTimestampInSeconds","timestampWithMs","browserPerformanceTimeOrigin","timing","navigationStart","Scope","newScope","_breadcrumbs","_tags","_extra","_contexts","_user","_level","_span","_session","_transactionName","_fingerprint","_eventProcessors","_scopeListeners","_notifyScopeListeners","extras","fingerprint","setTransactionName","getSpan","transaction","spanRecorder","session","captureContext","updatedScope","contexts","breadcrumb","maxBreadcrumbs","mergedBreadcrumb","trace","getTraceContext","transactionName","_applyFingerprint","breadcrumbs","_notifyEventProcessors","getGlobalEventProcessors","processors","final","_notifyingListeners","globalEventProcessors","addGlobalEventProcessor","Ok","Session","ip_address","ipAddress","did","email","username","sid","started","release","environment","errors","Exited","attrs","user_agent","client","_version","getStackTop","bindClient","Hub","setupIntegrations","getScope","getStack","getClient","pushScope","popScope","_stack","eventId","_lastEventId","finalHint","syntheticException","originalException","_invokeClient","beforeBreadcrumb","finalBreadcrumb","addBreadcrumb","setUser","setTags","setExtras","setTag","setExtra","setContext","oldHub","makeMain","integration","getIntegration","_callExtensionMethod","customSamplingContext","endSession","getUser","setSession","getSession","captureSession","carrier","getMainCarrier","sentry","hub","registry","getHubFromCarrier","setHubOnCarrier","getCurrentHub","hasHubOnCarrier","isOlderThan","activeDomain","getActiveDomain","registryHubTopStack","getHubFromActiveDomain","domain","callOnHub","captureException","withScope","dsn","_dsnObject","API","_getIngestEndpoint","getStoreEndpoint","_encodedAuth","_getEnvelopeEndpoint","clientName","clientVersion","Content-Type","X-Sentry-Auth","dialogOptions","endpoint","getBaseApiEndpoint","encodedOptions","auth","sentry_key","sentry_version","installedIntegrations","integrations","defaultIntegrations","userIntegrations","userIntegrationsNames_1","pickedIntegrationsNames_1","defaultIntegration","userIntegration","integrationsNames","alwaysLastToRun","getIntegrationsToSetup","setupOnce","setupIntegration","originalFunctionToString","backendClass","_backend","_dsn","BaseClient","_process","_getBackend","eventFromException","_captureEvent","promisedEvent","eventFromMessage","_sendSession","_isClientProcessing","ready","getTransport","transportFlushed","flush","_isEnabled","_integrations","crashed","errored","exceptions","exceptions_1","Crashed","sendSession","ticked","_processing","normalizeDepth","_applyClientOptions","_applyIntegrationsMetadata","finalScope","applyToEvent","_normalizeEvent","maxValueLength","sdkInfo","sdk","integrationsArray","sendEvent","_processEvent","finalEvent","beforeSend","sampleRate","isTransaction","_prepareEvent","__sentry__","beforeSendResult","processedEvent","_updateSessionFromEvent","_sendEvent","promise","NoopTransport","Skipped","_transport","_setupTransport","BaseBackend","_exception","_hint","_message","sessionToSentryRequest","api","sent_at","getEnvelopeEndpointWithUrlEncodedAuth","eventToSentryRequest","useEnvelope","req","getStoreEndpointWithUrlEncodedAuth","envelope","FunctionToString","DEFAULT_IGNORE_ERRORS","InboundFilters","clientOptions","_mergeOptions","_shouldDropEvent","_isSentryError","_isIgnoredError","_isDeniedUrl","_getEventFilterUrl","_isAllowedUrl","ignoreInternal","ignoreErrors","_getPossibleEventMessages","denyUrls","allowUrls","whitelistUrls","blacklistUrls","oO","stacktrace","frames_1","frames","filename","frames_2","winjs","geckoEval","chromeEval","reactMinifiedRegexp","computeStackTrace","ex","popSize","framesToPop","opera10Regex","opera11Regex","extractMessage","computeStackTraceFromStacktraceProp","popFrames","submatch","isNative","columnNumber","computeStackTraceFromStackProp","failed","exceptionFromStacktrace","prepareFramesForEvent","eventFromStacktrace","localStack","firstFrameFunction","lastFrameFunction","colno","function","in_app","lineno","eventFromUnknownInput","domException","name_1","eventFromString","DOMException.code","rejection","__serialized__","eventFromPlainObject","synthetic","attachStacktrace","_api","BaseTransport","drain","requestType","fromHttpCode","_handleRateLimit","_disabledUntil","_rateLimits","rlHeader","raHeader","parameters","headerDelay","headerDate","parseRetryAfterHeader","FetchTransport","_sendRequest","sentryRequest","originalPayload","_isRateLimited","fetchParameters","x-sentry-rate-limits","retry-after","_handleResponse","XHRTransport","getResponseHeader","setRequestHeader","send","BrowserBackend","transportOptions","transport","ignoreOnError","shouldIgnoreOnError","ignoreNextOnError","sentryWrapped","wrappedArguments","addEventProcessor","injectReportDialog","script","async","getReportDialogEndpoint","onLoad","SpanStatus","GlobalHandlers","stackTraceLimit","_installGlobalOnErrorHandler","_installGlobalOnUnhandledRejectionHandler","_onErrorHandlerInstalled","currentHub","hasIntegration","isFailedOwnDelivery","_eventFromIncompleteOnError","_enhanceEventWithInitialFrame","captureEvent","_onUnhandledRejectionHandlerInstalled","_eventFromIncompleteRejection","groups","getLocationHref","DEFAULT_EVENT_TARGET","TryCatch","eventTarget","_wrapTimeFunction","_wrapRAF","_wrapXHR","_wrapEventTarget","originalCallback","originalRemoveEventListener","wrappedEventHandler","originalEventHandler","xmlHttpRequestProps","wrapOptions","Breadcrumbs","dom","_consoleBreadcrumb","_domBreadcrumb","_xhrBreadcrumb","_fetchBreadcrumb","_historyBreadcrumb","fromString","parsedLoc","parsedFrom","parsedTo","LinkedErrors","_key","_handler","linkedErrors","_walkErrorTree","UserAgent","referrer","Referer","User-Agent","BrowserClient","getDsn","packages","addSentryBreadcrumb","CoreIntegrations.InboundFilters","CoreIntegrations.FunctionToString","window_1","SENTRY_RELEASE","autoSessionTracking","clientClass","enable","initAndBind","loadResolved","fcpResolved","possiblyEndSession","resolveWindowLoaded","startSession","po","PerformanceObserver","entryList","getEntries","entry","firstHiddenTime_1","visibilityState","timeStamp","buffered","startSessionTracking","httpStatus","Unauthenticated","PermissionDenied","NotFound","AlreadyExists","FailedPrecondition","ResourceExhausted","InvalidArgument","Unimplemented","Unavailable","DeadlineExceeded","InternalError","UnknownError","TRACEPARENT_REGEXP","hasTracingEnabled","getActiveTransaction","getTransaction","msToSec","errorCallback","activeTransaction","setStatus","maxlen","_maxlen","SpanRecorder","transactionContext","_hub","_trimEnd","trimEnd","Transaction","measurements","_measurements","sampled","finishedSpans","start_timestamp","spanContext","traceId","spanId","parentSpanId","description","Span","startChild","childSpan","spanStatus","sampledString","parent_span_id","span_id","trace_id","_pushActivity","_popActivity","transactionSpanId","IdleTransactionSpanRecorder","_idleHub","_idleTimeout","_onScope","clearActiveTransaction","configureScope","setSpan","IdleTransaction","_finished","activities","_beforeFinishCallbacks","Cancelled","keepSpan","_initTimeout","_pingHeartbeat","end_1","_heartbeatTimer","heartbeatString","_prevHeartbeatString","_heartbeatCounter","_beat","traceHeaders","sentry-trace","toTraceparent","samplingContext","parentSampled","givenRate","tracesSampler","tracesSampleRate","rate","isValidSampleRate","initSpanRecorder","_experiments","maxSpans","getDefaultSamplingContext","defaultSamplingContext","requestType_1","IncomingMessage","member","requestData","hostname","secure","socket","encrypted","originalUrl","absoluteUrl","query_string","extractNodeRequestData","globalObject","_startTransaction","firstHiddenTime","inputPromise","bindReporter","metric","observeAllUpdates","prevValue","isFinal","initMetric","entries","supportedEntryTypes","includes","isUnloading","listenersAdded","onPageHide","persisted","onHidden","cb","getFirstHidden","getLCP","onReport","reportAllChanges","report","firstHidden","entryHandler","onFinal","takeRecords","getTTFB","navigationEntry","getEntriesByType","entryType","getNavigationEntryFromPerformanceTiming","responseStart","_trackCLS","_trackLCP","_trackFID","_trackTTFB","MetricsInstrumentation","entryScriptSrc","entryScriptStartTimestamp","tracingInitMarkStartTime","scripts","_performanceCursor","addPerformanceNavigationTiming","_startChild","responseEnd","requestStart","addRequest","addNavigationSpans","measureStartTimestamp","measureEndTimestamp","addMeasureSpans","shouldRecord","resourceName","initiatorType","transferSize","encodedBodySize","decodedBodySize","addResourceSpans","_trackNavigator","timeOrigin_1","normalizedValue","setMeasurements","hadRecentInput","getCLS","connection","effectiveType","isMeasurementValue","rtt","downlink","deviceMemory","hardwareConcurrency","processingStart","perfMetrics","onFirstInputDelay","cancelable","requestTime","eventEnd","propertyIsEnumerable","defaultRequestInstrumentationOptions","traceFetch","traceXHR","tracingOrigins","registerRequestInstrumentation","shouldCreateSpanForRequest","urlMap","defaultShouldCreateSpan","origins","shouldCreateSpan","currentClientOptions","__span","setHttpStatus","append","fetchCallback","__sentry_xhr_span_id__","xhrCallback","DEFAULT_BROWSER_TRACING_OPTIONS","idleTimeout","markBackgroundTransactions","maxTransactionDuration","routingInstrumentation","startTransaction","startTransactionOnPageLoad","startTransactionOnLocationChange","startingUrl","pathname","BrowserTracing","_emitOptionsWarning","_getCurrentHub","_createRouteTransaction","beforeNavigate","parentContextFromHeader","metaName","traceparent","extractTraceparentData","getHeaderContext","expandedContext","modifiedContext","finalContext","idleTransaction","onScope","startIdleTransaction","registerBeforeFinishCallback","_metrics","addPerformanceEntries","maxDuration","adjustTransactionDuration","Express","_app","_methods","methods","patchMiddleware","routeMiddlewares","arity","__sentry_transaction","addExpressReqToTransaction","span_1","baseUrl","wrapUseArgs","originalAppCallback","Integrations","SidebarBrand","error_reporting_enabled","Sentry.init","error_reporting_environment","branding_logo","branding_title","SidebarUser","AvatarStyle","avatar","Tabs","TabsStyle","pages","currentPage","getNamedItem","page","TokenCopyButton","identifier","buttonClass","clipboard","writeText","COMMON_STYLES","PF","PFAddons","FA","PBGlobal","lastRenderedIndex","previousValues","previousLength","resolvedValue","Table","apiEndpoint","results","fullRow","row","columns","renderRows","BoundPoliciesList","policy_obj","pk","ApplicationViewPage","applicationSlug","slug","application","meta_icon","meta_publisher","ResponseType","FlowShellCard","flowBodyUrl","updateCard","errorMessage","flowBody","checkAutofocus","loadFormCode","setFormSubmitHandlers","newScript","autofocusElement","checkAutosubmit","updateFormAction","loading","Route","ROUTES","RouteMatch","fullUrl","RouterOutlet","navigate","CodeMirrorStyle","CodeMirrorTheme","activeUrl","defaultUrl","matchedRoute","SiteShell","_url","loadContent","URL","qs","URLSearchParams"],"mappings":"CAAC,WAGC,KAAI,uBAAwBA,UAA5B,CAEA,IAAIC,EAAc,aAAcC,SAAWA,OAAOC,SAASC,aACvDC,EAAsB,GACtBC,EAAgC,GAChCC,EAAwB,IAAIC,QAC5BC,EAAwB,IAAID,QAC5BE,EAAmB,IAAIF,QACvBG,EAAmB,IAAIH,QACvBI,EAA+B,IAAIJ,QACnCK,EAAQ,CACVC,QAAQ,GAENC,EAAQ,CACVC,K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